@prisma-next/sql-contract 0.16.0-dev.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 matchesPathPattern,\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 // A column default's literal payload is data, not shape — `{ kind:\n // 'literal', value: false }` (or `value: []`) must survive the\n // default-omission walk or the emitted contract fails its own\n // validation on the next read (CONTRACT.VALIDATION_FAILED on `Boolean @default(false)`).\n ['storage', 'namespaces', '*', 'entries', 'table', '*', 'columns', '*', 'default', 'value'],\n] as const satisfies readonly PathPattern[];\n\n// A literal column default's value is user data, not omittable structure:\n// `@default(false)` (and empty objects/arrays at any depth inside the value)\n// must survive canonicalization, or the emitted contract fails the runtime's\n// structural validation with `default.value … (was missing)`.\nconst columnDefaultValuePrefix = [\n 'storage',\n 'namespaces',\n '*',\n 'entries',\n 'table',\n '*',\n 'columns',\n '*',\n 'default',\n 'value',\n] as const satisfies PathPattern;\n\nconst isColumnDefaultValuePath = (path: readonly string[]): boolean =>\n path.length >= columnDefaultValuePrefix.length &&\n matchesPathPattern(path.slice(0, columnDefaultValuePrefix.length), columnDefaultValuePrefix);\n\nconst sortTargets = [\n { path: ['namespaces', '*', 'entries', 'table', '*'], arrayKeys: ['indexes', 'uniques'] },\n] as const satisfies readonly NamedArraySortTarget[];\n\nconst matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);\n\nconst shouldPreserveEmpty: PreserveEmptyPredicate = (path) =>\n isColumnDefaultValuePath(path) || matchesPreserveEmptyPattern(path);\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":";;AASA,MAAM,wBAAwB;CAC5B;EAAC;EAAW;EAAc;EAAK;EAAW;CAAO;CACjD;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;CAAG;CACtD;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;EAAK;GAAC;GAAW;GAAW;EAAa;CAAC;CAK7F;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;EAAK;EAAW;EAAK;EAAW;CAAO;AAC5F;AAMA,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,4BAA4B,SAChC,KAAK,UAAU,yBAAyB,UACxC,mBAAmB,KAAK,MAAM,GAAG,yBAAyB,MAAM,GAAG,wBAAwB;AAE7F,MAAM,cAAc,CAClB;CAAE,MAAM;EAAC;EAAc;EAAK;EAAW;EAAS;CAAG;CAAG,WAAW,CAAC,WAAW,SAAS;AAAE,CAC1F;AAEA,MAAM,8BAA8B,6BAA6B,qBAAqB;AAEtF,MAAM,uBAA+C,SACnD,yBAAyB,IAAI,KAAK,4BAA4B,IAAI;AAIpE,MAAa,mCAGT;CACF;CACA,aAP+B,kBAAkB,WAOjD;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 matchesPathPattern,\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 // A column default's literal payload is data, not shape — `{ kind:\n // 'literal', value: false }` (or `value: []`) must survive the\n // default-omission walk or the emitted contract fails its own\n // validation on the next read (PN-CLI-4003 on `Boolean @default(false)`).\n ['storage', 'namespaces', '*', 'entries', 'table', '*', 'columns', '*', 'default', 'value'],\n] as const satisfies readonly PathPattern[];\n\n// A literal column default's value is user data, not omittable structure:\n// `@default(false)` (and empty objects/arrays at any depth inside the value)\n// must survive canonicalization, or the emitted contract fails the runtime's\n// structural validation with `default.value … (was missing)`.\nconst columnDefaultValuePrefix = [\n 'storage',\n 'namespaces',\n '*',\n 'entries',\n 'table',\n '*',\n 'columns',\n '*',\n 'default',\n 'value',\n] as const satisfies PathPattern;\n\nconst isColumnDefaultValuePath = (path: readonly string[]): boolean =>\n path.length >= columnDefaultValuePrefix.length &&\n matchesPathPattern(path.slice(0, columnDefaultValuePrefix.length), columnDefaultValuePrefix);\n\nconst sortTargets = [\n { path: ['namespaces', '*', 'entries', 'table', '*'], arrayKeys: ['indexes', 'uniques'] },\n] as const satisfies readonly NamedArraySortTarget[];\n\nconst matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);\n\nconst shouldPreserveEmpty: PreserveEmptyPredicate = (path) =>\n isColumnDefaultValuePath(path) || matchesPreserveEmptyPattern(path);\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":";;AASA,MAAM,wBAAwB;CAC5B;EAAC;EAAW;EAAc;EAAK;EAAW;CAAO;CACjD;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;CAAG;CACtD;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;EAAK;GAAC;GAAW;GAAW;EAAa;CAAC;CAK7F;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;EAAK;EAAW;EAAK;EAAW;CAAO;AAC5F;AAMA,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,4BAA4B,SAChC,KAAK,UAAU,yBAAyB,UACxC,mBAAmB,KAAK,MAAM,GAAG,yBAAyB,MAAM,GAAG,wBAAwB;AAE7F,MAAM,cAAc,CAClB;CAAE,MAAM;EAAC;EAAc;EAAK;EAAW;EAAS;CAAG;CAAG,WAAW,CAAC,WAAW,SAAS;AAAE,CAC1F;AAEA,MAAM,8BAA8B,6BAA6B,qBAAqB;AAEtF,MAAM,uBAA+C,SACnD,yBAAyB,IAAI,KAAK,4BAA4B,IAAI;AAIpE,MAAa,mCAGT;CACF;CACA,aAP+B,kBAAkB,WAOjD;AACF"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-contract",
3
- "version": "0.16.0-dev.2",
3
+ "version": "0.16.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "SQL contract types, validators, and IR factories for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/contract": "0.16.0-dev.2",
10
- "@prisma-next/framework-components": "0.16.0-dev.2",
11
- "@prisma-next/sql-schema-ir": "0.16.0-dev.2",
12
- "@prisma-next/utils": "0.16.0-dev.2",
9
+ "@prisma-next/contract": "0.16.0",
10
+ "@prisma-next/framework-components": "0.16.0",
11
+ "@prisma-next/sql-schema-ir": "0.16.0",
12
+ "@prisma-next/utils": "0.16.0",
13
13
  "arktype": "^2.2.2"
14
14
  },
15
15
  "devDependencies": {
16
- "@prisma-next/test-utils": "0.16.0-dev.2",
17
- "@prisma-next/tsconfig": "0.16.0-dev.2",
18
- "@prisma-next/tsdown": "0.16.0-dev.2",
16
+ "@prisma-next/test-utils": "0.16.0",
17
+ "@prisma-next/tsconfig": "0.16.0",
18
+ "@prisma-next/tsdown": "0.16.0",
19
19
  "tsdown": "0.22.8",
20
20
  "typescript": "5.9.3",
21
21
  "vitest": "4.1.10"
@@ -14,7 +14,7 @@ const preserveEmptyPatterns = [
14
14
  // A column default's literal payload is data, not shape — `{ kind:
15
15
  // 'literal', value: false }` (or `value: []`) must survive the
16
16
  // default-omission walk or the emitted contract fails its own
17
- // validation on the next read (CONTRACT.VALIDATION_FAILED on `Boolean @default(false)`).
17
+ // validation on the next read (PN-CLI-4003 on `Boolean @default(false)`).
18
18
  ['storage', 'namespaces', '*', 'entries', 'table', '*', 'columns', '*', 'default', 'value'],
19
19
  ] as const satisfies readonly PathPattern[];
20
20