Skip to content

feat: add raw schema and db properties to FieldMeta#17

Merged
brainkim merged 1 commit intomainfrom
feat/raw-field-meta
Jan 4, 2026
Merged

feat: add raw schema and db properties to FieldMeta#17
brainkim merged 1 commit intomainfrom
feat/raw-field-meta

Conversation

@brainkim
Copy link
Copy Markdown
Member

@brainkim brainkim commented Jan 4, 2026

Summary

  • Add schema and db properties to FieldMeta for direct access to raw data
  • Mark existing cooked properties as deprecated (but still working)

New API (preferred)

const fields = Users.fields();

fields.email.schema     // ZodType - use Zod APIs for introspection
fields.email.db         // FieldDBMeta - raw db metadata
fields.email.db.unique  // boolean
fields.email.db.autoIncrement

Old API (deprecated, still works)

fields.email.unique     // boolean
fields.email.type       // "email" 
fields.email.required   // boolean

Migration

Users can migrate gradually:

// Before
const isGenerated = field.autoIncrement || field.inserted;

// After
const isGenerated = field.db.autoIncrement || field.db.inserted;

Notes

  • Additive and non-breaking
  • Deprecated properties will be removed in a future major version
  • Form-specific logic (type, required, etc.) will move to @b9g/forms

Related to #15

Test plan

  • All 584 tests pass
  • Type checking passes
  • Manual verification of new API

🤖 Generated with Claude Code

Add `schema` and `db` properties to FieldMeta for direct access to raw
Zod schema and database metadata. Mark existing cooked properties as
deprecated.

New API (preferred):
```typescript
fields.email.schema     // ZodType - use Zod APIs for introspection
fields.email.db         // FieldDBMeta - raw db metadata
fields.email.db.unique  // boolean
```

Old API (deprecated, still works):
```typescript
fields.email.unique     // boolean
fields.email.type       // "email"
fields.email.required   // boolean
```

This is additive and non-breaking. Deprecated properties will be removed
in a future major version when form logic moves to @b9g/forms.

Related to #15

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@brainkim
Copy link
Copy Markdown
Member Author

brainkim commented Jan 4, 2026

Too many cooks

@brainkim brainkim merged commit 1095b32 into main Jan 4, 2026
1 check passed
@brainkim brainkim deleted the feat/raw-field-meta branch January 4, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant