@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.
Files changed (60) hide show
  1. package/dist/canonicalization-hooks.d.mts.map +1 -1
  2. package/dist/canonicalization-hooks.mjs +10 -11
  3. package/dist/canonicalization-hooks.mjs.map +1 -1
  4. package/dist/factories.d.mts +4 -2
  5. package/dist/factories.d.mts.map +1 -1
  6. package/dist/factories.mjs +3 -2
  7. package/dist/factories.mjs.map +1 -1
  8. package/dist/foreign-key-BATxB95l.d.mts +121 -0
  9. package/dist/foreign-key-BATxB95l.d.mts.map +1 -0
  10. package/dist/index-type-validation.d.mts +2 -2
  11. package/dist/index-type-validation.mjs +1 -1
  12. package/dist/index-type-validation.mjs.map +1 -1
  13. package/dist/{index-types-B1cf5N0F.d.mts → index-types-Czsyu7Iw.d.mts} +1 -1
  14. package/dist/{index-types-B1cf5N0F.d.mts.map → index-types-Czsyu7Iw.d.mts.map} +1 -1
  15. package/dist/index-types.d.mts +1 -1
  16. package/dist/pack-types.d.mts +1 -1
  17. package/dist/referential-action-sql.d.mts +12 -0
  18. package/dist/referential-action-sql.d.mts.map +1 -0
  19. package/dist/referential-action-sql.mjs +17 -0
  20. package/dist/referential-action-sql.mjs.map +1 -0
  21. package/dist/resolve-storage-table.d.mts +20 -0
  22. package/dist/resolve-storage-table.d.mts.map +1 -0
  23. package/dist/resolve-storage-table.mjs +42 -0
  24. package/dist/resolve-storage-table.mjs.map +1 -0
  25. package/dist/sql-storage-CXf9xjAL.d.mts +314 -0
  26. package/dist/sql-storage-CXf9xjAL.d.mts.map +1 -0
  27. package/dist/types-DEnWD3xB.d.mts +208 -0
  28. package/dist/types-DEnWD3xB.d.mts.map +1 -0
  29. package/dist/{types-DPkj4y3_.mjs → types-DqhaAjCH.mjs} +109 -28
  30. package/dist/types-DqhaAjCH.mjs.map +1 -0
  31. package/dist/types.d.mts +4 -2
  32. package/dist/types.mjs +2 -2
  33. package/dist/validators.d.mts +51 -14
  34. package/dist/validators.d.mts.map +1 -1
  35. package/dist/validators.mjs +116 -32
  36. package/dist/validators.mjs.map +1 -1
  37. package/package.json +11 -9
  38. package/src/canonicalization-hooks.ts +5 -6
  39. package/src/exports/referential-action-sql.ts +1 -0
  40. package/src/exports/resolve-storage-table.ts +1 -0
  41. package/src/exports/types.ts +6 -0
  42. package/src/factories.ts +2 -1
  43. package/src/index-type-validation.ts +1 -1
  44. package/src/ir/build-sql-namespace.ts +33 -19
  45. package/src/ir/check-constraint.ts +42 -0
  46. package/src/ir/foreign-key-reference.ts +23 -0
  47. package/src/ir/postgres-enum-storage-entry.ts +2 -0
  48. package/src/ir/sql-storage.ts +53 -50
  49. package/src/ir/sql-unbound-namespace.ts +11 -4
  50. package/src/ir/storage-column.ts +7 -1
  51. package/src/ir/storage-table.ts +10 -0
  52. package/src/ir/storage-type-instance.ts +5 -3
  53. package/src/ir/storage-value-set.ts +42 -0
  54. package/src/referential-action-sql.ts +14 -0
  55. package/src/resolve-storage-table.ts +61 -0
  56. package/src/types.ts +13 -0
  57. package/src/validators.ts +156 -46
  58. package/dist/types-ChlHcJCu.d.mts +0 -508
  59. package/dist/types-ChlHcJCu.d.mts.map +0 -1
  60. package/dist/types-DPkj4y3_.mjs.map +0 -1
@@ -16,9 +16,10 @@ import { asNamespaceId } from "@prisma-next/contract/types";
16
16
  * envelope and runtime walk are honest at every layer.
17
17
  *
18
18
  * The `kind` discriminator is installed as a non-enumerable own property
19
- * so the JSON envelope reads `{ "id": "__unbound__" }` — symmetric
20
- * with the family-level non-enumerable `kind` on `SqlNode` and bounded
21
- * to the minimum data the framework `Namespace` interface promises.
19
+ * so the JSON envelope reads `{ "id": "__unbound__", "entries": { … } }`
20
+ * — symmetric with the family-level non-enumerable `kind` on `SqlNode`
21
+ * and bounded to the minimum data the framework `Namespace` interface
22
+ * promises.
22
23
  *
23
24
  * **Freeze-trap warning.** The leaf constructor calls
24
25
  * `freezeNode(this)` after installing `kind`. The leaf-class shape
@@ -35,7 +36,7 @@ import { asNamespaceId } from "@prisma-next/contract/types";
35
36
  var SqlUnboundNamespace = class SqlUnboundNamespace extends NamespaceBase {
36
37
  static instance = new SqlUnboundNamespace();
37
38
  id = UNBOUND_NAMESPACE_ID;
38
- tables = Object.freeze({});
39
+ entries = Object.freeze({ table: Object.freeze({}) });
39
40
  constructor() {
40
41
  super();
41
42
  Object.defineProperty(this, "kind", {
@@ -46,6 +47,9 @@ var SqlUnboundNamespace = class SqlUnboundNamespace extends NamespaceBase {
46
47
  });
47
48
  freezeNode(this);
48
49
  }
50
+ qualifyTable(tableName) {
51
+ return `"${tableName}"`;
52
+ }
49
53
  };
50
54
  //#endregion
51
55
  //#region src/ir/sql-node.ts
@@ -94,11 +98,48 @@ var SqlNode = class extends IRNodeBase {
94
98
  }
95
99
  };
96
100
  //#endregion
