viborm 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/adapters.d.mts +1 -1
  2. package/dist/adapters.mjs +1 -1
  3. package/dist/builder-CUyS5pxN.mjs +2 -0
  4. package/dist/builder-CUyS5pxN.mjs.map +1 -0
  5. package/dist/bun-sql.d.mts +1 -1
  6. package/dist/bun-sql.mjs +1 -1
  7. package/dist/bun-sqlite.d.mts +1 -1
  8. package/dist/bun-sqlite.mjs +1 -1
  9. package/dist/cache/cloudflare-kv.d.mts +1 -1
  10. package/dist/cache/memory.d.mts +1 -1
  11. package/dist/cache.d.mts +1 -1
  12. package/dist/cache.mjs +1 -1
  13. package/dist/chain-CoOL8l4W.mjs +2 -0
  14. package/dist/chain-CoOL8l4W.mjs.map +1 -0
  15. package/dist/cli.mjs +1 -1
  16. package/dist/{client-C4vu0G3p.d.mts → client-DMbHPHC_.d.mts} +1 -1
  17. package/dist/client-Db-sVg93.mjs +2 -0
  18. package/dist/client-Db-sVg93.mjs.map +1 -0
  19. package/dist/{client-BJuTpcYj.mjs → client-Dpgesimv.mjs} +3 -3
  20. package/dist/{client-BJuTpcYj.mjs.map → client-Dpgesimv.mjs.map} +1 -1
  21. package/dist/client.d.mts +2 -2
  22. package/dist/client.mjs +1 -1
  23. package/dist/config.d.mts +1 -1
  24. package/dist/config.mjs +1 -1
  25. package/dist/d1.d.mts +1 -1
  26. package/dist/d1.mjs +1 -1
  27. package/dist/driver.d.mts +1 -1
  28. package/dist/every-B1gLSYOW.mjs +2 -0
  29. package/dist/{every-CyllpuCG.mjs.map → every-B1gLSYOW.mjs.map} +1 -1
  30. package/dist/{identifier-conversion-BVE8cfFA.mjs → identifier-conversion-D3oCaSia.mjs} +2 -2
  31. package/dist/{identifier-conversion-BVE8cfFA.mjs.map → identifier-conversion-D3oCaSia.mjs.map} +1 -1
  32. package/dist/{index-BCPc_r4I.d.mts → index-B4Bo2kEi.d.mts} +694 -448
  33. package/dist/index.d.mts +2 -2
  34. package/dist/index.mjs +1 -1
  35. package/dist/instrumentation.d.mts +1 -1
  36. package/dist/instrumentation.mjs +1 -1
  37. package/dist/{libsql-CcKrXiun.mjs → libsql-C4sm2U20.mjs} +2 -2
  38. package/dist/{libsql-CcKrXiun.mjs.map → libsql-C4sm2U20.mjs.map} +1 -1
  39. package/dist/libsql.d.mts +1 -1
  40. package/dist/libsql.mjs +1 -1
  41. package/dist/{memory-B0HOEpPu.mjs → memory-BXOh0pq2.mjs} +2 -2
  42. package/dist/{memory-B0HOEpPu.mjs.map → memory-BXOh0pq2.mjs.map} +1 -1
  43. package/dist/migrations/mysql.d.mts +4 -4
  44. package/dist/migrations/mysql.mjs +1 -1
  45. package/dist/migrations/postgres.d.mts +4 -4
  46. package/dist/migrations/postgres.mjs +1 -1
  47. package/dist/migrations/sqlite.d.mts +4 -4
  48. package/dist/migrations/sqlite.mjs +1 -1
  49. package/dist/migrations/tenant.d.mts +2 -2
  50. package/dist/migrations/tenant.mjs +1 -1
  51. package/dist/migrations.d.mts +4 -4
  52. package/dist/migrations.mjs +1 -1
  53. package/dist/model-u8Ug971J.mjs.map +1 -1
  54. package/dist/{mysql-sGTzkV2q.mjs → mysql-BR0XTumr.mjs} +2 -2
  55. package/dist/{mysql-sGTzkV2q.mjs.map → mysql-BR0XTumr.mjs.map} +1 -1
  56. package/dist/mysql-adapter-BZtZrWeX.mjs +2 -0
  57. package/dist/mysql-adapter-BZtZrWeX.mjs.map +1 -0
  58. package/dist/mysql2.d.mts +1 -1
  59. package/dist/mysql2.mjs +1 -1
  60. package/dist/neon-http.d.mts +1 -1
  61. package/dist/neon-http.mjs +1 -1
  62. package/dist/{object-store-Dq6MthBh.d.mts → object-store-BI1YgcZ9.d.mts} +3 -3
  63. package/dist/on.d.mts +1 -1
  64. package/dist/on.mjs +1 -1
  65. package/dist/on.mjs.map +1 -1
  66. package/dist/ordering.d.mts +47 -36
  67. package/dist/ordering.mjs +1 -1
  68. package/dist/ordering.mjs.map +1 -1
  69. package/dist/permissions.d.mts +16 -9
  70. package/dist/permissions.mjs +1 -1
  71. package/dist/permissions.mjs.map +1 -1
  72. package/dist/pg.d.mts +1 -1
  73. package/dist/pg.mjs +1 -1
  74. package/dist/pglite.d.mts +1 -1
  75. package/dist/pglite.mjs +1 -1
  76. package/dist/planetscale.d.mts +1 -1
  77. package/dist/planetscale.mjs +1 -1
  78. package/dist/{planner-CTJ_dhbu.d.mts → planner-rsXqQbJR.d.mts} +1 -1
  79. package/dist/{postgres-C2uUUh0t.mjs → postgres-CrjBX4Yj.mjs} +2 -2
  80. package/dist/{postgres-C2uUUh0t.mjs.map → postgres-CrjBX4Yj.mjs.map} +1 -1
  81. package/dist/{postgres-adapter-CK1Ytkt1.mjs → postgres-adapter--PJvhRSM.mjs} +2 -2
  82. package/dist/{postgres-adapter-CK1Ytkt1.mjs.map → postgres-adapter--PJvhRSM.mjs.map} +1 -1
  83. package/dist/postgres-adapter-BJcelBCx.mjs +2 -0
  84. package/dist/postgres-adapter-BJcelBCx.mjs.map +1 -0
  85. package/dist/postgres.d.mts +1 -1
  86. package/dist/postgres.mjs +1 -1
  87. package/dist/{result-shape-B_hdiom4.mjs → result-shape-BPdZ1rUk.mjs} +2 -2
  88. package/dist/{result-shape-B_hdiom4.mjs.map → result-shape-BPdZ1rUk.mjs.map} +1 -1
  89. package/dist/rows-C4hPsLfi.mjs +2 -0
  90. package/dist/rows-C4hPsLfi.mjs.map +1 -0
  91. package/dist/schema/json.d.mts +7 -2
  92. package/dist/schema/json.mjs +1 -1
  93. package/dist/schema/json.mjs.map +1 -1
  94. package/dist/{schema-DYPfTOQl.mjs → schema-C8_nS6Ub.mjs} +2 -2
  95. package/dist/{schema-DYPfTOQl.mjs.map → schema-C8_nS6Ub.mjs.map} +1 -1
  96. package/dist/{schema-introspection-DilpMD0-.mjs → schema-introspection-BiG5153d.mjs} +2 -2
  97. package/dist/{schema-introspection-DilpMD0-.mjs.map → schema-introspection-BiG5153d.mjs.map} +1 -1
  98. package/dist/schema.d.mts +2 -2
  99. package/dist/schema.mjs +1 -1
  100. package/dist/select-assembly-Dcaqm09G.mjs.map +1 -1
  101. package/dist/soft-delete.d.mts +10 -10
  102. package/dist/soft-delete.mjs.map +1 -1
  103. package/dist/sqlite-adapter-CMRvEsOv.mjs +2 -0
  104. package/dist/sqlite-adapter-CMRvEsOv.mjs.map +1 -0
  105. package/dist/sqlite3.d.mts +1 -1
  106. package/dist/sqlite3.mjs +1 -1
  107. package/dist/{to-many-5gt2AWLE.mjs → to-many-CMK2Ys4N.mjs} +2 -2
  108. package/dist/{to-many-5gt2AWLE.mjs.map → to-many-CMK2Ys4N.mjs.map} +1 -1
  109. package/dist/types-C4v6iAmY.mjs.map +1 -1
  110. package/dist/{utils-CmNRGkRq.mjs → utils-BLIPe1Cb.mjs} +2 -2
  111. package/dist/{utils-CmNRGkRq.mjs.map → utils-BLIPe1Cb.mjs.map} +1 -1
  112. package/dist/validation.d.mts +1 -1
  113. package/dist/validation.mjs +1 -1
  114. package/dist/validator-CtSM_qvW.mjs +2 -0
  115. package/dist/validator-CtSM_qvW.mjs.map +1 -0
  116. package/dist/version-BPr1CKHw.mjs +2 -0
  117. package/dist/{version-COPScbnP.mjs.map → version-BPr1CKHw.mjs.map} +1 -1
  118. package/package.json +17 -17
  119. package/dist/builder-CK7lE3ee.mjs +0 -2
  120. package/dist/builder-CK7lE3ee.mjs.map +0 -1
  121. package/dist/chain-BJa7ew8x.mjs +0 -2
  122. package/dist/chain-BJa7ew8x.mjs.map +0 -1
  123. package/dist/client-BTF53MwW.mjs +0 -2
  124. package/dist/client-BTF53MwW.mjs.map +0 -1
  125. package/dist/every-CyllpuCG.mjs +0 -2
  126. package/dist/mysql-adapter-CWisQgdc.mjs +0 -2
  127. package/dist/mysql-adapter-CWisQgdc.mjs.map +0 -1
  128. package/dist/postgres-adapter-BnqAsfkG.mjs +0 -2
  129. package/dist/postgres-adapter-BnqAsfkG.mjs.map +0 -1
  130. package/dist/rows-DVyzZyFn.mjs +0 -2
  131. package/dist/rows-DVyzZyFn.mjs.map +0 -1
  132. package/dist/sqlite-adapter-BHx--tnz.mjs +0 -2
  133. package/dist/sqlite-adapter-BHx--tnz.mjs.map +0 -1
  134. package/dist/validator-CYKdGTvX.mjs +0 -2
  135. package/dist/validator-CYKdGTvX.mjs.map +0 -1
  136. package/dist/version-COPScbnP.mjs +0 -2
