@prisma-next/sql-lane-query-builder 0.13.0 → 0.14.0-dev.1

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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../../1-framework/0-foundation/contract/dist/domain-envelope-OkWsysCY.d.mts
1
+ //#region ../../../1-framework/0-foundation/contract/dist/domain-envelope-Bj-zQbVU.d.mts
2
2
  //#region src/namespace-id.d.ts
3
3
  type NamespaceId = string & {
4
4
  readonly __brand: 'NamespaceId';
@@ -16,31 +16,141 @@ interface CrossReference {
16
16
  readonly space?: string;
17
17
  }
18
18
  //#endregion
19
+ //#region src/types.d.ts
20
+ /**
21
+ * Unique symbol used as the key for branding types.
22
+ */
23
+ declare const $: unique symbol;
24
+ /**
25
+ * A helper type to brand a given type with a unique identifier.
26
+ *
27
+ * @template TKey Text used as the brand key.
28
+ * @template TValue Optional value associated with the brand key. Defaults to `true`.
29
+ */
30
+ type Brand<TKey extends string | number | symbol, TValue = true> = {
31
+ [$]: { [K in TKey]: TValue };
32
+ };
33
+ /**
34
+ * Base type for storage contract hashes.
35
+ * Emitted contract.d.ts files use this with the hash value as a type parameter:
36
+ * `type StorageHash = StorageHashBase<'sha256:abc123...'>`
37
+ */
38
+ type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
39
+ /**
40
+ * Base type for execution contract hashes.
41
+ * Emitted contract.d.ts files use this with the hash value as a type parameter:
42
+ * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`
43
+ */
44
+ type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
45
+ /**
46
+ * Base type for profile contract hashes.
47
+ * Emitted contract.d.ts files use this with the hash value as a type parameter:
48
+ * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`
49
+ */
50
+ type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
51
+ /**
52
+ * One entity-kind slot in a namespace — a map of entity name to entry.
53
+ * Values are opaque at the foundation layer; family and target concretions
54
+ * refine them to typed IR classes.
55
+ */
56
+ type StorageEntitySlot = Readonly<Record<string, unknown>>;
57
+ /**
58
+ * Plain-data namespace entry in a storage block. Every hydrated contract
59
+ * carries at least `id` plus entity-kind slot maps under `entries`
60
+ * (`table`, `collection`, …). Foundation declares only this shape — no IR
61
+ * machinery.
62
+ */
63
+ interface StorageNamespace {
64
+ readonly id: string;
65
+ readonly entries: Readonly<Record<string, StorageEntitySlot>>;
66
+ }
67
+ /**
68
+ * Base type for family-specific storage blocks.
69
+ * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the
70
+ * storage hash alongside family-specific data (tables, collections, etc.).
71
+ *
72
+ * The `namespaces` map is carried by every hydrated storage block. Serialized
73
+ * envelope shape is target-owned; this types the in-memory contract after
74
+ * `deserializeContract`.
75
+ */
76
+ interface StorageBase<THash extends string = string> {
77
+ readonly storageHash: StorageHashBase<THash>;
78
+ readonly namespaces: Readonly<Record<string, StorageNamespace>>;
79
+ }
80
+ type GeneratedValueSpec = {
81
+ readonly id: string;
82
+ readonly params?: Record<string, unknown>;
83
+ };
84
+ type JsonPrimitive = string | number | boolean | null;
85
+ type JsonValue = JsonPrimitive | {
86
+ readonly [key: string]: JsonValue;
87
+ } | readonly JsonValue[];
88
+ type ColumnDefaultLiteralValue = JsonValue;
89
+ type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
90
+ /**
91
+ * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
92
+ * resolve template values from caller-supplied args (typed `unknown` at the
93
+ * boundary) and need to validate before constructing a `ColumnDefault`.
94
+ * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
95
+ * instances. Rejects functions, class instances (other than `Date`),
96
+ * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
97
+ */
98
+ type ColumnDefault = {
99
+ readonly kind: 'literal';
100
+ readonly value: ColumnDefaultLiteralInputValue;
101
+ } | {
102
+ readonly kind: 'function';
103
+ readonly expression: string;
104
+ };
105
+ type ExecutionMutationDefaultValue = {
106
+ readonly kind: 'generator';
107
+ readonly id: GeneratedValueSpec['id'];
108
+ readonly params?: Record<string, unknown>;
109
+ };
110
+ type ExecutionMutationDefault = {
111
+ readonly ref: {
112
+ readonly namespace: string;
113
+ readonly table: string;
114
+ readonly column: string;
115
+ };
116
+ readonly onCreate?: ExecutionMutationDefaultValue;
117
+ readonly onUpdate?: ExecutionMutationDefaultValue;
118
+ };
119
+ /**
120
+ * `ExecutionMutationDefault` minus its `ref` — the per-field phases value
121
+ * authoring layers attach to a column before the column ref is known.
122
+ */
123
+ //#endregion
19
124
  //#region src/value-set-ref.d.ts
20
125
  /**
21
- * Space-aware reference coordinate for a domain enum or storage value-set.
126
+ * Entity coordinate for a domain enum or storage value-set reference.
22
127
  *
23
- * `plane` names the contract plane the referenced entity lives in:
24
- * - `'domain'` — the entity lives in the domain plane's `enum` slot.
25
- * - `'storage'` the entity lives in the storage plane's `valueSet` slot.
128
+ * Field-name identity with the framework's `EntityCoordinate` type
129
+ * (packages/1-framework/1-core/framework-components/src/ir/storage.ts).
130
+ * Foundation-contract cannot import framework-components (dependency points
131
+ * the other way), so this is a standalone mirror of that shape plus the
132
+ * cross-space discriminator.
26
133
  *
27
- * `entityKind` names the source entity-kind:
28
- * - `'enum'` — the referenced entity is a domain enum.
29
- * - `'value-set'` the referenced entity is a storage value-set.
134
+ * One-vocabulary rule (ADR 224): `entityKind` is equal to the entries slot
135
+ * key the referenced entity lives under — `'enum'` for domain's `enum` slot,
136
+ * `'valueSet'` for storage's `entries.valueSet` slot. No consumer-side
137
+ * translation between the kind string and the slot key.
30
138
  *
31
- * `namespaceId` admits the `UNBOUND_NAMESPACE_ID` (`__unbound__`) sentinel for
32
- * single-namespace (unbound) references.
139
+ * Every `valueSet` reference is intra-plane (domain field → domain enum;
140
+ * storage column/check → storage value-set). The directional invariant:
141
+ * domain may reference storage; storage may never reference domain.
33
142
  *
34
- * Cross-space discrimination is presence-based: when `spaceId` is absent the
35
- * reference is local (same contract-space); when `spaceId` is present the
36
- * reference is cross-space. This mirrors the `ForeignKeyReference` carrier
37
- * convention no separate tag field so local refs are JSON-minimal.
143
+ * `namespaceId` admits the `UNBOUND_NAMESPACE_ID` (`__unbound__`) sentinel
144
+ * for single-namespace (unbound) references.
145
+ *
146
+ * `spaceId` is the cross-space discriminator: absent local (same
147
+ * contract-space); present ⇒ cross-space. No separate tag field.
38
148
  */
39
149
  interface ValueSetRef {
40
150
  readonly plane: 'domain' | 'storage';
41
151
  readonly namespaceId: string;
42
- readonly entityKind: 'enum' | 'value-set';
43
- readonly name: string;
152
+ readonly entityKind: 'enum' | 'valueSet';
153
+ readonly entityName: string;
44
154
  readonly spaceId?: string;
45
155
  } //#endregion
46
156
  //#region src/domain-types.d.ts
@@ -74,7 +184,7 @@ type ContractEnum = {
74
184
  readonly codecId: string;
75
185
  readonly members: readonly {
76
186
  readonly name: string;
77
- readonly value: string;
187
+ readonly value: JsonValue;
78
188
  }[];
79
189
  };
80
190
  type ContractRelationOn = {
@@ -131,8 +241,8 @@ interface ContractModelBase<TModelStorage extends ModelStorageBase = ModelStorag
131
241
  * One namespace's application-domain entities — models and optional value
132
242
  * objects keyed by entity name within that namespace coordinate.
133
243
  */
134
- interface ApplicationDomainNamespace<TModels extends Record<string, ContractModelBase> = Record<string, ContractModelBase>> {
135
- readonly models: TModels;
244
+ interface ApplicationDomainNamespace {
245
+ readonly models: Record<string, ContractModelBase>;
136
246
  readonly valueObjects?: Record<string, ContractValueObject>;
137
247
  readonly enum?: Record<string, ContractEnum>;
138
248
  }
@@ -140,11 +250,11 @@ interface ApplicationDomainNamespace<TModels extends Record<string, ContractMode
140
250
  * Application-domain envelope: entity content keyed by namespace id.
141
251
  * Mirrors the storage plane's `namespaces` segment (ADR 221).
142
252
  */
143
- interface ApplicationDomain<TModels extends Record<string, ContractModelBase> = Record<string, ContractModelBase>> {
144
- readonly namespaces: Readonly<Record<string, ApplicationDomainNamespace<TModels>>>;
253
+ interface ApplicationDomain {
254
+ readonly namespaces: Readonly<Record<string, ApplicationDomainNamespace>>;
145
255
  }
146
256
  //#endregion
147
- //#region ../../../1-framework/0-foundation/contract/dist/contract-types-CBbD-VV1.d.mts
257
+ //#region ../../../1-framework/0-foundation/contract/dist/contract-types-DrjCtVOs.d.mts
148
258
  //#region src/control-policy.d.ts
149
259
  /**
150
260
  * Governance posture for a storage-plane node or for the contract as a whole.
@@ -165,110 +275,6 @@ type ControlPolicy = 'managed' | 'tolerated' | 'external' | 'observed';
165
275
  * and can be called by any consumer (verifier, planner, etc.) without importing IR classes.
166
276
  */
167
277
  //#endregion
168
- //#region src/types.d.ts
169
- /**
170
- * Unique symbol used as the key for branding types.
171
- */
172
- declare const $: unique symbol;
173
- /**
174
- * A helper type to brand a given type with a unique identifier.
175
- *
176
- * @template TKey Text used as the brand key.
177
- * @template TValue Optional value associated with the brand key. Defaults to `true`.
178
- */
179
- type Brand<TKey extends string | number | symbol, TValue = true> = {
180
- [$]: { [K in TKey]: TValue };
181
- };
182
- /**
183
- * Base type for storage contract hashes.
184
- * Emitted contract.d.ts files use this with the hash value as a type parameter:
185
- * `type StorageHash = StorageHashBase<'sha256:abc123...'>`
186
- */
187
- type StorageHashBase<THash extends string> = THash & Brand<'StorageHash'>;
188
- /**
189
- * Base type for execution contract hashes.
190
- * Emitted contract.d.ts files use this with the hash value as a type parameter:
191
- * `type ExecutionHash = ExecutionHashBase<'sha256:def456...'>`
192
- */
193
- type ExecutionHashBase<THash extends string> = THash & Brand<'ExecutionHash'>;
194
- /**
195
- * Base type for profile contract hashes.
196
- * Emitted contract.d.ts files use this with the hash value as a type parameter:
197
- * `type ProfileHash = ProfileHashBase<'sha256:def456...'>`
198
- */
199
- type ProfileHashBase<THash extends string> = THash & Brand<'ProfileHash'>;
200
- /**
201
- * One entity-kind slot in a namespace — a map of entity name to entry.
202
- * Values are opaque at the foundation layer; family and target concretions
203
- * refine them to typed IR classes.
204
- */
205
- type StorageEntitySlot = Readonly<Record<string, unknown>>;
206
- /**
207
- * Plain-data namespace entry in a storage block. Every hydrated contract
208
- * carries at least `id` plus entity-kind slot maps under `entries`
209
- * (`table`, `collection`, …). Foundation declares only this shape — no IR
210
- * machinery.
211
- */
212
- interface StorageNamespace {
213
- readonly id: string;
214
- readonly entries: Readonly<Record<string, StorageEntitySlot>>;
215
- }
216
- /**
217
- * Base type for family-specific storage blocks.
218
- * Family storage types (SqlStorage, MongoStorage, etc.) extend this to carry the
219
- * storage hash alongside family-specific data (tables, collections, etc.).
220
- *
221
- * The `namespaces` map is carried by every hydrated storage block. Serialized
222
- * envelope shape is target-owned; this types the in-memory contract after
223
- * `deserializeContract`.
224
- */
225
- interface StorageBase<THash extends string = string> {
226
- readonly storageHash: StorageHashBase<THash>;
227
- readonly namespaces: Readonly<Record<string, StorageNamespace>>;
228
- }
229
- type GeneratedValueSpec = {
230
- readonly id: string;
231
- readonly params?: Record<string, unknown>;
232
- };
233
- type JsonPrimitive = string | number | boolean | null;
234
- type JsonValue = JsonPrimitive | {
235
- readonly [key: string]: JsonValue;
236
- } | readonly JsonValue[];
237
- type ColumnDefaultLiteralValue = JsonValue;
238
- type ColumnDefaultLiteralInputValue = ColumnDefaultLiteralValue | Date;
239
- /**
240
- * Runtime predicate for `ColumnDefaultLiteralInputValue`. Authoring layers
241
- * resolve template values from caller-supplied args (typed `unknown` at the
242
- * boundary) and need to validate before constructing a `ColumnDefault`.
243
- * Accepts JSON primitives, plain arrays/objects of JSON values, and `Date`
244
- * instances. Rejects functions, class instances (other than `Date`),
245
- * `undefined`, `bigint`, `symbol`, and arrays/objects containing those.
246
- */
247
- type ColumnDefault = {
248
- readonly kind: 'literal';
249
- readonly value: ColumnDefaultLiteralInputValue;
250
- } | {
251
- readonly kind: 'function';
252
- readonly expression: string;
253
- };
254
- type ExecutionMutationDefaultValue = {
255
- readonly kind: 'generator';
256
- readonly id: GeneratedValueSpec['id'];
257
- readonly params?: Record<string, unknown>;
258
- };
259
- type ExecutionMutationDefault = {
260
- readonly ref: {
261
- readonly table: string;
262
- readonly column: string;
263
- };
264
- readonly onCreate?: ExecutionMutationDefaultValue;
265
- readonly onUpdate?: ExecutionMutationDefaultValue;
266
- };
267
- /**
268
- * `ExecutionMutationDefault` minus its `ref` — the per-field phases value
269
- * authoring layers attach to a column before the column ref is known.
270
- */
271
- //#endregion
272
278
  //#region src/contract-types.d.ts
273
279
  /**
274
280
  * Execution section for the unified contract (ADR 182).
@@ -297,18 +303,15 @@ type ContractExecutionSection<THash extends string = string> = {
297
303
  * here — they are handled at the serialization boundary.
298
304
  *
299
305
  * @template TStorage Family-specific storage block (extends {@link StorageBase}).
300
- * @template TModels Record of model name → {@link ContractModel} with
301
- * family-specific model storage.
302
306
  */
303
- interface Contract<TStorage extends StorageBase = StorageBase, TModels extends Record<string, ContractModelBase> = Record<string, ContractModelBase>> {
307
+ interface Contract<TStorage extends StorageBase = StorageBase> {
304
308
  readonly target: string;
305
309
  readonly targetFamily: string;
306
310
  readonly roots: Record<string, CrossReference>;
307
311
  /**
308
312
  * Application plane (ADR 221): `domain.namespaces.<nsId>.{ models, valueObjects }`.
309
- * `TModels` types the union of model entries across namespaces for family DSL inference.
310
313
  */
311
- readonly domain: ApplicationDomain<TModels>;
314
+ readonly domain: ApplicationDomain;
312
315
  readonly storage: TStorage;
313
316
  readonly capabilities: Record<string, Record<string, boolean>>;
314
317
  readonly extensionPacks: Record<string, unknown>;
@@ -317,7 +320,6 @@ interface Contract<TStorage extends StorageBase = StorageBase, TModels extends R
317
320
  readonly meta: Record<string, unknown>;
318
321
  readonly defaultControlPolicy?: ControlPolicy;
319
322
  }
320
- /** Model definitions union carried on a {@link Contract}'s `TModels` type parameter. */
321
323
  //#endregion
322
324
  //#region src/type-errors.d.ts
323
325
  /**
@@ -479,7 +481,7 @@ interface Namespace extends IRNode, StorageNamespace {
479
481
  * is honest at every layer.
480
482
  *
481
483
  * Extends `IRNode` so the framework's IR-walking surfaces (verifiers,
482
- * serializers) can dispatch on `Storage`-typed slots through the same
484
+ * serializers) can dispatch on `Storage`-typed fields through the same
483
485
  * IR-node alphabet as every other node — the structural dual already
484
486
  * holds in code (every concrete storage class extends an IR-node base);
485
487
  * the interface promotion makes the typing honest.
@@ -649,7 +651,7 @@ declare class ForeignKey extends SqlNode {
649
651
  constructor(input: ForeignKeyInput);
650
652
  } //#endregion
651
653
  //#endregion
652
- //#region ../../1-core/contract/dist/sql-storage-CXf9xjAL.d.mts
654
+ //#region ../../1-core/contract/dist/storage-value-set-WnYsIFM8.d.mts
653
655
  //#region src/ir/check-constraint.d.ts
654
656
  /**
655
657
  * Hydration / construction input shape for {@link CheckConstraint}.
@@ -806,6 +808,42 @@ declare class StorageTable extends SqlNode {
806
808
  readonly checks?: ReadonlyArray<CheckConstraint>;
807
809
  constructor(input: StorageTableInput);
808
810
  } //#endregion
811
+ //#region src/ir/storage-value-set.d.ts
812
+ /**
813
+ * Hydration / construction input shape for {@link StorageValueSet}.
814
+ * Mirrors the on-disk storage JSON envelope so the serializer hydration
815
+ * walker can hand a validated literal straight to `new`.
816
+ */
817
+ interface StorageValueSetInput {
818
+ readonly kind: 'valueSet';
819
+ /** Ordered permitted values, codec-encoded. Declaration order is preserved. */
820
+ readonly values: readonly JsonValue[];
821
+ }
822
+ /**
823
+ * SQL Contract IR node for a value-set entry in a namespace's `valueSet`
824
+ * map (`SqlNamespace.entries.valueSet`).
825
+ *
826
+ * A value-set records the ordered set of permitted codec-encoded values for
827
+ * an enum-like column restriction. It does not carry a `codecId` — the
828
+ * column that references it already holds the codec; the value-set holds
829
+ * only the permitted values.
830
+ *
831
+ * The node's `kind` is enumerable (`'valueSet'`) so the JSON envelope
832
+ * carries the discriminator and the serializer hydration walker can
833
+ * dispatch on it. This follows the per-leaf enumerable-kind convention
834
+ * established in the SQL-node comment (future polymorphic dispatch on
835
+ * namespace entries needs the discriminator in JSON).
836
+ *
837
+ * The entry's name is not on the class — value-sets are keyed by name in
838
+ * the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
839
+ */
840
+ declare class StorageValueSet extends SqlNode {
841
+ readonly kind: "valueSet";
842
+ readonly values: readonly JsonValue[];
843
+ constructor(input: StorageValueSetInput);
844
+ } //#endregion
845
+ //#endregion
846
+ //#region ../../1-core/contract/dist/sql-storage-Dga0jwP2.d.mts
809
847
  //#region src/ir/storage-type-instance.d.ts
810
848
  /**
811
849
  * Sentinel kind for the legacy codec-triple shape persisted under
@@ -820,8 +858,8 @@ declare const CODEC_INSTANCE_KIND: "codec-instance";
820
858
  * in `SqlStorage.types`. These are plain object literals — there is no
821
859
  * runtime IR class, the JSON envelope round-trips through the slot
822
860
  * unchanged. The `kind: 'codec-instance'` discriminator is the dispatch
823
- * key that distinguishes codec-typed entries from class-instance entries
824
- * (e.g. `PostgresEnumType`) sharing the polymorphic slot.
861
+ * key that distinguishes codec-typed entries from any class-instance
862
+ * kinds a target pack contributes to the polymorphic slot.
825
863
  */
826
864
  interface StorageTypeInstance extends StorageType {
827
865
  readonly kind: typeof CODEC_INSTANCE_KIND;
@@ -847,40 +885,6 @@ interface StorageTypeInstanceInput {
847
885
  * passes through unchanged. Missing `typeParams` is normalised to `{}`.
848
886
  */
849
887
  //#endregion
850
- //#region src/ir/storage-value-set.d.ts
851
- /**
852
- * Hydration / construction input shape for {@link StorageValueSet}.
853
- * Mirrors the on-disk storage JSON envelope so the serializer hydration
854
- * walker can hand a validated literal straight to `new`.
855
- */
856
- interface StorageValueSetInput {
857
- readonly kind: 'value-set';
858
- /** Ordered permitted values, codec-encoded. Declaration order is preserved. */
859
- readonly values: readonly string[];
860
- }
861
- /**
862
- * SQL Contract IR node for a value-set entry in a namespace's `valueSet`
863
- * map (`SqlNamespace.entries.valueSet`).
864
- *
865
- * A value-set records the ordered set of permitted codec-encoded values for
866
- * an enum-like column restriction. It does not carry a `codecId` — the
867
- * column that references it already holds the codec; the value-set holds
868
- * only the permitted values.
869
- *
870
- * The node's `kind` is enumerable (`'value-set'`) so the JSON envelope
871
- * carries the discriminator and the serializer hydration walker can
872
- * dispatch on it. This follows the per-leaf enumerable-kind convention
873
- * established in the SQL-node comment (future polymorphic dispatch on
874
- * namespace entries needs the discriminator in JSON).
875
- *
876
- * The entry's name is not on the class — value-sets are keyed by name in
877
- * the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
878
- */
879
- declare class StorageValueSet extends SqlNode {
880
- readonly kind: "value-set";
881
- readonly values: readonly string[];
882
- constructor(input: StorageValueSetInput);
883
- } //#endregion
884
888
  //#region src/ir/sql-storage.d.ts
885
889
  /**
886
890
  * Polymorphic value type for document-scoped `SqlStorage.types` entries
@@ -916,11 +920,25 @@ interface SqlStorageInput<THash extends string = string> {
916
920
  * the per-target serializer's responsibility (so the family base does
917
921
  * not import target-specific subclasses).
918
922
  */
923
+ /**
924
+ * The typed `entries` shape for SQL family namespaces. The open dictionary
925
+ * is intersected with optional known-kind maps so that `ns.entries.table`
926
+ * and `ns.entries.valueSet` resolve without a cast, while unknown pack-
927
+ * contributed kinds remain valid (the `Record` part allows any string key).
928
+ */
929
+ type SqlNamespaceEntries = Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
930
+ readonly table?: Readonly<Record<string, StorageTable>>;
931
+ readonly valueSet?: Readonly<Record<string, StorageValueSet>>;
932
+ };
933
+ /**
934
+ * SQL family namespace. `entries` is the open ADR 224 dictionary —
935
+ * `entries[entityKind][entityName]` addresses any entity. Emitted
936
+ * contract literals satisfy this structurally (no prototype getters
937
+ * needed). For typed access to specific kinds, use the class getters
938
+ * on the concretion or `ns.entries.table` / `ns.entries.valueSet` directly.
939
+ */
919
940
  type SqlNamespace = Namespace & {
920
- readonly entries: Readonly<{
921
- readonly table: Readonly<Record<string, StorageTable>>;
922
- readonly valueSet?: Readonly<Record<string, StorageValueSet>>;
923
- }>;
941
+ readonly entries: SqlNamespaceEntries;
924
942
  /**
925
943
  * Render a dialect-qualified table reference for runtime SQL emission.
926
944
  * Present on materialised target concretions (`PostgresSchema`,
@@ -934,9 +952,10 @@ declare class SqlStorage<THash extends string = string> extends SqlNode implemen
934
952
  readonly namespaces: Readonly<Record<string, SqlNamespace>>;
935
953
  readonly types?: Readonly<Record<string, StorageTypeInstance>>;
936
954
  constructor(input: SqlStorageInput<THash>);
937
- }
955
+ } //#endregion
938
956
  //#endregion
939
- //#region ../../1-core/contract/dist/types-DEnWD3xB.d.mts
957
+ //#region ../../1-core/contract/dist/types-B1N8w0I2.d.mts
958
+ type NamespacedFieldTypeMap = Record<string, Record<string, Record<string, unknown>>>;
940
959
  type CodecTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
941
960
  readonly codecTypes: infer C;
942
961
  } ? C extends Record<string, {
@@ -951,25 +970,37 @@ type CodecTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
951
970
  */
952
971
  type TypeMapsPhantomKey = '__@prisma-next/sql-contract/typeMaps@__';
953
972
  type ExtractTypeMapsFromContract<T> = TypeMapsPhantomKey extends keyof T ? NonNullable<T[TypeMapsPhantomKey & keyof T]> : never;
973
+ type FieldOutputTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
974
+ readonly fieldOutputTypes: infer F;
975
+ } ? F extends NamespacedFieldTypeMap ? F : Record<string, never> : Record<string, never>;
954
976
  type ExtractCodecTypes<T> = CodecTypesOf<ExtractTypeMapsFromContract<T>>;
977
+ type ExtractFieldOutputTypes<T> = FieldOutputTypesOf<ExtractTypeMapsFromContract<T>>;
955
978
  //#endregion
956
- //#region ../sql-builder/dist/db-CeOCQldG.d.mts
979
+ //#region ../sql-builder/dist/db-BS_UG1Si.d.mts
957
980
  //#endregion
958
981
  //#region src/types/db.d.ts
959
982
  type CapabilitiesBase = Record<string, Record<string, boolean>>;
983
+ type NamespaceEntries = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
984
+ type NamespaceDomain = Readonly<Record<string, {
985
+ readonly models: Readonly<Record<string, unknown>>;
986
+ }>>;
960
987
  type TableProxyContract = {
988
+ readonly domain: {
989
+ readonly namespaces: NamespaceDomain;
990
+ };
961
991
  readonly storage: {
962
992
  readonly namespaces: Readonly<Record<string, {
963
- readonly entries: {
964
- readonly table: Readonly<Record<string, StorageTable>>;
965
- };
993
+ readonly entries: NamespaceEntries;
966
994
  }>>;
967
995
  };
968
996
  readonly capabilities: CapabilitiesBase;
969
997
  };
998
+ type TablesInNamespace<NS extends {
999
+ readonly entries: NamespaceEntries;
1000
+ }> = NS['entries']['table'] extends Readonly<Record<string, StorageTable>> ? NS['entries']['table'] : Readonly<Record<string, StorageTable>>;
970
1001
  type UnboundTables$1<C extends TableProxyContract> = { readonly [Name in TableNamesAcrossNamespaces<C>]: TableInAnyNamespace<C, Name> };
971
- type TableNamesAcrossNamespaces<C extends TableProxyContract> = { [NSId in keyof C['storage']['namespaces']]: keyof C['storage']['namespaces'][NSId]['entries']['table'] & string }[keyof C['storage']['namespaces']];
972
- type TableInAnyNamespace<C extends TableProxyContract, Name extends string> = { [NSId in keyof C['storage']['namespaces']]: Name extends keyof C['storage']['namespaces'][NSId]['entries']['table'] ? C['storage']['namespaces'][NSId]['entries']['table'][Name] : never }[keyof C['storage']['namespaces']];
1002
+ type TableNamesAcrossNamespaces<C extends TableProxyContract> = { [NSId in keyof C['storage']['namespaces']]: keyof TablesInNamespace<C['storage']['namespaces'][NSId]> & string }[keyof C['storage']['namespaces']];
1003
+ type TableInAnyNamespace<C extends TableProxyContract, Name extends string> = { [NSId in keyof C['storage']['namespaces']]: Name extends keyof TablesInNamespace<C['storage']['namespaces'][NSId]> ? TablesInNamespace<C['storage']['namespaces'][NSId]>[Name] : never }[keyof C['storage']['namespaces']];
973
1004
  //#endregion
974
1005
  //#region src/type-atoms.d.ts
975
1006
  /**
@@ -1012,14 +1043,31 @@ type Simplify<TObject extends object> = DrainOuterGeneric<{ [K in keyof TObject]
1012
1043
  */
1013
1044
  type UnboundTables<TContract extends Contract<SqlStorage>> = UnboundTables$1<TContract & TableProxyContract>;
1014
1045
  /**
1015
- * A utility type to extract the output type of a referenced column from a contract.
1016
- * Uses the type-only codec channel (ExtractCodecTypes), not runtime mappings.
1046
+ * The field-output override (the enum value union) for a `table.column`, or
1047
+ * `never` when no model field maps to it. The emitted `FieldOutputTypes`
1048
+ * TypeMap is keyed by model/field, so one pass over the models matches both the
1049
+ * `storage.table` and the field's `storage.fields[*].column` to read the
1050
+ * already-narrowed type back out.
1051
+ */
1052
+ type FieldOutputOverride<TContract extends Contract, TTableName extends string, TColumnName extends string, Models = TContract['domain']['namespaces'][keyof TContract['domain']['namespaces']]['models'], FOT = ExtractFieldOutputTypes<TContract>> = { [M in keyof Models & keyof FOT & string]: Models[M] extends {
1053
+ readonly storage: {
1054
+ readonly table: TTableName;
1055
+ readonly fields: infer Fields;
1056
+ };
1057
+ } ? { [F in keyof Fields & keyof FOT[M] & string]: Fields[F] extends {
1058
+ readonly column: TColumnName;
1059
+ } ? FOT[M][F] : never }[keyof Fields & keyof FOT[M] & string] : never }[keyof Models & keyof FOT & string];
1060
+ /**
1061
+ * The output type of a referenced column. Returns the enum value union from the
1062
+ * `FieldOutputTypes` TypeMap when the column is enum-typed (the override already
1063
+ * carries the correct nullability), otherwise the codec output type with column
1064
+ * nullability applied.
1017
1065
  *
1018
1066
  * @template TContract The contract that describes the database.
1019
1067
  * @template TTableName The name of the table containing the column.
1020
1068
  * @template TColumnName The name of the column whose output type is to be extracted.
1021
1069
  */
1022
- type ExtractOutputType<TContract extends Contract<SqlStorage>, TTableName extends keyof UnboundTables<TContract> & string, TColumnName extends keyof UnboundTables<TContract>[TTableName]['columns'] & string, _TColumn = UnboundTables<TContract>[TTableName]['columns'][TColumnName]> = _TColumn extends StorageColumn ? (_TColumn['nullable'] extends true ? null : never) | ExtractCodecTypes<TContract>[_TColumn['codecId']]['output'] : never;
1070
+ type ExtractOutputType<TContract extends Contract<SqlStorage>, TTableName extends keyof UnboundTables<TContract> & string, TColumnName extends keyof UnboundTables<TContract>[TTableName]['columns'] & string, _TColumn = UnboundTables<TContract>[TTableName]['columns'][TColumnName]> = [FieldOutputOverride<TContract, TTableName, TColumnName>] extends [never] ? _TColumn extends StorageColumn ? (_TColumn['nullable'] extends true ? null : never) | ExtractCodecTypes<TContract>[_TColumn['codecId']]['output'] : never : FieldOutputOverride<TContract, TTableName, TColumnName>;
1023
1071
  /**
1024
1072
  * A type representing a selection of columns in a SQL `select` query in the
1025
1073
  * most generic form.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":["__brand","value","NamespaceId","namespace","model","space","ObjectType","CrossReference","plane","namespaceId","entityKind","name","spaceId","kind","codecId","typeParams","Record","members","ReadonlyArray","ScalarFieldType","ValueObjectFieldType","UnionFieldType","nullable","type","ContractFieldType","many","dict","valueSet","ValueSetRef","localFields","targetFields","table","parentColumns","childColumns","targetColumns","to","cardinality","on","ContractRelationOn","through","ContractRelationThrough","ContractManyToManyRelation","ContractNonJunctionRelation","ContractReferenceRelation","ContractEmbedRelation","field","fields","ContractField","Readonly","TModelStorage","ModelStorageBase","relations","ContractRelation","storage","discriminator","ContractDiscriminator","variants","ContractVariantEntry","base","owner","ContractModelBase","TModels","ModelName","K","models","valueObjects","ContractValueObject","enum","ContractEnum","namespaces","ApplicationDomainNamespace","domain","ApplicationDomain","ControlPolicy","nodeControl","defaultControlPolicy","TKey","TValue","$","K","THash","Brand","T","value","ExecutionHashBase","StorageHashBase","ProfileHashBase","Readonly","Record","id","entries","StorageEntitySlot","storageHash","namespaces","StorageNamespace","type","nullable","items","FieldType","properties","params","JsonPrimitive","key","JsonValue","ColumnDefaultLiteralValue","Date","ColumnDefaultLiteralInputValue","kind","expression","ColumnDefault","GeneratedValueSpec","ExecutionMutationDefaultValue","ref","table","column","onCreate","onUpdate","Omit","ExecutionMutationDefault","executionHash","mutations","defaults","ReadonlyArray","readOnly","projection","origin","capabilities","name","keys","unique","where","Expr","path","strategy","fields","indexes","DocIndex","target","targetFamily","profileHash","lane","annotations","contractJson","canonicalVersion","updatedAt","appTag","meta","invariants","space","migrationName","migrationHash","from","to","appliedAt","operationCount","TStorage","StorageBase","TModels","ContractModelBase","roots","CrossReference","domain","ApplicationDomain","storage","extensionPacks","execution","ContractExecutionSection","TContract","Contract","Only","TNamespace","valueObjects","VO","ContractValueObject","NamespaceValueObjectsOf","ExactlyOneNamespace","Projected","kind","IRNode","T","node","StorageNamespace","entries","Readonly","Record","IRNodeBase","Namespace","id","plane","namespaceId","entityKind","entityName","Pick","StorageBase","storage","Generator","EntityCoordinate","namespaces","ApplicationDomain","domain","IRNodeBase","kind","constructor","namespaceId","tableName","columns","spaceId","SqlNode","NamespaceId","ForeignKeyReferenceInput","input","source","ForeignKeyReference","target","name","onDelete","ReferentialAction","onUpdate","constraint","index","ForeignKeyInput","name","column","valueSet","ValueSetRef","SqlNode","constructor","CheckConstraintInput","input","columns","PrimaryKeyInput","type","options","Record","IndexInput","nativeType","codecId","nullable","typeParams","typeRef","default","ColumnDefault","control","ControlPolicy","StorageColumnInput","UniqueConstraintInput","StorageColumn","primaryKey","PrimaryKey","uniques","ReadonlyArray","UniqueConstraint","indexes","Index","foreignKeys","ForeignKey","ForeignKeyInput","checks","CheckConstraint","Readonly","StorageTableInput","StorageType","kind","CODEC_INSTANCE_KIND","StorageTypeInstanceInput","StorageTypeInstance","value","values","StorageValueSetInput","id","entries","table","StorageTable","StorageValueSet","THash","storageHash","StorageHashBase","types","SqlStorageTypeEntry","namespaces","SqlNamespace","Namespace","qualifyTable","tableName","Storage","SqlStorageInput","SqlStorage","storage","namespaceId","SqlNamespaceTablesInput","input","SqlNamespace","Readonly","Record","Namespace","namespaces","StorageType","kind","POSTGRES_ENUM_KIND","name","nativeType","values","codecId","control","ControlPolicy","value","PostgresEnumStorageEntry","NamespaceBase","instance","SqlUnboundNamespace","id","entries","table","StorageTable","constructor","qualifyTable","tableName","T","ControlDriverInstance","query","Row","sql","params","Promise","rows","onDelete","ReferentialAction","onUpdate","column","nullable","namespaceId","fields","SqlModelFieldStorage","constraint","index","fk","overrideDefaults","TCodecTypes","output","TQueryOperationTypes","TFieldOutputTypes","TFieldInputTypes","codecTypes","queryOperationTypes","fieldOutputTypes","fieldInputTypes","C","traits","CodecTrait","returnType","self","QueryOperationSelfSpec","impl","args","QueryOperationReturn","_CT","QueryOperationTypeEntry","Q","TContract","TTypeMaps","K","TypeMapsPhantomKey","NonNullable","F","CodecTypesOf","ExtractTypeMapsFromContract","QueryOperationTypesOf","FieldOutputTypesOf","FieldInputTypesOf","ExtractCodecTypes","Capabilities","Required","Method","T","K","Record","ScopeField","topLevel","ScopeTable","namespaces","Row","Alias","JoinOuterScope","getJoinOuterScope","Scope","buildAst","AnyFromSource","Name","Table","StorageTable$1","StorageTableToScopeTable","codecId","nullable","A","B","Expand","Omit","S","OldKey","NewKey","NullableScopeTable","TableName","RowType","SubqueryMarker","SelectAst","getRowFields","codecTypes","CodecTypesBase","capabilities","queryOperationTypes","QueryOperationTypesBase","resolvedColumnOutputTypes","Source","Field","FromScope","Columns","Pick","Expression$1","F","AvailableScope","QC","QueryContext","FieldProxy","fields","Functions","fns","BooleanCodecType","direction","OrderByDirection","nulls","OrderByNulls","OT","CT","input","eq","CodecId","CodecExpression","a","b","ne","N","gt","gte","lt","lte","and","ands","or","ors","exists","Subquery","subquery","notExists","in","expr","Array","values","notIn","raw","RawSqlTag","BuiltinFunctions","DeriveExtFunctions","count","CountField","sum","avg","min","max","AggregateOnlyFunctions","CodecTypes","output","PreResolved","ResolveField","ApplyNullable","NonNullable","sql","returning","StorageTable","annotate","As","AnnotationValue","OperationKind","annotations","ValidAnnotations","InsertQuery","GatedMethod","ReturningCapability","columns","WithFields","EmptyRow","build","SqlQueryPlan","ResolveRow","UpdateQuery","where","ExpressionBuilder","DeleteQuery","WithSelect","WithJoin","WithPagination","WithDistinct","WithAlias","WithBuild","GroupedQuery","groupBy","OrderByScope","having","AggregateFunctions","orderBy","field","OrderByOptions","options","distinctOn","postgres","SelectQuery","ParentScope","from","Other","JoinSource","other","MergeScopes","select","alias","WithField","Result","callback","ExtractScopeFields","innerJoin","on","JoinedTables","outerLeftJoin","NullableScope","outerRightJoin","outerFullJoin","lateralJoin","lateral","LateralRow","LateralBuilder","builder","outerLateralJoin","TraitExpression","limit","PaginationValue","offset","distinct","as","newAlias","C","Contract","M","ContractModelDefinitions","storage","table","ModelName","ColumnName","column","FieldTypes","FindModelForTable","TableProxyContract","UnboundTables","Tables","ColName","FindFieldForColumn","FieldName","FieldInputs","InsertValues","ResolvedInsertValues","ExtractCodecTypes","ExtractQueryOperationTypes","ResolvedColumnTypes","ExtractFieldOutputTypes","DefaultScope","ContractToQC","NewAlias","TableProxy","RebindScope","insert","ReadonlyArray","ExtractFieldInputTypes","rows","update","ResolvedUpdateValues","set","ResolvedUpdateExpressions","delete","Readonly","entries","CapabilitiesBase","TableNamesAcrossNamespaces","TableInAnyNamespace","NSId","NsId","Ns","Namespace"],"sources":["../../../../1-framework/0-foundation/contract/dist/domain-envelope-OkWsysCY.d.mts","../../../../1-framework/0-foundation/contract/dist/contract-types-CBbD-VV1.d.mts","../src/type-errors.ts","../src/column-reference.ts","../../../../1-framework/1-core/framework-components/dist/ir.d.mts","../../../1-core/contract/dist/foreign-key-BATxB95l.d.mts","../../../1-core/contract/dist/sql-storage-CXf9xjAL.d.mts","../../../1-core/contract/dist/types-DEnWD3xB.d.mts","../../sql-builder/dist/db-CeOCQldG.d.mts","../src/type-atoms.ts","../src/selection.ts","../src/table-reference.ts","../src/ref.ts","../src/select-builder.ts","../src/root.ts"],"mappings":";;KACK,WAAA;EAAA,SACMA,OAAO;AAAA;AAAA;AAAA;AAAA,UAKR,cAAA;EAAA,SACCG,SAAAA,EAAW,WAAW;EAAA,SACtBC,KAAAA;EAFa;;;;;EAAA,SAQbC,KAAAA;AAAAA;AAAAA;AAAAA;;;;;;;;;AA8BO;AAAA;;;;;;;;;AAOY;UAZpB,WAAA;EAAA,SACCG,KAAAA;EAAAA,SACAC,WAAAA;EAAAA,SACAC,UAAAA;EAAAA,SACAC,IAAAA;EAAAA,SACAC,OAAAA;AAAAA;AAAAA;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EACA,OAAA,EACA,YAAA,CAAa,UAAA,EAAY,gBAAA,CAAiB,SAAA,EAAW,UAAA;EAEvD,MAAA,CACE,GAAA,UACC,qCAAA;EAQH,KAAA,IAAS,OAAA,CAAQ,UAAA,yBAGb,QAAA,CAAS,UAAA;AAAA;;;;;AbtDG;AAEwC;;ccQ7C,IAAA,mBAAuB,QAAA,CAAS,UAAA;EAAA;cAG/B,QAAA,EAAU,SAAA;EdPFtZ;;;;AAON;EcSd,IAAA,CACE,KAAA,EAAO,cAAA,UACN,qCAAA;EdcgB;;;EcVnB,IAAA,uBACE,KAAA,iBAAsB,KAAA,GAClB,0BAAA,0FACA,cAAA,CAAe,KAAA,EAAO,SAAA,8BACzB,KAAA,kBACC,aAAA,CAAc,SAAA,EAAW,IAAA,CAAK,aAAA,CAAc,SAAA,GAAY,KAAA,KACxD,qCAAA;EACJ,IAAA,CACE,KAAA,EAAO,0BAAA,0FACN,qCAAA;AAAA;;;;iBAaW,UAAA,CACd,QAAA,UACC,qCAAqC;AdTtB;;;AAAA,iBcaF,UAAA,mBAA6B,QAAA,CAAS,UAAA,GACpD,QAAA,EAAU,SAAA,GACT,IAAA,CAAK,SAAA"}
1
+ {"version":3,"file":"index.d.mts","names":["__brand","value","NamespaceId","namespace","model","space","ObjectType","CrossReference","TKey","TValue","$","K","THash","Brand","T","ExecutionHashBase","StorageHashBase","ProfileHashBase","Readonly","Record","id","entries","StorageEntitySlot","storageHash","namespaces","StorageNamespace","type","nullable","items","FieldType","properties","params","JsonPrimitive","key","JsonValue","ColumnDefaultLiteralValue","Date","ColumnDefaultLiteralInputValue","kind","expression","ColumnDefault","GeneratedValueSpec","ExecutionMutationDefaultValue","ref","table","column","onCreate","onUpdate","Omit","ExecutionMutationDefault","executionHash","mutations","defaults","ReadonlyArray","readOnly","projection","origin","capabilities","name","keys","unique","where","Expr","path","strategy","fields","indexes","DocIndex","target","targetFamily","profileHash","lane","annotations","contractJson","canonicalVersion","updatedAt","appTag","meta","invariants","migrationName","migrationHash","from","to","appliedAt","operationCount","plane","namespaceId","entityKind","entityName","spaceId","codecId","typeParams","members","ScalarFieldType","ValueObjectFieldType","UnionFieldType","ContractFieldType","many","dict","valueSet","ValueSetRef","localFields","targetFields","parentColumns","childColumns","targetColumns","cardinality","on","ContractRelationOn","through","ContractRelationThrough","ContractManyToManyRelation","ContractNonJunctionRelation","ContractReferenceRelation","ContractEmbedRelation","field","ContractField","TModelStorage","ModelStorageBase","relations","ContractRelation","storage","discriminator","ContractDiscriminator","variants","ContractVariantEntry","base","owner","ContractModelBase","TModels","ModelName","models","valueObjects","ContractValueObject","enum","ContractEnum","ApplicationDomainNamespace","domain","ApplicationDomain","ControlPolicy","nodeControl","defaultControlPolicy","THash","executionHash","ExecutionHashBase","mutations","defaults","ReadonlyArray","ExecutionMutationDefault","TStorage","StorageBase","target","targetFamily","roots","Record","CrossReference","domain","ApplicationDomain","storage","capabilities","extensionPacks","execution","ContractExecutionSection","profileHash","ProfileHashBase","meta","T","Only","TNamespace","valueObjects","VO","ContractValueObject","TContract","Contract","NamespaceValueObjectsOf","ExactlyOneNamespace","Projected","kind","IRNode","T","node","StorageNamespace","entries","Readonly","Record","IRNodeBase","Namespace","id","plane","namespaceId","entityKind","entityName","Pick","StorageBase","storage","Generator","EntityCoordinate","coord","namespaces","ApplicationDomain","domain","Input","Node","schema","Type","construct","input","EntityKindDescriptor","ReadonlyMap","AnyEntityKindDescriptor","kinds","onUnknown","nsId","IRNodeBase","kind","constructor","namespaceId","tableName","columns","spaceId","SqlNode","NamespaceId","ForeignKeyReferenceInput","input","source","ForeignKeyReference","target","name","onDelete","ReferentialAction","onUpdate","constraint","index","ForeignKeyInput","name","column","valueSet","ValueSetRef","SqlNode","constructor","CheckConstraintInput","input","columns","PrimaryKeyInput","type","options","Record","IndexInput","nativeType","codecId","nullable","typeParams","typeRef","default","ColumnDefault","control","ControlPolicy","StorageColumnInput","UniqueConstraintInput","StorageColumn","primaryKey","PrimaryKey","uniques","ReadonlyArray","UniqueConstraint","indexes","Index","foreignKeys","ForeignKey","ForeignKeyInput","checks","CheckConstraint","Readonly","StorageTableInput","kind","values","JsonValue","StorageValueSetInput","StorageType","kind","CODEC_INSTANCE_KIND","codecId","nativeType","typeParams","Record","StorageTypeInstanceInput","input","StorageTypeInstance","value","id","entries","Readonly","THash","storageHash","StorageHashBase","types","SqlStorageTypeEntry","namespaces","SqlNamespace","table","StorageTable","valueSet","StorageValueSet","Namespace","SqlNamespaceEntries","qualifyTable","tableName","SqlNode","Storage","constructor","SqlStorageInput","SqlNamespaceTablesInput","input","SqlNamespace","Readonly","Record","Namespace","namespaces","NamespaceBase","instance","SqlUnboundNamespace","id","entries","SqlNamespaceEntries","kind","constructor","table","StorageTable","qualifyTable","tableName","T","ControlDriverInstance","query","Row","sql","params","Promise","rows","name","onDelete","ReferentialAction","onUpdate","column","codecId","nullable","namespaceId","fields","SqlModelFieldStorage","constraint","index","fk","overrideDefaults","TCodecTypes","output","TQueryOperationTypes","TFieldOutputTypes","NamespacedFieldTypeMap","TFieldInputTypes","codecTypes","queryOperationTypes","fieldOutputTypes","fieldInputTypes","C","traits","CodecTrait","returnType","self","QueryOperationSelfSpec","impl","args","QueryOperationReturn","_CT","QueryOperationTypeEntry","Q","TContract","TTypeMaps","K","TypeMapsPhantomKey","NonNullable","F","CodecTypesOf","ExtractTypeMapsFromContract","QueryOperationTypesOf","FieldOutputTypesOf","FieldInputTypesOf","ExtractCodecTypes","Capabilities","Required","Method","T","K","Record","ScopeField","topLevel","ScopeTable","namespaces","Row","Alias","JoinOuterScope","getJoinOuterScope","Scope","buildAst","AnyFromSource","Name","Table","StorageTable$1","StorageTableToScopeTable","codecId","nullable","A","B","Expand","Omit","S","OldKey","NewKey","NullableScopeTable","TableName","RowType","SubqueryMarker","SelectAst","getRowFields","codecTypes","CodecTypesBase","capabilities","queryOperationTypes","QueryOperationTypesBase","resolvedColumnOutputTypes","Source","Field","FromScope","Columns","Pick","Expression$1","F","AvailableScope","QC","QueryContext","FieldProxy","fields","Functions","fns","BooleanCodecType","direction","OrderByDirection","nulls","OrderByNulls","OT","CT","input","eq","CodecId","CodecExpression","a","b","ne","N","gt","gte","lt","lte","and","ands","or","ors","exists","Subquery","subquery","notExists","in","expr","Array","values","notIn","raw","RawSqlTag","BuiltinFunctions","DeriveExtFunctions","count","CountField","sum","avg","min","max","AggregateOnlyFunctions","CodecTypes","output","PreResolved","ResolveField","ApplyNullable","NonNullable","sql","returning","StorageTable","annotate","As","AnnotationValue","OperationKind","annotations","ValidAnnotations","InsertQuery","GatedMethod","ReturningCapability","columns","WithFields","EmptyRow","build","SqlQueryPlan","ResolveRow","UpdateQuery","where","ExpressionBuilder","DeleteQuery","WithSelect","WithJoin","WithPagination","WithDistinct","WithAlias","WithBuild","GroupedQuery","groupBy","OrderByScope","having","AggregateFunctions","orderBy","field","OrderByOptions","options","distinctOn","postgres","SelectQuery","ParentScope","from","Other","JoinSource","other","MergeScopes","select","alias","WithField","Result","callback","ExtractScopeFields","innerJoin","on","JoinedTables","outerLeftJoin","NullableScope","outerRightJoin","outerFullJoin","lateralJoin","lateral","LateralRow","LateralBuilder","builder","outerLateralJoin","TraitExpression","limit","PaginationValue","offset","distinct","as","newAlias","C","TableProxyContract","NsId","Models","M","storage","table","ModelName","ColumnName","Fields","column","NamespaceTable","ColName","ComputeColumnJsType","ExtractCodecTypes","FieldInputs","InsertValues","NsInputs","FindModelForTable","FindFieldForColumn","FieldName","ResolvedInsertValues","ExtractQueryOperationTypes","ResolvedColumnTypes","DefaultScope","ContractToQC","NewAlias","TableProxy","RebindScope","insert","ReadonlyArray","ExtractFieldInputTypes","rows","update","ResolvedUpdateValues","set","ResolvedUpdateExpressions","delete","Readonly","models","domain","NamespaceDomain","entries","NamespaceEntries","CapabilitiesBase","NS","TableNamesAcrossNamespaces","TableInAnyNamespace","NSId","TablesInNamespace","Ns","Namespace"],"sources":["../../../../1-framework/0-foundation/contract/dist/domain-envelope-Bj-zQbVU.d.mts","../../../../1-framework/0-foundation/contract/dist/contract-types-DrjCtVOs.d.mts","../src/type-errors.ts","../src/column-reference.ts","../../../../1-framework/1-core/framework-components/dist/ir.d.mts","../../../1-core/contract/dist/foreign-key-BATxB95l.d.mts","../../../1-core/contract/dist/storage-value-set-WnYsIFM8.d.mts","../../../1-core/contract/dist/sql-storage-Dga0jwP2.d.mts","../../../1-core/contract/dist/types-B1N8w0I2.d.mts","../../sql-builder/dist/db-BS_UG1Si.d.mts","../src/type-atoms.ts","../src/selection.ts","../src/table-reference.ts","../src/ref.ts","../src/select-builder.ts","../src/root.ts"],"mappings":";;KACK,WAAA;EAAA,SACMA,OAAO;AAAA;AAAA;AAAA;AAAA,UAKR,cAAA;EAAA,SACCG,SAAAA,EAAW,WAAW;EAAA,SACtBC,KAAAA;EAFa;;;;;EAAA,SAQbC,KAAAA;AAAAA;AAAAA;AAAAA;;;AASmB;cAAhB,CAAA;;;;;;;KAOT,KAAA;EAAA,CACF,CAAA,WAAY,IAAA,GAAO,MAAA;AAAA;;;;;;KAOjB,eAAA,yBAAwC,KAAA,GAAQ,KAAK;AAP9B;;;;;AAAA,KAavB,iBAAA,yBAA0C,KAAA,GAAQ,KAAK;AANF;AAAA;;;;AAAA,KAcrD,eAAA,yBAAwC,KAAA,GAAQ,KAAK;;;AARE;AAEkB;;KAazE,iBAAA,GAAoB,QAAQ,CAAC,MAAA;;;;;;AAPwB;UAchD,gBAAA;EAAA,SACCe,EAAAA;EAAAA,SACAC,OAAAA,EAAS,QAAA,CAAS,MAAA,SAAe,iBAAA;AAAA;AATJ;AAAA;;;;;;;;AAAA,UAoB9B,WAAA;EAAA,SACCE,WAAAA,EAAa,eAAA,CAAgB,KAAA;EAAA,SAC7BC,UAAAA,EAAY,QAAA,CAAS,MAAA,SAAe,gBAAA;AAAA;AAAA,KAQ1C,kBAAA;EAAA,SACMJ,EAAAA;EAAAA,SACAW,MAAAA,GAAS,MAAM;AAAA;AAAA,KAErB,aAAA;AAAA,KACA,SAAA,GAAY,aAAA;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A,GAAY,KAAA,KACxD,qCAAA;EACJ,IAAA,CACE,KAAA,EAAO,0BAAA,0FACN,qCAAA;AAAA;;;;iBAaW,UAAA,CACd,QAAA,UACC,qCAAqC;;;;iBAIxB,UAAA,mBAA6B,QAAA,CAAS,UAAA,GACpD,QAAA,EAAU,SAAA,GACT,IAAA,CAAK,SAAA"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-lane-query-builder",
3
- "version": "0.13.0",
3
+ "version": "0.14.0-dev.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "SQL query builder lane for Prisma Next",
8
8
  "devDependencies": {
9
- "@prisma-next/contract": "0.13.0",
10
- "@prisma-next/sql-builder": "0.13.0",
11
- "@prisma-next/sql-contract": "0.13.0",
12
- "@prisma-next/tsconfig": "0.13.0",
13
- "@prisma-next/tsdown": "0.13.0",
9
+ "@prisma-next/contract": "0.14.0-dev.1",
10
+ "@prisma-next/sql-builder": "0.14.0-dev.1",
11
+ "@prisma-next/sql-contract": "0.14.0-dev.1",
12
+ "@prisma-next/tsconfig": "0.14.0-dev.1",
13
+ "@prisma-next/tsdown": "0.14.0-dev.1",
14
14
  "tsdown": "0.22.1",
15
15
  "typescript": "5.9.3",
16
16
  "vitest": "4.1.8"
package/src/selection.ts CHANGED
@@ -3,7 +3,12 @@ import type {
3
3
  UnboundTables as SqlBuilderUnboundTables,
4
4
  TableProxyContract,
5
5
  } from '@prisma-next/sql-builder/types';
6
- import type { ExtractCodecTypes, SqlStorage, StorageColumn } from '@prisma-next/sql-contract/types';
6
+ import type {
7
+ ExtractCodecTypes,
8
+ ExtractFieldOutputTypes,
9
+ SqlStorage,
10
+ StorageColumn,
11
+ } from '@prisma-next/sql-contract/types';
7
12
  import type { DrainOuterGeneric } from './type-atoms';
8
13
 
9
14
  /**
@@ -16,8 +21,37 @@ export type UnboundTables<TContract extends Contract<SqlStorage>> = SqlBuilderUn
16
21
  >;
17
22
 
18
23
  /**
19
- * A utility type to extract the output type of a referenced column from a contract.
20
- * Uses the type-only codec channel (ExtractCodecTypes), not runtime mappings.
24
+ * The field-output override (the enum value union) for a `table.column`, or
25
+ * `never` when no model field maps to it. The emitted `FieldOutputTypes`
26
+ * TypeMap is keyed by model/field, so one pass over the models matches both the
27
+ * `storage.table` and the field's `storage.fields[*].column` to read the
28
+ * already-narrowed type back out.
29
+ */
30
+ type FieldOutputOverride<
31
+ TContract extends Contract,
32
+ TTableName extends string,
33
+ TColumnName extends string,
34
+ Models = TContract['domain']['namespaces'][keyof TContract['domain']['namespaces']]['models'],
35
+ FOT = ExtractFieldOutputTypes<TContract>,
36
+ > = {
37
+ [M in keyof Models & keyof FOT & string]: Models[M] extends {
38
+ readonly storage: { readonly table: TTableName; readonly fields: infer Fields };
39
+ }
40
+ ? {
41
+ [F in keyof Fields & keyof FOT[M] & string]: Fields[F] extends {
42
+ readonly column: TColumnName;
43
+ }
44
+ ? FOT[M][F]
45
+ : never;
46
+ }[keyof Fields & keyof FOT[M] & string]
47
+ : never;
48
+ }[keyof Models & keyof FOT & string];
49
+
50
+ /**
51
+ * The output type of a referenced column. Returns the enum value union from the
52
+ * `FieldOutputTypes` TypeMap when the column is enum-typed (the override already
53
+ * carries the correct nullability), otherwise the codec output type with column
54
+ * nullability applied.
21
55
  *
22
56
  * @template TContract The contract that describes the database.
23
57
  * @template TTableName The name of the table containing the column.
@@ -28,11 +62,13 @@ export type ExtractOutputType<
28
62
  TTableName extends keyof UnboundTables<TContract> & string,
29
63
  TColumnName extends keyof UnboundTables<TContract>[TTableName]['columns'] & string,
30
64
  _TColumn = UnboundTables<TContract>[TTableName]['columns'][TColumnName],
31
- > = _TColumn extends StorageColumn
32
- ?
33
- | (_TColumn['nullable'] extends true ? null : never)
34
- | ExtractCodecTypes<TContract>[_TColumn['codecId']]['output']
35
- : never;
65
+ > = [FieldOutputOverride<TContract, TTableName, TColumnName>] extends [never]
66
+ ? _TColumn extends StorageColumn
67
+ ?
68
+ | (_TColumn['nullable'] extends true ? null : never)
69
+ | ExtractCodecTypes<TContract>[_TColumn['codecId']]['output']
70
+ : never
71
+ : FieldOutputOverride<TContract, TTableName, TColumnName>;
36
72
 
37
73
  /**
38
74
  * A type representing a selection of columns in a SQL `select` query in the