@prisma/orm-family-mongo 8.0.0-rc.16-dev.5 → 8.0.0-rc.16-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.
@@ -4,7 +4,7 @@ import "@prisma/orm-framework/contract/types";
4
4
  import "@prisma/orm-framework/contract/hashing";
5
5
  import "@prisma/orm-framework/errors/control";
6
6
  import "@prisma/orm-framework/utils/casts";
7
- import "@prisma/orm-framework/components/codec";
7
+ import { enumRefusalOf } from "@prisma/orm-framework/components/codec";
8
8
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
9
9
  import { enumType } from "@prisma/orm-framework/contract-authoring";
10
10
  import { readEnumBlockMembers, resolveEnumCodecId } from "@prisma/orm-framework/components/authoring";
@@ -12,7 +12,7 @@ import { blockAttribute, jsonValue, mapBlock, str } from "@prisma/orm-framework/
12
12
  import "@prisma/orm-framework/utils/defined";
13
13
  import "@prisma/orm-framework/components/control";
14
14
  import "@prisma/orm-framework/utils/canonical-stringify";
15
- //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-DXktQ6MF.mjs
15
+ //#region ../../../2-mongo-family/9-family/dist/authoring-entity-types-D4HnWgJC.mjs
16
16
  function mongoFamilyEnumSpec() {
17
17
  return mapBlock({
18
18
  value: {
@@ -22,6 +22,29 @@ function mongoFamilyEnumSpec() {
22
22
  allowBare: true
23
23
  });
24
24
  }
25
+ const STORED_JSON_TYPE_NAMES = {
26
+ string: "a string",
27
+ number: "a finite number",
28
+ boolean: "a boolean",
29
+ object: "a JSON object",
30
+ array: "a JSON array"
31
+ };
32
+ function storedJsonTypeOf(stored) {
33
+ if (stored === null) return "null";
34
+ if (Array.isArray(stored)) return "array";
35
+ return typeof stored;
36
+ }
37
+ /**
38
+ * A collection validator lists an enum's members in their stored forms, so an enum's BSON type must be one whose values JSON holds. Maps each such type to the JSON type of a member's stored form.
39
+ */
40
+ const VALIDATOR_LISTABLE_BSON_TYPES = {
41
+ string: "string",
42
+ int: "number",
43
+ double: "number",
44
+ bool: "boolean",
45
+ object: "object",
46
+ array: "array"
47
+ };
25
48
  const mongoFamilyEntityTypes = { enum: {
26
49
  kind: "entity",
27
50
  discriminator: "enum",
@@ -63,6 +86,26 @@ const mongoFamilyEntityTypes = { enum: {
63
86
  });
64
87
  return;
65
88
  }
89
+ const storedJsonType = VALIDATOR_LISTABLE_BSON_TYPES[bsonType];
90
+ if (storedJsonType === void 0) {
91
+ diagnostics?.push({
92
+ code: "PSL_EXTENSION_INVALID_VALUE",
93
+ message: `enum "${block.name}" @@type codec "${codecId}" stores BSON type ${bsonType}, which a collection validator cannot list as an enum value. Use a codec whose BSON type is string, int, double, bool, object or array.`,
94
+ sourceId,
95
+ span: codecSpan
96
+ });
97
+ return;
98
+ }
99
+ const enumRefusal = enumRefusalOf(descriptor);
100
+ if (enumRefusal !== void 0) {
101
+ diagnostics?.push({
102
+ code: "PSL_EXTENSION_INVALID_VALUE",
103
+ message: `enum "${block.name}" cannot use the codec "${codecId}". ${enumRefusal}`,
104
+ sourceId,
105
+ span: codecSpan
106
+ });
107
+ return;
108
+ }
66
109
  const codec = ctx.codecLookup.get(codecId);
67
110
  if (codec === void 0) {
68
111
  diagnostics?.push({
@@ -75,6 +118,19 @@ const mongoFamilyEntityTypes = { enum: {
75
118
  }
76
119
  const members = readEnumBlockMembers(block, codecId, codec, ctx);
77
120
  if (members === void 0) return void 0;
121
+ let unlistedMember = false;
122
+ for (const member of members) {
123
+ const stored = codec.encodeJson(member.value);
124
+ if (storedJsonTypeOf(stored) === storedJsonType) continue;
125
+ diagnostics?.push({
126
+ code: "PSL_EXTENSION_INVALID_VALUE",
127
+ message: `enum "${block.name}" member "${member.name}" is stored as ${JSON.stringify(stored)}, which a collection validator cannot list as a ${bsonType}. A member of a ${bsonType} enum must be ${STORED_JSON_TYPE_NAMES[storedJsonType]}.`,
128
+ sourceId,
129
+ span: block.parameterSpans[member.name] ?? block.span
130
+ });
131
+ unlistedMember = true;
132
+ }
133
+ if (unlistedMember) return void 0;
78
134
  return enumType(block.name, { codecId }, ...members);
79
135
  } }
80
136
  } };
@@ -98,4 +154,4 @@ const mongoFamilyPslBlockDescriptors = { enum: {
98
154
  //#endregion
99
155
  export { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };
100
156
 
101
- //# sourceMappingURL=authoring-entity-types-DXktQ6MF-Bhtsznza.mjs.map
157
+ //# sourceMappingURL=authoring-entity-types-D4HnWgJC-DyfZDcwa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-entity-types-D4HnWgJC-DyfZDcwa.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/authoring-entity-types-D4HnWgJC.mjs"],"sourcesContent":["import \"@internal/utils/defined\";\nimport { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { enumRefusalOf } from \"@internal/framework-components/codec\";\nimport { isMongoDataType } from \"@internal/mongo-contract/data-type\";\nimport \"@internal/contract/hashing\";\nimport \"@internal/contract/types\";\nimport { enumType } from \"@internal/contract-authoring\";\nimport \"@internal/errors/control\";\nimport \"@internal/framework-components/control\";\nimport \"@internal/framework-components/ir\";\nimport \"@internal/mongo-contract\";\nimport \"@internal/mongo-contract/canonicalization-hooks\";\nimport \"@internal/utils/canonical-stringify\";\nimport \"@internal/utils/casts\";\nimport { blockAttribute, jsonValue, mapBlock, str } from \"@internal/psl-parser\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/authoring-entity-types.ts\nfunction mongoFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: jsonValue(),\n\t\t\tdocumentation: \"The stored member value; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst STORED_JSON_TYPE_NAMES = {\n\tstring: \"a string\",\n\tnumber: \"a finite number\",\n\tboolean: \"a boolean\",\n\tobject: \"a JSON object\",\n\tarray: \"a JSON array\"\n};\nfunction storedJsonTypeOf(stored) {\n\tif (stored === null) return \"null\";\n\tif (Array.isArray(stored)) return \"array\";\n\treturn typeof stored;\n}\n/**\n* A collection validator lists an enum's members in their stored forms, so an enum's BSON type must be one whose values JSON holds. Maps each such type to the JSON type of a member's stored form.\n*/\nconst VALIDATOR_LISTABLE_BSON_TYPES = {\n\tstring: \"string\",\n\tint: \"number\",\n\tdouble: \"number\",\n\tbool: \"boolean\",\n\tobject: \"object\",\n\tarray: \"array\"\n};\nconst mongoFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst descriptor = ctx.codecLookup.descriptorFor(codecId);\n\t\tif (descriptor === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst dataType = ctx.dataTypeLookup.get(descriptor.dataType);\n\t\tif (dataType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tif (!isMongoDataType(dataType)) throw new InternalError(`Data type ${dataType.id} is not a Mongo data type.`);\n\t\tconst { bsonTypes } = dataType.mongo;\n\t\tconst [bsonType, ...otherBsonTypes] = bsonTypes;\n\t\tif (bsonType === void 0 || otherBsonTypes.length > 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" declares ${bsonTypes.length} BSON types; an enum needs exactly one. Use a codec with one BSON type, such as mongo/string@1.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst storedJsonType = VALIDATOR_LISTABLE_BSON_TYPES[bsonType];\n\t\tif (storedJsonType === 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}\" stores BSON type ${bsonType}, which a collection validator cannot list as an enum value. Use a codec whose BSON type is string, int, double, bool, object or array.`,\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 enumRefusal = enumRefusalOf(descriptor);\n\t\tif (enumRefusal !== void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" cannot use the codec \"${codecId}\". ${enumRefusal}`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst codec = ctx.codecLookup.get(codecId);\n\t\tif (codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" is registered but codecLookup.get has no codec for it`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst members = readEnumBlockMembers(block, codecId, codec, ctx);\n\t\tif (members === void 0) return void 0;\n\t\tlet unlistedMember = false;\n\t\tfor (const member of members) {\n\t\t\tconst stored = codec.encodeJson(member.value);\n\t\t\tif (storedJsonTypeOf(stored) === storedJsonType) continue;\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" member \"${member.name}\" is stored as ${JSON.stringify(stored)}, which a collection validator cannot list as a ${bsonType}. A member of a ${bsonType} enum must be ${STORED_JSON_TYPE_NAMES[storedJsonType]}.`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: block.parameterSpans[member.name] ?? block.span\n\t\t\t});\n\t\t\tunlistedMember = true;\n\t\t}\n\t\tif (unlistedMember) return void 0;\n\t\treturn enumType(block.name, { codecId }, ...members);\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst mongoFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: mongoFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\nexport { mongoFamilyPslBlockDescriptors as n, mongoFamilyEntityTypes as t };\n\n//# sourceMappingURL=authoring-entity-types-D4HnWgJC.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAS,sBAAsB;CAC9B,OAAO,SAAS;EACf,OAAO;GACN,MAAM,UAAU;GAChB,eAAe;EAChB;EACA,WAAW;CACZ,CAAC;AACF;AACA,MAAM,yBAAyB;CAC9B,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,OAAO;AACR;AACA,SAAS,iBAAiB,QAAQ;CACjC,IAAI,WAAW,MAAM,OAAO;CAC5B,IAAI,MAAM,QAAQ,MAAM,GAAG,OAAO;CAClC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CACvB,MAAM;CACN,YAAY,EAAE,YAAY,uBAAuB;AAClD,EAAE"}
@@ -7,7 +7,7 @@ import { crossRef } from "@prisma/orm-framework/contract/types";
7
7
  import { buildExecutionSection, computeProfileHash, computeStorageHash } from "@prisma/orm-framework/contract/hashing";
8
8
  import { errorEnumCodecNotInPackStack } from "@prisma/orm-framework/errors/control";
9
9
  import { blindCast } from "@prisma/orm-framework/utils/casts";
10
- import { assembleDataTypes } from "@prisma/orm-framework/components/codec";
10
+ import { assembleDataTypes, enumRefusalOf } from "@prisma/orm-framework/components/codec";
11
11
  import { bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, createFieldHelpersFromNamespace, enumType as enumType$1, isEnumTypeHandle, member, resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
12
12
  import { assertNoCrossRegistryCollisions, instantiateAuthoringFieldPreset, validateAuthoringHelperArguments } from "@prisma/orm-framework/components/authoring";
13
13
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -27,6 +27,19 @@ function encodeEnumValue(value, codecId, codecLookup) {
27
27
  if (!codec) throw errorEnumCodecNotInPackStack({ codecId });
28
28
  return codec.encodeJson(value);
29
29
  }
30
+ function assertEnumCanUseCodec(handle, codecLookup) {
31
+ const descriptor = codecLookup.descriptorFor(handle.codecId);
32
+ const enumRefusal = descriptor === void 0 ? void 0 : enumRefusalOf(descriptor);
33
+ if (enumRefusal === void 0) return;
34
+ throw contractError("CONTRACT.ENUM_INVALID", `enumType("${handle.enumName}"): an enum cannot use the codec ${handle.codecId}. ${enumRefusal}`, {
35
+ fix: "Type the enum with another codec.",
36
+ meta: {
37
+ enumName: handle.enumName,
38
+ codecId: handle.codecId,
39
+ reason: "codec-not-for-enums"
40
+ }
41
+ });
42
+ }
30
43
  function stableStringify(value) {
31
44
  if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
32
45
  if (value && typeof value === "object") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${stableStringify(entry)}`).join(",")}}`;
@@ -690,10 +703,13 @@ function buildContractFromDefinition(definition) {
690
703
  });
691
704
  const codecLookup = extractCodecLookup([definition.target]);
692
705
  const storageValueSets = {};
693
- for (const [enumName, handle] of Object.entries(definition.enums ?? {})) storageValueSets[enumName] = {
694
- kind: "valueSet",
695
- values: handle.values.map((v) => encodeEnumValue(v, handle.codecId, codecLookup))
696
- };
706
+ for (const [enumName, handle] of Object.entries(definition.enums ?? {})) {
707
+ assertEnumCanUseCodec(handle, codecLookup);
708
+ storageValueSets[enumName] = {
709
+ kind: "valueSet",
710
+ values: handle.values.map((v) => encodeEnumValue(v, handle.codecId, codecLookup))
711
+ };
712
+ }
697
713
  const unboundNamespace = buildMongoNamespace({
698
714
  id: UNBOUND_NAMESPACE_ID,
699
715
  entries: {
@@ -787,4 +803,4 @@ function defineContract(definition, factory) {
787
803
  //#endregion
788
804
  export { field as a, member as c, valueObject as d, enumType$1 as i, model as l, buildBoundContract as n, index as o, defineContract as r, isEnumTypeHandle as s, bindEnumType as t, rel as u };
789
805
 
790
- //# sourceMappingURL=contract-builder-C8qP3adU.mjs.map
806
+ //# sourceMappingURL=contract-builder-C_xgQDIR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-builder-C_xgQDIR.mjs","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/contract-builder.mjs"],"sourcesContent":["import { t as contractError } from \"./contract-errors-BCN6RVI5.mjs\";\nimport { buildExecutionSection, computeProfileHash, computeStorageHash } from \"@internal/contract/hashing\";\nimport { crossRef } from \"@internal/contract/types\";\nimport { bindEnumType, composePackAuthoringNamespace, createEntityHelpersFromNamespace, createFieldHelpersFromNamespace, enumType, isEnumTypeHandle, member, resolveToOneRelationNullable } from \"@internal/contract-authoring\";\nimport { errorEnumCodecNotInPackStack } from \"@internal/errors/control\";\nimport { assertNoCrossRegistryCollisions, instantiateAuthoringFieldPreset, validateAuthoringHelperArguments } from \"@internal/framework-components/authoring\";\nimport { assembleDataTypes, enumRefusalOf } from \"@internal/framework-components/codec\";\nimport { extractCodecLookup } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { MongoCollectionOptions, MongoIndex, MongoStorage, applyPolymorphicScopeToMongoIndex, buildMongoNamespace } from \"@internal/mongo-contract\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { canonicalStringify } from \"@internal/utils/canonical-stringify\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/contract-builder.ts\n/**\n* Encode an authored enum value to its codec-encoded JSON form, mirroring SQL's `build-contract`.\n*\n* The codec is resolved by id from the lookup built from the contract's target pack, so a\n* non-identity `encodeJson` (permitted by the `mongoCodec` factory) is respected. A codecId the\n* lookup cannot resolve is a hard error: the enum uses a codec that is not part of the contract's\n* pack stack.\n*/\nfunction encodeEnumValue(value, codecId, codecLookup) {\n\tconst codec = codecLookup.get(codecId);\n\tif (!codec) throw errorEnumCodecNotInPackStack({ codecId });\n\treturn codec.encodeJson(value);\n}\nfunction assertEnumCanUseCodec(handle, codecLookup) {\n\tconst descriptor = codecLookup.descriptorFor(handle.codecId);\n\tconst enumRefusal = descriptor === void 0 ? void 0 : enumRefusalOf(descriptor);\n\tif (enumRefusal === void 0) return;\n\tthrow contractError(\"CONTRACT.ENUM_INVALID\", `enumType(\"${handle.enumName}\"): an enum cannot use the codec ${handle.codecId}. ${enumRefusal}`, {\n\t\tfix: \"Type the enum with another codec.\",\n\t\tmeta: {\n\t\t\tenumName: handle.enumName,\n\t\t\tcodecId: handle.codecId,\n\t\t\treason: \"codec-not-for-enums\"\n\t\t}\n\t});\n}\nfunction stableStringify(value) {\n\tif (Array.isArray(value)) return `[${value.map(stableStringify).join(\",\")}]`;\n\tif (value && typeof value === \"object\") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entry]) => `${JSON.stringify(key)}:${stableStringify(entry)}`).join(\",\")}}`;\n\treturn JSON.stringify(value);\n}\nconst MONGO_RESERVED_HELPER_KEYS = [\n\t\"field\",\n\t\"index\",\n\t\"model\",\n\t\"rel\",\n\t\"valueObject\"\n];\nfunction buildFieldPreset(helperPath, descriptor, args) {\n\tvalidateAuthoringHelperArguments(helperPath, descriptor.args, args);\n\tconst preset = instantiateAuthoringFieldPreset(descriptor, args);\n\tconst unsupported = [\n\t\t...preset.default !== void 0 ? [\"default\"] : [],\n\t\t...preset.id ? [\"id\"] : [],\n\t\t...preset.unique ? [\"unique\"] : []\n\t];\n\tif (unsupported.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Field preset \"${helperPath}\" contributes ${unsupported.join(\", \")}, which Mongo does not support. Mongo supports presets that set a codec and execution defaults only.`, { meta: {\n\t\thelperPath,\n\t\treason: \"preset-contribution-unsupported\",\n\t\tcontribution: unsupported\n\t} });\n\treturn createFieldBuilder({\n\t\ttype: {\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId: preset.descriptor.codecId,\n\t\t\t...normalizeOptionalTypeParams(preset.descriptor.typeParams)\n\t\t},\n\t\tnullable: preset.nullable,\n\t\tmany: false\n\t}, void 0, preset.executionDefaults);\n}\nfunction composeMongoFieldHelpers(fieldNamespace) {\n\tconst presetHelpers = createFieldHelpersFromNamespace(fieldNamespace, ({ helperPath, descriptor }) => (...args) => buildFieldPreset(helperPath, descriptor, args));\n\tconst collisions = Object.keys(presetHelpers).filter((name) => Object.hasOwn(field, name));\n\tif (collisions.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack-contributed field preset(s) ${collisions.map((c) => `\"${c}\"`).join(\", \")} collide with the built-in Mongo field helper(s) of the same name.`, { meta: {\n\t\treason: \"core-field-helper-collision\",\n\t\tcontribution: collisions\n\t} });\n\treturn {\n\t\t...field,\n\t\t...presetHelpers\n\t};\n}\nfunction composeMongoAuthoringHelpers(family, target, extensions) {\n\tconst components = [\n\t\tfamily,\n\t\ttarget,\n\t\t...Object.values(extensions ?? {})\n\t];\n\tconst entityNamespace = composePackAuthoringNamespace(components, \"entityTypes\");\n\tconst fieldNamespace = composePackAuthoringNamespace(components, \"field\");\n\tassertNoCrossRegistryCollisions({}, fieldNamespace, entityNamespace);\n\tconst collisions = Object.keys(entityNamespace).filter((name) => MONGO_RESERVED_HELPER_KEYS.includes(name));\n\tif (collisions.length > 0) throw contractError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Pack-contributed entity type(s) ${collisions.map((c) => `\"${c}\"`).join(\", \")} collide with the reserved built-in helper key(s) on the Mongo composed helpers surface. Reserved keys: ${MONGO_RESERVED_HELPER_KEYS.map((k) => `\"${k}\"`).join(\", \")}.`, { meta: {\n\t\treason: \"reserved-helper-key-collision\",\n\t\tcontribution: collisions\n\t} });\n\treturn blindCast({\n\t\t...createEntityHelpersFromNamespace(entityNamespace, { ctx: {\n\t\t\tfamily: family.familyId,\n\t\t\ttarget: target.targetId,\n\t\t\tcodecLookup: extractCodecLookup(components),\n\t\t\tdataTypeLookup: assembleDataTypes(components).lookup\n\t\t} }),\n\t\tfield: composeMongoFieldHelpers(fieldNamespace),\n\t\tindex,\n\t\tmodel,\n\t\trel,\n\t\tvalueObject\n\t});\n}\nfunction createFieldBuilder(spec, enumHandle, executionDefaults) {\n\tfunction many(options) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: spec.type,\n\t\t\tnullable: spec.nullable,\n\t\t\tmany: { elementNullable: options?.elementsNullable ?? false }\n\t\t}, enumHandle, executionDefaults);\n\t}\n\treturn {\n\t\t__kind: \"field\",\n\t\t...ifDefined(\"__executionDefaults\", executionDefaults),\n\t\t__type: spec.type,\n\t\t__nullable: spec.nullable,\n\t\t__many: spec.many,\n\t\t__enumHandle: blindCast(enumHandle),\n\t\toptional: blindCast(() => createFieldBuilder({\n\t\t\ttype: spec.type,\n\t\t\tnullable: true,\n\t\t\tmany: spec.many\n\t\t}, enumHandle, executionDefaults)),\n\t\tmany: blindCast(many)\n\t};\n}\nfunction normalizeOptionalTypeParams(typeParams) {\n\tif (!typeParams) return {};\n\treturn { typeParams };\n}\nfunction createScalarFieldBuilder(codecId, options) {\n\treturn createFieldBuilder({\n\t\ttype: blindCast({\n\t\t\tkind: \"scalar\",\n\t\t\tcodecId,\n\t\t\t...normalizeOptionalTypeParams(options?.typeParams)\n\t\t}),\n\t\tnullable: false,\n\t\tmany: false\n\t});\n}\nconst field = {\n\tscalar: createScalarFieldBuilder,\n\tobjectId() {\n\t\treturn createScalarFieldBuilder(\"mongo/objectId@1\");\n\t},\n\tstring() {\n\t\treturn createScalarFieldBuilder(\"mongo/string@1\");\n\t},\n\tdouble() {\n\t\treturn createScalarFieldBuilder(\"mongo/double@1\");\n\t},\n\tint32() {\n\t\treturn createScalarFieldBuilder(\"mongo/int32@1\");\n\t},\n\tbool() {\n\t\treturn createScalarFieldBuilder(\"mongo/bool@1\");\n\t},\n\tdate() {\n\t\treturn createScalarFieldBuilder(\"mongo/date@1\");\n\t},\n\tint64() {\n\t\treturn createScalarFieldBuilder(\"mongo/int64@1\");\n\t},\n\tint64Number() {\n\t\treturn createScalarFieldBuilder(\"mongo/int64Number@1\");\n\t},\n\tdecimal128() {\n\t\treturn createScalarFieldBuilder(\"mongo/decimal128@1\");\n\t},\n\tbinary() {\n\t\treturn createScalarFieldBuilder(\"mongo/binary@1\");\n\t},\n\tjson() {\n\t\treturn createScalarFieldBuilder(\"mongo/json@1\");\n\t},\n\tbson() {\n\t\treturn createScalarFieldBuilder(\"mongo/bson@1\");\n\t},\n\tvector(options) {\n\t\treturn createScalarFieldBuilder(\"mongo/vector@1\", options);\n\t},\n\tvalueObject(valueObjectName) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: blindCast({\n\t\t\t\tkind: \"valueObject\",\n\t\t\t\tname: resolveValueObjectName(valueObjectName)\n\t\t\t}),\n\t\t\tnullable: false,\n\t\t\tmany: false\n\t\t});\n\t},\n\tnamedType(handle) {\n\t\treturn createFieldBuilder({\n\t\t\ttype: blindCast({\n\t\t\t\tkind: \"scalar\",\n\t\t\t\tcodecId: handle.codecId\n\t\t\t}),\n\t\t\tnullable: false,\n\t\t\tmany: false\n\t\t}, handle);\n\t}\n};\nfunction index(fields, options) {\n\treturn {\n\t\tfields,\n\t\t...options ? { options } : {}\n\t};\n}\nfunction createFieldReference(modelName, fieldName) {\n\treturn {\n\t\t__kind: \"fieldRef\",\n\t\tmodelName,\n\t\tfieldName\n\t};\n}\nfunction isFieldReference(value) {\n\treturn typeof value === \"object\" && value !== null && \"__kind\" in value && value.__kind === \"fieldRef\";\n}\nfunction resolveModelName(value) {\n\treturn typeof value === \"string\" ? value : value.__name;\n}\nfunction resolveValueObjectName(value) {\n\treturn typeof value === \"string\" ? value : value.__name;\n}\nfunction normalizeStringList(value) {\n\treturn typeof value === \"string\" ? [value] : [...value];\n}\nfunction normalizeTargetField(targetModelName, value) {\n\tif (!isFieldReference(value)) return value;\n\tif (value.modelName !== targetModelName) throw contractError(\"CONTRACT.RELATION_INVALID\", `Relation target \"${targetModelName}\" cannot reference field \"${value.modelName}.${value.fieldName}\".`, { meta: {\n\t\tmodelName: targetModelName,\n\t\treason: \"cross-model-field-reference\",\n\t\treferencedModel: value.modelName,\n\t\treferencedField: value.fieldName\n\t} });\n\treturn value.fieldName;\n}\nfunction normalizeTargetFields(targetModelName, value) {\n\tif (typeof value === \"string\") return [value];\n\tif (isFieldReference(value)) return [normalizeTargetField(targetModelName, value)];\n\treturn value.map((entry) => normalizeTargetField(targetModelName, entry));\n}\nfunction createRelationBuilder(spec) {\n\treturn {\n\t\t__kind: \"relation\",\n\t\t__to: spec.to,\n\t\t__cardinality: spec.cardinality,\n\t\t__on: spec.on,\n\t\t__nullable: spec.nullable\n\t};\n}\nfunction createReferenceRelationBuilder(target, cardinality, options, nullable) {\n\tconst targetModelName = resolveModelName(target);\n\treturn createRelationBuilder({\n\t\tto: blindCast(targetModelName),\n\t\tcardinality,\n\t\ton: {\n\t\t\tlocalFields: blindCast(normalizeStringList(options.from)),\n\t\t\ttargetFields: blindCast(normalizeTargetFields(targetModelName, options.to))\n\t\t},\n\t\tnullable\n\t});\n}\nfunction createEmbedRelationBuilder(target, cardinality) {\n\treturn createRelationBuilder({\n\t\tto: blindCast(resolveModelName(target)),\n\t\tcardinality,\n\t\ton: void 0,\n\t\tnullable: void 0\n\t});\n}\nfunction hasOne(target, options) {\n\tif (!options) return createEmbedRelationBuilder(target, \"1:1\");\n\treturn createReferenceRelationBuilder(target, \"1:1\", options, true);\n}\nfunction hasMany(target, options) {\n\tif (!options) return createEmbedRelationBuilder(target, \"1:N\");\n\treturn createReferenceRelationBuilder(target, \"1:N\", options, void 0);\n}\nfunction belongsTo(target, options) {\n\treturn createReferenceRelationBuilder(target, \"N:1\", options, options.optional);\n}\nconst rel = {\n\tbelongsTo,\n\thasMany,\n\thasOne\n};\nfunction valueObject(name, input) {\n\treturn {\n\t\t__kind: \"valueObject\",\n\t\t__name: name,\n\t\t__fields: input.fields\n\t};\n}\nfunction model(name, input) {\n\treturn {\n\t\t__kind: \"model\",\n\t\t__name: name,\n\t\t__fields: input.fields,\n\t\t__relations: blindCast(input.relations ?? {}),\n\t\t__indexes: input.indexes,\n\t\t__collectionOptions: input.collectionOptions,\n\t\t__controlPolicy: input.controlPolicy,\n\t\t__collection: blindCast(input.collection),\n\t\t__owner: blindCast(input.owner ? resolveModelName(input.owner) : void 0),\n\t\t__base: blindCast(input.base ? resolveModelName(input.base) : void 0),\n\t\t__storageRelations: blindCast(input.storageRelations),\n\t\t__discriminator: blindCast(input.discriminator ? { field: input.discriminator.field } : void 0),\n\t\t__variants: blindCast(input.discriminator?.variants),\n\t\tref(fieldName) {\n\t\t\treturn createFieldReference(name, fieldName);\n\t\t}\n\t};\n}\nfunction validateTargetPackRef(family, target) {\n\tif (family.familyId !== \"mongo\") throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `defineContract only accepts Mongo family packs. Received family \"${family.familyId}\".`, { meta: {\n\t\tpackId: family.id,\n\t\tpackFamilyId: family.familyId,\n\t\tcontractFamilyId: \"mongo\"\n\t} });\n\tif (target.familyId !== family.familyId) throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `target pack \"${target.id}\" targets family \"${target.familyId}\" but contract family is \"${family.familyId}\".`, { meta: {\n\t\tpackId: target.id,\n\t\tpackFamilyId: target.familyId,\n\t\tcontractFamilyId: family.familyId\n\t} });\n}\nfunction validateExtensionPackRefs(target, extensions) {\n\tif (!extensions) return;\n\tfor (const packRef of Object.values(extensions)) {\n\t\tif (packRef.kind !== \"extension\") throw contractError(\"CONTRACT.PACK_REF_INVALID\", `defineContract only accepts extension pack refs in extensions. Received kind \"${packRef.kind}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tkind: packRef.kind\n\t\t} });\n\t\tif (packRef.familyId !== target.familyId) throw contractError(\"CONTRACT.PACK_FAMILY_MISMATCH\", `extension pack \"${packRef.id}\" targets family \"${packRef.familyId}\" but contract target family is \"${target.familyId}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tpackFamilyId: packRef.familyId,\n\t\t\tcontractFamilyId: target.familyId\n\t\t} });\n\t\tif (packRef.targetId && packRef.targetId !== target.targetId) throw contractError(\"CONTRACT.PACK_TARGET_MISMATCH\", `extension pack \"${packRef.id}\" targets \"${packRef.targetId}\" but contract target is \"${target.targetId}\".`, { meta: {\n\t\t\tpackId: packRef.id,\n\t\t\tpackTargetId: packRef.targetId,\n\t\t\tcontractTargetId: target.targetId\n\t\t} });\n\t}\n}\nfunction isContractScaffold(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn \"family\" in value && \"target\" in value;\n}\nfunction buildContractField(builder) {\n\tconst valueSet = builder.__enumHandle ? {\n\t\tplane: \"domain\",\n\t\tentityKind: \"enum\",\n\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\tentityName: builder.__enumHandle.enumName\n\t} : void 0;\n\treturn {\n\t\ttype: builder.__type,\n\t\tnullable: builder.__nullable,\n\t\tmany: builder.__many,\n\t\t...ifDefined(\"valueSet\", valueSet)\n\t};\n}\nfunction buildFields(fields) {\n\tconst builtFields = {};\n\tfor (const [fieldName, fieldBuilder] of Object.entries(fields)) builtFields[fieldName] = buildContractField(fieldBuilder);\n\treturn builtFields;\n}\nfunction toOneRelationNullable(modelName, relationName, relationBuilder, on, fields) {\n\tconst location = `Relation \"${modelName}.${relationName}\"`;\n\tconst ownsForeignKey = relationBuilder.__cardinality !== \"1:1\";\n\tconst localFields = ownsForeignKey ? on.localFields.map((fieldName) => {\n\t\tconst localField = fields[fieldName];\n\t\tif (localField === void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", `${location} joins on local field \"${fieldName}\", which model \"${modelName}\" does not declare`, { meta: {\n\t\t\tmodelName,\n\t\t\trelationName,\n\t\t\tfieldName,\n\t\t\treason: \"local-field-unknown\"\n\t\t} });\n\t\treturn localField;\n\t}) : [];\n\tconst { nullable, contradiction } = resolveToOneRelationNullable({\n\t\tdeclaredNullable: relationBuilder.__nullable,\n\t\tlocalFieldNullability: localFields.map((localField) => localField.__nullable === true),\n\t\townsReference: ownsForeignKey\n\t});\n\tif (contradiction !== void 0) throw contractError(\"CONTRACT.RELATION_INVALID\", !ownsForeignKey ? `${location} is required but does not own the foreign key, so nothing in storage guarantees the related document exists` : contradiction === \"declared-optional\" ? `${location} is optional but every local field it joins on is required` : `${location} is required but a local field it joins on is nullable`, { meta: {\n\t\tmodelName,\n\t\trelationName,\n\t\treason: \"to-one-nullability-mismatch\"\n\t} });\n\treturn nullable;\n}\nfunction buildRelation(modelName, relationName, relationBuilder, fields) {\n\tconst to = crossRef(relationBuilder.__to, UNBOUND_NAMESPACE_ID);\n\tconst on = relationBuilder.__on;\n\tif (on === void 0) return {\n\t\tto,\n\t\tcardinality: relationBuilder.__cardinality\n\t};\n\tif (relationBuilder.__cardinality === \"1:N\") return {\n\t\tto,\n\t\tcardinality: \"1:N\",\n\t\ton\n\t};\n\treturn {\n\t\tto,\n\t\tcardinality: relationBuilder.__cardinality,\n\t\tnullable: toOneRelationNullable(modelName, relationName, relationBuilder, on, fields),\n\t\ton\n\t};\n}\nfunction buildRelations(modelName, relations, fields) {\n\tconst builtRelations = {};\n\tfor (const [relationName, relationBuilder] of Object.entries(relations)) builtRelations[relationName] = buildRelation(modelName, relationName, relationBuilder, fields);\n\treturn builtRelations;\n}\nfunction buildValueObjects(valueObjects) {\n\tconst builtValueObjects = {};\n\tfor (const valueObjectBuilder of Object.values(valueObjects ?? {})) {\n\t\tif (valueObjectBuilder.__name in builtValueObjects) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate value object name \"${valueObjectBuilder.__name}\" in defineContract().`, { meta: {\n\t\t\tkind: \"valueObject\",\n\t\t\tname: valueObjectBuilder.__name\n\t\t} });\n\t\tbuiltValueObjects[valueObjectBuilder.__name] = { fields: buildFields(valueObjectBuilder.__fields) };\n\t}\n\treturn builtValueObjects;\n}\nfunction buildModels(models) {\n\tconst builtModels = {};\n\tfor (const modelBuilder of Object.values(models ?? {})) {\n\t\tif (modelBuilder.__name in builtModels) throw contractError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate model name \"${modelBuilder.__name}\" in defineContract().`, { meta: {\n\t\t\tkind: \"model\",\n\t\t\tname: modelBuilder.__name\n\t\t} });\n\t\tassertUniqueDiscriminatorValues(modelBuilder);\n\t\tconst storage = {\n\t\t\t...modelBuilder.__collection ? { collection: modelBuilder.__collection } : {},\n\t\t\t...modelBuilder.__storageRelations ? { relations: modelBuilder.__storageRelations } : {}\n\t\t};\n\t\tbuiltModels[modelBuilder.__name] = {\n\t\t\tfields: buildFields(modelBuilder.__fields),\n\t\t\trelations: buildRelations(modelBuilder.__name, modelBuilder.__relations, modelBuilder.__fields),\n\t\t\tstorage,\n\t\t\t...modelBuilder.__owner ? { owner: modelBuilder.__owner } : {},\n\t\t\t...modelBuilder.__base ? { base: crossRef(modelBuilder.__base, UNBOUND_NAMESPACE_ID) } : {},\n\t\t\t...modelBuilder.__discriminator ? { discriminator: modelBuilder.__discriminator } : {},\n\t\t\t...modelBuilder.__variants ? { variants: modelBuilder.__variants } : {}\n\t\t};\n\t}\n\treturn builtModels;\n}\nfunction assertUniqueDiscriminatorValues(modelBuilder) {\n\tconst variantsByValue = /* @__PURE__ */ new Map();\n\tfor (const [variantName, { value }] of Object.entries(modelBuilder.__variants ?? {})) {\n\t\tconst existingVariant = variantsByValue.get(value);\n\t\tif (existingVariant !== void 0) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", `Discriminator value \"${value}\" is used by both \"${existingVariant}\" and \"${variantName}\" on base model \"${modelBuilder.__name}\".`, { meta: {\n\t\t\tmodelName: modelBuilder.__name,\n\t\t\tvalue,\n\t\t\tvariants: [existingVariant, variantName],\n\t\t\treason: \"duplicate-discriminator-value\"\n\t\t} });\n\t\tvariantsByValue.set(value, variantName);\n\t}\n}\nfunction deriveRoots(models) {\n\tconst roots = {};\n\tfor (const modelBuilder of Object.values(models ?? {})) {\n\t\tif (!modelBuilder.__collection || modelBuilder.__owner || modelBuilder.__base) continue;\n\t\troots[modelBuilder.__collection] = crossRef(modelBuilder.__name, UNBOUND_NAMESPACE_ID);\n\t}\n\treturn roots;\n}\nfunction normalizeRoots(roots) {\n\tconst normalizedRoots = {};\n\tfor (const [rootName, rootValue] of Object.entries(roots ?? {})) normalizedRoots[rootName] = crossRef(resolveModelName(rootValue), UNBOUND_NAMESPACE_ID);\n\treturn normalizedRoots;\n}\nfunction toStorageIndex(index) {\n\tconst input = { keys: Object.entries(index.fields).map(([field, direction]) => ({\n\t\tfield,\n\t\tdirection\n\t})) };\n\tif (index.options) {\n\t\tfor (const [key, value] of Object.entries(index.options)) if (value !== void 0) input[key] = value;\n\t}\n\treturn new MongoIndex(blindCast(input));\n}\nfunction toStorageCollectionOptions(opts) {\n\treturn new MongoCollectionOptions({\n\t\t...opts.capped ? { capped: {\n\t\t\tsize: opts.size ?? 0,\n\t\t\t...opts.max != null && { max: opts.max }\n\t\t} } : {},\n\t\t...ifDefined(\"storageEngine\", opts.storageEngine),\n\t\t...ifDefined(\"indexOptionDefaults\", opts.indexOptionDefaults),\n\t\t...ifDefined(\"collation\", opts.collation),\n\t\t...ifDefined(\"timeseries\", opts.timeseries),\n\t\t...opts.clusteredIndex !== void 0 && { clusteredIndex: opts.clusteredIndex.name !== void 0 ? { name: opts.clusteredIndex.name } : {} },\n\t\t...ifDefined(\"expireAfterSeconds\", opts.expireAfterSeconds),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages)\n\t});\n}\nfunction findMissingIndexField(index, modelFields) {\n\tfor (const fieldName of Object.keys(index.fields)) {\n\t\tconst wildcardMatch = fieldName.match(/^(.+)\\.\\$\\*\\*$/);\n\t\tconst lookupName = wildcardMatch ? wildcardMatch[1] : fieldName;\n\t\tif (lookupName === void 0 || lookupName.length === 0) continue;\n\t\tif (lookupName === \"$**\") continue;\n\t\tif (!Object.hasOwn(modelFields, lookupName)) return lookupName;\n\t}\n}\nfunction resolveVariantScope(modelBuilder, modelsByName) {\n\tif (!modelBuilder.__base) return void 0;\n\tconst baseBuilder = modelsByName[modelBuilder.__base];\n\tif (!baseBuilder) return void 0;\n\tconst discriminatorField = baseBuilder.__discriminator?.field;\n\tconst variantValue = baseBuilder.__variants?.[modelBuilder.__name]?.value;\n\tif (!discriminatorField || variantValue === void 0) return void 0;\n\treturn {\n\t\tdiscriminatorField,\n\t\tdiscriminatorValue: variantValue\n\t};\n}\nfunction scopeVariantIndex(storageIndex, scope, variantName, authoredIndex) {\n\tconst result = applyPolymorphicScopeToMongoIndex(storageIndex, scope);\n\tif (result.kind === \"conflict\") {\n\t\tconst indexLabel = authoredIndex ? canonicalStringify(authoredIndex) : \"<unknown>\";\n\t\tthrow contractError(\"CONTRACT.INDEX_INVALID\", `Variant model \"${variantName}\" index ${indexLabel} conflicts with discriminator scope: ${result.reason}`, { meta: {\n\t\t\tvariantName,\n\t\t\tindexLabel,\n\t\t\treason: result.reason\n\t\t} });\n\t}\n\treturn result.index;\n}\nfunction buildCollections(models) {\n\tconst intermediate = {};\n\tconst declaredIndexOwners = /* @__PURE__ */ new Map();\n\tconst modelMap = models ?? {};\n\tconst modelsByName = {};\n\tfor (const builder of Object.values(modelMap)) modelsByName[builder.__name] = builder;\n\tfor (const modelBuilder of Object.values(modelMap)) {\n\t\tif (!modelBuilder.__collection) {\n\t\t\tif (modelBuilder.__indexes && modelBuilder.__indexes.length > 0) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelBuilder.__name}\" defines indexes but has no collection to attach them to.`, { meta: {\n\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\treason: \"indexes-without-collection\"\n\t\t\t} });\n\t\t\tif (modelBuilder.__collectionOptions) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelBuilder.__name}\" defines collectionOptions but has no collection to attach them to.`, { meta: {\n\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\treason: \"collectionOptions-without-collection\"\n\t\t\t} });\n\t\t\tif (modelBuilder.__controlPolicy) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Model \"${modelBuilder.__name}\" defines controlPolicy but has no collection to attach it to.`, { meta: {\n\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\treason: \"controlPolicy-without-collection\"\n\t\t\t} });\n\t\t\tcontinue;\n\t\t}\n\t\tconst existingCollection = intermediate[modelBuilder.__collection] ?? {};\n\t\tconst existingIndexes = existingCollection.indexes ?? [];\n\t\tif (existingCollection.options && modelBuilder.__collectionOptions) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Collection \"${modelBuilder.__collection}\" has collectionOptions declared by multiple models. Author collectionOptions on a single model per collection.`, { meta: {\n\t\t\tmodelName: modelBuilder.__name,\n\t\t\tcollection: modelBuilder.__collection,\n\t\t\treason: \"collectionOptions-declared-by-multiple-models\"\n\t\t} });\n\t\tif (existingCollection.control !== void 0 && modelBuilder.__controlPolicy) throw contractError(\"CONTRACT.COLLECTION_INVALID\", `Collection \"${modelBuilder.__collection}\" has controlPolicy declared by multiple models. Author controlPolicy on a single model per collection.`, { meta: {\n\t\t\tmodelName: modelBuilder.__name,\n\t\t\tcollection: modelBuilder.__collection,\n\t\t\treason: \"controlPolicy-declared-by-multiple-models\"\n\t\t} });\n\t\tfor (const collectionIndex of modelBuilder.__indexes ?? []) {\n\t\t\tconst missingField = findMissingIndexField(collectionIndex, modelBuilder.__fields);\n\t\t\tif (missingField !== void 0) {\n\t\t\t\tconst indexSignature = canonicalStringify(collectionIndex);\n\t\t\t\tthrow contractError(\"CONTRACT.FIELD_UNKNOWN\", `Model \"${modelBuilder.__name}\" index ${indexSignature} references unknown field \"${missingField}\".`, { meta: {\n\t\t\t\t\tmodelName: modelBuilder.__name,\n\t\t\t\t\tfieldName: missingField,\n\t\t\t\t\tindexSignature\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tconst polymorphicScope = resolveVariantScope(modelBuilder, modelsByName);\n\t\tconst rawStorageIndexes = (modelBuilder.__indexes ?? []).map(toStorageIndex);\n\t\tconst storageIndexes = polymorphicScope ? rawStorageIndexes.map((idx, i) => scopeVariantIndex(idx, polymorphicScope, modelBuilder.__name, modelBuilder.__indexes?.[i])) : rawStorageIndexes;\n\t\tfor (let i = 0; i < storageIndexes.length; i++) {\n\t\t\tconst storageIndex = storageIndexes[i];\n\t\t\tif (storageIndex === void 0) continue;\n\t\t\tconst indexSignature = stableStringify(storageIndex);\n\t\t\tconst collectionIndexKey = `${modelBuilder.__collection}:${indexSignature}`;\n\t\t\tconst firstOwner = declaredIndexOwners.get(collectionIndexKey);\n\t\t\tif (firstOwner) {\n\t\t\t\tconst authoredIndex = modelBuilder.__indexes?.[i];\n\t\t\t\tconst reportedSignature = authoredIndex ? canonicalStringify(authoredIndex) : indexSignature;\n\t\t\t\tthrow contractError(\"CONTRACT.NAME_DUPLICATE\", `Collection \"${modelBuilder.__collection}\" defines duplicate index ${reportedSignature}. First declared on model \"${firstOwner}\" and duplicated on model \"${modelBuilder.__name}\".`, { meta: {\n\t\t\t\t\tkind: \"index\",\n\t\t\t\t\tname: reportedSignature,\n\t\t\t\t\tcollection: modelBuilder.__collection,\n\t\t\t\t\tfirst: firstOwner,\n\t\t\t\t\tsecond: modelBuilder.__name\n\t\t\t\t} });\n\t\t\t}\n\t\t\tdeclaredIndexOwners.set(collectionIndexKey, modelBuilder.__name);\n\t\t}\n\t\tconst storageOptions = modelBuilder.__collectionOptions ? toStorageCollectionOptions(modelBuilder.__collectionOptions) : void 0;\n\t\tconst controlPatch = modelBuilder.__controlPolicy !== void 0 ? { control: modelBuilder.__controlPolicy } : {};\n\t\tintermediate[modelBuilder.__collection] = storageIndexes.length > 0 ? {\n\t\t\t...existingCollection,\n\t\t\tindexes: [...existingIndexes, ...storageIndexes],\n\t\t\t...storageOptions ? { options: storageOptions } : {},\n\t\t\t...controlPatch\n\t\t} : storageOptions ? {\n\t\t\t...existingCollection,\n\t\t\toptions: storageOptions,\n\t\t\t...controlPatch\n\t\t} : Object.keys(controlPatch).length > 0 ? {\n\t\t\t...existingCollection,\n\t\t\t...controlPatch\n\t\t} : existingCollection;\n\t}\n\treturn intermediate;\n}\nfunction executionDefaultError(modelName, fieldName, reason, message) {\n\treturn contractError(\"CONTRACT.DEFAULT_INVALID\", `Field \"${modelName}.${fieldName}\" ${message}`, { meta: {\n\t\tmodelName,\n\t\tfieldName,\n\t\treason\n\t} });\n}\nfunction hasExecutionDefaults(fieldBuilder) {\n\tconst phases = fieldBuilder.__executionDefaults;\n\treturn phases?.onCreate !== void 0 || phases?.onUpdate !== void 0;\n}\nfunction assertNoValueObjectExecutionDefaults(valueObjects) {\n\tfor (const valueObjectBuilder of Object.values(valueObjects ?? {})) for (const [fieldName, fieldBuilder] of Object.entries(valueObjectBuilder.__fields)) if (hasExecutionDefaults(fieldBuilder)) throw executionDefaultError(valueObjectBuilder.__name, fieldName, \"executionDefaults-on-value-object\", \"has executionDefaults, but it belongs to a value object. Generated values are only supported on model fields.\");\n}\nfunction buildExecutionDefaults(models) {\n\tconst modelBuilders = Object.values(models ?? {});\n\tconst collectionByModelName = new Map(modelBuilders.map((modelBuilder) => [modelBuilder.__name, modelBuilder.__collection]));\n\tconst byRef = /* @__PURE__ */ new Map();\n\tconst defaults = [];\n\tfor (const modelBuilder of modelBuilders) for (const [fieldName, fieldBuilder] of Object.entries(modelBuilder.__fields)) {\n\t\tconst phases = fieldBuilder.__executionDefaults;\n\t\tif (!phases || !hasExecutionDefaults(fieldBuilder)) continue;\n\t\tconst modelName = modelBuilder.__name;\n\t\tif (fieldBuilder.__nullable) throw executionDefaultError(modelName, fieldName, \"nullable-with-executionDefaults\", \"is filled on write by a preset such as temporal.createdAt(), so it cannot be optional; remove .optional().\");\n\t\tif (fieldBuilder.__many) throw executionDefaultError(modelName, fieldName, \"many-with-executionDefaults\", \"is filled on write by a preset such as temporal.createdAt(), so it cannot be a list; remove .many().\");\n\t\tif (modelBuilder.__base !== void 0) {\n\t\t\tconst collection = modelBuilder.__collection ?? collectionByModelName.get(modelBuilder.__base);\n\t\t\tthrow executionDefaultError(modelName, fieldName, \"executionDefaults-on-variant\", `has executionDefaults, but \"${modelName}\" is a variant of \"${modelBuilder.__base}\". Execution defaults apply to every document in collection \"${collection}\", so declare them on the base model.`);\n\t\t}\n\t\tconst entry = modelBuilder.__collection;\n\t\tif (entry === void 0) throw executionDefaultError(modelName, fieldName, \"executionDefaults-without-collection\", \"has executionDefaults, but its model has no collection. Generated values are only supported on fields of a model stored in a collection.\");\n\t\tconst refKey = JSON.stringify([entry, fieldName]);\n\t\tconst phasesKey = canonicalStringify(phases);\n\t\tconst existing = byRef.get(refKey);\n\t\tif (existing !== void 0) {\n\t\t\tif (existing.phasesKey !== phasesKey) throw executionDefaultError(modelName, fieldName, \"executionDefaults-conflict\", `has different executionDefaults than \"${existing.modelName}.${fieldName}\", which is stored in the same collection \"${entry}\". Use the same executionDefaults on both models.`);\n\t\t\tcontinue;\n\t\t}\n\t\tbyRef.set(refKey, {\n\t\t\tmodelName,\n\t\t\tphasesKey\n\t\t});\n\t\tdefaults.push({\n\t\t\tref: {\n\t\t\t\tnamespace: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentry,\n\t\t\t\tfield: fieldName\n\t\t\t},\n\t\t\t...phases\n\t\t});\n\t}\n\treturn defaults;\n}\nfunction buildContractFromDefinition(definition) {\n\tvalidateTargetPackRef(definition.family, definition.target);\n\tvalidateExtensionPackRefs(definition.target, definition.extensions);\n\tconst builtModels = buildModels(definition.models);\n\tconst builtValueObjects = buildValueObjects(definition.valueObjects);\n\tconst roots = definition.roots ? normalizeRoots(definition.roots) : deriveRoots(definition.models);\n\tconst capabilities = {};\n\tconst collections = buildCollections(definition.models);\n\tassertNoValueObjectExecutionDefaults(definition.valueObjects);\n\tconst execution = buildExecutionSection({\n\t\ttarget: definition.target.targetId,\n\t\ttargetFamily: definition.family.familyId,\n\t\tdefaults: buildExecutionDefaults(definition.models)\n\t});\n\tconst codecLookup = extractCodecLookup([definition.target]);\n\tconst storageValueSets = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tassertEnumCanUseCodec(handle, codecLookup);\n\t\tstorageValueSets[enumName] = {\n\t\t\tkind: \"valueSet\",\n\t\t\tvalues: handle.values.map((v) => encodeEnumValue(v, handle.codecId, codecLookup))\n\t\t};\n\t}\n\tconst unboundNamespace = buildMongoNamespace({\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tentries: {\n\t\t\tcollection: collections,\n\t\t\t...ifDefined(\"valueSet\", Object.keys(storageValueSets).length > 0 ? storageValueSets : void 0)\n\t\t}\n\t});\n\tconst storageBody = { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\tid: UNBOUND_NAMESPACE_ID,\n\t\tcollections: unboundNamespace.entries.collection,\n\t\t...ifDefined(\"valueSet\", unboundNamespace.entries.valueSet)\n\t} } };\n\tconst storage = new MongoStorage({\n\t\tstorageHash: computeStorageHash({\n\t\t\ttarget: definition.target.targetId,\n\t\t\ttargetFamily: definition.family.familyId,\n\t\t\tstorage: storageBody,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t}),\n\t\tnamespaces: { [UNBOUND_NAMESPACE_ID]: unboundNamespace }\n\t});\n\tconst builtEnums = {};\n\tfor (const [enumName, handle] of Object.entries(definition.enums ?? {})) {\n\t\tif (enumName !== handle.enumName) throw contractError(\"CONTRACT.ENUM_INVALID\", `enum declaration key \"${enumName}\" must match enumType name \"${handle.enumName}\". Aliases are not supported.`, { meta: {\n\t\t\tenumName: handle.enumName,\n\t\t\tdeclaredKey: enumName,\n\t\t\treason: \"declaration-key-mismatch\"\n\t\t} });\n\t\tbuiltEnums[enumName] = {\n\t\t\tcodecId: handle.codecId,\n\t\t\tmembers: handle.enumMembers.map((m) => ({\n\t\t\t\tname: m.name,\n\t\t\t\tvalue: encodeEnumValue(m.value, handle.codecId, codecLookup)\n\t\t\t}))\n\t\t};\n\t}\n\tconst hasEnums = Object.keys(builtEnums).length > 0;\n\tfor (const [modelName, modelBuilder] of Object.entries(definition.models ?? {})) for (const [fieldName, fieldBuilder] of Object.entries(modelBuilder.__fields)) {\n\t\tconst handle = fieldBuilder.__enumHandle;\n\t\tif (handle && !(handle.enumName in builtEnums)) throw contractError(\"CONTRACT.ENUM_UNKNOWN\", `Model \"${modelName}\" field \"${fieldName}\" references enum \"${handle.enumName}\" which is not declared in defineContract({ enums: { ... } }).`, { meta: {\n\t\t\tmodelName,\n\t\t\tfieldName,\n\t\t\tenumName: handle.enumName\n\t\t} });\n\t}\n\treturn blindCast({\n\t\ttarget: definition.target.targetId,\n\t\ttargetFamily: definition.family.familyId,\n\t\t...ifDefined(\"defaultControlPolicy\", definition.defaultControlPolicy),\n\t\troots,\n\t\tdomain: { namespaces: { [UNBOUND_NAMESPACE_ID]: {\n\t\t\tmodels: builtModels,\n\t\t\t...Object.keys(builtValueObjects).length > 0 ? { valueObjects: builtValueObjects } : {},\n\t\t\t...hasEnums ? { enum: builtEnums } : {}\n\t\t} } },\n\t\tstorage,\n\t\tcapabilities,\n\t\textensions: definition.extensions ?? {},\n\t\tprofileHash: computeProfileHash({\n\t\t\ttarget: definition.target.targetId,\n\t\t\ttargetFamily: definition.family.familyId,\n\t\t\tcapabilities\n\t\t}),\n\t\tmeta: {},\n\t\t...ifDefined(\"execution\", execution)\n\t});\n}\n/** Implementation. */\nfunction buildBoundContract(family, target, definition, factory) {\n\tconst full = {\n\t\t...definition,\n\t\tfamily,\n\t\ttarget\n\t};\n\tif (factory !== void 0) {\n\t\tconst built = factory(composeMongoAuthoringHelpers(family, target, definition.extensions));\n\t\treturn buildContractFromDefinition({\n\t\t\t...full,\n\t\t\t...ifDefined(\"models\", built.models),\n\t\t\t...ifDefined(\"valueObjects\", built.valueObjects),\n\t\t\t...ifDefined(\"roots\", built.roots)\n\t\t});\n\t}\n\treturn buildContractFromDefinition(full);\n}\nfunction defineContract(definition, factory) {\n\tif (!isContractScaffold(definition)) throw contractError(\"CONTRACT.ARGUMENT_INVALID\", \"defineContract expects a contract definition object. Define your contract with defineContract({ family, target, models, ... }).\");\n\tif (factory !== void 0) return buildBoundContract(definition.family, definition.target, definition, factory);\n\treturn buildBoundContract(definition.family, definition.target, definition);\n}\n//#endregion\nexport { bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, valueObject };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,gBAAgB,OAAO,SAAS,aAAa;CACrD,MAAM,QAAQ,YAAY,IAAI,OAAO;CACrC,IAAI,CAAC,OAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC;CAC1D,OAAO,MAAM,WAAW,KAAK;AAC9B;AACA,SAAS,sBAAsB,QAAQ,aAAa;CACnD,MAAM,aAAa,YAAY,cAAc,OAAO,OAAO;CAC3D,MAAM,c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C1B,cAAc,WAAW,OAAO;GAChC;EACD,CAAC;EACD,MAAM,CAAC;EACP,GAAG,UAAU,aAAa,SAAS;CACpC,CAAC;AACF;;AAEA,SAAS,mBAAmB,QAAQ,QAAQ,YAAY,SAAS;CAChE,MAAM,OAAO;EACZ,GAAG;EACH;EACA;CACD;CACA,IAAI,YAAY,KAAK,GAAG;EACvB,MAAM,QAAQ,QAAQ,6BAA6B,QAAQ,QAAQ,WAAW,UAAU,CAAC;EACzF,OAAO,4BAA4B;GAClC,GAAG;GACH,GAAG,UAAU,UAAU,MAAM,MAAM;GACnC,GAAG,UAAU,gBAAgB,MAAM,YAAY;GAC/C,GAAG,UAAU,SAAS,MAAM,KAAK;EAClC,CAAC;CACF;CACA,OAAO,4BAA4B,IAAI;AACxC;AACA,SAAS,eAAe,YAAY,SAAS;CAC5C,IAAI,CAAC,mBAAmB,UAAU,GAAG,MAAM,cAAc,6BAA6B,iIAAiI;CACvN,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,WAAW,QAAQ,WAAW,QAAQ,YAAY,OAAO;CAC3G,OAAO,mBAAmB,WAAW,QAAQ,WAAW,QAAQ,UAAU;AAC3E"}
@@ -313,7 +313,7 @@ type EnumHandleToEntry<Handle> = Handle extends EnumTypeHandle<string, infer Val
313
313
  readonly codecId: string;
314
314
  readonly members: readonly {
315
315
  readonly name: string;
316
- readonly value: Values[number];
316
+ readonly value: Values[number] extends JsonValue ? Values[number] : JsonValue;
317
317
  }[];
318
318
  } : never;
319
319
  type ContractEnumsFromRecord<Enums extends Record<string, EnumTypeHandle>> = { readonly [K in keyof Enums as Enums[K] extends EnumTypeHandle<infer Name> ? Name : never]: EnumHandleToEntry<Enums[K]>; };
@@ -604,4 +604,4 @@ declare function defineContract<const Definition extends ContractScaffold<Family
604
604
  }>(definition: Definition, factory: (helpers: ContractAuthoringHelpers<Definition['family'], Definition['target'], ScaffoldExtensions<Definition>>) => Built): MongoContractResult<Definition & Built>;
605
605
  //#endregion
606
606
  export { model as C, member as S, valueObject as T, defineContract as _, ContractScaffold as a, index as b, ExtractCodecTypesFromPack as c, ModelBuilder as d, MongoContractResult as f, buildBoundContract as g, bindEnumType as h, ContractFactory as i, FieldBuilder as l, ValueObjectBuilder as m, CodecTypeMap as n, EnumMember as o, RelationBuilder as p, ContractDefinition as r, EnumTypeHandle as s, BoundEnumType as t, FieldReference as u, enumType$1 as v, rel as w, isEnumTypeHandle as x, field as y };
607
- //# sourceMappingURL=contract-builder-CzwLK82r.d.mts.map
607
+ //# sourceMappingURL=contract-builder-Cc0pCnbQ.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-builder-Cc0pCnbQ.d.mts","names":[],"sources":["../../../../2-mongo-family/2-authoring/contract-ts/dist/contract-builder.d.mts"],"mappings":";;;;;;;;;;KAQK;WACM;;KAEN;WACM;;KAEN;KACA,QAAQ,KAAK,QAAQ;KACrB,cAAc;KACd,SAAS,QAAQ,WAAW,IAAI,EAAE,QAAQ;KAC1C,QAAQ,QAAQ,WAAW,IAAI,EAAE;KACjC,YAAY,QAAQ,SAAS,SAAS,QAAQ,OAAO,cAAc,cAAc;KACjF,oBAAoB,UAAU,yBAAyB,OAAO,kCAAkC,aAAa,yBAAyB;KACtI,0BAA0B,KAAK;EAClC,qBAAqB;IACnB,mBAAmB;EACrB;KACG,aAAa,wBAAwB;KACrC;WACM;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE;aACA;aACA;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;WAEF;aACE,OAAO;aACP,QAAQ;aACR;;;KAGR,yBAAyB,cAAc,2BAA2B,uBAAuB,WAAW,QAAQ,0BAA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B,sBAAsB,mBAAmB,iBAAiB,QAAQ,oBAAoB,aAAa"}
@@ -1,3 +1,3 @@
1
1
  import { n as typescriptContract, r as typescriptContractFromPath, t as ContractConfig } from "./config-types-CQOf5N7R.mjs";
2
- import { C as model, S as member, T as valueObject, _ as defineContract, a as ContractScaffold, b as index, c as ExtractCodecTypesFromPack, d as ModelBuilder, f as MongoContractResult, g as buildBoundContract, h as bindEnumType, i as ContractFactory, l as FieldBuilder, m as ValueObjectBuilder, n as CodecTypeMap, o as EnumMember, p as RelationBuilder, r as ContractDefinition, s as EnumTypeHandle, t as BoundEnumType, u as FieldReference, v as enumType, w as rel, x as isEnumTypeHandle, y as field } from "./contract-builder-CzwLK82r.mjs";
2
+ import { C as model, S as member, T as valueObject, _ as defineContract, a as ContractScaffold, b as index, c as ExtractCodecTypesFromPack, d as ModelBuilder, f as MongoContractResult, g as buildBoundContract, h as bindEnumType, i as ContractFactory, l as FieldBuilder, m as ValueObjectBuilder, n as CodecTypeMap, o as EnumMember, p as RelationBuilder, r as ContractDefinition, s as EnumTypeHandle, t as BoundEnumType, u as FieldReference, v as enumType, w as rel, x as isEnumTypeHandle, y as field } from "./contract-builder-Cc0pCnbQ.mjs";
3
3
  export { type BoundEnumType, type CodecTypeMap, type ContractConfig, type ContractDefinition, type ContractFactory, type ContractScaffold, type EnumMember, type EnumTypeHandle, type ExtractCodecTypesFromPack, type FieldBuilder, type FieldReference, type ModelBuilder, type MongoContractResult, type RelationBuilder, type ValueObjectBuilder, bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, typescriptContract, typescriptContractFromPath, valueObject };
@@ -1,3 +1,3 @@
1
1
  import { n as typescriptContractFromPath, t as typescriptContract } from "./config-types-x4rKdA0F.mjs";
2
- import { a as field, c as member, d as valueObject, i as enumType, l as model, n as buildBoundContract, o as index, r as defineContract, s as isEnumTypeHandle, t as bindEnumType, u as rel } from "./contract-builder-C8qP3adU.mjs";
2
+ import { a as field, c as member, d as valueObject, i as enumType, l as model, n as buildBoundContract, o as index, r as defineContract, s as isEnumTypeHandle, t as bindEnumType, u as rel } from "./contract-builder-C_xgQDIR.mjs";
3
3
  export { bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, typescriptContract, typescriptContractFromPath, valueObject };
@@ -1,2 +1,2 @@
1
- import { C as model, S as member, T as valueObject, _ as defineContract, a as ContractScaffold, b as index, c as ExtractCodecTypesFromPack, d as ModelBuilder, f as MongoContractResult, g as buildBoundContract, h as bindEnumType, i as ContractFactory, l as FieldBuilder, m as ValueObjectBuilder, n as CodecTypeMap, o as EnumMember, p as RelationBuilder, r as ContractDefinition, s as EnumTypeHandle, t as BoundEnumType, u as FieldReference, v as enumType, w as rel, x as isEnumTypeHandle, y as field } from "./contract-builder-CzwLK82r.mjs";
1
+ import { C as model, S as member, T as valueObject, _ as defineContract, a as ContractScaffold, b as index, c as ExtractCodecTypesFromPack, d as ModelBuilder, f as MongoContractResult, g as buildBoundContract, h as bindEnumType, i as ContractFactory, l as FieldBuilder, m as ValueObjectBuilder, n as CodecTypeMap, o as EnumMember, p as RelationBuilder, r as ContractDefinition, s as EnumTypeHandle, t as BoundEnumType, u as FieldReference, v as enumType, w as rel, x as isEnumTypeHandle, y as field } from "./contract-builder-Cc0pCnbQ.mjs";
2
2
  export { type BoundEnumType, type CodecTypeMap, type ContractDefinition, type ContractFactory, type ContractScaffold, type EnumMember, type EnumTypeHandle, type ExtractCodecTypesFromPack, type FieldBuilder, type FieldReference, type ModelBuilder, type MongoContractResult, type RelationBuilder, type ValueObjectBuilder, bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, valueObject };
@@ -1,2 +1,2 @@
1
- import { a as field, c as member, d as valueObject, i as enumType, l as model, n as buildBoundContract, o as index, r as defineContract, s as isEnumTypeHandle, t as bindEnumType, u as rel } from "./contract-builder-C8qP3adU.mjs";
1
+ import { a as field, c as member, d as valueObject, i as enumType, l as model, n as buildBoundContract, o as index, r as defineContract, s as isEnumTypeHandle, t as bindEnumType, u as rel } from "./contract-builder-C_xgQDIR.mjs";
2
2
  export { bindEnumType, buildBoundContract, defineContract, enumType, field, index, isEnumTypeHandle, member, model, rel, valueObject };
@@ -3,7 +3,7 @@ import { a as mongoAttributeSpecs, r as describeUnsupportedMongoAttribute } from
3
3
  import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
4
4
  import { t as mongoEmission } from "./exports-BSUZo1ZX.mjs";
5
5
  import { i as verifyMongoSchema } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
6
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-DXktQ6MF-Bhtsznza.mjs";
6
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-D4HnWgJC-DyfZDcwa.mjs";
7
7
  import { t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-PhZZAPWQ.mjs";
8
8
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
9
9
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -409,4 +409,4 @@ const mongoFamilyDescriptor = new MongoFamilyDescriptor();
409
409
  //#endregion
410
410
  export { mongoOperationsToPreview as i, formatMongoOperations as n, mongoFamilyDescriptor as r, createMongoFamilyInstance as t };
411
411
 
412
- //# sourceMappingURL=control-eW2Kc0X9.mjs.map
412
+ //# sourceMappingURL=control-XDI4R_IY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-eW2Kc0X9.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-B0bMHQW0.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-DXktQ6MF.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})` : `db.${cmd.collection}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `db.${cmd.collection}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `db.${cmd.collection}.drop()`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tconst candidate = operation;\n\t\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) continue;\n\t\tfor (const step of candidate[\"execute\"]) if (step.command && typeof step.command.accept === \"function\") statements.push(step.command.accept(formatter));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${suffix}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# 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,o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AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
1
+ {"version":3,"file":"control-XDI4R_IY.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-D4HnWgJC.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-DC_DM9_Y.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})` : `db.${cmd.collection}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `db.${cmd.collection}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `db.${cmd.collection}.drop()`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tconst candidate = operation;\n\t\tif (!(\"execute\" in candidate) || !Array.isArray(candidate[\"execute\"])) continue;\n\t\tfor (const step of candidate[\"execute\"]) if (step.command && typeof step.command.accept === \"function\") statements.push(step.command.accept(formatter));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst jsonSchema = blindCast(collection.validator.jsonSchema);\n\t\tconst properties = jsonSchema.properties;\n\t\tconst required = new Set(jsonSchema.required ?? []);\n\t\tif (properties) for (const [propName, propDef] of Object.entries(properties)) {\n\t\t\tconst bsonType = propDef.bsonType === void 0 ? \"any\" : String(propDef.bsonType);\n\t\t\tconst suffix = required.has(propName) ? \" (required)\" : \"\";\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${suffix}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMapping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C7F,OAAO;EACR;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,eAAe,SAAS;GAC7B,OAAO,kBAAkB,CAAC,CAAC,eAAe,cAAc,QAAQ,MAAM,CAAC;EACxE;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,WAAW,cAAc,QAAQ,MAAM,GAAG,QAAQ,KAAK;EACnF;EACA,MAAM,WAAW,SAAS;GACzB,OAAO,kBAAkB,CAAC,CAAC,iBAAiB,cAAc,QAAQ,MAAM,CAAC;EAC1E;EACA,yBAAyB,SAAS;GACjC,OAAO,kBAAkB,CAAC,CAAC,yBAAyB,cAAc,QAAQ,MAAM,CAAC;EAClF;EACA,aAAa,QAAQ;GACpB,OAAO,kBAAkB,MAAM;EAChC;EACA,mBAAmB,YAAY;GAC9B,OAAO,yBAAyB,UAAU;EAC3C;CACD;AACD;AAGA,MAAM,4BAA4B;AAClC,MAAM,0CAA0C;AAChD,MAAM,oCAAoC;AAC1C,IAAI,wBAAwB,MAAM;CACjC,OAAO;CACP,KAAK;CACL,WAAW;CACX,UAAU;CACV,WAAW;CACX,YAAY;EACX,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;CACA,iBAAiB;EAChB,8BAA8B;EAC9B,wBAAwB;CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
package/dist/family.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { d as defaultMongoStorageNamespaceId, u as defaultMongoDomainNamespaceId } from "./dist-D3mFP5N3.mjs";
2
2
  import { i as verifyMongoSchema, n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
3
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-DXktQ6MF-Bhtsznza.mjs";
3
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-D4HnWgJC-DyfZDcwa.mjs";
4
4
  import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-DC_DM9_Y-PhZZAPWQ.mjs";
5
- import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-eW2Kc0X9.mjs";
5
+ import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-XDI4R_IY.mjs";
6
6
  import { t as MongoContractView$1 } from "./mongo-contract-view-JZOa0Ry--pWIg_ZtN.mjs";
7
7
  import { t as MongoSchemaVerifierBase } from "./ir-vZWjElPY.mjs";
8
8
  import { t as MongoMigration } from "./migration-B0n3l8u7.mjs";
@@ -1,3 +1,3 @@
1
1
  import { n as contractToMongoSchemaIR, r as diffMongoSchemas, t as canonicalizeSchemasForVerification } from "./verify-mongo-schema-B0bMHQW0-BuK0Jv5S.mjs";
2
- import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-eW2Kc0X9.mjs";
2
+ import { i as mongoOperationsToPreview, n as formatMongoOperations, r as mongoFamilyDescriptor, t as createMongoFamilyInstance } from "./control-XDI4R_IY.mjs";
3
3
  export { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };
@@ -1,5 +1,5 @@
1
1
  import { a as mongoAttributeSpecs } from "./interpreter-Dqf3UsYT-CsYHwAfa.mjs";
2
- import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-DXktQ6MF-Bhtsznza.mjs";
2
+ import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-D4HnWgJC-DyfZDcwa.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-DXktQ6MF.mjs\";\nimport { mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\n//#region src/exports/pack.ts\nconst mongoFamilyPack = {\n\tkind: \"family\",\n\tid: \"mongo\",\n\tfamilyId: \"mongo\",\n\tversion: \"0.0.1\",\n\tauthoring: {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoAttributeSpecs\n\t}\n};\n//#endregion\nexport { mongoFamilyPack as default, mongoFamilyEntityTypes, mongoFamilyPslBlockDescriptors };\n\n//# sourceMappingURL=pack.mjs.map"],"mappings":";;;AAGA,MAAM,kBAAkB;CACvB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW;EACV,aAAa;EACb,qBAAqB;EACrB,gBAAgB;CACjB;AACD"}
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-D4HnWgJC.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"}