@prisma/orm-family-mongo 8.0.0-rc.14-dev.6 → 8.0.0-rc.14-dev.7

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.
@@ -3,13 +3,14 @@ import "@prisma/orm-framework/contract/types";
3
3
  import "@prisma/orm-framework/contract/hashing";
4
4
  import "@prisma/orm-framework/errors/control";
5
5
  import "@prisma/orm-framework/utils/casts";
6
+ import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
6
7
  import { enumType } from "@prisma/orm-framework/contract-authoring";
7
8
  import { resolveEnumCodecId } from "@prisma/orm-framework/components/authoring";
8
9
  import { blockAttribute, jsonValue, mapBlock, str } from "@prisma/orm-framework/psl-parser";
9
10
  import "@prisma/orm-framework/utils/defined";
10
11
  import "@prisma/orm-framework/components/control";
11
12
  import "@prisma/orm-framework/utils/canonical-stringify";
12
- //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-B27L6nXL.mjs
13
+ //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-tg0iEIGv.mjs
13
14
  function mongoFamilyEnumSpec() {
14
15
  return mapBlock({
15
16
  value: {
@@ -66,7 +67,8 @@ const mongoFamilyEntityTypes = { enum: {
66
67
  let value;
67
68
  if (memberValue === void 0) try {
68
69
  value = codec.decodeJson(memberName);
69
- } catch {
70
+ } catch (error) {
71
+ if (isInternalError(error)) throw error;
70
72
  diagnostics?.push({
71
73
  code: "PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC",
72
74
  message: `enum "${block.name}" member "${memberName}" has no value and codec "${codecId}" does not accept a bare name as input`,
@@ -79,6 +81,7 @@ const mongoFamilyEntityTypes = { enum: {
79
81
  else try {
80
82
  value = codec.decodeJson(memberValue);
81
83
  } catch (err) {
84
+ if (isInternalError(err)) throw err;
82
85
  const reason = err instanceof Error ? err.message : String(err);
83
86
  diagnostics?.push({
84
87
  code: "PSL_EXTENSION_INVALID_VALUE",
@@ -145,4 +148,4 @@ const mongoFamilyPslBlockDescriptors = { enum: {
145
148
  //#endregion
146
149
  export { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };
147
150
 
148
- //# sourceMappingURL=authoring-entity-types-B27L6nXL-BsztdhN5.mjs.map
151
+ //# sourceMappingURL=authoring-entity-types-tg0iEIGv-BsmTWyHs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-entity-types-tg0iEIGv-BsmTWyHs.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-tg0iEIGv.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/errors/control\";\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 { isInternalError } 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 bsonTypes = ctx.codecLookup?.targetTypesFor(codecId);\n\t\tif (bsonTypes === 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 [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}\" resolves in targetTypesFor but is absent from codecLookup.get`,\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 seenValues = /* @__PURE__ */ new Set();\n\t\tconst members = [];\n\t\tlet memberError = false;\n\t\tfor (const [memberName, memberValue] of Object.entries(block.values)) {\n\t\t\tconst span = block.parameterSpans[memberName] ?? block.span;\n\t\t\tlet value;\n\t\t\tif (memberValue === void 0) try {\n\t\t\t\tvalue = codec.decodeJson(memberName);\n\t\t\t} catch (error) {\n\t\t\t\tif (isInternalError(error)) throw error;\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" has no value and codec \"${codecId}\" does not accept a bare name as input`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse try {\n\t\t\t\tvalue = codec.decodeJson(memberValue);\n\t\t\t} catch (err) {\n\t\t\t\tif (isInternalError(err)) throw err;\n\t\t\t\tconst reason = err instanceof Error ? err.message : String(err);\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" was rejected by codec \"${codecId}\": ${reason}`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst valueKey = String(value);\n\t\t\tif (seenValues.has(valueKey)) {\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_DUPLICATE_MEMBER_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\": duplicate member value \"${valueKey}\"`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenValues.add(valueKey);\n\t\t\tmembers.push({\n\t\t\t\tname: memberName,\n\t\t\t\tvalue\n\t\t\t});\n\t\t}\n\t\tif (memberError) return void 0;\n\t\tif (members.length === 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_ENUM_MISSING_TYPE\",\n\t\t\t\tmessage: `enum \"${block.name}\" must have at least one member`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: block.span\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\treturn enumType(block.name, {\n\t\t\tcodecId,\n\t\t\tnativeType: bsonType\n\t\t}, ...members.map((m) => ({\n\t\t\tname: m.name,\n\t\t\tvalue: m.value\n\t\t})));\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-tg0iEIGv.mjs.map"],"mappings":";;;;;;;;;;;;;AAeA,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,YAAY,IAAI,aAAa,eAAe,OAAO;EACzD,IAAI,cAAc,KAAK,GAAG;GACzB,aAAa,KAAK;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK,qCAAqC,QAAQ;IAC1E;IACA,MAAM;GACP,CAAC;GACD;EACD;EACA,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,aAAa,IAA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;IACjB,MAAM;IACN,SAAS,SAAS,MAAM,KAAK;IAC7B;IACA,MAAM,MAAM;GACb,CAAC;GACD;EACD;EACA,OAAO,SAAS,MAAM,MAAM;GAC3B;GACA,YAAY;EACb,GAAG,GAAG,QAAQ,KAAK,OAAO;GACzB,MAAM,EAAE;GACR,OAAO,EAAE;EACV,EAAE,CAAC;CACJ,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"}
package/dist/codec.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as mongoCodec, i as MongoCodecTrait, n as MongoCodecInput, o as newMongoCodecRegistry, r as MongoCodecRegistry, t as MongoCodec } from "./index--ynTw_5M.mjs";
1
+ import { a as mongoCodec, i as MongoCodecTrait, n as MongoCodecInput, o as newMongoCodecRegistry, r as MongoCodecRegistry, t as MongoCodec } from "./index-CUkTUMkQ.mjs";
2
2
  export { type MongoCodec, type MongoCodecInput, type MongoCodecRegistry, type MongoCodecTrait, mongoCodec, newMongoCodecRegistry };
@@ -2,7 +2,7 @@ import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hook
2
2
  import { i as mongoAttributeSpecs } from "./interpreter-Da0fGDSM-DGCJEzeI.mjs";
3
3
  import { t as mongoEmission } from "./exports-BSUZo1ZX.mjs";
4
4
  import { i as verifyMongoSchema } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
5
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-B27L6nXL-BsztdhN5.mjs";
5
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-tg0iEIGv-BsmTWyHs.mjs";
6
6
  import { t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-BCyJeFBM.mjs";
7
7
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
8
8
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -402,4 +402,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
402
402
  //#endregion
403
403
  export { mongoOperationsToPreview as i, formatMongoOperations as n, mongoFamilyDescriptor as r, createMongoFamilyInstance as t };
404
404
 
405
- //# sourceMappingURL=control-CSzMTSlC.mjs.map
405
+ //# sourceMappingURL=control-D9OASt_0.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-CSzMTSlC.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-B27L6nXL.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { 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 { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { InternalError } from \"@internal/utils/internal-error\";\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;\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\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,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,IAAI,KAAK,UAAU,KAAK,GAAG;CACpK,IAAI,MAAM,WAAW,GAAG,OAAO,KAAK;CACpC,OAAO,KAAK,MAAM,KAAK,IAAI,EAAE;AAC9B;AACA,SAAS,cAAc,KAAK;CAC3B,OAAO,oBAAoB,GAAG;AAC/B;AACA,SAAS,8BAA8B,KAAK;CAC3C,OAAO,oBAAoB,GAAG;AAC/B;AACA,IAAI,2BAA2B,MAAM;CACpC,YAAY,KAAK;EAChB,MAAM,UAAU,cAAc,IAAI,IAAI;EACtC,MAAM,OAAO,cAAc,GAAG;EAC9B,OAAO,OAAO,MAAM,IAAI,WAAW,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AU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
1
+ {"version":3,"file":"control-D9OASt_0.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-tg0iEIGv.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { 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;\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\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,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW,GAAG,IAAI,IAAI,KAAK,UAAU,KAAK,GAAG;CACpK,IAAI,MAAM,WAAW,GAAG,OAAO,KAAK;CACpC,OAAO,KAAK,MAAM,KAAK,IAAI,EAAE;AAC9B;AACA,SAAS,cAAc,KAAK;CAC3B,OAAO,oBAAoB,GAAG;AAC/B;AACA,SAAS,8BAA8B,KAAK;CAC3C,OAAO,oBAAoB,GAAG;AAC/B;AACA,IAAI,2BAA2B,MAAM;CACpC,YAAY,KAAK;EAChB,MAAM,UAAU,cAAc,IAAI,IAAI;EACtC,MAAM,OAAO,cAAc,GAAG;EAC9B,OAAO,OAAO,MAAM,IAAI,WAAW,eAAe,QAAQ,IAAI,KAAK,KAAK,MAAM,IAAI,WAAW,eAAe,QAAQ;CACrH;CACA,UAAU,KAAK;EACd,OAAO,MAAM,IAAI,WAAW,aAAa,KAAK,UAAU,IAAI,IAAI,EAAE;CACnE;CACA,iBAAiB,KAAK;EACrB,MAAM,OAAO,8BAA8B,GAAG;EAC9C,OAAO,OAAO,uBAAuB,KAAK,UAAU,IAAI,UAAU,EAAE,IAAI,KAAK,KAAK,u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Aa;KACb,aAAa;IACd;IACA,QAAQ;KACP,UAAU,SAAS;KACnB,QAAQ,SAAS;IAClB;IACA,QAAQ;KACP,SAAS;KACT,SAAS;KACT,GAAG,UAAU,YAAY,cAAc;IACxC;IACA,MAAM;KACL;KACA,GAAG,UAAU,cAAc,UAAU;IACtC;IACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;GAC1C;EACD;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,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;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-Dvr-nVtl.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-B27L6nXL-BsztdhN5.mjs";
3
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-tg0iEIGv-BsmTWyHs.mjs";
4
4
  import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-BCyJeFBM.mjs";
5
- import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-CSzMTSlC.mjs";
5
+ import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-D9OASt_0.mjs";
6
6
  import { t as MongoContractView$1 } from "./mongo-contract-view-JZOa0Ry--Dm8a36wf.mjs";
7
7
  import { t as MongoSchemaVerifierBase } from "./ir-vZWjElPY.mjs";
8
8
  import { t as MongoMigration } from "./migration-DkhV-MNn.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-CSzMTSlC.mjs";
2
+ import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-D9OASt_0.mjs";
3
3
  export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -1,5 +1,5 @@
1
1
  import { i as mongoAttributeSpecs } from "./interpreter-Da0fGDSM-DGCJEzeI.mjs";
2
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-B27L6nXL-BsztdhN5.mjs";
2
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-tg0iEIGv-BsmTWyHs.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-B27L6nXL.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-tg0iEIGv.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"}
@@ -12,11 +12,14 @@ interface MongoCodec<Id extends string = string, TTraits extends readonly MongoC
12
12
  decode(wire: TWire, ctx: CodecCallContext): Promise<TOutput>;
13
13
  }
14
14
  /**
15
- * Conditional bundle for `encodeJson`/`decodeJson`: when `TInput` is structurally assignable to `JsonValue` the identity defaults are sound and both fields are optional; otherwise both fields are required so an author cannot silently produce a non-JSON-safe contract artifact.
15
+ * Conditional bundle for `encodeJson`/`decodeJson`. An identity `encodeJson` is sound whenever `TInput` is a JSON type, but an identity `decodeJson` returns any JSON value as a `TInput`, which is sound only when `TInput` is exactly `JsonValue`. So both are optional for `JsonValue`, `decodeJson` is required for a narrower JSON type such as `string`, and both are required for a type that is not JSON.
16
16
  */
17
- type JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue] ? {
17
+ type JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue] ? [JsonValue] extends [TInput] ? {
18
18
  encodeJson?: (value: TInput) => JsonValue;
19
19
  decodeJson?: (json: JsonValue) => TInput;
20
+ } : {
21
+ encodeJson?: (value: TInput) => JsonValue;
22
+ decodeJson: (json: JsonValue) => TInput;
20
23
  } : {
21
24
  encodeJson: (value: TInput) => JsonValue;
22
25
  decodeJson: (json: JsonValue) => TInput;
@@ -26,7 +29,7 @@ type JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue] ? {
26
29
  *
27
30
  * Author `encode` and `decode` as sync or async functions; the factory produces a {@link MongoCodec} whose query-time methods follow the boundary contract documented on the framework {@link BaseCodec}. Authors receive a second `ctx` options argument carrying the per-call context; ignore it if you don't need it.
28
31
  *
29
- * Both `encode` and `decode` are required so `TInput` and `TWire` are always covered by an explicit author function — the factory installs no identity fallback. `encodeJson` and `decodeJson` default to identity **only when `TInput` is assignable to `JsonValue`**; otherwise both are required so the contract artifact stays JSON-safe.
32
+ * Both `encode` and `decode` are required so `TInput` and `TWire` are always covered by an explicit author function — the factory installs no identity fallback. `encodeJson` defaults to identity when `TInput` is a JSON type, and `decodeJson` only when `TInput` is exactly `JsonValue`; any other codec supplies a `decodeJson` that follows {@link BaseCodec.decodeJson}, and a codec whose type is not JSON supplies both.
30
33
  *
31
34
  * Codec-id-keyed static metadata (`traits`, `targetTypes`, `renderOutputType`) lives on the unified `CodecDescriptor` rather than on the codec instance itself (TML-2357).
32
35
  */
@@ -60,4 +63,4 @@ interface MongoCodecRegistry {
60
63
  declare function newMongoCodecRegistry(): MongoCodecRegistry;
61
64
  //#endregion
62
65
  export { mongoCodec as a, MongoCodecTrait as i, MongoCodecInput as n, newMongoCodecRegistry as o, MongoCodecRegistry as r, MongoCodec as t };
63
- //# sourceMappingURL=index--ynTw_5M.d.mts.map
66
+ //# sourceMappingURL=index-CUkTUMkQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CUkTUMkQ.d.mts","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-codec/dist/index.d.mts"],"mappings":";;;;KAGK,kBAAkB;;;;;;UAMb,WAAW,4BAA4B,yBAAyB,6BAA6B,mBAAmB,iBAAiB,kBAAkB,UAAU,gBAAgB,KAAK,MAAM,IAAI,SAAS,OAAO;EACpN,OAAO,MAAM,OAAO,KAAK,mBAAmB,QAAQ;;;;;KAKjD,oBAAoB,WAAW,iBAAiB,cAAc,oBAAoB;EACrF,cAAc,OAAO,WAAW;EAChC,cAAc,MAAM,cAAc;;EAElC,cAAc,OAAO,WAAW;EAChC,aAAa,MAAM,cAAc;;EAEjC,aAAa,OAAO,WAAW;EAC/B,aAAa,MAAM,cAAc;;;;;;;;;;;iBAWlB,WAAW,yBAAyB,yBAAyB,iCAAiC,iBAAiB,kBAAkB;EAChJ,QAAQ;EACR,SAAS,OAAO,QAAQ,KAAK,qBAAqB,QAAQ,QAAQ;EAClE,SAAS,MAAM,OAAO,KAAK,qBAAqB,SAAS,QAAQ;IAC/D,oBAAoB,UAAU,WAAW,IAAI,SAAS,OAAO;;;;iBAIhD,WAAW,yBAAyB,yBAAyB,mBAAmB,OAAO,QAAQ,gBAAgB,QAAQ;EACtI,QAAQ;EACR,SAAS,OAAO,QAAQ,KAAK,qBAAqB,QAAQ,QAAQ;EAClE,SAAS,MAAM,OAAO,KAAK,qBAAqB,UAAU,QAAQ;IAChE,oBAAoB,UAAU,WAAW,IAAI,SAAS,OAAO,QAAQ;;KAEpE,gBAAgB,KAAK,UAAU,4BAA4B,kCAAkC,mBAAmB;;;UAG3G;EACR,IAAI,aAAa;EACjB,IAAI;EACJ,SAAS,OAAO;GACf,OAAO,aAAa,SAAS;EAC9B,UAAU,iBAAiB;;;;;iBAKZ,yBAAyB"}
@@ -1,4 +1,4 @@
1
- import { r as MongoCodecRegistry, t as MongoCodec } from "./index--ynTw_5M.mjs";
1
+ import { r as MongoCodecRegistry, t as MongoCodec } from "./index-CUkTUMkQ.mjs";
2
2
  import { l as MongoParamRef } from "./index-9DDQlC5U.mjs";
3
3
  import { ot as MongoResultShape, rt as MongoQueryPlan } from "./query-plan-DWV6y1mg-wdqfTTo9.mjs";
4
4
  import "./execution-p8UbRaQp.mjs";
package/dist/runtime.mjs CHANGED
@@ -3,6 +3,7 @@ import { t as MongoParamRef } from "./dist-CO2arS1K.mjs";
3
3
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
4
4
  import { AsyncIterableResult, RuntimeCore, applyMutationDefaults, assertMutationDefaultGeneratorsAvailable, checkAborted, checkMiddlewareCompatibility, collectMutationDefaultGenerators, runBeforeExecuteChain, runBeforeQueryChain, runExecuteWithMiddleware, runQueryWithMiddleware, runtimeError } from "@prisma/orm-framework/components/runtime";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
+ import { isInternalError } from "@prisma/orm-framework/utils/internal-error";
6
7
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
7
8
  import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
8
9
  import { createExecutionStack } from "@prisma/orm-framework/components/execution";
@@ -79,9 +80,10 @@ function describeDocumentId(id) {
79
80
  return previewWireValue(id);
80
81
  }
81
82
  /**
82
- * 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`) passes through unchanged; everything else is wrapped in a `RUNTIME.DECODE_FAILED` envelope. The original error is the `cause`.
83
+ * 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`.
83
84
  */
84
85
  function wrapDecodeFailure(error, location, codecId, wireValue) {
86
+ if (isInternalError(error)) throw error;
85
87
  const codecDetails = isStructuredError(error) ? error.meta : void 0;
86
88
  if (isStructuredError(error) && error.code !== "RUNTIME.DECODE_FAILED") throw error;
87
89
  const { collection, path, documentId } = location;
@@ -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 { 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`) passes 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\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":";;;;;;;;;;;AAWA,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,aAAa,iCAAiC,YAAY;CAChE,MAAM,YAAY,YAAY,QAAQ,QAAQ;CAC9C,yCAAyC,WAAW,UAAU;CAC9D,KAAK,MAAM,eAAe,cAAc;EACvC,MAAM,cAAc,YAAY,OAAO;EACvC,KAAK,MAAM,SAAS,cAAc,WAAW,GAAG;GAC/C,MAAM,gBAAgB,OAAO,IAAI,MAAM,EAAE;GACzC,I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,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"],"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,aAAa,iCAAiC,YAAY;CAChE,MAAM,YAAY,YAAY,QAAQ,QAAQ;CAC9C,yCAAyC,WAAW,UAAU;CAC9D,KAAK,MAAM,eAAe,cAAc;EACvC,MAAM,cAAc,YAAY,OAAO;EACvC,KAAK,MAAM,SAAS,cAAc,WAAW,GAAG;GAC/C,MAAM,gBAAgB,OAAO,IAAI,MAAM,EAAE;GACzC,IAAI,kBAAkB,KAAK,GAAG,MAAM,aAAa,2BAA2B,6BAA6B,MAAM,GAAG,oBAAoB,YAAY,GAAG,4BAA4B,cAAc,MAAM;IACpM,SAAS,MAAM;IACf;IACA,eAAe,YAAY;GAC5B,CAAC;GACD,SAAS,SAAS,KAAK;GACvB,OAAO,IAAI,MAAM,IAAI,YAAY,EAAE;EACpC;CACD;CACA,OAAO,OAAO,OAAO;EACpB,UAAU,QAAQ;EAClB,QAAQ;EACR,OAAO,Q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AwB,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-family-mongo",
3
- "version": "8.0.0-rc.14-dev.6",
3
+ "version": "8.0.0-rc.14-dev.7",
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.6",
13
- "@prisma/orm-toolchain": "8.0.0-rc.14-dev.6",
12
+ "@prisma/orm-framework": "8.0.0-rc.14-dev.7",
13
+ "@prisma/orm-toolchain": "8.0.0-rc.14-dev.7",
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.6",
20
- "@internal/mongo-codec": "8.0.0-rc.14-dev.6",
21
- "@internal/mongo-contract": "8.0.0-rc.14-dev.6",
22
- "@internal/mongo-contract-prisma6": "8.0.0-rc.14-dev.6",
23
- "@internal/mongo-contract-psl": "8.0.0-rc.14-dev.6",
24
- "@internal/mongo-contract-ts": "8.0.0-rc.14-dev.6",
25
- "@internal/mongo-emitter": "8.0.0-rc.14-dev.6",
26
- "@internal/mongo-lowering": "8.0.0-rc.14-dev.6",
27
- "@internal/mongo-orm": "8.0.0-rc.14-dev.6",
28
- "@internal/mongo-query-ast": "8.0.0-rc.14-dev.6",
29
- "@internal/mongo-query-builder": "8.0.0-rc.14-dev.6",
30
- "@internal/mongo-runtime": "8.0.0-rc.14-dev.6",
31
- "@internal/mongo-schema-ir": "8.0.0-rc.14-dev.6",
32
- "@internal/mongo-value": "8.0.0-rc.14-dev.6",
33
- "@internal/mongo-wire": "8.0.0-rc.14-dev.6",
34
- "@repo/tsconfig": "8.0.0-rc.14-dev.6",
35
- "@repo/tsdown": "8.0.0-rc.14-dev.6",
19
+ "@internal/family-mongo": "8.0.0-rc.14-dev.7",
20
+ "@internal/mongo-codec": "8.0.0-rc.14-dev.7",
21
+ "@internal/mongo-contract": "8.0.0-rc.14-dev.7",
22
+ "@internal/mongo-contract-prisma6": "8.0.0-rc.14-dev.7",
23
+ "@internal/mongo-contract-psl": "8.0.0-rc.14-dev.7",
24
+ "@internal/mongo-contract-ts": "8.0.0-rc.14-dev.7",
25
+ "@internal/mongo-emitter": "8.0.0-rc.14-dev.7",
26
+ "@internal/mongo-lowering": "8.0.0-rc.14-dev.7",
27
+ "@internal/mongo-orm": "8.0.0-rc.14-dev.7",
28
+ "@internal/mongo-query-ast": "8.0.0-rc.14-dev.7",
29
+ "@internal/mongo-query-builder": "8.0.0-rc.14-dev.7",
30
+ "@internal/mongo-runtime": "8.0.0-rc.14-dev.7",
31
+ "@internal/mongo-schema-ir": "8.0.0-rc.14-dev.7",
32
+ "@internal/mongo-value": "8.0.0-rc.14-dev.7",
33
+ "@internal/mongo-wire": "8.0.0-rc.14-dev.7",
34
+ "@repo/tsconfig": "8.0.0-rc.14-dev.7",
35
+ "@repo/tsdown": "8.0.0-rc.14-dev.7",
36
36
  "tsdown": "0.22.14",
37
37
  "typescript": "5.9.3"
38
38
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"authoring-entity-types-B27L6nXL-BsztdhN5.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-B27L6nXL.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/errors/control\";\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\";\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 bsonTypes = ctx.codecLookup?.targetTypesFor(codecId);\n\t\tif (bsonTypes === 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 [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}\" resolves in targetTypesFor but is absent from codecLookup.get`,\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 seenValues = /* @__PURE__ */ new Set();\n\t\tconst members = [];\n\t\tlet memberError = false;\n\t\tfor (const [memberName, memberValue] of Object.entries(block.values)) {\n\t\t\tconst span = block.parameterSpans[memberName] ?? block.span;\n\t\t\tlet value;\n\t\t\tif (memberValue === void 0) try {\n\t\t\t\tvalue = codec.decodeJson(memberName);\n\t\t\t} catch {\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_BARE_MEMBER_NON_STRING_CODEC\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" has no value and codec \"${codecId}\" does not accept a bare name as input`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse try {\n\t\t\t\tvalue = codec.decodeJson(memberValue);\n\t\t\t} catch (err) {\n\t\t\t\tconst reason = err instanceof Error ? err.message : String(err);\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\" member \"${memberName}\" was rejected by codec \"${codecId}\": ${reason}`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst valueKey = String(value);\n\t\t\tif (seenValues.has(valueKey)) {\n\t\t\t\tdiagnostics?.push({\n\t\t\t\t\tcode: \"PSL_ENUM_DUPLICATE_MEMBER_VALUE\",\n\t\t\t\t\tmessage: `enum \"${block.name}\": duplicate member value \"${valueKey}\"`,\n\t\t\t\t\tsourceId,\n\t\t\t\t\tspan\n\t\t\t\t});\n\t\t\t\tmemberError = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseenValues.add(valueKey);\n\t\t\tmembers.push({\n\t\t\t\tname: memberName,\n\t\t\t\tvalue\n\t\t\t});\n\t\t}\n\t\tif (memberError) return void 0;\n\t\tif (members.length === 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_ENUM_MISSING_TYPE\",\n\t\t\t\tmessage: `enum \"${block.name}\" must have at least one member`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: block.span\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\treturn enumType(block.name, {\n\t\t\tcodecId,\n\t\t\tnativeType: bsonType\n\t\t}, ...members.map((m) => ({\n\t\t\tname: m.name,\n\t\t\tvalue: m.value\n\t\t})));\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-B27L6nXL.mjs.map"],"mappings":";;;;;;;;;;;;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