@prisma-next/sql-contract 0.12.0 → 0.13.0-dev.2
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/canonicalization-hooks.d.mts.map +1 -1
- package/dist/canonicalization-hooks.mjs +10 -11
- package/dist/canonicalization-hooks.mjs.map +1 -1
- package/dist/factories.d.mts +4 -2
- package/dist/factories.d.mts.map +1 -1
- package/dist/factories.mjs +3 -2
- package/dist/factories.mjs.map +1 -1
- package/dist/foreign-key-BATxB95l.d.mts +121 -0
- package/dist/foreign-key-BATxB95l.d.mts.map +1 -0
- package/dist/index-type-validation.d.mts +2 -2
- package/dist/index-type-validation.mjs +1 -1
- package/dist/index-type-validation.mjs.map +1 -1
- package/dist/{index-types-B1cf5N0F.d.mts → index-types-Czsyu7Iw.d.mts} +1 -1
- package/dist/{index-types-B1cf5N0F.d.mts.map → index-types-Czsyu7Iw.d.mts.map} +1 -1
- package/dist/index-types.d.mts +1 -1
- package/dist/pack-types.d.mts +1 -1
- package/dist/referential-action-sql.d.mts +12 -0
- package/dist/referential-action-sql.d.mts.map +1 -0
- package/dist/referential-action-sql.mjs +17 -0
- package/dist/referential-action-sql.mjs.map +1 -0
- package/dist/resolve-storage-table.d.mts +20 -0
- package/dist/resolve-storage-table.d.mts.map +1 -0
- package/dist/resolve-storage-table.mjs +42 -0
- package/dist/resolve-storage-table.mjs.map +1 -0
- package/dist/sql-storage-CXf9xjAL.d.mts +314 -0
- package/dist/sql-storage-CXf9xjAL.d.mts.map +1 -0
- package/dist/types-DEnWD3xB.d.mts +208 -0
- package/dist/types-DEnWD3xB.d.mts.map +1 -0
- package/dist/{types-DPkj4y3_.mjs → types-DqhaAjCH.mjs} +109 -28
- package/dist/types-DqhaAjCH.mjs.map +1 -0
- package/dist/types.d.mts +4 -2
- package/dist/types.mjs +2 -2
- package/dist/validators.d.mts +51 -14
- package/dist/validators.d.mts.map +1 -1
- package/dist/validators.mjs +116 -32
- package/dist/validators.mjs.map +1 -1
- package/package.json +11 -9
- package/src/canonicalization-hooks.ts +5 -6
- package/src/exports/referential-action-sql.ts +1 -0
- package/src/exports/resolve-storage-table.ts +1 -0
- package/src/exports/types.ts +6 -0
- package/src/factories.ts +2 -1
- package/src/index-type-validation.ts +1 -1
- package/src/ir/build-sql-namespace.ts +33 -19
- package/src/ir/check-constraint.ts +42 -0
- package/src/ir/foreign-key-reference.ts +23 -0
- package/src/ir/postgres-enum-storage-entry.ts +2 -0
- package/src/ir/sql-storage.ts +53 -50
- package/src/ir/sql-unbound-namespace.ts +11 -4
- package/src/ir/storage-column.ts +7 -1
- package/src/ir/storage-table.ts +10 -0
- package/src/ir/storage-type-instance.ts +5 -3
- package/src/ir/storage-value-set.ts +42 -0
- package/src/referential-action-sql.ts +14 -0
- package/src/resolve-storage-table.ts +61 -0
- package/src/types.ts +13 -0
- package/src/validators.ts +156 -46
- package/dist/types-ChlHcJCu.d.mts +0 -508
- package/dist/types-ChlHcJCu.d.mts.map +0 -1
- package/dist/types-DPkj4y3_.mjs.map +0 -1
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
import { IRNodeBase, Namespace, NamespaceBase, Storage, StorageType } from "@prisma-next/framework-components/ir";
|
|
2
|
-
import { ColumnDefault, NamespaceId, StorageHashBase } from "@prisma-next/contract/types";
|
|
3
|
-
import { CodecTrait } from "@prisma-next/framework-components/codec";
|
|
4
|
-
|
|
5
|
-
//#region src/ir/sql-node.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* SQL family IR node base. Carries the family-level `kind` discriminator
|
|
8
|
-
* `'sql'` and inherits the framework's `freezeNode` affordance.
|
|
9
|
-
*
|
|
10
|
-
* Single family-level discriminator (not per-leaf) reflects the fact that
|
|
11
|
-
* SQL IR has no polymorphic dispatch today — verifiers and serializers
|
|
12
|
-
* walk by structural position (`storage.tables[name].columns[name]`),
|
|
13
|
-
* not by inspecting `kind`. The abstract bar for per-leaf discriminators
|
|
14
|
-
* isn't earned until a future polymorphic consumer arrives.
|
|
15
|
-
*
|
|
16
|
-
* `kind` is installed as a non-enumerable own property on every instance,
|
|
17
|
-
* which keeps three things clean simultaneously:
|
|
18
|
-
*
|
|
19
|
-
* - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope
|
|
20
|
-
* shape (no `kind` field), so emitted contract.json files and the
|
|
21
|
-
* `validateSqlContractFully` arktype schemas stay unchanged.
|
|
22
|
-
* - Test assertions that use `toEqual({...})` against the pre-lift flat
|
|
23
|
-
* shape continue to pass — only enumerable own properties are
|
|
24
|
-
* compared.
|
|
25
|
-
* - Direct access (`node.kind`) and runtime narrowing
|
|
26
|
-
* (`if (node.kind === 'sql')`) still work, so future polymorphic
|
|
27
|
-
* dispatch can begin reading `kind` without a runtime change.
|
|
28
|
-
*
|
|
29
|
-
* Future per-leaf overrides land cleanly: a class that gains a
|
|
30
|
-
* polymorphic-dispatch consumer (e.g. an enum type instance walked
|
|
31
|
-
* alongside other types) overrides `kind` with its narrower literal
|
|
32
|
-
* at that leaf level. Per-leaf overrides will use enumerable kind
|
|
33
|
-
* (matching the Mongo per-class-discriminator precedent) because they
|
|
34
|
-
* encode dispatch-relevant information that callers need to see in
|
|
35
|
-
* JSON envelopes; the family-level `'sql'` is uniform across all SQL
|
|
36
|
-
* IR and carries no dispatch-relevant information.
|
|
37
|
-
*/
|
|
38
|
-
declare abstract class SqlNode extends IRNodeBase {
|
|
39
|
-
readonly kind?: string;
|
|
40
|
-
constructor();
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/ir/foreign-key-reference.d.ts
|
|
44
|
-
interface ForeignKeyReferenceInput {
|
|
45
|
-
readonly namespaceId: string;
|
|
46
|
-
readonly tableName: string;
|
|
47
|
-
readonly columns: readonly string[];
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* SQL Contract IR node for one side (source or target) of a foreign-key
|
|
51
|
-
* declaration. Carries the full coordinate: namespace, table, and columns.
|
|
52
|
-
*
|
|
53
|
-
* Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`
|
|
54
|
-
* as the sentinel `namespaceId` for single-namespace (unbound) references.
|
|
55
|
-
*/
|
|
56
|
-
declare class ForeignKeyReference extends SqlNode {
|
|
57
|
-
readonly namespaceId: NamespaceId;
|
|
58
|
-
readonly tableName: string;
|
|
59
|
-
readonly columns: readonly string[];
|
|
60
|
-
constructor(input: ForeignKeyReferenceInput);
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
|
-
//#region src/ir/foreign-key.d.ts
|
|
64
|
-
type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';
|
|
65
|
-
interface ForeignKeyInput {
|
|
66
|
-
readonly source: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
67
|
-
readonly target: ForeignKeyReference | ForeignKeyReferenceInput;
|
|
68
|
-
readonly name?: string;
|
|
69
|
-
readonly onDelete?: ReferentialAction;
|
|
70
|
-
readonly onUpdate?: ReferentialAction;
|
|
71
|
-
/** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */
|
|
72
|
-
readonly constraint: boolean;
|
|
73
|
-
/** Whether to emit a backing index for the FK columns. */
|
|
74
|
-
readonly index: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* SQL Contract IR node for a table-level foreign-key declaration.
|
|
78
|
-
*
|
|
79
|
-
* Each FK carries explicit `source` and `target` {@link ForeignKeyReference}
|
|
80
|
-
* coordinates (namespace, table, columns). For single-namespace contracts the
|
|
81
|
-
* sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.
|
|
82
|
-
*
|
|
83
|
-
* The nested references are normalised to {@link ForeignKeyReference}
|
|
84
|
-
* instances inside the constructor so downstream walks see a uniform AST
|
|
85
|
-
* regardless of whether the input was a JSON literal or an already-constructed
|
|
86
|
-
* class instance.
|
|
87
|
-
*/
|
|
88
|
-
declare class ForeignKey extends SqlNode {
|
|
89
|
-
readonly source: ForeignKeyReference;
|
|
90
|
-
readonly target: ForeignKeyReference;
|
|
91
|
-
readonly constraint: boolean;
|
|
92
|
-
readonly index: boolean;
|
|
93
|
-
readonly name?: string;
|
|
94
|
-
readonly onDelete?: ReferentialAction;
|
|
95
|
-
readonly onUpdate?: ReferentialAction;
|
|
96
|
-
constructor(input: ForeignKeyInput);
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/ir/postgres-enum-storage-entry.d.ts
|
|
100
|
-
/**
|
|
101
|
-
* Discriminator literal for the Postgres-enum variant on the polymorphic
|
|
102
|
-
* `SqlStorage.types` slot.
|
|
103
|
-
*
|
|
104
|
-
* Enums are a target-level concept: Postgres ships native
|
|
105
|
-
* `CREATE TYPE … AS ENUM` while other SQL targets approximate enums via
|
|
106
|
-
* constraints. The literal lives at the SQL family layer because every
|
|
107
|
-
* SQL-family consumer (verifier, planner, lowering, …) needs to
|
|
108
|
-
* discriminate enum-typed slot entries from codec-typed ones. The
|
|
109
|
-
* concrete IR class (`PostgresEnumType`) lives in the target-postgres
|
|
110
|
-
* package and implements this structural contract; cross-domain
|
|
111
|
-
* layering rules forbid the SQL family from importing the concrete
|
|
112
|
-
* target class directly, so the discriminator and structural interface
|
|
113
|
-
* carry the dispatch.
|
|
114
|
-
*/
|
|
115
|
-
declare const POSTGRES_ENUM_KIND: "postgres-enum";
|
|
116
|
-
/**
|
|
117
|
-
* Structural contract every Postgres-enum slot entry honours — both
|
|
118
|
-
* the live `PostgresEnumType` IR-class instance and the raw JSON
|
|
119
|
-
* envelope shape that survives `JSON.stringify` round-trips. SQL
|
|
120
|
-
* family-layer dispatch narrows polymorphic `StorageType` slot
|
|
121
|
-
* entries to this shape via `isPostgresEnumStorageEntry`.
|
|
122
|
-
*
|
|
123
|
-
* The `codecBinding` field is accessor-shaped (live class instance) on
|
|
124
|
-
* the IR class and undefined on the raw JSON envelope; consumers that
|
|
125
|
-
* need it must guard for its presence (the JSON path synthesises an
|
|
126
|
-
* equivalent shape from `codecId` + `values`).
|
|
127
|
-
*/
|
|
128
|
-
interface PostgresEnumStorageEntry extends StorageType {
|
|
129
|
-
readonly kind: typeof POSTGRES_ENUM_KIND;
|
|
130
|
-
readonly name: string;
|
|
131
|
-
readonly nativeType: string;
|
|
132
|
-
readonly values: readonly string[];
|
|
133
|
-
/**
|
|
134
|
-
* Enumerable own property on the persisted JSON envelope; the live
|
|
135
|
-
* IR-class instance carries it too. Family-shared dispatch sites
|
|
136
|
-
* read `codecId` directly rather than going through the IR-class
|
|
137
|
-
* `codecBinding` accessor (which lives on the prototype and isn't
|
|
138
|
-
* present on raw JSON envelopes).
|
|
139
|
-
*/
|
|
140
|
-
readonly codecId: string;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Narrow a polymorphic `StorageType` entry to the Postgres-enum shape
|
|
144
|
-
* via its enumerable `kind` discriminator. Type guard returns true for
|
|
145
|
-
* both live `PostgresEnumType` instances and raw JSON envelopes.
|
|
146
|
-
*/
|
|
147
|
-
declare function isPostgresEnumStorageEntry(value: unknown): value is PostgresEnumStorageEntry;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/ir/primary-key.d.ts
|
|
150
|
-
interface PrimaryKeyInput {
|
|
151
|
-
readonly columns: readonly string[];
|
|
152
|
-
readonly name?: string;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* SQL Contract IR node for a table's primary-key constraint.
|
|
156
|
-
*/
|
|
157
|
-
declare class PrimaryKey extends SqlNode {
|
|
158
|
-
readonly columns: readonly string[];
|
|
159
|
-
readonly name?: string;
|
|
160
|
-
constructor(input: PrimaryKeyInput);
|
|
161
|
-
}
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/ir/sql-index.d.ts
|
|
164
|
-
interface IndexInput {
|
|
165
|
-
readonly columns: readonly string[];
|
|
166
|
-
readonly name?: string;
|
|
167
|
-
readonly type?: string;
|
|
168
|
-
readonly options?: Record<string, unknown>;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* SQL Contract IR node for a table-level secondary index.
|
|
172
|
-
*
|
|
173
|
-
* Note that this class shadows the global TypeScript `Index` lib type
|
|
174
|
-
* at the family-shared name; consumer files that need both should
|
|
175
|
-
* alias one (e.g.
|
|
176
|
-
* `import { Index as SqlIndexNode } from '@prisma-next/sql-contract/types'`).
|
|
177
|
-
*/
|
|
178
|
-
declare class Index extends SqlNode {
|
|
179
|
-
readonly columns: readonly string[];
|
|
180
|
-
readonly name?: string;
|
|
181
|
-
readonly type?: string;
|
|
182
|
-
readonly options?: Record<string, unknown>;
|
|
183
|
-
constructor(input: IndexInput);
|
|
184
|
-
}
|
|
185
|
-
//#endregion
|
|
186
|
-
//#region src/ir/storage-column.d.ts
|
|
187
|
-
/**
|
|
188
|
-
* Hydration / construction input shape for {@link StorageColumn}. Mirrors
|
|
189
|
-
* the on-disk storage JSON envelope exactly so the family-base
|
|
190
|
-
* serializer's hydration walker can hand an arktype-validated literal
|
|
191
|
-
* straight to `new`.
|
|
192
|
-
*
|
|
193
|
-
* `typeParams` and `typeRef` remain mutually exclusive (one or the
|
|
194
|
-
* other, not both); the constructor preserves whichever caller-side
|
|
195
|
-
* choice the input encodes.
|
|
196
|
-
*/
|
|
197
|
-
interface StorageColumnInput {
|
|
198
|
-
readonly nativeType: string;
|
|
199
|
-
readonly codecId: string;
|
|
200
|
-
readonly nullable: boolean;
|
|
201
|
-
readonly typeParams?: Record<string, unknown>;
|
|
202
|
-
readonly typeRef?: string;
|
|
203
|
-
readonly default?: ColumnDefault;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* SQL Contract IR node for a single column entry in `StorageTable.columns`.
|
|
207
|
-
*
|
|
208
|
-
* Single concrete family-shared class — every SQL target reads the
|
|
209
|
-
* same column shape today, so there is no per-target subclass. The
|
|
210
|
-
* class type accepts any caller that constructs via
|
|
211
|
-
* `new StorageColumn(input)`; literal construction sites must pass
|
|
212
|
-
* through the constructor or the family-base hydration walker.
|
|
213
|
-
*
|
|
214
|
-
* The column's `name` is not on the class — columns are keyed by name
|
|
215
|
-
* in the parent `StorageTable.columns: Record<string, StorageColumn>`
|
|
216
|
-
* map, so a `name` field would be redundant with the key.
|
|
217
|
-
*/
|
|
218
|
-
declare class StorageColumn extends SqlNode {
|
|
219
|
-
readonly nativeType: string;
|
|
220
|
-
readonly codecId: string;
|
|
221
|
-
readonly nullable: boolean;
|
|
222
|
-
readonly typeParams?: Record<string, unknown>;
|
|
223
|
-
readonly typeRef?: string;
|
|
224
|
-
readonly default?: ColumnDefault;
|
|
225
|
-
constructor(input: StorageColumnInput);
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/ir/unique-constraint.d.ts
|
|
229
|
-
interface UniqueConstraintInput {
|
|
230
|
-
readonly columns: readonly string[];
|
|
231
|
-
readonly name?: string;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* SQL Contract IR node for a table-level unique constraint.
|
|
235
|
-
*/
|
|
236
|
-
declare class UniqueConstraint extends SqlNode {
|
|
237
|
-
readonly columns: readonly string[];
|
|
238
|
-
readonly name?: string;
|
|
239
|
-
constructor(input: UniqueConstraintInput);
|
|
240
|
-
}
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region src/ir/storage-table.d.ts
|
|
243
|
-
interface StorageTableInput {
|
|
244
|
-
readonly columns: Record<string, StorageColumn | StorageColumnInput>;
|
|
245
|
-
readonly primaryKey?: PrimaryKey | PrimaryKeyInput;
|
|
246
|
-
readonly uniques: ReadonlyArray<UniqueConstraint | UniqueConstraintInput>;
|
|
247
|
-
readonly indexes: ReadonlyArray<Index | IndexInput>;
|
|
248
|
-
readonly foreignKeys: ReadonlyArray<ForeignKey | ForeignKeyInput>;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* SQL Contract IR node for a single table entry in a namespace's
|
|
252
|
-
* `tables` map.
|
|
253
|
-
*
|
|
254
|
-
* The constructor normalises nested IR-class fields (columns, primary
|
|
255
|
-
* key, uniques, indexes, foreign keys) into the appropriate class
|
|
256
|
-
* instances so downstream walks see a uniform AST regardless of whether
|
|
257
|
-
* the input was a JSON literal or an already-constructed class.
|
|
258
|
-
*
|
|
259
|
-
* The table's `name` is not on the class — tables are keyed by name in
|
|
260
|
-
* the parent namespace's `tables: Record<string, StorageTable>` map.
|
|
261
|
-
*/
|
|
262
|
-
declare class StorageTable extends SqlNode {
|
|
263
|
-
readonly columns: Readonly<Record<string, StorageColumn>>;
|
|
264
|
-
readonly uniques: ReadonlyArray<UniqueConstraint>;
|
|
265
|
-
readonly indexes: ReadonlyArray<Index>;
|
|
266
|
-
readonly foreignKeys: ReadonlyArray<ForeignKey>;
|
|
267
|
-
readonly primaryKey?: PrimaryKey;
|
|
268
|
-
constructor(input: StorageTableInput);
|
|
269
|
-
}
|
|
270
|
-
//#endregion
|
|
271
|
-
//#region src/ir/storage-type-instance.d.ts
|
|
272
|
-
/**
|
|
273
|
-
* Sentinel kind for the legacy codec-triple shape persisted under
|
|
274
|
-
* `SqlStorage.types`. Plain JSON-clean object literals carry this
|
|
275
|
-
* discriminator so the polymorphic slot dispatch can route them down
|
|
276
|
-
* the codec path while target-specific IR class instances (e.g. the
|
|
277
|
-
* Postgres enum class) keep their own narrower `kind` literal.
|
|
278
|
-
*/
|
|
279
|
-
declare const CODEC_INSTANCE_KIND: "codec-instance";
|
|
280
|
-
/**
|
|
281
|
-
* Structural sub-interface of {@link StorageType} for codec-typed entries
|
|
282
|
-
* in `SqlStorage.types`. These are plain object literals — there is no
|
|
283
|
-
* runtime IR class, the JSON envelope round-trips through the slot
|
|
284
|
-
* unchanged. The `kind: 'codec-instance'` discriminator is the dispatch
|
|
285
|
-
* key that distinguishes codec-typed entries from class-instance entries
|
|
286
|
-
* (e.g. `PostgresEnumType`) sharing the polymorphic slot.
|
|
287
|
-
*/
|
|
288
|
-
interface StorageTypeInstance extends StorageType {
|
|
289
|
-
readonly kind: typeof CODEC_INSTANCE_KIND;
|
|
290
|
-
readonly codecId: string;
|
|
291
|
-
readonly nativeType: string;
|
|
292
|
-
readonly typeParams: Record<string, unknown>;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Construction-time input for a codec-triple entry. Symmetric with the
|
|
296
|
-
* structural runtime shape minus the `kind` discriminator — callers may
|
|
297
|
-
* omit `kind`; the helper {@link toStorageTypeInstance} stamps it on.
|
|
298
|
-
*/
|
|
299
|
-
interface StorageTypeInstanceInput {
|
|
300
|
-
readonly codecId: string;
|
|
301
|
-
readonly nativeType: string;
|
|
302
|
-
readonly typeParams: Record<string, unknown>;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Stamp the codec-instance `kind` discriminator on a caller-supplied
|
|
306
|
-
* codec triple. Idempotent: input that already carries the discriminator
|
|
307
|
-
* passes through unchanged.
|
|
308
|
-
*/
|
|
309
|
-
declare function toStorageTypeInstance(input: StorageTypeInstanceInput): StorageTypeInstance;
|
|
310
|
-
/**
|
|
311
|
-
* Type-guard for codec-typed entries on the polymorphic
|
|
312
|
-
* `SqlStorage.types` slot. Distinguishes `StorageTypeInstance` from
|
|
313
|
-
* class-instance kinds (e.g. `PostgresEnumType`).
|
|
314
|
-
*/
|
|
315
|
-
declare function isStorageTypeInstance(value: unknown): value is StorageTypeInstance;
|
|
316
|
-
//#endregion
|
|
317
|
-
//#region src/ir/sql-storage.d.ts
|
|
318
|
-
/**
|
|
319
|
-
* Polymorphic value type for document-scoped `SqlStorage.types` entries
|
|
320
|
-
* (codec aliases / parameterised native type registrations). Postgres
|
|
321
|
-
* native enum registrations live under
|
|
322
|
-
* `storage.namespaces[namespaceId].enum` instead.
|
|
323
|
-
*/
|
|
324
|
-
type SqlStorageTypeEntry = StorageTypeInstance | StorageTypeInstanceInput | PostgresEnumStorageEntry;
|
|
325
|
-
interface SqlNamespaceTablesInput {
|
|
326
|
-
readonly id: string;
|
|
327
|
-
readonly tables?: Record<string, StorageTable | StorageTableInput>;
|
|
328
|
-
readonly enum?: Record<string, PostgresEnumStorageEntry>;
|
|
329
|
-
}
|
|
330
|
-
interface SqlStorageInput<THash extends string = string> {
|
|
331
|
-
readonly storageHash: StorageHashBase<THash>;
|
|
332
|
-
readonly types?: Record<string, SqlStorageTypeEntry>;
|
|
333
|
-
readonly namespaces: Readonly<Record<string, SqlNamespace>>;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* SQL Contract IR root node for the `storage` field.
|
|
337
|
-
*
|
|
338
|
-
* Single concrete family-shared class — both Postgres and SQLite
|
|
339
|
-
* consume this class today. Per-target storage subclasses are
|
|
340
|
-
* introduced when each target's namespace shape earns its
|
|
341
|
-
* target-specific concretion (target-specific derived fields,
|
|
342
|
-
* target-specific storage extensions).
|
|
343
|
-
*
|
|
344
|
-
* Honours the framework `Storage` interface: every SQL IR carries a
|
|
345
|
-
* `namespaces` map keyed by namespace id. Callers must supply fully
|
|
346
|
-
* constructed `Namespace` instances — construction discipline lives
|
|
347
|
-
* in the authoring builders and deserializer hydration paths.
|
|
348
|
-
*
|
|
349
|
-
* The constructor normalises optional `types` into class instances.
|
|
350
|
-
* `types` is polymorphic per Decision 18 Option B: codec-triple inputs
|
|
351
|
-
* are stamped with `kind: 'codec-instance'`; class-instance kinds
|
|
352
|
-
* (e.g. Postgres-enum entries satisfying `PostgresEnumStorageEntry`)
|
|
353
|
-
* pass through; hydration of raw JSON class-instance entries (carrying
|
|
354
|
-
* their narrower `kind` literal) is the per-target serializer's
|
|
355
|
-
* responsibility (so the family base does not import target-specific
|
|
356
|
-
* subclasses).
|
|
357
|
-
*/
|
|
358
|
-
type SqlNamespace = Namespace & {
|
|
359
|
-
readonly tables: Readonly<Record<string, StorageTable>>;
|
|
360
|
-
readonly enum?: Readonly<Record<string, PostgresEnumStorageEntry>>;
|
|
361
|
-
};
|
|
362
|
-
declare class SqlStorage<THash extends string = string> extends SqlNode implements Storage {
|
|
363
|
-
readonly storageHash: StorageHashBase<THash>;
|
|
364
|
-
readonly namespaces: Readonly<Record<string, SqlNamespace>>;
|
|
365
|
-
readonly types?: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>;
|
|
366
|
-
constructor(input: SqlStorageInput<THash>);
|
|
367
|
-
}
|
|
368
|
-
//#endregion
|
|
369
|
-
//#region src/ir/build-sql-namespace.d.ts
|
|
370
|
-
declare function buildSqlNamespace(input: SqlNamespaceTablesInput): SqlNamespace;
|
|
371
|
-
declare function buildSqlNamespaceMap(namespaces: Readonly<Record<string, Namespace | SqlNamespaceTablesInput>>): Readonly<Record<string, SqlNamespace>>;
|
|
372
|
-
//#endregion
|
|
373
|
-
//#region src/ir/sql-unbound-namespace.d.ts
|
|
374
|
-
/**
|
|
375
|
-
* Family-layer placeholder for the SQL unbound-namespace singleton —
|
|
376
|
-
* the late-bound slot whose binding the target resolves at connection
|
|
377
|
-
* time rather than at authoring time.
|
|
378
|
-
*
|
|
379
|
-
* SQL contracts honour the framework `Storage.namespaces` invariant from
|
|
380
|
-
* the moment they appear in the IR. Today `SqlStorage` is family-shared
|
|
381
|
-
* (Postgres + SQLite consume the same class); a per-target namespace
|
|
382
|
-
* concretion (`PostgresSchema.unbound`, `SqliteUnboundDatabase.instance`)
|
|
383
|
-
* earns its existence when each target's namespace shape lands. Until
|
|
384
|
-
* then the family ships a single placeholder singleton so the JSON
|
|
385
|
-
* envelope and runtime walk are honest at every layer.
|
|
386
|
-
*
|
|
387
|
-
* The `kind` discriminator is installed as a non-enumerable own property
|
|
388
|
-
* so the JSON envelope reads `{ "id": "__unbound__" }` — symmetric
|
|
389
|
-
* with the family-level non-enumerable `kind` on `SqlNode` and bounded
|
|
390
|
-
* to the minimum data the framework `Namespace` interface promises.
|
|
391
|
-
*
|
|
392
|
-
* **Freeze-trap warning.** The leaf constructor calls
|
|
393
|
-
* `freezeNode(this)` after installing `kind`. The leaf-class shape
|
|
394
|
-
* works today only because `NamespaceBase` does NOT freeze in its
|
|
395
|
-
* constructor — the `Object.defineProperty(this, 'kind', …)` call after
|
|
396
|
-
* `super()` succeeds because the instance is still mutable at that
|
|
397
|
-
* point. Subclasses that add instance fields will still hit the freeze
|
|
398
|
-
* trap once leaf-class `freezeNode(this)` runs; and if a future
|
|
399
|
-
* framework change lifts the freeze to `NamespaceBase`, even the
|
|
400
|
-
* `defineProperty` here would silently fail. To add subclass instance
|
|
401
|
-
* fields safely, lift `freezeNode` to a leaf-class `seal()` hook each
|
|
402
|
-
* leaf calls explicitly at the end of its own constructor.
|
|
403
|
-
*/
|
|
404
|
-
declare class SqlUnboundNamespace extends NamespaceBase {
|
|
405
|
-
static readonly instance: SqlUnboundNamespace;
|
|
406
|
-
readonly id: "__unbound__";
|
|
407
|
-
readonly tables: Readonly<Record<string, StorageTable>>;
|
|
408
|
-
readonly kind: string;
|
|
409
|
-
private constructor();
|
|
410
|
-
}
|
|
411
|
-
//#endregion
|
|
412
|
-
//#region src/types.d.ts
|
|
413
|
-
type ForeignKeyOptions = {
|
|
414
|
-
readonly name?: string;
|
|
415
|
-
readonly onDelete?: ReferentialAction;
|
|
416
|
-
readonly onUpdate?: ReferentialAction;
|
|
417
|
-
};
|
|
418
|
-
type SqlModelFieldStorage = {
|
|
419
|
-
readonly column: string;
|
|
420
|
-
readonly codecId?: string;
|
|
421
|
-
readonly nullable?: boolean;
|
|
422
|
-
};
|
|
423
|
-
type SqlModelStorage = {
|
|
424
|
-
readonly table: string;
|
|
425
|
-
readonly fields: Record<string, SqlModelFieldStorage>;
|
|
426
|
-
};
|
|
427
|
-
declare const DEFAULT_FK_CONSTRAINT = true;
|
|
428
|
-
declare const DEFAULT_FK_INDEX = true;
|
|
429
|
-
declare function applyFkDefaults(fk: {
|
|
430
|
-
constraint?: boolean | undefined;
|
|
431
|
-
index?: boolean | undefined;
|
|
432
|
-
}, overrideDefaults?: {
|
|
433
|
-
constraint?: boolean | undefined;
|
|
434
|
-
index?: boolean | undefined;
|
|
435
|
-
}): {
|
|
436
|
-
constraint: boolean;
|
|
437
|
-
index: boolean;
|
|
438
|
-
};
|
|
439
|
-
type TypeMaps<TCodecTypes extends Record<string, {
|
|
440
|
-
output: unknown;
|
|
441
|
-
}> = Record<string, never>, TQueryOperationTypes extends Record<string, unknown> = Record<string, never>, TFieldOutputTypes extends Record<string, Record<string, unknown>> = Record<string, never>, TFieldInputTypes extends Record<string, Record<string, unknown>> = Record<string, never>> = {
|
|
442
|
-
readonly codecTypes: TCodecTypes;
|
|
443
|
-
readonly queryOperationTypes: TQueryOperationTypes;
|
|
444
|
-
readonly fieldOutputTypes: TFieldOutputTypes;
|
|
445
|
-
readonly fieldInputTypes: TFieldInputTypes;
|
|
446
|
-
};
|
|
447
|
-
type CodecTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
|
|
448
|
-
readonly codecTypes: infer C;
|
|
449
|
-
} ? C extends Record<string, {
|
|
450
|
-
output: unknown;
|
|
451
|
-
}> ? C : Record<string, never> : Record<string, never>;
|
|
452
|
-
/**
|
|
453
|
-
* Dispatch hint identifying the first-argument target of an operation.
|
|
454
|
-
*
|
|
455
|
-
* Used by ORM column helpers to decide whether an operation is reachable on a
|
|
456
|
-
* field. Either names a concrete codec identity or a set of capability traits
|
|
457
|
-
* that the field's codec must carry.
|
|
458
|
-
*/
|
|
459
|
-
type QueryOperationSelfSpec = {
|
|
460
|
-
readonly codecId: string;
|
|
461
|
-
readonly traits?: never;
|
|
462
|
-
} | {
|
|
463
|
-
readonly traits: readonly CodecTrait[];
|
|
464
|
-
readonly codecId?: never;
|
|
465
|
-
};
|
|
466
|
-
/**
|
|
467
|
-
* Structural shape an operation's impl must return: any value carrying a
|
|
468
|
-
* codec-exact `returnType` descriptor. `Expression<T>` (from
|
|
469
|
-
* `@prisma-next/sql-relational-core/expression`, with `T extends ScopeField`)
|
|
470
|
-
* extends this. Trait-targeted returns are deliberately excluded — predicate
|
|
471
|
-
* detection and result decoding both depend on knowing the concrete return
|
|
472
|
-
* codec.
|
|
473
|
-
*/
|
|
474
|
-
type QueryOperationReturn = {
|
|
475
|
-
readonly returnType: {
|
|
476
|
-
readonly codecId: string;
|
|
477
|
-
readonly nullable: boolean;
|
|
478
|
-
};
|
|
479
|
-
};
|
|
480
|
-
type QueryOperationTypeEntry = {
|
|
481
|
-
readonly self?: QueryOperationSelfSpec;
|
|
482
|
-
readonly impl: (...args: never[]) => QueryOperationReturn;
|
|
483
|
-
};
|
|
484
|
-
type SqlQueryOperationTypes<_CT extends Record<string, {
|
|
485
|
-
readonly input: unknown;
|
|
486
|
-
readonly output: unknown;
|
|
487
|
-
}>, T extends Record<string, QueryOperationTypeEntry>> = T;
|
|
488
|
-
type QueryOperationTypesBase = Record<string, QueryOperationTypeEntry>;
|
|
489
|
-
type QueryOperationTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
|
|
490
|
-
readonly queryOperationTypes: infer Q;
|
|
491
|
-
} ? Q extends Record<string, unknown> ? Q : Record<string, never> : Record<string, never>;
|
|
492
|
-
type TypeMapsPhantomKey = '__@prisma-next/sql-contract/typeMaps@__';
|
|
493
|
-
type ContractWithTypeMaps<TContract, TTypeMaps> = TContract & { readonly [K in TypeMapsPhantomKey]?: TTypeMaps };
|
|
494
|
-
type ExtractTypeMapsFromContract<T> = TypeMapsPhantomKey extends keyof T ? NonNullable<T[TypeMapsPhantomKey & keyof T]> : never;
|
|
495
|
-
type FieldOutputTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
|
|
496
|
-
readonly fieldOutputTypes: infer F;
|
|
497
|
-
} ? F extends Record<string, Record<string, unknown>> ? F : Record<string, never> : Record<string, never>;
|
|
498
|
-
type FieldInputTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
|
|
499
|
-
readonly fieldInputTypes: infer F;
|
|
500
|
-
} ? F extends Record<string, Record<string, unknown>> ? F : Record<string, never> : Record<string, never>;
|
|
501
|
-
type ExtractCodecTypes<T> = CodecTypesOf<ExtractTypeMapsFromContract<T>>;
|
|
502
|
-
type ExtractQueryOperationTypes<T> = QueryOperationTypesOf<ExtractTypeMapsFromContract<T>>;
|
|
503
|
-
type ExtractFieldOutputTypes<T> = FieldOutputTypesOf<ExtractTypeMapsFromContract<T>>;
|
|
504
|
-
type ExtractFieldInputTypes<T> = FieldInputTypesOf<ExtractTypeMapsFromContract<T>>;
|
|
505
|
-
type ResolveCodecTypes<TContract, TTypeMaps> = [TTypeMaps] extends [never] ? ExtractCodecTypes<TContract> : CodecTypesOf<TTypeMaps>;
|
|
506
|
-
//#endregion
|
|
507
|
-
export { ForeignKeyReference as $, SqlStorageInput as A, UniqueConstraintInput as B, TypeMapsPhantomKey as C, buildSqlNamespaceMap as D, buildSqlNamespace as E, isStorageTypeInstance as F, PrimaryKey as G, StorageColumnInput as H, toStorageTypeInstance as I, PostgresEnumStorageEntry as J, PrimaryKeyInput as K, StorageTable as L, CODEC_INSTANCE_KIND as M, StorageTypeInstance as N, SqlNamespaceTablesInput as O, StorageTypeInstanceInput as P, ReferentialAction as Q, StorageTableInput as R, TypeMaps as S, SqlUnboundNamespace as T, Index as U, StorageColumn as V, IndexInput as W, ForeignKey as X, isPostgresEnumStorageEntry as Y, ForeignKeyInput as Z, QueryOperationTypesOf as _, ExtractCodecTypes as a, SqlModelStorage as b, ExtractQueryOperationTypes as c, FieldOutputTypesOf as d, ForeignKeyReferenceInput as et, ForeignKeyOptions as f, QueryOperationTypesBase as g, QueryOperationTypeEntry as h, DEFAULT_FK_INDEX as i, SqlStorageTypeEntry as j, SqlStorage as k, ExtractTypeMapsFromContract as l, QueryOperationSelfSpec as m, ContractWithTypeMaps as n, ExtractFieldInputTypes as o, QueryOperationReturn as p, POSTGRES_ENUM_KIND as q, DEFAULT_FK_CONSTRAINT as r, ExtractFieldOutputTypes as s, CodecTypesOf as t, SqlNode as tt, FieldInputTypesOf as u, ResolveCodecTypes as v, applyFkDefaults as w, SqlQueryOperationTypes as x, SqlModelFieldStorage as y, UniqueConstraint as z };
|
|
508
|
-
//# sourceMappingURL=types-ChlHcJCu.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-ChlHcJCu.d.mts","names":[],"sources":["../src/ir/sql-node.ts","../src/ir/foreign-key-reference.ts","../src/ir/foreign-key.ts","../src/ir/postgres-enum-storage-entry.ts","../src/ir/primary-key.ts","../src/ir/sql-index.ts","../src/ir/storage-column.ts","../src/ir/unique-constraint.ts","../src/ir/storage-table.ts","../src/ir/storage-type-instance.ts","../src/ir/sql-storage.ts","../src/ir/build-sql-namespace.ts","../src/ir/sql-unbound-namespace.ts","../src/types.ts"],"mappings":";;;;;;;;;AAkCA;;;;;;;;;;;;AC9BA;;;;;;;;AAGkB;AAUlB;;;;;;;uBDiBsB,OAAA,SAAgB,UAAU;EAAA,SACrC,IAAA;;;;;UC/BM,wBAAA;EAAA,SACN,WAAA;EAAA,SACA,SAAA;EAAA,SACA,OAAA;AAAA;;;;;;;;cAUE,mBAAA,SAA4B,OAAA;EAAA,SAC9B,WAAA,EAAa,WAAA;EAAA,SACb,SAAA;EAAA,SACA,OAAA;cAEG,KAAA,EAAO,wBAAA;AAAA;;;KClBT,iBAAA;AAAA,UAEK,eAAA;EAAA,SACN,MAAA,EAAQ,mBAAA,GAAsB,wBAAA;EAAA,SAC9B,MAAA,EAAQ,mBAAA,GAAsB,wBAAA;EAAA,SAC9B,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAA;EFuBgB;EAAA,SErB3B,UAAA;;WAEA,KAAA;AAAA;;;;ADXX;;;;;;;;AAGkB;cCuBL,UAAA,SAAmB,OAAA;EAAA,SACrB,MAAA,EAAQ,mBAAA;EAAA,SACR,MAAA,EAAQ,mBAAA;EAAA,SACR,UAAA;EAAA,SACA,KAAA;EAAA,SACQ,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAA;cAEhB,KAAA,EAAO,eAAA;AAAA;;;;;;;AFLrB;;;;;;;;;;;cGjBa,kBAAA;AFbb;;;;;;;;AAGkB;AAUlB;;;AAbA,UE2BiB,wBA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kBACF,MAAA;AAAA,KAEM,kBAAA;AAAA,KAEA,oBAAA,yBAA6C,SAAA,oBACxC,kBAAA,IAAsB,SAAA;AAAA,KAG3B,2BAAA,MAAiC,kBAAA,eAAiC,CAAA,GAC1E,WAAA,CAAY,CAAA,CAAE,kBAAA,SAA2B,CAAA;AAAA,KAGjC,kBAAA,OAAyB,CAAA,oBACjC,MAAA,kBACA,CAAA;EAAA,SAAqB,gBAAA;AAAA,IACnB,CAAA,SAAU,MAAA,SAAe,MAAA,qBACvB,CAAA,GACA,MAAA,kBACF,MAAA;AAAA,KAEM,iBAAA,OAAwB,CAAA,oBAChC,MAAA,kBACA,CAAA;EAAA,SAAqB,eAAA;AAAA,IACnB,CAAA,SAAU,MAAA,SAAe,MAAA,qBACvB,CAAA,GACA,MAAA,kBACF,MAAA;AAAA,KAEM,iBAAA,MAAuB,YAAA,CAAa,2BAAA,CAA4B,CAAA;AAAA,KAChE,0BAAA,MAAgC,qBAAA,CAAsB,2BAAA,CAA4B,CAAA;AAAA,KAClF,uBAAA,MAA6B,kBAAA,CAAmB,2BAAA,CAA4B,CAAA;AAAA,KAC5E,sBAAA,MAA4B,iBAAA,CAAkB,2BAAA,CAA4B,CAAA;AAAA,KAE1E,iBAAA,0BAA2C,SAAA,oBACnD,iBAAA,CAAkB,SAAA,IAClB,YAAA,CAAa,SAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-DPkj4y3_.mjs","names":[],"sources":["../src/ir/sql-unbound-namespace.ts","../src/ir/sql-node.ts","../src/ir/foreign-key-reference.ts","../src/ir/foreign-key.ts","../src/ir/primary-key.ts","../src/ir/sql-index.ts","../src/ir/storage-column.ts","../src/ir/unique-constraint.ts","../src/ir/storage-table.ts","../src/ir/build-sql-namespace.ts","../src/ir/postgres-enum-storage-entry.ts","../src/ir/storage-type-instance.ts","../src/ir/sql-storage.ts","../src/types.ts"],"sourcesContent":["import {\n freezeNode,\n NamespaceBase,\n UNBOUND_NAMESPACE_ID,\n} from '@prisma-next/framework-components/ir';\nimport type { StorageTable } from './storage-table';\n\n/**\n * Family-layer placeholder for the SQL unbound-namespace singleton —\n * the late-bound slot whose binding the target resolves at connection\n * time rather than at authoring time.\n *\n * SQL contracts honour the framework `Storage.namespaces` invariant from\n * the moment they appear in the IR. Today `SqlStorage` is family-shared\n * (Postgres + SQLite consume the same class); a per-target namespace\n * concretion (`PostgresSchema.unbound`, `SqliteUnboundDatabase.instance`)\n * earns its existence when each target's namespace shape lands. Until\n * then the family ships a single placeholder singleton so the JSON\n * envelope and runtime walk are honest at every layer.\n *\n * The `kind` discriminator is installed as a non-enumerable own property\n * so the JSON envelope reads `{ \"id\": \"__unbound__\" }` — symmetric\n * with the family-level non-enumerable `kind` on `SqlNode` and bounded\n * to the minimum data the framework `Namespace` interface promises.\n *\n * **Freeze-trap warning.** The leaf constructor calls\n * `freezeNode(this)` after installing `kind`. The leaf-class shape\n * works today only because `NamespaceBase` does NOT freeze in its\n * constructor — the `Object.defineProperty(this, 'kind', …)` call after\n * `super()` succeeds because the instance is still mutable at that\n * point. Subclasses that add instance fields will still hit the freeze\n * trap once leaf-class `freezeNode(this)` runs; and if a future\n * framework change lifts the freeze to `NamespaceBase`, even the\n * `defineProperty` here would silently fail. To add subclass instance\n * fields safely, lift `freezeNode` to a leaf-class `seal()` hook each\n * leaf calls explicitly at the end of its own constructor.\n */\nexport class SqlUnboundNamespace extends NamespaceBase {\n static readonly instance: SqlUnboundNamespace = new SqlUnboundNamespace();\n\n readonly id = UNBOUND_NAMESPACE_ID;\n readonly tables: Readonly<Record<string, StorageTable>> = Object.freeze({});\n declare readonly kind: string;\n\n private constructor() {\n super();\n Object.defineProperty(this, 'kind', {\n value: 'sql-namespace',\n writable: false,\n enumerable: false,\n configurable: true,\n });\n freezeNode(this);\n }\n}\n","import { IRNodeBase } from '@prisma-next/framework-components/ir';\n\n/**\n * SQL family IR node base. Carries the family-level `kind` discriminator\n * `'sql'` and inherits the framework's `freezeNode` affordance.\n *\n * Single family-level discriminator (not per-leaf) reflects the fact that\n * SQL IR has no polymorphic dispatch today — verifiers and serializers\n * walk by structural position (`storage.tables[name].columns[name]`),\n * not by inspecting `kind`. The abstract bar for per-leaf discriminators\n * isn't earned until a future polymorphic consumer arrives.\n *\n * `kind` is installed as a non-enumerable own property on every instance,\n * which keeps three things clean simultaneously:\n *\n * - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope\n * shape (no `kind` field), so emitted contract.json files and the\n * `validateSqlContractFully` arktype schemas stay unchanged.\n * - Test assertions that use `toEqual({...})` against the pre-lift flat\n * shape continue to pass — only enumerable own properties are\n * compared.\n * - Direct access (`node.kind`) and runtime narrowing\n * (`if (node.kind === 'sql')`) still work, so future polymorphic\n * dispatch can begin reading `kind` without a runtime change.\n *\n * Future per-leaf overrides land cleanly: a class that gains a\n * polymorphic-dispatch consumer (e.g. an enum type instance walked\n * alongside other types) overrides `kind` with its narrower literal\n * at that leaf level. Per-leaf overrides will use enumerable kind\n * (matching the Mongo per-class-discriminator precedent) because they\n * encode dispatch-relevant information that callers need to see in\n * JSON envelopes; the family-level `'sql'` is uniform across all SQL\n * IR and carries no dispatch-relevant information.\n */\nexport abstract class SqlNode extends IRNodeBase {\n readonly kind?: string;\n\n constructor() {\n super();\n Object.defineProperty(this, 'kind', {\n value: 'sql',\n writable: false,\n enumerable: false,\n // configurable so per-leaf subclasses (e.g. PostgresEnumType in\n // target-postgres) can override `kind` with their narrower\n // enumerable literal via a class-field initializer. SqlNode\n // itself never needs to mutate the property again, so\n // configurability has no surface impact at this layer.\n configurable: true,\n });\n }\n}\n","import { asNamespaceId, type NamespaceId } from '@prisma-next/contract/types';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from './sql-node';\n\nexport interface ForeignKeyReferenceInput {\n readonly namespaceId: string;\n readonly tableName: string;\n readonly columns: readonly string[];\n}\n\n/**\n * SQL Contract IR node for one side (source or target) of a foreign-key\n * declaration. Carries the full coordinate: namespace, table, and columns.\n *\n * Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`\n * as the sentinel `namespaceId` for single-namespace (unbound) references.\n */\nexport class ForeignKeyReference extends SqlNode {\n readonly namespaceId: NamespaceId;\n readonly tableName: string;\n readonly columns: readonly string[];\n\n constructor(input: ForeignKeyReferenceInput) {\n super();\n this.namespaceId = asNamespaceId(input.namespaceId);\n this.tableName = input.tableName;\n this.columns = input.columns;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { ForeignKeyReference, type ForeignKeyReferenceInput } from './foreign-key-reference';\nimport { SqlNode } from './sql-node';\n\nexport type ReferentialAction = 'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault';\n\nexport interface ForeignKeyInput {\n readonly source: ForeignKeyReference | ForeignKeyReferenceInput;\n readonly target: ForeignKeyReference | ForeignKeyReferenceInput;\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n /** Whether to emit FK constraint DDL (ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY). */\n readonly constraint: boolean;\n /** Whether to emit a backing index for the FK columns. */\n readonly index: boolean;\n}\n\n/**\n * SQL Contract IR node for a table-level foreign-key declaration.\n *\n * Each FK carries explicit `source` and `target` {@link ForeignKeyReference}\n * coordinates (namespace, table, columns). For single-namespace contracts the\n * sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.\n *\n * The nested references are normalised to {@link ForeignKeyReference}\n * instances inside the constructor so downstream walks see a uniform AST\n * regardless of whether the input was a JSON literal or an already-constructed\n * class instance.\n */\nexport class ForeignKey extends SqlNode {\n readonly source: ForeignKeyReference;\n readonly target: ForeignKeyReference;\n readonly constraint: boolean;\n readonly index: boolean;\n declare readonly name?: string;\n declare readonly onDelete?: ReferentialAction;\n declare readonly onUpdate?: ReferentialAction;\n\n constructor(input: ForeignKeyInput) {\n super();\n this.source =\n input.source instanceof ForeignKeyReference\n ? input.source\n : new ForeignKeyReference(input.source);\n this.target =\n input.target instanceof ForeignKeyReference\n ? input.target\n : new ForeignKeyReference(input.target);\n this.constraint = input.constraint;\n this.index = input.index;\n if (input.name !== undefined) this.name = input.name;\n if (input.onDelete !== undefined) this.onDelete = input.onDelete;\n if (input.onUpdate !== undefined) this.onUpdate = input.onUpdate;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from './sql-node';\n\nexport interface PrimaryKeyInput {\n readonly columns: readonly string[];\n readonly name?: string;\n}\n\n/**\n * SQL Contract IR node for a table's primary-key constraint.\n */\nexport class PrimaryKey extends SqlNode {\n readonly columns: readonly string[];\n declare readonly name?: string;\n\n constructor(input: PrimaryKeyInput) {\n super();\n this.columns = input.columns;\n if (input.name !== undefined) this.name = input.name;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from './sql-node';\n\nexport interface IndexInput {\n readonly columns: readonly string[];\n readonly name?: string;\n readonly type?: string;\n readonly options?: Record<string, unknown>;\n}\n\n/**\n * SQL Contract IR node for a table-level secondary index.\n *\n * Note that this class shadows the global TypeScript `Index` lib type\n * at the family-shared name; consumer files that need both should\n * alias one (e.g.\n * `import { Index as SqlIndexNode } from '@prisma-next/sql-contract/types'`).\n */\nexport class Index extends SqlNode {\n readonly columns: readonly string[];\n declare readonly name?: string;\n declare readonly type?: string;\n declare readonly options?: Record<string, unknown>;\n\n constructor(input: IndexInput) {\n super();\n this.columns = input.columns;\n if (input.name !== undefined) this.name = input.name;\n if (input.type !== undefined) this.type = input.type;\n if (input.options !== undefined) this.options = input.options;\n freezeNode(this);\n }\n}\n","import type { ColumnDefault } from '@prisma-next/contract/types';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from './sql-node';\n\n/**\n * Hydration / construction input shape for {@link StorageColumn}. Mirrors\n * the on-disk storage JSON envelope exactly so the family-base\n * serializer's hydration walker can hand an arktype-validated literal\n * straight to `new`.\n *\n * `typeParams` and `typeRef` remain mutually exclusive (one or the\n * other, not both); the constructor preserves whichever caller-side\n * choice the input encodes.\n */\nexport interface StorageColumnInput {\n readonly nativeType: string;\n readonly codecId: string;\n readonly nullable: boolean;\n readonly typeParams?: Record<string, unknown>;\n readonly typeRef?: string;\n readonly default?: ColumnDefault;\n}\n\n/**\n * SQL Contract IR node for a single column entry in `StorageTable.columns`.\n *\n * Single concrete family-shared class — every SQL target reads the\n * same column shape today, so there is no per-target subclass. The\n * class type accepts any caller that constructs via\n * `new StorageColumn(input)`; literal construction sites must pass\n * through the constructor or the family-base hydration walker.\n *\n * The column's `name` is not on the class — columns are keyed by name\n * in the parent `StorageTable.columns: Record<string, StorageColumn>`\n * map, so a `name` field would be redundant with the key.\n */\nexport class StorageColumn extends SqlNode {\n readonly nativeType: string;\n readonly codecId: string;\n readonly nullable: boolean;\n declare readonly typeParams?: Record<string, unknown>;\n declare readonly typeRef?: string;\n declare readonly default?: ColumnDefault;\n\n constructor(input: StorageColumnInput) {\n super();\n this.nativeType = input.nativeType;\n this.codecId = input.codecId;\n this.nullable = input.nullable;\n if (input.typeParams !== undefined) this.typeParams = input.typeParams;\n if (input.typeRef !== undefined) this.typeRef = input.typeRef;\n if (input.default !== undefined) this.default = input.default;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from './sql-node';\n\nexport interface UniqueConstraintInput {\n readonly columns: readonly string[];\n readonly name?: string;\n}\n\n/**\n * SQL Contract IR node for a table-level unique constraint.\n */\nexport class UniqueConstraint extends SqlNode {\n readonly columns: readonly string[];\n declare readonly name?: string;\n\n constructor(input: UniqueConstraintInput) {\n super();\n this.columns = input.columns;\n if (input.name !== undefined) this.name = input.name;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { ForeignKey, type ForeignKeyInput } from './foreign-key';\nimport { PrimaryKey, type PrimaryKeyInput } from './primary-key';\nimport { Index, type IndexInput } from './sql-index';\nimport { SqlNode } from './sql-node';\nimport { StorageColumn, type StorageColumnInput } from './storage-column';\nimport { UniqueConstraint, type UniqueConstraintInput } from './unique-constraint';\n\nexport interface StorageTableInput {\n readonly columns: Record<string, StorageColumn | StorageColumnInput>;\n readonly primaryKey?: PrimaryKey | PrimaryKeyInput;\n readonly uniques: ReadonlyArray<UniqueConstraint | UniqueConstraintInput>;\n readonly indexes: ReadonlyArray<Index | IndexInput>;\n readonly foreignKeys: ReadonlyArray<ForeignKey | ForeignKeyInput>;\n}\n\n/**\n * SQL Contract IR node for a single table entry in a namespace's\n * `tables` map.\n *\n * The constructor normalises nested IR-class fields (columns, primary\n * key, uniques, indexes, foreign keys) into the appropriate class\n * instances so downstream walks see a uniform AST regardless of whether\n * the input was a JSON literal or an already-constructed class.\n *\n * The table's `name` is not on the class — tables are keyed by name in\n * the parent namespace's `tables: Record<string, StorageTable>` map.\n */\nexport class StorageTable extends SqlNode {\n readonly columns: Readonly<Record<string, StorageColumn>>;\n readonly uniques: ReadonlyArray<UniqueConstraint>;\n readonly indexes: ReadonlyArray<Index>;\n readonly foreignKeys: ReadonlyArray<ForeignKey>;\n declare readonly primaryKey?: PrimaryKey;\n\n constructor(input: StorageTableInput) {\n super();\n this.columns = Object.freeze(\n Object.fromEntries(\n Object.entries(input.columns).map(([name, col]) => [\n name,\n col instanceof StorageColumn ? col : new StorageColumn(col),\n ]),\n ),\n );\n if (input.primaryKey !== undefined) {\n this.primaryKey =\n input.primaryKey instanceof PrimaryKey\n ? input.primaryKey\n : new PrimaryKey(input.primaryKey);\n }\n this.uniques = Object.freeze(\n input.uniques.map((u) => (u instanceof UniqueConstraint ? u : new UniqueConstraint(u))),\n );\n this.indexes = Object.freeze(input.indexes.map((i) => (i instanceof Index ? i : new Index(i))));\n this.foreignKeys = Object.freeze(\n input.foreignKeys.map((fk) => (fk instanceof ForeignKey ? fk : new ForeignKey(fk))),\n );\n freezeNode(this);\n }\n}\n","import {\n freezeNode,\n type Namespace,\n NamespaceBase,\n UNBOUND_NAMESPACE_ID,\n} from '@prisma-next/framework-components/ir';\nimport { blindCast, castAs } from '@prisma-next/utils/casts';\nimport type { PostgresEnumStorageEntry } from './postgres-enum-storage-entry';\nimport type { SqlNamespace, SqlNamespaceTablesInput } from './sql-storage';\nimport { SqlUnboundNamespace } from './sql-unbound-namespace';\nimport { StorageTable } from './storage-table';\n\nconst SQL_NAMESPACE_KIND = 'sql-namespace' as const;\n\nfunction isMaterializedSqlNamespace(ns: Namespace | SqlNamespaceTablesInput): ns is SqlNamespace {\n if (typeof ns !== 'object' || ns === null) {\n return false;\n }\n const proto = Object.getPrototypeOf(ns);\n if (proto === Object.prototype || proto === null) {\n return false;\n }\n return (ns as Namespace).kind === SQL_NAMESPACE_KIND;\n}\n\nclass SqlBoundNamespace extends NamespaceBase {\n declare readonly kind: string;\n declare readonly enum?: Readonly<Record<string, PostgresEnumStorageEntry>>;\n\n readonly id: string;\n readonly tables: Readonly<Record<string, StorageTable>>;\n\n static fromTablesInput(input: SqlNamespaceTablesInput): SqlNamespace {\n const tableCount = Object.keys(input.tables ?? {}).length;\n const enumCount = Object.keys(input.enum ?? {}).length;\n if (input.id === UNBOUND_NAMESPACE_ID && tableCount === 0 && enumCount === 0) {\n return castAs<SqlNamespace>(SqlUnboundNamespace.instance);\n }\n return castAs<SqlNamespace>(new SqlBoundNamespace(input));\n }\n\n private constructor(input: SqlNamespaceTablesInput) {\n super();\n this.id = input.id;\n this.tables = Object.freeze(\n Object.fromEntries(\n Object.entries(input.tables ?? {}).map(([name, t]) => [\n name,\n t instanceof StorageTable ? t : new StorageTable(t),\n ]),\n ),\n );\n if (input.enum !== undefined && Object.keys(input.enum).length > 0) {\n Object.defineProperty(this, 'enum', {\n value: Object.freeze({ ...input.enum }),\n writable: false,\n enumerable: true,\n configurable: false,\n });\n }\n Object.defineProperty(this, 'kind', {\n value: SQL_NAMESPACE_KIND,\n writable: false,\n enumerable: false,\n configurable: true,\n });\n freezeNode(this);\n }\n}\n\nexport function buildSqlNamespace(input: SqlNamespaceTablesInput): SqlNamespace {\n return SqlBoundNamespace.fromTablesInput(input);\n}\n\nexport function buildSqlNamespaceMap(\n namespaces: Readonly<Record<string, Namespace | SqlNamespaceTablesInput>>,\n): Readonly<Record<string, SqlNamespace>> {\n return Object.fromEntries(\n Object.entries(namespaces).map(([nsKey, ns]) => [\n nsKey,\n isMaterializedSqlNamespace(ns)\n ? blindCast<\n SqlNamespace,\n 'a materialised SQL-family namespace entry in a namespace map is a SqlNamespace'\n >(ns)\n : SqlBoundNamespace.fromTablesInput(ns),\n ]),\n );\n}\n","import type { StorageType } from '@prisma-next/framework-components/ir';\n\n/**\n * Discriminator literal for the Postgres-enum variant on the polymorphic\n * `SqlStorage.types` slot.\n *\n * Enums are a target-level concept: Postgres ships native\n * `CREATE TYPE … AS ENUM` while other SQL targets approximate enums via\n * constraints. The literal lives at the SQL family layer because every\n * SQL-family consumer (verifier, planner, lowering, …) needs to\n * discriminate enum-typed slot entries from codec-typed ones. The\n * concrete IR class (`PostgresEnumType`) lives in the target-postgres\n * package and implements this structural contract; cross-domain\n * layering rules forbid the SQL family from importing the concrete\n * target class directly, so the discriminator and structural interface\n * carry the dispatch.\n */\nexport const POSTGRES_ENUM_KIND = 'postgres-enum' as const;\n\n/**\n * Structural contract every Postgres-enum slot entry honours — both\n * the live `PostgresEnumType` IR-class instance and the raw JSON\n * envelope shape that survives `JSON.stringify` round-trips. SQL\n * family-layer dispatch narrows polymorphic `StorageType` slot\n * entries to this shape via `isPostgresEnumStorageEntry`.\n *\n * The `codecBinding` field is accessor-shaped (live class instance) on\n * the IR class and undefined on the raw JSON envelope; consumers that\n * need it must guard for its presence (the JSON path synthesises an\n * equivalent shape from `codecId` + `values`).\n */\nexport interface PostgresEnumStorageEntry extends StorageType {\n readonly kind: typeof POSTGRES_ENUM_KIND;\n readonly name: string;\n readonly nativeType: string;\n readonly values: readonly string[];\n /**\n * Enumerable own property on the persisted JSON envelope; the live\n * IR-class instance carries it too. Family-shared dispatch sites\n * read `codecId` directly rather than going through the IR-class\n * `codecBinding` accessor (which lives on the prototype and isn't\n * present on raw JSON envelopes).\n */\n readonly codecId: string;\n}\n\n/**\n * Narrow a polymorphic `StorageType` entry to the Postgres-enum shape\n * via its enumerable `kind` discriminator. Type guard returns true for\n * both live `PostgresEnumType` instances and raw JSON envelopes.\n */\nexport function isPostgresEnumStorageEntry(value: unknown): value is PostgresEnumStorageEntry {\n if (typeof value !== 'object' || value === null) return false;\n return (value as { kind?: unknown }).kind === POSTGRES_ENUM_KIND;\n}\n","import type { StorageType } from '@prisma-next/framework-components/ir';\n\n/**\n * Sentinel kind for the legacy codec-triple shape persisted under\n * `SqlStorage.types`. Plain JSON-clean object literals carry this\n * discriminator so the polymorphic slot dispatch can route them down\n * the codec path while target-specific IR class instances (e.g. the\n * Postgres enum class) keep their own narrower `kind` literal.\n */\nexport const CODEC_INSTANCE_KIND = 'codec-instance' as const;\n\n/**\n * Structural sub-interface of {@link StorageType} for codec-typed entries\n * in `SqlStorage.types`. These are plain object literals — there is no\n * runtime IR class, the JSON envelope round-trips through the slot\n * unchanged. The `kind: 'codec-instance'` discriminator is the dispatch\n * key that distinguishes codec-typed entries from class-instance entries\n * (e.g. `PostgresEnumType`) sharing the polymorphic slot.\n */\nexport interface StorageTypeInstance extends StorageType {\n readonly kind: typeof CODEC_INSTANCE_KIND;\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams: Record<string, unknown>;\n}\n\n/**\n * Construction-time input for a codec-triple entry. Symmetric with the\n * structural runtime shape minus the `kind` discriminator — callers may\n * omit `kind`; the helper {@link toStorageTypeInstance} stamps it on.\n */\nexport interface StorageTypeInstanceInput {\n readonly codecId: string;\n readonly nativeType: string;\n readonly typeParams: Record<string, unknown>;\n}\n\n/**\n * Stamp the codec-instance `kind` discriminator on a caller-supplied\n * codec triple. Idempotent: input that already carries the discriminator\n * passes through unchanged.\n */\nexport function toStorageTypeInstance(input: StorageTypeInstanceInput): StorageTypeInstance {\n return {\n kind: CODEC_INSTANCE_KIND,\n codecId: input.codecId,\n nativeType: input.nativeType,\n typeParams: input.typeParams,\n };\n}\n\n/**\n * Type-guard for codec-typed entries on the polymorphic\n * `SqlStorage.types` slot. Distinguishes `StorageTypeInstance` from\n * class-instance kinds (e.g. `PostgresEnumType`).\n */\nexport function isStorageTypeInstance(value: unknown): value is StorageTypeInstance {\n if (typeof value !== 'object' || value === null) return false;\n return (value as { kind?: unknown }).kind === CODEC_INSTANCE_KIND;\n}\n","import type { StorageHashBase } from '@prisma-next/contract/types';\nimport { freezeNode, type Namespace, type Storage } from '@prisma-next/framework-components/ir';\nimport {\n isPostgresEnumStorageEntry,\n type PostgresEnumStorageEntry,\n} from './postgres-enum-storage-entry';\nimport { SqlNode } from './sql-node';\nimport type { StorageTable, StorageTableInput } from './storage-table';\nimport {\n isStorageTypeInstance,\n type StorageTypeInstance,\n type StorageTypeInstanceInput,\n} from './storage-type-instance';\n\n/**\n * Polymorphic value type for document-scoped `SqlStorage.types` entries\n * (codec aliases / parameterised native type registrations). Postgres\n * native enum registrations live under\n * `storage.namespaces[namespaceId].enum` instead.\n */\nexport type SqlStorageTypeEntry =\n | StorageTypeInstance\n | StorageTypeInstanceInput\n | PostgresEnumStorageEntry;\n\nexport interface SqlNamespaceTablesInput {\n readonly id: string;\n readonly tables?: Record<string, StorageTable | StorageTableInput>;\n readonly enum?: Record<string, PostgresEnumStorageEntry>;\n}\n\nexport interface SqlStorageInput<THash extends string = string> {\n readonly storageHash: StorageHashBase<THash>;\n readonly types?: Record<string, SqlStorageTypeEntry>;\n readonly namespaces: Readonly<Record<string, SqlNamespace>>;\n}\n\n/**\n * SQL Contract IR root node for the `storage` field.\n *\n * Single concrete family-shared class — both Postgres and SQLite\n * consume this class today. Per-target storage subclasses are\n * introduced when each target's namespace shape earns its\n * target-specific concretion (target-specific derived fields,\n * target-specific storage extensions).\n *\n * Honours the framework `Storage` interface: every SQL IR carries a\n * `namespaces` map keyed by namespace id. Callers must supply fully\n * constructed `Namespace` instances — construction discipline lives\n * in the authoring builders and deserializer hydration paths.\n *\n * The constructor normalises optional `types` into class instances.\n * `types` is polymorphic per Decision 18 Option B: codec-triple inputs\n * are stamped with `kind: 'codec-instance'`; class-instance kinds\n * (e.g. Postgres-enum entries satisfying `PostgresEnumStorageEntry`)\n * pass through; hydration of raw JSON class-instance entries (carrying\n * their narrower `kind` literal) is the per-target serializer's\n * responsibility (so the family base does not import target-specific\n * subclasses).\n */\n// SQL concretions always store `StorageTable`-shaped values in `tables`.\n// `tables` is a SQL-family idiom — the framework `Namespace` contract no\n// longer mandates this field; Mongo namespaces carry `collections`\n// instead. The `tables` slot uses the same narrowing as every other\n// SQL namespace; the wider `Record<string, object>` on `StorageTable` is\n// only there so emitted `contract.d.ts` table literals (which lack the\n// runtime `kind` discriminator on `StorageTable`) structurally satisfy\n// the slot without a class-instance check.\nexport type SqlNamespace = Namespace & {\n readonly tables: Readonly<Record<string, StorageTable>>;\n readonly enum?: Readonly<Record<string, PostgresEnumStorageEntry>>;\n};\n\nexport class SqlStorage<THash extends string = string> extends SqlNode implements Storage {\n readonly storageHash: StorageHashBase<THash>;\n readonly namespaces: Readonly<Record<string, SqlNamespace>>;\n declare readonly types?: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>;\n\n constructor(input: SqlStorageInput<THash>) {\n super();\n this.storageHash = input.storageHash;\n this.namespaces = Object.freeze(input.namespaces);\n if (input.types !== undefined) {\n this.types = Object.freeze(\n Object.fromEntries(\n Object.entries(input.types).map(([name, ti]) => [name, normaliseTypeEntry(name, ti)]),\n ),\n );\n }\n freezeNode(this);\n }\n}\n\n/**\n * Strict polymorphic-slot dispatch for `SqlStorage.types` entries.\n * Every entry must carry a recognised `kind` discriminator — either\n * `'codec-instance'` (codec triple, family-shared) or\n * `'postgres-enum'` (target-specific IR class). Untagged or\n * unrecognised inputs throw a diagnostic naming the entry and its\n * `kind`, so format drift surfaces loudly at the deserializer\n * boundary instead of slipping past the seam and corrupting\n * downstream IR walks.\n *\n * Codec-triple authors that have an untagged shape on hand can call\n * `toStorageTypeInstance(...)` (which stamps the `'codec-instance'`\n * discriminator) before constructing `SqlStorage`. On-disk reads\n * cross `familyInstance.deserializeContract` first; the structural\n * arktype schema rejects untagged entries earlier, so this throw\n * only fires for in-memory authoring bugs.\n */\nfunction normaliseTypeEntry(\n name: string,\n entry: SqlStorageTypeEntry,\n): StorageTypeInstance | PostgresEnumStorageEntry {\n if (isPostgresEnumStorageEntry(entry)) {\n // Live class instances pass through unchanged; raw JSON envelopes\n // (e.g. `kind: 'postgres-enum'` without the class identity) are\n // rejected so the target serializer's hydration path is the only\n // way IR class instances enter the slot.\n if (entry instanceof SqlNode) {\n return entry;\n }\n throw new Error(\n `Encountered raw postgres-enum JSON in storage.types[${JSON.stringify(name)}] without serializer hydration; use a target ContractSerializer that registers the matching entity-type factory.`,\n );\n }\n if (isStorageTypeInstance(entry)) {\n return entry;\n }\n const rawKind = (entry as { kind?: unknown }).kind;\n const kindDescription =\n rawKind === undefined\n ? 'missing `kind` discriminator'\n : `unrecognised \\`kind\\` discriminator ${JSON.stringify(rawKind)}`;\n throw new Error(\n `storage.types[${JSON.stringify(name)}] has ${kindDescription}; expected ${JSON.stringify('codec-instance')} or ${JSON.stringify('postgres-enum')}. Untagged codec triples should be wrapped with toStorageTypeInstance(...) before construction.`,\n );\n}\n","import type { CodecTrait } from '@prisma-next/framework-components/codec';\nimport type { ReferentialAction } from './ir/foreign-key';\n\nexport { buildSqlNamespace, buildSqlNamespaceMap } from './ir/build-sql-namespace';\nexport {\n ForeignKey,\n type ForeignKeyInput,\n type ReferentialAction,\n} from './ir/foreign-key';\nexport {\n ForeignKeyReference,\n type ForeignKeyReferenceInput,\n} from './ir/foreign-key-reference';\nexport {\n isPostgresEnumStorageEntry,\n POSTGRES_ENUM_KIND,\n type PostgresEnumStorageEntry,\n} from './ir/postgres-enum-storage-entry';\nexport { PrimaryKey, type PrimaryKeyInput } from './ir/primary-key';\nexport { Index, type IndexInput } from './ir/sql-index';\nexport { SqlNode } from './ir/sql-node';\nexport {\n type SqlNamespaceTablesInput,\n SqlStorage,\n type SqlStorageInput,\n type SqlStorageTypeEntry,\n} from './ir/sql-storage';\nexport { SqlUnboundNamespace } from './ir/sql-unbound-namespace';\nexport { StorageColumn, type StorageColumnInput } from './ir/storage-column';\nexport { StorageTable, type StorageTableInput } from './ir/storage-table';\nexport {\n CODEC_INSTANCE_KIND,\n isStorageTypeInstance,\n type StorageTypeInstance,\n type StorageTypeInstanceInput,\n toStorageTypeInstance,\n} from './ir/storage-type-instance';\nexport {\n UniqueConstraint,\n type UniqueConstraintInput,\n} from './ir/unique-constraint';\n\nexport type ForeignKeyOptions = {\n readonly name?: string;\n readonly onDelete?: ReferentialAction;\n readonly onUpdate?: ReferentialAction;\n};\n\nexport type SqlModelFieldStorage = {\n readonly column: string;\n readonly codecId?: string;\n readonly nullable?: boolean;\n};\n\nexport type SqlModelStorage = {\n readonly table: string;\n readonly fields: Record<string, SqlModelFieldStorage>;\n};\n\nexport const DEFAULT_FK_CONSTRAINT = true;\nexport const DEFAULT_FK_INDEX = true;\n\nexport function applyFkDefaults(\n fk: { constraint?: boolean | undefined; index?: boolean | undefined },\n overrideDefaults?: { constraint?: boolean | undefined; index?: boolean | undefined },\n): { constraint: boolean; index: boolean } {\n return {\n constraint: fk.constraint ?? overrideDefaults?.constraint ?? DEFAULT_FK_CONSTRAINT,\n index: fk.index ?? overrideDefaults?.index ?? DEFAULT_FK_INDEX,\n };\n}\n\nexport type TypeMaps<\n TCodecTypes extends Record<string, { output: unknown }> = Record<string, never>,\n TQueryOperationTypes extends Record<string, unknown> = Record<string, never>,\n TFieldOutputTypes extends Record<string, Record<string, unknown>> = Record<string, never>,\n TFieldInputTypes extends Record<string, Record<string, unknown>> = Record<string, never>,\n> = {\n readonly codecTypes: TCodecTypes;\n readonly queryOperationTypes: TQueryOperationTypes;\n readonly fieldOutputTypes: TFieldOutputTypes;\n readonly fieldInputTypes: TFieldInputTypes;\n};\n\nexport type CodecTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly codecTypes: infer C }\n ? C extends Record<string, { output: unknown }>\n ? C\n : Record<string, never>\n : Record<string, never>;\n\n/**\n * Dispatch hint identifying the first-argument target of an operation.\n *\n * Used by ORM column helpers to decide whether an operation is reachable on a\n * field. Either names a concrete codec identity or a set of capability traits\n * that the field's codec must carry.\n */\nexport type QueryOperationSelfSpec =\n | { readonly codecId: string; readonly traits?: never }\n | { readonly traits: readonly CodecTrait[]; readonly codecId?: never };\n\n/**\n * Structural shape an operation's impl must return: any value carrying a\n * codec-exact `returnType` descriptor. `Expression<T>` (from\n * `@prisma-next/sql-relational-core/expression`, with `T extends ScopeField`)\n * extends this. Trait-targeted returns are deliberately excluded — predicate\n * detection and result decoding both depend on knowing the concrete return\n * codec.\n */\nexport type QueryOperationReturn = {\n readonly returnType: { readonly codecId: string; readonly nullable: boolean };\n};\n\nexport type QueryOperationTypeEntry = {\n readonly self?: QueryOperationSelfSpec;\n readonly impl: (...args: never[]) => QueryOperationReturn;\n};\n\nexport type SqlQueryOperationTypes<\n _CT extends Record<string, { readonly input: unknown; readonly output: unknown }>,\n T extends Record<string, QueryOperationTypeEntry>,\n> = T;\n\nexport type QueryOperationTypesBase = Record<string, QueryOperationTypeEntry>;\n\nexport type QueryOperationTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly queryOperationTypes: infer Q }\n ? Q extends Record<string, unknown>\n ? Q\n : Record<string, never>\n : Record<string, never>;\n\nexport type TypeMapsPhantomKey = '__@prisma-next/sql-contract/typeMaps@__';\n\nexport type ContractWithTypeMaps<TContract, TTypeMaps> = TContract & {\n readonly [K in TypeMapsPhantomKey]?: TTypeMaps;\n};\n\nexport type ExtractTypeMapsFromContract<T> = TypeMapsPhantomKey extends keyof T\n ? NonNullable<T[TypeMapsPhantomKey & keyof T]>\n : never;\n\nexport type FieldOutputTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly fieldOutputTypes: infer F }\n ? F extends Record<string, Record<string, unknown>>\n ? F\n : Record<string, never>\n : Record<string, never>;\n\nexport type FieldInputTypesOf<T> = [T] extends [never]\n ? Record<string, never>\n : T extends { readonly fieldInputTypes: infer F }\n ? F extends Record<string, Record<string, unknown>>\n ? F\n : Record<string, never>\n : Record<string, never>;\n\nexport type ExtractCodecTypes<T> = CodecTypesOf<ExtractTypeMapsFromContract<T>>;\nexport type ExtractQueryOperationTypes<T> = QueryOperationTypesOf<ExtractTypeMapsFromContract<T>>;\nexport type ExtractFieldOutputTypes<T> = FieldOutputTypesOf<ExtractTypeMapsFromContract<T>>;\nexport type ExtractFieldInputTypes<T> = FieldInputTypesOf<ExtractTypeMapsFromContract<T>>;\n\nexport type ResolveCodecTypes<TContract, TTypeMaps> = [TTypeMaps] extends [never]\n ? ExtractCodecTypes<TContract>\n : CodecTypesOf<TTypeMaps>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,sBAAb,MAAa,4BAA4B,cAAc;CACrD,OAAgB,WAAgC,IAAI,oBAAoB;CAExE,KAAc;CACd,SAA0D,OAAO,OAAO,CAAC,CAAC;CAG1E,cAAsB;EACpB,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GAClC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EAChB,CAAC;EACD,WAAW,IAAI;CACjB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpBA,IAAsB,UAAtB,cAAsC,WAAW;CAC/C;CAEA,cAAc;EACZ,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GAClC,OAAO;GACP,UAAU;GACV,YAAY;GAMZ,cAAc;EAChB,CAAC;CACH;AACF;;;;;;;;;;AClCA,IAAa,sBAAb,cAAyC,QAAQ;CAC/C;CACA;CACA;CAEA,YAAY,OAAiC;EAC3C,MAAM;EACN,KAAK,cAAc,cAAc,MAAM,WAAW;EAClD,K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