@prisma/orm-family-mongo 8.0.0-rc.14-dev.35 → 8.0.0-rc.14-dev.37

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.
@@ -12,7 +12,7 @@ import { blockAttribute, jsonValue, mapBlock, str } from "@prisma/orm-framework/
12
12
  import "@prisma/orm-framework/utils/defined";
13
13
  import "@prisma/orm-framework/components/control";
14
14
  import "@prisma/orm-framework/utils/canonical-stringify";
15
- //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-BOMOzrka.mjs
15
+ //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-DXktQ6MF.mjs
16
16
  function mongoFamilyEnumSpec() {
17
17
  return mapBlock({
18
18
  value: {
@@ -75,10 +75,7 @@ const mongoFamilyEntityTypes = { enum: {
75
75
  }
76
76
  const members = readEnumBlockMembers(block, codecId, codec, ctx);
77
77
  if (members === void 0) return void 0;
78
- return enumType(block.name, {
79
- codecId,
80
- nativeType: bsonType
81
- }, ...members);
78
+ return enumType(block.name, { codecId }, ...members);
82
79
  } }
83
80
  } };
84
81
  const enumTypeBlockAttribute = blockAttribute("type", {
@@ -101,4 +98,4 @@ const mongoFamilyPslBlockDescriptors = { enum: {
101
98
  //#endregion
102
99
  export { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };
103
100
 
104
- //# sourceMappingURL=authoring-entity-types-BOMOzrka-CgmQMnNa.mjs.map
101
+ //# sourceMappingURL=authoring-entity-types-DXktQ6MF-Bhtsznza.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"authoring-entity-types-BOMOzrka-CgmQMnNa.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-BOMOzrka.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { isMongoDataType } from \"@internal/mongo-contract/data-type\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/errors/control\";\nimport \"@internal/framework-components/codec\";\nimport \"@internal/framework-components/control\";\nimport \"@internal/framework-components/ir\";\nimport \"@internal/mongo-contract\";\nimport \"@internal/mongo-contract/canonicalization-hooks\";\nimport \"@internal/utils/canonical-stringify\";\nimport \"@internal/utils/casts\";\nimport { blockAttribute, jsonValue, mapBlock, str } from \"@internal/psl-parser\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/authoring-entity-types.ts\nfunction mongoFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: jsonValue(),\n\t\t\tdocumentation: \"The stored member value; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst mongoFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst descriptor = ctx.codecLookup.descriptorFor(codecId);\n\t\tif (descriptor === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst dataType = ctx.dataTypeLookup.get(descriptor.dataType);\n\t\tif (dataType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (!isMongoDataType(dataType)) throw new InternalError(`Data type ${dataType.id} is not a Mongo data type.`);\n\t\tconst { bsonTypes } = dataType.mongo;\n\t\tconst [bsonType, ...otherBsonTypes] = bsonTypes;\n\t\tif (bsonType === void 0 || otherBsonTypes.length > 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" declares ${bsonTypes.length} BSON types; an enum needs exactly one. Use a codec with one BSON type, such as mongo/string@1.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst codec = ctx.codecLookup.get(codecId);\n\t\tif (codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" is registered but codecLookup.get has no codec for it`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst members = readEnumBlockMembers(block, codecId, codec, ctx);\n\t\tif (members === void 0) return void 0;\n\t\treturn enumType(block.name, {\n\t\t\tcodecId,\n\t\t\tnativeType: bsonType\n\t\t}, ...members);\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst mongoFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: mongoFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\nexport { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };\n\n//# sourceMappingURL=authoring-entity-types-BOMOzrka.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB;CAC9B,OAAO,SAAS;EACf,OAAO;GACN,MAAM,UAAU;GAChB,eAAe;EAChB;EACA,WAAW;CACZ,CAAC;AACF;AACA,MAAM,yBAAyB,EAAE,MAAM;CACtC,MAAM;CACN,eAAe;CACf,QAAQ,EAAE,UAAU,OAAO,QAAQ;EAClC,MAAM,WAAW,IAAI,YAAY;EACjC,MAAM,cAAc,IAAI;EACxB,MAAM,WAAW,mBAAmB,OAAO,GAAG;EAC9C,IAAI,aAAa,KAAK,GAAG;EACzB,MAAM,EAAE,SAAS,cAAc;EAC/B,MAAM,aAAa,IAAI,YAAY,cAAc,OAAO;EACxD,IAAI,eAAe,KAAK,GAAG;GAC1B,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,qCAAqC,QAAQ;IAC1E;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,WAAW,IAAI,eAAe,IAAI,WAAW,QAAQ;EAC3D,IAAI,aAAa,KAAK,GAAG;GACxB,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,kBAAkB,QAAQ,0BAA0B,WAAW,SAAS;IACrG;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,IAAI,CAAC,gBAAgB,QAAQ,GAAG,MAAM,IAAI,cAAc,aAAa,SAAS,GAAG,2BAA2B;EAC5G,MAAM,EAAE,cAAc,SAAS;EAC/B,MAAM,CAAC,UAAU,GAAG,kBAAkB;EACtC,IAAI,aAAa,KAAK,KAAK,eAAe,SAAS,GAAG;GACrD,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,kBAAkB,QAAQ,aAAa,UAAU,OAAO;IACrF;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,QAAQ,IAAI,YAAY,IAAI,OAAO;EACzC,IAAI,UAAU,KAAK,GAAG;GACrB,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,kBAAkB,QAAQ;IACvD;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,MAAM,UAAU,qBAAqB,OAAO,SAAS,OAAO,GAAG;EAC/D,IAAI,YAAY,KAAK,GAAG,OAAO,KAAK;EACpC,OAAO,SAAS,MAAM,MAAM;GAC3B;GACA,YAAY;EACb,GAAG,GAAG,OAAO;CACd,EAAE;AACH,EAAE;AACF,MAAM,yBAAyB,eAAe,QAAQ;CACrD,eAAe;CACf,YAAY,CAAC;EACZ,KAAK;EACL,MAAM,IAAI;EACV,eAAe;CAChB,CAAC;AACF,CAAC;AACD,MAAM,iCAAiC,EAAE,MAAM;CAC9C,MAAM;CACN,SAAS;CACT,eAAe;CACf,eAAe;CACf,MAAM,EAAE,UAAU,KAAK;CACvB,MAAM;CACN,YAAY,EAAE,YAAY,uBAAuB;AAClD,EAAE"}
1
+ {"version":3,"file":"authoring-entity-types-DXktQ6MF-Bhtsznza.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-DXktQ6MF.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { isMongoDataType } from \"@internal/mongo-contract/data-type\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/errors/control\";\nimport \"@internal/framework-components/codec\";\nimport \"@internal/framework-components/control\";\nimport \"@internal/framework-components/ir\";\nimport \"@internal/mongo-contract\";\nimport \"@internal/mongo-contract/canonicalization-hooks\";\nimport \"@internal/utils/canonical-stringify\";\nimport \"@internal/utils/casts\";\nimport { blockAttribute, jsonValue, mapBlock, str } from \"@internal/psl-parser\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/authoring-entity-types.ts\nfunction mongoFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: jsonValue(),\n\t\t\tdocumentation: \"The stored member value; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst mongoFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst descriptor = ctx.codecLookup.descriptorFor(codecId);\n\t\tif (descriptor === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst dataType = ctx.dataTypeLookup.get(descriptor.dataType);\n\t\tif (dataType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (!isMongoDataType(dataType)) throw new InternalError(`Data type ${dataType.id} is not a Mongo data type.`);\n\t\tconst { bsonTypes } = dataType.mongo;\n\t\tconst [bsonType, ...otherBsonTypes] = bsonTypes;\n\t\tif (bsonType === void 0 || otherBsonTypes.length > 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" declares ${bsonTypes.length} BSON types; an enum needs exactly one. Use a codec with one BSON type, such as mongo/string@1.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst codec = ctx.codecLookup.get(codecId);\n\t\tif (codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" is registered but codecLookup.get has no codec for it`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst members = readEnumBlockMembers(block, codecId, codec, ctx);\n\t\tif (members === void 0) return void 0;\n\t\treturn enumType(block.name, { codecId }, ...members);\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst mongoFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: mongoFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\nexport { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };\n\n//# sourceMappingURL=authoring-entity-types-DXktQ6MF.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB;CAC9B,OAAO,SAAS;EACf,OAAO;GACN,MAAM,UAAU;GAChB,eAAe;EAChB;EACA,WAAW;CACZ,CAAC;AACF;AACA,MAAM,yBAAyB,EAAE,MAAM;CACtC,MAAM;CACN,eAAe;CACf,QAAQ,EAAE,UAAU,OAAO,QAAQ;EAClC,MAAM,WAAW,IAAI,YAAY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AyB,eAAe,QAAQ;CACrD,eAAe;CACf,YAAY,CAAC;EACZ,KAAK;EACL,MAAM,IAAI;EACV,eAAe;CAChB,CAAC;AACF,CAAC;AACD,MAAM,iCAAiC,EAAE,MAAM;CAC9C,MAAM;CACN,SAAS;CACT,eAAe;CACf,eAAe;CACf,MAAM,EAAE,UAAU,KAAK;CACvB,MAAM;CACN,YAAY,EAAE,YAAY,uBAAuB;AAClD,EAAE"}
@@ -3,13 +3,13 @@ import { a as mongoAttributeSpecs, r as describeUnsupportedMongoAttribute } from
3
3
  import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
4
4
  import { t as mongoEmission } from "./exports-BSUZo1ZX.mjs";
5
5
  import { i as verifyMongoSchema } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
6
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-BOMOzrka-CgmQMnNa.mjs";
6
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-DXktQ6MF-Bhtsznza.mjs";
7
7
  import { t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-PhZZAPWQ.mjs";
8
8
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
9
9
  import { blindCast } from "@prisma/orm-framework/utils/casts";
10
10
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
11
11
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
12
- import { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH } from "@prisma/orm-framework/components/control";
12
+ import { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from "@prisma/orm-framework/components/control";
13
13
  import { assertDescriptorSelfConsistency } from "@prisma/orm-toolchain/migration-tools/spaces";
14
14
  //#region ../../../2-mongo-family/9-family/dist/control.mjs
15
15
  function formatKeySpec(keys) {
@@ -233,6 +233,60 @@ function createMongoFamilyInstance(controlStack) {
233
233
  if (!isMongoTargetDriver(driver)) throw structuredError("CONTRACT.TARGET_MISMATCH", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);
234
234
  return driver;
235
235
  }
236
+ async function signSpaceMarker(driver, { space, contract, expected }) {
237
+ const storageHash = contract.storage.storageHash;
238
+ const profileHash = contract.profileHash;
239
+ const signed = {
240
+ space,
241
+ contract: {
242
+ storageHash,
243
+ profileHash
244
+ }
245
+ };
246
+ const controlAdapter = getControlAdapter();
247
+ const readHashes = async () => {
248
+ const marker = await controlAdapter.readMarker(driver, space);
249
+ return marker === null ? null : {
250
+ storageHash: marker.storageHash,
251
+ profileHash: marker.profileHash
252
+ };
253
+ };
254
+ const existing = await readHashes();
255
+ if (!sameMarkerHashes(existing, expected)) return {
256
+ ...signed,
257
+ status: "conflict",
258
+ expected,
259
+ found: existing
260
+ };
261
+ if (existing === null) {
262
+ await controlAdapter.initMarker(driver, space, {
263
+ storageHash,
264
+ profileHash
265
+ });
266
+ return {
267
+ ...signed,
268
+ status: "created"
269
+ };
270
+ }
271
+ if (existing.storageHash === storageHash && existing.profileHash === profileHash) return {
272
+ ...signed,
273
+ status: "unchanged"
274
+ };
275
+ if (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {
276
+ storageHash,
277
+ profileHash
278
+ })) return {
279
+ ...signed,
280
+ status: "conflict",
281
+ expected,
282
+ found: await readHashes()
283
+ };
284
+ return {
285
+ ...signed,
286
+ status: "updated",
287
+ previous: existing
288
+ };
289
+ }
236
290
  return {
237
291
  familyId: "mongo",
238
292
  deserializeContract(contractJson) {
@@ -300,65 +354,11 @@ function createMongoFamilyInstance(controlStack) {
300
354
  frameworkComponents: options.frameworkComponents
301
355
  });
302
356
  },
303
- async sign(options) {
304
- const { driver, contract: rawContract, contractPath, configPath } = options;
305
- const startTime = Date.now();
306
- const contract = asValidatedMongoContract(rawContract);
307
- const contractStorageHash = contract.storage.storageHash;
308
- const contractProfileHash = contract.profileHash;
309
- const controlAdapter = getControlAdapter();
310
- const mongoDriver = asMongoDriver(driver);
311
- const existingMarker = await controlAdapter.readMarker(mongoDriver, APP_SPACE_ID);
312
- let markerCreated = false;
313
- let markerUpdated = false;
314
- let previousHashes;
315
- if (!existingMarker) {
316
- await controlAdapter.initMarker(mongoDriver, APP_SPACE_ID, {
317
- storageHash: contractStorageHash,
318
- profileHash: contractProfileHash
319
- });
320
- markerCreated = true;
321
- } else {
322
- const storageHashMatches = existingMarker.storageHash === contractStorageHash;
323
- const profileHashMatches = existingMarker.profileHash === contractProfileHash;
324
- if (!storageHashMatches || !profileHashMatches) {
325
- previousHashes = {
326
- storageHash: existingMarker.storageHash,
327
- profileHash: existingMarker.profileHash
328
- };
329
- if (!await controlAdapter.updateMarker(mongoDriver, APP_SPACE_ID, existingMarker.storageHash, {
330
- storageHash: contractStorageHash,
331
- profileHash: contractProfileHash
332
- })) throw structuredError("MIGRATION.MARKER_CAS_FAILURE", "CAS conflict: marker was modified by another process during sign");
333
- markerUpdated = true;
334
- }
335
- }
336
- let summary;
337
- if (markerCreated) summary = "Database signed (marker created)";
338
- else if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? "unknown"})`;
339
- else summary = "Database already signed with this contract";
340
- return {
341
- ok: true,
342
- summary,
343
- contract: {
344
- storageHash: contractStorageHash,
345
- profileHash: contractProfileHash
346
- },
347
- target: {
348
- expected: contract.target,
349
- actual: contract.target
350
- },
351
- marker: {
352
- created: markerCreated,
353
- updated: markerUpdated,
354
- ...ifDefined("previous", previousHashes)
355
- },
356
- meta: {
357
- contractPath,
358
- ...ifDefined("configPath", configPath)
359
- },
360
- timings: { total: Date.now() - startTime }
361
- };
357
+ async signSpaces(options) {
358
+ const mongoDriver = asMongoDriver(options.driver);
359
+ const signatures = [];
360
+ for (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));
361
+ return signatures;
362
362
  },
363
363
  async readMarker(options) {
364
364
  return getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);
@@ -409,4 +409,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
409
409
  //#endregion
410
410
  export { mongoOperationsToPreview as i, formatMongoOperations as n, mongoFamilyDescriptor as r, createMongoFamilyInstance as t };
411
411
 
412
- //# sourceMappingURL=control-JuPlJeiS.mjs.map
412
+ //# sourceMappingURL=control-ISFViXu-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-ISFViXu-.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-B0bMHQW0.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-DXktQ6MF.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.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 { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\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}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})` : `db.${cmd.collection}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `db.${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 `db.${cmd.collection}.drop()`;\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 formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tconst candidate = operation;\n\t\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) continue;\n\t\tfor (const step of candidate[\"execute\"]) if (step.command && typeof step.command.accept === \"function\") statements.push(step.command.accept(formatter));\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/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\tlabel: \"database\",\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\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\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 jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\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\tlabel: `${propName}: ${bsonType}${suffix}`\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\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\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\tlabel: `options (${optLabels.join(\", \")})`,\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\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\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\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\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 readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\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\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\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 signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\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};\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, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sour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C;GAC7F,OAAO;EACR;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,eAAe,SAAS;GAC7B,OAAO,kBAAkB,CAAC,CAAC,eAAe,cAAc,QAAQ,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;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/family.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { d as defaultMongoStorageNamespaceId, u as defaultMongoDomainNamespaceId } from "./dist-D3mFP5N3.mjs";
2
2
  import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
3
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-BOMOzrka-CgmQMnNa.mjs";
3
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-DXktQ6MF-Bhtsznza.mjs";
4
4
  import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-PhZZAPWQ.mjs";
5
- import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-JuPlJeiS.mjs";
5
+ import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-ISFViXu-.mjs";
6
6
  import { t as MongoContractView$1 } from "./mongo-contract-view-JZOa0Ry--pWIg_ZtN.mjs";
7
7
  import { t as MongoSchemaVerifierBase } from "./ir-vZWjElPY.mjs";
8
8
  import { t as MongoMigration } from "./migration-B0n3l8u7.mjs";
@@ -1,3 +1,3 @@
1
1
  import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
2
- import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-JuPlJeiS.mjs";
2
+ import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-ISFViXu-.mjs";
3
3
  export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -1,5 +1,5 @@
1
1
  import { a as mongoAttributeSpecs } from "./interpreter-D3cYmZTX-TygWz2iq.mjs";
2
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-BOMOzrka-CgmQMnNa.mjs";
2
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-DXktQ6MF-Bhtsznza.mjs";
3
3
  //#region ../../../2-mongo-family/9-family/dist/pack.mjs
4
4
  const mongoFamilyPack = {
5
5
  kind: "family",
@@ -1 +1 @@
1
- {"version":3,"file":"family__pack.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/pack.mjs"],"sourcesContent":["import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-BOMOzrka.mjs\";\nimport { mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\n//#region src/exports/pack.ts\nconst mongoFamilyPack = {\n\tkind: \"family\",\n\tid: \"mongo\",\n\tfamilyId: \"mongo\",\n\tversion: \"0.0.1\",\n\tauthoring: {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoAttributeSpecs\n\t}\n};\n//#endregion\nexport { mongoFamilyPack as default, mongoFamilyEntityTypes, mongoFamilyPslBlockDescriptors };\n\n//# sourceMappingURL=pack.mjs.map"],"mappings":";;;AAGA,MAAM,kBAAkB;CACvB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW;EACV,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;AACD"}
1
+ {"version":3,"file":"family__pack.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/pack.mjs"],"sourcesContent":["import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-DXktQ6MF.mjs\";\nimport { mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\n//#region src/exports/pack.ts\nconst mongoFamilyPack = {\n\tkind: \"family\",\n\tid: \"mongo\",\n\tfamilyId: \"mongo\",\n\tversion: \"0.0.1\",\n\tauthoring: {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoAttributeSpecs\n\t}\n};\n//#endregion\nexport { mongoFamilyPack as default, mongoFamilyEntityTypes, mongoFamilyPslBlockDescriptors };\n\n//# sourceMappingURL=pack.mjs.map"],"mappings":";;;AAGA,MAAM,kBAAkB;CACvB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW;EACV,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;AACD"}
package/dist/runtime.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as newMongoCodecRegistry } from "./dist-CqUoKyeL.mjs";
2
2
  import { t as MongoParamRef } from "./dist-CO2arS1K.mjs";
3
3
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
4
- import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from "@prisma/orm-framework/components/runtime";
4
+ import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, onQueryEndOutsideTransaction, reportExecuteEnding, reportQueryEnding, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from "@prisma/orm-framework/components/runtime";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
7
7
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -511,7 +511,7 @@ var MongoRuntimeImpl = class extends RuntimeCore {
511
511
  #driver;
512
512
  #codecs;
513
513
  constructor(options) {
514
- const middleware = options.middleware ? [...options.middleware] : [];
514
+ const middleware = options.middleware ?? [];
515
515
  const targetId = options.context.stack.target.targetId;
516
516
  for (const mw of middleware) checkMiddlewareCompatibility(mw, "mongo", targetId);
517
517
  const ctx = {
@@ -589,20 +589,25 @@ var MongoRuntimeImpl = class extends RuntimeCore {
589
589
  const { codecCtx, middlewareCtx } = this.createQueryContexts(options);
590
590
  const generator = async function* () {
591
591
  const exec = await self.prepareQueryExecution(plan, codecCtx, middlewareCtx);
592
- const stream = runQueryWithMiddleware(exec, self.middleware, middlewareCtx, () => self.runDriver(exec));
593
- for await (const rawRow of stream) {
594
- checkAborted(codecCtx, "stream");
595
- if (exec.resultShape === void 0) yield blindCast(rawRow);
596
- else yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, self.#codecs, exec.command.collection, codecCtx));
597
- }
592
+ yield* reportQueryEnding(onQueryEndOutsideTransaction(self.afterTransactionStageFor(exec, middlewareCtx)), () => self.#decodedRows(exec, codecCtx, middlewareCtx));
598
593
  };
599
594
  return new AsyncIterableResult(generator());
600
595
  }
596
+ async *#decodedRows(exec, codecCtx, middlewareCtx) {
597
+ const stream = runQueryWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runDriver(exec));
598
+ for await (const rawRow of stream) {
599
+ checkAborted(codecCtx, "stream");
600
+ if (exec.resultShape === void 0) yield blindCast(rawRow);
601
+ else yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, this.#codecs, exec.command.collection, codecCtx));
602
+ }
603
+ }
601
604
  async execute(plan, options) {
602
605
  const { codecCtx, middlewareCtx } = this.createQueryContexts(options);
603
606
  const exec = await this.prepareExecuteExecution(plan, codecCtx, middlewareCtx);
604
- checkAborted(codecCtx, "stream");
605
- return runExecuteWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runExecute(exec));
607
+ return reportExecuteEnding(onQueryEndOutsideTransaction(this.afterTransactionStageFor(exec, middlewareCtx)), async () => {
608
+ checkAborted(codecCtx, "stream");
609
+ return runExecuteWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runExecute(exec));
610
+ });
606
611
  }
607
612
  async #readDriverStatistics(exec) {
608
613
  const countField = statisticsCountField(exec.command.kind);
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":["#adapter","#driver","#codecs","#readDriverStatistics"],"sources":["../../../../2-mongo-family/7-runtime/dist/index.mjs"],"sourcesContent":["import { createExecutionStack } from \"@internal/framework-components/execution\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from \"@internal/framework-components/runtime\";\nimport { newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { hashContent } from \"@internal/utils/hash-content\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { MongoParamRef } from \"@internal/mongo-value\";\n//#region src/mongo-execution-stack.ts\nfunction createMongoExecutionStack(options) {\n\treturn blindCast(createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\n\t}));\n}\nfunction createMongoExecutionContext(options) {\n\tconst registry = newMongoCodecRegistry();\n\tconst owners = /* @__PURE__ */ new Map();\n\tconst contributors = [\n\t\toptions.stack.target,\n\t\toptions.stack.adapter,\n\t\t...options.stack.extensions\n\t];\n\tconst generators = collectMutationDefaultGenerators(contributors);\n\tconst execution = executionOf(options.contract);\n\tassertMutationDefaultGeneratorsAvailable(execution, generators);\n\tfor (const contributor of contributors) {\n\t\tconst contributed = contributor.codecs();\n\t\tfor (const codec of iterateCodecs(contributed)) {\n\t\t\tconst existingOwner = owners.get(codec.id);\n\t\t\tif (existingOwner !== void 0) throw runtimeError(\"RUNTIME.DUPLICATE_CODEC\", `Duplicate Mongo codec id '${codec.id}' contributed by '${contributor.id}' (already registered by '${existingOwner}').`, {\n\t\t\t\tcodecId: codec.id,\n\t\t\t\texistingOwner,\n\t\t\t\tincomingOwner: contributor.id\n\t\t\t});\n\t\t\tregistry.register(codec);\n\t\t\towners.set(codec.id, contributor.id);\n\t\t}\n\t}\n\treturn Object.freeze({\n\t\tcontract: options.contract,\n\t\tcodecs: registry,\n\t\tstack: options.stack,\n\t\tapplyMutationDefaults: (mutation) => applyMutationDefaults(execution, generators, mutation)\n\t});\n}\nfunction executionOf(contract) {\n\treturn blindCast(contract)?.execution;\n}\nfunction* iterateCodecs(registry) {\n\tyield* registry.values();\n}\n//#endregion\n//#region src/codecs/decoding.ts\nconst WIRE_PREVIEW_LIMIT = 100;\nfunction truncate(text) {\n\treturn text.length > WIRE_PREVIEW_LIMIT ? `${text.substring(0, WIRE_PREVIEW_LIMIT)}...` : text;\n}\n/**\n* JSON text of the wire value, using each BSON class's own JSON form (an `ObjectId` as its hex string, a `Date` as ISO text), or `String(value)` when it has none.\n*/\nfunction previewWireValue(wireValue) {\n\tif (typeof wireValue === \"string\") return truncate(wireValue);\n\ttry {\n\t\treturn truncate(JSON.stringify(wireValue, (_key, value) => typeof value === \"bigint\" ? `${value}n` : value) ?? String(wireValue));\n\t} catch {\n\t\treturn truncate(String(wireValue));\n\t}\n}\nfunction hasHexString(value) {\n\treturn \"toHexString\" in value && typeof value.toHexString === \"function\";\n}\nfunction describeDocumentId(id) {\n\tif (id === void 0) return void 0;\n\tif (typeof id === \"string\") return JSON.stringify(id);\n\tif (typeof id === \"object\" && id !== null && hasHexString(id)) return id.toHexString();\n\treturn previewWireValue(id);\n}\n/**\n* Every decode failure names the collection and field, and the `_id` of the document when the row carries one; inside a document shape marked `row`, that document's `_id` and the field's path from it. A codec's own `RUNTIME.DECODE_FAILED` keeps its code and details, with the location added; any other structured envelope (a dotted `code`, per `isStructuredError`) and an `InternalError` pass through unchanged; everything else is wrapped in a `RUNTIME.DECODE_FAILED` envelope. The original error is the `cause`.\n*/\nfunction wrapDecodeFailure(error, location, codecId, wireValue) {\n\tif (isInternalError(error)) throw error;\n\tconst codecDetails = isStructuredError(error) ? error.meta : void 0;\n\tif (isStructuredError(error) && error.code !== \"RUNTIME.DECODE_FAILED\") throw error;\n\tconst { collection, path, documentId } = location;\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst wrapped = runtimeError(\"RUNTIME.DECODE_FAILED\", `Failed to decode field ${path}${documentId === void 0 ? \"\" : ` of the document with _id ${documentId}`} in collection '${collection}' with codec '${codecId}': ${message}`, {\n\t\t...codecDetails,\n\t\tcollection,\n\t\tpath,\n\t\t...ifDefined(\"documentId\", documentId),\n\t\tcodec: codecId,\n\t\twirePreview: previewWireValue(wireValue)\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\n/**\n* A document may leave out a nullable field entirely (Prisma 6 and the driver both omit it); the field's type says `null`, so an absent value reads as `null`.\n*/\nfunction absentAsNull(value, nullable) {\n\treturn value === void 0 && nullable ? null : value;\n}\nasync function decodeMongoRow(row, shape, registry, collection, ctx = {}) {\n\tif (shape.kind === \"unknown\") return row;\n\tif (typeof row !== \"object\" || row === null) return row;\n\tconst rowObj = blindCast(row);\n\tconst out = {};\n\tconst tasks = [];\n\tfunction scheduleLeaf(path, documentId, codecId, wire, assign) {\n\t\tconst codec = registry.get(codecId);\n\t\tif (!codec) {\n\t\t\tassign(wire);\n\t\t\treturn;\n\t\t}\n\t\ttasks.push((async () => {\n\t\t\ttry {\n\t\t\t\tassign(await codec.decode(wire, ctx));\n\t\t\t} catch (error) {\n\t\t\t\twrapDecodeFailure(error, {\n\t\t\t\t\tcollection,\n\t\t\t\t\tpath,\n\t\t\t\t\tdocumentId\n\t\t\t\t}, codecId, wire);\n\t\t\t}\n\t\t})());\n\t}\n\tfunction walkField(value, fieldShape, path, documentId, assign) {\n\t\tswitch (fieldShape.kind) {\n\t\t\tcase \"unknown\":\n\t\t\t\tassign(value);\n\t\t\t\treturn;\n\t\t\tcase \"leaf\":\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tscheduleLeaf(path, documentId, fieldShape.codecId, value, assign);\n\t\t\t\treturn;\n\t\t\tcase \"document\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst vObj = blindCast(value);\n\t\t\t\tconst nested = { ...vObj };\n\t\t\t\tassign(nested);\n\t\t\t\tfor (const [fk, fShape] of Object.entries(fieldShape.fields)) walkField(vObj[fk], fShape, fieldShape.row ? fk : `${path}.${fk}`, fieldShape.row ? describeDocumentId(vObj[\"_id\"]) : documentId, (v) => {\n\t\t\t\t\tnested[fk] = v;\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"array\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst arr = [];\n\t\t\t\tassign(arr);\n\t\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\t\tconst el = value[i];\n\t\t\t\t\twalkField(el, fieldShape.element, `${path}.${i}`, documentId, (v) => {\n\t\t\t\t\t\tarr[i] = v;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t/* v8 ignore stop */\n\t}\n\tconst documentId = describeDocumentId(rowObj[\"_id\"]);\n\tfor (const [k, fShape] of Object.entries(shape.fields)) walkField(rowObj[k], fShape, k, documentId, (v) => {\n\t\tout[k] = v;\n\t});\n\tfor (const k of Object.keys(rowObj)) if (!Object.hasOwn(shape.fields, k)) out[k] = rowObj[k];\n\tawait Promise.all(tasks);\n\treturn out;\n}\n//#endregion\n//#region src/content-hash.ts\n/** @internal */\nconst RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND = \"RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND\";\n/**\n* Resolved wire commands are frozen class instances (`InsertOneWireCommand`, …);\n* pre-resolve `beforeExecute` plans hold a plain-object `MongoLoweredDraft` in the\n* command slot. O(1) prototype check — no tree walk on the hot path.\n*/\nfunction isResolvedMongoWireCommand(command) {\n\tif (command === null || typeof command !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(command);\n\treturn proto !== null && proto !== Object.prototype;\n}\nfunction assertContentHashOnResolvedCommand(command) {\n\tif (isResolvedMongoWireCommand(command)) return;\n\tthrow runtimeError(RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND, \"contentHash and computeMongoContentHash are only valid on a resolved wire command after parameter resolution. During a before hook, plan.command holds an unresolved MongoLoweredDraft — use params.entries() and the param mutator instead of contentHash or structural reads of plan.command.\", { phase: \"beforeExecute\" });\n}\n/**\n* Computes a stable content hash for a lowered Mongo execution plan.\n*\n* Internally builds an unambiguous canonical-stringified preimage from\n* two components:\n*\n* 1. `meta.storageHash` — discriminates by schema. A migration changes the\n* storage hash, which invalidates cached entries automatically (no\n* per-app invalidation logic needed for schema changes).\n* 2. `exec.command` — the wire command. `canonicalStringify` produces a\n* deterministic serialization that is stable across object key\n* insertion order and that distinguishes types JSON would otherwise\n* conflate (e.g. `BigInt(1)` vs `1`, `Date` vs ISO string, `Buffer`\n* vs number array). The spread converts the frozen wire-command\n* class instance (`InsertOneWireCommand`, `AggregateWireCommand`, …)\n* into a plain object exposing its own enumerable properties\n* (`kind`, `collection`, plus the payload-specific fields like\n* `document`/`filter`/`update`/`pipeline`/…), which is what\n* `canonicalStringify` accepts; class instances are rejected\n* outright to prevent silent collisions.\n*\n* Unlike SQL, there is no separate \"rendered statement\" component because\n* a Mongo `MongoExecutionPlan.command` is the wire command itself —\n* canonicalizing it captures both structure and parameters in one pass.\n*\n* The components are wrapped in an object and canonicalized as a single\n* unit (rather than concatenated with a delimiter) so component\n* boundaries are unambiguous and cannot collide with a different split\n* of the same characters.\n*\n* The canonical string is then piped through `hashContent` to produce a\n* bounded, opaque digest. See `@internal/utils/hash-content` for the\n* rationale.\n*\n* @throws {RuntimeErrorEnvelope} {@link RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND}\n* when `exec.command` is still a pre-resolve draft (plain object), e.g. when\n* `contentHash` is called from `beforeExecute`.\n*\n* @internal\n*/\nfunction computeMongoContentHash(exec) {\n\tassertContentHashOnResolvedCommand(exec.command);\n\treturn hashContent(canonicalStringify({\n\t\tstorageHash: exec.meta.storageHash,\n\t\tcommand: { ...exec.command }\n\t}));\n}\n//#endregion\n//#region src/param-ref-mutator.ts\nfunction* flattenDraftSlot(value) {\n\tif (value instanceof MongoParamRef) {\n\t\tyield value;\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) yield* flattenDraftSlot(item);\n\t\treturn;\n\t}\n\tif (isPlainRecord(value)) for (const v of Object.values(value)) yield* flattenDraftSlot(v);\n}\n/**\n* Flat walk over a `MongoLoweredDraft` yielding every `MongoParamRef` leaf\n* regardless of nesting — object values, array elements, filter predicate\n* values, update operator values, and pipeline stage values. Raw command\n* variants carry no `MongoParamRef` nodes so they yield zero entries.\n*\n* **Walk parity:** slot traversal matches `resolveDraftSlot` / `resolveParams`\n* — refs appear only in plain-object and array containers; `Date` and other\n* non-plain objects are leaves (not descended into), so middleware sees every\n* ref the resolve pass will encode.\n*/\nfunction* flattenMongoParamRefs(draft) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\":\n\t\tcase \"rawInsertOne\":\n\t\t\tyield* flattenDraftSlot(draft.document);\n\t\t\tbreak;\n\t\tcase \"insertMany\":\n\t\tcase \"rawInsertMany\":\n\t\t\tfor (const doc of draft.documents) yield* flattenDraftSlot(doc);\n\t\t\tbreak;\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\":\n\t\tcase \"rawUpdateOne\":\n\t\tcase \"rawUpdateMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"findOneAndUpdate\":\n\t\tcase \"rawFindOneAndUpdate\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\":\n\t\tcase \"rawDeleteOne\":\n\t\tcase \"rawDeleteMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"findOneAndDelete\":\n\t\tcase \"rawFindOneAndDelete\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"aggregate\":\n\t\tcase \"rawAggregate\":\n\t\t\tfor (const stage of draft.pipeline) yield* flattenDraftSlot(stage);\n\t\t\tbreak;\n\t}\n}\nfunction substituteSlot(value, overrides) {\n\tif (value instanceof MongoParamRef) {\n\t\tif (overrides.has(value)) return new MongoParamRef(overrides.get(value), {\n\t\t\t...ifDefined(\"name\", value.name),\n\t\t\t...ifDefined(\"codecId\", value.codecId),\n\t\t\t...ifDefined(\"collection\", value.collection)\n\t\t});\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) return value.map((item) => substituteSlot(item, overrides));\n\tif (isPlainRecord(value)) {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = substituteSlot(v, overrides);\n\t\treturn out;\n\t}\n\treturn value;\n}\nfunction substituteDoc(doc, overrides) {\n\treturn blindCast(substituteSlot(doc, overrides));\n}\nfunction isUpdatePipeline(update) {\n\treturn Array.isArray(update);\n}\nfunction substituteUpdate(update, overrides) {\n\tif (isUpdatePipeline(update)) return update.map((stage) => substituteDoc(stage, overrides));\n\treturn substituteDoc(update, overrides);\n}\nfunction buildMutatedDraft(draft, overrides) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\": return {\n\t\t\tkind: \"insertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"rawInsertOne\": return {\n\t\t\tkind: \"rawInsertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"insertMany\": return {\n\t\t\tkind: \"insertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"rawInsertMany\": return {\n\t\t\tkind: \"rawInsertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"updateOne\": return {\n\t\t\tkind: \"updateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"updateMany\": return {\n\t\t\tkind: \"updateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"rawUpdateOne\": return {\n\t\t\tkind: \"rawUpdateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides)\n\t\t};\n\t\tcase \"rawUpdateMany\": return {\n\t\t\tkind: \"rawUpdateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides)\n\t\t};\n\t\tcase \"deleteOne\": return {\n\t\t\tkind: \"deleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"deleteMany\": return {\n\t\t\tkind: \"deleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteOne\": return {\n\t\t\tkind: \"rawDeleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteMany\": return {\n\t\t\tkind: \"rawDeleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"findOneAndUpdate\": return {\n\t\t\tkind: \"findOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"rawFindOneAndUpdate\": return {\n\t\t\tkind: \"rawFindOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"findOneAndDelete\": return {\n\t\t\tkind: \"findOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"rawFindOneAndDelete\": return {\n\t\t\tkind: \"rawFindOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"aggregate\": return {\n\t\t\tkind: \"aggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t\tcase \"rawAggregate\": return {\n\t\t\tkind: \"rawAggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t}\n}\n/**\n* Build a {@link MongoParamRefMutatorInternal} for the given lowered draft.\n*\n* The mutator captures the draft by reference and uses `flattenMongoParamRefs`\n* on demand to produce `entries()`. Replacements are stored in a lazily-\n* allocated `Map`; the fast path (no replacements) preserves bit-for-bit\n* reference identity to the original draft in `currentDraft()`.\n*/\nfunction createMongoParamRefMutator(draft) {\n\tconst originalDraft = draft;\n\tlet overrides;\n\tconst ensureOverrides = () => {\n\t\tif (!overrides) overrides = /* @__PURE__ */ new Map();\n\t\treturn overrides;\n\t};\n\tfunction* entries() {\n\t\tfor (const ref of flattenMongoParamRefs(originalDraft)) yield blindCast({\n\t\t\tref: blindCast(ref),\n\t\t\tvalue: overrides?.has(ref) ? overrides.get(ref) : ref.value,\n\t\t\tcodecId: ref.codecId\n\t\t});\n\t}\n\tfunction replaceValue(handle, newValue) {\n\t\tensureOverrides().set(blindCast(handle), newValue);\n\t}\n\tfunction replaceValues(updates) {\n\t\tconst map = ensureOverrides();\n\t\tfor (const { ref, newValue } of updates) map.set(blindCast(ref), newValue);\n\t}\n\treturn {\n\t\tentries,\n\t\treplaceValue: blindCast(replaceValue),\n\t\treplaceValues,\n\t\tcurrentDraft() {\n\t\t\tif (!overrides || overrides.size === 0) return originalDraft;\n\t\t\treturn buildMutatedDraft(originalDraft, overrides);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/mongo-runtime.ts\nfunction noop() {}\nfunction isUnknownRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction statisticsCountField(commandKind) {\n\tswitch (commandKind) {\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\": return \"modifiedCount\";\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\": return \"deletedCount\";\n\t\tdefault: return;\n\t}\n}\nfunction invalidStatisticsResult(commandKind, countField) {\n\treturn runtimeError(\"RUNTIME.MONGO_STATISTICS_RESULT_INVALID\", `Mongo command '${commandKind}' did not return exactly one numeric '${countField}' result`, {\n\t\tcommandKind,\n\t\tcountField\n\t});\n}\nvar MongoRuntimeImpl = class extends RuntimeCore {\n\t#adapter;\n\t#driver;\n\t#codecs;\n\tconstructor(options) {\n\t\tconst middleware = options.middleware ? [...options.middleware] : [];\n\t\tconst targetId = options.context.stack.target.targetId;\n\t\tfor (const mw of middleware) checkMiddlewareCompatibility(mw, \"mongo\", targetId);\n\t\tconst ctx = {\n\t\t\tcontract: options.context.contract,\n\t\t\tmode: options.mode ?? \"strict\",\n\t\t\tnow: () => Date.now(),\n\t\t\tlog: {\n\t\t\t\tinfo: noop,\n\t\t\t\twarn: noop,\n\t\t\t\terror: noop\n\t\t\t},\n\t\t\tcontentHash: (exec) => computeMongoContentHash(blindCast(exec)),\n\t\t\tscope: \"runtime\",\n\t\t\tplanExecutionId: \"\"\n\t\t};\n\t\tsuper({\n\t\t\tmiddleware,\n\t\t\tctx\n\t\t});\n\t\tconst adapterInstance = options.context.stack.adapter.create(options.context.stack);\n\t\tthis.#adapter = adapterInstance;\n\t\tthis.#driver = options.driver;\n\t\tthis.#codecs = options.context.codecs;\n\t}\n\t/* v8 ignore start -- one-phase lower satisfies RuntimeCore; operations use the split preparation pipeline */\n\tasync lower(plan, ctx) {\n\t\treturn {\n\t\t\tcommand: await this.#adapter.lower(plan, ctx),\n\t\t\tmeta: plan.meta,\n\t\t\t...ifDefined(\"resultShape\", plan.resultShape)\n\t\t};\n\t}\n\t/* v8 ignore stop */\n\trunDriver(exec) {\n\t\treturn this.#driver.execute(exec.command);\n\t}\n\trunExecute(exec) {\n\t\treturn this.#readDriverStatistics(exec);\n\t}\n\tcreateQueryContexts(options) {\n\t\tconst signal = options?.signal;\n\t\treturn {\n\t\t\tcodecCtx: signal === void 0 ? {} : { signal },\n\t\t\tmiddlewareCtx: {\n\t\t\t\t...this.ctx,\n\t\t\t\t...ifDefined(\"signal\", signal),\n\t\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t\t}\n\t\t};\n\t}\n\tprepareQueryExecution(plan, codecCtx, middlewareCtx) {\n\t\treturn this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeQueryChain);\n\t}\n\tprepareExecuteExecution(plan, codecCtx, middlewareCtx) {\n\t\treturn this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeExecuteChain);\n\t}\n\tasync prepareOperation(plan, codecCtx, middlewareCtx, runBefore) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst compiled = await this.runBeforeCompile(plan);\n\t\tconst draft = this.#adapter.structuralLower(compiled);\n\t\tconst mutator = createMongoParamRefMutator(draft);\n\t\tawait runBefore({\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: blindCast(draft)\n\t\t}, this.middleware, middlewareCtx, mutator);\n\t\treturn {\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: await this.#adapter.resolveParams(mutator.currentDraft(), codecCtx)\n\t\t};\n\t}\n\tquery(plan, options) {\n\t\tconst self = this;\n\t\tconst { codecCtx, middlewareCtx } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tconst exec = await self.prepareQueryExecution(plan, codecCtx, middlewareCtx);\n\t\t\tconst stream = runQueryWithMiddleware(exec, self.middleware, middlewareCtx, () => self.runDriver(exec));\n\t\t\tfor await (const rawRow of stream) {\n\t\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\t\tif (exec.resultShape === void 0) yield blindCast(rawRow);\n\t\t\t\telse yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, self.#codecs, exec.command.collection, codecCtx));\n\t\t\t}\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync execute(plan, options) {\n\t\tconst { codecCtx, middlewareCtx } = this.createQueryContexts(options);\n\t\tconst exec = await this.prepareExecuteExecution(plan, codecCtx, middlewareCtx);\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\treturn runExecuteWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runExecute(exec));\n\t}\n\tasync #readDriverStatistics(exec) {\n\t\tconst countField = statisticsCountField(exec.command.kind);\n\t\tif (countField === void 0) throw runtimeError(\"RUNTIME.MONGO_STATISTICS_UNSUPPORTED\", `Mongo command '${exec.command.kind}' does not expose statement statistics`, { commandKind: exec.command.kind });\n\t\tlet affectedRows;\n\t\tfor await (const result of this.#driver.execute(exec.command)) {\n\t\t\tif (affectedRows !== void 0 || !isUnknownRecord(result)) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\tconst count = result[countField];\n\t\t\tif (typeof count !== \"number\") throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\taffectedRows = count;\n\t\t}\n\t\tif (affectedRows === void 0) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\treturn { affectedRows };\n\t}\n\tasync close() {\n\t\tawait this.#driver.close();\n\t}\n};\nfunction createMongoRuntime(options) {\n\treturn new MongoRuntimeImpl(options);\n}\n//#endregion\nexport { createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, flattenMongoParamRefs };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,UAAU,qBAAqB;EACrC,QAAQ,QAAQ;EAChB,SAAS,QAAQ;EACjB,QAAQ,QAAQ;EAChB,YAAY,QAAQ;CACrB,CAAC,CAAC;AACH;AACA,SAAS,4BAA4B,SAAS;CAC7C,MAAM,WAAW,sBAAsB;CACvC,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,eAAe;EACpB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,GAAG,QAAQ,MAAM;CAClB;CACA,MAAM,aA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EAAE,UAAU,kBAAkB,KAAK,oBAAoB,OAAO;EACpE,MAAM,OAAO,MAAM,KAAK,wBAAwB,MAAM,UAAU,aAAa;EAC7E,aAAa,UAAU,QAAQ;EAC/B,OAAO,yBAAyB,MAAM,KAAK,YAAY,qBAAqB,KAAK,WAAW,IAAI,CAAC;CAClG;CACA,MAAMC,sBAAsB,MAAM;EACjC,MAAM,aAAa,qBAAqB,KAAK,QAAQ,IAAI;EACzD,IAAI,eAAe,KAAK,GAAG,MAAM,aAAa,wCAAwC,kBAAkB,KAAK,QAAQ,KAAK,yCAAyC,EAAE,aAAa,KAAK,QAAQ,KAAK,CAAC;EACrM,IAAI;EACJ,WAAW,MAAM,UAAU,KAAKF,QAAQ,QAAQ,KAAK,OAAO,GAAG;GAC9D,IAAI,iBAAiB,KAAK,KAAK,CAAC,gBAAgB,MAAM,GAAG,MAAM,wBAAwB,KAAK,QAAQ,MAAM,UAAU;GACpH,MAAM,QAAQ,OAAO;GACrB,IAAI,OAAO,UAAU,UAAU,MAAM,wBAAwB,KAAK,QAAQ,MAAM,UAAU;GAC1F,eAAe;EAChB;EACA,IAAI,iBAAiB,KAAK,GAAG,MAAM,wBAAwB,KAAK,QAAQ,MAAM,UAAU;EACxF,OAAO,EAAE,aAAa;CACvB;CACA,MAAM,QAAQ;EACb,MAAM,KAAKA,QAAQ,MAAM;CAC1B;AACD;AACA,SAAS,mBAAmB,SAAS;CACpC,OAAO,IAAI,iBAAiB,OAAO;AACpC"}
1
+ {"version":3,"file":"runtime.mjs","names":["#adapter","#driver","#codecs","#readDriverStatistics","#decodedRows"],"sources":["../../../../2-mongo-family/7-runtime/dist/index.mjs"],"sourcesContent":["import { createExecutionStack } from \"@internal/framework-components/execution\";\nimport { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, onQueryEndOutsideTransaction, reportExecuteEnding, reportQueryEnding, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from \"@internal/framework-components/runtime\";\nimport { newMongoCodecRegistry } from \"@internal/mongo-codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { isInternalError } from \"@internal/utils/internal-error\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { hashContent } from \"@internal/utils/hash-content\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { MongoParamRef } from \"@internal/mongo-value\";\n//#region src/mongo-execution-stack.ts\nfunction createMongoExecutionStack(options) {\n\treturn blindCast(createExecutionStack({\n\t\ttarget: options.target,\n\t\tadapter: options.adapter,\n\t\tdriver: options.driver,\n\t\textensions: options.extensions\n\t}));\n}\nfunction createMongoExecutionContext(options) {\n\tconst registry = newMongoCodecRegistry();\n\tconst owners = /* @__PURE__ */ new Map();\n\tconst contributors = [\n\t\toptions.stack.target,\n\t\toptions.stack.adapter,\n\t\t...options.stack.extensions\n\t];\n\tconst generators = collectMutationDefaultGenerators(contributors);\n\tconst execution = executionOf(options.contract);\n\tassertMutationDefaultGeneratorsAvailable(execution, generators);\n\tfor (const contributor of contributors) {\n\t\tconst contributed = contributor.codecs();\n\t\tfor (const codec of iterateCodecs(contributed)) {\n\t\t\tconst existingOwner = owners.get(codec.id);\n\t\t\tif (existingOwner !== void 0) throw runtimeError(\"RUNTIME.DUPLICATE_CODEC\", `Duplicate Mongo codec id '${codec.id}' contributed by '${contributor.id}' (already registered by '${existingOwner}').`, {\n\t\t\t\tcodecId: codec.id,\n\t\t\t\texistingOwner,\n\t\t\t\tincomingOwner: contributor.id\n\t\t\t});\n\t\t\tregistry.register(codec);\n\t\t\towners.set(codec.id, contributor.id);\n\t\t}\n\t}\n\treturn Object.freeze({\n\t\tcontract: options.contract,\n\t\tcodecs: registry,\n\t\tstack: options.stack,\n\t\tapplyMutationDefaults: (mutation) => applyMutationDefaults(execution, generators, mutation)\n\t});\n}\nfunction executionOf(contract) {\n\treturn blindCast(contract)?.execution;\n}\nfunction* iterateCodecs(registry) {\n\tyield* registry.values();\n}\n//#endregion\n//#region src/codecs/decoding.ts\nconst WIRE_PREVIEW_LIMIT = 100;\nfunction truncate(text) {\n\treturn text.length > WIRE_PREVIEW_LIMIT ? `${text.substring(0, WIRE_PREVIEW_LIMIT)}...` : text;\n}\n/**\n* JSON text of the wire value, using each BSON class's own JSON form (an `ObjectId` as its hex string, a `Date` as ISO text), or `String(value)` when it has none.\n*/\nfunction previewWireValue(wireValue) {\n\tif (typeof wireValue === \"string\") return truncate(wireValue);\n\ttry {\n\t\treturn truncate(JSON.stringify(wireValue, (_key, value) => typeof value === \"bigint\" ? `${value}n` : value) ?? String(wireValue));\n\t} catch {\n\t\treturn truncate(String(wireValue));\n\t}\n}\nfunction hasHexString(value) {\n\treturn \"toHexString\" in value && typeof value.toHexString === \"function\";\n}\nfunction describeDocumentId(id) {\n\tif (id === void 0) return void 0;\n\tif (typeof id === \"string\") return JSON.stringify(id);\n\tif (typeof id === \"object\" && id !== null && hasHexString(id)) return id.toHexString();\n\treturn previewWireValue(id);\n}\n/**\n* Every decode failure names the collection and field, and the `_id` of the document when the row carries one; inside a document shape marked `row`, that document's `_id` and the field's path from it. A codec's own `RUNTIME.DECODE_FAILED` keeps its code and details, with the location added; any other structured envelope (a dotted `code`, per `isStructuredError`) and an `InternalError` pass through unchanged; everything else is wrapped in a `RUNTIME.DECODE_FAILED` envelope. The original error is the `cause`.\n*/\nfunction wrapDecodeFailure(error, location, codecId, wireValue) {\n\tif (isInternalError(error)) throw error;\n\tconst codecDetails = isStructuredError(error) ? error.meta : void 0;\n\tif (isStructuredError(error) && error.code !== \"RUNTIME.DECODE_FAILED\") throw error;\n\tconst { collection, path, documentId } = location;\n\tconst message = error instanceof Error ? error.message : String(error);\n\tconst wrapped = runtimeError(\"RUNTIME.DECODE_FAILED\", `Failed to decode field ${path}${documentId === void 0 ? \"\" : ` of the document with _id ${documentId}`} in collection '${collection}' with codec '${codecId}': ${message}`, {\n\t\t...codecDetails,\n\t\tcollection,\n\t\tpath,\n\t\t...ifDefined(\"documentId\", documentId),\n\t\tcodec: codecId,\n\t\twirePreview: previewWireValue(wireValue)\n\t});\n\twrapped.cause = error;\n\tthrow wrapped;\n}\n/**\n* A document may leave out a nullable field entirely (Prisma 6 and the driver both omit it); the field's type says `null`, so an absent value reads as `null`.\n*/\nfunction absentAsNull(value, nullable) {\n\treturn value === void 0 && nullable ? null : value;\n}\nasync function decodeMongoRow(row, shape, registry, collection, ctx = {}) {\n\tif (shape.kind === \"unknown\") return row;\n\tif (typeof row !== \"object\" || row === null) return row;\n\tconst rowObj = blindCast(row);\n\tconst out = {};\n\tconst tasks = [];\n\tfunction scheduleLeaf(path, documentId, codecId, wire, assign) {\n\t\tconst codec = registry.get(codecId);\n\t\tif (!codec) {\n\t\t\tassign(wire);\n\t\t\treturn;\n\t\t}\n\t\ttasks.push((async () => {\n\t\t\ttry {\n\t\t\t\tassign(await codec.decode(wire, ctx));\n\t\t\t} catch (error) {\n\t\t\t\twrapDecodeFailure(error, {\n\t\t\t\t\tcollection,\n\t\t\t\t\tpath,\n\t\t\t\t\tdocumentId\n\t\t\t\t}, codecId, wire);\n\t\t\t}\n\t\t})());\n\t}\n\tfunction walkField(value, fieldShape, path, documentId, assign) {\n\t\tswitch (fieldShape.kind) {\n\t\t\tcase \"unknown\":\n\t\t\t\tassign(value);\n\t\t\t\treturn;\n\t\t\tcase \"leaf\":\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tscheduleLeaf(path, documentId, fieldShape.codecId, value, assign);\n\t\t\t\treturn;\n\t\t\tcase \"document\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst vObj = blindCast(value);\n\t\t\t\tconst nested = { ...vObj };\n\t\t\t\tassign(nested);\n\t\t\t\tfor (const [fk, fShape] of Object.entries(fieldShape.fields)) walkField(vObj[fk], fShape, fieldShape.row ? fk : `${path}.${fk}`, fieldShape.row ? describeDocumentId(vObj[\"_id\"]) : documentId, (v) => {\n\t\t\t\t\tnested[fk] = v;\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"array\": {\n\t\t\t\tif (value === null || value === void 0) {\n\t\t\t\t\tassign(absentAsNull(value, fieldShape.nullable));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tassign(value);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst arr = [];\n\t\t\t\tassign(arr);\n\t\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\t\tconst el = value[i];\n\t\t\t\t\twalkField(el, fieldShape.element, `${path}.${i}`, documentId, (v) => {\n\t\t\t\t\t\tarr[i] = v;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t/* v8 ignore stop */\n\t}\n\tconst documentId = describeDocumentId(rowObj[\"_id\"]);\n\tfor (const [k, fShape] of Object.entries(shape.fields)) walkField(rowObj[k], fShape, k, documentId, (v) => {\n\t\tout[k] = v;\n\t});\n\tfor (const k of Object.keys(rowObj)) if (!Object.hasOwn(shape.fields, k)) out[k] = rowObj[k];\n\tawait Promise.all(tasks);\n\treturn out;\n}\n//#endregion\n//#region src/content-hash.ts\n/** @internal */\nconst RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND = \"RUNTIME.CONTENT_HASH_REQUIRES_RESOLVED_COMMAND\";\n/**\n* Resolved wire commands are frozen class instances (`InsertOneWireCommand`, …);\n* pre-resolve `beforeExecute` plans hold a plain-object `MongoLoweredDraft` in the\n* command slot. O(1) prototype check — no tree walk on the hot path.\n*/\nfunction isResolvedMongoWireCommand(command) {\n\tif (command === null || typeof command !== \"object\") return false;\n\tconst proto = Object.getPrototypeOf(command);\n\treturn proto !== null && proto !== Object.prototype;\n}\nfunction assertContentHashOnResolvedCommand(command) {\n\tif (isResolvedMongoWireCommand(command)) return;\n\tthrow runtimeError(RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND, \"contentHash and computeMongoContentHash are only valid on a resolved wire command after parameter resolution. During a before hook, plan.command holds an unresolved MongoLoweredDraft — use params.entries() and the param mutator instead of contentHash or structural reads of plan.command.\", { phase: \"beforeExecute\" });\n}\n/**\n* Computes a stable content hash for a lowered Mongo execution plan.\n*\n* Internally builds an unambiguous canonical-stringified preimage from\n* two components:\n*\n* 1. `meta.storageHash` — discriminates by schema. A migration changes the\n* storage hash, which invalidates cached entries automatically (no\n* per-app invalidation logic needed for schema changes).\n* 2. `exec.command` — the wire command. `canonicalStringify` produces a\n* deterministic serialization that is stable across object key\n* insertion order and that distinguishes types JSON would otherwise\n* conflate (e.g. `BigInt(1)` vs `1`, `Date` vs ISO string, `Buffer`\n* vs number array). The spread converts the frozen wire-command\n* class instance (`InsertOneWireCommand`, `AggregateWireCommand`, …)\n* into a plain object exposing its own enumerable properties\n* (`kind`, `collection`, plus the payload-specific fields like\n* `document`/`filter`/`update`/`pipeline`/…), which is what\n* `canonicalStringify` accepts; class instances are rejected\n* outright to prevent silent collisions.\n*\n* Unlike SQL, there is no separate \"rendered statement\" component because\n* a Mongo `MongoExecutionPlan.command` is the wire command itself —\n* canonicalizing it captures both structure and parameters in one pass.\n*\n* The components are wrapped in an object and canonicalized as a single\n* unit (rather than concatenated with a delimiter) so component\n* boundaries are unambiguous and cannot collide with a different split\n* of the same characters.\n*\n* The canonical string is then piped through `hashContent` to produce a\n* bounded, opaque digest. See `@internal/utils/hash-content` for the\n* rationale.\n*\n* @throws {RuntimeErrorEnvelope} {@link RUNTIME_CONTENT_HASH_REQUIRES_RESOLVED_COMMAND}\n* when `exec.command` is still a pre-resolve draft (plain object), e.g. when\n* `contentHash` is called from `beforeExecute`.\n*\n* @internal\n*/\nfunction computeMongoContentHash(exec) {\n\tassertContentHashOnResolvedCommand(exec.command);\n\treturn hashContent(canonicalStringify({\n\t\tstorageHash: exec.meta.storageHash,\n\t\tcommand: { ...exec.command }\n\t}));\n}\n//#endregion\n//#region src/param-ref-mutator.ts\nfunction* flattenDraftSlot(value) {\n\tif (value instanceof MongoParamRef) {\n\t\tyield value;\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) yield* flattenDraftSlot(item);\n\t\treturn;\n\t}\n\tif (isPlainRecord(value)) for (const v of Object.values(value)) yield* flattenDraftSlot(v);\n}\n/**\n* Flat walk over a `MongoLoweredDraft` yielding every `MongoParamRef` leaf\n* regardless of nesting — object values, array elements, filter predicate\n* values, update operator values, and pipeline stage values. Raw command\n* variants carry no `MongoParamRef` nodes so they yield zero entries.\n*\n* **Walk parity:** slot traversal matches `resolveDraftSlot` / `resolveParams`\n* — refs appear only in plain-object and array containers; `Date` and other\n* non-plain objects are leaves (not descended into), so middleware sees every\n* ref the resolve pass will encode.\n*/\nfunction* flattenMongoParamRefs(draft) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\":\n\t\tcase \"rawInsertOne\":\n\t\t\tyield* flattenDraftSlot(draft.document);\n\t\t\tbreak;\n\t\tcase \"insertMany\":\n\t\tcase \"rawInsertMany\":\n\t\t\tfor (const doc of draft.documents) yield* flattenDraftSlot(doc);\n\t\t\tbreak;\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\":\n\t\tcase \"rawUpdateOne\":\n\t\tcase \"rawUpdateMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"findOneAndUpdate\":\n\t\tcase \"rawFindOneAndUpdate\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tyield* flattenDraftSlot(draft.update);\n\t\t\tbreak;\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\":\n\t\tcase \"rawDeleteOne\":\n\t\tcase \"rawDeleteMany\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"findOneAndDelete\":\n\t\tcase \"rawFindOneAndDelete\":\n\t\t\tyield* flattenDraftSlot(draft.filter);\n\t\t\tbreak;\n\t\tcase \"aggregate\":\n\t\tcase \"rawAggregate\":\n\t\t\tfor (const stage of draft.pipeline) yield* flattenDraftSlot(stage);\n\t\t\tbreak;\n\t}\n}\nfunction substituteSlot(value, overrides) {\n\tif (value instanceof MongoParamRef) {\n\t\tif (overrides.has(value)) return new MongoParamRef(overrides.get(value), {\n\t\t\t...ifDefined(\"name\", value.name),\n\t\t\t...ifDefined(\"codecId\", value.codecId),\n\t\t\t...ifDefined(\"collection\", value.collection)\n\t\t});\n\t\treturn value;\n\t}\n\tif (Array.isArray(value)) return value.map((item) => substituteSlot(item, overrides));\n\tif (isPlainRecord(value)) {\n\t\tconst out = {};\n\t\tfor (const [k, v] of Object.entries(value)) out[k] = substituteSlot(v, overrides);\n\t\treturn out;\n\t}\n\treturn value;\n}\nfunction substituteDoc(doc, overrides) {\n\treturn blindCast(substituteSlot(doc, overrides));\n}\nfunction isUpdatePipeline(update) {\n\treturn Array.isArray(update);\n}\nfunction substituteUpdate(update, overrides) {\n\tif (isUpdatePipeline(update)) return update.map((stage) => substituteDoc(stage, overrides));\n\treturn substituteDoc(update, overrides);\n}\nfunction buildMutatedDraft(draft, overrides) {\n\tswitch (draft.kind) {\n\t\tcase \"insertOne\": return {\n\t\t\tkind: \"insertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"rawInsertOne\": return {\n\t\t\tkind: \"rawInsertOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocument: substituteDoc(draft.document, overrides)\n\t\t};\n\t\tcase \"insertMany\": return {\n\t\t\tkind: \"insertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"rawInsertMany\": return {\n\t\t\tkind: \"rawInsertMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tdocuments: draft.documents.map((d) => substituteDoc(d, overrides))\n\t\t};\n\t\tcase \"updateOne\": return {\n\t\t\tkind: \"updateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"updateMany\": return {\n\t\t\tkind: \"updateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert\n\t\t};\n\t\tcase \"rawUpdateOne\": return {\n\t\t\tkind: \"rawUpdateOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides)\n\t\t};\n\t\tcase \"rawUpdateMany\": return {\n\t\t\tkind: \"rawUpdateMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides)\n\t\t};\n\t\tcase \"deleteOne\": return {\n\t\t\tkind: \"deleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"deleteMany\": return {\n\t\t\tkind: \"deleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteOne\": return {\n\t\t\tkind: \"rawDeleteOne\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"rawDeleteMany\": return {\n\t\t\tkind: \"rawDeleteMany\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides)\n\t\t};\n\t\tcase \"findOneAndUpdate\": return {\n\t\t\tkind: \"findOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"rawFindOneAndUpdate\": return {\n\t\t\tkind: \"rawFindOneAndUpdate\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tupdate: substituteUpdate(draft.update, overrides),\n\t\t\tupsert: draft.upsert,\n\t\t\tsort: draft.sort,\n\t\t\treturnDocument: draft.returnDocument\n\t\t};\n\t\tcase \"findOneAndDelete\": return {\n\t\t\tkind: \"findOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"rawFindOneAndDelete\": return {\n\t\t\tkind: \"rawFindOneAndDelete\",\n\t\t\tcollection: draft.collection,\n\t\t\tfilter: substituteDoc(draft.filter, overrides),\n\t\t\tsort: draft.sort\n\t\t};\n\t\tcase \"aggregate\": return {\n\t\t\tkind: \"aggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t\tcase \"rawAggregate\": return {\n\t\t\tkind: \"rawAggregate\",\n\t\t\tcollection: draft.collection,\n\t\t\tpipeline: draft.pipeline.map((s) => substituteDoc(s, overrides))\n\t\t};\n\t}\n}\n/**\n* Build a {@link MongoParamRefMutatorInternal} for the given lowered draft.\n*\n* The mutator captures the draft by reference and uses `flattenMongoParamRefs`\n* on demand to produce `entries()`. Replacements are stored in a lazily-\n* allocated `Map`; the fast path (no replacements) preserves bit-for-bit\n* reference identity to the original draft in `currentDraft()`.\n*/\nfunction createMongoParamRefMutator(draft) {\n\tconst originalDraft = draft;\n\tlet overrides;\n\tconst ensureOverrides = () => {\n\t\tif (!overrides) overrides = /* @__PURE__ */ new Map();\n\t\treturn overrides;\n\t};\n\tfunction* entries() {\n\t\tfor (const ref of flattenMongoParamRefs(originalDraft)) yield blindCast({\n\t\t\tref: blindCast(ref),\n\t\t\tvalue: overrides?.has(ref) ? overrides.get(ref) : ref.value,\n\t\t\tcodecId: ref.codecId\n\t\t});\n\t}\n\tfunction replaceValue(handle, newValue) {\n\t\tensureOverrides().set(blindCast(handle), newValue);\n\t}\n\tfunction replaceValues(updates) {\n\t\tconst map = ensureOverrides();\n\t\tfor (const { ref, newValue } of updates) map.set(blindCast(ref), newValue);\n\t}\n\treturn {\n\t\tentries,\n\t\treplaceValue: blindCast(replaceValue),\n\t\treplaceValues,\n\t\tcurrentDraft() {\n\t\t\tif (!overrides || overrides.size === 0) return originalDraft;\n\t\t\treturn buildMutatedDraft(originalDraft, overrides);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/mongo-runtime.ts\nfunction noop() {}\nfunction isUnknownRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction statisticsCountField(commandKind) {\n\tswitch (commandKind) {\n\t\tcase \"updateOne\":\n\t\tcase \"updateMany\": return \"modifiedCount\";\n\t\tcase \"deleteOne\":\n\t\tcase \"deleteMany\": return \"deletedCount\";\n\t\tdefault: return;\n\t}\n}\nfunction invalidStatisticsResult(commandKind, countField) {\n\treturn runtimeError(\"RUNTIME.MONGO_STATISTICS_RESULT_INVALID\", `Mongo command '${commandKind}' did not return exactly one numeric '${countField}' result`, {\n\t\tcommandKind,\n\t\tcountField\n\t});\n}\nvar MongoRuntimeImpl = class extends RuntimeCore {\n\t#adapter;\n\t#driver;\n\t#codecs;\n\tconstructor(options) {\n\t\tconst middleware = options.middleware ?? [];\n\t\tconst targetId = options.context.stack.target.targetId;\n\t\tfor (const mw of middleware) checkMiddlewareCompatibility(mw, \"mongo\", targetId);\n\t\tconst ctx = {\n\t\t\tcontract: options.context.contract,\n\t\t\tmode: options.mode ?? \"strict\",\n\t\t\tnow: () => Date.now(),\n\t\t\tlog: {\n\t\t\t\tinfo: noop,\n\t\t\t\twarn: noop,\n\t\t\t\terror: noop\n\t\t\t},\n\t\t\tcontentHash: (exec) => computeMongoContentHash(blindCast(exec)),\n\t\t\tscope: \"runtime\",\n\t\t\tplanExecutionId: \"\"\n\t\t};\n\t\tsuper({\n\t\t\tmiddleware,\n\t\t\tctx\n\t\t});\n\t\tconst adapterInstance = options.context.stack.adapter.create(options.context.stack);\n\t\tthis.#adapter = adapterInstance;\n\t\tthis.#driver = options.driver;\n\t\tthis.#codecs = options.context.codecs;\n\t}\n\t/* v8 ignore start -- one-phase lower satisfies RuntimeCore; operations use the split preparation pipeline */\n\tasync lower(plan, ctx) {\n\t\treturn {\n\t\t\tcommand: await this.#adapter.lower(plan, ctx),\n\t\t\tmeta: plan.meta,\n\t\t\t...ifDefined(\"resultShape\", plan.resultShape)\n\t\t};\n\t}\n\t/* v8 ignore stop */\n\trunDriver(exec) {\n\t\treturn this.#driver.execute(exec.command);\n\t}\n\trunExecute(exec) {\n\t\treturn this.#readDriverStatistics(exec);\n\t}\n\tcreateQueryContexts(options) {\n\t\tconst signal = options?.signal;\n\t\treturn {\n\t\t\tcodecCtx: signal === void 0 ? {} : { signal },\n\t\t\tmiddlewareCtx: {\n\t\t\t\t...this.ctx,\n\t\t\t\t...ifDefined(\"signal\", signal),\n\t\t\t\tplanExecutionId: crypto.randomUUID()\n\t\t\t}\n\t\t};\n\t}\n\tprepareQueryExecution(plan, codecCtx, middlewareCtx) {\n\t\treturn this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeQueryChain);\n\t}\n\tprepareExecuteExecution(plan, codecCtx, middlewareCtx) {\n\t\treturn this.prepareOperation(plan, codecCtx, middlewareCtx, runBeforeExecuteChain);\n\t}\n\tasync prepareOperation(plan, codecCtx, middlewareCtx, runBefore) {\n\t\tcheckAborted(codecCtx, \"stream\");\n\t\tconst compiled = await this.runBeforeCompile(plan);\n\t\tconst draft = this.#adapter.structuralLower(compiled);\n\t\tconst mutator = createMongoParamRefMutator(draft);\n\t\tawait runBefore({\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: blindCast(draft)\n\t\t}, this.middleware, middlewareCtx, mutator);\n\t\treturn {\n\t\t\tmeta: compiled.meta,\n\t\t\t...ifDefined(\"resultShape\", compiled.resultShape),\n\t\t\tcommand: await this.#adapter.resolveParams(mutator.currentDraft(), codecCtx)\n\t\t};\n\t}\n\tquery(plan, options) {\n\t\tconst self = this;\n\t\tconst { codecCtx, middlewareCtx } = this.createQueryContexts(options);\n\t\tconst generator = async function* () {\n\t\t\tconst exec = await self.prepareQueryExecution(plan, codecCtx, middlewareCtx);\n\t\t\tyield* reportQueryEnding(onQueryEndOutsideTransaction(self.afterTransactionStageFor(exec, middlewareCtx)), () => self.#decodedRows(exec, codecCtx, middlewareCtx));\n\t\t};\n\t\treturn new AsyncIterableResult(generator());\n\t}\n\tasync *#decodedRows(exec, codecCtx, middlewareCtx) {\n\t\tconst stream = runQueryWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runDriver(exec));\n\t\tfor await (const rawRow of stream) {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\tif (exec.resultShape === void 0) yield blindCast(rawRow);\n\t\t\telse yield blindCast(await decodeMongoRow(rawRow, exec.resultShape, this.#codecs, exec.command.collection, codecCtx));\n\t\t}\n\t}\n\tasync execute(plan, options) {\n\t\tconst { codecCtx, middlewareCtx } = this.createQueryContexts(options);\n\t\tconst exec = await this.prepareExecuteExecution(plan, codecCtx, middlewareCtx);\n\t\treturn reportExecuteEnding(onQueryEndOutsideTransaction(this.afterTransactionStageFor(exec, middlewareCtx)), async () => {\n\t\t\tcheckAborted(codecCtx, \"stream\");\n\t\t\treturn runExecuteWithMiddleware(exec, this.middleware, middlewareCtx, () => this.runExecute(exec));\n\t\t});\n\t}\n\tasync #readDriverStatistics(exec) {\n\t\tconst countField = statisticsCountField(exec.command.kind);\n\t\tif (countField === void 0) throw runtimeError(\"RUNTIME.MONGO_STATISTICS_UNSUPPORTED\", `Mongo command '${exec.command.kind}' does not expose statement statistics`, { commandKind: exec.command.kind });\n\t\tlet affectedRows;\n\t\tfor await (const result of this.#driver.execute(exec.command)) {\n\t\t\tif (affectedRows !== void 0 || !isUnknownRecord(result)) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\tconst count = result[countField];\n\t\t\tif (typeof count !== \"number\") throw invalidStatisticsResult(exec.command.kind, countField);\n\t\t\taffectedRows = count;\n\t\t}\n\t\tif (affectedRows === void 0) throw invalidStatisticsResult(exec.command.kind, countField);\n\t\treturn { affectedRows };\n\t}\n\tasync close() {\n\t\tawait this.#driver.close();\n\t}\n};\nfunction createMongoRuntime(options) {\n\treturn new MongoRuntimeImpl(options);\n}\n//#endregion\nexport { createMongoExecutionContext, createMongoExecutionStack, createMongoParamRefMutator, createMongoRuntime, flattenMongoParamRefs };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,UAAU,qBAAqB;EACrC,QAAQ,QAAQ;EAChB,SAAS,QAAQ;EACjB,QAAQ,QAAQ;EAChB,YAAY,QAAQ;CACrB,CAAC,CAAC;AACH;AACA,SAAS,4BAA4B,SAAS;CAC7C,MAAM,WAAW,sBAAsB;CACvC,MAAM,yBAAyB,IAAI,IAAI;CACvC,MAAM,eAAe;EACpB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,GAAG,QAAQ,MAAM;CAClB;CACA,MAAM,aAA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rc.14-dev.37",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,30 +9,30 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-framework": "8.0.0-rc.14-dev.35",
13
- "@prisma/orm-toolchain": "8.0.0-rc.14-dev.35",
12
+ "@prisma/orm-framework": "8.0.0-rc.14-dev.37",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.14-dev.37",
14
14
  "arktype": "^2.2.2",
15
15
  "mongodb": "^7.4.0",
16
16
  "pathe": "^2.0.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@internal/family-mongo": "8.0.0-rc.14-dev.35",
20
- "@internal/mongo-codec": "8.0.0-rc.14-dev.35",
21
- "@internal/mongo-contract": "8.0.0-rc.14-dev.35",
22
- "@internal/mongo-contract-prisma6": "8.0.0-rc.14-dev.35",
23
- "@internal/mongo-contract-psl": "8.0.0-rc.14-dev.35",
24
- "@internal/mongo-contract-ts": "8.0.0-rc.14-dev.35",
25
- "@internal/mongo-emitter": "8.0.0-rc.14-dev.35",
26
- "@internal/mongo-lowering": "8.0.0-rc.14-dev.35",
27
- "@internal/mongo-orm": "8.0.0-rc.14-dev.35",
28
- "@internal/mongo-query-ast": "8.0.0-rc.14-dev.35",
29
- "@internal/mongo-query-builder": "8.0.0-rc.14-dev.35",
30
- "@internal/mongo-runtime": "8.0.0-rc.14-dev.35",
31
- "@internal/mongo-schema-ir": "8.0.0-rc.14-dev.35",
32
- "@internal/mongo-value": "8.0.0-rc.14-dev.35",
33
- "@internal/mongo-wire": "8.0.0-rc.14-dev.35",
34
- "@repo/tsconfig": "8.0.0-rc.14-dev.35",
35
- "@repo/tsdown": "8.0.0-rc.14-dev.35",
19
+ "@internal/family-mongo": "8.0.0-rc.14-dev.37",
20
+ "@internal/mongo-codec": "8.0.0-rc.14-dev.37",
21
+ "@internal/mongo-contract": "8.0.0-rc.14-dev.37",
22
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.14-dev.37",
23
+ "@internal/mongo-contract-psl": "8.0.0-rc.14-dev.37",
24
+ "@internal/mongo-contract-ts": "8.0.0-rc.14-dev.37",
25
+ "@internal/mongo-emitter": "8.0.0-rc.14-dev.37",
26
+ "@internal/mongo-lowering": "8.0.0-rc.14-dev.37",
27
+ "@internal/mongo-orm": "8.0.0-rc.14-dev.37",
28
+ "@internal/mongo-query-ast": "8.0.0-rc.14-dev.37",
29
+ "@internal/mongo-query-builder": "8.0.0-rc.14-dev.37",
30
+ "@internal/mongo-runtime": "8.0.0-rc.14-dev.37",
31
+ "@internal/mongo-schema-ir": "8.0.0-rc.14-dev.37",
32
+ "@internal/mongo-value": "8.0.0-rc.14-dev.37",
33
+ "@internal/mongo-wire": "8.0.0-rc.14-dev.37",
34
+ "@repo/tsconfig": "8.0.0-rc.14-dev.37",
35
+ "@repo/tsdown": "8.0.0-rc.14-dev.37",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-JuPlJeiS.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-B0bMHQW0.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-BOMOzrka.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.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 { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\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}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})` : `db.${cmd.collection}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `db.${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 `db.${cmd.collection}.drop()`;\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 formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tconst candidate = operation;\n\t\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) continue;\n\t\tfor (const step of candidate[\"execute\"]) if (step.command && typeof step.command.accept === \"function\") statements.push(step.command.accept(formatter));\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/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\tlabel: \"database\",\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\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\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 jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\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\tlabel: `${propName}: ${bsonType}${suffix}`\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\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\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\tlabel: `options (${optLabels.join(\", \")})`,\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\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\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\treturn {\n\t\tfamilyId: \"mongo\",\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 sign(options) {\n\t\t\tconst { driver, contract: rawContract, 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 controlAdapter = getControlAdapter();\n\t\t\tconst mongoDriver = asMongoDriver(driver);\n\t\t\tconst existingMarker = await controlAdapter.readMarker(mongoDriver, APP_SPACE_ID);\n\t\t\tlet markerCreated = false;\n\t\t\tlet markerUpdated = false;\n\t\t\tlet previousHashes;\n\t\t\tif (!existingMarker) {\n\t\t\t\tawait controlAdapter.initMarker(mongoDriver, APP_SPACE_ID, {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t});\n\t\t\t\tmarkerCreated = true;\n\t\t\t} else {\n\t\t\t\tconst storageHashMatches = existingMarker.storageHash === contractStorageHash;\n\t\t\t\tconst profileHashMatches = existingMarker.profileHash === contractProfileHash;\n\t\t\t\tif (!storageHashMatches || !profileHashMatches) {\n\t\t\t\t\tpreviousHashes = {\n\t\t\t\t\t\tstorageHash: existingMarker.storageHash,\n\t\t\t\t\t\tprofileHash: existingMarker.profileHash\n\t\t\t\t\t};\n\t\t\t\t\tif (!await controlAdapter.updateMarker(mongoDriver, APP_SPACE_ID, existingMarker.storageHash, {\n\t\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t\t})) throw structuredError(\"MIGRATION.MARKER_CAS_FAILURE\", \"CAS conflict: marker was modified by another process during sign\");\n\t\t\t\t\tmarkerUpdated = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet summary;\n\t\t\tif (markerCreated) summary = \"Database signed (marker created)\";\n\t\t\telse if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? \"unknown\"})`;\n\t\t\telse summary = \"Database already signed with this contract\";\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tsummary,\n\t\t\t\tcontract: {\n\t\t\t\t\tstorageHash: contractStorageHash,\n\t\t\t\t\tprofileHash: contractProfileHash\n\t\t\t\t},\n\t\t\t\ttarget: {\n\t\t\t\t\texpected: contract.target,\n\t\t\t\t\tactual: contract.target\n\t\t\t\t},\n\t\t\t\tmarker: {\n\t\t\t\t\tcreated: markerCreated,\n\t\t\t\t\tupdated: markerUpdated,\n\t\t\t\t\t...ifDefined(\"previous\", previousHashes)\n\t\t\t\t},\n\t\t\t\tmeta: {\n\t\t\t\t\tcontractPath,\n\t\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t\t},\n\t\t\t\ttimings: { total: Date.now() - startTime }\n\t\t\t};\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};\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, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;AAaA,SAAS,cAAc,MAAM;CAC5B,OAAO,KAAK,KAAK,KAAK,MAAM,GAAG,KAAK,UAAU,EAAE,KAAK,EAAE,IAAI,KAAK,UAAU,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;AACtG;AACA,MAAM,oCAAoC,IAAI,IAAI;CACjD;CACA;CACA;AACD,CAAC;AACD,SAAS,oBAAoB,KAAK;CACjC,MAAM,QAAQ,OAAO,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC,kBAAkB,IAAI,GAAG,KAAK,UAAU,KAAK,CAAC,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