🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/sql-contract

Package Overview
Dependencies
Maintainers
4
Versions
1021
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/sql-contract - npm Package Compare versions

Comparing version
0.14.0-dev.82
to
0.14.0-dev.85
+1
-1
dist/canonicalization-hooks.d.mts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"canonicalization-hooks.d.mts","names":[],"sources":["../src/canonicalization-hooks.ts"],"mappings":";;;cA6Ba,gCAAA;EAAA,SACF,mBAAA,EAAqB,sBAAA;EAAA,SACrB,WAAA,EAAa,WAAW;AAAA"}
{"version":3,"file":"canonicalization-hooks.d.mts","names":[],"sources":["../src/canonicalization-hooks.ts"],"mappings":";;;cAqDa,gCAAA;EAAA,SACF,mBAAA,EAAqB,sBAAA;EAAA,SACrB,WAAA,EAAa,WAAW;AAAA"}

@@ -1,65 +0,83 @@

import { createPreserveEmptyPredicate, createStorageSort } from "@prisma-next/contract/hashing-utils";
const sqlContractCanonicalizationHooks = {
shouldPreserveEmpty: createPreserveEmptyPredicate([
import { createPreserveEmptyPredicate, createStorageSort, matchesPathPattern } from "@prisma-next/contract/hashing-utils";
//#region src/canonicalization-hooks.ts
const preserveEmptyPatterns = [
[
"storage",
"namespaces",
"*",
"entries",
"table"
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*"
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
[
"storage",
"namespaces",
"*",
"entries",
"table"
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*"
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
[
"uniques",
"indexes",
"foreignKeys"
]
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
"foreignKeys",
["constraint", "index"]
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
"columns",
"*",
"default",
"value"
"uniques",
"indexes",
"foreignKeys"
]
]),
sortStorage: createStorageSort([{
path: [
"namespaces",
"*",
"entries",
"table",
"*"
],
arrayKeys: ["indexes", "uniques"]
}])
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
"foreignKeys",
["constraint", "index"]
],
[
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
"columns",
"*",
"default",
"value"
]
];
const columnDefaultValuePrefix = [
"storage",
"namespaces",
"*",
"entries",
"table",
"*",
"columns",
"*",
"default",
"value"
];
const isColumnDefaultValuePath = (path) => path.length >= columnDefaultValuePrefix.length && matchesPathPattern(path.slice(0, columnDefaultValuePrefix.length), columnDefaultValuePrefix);
const sortTargets = [{
path: [
"namespaces",
"*",
"entries",
"table",
"*"
],
arrayKeys: ["indexes", "uniques"]
}];
const matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);
const shouldPreserveEmpty = (path) => isColumnDefaultValuePath(path) || matchesPreserveEmptyPattern(path);
const sqlContractCanonicalizationHooks = {
shouldPreserveEmpty,
sortStorage: createStorageSort(sortTargets)
};

@@ -66,0 +84,0 @@ //#endregion

@@ -1,1 +0,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 // 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\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":";AA6BA,MAAa,mCAGT;CACF,qBARA,6BAA6B;EAhB7B;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;EAK9F;GAAC;GAAW;GAAc;GAAK;GAAW;GAAS;GAAK;GAAW;GAAK;GAAW;EAAO;CAQ7D,CAQ7B;CACA,aAP+B,kBAAkB,CANjD;EAAE,MAAM;GAAC;GAAc;GAAK;GAAW;GAAS;EAAG;EAAG,WAAW,CAAC,WAAW,SAAS;CAAE,CAMvC,CAOjD;AACF"}
{"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 ['storage', 'namespaces', '*', 'entries', 'table', '*', 'foreignKeys', ['constraint', 'index']],\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;CAC7F;EAAC;EAAW;EAAc;EAAK;EAAW;EAAS;EAAK;EAAe,CAAC,cAAc,OAAO;CAAC;CAK9F;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"}
{
"name": "@prisma-next/sql-contract",
"version": "0.14.0-dev.82",
"version": "0.14.0-dev.85",
"license": "Apache-2.0",

@@ -9,11 +9,11 @@ "type": "module",

"dependencies": {
"@prisma-next/contract": "0.14.0-dev.82",
"@prisma-next/framework-components": "0.14.0-dev.82",
"@prisma-next/utils": "0.14.0-dev.82",
"@prisma-next/contract": "0.14.0-dev.85",
"@prisma-next/framework-components": "0.14.0-dev.85",
"@prisma-next/utils": "0.14.0-dev.85",
"arktype": "^2.2.2"
},
"devDependencies": {
"@prisma-next/test-utils": "0.14.0-dev.82",
"@prisma-next/tsconfig": "0.14.0-dev.82",
"@prisma-next/tsdown": "0.14.0-dev.82",
"@prisma-next/test-utils": "0.14.0-dev.85",
"@prisma-next/tsconfig": "0.14.0-dev.85",
"@prisma-next/tsdown": "0.14.0-dev.85",
"tsdown": "0.22.3",

@@ -20,0 +20,0 @@ "typescript": "5.9.3",

@@ -5,2 +5,3 @@ import type { PreserveEmptyPredicate, StorageSort } from '@prisma-next/contract/hashing';

createStorageSort,
matchesPathPattern,
type NamedArraySortTarget,

@@ -22,2 +23,23 @@ type PathPattern,

// A literal column default's value is user data, not omittable structure:
// `@default(false)` (and empty objects/arrays at any depth inside the value)
// must survive canonicalization, or the emitted contract fails the runtime's
// structural validation with `default.value … (was missing)`.
const columnDefaultValuePrefix = [
'storage',
'namespaces',
'*',
'entries',
'table',
'*',
'columns',
'*',
'default',
'value',
] as const satisfies PathPattern;
const isColumnDefaultValuePath = (path: readonly string[]): boolean =>
path.length >= columnDefaultValuePrefix.length &&
matchesPathPattern(path.slice(0, columnDefaultValuePrefix.length), columnDefaultValuePrefix);
const sortTargets = [

@@ -27,5 +49,7 @@ { path: ['namespaces', '*', 'entries', 'table', '*'], arrayKeys: ['indexes', 'uniques'] },

const shouldPreserveEmpty: PreserveEmptyPredicate =
createPreserveEmptyPredicate(preserveEmptyPatterns);
const matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);
const shouldPreserveEmpty: PreserveEmptyPredicate = (path) =>
isColumnDefaultValuePath(path) || matchesPreserveEmptyPattern(path);
const sortStorage: StorageSort = createStorageSort(sortTargets);

@@ -32,0 +56,0 @@