@prisma-next/mongo-contract 0.11.0-dev.56 → 0.11.0-dev.58
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.d.mts","names":[],"sources":["../src/canonicalization-hooks.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"canonicalization-hooks.d.mts","names":[],"sources":["../src/canonicalization-hooks.ts"],"mappings":";;;cAsBa,kCAAA;EAAA,SACF,mBAAA,EAAqB,sBAAsB;AAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPreserveEmptyPredicate } from "@prisma-next/contract/hashing-utils";
|
|
2
|
-
|
|
2
|
+
//#region src/canonicalization-hooks.ts
|
|
3
|
+
const matchesPreserveEmptyPattern = createPreserveEmptyPredicate([[
|
|
3
4
|
"storage",
|
|
4
5
|
"namespaces",
|
|
5
6
|
"*",
|
|
@@ -10,7 +11,9 @@ const mongoContractCanonicalizationHooks = { shouldPreserveEmpty: createPreserve
|
|
|
10
11
|
"*",
|
|
11
12
|
"collections",
|
|
12
13
|
"*"
|
|
13
|
-
]])
|
|
14
|
+
]]);
|
|
15
|
+
const shouldPreserveEmpty = (path) => path[path.length - 1] === "additionalProperties" || matchesPreserveEmptyPattern(path);
|
|
16
|
+
const mongoContractCanonicalizationHooks = { shouldPreserveEmpty };
|
|
14
17
|
//#endregion
|
|
15
18
|
export { mongoContractCanonicalizationHooks };
|
|
16
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalization-hooks.mjs","names":[],"sources":["../src/canonicalization-hooks.ts"],"sourcesContent":["import type { PreserveEmptyPredicate } from '@prisma-next/contract/hashing';\nimport {\n createPreserveEmptyPredicate,\n type PathPattern,\n} from '@prisma-next/contract/hashing-utils';\n\nconst preserveEmptyPatterns = [\n ['storage', 'namespaces', '*', 'collections'],\n ['storage', 'namespaces', '*', 'collections', '*'],\n] as const satisfies readonly PathPattern[];\n\nconst shouldPreserveEmpty: PreserveEmptyPredicate
|
|
1
|
+
{"version":3,"file":"canonicalization-hooks.mjs","names":[],"sources":["../src/canonicalization-hooks.ts"],"sourcesContent":["import type { PreserveEmptyPredicate } from '@prisma-next/contract/hashing';\nimport {\n createPreserveEmptyPredicate,\n type PathPattern,\n} from '@prisma-next/contract/hashing-utils';\n\nconst preserveEmptyPatterns = [\n ['storage', 'namespaces', '*', 'collections'],\n ['storage', 'namespaces', '*', 'collections', '*'],\n] as const satisfies readonly PathPattern[];\n\nconst matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);\n\n// `additionalProperties: false` is the closed-schema marker on a Mongo\n// `$jsonSchema` validator. It is injected at every object level — top-level\n// collections, nested embedded value objects, and each polymorphic `oneOf`\n// branch — so it appears at an unbounded set of paths that fixed-length path\n// patterns cannot enumerate. It is a meaningful constraint rather than an\n// omittable default, so preserve it wherever it occurs in a Mongo contract.\nconst shouldPreserveEmpty: PreserveEmptyPredicate = (path) =>\n path[path.length - 1] === 'additionalProperties' || matchesPreserveEmptyPattern(path);\n\nexport const mongoContractCanonicalizationHooks: {\n readonly shouldPreserveEmpty: PreserveEmptyPredicate;\n} = {\n shouldPreserveEmpty,\n};\n"],"mappings":";;AAWA,MAAM,8BAA8B,6BAA6B,CAJ/D;CAAC;CAAW;CAAc;CAAK;AAAa,GAC5C;CAAC;CAAW;CAAc;CAAK;CAAe;AAAG,CAGkC,CAAC;AAQtF,MAAM,uBAA+C,SACnD,KAAK,KAAK,SAAS,OAAO,0BAA0B,4BAA4B,IAAI;AAEtF,MAAa,qCAET,EACF,oBACF"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/mongo-contract",
|
|
3
|
-
"version": "0.11.0-dev.
|
|
3
|
+
"version": "0.11.0-dev.58",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "Contract types and validation for Prisma Next MongoDB support",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/contract": "0.11.0-dev.
|
|
10
|
-
"@prisma-next/framework-components": "0.11.0-dev.
|
|
11
|
-
"@prisma-next/utils": "0.11.0-dev.
|
|
9
|
+
"@prisma-next/contract": "0.11.0-dev.58",
|
|
10
|
+
"@prisma-next/framework-components": "0.11.0-dev.58",
|
|
11
|
+
"@prisma-next/utils": "0.11.0-dev.58",
|
|
12
12
|
"arktype": "^2.2.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@prisma-next/test-utils": "0.11.0-dev.
|
|
16
|
-
"@prisma-next/tsconfig": "0.11.0-dev.
|
|
17
|
-
"@prisma-next/tsdown": "0.11.0-dev.
|
|
15
|
+
"@prisma-next/test-utils": "0.11.0-dev.58",
|
|
16
|
+
"@prisma-next/tsconfig": "0.11.0-dev.58",
|
|
17
|
+
"@prisma-next/tsdown": "0.11.0-dev.58",
|
|
18
18
|
"tsdown": "0.22.0",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
20
|
"vitest": "4.1.6"
|
|
@@ -9,8 +9,16 @@ const preserveEmptyPatterns = [
|
|
|
9
9
|
['storage', 'namespaces', '*', 'collections', '*'],
|
|
10
10
|
] as const satisfies readonly PathPattern[];
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const matchesPreserveEmptyPattern = createPreserveEmptyPredicate(preserveEmptyPatterns);
|
|
13
|
+
|
|
14
|
+
// `additionalProperties: false` is the closed-schema marker on a Mongo
|
|
15
|
+
// `$jsonSchema` validator. It is injected at every object level — top-level
|
|
16
|
+
// collections, nested embedded value objects, and each polymorphic `oneOf`
|
|
17
|
+
// branch — so it appears at an unbounded set of paths that fixed-length path
|
|
18
|
+
// patterns cannot enumerate. It is a meaningful constraint rather than an
|
|
19
|
+
// omittable default, so preserve it wherever it occurs in a Mongo contract.
|
|
20
|
+
const shouldPreserveEmpty: PreserveEmptyPredicate = (path) =>
|
|
21
|
+
path[path.length - 1] === 'additionalProperties' || matchesPreserveEmptyPattern(path);
|
|
14
22
|
|
|
15
23
|
export const mongoContractCanonicalizationHooks: {
|
|
16
24
|
readonly shouldPreserveEmpty: PreserveEmptyPredicate;
|