@@ -1554,6 +1554,14 @@ type AtLeastOne<Value> = { [Key in keyof Value]-?: Required<Pick<Value, Key>> &
1554
1554
  */
1555
1555
  type OrdinaryJunctionOverrides = AtLeastOne<{
1556
1556
  readonly table?: string;
1557
+ /**
1558
+ * The declared model that IS the junction, as its thunk: the two overloads of
1559
+ * `.through()` write `table` or this, never both. `any`-returning for the same
1560
+ * reason as a relation's getter (above): a resolved return type here is
1561
+ * circular in the mutually recursive consts a junction model always forms.
1562
+ */
1563
+ readonly model?: () => any;
1564
+ /** With `model`, the to-one relations of the junction model each side reads. */
1557
1565
  readonly source?: string;
1558
1566
  readonly target?: string;
1559
1567
  readonly onDelete?: JunctionSideActions;
@@ -1637,6 +1645,8 @@ type RelationInternal<State$1> = {
1637
1645
  readonly state: State$1;
1638
1646
  /** Variant key for a variant target; omitted for a model target. */
1639
1647
  readonly settleTarget: (variantKey?: string) => unknown;
1648
+ /** The `.through(() => model)` thunk's answer, read once; a model-target collection's only. */
1649
+ readonly settleJunctionModel?: () => unknown;
1640
1650
  };
1641
1651
  /** Any relation terminal, matched by its internal brand. */
1642
1652
  type AnyRelation = {
@@ -3826,6 +3836,40 @@ type ReverseCandidates<SourceModel, TargetModel$2, CandidateKey, AskingName> = C
3826
3836
  */
3827
3837
  type ProvenPartnerKey<SourceModel, FieldKey, R$1> = ForwardCandidates<SourceModel, FieldKey, R$1> extends infer Candidate ? [Candidate] extends [keyof RelationsOf$1<TargetModelOf<R$1>>] ? IsSingleKey<Candidate> extends true ? IsExactly<ReverseCandidates<SourceModel, TargetModelOf<R$1>, Candidate, RelationName$1<R$1>>, FieldKey> extends true ? Candidate : never : never : never : never;
3828
3838
  type ProvenPartner<SourceModel, FieldKey, R$1> = ProvenPartnerKey<SourceModel, FieldKey, R$1> extends infer Key ? [Key] extends [keyof RelationsOf$1<TargetModelOf<R$1>>] ? RelationsOf$1<TargetModelOf<R$1>>[Key] : never : never;
3839
+ /**
3840
+ * The declared model holding a slot's junction, read from whichever endpoint
3841
+ * declared it: `never` for a string `.through()`, no junction at all, and
3842
+ * anything but a to-many slot. It stands apart from the membership because only
3843
+ * a node that names `$through` needs it, and it reads the getter it finds, which
3844
+ * is what the state keeping it unresolved until now is for.
3845
+ */
3846
+ type JunctionModelOf<SourceModel, FieldKey, R$1> = Cardinality<R$1> extends "many" ? DeclaredJunctionModel<R$1> extends infer Declared ? [Declared] extends [never] ? DeclaredJunctionModel<ProvenPartner<SourceModel, FieldKey, R$1>> : Declared : never : never;
3847
+ type DeclaredJunctionModel<R$1> = R$1 extends {
3848
+ readonly "~": {
3849
+ readonly state: {
3850
+ readonly junction: {
3851
+ readonly model: () => infer M;
3852
+ };
3853
+ };
3854
+ };
3855
+ } ? M : never;
3856
+ /**
3857
+ * The junction state a declaring endpoint holds, `.source()` / `.target()`
3858
+ * names included where it states them, read from either endpoint.
3859
+ */
3860
+ type JunctionFactsOf<SourceModel, FieldKey, R$1> = [DeclaredJunctionModel<R$1>] extends [never] ? ProvenPartner<SourceModel, FieldKey, R$1> extends {
3861
+ readonly "~": {
3862
+ readonly state: {
3863
+ readonly junction: infer Facts;
3864
+ };
3865
+ };
3866
+ } ? Facts : never : R$1 extends {
3867
+ readonly "~": {
3868
+ readonly state: {
3869
+ readonly junction: infer Facts;
3870
+ };
3871
+ };
3872
+ } ? Facts : never;
3829
3873
  type ScalarPrimaryKeyKeys<M$1> = { [Key in keyof ScalarsOf<M$1>]: ScalarsOf<M$1>[Key] extends Scalar ? [ScalarsOf<M$1>[Key]["~"]["state"]["isId"]] extends [true] ? Key : never : never }[keyof ScalarsOf<M$1>];
3830
3874
  type HasCompleteScalarPrimaryKey<M$1> = IsSingleKey<ScalarPrimaryKeyKeys<M$1>>;
3831
3875
  type HasCompleteCompoundPrimaryKey<M$1> = CompoundIdsOf<M$1> extends infer Ids ? [Ids] extends [Record<PropertyKey, unknown>] ? string extends keyof Ids ? false : IsSingleKey<keyof Ids> extends true ? Ids[keyof Ids] extends {
@@ -3923,6 +3967,61 @@ type DerivedNestedKeys<SourceModel, FieldKey, R$1> = StaticResolvedMembership<So
3923
3967
  */
3924
3968
  type TargetModel$1<S$1 extends RelationState> = TargetGetter<S$1> extends (() => infer T) ? T extends AnyModel ? T : never : never;
3925
3969
  type GetTargetSchemas<S$1 extends RelationState> = ModelSchemas<TargetModel$1<S$1>>;
3970
+ /**
3971
+ * The scalars of a link row a `$through` filter may test: each field's own
3972
+ * filter, and nothing else, so a relation inside it is an unknown key.
3973
+ */
3974
+ type LinkFilterSchema<M$1 extends AnyModel> = V$1.Object<V$1.FromObject<ModelSchemas<M$1>["scalars"], "filter">["entries"]>;
3975
+ /** A target's `where` with `$through` beside it, the input it adds and no more. */
3976
+ type WhereWithLinkFilter<Where extends VibSchema<any, any>, M$1 extends AnyModel> = VibSchema<Where[" vibInferred"]["0"] & {
3977
+ $through?: LinkFilterSchema<M$1>[" vibInferred"]["0"];
3978
+ }, Where[" vibInferred"]["1"]>;
3979
+ /**
3980
+ * The columns a `$through` may name: the junction model's scalars but the two
3981
+ * sides' own. The sides are the to-ones `.source()` / `.target()` named, else
3982
+ * the to-ones aimed at either endpoint, read here and not from the resolved
3983
+ * edge, which types cannot reach.
3984
+ */
3985
+ type LinkMemberFields<Facts, M$1, Source, Target$1> = { [K in keyof RelationsOf$1<M$1>]: ForeignKeyOf<RelationsOf$1<M$1>[K]> extends {
3986
+ readonly fields: infer Fields extends readonly string[];
3987
+ } ? Facts extends {
3988
+ readonly source: string;
3989
+ readonly target: string;
3990
+ } ? K extends Facts["source"] | Facts["target"] ? Fields[number] : never : TargetModelOf<RelationsOf$1<M$1>[K]> extends Source | Target$1 ? Fields[number] : never : never }[keyof RelationsOf$1<M$1>];
3991
+ type LinkScalars<M$1 extends AnyModel> = ModelSchemas<M$1>["scalars"];
3992
+ type LinkEntries<M$1 extends AnyModel> = V$1.FromObject<LinkScalars<M$1>, "create">["entries"];
3993
+ /** A scalar with neither a default nor a null to stand on, as `create` reads it. */
3994
+ type RequiredLinkKeys<M$1 extends AnyModel> = { [K in keyof M$1["~"]["state"]["scalars"]]: M$1["~"]["state"]["scalars"][K]["~"]["state"]["optional"] extends true ? never : K }[keyof M$1["~"]["state"]["scalars"]];
3995
+ /** What `$through` may state, the keys a create requires required here too. */
3996
+ type LinkWriteInput<M$1 extends AnyModel, Members$1> = { [K in Exclude<keyof LinkEntries<M$1>, Members$1 | RequiredLinkKeys<M$1>>]?: V$1.Input<LinkEntries<M$1>[K]> } & { [K in Exclude<Extract<keyof LinkEntries<M$1>, RequiredLinkKeys<M$1>>, Members$1>]: V$1.Input<LinkEntries<M$1>[K]> };
3997
+ /** The columns one slot's `$through` may name, for the literal walk to read. */
3998
+ type LinkWriteKeys<Source, Key$1, R$1> = JunctionModelOf<Source, Key$1, R$1> extends infer M extends AnyModel ? Exclude<keyof M["~"]["state"]["scalars"], LinkMemberFields<JunctionFactsOf<Source, Key$1, R$1>, M, Source, TargetModelOf<R$1>>> : never;
3999
+ /**
4000
+ * A nested write's target input on a slot a declared model holds: `$through` is
4001
+ * optional where every other column of the link can fill itself, and required
4002
+ * where one cannot. Every other slot reads its target's own schema unchanged.
4003
+ */
4004
+ type WithLinkWrite<Schema$4 extends VibSchema<any, any>, Source, Key$1, S$1> = [JunctionModelOf<Source, Key$1, {
4005
+ readonly "~": {
4006
+ readonly state: S$1;
4007
+ };
4008
+ }>] extends [never] ? Schema$4 : JunctionModelOf<Source, Key$1, {
4009
+ readonly "~": {
4010
+ readonly state: S$1;
4011
+ };
4012
+ }> extends infer M extends AnyModel ? LinkWriteInput<M, LinkMemberFields<JunctionFactsOf<Source, Key$1, {
4013
+ readonly "~": {
4014
+ readonly state: S$1;
4015
+ };
4016
+ }>, M, Source, TargetModelOf<{
4017
+ readonly "~": {
4018
+ readonly state: S$1;
4019
+ };
4020
+ }>>> extends infer Written ? VibSchema<Schema$4[" vibInferred"]["0"] & (Record<never, never> extends Written ? {
4021
+ $through?: Written;
4022
+ } : {
4023
+ $through: Written;
4024
+ }), Schema$4[" vibInferred"]["1"]> : Schema$4 : Schema$4;
3926
4025
  //#endregion
3927
4026
  //#region src/validation/relations/count-filter.d.ts
3928
4027
  /**
@@ -4106,15 +4205,15 @@ type ToOneCreateSchema<Source extends AnyModel, Key$1, S$1 extends RelationState
4106
4205
  * relation-bearing rows as an ordered record series.
4107
4206
  */
4108
4207
  type ToManyCreateSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Object<{
4109
- create: () => V$1.SingleOrArray<ProjectedNestedCreate<Source, Key$1, S$1>>;
4208
+ create: () => V$1.SingleOrArray<WithLinkWrite<ProjectedNestedCreate<Source, Key$1, S$1>, Source, Key$1, S$1>>;
4110
4209
  createMany: NestedCreateManySchema<Source, Key$1, S$1>;
4111
- connect: () => V$1.SingleOrArray<GetTargetSchemas<S$1>["core"]["whereUnique"]>;
4112
- connectOrCreate: () => V$1.SingleOrArray<V$1.Object<{
4210
+ connect: () => V$1.SingleOrArray<WithLinkWrite<GetTargetSchemas<S$1>["core"]["whereUnique"], Source, Key$1, S$1>>;
4211
+ connectOrCreate: () => V$1.SingleOrArray<WithLinkWrite<V$1.Object<{
4113
4212
  where: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
4114
4213
  create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
4115
4214
  }, {
4116
4215
  partial: false;
4117
- }>>;
4216
+ }>, Source, Key$1, S$1>>;
4118
4217
  upsert: () => V$1.SingleOrArray<V$1.Object<{
4119
4218
  where: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
4120
4219
  create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
@@ -4139,7 +4238,7 @@ interface NormalizedRecurrence {
4139
4238
  readonly selective?: true;
4140
4239
  /**
4141
4240
  * A projection's: its caller states that each outer row's walk reaches few
4142
- * rows of the table ({@link OUTPUT_BUDGET}).
4241
+ * rows of the table ({@link PROJECTION_OPTIONS}).
4143
4242
  */
4144
4243
  readonly fewRows?: true;
4145
4244
  }
@@ -4160,11 +4259,11 @@ type GraphWalk = {
4160
4259
  readonly preventCycles?: true;
4161
4260
  };
4162
4261
  /**
4163
- * A projection's bag adds the output budget. A `where` filter reads the
4164
- * closure as a set and decodes no occurrence, so it has nothing to bound and
4165
- * refuses the key by its own type.
4262
+ * A projection's bag adds its output budget and `fewRows`. A `where` filter
4263
+ * reads the closure as a set and decodes no occurrence, so it has nothing to
4264
+ * bound nor to read by key, and refuses both keys by its own type.
4166
4265
  */
4167
- type OutputBudget = {
4266
+ type ProjectionOptions = {
4168
4267
  readonly maxOccurrences?: number;
4169
4268
  readonly fewRows?: boolean;
4170
4269
  };
@@ -4177,8 +4276,8 @@ type Selective = {
4177
4276
  };
4178
4277
  type ForeignKeyFilterRecurse = true | (ForeignKeyWalk & Selective);
4179
4278
  type GraphFilterRecurse = true | (GraphWalk & Selective);
4180
- type ForeignKeyRecurse = true | (ForeignKeyWalk & OutputBudget);
4181
- type GraphRecurse = true | (GraphWalk & OutputBudget);
4279
+ type ForeignKeyRecurse = true | (ForeignKeyWalk & ProjectionOptions);
4280
+ type GraphRecurse = true | (GraphWalk & ProjectionOptions);
4182
4281
  type ForeignKeyRecurrenceSchema = V$1.Schema<ForeignKeyRecurse, NormalizedRecurrence>;
4183
4282
  type GraphRecurrenceSchema = V$1.Schema<GraphRecurse, NormalizedRecurrence>;
4184
4283
  type ForeignKeyFilterRecurrenceSchema = V$1.Schema<ForeignKeyFilterRecurse, NormalizedRecurrence>;
@@ -4330,7 +4429,21 @@ type ToOneFilterSchema<Source extends AnyModel, Key$1, S$1 extends RelationState
4330
4429
  * To-many filter: { some?, every?, none? }, or the recursive filter.
4331
4430
  * Uses thunks for lazy evaluation - getTargetWhereSchema already returns thunk
4332
4431
  */
4333
- type ToManyFilterSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [V$1.Object<Quantifiers<S$1> & NoClosure>, RecursiveFilterSchema<Source, Key$1, S$1>]>;
4432
+ type ToManyFilterSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [V$1.Object<LinkedQuantifiers<Source, Key$1, S$1> & NoClosure>, RecursiveFilterSchema<Source, Key$1, S$1>]>;
4433
+ /** {@link Quantifiers} on a slot a declared model holds: each also takes `$through`. */
4434
+ type LinkedQuantifiers<Source, Key$1, S$1 extends RelationState> = [JunctionModelOf<Source, Key$1, {
4435
+ readonly "~": {
4436
+ readonly state: S$1;
4437
+ };
4438
+ }>] extends [never] ? Quantifiers<S$1> : JunctionModelOf<Source, Key$1, {
4439
+ readonly "~": {
4440
+ readonly state: S$1;
4441
+ };
4442
+ }> extends infer M extends AnyModel ? {
4443
+ some: () => WhereWithLinkFilter<TargetWhereSchema<S$1>, M>;
4444
+ every: () => WhereWithLinkFilter<TargetWhereSchema<S$1>, M>;
4445
+ none: () => WhereWithLinkFilter<TargetWhereSchema<S$1>, M>;
4446
+ } : Quantifiers<S$1>;
4334
4447
  //#endregion
4335
4448
  //#region src/drivers/types.d.ts
4336
4449
  /**
@@ -4944,11 +5057,11 @@ interface BatchPayload {
4944
5057
  /** Literal selections are required; runtime choices expose optional fields. */
4945
5058
  type SelectedFields<Selection$1, Fields$1> = { [K in keyof Selection$1 & keyof Fields$1 as Selection$1[K] extends true | object ? K : never]: Fields$1[K] } & { [K in keyof Selection$1 & keyof Fields$1 as Selection$1[K] extends true | object ? never : Extract<Selection$1[K], true | object> extends never ? never : K]?: Fields$1[K] };
4946
5059
  type SelectedCountResult<Selection$1> = Prettify<SelectedFields<Selection$1, { [K in keyof Selection$1]: number }>>;
4947
- type CountResultType<Args, Selected = (Args extends {
5060
+ type CountResultType<Args, Selected$1 = (Args extends {
4948
5061
  select: infer Selection;
4949
5062
  } ? SelectedCountResult<Selection> : never)> = Args extends {
4950
5063
  select: unknown;
4951
- } ? keyof Selected extends never ? number : Selected : number;
5064
+ } ? keyof Selected$1 extends never ? number : Selected$1 : number;
4952
5065
  /**
4953
5066
  * The non-recursive part of a model that result inference can compare safely.
4954
5067
  *
@@ -5330,6 +5443,19 @@ type InferRelationCountSelection<S$1 extends ModelState, Selection$1> = Selectio
5330
5443
  * Result when include is provided - base result + included relations
5331
5444
  */
5332
5445
  type InferIncludeResult<S$1 extends ModelState, Include$1, ClientDefaults = never> = Prettify<InferModelOutput<S$1> & { [K in keyof Include$1 & keyof S$1["relations"] as Include$1[K] extends true | object ? K : never]: S$1["relations"][K] extends AnyRelation ? InferSelectedRelation<S$1, K, S$1["relations"][K], Include$1[K], ClientDefaults> : never } & InferRelationCountSelection<S$1, Include$1>>;
5446
+ /** What a node asks of its link row: `never` where it asks for nothing. */
5447
+ type NodeLinkRow<Node> = NodeSelect<Node> extends {
5448
+ readonly $through: infer Asked;
5449
+ } ? Asked : NodeInclude<Node> extends {
5450
+ readonly $through: infer Asked;
5451
+ } ? Asked : never;
5452
+ /**
5453
+ * A node's row beside the columns its `$through` selects of the junction model.
5454
+ * Only a node that names the key reaches the junction model's type at all.
5455
+ */
5456
+ type WithLinkRow<Source, K$1, R$1 extends AnyRelation, Node, Row$1, ClientDefaults> = [NodeLinkRow<Node>] extends [never] ? Row$1 : NodeLinkRow<Node> extends true | object ? JunctionModelOf<Source, K$1, R$1> extends infer M ? M extends Model$1<infer State> ? State extends ModelState ? Prettify<Row$1 & {
5457
+ $through: NodeLinkRow<Node> extends true ? ApplyOmit<InferModelOutput<State>, ResolveClientOmit<M, ClientDefaults>> : InferSelectInclude<State, NodeLinkRow<Node>, NodeSelect<NodeLinkRow<Node>>, never, ClientDefaults>;
5458
+ }> : Row$1 : Row$1 : Row$1 : Row$1;
5333
5459
  /**
5334
5460
  * A relation node in `select`/`include` position: `{ select }`, `{ include }`,
5335
5461
  * `{ omit }`, pagination-only (`{ where, take, … }`), or any combination the
@@ -5337,7 +5463,7 @@ type InferIncludeResult<S$1 extends ModelState, Include$1, ClientDefaults = neve
5337
5463
  * selection. An unselected node applies it to the default/include shape.
5338
5464
  * Pagination-only nodes fall through to the full relation payload.
5339
5465
  */
5340
- type InferRelationNodeResult<S$1 extends ModelState, K$1, R$1 extends AnyRelation, Node, ClientDefaults = never> = OrHidden<WrapRelationNode<S$1, K$1, R$1, ApplyRecurrence<S$1, K$1, R$1, Node, InferSelectInclude<GetTargetModelState<R$1>, Node, NodeSelect<Node>, MergeClientOmit<ResolveClientOmit<GetTargetModel<R$1>, ClientDefaults>, NodeOmit<Node>>, ClientDefaults>>>, R$1, ClientDefaults>;
5466
+ type InferRelationNodeResult<S$1 extends ModelState, K$1, R$1 extends AnyRelation, Node, ClientDefaults = never> = OrHidden<WrapRelationNode<S$1, K$1, R$1, ApplyRecurrence<S$1, K$1, R$1, Node, WithLinkRow<SourceModelOf<S$1>, K$1, R$1, Node, InferSelectInclude<GetTargetModelState<R$1>, Node, NodeSelect<Node>, MergeClientOmit<ResolveClientOmit<GetTargetModel<R$1>, ClientDefaults>, NodeOmit<Node>>, ClientDefaults>, ClientDefaults>>>, R$1, ClientDefaults>;
5341
5467
  /**
5342
5468
  * Extract scalar keys from a ModelShape
5343
5469
  */
@@ -5862,7 +5988,7 @@ type RowsContribution = {
5862
5988
  * read row by row is not bounded: from a row the member admits, it reaches
5863
5989
  * such rows already. `permissions`' `tenant` states its tenant here.
5864
5990
  */
5865
- readonly bound?: {
5991
+ readonly confine?: {
5866
5992
  readonly [model: string]: ScalarFields;
5867
5993
  };
5868
5994
  };
@@ -6281,6 +6407,30 @@ type ProjectedModelOperations<C$1 extends VibORMConfig, ClientDefaults, Controls
6281
6407
  /** Cached views retain projections, but expose only read operations and Promises. */
6282
6408
  type CachedProjectedOperations<C$1 extends VibORMConfig, ModelName$1 extends keyof ClientSchema<C$1>, ClientDefaults, Controls$1, ModelMethods> = typeof projectedModelState extends keyof ModelMethods ? NonNullable<ModelMethods[typeof projectedModelState]> extends infer Projections extends Record<string, ProjectionModelsConstraint> ? UnionToIntersection<{ [Key in keyof Projections & string]: { readonly [O in Extract<ProjectedOperation, CacheableOperations>]: ProjectedMethod<O, C$1, ModelName$1, ClientDefaults, Controls$1, Projections[Key], Key, false> } }[keyof Projections & string]> : unknown : unknown;
6283
6409
  type UnionToIntersection<Value> = (Value extends unknown ? (value: Value) => void : never) extends ((value: infer Intersection) => void) ? Intersection : never;
6410
+ /**
6411
+ * Every key's arm at once (a chain declaring two keys admits and reads
6412
+ * both). Each arm is boxed, so a union inside one (`move`'s placements) is
6413
+ * not intersected with itself.
6414
+ */
6415
+ type EachKey<Arms extends Record<string, [unknown]>> = (UnionToIntersection<Arms[keyof Arms]> & [unknown])[0];
6416
+ /** The projection facts a delegate's chain declares, keyed by the key. */
6417
+ type DelegateProjections<Delegate> = typeof projectedModelState extends keyof Delegate ? NonNullable<Delegate[typeof projectedModelState]> : never;
6418
+ /**
6419
+ * A model method's arguments on the delegate it is called on: `Payload`,
6420
+ * whose every `select` and `include` admits each key the delegate's chain
6421
+ * declares, as the projected overloads of the operation it delegates to
6422
+ * admit it.
6423
+ */
6424
+ type DelegateProjectedArgs<Delegate, Payload, ModelName$1> = DelegateProjections<Delegate> extends infer Projections extends Record<string, ProjectionModelsConstraint> ? [Projections] extends [never] ? Payload : EachKey<{ [Key in keyof Projections & string]: [ProjectedArgs<Payload, Projections[Key], ModelName$1 & keyof Projections[Key], Key>] }> : Payload;
6425
+ /** A model method's call with every key its delegate's chain declares taken out. */
6426
+ type DelegateCallArgs<Delegate, Args> = [DelegateProjections<Delegate>] extends [never] ? Args : WithoutKey<Args, keyof DelegateProjections<Delegate> & string>;
6427
+ /**
6428
+ * A model method's result on the delegate it is called on (`Row`, typed from
6429
+ * `DelegateCallArgs`), with each declared key's member wherever the call
6430
+ * spelled it, as the projected overloads of the operation it delegates to
6431
+ * type theirs.
6432
+ */
6433
+ type DelegateProjectedResult<Delegate, O$1, ModelName$1, Args, Row$1> = O$1 extends ProjectedOperation ? DelegateProjections<Delegate> extends infer Projections extends Record<string, ProjectionModelsConstraint> ? [Projections] extends [never] ? Row$1 : EachKey<{ [Key in keyof Projections & string]: [Overlay<Row$1, Args, Projections[Key], ModelName$1 & keyof Projections[Key], Key>] }> : Row$1 : Row$1;
6284
6434
  /**
6285
6435
  * Whether a definition's verbs declare a projection key. A definition with no
6286
6436
  * `rows.verbs` is answered by its shape alone, before any model is read.
@@ -6423,6 +6573,18 @@ type TransactionMethod<C$1 extends VibORMConfig, X$1 extends ExtensionStateConst
6423
6573
  <T$1>(fn: (tx: TransactionClient<C$1, X$1>) => PromiseLike<T$1>, options?: TransactionOptions): Promise<T$1>;
6424
6574
  <T$1 extends BatchTransactionOperation<unknown>[]>(operations: [...T$1], options?: BatchTransactionOptions): Promise<{ [K in keyof T$1]: Awaited<T$1[K]> }>;
6425
6575
  };
6576
+ /**
6577
+ * What a factory given to `$extends` returns: a client. A conditional, not
6578
+ * `Result & { readonly $schema: Schema }`: inferring `Result` against an
6579
+ * intersection rebuilds the returned client without its alias, so an exported
6580
+ * extended client's declaration spelled every delegate out (one ordered model:
6581
+ * 1.2 MB). Inference reaches a conditional's branch with the type as returned.
6582
+ */
6583
+ type FactoryResult<Result$1> = Result$1 extends {
6584
+ readonly $schema: Schema$1;
6585
+ } ? Result$1 : {
6586
+ readonly $schema: Schema$1;
6587
+ };
6426
6588
  declare const clientTypeState: unique symbol;
6427
6589
  /**
6428
6590
  * Declaration-only inference metadata; no property is installed at runtime.
@@ -6431,9 +6593,15 @@ declare const clientTypeState: unique symbol;
6431
6593
  * Result helpers check key presence and the full client surface: this metadata
6432
6594
  * guides inference, but does not prove that a client has the declared methods.
6433
6595
  */
6434
- type ClientTypeState<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = [C$1] extends [unknown] ? {
6596
+ type ClientTypeState<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint> = [C$1] extends [unknown] ? ClientTypeStateMember<C$1, X$1> : never;
6597
+ /**
6598
+ * The metadata's one member. An interface, so an inferred client's
6599
+ * declaration names it rather than spelling its symbol-keyed member, which a
6600
+ * declaration file cannot name.
6601
+ */
6602
+ interface ClientTypeStateMember<C$1, X$1> {
6435
6603
  readonly [clientTypeState]?: readonly [C$1, X$1] | object;
6436
- } : never;
6604
+ }
6437
6605
  /**
6438
6606
  * Extended client type with utility methods
6439
6607
  */
@@ -6496,9 +6664,7 @@ interface VibORMClientMembers<C$1 extends VibORMConfig, X$1 extends ExtensionSta
6496
6664
  * Definitions append to the immutable chain; factories compose through the
6497
6665
  * same `$extends` method. Definition model keys are checked against this schema.
6498
6666
  */
6499
- $extends<Result$1 = VibORMClient<C$1, X$1>>(factory: (client: NoInfer<VibORMClient<C$1, X$1>>) => Result$1 & {
6500
- readonly $schema: Schema$1;
6501
- }): Result$1;
6667
+ $extends<Result$1 = VibORMClient<C$1, X$1>>(factory: (client: NoInfer<VibORMClient<C$1, X$1>>) => FactoryResult<Result$1>): Result$1;
6502
6668
  $extends<const Definition$1 extends OfficialAwareDefinition<C$1, X$1, Definition$1>, Fields$1 = unknown>(extension: Definition$1 & ExtensionAdmission<Definition$1, C$1, X$1> & (Definition$1 extends ((...args: never[]) => unknown) ? never : unknown) & ResultInference<C$1, X$1["result"], Fields$1>): VibORMClient<AppliedClientConfig<C$1, Definition$1>, AppliedExtensionState<C$1, X$1, Definition$1>>;
6503
6669
  }
6504
6670
  type ApplyClientExtensions<C$1 extends VibORMConfig, X$1 extends ExtensionStateConstraint, Definitions extends readonly unknown[]> = Definitions extends readonly [] ? VibORMClient<C$1, X$1> : Definitions extends readonly [infer Definition, ...infer RemainingDefinitions] ? Definition extends ((...args: never[]) => unknown) ? never : Definition extends OfficialAwareDefinition<C$1, X$1> ? Definition extends ExtensionAdmission<Definition, C$1, X$1> ? ApplyClientExtensions<AppliedClientConfig<C$1, Definition>, AppliedExtensionState<C$1, X$1, Definition>, RemainingDefinitions> : never : never : never;
@@ -6524,6 +6690,15 @@ type ExtensionState = ExtensionStateConstraint;
6524
6690
  * `M[K & keyof M]` in a plugin generic over it.
6525
6691
  */
6526
6692
  type ExtendedOperationResult<Client$1, ModelName$1, O$1 extends Operations, Args> = typeof clientTypeState extends keyof Client$1 ? Client$1 extends ClientTypeState<infer C, infer X> ? Client$1 extends VibORMClient<C, X> ? ContextualOperationResult<C, ModelName$1 & keyof ClientSchema<C>, O$1, Args, ClientRowsContext<C, X["rows"]>> : never : never : never;
6693
+ /**
6694
+ * One operation's arguments on the model delegate `Delegate` it would run on:
6695
+ * `Payload`, whose `select` and `include` admit the keys that delegate's chain
6696
+ * projects (`$access`), as the operation's own projected overloads admit
6697
+ * them. A model method constrains its arguments with it beside
6698
+ * `DelegateOperationResult`: `restore<Self, A extends
6699
+ * DelegateOperationArgs<Self, RestoreArgs>>(this: Self, args: A)`.
6700
+ */
6701
+ type DelegateOperationArgs<Delegate, Payload> = Delegate extends DelegateState<unknown, unknown, unknown, infer K> ? DelegateProjectedArgs<Delegate, Payload, K> : Payload;
6527
6702
  /**
6528
6703
  * One operation's result on the model delegate `Delegate` it would run on,
6529
6704
  * as `ExtendedOperationResult` types it for that delegate's client. A model
@@ -6532,7 +6707,8 @@ type ExtendedOperationResult<Client$1, ModelName$1, O$1 extends Operations, Args
6532
6707
  * `restore<Self, A>(this: Self, args: A): PendingOperation<
6533
6708
  * DelegateOperationResult<Self, "update", A>>`.
6534
6709
  */
6535
- type DelegateOperationResult<Delegate, O$1 extends Operations, Args> = Delegate extends DelegateState<infer C extends VibORMConfig, infer Rows extends string, infer Result extends object, infer K> ? [keyof Result] extends [never] ? DelegateRow<C, Rows, K & keyof ClientSchema<C>, O$1, Args> : O$1 extends Exclude<Operations, ComputedOperation> ? DelegateRow<C, Rows, K & keyof ClientSchema<C>, O$1, Args> : WithComputedResult<DelegateRow<C, Rows, K & keyof ClientSchema<C>, O$1, Args>, ClientSchema<C>[K & keyof ClientSchema<C>], Args, ComputedResultContext<Result, ClientSchema<C>, K>> : unknown;
6710
+ type DelegateOperationResult<Delegate, O$1 extends Operations, Args> = Delegate extends DelegateState<infer C extends VibORMConfig, infer Rows extends string, infer Result extends object, infer K> ? DelegateProjectedResult<Delegate, O$1, K, Args, DelegateComputedRow<C, Rows, Result, K, O$1, DelegateCallArgs<Delegate, Args>>> : unknown;
6711
+ type DelegateComputedRow<C$1 extends VibORMConfig, Rows$1 extends string, Result$1 extends object, K$1, O$1 extends Operations, Args> = [keyof Result$1] extends [never] ? DelegateRow<C$1, Rows$1, K$1 & keyof ClientSchema<C$1>, O$1, Args> : O$1 extends Exclude<Operations, ComputedOperation> ? DelegateRow<C$1, Rows$1, K$1 & keyof ClientSchema<C$1>, O$1, Args> : WithComputedResult<DelegateRow<C$1, Rows$1, K$1 & keyof ClientSchema<C$1>, O$1, Args>, ClientSchema<C$1>[K$1 & keyof ClientSchema<C$1>], Args, ComputedResultContext<Result$1, ClientSchema<C$1>, K$1>>;
6536
6712
  type DelegateRow<C$1 extends VibORMConfig, Rows$1 extends string, K$1 extends keyof ClientSchema<C$1>, O$1 extends Operations, Args> = ContextualOperationResult<C$1, K$1, O$1, Args, ClientRowsContext<C$1, Rows$1>>;
6537
6713
  /**
6538
6714
  * VibORM Client
@@ -6725,6 +6901,18 @@ type DeclaredMapKeys<Action> = Action extends JunctionReferentialAction ? never
6725
6901
  * an extra key.
6726
6902
  */
6727
6903
  type ExactJunctionActions<Action> = Record<Exclude<DeclaredMapKeys<Action>, keyof JunctionSideActions>, never>;
6904
+ /**
6905
+ * `.source()` / `.target()` after a declared model's `.through()` names one of
6906
+ * its relations, which is what `$through` keeps a link's own columns apart by.
6907
+ * On any other junction a token is only a name and the state stays as it was.
6908
+ */
6909
+ type WithJunctionSide<State$1, Side extends string, Token> = State$1 extends {
6910
+ readonly junction: {
6911
+ readonly model: unknown;
6912
+ };
6913
+ } ? Replace<State$1, {
6914
+ readonly junction: State$1["junction"] & { readonly [K in Side]: Token };
6915
+ }> : State$1;
6728
6916
  /**
6729
6917
  * A model-target collection slot.
6730
6918
  *
@@ -6742,8 +6930,20 @@ type ModelToManyRelation<State$1> = {
6742
6930
  readonly name: Name$1;
6743
6931
  }>>;
6744
6932
  through(table: string): ModelToManyRelation<State$1>;
6745
- source(token: string): ModelToManyRelation<State$1>;
6746
- target(token: string): ModelToManyRelation<State$1>;
6933
+ /**
6934
+ * A declared model as the junction: its table, columns and delegate stay its
6935
+ * own and `.source()` / `.target()` name its to-one relations. The getter is
6936
+ * kept as a target's is and read only where a query asks for `$through`: the
6937
+ * junction model's relations point back here, so `.source()` naming them in
6938
+ * its own signature would resolve a circular const.
6939
+ */
6940
+ through<const G$1>(model: G$1 & GetterOnly<G$1>): ModelToManyRelation<Replace<State$1, {
6941
+ readonly junction: {
6942
+ readonly model: G$1;
6943
+ };
6944
+ }>>;
6945
+ source<const Token extends string>(token: Token): ModelToManyRelation<WithJunctionSide<State$1, "source", Token>>;
6946
+ target<const Token extends string>(token: Token): ModelToManyRelation<WithJunctionSide<State$1, "target", Token>>;
6747
6947
  onDelete<const Action extends JunctionActionDeclaration>(action: Action & ExactJunctionActions<Action>): ModelToManyRelation<State$1>;
6748
6948
  onUpdate<const Action extends JunctionActionDeclaration>(action: Action & ExactJunctionActions<Action>): ModelToManyRelation<State$1>;
6749
6949
  };
@@ -8093,165 +8293,434 @@ type PaginationTakeSchema = V$1.Integer;
8093
8293
  type PaginationSkipSchema = V$1.Schema<number, number>;
8094
8294
  type BulkWriteLimitSchema = V$1.Schema<number, number>;
8095
8295
  //#endregion
8096
- //#region src/validation/relations/select-include.d.ts
8097
- /** The asking key cannot have a second producer inside its own repeated node. */
8098
- declare const askingKeyRefusal: (key: string) => OptionalSchema<VibSchema<never, never>, undefined, undefined, undefined>;
8099
- /** A target projection whose asking key is refused, keeping its options. */
8100
- type ProjectionWithoutAsking<Schema$4 extends V$1.Object<any, any>, Key$1> = V$1.Object<Omit<Schema$4["entries"], Extract<Key$1, keyof Schema$4["entries"]>> & Record<Extract<Key$1, string>, ReturnType<typeof askingKeyRefusal>>>;
8101
- type RecursiveProjectionSchemas<S$1 extends RelationState, Key$1> = {
8102
- readonly select: ProjectionWithoutAsking<GetTargetSchemas<S$1>["core"]["select"], Key$1>;
8103
- readonly include: ProjectionWithoutAsking<GetTargetSchemas<S$1>["core"]["include"], Key$1>;
8104
- };
8105
- type ToOneRecursiveNodeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = IncludeToField<V$1.Object<{
8106
- recurse: RecurrenceFor<Source, Key$1, S$1>;
8107
- where: UnavailableRecursiveClauseSchema;
8108
- orderBy: UnavailableRecursiveClauseSchema;
8109
- select: () => RecursiveProjectionSchemas<S$1, Key$1>["select"];
8110
- include: () => RecursiveProjectionSchemas<S$1, Key$1>["include"];
8111
- omit: () => GetTargetSchemas<S$1>["core"]["omit"];
8112
- }, {
8113
- atLeast: ["recurse"];
8114
- }>>;
8115
- /**
8116
- * Nested `distinct`: scalar field names of the RELATED model, deduplicating
8117
- * that relation's ordered rows before `take`/`skip` window them (the same
8118
- * enum-of-scalars schema the top-level findMany args use).
8119
- */
8120
- type NestedDistinctSchema<S$1 extends RelationState> = V$1.Enum<StringKeyOf<TargetModel$1<S$1>["~"]["state"]["scalars"]>[], {
8121
- array: true;
8122
- }>;
8123
- type IncludeToField<Schema$4 extends V$1.Object<any, any>> = V$1.Coerce<Schema$4, Schema$4[" vibInferred"]["1"] & {
8124
- select?: Record<string, true>;
8125
- }>;
8126
- type BooleanToSelect = V$1.Coerce<V$1.Boolean, {
8127
- select?: Record<string, true>;
8128
- } | false>;
8296
+ //#region src/validation/model/core/projection.d.ts
8297
+ type ModelStateOf$5<M$1 extends AnyModel> = M$1["~"]["state"];
8129
8298
  /**
8130
- * The node a bare `true` desugars to: an explicit projection of the target's
8131
- * projectable scalars, FRESH on every parse so the engine never receives a
8132
- * schema-level singleton it could mutate. A target with nothing projectable
8133
- * yields `{}`, which the builder reads as "default row".
8299
+ * The keys a model's `.omit()` hides for good. `undefined` (the common case,
8300
+ * no `.omit()` at all) contributes nothing.
8134
8301
  */
8135
-
8302
+ type ModelOmittedKeys<M$1 extends AnyModel> = ModelStateOf$5<M$1>["omit"] extends Record<string, true> ? StringKeyOf<ModelStateOf$5<M$1>["omit"]> : never;
8303
+ /** Every scalar of the model that a query is allowed to project. */
8304
+ type ProjectableScalarKeys<M$1 extends AnyModel> = Exclude<StringKeyOf<ModelStateOf$5<M$1>["scalars"]>, ModelOmittedKeys<M$1>>;
8305
+ //#endregion
8306
+ //#region src/validation/model/core/select.d.ts
8136
8307
  /**
8137
- * To-one include: true or nested { select, include }
8138
- * `select` and `include` are mutually exclusive on the same node (Prisma parity)
8308
+ * Build select schema - boolean selection for each scalar field, nested select for relations
8139
8309
  */
8140
- type ToOneIncludeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [BooleanToSelect, IncludeToField<V$1.Object<{
8141
- select: () => GetTargetSchemas<S$1>["core"]["select"];
8142
- include: () => GetTargetSchemas<S$1>["core"]["include"];
8143
- omit: () => GetTargetSchemas<S$1>["core"]["omit"];
8144
- recurse: UnavailableRecurrenceSchema;
8145
- }>>, ToOneRecursiveNodeSchema<Source, Key$1, S$1>]>;
8310
+ type ModelStateOf$4<M$1 extends AnyModel> = M$1["~"]["state"];
8311
+ type ModelScalars<M$1 extends AnyModel> = ModelStateOf$4<M$1>["scalars"];
8312
+ type ScalarStateOf$1<F$1> = F$1 extends {
8313
+ "~": {
8314
+ state: infer S;
8315
+ };
8316
+ } ? S extends ScalarState ? S : never : never;
8317
+ type AnyVectorScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelScalars<M$1>]: ScalarStateOf$1<ModelScalars<M$1>[K]>["type"] extends "vector" ? K extends string ? K : never : never }[keyof ModelScalars<M$1>];
8318
+ type AnyPointScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelScalars<M$1>]: ScalarStateOf$1<ModelScalars<M$1>[K]>["type"] extends "point" ? K extends string ? K : never : never }[keyof ModelScalars<M$1>];
8146
8319
  /**
8147
- * THE TO-MANY NESTED NODE — `{ where, orderBy, take, skip, cursor, distinct,
8148
- * select, include, omit }`, with `select`/`include` mutually exclusive on the
8149
- * same node (Prisma parity).
8150
- *
8151
- * `take`/`skip`/`cursor`/`distinct` are the very schemas the top level uses: a
8152
- * negative `take` is Prisma's "last N" (the relation subquery runs the reversed
8153
- * order with an absolute limit and the parser restores the logical order), a
8154
- * non-integer take or a negative skip is refused with the top-level message,
8155
- * `cursor` is a whereUnique of the RELATED model applied per parent, and
8156
- * `distinct` names scalars of the RELATED model.
8157
- *
8158
- * DECOUPLED FROM `RelationState` on purpose. Everything the node needs reduces
8159
- * to four facts — the target model (default projection + `omit` desugaring),
8160
- * the label an `omit` failure carries, the target's core schemas, and the
8161
- * target's scalar names for `distinct`. Naming those four directly is what lets
8162
- * a SECOND caller build the identical node without a relation to read them off:
8163
- * a polymorphic collection's per-variant arm
8164
- * (`./polymorphic/select-include.ts`), whose target is chosen by a
8165
- * discriminator rather than by an edge.
8166
- *
8167
- * Extracted rather than hand-copied. Two hand-written copies of these nine keys
8168
- * under `rejectSelectInclude` + `withOmitProjection` + `includeToField` would be
8169
- * two things to keep in step, and the drift would be silent — a polymorphic arm
8170
- * quietly missing `cursor`, say, reads as "not supported" rather than as a bug.
8171
- * `to-many.core.test.ts` is the regression net for the extraction itself.
8320
+ * Both halves of the select schema are keyed on {@link ProjectableScalarKeys},
8321
+ * so a model-level `.omit()`-ed scalar has no `select` entry at all: naming it
8322
+ * is an "Unknown key" parse failure rather than a way around the schema's own
8323
+ * exclusion. See `projection.ts` for why that layer is hard and the other two
8324
+ * are not.
8172
8325
  */
8173
- /** The six core schemas of the related model a to-many node reaches for. */
8174
- type ToManyNestedTargetCore = {
8175
- readonly where: VibSchema<any, any>;
8176
- readonly orderBy: VibSchema<any, any>;
8177
- readonly whereUnique: VibSchema<any, any>;
8178
- readonly select: VibSchema<any, any>;
8179
- readonly include: VibSchema<any, any>;
8180
- readonly omit: VibSchema<any, any>;
8326
+ type VectorScalarKeys<M$1 extends AnyModel> = Extract<ProjectableScalarKeys<M$1>, AnyVectorScalarKeys<M$1>>;
8327
+ type PointScalarKeys$1<M$1 extends AnyModel> = Extract<ProjectableScalarKeys<M$1>, AnyPointScalarKeys<M$1>>;
8328
+ type PlainScalarKeys<M$1 extends AnyModel> = Exclude<ProjectableScalarKeys<M$1>, AnyVectorScalarKeys<M$1> | AnyPointScalarKeys<M$1>>;
8329
+ declare const scalarSelectSchema: BooleanSchema<boolean | undefined, boolean>;
8330
+ /** The desugared shorthand: one `true` entry per counted relation. */
8331
+ type CountAllSelection = Record<string, true>;
8332
+ /** Both relation namespaces a `_count` (and an `include`) reaches across. */
8333
+ type RelationSchemaBundle = {
8334
+ relations: Record<string, any>;
8335
+ polymorphic: Record<string, any>;
8181
8336
  };
8182
- type ToManyNestedNodeSchema<Core$1 extends ToManyNestedTargetCore, Distinct> = IncludeToField<V$1.Object<{
8183
- where: () => Core$1["where"];
8184
- orderBy: () => V$1.Union<readonly [Core$1["orderBy"], V$1.Array<Core$1["orderBy"]>]>;
8185
- take: PaginationTakeSchema;
8186
- skip: PaginationSkipSchema;
8187
- cursor: () => Core$1["whereUnique"];
8188
- distinct: Distinct;
8189
- select: () => Core$1["select"];
8190
- include: () => Core$1["include"];
8191
- omit: () => Core$1["omit"];
8192
- recurse: UnavailableRecurrenceSchema;
8193
- }>>;
8194
- type ToManyRecursiveNodeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = IncludeToField<V$1.Object<{
8195
- where: () => GetTargetSchemas<S$1>["core"]["where"];
8196
- orderBy: () => V$1.Union<readonly [GetTargetSchemas<S$1>["core"]["orderBy"], V$1.Array<GetTargetSchemas<S$1>["core"]["orderBy"]>]>;
8197
- take: UnavailableRecursiveClauseSchema;
8198
- skip: UnavailableRecursiveClauseSchema;
8199
- cursor: UnavailableRecursiveClauseSchema;
8200
- distinct: UnavailableRecursiveClauseSchema;
8201
- select: () => RecursiveProjectionSchemas<S$1, Key$1>["select"];
8202
- include: () => RecursiveProjectionSchemas<S$1, Key$1>["include"];
8203
- omit: () => GetTargetSchemas<S$1>["core"]["omit"];
8204
- recurse: RecurrenceFor<Source, Key$1, S$1>;
8205
- }, {
8206
- atLeast: ["recurse"];
8207
- }>>;
8208
- type ToManyIncludeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [BooleanToSelect, ToManyNestedNodeSchema<GetTargetSchemas<S$1>["core"], NestedDistinctSchema<S$1>>, ToManyRecursiveNodeSchema<Source, Key$1, S$1>]>;
8209
- /**
8210
- * Relation-level args are the same shape in select and include position
8211
- * (Prisma parity: select/include can alternate down the relation tree)
8212
- */
8213
- type ToOneSelectSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = ToOneIncludeSchema<Source, Key$1, S$1>;
8214
- type ToManySelectSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = ToManyIncludeSchema<Source, Key$1, S$1>;
8215
- //#endregion
8216
- //#region src/validation/relations/update.d.ts
8217
8337
  /**
8218
- * The `{ where?, data }` wrapper spelling of a to-one nested `update` (Prisma 5).
8219
- * `where` is a NON-unique `WhereInput` — a to-one has exactly one connected record,
8220
- * so this filters that record rather than selecting among candidates.
8338
+ * `_count` accepts either Prisma's shorthand `true` or the explicit
8339
+ * `{ select: { <relation>: true | { where } } }` object. The shorthand is
8340
+ * desugared here, so everything downstream (query engine, result parser) only
8341
+ * ever sees the object form.
8221
8342
  */
8222
- type ToOneUpdateWrapperSchema<S$1 extends RelationState, UpdateSchema$1 extends V$1.Object<any, any>> = V$1.Object<{
8223
- where: () => GetTargetSchemas<S$1>["core"]["where"];
8224
- data: () => UpdateSchema$1;
8343
+ type CountSchema<F$1 extends RelationSchemaBundle> = V$1.Union<readonly [V$1.Coerce<V$1.Literal<true>, {
8344
+ select: CountAllSelection;
8345
+ }>, V$1.Object<{
8346
+ select: V$1.Object<V$1.FromObject<F$1["relations"], "countFilter", {
8347
+ optional: true;
8348
+ }>["entries"] & V$1.FromObject<F$1["polymorphic"], "countFilter", {
8349
+ optional: true;
8350
+ }>["entries"], {
8351
+ optional: true;
8352
+ }>;
8225
8353
  }, {
8226
- atLeast: ["data"];
8227
- }>;
8228
- /**
8229
- * A to-one nested `update` payload: bare data OR the `{ where?, data }` wrapper.
8230
- * Dispatch is DETERMINISTIC and structural — never try-this-then-that — so a
8231
- * malformed wrapper surfaces the wrapper's own error rather than a union-wide miss,
8232
- * and the form a payload takes never depends on the values inside it.
8233
- *
8234
- * This is the ONE place the rule is applied, because it is the only place that sees
8235
- * the USER's payload: both arms emit the same canonical `{ data, where? }` envelope,
8236
- * so no later reader (the update root, a target one level deeper, the nested-target
8237
- * delegation) ever has to tell the spellings apart from an output that already
8238
- * rewrote scalar shorthands. See {@link file://./to-one-update-form.ts} for the rule,
8239
- * and for the collision it REFUSES: on a target that owns a field named `data`, the
8240
- * envelope's shape is also how bare data spells that field, and only the caller can
8241
- * say which was meant.
8242
- */
8243
- type ToOneUpdateTargetWithDataSchema<S$1 extends RelationState, UpdateSchema$1 extends V$1.Object<any, any>> = V$1.Union<readonly [ToOneUpdateWrapperSchema<S$1, UpdateSchema$1>, UpdateSchema$1]>;
8244
- type ToOneUpdateTargetSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = ToOneUpdateTargetWithDataSchema<S$1, ProjectedNestedUpdate<Source, Key$1, S$1>>;
8245
- /**
8246
- * To-one update: { create?, connect?, connectOrCreate?, update?, upsert?, disconnect?, delete? }
8247
- * disconnect and delete only available for optional relations.
8248
- */
8249
- type ToOneUpdateEntriesBase<Source extends AnyModel, Key$1, S$1 extends RelationState> = {
8250
- create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
8251
- connect: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
8252
- connectOrCreate: V$1.Object<{
8253
- where: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
8254
- create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
8354
+ optional: true;
8355
+ }>]>;
8356
+ declare const vectorScalarSelectSchema: UnionSchema<readonly [BooleanSchema<boolean | undefined, boolean>, ObjectSchema<{
8357
+ _distance: ObjectSchema<{
8358
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8359
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8360
+ }, {
8361
+ readonly partial: false;
8362
+ }, InferInputShape<{
8363
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8364
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8365
+ }>, InferOutputShape<{
8366
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8367
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8368
+ }>>;
8369
+ }, {
8370
+ readonly partial: false;
8371
+ }, InferInputShape<{
8372
+ _distance: ObjectSchema<{
8373
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8374
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8375
+ }, {
8376
+ readonly partial: false;
8377
+ }, InferInputShape<{
8378
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8379
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8380
+ }>, InferOutputShape<{
8381
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8382
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8383
+ }>>;
8384
+ }>, InferOutputShape<{
8385
+ _distance: ObjectSchema<{
8386
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8387
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8388
+ }, {
8389
+ readonly partial: false;
8390
+ }, InferInputShape<{
8391
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8392
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8393
+ }>, InferOutputShape<{
8394
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8395
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8396
+ }>>;
8397
+ }>>], boolean | InferInputShape<{
8398
+ _distance: ObjectSchema<{
8399
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8400
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8401
+ }, {
8402
+ readonly partial: false;
8403
+ }, InferInputShape<{
8404
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8405
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8406
+ }>, InferOutputShape<{
8407
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8408
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8409
+ }>>;
8410
+ }> | undefined, boolean | InferOutputShape<{
8411
+ _distance: ObjectSchema<{
8412
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8413
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8414
+ }, {
8415
+ readonly partial: false;
8416
+ }, InferInputShape<{
8417
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8418
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8419
+ }>, InferOutputShape<{
8420
+ to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
8421
+ metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
8422
+ }>>;
8423
+ }>>;
8424
+ type VectorScalarSelectSchema = typeof vectorScalarSelectSchema;
8425
+ declare const pointScalarSelectSchema: UnionSchema<readonly [BooleanSchema<boolean | undefined, boolean>, ObjectSchema<{
8426
+ _distance: ObjectSchema<{
8427
+ to: PointSchema<GeoPoint, GeoPoint>;
8428
+ }, {
8429
+ readonly partial: false;
8430
+ }, InferInputShape<{
8431
+ to: PointSchema<GeoPoint, GeoPoint>;
8432
+ }>, InferOutputShape<{
8433
+ to: PointSchema<GeoPoint, GeoPoint>;
8434
+ }>>;
8435
+ }, {
8436
+ readonly partial: false;
8437
+ }, InferInputShape<{
8438
+ _distance: ObjectSchema<{
8439
+ to: PointSchema<GeoPoint, GeoPoint>;
8440
+ }, {
8441
+ readonly partial: false;
8442
+ }, InferInputShape<{
8443
+ to: PointSchema<GeoPoint, GeoPoint>;
8444
+ }>, InferOutputShape<{
8445
+ to: PointSchema<GeoPoint, GeoPoint>;
8446
+ }>>;
8447
+ }>, InferOutputShape<{
8448
+ _distance: ObjectSchema<{
8449
+ to: PointSchema<GeoPoint, GeoPoint>;
8450
+ }, {
8451
+ readonly partial: false;
8452
+ }, InferInputShape<{
8453
+ to: PointSchema<GeoPoint, GeoPoint>;
8454
+ }>, InferOutputShape<{
8455
+ to: PointSchema<GeoPoint, GeoPoint>;
8456
+ }>>;
8457
+ }>>], boolean | InferInputShape<{
8458
+ _distance: ObjectSchema<{
8459
+ to: PointSchema<GeoPoint, GeoPoint>;
8460
+ }, {
8461
+ readonly partial: false;
8462
+ }, InferInputShape<{
8463
+ to: PointSchema<GeoPoint, GeoPoint>;
8464
+ }>, InferOutputShape<{
8465
+ to: PointSchema<GeoPoint, GeoPoint>;
8466
+ }>>;
8467
+ }> | undefined, boolean | InferOutputShape<{
8468
+ _distance: ObjectSchema<{
8469
+ to: PointSchema<GeoPoint, GeoPoint>;
8470
+ }, {
8471
+ readonly partial: false;
8472
+ }, InferInputShape<{
8473
+ to: PointSchema<GeoPoint, GeoPoint>;
8474
+ }>, InferOutputShape<{
8475
+ to: PointSchema<GeoPoint, GeoPoint>;
8476
+ }>>;
8477
+ }>>;
8478
+ type PointScalarSelectSchema = typeof pointScalarSelectSchema;
8479
+ /**
8480
+ * A written `select` names what the row carries, so one that names nothing
8481
+ * (`{}`, only `false`, or a `_count` that counts no relation, as `_count: true`
8482
+ * does on a model with no to-many relation) is a caller mistake, refused at its
8483
+ * own path. Leaving `select` out is how a caller asks for the default row.
8484
+ */
8485
+ declare const requireSelectedField: (select: Record<string, unknown>) => string | undefined;
8486
+ /** The refusal every written `select` carries ({@link requireSelectedField}). */
8487
+ type SelectRefusal = {
8488
+ readonly refuse: typeof requireSelectedField;
8489
+ };
8490
+ type SelectSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.Object<V$1.FromKeys<PlainScalarKeys<M$1>[], typeof scalarSelectSchema>["entries"] & V$1.FromKeys<VectorScalarKeys<M$1>[], VectorScalarSelectSchema>["entries"] & V$1.FromKeys<PointScalarKeys$1<M$1>[], PointScalarSelectSchema>["entries"] & V$1.FromObject<F$1["relations"], "select">["entries"] & V$1.FromObject<F$1["polymorphic"], "select">["entries"] & {
8491
+ _count: CountSchema<F$1>;
8492
+ }, SelectRefusal>;
8493
+ /**
8494
+ * The SCALAR-ONLY projection: {@link SelectSchema} without relation keys and
8495
+ * without `_count`.
8496
+ *
8497
+ * This is the projection of a bulk write (`createMany` / `updateMany` /
8498
+ * `deleteMany` with a `select`). Those rows come out of the write statement's
8499
+ * `RETURNING` clause — an expression list with no table alias to correlate
8500
+ * against — so a relation subquery embedded there binds its outer column
8501
+ * reference by NAME and is silently captured by the inner table whenever the two
8502
+ * share a column name. The observable result was wrong data, not an error: a
8503
+ * to-many relation always came back `[]`, and a self-referencing to-one came
8504
+ * back `null`, while the identical projection through `findMany` returned the
8505
+ * real rows. Refusing the key is the fail-closed answer; read relations in a
8506
+ * separate query, which is what the underlying implementation would have to do
8507
+ * anyway.
8508
+ *
8509
+ * Prisma divergence, deliberate: Prisma's `createManyAndReturn` /
8510
+ * `updateManyAndReturn` DO accept relations here — its generator emits dedicated
8511
+ * `<Model>SelectCreateManyAndReturn` / `<Model>IncludeCreateManyAndReturn` types
8512
+ * (prisma 6.8.2, `prisma-client/generator-build`, `Model.argsTypes`).
8513
+ */
8514
+ type ScalarSelectSchema<M$1 extends AnyModel> = V$1.Object<V$1.FromKeys<PlainScalarKeys<M$1>[], typeof scalarSelectSchema>["entries"] & V$1.FromKeys<VectorScalarKeys<M$1>[], VectorScalarSelectSchema>["entries"] & V$1.FromKeys<PointScalarKeys$1<M$1>[], PointScalarSelectSchema>["entries"], SelectRefusal>;
8515
+ /**
8516
+ * A relation node's `$through`: the link row of a declared model's junction,
8517
+ * `true` for its projectable scalars or `{ select }` of them. Scalars only, and
8518
+ * only plain ones, so a relation or a computed distance is an unknown key: what
8519
+ * a link row holds is what its columns hold.
8520
+ */
8521
+ type ThroughSelectSchema<M$1 extends AnyModel> = V$1.Union<readonly [V$1.Coerce<V$1.Boolean, {
8522
+ select: Record<string, true>;
8523
+ } | false>, V$1.Object<{
8524
+ select: V$1.Object<V$1.FromKeys<ProjectableScalarKeys<M$1>[], typeof scalarSelectSchema>["entries"], SelectRefusal>;
8525
+ }, {
8526
+ partial: false;
8527
+ }>]>;
8528
+ /**
8529
+ * Build include schema - nested include for each relation
8530
+ */
8531
+ type IncludeSchema<F$1 extends RelationSchemaBundle> = V$1.Object<V$1.FromObject<F$1["relations"], "include", {
8532
+ optional: true;
8533
+ }>["entries"] & {
8534
+ _count: CountSchema<F$1>;
8535
+ } & V$1.FromObject<F$1["polymorphic"], "include", {
8536
+ optional: true;
8537
+ }>["entries"]>;
8538
+ //#endregion
8539
+ //#region src/validation/relations/select-include.d.ts
8540
+ /** The asking key cannot have a second producer inside its own repeated node. */
8541
+ declare const askingKeyRefusal: (key: string) => OptionalSchema<VibSchema<never, never>, undefined, undefined, undefined>;
8542
+ /** A target projection whose asking key is refused, keeping its options. */
8543
+ type ProjectionWithoutAsking<Schema$4 extends V$1.Object<any, any>, Key$1> = V$1.Object<Omit<Schema$4["entries"], Extract<Key$1, keyof Schema$4["entries"]>> & Record<Extract<Key$1, string>, ReturnType<typeof askingKeyRefusal>>>;
8544
+ type RecursiveProjectionSchemas<S$1 extends RelationState, Key$1> = {
8545
+ readonly select: ProjectionWithoutAsking<GetTargetSchemas<S$1>["core"]["select"], Key$1>;
8546
+ readonly include: ProjectionWithoutAsking<GetTargetSchemas<S$1>["core"]["include"], Key$1>;
8547
+ };
8548
+ type ToOneRecursiveNodeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = IncludeToField<V$1.Object<{
8549
+ recurse: RecurrenceFor<Source, Key$1, S$1>;
8550
+ where: UnavailableRecursiveClauseSchema;
8551
+ orderBy: UnavailableRecursiveClauseSchema;
8552
+ select: () => RecursiveProjectionSchemas<S$1, Key$1>["select"];
8553
+ include: () => RecursiveProjectionSchemas<S$1, Key$1>["include"];
8554
+ omit: () => GetTargetSchemas<S$1>["core"]["omit"];
8555
+ }, {
8556
+ atLeast: ["recurse"];
8557
+ }>>;
8558
+ /**
8559
+ * Nested `distinct`: scalar field names of the RELATED model, deduplicating
8560
+ * that relation's ordered rows before `take`/`skip` window them (the same
8561
+ * enum-of-scalars schema the top-level findMany args use).
8562
+ */
8563
+ type NestedDistinctSchema<S$1 extends RelationState> = V$1.Enum<StringKeyOf<TargetModel$1<S$1>["~"]["state"]["scalars"]>[], {
8564
+ array: true;
8565
+ }>;
8566
+ type IncludeToField<Schema$4 extends V$1.Object<any, any>> = V$1.Coerce<Schema$4, Schema$4[" vibInferred"]["1"] & {
8567
+ select?: Record<string, true>;
8568
+ }>;
8569
+ type BooleanToSelect = V$1.Coerce<V$1.Boolean, {
8570
+ select?: Record<string, true>;
8571
+ } | false>;
8572
+ /**
8573
+ * The node a bare `true` desugars to: an explicit projection of the target's
8574
+ * projectable scalars, FRESH on every parse so the engine never receives a
8575
+ * schema-level singleton it could mutate. A target with nothing projectable
8576
+ * yields `{}`, which the builder reads as "default row".
8577
+ */
8578
+
8579
+ /**
8580
+ * To-one include: true or nested { select, include }
8581
+ * `select` and `include` are mutually exclusive on the same node (Prisma parity)
8582
+ */
8583
+ type ToOneIncludeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [BooleanToSelect, IncludeToField<V$1.Object<{
8584
+ select: () => GetTargetSchemas<S$1>["core"]["select"];
8585
+ include: () => GetTargetSchemas<S$1>["core"]["include"];
8586
+ omit: () => GetTargetSchemas<S$1>["core"]["omit"];
8587
+ recurse: UnavailableRecurrenceSchema;
8588
+ }>>, ToOneRecursiveNodeSchema<Source, Key$1, S$1>]>;
8589
+ /**
8590
+ * THE TO-MANY NESTED NODE — `{ where, orderBy, take, skip, cursor, distinct,
8591
+ * select, include, omit }`, with `select`/`include` mutually exclusive on the
8592
+ * same node (Prisma parity).
8593
+ *
8594
+ * `take`/`skip`/`cursor`/`distinct` are the very schemas the top level uses: a
8595
+ * negative `take` is Prisma's "last N" (the relation subquery runs the reversed
8596
+ * order with an absolute limit and the parser restores the logical order), a
8597
+ * non-integer take or a negative skip is refused with the top-level message,
8598
+ * `cursor` is a whereUnique of the RELATED model applied per parent, and
8599
+ * `distinct` names scalars of the RELATED model.
8600
+ *
8601
+ * DECOUPLED FROM `RelationState` on purpose. Everything the node needs reduces
8602
+ * to four facts — the target model (default projection + `omit` desugaring),
8603
+ * the label an `omit` failure carries, the target's core schemas, and the
8604
+ * target's scalar names for `distinct`. Naming those four directly is what lets
8605
+ * a SECOND caller build the identical node without a relation to read them off:
8606
+ * a polymorphic collection's per-variant arm
8607
+ * (`./polymorphic/select-include.ts`), whose target is chosen by a
8608
+ * discriminator rather than by an edge.
8609
+ *
8610
+ * Extracted rather than hand-copied. Two hand-written copies of these nine keys
8611
+ * under `rejectSelectInclude` + `withOmitProjection` + `includeToField` would be
8612
+ * two things to keep in step, and the drift would be silent — a polymorphic arm
8613
+ * quietly missing `cursor`, say, reads as "not supported" rather than as a bug.
8614
+ * `to-many.core.test.ts` is the regression net for the extraction itself.
8615
+ */
8616
+ /** The six core schemas of the related model a to-many node reaches for. */
8617
+ type ToManyNestedTargetCore = {
8618
+ readonly where: VibSchema<any, any>;
8619
+ readonly orderBy: VibSchema<any, any>;
8620
+ readonly whereUnique: VibSchema<any, any>;
8621
+ readonly select: VibSchema<any, any>;
8622
+ readonly include: VibSchema<any, any>;
8623
+ readonly omit: VibSchema<any, any>;
8624
+ };
8625
+ type ToManyNestedNodeSchema<Core$1 extends ToManyNestedTargetCore, Distinct> = IncludeToField<V$1.Object<{
8626
+ where: () => Core$1["where"];
8627
+ orderBy: () => V$1.Union<readonly [Core$1["orderBy"], V$1.Array<Core$1["orderBy"]>]>;
8628
+ take: PaginationTakeSchema;
8629
+ skip: PaginationSkipSchema;
8630
+ cursor: () => Core$1["whereUnique"];
8631
+ distinct: Distinct;
8632
+ select: () => Core$1["select"];
8633
+ include: () => Core$1["include"];
8634
+ omit: () => Core$1["omit"];
8635
+ recurse: UnavailableRecurrenceSchema;
8636
+ }>>;
8637
+ type ToManyRecursiveNodeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = IncludeToField<V$1.Object<{
8638
+ where: () => GetTargetSchemas<S$1>["core"]["where"];
8639
+ orderBy: () => V$1.Union<readonly [GetTargetSchemas<S$1>["core"]["orderBy"], V$1.Array<GetTargetSchemas<S$1>["core"]["orderBy"]>]>;
8640
+ take: UnavailableRecursiveClauseSchema;
8641
+ skip: UnavailableRecursiveClauseSchema;
8642
+ cursor: UnavailableRecursiveClauseSchema;
8643
+ distinct: UnavailableRecursiveClauseSchema;
8644
+ select: () => RecursiveProjectionSchemas<S$1, Key$1>["select"];
8645
+ include: () => RecursiveProjectionSchemas<S$1, Key$1>["include"];
8646
+ omit: () => GetTargetSchemas<S$1>["core"]["omit"];
8647
+ recurse: RecurrenceFor<Source, Key$1, S$1>;
8648
+ }, {
8649
+ atLeast: ["recurse"];
8650
+ }>>;
8651
+ /**
8652
+ * The target's core as a slot with a declared junction model reads it, and the
8653
+ * target's own core everywhere else. Nothing here resolves the junction model
8654
+ * until a query's own selection reads this slot's `select` or `include`.
8655
+ */
8656
+ type ThroughCore<Source, Key$1, S$1 extends RelationState, Core$1> = [JunctionModelOf<Source, Key$1, {
8657
+ readonly "~": {
8658
+ readonly state: S$1;
8659
+ };
8660
+ }>] extends [never] ? Core$1 : Core$1 extends ToManyNestedTargetCore ? JunctionModelOf<Source, Key$1, {
8661
+ readonly "~": {
8662
+ readonly state: S$1;
8663
+ };
8664
+ }> extends infer M extends AnyModel ? Omit<Core$1, "where" | "select" | "include"> & {
8665
+ readonly where: WhereWithLinkFilter<Core$1["where"], M>;
8666
+ readonly select: WithThroughKey<Core$1["select"], M>;
8667
+ readonly include: WithThroughKey<Core$1["include"], M>;
8668
+ } : Core$1 : Core$1;
8669
+ /**
8670
+ * Reads the projection's inferred halves and never its entries: rebuilding the
8671
+ * object from `entries` would resolve the target's relation members while one
8672
+ * of them is being resolved, which is circular in every self relation (TS2615).
8673
+ */
8674
+ type WithThroughKey<Schema$4 extends VibSchema<any, any>, M$1 extends AnyModel> = VibSchema<Schema$4[" vibInferred"]["0"] & {
8675
+ $through?: ThroughSelectSchema<M$1>[" vibInferred"]["0"];
8676
+ }, Schema$4[" vibInferred"]["1"]>;
8677
+ type ToManyIncludeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [BooleanToSelect, ToManyNestedNodeSchema<ThroughCore<Source, Key$1, S$1, GetTargetSchemas<S$1>["core"]>, NestedDistinctSchema<S$1>>, ToManyRecursiveNodeSchema<Source, Key$1, S$1>]>;
8678
+ /**
8679
+ * Relation-level args are the same shape in select and include position
8680
+ * (Prisma parity: select/include can alternate down the relation tree)
8681
+ */
8682
+ type ToOneSelectSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = ToOneIncludeSchema<Source, Key$1, S$1>;
8683
+ type ToManySelectSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = ToManyIncludeSchema<Source, Key$1, S$1>;
8684
+ //#endregion
8685
+ //#region src/validation/relations/update.d.ts
8686
+ /**
8687
+ * The `{ where?, data }` wrapper spelling of a to-one nested `update` (Prisma 5).
8688
+ * `where` is a NON-unique `WhereInput` — a to-one has exactly one connected record,
8689
+ * so this filters that record rather than selecting among candidates.
8690
+ */
8691
+ type ToOneUpdateWrapperSchema<S$1 extends RelationState, UpdateSchema$1 extends V$1.Object<any, any>> = V$1.Object<{
8692
+ where: () => GetTargetSchemas<S$1>["core"]["where"];
8693
+ data: () => UpdateSchema$1;
8694
+ }, {
8695
+ atLeast: ["data"];
8696
+ }>;
8697
+ /**
8698
+ * A to-one nested `update` payload: bare data OR the `{ where?, data }` wrapper.
8699
+ * Dispatch is DETERMINISTIC and structural — never try-this-then-that — so a
8700
+ * malformed wrapper surfaces the wrapper's own error rather than a union-wide miss,
8701
+ * and the form a payload takes never depends on the values inside it.
8702
+ *
8703
+ * This is the ONE place the rule is applied, because it is the only place that sees
8704
+ * the USER's payload: both arms emit the same canonical `{ data, where? }` envelope,
8705
+ * so no later reader (the update root, a target one level deeper, the nested-target
8706
+ * delegation) ever has to tell the spellings apart from an output that already
8707
+ * rewrote scalar shorthands. See {@link file://./to-one-update-form.ts} for the rule,
8708
+ * and for the collision it REFUSES: on a target that owns a field named `data`, the
8709
+ * envelope's shape is also how bare data spells that field, and only the caller can
8710
+ * say which was meant.
8711
+ */
8712
+ type ToOneUpdateTargetWithDataSchema<S$1 extends RelationState, UpdateSchema$1 extends V$1.Object<any, any>> = V$1.Union<readonly [ToOneUpdateWrapperSchema<S$1, UpdateSchema$1>, UpdateSchema$1]>;
8713
+ type ToOneUpdateTargetSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = ToOneUpdateTargetWithDataSchema<S$1, ProjectedNestedUpdate<Source, Key$1, S$1>>;
8714
+ /**
8715
+ * To-one update: { create?, connect?, connectOrCreate?, update?, upsert?, disconnect?, delete? }
8716
+ * disconnect and delete only available for optional relations.
8717
+ */
8718
+ type ToOneUpdateEntriesBase<Source extends AnyModel, Key$1, S$1 extends RelationState> = {
8719
+ create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
8720
+ connect: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
8721
+ connectOrCreate: V$1.Object<{
8722
+ where: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
8723
+ create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
8255
8724
  }, {
8256
8725
  partial: false;
8257
8726
  }>;
@@ -8299,17 +8768,17 @@ type ToOneUpdateSchema<Source extends AnyModel, Key$1, S$1 extends RelationState
8299
8768
  * Most operations accept single or array.
8300
8769
  */
8301
8770
  type ToManyUpdateEntries<Source extends AnyModel, Key$1, S$1 extends RelationState> = {
8302
- create: () => V$1.SingleOrArray<ProjectedNestedCreate<Source, Key$1, S$1>>;
8771
+ create: () => V$1.SingleOrArray<WithLinkWrite<ProjectedNestedCreate<Source, Key$1, S$1>, Source, Key$1, S$1>>;
8303
8772
  createMany: NestedCreateManySchema<Source, Key$1, S$1>;
8304
- connect: () => V$1.SingleOrArray<GetTargetSchemas<S$1>["core"]["whereUnique"]>;
8773
+ connect: () => V$1.SingleOrArray<WithLinkWrite<GetTargetSchemas<S$1>["core"]["whereUnique"], Source, Key$1, S$1>>;
8305
8774
  delete: () => V$1.SingleOrArray<GetTargetSchemas<S$1>["core"]["whereUniqueExtended"]>;
8306
- connectOrCreate: V$1.SingleOrArray<V$1.Object<{
8775
+ connectOrCreate: () => V$1.SingleOrArray<WithLinkWrite<V$1.Object<{
8307
8776
  where: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
8308
8777
  create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
8309
8778
  }, {
8310
8779
  partial: false;
8311
- }>>;
8312
- set: () => V$1.SingleOrArray<GetTargetSchemas<S$1>["core"]["whereUnique"]>;
8780
+ }>, Source, Key$1, S$1>>;
8781
+ set: () => V$1.SingleOrArray<WithLinkWrite<GetTargetSchemas<S$1>["core"]["whereUnique"], Source, Key$1, S$1>>;
8313
8782
  update: V$1.SingleOrArray<V$1.Object<{
8314
8783
  where: () => GetTargetSchemas<S$1>["core"]["whereUniqueExtended"];
8315
8784
  data: () => ProjectedNestedUpdate<Source, Key$1, S$1>;
@@ -9678,8 +10147,8 @@ type GetScalarsSchemas<Source extends AnyModel> = { [F in keyof Source["~"]["sta
9678
10147
  /**
9679
10148
  * Build scalar create schema - all scalar fields for create input
9680
10149
  */
9681
- type ModelStateOf$5<M$1 extends AnyModel> = M$1["~"]["state"];
9682
- type ModelRelations<M$1 extends AnyModel> = ModelStateOf$5<M$1>["relations"];
10150
+ type ModelStateOf$3<M$1 extends AnyModel> = M$1["~"]["state"];
10151
+ type ModelRelations<M$1 extends AnyModel> = ModelStateOf$3<M$1>["relations"];
9683
10152
  /** The local half of every foreign key this model's own relations store. */
9684
10153
  type ForeignKeyScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelRelations<M$1>]: ModelRelations<M$1>[K]["~"]["state"] extends {
9685
10154
  readonly foreignKey: {
@@ -9701,11 +10170,11 @@ type CreateRequirementGroup<M$1 extends AnyModel> = { [K in keyof ModelRelations
9701
10170
  type ScalarCreateEntries<F$1 extends {
9702
10171
  scalars: Record<string, unknown>;
9703
10172
  }> = V$1.FromObject<F$1["scalars"], "create">["entries"];
9704
- type RequiredModelScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelStateOf$5<M$1>["scalars"]]: ModelStateOf$5<M$1>["scalars"][K]["~"]["state"]["optional"] extends true ? never : Extract<K, string> }[keyof ModelStateOf$5<M$1>["scalars"]];
10173
+ type RequiredModelScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelStateOf$3<M$1>["scalars"]]: ModelStateOf$3<M$1>["scalars"][K]["~"]["state"]["optional"] extends true ? never : Extract<K, string> }[keyof ModelStateOf$3<M$1>["scalars"]];
9705
10174
  type RequiredScalarCreateKeys<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>, OmittedRequiredKeys extends string = never> = Extract<Exclude<RequiredModelScalarKeys<M$1>, OmittedRequiredKeys>, keyof ScalarCreateEntries<F$1>>;
9706
10175
  type NestedRequiredScalarKeys<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = RequiredScalarCreateKeys<M$1, F$1, ForeignKeyScalarKeys<M$1>>;
9707
10176
  type ScalarCreateSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.FromObject<F$1["scalars"], "create", {
9708
- atLeast: RequiredScalarKeys<ModelStateOf$5<M$1>["shape"]>[];
10177
+ atLeast: RequiredScalarKeys<ModelStateOf$3<M$1>["shape"]>[];
9709
10178
  }>;
9710
10179
  /**
9711
10180
  * Root `createMany` rows: the ORDINARY create data shape (plan §6 J1), minus the
@@ -9769,8 +10238,8 @@ interface NonNullableSchema<TWrapped extends VibSchema<any, any>, TInput = NonNu
9769
10238
  }
9770
10239
  //#endregion
9771
10240
  //#region src/validation/model/core/filter.d.ts
9772
- type ModelStateOf$4<M$1 extends AnyModel> = M$1["~"]["state"];
9773
- type UniqueScalarSchemas<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = Pick<F$1["scalars"], Extract<keyof F$1["scalars"], keyof ModelStateOf$4<M$1>["uniques"]>>;
10241
+ type ModelStateOf$2<M$1 extends AnyModel> = M$1["~"]["state"];
10242
+ type UniqueScalarSchemas<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = Pick<F$1["scalars"], Extract<keyof F$1["scalars"], keyof ModelStateOf$2<M$1>["uniques"]>>;
9774
10243
  type ScalarFilterSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.FromObject<F$1["scalars"], "filter">;
9775
10244
  /** A field's value schema in a unique selector: never `null`. */
9776
10245
  type UniqueMember<S$1> = S$1 extends {
@@ -9784,239 +10253,9 @@ type RelationFilterSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>>
9784
10253
  */
9785
10254
  /** A declared compound selector with every member's `null` removed. */
9786
10255
  type NonNullSelectors<Selectors> = { [Name in keyof Selectors]: Selectors[Name] extends ObjectSchema<infer Members, infer Options> ? ObjectSchema<{ [Member in keyof Members]: Members[Member] extends VibSchema<any, any> ? NonNullableSchema<Members[Member]> : Members[Member] }, Options> : Selectors[Name] };
9787
- type CompoundConstraintEntries<M$1 extends AnyModel> = (ModelStateOf$4<M$1>["compoundId"] extends Record<string, ObjectSchema<any>> ? NonNullSelectors<ModelStateOf$4<M$1>["compoundId"]> : Record<never, never>) & (ModelStateOf$4<M$1>["compoundUniques"] extends Record<string, ObjectSchema<any>> ? NonNullSelectors<ModelStateOf$4<M$1>["compoundUniques"]> : Record<never, never>);
10256
+ type CompoundConstraintEntries<M$1 extends AnyModel> = (ModelStateOf$2<M$1>["compoundId"] extends Record<string, ObjectSchema<any>> ? NonNullSelectors<ModelStateOf$2<M$1>["compoundId"]> : Record<never, never>) & (ModelStateOf$2<M$1>["compoundUniques"] extends Record<string, ObjectSchema<any>> ? NonNullSelectors<ModelStateOf$2<M$1>["compoundUniques"]> : Record<never, never>);
9788
10257
  type CompoundConstraintFilterSchema<M$1 extends AnyModel> = ObjectSchema<CompoundConstraintEntries<M$1>>;
9789
- type CompoundIdFilterSchema<M$1 extends AnyModel> = V$1.Object<NonNullSelectors<ModelStateOf$4<M$1>["compoundId"]>>;
9790
- //#endregion
9791
- //#region src/validation/model/core/projection.d.ts
9792
- type ModelStateOf$3<M$1 extends AnyModel> = M$1["~"]["state"];
9793
- /**
9794
- * The keys a model's `.omit()` hides for good. `undefined` (the common case,
9795
- * no `.omit()` at all) contributes nothing.
9796
- */
9797
- type ModelOmittedKeys<M$1 extends AnyModel> = ModelStateOf$3<M$1>["omit"] extends Record<string, true> ? StringKeyOf<ModelStateOf$3<M$1>["omit"]> : never;
9798
- /** Every scalar of the model that a query is allowed to project. */
9799
- type ProjectableScalarKeys<M$1 extends AnyModel> = Exclude<StringKeyOf<ModelStateOf$3<M$1>["scalars"]>, ModelOmittedKeys<M$1>>;
9800
- //#endregion
9801
- //#region src/validation/model/core/select.d.ts
9802
- /**
9803
- * Build select schema - boolean selection for each scalar field, nested select for relations
9804
- */
9805
- type ModelStateOf$2<M$1 extends AnyModel> = M$1["~"]["state"];
9806
- type ModelScalars<M$1 extends AnyModel> = ModelStateOf$2<M$1>["scalars"];
9807
- type ScalarStateOf$1<F$1> = F$1 extends {
9808
- "~": {
9809
- state: infer S;
9810
- };
9811
- } ? S extends ScalarState ? S : never : never;
9812
- type AnyVectorScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelScalars<M$1>]: ScalarStateOf$1<ModelScalars<M$1>[K]>["type"] extends "vector" ? K extends string ? K : never : never }[keyof ModelScalars<M$1>];
9813
- type AnyPointScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelScalars<M$1>]: ScalarStateOf$1<ModelScalars<M$1>[K]>["type"] extends "point" ? K extends string ? K : never : never }[keyof ModelScalars<M$1>];
9814
- /**
9815
- * Both halves of the select schema are keyed on {@link ProjectableScalarKeys},
9816
- * so a model-level `.omit()`-ed scalar has no `select` entry at all: naming it
9817
- * is an "Unknown key" parse failure rather than a way around the schema's own
9818
- * exclusion. See `projection.ts` for why that layer is hard and the other two
9819
- * are not.
9820
- */
9821
- type VectorScalarKeys<M$1 extends AnyModel> = Extract<ProjectableScalarKeys<M$1>, AnyVectorScalarKeys<M$1>>;
9822
- type PointScalarKeys$1<M$1 extends AnyModel> = Extract<ProjectableScalarKeys<M$1>, AnyPointScalarKeys<M$1>>;
9823
- type PlainScalarKeys<M$1 extends AnyModel> = Exclude<ProjectableScalarKeys<M$1>, AnyVectorScalarKeys<M$1> | AnyPointScalarKeys<M$1>>;
9824
- declare const scalarSelectSchema: BooleanSchema<boolean | undefined, boolean>;
9825
- /** The desugared shorthand: one `true` entry per counted relation. */
9826
- type CountAllSelection = Record<string, true>;
9827
- /** Both relation namespaces a `_count` (and an `include`) reaches across. */
9828
- type RelationSchemaBundle = {
9829
- relations: Record<string, any>;
9830
- polymorphic: Record<string, any>;
9831
- };
9832
- /**
9833
- * `_count` accepts either Prisma's shorthand `true` or the explicit
9834
- * `{ select: { <relation>: true | { where } } }` object. The shorthand is
9835
- * desugared here, so everything downstream (query engine, result parser) only
9836
- * ever sees the object form.
9837
- */
9838
- type CountSchema<F$1 extends RelationSchemaBundle> = V$1.Union<readonly [V$1.Coerce<V$1.Literal<true>, {
9839
- select: CountAllSelection;
9840
- }>, V$1.Object<{
9841
- select: V$1.Object<V$1.FromObject<F$1["relations"], "countFilter", {
9842
- optional: true;
9843
- }>["entries"] & V$1.FromObject<F$1["polymorphic"], "countFilter", {
9844
- optional: true;
9845
- }>["entries"], {
9846
- optional: true;
9847
- }>;
9848
- }, {
9849
- optional: true;
9850
- }>]>;
9851
- declare const vectorScalarSelectSchema: UnionSchema<readonly [BooleanSchema<boolean | undefined, boolean>, ObjectSchema<{
9852
- _distance: ObjectSchema<{
9853
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9854
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9855
- }, {
9856
- readonly partial: false;
9857
- }, InferInputShape<{
9858
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9859
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9860
- }>, InferOutputShape<{
9861
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9862
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9863
- }>>;
9864
- }, {
9865
- readonly partial: false;
9866
- }, InferInputShape<{
9867
- _distance: ObjectSchema<{
9868
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9869
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9870
- }, {
9871
- readonly partial: false;
9872
- }, InferInputShape<{
9873
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9874
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9875
- }>, InferOutputShape<{
9876
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9877
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9878
- }>>;
9879
- }>, InferOutputShape<{
9880
- _distance: ObjectSchema<{
9881
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9882
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9883
- }, {
9884
- readonly partial: false;
9885
- }, InferInputShape<{
9886
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9887
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9888
- }>, InferOutputShape<{
9889
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9890
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9891
- }>>;
9892
- }>>], boolean | InferInputShape<{
9893
- _distance: ObjectSchema<{
9894
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9895
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9896
- }, {
9897
- readonly partial: false;
9898
- }, InferInputShape<{
9899
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9900
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9901
- }>, InferOutputShape<{
9902
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9903
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9904
- }>>;
9905
- }> | undefined, boolean | InferOutputShape<{
9906
- _distance: ObjectSchema<{
9907
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9908
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9909
- }, {
9910
- readonly partial: false;
9911
- }, InferInputShape<{
9912
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9913
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9914
- }>, InferOutputShape<{
9915
- to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
9916
- metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
9917
- }>>;
9918
- }>>;
9919
- type VectorScalarSelectSchema = typeof vectorScalarSelectSchema;
9920
- declare const pointScalarSelectSchema: UnionSchema<readonly [BooleanSchema<boolean | undefined, boolean>, ObjectSchema<{
9921
- _distance: ObjectSchema<{
9922
- to: PointSchema<GeoPoint, GeoPoint>;
9923
- }, {
9924
- readonly partial: false;
9925
- }, InferInputShape<{
9926
- to: PointSchema<GeoPoint, GeoPoint>;
9927
- }>, InferOutputShape<{
9928
- to: PointSchema<GeoPoint, GeoPoint>;
9929
- }>>;
9930
- }, {
9931
- readonly partial: false;
9932
- }, InferInputShape<{
9933
- _distance: ObjectSchema<{
9934
- to: PointSchema<GeoPoint, GeoPoint>;
9935
- }, {
9936
- readonly partial: false;
9937
- }, InferInputShape<{
9938
- to: PointSchema<GeoPoint, GeoPoint>;
9939
- }>, InferOutputShape<{
9940
- to: PointSchema<GeoPoint, GeoPoint>;
9941
- }>>;
9942
- }>, InferOutputShape<{
9943
- _distance: ObjectSchema<{
9944
- to: PointSchema<GeoPoint, GeoPoint>;
9945
- }, {
9946
- readonly partial: false;
9947
- }, InferInputShape<{
9948
- to: PointSchema<GeoPoint, GeoPoint>;
9949
- }>, InferOutputShape<{
9950
- to: PointSchema<GeoPoint, GeoPoint>;
9951
- }>>;
9952
- }>>], boolean | InferInputShape<{
9953
- _distance: ObjectSchema<{
9954
- to: PointSchema<GeoPoint, GeoPoint>;
9955
- }, {
9956
- readonly partial: false;
9957
- }, InferInputShape<{
9958
- to: PointSchema<GeoPoint, GeoPoint>;
9959
- }>, InferOutputShape<{
9960
- to: PointSchema<GeoPoint, GeoPoint>;
9961
- }>>;
9962
- }> | undefined, boolean | InferOutputShape<{
9963
- _distance: ObjectSchema<{
9964
- to: PointSchema<GeoPoint, GeoPoint>;
9965
- }, {
9966
- readonly partial: false;
9967
- }, InferInputShape<{
9968
- to: PointSchema<GeoPoint, GeoPoint>;
9969
- }>, InferOutputShape<{
9970
- to: PointSchema<GeoPoint, GeoPoint>;
9971
- }>>;
9972
- }>>;
9973
- type PointScalarSelectSchema = typeof pointScalarSelectSchema;
9974
- /**
9975
- * A written `select` names what the row carries, so one that names nothing
9976
- * (`{}`, only `false`, or a `_count` that counts no relation, as `_count: true`
9977
- * does on a model with no to-many relation) is a caller mistake, refused at its
9978
- * own path. Leaving `select` out is how a caller asks for the default row.
9979
- */
9980
- declare const requireSelectedField: (select: Record<string, unknown>) => string | undefined;
9981
- /** The refusal every written `select` carries ({@link requireSelectedField}). */
9982
- type SelectRefusal = {
9983
- readonly refuse: typeof requireSelectedField;
9984
- };
9985
- type SelectSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.Object<V$1.FromKeys<PlainScalarKeys<M$1>[], typeof scalarSelectSchema>["entries"] & V$1.FromKeys<VectorScalarKeys<M$1>[], VectorScalarSelectSchema>["entries"] & V$1.FromKeys<PointScalarKeys$1<M$1>[], PointScalarSelectSchema>["entries"] & V$1.FromObject<F$1["relations"], "select">["entries"] & V$1.FromObject<F$1["polymorphic"], "select">["entries"] & {
9986
- _count: CountSchema<F$1>;
9987
- }, SelectRefusal>;
9988
- /**
9989
- * The SCALAR-ONLY projection: {@link SelectSchema} without relation keys and
9990
- * without `_count`.
9991
- *
9992
- * This is the projection of a bulk write (`createMany` / `updateMany` /
9993
- * `deleteMany` with a `select`). Those rows come out of the write statement's
9994
- * `RETURNING` clause — an expression list with no table alias to correlate
9995
- * against — so a relation subquery embedded there binds its outer column
9996
- * reference by NAME and is silently captured by the inner table whenever the two
9997
- * share a column name. The observable result was wrong data, not an error: a
9998
- * to-many relation always came back `[]`, and a self-referencing to-one came
9999
- * back `null`, while the identical projection through `findMany` returned the
10000
- * real rows. Refusing the key is the fail-closed answer; read relations in a
10001
- * separate query, which is what the underlying implementation would have to do
10002
- * anyway.
10003
- *
10004
- * Prisma divergence, deliberate: Prisma's `createManyAndReturn` /
10005
- * `updateManyAndReturn` DO accept relations here — its generator emits dedicated
10006
- * `<Model>SelectCreateManyAndReturn` / `<Model>IncludeCreateManyAndReturn` types
10007
- * (prisma 6.8.2, `prisma-client/generator-build`, `Model.argsTypes`).
10008
- */
10009
- type ScalarSelectSchema<M$1 extends AnyModel> = V$1.Object<V$1.FromKeys<PlainScalarKeys<M$1>[], typeof scalarSelectSchema>["entries"] & V$1.FromKeys<VectorScalarKeys<M$1>[], VectorScalarSelectSchema>["entries"] & V$1.FromKeys<PointScalarKeys$1<M$1>[], PointScalarSelectSchema>["entries"], SelectRefusal>;
10010
- /**
10011
- * Build include schema - nested include for each relation
10012
- */
10013
- type IncludeSchema<F$1 extends RelationSchemaBundle> = V$1.Object<V$1.FromObject<F$1["relations"], "include", {
10014
- optional: true;
10015
- }>["entries"] & {
10016
- _count: CountSchema<F$1>;
10017
- } & V$1.FromObject<F$1["polymorphic"], "include", {
10018
- optional: true;
10019
- }>["entries"]>;
10258
+ type CompoundIdFilterSchema<M$1 extends AnyModel> = V$1.Object<NonNullSelectors<ModelStateOf$2<M$1>["compoundId"]>>;
10020
10259
  //#endregion
10021
10260
  //#region src/validation/model/core/update.d.ts
10022
10261
  /**
@@ -11028,11 +11267,13 @@ type ModelShape = Record<string, AnyModelField>;
11028
11267
  * member's type, so it cannot change what a shape infers. Each key's type is
11029
11268
  * its reason spelled as a string literal, so the diagnostic a caller reads
11030
11269
  * names it: no model member is a string, so nothing a shape can hold
11031
- * satisfies it.
11270
+ * satisfies it. `$through` is a selection's own key too, refused at runtime as
11271
+ * no identifier (F001); this names the reason a caller would otherwise guess at.
11032
11272
  */
11033
11273
  type DeclaredModelShape = ModelShape & {
11034
11274
  readonly _count?: "`_count` is reserved for relation counts (F010)";
11035
11275
  readonly _distance?: "`_distance` is reserved for distance results (F010)";
11276
+ readonly $through?: "`$through` is reserved for a relation's link row (F010)";
11036
11277
  };
11037
11278
  type NameFromKeys<TFields extends string[], TName extends string = ""> = TFields extends readonly [infer F extends string, ...infer R extends string[]] ? R extends [] ? `${TName}_${F}` : NameFromKeys<R, TName extends "" ? F : `${TName}_${F}`> : never;
11038
11279
  type ToString<T$1> = T$1 extends string | number | bigint | boolean | null | undefined ? `${T$1}` : never;
@@ -11558,7 +11799,11 @@ type WhereLogicalKey = "AND" | "OR" | "NOT";
11558
11799
  type WhereLogicalKeys<M$1 extends Model$1<any>> = Exclude<WhereLogicalKey, keyof M$1["~"]["state"]["shape"]>;
11559
11800
  type WhereModelKeys<M$1 extends Model$1<any>> = keyof M$1["~"]["state"]["shape"] | WhereLogicalKey;
11560
11801
  /** The unknown keys inside the quantifiers `Q` a relation filter spelled. */
11561
- type QuantifiedWhereUnknownKeys<Given, R$1 extends AnyRelation, Seen, Q$1 extends PropertyKey> = { [K in Extract<SpelledClauseKeys<Given>, Q$1>]: WhereUnknownKeys<ValueAt<Given, K>, GetTargetModel<R$1>, Seen> }[Extract<SpelledClauseKeys<Given>, Q$1>];
11802
+ type QuantifiedWhereUnknownKeys<Given, R$1 extends AnyRelation, Seen, Q$1 extends PropertyKey, LinkModel = never> = { [K in Extract<SpelledClauseKeys<Given>, Q$1>]: WhereUnknownKeys<ValueAt<Given, K>, GetTargetModel<R$1>, Seen, WhereModelKeys<GetTargetModel<R$1>> | ([LinkModel] extends [never] ? never : "$through")> | LinkFilterUnknownKeys<ValueAt<Given, K>, LinkModel> }[Extract<SpelledClauseKeys<Given>, Q$1>];
11803
+ /** A `$through` filter's keys: the junction model's scalars and nothing else. */
11804
+ type LinkFilterUnknownKeys<Given, LinkModel> = [LinkModel] extends [never] ? never : LinkModel extends Model$1<any> ? Given extends {
11805
+ readonly $through: infer Filter;
11806
+ } ? Exclude<keyof Filter, keyof LinkModel["~"]["state"]["scalars"]> : never : never;
11562
11807
  /**
11563
11808
  * The selectors among `Q` that `Given` spells with a value. The runtime reads
11564
11809
  * one whose only value is `undefined` as absent (`withRecursiveNode` drops an
@@ -11573,13 +11818,13 @@ type DefinedSelectors<Given, Q$1 extends PropertyKey> = { [K in Q$1]: [Exclude<V
11573
11818
  * filter with a defined `is` / `isNot` is the explicit form, and any other is
11574
11819
  * the shorthand, beside which an undefined `recurse` / `self` is absent.
11575
11820
  */
11576
- type RelationWhereUnknownKeys<Given, R$1 extends AnyRelation, Seen> = TargetKind<R$1> extends "model" ? [DefinedSelectors<Given, "recurse">] extends [never] ? Cardinality<R$1> extends "one" ? [DefinedSelectors<Given, "is" | "isNot">] extends [never] ? WhereUnknownKeys<Given, GetTargetModel<R$1>, Seen, WhereModelKeys<GetTargetModel<R$1>> | Exclude<"recurse" | "self", DefinedSelectors<Given, "self">>> : QuantifiedWhereUnknownKeys<Given, R$1, Seen, "is" | "isNot"> : QuantifiedWhereUnknownKeys<Given, R$1, Seen, "some" | "every" | "none"> : QuantifiedWhereUnknownKeys<Given, R$1, Seen, "some" | "every" | "none"> | MisspelledRecurrenceKeys<ValueAt<Given, "recurse">, FilterRecurrenceOptionKey> : never;
11821
+ type RelationWhereUnknownKeys<Given, R$1 extends AnyRelation, Seen, LinkModel = never> = TargetKind<R$1> extends "model" ? [DefinedSelectors<Given, "recurse">] extends [never] ? Cardinality<R$1> extends "one" ? [DefinedSelectors<Given, "is" | "isNot">] extends [never] ? WhereUnknownKeys<Given, GetTargetModel<R$1>, Seen, WhereModelKeys<GetTargetModel<R$1>> | Exclude<"recurse" | "self", DefinedSelectors<Given, "self">>> : QuantifiedWhereUnknownKeys<Given, R$1, Seen, "is" | "isNot"> : QuantifiedWhereUnknownKeys<Given, R$1, Seen, "some" | "every" | "none", LinkModel> : QuantifiedWhereUnknownKeys<Given, R$1, Seen, "some" | "every" | "none"> | MisspelledRecurrenceKeys<ValueAt<Given, "recurse">, FilterRecurrenceOptionKey> : never;
11577
11822
  /**
11578
11823
  * The misspelled model keys of one WHERE value, at every depth it names. An
11579
11824
  * `any` value states no key and is not walked: its array arm would unwrap it
11580
11825
  * to itself until TS2589.
11581
11826
  */
11582
- type WhereUnknownKeys<Given, M$1 extends Model$1<any>, Seen = never, Allowed extends PropertyKey = WhereModelKeys<M$1>> = 0 extends 1 & Given ? never : Given extends readonly unknown[] ? WhereUnknownKeys<Given[number], M$1, Seen, Allowed> : Given extends object ? string extends keyof Given ? never : Exclude<keyof Given, Allowed> | (SeenValue<Given, M$1, Seen> extends true ? never : { [K in Extract<WhereWalkKeys<Given, M$1>, WhereLogicalKeys<M$1> | keyof M$1["~"]["state"]["relations"]>]: K extends WhereLogicalKeys<M$1> ? WhereUnknownKeys<NonNullable<Given[K]>, M$1, Seen | readonly [Given, M$1]> : K extends keyof M$1["~"]["state"]["relations"] ? RelationWhereUnknownKeys<NonNullable<Given[K]>, M$1["~"]["state"]["relations"][K], Seen | readonly [Given, M$1]> : never }[Extract<WhereWalkKeys<Given, M$1>, WhereLogicalKeys<M$1> | keyof M$1["~"]["state"]["relations"]>]) : never;
11827
+ type WhereUnknownKeys<Given, M$1 extends Model$1<any>, Seen = never, Allowed extends PropertyKey = WhereModelKeys<M$1>> = 0 extends 1 & Given ? never : Given extends readonly unknown[] ? WhereUnknownKeys<Given[number], M$1, Seen, Allowed> : Given extends object ? string extends keyof Given ? never : Exclude<keyof Given, Allowed> | (SeenValue<Given, M$1, Seen> extends true ? never : { [K in Extract<WhereWalkKeys<Given, M$1>, WhereLogicalKeys<M$1> | keyof M$1["~"]["state"]["relations"]>]: K extends WhereLogicalKeys<M$1> ? WhereUnknownKeys<NonNullable<Given[K]>, M$1, Seen | readonly [Given, M$1]> : K extends keyof M$1["~"]["state"]["relations"] ? RelationWhereUnknownKeys<NonNullable<Given[K]>, M$1["~"]["state"]["relations"][K], Seen | readonly [Given, M$1], LinkRowKey<M$1, K>> : never }[Extract<WhereWalkKeys<Given, M$1>, WhereLogicalKeys<M$1> | keyof M$1["~"]["state"]["relations"]>]) : never;
11583
11828
  /**
11584
11829
  * The keys of one WHERE object the walk descends. A value whose type states
11585
11830
  * every key of the model's WHERE is the client's own payload, under any of its
@@ -11629,7 +11874,15 @@ type WrittenKeys<Given> = Given extends object ? keyof { [K in keyof Given as st
11629
11874
  * Selectors (`where`, `connect`, …) stay unkeyed, as
11630
11875
  * `contextual-typing-gate.core.types.ts` pins.
11631
11876
  */
11632
- type NestedWriteUnknownKeys<Data$1, M$1 extends Model$1<any>> = Data$1 extends readonly unknown[] ? NestedWriteUnknownKeys<Data$1[number], M$1> : { [K in Extract<RequiredSpelledKeys<Data$1>, keyof M$1["~"]["state"]["relations"]>]: TargetKind<M$1["~"]["state"]["relations"][K]> extends "model" ? TargetWriteUnknownKeys<NonNullable<ValueAt<Data$1, K>>, GetTargetModel<M$1["~"]["state"]["relations"][K]>> : never }[Extract<RequiredSpelledKeys<Data$1>, keyof M$1["~"]["state"]["relations"]>];
11877
+ type NestedWriteUnknownKeys<Data$1, M$1 extends Model$1<any>> = Data$1 extends readonly unknown[] ? NestedWriteUnknownKeys<Data$1[number], M$1> : { [K in Extract<RequiredSpelledKeys<Data$1>, keyof M$1["~"]["state"]["relations"]>]: TargetKind<M$1["~"]["state"]["relations"][K]> extends "model" ? TargetWriteUnknownKeys<NonNullable<ValueAt<Data$1, K>>, GetTargetModel<M$1["~"]["state"]["relations"][K]>, keyof GetTargetModel<M$1["~"]["state"]["relations"][K]>["~"]["state"]["shape"] | ([LinkRowKey<M$1, K>] extends [never] ? never : "$through")> | LinkWriteUnknownKeys<NonNullable<ValueAt<Data$1, K>>, LinkWriteKeys<M$1, K, M$1["~"]["state"]["relations"][K]>, LinkRowKey<M$1, K>> : never }[Extract<RequiredSpelledKeys<Data$1>, keyof M$1["~"]["state"]["relations"]>];
11878
+ /**
11879
+ * The keys a nested write's `$through` names outside what the slot may write,
11880
+ * and the key itself where the slot has no link row to write. Only the verbs
11881
+ * that link read one, each entry walked as the caller wrote it.
11882
+ */
11883
+ type LinkWriteUnknownKeys<Verbs$1, Allowed, LinkModel> = ElementOf<NonNullable<ValueAt<Verbs$1, Extract<RequiredSpelledKeys<Verbs$1>, "connect" | "create" | "connectOrCreate" | "set">>>> extends infer Entry ? Entry extends {
11884
+ readonly $through: infer Written;
11885
+ } ? [LinkModel] extends [never] ? "$through" : Exclude<keyof Written, Allowed> : never : never;
11633
11886
  type TargetWriteUnknownKeys<Verbs$1, T$1 extends Model$1<any>, Keys$1 extends PropertyKey = keyof T$1["~"]["state"]["shape"]> = NestedWriteData<Verbs$1, Keys$1> extends infer Data ? Data extends object ? Exclude<RequiredSpelledKeys<Data>, Keys$1> | NestedWriteUnknownKeys<Data, T$1> : never : never;
11634
11887
  /**
11635
11888
  * Whether the argument SPELLED `Clause`. A literal's keys are required; a
@@ -11751,7 +12004,17 @@ type RecursiveRootClause<Arg, M$1 extends Model$1<any>, Clause extends "select"
11751
12004
  * The operation's own projection. Its members meet the node guard directly,
11752
12005
  * so a misspelling one relation deep is reported on the key itself.
11753
12006
  */
11754
- type RecursiveRootMembers<Clause, M$1> = { [Key in SpelledClauseKeys<NonNullable<Clause>>]?: RecursiveNodeGuard<ValueAt<NonNullable<Clause>, Key>, RelationTarget<M$1, Key>> };
12007
+ type RecursiveRootMembers<Clause, M$1> = { [Key in SpelledClauseKeys<NonNullable<Clause>>]?: RecursiveNodeGuard<ValueAt<NonNullable<Clause>, Key>, RelationTarget<M$1, Key>, LinkRowKey<M$1, Key>> };
12008
+ /** The model a slot's `$through` reads; `never` where it has none to read. */
12009
+ type LinkRowKey<M$1, Key$1> = M$1 extends Model$1<any> ? Key$1 extends keyof M$1["~"]["state"]["relations"] ? JunctionModelOf<M$1, Key$1, M$1["~"]["state"]["relations"][Key$1]> : never : never;
12010
+ /** A node's `$through`: its `select` names the junction model's scalars only. */
12011
+ type LinkRowSeal<Clause, LinkModel> = [LinkModel] extends [never] ? unknown : LinkModel extends Model$1<any> ? "$through" extends keyof NonNullable<Clause> ? NonNullable<Clause>["$through" & keyof NonNullable<Clause>] extends {
12012
+ readonly select: infer Selected;
12013
+ } ? {
12014
+ $through?: {
12015
+ select?: { [Key in Exclude<WrittenKeys<NonNullable<Selected>>, keyof LinkModel["~"]["state"]["scalars"]>]?: undefined };
12016
+ };
12017
+ } : unknown : unknown : unknown;
11755
12018
  /** The model a relation key targets; `never` (nothing to key) otherwise. */
11756
12019
  type RelationTarget<M$1, Key$1> = M$1 extends Model$1<any> ? Key$1 extends keyof M$1["~"]["state"]["relations"] ? TargetKind<M$1["~"]["state"]["relations"][Key$1]> extends "model" ? GetTargetModel<M$1["~"]["state"]["relations"][Key$1]> : never : never : never;
11757
12020
  /**
@@ -11759,7 +12022,7 @@ type RelationTarget<M$1, Key$1> = M$1 extends Model$1<any> ? Key$1 extends keyof
11759
12022
  * admit one, states nothing: the guard is for what a caller spelled, and TS
11760
12023
  * falls back to the payload type itself when an argument fails it.
11761
12024
  */
11762
- type RecursiveNodeGuard<Node, T$1> = [Exclude<Node, null | undefined>] extends [object] ? RecursiveNodeObjectGuard<Exclude<Node, null | undefined>, T$1> : unknown;
12025
+ type RecursiveNodeGuard<Node, T$1, LinkKey = never> = [Exclude<Node, null | undefined>] extends [object] ? RecursiveNodeObjectGuard<Exclude<Node, null | undefined>, T$1, LinkKey> : unknown;
11763
12026
  type ExclusiveSelection<Node> = Node extends {
11764
12027
  select: object;
11765
12028
  include: object;
@@ -11768,14 +12031,14 @@ type ExclusiveSelection<Node> = Node extends {
11768
12031
  } | {
11769
12032
  include?: undefined;
11770
12033
  } : unknown;
11771
- type RecursiveNodeObjectGuard<Node, T$1> = ExclusiveSelection<Node> & ("recurse" extends keyof Node ? {
12034
+ type RecursiveNodeObjectGuard<Node, T$1, LinkKey> = ExclusiveSelection<Node> & ("recurse" extends keyof Node ? {
11772
12035
  recurse?: RecurrenceBagGuard<Node["recurse"]>;
11773
12036
  } : unknown) & ("select" extends keyof Node ? {
11774
- select?: RecursiveProjectionGuard<Node["select"], T$1> & ProjectionKeySeal<Node["select"], T$1, "select">;
12037
+ select?: RecursiveProjectionGuard<Node["select"], T$1> & ProjectionKeySeal<Node["select"], T$1, "select", "recurse" extends keyof Node ? never : LinkKey>;
11775
12038
  } : unknown) & ("include" extends keyof Node ? {
11776
- include?: RecursiveProjectionGuard<Node["include"], T$1> & ProjectionKeySeal<Node["include"], T$1, "include">;
12039
+ include?: RecursiveProjectionGuard<Node["include"], T$1> & ProjectionKeySeal<Node["include"], T$1, "include", "recurse" extends keyof Node ? never : LinkKey>;
11777
12040
  } : unknown) & ("where" extends keyof Node ? {
11778
- where?: NodeWhereSeal<Node["where"], T$1>;
12041
+ where?: NodeWhereSeal<Node["where"], T$1, "recurse" extends keyof Node ? never : LinkKey>;
11779
12042
  } : unknown) & ("variants" extends keyof Node ? {
11780
12043
  variants?: RecursiveProjectionGuard<Node["variants"], never>;
11781
12044
  } : unknown) & RecursiveProjectionGuard<Node, never, RelationNodeClauseKey>;
@@ -11785,7 +12048,7 @@ type RecursiveNodeObjectGuard<Node, T$1> = ExclusiveSelection<Node> & ("recurse"
11785
12048
  * the walk through a type parameter. A generic NODE whose constraint spells
11786
12049
  * `select`, `include` or `where` is refused: those keys cannot be proven.
11787
12050
  */
11788
- type RecursiveProjectionGuard<Clause, T$1, Skipped extends PropertyKey = never> = { [Key in Exclude<SpelledClauseKeys<NonNullable<Clause>>, Skipped>]?: boolean | RecursiveNodeGuard<ValueAt<NonNullable<Clause>, Key>, RelationTarget<T$1, Key>> };
12051
+ type RecursiveProjectionGuard<Clause, T$1, Skipped extends PropertyKey = never> = { [Key in Exclude<SpelledClauseKeys<NonNullable<Clause>>, Skipped>]?: boolean | RecursiveNodeGuard<ValueAt<NonNullable<Clause>, Key>, RelationTarget<T$1, Key>, LinkRowKey<T$1, Key>> };
11789
12052
  /**
11790
12053
  * A model-target node's `select` / `include` keys, beside `_count`: every
11791
12054
  * key the value names, optional ones included, is refused as `?: undefined`.
@@ -11794,9 +12057,9 @@ type RecursiveProjectionGuard<Clause, T$1, Skipped extends PropertyKey = never>
11794
12057
  * recursive node, and the recursive arm's projection carries the asking key as
11795
12058
  * a refused `?: undefined` member.
11796
12059
  */
11797
- type ProjectionKeySeal<Clause, T$1, Kind$1 extends "select" | "include"> = [T$1] extends [never] ? unknown : T$1 extends Model$1<any> ? { [Key in Exclude<WrittenKeys<NonNullable<Clause>>, "_count" | keyof T$1["~"]["state"][Kind$1 extends "select" ? "shape" : "relations"]>]?: undefined } : unknown;
12060
+ type ProjectionKeySeal<Clause, T$1, Kind$1 extends "select" | "include", LinkModel> = [T$1] extends [never] ? unknown : T$1 extends Model$1<any> ? { [Key in Exclude<WrittenKeys<NonNullable<Clause>>, "_count" | ([LinkModel] extends [never] ? never : "$through") | keyof T$1["~"]["state"][Kind$1 extends "select" ? "shape" : "relations"]>]?: undefined } & LinkRowSeal<Clause, LinkModel> : unknown;
11798
12061
  /** A model-target node's `where`, walked as the root WHERE is. */
11799
- type NodeWhereSeal<Where, T$1> = [T$1] extends [never] ? unknown : T$1 extends Model$1<any> ? WhereUnknownKeys<NonNullable<Where>, T$1> extends infer Extra ? [Extra] extends [never] ? unknown : UnknownClauseKey<Extra> : unknown : unknown;
12062
+ type NodeWhereSeal<Where, T$1, LinkModel = never> = [T$1] extends [never] ? unknown : T$1 extends Model$1<any> ? WhereUnknownKeys<NonNullable<Where>, T$1, never, WhereModelKeys<T$1> | ([LinkModel] extends [never] ? never : "$through")> | LinkFilterUnknownKeys<NonNullable<Where>, LinkModel> extends infer Extra ? [Extra] extends [never] ? unknown : UnknownClauseKey<Extra> : unknown : unknown;
11800
12063
  type ScalarStateOf<Field$1, Kind$1 extends ScalarType> = Field$1 extends {
11801
12064
  readonly "~": {
11802
12065
  readonly state: infer State extends ScalarState<Kind$1>;
@@ -12926,11 +13189,6 @@ interface DatabaseAdapter {
12926
13189
  lte: (left: Sql, right: Sql) => Sql;
12927
13190
  gt: (left: Sql, right: Sql) => Sql;
12928
13191
  gte: (left: Sql, right: Sql) => Sql;
12929
- like: (column: Sql, pattern: Sql) => Sql;
12930
- notLike: (column: Sql, pattern: Sql) => Sql;
12931
- /** Case-insensitive LIKE. */
12932
- ilike: (column: Sql, pattern: Sql) => Sql;
12933
- notIlike: (column: Sql, pattern: Sql) => Sql;
12934
13192
  /** Case-sensitive substring predicates, independent of database collation. */
12935
13193
  containsText: (column: Sql, value: Sql) => Sql;
12936
13194
  startsWithText: (column: Sql, value: Sql) => Sql;
@@ -13675,10 +13933,6 @@ declare class MySQLAdapter implements DatabaseAdapter {
13675
13933
  isNotNull: (expr: Sql) => Sql;
13676
13934
  in: (column: Sql, values: Sql) => Sql;
13677
13935
  notIn: (column: Sql, values: Sql) => Sql;
13678
- like: (column: Sql, pattern: Sql) => Sql;
13679
- notLike: (column: Sql, pattern: Sql) => Sql;
13680
- ilike: (column: Sql, pattern: Sql) => Sql;
13681
- notIlike: (column: Sql, pattern: Sql) => Sql;
13682
13936
  containsText: (column: Sql, value: Sql) => Sql;
13683
13937
  startsWithText: (column: Sql, value: Sql) => Sql;
13684
13938
  endsWithText: (column: Sql, value: Sql) => Sql;
@@ -13917,10 +14171,6 @@ declare class PostgresAdapter implements DatabaseAdapter {
13917
14171
  notBetween: (column: Sql, min: Sql, max: Sql) => Sql;
13918
14172
  isNull: (expr: Sql) => Sql;
13919
14173
  isNotNull: (expr: Sql) => Sql;
13920
- like: (column: Sql, pattern: Sql) => Sql;
13921
- notLike: (column: Sql, pattern: Sql) => Sql;
13922
- ilike: (column: Sql, pattern: Sql) => Sql;
13923
- notIlike: (column: Sql, pattern: Sql) => Sql;
13924
14174
  containsText: (column: Sql, value: Sql) => Sql;
13925
14175
  startsWithText: (column: Sql, value: Sql) => Sql;
13926
14176
  endsWithText: (column: Sql, value: Sql) => Sql;
@@ -14232,10 +14482,6 @@ declare class SQLiteAdapter implements DatabaseAdapter {
14232
14482
  isNotNull: (expr: Sql) => Sql;
14233
14483
  in: (column: Sql, values: Sql) => Sql;
14234
14484
  notIn: (column: Sql, values: Sql) => Sql;
14235
- like: (column: Sql, pattern: Sql) => Sql;
14236
- notLike: (column: Sql, pattern: Sql) => Sql;
14237
- ilike: (column: Sql, pattern: Sql) => Sql;
14238
- notIlike: (column: Sql, pattern: Sql) => Sql;
14239
14485
  containsText: (column: Sql, value: Sql) => Sql;
14240
14486
  startsWithText: (column: Sql, value: Sql) => Sql;
14241
14487
  endsWithText: (column: Sql, value: Sql) => Sql;
@@ -14435,4 +14681,4 @@ declare const mysqlAdapter: MySQLAdapter;
14435
14681
  declare const postgresAdapter: PostgresAdapter;
14436
14682
  declare const sqliteAdapter: SQLiteAdapter;
14437
14683
  //#endregion
14438
- export { ModelOperationInput as $, MYSQL as $i, Model$1 as $n, JunctionReferentialAction as $r, ClientExtensionState as $t, Schema$1 as A, isCheckConstraintError as Ai, WithCacheOptions as An, IsoTimestampSchema as Ar, DelegateOperationResult as At, VariantToOneRelation as B, VibORMError as Bi, V$1 as Bn, toJsonSchema as Br, OfficialCacheExtension as Bt, Client as C, MigrationError as Ci, UnwrapPendingOperations as Cn, JsonSchema as Cr, s as Ct, OperationPayloadSchema as D, NotNullConstraintError as Di, CacheSetOptions as Dn, BaseIsoTimestampSchema as Dr, renderSchemaType as Dt, OperationPayload as E, ForeignKeyError as Ei, CacheEntry as En, BaseIsoTimeSchema as Er, renderOperationResultType as Et, LinkedClientConfig as F, CacheConfigurationError as Fi, BatchQuery as Fn, BaseBlobSchema as Fr, NoExtraDriverConfigKeys as Ft, ParseResult as G, wrapError as Gi, ModelFieldRefs as Gn, JsonNull as Gr, PlacedControl as Gt, BigIntScalar as H, isRetryableError as Hi, StringSchema as Hn, AnyJsonNullSentinel as Hr, DefinitionControls as Ht, Links$1 as I, CacheInvalidKeyError as Ii, CommittedBatchNotification as In, BlobSchema as Ir, VibORMClient as It, SchemaRegistryOperation as J, GeoBounds as Ji, AnyModel as Jn, isJsonNullSentinel as Jr, ClientExtension as Jt, Prettify as K, DiagnosticDisclosure as Ki, createModelFieldRefs as Kn, JsonNullKind as Kr, RowsVerbs as Kt, RelationLinks as L, CacheInvalidTTLError as Li, Dialect as Ln, BaseBigIntSchema as Lr, VibORMConfig as Lt, ClientSchema as M, isNotNullConstraintError as Mi, BatchTransactionOptions as Mn, EnumSchema as Mr, ExtendedClient as Mt, FlatSchema as N, isUniqueConstraintError as Ni, DriverTransactionOptions as Nn, BaseBooleanSchema as Nr, ExtendedOperationResult as Nt, OperationResult as O, UniqueConstraintError as Oi, WaitUntilFn as On, IsoDateSchema as Or, validateOperationPayload as Ot, Linked as P, isValueTooLongError as Pi, TransactionOptionSupport as Pn, BooleanSchema as Pr, ExtensionState as Pt, ModelCoreSchemas as Q, Decimal as Qi, InitialModelState as Qn, Getter as Qr, AccumulatedExtensionState as Qt, ModelShape as R, CacheOperationNotCacheableError as Ri, QueryExecutionContext as Rn, BigIntSchema as Rr, createClient as Rt, CachedClient as S, isUnsupportedOperationError as Si, UnwrapPendingOperation as Sn, InputJsonValue as Sr, ModelToManyRelation as St, MutationOperations as T, CheckConstraintError as Ti, CacheDriver as Tn, BaseIsoDateSchema as Tr, getOperationPayloadSchema as Tt, InferInput as U, isVibORMError as Ui, AnyFieldRef as Un, AnyNull as Ur, NoControls as Ut, type Scalar as V, VibORMErrorCode as Vi, v as Vn, createSchemaRegistry as Vr, WriteOutcome as Vt, InferOutput as W, toPrismaErrorCode as Wi, FieldRef as Wn, DbNull as Wr, OrderTerm as Wt, ModelArgsSchemas as X, GeoPolygon as Xi, IndexOptions as Xn, inferred as Xr, StatementContext as Xt, VibSchema as Y, GeoPoint as Yi, IndexDefinition as Yn, JsonSchema$1 as Yr, defineExtension as Yt, ModelCoreInput as Z, DecimalDescriptor as Zi, IndexType as Zn, AnyRelation as Zr, StatementHandler as Zt, ObservationCompletion as _, QueryError as _i, Severity as _n, BaseIntegerSchema as _r, DateScalar as _t, PostgresAdapter as a, isValidationError as ai, ResultConsumerContextOf as an, AutoGenerateType as ar, CoreSchemas as at, OFFICIAL_INSTRUMENTATION_NAME as b, isNotFoundError as bi, Schema$3 as bn, NumberSchema as br, ModelToOneRelation as bt, Operation as c, ClientInitializationError as ci, CountResultType as cn, ScalarState as cr, StringScalar as ct, MigrationSessionAttestation as d, ForbiddenError as di, RawOperation as dn, parse as dr, JsonScalar as dt, NativeType as ea, ReferentialAction as ei, EmptyClientExtensionState as en, ModelInternal as er, ModelRelationNestedInput as et, SQLITE_MIGRATION_CAPABILITY as f, NestedWriteAssertionError as fi, validateSchema as fn, BaseVectorSchema as fr, IntScalar as ft, MigrationNamespaceAttestation as g, QueryEngineError as gi, SchemaValidationIssue as gn, ObjectSchema as gr, DateTimeScalar as gt, DriverResultParser as h, PendingOperationError as hi, isSchemaValidationError as hn, PointSchema as hr, TimeScalar as ht, SQLiteAdapter as i, ValidationErrorSource as ii, MergeExtensionState as in, AutoGenerate as ir, ArgsSchemas as it, ValidatedOperationPayload as j, isForeignKeyError as ji, sqliteResultParser as jn, BaseEnumSchema as jr, DriverConfig as jt, Operations as k, ValueTooLongError as ki, CacheInvalidationOptions as kn, IsoTimeSchema as kr, ClientTypeState as kt, AnyDriver as l, ConnectionError as li, GroupByResultType as ln, ScalarType as lr, PointScalar as lt, PinnedSessionReservation as m, NotFoundError as mi, SchemaValidationError as mn, BasePointSchema as mr, DecimalScalar as mt, postgresAdapter as n, PG as na, RelationSlot as ni, ExtensionContributionState as nn, UpdateState as nr, ModelStateSchemas as nt, MySQLAdapter as o, InvalidTransactionInputError as oi, AggregateResultType as on, GeneratorDefaultBrand as or, NumericScalar as ot, SqliteMigrationCapability as p, NestedWriteError as pi, validateSchemaOrThrow as pn, VectorSchema as pr, EnumScalar as pt, SchemaRegistryLookup as q, GeoArea as qi, isFieldRef as qn, JsonNullSentinel as qr, StampedFields as qt, sqliteAdapter as r, SQLITE as ra, ValidationError as ri, ExtensionResultConsumerState as rn, DecimalSchema as rr, ScalarSchemas as rt, DatabaseAdapter as s, TransactionError as si, BatchPayload as sn, InitialScalarState as sr, VectorScalar as st, mysqlAdapter as t, NativeTypeMap as ta, RelationCardinality as ti, ExtensionCacheState as tn, ModelState as tr, ModelSchemas as tt, Driver as u, FeatureNotSupportedError as ui, InferSelectInclude as un, UpdateState$1 as ur, NumberScalar as ut, ObservationUnit as v, UnsupportedOperationError as vi, ValidationResult$1 as vn, BaseNumberSchema as vr, BooleanScalar as vt, InferDatabase as w, isMigrationError as wi, isPendingOperation as wn, JsonValue as wr, getSchemas as wt, CacheableOperations as x, isPendingOperationError as xi, PendingOperation as xn, BaseJsonSchema as xr, ReferencesStage as xt, ObserveHandler as y, isClientInitializationError as yi, DateTimePhysicalForm as yn, IntegerSchema as yr, BlobScalar as yt, VariantToManyRelation as z, PrismaErrorCode as zi, QueryResult as zn, createJsonSchemaConverter as zr, defaultOmit as zt };
14684
+ export { ModelCoreInput as $, GeoArea as $i, isFieldRef as $n, JsonNullSentinel as $r, ClientExtension as $t, Operations as A, isMigrationError as Ai, isPendingOperation as An, JsonValue as Ar, validateOperationPayload as At, ScalarKeys as B, isValueTooLongError as Bi, TransactionOptionSupport as Bn, BooleanSchema as Br, VibORMClient as Bt, Client as C, QueryError as Ci, Severity as Cn, BaseIntegerSchema as Cr, ReferencesStage as Ct, OperationPayload as D, isPendingOperationError as Di, PendingOperation as Dn, BaseJsonSchema as Dr, getOperationPayloadSchema as Dt, NoExtraOperationKeys as E, isNotFoundError as Ei, Schema$3 as En, NumberSchema as Er, getSchemas as Et, Linked as F, ValueTooLongError as Fi, CacheInvalidationOptions as Fn, IsoTimeSchema as Fr, ExtendedClient as Ft, InferInput as G, PrismaErrorCode as Gi, QueryResult as Gn, createJsonSchemaConverter as Gr, OfficialCacheExtension as Gt, VariantToOneRelation as H, CacheInvalidKeyError as Hi, CommittedBatchNotification as Hn, BlobSchema as Hr, createClient as Ht, LinkedClientConfig as I, isCheckConstraintError as Ii, WithCacheOptions as In, IsoTimestampSchema as Ir, ExtendedOperationResult as It, Prettify as J, isRetryableError as Ji, StringSchema as Jn, AnyJsonNullSentinel as Jr, NoControls as Jt, InferOutput as K, VibORMError as Ki, V$1 as Kn, toJsonSchema as Kr, WriteOutcome as Kt, Links$1 as L, isForeignKeyError as Li, sqliteResultParser as Ln, BaseEnumSchema as Lr, ExtensionState as Lt, ValidatedOperationPayload as M, ForeignKeyError as Mi, CacheEntry as Mn, BaseIsoTimeSchema as Mr, DelegateOperationArgs as Mt, ClientSchema as N, NotNullConstraintError as Ni, CacheSetOptions as Nn, BaseIsoTimestampSchema as Nr, DelegateOperationResult as Nt, OperationPayloadSchema as O, isUnsupportedOperationError as Oi, UnwrapPendingOperation as On, InputJsonValue as Or, renderOperationResultType as Ot, FlatSchema as P, UniqueConstraintError as Pi, WaitUntilFn as Pn, IsoDateSchema as Pr, DriverConfig as Pt, ModelArgsSchemas as Q, DiagnosticDisclosure as Qi, createModelFieldRefs as Qn, JsonNullKind as Qr, StampedFields as Qt, RelationLinks as R, isNotNullConstraintError as Ri, BatchTransactionOptions as Rn, EnumSchema as Rr, NoExtraDriverConfigKeys as Rt, CachedClient as S, QueryEngineError as Si, SchemaValidationIssue as Sn, ObjectSchema as Sr, ModelToOneRelation as St, MutationOperations as T, isClientInitializationError as Ti, DateTimePhysicalForm as Tn, IntegerSchema as Tr, s as Tt, Scalar as U, CacheInvalidTTLError as Ui, Dialect as Un, BaseBigIntSchema as Ur, ProjectedModelOperations as Ut, type VariantToManyRelation as V, CacheConfigurationError as Vi, BatchQuery as Vn, BaseBlobSchema as Vr, VibORMConfig as Vt, BigIntScalar as W, CacheOperationNotCacheableError as Wi, QueryExecutionContext as Wn, BigIntSchema as Wr, defaultOmit as Wt, SchemaRegistryOperation as X, toPrismaErrorCode as Xi, FieldRef as Xn, DbNull as Xr, PlacedControl as Xt, SchemaRegistryLookup as Y, isVibORMError as Yi, AnyFieldRef as Yn, AnyNull as Yr, OrderTerm as Yt, VibSchema as Z, wrapError as Zi, ModelFieldRefs as Zn, JsonNull as Zr, RowsVerbs as Zt, ObservationCompletion as _, ForbiddenError as _i, RawOperation as _n, parse as _r, TimeScalar as _t, PostgresAdapter as a, MYSQL as aa, JunctionReferentialAction as ai, EmptyClientExtensionState as an, Model$1 as ar, ScalarSchemas as at, OFFICIAL_INSTRUMENTATION_NAME as b, NotFoundError as bi, SchemaValidationError as bn, BasePointSchema as br, BooleanScalar as bt, Operation as c, PG as ca, RelationSlot as ci, ExtensionResultConsumerState as cn, UpdateState as cr, NumericScalar as ct, MigrationSessionAttestation as d, isValidationError as di, AggregateResultType as dn, AutoGenerateType as dr, PointScalar as dt, GeoBounds as ea, isJsonNullSentinel as ei, defineExtension as en, AnyModel as er, ModelCoreSchemas as et, SQLITE_MIGRATION_CAPABILITY as f, InvalidTransactionInputError as fi, BatchPayload as fn, GeneratorDefaultBrand as fr, NumberScalar as ft, MigrationNamespaceAttestation as g, FeatureNotSupportedError as gi, InferSelectInclude as gn, UpdateState$1 as gr, DecimalScalar as gt, DriverResultParser as h, ConnectionError as hi, GroupByResultType as hn, ScalarType as hr, EnumScalar as ht, SQLiteAdapter as i, Decimal as ia, Getter as ii, ClientExtensionState as in, InitialModelState as ir, ModelStateSchemas as it, Schema$1 as j, CheckConstraintError as ji, CacheDriver as jn, BaseIsoDateSchema as jr, ClientTypeState as jt, OperationResult as k, MigrationError as ki, UnwrapPendingOperations as kn, JsonSchema as kr, renderSchemaType as kt, AnyDriver as l, SQLITE as la, ValidationError as li, MergeExtensionState as ln, DecimalSchema as lr, VectorScalar as lt, PinnedSessionReservation as m, ClientInitializationError as mi, CountResultType as mn, ScalarState as mr, IntScalar as mt, postgresAdapter as n, GeoPolygon as na, inferred as ni, StatementHandler as nn, IndexOptions as nr, ModelRelationNestedInput as nt, MySQLAdapter as o, NativeType as oa, ReferentialAction as oi, ExtensionCacheState as on, ModelInternal as or, ArgsSchemas as ot, SqliteMigrationCapability as p, TransactionError as pi, ClientHiddenContext as pn, InitialScalarState as pr, JsonScalar as pt, ParseResult as q, VibORMErrorCode as qi, v as qn, createSchemaRegistry as qr, DefinitionControls as qt, sqliteAdapter as r, DecimalDescriptor as ra, AnyRelation as ri, AccumulatedExtensionState as rn, IndexType as rr, ModelSchemas as rt, DatabaseAdapter as s, NativeTypeMap as sa, RelationCardinality as si, ExtensionContributionState as sn, ModelState as sr, CoreSchemas as st, mysqlAdapter as t, GeoPoint as ta, JsonSchema$1 as ti, StatementContext as tn, IndexDefinition as tr, ModelOperationInput as tt, Driver as u, ValidationErrorSource as ui, ResultConsumerContextOf as un, AutoGenerate as ur, StringScalar as ut, ObservationUnit as v, NestedWriteAssertionError as vi, validateSchema as vn, BaseVectorSchema as vr, DateTimeScalar as vt, InferDatabase as w, UnsupportedOperationError as wi, ValidationResult$1 as wn, BaseNumberSchema as wr, ModelToManyRelation as wt, CacheableOperations as x, PendingOperationError as xi, isSchemaValidationError as xn, PointSchema as xr, BlobScalar as xt, ObserveHandler as y, NestedWriteError as yi, validateSchemaOrThrow as yn, VectorSchema as yr, DateScalar as yt, ModelShape as z, isUniqueConstraintError as zi, DriverTransactionOptions as zn, BaseBooleanSchema as zr, ProjectedContribution as zt };