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
f3843a37f6
feat(orm): implement JSON null values and equality filter ( #464 )
...
* feat(orm): implement JSON null values and equality filter
* Update packages/orm/src/client/crud/validator/index.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/orm/src/utils/type-utils.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* address PR comments
* speed up test type-checking
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-04 20:54:04 +08:00
Yiming Cao
2d740f12e6
feat(orm): implement field omission ( #441 )
...
* feat: implement field omission
* Update tests/e2e/orm/client-api/omit.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix build
* fix build
* fix build
* update sample
* fix tests
* update
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-27 09:50:46 +08:00
Yiming Cao
023f1924a0
feat(policy): support arbitrary collection traversal from auth() ( #439 )
...
* feat(policy): support arbitrary collection traversal from `auth()`
* address PR comments
2025-11-25 17:54:47 -08:00
Yiming Cao
ed931da78c
fix(orm): reimplement typescript type display simplification ( #405 )
...
* fix(orm): reimplement typescript type display simplification
* update
2025-11-14 22:44:29 -08:00
Yiming Cao
94679dba7e
fix(orm): foreign key name mapping is not properly process in join ( #400 )
2025-11-14 13:15:18 -08:00