101
+ //#region src/ir/check-constraint.ts
102
+ /**
103
+ * SQL Contract IR node for a table-level check constraint that restricts
104
+ * a column to the permitted values of a value-set.
105
+ *
106
+ * The constraint is **structured** (names a column and a value-set
107
+ * reference), not a raw SQL expression. Each target renders its own DDL
108
+ * from the structured form, keeping the contract target-agnostic.
109
+ *
110
+ * Construction is idempotent: passing an existing `CheckConstraint`
111
+ * instance as input produces a new instance with identical fields.
112
+ * The constructor does not use `instanceof` for input discrimination —
113
+ * it reads plain named properties, which is sufficient since
114
+ * `CheckConstraintInput` is a structural type.
115
+ */
116
+ var CheckConstraint = class extends SqlNode {
117
+ name;
118
+ column;
119
+ valueSet;
120
+ constructor(input) {
121
+ super();
122
+ this.name = input.name;
123
+ this.column = input.column;
124
+ this.valueSet = input.valueSet;
125
+ freezeNode(this);
126
+ }
127
+ };
128
+ //#endregion
97
129
  //#region src/ir/foreign-key-reference.ts
98
130
  /**
99
131
  * SQL Contract IR node for one side (source or target) of a foreign-key
100
132
  * declaration. Carries the full coordinate: namespace, table, and columns.
101
133
  *
134
+ * Cross-space discrimination is based on `spaceId` presence: absent means
135
+ * local (same contract-space); present means cross-space (the referenced
136
+ * table lives in the contract-space identified by `spaceId`).
137
+ *
138
+ * For local references `spaceId` is absent from JSON, keeping the serialized
139
+ * shape byte-identical to contracts authored before cross-space support was
140
+ * added. For cross-space references `spaceId` appears in JSON so round-trips
141
+ * are lossless.
142
+ *
102
143
  * Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`
103
144
  * as the sentinel `namespaceId` for single-namespace (unbound) references.
104
145
  */
@@ -111,6 +152,7 @@ var ForeignKeyReference = class extends SqlNode {
111
152
  this.namespaceId = asNamespaceId(input.namespaceId);
112
153
  this.tableName = input.tableName;
113
154
  this.columns = input.columns;
155
+ if (input.spaceId !== void 0) this.spaceId = input.spaceId;
114
156
  freezeNode(this);
115
157
  }
116
158
  };
@@ -207,6 +249,8 @@ var StorageColumn = class extends SqlNode {
207
249
  if (input.typeParams !== void 0) this.typeParams = input.typeParams;
208
250
  if (input.typeRef !== void 0) this.typeRef = input.typeRef;
209
251
  if (input.default !== void 0) this.default = input.default;
252
+ if (input.control !== void 0) this.control = input.control;
253
+ if (input.valueSet !== void 0) this.valueSet = input.valueSet;
210
254
  freezeNode(this);
211
255
  }
212
256
  };
@@ -250,6 +294,37 @@ var StorageTable = class extends SqlNode {
250
294
  this.uniques = Object.freeze(input.uniques.map((u) => u instanceof UniqueConstraint ? u : new UniqueConstraint(u)));
251
295
  this.indexes = Object.freeze(input.indexes.map((i) => i instanceof Index ? i : new Index(i)));
252
296
  this.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof ForeignKey ? fk : new ForeignKey(fk)));
297
+ if (input.control !== void 0) this.control = input.control;
298
+ if (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((cc) => new CheckConstraint(cc)));
299
+ freezeNode(this);
300
+ }
301
+ };
302
+ //#endregion
303
+ //#region src/ir/storage-value-set.ts
304
+ /**
305
+ * SQL Contract IR node for a value-set entry in a namespace's `valueSet`
306
+ * map (`SqlNamespace.entries.valueSet`).
307
+ *
308
+ * A value-set records the ordered set of permitted codec-encoded values for
309
+ * an enum-like column restriction. It does not carry a `codecId` — the
310
+ * column that references it already holds the codec; the value-set holds
311
+ * only the permitted values.
312
+ *
313
+ * The node's `kind` is enumerable (`'value-set'`) so the JSON envelope
314
+ * carries the discriminator and the serializer hydration walker can
315
+ * dispatch on it. This follows the per-leaf enumerable-kind convention
316
+ * established in the SQL-node comment (future polymorphic dispatch on
317
+ * namespace entries needs the discriminator in JSON).
318
+ *
319
+ * The entry's name is not on the class — value-sets are keyed by name in
320
+ * the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
321
+ */
322
+ var StorageValueSet = class extends SqlNode {
323
+ kind = "value-set";
324
+ values;
325
+ constructor(input) {
326
+ super();
327
+ this.values = Object.freeze([...input.values]);
253
328
  freezeNode(this);
254
329
  }
255
330
  };
@@ -264,23 +339,24 @@ function isMaterializedSqlNamespace(ns) {
264
339
  }
