viborm 1.11.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.
- package/dist/adapters.d.mts +1 -1
- package/dist/builder-CUyS5pxN.mjs +2 -0
- package/dist/builder-CUyS5pxN.mjs.map +1 -0
- package/dist/bun-sql.d.mts +1 -1
- package/dist/bun-sql.mjs +1 -1
- package/dist/bun-sqlite.d.mts +1 -1
- package/dist/bun-sqlite.mjs +1 -1
- package/dist/cache/cloudflare-kv.d.mts +1 -1
- package/dist/cache/memory.d.mts +1 -1
- package/dist/cache.d.mts +1 -1
- package/dist/cache.mjs +1 -1
- package/dist/chain-CoOL8l4W.mjs +2 -0
- package/dist/chain-CoOL8l4W.mjs.map +1 -0
- package/dist/cli.mjs +1 -1
- package/dist/{client-CEaKCIbT.d.mts → client-DMbHPHC_.d.mts} +1 -1
- package/dist/client-Db-sVg93.mjs +2 -0
- package/dist/client-Db-sVg93.mjs.map +1 -0
- package/dist/{client-BJuTpcYj.mjs → client-Dpgesimv.mjs} +3 -3
- package/dist/{client-BJuTpcYj.mjs.map → client-Dpgesimv.mjs.map} +1 -1
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/d1.d.mts +1 -1
- package/dist/d1.mjs +1 -1
- package/dist/driver.d.mts +1 -1
- package/dist/every-B1gLSYOW.mjs +2 -0
- package/dist/{every-CyllpuCG.mjs.map → every-B1gLSYOW.mjs.map} +1 -1
- package/dist/{identifier-conversion-BVE8cfFA.mjs → identifier-conversion-D3oCaSia.mjs} +2 -2
- package/dist/{identifier-conversion-BVE8cfFA.mjs.map → identifier-conversion-D3oCaSia.mjs.map} +1 -1
- package/dist/{index-NcKTpeZg.d.mts → index-B4Bo2kEi.d.mts} +638 -425
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/instrumentation.d.mts +1 -1
- package/dist/instrumentation.mjs +1 -1
- package/dist/{libsql-CcKrXiun.mjs → libsql-C4sm2U20.mjs} +2 -2
- package/dist/{libsql-CcKrXiun.mjs.map → libsql-C4sm2U20.mjs.map} +1 -1
- package/dist/libsql.d.mts +1 -1
- package/dist/libsql.mjs +1 -1
- package/dist/{memory-B0HOEpPu.mjs → memory-BXOh0pq2.mjs} +2 -2
- package/dist/{memory-B0HOEpPu.mjs.map → memory-BXOh0pq2.mjs.map} +1 -1
- package/dist/migrations/mysql.d.mts +4 -4
- package/dist/migrations/mysql.mjs +1 -1
- package/dist/migrations/postgres.d.mts +4 -4
- package/dist/migrations/postgres.mjs +1 -1
- package/dist/migrations/sqlite.d.mts +4 -4
- package/dist/migrations/sqlite.mjs +1 -1
- package/dist/migrations/tenant.d.mts +2 -2
- package/dist/migrations/tenant.mjs +1 -1
- package/dist/migrations.d.mts +4 -4
- package/dist/migrations.mjs +1 -1
- package/dist/model-u8Ug971J.mjs.map +1 -1
- package/dist/{mysql-sGTzkV2q.mjs → mysql-BR0XTumr.mjs} +2 -2
- package/dist/{mysql-sGTzkV2q.mjs.map → mysql-BR0XTumr.mjs.map} +1 -1
- package/dist/mysql2.d.mts +1 -1
- package/dist/mysql2.mjs +1 -1
- package/dist/neon-http.d.mts +1 -1
- package/dist/neon-http.mjs +1 -1
- package/dist/{object-store-BuOuL61Z.d.mts → object-store-BI1YgcZ9.d.mts} +3 -3
- package/dist/on.d.mts +1 -1
- package/dist/on.mjs +1 -1
- package/dist/on.mjs.map +1 -1
- package/dist/ordering.d.mts +1 -1
- package/dist/permissions.d.mts +1 -1
- package/dist/pg.d.mts +1 -1
- package/dist/pg.mjs +1 -1
- package/dist/pglite.d.mts +1 -1
- package/dist/pglite.mjs +1 -1
- package/dist/planetscale.d.mts +1 -1
- package/dist/planetscale.mjs +1 -1
- package/dist/{planner-CJ321_hX.d.mts → planner-rsXqQbJR.d.mts} +1 -1
- package/dist/{postgres-C2uUUh0t.mjs → postgres-CrjBX4Yj.mjs} +2 -2
- package/dist/{postgres-C2uUUh0t.mjs.map → postgres-CrjBX4Yj.mjs.map} +1 -1
- package/dist/postgres.d.mts +1 -1
- package/dist/postgres.mjs +1 -1
- package/dist/{result-shape-Beo2WK4y.mjs → result-shape-BPdZ1rUk.mjs} +2 -2
- package/dist/{result-shape-Beo2WK4y.mjs.map → result-shape-BPdZ1rUk.mjs.map} +1 -1
- package/dist/{rows-AGRWMfWj.mjs → rows-C4hPsLfi.mjs} +2 -2
- package/dist/{rows-AGRWMfWj.mjs.map → rows-C4hPsLfi.mjs.map} +1 -1
- package/dist/schema/json.d.mts +7 -2
- package/dist/schema/json.mjs +1 -1
- package/dist/schema/json.mjs.map +1 -1
- package/dist/{schema-DYPfTOQl.mjs → schema-C8_nS6Ub.mjs} +2 -2
- package/dist/{schema-DYPfTOQl.mjs.map → schema-C8_nS6Ub.mjs.map} +1 -1
- package/dist/{schema-introspection-Dp5vWFBv.mjs → schema-introspection-BiG5153d.mjs} +2 -2
- package/dist/{schema-introspection-Dp5vWFBv.mjs.map → schema-introspection-BiG5153d.mjs.map} +1 -1
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +1 -1
- package/dist/soft-delete.d.mts +1 -1
- package/dist/sqlite3.d.mts +1 -1
- package/dist/sqlite3.mjs +1 -1
- package/dist/{to-many-5gt2AWLE.mjs → to-many-CMK2Ys4N.mjs} +2 -2
- package/dist/{to-many-5gt2AWLE.mjs.map → to-many-CMK2Ys4N.mjs.map} +1 -1
- package/dist/types-C4v6iAmY.mjs.map +1 -1
- package/dist/{utils-CmNRGkRq.mjs → utils-BLIPe1Cb.mjs} +2 -2
- package/dist/{utils-CmNRGkRq.mjs.map → utils-BLIPe1Cb.mjs.map} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/dist/validator-CtSM_qvW.mjs +2 -0
- package/dist/validator-CtSM_qvW.mjs.map +1 -0
- package/dist/version-BPr1CKHw.mjs +2 -0
- package/dist/{version-azc2rGHS.mjs.map → version-BPr1CKHw.mjs.map} +1 -1
- package/package.json +17 -17
- package/dist/builder-CK7lE3ee.mjs +0 -2
- package/dist/builder-CK7lE3ee.mjs.map +0 -1
- package/dist/chain-AqwYJpGa.mjs +0 -2
- package/dist/chain-AqwYJpGa.mjs.map +0 -1
- package/dist/client-CuBbRKhN.mjs +0 -2
- package/dist/client-CuBbRKhN.mjs.map +0 -1
- package/dist/every-CyllpuCG.mjs +0 -2
- package/dist/validator-CYKdGTvX.mjs +0 -2
- package/dist/validator-CYKdGTvX.mjs.map +0 -1
- package/dist/version-azc2rGHS.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>;
|
|
@@ -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<
|
|
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
|
*/
|
|
@@ -6775,6 +6901,18 @@ type DeclaredMapKeys<Action> = Action extends JunctionReferentialAction ? never
|
|
|
6775
6901
|
* an extra key.
|
|
6776
6902
|
*/
|
|
6777
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;
|
|
6778
6916
|
/**
|
|
6779
6917
|
* A model-target collection slot.
|
|
6780
6918
|
*
|
|
@@ -6792,8 +6930,20 @@ type ModelToManyRelation<State$1> = {
|
|
|
6792
6930
|
readonly name: Name$1;
|
|
6793
6931
|
}>>;
|
|
6794
6932
|
through(table: string): ModelToManyRelation<State$1>;
|
|
6795
|
-
|
|
6796
|
-
|
|
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>>;
|
|
6797
6947
|
onDelete<const Action extends JunctionActionDeclaration>(action: Action & ExactJunctionActions<Action>): ModelToManyRelation<State$1>;
|
|
6798
6948
|
onUpdate<const Action extends JunctionActionDeclaration>(action: Action & ExactJunctionActions<Action>): ModelToManyRelation<State$1>;
|
|
6799
6949
|
};
|
|
@@ -8143,175 +8293,444 @@ type PaginationTakeSchema = V$1.Integer;
|
|
|
8143
8293
|
type PaginationSkipSchema = V$1.Schema<number, number>;
|
|
8144
8294
|
type BulkWriteLimitSchema = V$1.Schema<number, number>;
|
|
8145
8295
|
//#endregion
|
|
8146
|
-
//#region src/validation/
|
|
8147
|
-
|
|
8148
|
-
declare const askingKeyRefusal: (key: string) => OptionalSchema<VibSchema<never, never>, undefined, undefined, undefined>;
|
|
8149
|
-
/** A target projection whose asking key is refused, keeping its options. */
|
|
8150
|
-
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>>>;
|
|
8151
|
-
type RecursiveProjectionSchemas<S$1 extends RelationState, Key$1> = {
|
|
8152
|
-
readonly select: ProjectionWithoutAsking<GetTargetSchemas<S$1>["core"]["select"], Key$1>;
|
|
8153
|
-
readonly include: ProjectionWithoutAsking<GetTargetSchemas<S$1>["core"]["include"], Key$1>;
|
|
8154
|
-
};
|
|
8155
|
-
type ToOneRecursiveNodeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = IncludeToField<V$1.Object<{
|
|
8156
|
-
recurse: RecurrenceFor<Source, Key$1, S$1>;
|
|
8157
|
-
where: UnavailableRecursiveClauseSchema;
|
|
8158
|
-
orderBy: UnavailableRecursiveClauseSchema;
|
|
8159
|
-
select: () => RecursiveProjectionSchemas<S$1, Key$1>["select"];
|
|
8160
|
-
include: () => RecursiveProjectionSchemas<S$1, Key$1>["include"];
|
|
8161
|
-
omit: () => GetTargetSchemas<S$1>["core"]["omit"];
|
|
8162
|
-
}, {
|
|
8163
|
-
atLeast: ["recurse"];
|
|
8164
|
-
}>>;
|
|
8165
|
-
/**
|
|
8166
|
-
* Nested `distinct`: scalar field names of the RELATED model, deduplicating
|
|
8167
|
-
* that relation's ordered rows before `take`/`skip` window them (the same
|
|
8168
|
-
* enum-of-scalars schema the top-level findMany args use).
|
|
8169
|
-
*/
|
|
8170
|
-
type NestedDistinctSchema<S$1 extends RelationState> = V$1.Enum<StringKeyOf<TargetModel$1<S$1>["~"]["state"]["scalars"]>[], {
|
|
8171
|
-
array: true;
|
|
8172
|
-
}>;
|
|
8173
|
-
type IncludeToField<Schema$4 extends V$1.Object<any, any>> = V$1.Coerce<Schema$4, Schema$4[" vibInferred"]["1"] & {
|
|
8174
|
-
select?: Record<string, true>;
|
|
8175
|
-
}>;
|
|
8176
|
-
type BooleanToSelect = V$1.Coerce<V$1.Boolean, {
|
|
8177
|
-
select?: Record<string, true>;
|
|
8178
|
-
} | false>;
|
|
8179
|
-
/**
|
|
8180
|
-
* The node a bare `true` desugars to: an explicit projection of the target's
|
|
8181
|
-
* projectable scalars, FRESH on every parse so the engine never receives a
|
|
8182
|
-
* schema-level singleton it could mutate. A target with nothing projectable
|
|
8183
|
-
* yields `{}`, which the builder reads as "default row".
|
|
8184
|
-
*/
|
|
8185
|
-
|
|
8186
|
-
/**
|
|
8187
|
-
* To-one include: true or nested { select, include }
|
|
8188
|
-
* `select` and `include` are mutually exclusive on the same node (Prisma parity)
|
|
8189
|
-
*/
|
|
8190
|
-
type ToOneIncludeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = V$1.Union<readonly [BooleanToSelect, IncludeToField<V$1.Object<{
|
|
8191
|
-
select: () => GetTargetSchemas<S$1>["core"]["select"];
|
|
8192
|
-
include: () => GetTargetSchemas<S$1>["core"]["include"];
|
|
8193
|
-
omit: () => GetTargetSchemas<S$1>["core"]["omit"];
|
|
8194
|
-
recurse: UnavailableRecurrenceSchema;
|
|
8195
|
-
}>>, ToOneRecursiveNodeSchema<Source, Key$1, S$1>]>;
|
|
8196
|
-
/**
|
|
8197
|
-
* THE TO-MANY NESTED NODE — `{ where, orderBy, take, skip, cursor, distinct,
|
|
8198
|
-
* select, include, omit }`, with `select`/`include` mutually exclusive on the
|
|
8199
|
-
* same node (Prisma parity).
|
|
8200
|
-
*
|
|
8201
|
-
* `take`/`skip`/`cursor`/`distinct` are the very schemas the top level uses: a
|
|
8202
|
-
* negative `take` is Prisma's "last N" (the relation subquery runs the reversed
|
|
8203
|
-
* order with an absolute limit and the parser restores the logical order), a
|
|
8204
|
-
* non-integer take or a negative skip is refused with the top-level message,
|
|
8205
|
-
* `cursor` is a whereUnique of the RELATED model applied per parent, and
|
|
8206
|
-
* `distinct` names scalars of the RELATED model.
|
|
8207
|
-
*
|
|
8208
|
-
* DECOUPLED FROM `RelationState` on purpose. Everything the node needs reduces
|
|
8209
|
-
* to four facts — the target model (default projection + `omit` desugaring),
|
|
8210
|
-
* the label an `omit` failure carries, the target's core schemas, and the
|
|
8211
|
-
* target's scalar names for `distinct`. Naming those four directly is what lets
|
|
8212
|
-
* a SECOND caller build the identical node without a relation to read them off:
|
|
8213
|
-
* a polymorphic collection's per-variant arm
|
|
8214
|
-
* (`./polymorphic/select-include.ts`), whose target is chosen by a
|
|
8215
|
-
* discriminator rather than by an edge.
|
|
8216
|
-
*
|
|
8217
|
-
* Extracted rather than hand-copied. Two hand-written copies of these nine keys
|
|
8218
|
-
* under `rejectSelectInclude` + `withOmitProjection` + `includeToField` would be
|
|
8219
|
-
* two things to keep in step, and the drift would be silent — a polymorphic arm
|
|
8220
|
-
* quietly missing `cursor`, say, reads as "not supported" rather than as a bug.
|
|
8221
|
-
* `to-many.core.test.ts` is the regression net for the extraction itself.
|
|
8222
|
-
*/
|
|
8223
|
-
/** The six core schemas of the related model a to-many node reaches for. */
|
|
8224
|
-
type ToManyNestedTargetCore = {
|
|
8225
|
-
readonly where: VibSchema<any, any>;
|
|
8226
|
-
readonly orderBy: VibSchema<any, any>;
|
|
8227
|
-
readonly whereUnique: VibSchema<any, any>;
|
|
8228
|
-
readonly select: VibSchema<any, any>;
|
|
8229
|
-
readonly include: VibSchema<any, any>;
|
|
8230
|
-
readonly omit: VibSchema<any, any>;
|
|
8231
|
-
};
|
|
8232
|
-
type ToManyNestedNodeSchema<Core$1 extends ToManyNestedTargetCore, Distinct> = IncludeToField<V$1.Object<{
|
|
8233
|
-
where: () => Core$1["where"];
|
|
8234
|
-
orderBy: () => V$1.Union<readonly [Core$1["orderBy"], V$1.Array<Core$1["orderBy"]>]>;
|
|
8235
|
-
take: PaginationTakeSchema;
|
|
8236
|
-
skip: PaginationSkipSchema;
|
|
8237
|
-
cursor: () => Core$1["whereUnique"];
|
|
8238
|
-
distinct: Distinct;
|
|
8239
|
-
select: () => Core$1["select"];
|
|
8240
|
-
include: () => Core$1["include"];
|
|
8241
|
-
omit: () => Core$1["omit"];
|
|
8242
|
-
recurse: UnavailableRecurrenceSchema;
|
|
8243
|
-
}>>;
|
|
8244
|
-
type ToManyRecursiveNodeSchema<Source extends AnyModel, Key$1, S$1 extends RelationState> = IncludeToField<V$1.Object<{
|
|
8245
|
-
where: () => GetTargetSchemas<S$1>["core"]["where"];
|
|
8246
|
-
orderBy: () => V$1.Union<readonly [GetTargetSchemas<S$1>["core"]["orderBy"], V$1.Array<GetTargetSchemas<S$1>["core"]["orderBy"]>]>;
|
|
8247
|
-
take: UnavailableRecursiveClauseSchema;
|
|
8248
|
-
skip: UnavailableRecursiveClauseSchema;
|
|
8249
|
-
cursor: UnavailableRecursiveClauseSchema;
|
|
8250
|
-
distinct: UnavailableRecursiveClauseSchema;
|
|
8251
|
-
select: () => RecursiveProjectionSchemas<S$1, Key$1>["select"];
|
|
8252
|
-
include: () => RecursiveProjectionSchemas<S$1, Key$1>["include"];
|
|
8253
|
-
omit: () => GetTargetSchemas<S$1>["core"]["omit"];
|
|
8254
|
-
recurse: RecurrenceFor<Source, Key$1, S$1>;
|
|
8255
|
-
}, {
|
|
8256
|
-
atLeast: ["recurse"];
|
|
8257
|
-
}>>;
|
|
8258
|
-
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>]>;
|
|
8296
|
+
//#region src/validation/model/core/projection.d.ts
|
|
8297
|
+
type ModelStateOf$5<M$1 extends AnyModel> = M$1["~"]["state"];
|
|
8259
8298
|
/**
|
|
8260
|
-
*
|
|
8261
|
-
* (
|
|
8299
|
+
* The keys a model's `.omit()` hides for good. `undefined` (the common case,
|
|
8300
|
+
* no `.omit()` at all) contributes nothing.
|
|
8262
8301
|
*/
|
|
8263
|
-
type
|
|
8264
|
-
|
|
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>>;
|
|
8265
8305
|
//#endregion
|
|
8266
|
-
//#region src/validation/
|
|
8306
|
+
//#region src/validation/model/core/select.d.ts
|
|
8267
8307
|
/**
|
|
8268
|
-
*
|
|
8269
|
-
* `where` is a NON-unique `WhereInput` — a to-one has exactly one connected record,
|
|
8270
|
-
* so this filters that record rather than selecting among candidates.
|
|
8308
|
+
* Build select schema - boolean selection for each scalar field, nested select for relations
|
|
8271
8309
|
*/
|
|
8272
|
-
type
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
}
|
|
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>];
|
|
8278
8319
|
/**
|
|
8279
|
-
*
|
|
8280
|
-
*
|
|
8281
|
-
*
|
|
8282
|
-
*
|
|
8283
|
-
*
|
|
8284
|
-
* This is the ONE place the rule is applied, because it is the only place that sees
|
|
8285
|
-
* the USER's payload: both arms emit the same canonical `{ data, where? }` envelope,
|
|
8286
|
-
* so no later reader (the update root, a target one level deeper, the nested-target
|
|
8287
|
-
* delegation) ever has to tell the spellings apart from an output that already
|
|
8288
|
-
* rewrote scalar shorthands. See {@link file://./to-one-update-form.ts} for the rule,
|
|
8289
|
-
* and for the collision it REFUSES: on a target that owns a field named `data`, the
|
|
8290
|
-
* envelope's shape is also how bare data spells that field, and only the caller can
|
|
8291
|
-
* say which was meant.
|
|
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.
|
|
8292
8325
|
*/
|
|
8293
|
-
type
|
|
8294
|
-
type
|
|
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>;
|
|
8336
|
+
};
|
|
8295
8337
|
/**
|
|
8296
|
-
*
|
|
8297
|
-
*
|
|
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.
|
|
8298
8342
|
*/
|
|
8299
|
-
type
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
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;
|
|
8307
8352
|
}>;
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8353
|
+
}, {
|
|
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">;
|
|
8312
8360
|
}, {
|
|
8313
|
-
partial: false;
|
|
8314
|
-
}
|
|
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>;
|
|
8724
|
+
}, {
|
|
8725
|
+
partial: false;
|
|
8726
|
+
}>;
|
|
8727
|
+
update: () => ToOneUpdateTargetSchema<Source, Key$1, S$1>;
|
|
8728
|
+
upsert: V$1.Object<{
|
|
8729
|
+
create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
|
|
8730
|
+
update: () => ProjectedNestedUpdate<Source, Key$1, S$1>;
|
|
8731
|
+
}, {
|
|
8732
|
+
partial: false;
|
|
8733
|
+
}>;
|
|
8315
8734
|
};
|
|
8316
8735
|
type ToOneUpdateSchemaDisconnect = V$1.Object<{
|
|
8317
8736
|
disconnect: V$1.Boolean;
|
|
@@ -8349,17 +8768,17 @@ type ToOneUpdateSchema<Source extends AnyModel, Key$1, S$1 extends RelationState
|
|
|
8349
8768
|
* Most operations accept single or array.
|
|
8350
8769
|
*/
|
|
8351
8770
|
type ToManyUpdateEntries<Source extends AnyModel, Key$1, S$1 extends RelationState> = {
|
|
8352
|
-
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>>;
|
|
8353
8772
|
createMany: NestedCreateManySchema<Source, Key$1, S$1>;
|
|
8354
|
-
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>>;
|
|
8355
8774
|
delete: () => V$1.SingleOrArray<GetTargetSchemas<S$1>["core"]["whereUniqueExtended"]>;
|
|
8356
|
-
connectOrCreate: V$1.SingleOrArray<V$1.Object<{
|
|
8775
|
+
connectOrCreate: () => V$1.SingleOrArray<WithLinkWrite<V$1.Object<{
|
|
8357
8776
|
where: () => GetTargetSchemas<S$1>["core"]["whereUnique"];
|
|
8358
8777
|
create: () => ProjectedNestedCreate<Source, Key$1, S$1>;
|
|
8359
8778
|
}, {
|
|
8360
8779
|
partial: false;
|
|
8361
|
-
}>>;
|
|
8362
|
-
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>>;
|
|
8363
8782
|
update: V$1.SingleOrArray<V$1.Object<{
|
|
8364
8783
|
where: () => GetTargetSchemas<S$1>["core"]["whereUniqueExtended"];
|
|
8365
8784
|
data: () => ProjectedNestedUpdate<Source, Key$1, S$1>;
|
|
@@ -9728,8 +10147,8 @@ type GetScalarsSchemas<Source extends AnyModel> = { [F in keyof Source["~"]["sta
|
|
|
9728
10147
|
/**
|
|
9729
10148
|
* Build scalar create schema - all scalar fields for create input
|
|
9730
10149
|
*/
|
|
9731
|
-
type ModelStateOf$
|
|
9732
|
-
type ModelRelations<M$1 extends AnyModel> = ModelStateOf$
|
|
10150
|
+
type ModelStateOf$3<M$1 extends AnyModel> = M$1["~"]["state"];
|
|
10151
|
+
type ModelRelations<M$1 extends AnyModel> = ModelStateOf$3<M$1>["relations"];
|
|
9733
10152
|
/** The local half of every foreign key this model's own relations store. */
|
|
9734
10153
|
type ForeignKeyScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelRelations<M$1>]: ModelRelations<M$1>[K]["~"]["state"] extends {
|
|
9735
10154
|
readonly foreignKey: {
|
|
@@ -9751,11 +10170,11 @@ type CreateRequirementGroup<M$1 extends AnyModel> = { [K in keyof ModelRelations
|
|
|
9751
10170
|
type ScalarCreateEntries<F$1 extends {
|
|
9752
10171
|
scalars: Record<string, unknown>;
|
|
9753
10172
|
}> = V$1.FromObject<F$1["scalars"], "create">["entries"];
|
|
9754
|
-
type RequiredModelScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelStateOf$
|
|
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"]];
|
|
9755
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>>;
|
|
9756
10175
|
type NestedRequiredScalarKeys<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = RequiredScalarCreateKeys<M$1, F$1, ForeignKeyScalarKeys<M$1>>;
|
|
9757
10176
|
type ScalarCreateSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.FromObject<F$1["scalars"], "create", {
|
|
9758
|
-
atLeast: RequiredScalarKeys<ModelStateOf$
|
|
10177
|
+
atLeast: RequiredScalarKeys<ModelStateOf$3<M$1>["shape"]>[];
|
|
9759
10178
|
}>;
|
|
9760
10179
|
/**
|
|
9761
10180
|
* Root `createMany` rows: the ORDINARY create data shape (plan §6 J1), minus the
|
|
@@ -9819,8 +10238,8 @@ interface NonNullableSchema<TWrapped extends VibSchema<any, any>, TInput = NonNu
|
|
|
9819
10238
|
}
|
|
9820
10239
|
//#endregion
|
|
9821
10240
|
//#region src/validation/model/core/filter.d.ts
|
|
9822
|
-
type ModelStateOf$
|
|
9823
|
-
type UniqueScalarSchemas<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = Pick<F$1["scalars"], Extract<keyof F$1["scalars"], keyof ModelStateOf$
|
|
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"]>>;
|
|
9824
10243
|
type ScalarFilterSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.FromObject<F$1["scalars"], "filter">;
|
|
9825
10244
|
/** A field's value schema in a unique selector: never `null`. */
|
|
9826
10245
|
type UniqueMember<S$1> = S$1 extends {
|
|
@@ -9834,239 +10253,9 @@ type RelationFilterSchema<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>>
|
|
|
9834
10253
|
*/
|
|
9835
10254
|
/** A declared compound selector with every member's `null` removed. */
|
|
9836
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] };
|
|
9837
|
-
type CompoundConstraintEntries<M$1 extends AnyModel> = (ModelStateOf$
|
|
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>);
|
|
9838
10257
|
type CompoundConstraintFilterSchema<M$1 extends AnyModel> = ObjectSchema<CompoundConstraintEntries<M$1>>;
|
|
9839
|
-
type CompoundIdFilterSchema<M$1 extends AnyModel> = V$1.Object<NonNullSelectors<ModelStateOf$
|
|
9840
|
-
//#endregion
|
|
9841
|
-
//#region src/validation/model/core/projection.d.ts
|
|
9842
|
-
type ModelStateOf$3<M$1 extends AnyModel> = M$1["~"]["state"];
|
|
9843
|
-
/**
|
|
9844
|
-
* The keys a model's `.omit()` hides for good. `undefined` (the common case,
|
|
9845
|
-
* no `.omit()` at all) contributes nothing.
|
|
9846
|
-
*/
|
|
9847
|
-
type ModelOmittedKeys<M$1 extends AnyModel> = ModelStateOf$3<M$1>["omit"] extends Record<string, true> ? StringKeyOf<ModelStateOf$3<M$1>["omit"]> : never;
|
|
9848
|
-
/** Every scalar of the model that a query is allowed to project. */
|
|
9849
|
-
type ProjectableScalarKeys<M$1 extends AnyModel> = Exclude<StringKeyOf<ModelStateOf$3<M$1>["scalars"]>, ModelOmittedKeys<M$1>>;
|
|
9850
|
-
//#endregion
|
|
9851
|
-
//#region src/validation/model/core/select.d.ts
|
|
9852
|
-
/**
|
|
9853
|
-
* Build select schema - boolean selection for each scalar field, nested select for relations
|
|
9854
|
-
*/
|
|
9855
|
-
type ModelStateOf$2<M$1 extends AnyModel> = M$1["~"]["state"];
|
|
9856
|
-
type ModelScalars<M$1 extends AnyModel> = ModelStateOf$2<M$1>["scalars"];
|
|
9857
|
-
type ScalarStateOf$1<F$1> = F$1 extends {
|
|
9858
|
-
"~": {
|
|
9859
|
-
state: infer S;
|
|
9860
|
-
};
|
|
9861
|
-
} ? S extends ScalarState ? S : never : never;
|
|
9862
|
-
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>];
|
|
9863
|
-
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>];
|
|
9864
|
-
/**
|
|
9865
|
-
* Both halves of the select schema are keyed on {@link ProjectableScalarKeys},
|
|
9866
|
-
* so a model-level `.omit()`-ed scalar has no `select` entry at all: naming it
|
|
9867
|
-
* is an "Unknown key" parse failure rather than a way around the schema's own
|
|
9868
|
-
* exclusion. See `projection.ts` for why that layer is hard and the other two
|
|
9869
|
-
* are not.
|
|
9870
|
-
*/
|
|
9871
|
-
type VectorScalarKeys<M$1 extends AnyModel> = Extract<ProjectableScalarKeys<M$1>, AnyVectorScalarKeys<M$1>>;
|
|
9872
|
-
type PointScalarKeys$1<M$1 extends AnyModel> = Extract<ProjectableScalarKeys<M$1>, AnyPointScalarKeys<M$1>>;
|
|
9873
|
-
type PlainScalarKeys<M$1 extends AnyModel> = Exclude<ProjectableScalarKeys<M$1>, AnyVectorScalarKeys<M$1> | AnyPointScalarKeys<M$1>>;
|
|
9874
|
-
declare const scalarSelectSchema: BooleanSchema<boolean | undefined, boolean>;
|
|
9875
|
-
/** The desugared shorthand: one `true` entry per counted relation. */
|
|
9876
|
-
type CountAllSelection = Record<string, true>;
|
|
9877
|
-
/** Both relation namespaces a `_count` (and an `include`) reaches across. */
|
|
9878
|
-
type RelationSchemaBundle = {
|
|
9879
|
-
relations: Record<string, any>;
|
|
9880
|
-
polymorphic: Record<string, any>;
|
|
9881
|
-
};
|
|
9882
|
-
/**
|
|
9883
|
-
* `_count` accepts either Prisma's shorthand `true` or the explicit
|
|
9884
|
-
* `{ select: { <relation>: true | { where } } }` object. The shorthand is
|
|
9885
|
-
* desugared here, so everything downstream (query engine, result parser) only
|
|
9886
|
-
* ever sees the object form.
|
|
9887
|
-
*/
|
|
9888
|
-
type CountSchema<F$1 extends RelationSchemaBundle> = V$1.Union<readonly [V$1.Coerce<V$1.Literal<true>, {
|
|
9889
|
-
select: CountAllSelection;
|
|
9890
|
-
}>, V$1.Object<{
|
|
9891
|
-
select: V$1.Object<V$1.FromObject<F$1["relations"], "countFilter", {
|
|
9892
|
-
optional: true;
|
|
9893
|
-
}>["entries"] & V$1.FromObject<F$1["polymorphic"], "countFilter", {
|
|
9894
|
-
optional: true;
|
|
9895
|
-
}>["entries"], {
|
|
9896
|
-
optional: true;
|
|
9897
|
-
}>;
|
|
9898
|
-
}, {
|
|
9899
|
-
optional: true;
|
|
9900
|
-
}>]>;
|
|
9901
|
-
declare const vectorScalarSelectSchema: UnionSchema<readonly [BooleanSchema<boolean | undefined, boolean>, ObjectSchema<{
|
|
9902
|
-
_distance: ObjectSchema<{
|
|
9903
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9904
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9905
|
-
}, {
|
|
9906
|
-
readonly partial: false;
|
|
9907
|
-
}, InferInputShape<{
|
|
9908
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9909
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9910
|
-
}>, InferOutputShape<{
|
|
9911
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9912
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9913
|
-
}>>;
|
|
9914
|
-
}, {
|
|
9915
|
-
readonly partial: false;
|
|
9916
|
-
}, InferInputShape<{
|
|
9917
|
-
_distance: ObjectSchema<{
|
|
9918
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9919
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9920
|
-
}, {
|
|
9921
|
-
readonly partial: false;
|
|
9922
|
-
}, InferInputShape<{
|
|
9923
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9924
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9925
|
-
}>, InferOutputShape<{
|
|
9926
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9927
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9928
|
-
}>>;
|
|
9929
|
-
}>, InferOutputShape<{
|
|
9930
|
-
_distance: ObjectSchema<{
|
|
9931
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9932
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9933
|
-
}, {
|
|
9934
|
-
readonly partial: false;
|
|
9935
|
-
}, InferInputShape<{
|
|
9936
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9937
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9938
|
-
}>, InferOutputShape<{
|
|
9939
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9940
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9941
|
-
}>>;
|
|
9942
|
-
}>>], boolean | InferInputShape<{
|
|
9943
|
-
_distance: ObjectSchema<{
|
|
9944
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9945
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9946
|
-
}, {
|
|
9947
|
-
readonly partial: false;
|
|
9948
|
-
}, InferInputShape<{
|
|
9949
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9950
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9951
|
-
}>, InferOutputShape<{
|
|
9952
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9953
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9954
|
-
}>>;
|
|
9955
|
-
}> | undefined, boolean | InferOutputShape<{
|
|
9956
|
-
_distance: ObjectSchema<{
|
|
9957
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9958
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9959
|
-
}, {
|
|
9960
|
-
readonly partial: false;
|
|
9961
|
-
}, InferInputShape<{
|
|
9962
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9963
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9964
|
-
}>, InferOutputShape<{
|
|
9965
|
-
to: ArraySchema<NumberSchema<number, number>, number[], number[]>;
|
|
9966
|
-
metric: EnumSchema<["l2", "cosine"], "l2" | "cosine", "l2" | "cosine">;
|
|
9967
|
-
}>>;
|
|
9968
|
-
}>>;
|
|
9969
|
-
type VectorScalarSelectSchema = typeof vectorScalarSelectSchema;
|
|
9970
|
-
declare const pointScalarSelectSchema: UnionSchema<readonly [BooleanSchema<boolean | undefined, boolean>, ObjectSchema<{
|
|
9971
|
-
_distance: ObjectSchema<{
|
|
9972
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9973
|
-
}, {
|
|
9974
|
-
readonly partial: false;
|
|
9975
|
-
}, InferInputShape<{
|
|
9976
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9977
|
-
}>, InferOutputShape<{
|
|
9978
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9979
|
-
}>>;
|
|
9980
|
-
}, {
|
|
9981
|
-
readonly partial: false;
|
|
9982
|
-
}, InferInputShape<{
|
|
9983
|
-
_distance: ObjectSchema<{
|
|
9984
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9985
|
-
}, {
|
|
9986
|
-
readonly partial: false;
|
|
9987
|
-
}, InferInputShape<{
|
|
9988
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9989
|
-
}>, InferOutputShape<{
|
|
9990
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9991
|
-
}>>;
|
|
9992
|
-
}>, InferOutputShape<{
|
|
9993
|
-
_distance: ObjectSchema<{
|
|
9994
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9995
|
-
}, {
|
|
9996
|
-
readonly partial: false;
|
|
9997
|
-
}, InferInputShape<{
|
|
9998
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
9999
|
-
}>, InferOutputShape<{
|
|
10000
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10001
|
-
}>>;
|
|
10002
|
-
}>>], boolean | InferInputShape<{
|
|
10003
|
-
_distance: ObjectSchema<{
|
|
10004
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10005
|
-
}, {
|
|
10006
|
-
readonly partial: false;
|
|
10007
|
-
}, InferInputShape<{
|
|
10008
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10009
|
-
}>, InferOutputShape<{
|
|
10010
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10011
|
-
}>>;
|
|
10012
|
-
}> | undefined, boolean | InferOutputShape<{
|
|
10013
|
-
_distance: ObjectSchema<{
|
|
10014
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10015
|
-
}, {
|
|
10016
|
-
readonly partial: false;
|
|
10017
|
-
}, InferInputShape<{
|
|
10018
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10019
|
-
}>, InferOutputShape<{
|
|
10020
|
-
to: PointSchema<GeoPoint, GeoPoint>;
|
|
10021
|
-
}>>;
|
|
10022
|
-
}>>;
|
|
10023
|
-
type PointScalarSelectSchema = typeof pointScalarSelectSchema;
|
|
10024
|
-
/**
|
|
10025
|
-
* A written `select` names what the row carries, so one that names nothing
|
|
10026
|
-
* (`{}`, only `false`, or a `_count` that counts no relation, as `_count: true`
|
|
10027
|
-
* does on a model with no to-many relation) is a caller mistake, refused at its
|
|
10028
|
-
* own path. Leaving `select` out is how a caller asks for the default row.
|
|
10029
|
-
*/
|
|
10030
|
-
declare const requireSelectedField: (select: Record<string, unknown>) => string | undefined;
|
|
10031
|
-
/** The refusal every written `select` carries ({@link requireSelectedField}). */
|
|
10032
|
-
type SelectRefusal = {
|
|
10033
|
-
readonly refuse: typeof requireSelectedField;
|
|
10034
|
-
};
|
|
10035
|
-
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"] & {
|
|
10036
|
-
_count: CountSchema<F$1>;
|
|
10037
|
-
}, SelectRefusal>;
|
|
10038
|
-
/**
|
|
10039
|
-
* The SCALAR-ONLY projection: {@link SelectSchema} without relation keys and
|
|
10040
|
-
* without `_count`.
|
|
10041
|
-
*
|
|
10042
|
-
* This is the projection of a bulk write (`createMany` / `updateMany` /
|
|
10043
|
-
* `deleteMany` with a `select`). Those rows come out of the write statement's
|
|
10044
|
-
* `RETURNING` clause — an expression list with no table alias to correlate
|
|
10045
|
-
* against — so a relation subquery embedded there binds its outer column
|
|
10046
|
-
* reference by NAME and is silently captured by the inner table whenever the two
|
|
10047
|
-
* share a column name. The observable result was wrong data, not an error: a
|
|
10048
|
-
* to-many relation always came back `[]`, and a self-referencing to-one came
|
|
10049
|
-
* back `null`, while the identical projection through `findMany` returned the
|
|
10050
|
-
* real rows. Refusing the key is the fail-closed answer; read relations in a
|
|
10051
|
-
* separate query, which is what the underlying implementation would have to do
|
|
10052
|
-
* anyway.
|
|
10053
|
-
*
|
|
10054
|
-
* Prisma divergence, deliberate: Prisma's `createManyAndReturn` /
|
|
10055
|
-
* `updateManyAndReturn` DO accept relations here — its generator emits dedicated
|
|
10056
|
-
* `<Model>SelectCreateManyAndReturn` / `<Model>IncludeCreateManyAndReturn` types
|
|
10057
|
-
* (prisma 6.8.2, `prisma-client/generator-build`, `Model.argsTypes`).
|
|
10058
|
-
*/
|
|
10059
|
-
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>;
|
|
10060
|
-
/**
|
|
10061
|
-
* Build include schema - nested include for each relation
|
|
10062
|
-
*/
|
|
10063
|
-
type IncludeSchema<F$1 extends RelationSchemaBundle> = V$1.Object<V$1.FromObject<F$1["relations"], "include", {
|
|
10064
|
-
optional: true;
|
|
10065
|
-
}>["entries"] & {
|
|
10066
|
-
_count: CountSchema<F$1>;
|
|
10067
|
-
} & V$1.FromObject<F$1["polymorphic"], "include", {
|
|
10068
|
-
optional: true;
|
|
10069
|
-
}>["entries"]>;
|
|
10258
|
+
type CompoundIdFilterSchema<M$1 extends AnyModel> = V$1.Object<NonNullSelectors<ModelStateOf$2<M$1>["compoundId"]>>;
|
|
10070
10259
|
//#endregion
|
|
10071
10260
|
//#region src/validation/model/core/update.d.ts
|
|
10072
10261
|
/**
|
|
@@ -11078,11 +11267,13 @@ type ModelShape = Record<string, AnyModelField>;
|
|
|
11078
11267
|
* member's type, so it cannot change what a shape infers. Each key's type is
|
|
11079
11268
|
* its reason spelled as a string literal, so the diagnostic a caller reads
|
|
11080
11269
|
* names it: no model member is a string, so nothing a shape can hold
|
|
11081
|
-
* 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.
|
|
11082
11272
|
*/
|
|
11083
11273
|
type DeclaredModelShape = ModelShape & {
|
|
11084
11274
|
readonly _count?: "`_count` is reserved for relation counts (F010)";
|
|
11085
11275
|
readonly _distance?: "`_distance` is reserved for distance results (F010)";
|
|
11276
|
+
readonly $through?: "`$through` is reserved for a relation's link row (F010)";
|
|
11086
11277
|
};
|
|
11087
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;
|
|
11088
11279
|
type ToString<T$1> = T$1 extends string | number | bigint | boolean | null | undefined ? `${T$1}` : never;
|
|
@@ -11608,7 +11799,11 @@ type WhereLogicalKey = "AND" | "OR" | "NOT";
|
|
|
11608
11799
|
type WhereLogicalKeys<M$1 extends Model$1<any>> = Exclude<WhereLogicalKey, keyof M$1["~"]["state"]["shape"]>;
|
|
11609
11800
|
type WhereModelKeys<M$1 extends Model$1<any>> = keyof M$1["~"]["state"]["shape"] | WhereLogicalKey;
|
|
11610
11801
|
/** The unknown keys inside the quantifiers `Q` a relation filter spelled. */
|
|
11611
|
-
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;
|
|
11612
11807
|
/**
|
|
11613
11808
|
* The selectors among `Q` that `Given` spells with a value. The runtime reads
|
|
11614
11809
|
* one whose only value is `undefined` as absent (`withRecursiveNode` drops an
|
|
@@ -11623,13 +11818,13 @@ type DefinedSelectors<Given, Q$1 extends PropertyKey> = { [K in Q$1]: [Exclude<V
|
|
|
11623
11818
|
* filter with a defined `is` / `isNot` is the explicit form, and any other is
|
|
11624
11819
|
* the shorthand, beside which an undefined `recurse` / `self` is absent.
|
|
11625
11820
|
*/
|
|
11626
|
-
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;
|
|
11627
11822
|
/**
|
|
11628
11823
|
* The misspelled model keys of one WHERE value, at every depth it names. An
|
|
11629
11824
|
* `any` value states no key and is not walked: its array arm would unwrap it
|
|
11630
11825
|
* to itself until TS2589.
|
|
11631
11826
|
*/
|
|
11632
|
-
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]
|
|
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;
|
|
11633
11828
|
/**
|
|
11634
11829
|
* The keys of one WHERE object the walk descends. A value whose type states
|
|
11635
11830
|
* every key of the model's WHERE is the client's own payload, under any of its
|
|
@@ -11679,7 +11874,15 @@ type WrittenKeys<Given> = Given extends object ? keyof { [K in keyof Given as st
|
|
|
11679
11874
|
* Selectors (`where`, `connect`, …) stay unkeyed, as
|
|
11680
11875
|
* `contextual-typing-gate.core.types.ts` pins.
|
|
11681
11876
|
*/
|
|
11682
|
-
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;
|
|
11683
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;
|
|
11684
11887
|
/**
|
|
11685
11888
|
* Whether the argument SPELLED `Clause`. A literal's keys are required; a
|
|
@@ -11801,7 +12004,17 @@ type RecursiveRootClause<Arg, M$1 extends Model$1<any>, Clause extends "select"
|
|
|
11801
12004
|
* The operation's own projection. Its members meet the node guard directly,
|
|
11802
12005
|
* so a misspelling one relation deep is reported on the key itself.
|
|
11803
12006
|
*/
|
|
11804
|
-
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;
|
|
11805
12018
|
/** The model a relation key targets; `never` (nothing to key) otherwise. */
|
|
11806
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;
|
|
11807
12020
|
/**
|
|
@@ -11809,7 +12022,7 @@ type RelationTarget<M$1, Key$1> = M$1 extends Model$1<any> ? Key$1 extends keyof
|
|
|
11809
12022
|
* admit one, states nothing: the guard is for what a caller spelled, and TS
|
|
11810
12023
|
* falls back to the payload type itself when an argument fails it.
|
|
11811
12024
|
*/
|
|
11812
|
-
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;
|
|
11813
12026
|
type ExclusiveSelection<Node> = Node extends {
|
|
11814
12027
|
select: object;
|
|
11815
12028
|
include: object;
|
|
@@ -11818,14 +12031,14 @@ type ExclusiveSelection<Node> = Node extends {
|
|
|
11818
12031
|
} | {
|
|
11819
12032
|
include?: undefined;
|
|
11820
12033
|
} : unknown;
|
|
11821
|
-
type RecursiveNodeObjectGuard<Node, T$1> = ExclusiveSelection<Node> & ("recurse" extends keyof Node ? {
|
|
12034
|
+
type RecursiveNodeObjectGuard<Node, T$1, LinkKey> = ExclusiveSelection<Node> & ("recurse" extends keyof Node ? {
|
|
11822
12035
|
recurse?: RecurrenceBagGuard<Node["recurse"]>;
|
|
11823
12036
|
} : unknown) & ("select" extends keyof Node ? {
|
|
11824
|
-
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>;
|
|
11825
12038
|
} : unknown) & ("include" extends keyof Node ? {
|
|
11826
|
-
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>;
|
|
11827
12040
|
} : unknown) & ("where" extends keyof Node ? {
|
|
11828
|
-
where?: NodeWhereSeal<Node["where"], T$1>;
|
|
12041
|
+
where?: NodeWhereSeal<Node["where"], T$1, "recurse" extends keyof Node ? never : LinkKey>;
|
|
11829
12042
|
} : unknown) & ("variants" extends keyof Node ? {
|
|
11830
12043
|
variants?: RecursiveProjectionGuard<Node["variants"], never>;
|
|
11831
12044
|
} : unknown) & RecursiveProjectionGuard<Node, never, RelationNodeClauseKey>;
|
|
@@ -11835,7 +12048,7 @@ type RecursiveNodeObjectGuard<Node, T$1> = ExclusiveSelection<Node> & ("recurse"
|
|
|
11835
12048
|
* the walk through a type parameter. A generic NODE whose constraint spells
|
|
11836
12049
|
* `select`, `include` or `where` is refused: those keys cannot be proven.
|
|
11837
12050
|
*/
|
|
11838
|
-
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>> };
|
|
11839
12052
|
/**
|
|
11840
12053
|
* A model-target node's `select` / `include` keys, beside `_count`: every
|
|
11841
12054
|
* key the value names, optional ones included, is refused as `?: undefined`.
|
|
@@ -11844,9 +12057,9 @@ type RecursiveProjectionGuard<Clause, T$1, Skipped extends PropertyKey = never>
|
|
|
11844
12057
|
* recursive node, and the recursive arm's projection carries the asking key as
|
|
11845
12058
|
* a refused `?: undefined` member.
|
|
11846
12059
|
*/
|
|
11847
|
-
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;
|
|
11848
12061
|
/** A model-target node's `where`, walked as the root WHERE is. */
|
|
11849
|
-
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;
|
|
11850
12063
|
type ScalarStateOf<Field$1, Kind$1 extends ScalarType> = Field$1 extends {
|
|
11851
12064
|
readonly "~": {
|
|
11852
12065
|
readonly state: infer State extends ScalarState<Kind$1>;
|