ymc9
1ba4e54066
refactor(schema): widen types for attributes, default, and foreignKeyFor in generated schema
...
The generated schema previously used `as const` on entire model/enum/typeDef
objects, causing TypeScript to deeply infer literal types for all nested
properties. This is unnecessary for `attributes`, `default`, and `foreignKeyFor`
which are only used at runtime, not in CRUD type computations.
Changes:
- Add type assertions (`as readonly AttributeApplication[]`, `as FieldDefault`,
`as readonly string[]`) to prevent deep const inference on these properties
- Extract `FieldDefault` type alias from `FieldDef` for cleaner generated code
- Change `FieldHasDefault` to use key existence check (`'default' extends keyof`)
instead of value type check, enabling the `default` widening
- Conditionally import `AttributeApplication` and `FieldDefault` only when used
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:51:43 -07:00
Yiming Cao
3e03ab1506
refactor: remove import from orm package in generated schema ( #2387 )
2026-02-19 18:16:13 -08:00
Copilot
5d1053f658
fix(schema): use type-only imports to prevent bundling server dependencies in client code ( #668 )
...
* Initial plan
* Fix: Change ModelResult/TypeDefResult imports to type-only imports in ts-schema-generator
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
* Regenerate test schemas with type-only imports
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
* Fix: Update bun runtime models.ts to use type-only imports
Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com>
2026-02-07 23:25:23 +08:00
Yiming Cao
209312a27b
fix(orm): properly handle literal array values in policy evaluation for postgres ( #628 )
2026-01-29 00:15:07 +08:00
Yiming Cao
84d1e60ae1
perf(orm): more aggressive caching of validation zod schemas ( #623 )
...
* WIP: more aggressive caching of validation zod schemas
* refactor: use a decorator-based approach for caching
* update
* update
* update
* update
* update
* remove object-type args from cache key
* update cache key
2026-01-27 11:30:05 +08:00
Yiming Cao
c4ee20a889
chore: regenerate ts schemas ( #583 )
2026-01-09 17:48:30 +08:00
Yiming Cao
ac4a68cd5d
refactor(orm): simplify model results typing ( #485 )
...
* refactor(orm): simplify model results typing
* add missing dev dependency
* update
* update
* update
2025-12-13 16:59:03 +08:00
Yiming Cao
96629ed817
fix(type-check): try improving type checking performance ( #475 )
...
* fix(type-check): try improving type checking performance
* update
* update
* update
* revert to ZenStackPromise
* update promise
2025-12-12 14:30:05 +08:00
Yiming Cao
02dec0c83a
feat(orm): enable JSON filter for typed-json fields; consolidate generation scripts ( #471 )
2025-12-06 15:25:31 +08:00
Yiming Cao
411524404e
refactor: move e2e orm tests to e2e project, fix bundle issues ( #285 )
...
* refactor: move e2e orm tests to e2e project, fix bundle issues
* add missing package
* include all tests
* more fixes
* update lockfile
* extract policy plugin to its own package
* fix lint
* addressing review comments
2025-10-03 21:06:19 -07:00