265
340
  var SqlBoundNamespace = class SqlBoundNamespace extends NamespaceBase {
266
341
  id;
267
- tables;
342
+ entries;
268
343
  static fromTablesInput(input) {
269
- const tableCount = Object.keys(input.tables ?? {}).length;
270
- const enumCount = Object.keys(input.enum ?? {}).length;
271
- if (input.id === UNBOUND_NAMESPACE_ID && tableCount === 0 && enumCount === 0) return castAs(SqlUnboundNamespace.instance);
344
+ const tableCount = Object.keys(input.entries.table).length;
345
+ const hasValueSets = input.entries.valueSet !== void 0 && Object.keys(input.entries.valueSet).length > 0;
346
+ if (input.id === UNBOUND_NAMESPACE_ID && tableCount === 0 && !hasValueSets) return castAs(SqlUnboundNamespace.instance);
272
347
  return castAs(new SqlBoundNamespace(input));
273
348
  }
274
349
  constructor(input) {
275
350
  super();
276
351
  this.id = input.id;
277
- this.tables = Object.freeze(Object.fromEntries(Object.entries(input.tables ?? {}).map(([name, t]) => [name, t instanceof StorageTable ? t : new StorageTable(t)])));
278
- if (input.enum !== void 0 && Object.keys(input.enum).length > 0) Object.defineProperty(this, "enum", {
279
- value: Object.freeze({ ...input.enum }),
280
- writable: false,
281
- enumerable: true,
282
- configurable: false
283
- });
352
+ const table = Object.freeze(Object.fromEntries(Object.entries(input.entries.table).map(([k, v]) => [k, new StorageTable(v)])));
353
+ if (input.entries.valueSet !== void 0) {
354
+ const valueSet = Object.freeze(Object.fromEntries(Object.entries(input.entries.valueSet).map(([k, v]) => [k, new StorageValueSet(v)])));
355
+ this.entries = Object.freeze({
356
+ table,
357
+ valueSet
358
+ });
359
+ } else this.entries = Object.freeze({ table });
284
360
  Object.defineProperty(this, "kind", {
285
361
  value: SQL_NAMESPACE_KIND,
286
362
  writable: false,
@@ -289,12 +365,16 @@ var SqlBoundNamespace = class SqlBoundNamespace extends NamespaceBase {
289
365
  });
290
366
  freezeNode(this);
291
367
  }
368
+ qualifyTable(tableName) {
369
+ if (this.id === UNBOUND_NAMESPACE_ID) return `"${tableName}"`;
370
+ return `"${this.id}"."${tableName}"`;
371
+ }
292
372
  };
293
373
  function buildSqlNamespace(input) {
294
374
  return SqlBoundNamespace.fromTablesInput(input);
295
375
  }
296
376
  function buildSqlNamespaceMap(namespaces) {
297
- return Object.fromEntries(Object.entries(namespaces).map(([nsKey, ns]) => [nsKey, isMaterializedSqlNamespace(ns) ? blindCast(ns) : SqlBoundNamespace.fromTablesInput(ns)]));
377
+ return Object.fromEntries(Object.entries(namespaces).map(([nsKey, ns]) => [nsKey, isMaterializedSqlNamespace(ns) ? blindCast(ns) : SqlBoundNamespace.fromTablesInput(blindCast(ns))]));
298
378
  }
299
379
  //#endregion
300
380
  //#region src/ir/postgres-enum-storage-entry.ts
@@ -336,14 +416,14 @@ const CODEC_INSTANCE_KIND = "codec-instance";
336
416
  /**
337
417
  * Stamp the codec-instance `kind` discriminator on a caller-supplied
338
418
  * codec triple. Idempotent: input that already carries the discriminator
339
- * passes through unchanged.
419
+ * passes through unchanged. Missing `typeParams` is normalised to `{}`.
340
420
  */
341
421
  function toStorageTypeInstance(input) {
342
422
  return {
343
423
  kind: CODEC_INSTANCE_KIND,
344
424
  codecId: input.codecId,
345
425
  nativeType: input.nativeType,
346
- typeParams: input.typeParams
426
+ typeParams: input.typeParams ?? {}
347
427
  };
348
428
  }
349
429
  /**
@@ -368,11 +448,13 @@ var SqlStorage = class extends SqlNode {
368
448
  freezeNode(this);
369
449
  }
370
450
  };
451
+ function storageTableAt(storage, namespaceId, tableName) {
452
+ return storage.namespaces[namespaceId]?.entries.table[tableName];
453
+ }
371
454
  /**
372
455
  * Strict polymorphic-slot dispatch for `SqlStorage.types` entries.
373
- * Every entry must carry a recognised `kind` discriminator — either
374
- * `'codec-instance'` (codec triple, family-shared) or
375
- * `'postgres-enum'` (target-specific IR class). Untagged or
456
+ * Every entry must carry a `kind: 'codec-instance'` discriminator or
457
+ * be an already-constructed `StorageTypeInstance`. Untagged or
376
458
  * unrecognised inputs throw a diagnostic naming the entry and its
377
459
  * `kind`, so format drift surfaces loudly at the deserializer
378
460
  * boundary instead of slipping past the seam and corrupting
@@ -386,14 +468,13 @@ var SqlStorage = class extends SqlNode {
386
468
  * only fires for in-memory authoring bugs.
387
469
  */
388
470
  function normaliseTypeEntry(name, entry) {
389
- if (isPostgresEnumStorageEntry(entry)) {
390
- if (entry instanceof SqlNode) return entry;
391
- throw new Error(`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.`);
471
+ if (isStorageTypeInstance(entry)) {
472
+ if ("typeParams" in entry) return entry;
473
+ return toStorageTypeInstance(entry);
392
474
  }
393
- if (isStorageTypeInstance(entry)) return entry;
394
475
  const rawKind = entry.kind;
395
476
  const kindDescription = rawKind === void 0 ? "missing `kind` discriminator" : `unrecognised \`kind\` discriminator ${JSON.stringify(rawKind)}`;
396
- throw new Error(`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.`);
477
+ throw new Error(`storage.types[${JSON.stringify(name)}] has ${kindDescription}; expected ${JSON.stringify("codec-instance")}. Untagged codec triples should be wrapped with toStorageTypeInstance(...) before construction.`);
397
478
  }
398
479
  //#endregion
399
480
  //#region src/types.ts
@@ -406,6 +487,6 @@ function applyFkDefaults(fk, overrideDefaults) {
406
487
  };
407
488
  }
408
489
  //#endregion
409
- export { ForeignKey as _, CODEC_INSTANCE_KIND as a, SqlUnboundNamespace as b, POSTGRES_ENUM_KIND as c, buildSqlNamespaceMap as d, StorageTable as f, PrimaryKey as g, Index as h, SqlStorage as i, isPostgresEnumStorageEntry as l, StorageColumn as m, DEFAULT_FK_INDEX as n, isStorageTypeInstance as o, UniqueConstraint as p, applyFkDefaults as r, toStorageTypeInstance as s, DEFAULT_FK_CONSTRAINT as t, buildSqlNamespace as u, ForeignKeyReference as v, SqlNode as y };
490
+ export { SqlUnboundNamespace as C, SqlNode as S, Index as _, storageTableAt as a, ForeignKeyReference as b, toStorageTypeInstance as c, buildSqlNamespace as d, buildSqlNamespaceMap as f, StorageColumn as g, UniqueConstraint as h, SqlStorage as i, POSTGRES_ENUM_KIND as l, StorageTable as m, DEFAULT_FK_INDEX as n, CODEC_INSTANCE_KIND as o, StorageValueSet as p, applyFkDefaults as r, isStorageTypeInstance as s, DEFAULT_FK_CONSTRAINT as t, isPostgresEnumStorageEntry as u, PrimaryKey as v, CheckConstraint as x, ForeignKey as y };
410
491
 
411
- //# sourceMappingURL=types-DPkj4y3_.mjs.map
492
+ //# sourceMappingURL=types-DqhaAjCH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DqhaAjCH.mjs","names":[],"sources":["../src/ir/sql-unbound-namespace.ts","../src/ir/sql-node.ts","../src/ir/check-constraint.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/storage-value-set.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__\", \"entries\": { … } }`\n * — symmetric with the family-level non-enumerable `kind` on `SqlNode`\n * and bounded to the minimum data the framework `Namespace` interface\n * 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 entries: Readonly<{\n readonly table: Readonly<Record<string, StorageTable>>;\n }> = Object.freeze({ table: 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 qualifyTable(tableName: string): string {\n return `\"${tableName}\"`;\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 type { ValueSetRef } 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 CheckConstraint}.\n * Mirrors the on-disk storage JSON envelope so the serializer hydration\n * walker can hand a validated literal straight to `new`.\n */\nexport interface CheckConstraintInput {\n readonly name: string;\n readonly column: string;\n readonly valueSet: ValueSetRef;\n}\n\n/**\n * SQL Contract IR node for a table-level check constraint that restricts\n * a column to the permitted values of a value-set.\n *\n * The constraint is **structured** (names a column and a value-set\n * reference), not a raw SQL expression. Each target renders its own DDL\n * from the structured form, keeping the contract target-agnostic.\n *\n * Construction is idempotent: passing an existing `CheckConstraint`\n * instance as input produces a new instance with identical fields.\n * The constructor does not use `instanceof` for input discrimination —\n * it reads plain named properties, which is sufficient since\n * `CheckConstraintInput` is a structural type.\n */\nexport class CheckConstraint extends SqlNode {\n readonly name: string;\n readonly column: string;\n readonly valueSet: ValueSetRef;\n\n constructor(input: CheckConstraintInput) {\n super();\n this.name = input.name;\n this.column = input.column;\n this.valueSet = input.valueSet;\n freezeNode(this);\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\n/**\n * Input for a foreign-key reference (one side of a foreign-key declaration).\n *\n * When `spaceId` is absent the reference is local — the referenced table lives\n * in the same contract-space. When `spaceId` is present the reference is\n * cross-space — the referenced table lives in a different contract-space\n * identified by `spaceId`.\n *\n * Presence-based discrimination keeps local FK JSON byte-identical to\n * contracts authored before cross-space support was added.\n */\nexport interface ForeignKeyReferenceInput {\n readonly namespaceId: string;\n readonly tableName: string;\n readonly columns: readonly string[];\n readonly spaceId?: 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 * Cross-space discrimination is based on `spaceId` presence: absent means\n * local (same contract-space); present means cross-space (the referenced\n * table lives in the contract-space identified by `spaceId`).\n *\n * For local references `spaceId` is absent from JSON, keeping the serialized\n * shape byte-identical to contracts authored before cross-space support was\n * added. For cross-space references `spaceId` appears in JSON so round-trips\n * are lossless.\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 declare readonly spaceId?: 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 if (input.spaceId !== undefined) this.spaceId = input.spaceId;\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, ControlPolicy, ValueSetRef } 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 readonly control?: ControlPolicy;\n readonly valueSet?: ValueSetRef;\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 declare readonly control?: ControlPolicy;\n declare readonly valueSet?: ValueSetRef;\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 if (input.control !== undefined) this.control = input.control;\n if (input.valueSet !== undefined) this.valueSet = input.valueSet;\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 type { ControlPolicy } from '@prisma-next/contract/types';\nimport { freezeNode } from '@prisma-next/framework-components/ir';\nimport { CheckConstraint, type CheckConstraintInput } from './check-constraint';\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 readonly control?: ControlPolicy;\n readonly checks?: ReadonlyArray<CheckConstraint | CheckConstraintInput>;\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 declare readonly control?: ControlPolicy;\n declare readonly checks?: ReadonlyArray<CheckConstraint>;\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 if (input.control !== undefined) this.control = input.control;\n if (input.checks !== undefined && input.checks.length > 0) {\n this.checks = Object.freeze(input.checks.map((cc) => new CheckConstraint(cc)));\n }\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from './sql-node';\n\n/**\n * Hydration / construction input shape for {@link StorageValueSet}.\n * Mirrors the on-disk storage JSON envelope so the serializer hydration\n * walker can hand a validated literal straight to `new`.\n */\nexport interface StorageValueSetInput {\n readonly kind: 'value-set';\n /** Ordered permitted values, codec-encoded. Declaration order is preserved. */\n readonly values: readonly string[];\n}\n\n/**\n * SQL Contract IR node for a value-set entry in a namespace's `valueSet`\n * map (`SqlNamespace.entries.valueSet`).\n *\n * A value-set records the ordered set of permitted codec-encoded values for\n * an enum-like column restriction. It does not carry a `codecId` — the\n * column that references it already holds the codec; the value-set holds\n * only the permitted values.\n *\n * The node's `kind` is enumerable (`'value-set'`) so the JSON envelope\n * carries the discriminator and the serializer hydration walker can\n * dispatch on it. This follows the per-leaf enumerable-kind convention\n * established in the SQL-node comment (future polymorphic dispatch on\n * namespace entries needs the discriminator in JSON).\n *\n * The entry's name is not on the class — value-sets are keyed by name in\n * the parent namespace's `valueSet: Record<string, StorageValueSet>` map.\n */\nexport class StorageValueSet extends SqlNode {\n override readonly kind = 'value-set' as const;\n readonly values: readonly string[];\n\n constructor(input: StorageValueSetInput) {\n super();\n this.values = Object.freeze([...input.values]);\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 { SqlNamespace, SqlNamespaceTablesInput } from './sql-storage';\nimport { SqlUnboundNamespace } from './sql-unbound-namespace';\nimport { StorageTable } from './storage-table';\nimport { StorageValueSet } from './storage-value-set';\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\n readonly id: string;\n readonly entries: Readonly<{\n readonly table: Readonly<Record<string, StorageTable>>;\n readonly valueSet?: Readonly<Record<string, StorageValueSet>>;\n }>;\n\n static fromTablesInput(input: SqlNamespaceTablesInput): SqlNamespace {\n const tableCount = Object.keys(input.entries.table).length;\n const hasValueSets =\n input.entries.valueSet !== undefined && Object.keys(input.entries.valueSet).length > 0;\n if (input.id === UNBOUND_NAMESPACE_ID && tableCount === 0 && !hasValueSets) {\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 const table = Object.freeze(\n Object.fromEntries(\n Object.entries(input.entries.table).map(([k, v]) => [k, new StorageTable(v)]),\n ),\n );\n if (input.entries.valueSet !== undefined) {\n const valueSet = Object.freeze(\n Object.fromEntries(\n Object.entries(input.entries.valueSet).map(([k, v]) => [k, new StorageValueSet(v)]),\n ),\n );\n this.entries = Object.freeze({ table, valueSet });\n } else {\n this.entries = Object.freeze({ table });\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 qualifyTable(tableName: string): string {\n if (this.id === UNBOUND_NAMESPACE_ID) {\n return `\"${tableName}\"`;\n }\n return `\"${this.id}\".\"${tableName}\"`;\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(\n blindCast<\n SqlNamespaceTablesInput,\n 'non-materialized SQL namespace map entry is a SqlNamespaceTablesInput'\n >(ns),\n ),\n ]),\n );\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport 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 readonly control?: ControlPolicy;\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 * `typeParams` may be omitted on input; the constructor normalises a\n * missing value to `{}` so the in-memory shape is always present.\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. Missing `typeParams` is normalised to `{}`.\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 { SqlNode } from './sql-node';\nimport type { StorageTable, StorageTableInput } from './storage-table';\nimport {\n isStorageTypeInstance,\n type StorageTypeInstance,\n type StorageTypeInstanceInput,\n toStorageTypeInstance,\n} from './storage-type-instance';\nimport type { StorageValueSet, StorageValueSetInput } from './storage-value-set';\n\n/**\n * Polymorphic value type for document-scoped `SqlStorage.types` entries\n * (codec aliases / parameterised native type registrations).\n *\n * Postgres native enum registrations live under the postgres-specific\n * `entries.type` slot on `PostgresSchema` (target layer), not here.\n */\nexport type SqlStorageTypeEntry = StorageTypeInstance | StorageTypeInstanceInput;\n\nexport interface SqlNamespaceTablesInput {\n readonly id: string;\n readonly entries: {\n readonly table: Record<string, StorageTable | StorageTableInput>;\n readonly valueSet?: Record<string, StorageValueSet | StorageValueSetInput>;\n };\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'`; hydration of raw JSON\n * class-instance entries (carrying their narrower `kind` literal) is\n * the per-target serializer's responsibility (so the family base does\n * not import target-specific subclasses).\n */\n// SQL concretions store `StorageTable` values under `entries.table`.\n// Mongo namespaces carry `entries.collection` instead. The wider\n// `Record<string, object>` on `StorageTable` is only there so emitted\n// `contract.d.ts` table literals (which lack the runtime `kind`\n// discriminator on `StorageTable`) structurally satisfy the slot without\n// a class-instance check.\nexport type SqlNamespace = Namespace & {\n readonly entries: Readonly<{\n readonly table: Readonly<Record<string, StorageTable>>;\n readonly valueSet?: Readonly<Record<string, StorageValueSet>>;\n }>;\n /**\n * Render a dialect-qualified table reference for runtime SQL emission.\n * Present on materialised target concretions (`PostgresSchema`,\n * `SqliteDatabase`, …) and family placeholders; omitted on emitted\n * contract structural namespace literals (methods are not serialised).\n */\n qualifyTable?(tableName: string): string;\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>>;\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\nexport function storageTableAt(\n storage: SqlStorage,\n namespaceId: string,\n tableName: string,\n): StorageTable | undefined {\n return storage.namespaces[namespaceId]?.entries.table[tableName];\n}\n\n/**\n * Strict polymorphic-slot dispatch for `SqlStorage.types` entries.\n * Every entry must carry a `kind: 'codec-instance'` discriminator or\n * be an already-constructed `StorageTypeInstance`. 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(name: string, entry: SqlStorageTypeEntry): StorageTypeInstance {\n if (isStorageTypeInstance(entry)) {\n // Normalise on-disk objects that omit `typeParams` (the canonical on-disk\n // form strips empty typeParams to keep JSON compact). The in-memory invariant\n // is always `typeParams: {}` when empty — never `undefined`. Only create a\n // new object when necessary to preserve identity-equality for callers that\n // hold a reference to an already-correct in-memory entry.\n if ('typeParams' in entry) {\n return entry;\n }\n return toStorageTypeInstance(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')}. Untagged codec triples should be wrapped with toStorageTypeInstance(...) before construction.`,\n );\n}\n","import type { CodecTrait } from '@prisma-next/framework-components/codec';\nimport type { ControlDriverInstance } from '@prisma-next/framework-components/control';\nimport type { ReferentialAction } from './ir/foreign-key';\n\nexport interface SqlControlDriverInstance<T extends string = string>\n extends ControlDriverInstance<'sql', T> {\n query<Row = Record<string, unknown>>(\n sql: string,\n params?: readonly unknown[],\n ): Promise<{ readonly rows: Row[] }>;\n}\n\nexport { buildSqlNamespace, buildSqlNamespaceMap } from './ir/build-sql-namespace';\nexport { CheckConstraint, type CheckConstraintInput } from './ir/check-constraint';\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 storageTableAt,\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 { StorageValueSet, type StorageValueSetInput } from './ir/storage-value-set';\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 namespaceId: 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAa,sBAAb,MAAa,4BAA4B,cAAc;CACrD,OAAgB,WAAgC,IAAI,oBAAoB;CAExE,KAAc;CACd,UAEK,OAAO,OAAO,EAAE,OAAO,OAAO,OAAO,CAAC,CAAC,EAAE,CAAC;CAG/C,cAAsB;EACpB,MAAM;EACN,OAAO,eAAe,MAAM,QAAQ;GAClC,OAAO;GACP,UAAU;GACV,YAAY;GACZ,cAAc;EAChB,CAAC;EACD,WAAW,IAAI;CACjB;CAEA,aAAa,WAA2B;EACtC,OAAO,IAAI,UAAU;CACvB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3BA,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;;;;;;;;;;;;;;;;;ACtBA,IAAa,kBAAb,cAAqC,QAAQ;CAC3C;CACA;CACA;CAEA,YAAY,OAA6B;EACvC,MAAM;EACN,KAAK,OAAO,MAAM;EAClB,KAAK,SAAS,MAAM;EACpB,KAAK,WAAW,MAAM;EACtB,WAAW,IAAI;CACjB;AACF;;;;;;;;;;;;;;;;;;;ACHA,IAAa,sBAAb,cAAyC,QAAQ;CAC/C;CACA;CACA;CAGA,YAAY,OAAiC;EAC3C,MAAM;EACN,KAAK,cAAc,cAAc,MAAM,WAAW;EAClD,KAAK,YAAY,MAAM;EACvB,KAAK,UAAU,MAAM;EACrB,IAAI,MAAM,YAAY,KAAA,GAAW,KAAK,UAAU,MAAM;EACtD,WA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zC,MAAM;EACN,KAAK,cAAc,MAAM;EACzB,KAAK,aAAa,OAAO,OAAO,MAAM,UAAU;EAChD,IAAI,MAAM,UAAU,KAAA,GAClB,KAAK,QAAQ,OAAO,OAClB,OAAO,YACL,OAAO,QAAQ,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,mBAAmB,MAAM,EAAE,CAAC,CAAC,CACtF,CACF;EAEF,WAAW,IAAI;CACjB;AACF;AAEA,SAAgB,eACd,SACA,aACA,WAC0B;CAC1B,OAAO,QAAQ,WAAW,YAAY,EAAE,QAAQ,MAAM;AACxD;;;;;;;;;;;;;;;;;AAkBA,SAAS,mBAAmB,MAAc,OAAiD;CACzF,IAAI,sBAAsB,KAAK,GAAG;EAMhC,IAAI,gBAAgB,OAClB,OAAO;EAET,OAAO,sBAAsB,KAAK;CACpC;CACA,MAAM,UAAW,MAA6B;CAC9C,MAAM,kBACJ,YAAY,KAAA,IACR,iCACA,uCAAuC,KAAK,UAAU,OAAO;CACnE,MAAM,IAAI,MACR,iBAAiB,KAAK,UAAU,IAAI,EAAE,QAAQ,gBAAgB,aAAa,KAAK,UAAU,gBAAgB,EAAE,gGAC9G;AACF;;;ACpEA,MAAa,wBAAwB;AACrC,MAAa,mBAAmB;AAEhC,SAAgB,gBACd,IACA,kBACyC;CACzC,OAAO;EACL,YAAY,GAAG,cAAc,kBAAkB,cAAA;EAC/C,OAAO,GAAG,SAAS,kBAAkB,SAAA;CACvC;AACF"}
package/dist/types.d.mts CHANGED
@@ -1,2 +1,4 @@
1
- import { $ as ForeignKeyReference, A as SqlStorageInput, B as UniqueConstraintInput, C as TypeMapsPhantomKey, D as buildSqlNamespaceMap, E as buildSqlNamespace, F as isStorageTypeInstance, G as PrimaryKey, H as StorageColumnInput, I as toStorageTypeInstance, J as PostgresEnumStorageEntry, K as PrimaryKeyInput, L as StorageTable, M as CODEC_INSTANCE_KIND, N as StorageTypeInstance, O as SqlNamespaceTablesInput, P as StorageTypeInstanceInput, Q as ReferentialAction, R as StorageTableInput, S as TypeMaps, T as SqlUnboundNamespace, U as Index, V as StorageColumn, W as IndexInput, X as ForeignKey, Y as isPostgresEnumStorageEntry, Z as ForeignKeyInput, _ as QueryOperationTypesOf, a as ExtractCodecTypes, b as SqlModelStorage, c as ExtractQueryOperationTypes, d as FieldOutputTypesOf, et as ForeignKeyReferenceInput, f as ForeignKeyOptions, g as QueryOperationTypesBase, h as QueryOperationTypeEntry, i as DEFAULT_FK_INDEX, j as SqlStorageTypeEntry, k as SqlStorage, l as ExtractTypeMapsFromContract, m as QueryOperationSelfSpec, n as ContractWithTypeMaps, o as ExtractFieldInputTypes, p as QueryOperationReturn, q as POSTGRES_ENUM_KIND, r as DEFAULT_FK_CONSTRAINT, s as ExtractFieldOutputTypes, t as CodecTypesOf, tt as SqlNode, u as FieldInputTypesOf, v as ResolveCodecTypes, w as applyFkDefaults, x as SqlQueryOperationTypes, y as SqlModelFieldStorage, z as UniqueConstraint } from "./types-ChlHcJCu.mjs";
2
- export { CODEC_INSTANCE_KIND, type CodecTypesOf, type ContractWithTypeMaps, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, type ExtractCodecTypes, type ExtractFieldInputTypes, type ExtractFieldOutputTypes, type ExtractQueryOperationTypes, type ExtractTypeMapsFromContract, type FieldInputTypesOf, type FieldOutputTypesOf, ForeignKey, type ForeignKeyInput, type ForeignKeyOptions, ForeignKeyReference, type ForeignKeyReferenceInput, Index, type IndexInput, POSTGRES_ENUM_KIND, type PostgresEnumStorageEntry, PrimaryKey, type PrimaryKeyInput, type QueryOperationReturn, type QueryOperationSelfSpec, type QueryOperationTypeEntry, type QueryOperationTypesBase, type QueryOperationTypesOf, type ReferentialAction, type ResolveCodecTypes, type SqlModelFieldStorage, type SqlModelStorage, type SqlNamespaceTablesInput, SqlNode, type SqlQueryOperationTypes, SqlStorage, type SqlStorageInput, type SqlStorageTypeEntry, SqlUnboundNamespace, StorageColumn, type StorageColumnInput, StorageTable, type StorageTableInput, type StorageTypeInstance, type StorageTypeInstanceInput, type TypeMaps, type TypeMapsPhantomKey, UniqueConstraint, type UniqueConstraintInput, applyFkDefaults, buildSqlNamespace, buildSqlNamespaceMap, isPostgresEnumStorageEntry, isStorageTypeInstance, toStorageTypeInstance };
1
+ import { a as ForeignKeyReferenceInput, i as ForeignKeyReference, n as ForeignKeyInput, o as SqlNode, r as ReferentialAction, t as ForeignKey } from "./foreign-key-BATxB95l.mjs";
2
+ import { C as PrimaryKeyInput, S as PrimaryKey, T as CheckConstraintInput, _ as UniqueConstraintInput, a as SqlStorageTypeEntry, b as Index, c as StorageValueSetInput, d as StorageTypeInstanceInput, f as isStorageTypeInstance, g as UniqueConstraint, h as StorageTableInput, i as SqlStorageInput, l as CODEC_INSTANCE_KIND, m as StorageTable, n as SqlNamespaceTablesInput, o as storageTableAt, p as toStorageTypeInstance, r as SqlStorage, s as StorageValueSet, u as StorageTypeInstance, v as StorageColumn, w as CheckConstraint, x as IndexInput, y as StorageColumnInput } from "./sql-storage-CXf9xjAL.mjs";
3
+ import { A as buildSqlNamespace, C as TypeMaps, D as POSTGRES_ENUM_KIND, E as SqlUnboundNamespace, O as PostgresEnumStorageEntry, S as SqlQueryOperationTypes, T as applyFkDefaults, _ as QueryOperationTypesOf, a as ExtractCodecTypes, b as SqlModelFieldStorage, c as ExtractQueryOperationTypes, d as FieldOutputTypesOf, f as ForeignKeyOptions, g as QueryOperationTypesBase, h as QueryOperationTypeEntry, i as DEFAULT_FK_INDEX, j as buildSqlNamespaceMap, k as isPostgresEnumStorageEntry, l as ExtractTypeMapsFromContract, m as QueryOperationSelfSpec, n as ContractWithTypeMaps, o as ExtractFieldInputTypes, p as QueryOperationReturn, r as DEFAULT_FK_CONSTRAINT, s as ExtractFieldOutputTypes, t as CodecTypesOf, u as FieldInputTypesOf, v as ResolveCodecTypes, w as TypeMapsPhantomKey, x as SqlModelStorage, y as SqlControlDriverInstance } from "./types-DEnWD3xB.mjs";
4
+ export { CODEC_INSTANCE_KIND, CheckConstraint, type CheckConstraintInput, type CodecTypesOf, type ContractWithTypeMaps, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, type ExtractCodecTypes, type ExtractFieldInputTypes, type ExtractFieldOutputTypes, type ExtractQueryOperationTypes, type ExtractTypeMapsFromContract, type FieldInputTypesOf, type FieldOutputTypesOf, ForeignKey, type ForeignKeyInput, type ForeignKeyOptions, ForeignKeyReference, type ForeignKeyReferenceInput, Index, type IndexInput, POSTGRES_ENUM_KIND, type PostgresEnumStorageEntry, PrimaryKey, type PrimaryKeyInput, type QueryOperationReturn, type QueryOperationSelfSpec, type QueryOperationTypeEntry, type QueryOperationTypesBase, type QueryOperationTypesOf, type ReferentialAction, type ResolveCodecTypes, type SqlControlDriverInstance, type SqlModelFieldStorage, type SqlModelStorage, type SqlNamespaceTablesInput, SqlNode, type SqlQueryOperationTypes, SqlStorage, type SqlStorageInput, type SqlStorageTypeEntry, SqlUnboundNamespace, StorageColumn, type StorageColumnInput, StorageTable, type StorageTableInput, type StorageTypeInstance, type StorageTypeInstanceInput, StorageValueSet, type StorageValueSetInput, type TypeMaps, type TypeMapsPhantomKey, UniqueConstraint, type UniqueConstraintInput, applyFkDefaults, buildSqlNamespace, buildSqlNamespaceMap, isPostgresEnumStorageEntry, isStorageTypeInstance, storageTableAt, toStorageTypeInstance };
package/dist/types.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as ForeignKey, a as CODEC_INSTANCE_KIND, b as SqlUnboundNamespace, c as POSTGRES_ENUM_KIND, d as buildSqlNamespaceMap, f as StorageTable, g as PrimaryKey, h as Index, i as SqlStorage, l as isPostgresEnumStorageEntry, m as StorageColumn, n as DEFAULT_FK_INDEX, o as isStorageTypeInstance, p as UniqueConstraint, r as applyFkDefaults, s as toStorageTypeInstance, t as DEFAULT_FK_CONSTRAINT, u as buildSqlNamespace, v as ForeignKeyReference, y as SqlNode } from "./types-DPkj4y3_.mjs";
2
- export { CODEC_INSTANCE_KIND, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, ForeignKey, ForeignKeyReference, Index, POSTGRES_ENUM_KIND, PrimaryKey, SqlNode, SqlStorage, SqlUnboundNamespace, StorageColumn, StorageTable, UniqueConstraint, applyFkDefaults, buildSqlNamespace, buildSqlNamespaceMap, isPostgresEnumStorageEntry, isStorageTypeInstance, toStorageTypeInstance };
1
+ import { C as SqlUnboundNamespace, S as SqlNode, _ as Index, a as storageTableAt, b as ForeignKeyReference, c as toStorageTypeInstance, d as buildSqlNamespace, f as buildSqlNamespaceMap, g as StorageColumn, h as UniqueConstraint, i as SqlStorage, l as POSTGRES_ENUM_KIND, m as StorageTable, n as DEFAULT_FK_INDEX, o as CODEC_INSTANCE_KIND, p as StorageValueSet, r as applyFkDefaults, s as isStorageTypeInstance, t as DEFAULT_FK_CONSTRAINT, u as isPostgresEnumStorageEntry, v as PrimaryKey, x as CheckConstraint, y as ForeignKey } from "./types-DqhaAjCH.mjs";
2
+ export { CODEC_INSTANCE_KIND, CheckConstraint, DEFAULT_FK_CONSTRAINT, DEFAULT_FK_INDEX, ForeignKey, ForeignKeyReference, Index, POSTGRES_ENUM_KIND, PrimaryKey, SqlNode, SqlStorage, SqlUnboundNamespace, StorageColumn, StorageTable, StorageValueSet, UniqueConstraint, applyFkDefaults, buildSqlNamespace, buildSqlNamespaceMap, isPostgresEnumStorageEntry, isStorageTypeInstance, storageTableAt, toStorageTypeInstance };
@@ -1,8 +1,7 @@
1
- import { Q as ReferentialAction, Z as ForeignKeyInput, k as SqlStorage } from "./types-ChlHcJCu.mjs";
1
+ import { n as ForeignKeyInput, r as ReferentialAction } from "./foreign-key-BATxB95l.mjs";
2
+ import { r as SqlStorage } from "./sql-storage-CXf9xjAL.mjs";
2
3
  import { Contract } from "@prisma-next/contract/types";
