@prisma/orm-family-mongo 8.0.0-rc.24-dev.27 → 8.0.0-rc.24-dev.29
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.
- package/dist/contract-psl__provider.mjs +20 -17
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/{control-Cxk8l7hC.mjs → control-DfFrLt8R.mjs} +5 -2
- package/dist/{control-Cxk8l7hC.mjs.map → control-DfFrLt8R.mjs.map} +1 -1
- package/dist/emitter.d.mts +2 -2
- package/dist/emitter.d.mts.map +1 -1
- package/dist/emitter.mjs +1 -1
- package/dist/{exports-DNAGDetn.mjs → exports-n9NNOl-G.mjs} +14 -11
- package/dist/exports-n9NNOl-G.mjs.map +1 -0
- package/dist/family.mjs +1 -1
- package/dist/family__control.mjs +1 -1
- package/package.json +20 -20
- package/dist/exports-DNAGDetn.mjs.map +0 -1
|
@@ -11,6 +11,10 @@ import { buildSymbolTable, createBinder, isPrisma8Schema, mapPslDiagnostics } fr
|
|
|
11
11
|
function hasTarget(options) {
|
|
12
12
|
return options?.target !== void 0;
|
|
13
13
|
}
|
|
14
|
+
const strictUtf8 = new TextDecoder("utf-8", {
|
|
15
|
+
fatal: true,
|
|
16
|
+
ignoreBOM: true
|
|
17
|
+
});
|
|
14
18
|
function mongoContract(schemaPath, options) {
|
|
15
19
|
if (!hasTarget(options)) throw structuredError("CONTRACT.ARGUMENT_INVALID", `mongoContract("${schemaPath}") needs the MongoDB target pack, which the contract records.`, {
|
|
16
20
|
fix: "Pass { target: mongoTargetPack }, with mongoTargetPack imported from '@prisma/orm-mongo/target/pack', or name the schema in defineConfig({ contract }) from '@prisma/orm-mongo/config', which passes it for you.",
|
|
@@ -54,27 +58,26 @@ function mongoContract(schemaPath, options) {
|
|
|
54
58
|
const readDiagnostics = [];
|
|
55
59
|
const members = [];
|
|
56
60
|
const undirected = [];
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
message,
|
|
66
|
-
sourceId: path
|
|
61
|
+
let anyFileOptedIn = false;
|
|
62
|
+
for (const path of candidates) try {
|
|
63
|
+
const bytes = await readFile(path);
|
|
64
|
+
if (isPrisma8Schema(bytes.toString("utf-8"))) {
|
|
65
|
+
anyFileOptedIn = true;
|
|
66
|
+
members.push({
|
|
67
|
+
path,
|
|
68
|
+
text: strictUtf8.decode(bytes)
|
|
67
69
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
} else undirected.push(path);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
73
|
+
readDiagnostics.push({
|
|
74
|
+
code: "PSL_SCHEMA_READ_FAILED",
|
|
75
|
+
message: `Could not read ${path}: ${reason}`,
|
|
76
|
+
sourceId: path
|
|
73
77
|
});
|
|
74
|
-
else undirected.push(path);
|
|
75
78
|
}
|
|
76
79
|
if (members.length === 0) {
|
|
77
|
-
if (undirected.length === 0) return notOk({
|
|
80
|
+
if (anyFileOptedIn || undirected.length === 0) return notOk({
|
|
78
81
|
summary: "Failed to read Prisma schema files",
|
|
79
82
|
diagnostics: readDiagnostics
|
|
80
83
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToMongoContract } from \"../interpreter-BC6ISiJM.mjs\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { buildSymbolTable, createBinder, isPrisma8Schema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/provider.ts\nfunction hasTarget(options) {\n\treturn options?.target !== void 0;\n}\nfunction mongoContract(schemaPath, options) {\n\tif (!hasTarget(options)) throw structuredError(\"CONTRACT.ARGUMENT_INVALID\", `mongoContract(\"${schemaPath}\") needs the MongoDB target pack, which the contract records.`, {\n\t\tfix: \"Pass { target: mongoTargetPack }, with mongoTargetPack imported from '@prisma/orm-mongo/target/pack', or name the schema in defineConfig({ contract }) from '@prisma/orm-mongo/config', which passes it for you.\",\n\t\tmeta: {\n\t\t\tschemaPath,\n\t\t\treason: \"target-pack-missing\"\n\t\t}\n\t});\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\tdocuments: input.documents,\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsources: input.sources,\n\t\t\t\t\tbinder: input.binder,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\t...ifDefined(\"extensionPacks\", options.extensionPacks),\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\tdefaultFunctionRegistry: context.controlMutationDefaults.defaultFunctionRegistry,\n\t\t\t\t\tgeneratorFunctions: context.generatorFunctions,\n\t\t\t\t\tdataTypes: context.dataTypes,\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options.enumInferenceCodecs),\n\t\t\t\t\t...ifDefined(\"reportWarning\", context.reportWarning)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst candidates = [...new Set(context.resolvedInputs)].sort();\n\t\t\t\tif (candidates.length === 0) return notOk({\n\t\t\t\t\tsummary: \"No schema files matched the configured contract source\",\n\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\tcode: \"PSL_NO_SCHEMA_FILES_MATCHED\",\n\t\t\t\t\t\tmessage: `No files matched the configured pattern \"${schemaPath}\"`,\n\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t\tconst readDiagnostics = [];\n\t\t\t\tconst members = [];\n\t\t\t\tconst undirected = [];\n\t\t\t\tfor (const path of candidates) {\n\t\t\t\t\
|
|
1
|
+
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-psl/dist/exports/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToMongoContract } from \"../interpreter-BC6ISiJM.mjs\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { buildSymbolTable, createBinder, isPrisma8Schema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/provider.ts\nfunction hasTarget(options) {\n\treturn options?.target !== void 0;\n}\nconst strictUtf8 = new TextDecoder(\"utf-8\", {\n\tfatal: true,\n\tignoreBOM: true\n});\nfunction mongoContract(schemaPath, options) {\n\tif (!hasTarget(options)) throw structuredError(\"CONTRACT.ARGUMENT_INVALID\", `mongoContract(\"${schemaPath}\") needs the MongoDB target pack, which the contract records.`, {\n\t\tfix: \"Pass { target: mongoTargetPack }, with mongoTargetPack imported from '@prisma/orm-mongo/target/pack', or name the schema in defineConfig({ contract }) from '@prisma/orm-mongo/config', which passes it for you.\",\n\t\tmeta: {\n\t\t\tschemaPath,\n\t\t\treason: \"target-pack-missing\"\n\t\t}\n\t});\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\treturn interpretPslDocumentToMongoContract({\n\t\t\t\t\tdocuments: input.documents,\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsources: input.sources,\n\t\t\t\t\tbinder: input.binder,\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\t...ifDefined(\"extensionPacks\", options.extensionPacks),\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\tdefaultFunctionRegistry: context.controlMutationDefaults.defaultFunctionRegistry,\n\t\t\t\t\tgeneratorFunctions: context.generatorFunctions,\n\t\t\t\t\tdataTypes: context.dataTypes,\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options.enumInferenceCodecs),\n\t\t\t\t\t...ifDefined(\"reportWarning\", context.reportWarning)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst candidates = [...new Set(context.resolvedInputs)].sort();\n\t\t\t\tif (candidates.length === 0) return notOk({\n\t\t\t\t\tsummary: \"No schema files matched the configured contract source\",\n\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\tcode: \"PSL_NO_SCHEMA_FILES_MATCHED\",\n\t\t\t\t\t\tmessage: `No files matched the configured pattern \"${schemaPath}\"`,\n\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t\tconst readDiagnostics = [];\n\t\t\t\tconst members = [];\n\t\t\t\tconst undirected = [];\n\t\t\t\tlet anyFileOptedIn = false;\n\t\t\t\tfor (const path of candidates) try {\n\t\t\t\t\tconst bytes = await readFile(path);\n\t\t\t\t\tif (isPrisma8Schema(bytes.toString(\"utf-8\"))) {\n\t\t\t\t\t\tanyFileOptedIn = true;\n\t\t\t\t\t\tmembers.push({\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\ttext: strictUtf8.decode(bytes)\n\t\t\t\t\t\t});\n\t\t\t\t\t} else undirected.push(path);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst reason = error instanceof Error ? error.message : String(error);\n\t\t\t\t\treadDiagnostics.push({\n\t\t\t\t\t\tcode: \"PSL_SCHEMA_READ_FAILED\",\n\t\t\t\t\t\tmessage: `Could not read ${path}: ${reason}`,\n\t\t\t\t\t\tsourceId: path\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (members.length === 0) {\n\t\t\t\t\tif (anyFileOptedIn || undirected.length === 0) return notOk({\n\t\t\t\t\t\tsummary: \"Failed to read Prisma schema files\",\n\t\t\t\t\t\tdiagnostics: readDiagnostics\n\t\t\t\t\t});\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: \"No schema file carries the \\\"// use prisma-8\\\" directive\",\n\t\t\t\t\t\tdiagnostics: [...readDiagnostics, {\n\t\t\t\t\t\t\tcode: \"PSL_NO_OPTED_IN_SCHEMA_FILES\",\n\t\t\t\t\t\t\tmessage: `None of the matched files carry the \"// use prisma-8\" directive: ${undirected.join(\", \")}`,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst parsed = members.map(({ path, text }) => parse(text, path));\n\t\t\t\tconst documents = parsed.map(({ document }) => document);\n\t\t\t\tconst [firstSources, ...restSources] = parsed.map(({ sources }) => sources);\n\t\t\t\tassertDefined(firstSources, \"mongoContract requires at least one parsed schema file\");\n\t\t\t\tconst sources = firstSources.merge(...restSources);\n\t\t\t\tconst seedDiagnostics = [...readDiagnostics, ...mapPslDiagnostics(parsed.flatMap(({ diagnostics }) => diagnostics), sources)];\n\t\t\t\tconst { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tdefaultNamespaceId: context.defaultNamespaceId\n\t\t\t\t});\n\t\t\t\tconst { binder, diagnostics: binderDiagnostics } = createBinder({\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tsources,\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\treturn withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tbinder\n\t\t\t\t}, context), [...seedDiagnostics, ...mapPslDiagnostics([...symbolTableDiagnostics, ...binderDiagnostics], sources)]);\n\t\t\t}\n\t\t},\n\t\t...ifDefined(\"output\", options.output)\n\t};\n}\n//#endregion\nexport { mongoContract };\n\n//# sourceMappingURL=provider.mjs.map"],"mappings":";;;;;;;;;;AAUA,SAAS,UAAU,SAAS;CAC3B,OAAO,SAAS,WAAW,KAAK;AACjC;AACA,MAAM,aAAa,IAAI,YAAY,SAAS;CAC3C,OAAO;CACP,WAAW;AACZ,CAAC;AACD,SAAS,cAAc,YAAY,SAAS;CAC3C,IAAI,CAAC,UAAU,OAAO,GAAG,MAAM,gBAAgB,6BAA6B,kBAAkB,WAAW,gEAAgE;EACxK,KAAK;EACL,MAAM;GACL;GACA,QAAQ;EACT;CACD,CAAC;CACD,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,OAAO,oCAAoC;KAC1C,WAAW,MAAM;KACjB,aAAa,MAAM;KACnB,SAAS,MAAM;KACf,QAAQ,MAAM;KACd,QAAQ,QAAQ;KAChB,GAAG,UAAU,kBAAkB,QAAQ,cAAc;KACrD,iBAAiB,CAAC;KAClB,yBAAyB,QAAQ,wBAAwB;KACzD,oBAAoB,QAAQ;KAC5B,WAAW,QAAQ;KACnB,aAAa,QAAQ;KACrB,wBAAwB,QAAQ;KAChC,GAAG,UAAU,uBAAuB,QAAQ,mBAAmB;KAC/D,GAAG,UAAU,iBAAiB,QAAQ,aAAa;IACpD,CAAC;GACF;GACA,MAAM,KAAK,SAAS;IACnB,MAAM,aAAa,CAAC,GAAG,IAAI,IAAI,QAAQ,cAAc,CAAC,CAAC,CAAC,KAAK;IAC7D,I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B,WAAW,GAAG,OAAO,CAAC;IAC5H,MAAM,EAAE,aAAa,aAAa,2BAA2B,iBAAiB;KAC7E;KACA;KACA,oBAAoB,QAAQ;IAC7B,CAAC;IACD,MAAM,EAAE,QAAQ,aAAa,sBAAsB,aAAa;KAC/D;KACA;KACA;IACD,CAAC;IACD,OAAO,oBAAoB,KAAK,UAAU;KACzC;KACA;KACA;KACA;IACD,GAAG,OAAO,GAAG,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC;GACpH;EACD;EACA,GAAG,UAAU,UAAU,QAAQ,MAAM;CACtC;AACD"}
|
|
@@ -2,7 +2,7 @@ import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hook
|
|
|
2
2
|
import { Z as validatorRootShapesOf } from "./dist-B-IBy07a.mjs";
|
|
3
3
|
import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-BC6ISiJM-BLsI-NHx.mjs";
|
|
4
4
|
import { t as describeUnresolvedMongoType } from "./dist-CIeN6u2T.mjs";
|
|
5
|
-
import { t as mongoEmission } from "./exports-
|
|
5
|
+
import { t as mongoEmission } from "./exports-n9NNOl-G.mjs";
|
|
6
6
|
import { et as RawUpdateManyCommand } from "./execution--hGsOBbu.mjs";
|
|
7
7
|
import { i as verifyMongoSchema } from "./verify-mongo-schema-D8rznxzZ-DaGYZJ89.mjs";
|
|
8
8
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-qeRu8r5L-kYG8jSMg.mjs";
|
|
@@ -611,6 +611,9 @@ function createMongoFamilyInstance(controlStack) {
|
|
|
611
611
|
},
|
|
612
612
|
storageNameOf(operation) {
|
|
613
613
|
return mongoStorageNameOf(operation);
|
|
614
|
+
},
|
|
615
|
+
accessChangesOf() {
|
|
616
|
+
return [];
|
|
614
617
|
}
|
|
615
618
|
};
|
|
616
619
|
}
|
|
@@ -640,4 +643,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
|
|
|
640
643
|
//#endregion
|
|
641
644
|
export { mongoFamilyDescriptor as a, markerSwapFailure as i, fieldRewriteOf as n, mongoOperationsToPreview as o, formatMongoOperations as r, createMongoFamilyInstance as t };
|
|
642
645
|
|
|
643
|
-
//# sourceMappingURL=control-
|
|
646
|
+
//# sourceMappingURL=control-DfFrLt8R.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-Cxk8l7hC.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-D8rznxzZ.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-qeRu8r5L.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-BBknnHWy.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, compareMarkerDatabasePolicies, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/marker-policies.ts\n/**\n* Why the swap of a marker expected at `expectedStorageHash`, guarded by `checkedPolicies` when given,\n* failed. `found` is the marker read after the swap. When it holds both again, another process\n* changed the marker and changed it back while the swap ran.\n*/\nfunction markerSwapFailure(found, expectedStorageHash, checkedPolicies) {\n\tif (found?.storageHash !== expectedStorageHash) return {\n\t\tkind: \"storageHashMoved\",\n\t\tfound\n\t};\n\tif (checkedPolicies === void 0) return {\n\t\tkind: \"markerChanged\",\n\t\tfound\n\t};\n\tconst comparison = compareMarkerDatabasePolicies(found, checkedPolicies);\n\tswitch (comparison.kind) {\n\t\tcase \"moved\": return {\n\t\t\tkind: \"policiesMoved\",\n\t\t\tfound: comparison.found\n\t\t};\n\t\tcase \"unreadable\": return {\n\t\t\tkind: \"policiesUnreadable\",\n\t\t\twhy: comparison.why\n\t\t};\n\t\tcase \"held\": return {\n\t\t\tkind: \"markerChanged\",\n\t\t\tfound\n\t\t};\n\t}\n}\n//#endregion\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/** The field an update sets or changes: one `$rename` or `$unset` of one field, or a pipeline of one `$set` of one field. */\nfunction rewrittenField(update) {\n\tif (Array.isArray(update)) {\n\t\tconst [stage, ...others] = update;\n\t\treturn others.length === 0 && onlyKey(stage) === \"$set\" ? onlyKey(Reflect.get(stage ?? {}, \"$set\")) : void 0;\n\t}\n\tconst operator = onlyKey(update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\treturn onlyKey(Reflect.get(update, operator));\n}\n/**\n* The field rewrite an operation's run has the shape of, if it has one: a single `updateMany` that\n* skips validation and renames, unsets or sets one field. A data transform the user filled can have\n* this shape too, so a caller tells the two apart by the operation's class.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst field = rewrittenField(command.update);\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabelParts: [{\n\t\t\ttext: \"database\",\n\t\t\trole: \"title\"\n\t\t}],\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: prefix,\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" (\" },\n\t\t\t\t{\n\t\t\t\t\ttext: keysSummary,\n\t\t\t\t\trole: \"name\"\n\t\t\t\t},\n\t\t\t\t{ text: \")\" },\n\t\t\t\t...options.length > 0 ? [{ text: \" \" }, {\n\t\t\t\t\ttext: `(${options.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tname: index.name,\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst roots = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst fields = /* @__PURE__ */ new Map();\n\t\tfor (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {\n\t\t\tconst types = fields.get(propName) ?? /* @__PURE__ */ new Set();\n\t\t\tfor (const type of bsonTypesOf(propDef)) types.add(type);\n\t\t\tfields.set(propName, types);\n\t\t}\n\t\tfor (const [propName, types] of fields) {\n\t\t\tconst bsonType = types.has(\"any\") ? \"any\" : [...types].join(\" | \");\n\t\t\tconst required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabelParts: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: propName,\n\t\t\t\t\t\trole: \"name\"\n\t\t\t\t\t},\n\t\t\t\t\t{ text: \": \" },\n\t\t\t\t\t{ text: bsonType },\n\t\t\t\t\t...required ? [{ text: \" \" }, {\n\t\t\t\t\t\ttext: \"(required)\",\n\t\t\t\t\t\trole: \"detail\"\n\t\t\t\t\t}] : []\n\t\t\t\t]\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"validator\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"options\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(${optLabels.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabelParts: [\n\t\t\t{\n\t\t\t\ttext: \"collection\",\n\t\t\t\trole: \"keyword\"\n\t\t\t},\n\t\t\t{ text: \" \" },\n\t\t\t{\n\t\t\t\ttext: name,\n\t\t\t\trole: \"name\"\n\t\t\t}\n\t\t],\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\nfunction bsonTypesOf(propDef) {\n\tif (typeof propDef !== \"object\" || propDef === null || !(\"bsonType\" in propDef)) return [\"any\"];\n\tconst { bsonType } = propDef;\n\treturn Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tfunction contractHashesOf(contract) {\n\t\treturn {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\tprofileHash: contract.profileHash\n\t\t};\n\t}\n\tfunction databasePoliciesConflict(checked, comparison) {\n\t\treturn {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"databasePolicies\",\n\t\t\tchecked,\n\t\t\tcomparison\n\t\t};\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }, checkedPolicies) {\n\t\tconst { storageHash, profileHash } = contractHashesOf(contract);\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\tconst existing = marker === null ? null : {\n\t\t\tstorageHash: marker.storageHash,\n\t\t\tprofileHash: marker.profileHash\n\t\t};\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"storageHash\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tconst guardedBy = space === APP_SPACE_ID ? checkedPolicies : void 0;\n\t\tif (await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t}, guardedBy)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t\tconst found = await controlAdapter.readMarker(driver, space);\n\t\tconst failure = markerSwapFailure(found, existing.storageHash, guardedBy);\n\t\tif (guardedBy !== void 0 && failure.kind === \"policiesMoved\") return databasePoliciesConflict(guardedBy, {\n\t\t\tkind: \"moved\",\n\t\t\tfound: failure.found\n\t\t});\n\t\tif (guardedBy !== void 0 && failure.kind === \"policiesUnreadable\") return databasePoliciesConflict(guardedBy, {\n\t\t\tkind: \"unreadable\",\n\t\t\twhy: failure.why\n\t\t});\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"storageHash\",\n\t\t\texpected,\n\t\t\tfound: found === null ? null : {\n\t\t\t\tstorageHash: found.storageHash,\n\t\t\t\tprofileHash: found.profileHash\n\t\t\t}\n\t\t};\n\t}\n\tasync function databasePoliciesHeld(driver, checked) {\n\t\tconst comparison = compareMarkerDatabasePolicies(await getControlAdapter().readMarker(driver, APP_SPACE_ID), checked);\n\t\treturn comparison.kind === \"held\" ? void 0 : databasePoliciesConflict(checked, comparison);\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tget markerLocation() {\n\t\t\treturn getControlAdapter().markerLocation;\n\t\t},\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst checked = options.expectedDatabasePolicies;\n\t\t\tif (checked !== void 0) {\n\t\t\t\tconst conflict = await databasePoliciesHeld(mongoDriver, checked);\n\t\t\t\tif (conflict !== void 0) return [conflict];\n\t\t\t}\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space, checked));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, markerSwapFailure, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,kBAAkB,OAAO,qBAAqB,iBAAiB;CACvE,IAAI,OAAO,gBAAgB,qBAAqB,OAAO;EACtD,MAAM;EACN;CACD;CACA,IAAI,oBAAoB,KAAK,GAAG,OAAO;EACtC,MAAM;EACN;CACD;CACA,MAAM,aAAa,8BAA8B,OAAO,eAAe;CACvE,QAAQ,WAAW,MAAnB;EACC,KAAK,SAAS,OAAO;GACpB,MAAM;GACN,OAAO,WAAW;EACnB;EACA,KAAK,cAAc,OAAO;GACzB,MAAM;GACN,KAAK,WAAW;EACjB;EACA,KAAK,QAAQ,OAAO;GACnB,MAAM;GACN;EACD;CACD;AACD;AAGA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,OAAO;CACd,OAAO,KAAK,WAAW,IAAI,MAAM,KAAK;AACvC;;AAEA,SAAS,eAAe,QAAQ;CAC/B,IAAI,MAAM,QAAQ,MAAM,GAAG;EAC1B,MAAM,CAAC,OAAO,GAAG,UAAU;EAC3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Ac,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;EACA,cAAc,WAAW;GACxB,OAAO,mBAAmB,SAAS;EACpC;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"control-DfFrLt8R.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-D8rznxzZ.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-qeRu8r5L.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-BBknnHWy.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, compareMarkerDatabasePolicies, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/marker-policies.ts\n/**\n* Why the swap of a marker expected at `expectedStorageHash`, guarded by `checkedPolicies` when given,\n* failed. `found` is the marker read after the swap. When it holds both again, another process\n* changed the marker and changed it back while the swap ran.\n*/\nfunction markerSwapFailure(found, expectedStorageHash, checkedPolicies) {\n\tif (found?.storageHash !== expectedStorageHash) return {\n\t\tkind: \"storageHashMoved\",\n\t\tfound\n\t};\n\tif (checkedPolicies === void 0) return {\n\t\tkind: \"markerChanged\",\n\t\tfound\n\t};\n\tconst comparison = compareMarkerDatabasePolicies(found, checkedPolicies);\n\tswitch (comparison.kind) {\n\t\tcase \"moved\": return {\n\t\t\tkind: \"policiesMoved\",\n\t\t\tfound: comparison.found\n\t\t};\n\t\tcase \"unreadable\": return {\n\t\t\tkind: \"policiesUnreadable\",\n\t\t\twhy: comparison.why\n\t\t};\n\t\tcase \"held\": return {\n\t\t\tkind: \"markerChanged\",\n\t\t\tfound\n\t\t};\n\t}\n}\n//#endregion\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/** The field an update sets or changes: one `$rename` or `$unset` of one field, or a pipeline of one `$set` of one field. */\nfunction rewrittenField(update) {\n\tif (Array.isArray(update)) {\n\t\tconst [stage, ...others] = update;\n\t\treturn others.length === 0 && onlyKey(stage) === \"$set\" ? onlyKey(Reflect.get(stage ?? {}, \"$set\")) : void 0;\n\t}\n\tconst operator = onlyKey(update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\treturn onlyKey(Reflect.get(update, operator));\n}\n/**\n* The field rewrite an operation's run has the shape of, if it has one: a single `updateMany` that\n* skips validation and renames, unsets or sets one field. A data transform the user filled can have\n* this shape too, so a caller tells the two apart by the operation's class.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst field = rewrittenField(command.update);\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabelParts: [{\n\t\t\ttext: \"database\",\n\t\t\trole: \"title\"\n\t\t}],\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: prefix,\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" (\" },\n\t\t\t\t{\n\t\t\t\t\ttext: keysSummary,\n\t\t\t\t\trole: \"name\"\n\t\t\t\t},\n\t\t\t\t{ text: \")\" },\n\t\t\t\t...options.length > 0 ? [{ text: \" \" }, {\n\t\t\t\t\ttext: `(${options.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}] : []\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tname: index.name,\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst roots = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst fields = /* @__PURE__ */ new Map();\n\t\tfor (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {\n\t\t\tconst types = fields.get(propName) ?? /* @__PURE__ */ new Set();\n\t\t\tfor (const type of bsonTypesOf(propDef)) types.add(type);\n\t\t\tfields.set(propName, types);\n\t\t}\n\t\tfor (const [propName, types] of fields) {\n\t\t\tconst bsonType = types.has(\"any\") ? \"any\" : [...types].join(\" | \");\n\t\t\tconst required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabelParts: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: propName,\n\t\t\t\t\t\trole: \"name\"\n\t\t\t\t\t},\n\t\t\t\t\t{ text: \": \" },\n\t\t\t\t\t{ text: bsonType },\n\t\t\t\t\t...required ? [{ text: \" \" }, {\n\t\t\t\t\t\ttext: \"(required)\",\n\t\t\t\t\t\trole: \"detail\"\n\t\t\t\t\t}] : []\n\t\t\t\t]\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"validator\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabelParts: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"options\",\n\t\t\t\t\trole: \"keyword\"\n\t\t\t\t},\n\t\t\t\t{ text: \" \" },\n\t\t\t\t{\n\t\t\t\t\ttext: `(${optLabels.join(\", \")})`,\n\t\t\t\t\trole: \"detail\"\n\t\t\t\t}\n\t\t\t],\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabelParts: [\n\t\t\t{\n\t\t\t\ttext: \"collection\",\n\t\t\t\trole: \"keyword\"\n\t\t\t},\n\t\t\t{ text: \" \" },\n\t\t\t{\n\t\t\t\ttext: name,\n\t\t\t\trole: \"name\"\n\t\t\t}\n\t\t],\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\nfunction bsonTypesOf(propDef) {\n\tif (typeof propDef !== \"object\" || propDef === null || !(\"bsonType\" in propDef)) return [\"any\"];\n\tconst { bsonType } = propDef;\n\treturn Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tfunction contractHashesOf(contract) {\n\t\treturn {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\tprofileHash: contract.profileHash\n\t\t};\n\t}\n\tfunction databasePoliciesConflict(checked, comparison) {\n\t\treturn {\n\t\t\tspace: APP_SPACE_ID,\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"databasePolicies\",\n\t\t\tchecked,\n\t\t\tcomparison\n\t\t};\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }, checkedPolicies) {\n\t\tconst { storageHash, profileHash } = contractHashesOf(contract);\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\tconst existing = marker === null ? null : {\n\t\t\tstorageHash: marker.storageHash,\n\t\t\tprofileHash: marker.profileHash\n\t\t};\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"storageHash\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tconst guardedBy = space === APP_SPACE_ID ? checkedPolicies : void 0;\n\t\tif (await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t}, guardedBy)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t\tconst found = await controlAdapter.readMarker(driver, space);\n\t\tconst failure = markerSwapFailure(found, existing.storageHash, guardedBy);\n\t\tif (guardedBy !== void 0 && failure.kind === \"policiesMoved\") return databasePoliciesConflict(guardedBy, {\n\t\t\tkind: \"moved\",\n\t\t\tfound: failure.found\n\t\t});\n\t\tif (guardedBy !== void 0 && failure.kind === \"policiesUnreadable\") return databasePoliciesConflict(guardedBy, {\n\t\t\tkind: \"unreadable\",\n\t\t\twhy: failure.why\n\t\t});\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\treason: \"storageHash\",\n\t\t\texpected,\n\t\t\tfound: found === null ? null : {\n\t\t\t\tstorageHash: found.storageHash,\n\t\t\t\tprofileHash: found.profileHash\n\t\t\t}\n\t\t};\n\t}\n\tasync function databasePoliciesHeld(driver, checked) {\n\t\tconst comparison = compareMarkerDatabasePolicies(await getControlAdapter().readMarker(driver, APP_SPACE_ID), checked);\n\t\treturn comparison.kind === \"held\" ? void 0 : databasePoliciesConflict(checked, comparison);\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tget markerLocation() {\n\t\t\treturn getControlAdapter().markerLocation;\n\t\t},\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst checked = options.expectedDatabasePolicies;\n\t\t\tif (checked !== void 0) {\n\t\t\t\tconst conflict = await databasePoliciesHeld(mongoDriver, checked);\n\t\t\t\tif (conflict !== void 0) return [conflict];\n\t\t\t}\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space, checked));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t},\n\t\taccessChangesOf() {\n\t\t\treturn [];\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, markerSwapFailure, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,kBAAkB,OAAO,qBAAqB,iBAAiB;CACvE,IAAI,OAAO,gBAAgB,qBAAqB,OAAO;EACtD,MAAM;EACN;CACD;CACA,IAAI,oBAAoB,KAAK,GAAG,OAAO;EACtC,MAAM;EACN;CACD;CACA,MAAM,aAAa,8BAA8B,OAAO,eAAe;CACvE,QAAQ,WAAW,MAAnB;EACC,KAAK,SAAS,OAAO;GACpB,MAAM;GACN,OAAO,WAAW;EACnB;EACA,KAAK,cAAc,OAAO;GACzB,MAAM;GACN,KAAK,WAAW;EACjB;EACA,KAAK,QAAQ,OAAO;GACnB,MAAM;GACN;EACD;CACD;AACD;AAGA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IA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AQ,MAAM,CAAC;EACxE;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,iBAAiB,cAAc,QAAQ,MAAM,CAAC;EAC1E;EACA,yBAAyB,SAAS;GACjC,OAAO,kBAAkB,CAAC,CAAC,yBAAyB,cAAc,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;EACA,cAAc,WAAW;GACxB,OAAO,mBAAmB,SAAS;EACpC;EACA,kBAAkB;GACjB,OAAO,CAAC;EACT;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
|
package/dist/emitter.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Contract, ContractModelBase, JsonValue } from "@prisma/orm-framework/contract/types";
|
|
2
|
-
import {
|
|
2
|
+
import { ImportRequirement } from "@prisma/orm-framework/components/control";
|
|
3
3
|
//#region ../../../2-mongo-family/3-tooling/emitter/dist/exports/index.d.mts
|
|
4
4
|
//#region src/index.d.ts
|
|
5
5
|
declare const mongoEmission: {
|
|
@@ -10,7 +10,7 @@ declare const mongoEmission: {
|
|
|
10
10
|
readonly encodedValues: readonly JsonValue[];
|
|
11
11
|
readonly codecId: string;
|
|
12
12
|
} | undefined;
|
|
13
|
-
getFamilyImports(
|
|
13
|
+
getFamilyImports(typesModule: string): ReadonlyArray<ImportRequirement>;
|
|
14
14
|
getFamilyTypeAliases(): string;
|
|
15
15
|
getTypeMapsExpression(): string;
|
|
16
16
|
getContractWrapper(contractBaseName: string, typeMapsName: string): string;
|
package/dist/emitter.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.mts","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.d.mts"],"mappings":";;;;cAGc;EACZ;EACA,oBAAoB,UAAU,UAAU;EACxC,yBAAyB,oBAAoB,OAAO;EACpD,uBAAuB,oBAAoB,mBAAmB,OAAO,mBAAmB,UAAU;aACvF,wBAAwB;aACxB;;EAEX,iBAAiB,
|
|
1
|
+
{"version":3,"file":"emitter.d.mts","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.d.mts"],"mappings":";;;;cAGc;EACZ;EACA,oBAAoB,UAAU,UAAU;EACxC,yBAAyB,oBAAoB,OAAO;EACpD,uBAAuB,oBAAoB,mBAAmB,OAAO,mBAAmB,UAAU;aACvF,wBAAwB;aACxB;;EAEX,iBAAiB,sBAAsB,cAAc;EACrD;EACA;EACA,mBAAmB,0BAA0B"}
|
package/dist/emitter.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mongoEmission } from "./exports-
|
|
1
|
+
import { t as mongoEmission } from "./exports-n9NNOl-G.mjs";
|
|
2
2
|
export { mongoEmission };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
2
|
+
import { compareCodeUnits } from "@prisma/orm-framework/contract/hashing-utils";
|
|
2
3
|
import { generateValueObjectsDescriptorType, serializeObjectKey, serializeValue } from "@prisma/orm-toolchain/emitter/domain-type-generation";
|
|
3
4
|
//#region ../../../2-mongo-family/3-tooling/emitter/dist/exports/index.mjs
|
|
4
5
|
const MONGO_NAMESPACE_KIND_FALLBACK = "mongo-namespace";
|
|
@@ -13,12 +14,12 @@ function generateMongoCollectionEntryType(coll) {
|
|
|
13
14
|
}
|
|
14
15
|
function generateMongoNamespaceCollectionsType(collections) {
|
|
15
16
|
const entries = [];
|
|
16
|
-
for (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => a
|
|
17
|
+
for (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => compareCodeUnits(a, b))) entries.push(`readonly ${serializeObjectKey(collName)}: ${generateMongoCollectionEntryType(coll)}`);
|
|
17
18
|
if (entries.length === 0) return "Record<string, never>";
|
|
18
19
|
return `{ ${entries.join("; ")} }`;
|
|
19
20
|
}
|
|
20
21
|
function generateMongoNamespacesType(namespaces) {
|
|
21
|
-
const sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => a
|
|
22
|
+
const sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => compareCodeUnits(a, b));
|
|
22
23
|
if (sorted.length === 0) return "Record<string, never>";
|
|
23
24
|
const parts = [];
|
|
24
25
|
for (const [name, ns] of sorted) {
|
|
@@ -62,15 +63,17 @@ const mongoEmission = {
|
|
|
62
63
|
codecId: field.type.codecId
|
|
63
64
|
};
|
|
64
65
|
},
|
|
65
|
-
getFamilyImports(
|
|
66
|
+
getFamilyImports(typesModule) {
|
|
66
67
|
return [
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
"MongoCollection",
|
|
69
|
+
"MongoContractWithTypeMaps",
|
|
70
|
+
"MongoTypeMaps",
|
|
71
|
+
"RelationKeys"
|
|
72
|
+
].map((symbol) => ({
|
|
73
|
+
moduleSpecifier: typesModule,
|
|
74
|
+
symbol,
|
|
75
|
+
typeOnly: true
|
|
76
|
+
}));
|
|
74
77
|
},
|
|
75
78
|
getFamilyTypeAliases() {
|
|
76
79
|
return "";
|
|
@@ -85,4 +88,4 @@ const mongoEmission = {
|
|
|
85
88
|
//#endregion
|
|
86
89
|
export { mongoEmission as t };
|
|
87
90
|
|
|
88
|
-
//# sourceMappingURL=exports-
|
|
91
|
+
//# sourceMappingURL=exports-n9NNOl-G.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-n9NNOl-G.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.mjs"],"sourcesContent":["import { compareCodeUnits } from \"@internal/contract/hashing-utils\";\nimport { generateValueObjectsDescriptorType, serializeObjectKey, serializeValue } from \"@internal/emitter/domain-type-generation\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/index.ts\nconst MONGO_NAMESPACE_KIND_FALLBACK = \"mongo-namespace\";\nfunction mongoNamespaceSerializedKind(ns) {\n\tconst kind = ns.kind;\n\tif (typeof kind === \"string\") return `readonly kind: ${serializeValue(kind)}`;\n\treturn `readonly kind: \"${MONGO_NAMESPACE_KIND_FALLBACK}\"`;\n}\nfunction generateMongoCollectionEntryType(coll) {\n\tif (Object.entries(coll).filter(([key, v]) => v !== void 0 && key !== \"kind\").length === 0) return \"MongoCollection\";\n\treturn serializeValue(coll);\n}\nfunction generateMongoNamespaceCollectionsType(collections) {\n\tconst entries = [];\n\tfor (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => compareCodeUnits(a, b))) entries.push(`readonly ${serializeObjectKey(collName)}: ${generateMongoCollectionEntryType(coll)}`);\n\tif (entries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${entries.join(\"; \")} }`;\n}\nfunction generateMongoNamespacesType(namespaces) {\n\tconst sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => compareCodeUnits(a, b));\n\tif (sorted.length === 0) return \"Record<string, never>\";\n\tconst parts = [];\n\tfor (const [name, ns] of sorted) {\n\t\tconst entriesParts = [`readonly collection: ${generateMongoNamespaceCollectionsType(ns.entries.collection ?? {})}`];\n\t\tconst valueObjects = ns.entries.valueObject;\n\t\tif (valueObjects !== void 0 && Object.keys(valueObjects).length > 0) entriesParts.push(`readonly valueObject: ${generateValueObjectsDescriptorType(valueObjects)}`);\n\t\tparts.push(`readonly ${serializeObjectKey(name)}: { readonly id: ${serializeValue(ns.id)}; ${mongoNamespaceSerializedKind(ns)}; readonly entries: { ${entriesParts.join(\"; \")} } }`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nconst mongoEmission = {\n\tid: \"mongo\",\n\tgenerateStorageType(contract, storageHashTypeName) {\n\t\tconst storage = contract.storage;\n\t\treturn `{ readonly namespaces: ${generateMongoNamespacesType(storage.namespaces)}; readonly storageHash: ${storageHashTypeName} }`;\n\t},\n\tgenerateModelStorageType(_modelName, model) {\n\t\tconst parts = [];\n\t\tconst collection = model.storage[\"collection\"];\n\t\tif (collection) parts.push(`readonly collection: ${serializeValue(collection)}`);\n\t\tconst storageFields = blindCast(model.storage[\"fields\"]);\n\t\tconst fieldEntries = Object.entries(storageFields).map(([fieldName, { field }]) => `readonly ${serializeObjectKey(fieldName)}: { readonly field: ${serializeValue(field)} }`);\n\t\tparts.push(`readonly fields: ${fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\"}`);\n\t\tconst storageRelations = model.storage[\"relations\"];\n\t\tif (storageRelations && Object.keys(storageRelations).length > 0) {\n\t\t\tconst relEntries = [];\n\t\t\tfor (const [relName, relVal] of Object.entries(storageRelations)) relEntries.push(`readonly ${serializeObjectKey(relName)}: ${serializeValue(relVal)}`);\n\t\t\tparts.push(`readonly relations: { ${relEntries.join(\"; \")} }`);\n\t\t}\n\t\treturn `{ ${parts.join(\"; \")} }`;\n\t},\n\tresolveStorageValueSet(_modelName, fieldName, model, contract) {\n\t\tconst field = model.fields[fieldName];\n\t\tif (field === void 0 || field.type.kind !== \"scalar\") return void 0;\n\t\tconst ref = field.valueSet;\n\t\tif (ref?.plane !== \"storage\") return void 0;\n\t\tconst valueSet = blindCast(contract.storage).namespaces[ref.namespaceId]?.entries.valueSet?.[ref.entityName];\n\t\tif (valueSet === void 0) return void 0;\n\t\treturn {\n\t\t\tencodedValues: valueSet.values,\n\t\t\tcodecId: field.type.codecId\n\t\t};\n\t},\n\tgetFamilyImports(typesModule) {\n\t\treturn [\n\t\t\t\"MongoCollection\",\n\t\t\t\"MongoContractWithTypeMaps\",\n\t\t\t\"MongoTypeMaps\",\n\t\t\t\"RelationKeys\"\n\t\t].map((symbol) => ({\n\t\t\tmoduleSpecifier: typesModule,\n\t\t\tsymbol,\n\t\t\ttypeOnly: true\n\t\t}));\n\t},\n\tgetFamilyTypeAliases() {\n\t\treturn \"\";\n\t},\n\tgetTypeMapsExpression() {\n\t\treturn \"MongoTypeMaps<CodecTypes, FieldOutputTypes, FieldInputTypes>\";\n\t},\n\tgetContractWrapper(contractBaseName, typeMapsName) {\n\t\treturn `export type Contract = MongoContractWithTypeMaps<${contractBaseName}, ${typeMapsName}>;`;\n\t}\n};\n//#endregion\nexport { mongoEmission };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;AAIA,MAAM,gCAAgC;AACtC,SAAS,6BAA6B,IAAI;CACzC,MAAM,OAAO,GAAG;CAChB,IAAI,OAAO,SAAS,UAAU,OAAO,kBAAkB,eAAe,IAAI;CAC1E,OAAO,mBAAmB,8BAA8B;AACzD;AACA,SAAS,iCAAiC,MAAM;CAC/C,IAAI,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,OAAO,MAAM,KAAK,KAAK,QAAQ,MAAM,CAAC,CAAC,WAAW,GAAG,OAAO;CACnG,OAAO,eAAe,IAAI;AAC3B;AACA,SAAS,sCAAsC,aAAa;CAC3D,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,UAAU,SAAS,OAAO,QAAQ,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,iBAAiB,GAAG,CAAC,CAAC,GAAG,QAAQ,KAAK,YAAY,mBAAmB,QAAQ,EAAE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oStorageNamespaceId
|
|
|
2
2
|
import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-D8rznxzZ-DaGYZJ89.mjs";
|
|
3
3
|
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-qeRu8r5L-kYG8jSMg.mjs";
|
|
4
4
|
import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-BBknnHWy-BhyFgbto.mjs";
|
|
5
|
-
import { a as mongoFamilyDescriptor, i as markerSwapFailure, n as fieldRewriteOf, o as mongoOperationsToPreview, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-
|
|
5
|
+
import { a as mongoFamilyDescriptor, i as markerSwapFailure, n as fieldRewriteOf, o as mongoOperationsToPreview, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-DfFrLt8R.mjs";
|
|
6
6
|
import { t as MongoContractView$1 } from "./mongo-contract-view-CF5trX6R-Blqb2Pqo.mjs";
|
|
7
7
|
import { t as MongoSchemaVerifierBase } from "./ir-Cy56OadG.mjs";
|
|
8
8
|
import { t as MongoMigration } from "./migration-DKNUUMzk.mjs";
|
package/dist/family__control.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-D8rznxzZ-DaGYZJ89.mjs";
|
|
2
|
-
import { a as mongoFamilyDescriptor, i as markerSwapFailure, n as fieldRewriteOf, o as mongoOperationsToPreview, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-
|
|
2
|
+
import { a as mongoFamilyDescriptor, i as markerSwapFailure, n as fieldRewriteOf, o as mongoOperationsToPreview, r as formatMongoOperations, t as createMongoFamilyInstance } from "./control-DfFrLt8R.mjs";
|
|
3
3
|
export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, markerSwapFailure, mongoFamilyDescriptor, mongoOperationsToPreview };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-family-mongo",
|
|
3
|
-
"version": "8.0.0-rc.24-dev.
|
|
3
|
+
"version": "8.0.0-rc.24-dev.29",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,31 +9,31 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.24-dev.
|
|
13
|
-
"@prisma/orm-toolchain": "8.0.0-rc.24-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.24-dev.29",
|
|
13
|
+
"@prisma/orm-toolchain": "8.0.0-rc.24-dev.29",
|
|
14
14
|
"arktype": "^2.2.2",
|
|
15
15
|
"mongodb": "^7.4.0",
|
|
16
16
|
"pathe": "^2.0.3",
|
|
17
17
|
"temporal-spec": "1.0.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@internal/family-mongo": "8.0.0-rc.24-dev.
|
|
21
|
-
"@internal/mongo-codec": "8.0.0-rc.24-dev.
|
|
22
|
-
"@internal/mongo-contract": "8.0.0-rc.24-dev.
|
|
23
|
-
"@internal/mongo-contract-prisma6": "8.0.0-rc.24-dev.
|
|
24
|
-
"@internal/mongo-contract-psl": "8.0.0-rc.24-dev.
|
|
25
|
-
"@internal/mongo-contract-ts": "8.0.0-rc.24-dev.
|
|
26
|
-
"@internal/mongo-emitter": "8.0.0-rc.24-dev.
|
|
27
|
-
"@internal/mongo-lowering": "8.0.0-rc.24-dev.
|
|
28
|
-
"@internal/mongo-orm": "8.0.0-rc.24-dev.
|
|
29
|
-
"@internal/mongo-query-ast": "8.0.0-rc.24-dev.
|
|
30
|
-
"@internal/mongo-query-builder": "8.0.0-rc.24-dev.
|
|
31
|
-
"@internal/mongo-runtime": "8.0.0-rc.24-dev.
|
|
32
|
-
"@internal/mongo-schema-ir": "8.0.0-rc.24-dev.
|
|
33
|
-
"@internal/mongo-value": "8.0.0-rc.24-dev.
|
|
34
|
-
"@internal/mongo-wire": "8.0.0-rc.24-dev.
|
|
35
|
-
"@repo/tsconfig": "8.0.0-rc.24-dev.
|
|
36
|
-
"@repo/tsdown": "8.0.0-rc.24-dev.
|
|
20
|
+
"@internal/family-mongo": "8.0.0-rc.24-dev.29",
|
|
21
|
+
"@internal/mongo-codec": "8.0.0-rc.24-dev.29",
|
|
22
|
+
"@internal/mongo-contract": "8.0.0-rc.24-dev.29",
|
|
23
|
+
"@internal/mongo-contract-prisma6": "8.0.0-rc.24-dev.29",
|
|
24
|
+
"@internal/mongo-contract-psl": "8.0.0-rc.24-dev.29",
|
|
25
|
+
"@internal/mongo-contract-ts": "8.0.0-rc.24-dev.29",
|
|
26
|
+
"@internal/mongo-emitter": "8.0.0-rc.24-dev.29",
|
|
27
|
+
"@internal/mongo-lowering": "8.0.0-rc.24-dev.29",
|
|
28
|
+
"@internal/mongo-orm": "8.0.0-rc.24-dev.29",
|
|
29
|
+
"@internal/mongo-query-ast": "8.0.0-rc.24-dev.29",
|
|
30
|
+
"@internal/mongo-query-builder": "8.0.0-rc.24-dev.29",
|
|
31
|
+
"@internal/mongo-runtime": "8.0.0-rc.24-dev.29",
|
|
32
|
+
"@internal/mongo-schema-ir": "8.0.0-rc.24-dev.29",
|
|
33
|
+
"@internal/mongo-value": "8.0.0-rc.24-dev.29",
|
|
34
|
+
"@internal/mongo-wire": "8.0.0-rc.24-dev.29",
|
|
35
|
+
"@repo/tsconfig": "8.0.0-rc.24-dev.29",
|
|
36
|
+
"@repo/tsdown": "8.0.0-rc.24-dev.29",
|
|
37
37
|
"tsdown": "0.22.14",
|
|
38
38
|
"typescript": "5.9.3"
|
|
39
39
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports-DNAGDetn.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.mjs"],"sourcesContent":["import { generateValueObjectsDescriptorType, serializeObjectKey, serializeValue } from \"@internal/emitter/domain-type-generation\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/index.ts\nconst MONGO_NAMESPACE_KIND_FALLBACK = \"mongo-namespace\";\nfunction mongoNamespaceSerializedKind(ns) {\n\tconst kind = ns.kind;\n\tif (typeof kind === \"string\") return `readonly kind: ${serializeValue(kind)}`;\n\treturn `readonly kind: \"${MONGO_NAMESPACE_KIND_FALLBACK}\"`;\n}\nfunction generateMongoCollectionEntryType(coll) {\n\tif (Object.entries(coll).filter(([key, v]) => v !== void 0 && key !== \"kind\").length === 0) return \"MongoCollection\";\n\treturn serializeValue(coll);\n}\nfunction generateMongoNamespaceCollectionsType(collections) {\n\tconst entries = [];\n\tfor (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => a.localeCompare(b))) entries.push(`readonly ${serializeObjectKey(collName)}: ${generateMongoCollectionEntryType(coll)}`);\n\tif (entries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${entries.join(\"; \")} }`;\n}\nfunction generateMongoNamespacesType(namespaces) {\n\tconst sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\tif (sorted.length === 0) return \"Record<string, never>\";\n\tconst parts = [];\n\tfor (const [name, ns] of sorted) {\n\t\tconst entriesParts = [`readonly collection: ${generateMongoNamespaceCollectionsType(ns.entries.collection ?? {})}`];\n\t\tconst valueObjects = ns.entries.valueObject;\n\t\tif (valueObjects !== void 0 && Object.keys(valueObjects).length > 0) entriesParts.push(`readonly valueObject: ${generateValueObjectsDescriptorType(valueObjects)}`);\n\t\tparts.push(`readonly ${serializeObjectKey(name)}: { readonly id: ${serializeValue(ns.id)}; ${mongoNamespaceSerializedKind(ns)}; readonly entries: { ${entriesParts.join(\"; \")} } }`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nconst mongoEmission = {\n\tid: \"mongo\",\n\tgenerateStorageType(contract, storageHashTypeName) {\n\t\tconst storage = contract.storage;\n\t\treturn `{ readonly namespaces: ${generateMongoNamespacesType(storage.namespaces)}; readonly storageHash: ${storageHashTypeName} }`;\n\t},\n\tgenerateModelStorageType(_modelName, model) {\n\t\tconst parts = [];\n\t\tconst collection = model.storage[\"collection\"];\n\t\tif (collection) parts.push(`readonly collection: ${serializeValue(collection)}`);\n\t\tconst storageFields = blindCast(model.storage[\"fields\"]);\n\t\tconst fieldEntries = Object.entries(storageFields).map(([fieldName, { field }]) => `readonly ${serializeObjectKey(fieldName)}: { readonly field: ${serializeValue(field)} }`);\n\t\tparts.push(`readonly fields: ${fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\"}`);\n\t\tconst storageRelations = model.storage[\"relations\"];\n\t\tif (storageRelations && Object.keys(storageRelations).length > 0) {\n\t\t\tconst relEntries = [];\n\t\t\tfor (const [relName, relVal] of Object.entries(storageRelations)) relEntries.push(`readonly ${serializeObjectKey(relName)}: ${serializeValue(relVal)}`);\n\t\t\tparts.push(`readonly relations: { ${relEntries.join(\"; \")} }`);\n\t\t}\n\t\treturn `{ ${parts.join(\"; \")} }`;\n\t},\n\tresolveStorageValueSet(_modelName, fieldName, model, contract) {\n\t\tconst field = model.fields[fieldName];\n\t\tif (field === void 0 || field.type.kind !== \"scalar\") return void 0;\n\t\tconst ref = field.valueSet;\n\t\tif (ref?.plane !== \"storage\") return void 0;\n\t\tconst valueSet = blindCast(contract.storage).namespaces[ref.namespaceId]?.entries.valueSet?.[ref.entityName];\n\t\tif (valueSet === void 0) return void 0;\n\t\treturn {\n\t\t\tencodedValues: valueSet.values,\n\t\t\tcodecId: field.type.codecId\n\t\t};\n\t},\n\tgetFamilyImports(resolveImportSpecifier) {\n\t\treturn [\n\t\t\t\"import type {\",\n\t\t\t\" MongoCollection,\",\n\t\t\t\" MongoContractWithTypeMaps,\",\n\t\t\t\" MongoTypeMaps,\",\n\t\t\t\" RelationKeys,\",\n\t\t\t`} from '${resolveImportSpecifier(\"@internal/mongo-contract\")}';`\n\t\t];\n\t},\n\tgetFamilyTypeAliases() {\n\t\treturn \"\";\n\t},\n\tgetTypeMapsExpression() {\n\t\treturn \"MongoTypeMaps<CodecTypes, FieldOutputTypes, FieldInputTypes>\";\n\t},\n\tgetContractWrapper(contractBaseName, typeMapsName) {\n\t\treturn `export type Contract = MongoContractWithTypeMaps<${contractBaseName}, ${typeMapsName}>;`;\n\t}\n};\n//#endregion\nexport { mongoEmission };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;AAGA,MAAM,gCAAgC;AACtC,SAAS,6BAA6B,IAAI;CACzC,MAAM,OAAO,GAAG;CAChB,IAAI,OAAO,SAAS,UAAU,OAAO,kBAAkB,eAAe,IAAI;CAC1E,OAAO,mBAAmB,8BAA8B;AACzD;AACA,SAAS,iCAAiC,MAAM;CAC/C,IAAI,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,OAAO,MAAM,KAAK,KAAK,QAAQ,MAAM,CAAC,CAAC,WAAW,GAAG,OAAO;CACnG,OAAO,eAAe,IAAI;AAC3B;AACA,SAAS,sCAAsC,aAAa;CAC3D,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,UAAU,SAAS,OAAO,QAAQ,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,GAAG,QAAQ,KAAK,YAAY,mBAAmB,QAAQ,EAAE,IAAI,iCAAiC,IAAI,GAAG;CACrM,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,OAAO,KAAK,QAAQ,KAAK,IAAI,EAAE;AAChC;AACA,SAAS,4BAA4B,YAAY;CAChD,MAAM,SAAS,OAAO,QAAQ,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC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