@prisma-next/sql-contract 0.12.0-dev.6 → 0.12.0-dev.61

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 (46) hide show
  1. package/dist/canonicalization-hooks.mjs +10 -5
  2. package/dist/canonicalization-hooks.mjs.map +1 -1
  3. package/dist/factories.d.mts +3 -2
  4. package/dist/factories.d.mts.map +1 -1
  5. package/dist/factories.mjs +3 -2
  6. package/dist/factories.mjs.map +1 -1
  7. package/dist/index-type-validation.d.mts +2 -2
  8. package/dist/index-type-validation.mjs +1 -1
  9. package/dist/index-type-validation.mjs.map +1 -1
  10. package/dist/{index-types-B1cf5N0F.d.mts → index-types-Czsyu7Iw.d.mts} +1 -1
  11. package/dist/{index-types-B1cf5N0F.d.mts.map → index-types-Czsyu7Iw.d.mts.map} +1 -1
  12. package/dist/index-types.d.mts +1 -1
  13. package/dist/pack-types.d.mts +1 -1
  14. package/dist/resolve-storage-table.d.mts +17 -0
  15. package/dist/resolve-storage-table.d.mts.map +1 -0
  16. package/dist/resolve-storage-table.mjs +26 -0
  17. package/dist/resolve-storage-table.mjs.map +1 -0
  18. package/dist/{types-Cx_5A_L0.d.mts → sql-storage-CaAh0nd3.d.mts} +89 -209
  19. package/dist/sql-storage-CaAh0nd3.d.mts.map +1 -0
  20. package/dist/types-CZZASopP.d.mts +207 -0
  21. package/dist/types-CZZASopP.d.mts.map +1 -0
  22. package/dist/{types-YQrDHy-b.mjs → types-a657xjzo.mjs} +73 -26
  23. package/dist/types-a657xjzo.mjs.map +1 -0
  24. package/dist/types.d.mts +3 -2
  25. package/dist/types.mjs +2 -2
  26. package/dist/validators.d.mts +38 -14
  27. package/dist/validators.d.mts.map +1 -1
  28. package/dist/validators.mjs +65 -24
  29. package/dist/validators.mjs.map +1 -1
  30. package/package.json +10 -9
  31. package/src/canonicalization-hooks.ts +5 -5
  32. package/src/exports/resolve-storage-table.ts +1 -0
  33. package/src/exports/types.ts +4 -0
  34. package/src/factories.ts +2 -1
  35. package/src/index-type-validation.ts +1 -1
  36. package/src/ir/build-sql-namespace.ts +33 -19
  37. package/src/ir/foreign-key-reference.ts +23 -0
  38. package/src/ir/sql-storage.ts +44 -50
  39. package/src/ir/sql-unbound-namespace.ts +11 -4
  40. package/src/ir/storage-column.ts +4 -1
  41. package/src/ir/storage-value-set.ts +42 -0
  42. package/src/resolve-storage-table.ts +41 -0
  43. package/src/types.ts +12 -0
  44. package/src/validators.ts +90 -40
  45. package/dist/types-Cx_5A_L0.d.mts.map +0 -1
  46. package/dist/types-YQrDHy-b.mjs.map +0 -1
@@ -5,20 +5,23 @@ const sqlContractCanonicalizationHooks = {
5
5
  "storage",
6
6
  "namespaces",
7
7
  "*",
8
- "tables"
8
+ "entries",
9
+ "table"
9
10
  ],
10
11
  [
11
12
  "storage",
12
13
  "namespaces",
13
14
  "*",
14
- "tables",
15
+ "entries",
16
+ "table",
15
17
  "*"
16
18
  ],