3
4
  import { Type } from "arktype";
4
- import * as _$arktype_internal_variants_object_ts0 from "arktype/internal/variants/object.ts";
5
- import * as _$arktype_internal_variants_string_ts0 from "arktype/internal/variants/string.ts";
6
5
 
7
6
  //#region src/validators.d.ts
8
7
  type ColumnDefaultLiteral = {
@@ -13,38 +12,76 @@ type ColumnDefaultFunction = {
13
12
  readonly kind: 'function';
14
13
  readonly expression: string;
15
14
  };
16
- declare const ColumnDefaultLiteralSchema: _$arktype_internal_variants_object_ts0.ObjectType<ColumnDefaultLiteral, {}>;
17
- declare const ColumnDefaultFunctionSchema: _$arktype_internal_variants_object_ts0.ObjectType<ColumnDefaultFunction, {}>;
18
- declare const ColumnDefaultSchema: _$arktype_internal_variants_object_ts0.ObjectType<ColumnDefaultLiteral | ColumnDefaultFunction, {}>;
15
+ declare const ColumnDefaultLiteralSchema: import("arktype/internal/variants/object.ts").ObjectType<ColumnDefaultLiteral, {}>;
16
+ declare const ColumnDefaultFunctionSchema: import("arktype/internal/variants/object.ts").ObjectType<ColumnDefaultFunction, {}>;
17
+ declare const ColumnDefaultSchema: import("arktype/internal/variants/object.ts").ObjectType<ColumnDefaultLiteral | ColumnDefaultFunction, {}>;
19
18
  /**
20
- * Postgres native enum entry under `storage.namespaces[namespaceId].enum[name]`.
19
+ * Postgres native enum entry under `storage.namespaces[namespaceId].entries.type[name]`.
21
20
  * Document-scoped `storage.types` carries codec aliases only
22
21
  * (`DocumentScopedStorageTypeSchema`).
23
22
  */
24
- declare const PostgresEnumTypeSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
23
+ declare const PostgresEnumTypeSchema: import("arktype/internal/variants/object.ts").ObjectType<{
25
24
  kind: "postgres-enum";
26
25
  values: readonly string[];
27
26
  name?: string;
28
27
  nativeType?: string;
28
+ control?: "managed" | "tolerated" | "external" | "observed";
29
29
  }, {}>;
30
- declare const IndexSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
30
+ /**
31
+ * Storage value-set entry under `storage.namespaces[id].entries.valueSet[name]`.
32
+ * Carries a `kind: 'value-set'` discriminator (enumerable, survives JSON) and an
33
+ * ordered `values` array of codec-encoded permitted values.
34
+ */
35
+ declare const StorageValueSetSchema: import("arktype/internal/variants/object.ts").ObjectType<{
36
+ kind: "value-set";
37
+ values: readonly string[];
38
+ }, {}>;
39
+ /**
40
+ * Domain enum entry under `domain.namespaces[id].enum[name]`.
41
+ * Carries the codec id and an ordered `members` array of `{name, value}` pairs.
42
+ */
43
+ declare const ContractEnumSchema: import("arktype/internal/variants/object.ts").ObjectType<{
44
+ codecId: string;
45
+ members: readonly {
46
+ name: string;
47
+ value: string;
48
+ }[];
49
+ }, {}>;
50
+ declare const IndexSchema: import("arktype/internal/variants/object.ts").ObjectType<{
31
51
  columns: readonly string[];
32
52
  name?: string;
33
53
  type?: string;
34
54
  options?: Record<string, unknown>;
35
55
  }, {}>;
36
- declare const ForeignKeyReferenceSchema: _$arktype_internal_variants_object_ts0.ObjectType<{
56
+ declare const ForeignKeyReferenceSchema: import("arktype/internal/variants/object.ts").ObjectType<{
57
+ namespaceId: string;
58
+ tableName: string;
59
+ columns: readonly string[];
60
+ spaceId?: string;
61
+ }, {}>;
62
+ declare const ForeignKeySourceSchema: import("arktype/internal/variants/object.ts").ObjectType<{
37
63
  namespaceId: string;
38
64
  tableName: string;
39
65
  columns: readonly string[];
40
66
  }, {}>;
41
- declare const ReferentialActionSchema: _$arktype_internal_variants_string_ts0.StringType<ReferentialAction, {}>;
42
- declare const ForeignKeySchema: _$arktype_internal_variants_object_ts0.ObjectType<ForeignKeyInput, {}>;
67
+ declare const ReferentialActionSchema: import("arktype/internal/variants/string.ts").StringType<ReferentialAction, {}>;
68
+ declare const ForeignKeySchema: import("arktype/internal/variants/object.ts").ObjectType<ForeignKeyInput, {}>;
69
+ declare const CheckConstraintSchema: import("arktype/internal/variants/object.ts").ObjectType<{
70
+ name: string;
71
+ column: string;
72
+ valueSet: {
73
+ plane: "domain" | "storage";
74
+ namespaceId: string;
75
+ entityKind: "value-set" | "enum";
76
+ name: string;
77
+ spaceId?: string;
78
+ };
79
+ }, {}>;
43
80
  /**
44
81
  * Builds the per-namespace entry schema for `storage.namespaces[id]`.
45
82
  * Pack-contributed `validatorSchema` fragments — keyed by the
46
83
  * descriptor's `discriminator` — validate each entry by matching the
47
- * entry's `kind` field on the `'enum?'` slot.
84
+ * entry's `kind` field on the `'entries.type'` slot.
48
85
  */
49
86
  declare function createNamespaceEntrySchema(fragments?: ReadonlyMap<string, Type<unknown>>): Type<unknown>;
50
87
  /**
@@ -118,5 +155,5 @@ interface ValidateSqlContractFullyOptions {
118
155
  */
119
156
  declare function validateSqlContractFully<T extends Contract<SqlStorage>>(value: unknown, options?: ValidateSqlContractFullyOptions): T;
120
157
  //#endregion
121
- export { ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ForeignKeyReferenceSchema, ForeignKeySchema, IndexSchema, PostgresEnumTypeSchema, ReferentialActionSchema, ValidateSqlContractFullyOptions, createNamespaceEntrySchema, createSqlContractSchema, createSqlStorageSchema, validateModel, validateModelStorageReferences, validateSqlContractFully, validateSqlStorageConsistency, validateStorage, validateStorageSemantics };
158
+ export { CheckConstraintSchema, ColumnDefaultFunctionSchema, ColumnDefaultLiteralSchema, ColumnDefaultSchema, ContractEnumSchema, ForeignKeyReferenceSchema, ForeignKeySchema, ForeignKeySourceSchema, IndexSchema, PostgresEnumTypeSchema, ReferentialActionSchema, StorageValueSetSchema, ValidateSqlContractFullyOptions, createNamespaceEntrySchema, createSqlContractSchema, createSqlStorageSchema, validateModel, validateModelStorageReferences, validateSqlContractFully, validateSqlStorageConsistency, validateStorage, validateStorageSemantics };
122
159
  //# sourceMappingURL=validators.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.mts","names":[],"sources":["../src/validators.ts"],"mappings":";;;;;;;KA2BK,oBAAA;EAAA,SACM,IAAA;EAAA,SACA,KAAA,8BAAmC,MAAM;AAAA;AAAA,KAE/C,qBAAA;EAAA,SAAmC,IAAA;EAAA,SAA2B,UAAU;AAAA;AAAA,cAQhE,0BAAA,EAA0B,sCAAA,CAAA,UAAA,CAAA,oBAAA;AAAA,cAK1B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