Commit graph

254 commits

Author SHA1 Message Date
github-actions[bot]
87644178b3
[CI] Bump version 3.7.1 (#2678)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-05-22 08:31:58 -07:00
Keath Pavlenko
1a4de21bdc
fix: detect policy plugin by stable id (#2663)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
2026-05-11 18:28:16 -07:00
Erwan JOLY
ce50d3ba48
fix(orm): coerce ISO strings on DateTime input, with strictDateInput opt-in (#2631) (#2632)
Some checks failed
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 05:56:25 -07:00
github-actions[bot]
b53e908a5d
[CI] Bump version 3.7.0 (#2656)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-05-07 22:35:13 -07:00
Yiming Cao
899e74daf6
test(regression): add regression test for issue #2639 (#2657)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 21:47:35 -07:00
Yiming Cao
7283d0e4d1
fix(orm): handle cyclic JSON typedef references in zod factory (#2654) (#2655)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 20:51:04 -07:00
Erwan JOLY
d1db37cee5
fix(orm): format Date as HH:MM:SS for @db.Time / @db.Timetz columns (#2633) (#2634) 2026-05-07 18:02:55 -07:00
Yiming Cao
d5e790061a
fix(orm, zod): allow null in inferred type of required Json fields (#2647) (#2649)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 19:14:07 -07:00
Yiming Cao
2a10bcae09
fix(orm): export UncheckedCreateInput/CheckedCreateInput and add XOR to UpdateInput (#2627)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 14:44:21 -07:00
Yiming Cao
d30ebade7f
fix(policy): resolve inherited fields in delegate sub-type create policy checks (#2623)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:23:37 -07:00
github-actions[bot]
80c0bd6d68
[CI] Bump version 3.6.4 (#2624)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-27 17:50:05 -07:00
github-actions[bot]
8609d5b3e3
[CI] Bump version 3.6.3 (#2613)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-24 21:21:24 -07:00
Yiming Cao
09ca875066
test(regression): add regression test for issue #2538 (#2607) 2026-04-22 16:32:01 -07:00
ymc9
fa94d38bb2 test(regression): add regression test for issue #2538
Adds a regression test for nested collection predicates in access
policies generating valid SQL (issue #2538).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 15:59:06 -07:00
Yiming Cao
40c45944cc
fix(orm): resolve implicit m2m join table schema for non-public PostgreSQL schemas (#2606)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 15:21:43 -07:00
Yiming Cao
1cf4345ffa
fix(policy): join base table when loading before-update entities for @@delegate sub-models (#2605)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 11:59:30 -07:00
github-actions[bot]
fd8db57ef2
[CI] Bump version 3.6.2 (#2604)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-22 10:54:53 -07:00
github-actions[bot]
a1374c042f
[CI] Bump version 3.6.1 (#2598)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-21 08:52:19 -07:00
Eugen Istoc
4e35bc163b
fix(orm): resolve delegate-inherited fields in cursor pagination (#2591) 2026-04-18 15:50:06 -07:00
Yiming Cao
09b96e4ed3
fix(orm): make JsonArray mutable to fix Zod schema type incompatibility (#2585) 2026-04-16 22:03:39 -07:00
Evgenii Novalov
36da18a17f
perf(orm): use EXISTS instead of COUNT subquery for to-one relation filters (#2579)
Co-authored-by: evgenovalov <evgenii@flowlity.com>
2026-04-15 13:07:16 -07:00
Yiming Cao
b8209d7eeb
chore: migrate from tsup to tsdown (#2580) 2026-04-15 12:13:34 -07:00
Lukas Kahwe Smith
3393e4cc21
@computed fields from mixin types (with) cause column does not exist error when the model is explicitly included (#2539)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 13:49:35 -07:00
github-actions[bot]
3dc922d6a9
[CI] Bump version 3.6.0 (#2571)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-11 19:18:20 -07:00
Yiming Cao
d22709fb55
fix(orm): prepend DISTINCT ON fields to ORDER BY for PostgreSQL compatibility (#2562)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com>
2026-04-06 16:47:45 -07:00
github-actions[bot]
df9b35ea64
[CI] Bump version 3.5.6 (#2560)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-06 13:14:51 -07:00
Yiming Cao
e9482fe34f
fix(orm): fix _count returning 0 for self-referential relations on delegate models (#2555)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 18:16:39 -07:00
Yiming Cao
744c760ac4
fix(orm): split jsonb_build_object calls exceeding PostgreSQL 100-arg limit (#2554)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:49:18 -07:00
Yiming Cao
dbb3474c65
fix(orm): support DbNull/JsonNull/AnyNull for nullable typed JSON fields (#2552)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:08:57 -07:00
github-actions[bot]
0495333ca3
[CI] Bump version 3.5.5 (#2553)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-03 14:13:43 -07:00
Yiming Cao
a81d8f4f52
test(regression): add regression test for issue #2410 (#2549)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 14:10:06 -07:00
github-actions[bot]
263074ce78
[CI] Bump version 3.5.4 (#2545)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-02 10:23:46 -07:00
Lukas Wolf
28ae08d739
fix(policy): currentModel and currentOperation inside of collection predicates (#2537) 2026-03-31 22:35:16 -07:00
ymc9
a0a6424c5d Revert "fix(policy): skip m2m update-policy check for newly created side on connect"
This reverts commit 59d302d199.
2026-03-31 20:13:14 -07:00
ymc9
59d302d199 fix(policy): skip m2m update-policy check for newly created side on connect
When creating a model with a nested many-to-many `connect`, the join table
insert triggered an update-policy check on the just-created entity. Because
the connection doesn't exist yet at check time, relation-based policies
(e.g. `parents?[id == auth().id]`) always evaluated to false, causing a
spurious "not updatable" error.

Fix by embedding a lightweight marker in the insert query's end-modifier
comment so the policy handler can identify the newly-created side and skip
its circular update check. The connected side's update policy is still
enforced. Adds regression test for issue #2531.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 20:06:12 -07:00
github-actions[bot]
80f364a2f0
[CI] Bump version 3.5.3 (#2533)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-30 18:40:07 -07:00
Yiming Cao
4686720178
fix(orm): fix PostgreSQL type mismatch when @db.Uuid fields used in policy expressions (#2532)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 18:39:53 -07:00
github-actions[bot]
e79ea0cbad
[CI] Bump version 3.5.2 (#2523) 2026-03-26 08:26:49 -07:00
ymc9
3145ba686b fix(cli): regression of CLI plugin resolution 2026-03-24 19:02:25 -07:00
github-actions[bot]
8b1046b2c7
[CI] Bump version 3.5.0 (#2511)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-23 16:31:36 -07:00
Yiming Cao
e6317dc9b5
fix(orm): disallow include on models without relation fields (#2508)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 20:05:55 -07:00
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
github-actions[bot]
2c32dc329e
[CI] Bump version 3.4.6 (#2477)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-11 11:40:16 -07:00
Yiming Cao
31776a890a
fix(orm): use IS operator for null comparisons in filters (#2475)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 10:57:21 -07:00
Pavel Kudinov
20832441c7
fix(policy): handle DefaultInsertValueNode in createManyAndReturn (#2461)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 16:06:28 -08:00
Yiming Cao
00c53d7fed
fix(sdk): correctly handle mixin fields for delegate model inheritance (#2456) 2026-03-07 10:04:18 -08:00
claude[bot]
956a64ddbe fix(test): correct delegate discriminator enum values to match model names
- Change DataType enum from TEXT/NUMBER to DataText/DataNumber
- Remove explicit dataType field from test as it's auto-set by delegate discriminator
- Fixes MySQL test failure: delegate discriminators must use model names

Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com>
2026-03-07 17:30:46 +00:00
claude[bot]
ffa17203f3 fix(test): add missing dataType field in issue-2351 regression test
The test was failing on MySQL because the dataType enum field was required
but not provided when creating DataText records. MySQL is stricter about
enum validation than SQLite, causing 'Data truncated for column' errors.

Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com>
2026-03-07 17:14:26 +00:00
github-actions[bot]
bd2b111b8e
[CI] Bump version 3.4.5 (#2457)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-06 22:26:46 -08:00
ymc9
4a99088bce fix(sdk): correctly handle mixin fields for delegate model inheritance
Fields inherited via a mixin type on a delegate base model were not
getting their `originModel` set in the generated schema, causing the
ORM to include them in the wrong table's INSERT statement.

Introduces `getOwnedFields` and `getDelegateOriginModel` helpers in
`model-utils.ts` and uses them in both `ts-schema-generator` and
`prisma-schema-generator`, replacing the previous logic that only
checked `field.$container` directly.

Fixes #2351

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 22:25:10 -08:00