17
19
  [
18
20
  "storage",
19
21
  "namespaces",
20
22
  "*",
21
- "tables",
23
+ "entries",
24
+ "table",
22
25
  "*",
23
26
  [
24
27
  "uniques",
@@ -30,7 +33,8 @@ const sqlContractCanonicalizationHooks = {
30
33
  "storage",
31
34
  "namespaces",
32
35
  "*",
33
- "tables",
36
+ "entries",
37
+ "table",
34
38
  "*",
35
39
  "foreignKeys",
36
40
  ["constraint", "index"]
@@ -46,7 +50,8 @@ const sqlContractCanonicalizationHooks = {
46
50
  path: [
47
51
  "namespaces",
48
52
  "*",
49
- "tables",
53
+ "entries",
54
+ "table",
50
55
  "*"
51
56
  ],
52
57
  arrayKeys: ["indexes", "uniques"]
@@ -1 +1 @@
1
- {"version":3,"file":"canonicalization-hooks.mjs","names":[],"sources":["../src/canonicalization-hooks.ts"],"sourcesContent":["import type { PreserveEmptyPredicate, StorageSort } from '@prisma-next/contract/hashing';\nimport {\n createPreserveEmptyPredicate,\n createStorageSort,\n type NamedArraySortTarget,\n type PathPattern,\n} from '@prisma-next/contract/hashing-utils';\n\nconst preserveEmptyPatterns = [\n ['storage', 'namespaces', '*', 'tables'],\n ['storage', 'namespaces', '*', 'tables', '*'],\n ['storage', 'namespaces', '*', 'tables', '*', ['uniques', 'indexes', 'foreignKeys']],\n ['storage', 'namespaces', '*', 'tables', '*', 'foreignKeys', ['constraint', 'index']],\n ['storage', 'types', '*', 'typeParams'],\n] as const satisfies readonly PathPattern[];\n\nconst sortTargets = [\n { path: ['namespaces', '*', 'tables', '*'], arrayKeys: ['indexes', 'uniques'] },\n] as const satisfies readonly NamedArraySortTarget[];\n\nconst shouldPreserveEmpty: PreserveEmptyPredicate =\n createPreserveEmptyPredicate(preserveEmptyPatterns);\n\nconst sortStorage: StorageSort = createStorageSort(sortTargets);\n\nexport const sqlContractCanonicalizationHooks: {\n readonly shouldPreserveEmpty: PreserveEmptyPredicate;\n readonly sortStorage: StorageSort;\n} = {\n shouldPreserveEmpty,\n sortStorage,\n};\n"],"mappings":";AAyBA,MAAa,mCAGT;CACF,qBARA,6BAA6B;EAZ7B;GAAC;GAAW;GAAc;GAAK;EAAQ;EACvC;GAAC;GAAW;GAAc;GAAK;GAAU;EAAG;EAC5C;GAAC;GAAW;GAAc;GAAK;GAAU;GAAK;IAAC;IAAW;IAAW;GAAa;EAAC;EACnF;GAAC;GAAW;GAAc;GAAK;GAAU;GAAK;GAAe,CAAC,cAAc,OAAO;EAAC;EACpF;GAAC;GAAW;GAAS;GAAK;EAAY;CAQT,CAQ7B;CACA,aAP+B,kBAAkB,CANjD;EAAE,MAAM;GAAC;GAAc;GAAK;GAAU;EAAG;EAAG,WAAW,CAAC,WAAW,SAAS;CAAE,CAM7B,CAOjD;AACF"}
1
+ {"version":3,"file":"canonicalization-hooks.mjs","names":[],"sources":["../src/canonicalization-hooks.ts"],"sourcesContent":["import type { PreserveEmptyPredicate, StorageSort } from '@prisma-next/contract/hashing';\nimport {\n createPreserveEmptyPredicate,\n createStorageSort,\n type NamedArraySortTarget,\n type PathPattern,\n} from '@prisma-next/contract/hashing-utils';\n\nconst preserveEmptyPatterns = [\n ['storage', 'namespaces', '*', 'entries', 'table'],\n ['storage', 'namespaces', '*', 'entries', 'table', '*'],\n ['storage', 'namespaces', '*', 'entries', 'table', '*', ['uniques', 'indexes', 'foreignKeys']],\n ['storage', 'namespaces', '*', 'entries', 'table', '*', 'foreignKeys', ['constraint', 'index']],\n ['storage', 'types', '*', 'typeParams'],\n] as const satisfies readonly PathPattern[];\n\nconst sortTargets = [\n { path: ['namespaces', '*', 'entries', 'table', '*'], arrayKeys: ['indexes', 'uniques'] },\n] as const satisfies readonly NamedArraySortTarget[];\n\nconst shouldPreserveEmpty: PreserveEmptyPredicate =\n createPreserveEmptyPredicate(preserveEmptyPatterns);\n\nconst sortStorage: StorageSort = createStorageSort(sortTargets);\n\nexport const sqlContractCanonicalizationHooks: {\n readonly shouldPreserveEmpty: PreserveEmptyPredicate;\n readonly sortStorage: StorageSort;\n} = {\n shouldPreserveEmpty,\n sortStorage,\n};\n"],"mappings":";AAyBA,MAAa,mCAGT;CACF,qBARA,6BAA6B;EAZ7B;GAAC;GAAW;GAAc;GAAK;GAAW;EAAO;EACjD;GAAC;GAAW;GAAc;GAAK;GAAW;GAAS;EAAG;EACtD;GAAC;GAAW;GAAc;GAAK;GAAW;GAAS;GAAK;IAAC;IAAW;IAAW;GAAa;EAAC;EAC7F;GAAC;GAAW;GAAc;GAAK;GAAW;GAAS;GAAK;GAAe,CAAC,cAAc,OAAO;EAAC;EAC9F;GAAC;GAAW;GAAS;GAAK;EAAY;CAQT,CAQ7B;CACA,aAP+B,kBAAkB,CANjD;EAAE,MAAM;GAAC;GAAc;GAAK;GAAW;GAAS;EAAG;EAAG,WAAW,CAAC,WAAW,SAAS;CAAE,CAMvC,CAOjD;AACF"}
@@ -1,4 +1,5 @@
1
- import { G as PrimaryKey, H as StorageColumnInput, L as StorageTable, U as Index, V as StorageColumn, X as ForeignKey, b as SqlModelStorage, f as ForeignKeyOptions, y as SqlModelFieldStorage, z as UniqueConstraint } from "./types-Cx_5A_L0.mjs";
1
+ import { S as PrimaryKey, b as Index, g as UniqueConstraint, m as StorageTable, v as StorageColumn, w as ForeignKey, y as StorageColumnInput } from "./sql-storage-CaAh0nd3.mjs";
2
+ import { b as SqlModelFieldStorage, f as ForeignKeyOptions, x as SqlModelStorage } from "./types-CZZASopP.mjs";
2
3
  import { ScalarFieldType } from "@prisma-next/contract/types";
3
4
 
4
5
  //#region src/factories.d.ts
@@ -17,7 +18,7 @@ declare function table(columns: Record<string, StorageColumn | StorageColumnInpu
17
18
  indexes?: readonly Index[];
18
19
  fks?: readonly ForeignKey[];
19
20
  }): StorageTable;
20
- declare function model(tableName: string, fields: Record<string, SqlModelFieldStorage>, relations?: Record<string, unknown>): {
21
+ declare function model(tableName: string, fields: Record<string, SqlModelFieldStorage>, relations?: Record<string, unknown>, namespaceId?: string): {
21
22
  storage: SqlModelStorage;
22
23
  fields: Record<string, {
23
24
  readonly nullable: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"factories.d.mts","names":[],"sources":["../src/factories.ts"],"mappings":";;;;iBAgBgB,GAAA,CAAI,UAAA,UAAoB,OAAA,UAAiB,QAAA,aAAmB,aAAa;AAAA,iBAIzE,EAAA,CAAA,GAAM,OAAA,sBAA6B,UAAU;AAAA,iBAI7C,MAAA,CAAA,GAAU,OAAA,sBAA6B,gBAAgB;AAAA,iBAIvD,KAAA,CAAA,GAAS,OAAA,sBAA6B,KAAK;AAAA,iBAI3C,EAAA,CACd,YAAA,UACA,UAAA,qBACA,eAAA,UACA,aAAA,qBACA,IAAA,GAAO,iBAAA;EAAsB,UAAA;EAAsB,KAAA;EAAiB,WAAA;AAAA,IACnE,UAAU;AAAA,iBAcG,KAAA,CACd,OAAA,EAAS,MAAA,SAAe,aAAA,GAAgB,kBAAA,GACxC,IAAA;EACE,EAAA,GAAK,UAAA;EACL,OAAA,YAAmB,gBAAA;EACnB,OAAA,YAAmB,KAAA;EACnB,GAAA,YAAe,UAAA;AAAA,IAEhB,YAAA;AAAA,iBAUa,KAAA,CACd,SAAA,UACA,MAAA,EAAQ,MAAA,SAAe,oBAAA,GACvB,SAAA,GAAW,MAAA;EAEX,OAAA,EAAS,eAAA;EACT,MAAA,EAAQ,MAAA;IAAA,SAA0B,QAAA;IAAA,SAA4B,IAAA,EAAM,eAAA;EAAA;EACpE,SAAA,EAAW,MAAA;AAAA"}
1
+ {"version":3,"file":"factories.d.mts","names":[],"sources":["../src/factories.ts"],"mappings":";;;;;iBAgBgB,GAAA,CAAI,UAAA,UAAoB,OAAA,UAAiB,QAAA,aAAmB,aAAa;AAAA,iBAIzE,EAAA,IAAM,OAAA,sBAA6B,UAAU;AAAA,iBAI7C,MAAA,IAAU,OAAA,sBAA6B,gBAAgB;AAAA,iBAIvD,KAAA,IAAS,OAAA,sBAA6B,KAAK;AAAA,iBAI3C,EAAA,CACd,YAAA,UACA,UAAA,qBACA,eAAA,UACA,aAAA,qBACA,IAAA,GAAO,iBAAA;EAAsB,UAAA;EAAsB,KAAA;EAAiB,WAAA;AAAA,IACnE,UAAU;AAAA,iBAcG,KAAA,CACd,OAAA,EAAS,MAAA,SAAe,aAAA,GAAgB,kBAAA,GACxC,IAAA;EACE,EAAA,GAAK,UAAA;EACL,OAAA,YAAmB,gBAAA;EACnB,OAAA,YAAmB,KAAA;EACnB,GAAA,YAAe,UAAA;AAAA,IAEhB,YAAA;AAAA,iBAUa,KAAA,CACd,SAAA,UACA,MAAA,EAAQ,MAAA,SAAe,oBAAA,GACvB,SAAA,GAAW,MAAA,mBACX,WAAA;EAEA,OAAA,EAAS,eAAA;EACT,MAAA,EAAQ,MAAA;IAAA,SAA0B,QAAA;IAAA,SAA4B,IAAA,EAAM,eAAA;EAAA;EACpE,SAAA,EAAW,MAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { _ as ForeignKey, f as StorageTable, g as PrimaryKey, h as Index, m as StorageColumn, p as UniqueConstraint, r as applyFkDefaults } from "./types-YQrDHy-b.mjs";
1
+ import { _ as Index, g as StorageColumn, h as UniqueConstraint, m as StorageTable, r as applyFkDefaults, v as PrimaryKey, y as ForeignKey } from "./types-a657xjzo.mjs";
2
2
  import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
3
3
  import { asNamespaceId } from "@prisma-next/contract/types";
4
4
  //#region src/factories.ts
@@ -51,10 +51,11 @@ function table(columns, opts) {
51
51
  foreignKeys: opts?.fks ?? []
52
52
  });
53
53
  }
54
- function model(tableName, fields, relations = {}) {
54
+ function model(tableName, fields, relations = {}, namespaceId = UNBOUND_NAMESPACE_ID) {
55
55
  return {
56
56
  storage: {
57
57
  table: tableName,
58
+ namespaceId,
58
59
  fields
59
60
  },
60
61
  fields: Object.fromEntries(Object.entries(fields).map(([name, field]) => [name, {
@@ -1 +1 @@
1
- {"version":3,"file":"factories.mjs","names":[],"sources":["../src/factories.ts"],"sourcesContent":["import { asNamespaceId, type ScalarFieldType } from '@prisma-next/contract/types';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport {\n applyFkDefaults,\n ForeignKey,\n type ForeignKeyOptions,\n Index,\n PrimaryKey,\n type SqlModelFieldStorage,\n type SqlModelStorage,\n StorageColumn,\n type StorageColumnInput,\n StorageTable,\n UniqueConstraint,\n} from './types';\n\nexport function col(nativeType: string, codecId: string, nullable = false): StorageColumn {\n return new StorageColumn({ nativeType, codecId, nullable });\n}\n\nexport function pk(...columns: readonly string[]): PrimaryKey {\n return new PrimaryKey({ columns });\n}\n\nexport function unique(...columns: readonly string[]): UniqueConstraint {\n return new UniqueConstraint({ columns });\n}\n\nexport function index(...columns: readonly string[]): Index {\n return new Index({ columns });\n}\n\nexport function fk(\n srcTableName: string,\n srcColumns: readonly string[],\n targetTableName: string,\n targetColumns: readonly string[],\n opts?: ForeignKeyOptions & { constraint?: boolean; index?: boolean; namespaceId?: string },\n): ForeignKey {\n const defaults = applyFkDefaults({ constraint: opts?.constraint, index: opts?.index });\n const namespaceId = asNamespaceId(opts?.namespaceId ?? UNBOUND_NAMESPACE_ID);\n return new ForeignKey({\n source: { namespaceId, tableName: srcTableName, columns: srcColumns },\n target: { namespaceId, tableName: targetTableName, columns: targetColumns },\n ...(opts?.name !== undefined && { name: opts.name }),\n ...(opts?.onDelete !== undefined && { onDelete: opts.onDelete }),\n ...(opts?.onUpdate !== undefined && { onUpdate: opts.onUpdate }),\n constraint: defaults.constraint,\n index: defaults.index,\n });\n}\n\nexport function table(\n columns: Record<string, StorageColumn | StorageColumnInput>,\n opts?: {\n pk?: PrimaryKey;\n uniques?: readonly UniqueConstraint[];\n indexes?: readonly Index[];\n fks?: readonly ForeignKey[];\n },\n): StorageTable {\n return new StorageTable({\n columns,\n ...(opts?.pk !== undefined && { primaryKey: opts.pk }),\n uniques: opts?.uniques ?? [],\n indexes: opts?.indexes ?? [],\n foreignKeys: opts?.fks ?? [],\n });\n}\n\nexport function model(\n tableName: string,\n fields: Record<string, SqlModelFieldStorage>,\n relations: Record<string, unknown> = {},\n): {\n storage: SqlModelStorage;\n fields: Record<string, { readonly nullable: boolean; readonly type: ScalarFieldType }>;\n relations: Record<string, unknown>;\n} {\n const storage: SqlModelStorage = { table: tableName, fields };\n const domainFields = Object.fromEntries(\n Object.entries(fields).map(([name, field]) => [\n name,\n {\n nullable: field.nullable ?? false,\n type: { kind: 'scalar' as const, codecId: field.codecId ?? 'core/unknown@1' },\n },\n ]),\n ) as Record<string, { nullable: boolean; type: ScalarFieldType }>;\n return {\n storage,\n fields: domainFields,\n relations,\n };\n}\n"],"mappings":";;;;AAgBA,SAAgB,IAAI,YAAoB,SAAiB,WAAW,OAAsB;CACxF,OAAO,IAAI,cAAc;EAAE;EAAY;EAAS;CAAS,CAAC;AAC5D;AAEA,SAAgB,GAAG,GAAG,SAAwC;CAC5D,OAAO,IAAI,WAAW,EAAE,QAAQ,CAAC;AACnC;AAEA,SAAgB,OAAO,GAAG,SAA8C;CACtE,OAAO,IAAI,iBAAiB,EAAE,QAAQ,CAAC;AACzC;AAEA,SAAgB,MAAM,GAAG,SAAmC;CAC1D,OAAO,IAAI,MAAM,EAAE,QAAQ,CAAC;AAC9B;AAEA,SAAgB,GACd,cACA,YACA,iBACA,eACA,MACY;CACZ,MAAM,WAAW,gBAAgB;EAAE,YAAY,MAAM;EAAY,OAAO,MAAM;CAAM,CAAC;CACrF,MAAM,cAAc,cAAc,MAAM,eAAe,oBAAoB;CAC3E,OAAO,IAAI,WAAW;EACpB,QAAQ;GAAE;GAAa,WAAW;GAAc,SAAS;EAAW;EACpE,QAAQ;GAAE;GAAa,WAAW;GAAiB,SAAS;EAAc;EAC1E,GAAI,MAAM,SAAS,KAAA,KAAa,EAAE,MAAM,KAAK,KAAK;EAClD,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,UAAU,KAAK,SAAS;EAC9D,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,UAAU,KAAK,SAAS;EAC9D,YAAY,SAAS;EACrB,OAAO,SAAS;CAClB,CAAC;AACH;AAEA,SAAgB,MACd,SACA,MAMc;CACd,OAAO,IAAI,aAAa;EACtB;EACA,GAAI,MAAM,OAAO,KAAA,KAAa,EAAE,YAAY,KAAK,GAAG;EACpD,SAAS,MAAM,WAAW,CAAC;EAC3B,SAAS,MAAM,WAAW,CAAC;EAC3B,aAAa,MAAM,OAAO,CAAC;CAC7B,CAAC;AACH;AAEA,SAAgB,MACd,WACA,QACA,YAAqC,CAAC,GAKtC;CAWA,OAAO;EACL,SAAA;GAXiC,OAAO;GAAW;EAW7C;EACN,QAXmB,OAAO,YAC1B,OAAO,QAAQ,MAAM,EAAE,KAAK,CAAC,MAAM,WAAW,CAC5C,MACA;GACE,UAAU,MAAM,YAAY;GAC5B,MAAM;IAAE,MAAM;IAAmB,SAAS,MAAM,WAAW;GAAiB;EAC9E,CACF,CAAC,CAIkB;EACnB;CACF;AACF"}
1
+ {"version":3,"file":"factories.mjs","names":[],"sources":["../src/factories.ts"],"sourcesContent":["import { asNamespaceId, type ScalarFieldType } from '@prisma-next/contract/types';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport {\n applyFkDefaults,\n ForeignKey,\n type ForeignKeyOptions,\n Index,\n PrimaryKey,\n type SqlModelFieldStorage,\n type SqlModelStorage,\n StorageColumn,\n type StorageColumnInput,\n StorageTable,\n UniqueConstraint,\n} from './types';\n\nexport function col(nativeType: string, codecId: string, nullable = false): StorageColumn {\n return new StorageColumn({ nativeType, codecId, nullable });\n}\n\nexport function pk(...columns: readonly string[]): PrimaryKey {\n return new PrimaryKey({ columns });\n}\n\nexport function unique(...columns: readonly string[]): UniqueConstraint {\n return new UniqueConstraint({ columns });\n}\n\nexport function index(...columns: readonly string[]): Index {\n return new Index({ columns });\n}\n\nexport function fk(\n srcTableName: string,\n srcColumns: readonly string[],\n targetTableName: string,\n targetColumns: readonly string[],\n opts?: ForeignKeyOptions & { constraint?: boolean; index?: boolean; namespaceId?: string },\n): ForeignKey {\n const defaults = applyFkDefaults({ constraint: opts?.constraint, index: opts?.index });\n const namespaceId = asNamespaceId(opts?.namespaceId ?? UNBOUND_NAMESPACE_ID);\n return new ForeignKey({\n source: { namespaceId, tableName: srcTableName, columns: srcColumns },\n target: { namespaceId, tableName: targetTableName, columns: targetColumns },\n ...(opts?.name !== undefined && { name: opts.name }),\n ...(opts?.onDelete !== undefined && { onDelete: opts.onDelete }),\n ...(opts?.onUpdate !== undefined && { onUpdate: opts.onUpdate }),\n constraint: defaults.constraint,\n index: defaults.index,\n });\n}\n\nexport function table(\n columns: Record<string, StorageColumn | StorageColumnInput>,\n opts?: {\n pk?: PrimaryKey;\n uniques?: readonly UniqueConstraint[];\n indexes?: readonly Index[];\n fks?: readonly ForeignKey[];\n },\n): StorageTable {\n return new StorageTable({\n columns,\n ...(opts?.pk !== undefined && { primaryKey: opts.pk }),\n uniques: opts?.uniques ?? [],\n indexes: opts?.indexes ?? [],\n foreignKeys: opts?.fks ?? [],\n });\n}\n\nexport function model(\n tableName: string,\n fields: Record<string, SqlModelFieldStorage>,\n relations: Record<string, unknown> = {},\n namespaceId: string = UNBOUND_NAMESPACE_ID,\n): {\n storage: SqlModelStorage;\n fields: Record<string, { readonly nullable: boolean; readonly type: ScalarFieldType }>;\n relations: Record<string, unknown>;\n} {\n const storage: SqlModelStorage = { table: tableName, namespaceId, fields };\n const domainFields = Object.fromEntries(\n Object.entries(fields).map(([name, field]) => [\n name,\n {\n nullable: field.nullable ?? false,\n type: { kind: 'scalar' as const, codecId: field.codecId ?? 'core/unknown@1' },\n },\n ]),\n ) as Record<string, { nullable: boolean; type: ScalarFieldType }>;\n return {\n storage,\n fields: domainFields,\n relations,\n };\n}\n"],"mappings":";;;;AAgBA,SAAgB,IAAI,YAAoB,SAAiB,WAAW,OAAsB;CACxF,OAAO,IAAI,cAAc;EAAE;EAAY;EAAS;CAAS,CAAC;AAC5D;AAEA,SAAgB,GAAG,GAAG,SAAwC;CAC5D,OAAO,IAAI,WAAW,EAAE,QAAQ,CAAC;AACnC;AAEA,SAAgB,OAAO,GAAG,SAA8C;CACtE,OAAO,IAAI,iBAAiB,EAAE,QAAQ,CAAC;AACzC;AAEA,SAAgB,MAAM,GAAG,SAAmC;CAC1D,OAAO,IAAI,MAAM,EAAE,QAAQ,CAAC;AAC9B;AAEA,SAAgB,GACd,cACA,YACA,iBACA,eACA,MACY;CACZ,MAAM,WAAW,gBAAgB;EAAE,YAAY,MAAM;EAAY,OAAO,MAAM;CAAM,CAAC;CACrF,MAAM,cAAc,cAAc,MAAM,eAAe,oBAAoB;CAC3E,OAAO,IAAI,WAAW;EACpB,QAAQ;GAAE;GAAa,WAAW;GAAc,SAAS;EAAW;EACpE,QAAQ;GAAE;GAAa,WAAW;GAAiB,SAAS;EAAc;EAC1E,GAAI,MAAM,SAAS,KAAA,KAAa,EAAE,MAAM,KAAK,KAAK;EAClD,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,UAAU,KAAK,SAAS;EAC9D,GAAI,MAAM,aAAa,KAAA,KAAa,EAAE,UAAU,KAAK,SAAS;EAC9D,YAAY,SAAS;EACrB,OAAO,SAAS;CAClB,CAAC;AACH;AAEA,SAAgB,MACd,SACA,MAMc;CACd,OAAO,IAAI,aAAa;EACtB;EACA,GAAI,MAAM,OAAO,KAAA,KAAa,EAAE,YAAY,KAAK,GAAG;EACpD,SAAS,MAAM,WAAW,CAAC;EAC3B,SAAS,MAAM,WAAW,CAAC;EAC3B,aAAa,MAAM,OAAO,CAAC;CAC7B,CAAC;AACH;AAEA,SAAgB,MACd,WACA,QACA,YAAqC,CAAC,GACtC,cAAsB,sBAKtB;CAWA,OAAO;EACL,SAAA;GAXiC,OAAO;GAAW;GAAa;EAW1D;EACN,QAXmB,OAAO,YAC1B,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,WAAW,CAC5C,MACA;GACE,UAAU,MAAM,YAAY;GAC5B,MAAM;IAAE,MAAM;IAAmB,SAAS,MAAM,WAAW;GAAiB;EAC9E,CACF,CAAC,CAIkB;EACnB;CACF;AACF"}
@@ -1,5 +1,5 @@
1
- import { k as SqlStorage } from "./types-Cx_5A_L0.mjs";
2
- import { a as IndexTypeRegistry } from "./index-types-B1cf5N0F.mjs";
1
+ import { r as SqlStorage } from "./sql-storage-CaAh0nd3.mjs";
2
+ import { a as IndexTypeRegistry } from "./index-types-Czsyu7Iw.mjs";
3
3
  import { Contract } from "@prisma-next/contract/types";
4
4
 
5
5
  //#region src/index-type-validation.d.ts
@@ -2,7 +2,7 @@ import { ContractValidationError } from "@prisma-next/contract/contract-validati
2
2
  import { type } from "arktype";
3
3
  //#region src/index-type-validation.ts
4
4
  function validateIndexTypes(contract, indexTypeRegistry) {
5
- for (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) for (const [tableName, rawTable] of Object.entries(ns.tables)) {
5
+ for (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) for (const [tableName, rawTable] of Object.entries(ns.entries.table)) {
6
6
  const table = rawTable;
7
7
  for (const index of table.indexes) {
8
8
  if (index.type === void 0 && index.options !== void 0) throw new ContractValidationError(`Namespace "${namespaceId}" table "${tableName}" index on columns [${index.columns.join(", ")}] has options without a type`, "storage");
@@ -1 +1 @@
1
- {"version":3,"file":"index-type-validation.mjs","names":[],"sources":["../src/index-type-validation.ts"],"sourcesContent":["import { ContractValidationError } from '@prisma-next/contract/contract-validation-error';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { type } from 'arktype';\nimport type { IndexTypeRegistry } from './index-types';\nimport type { SqlStorage, StorageTable } from './types';\n\nexport function validateIndexTypes(\n contract: Contract<SqlStorage>,\n indexTypeRegistry: IndexTypeRegistry,\n): void {\n for (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) {\n for (const [tableName, rawTable] of Object.entries(ns.tables)) {\n const table = rawTable as StorageTable;\n for (const index of table.indexes) {\n if (index.type === undefined && index.options !== undefined) {\n throw new ContractValidationError(\n `Namespace \"${namespaceId}\" table \"${tableName}\" index on columns [${index.columns.join(', ')}] has options without a type`,\n 'storage',\n );\n }\n if (index.type === undefined) continue;\n const entry = indexTypeRegistry.get(index.type);\n if (entry === undefined) {\n throw new ContractValidationError(\n `Namespace \"${namespaceId}\" table \"${tableName}\" index on columns [${index.columns.join(', ')}] uses unregistered index type \"${index.type}\"`,\n 'storage',\n );\n }\n const optionsValue = index.options ?? {};\n const result = entry.options(optionsValue);\n if (result instanceof type.errors) {\n throw new ContractValidationError(\n `Namespace \"${namespaceId}\" table \"${tableName}\" index on columns [${index.columns.join(', ')}] has invalid options for type \"${index.type}\": ${result.summary}`,\n 'storage',\n );\n }\n }\n }\n }\n}\n"],"mappings":";;;AAMA,SAAgB,mBACd,UACA,mBACM;CACN,KAAK,MAAM,CAAC,aAAa,OAAO,OAAO,QAAQ,SAAS,QAAQ,UAAU,GACxE,KAAK,MAAM,CAAC,WAAW,aAAa,OAAO,QAAQ,GAAG,MAAM,GAAG;EAC7D,MAAM,QAAQ;EACd,KAAK,MAAM,SAAS,MAAM,SAAS;GACjC,IAAI,MAAM,SAAS,KAAA,KAAa,MAAM,YAAY,KAAA,GAChD,MAAM,IAAI,wBACR,cAAc,YAAY,WAAW,UAAU,sBAAsB,MAAM,QAAQ,KAAK,IAAI,EAAE,+BAC9F,SACF;GAEF,IAAI,MAAM,SAAS,KAAA,GAAW;GAC9B,MAAM,QAAQ,kBAAkB,IAAI,MAAM,IAAI;GAC9C,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,wBACR,cAAc,YAAY,WAAW,UAAU,sBAAsB,MAAM,QAAQ,KAAK,IAAI,EAAE,kCAAkC,MAAM,KAAK,IAC3I,SACF;GAEF,MAAM,eAAe,MAAM,WAAW,CAAC;GACvC,MAAM,SAAS,MAAM,QAAQ,YAAY;GACzC,IAAI,kBAAkB,KAAK,QACzB,MAAM,IAAI,wBACR,cAAc,YAAY,WAAW,UAAU,sBAAsB,MAAM,QAAQ,KAAK,IAAI,EAAE,kCAAkC,MAAM,KAAK,KAAK,OAAO,WACvJ,SACF;EAEJ;CACF;AAEJ"}
1
+ {"version":3,"file":"index-type-validation.mjs","names":[],"sources":["../src/index-type-validation.ts"],"sourcesContent":["import { ContractValidationError } from '@prisma-next/contract/contract-validation-error';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { type } from 'arktype';\nimport type { IndexTypeRegistry } from './index-types';\nimport type { SqlStorage, StorageTable } from './types';\n\nexport function validateIndexTypes(\n contract: Contract<SqlStorage>,\n indexTypeRegistry: IndexTypeRegistry,\n): void {\n for (const [namespaceId, ns] of Object.entries(contract.storage.namespaces)) {\n for (const [tableName, rawTable] of Object.entries(ns.entries.table)) {\n const table = rawTable as StorageTable;\n for (const index of table.indexes) {\n if (index.type === undefined && index.options !== undefined) {\n throw new ContractValidationError(\n `Namespace \"${namespaceId}\" table \"${tableName}\" index on columns [${index.columns.join(', ')}] has options without a type`,\n 'storage',\n );\n }\n if (index.type === undefined) continue;\n const entry = indexTypeRegistry.get(index.type);\n if (entry === undefined) {\n throw new ContractValidationError(\n `Namespace \"${namespaceId}\" table \"${tableName}\" index on columns [${index.columns.join(', ')}] uses unregistered index type \"${index.type}\"`,\n 'storage',\n );\n }\n const optionsValue = index.options ?? {};\n const result = entry.options(optionsValue);\n if (result instanceof type.errors) {\n throw new ContractValidationError(\n `Namespace \"${namespaceId}\" table \"${tableName}\" index on columns [${index.columns.join(', ')}] has invalid options for type \"${index.type}\": ${result.summary}`,\n 'storage',\n );\n }\n }\n }\n }\n}\n"],"mappings":";;;AAMA,SAAgB,mBACd,UACA,mBACM;CACN,KAAK,MAAM,CAAC,aAAa,OAAO,OAAO,QAAQ,SAAS,QAAQ,UAAU,GACxE,KAAK,MAAM,CAAC,WAAW,aAAa,OAAO,QAAQ,GAAG,QAAQ,KAAK,GAAG;EACpE,MAAM,QAAQ;EACd,KAAK,MAAM,SAAS,MAAM,SAAS;GACjC,IAAI,MAAM,SAAS,KAAA,KAAa,MAAM,YAAY,KAAA,GAChD,MAAM,IAAI,wBACR,cAAc,YAAY,WAAW,UAAU,sBAAsB,MAAM,QAAQ,KAAK,IAAI,EAAE,+BAC9F,SACF;GAEF,IAAI,MAAM,SAAS,KAAA,GAAW;GAC9B,MAAM,QAAQ,kBAAkB,IAAI,MAAM,IAAI;GAC9C,IAAI,UAAU,KAAA,GACZ,MAAM,IAAI,wBACR,cAAc,YAAY,WAAW,UAAU,sBAAsB,MAAM,QAAQ,KAAK,IAAI,EAAE,kCAAkC,MAAM,KAAK,IAC3I,SACF;GAEF,MAAM,eAAe,MAAM,WAAW,CAAC;GACvC,MAAM,SAAS,MAAM,QAAQ,YAAY;GACzC,IAAI,kBAAkB,KAAK,QACzB,MAAM,IAAI,wBACR,cAAc,YAAY,WAAW,UAAU,sBAAsB,MAAM,QAAQ,KAAK,IAAI,EAAE,kCAAkC,MAAM,KAAK,KAAK,OAAO,WACvJ,SACF;EAEJ;CACF;AAEJ"}
@@ -28,4 +28,4 @@ interface IndexTypeRegistry {
28
28
  declare function createIndexTypeRegistry(): IndexTypeRegistry;
29
29
  //#endregion
30
30
  export { IndexTypeRegistry as a, IndexTypeRegistration as i, IndexTypeEntry as n, createIndexTypeRegistry as o, IndexTypeMap as r, defineIndexTypes as s, IndexTypeBuilder as t };
31
- //# sourceMappingURL=index-types-B1cf5N0F.d.mts.map
31
+ //# sourceMappingURL=index-types-Czsyu7Iw.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-types-B1cf5N0F.d.mts","names":[],"sources":["../src/index-types.ts"],"mappings":";;;UAEiB,cAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA,EAAS,IAAI,CAAC,QAAA;AAAA;AAAA,KAGb,YAAA;EAAA,SAAoD,OAAO;AAAA;AAAA,UAEtD,qBAAA,cAAmC,YAAA,GAAe,MAAA;EAAA,SACxD,UAAA,EAAY,IAAA;EAAA,SACZ,OAAA,EAAS,aAAA,CAAc,cAAA;AAAA;AAAA,UAGjB,gBAAA,cAA8B,YAAA,GAAe,MAAA,wBACpD,qBAAA,CAAsB,IAAA;EAC9B,GAAA,6BACE,WAAA,EAAa,IAAA,EACb,KAAA;IAAA,SAAkB,OAAA,EAAS,IAAA,CAAK,KAAA;EAAA,IAC/B,gBAAA,CAAiB,IAAA,GAAO,MAAA,CAAO,IAAA;IAAA,SAAiB,OAAA,EAAS,KAAA;EAAA;AAAA;AAAA,iBA0B9C,gBAAA,CAAA,GAAoB,gBAAgB,CAAC,MAAA;AAAA,UAIpC,iBAAA;EACf,QAAA,CAAS,KAAA,EAAO,cAAA;EAChB,GAAA,CAAI,WAAA,WAAsB,cAAc;EACxC,GAAA,CAAI,WAAA;AAAA;AAAA,iBAsBU,uBAAA,CAAA,GAA2B,iBAAiB"}
1
+ {"version":3,"file":"index-types-Czsyu7Iw.d.mts","names":[],"sources":["../src/index-types.ts"],"mappings":";;;UAEiB,cAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA,EAAS,IAAI,CAAC,QAAA;AAAA;AAAA,KAGb,YAAA;EAAA,SAAoD,OAAO;AAAA;AAAA,UAEtD,qBAAA,cAAmC,YAAA,GAAe,MAAA;EAAA,SACxD,UAAA,EAAY,IAAA;EAAA,SACZ,OAAA,EAAS,aAAA,CAAc,cAAA;AAAA;AAAA,UAGjB,gBAAA,cAA8B,YAAA,GAAe,MAAA,wBACpD,qBAAA,CAAsB,IAAA;EAC9B,GAAA,6BACE,WAAA,EAAa,IAAA,EACb,KAAA;IAAA,SAAkB,OAAA,EAAS,IAAA,CAAK,KAAA;EAAA,IAC/B,gBAAA,CAAiB,IAAA,GAAO,MAAA,CAAO,IAAA;IAAA,SAAiB,OAAA,EAAS,KAAA;EAAA;AAAA;AAAA,iBA0B9C,gBAAA,IAAoB,gBAAgB,CAAC,MAAA;AAAA,UAIpC,iBAAA;EACf,QAAA,CAAS,KAAA,EAAO,cAAA;EAChB,GAAA,CAAI,WAAA,WAAsB,cAAc;EACxC,GAAA,CAAI,WAAA;AAAA;AAAA,iBAsBU,uBAAA,IAA2B,iBAAiB"}
@@ -1,2 +1,2 @@
1
- import { a as IndexTypeRegistry, i as IndexTypeRegistration, n as IndexTypeEntry, o as createIndexTypeRegistry, r as IndexTypeMap, s as defineIndexTypes, t as IndexTypeBuilder } from "./index-types-B1cf5N0F.mjs";
1
+ import { a as IndexTypeRegistry, i as IndexTypeRegistration, n as IndexTypeEntry, o as createIndexTypeRegistry, r as IndexTypeMap, s as defineIndexTypes, t as IndexTypeBuilder } from "./index-types-Czsyu7Iw.mjs";
2
2
  export { type IndexTypeBuilder, type IndexTypeEntry, type IndexTypeMap, type IndexTypeRegistration, type IndexTypeRegistry, createIndexTypeRegistry, defineIndexTypes };
@@ -9,5 +9,5 @@ interface StorageTypeMetadata {
9
9
  readonly nativeType?: string;
10
10
  }
11
11
  //#endregion
12
- export { type StorageTypeMetadata };
12
+ export type { StorageTypeMetadata };
13
13
  //# sourceMappingURL=pack-types.d.mts.map
@@ -0,0 +1,17 @@
1
+ import { m as StorageTable, r as SqlStorage } from "./sql-storage-CaAh0nd3.mjs";
2
+
3
+ //#region src/resolve-storage-table.d.ts
4
+ interface ResolvedStorageTable {
5
+ readonly namespaceId: string;
6
+ readonly table: StorageTable;
7
+ }
8
+ /**
9
+ * Resolve a bare storage table name to its namespace coordinate and table IR by
10
+ * scanning the contract's namespaces. For the single-namespace contracts in
11
+ * scope the scan is exact; cross-namespace bare-name collisions are selected
12
+ * explicitly (TML-2550).
13
+ */
14
+ declare function resolveStorageTable(storage: SqlStorage, tableName: string): ResolvedStorageTable | undefined;
15
+ //#endregion
16
+ export { type ResolvedStorageTable, resolveStorageTable };
17
+ //# sourceMappingURL=resolve-storage-table.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-storage-table.d.mts","names":[],"sources":["../src/resolve-storage-table.ts"],"mappings":";;;UAGiB,oBAAA;EAAA,SACN,WAAA;EAAA,SACA,KAAA,EAAO,YAAY;AAAA;;;;;;AAAA;iBAuBd,mBAAA,CACd,OAAA,EAAS,UAAA,EACT,SAAA,WACC,oBAAoB"}
@@ -0,0 +1,26 @@
1
+ //#region src/resolve-storage-table.ts
2
+ function tableInNamespace(namespace, tableName) {
3
+ if (namespace === void 0) return;
4
+ const tables = namespace.entries.table;
5
+ if (!Object.hasOwn(tables, tableName)) return;
6
+ return tables[tableName];
7
+ }
8
+ /**
9
+ * Resolve a bare storage table name to its namespace coordinate and table IR by
10
+ * scanning the contract's namespaces. For the single-namespace contracts in
11
+ * scope the scan is exact; cross-namespace bare-name collisions are selected
12
+ * explicitly (TML-2550).
13
+ */
14
+ function resolveStorageTable(storage, tableName) {
15
+ for (const namespaceId of Object.keys(storage.namespaces)) {
16
+ const table = tableInNamespace(storage.namespaces[namespaceId], tableName);
17
+ if (table !== void 0) return {
18
+ namespaceId,
19
+ table
20
+ };
21
+ }
22
+ }
23
+ //#endregion
24
+ export { resolveStorageTable };
25
+
26
+ //# sourceMappingURL=resolve-storage-table.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-storage-table.mjs","names":[],"sources":["../src/resolve-storage-table.ts"],"sourcesContent":["import type { SqlNamespace, SqlStorage } from './ir/sql-storage';\nimport type { StorageTable } from './ir/storage-table';\n\nexport interface ResolvedStorageTable {\n readonly namespaceId: string;\n readonly table: StorageTable;\n}\n\nfunction tableInNamespace(\n namespace: SqlNamespace | undefined,\n tableName: string,\n): StorageTable | undefined {\n if (namespace === undefined) {\n return undefined;\n }\n const tables = namespace.entries.table;\n if (!Object.hasOwn(tables, tableName)) {\n return undefined;\n }\n return tables[tableName];\n}\n\n/**\n * Resolve a bare storage table name to its namespace coordinate and table IR by\n * scanning the contract's namespaces. For the single-namespace contracts in\n * scope the scan is exact; cross-namespace bare-name collisions are selected\n * explicitly (TML-2550).\n */\nexport function resolveStorageTable(\n storage: SqlStorage,\n tableName: string,\n): ResolvedStorageTable | undefined {\n for (const namespaceId of Object.keys(storage.namespaces)) {\n const table = tableInNamespace(storage.namespaces[namespaceId], tableName);\n if (table !== undefined) {\n return { namespaceId, table };\n }\n }\n\n return undefined;\n}\n"],"mappings":";AAQA,SAAS,iBACP,WACA,WAC0B;CAC1B,IAAI,cAAc,KAAA,GAChB;CAEF,MAAM,SAAS,UAAU,QAAQ;CACjC,IAAI,CAAC,OAAO,OAAO,QAAQ,SAAS,GAClC;CAEF,OAAO,OAAO;AAChB;;;;;;;AAQA,SAAgB,oBACd,SACA,WACkC;CAClC,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG;EACzD,MAAM,QAAQ,iBAAiB,QAAQ,WAAW,cAAc,SAAS;EACzE,IAAI,UAAU,KAAA,GACZ,OAAO;GAAE;GAAa;EAAM;CAEhC;AAGF"}
@@ -1,6 +1,5 @@
1
- import { IRNodeBase, Namespace, NamespaceBase, Storage, StorageType } from "@prisma-next/framework-components/ir";
2
- import { ColumnDefault, ControlPolicy, NamespaceId, StorageHashBase } from "@prisma-next/contract/types";
3
- import { CodecTrait } from "@prisma-next/framework-components/codec";
1
+ import { IRNodeBase, Namespace, Storage, StorageType } from "@prisma-next/framework-components/ir";
2
+ import { ColumnDefault, ControlPolicy, NamespaceId, StorageHashBase, ValueSetRef } from "@prisma-next/contract/types";
4
3
 
5
4
  //#region src/ir/sql-node.d.ts
6
5
  /**
@@ -41,15 +40,36 @@ declare abstract class SqlNode extends IRNodeBase {
41
40
  }
42
41
  //#endregion
43
42
  //#region src/ir/foreign-key-reference.d.ts
43
+ /**
44
+ * Input for a foreign-key reference (one side of a foreign-key declaration).
45
+ *
46
+ * When `spaceId` is absent the reference is local — the referenced table lives
47
+ * in the same contract-space. When `spaceId` is present the reference is
48
+ * cross-space — the referenced table lives in a different contract-space
49
+ * identified by `spaceId`.
50
+ *
51
+ * Presence-based discrimination keeps local FK JSON byte-identical to
52
+ * contracts authored before cross-space support was added.
53
+ */
44
54
  interface ForeignKeyReferenceInput {
45
55
  readonly namespaceId: string;
46
56
  readonly tableName: string;
47
57
  readonly columns: readonly string[];
58
+ readonly spaceId?: string;
48
59
  }
49
60
  /**
50
61
  * SQL Contract IR node for one side (source or target) of a foreign-key
51
62
  * declaration. Carries the full coordinate: namespace, table, and columns.
52
63
  *
64
+ * Cross-space discrimination is based on `spaceId` presence: absent means
65
+ * local (same contract-space); present means cross-space (the referenced
66
+ * table lives in the contract-space identified by `spaceId`).
67
+ *
68
+ * For local references `spaceId` is absent from JSON, keeping the serialized
69
+ * shape byte-identical to contracts authored before cross-space support was
70
+ * added. For cross-space references `spaceId` appears in JSON so round-trips
71
+ * are lossless.
72
+ *
53
73
  * Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`
54
74
  * as the sentinel `namespaceId` for single-namespace (unbound) references.
55
75
  */
@@ -57,6 +77,7 @@ declare class ForeignKeyReference extends SqlNode {
57
77
  readonly namespaceId: NamespaceId;
58
78
  readonly tableName: string;
59
79
  readonly columns: readonly string[];
80
+ readonly spaceId?: string;
60
81
  constructor(input: ForeignKeyReferenceInput);
61
82
  }
62
83
  //#endregion
@@ -96,57 +117,6 @@ declare class ForeignKey extends SqlNode {
96
117
  constructor(input: ForeignKeyInput);
97
118
  }
98
119
  //#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
- readonly control?: ControlPolicy;
142
- }
143
- /**
144
- * Narrow a polymorphic `StorageType` entry to the Postgres-enum shape
145
- * via its enumerable `kind` discriminator. Type guard returns true for
146
- * both live `PostgresEnumType` instances and raw JSON envelopes.
147
- */
148
- declare function isPostgresEnumStorageEntry(value: unknown): value is PostgresEnumStorageEntry;
149
- //#endregion
150
120
  //#region src/ir/primary-key.d.ts
151
121
  interface PrimaryKeyInput {
152
122
  readonly columns: readonly string[];
@@ -203,6 +173,7 @@ interface StorageColumnInput {
203
173
  readonly typeRef?: string;
204
174
  readonly default?: ColumnDefault;
205
175
  readonly control?: ControlPolicy;
176
+ readonly valueSet?: ValueSetRef;
206
177
  }
207
178
  /**
208
179
  * SQL Contract IR node for a single column entry in `StorageTable.columns`.
@@ -225,6 +196,7 @@ declare class StorageColumn extends SqlNode {
225
196
  readonly typeRef?: string;
226
197
  readonly default?: ColumnDefault;
227
198
  readonly control?: ControlPolicy;
199
+ readonly valueSet?: ValueSetRef;
228
200
  constructor(input: StorageColumnInput);
229
201
  }
230
202
  //#endregion
@@ -319,18 +291,56 @@ declare function toStorageTypeInstance(input: StorageTypeInstanceInput): Storage
319
291
  */
320
292
  declare function isStorageTypeInstance(value: unknown): value is StorageTypeInstance;
321
293
  //#endregion
294
+ //#region src/ir/storage-value-set.d.ts
295
+ /**
296
+ * Hydration / construction input shape for {@link StorageValueSet}.
297
+ * Mirrors the on-disk storage JSON envelope so the serializer hydration
298
+ * walker can hand a validated literal straight to `new`.
299
+ */
300
+ interface StorageValueSetInput {
301
+ readonly kind: 'value-set';
302
+ /** Ordered permitted values, codec-encoded. Declaration order is preserved. */
303
+ readonly values: readonly string[];
304
+ }
305
+ /**
306
+ * SQL Contract IR node for a value-set entry in a namespace's `valueSet`
307
+ * map (`SqlNamespace.entries.valueSet`).
308
+ *
309
+ * A value-set records the ordered set of permitted codec-encoded values for
310
+ * an enum-like column restriction. It does not carry a `codecId` — the
311
+ * column that references it already holds the codec; the value-set holds
312
+ * only the permitted values.
313
+ *
314
+ * The node's `kind` is enumerable (`'value-set'`) so the JSON envelope
315
+ * carries the discriminator and the serializer hydration walker can
316
+ * dispatch on it. This follows the per-leaf enumerable-kind convention
317
+ * established in the SQL-node comment (future polymorphic dispatch on
318
+ * namespace entries needs the discriminator in JSON).
319
+ *
320
+ * The entry's name is not on the class — value-sets are keyed by name in
321
+ * the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
322
+ */
323
+ declare class StorageValueSet extends SqlNode {
324
+ readonly kind: "value-set";
325
+ readonly values: readonly string[];
326
+ constructor(input: StorageValueSetInput);
327
+ }
328
+ //#endregion
322
329
  //#region src/ir/sql-storage.d.ts
323
330
  /**
324
331
  * Polymorphic value type for document-scoped `SqlStorage.types` entries
325
- * (codec aliases / parameterised native type registrations). Postgres
326
- * native enum registrations live under
327
- * `storage.namespaces[namespaceId].enum` instead.
332
+ * (codec aliases / parameterised native type registrations).
333
+ *
334
+ * Postgres native enum registrations live under the postgres-specific
335
+ * `entries.type` slot on `PostgresSchema` (target layer), not here.
328
336
  */
329
- type SqlStorageTypeEntry = StorageTypeInstance | StorageTypeInstanceInput | PostgresEnumStorageEntry;
337
+ type SqlStorageTypeEntry = StorageTypeInstance | StorageTypeInstanceInput;
330
338
  interface SqlNamespaceTablesInput {
331
339
  readonly id: string;
332
- readonly tables?: Record<string, StorageTable | StorageTableInput>;
333
- readonly enum?: Record<string, PostgresEnumStorageEntry>;
340
+ readonly entries: {
341
+ readonly table: Record<string, StorageTable | StorageTableInput>;
342
+ readonly valueSet?: Record<string, StorageValueSet | StorageValueSetInput>;
343
+ };
334
344
  }
335
345
  interface SqlStorageInput<THash extends string = string> {
336
346
  readonly storageHash: StorageHashBase<THash>;
@@ -353,161 +363,31 @@ interface SqlStorageInput<THash extends string = string> {
353
363
  *
354
364
  * The constructor normalises optional `types` into class instances.
355
365
  * `types` is polymorphic per Decision 18 Option B: codec-triple inputs
356
- * are stamped with `kind: 'codec-instance'`; class-instance kinds
357
- * (e.g. Postgres-enum entries satisfying `PostgresEnumStorageEntry`)
358
- * pass through; hydration of raw JSON class-instance entries (carrying
359
- * their narrower `kind` literal) is the per-target serializer's
360
- * responsibility (so the family base does not import target-specific
361
- * subclasses).
366
+ * are stamped with `kind: 'codec-instance'`; hydration of raw JSON
367
+ * class-instance entries (carrying their narrower `kind` literal) is
368
+ * the per-target serializer's responsibility (so the family base does
369
+ * not import target-specific subclasses).
362
370
  */
363
371
  type SqlNamespace = Namespace & {
364
- readonly tables: Readonly<Record<string, StorageTable>>;
365
- readonly enum?: Readonly<Record<string, PostgresEnumStorageEntry>>;
372
+ readonly entries: Readonly<{
373
+ readonly table: Readonly<Record<string, StorageTable>>;
374
+ readonly valueSet?: Readonly<Record<string, StorageValueSet>>;
375
+ }>;
376
+ /**
377
+ * Render a dialect-qualified table reference for runtime SQL emission.
378
+ * Present on materialised target concretions (`PostgresSchema`,
379
+ * `SqliteDatabase`, …) and family placeholders; omitted on emitted
380
+ * contract structural namespace literals (methods are not serialised).
381
+ */
382
+ qualifyTable?(tableName: string): string;
366
383
  };
367
384
  declare class SqlStorage<THash extends string = string> extends SqlNode implements Storage {
368
385
  readonly storageHash: StorageHashBase<THash>;
369
386
  readonly namespaces: Readonly<Record<string, SqlNamespace>>;
370
- readonly types?: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>;
387
+ readonly types?: Readonly<Record<string, StorageTypeInstance>>;
371
388
  constructor(input: SqlStorageInput<THash>);
372
389
  }
390
+ declare function storageTableAt(storage: SqlStorage, namespaceId: string, tableName: string): StorageTable | undefined;
373
391
  //#endregion
374
- //#region src/ir/build-sql-namespace.d.ts
375
- declare function buildSqlNamespace(input: SqlNamespaceTablesInput): SqlNamespace;
376
- declare function buildSqlNamespaceMap(namespaces: Readonly<Record<string, Namespace | SqlNamespaceTablesInput>>): Readonly<Record<string, SqlNamespace>>;
377
- //#endregion
378
- //#region src/ir/sql-unbound-namespace.d.ts
379
- /**
380
- * Family-layer placeholder for the SQL unbound-namespace singleton —
381
- * the late-bound slot whose binding the target resolves at connection
382
- * time rather than at authoring time.
383
- *
384
- * SQL contracts honour the framework `Storage.namespaces` invariant from
385
- * the moment they appear in the IR. Today `SqlStorage` is family-shared
386
- * (Postgres + SQLite consume the same class); a per-target namespace
387
- * concretion (`PostgresSchema.unbound`, `SqliteUnboundDatabase.instance`)
388
- * earns its existence when each target's namespace shape lands. Until
389
- * then the family ships a single placeholder singleton so the JSON
390
- * envelope and runtime walk are honest at every layer.
391
- *
392
- * The `kind` discriminator is installed as a non-enumerable own property
393
- * so the JSON envelope reads `{ "id": "__unbound__" }` — symmetric
394
- * with the family-level non-enumerable `kind` on `SqlNode` and bounded
395
- * to the minimum data the framework `Namespace` interface promises.
396
- *
397
- * **Freeze-trap warning.** The leaf constructor calls
398
- * `freezeNode(this)` after installing `kind`. The leaf-class shape
399
- * works today only because `NamespaceBase` does NOT freeze in its
400
- * constructor — the `Object.defineProperty(this, 'kind', …)` call after
401
- * `super()` succeeds because the instance is still mutable at that
402
- * point. Subclasses that add instance fields will still hit the freeze
403
- * trap once leaf-class `freezeNode(this)` runs; and if a future
404
- * framework change lifts the freeze to `NamespaceBase`, even the
405
- * `defineProperty` here would silently fail. To add subclass instance
406
- * fields safely, lift `freezeNode` to a leaf-class `seal()` hook each
407
- * leaf calls explicitly at the end of its own constructor.
408
- */
409
- declare class SqlUnboundNamespace extends NamespaceBase {
410
- static readonly instance: SqlUnboundNamespace;
411
- readonly id: "__unbound__";
412
- readonly tables: Readonly<Record<string, StorageTable>>;
413
- readonly kind: string;
414
- private constructor();
415
- }
416
- //#endregion
417
- //#region src/types.d.ts
418
- type ForeignKeyOptions = {
419
- readonly name?: string;
420
- readonly onDelete?: ReferentialAction;
421
- readonly onUpdate?: ReferentialAction;
422
- };
423
- type SqlModelFieldStorage = {
424
- readonly column: string;
425
- readonly codecId?: string;
426
- readonly nullable?: boolean;
427
- };
428
- type SqlModelStorage = {
429
- readonly table: string;
430
- readonly fields: Record<string, SqlModelFieldStorage>;
431
- };
432
- declare const DEFAULT_FK_CONSTRAINT = true;
433
- declare const DEFAULT_FK_INDEX = true;
434
- declare function applyFkDefaults(fk: {
435
- constraint?: boolean | undefined;
436
- index?: boolean | undefined;
437
- }, overrideDefaults?: {
438
- constraint?: boolean | undefined;
439
- index?: boolean | undefined;
440
- }): {
441
- constraint: boolean;
442
- index: boolean;
443
- };
444
- type TypeMaps<TCodecTypes extends Record<string, {
445
- output: unknown;
446
- }> = 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>> = {
447
- readonly codecTypes: TCodecTypes;
448
- readonly queryOperationTypes: TQueryOperationTypes;
449
- readonly fieldOutputTypes: TFieldOutputTypes;
450
- readonly fieldInputTypes: TFieldInputTypes;
451
- };
452
- type CodecTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
453
- readonly codecTypes: infer C;
454
- } ? C extends Record<string, {
455
- output: unknown;
456
- }> ? C : Record<string, never> : Record<string, never>;
457
- /**
458
- * Dispatch hint identifying the first-argument target of an operation.
459
- *
460
- * Used by ORM column helpers to decide whether an operation is reachable on a
461
- * field. Either names a concrete codec identity or a set of capability traits
462
- * that the field's codec must carry.
463
- */
464
- type QueryOperationSelfSpec = {
465
- readonly codecId: string;
466
- readonly traits?: never;
467
- } | {
468
- readonly traits: readonly CodecTrait[];
469
- readonly codecId?: never;
470
- };
471
- /**
472
- * Structural shape an operation's impl must return: any value carrying a
473
- * codec-exact `returnType` descriptor. `Expression<T>` (from
474
- * `@prisma-next/sql-relational-core/expression`, with `T extends ScopeField`)
475
- * extends this. Trait-targeted returns are deliberately excluded — predicate
476
- * detection and result decoding both depend on knowing the concrete return
477
- * codec.
478
- */
479
- type QueryOperationReturn = {
480
- readonly returnType: {
481
- readonly codecId: string;
482
- readonly nullable: boolean;
483
- };
484
- };
485
- type QueryOperationTypeEntry = {
486
- readonly self?: QueryOperationSelfSpec;
487
- readonly impl: (...args: never[]) => QueryOperationReturn;
488
- };
489
- type SqlQueryOperationTypes<_CT extends Record<string, {
490
- readonly input: unknown;
491
- readonly output: unknown;
492
- }>, T extends Record<string, QueryOperationTypeEntry>> = T;
493
- type QueryOperationTypesBase = Record<string, QueryOperationTypeEntry>;
494
- type QueryOperationTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
495
- readonly queryOperationTypes: infer Q;
496
- } ? Q extends Record<string, unknown> ? Q : Record<string, never> : Record<string, never>;
497
- type TypeMapsPhantomKey = '__@prisma-next/sql-contract/typeMaps@__';
498
- type ContractWithTypeMaps<TContract, TTypeMaps> = TContract & { readonly [K in TypeMapsPhantomKey]?: TTypeMaps };
499
- type ExtractTypeMapsFromContract<T> = TypeMapsPhantomKey extends keyof T ? NonNullable<T[TypeMapsPhantomKey & keyof T]> : never;
500
- type FieldOutputTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
501
- readonly fieldOutputTypes: infer F;
502
- } ? F extends Record<string, Record<string, unknown>> ? F : Record<string, never> : Record<string, never>;
503
- type FieldInputTypesOf<T> = [T] extends [never] ? Record<string, never> : T extends {
504
- readonly fieldInputTypes: infer F;
505
- } ? F extends Record<string, Record<string, unknown>> ? F : Record<string, never> : Record<string, never>;
506
- type ExtractCodecTypes<T> = CodecTypesOf<ExtractTypeMapsFromContract<T>>;
507
- type ExtractQueryOperationTypes<T> = QueryOperationTypesOf<ExtractTypeMapsFromContract<T>>;
508
- type ExtractFieldOutputTypes<T> = FieldOutputTypesOf<ExtractTypeMapsFromContract<T>>;
509
- type ExtractFieldInputTypes<T> = FieldInputTypesOf<ExtractTypeMapsFromContract<T>>;
510
- type ResolveCodecTypes<TContract, TTypeMaps> = [TTypeMaps] extends [never] ? ExtractCodecTypes<TContract> : CodecTypesOf<TTypeMaps>;
511
- //#endregion
512
- 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 };
513
- //# sourceMappingURL=types-Cx_5A_L0.d.mts.map
392
+ export { PrimaryKeyInput as C, ForeignKeyReference as D, ReferentialAction as E, ForeignKeyReferenceInput as O, PrimaryKey as S, ForeignKeyInput as T, UniqueConstraintInput as _, SqlStorageTypeEntry as a, Index as b, StorageValueSetInput as c, StorageTypeInstanceInput as d, isStorageTypeInstance as f, UniqueConstraint as g, StorageTableInput as h, SqlStorageInput as i, SqlNode as k, CODEC_INSTANCE_KIND as l, StorageTable as m, SqlNamespaceTablesInput as n, storageTableAt as o, toStorageTypeInstance as p, SqlStorage as r, StorageValueSet as s, SqlNamespace as t, StorageTypeInstance as u, StorageColumn as v, ForeignKey as w, IndexInput as x, StorageColumnInput as y };
393
+ //# sourceMappingURL=sql-storage-CaAh0nd3.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-storage-CaAh0nd3.d.mts","names":[],"sources":["../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/storage-type-instance.ts","../src/ir/storage-value-set.ts","../src/ir/sql-storage.ts"],"mappings":"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"}