@prisma/orm-family-mongo 8.0.0-rc.24-dev.12 → 8.0.0-rc.24-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{control-BNH5e5av.d.mts → control-C60vKgXR.d.mts} +2 -2
- package/dist/{control-BNH5e5av.d.mts.map → control-C60vKgXR.d.mts.map} +1 -1
- package/dist/{control-Cxe4huYd.d.mts → control-CwUH60Zs.d.mts} +4 -4
- package/dist/{control-Cxe4huYd.d.mts.map → control-CwUH60Zs.d.mts.map} +1 -1
- package/dist/{control-adapter-BheElqfe-Z1rEl51r.d.mts → control-adapter-BheElqfe-DvKx2xNu.d.mts} +3 -3
- package/dist/{control-adapter-BheElqfe-Z1rEl51r.d.mts.map → control-adapter-BheElqfe-DvKx2xNu.d.mts.map} +1 -1
- package/dist/control-adapter-CsdEt84L.d.mts +1 -0
- package/dist/{execution-CD6EeX3b.d.mts → execution-BaB-jj-9.d.mts} +2 -2
- package/dist/{execution-CD6EeX3b.d.mts.map → execution-BaB-jj-9.d.mts.map} +1 -1
- package/dist/family.d.mts +4 -4
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/{field-accessor-DJzCZm0f-ZGjGQy0_.d.mts → field-accessor-DJzCZm0f-BErO0512.d.mts} +3 -3
- package/dist/{field-accessor-DJzCZm0f-ZGjGQy0_.d.mts.map → field-accessor-DJzCZm0f-BErO0512.d.mts.map} +1 -1
- package/dist/index-Bzkio7As.d.mts +849 -0
- package/dist/index-Bzkio7As.d.mts.map +1 -0
- package/dist/{index-B2yjvk4C.d.mts → index-C4SE1De2.d.mts} +3 -3
- package/dist/{index-B2yjvk4C.d.mts.map → index-C4SE1De2.d.mts.map} +1 -1
- package/dist/{index-By9G6gWh.d.mts → index-DoC4WknJ.d.mts} +5 -5
- package/dist/{index-By9G6gWh.d.mts.map → index-DoC4WknJ.d.mts.map} +1 -1
- package/dist/lowering.d.mts +1 -1
- package/dist/{migration-B7PcbeNg.d.mts → migration-C6-3qUP0.d.mts} +2 -2
- package/dist/{migration-B7PcbeNg.d.mts.map → migration-C6-3qUP0.d.mts.map} +1 -1
- package/dist/orm.d.mts +36 -12
- package/dist/orm.d.mts.map +1 -1
- package/dist/orm.mjs +201 -23
- package/dist/orm.mjs.map +1 -1
- package/dist/query-ast.d.mts +4 -4
- package/dist/query-ast__control.d.mts +2 -2
- package/dist/query-ast__execution.d.mts +3 -3
- package/dist/query-builder.d.mts +4 -849
- package/dist/query-builder__contract-free.d.mts +4 -4
- package/dist/{query-plan-Dtyaa2z2-BD60dwyV.d.mts → query-plan-k7nXo4F_-C07yAGNa.d.mts} +9 -4
- package/dist/{query-plan-Dtyaa2z2-BD60dwyV.d.mts.map → query-plan-k7nXo4F_-C07yAGNa.d.mts.map} +1 -1
- package/dist/runtime.d.mts +12 -15
- package/dist/runtime.d.mts.map +1 -1
- package/dist/wire.d.mts +2 -2
- package/package.json +20 -20
- package/dist/control-adapter-Cj8JmiQV.d.mts +0 -1
- package/dist/query-builder.d.mts.map +0 -1
package/dist/orm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orm.mjs","names":["#ctx","#enums","#contract","#modelName","#executor","#mutationDefaults","#collectionName","#state","#variantValue","#cloneWithVariant","#encodeFieldFilter","#storedPath","#clone","#compileWhereObject","#storedNames","#query","#rejectIncludes","#withCreateDefaults","#injectDiscriminator","#stripUndefined","#toDocument","#drainPlan","#insertOneResultShape","#rowOf","#insertManyResultShape","#requireFilters","#rejectWindowing","#mergeFilters","#withUpdateDefaults","#resolveUpdateDoc","#modelResultShape","#readMatchingIds","#executePlan","#rejectDocumentIdOps","#wrapFieldOpValue","#toSetFields","#storedKeys","#upsertCommand","#compile","#rowMapper","#variantModelName","#modelWithVariantFields","#planMeta","#wrapCommand","#idFieldShape","#documentShape","#modelFields","#wrapFieldValue","#fieldAtPath","#valueObjectAt","#nullParam","#assertEnumValues","#scalarParam","#wrapValueObject","#fieldParam","#appliedDefaults","#toUpdateDocument"],"sources":["../../../../2-mongo-family/5-query-builders/orm/dist/index.mjs"],"sourcesContent":["import { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\nimport { valueObjectAt } from \"@internal/contract/types\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { AsyncIterableResult, runtimeError } from \"@internal/framework-components/runtime\";\nimport { defaultMongoDomainNamespaceId, mongoModelsOf, ownDocumentIdFieldOf, ownEmbedStoredNamesOf, ownStoredNamesOf, storedNamesOf } from \"@internal/mongo-contract\";\nimport { AggregateCommand, DeleteManyCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, InsertOneCommand, MongoAddFieldsStage, MongoAggArrayFilter, MongoAggCond, MongoAggFieldRef, MongoAggLiteral, MongoAggMap, MongoAggOperator, MongoAndExpr, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoProjectStage, MongoSkipStage, MongoSortStage, MongoUnwindStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, enumMemberCodecFor, freezeMongoResultShape, isMongoFilterExpr } from \"@internal/mongo-query-ast/execution\";\nimport { contractFieldToMongoFieldShape, contractModelToMongoResultShape } from \"@internal/mongo-query-builder\";\nimport { MongoParamRef, isMongoPreparedParamRef } from \"@internal/mongo-value\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/collection-state.ts\nfunction emptyCollectionState() {\n\treturn {\n\t\tfilters: [],\n\t\tincludes: [],\n\t\torderBy: void 0,\n\t\tselectedFields: void 0,\n\t\tlimit: void 0,\n\t\toffset: void 0\n\t};\n}\n//#endregion\n//#region src/compile.ts\nfunction isToOne(include) {\n\treturn include.cardinality === \"N:1\" || include.cardinality === \"1:1\";\n}\n/**\n* An included document is decoded through the related model's codecs, like the root document. A to-one include with no related document reads as `null`.\n*/\nfunction includeShape(include, storage) {\n\tconst target = contractModelToMongoResultShape(include.targetModel, { storage });\n\tconst fields = target.kind === \"document\" ? target.fields : {};\n\treturn isToOne(include) ? {\n\t\tkind: \"document\",\n\t\tnullable: true,\n\t\tfields\n\t} : {\n\t\tkind: \"array\",\n\t\tnullable: false,\n\t\telement: {\n\t\t\tkind: \"document\",\n\t\t\tnullable: false,\n\t\t\tfields\n\t\t}\n\t};\n}\nfunction compileIncludes(includes) {\n\tconst stages = [];\n\tfor (const inc of includes) {\n\t\tstages.push(new MongoLookupStage({\n\t\t\tfrom: inc.from,\n\t\t\tlocalField: inc.localField,\n\t\t\tforeignField: inc.foreignField,\n\t\t\tas: inc.relationName\n\t\t}));\n\t\tif (isToOne(inc)) stages.push(new MongoUnwindStage(`$${inc.relationName}`, true));\n\t}\n\treturn stages;\n}\nfunction compileMongoQuery(collection, state, storageHash, model, storage) {\n\tconst stages = [];\n\tconst singleFilter = state.filters.length === 1 ? state.filters[0] : void 0;\n\tif (singleFilter) stages.push(new MongoMatchStage(singleFilter));\n\telse if (state.filters.length > 1) stages.push(new MongoMatchStage(MongoAndExpr.of([...state.filters])));\n\tif (state.includes.length > 0) stages.push(...compileIncludes(state.includes));\n\tif (state.orderBy) stages.push(new MongoSortStage(state.orderBy));\n\tif (state.offset !== void 0) stages.push(new MongoSkipStage(state.offset));\n\tif (state.limit !== void 0) stages.push(new MongoLimitStage(state.limit));\n\tif (state.selectedFields && state.selectedFields.length > 0) {\n\t\tconst projection = {};\n\t\tfor (const field of state.selectedFields) projection[field] = 1;\n\t\tfor (const inc of state.includes) projection[inc.relationName] = 1;\n\t\tif (!Object.hasOwn(projection, \"_id\")) projection[\"_id\"] = 0;\n\t\tstages.push(new MongoProjectStage(projection));\n\t}\n\tconst meta = {\n\t\ttarget: \"mongo\",\n\t\tstorageHash,\n\t\tlane: \"mongo-orm\"\n\t};\n\treturn {\n\t\tcollection,\n\t\tcommand: new AggregateCommand(collection, stages),\n\t\tmeta,\n\t\tresultShape: contractModelToMongoResultShape(model, {\n\t\t\t...ifDefined(\"selection\", state.selectedFields !== void 0 && state.selectedFields.length > 0 ? state.selectedFields : void 0),\n\t\t\tincludes: Object.fromEntries(state.includes.map((inc) => [inc.relationName, includeShape(inc, storage)])),\n\t\t\tstorage\n\t\t})\n\t};\n}\n//#endregion\n//#region src/orm-errors.ts\nfunction ormError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/orm-param.ts\nfunction findPlaceholder(value) {\n\tif (isMongoPreparedParamRef(value)) return value;\n\tif (value instanceof MongoParamRef) return findPlaceholder(value.value);\n\tconst children = Array.isArray(value) ? value : isPlainRecord(value) ? Object.values(value) : [];\n\tfor (const child of children) {\n\t\tconst found = findPlaceholder(child);\n\t\tif (found !== void 0) return found;\n\t}\n}\n/**\n* Wraps a value the ORM sends as a parameter. Every ORM value goes through it, so a prepared placeholder anywhere in the value is refused with `ORM.ARGUMENT_INVALID`: ORM writes run at once, and value-object literals are built with the query, so neither can take one.\n*/\nfunction ormParam(value, path, options) {\n\tconst placeholder = findPlaceholder(value);\n\tif (placeholder !== void 0) throw ormError(\"ORM.ARGUMENT_INVALID\", `The prepared parameter '${placeholder.name}' cannot be used for '${path}'. ORM writes run at once, and value-object literals are built with the query, so neither can take a prepared parameter.`, { meta: {\n\t\tname: placeholder.name,\n\t\tfield: path\n\t} });\n\treturn new MongoParamRef(value, options);\n}\n//#endregion\n//#region src/field-accessor.ts\nfunction createFieldExpression(fieldPath) {\n\treturn {\n\t\tset(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$set\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tunset() {\n\t\t\treturn {\n\t\t\t\toperator: \"$unset\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(\"\", fieldPath)\n\t\t\t};\n\t\t},\n\t\tinc(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$inc\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tmul(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$mul\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tpush(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$push\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tpull(match) {\n\t\t\treturn {\n\t\t\t\toperator: \"$pull\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(match, fieldPath)\n\t\t\t};\n\t\t},\n\t\taddToSet(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$addToSet\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tpop(end) {\n\t\t\treturn {\n\t\t\t\toperator: \"$pop\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(end, fieldPath)\n\t\t\t};\n\t\t}\n\t};\n}\nfunction createFieldAccessor() {\n\treturn new Proxy((() => {}), {\n\t\tget(_target, prop) {\n\t\t\treturn createFieldExpression(prop);\n\t\t},\n\t\tapply(_target, _thisArg, args) {\n\t\t\treturn createFieldExpression(args[0]);\n\t\t}\n\t});\n}\nfunction compileFieldOperations(ops, wrapValue, storedPathOf = (field) => field) {\n\tconst grouped = {};\n\tfor (const op of ops) {\n\t\tlet group = grouped[op.operator];\n\t\tif (!group) {\n\t\t\tgroup = {};\n\t\t\tgrouped[op.operator] = group;\n\t\t}\n\t\tgroup[storedPathOf(op.field)] = wrapValue(op.field, op.value, op.operator);\n\t}\n\treturn grouped;\n}\n//#endregion\n//#region src/model-stored-names.ts\nfunction invert(map) {\n\treturn Object.fromEntries(Object.entries(map).map(([key, value]) => [value, key]));\n}\nconst cachedStoredNames = /* @__PURE__ */ new WeakMap();\n/**\n* The stored names of model `modelName`'s fields, its own and those it inherits, and, when `variantModelName` is given, the fields of that variant. Embedded models are looked up when asked for, so a model that embeds itself reuses the same map at every level.\n*/\nfunction modelStoredNamesOf(contract, modelName, variantModelName) {\n\tconst cache = cachedStoredNames.get(contract) ?? /* @__PURE__ */ new Map();\n\tcachedStoredNames.set(contract, cache);\n\tconst key = JSON.stringify([modelName, variantModelName ?? null]);\n\tconst cached = cache.get(key);\n\tif (cached !== void 0) return cached;\n\tconst models = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId);\n\tconst model = models[modelName];\n\tconst variant = variantModelName === void 0 ? void 0 : models[variantModelName];\n\tconst storedNames = {\n\t\t...storedNamesOf(models, modelName),\n\t\t...variant === void 0 ? {} : ownStoredNamesOf(variant)\n\t};\n\tconst embedStoredNames = model === void 0 ? {} : ownEmbedStoredNamesOf(model);\n\tconst storedNamesOfModel = {\n\t\tmodelName,\n\t\tstoredNames,\n\t\tfieldNames: invert(storedNames),\n\t\tembedStoredNames,\n\t\tembedded(relationName) {\n\t\t\tif (!Object.hasOwn(embedStoredNames, relationName)) return void 0;\n\t\t\tconst target = model?.relations[relationName]?.to.model;\n\t\t\treturn target === void 0 ? void 0 : modelStoredNamesOf(contract, target);\n\t\t}\n\t};\n\tcache.set(key, storedNamesOfModel);\n\treturn storedNamesOfModel;\n}\n/** The refusal of a name a caller passed that is not a field of the model. */\nfunction callerFieldUnknown(names, fieldName) {\n\tconst unknown = `Model \"${names.modelName}\" has no field \"${fieldName}\"`;\n\tconst fieldForStoredName = Object.hasOwn(names.fieldNames, fieldName) ? names.fieldNames[fieldName] : void 0;\n\tif (fieldForStoredName !== void 0) return ormError(\"ORM.FIELD_UNKNOWN\", `${unknown}. \"${fieldName}\" is the stored name of field \"${fieldForStoredName}\"; pass the field name.`, { meta: {\n\t\tmodel: names.modelName,\n\t\tfield: fieldName,\n\t\tfieldForStoredName\n\t} });\n\treturn ormError(\"ORM.FIELD_UNKNOWN\", unknown, { meta: {\n\t\tmodel: names.modelName,\n\t\tfield: fieldName\n\t} });\n}\n/** The stored name of a field a caller named. A name that is not a field is refused with `ORM.FIELD_UNKNOWN`. */\nfunction storedNameOfCallerField(names, fieldName) {\n\tconst storedName = Object.hasOwn(names.storedNames, fieldName) ? names.storedNames[fieldName] : void 0;\n\tif (storedName === void 0) throw callerFieldUnknown(names, fieldName);\n\treturn storedName;\n}\n/**\n* The stored path of a dot path a caller named: its first segment is a field, or an embed relation, of the model; a value object stores the rest under their own names.\n*/\nfunction storedPathOfCallerPath(names, path) {\n\tconst [head = path, ...rest] = path.split(\".\");\n\tconst embed = Object.hasOwn(names.embedStoredNames, head) ? names.embedStoredNames[head] : void 0;\n\tif (embed === void 0) return [storedNameOfCallerField(names, head), ...rest].join(\".\");\n\tconst embeddedStorage = names.embedded(head);\n\tconst [next, ...afterNext] = rest;\n\tif (embeddedStorage === void 0 || next === void 0) return [embed, ...rest].join(\".\");\n\tif (/^\\d+$/.test(next)) return afterNext.length === 0 ? [embed, next].join(\".\") : [\n\t\tembed,\n\t\tnext,\n\t\tstoredPathOfCallerPath(embeddedStorage, afterNext.join(\".\"))\n\t].join(\".\");\n\treturn [embed, storedPathOfCallerPath(embeddedStorage, rest.join(\".\"))].join(\".\");\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction mapEach(value, map) {\n\tif (Array.isArray(value)) return value.map((element) => isRecord(element) ? map(element) : element);\n\treturn isRecord(value) ? map(value) : value;\n}\n/** A document of a model as a row of its fields: each stored name under the name of the field that stores it, embedded models likewise, and stored names no field stores left out. */\nfunction rowOfStoredDocument(document, names, extra = {}) {\n\tconst row = {};\n\tconst relationOfEmbed = invert(names.embedStoredNames);\n\tfor (const [storedName, value] of Object.entries(document)) {\n\t\tconst extraKey = Object.hasOwn(extra, storedName) ? extra[storedName] : void 0;\n\t\tif (extraKey !== void 0) {\n\t\t\trow[storedName] = extraKey(value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst fieldName = Object.hasOwn(names.fieldNames, storedName) ? names.fieldNames[storedName] : void 0;\n\t\tif (fieldName !== void 0) {\n\t\t\trow[fieldName] = value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst relationName = Object.hasOwn(relationOfEmbed, storedName) ? relationOfEmbed[storedName] : void 0;\n\t\tif (relationName === void 0) continue;\n\t\tconst embeddedStorage = names.embedded(relationName);\n\t\trow[relationName] = embeddedStorage === void 0 ? value : mapEach(value, (embedded) => rowOfStoredDocument(embedded, embeddedStorage));\n\t}\n\treturn row;\n}\n/** A row of a model's fields as the document that stores it, embedded models likewise. */\nfunction storedDocumentOfRow(row, names) {\n\tconst document = {};\n\tfor (const [name, value] of Object.entries(row)) {\n\t\tconst embed = Object.hasOwn(names.embedStoredNames, name) ? names.embedStoredNames[name] : void 0;\n\t\tif (embed === void 0) {\n\t\t\tdocument[storedNameOfCallerField(names, name)] = value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst embeddedStorage = names.embedded(name);\n\t\tdocument[embed] = embeddedStorage === void 0 ? value : mapEach(value, (embedded) => storedDocumentOfRow(embedded, embeddedStorage));\n\t}\n\treturn document;\n}\n/**\n* Maps each document of model `modelName` to its row. A document of a model with variants is read with the fields of the variant its discriminator value names, unless `variantModelName` already names one; each included relation is read as rows of the model it reads.\n*/\nfunction documentRowMapper(contract, modelName, variantModelName, includes = {}) {\n\tconst model = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId)[modelName];\n\tconst base = modelStoredNamesOf(contract, modelName, variantModelName);\n\tconst discriminator = variantModelName === void 0 && model?.discriminator !== void 0 ? base.storedNames[model.discriminator.field] : void 0;\n\tconst namesOfVariant = (value) => {\n\t\tconst variantModel = typeof value === \"string\" ? model?.variants?.[value]?.model : void 0;\n\t\treturn variantModel === void 0 ? base : modelStoredNamesOf(contract, modelName, variantModel);\n\t};\n\tconst extra = Object.fromEntries(Object.entries(includes).map(([relationName, target]) => {\n\t\tconst targetRow = documentRowMapper(contract, target, void 0);\n\t\treturn [relationName, (value) => mapEach(value, targetRow)];\n\t}));\n\treturn (document) => {\n\t\tif (!isRecord(document)) return document;\n\t\treturn rowOfStoredDocument(document, discriminator === void 0 ? base : namesOfVariant(document[discriminator]), extra);\n\t};\n}\n//#endregion\n//#region src/upsert-pipeline.ts\nfunction fieldNamesIn(filter) {\n\tswitch (filter.kind) {\n\t\tcase \"field\":\n\t\tcase \"exists\": return [filter.field.split(\".\")[0] ?? filter.field];\n\t\tcase \"and\":\n\t\tcase \"or\": return filter.exprs.flatMap(fieldNamesIn);\n\t\tcase \"not\": return fieldNamesIn(filter.expr);\n\t\tcase \"expr\": return [];\n\t}\n}\n/**\n* True while the pipeline runs on the document an upsert is inserting. That document starts with only the equality fields the server copies from the filter, so every one of its keys is a field the filter names; a matched document always has an `_id` the filter does not name, or, when the filter names `_id`, fields besides the filter's.\n*/\nfunction isInsert(filter) {\n\tconst keys = new MongoAggMap(MongoAggOperator.of(\"$objectToArray\", MongoAggFieldRef.of(\"$ROOT\")), MongoAggFieldRef.of(\"$this.k\"), \"this\");\n\treturn MongoAggOperator.of(\"$setIsSubset\", [keys, MongoAggLiteral.of([...new Set(fieldNamesIn(filter))])]);\n}\nfunction orEmptyList(field) {\n\treturn MongoAggOperator.of(\"$ifNull\", [MongoAggFieldRef.of(field), MongoAggLiteral.of([])]);\n}\nfunction whenList(field, expr) {\n\treturn MongoAggCond.of(MongoAggOperator.of(\"$isArray\", MongoAggFieldRef.of(field)), expr, MongoAggFieldRef.of(field));\n}\nfunction popped(field, end) {\n\tconst size = MongoAggOperator.size(MongoAggFieldRef.of(field));\n\tconst rest = MongoAggOperator.subtract(size, MongoAggLiteral.of(1));\n\tconst kept = MongoAggOperator.of(\"$slice\", [\n\t\tMongoAggFieldRef.of(field),\n\t\tMongoAggLiteral.of(end === -1 ? 1 : 0),\n\t\trest\n\t]);\n\treturn whenList(field, MongoAggCond.of(MongoAggOperator.of(\"$lte\", [size, MongoAggLiteral.of(1)]), MongoAggLiteral.of([]), kept));\n}\nfunction operatorExpression(operator, field, value) {\n\tswitch (operator) {\n\t\tcase \"$set\": return MongoAggLiteral.of(value);\n\t\tcase \"$unset\": return MongoAggFieldRef.of(\"$REMOVE\");\n\t\tcase \"$inc\": return MongoAggOperator.add(MongoAggOperator.of(\"$ifNull\", [MongoAggFieldRef.of(field), MongoAggLiteral.of(0)]), MongoAggLiteral.of(value));\n\t\tcase \"$mul\": return MongoAggOperator.multiply(MongoAggOperator.of(\"$ifNull\", [MongoAggFieldRef.of(field), MongoAggLiteral.of(0)]), MongoAggLiteral.of(value));\n\t\tcase \"$push\": return MongoAggOperator.of(\"$concatArrays\", [orEmptyList(field), MongoAggLiteral.of([value])]);\n\t\tcase \"$addToSet\": return MongoAggCond.of(MongoAggOperator.of(\"$in\", [MongoAggLiteral.of(value), orEmptyList(field)]), orEmptyList(field), MongoAggOperator.of(\"$concatArrays\", [orEmptyList(field), MongoAggLiteral.of([value])]));\n\t\tcase \"$pull\":\n\t\t\tif (typeof value === \"object\" && value !== null && !(value instanceof MongoParamRef)) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `upsert() cannot pull by a match document from \"${field}\" when create sets a field that has an update default. Pull a single value, or leave that field out of create.`, { meta: {\n\t\t\t\tmethod: \"upsert\",\n\t\t\t\tfield\n\t\t\t} });\n\t\t\treturn whenList(field, MongoAggArrayFilter.of(MongoAggFieldRef.of(field), MongoAggOperator.of(\"$ne\", [MongoAggFieldRef.of(\"$this\"), MongoAggLiteral.of(value)]), \"this\"));\n\t\tcase \"$pop\": return popped(field, value instanceof MongoParamRef ? value.value : value);\n\t\tdefault: throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `upsert() cannot apply ${operator} to \"${field}\" when create sets a field that has an update default.`, { meta: {\n\t\t\tmethod: \"upsert\",\n\t\t\tfield,\n\t\t\toperator\n\t\t} });\n\t}\n}\n/**\n* The one-command form of an upsert whose `create` sets a field that also has an update default: an update pipeline that, on insert, writes every `create` value, including those fields, and on update applies the update and its defaults. Every value is a `$literal`, so a string such as `'$x'` is not read as a field path.\n*/\nfunction upsertPipeline(input) {\n\tconst inserting = isInsert(input.filter);\n\tconst fields = {};\n\tfor (const [operator, group] of Object.entries(input.update)) for (const [field, value] of Object.entries(group)) {\n\t\tconst onUpdate = operatorExpression(operator, field, value);\n\t\tconst created = input.create[field];\n\t\tfields[field] = operator === \"$set\" && input.createWins.has(field) && created !== void 0 ? MongoAggCond.of(inserting, MongoAggLiteral.of(created), onUpdate) : onUpdate;\n\t}\n\tfor (const [field, value] of Object.entries(input.create)) if (!Object.hasOwn(fields, field)) fields[field] = MongoAggCond.of(inserting, MongoAggLiteral.of(value), MongoAggFieldRef.of(field));\n\treturn [new MongoAddFieldsStage(fields)];\n}\n//#endregion\n//#region src/where-equality.ts\n/**\n* On a list, `{ field: null }` also matches an array holding a null item, and an upsert copies `{ field: element }` into the inserted document as a value that is not a list. So `null` on a list matches any value that is not an array, and one element matches a list item equal to it.\n*/\nfunction whereEquality(path, field, value) {\n\tif (field?.many) {\n\t\tif (value === null) return notAnArray(path);\n\t\tif (!Array.isArray(value)) return holdsItem(path, value);\n\t}\n\treturn MongoFieldFilter.eq(path, value);\n}\nfunction notAnArray(path) {\n\treturn MongoFieldFilter.of(path, \"$not\", { $type: \"array\" });\n}\nfunction holdsItem(path, item) {\n\treturn MongoFieldFilter.of(path, \"$elemMatch\", { $eq: item });\n}\n//#endregion\n//#region src/collection.ts\nconst COMPARISON_OPERATORS = /* @__PURE__ */ new Set([\n\t\"$eq\",\n\t\"$ne\",\n\t\"$gt\",\n\t\"$gte\",\n\t\"$lt\",\n\t\"$lte\"\n]);\nconst MEMBERSHIP_OPERATORS = /* @__PURE__ */ new Set([\"$in\", \"$nin\"]);\nfunction modelOf(contract, modelName) {\n\tconst model = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId)[modelName];\n\tif (model === void 0) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown model: \"${modelName}\".`, { meta: { model: modelName } });\n\treturn model;\n}\nfunction resolveCollectionName(model, modelName) {\n\treturn model.storage.collection ?? modelName;\n}\nfunction topLevelUpdateFields(updateDoc) {\n\tconst fields = /* @__PURE__ */ new Set();\n\tfor (const operatorGroup of Object.values(updateDoc)) for (const fieldPath of Object.keys(operatorGroup)) fields.add(fieldPath.split(\".\")[0] ?? fieldPath);\n\treturn fields;\n}\n/** The context contract's enum accessors, each reading its members through its codec in the context. */\nfunction buildEnumAccessors(context) {\n\treturn buildNamespacedEnums(context.contract.domain, enumMemberCodecFor(context.codecs));\n}\nfunction describeValue(value) {\n\tif (typeof value === \"bigint\") return `${value}n`;\n\ttry {\n\t\treturn JSON.stringify(value) ?? String(value);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\nfunction isUnknownRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nconst LIST_INDEX = /^\\d+$/;\nvar MongoCollectionImpl = class MongoCollectionImpl {\n\t#contract;\n\t#modelName;\n\t#ctx;\n\t#enums;\n\t#executor;\n\t#mutationDefaults;\n\t#collectionName;\n\t#state;\n\t#variantValue;\n\tconstructor(ctx, modelName, enums) {\n\t\tthis.#ctx = ctx;\n\t\tthis.#enums = enums;\n\t\tthis.#contract = ctx.context.contract;\n\t\tthis.#modelName = modelName;\n\t\tthis.#executor = ctx.runtime;\n\t\tthis.#mutationDefaults = ctx.context;\n\t\tthis.#collectionName = resolveCollectionName(modelOf(this.#contract, modelName), modelName);\n\t\tthis.#state = emptyCollectionState();\n\t}\n\tvariant(value) {\n\t\tconst model = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[this.#modelName];\n\t\tconst discriminator = model?.discriminator;\n\t\tconst selectedValue = this.#variantValue;\n\t\tif (selectedValue !== void 0) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `variant(\"${value}\") cannot be called on model \"${this.#modelName}\" because variant(\"${selectedValue}\") is already selected; call variant() on the base collection instead`, { meta: {\n\t\t\tmethod: \"variant\",\n\t\t\tmodel: this.#modelName,\n\t\t\tvariant: model?.variants?.[selectedValue]?.model,\n\t\t\tselectedValue,\n\t\t\treason: \"variant-already-selected\"\n\t\t} });\n\t\tif (!discriminator || model?.variants?.[value] === void 0) {\n\t\t\tconst declaredValues = discriminator ? Object.keys(model?.variants ?? {}) : [];\n\t\t\tthrow ormError(\"ORM.ARGUMENT_INVALID\", declaredValues.length === 0 ? `variant(\"${value}\") cannot narrow model \"${this.#modelName}\": it declares no discriminator values` : `variant(\"${value}\") cannot narrow model \"${this.#modelName}\": the declared discriminator values are ${declaredValues.map((declared) => `\"${declared}\"`).join(\", \")}`, { meta: {\n\t\t\t\tmethod: \"variant\",\n\t\t\t\targument: \"value\",\n\t\t\t\tmodel: this.#modelName,\n\t\t\t\tvalue,\n\t\t\t\tdeclaredValues\n\t\t\t} });\n\t\t}\n\t\tconst filter = MongoFieldFilter.eq(storedNameOfCallerField(modelStoredNamesOf(this.#contract, this.#modelName), discriminator.field), ormParam(value, discriminator.field));\n\t\treturn this.#cloneWithVariant({ filters: [...this.#state.filters, filter] }, value);\n\t}\n\twhere(filter) {\n\t\tif (isMongoFilterExpr(filter)) {\n\t\t\tconst encoded = filter.rewrite({\n\t\t\t\tfield: (fieldFilter) => this.#encodeFieldFilter(fieldFilter),\n\t\t\t\texists: (existsFilter) => new MongoExistsExpr(this.#storedPath(existsFilter.field), existsFilter.exists),\n\t\t\t\texpr: (exprFilter) => MongoExprFilter.of(exprFilter.aggExpr.rewrite({ fieldRef: (ref) => ref.path.startsWith(\"$\") ? ref : MongoAggFieldRef.of(this.#storedPath(ref.path)) }))\n\t\t\t});\n\t\t\treturn this.#clone({ filters: [...this.#state.filters, encoded] });\n\t\t}\n\t\tconst compiled = this.#compileWhereObject(blindCast(filter));\n\t\treturn this.#clone({ filters: [...this.#state.filters, ...compiled] });\n\t}\n\tselect(...fields) {\n\t\tconst storage = this.#storedNames();\n\t\treturn this.#clone({ selectedFields: [...this.#state.selectedFields ?? [], ...fields.map((field) => storedNameOfCallerField(storage, field))] });\n\t}\n\tinclude(relationName) {\n\t\tconst relation = modelOf(this.#contract, this.#modelName).relations?.[relationName];\n\t\tif (!relation) throw ormError(\"ORM.RELATION_UNKNOWN\", `Unknown relation \"${relationName}\" on model \"${this.#modelName}\"`, { meta: {\n\t\t\tmodel: this.#modelName,\n\t\t\trelation: relationName\n\t\t} });\n\t\tif (!(\"on\" in relation)) throw ormError(\"ORM.INCLUDE_UNSUPPORTED\", `Relation \"${relationName}\" is an embed relation — only reference relations can be included`, { meta: {\n\t\t\tmodel: this.#modelName,\n\t\t\trelation: relationName\n\t\t} });\n\t\tconst ref = relation;\n\t\tconst localField = ref.on.localFields[0];\n\t\tconst foreignField = ref.on.targetFields[0];\n\t\tif (!localField || !foreignField || ref.on.localFields.length !== 1 || ref.on.targetFields.length !== 1) throw ormError(\"ORM.INCLUDE_UNSUPPORTED\", `Compound references are not yet supported: relation \"${relationName}\"`, { meta: {\n\t\t\tmodel: this.#modelName,\n\t\t\trelation: relationName\n\t\t} });\n\t\tconst targetModelName = ref.to.model;\n\t\tconst targetModel = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[targetModelName];\n\t\tif (!targetModel) throw new InternalError(`Target model \"${targetModelName}\" not found for relation \"${relationName}\"`);\n\t\tconst includeExpr = {\n\t\t\trelationName,\n\t\t\ttargetModelName,\n\t\t\ttargetModel,\n\t\t\tfrom: resolveCollectionName(targetModel, targetModelName),\n\t\t\tlocalField: storedNameOfCallerField(this.#storedNames(), localField),\n\t\t\tforeignField: storedNameOfCallerField(modelStoredNamesOf(this.#contract, targetModelName), foreignField),\n\t\t\tcardinality: ref.cardinality\n\t\t};\n\t\treturn blindCast(this.#clone({ includes: [...this.#state.includes, includeExpr] }));\n\t}\n\torderBy(spec) {\n\t\tconst storage = this.#storedNames();\n\t\tconst merged = {\n\t\t\t...this.#state.orderBy,\n\t\t\t...Object.fromEntries(Object.entries(spec).flatMap(([field, direction]) => direction === void 0 ? [] : [[storedNameOfCallerField(storage, field), direction]]))\n\t\t};\n\t\treturn this.#clone({ orderBy: merged });\n\t}\n\tlimit(n) {\n\t\treturn this.#clone({ limit: n });\n\t}\n\toffset(n) {\n\t\treturn this.#clone({ offset: n });\n\t}\n\tall() {\n\t\treturn this.#query();\n\t}\n\tasync first() {\n\t\tconst result = this.#clone({ limit: 1 }).#query();\n\t\tfor await (const row of result) return row;\n\t\treturn null;\n\t}\n\tasync firstOrThrow() {\n\t\treturn this.#clone({ limit: 1 }).#query().firstOrThrow();\n\t}\n\tasync create(data) {\n\t\tthis.#rejectIncludes(\"create\");\n\t\tconst normalized = this.#withCreateDefaults(this.#injectDiscriminator(this.#stripUndefined(blindCast(data))), /* @__PURE__ */ new Map());\n\t\tconst document = this.#toDocument(normalized);\n\t\tconst command = new InsertOneCommand(this.#collectionName, document);\n\t\tconst results = await this.#drainPlan(command, this.#insertOneResultShape());\n\t\treturn blindCast(this.#rowOf(blindCast(results[0]).document));\n\t}\n\tcreateAll(data) {\n\t\tthis.#rejectIncludes(\"createAll\");\n\t\tconst self = this;\n\t\tasync function* gen() {\n\t\t\tconst defaultValueCache = /* @__PURE__ */ new Map();\n\t\t\tconst normalizedRows = data.map((d) => self.#withCreateDefaults(self.#injectDiscriminator(self.#stripUndefined(blindCast(d))), defaultValueCache));\n\t\t\tconst command = new InsertManyCommand(self.#collectionName, normalizedRows.map((d) => self.#toDocument(d)));\n\t\t\tconst { documents } = blindCast((await self.#drainPlan(command, self.#insertManyResultShape()))[0]);\n\t\t\tfor (const document of documents) yield blindCast(self.#rowOf(document));\n\t\t}\n\t\treturn new AsyncIterableResult(gen());\n\t}\n\tasync createAndCount(data) {\n\t\tthis.#rejectIncludes(\"createAndCount\");\n\t\tconst defaultValueCache = /* @__PURE__ */ new Map();\n\t\tconst documents = data.map((d) => this.#toDocument(this.#withCreateDefaults(this.#injectDiscriminator(this.#stripUndefined(blindCast(d))), defaultValueCache)));\n\t\tconst command = new InsertManyCommand(this.#collectionName, documents);\n\t\treturn blindCast((await this.#drainPlan(command))[0]).insertedCount;\n\t}\n\tasync update(dataOrCallback) {\n\t\tthis.#requireFilters(\"update\");\n\t\tthis.#rejectWindowing(\"update\");\n\t\tthis.#rejectIncludes(\"update\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst updateDoc = this.#withUpdateDefaults(this.#resolveUpdateDoc(dataOrCallback), /* @__PURE__ */ new Map());\n\t\tconst command = new FindOneAndUpdateCommand(this.#collectionName, filter, updateDoc, false);\n\t\tconst result = (await this.#drainPlan(command, this.#modelResultShape()))[0];\n\t\treturn result === void 0 ? null : blindCast(this.#rowOf(result));\n\t}\n\tupdateAll(dataOrCallback) {\n\t\tthis.#requireFilters(\"updateAll\");\n\t\tthis.#rejectWindowing(\"updateAll\");\n\t\tconst self = this;\n\t\tasync function* gen() {\n\t\t\tconst ids = await self.#readMatchingIds();\n\t\t\tif (ids.length === 0) return;\n\t\t\tconst filter = self.#mergeFilters();\n\t\t\tconst updateDoc = self.#withUpdateDefaults(self.#resolveUpdateDoc(dataOrCallback), /* @__PURE__ */ new Map());\n\t\t\tconst command = new UpdateManyCommand(self.#collectionName, filter, updateDoc);\n\t\t\tawait self.#drainPlan(command);\n\t\t\tconst idFilter = MongoFieldFilter.in(\"_id\", ids.map((id) => ormParam(id, \"_id\")));\n\t\t\tyield* self.#clone({ filters: [idFilter] }).#query();\n\t\t}\n\t\treturn new AsyncIterableResult(gen());\n\t}\n\tasync updateAndCount(dataOrCallback) {\n\t\tthis.#requireFilters(\"updateAndCount\");\n\t\tthis.#rejectWindowing(\"updateAndCount\");\n\t\tthis.#rejectIncludes(\"updateAndCount\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst updateDoc = this.#withUpdateDefaults(this.#resolveUpdateDoc(dataOrCallback), /* @__PURE__ */ new Map());\n\t\tconst command = new UpdateManyCommand(this.#collectionName, filter, updateDoc);\n\t\treturn (await this.#executePlan(command)).affectedRows;\n\t}\n\tasync delete() {\n\t\tthis.#requireFilters(\"delete\");\n\t\tthis.#rejectWindowing(\"delete\");\n\t\tthis.#rejectIncludes(\"delete\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst command = new FindOneAndDeleteCommand(this.#collectionName, filter);\n\t\tconst result = (await this.#drainPlan(command, this.#modelResultShape()))[0];\n\t\treturn result === void 0 ? null : blindCast(this.#rowOf(result));\n\t}\n\tdeleteAll() {\n\t\tthis.#requireFilters(\"deleteAll\");\n\t\tthis.#rejectWindowing(\"deleteAll\");\n\t\tconst self = this;\n\t\tasync function* gen() {\n\t\t\tconst docs = [];\n\t\t\tfor await (const row of self.#query()) docs.push(row);\n\t\t\tconst filter = self.#mergeFilters();\n\t\t\tconst command = new DeleteManyCommand(self.#collectionName, filter);\n\t\t\tawait self.#drainPlan(command);\n\t\t\tyield* docs;\n\t\t}\n\t\treturn new AsyncIterableResult(gen());\n\t}\n\tasync deleteAndCount() {\n\t\tthis.#requireFilters(\"deleteAndCount\");\n\t\tthis.#rejectWindowing(\"deleteAndCount\");\n\t\tthis.#rejectIncludes(\"deleteAndCount\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst command = new DeleteManyCommand(this.#collectionName, filter);\n\t\treturn (await this.#executePlan(command)).affectedRows;\n\t}\n\tasync upsert(input) {\n\t\tthis.#requireFilters(\"upsert\");\n\t\tthis.#rejectWindowing(\"upsert\");\n\t\tthis.#rejectIncludes(\"upsert\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst defaultValueCache = /* @__PURE__ */ new Map();\n\t\tconst explicitCreate = this.#injectDiscriminator(this.#stripUndefined(blindCast(input.create)));\n\t\tconst allCreateFields = this.#toDocument(this.#withCreateDefaults(explicitCreate, defaultValueCache));\n\t\tlet updateDoc;\n\t\tif (typeof input.update === \"function\") {\n\t\t\tconst accessor = createFieldAccessor();\n\t\t\tconst ops = input.update(accessor);\n\t\t\tthis.#rejectDocumentIdOps(ops);\n\t\t\tconst dotPathOp = ops.find((op) => op.field.includes(\".\"));\n\t\t\tif (dotPathOp) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `upsert() does not support dot-path field operations (found \"${dotPathOp.field}\"). Dot-path updates conflict with \\$setOnInsert on the insert path, producing incomplete documents. Use top-level field operations instead.`, { meta: {\n\t\t\t\tmethod: \"upsert\",\n\t\t\t\tfield: dotPathOp.field\n\t\t\t} });\n\t\t\tupdateDoc = compileFieldOperations(ops, (field, value, operator) => this.#wrapFieldOpValue(field, value, operator), (field) => this.#storedPath(field));\n\t\t} else {\n\t\t\tconst setFields = this.#toSetFields(blindCast(input.update));\n\t\t\tupdateDoc = {};\n\t\t\tif (Object.keys(setFields).length > 0) updateDoc[\"$set\"] = setFields;\n\t\t}\n\t\tconst explicitUpdateFields = topLevelUpdateFields(updateDoc);\n\t\tconst withUpdateDefaults = this.#withUpdateDefaults(updateDoc, defaultValueCache);\n\t\tconst explicitCreateFields = new Set(Object.keys(this.#storedKeys(explicitCreate)));\n\t\tconst generatedSetByCreate = Object.keys(withUpdateDefaults[\"$set\"] ?? {}).filter((field) => !explicitUpdateFields.has(field) && explicitCreateFields.has(field));\n\t\tif (generatedSetByCreate.length === 0) return this.#upsertCommand(filter, withUpdateDefaults, allCreateFields);\n\t\tconst results = await this.#drainPlan(new FindOneAndUpdateCommand(this.#collectionName, filter, upsertPipeline({\n\t\t\tfilter,\n\t\t\tupdate: withUpdateDefaults,\n\t\t\tcreate: allCreateFields,\n\t\t\tcreateWins: new Set(generatedSetByCreate)\n\t\t}), true), this.#modelResultShape());\n\t\treturn blindCast(this.#rowOf(results[0]));\n\t}\n\tasync #upsertCommand(filter, updateDoc, allCreateFields) {\n\t\tconst updatedFields = topLevelUpdateFields(updateDoc);\n\t\tconst insertOnlyFields = {};\n\t\tfor (const [key, value] of Object.entries(allCreateFields)) if (!updatedFields.has(key)) insertOnlyFields[key] = value;\n\t\tconst command = new FindOneAndUpdateCommand(this.#collectionName, filter, Object.keys(insertOnlyFields).length > 0 ? {\n\t\t\t...updateDoc,\n\t\t\t$setOnInsert: insertOnlyFields\n\t\t} : updateDoc, true);\n\t\tconst results = await this.#drainPlan(command, this.#modelResultShape());\n\t\treturn blindCast(this.#rowOf(results[0]));\n\t}\n\tasync #readMatchingIds() {\n\t\tconst idQuery = this.#clone({\n\t\t\tincludes: [],\n\t\t\tselectedFields: [\"_id\"],\n\t\t\torderBy: void 0,\n\t\t\tlimit: void 0,\n\t\t\toffset: void 0\n\t\t});\n\t\tconst ids = [];\n\t\tconst { resultShape: _rs, ...planWithoutShape } = idQuery.#compile();\n\t\tfor await (const row of this.#executor.query(planWithoutShape)) {\n\t\t\tconst storageRow = blindCast(row);\n\t\t\tids.push(storageRow[\"_id\"]);\n\t\t}\n\t\treturn ids;\n\t}\n\t#query() {\n\t\tconst plan = this.#compile();\n\t\tconst documents = this.#executor.query(plan);\n\t\tconst rowOf = this.#rowMapper();\n\t\tasync function* rows() {\n\t\t\tfor await (const document of documents) yield blindCast(rowOf(document));\n\t\t}\n\t\treturn new AsyncIterableResult(rows());\n\t}\n\t#rowMapper() {\n\t\treturn documentRowMapper(this.#contract, this.#modelName, this.#variantModelName(), Object.fromEntries(this.#state.includes.map((include) => [include.relationName, include.targetModelName])));\n\t}\n\t#rowOf(document) {\n\t\treturn this.#rowMapper()(document);\n\t}\n\t#variantModelName() {\n\t\tif (this.#variantValue === void 0) return void 0;\n\t\treturn mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[this.#modelName]?.variants?.[this.#variantValue]?.model;\n\t}\n\t#storedNames() {\n\t\treturn modelStoredNamesOf(this.#contract, this.#modelName, this.#variantModelName());\n\t}\n\t#storedPath(path) {\n\t\treturn storedPathOfCallerPath(this.#storedNames(), path);\n\t}\n\t#storedKeys(data) {\n\t\tconst storage = this.#storedNames();\n\t\treturn Object.fromEntries(Object.entries(data).map(([key, value]) => [storedPathOfCallerPath(storage, key), value]));\n\t}\n\t#rejectDocumentIdOps(ops) {\n\t\tconst idOp = ops.find((op) => this.#storedPath(op.field).split(\".\")[0] === \"_id\");\n\t\tif (idOp) throw ormError(\"ORM.FIELD_IMMUTABLE\", `Mutation payloads cannot modify \\`${idOp.field}\\``, { meta: { field: idOp.field } });\n\t}\n\t#compile() {\n\t\tconst model = this.#modelWithVariantFields();\n\t\tif (!model) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown model: \"${this.#modelName}\".`, { meta: { model: this.#modelName } });\n\t\treturn compileMongoQuery(this.#collectionName, this.#state, this.#contract.storage.storageHash, model, this.#contract.storage);\n\t}\n\t#wrapCommand(command, resultShape) {\n\t\treturn {\n\t\t\tcollection: this.#collectionName,\n\t\t\tcommand,\n\t\t\tmeta: this.#planMeta(),\n\t\t\t...ifDefined(\"resultShape\", resultShape)\n\t\t};\n\t}\n\t#executePlan(command) {\n\t\treturn this.#executor.execute(this.#wrapCommand(command));\n\t}\n\tasync #drainPlan(command, resultShape) {\n\t\tconst plan = this.#wrapCommand(command, resultShape);\n\t\tconst result = this.#executor.query(plan);\n\t\tconst rows = [];\n\t\tfor await (const row of result) rows.push(row);\n\t\treturn rows;\n\t}\n\t#modelFields() {\n\t\treturn this.#modelWithVariantFields()?.fields ?? {};\n\t}\n\t#modelWithVariantFields() {\n\t\tconst models = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId);\n\t\tconst model = models[this.#modelName];\n\t\tconst variantRef = this.#variantValue === void 0 ? void 0 : model?.variants?.[this.#variantValue];\n\t\tif (model === void 0 || variantRef === void 0) return model;\n\t\tconst variant = models[variantRef.model];\n\t\treturn variant === void 0 ? model : {\n\t\t\t...model,\n\t\t\tfields: {\n\t\t\t\t...model.fields,\n\t\t\t\t...variant.fields\n\t\t\t},\n\t\t\tstorage: {\n\t\t\t\t...model.storage,\n\t\t\t\tfields: {\n\t\t\t\t\t...model.storage.fields,\n\t\t\t\t\t...variant.storage.fields\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t#idFieldShape() {\n\t\tconst model = this.#modelWithVariantFields();\n\t\tconst idField = model === void 0 ? void 0 : ownDocumentIdFieldOf(model)?.field;\n\t\treturn idField ? contractFieldToMongoFieldShape(idField) : Object.freeze({ kind: \"unknown\" });\n\t}\n\t#insertOneResultShape() {\n\t\treturn freezeMongoResultShape({\n\t\t\tkind: \"document\",\n\t\t\tfields: {\n\t\t\t\tinsertedId: this.#idFieldShape(),\n\t\t\t\tdocument: this.#documentShape()\n\t\t\t}\n\t\t});\n\t}\n\t#insertManyResultShape() {\n\t\treturn freezeMongoResultShape({\n\t\t\tkind: \"document\",\n\t\t\tfields: {\n\t\t\t\tinsertedIds: {\n\t\t\t\t\tkind: \"array\",\n\t\t\t\t\tnullable: false,\n\t\t\t\t\telement: this.#idFieldShape()\n\t\t\t\t},\n\t\t\t\tdocuments: {\n\t\t\t\t\tkind: \"array\",\n\t\t\t\t\tnullable: false,\n\t\t\t\t\telement: this.#documentShape()\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t#documentShape() {\n\t\tconst shape = this.#modelResultShape();\n\t\treturn shape.kind === \"document\" ? {\n\t\t\tkind: \"document\",\n\t\t\tnullable: false,\n\t\t\tfields: shape.fields,\n\t\t\trow: true\n\t\t} : { kind: \"unknown\" };\n\t}\n\t#modelResultShape() {\n\t\tconst model = this.#modelWithVariantFields();\n\t\tif (!model) return Object.freeze({ kind: \"unknown\" });\n\t\treturn contractModelToMongoResultShape(model, { storage: this.#contract.storage });\n\t}\n\t#valueObjectAt(reference) {\n\t\treturn valueObjectAt(this.#contract.storage, reference);\n\t}\n\t#compileWhereObject(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst filters = [];\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst storedName = storedNameOfCallerField(this.#storedNames(), key);\n\t\t\tconst field = fields[key];\n\t\t\tfilters.push(whereEquality(storedName, field, this.#wrapFieldValue(value, field, key, \"filter\")));\n\t\t}\n\t\treturn filters;\n\t}\n\t/**\n\t* Encodes the comparison values of a filter on a scalar field through the field's codec, as the object form of `where` and every update does. Without it a driver class such as an `ObjectId` would be copied into a plain object and match nothing.\n\t*/\n\t#encodeFieldFilter(filter) {\n\t\tconst storedPath = this.#storedPath(filter.field);\n\t\tconst field = this.#fieldAtPath(filter.field);\n\t\tif (field?.type.kind !== \"scalar\") return storedPath === filter.field ? filter : MongoFieldFilter.of(storedPath, filter.op, filter.value);\n\t\tconst encode = (value) => {\n\t\t\tif (value === null) return null;\n\t\t\tif (value instanceof MongoParamRef) return value.codecId === void 0 ? this.#wrapFieldValue(value.value, field, filter.field, \"filter\") : value;\n\t\t\tif (field.many && Array.isArray(value)) return value.map(encode);\n\t\t\treturn this.#wrapFieldValue(value, field, filter.field, \"filter\");\n\t\t};\n\t\tif (COMPARISON_OPERATORS.has(filter.op)) return MongoFieldFilter.of(storedPath, filter.op, encode(filter.value));\n\t\tif (MEMBERSHIP_OPERATORS.has(filter.op) && Array.isArray(filter.value)) {\n\t\t\tconst values = filter.value;\n\t\t\tconst encoded = values.map(encode);\n\t\t\treturn encoded.every((value, index) => value === values[index]) && storedPath === filter.field ? filter : MongoFieldFilter.of(storedPath, filter.op, encoded);\n\t\t}\n\t\treturn storedPath === filter.field ? filter : MongoFieldFilter.of(storedPath, filter.op, filter.value);\n\t}\n\t#fieldAtPath(path) {\n\t\tconst [head, ...rest] = path.split(\".\");\n\t\tlet field = head === void 0 ? void 0 : this.#modelFields()[head];\n\t\tfor (const segment of rest) {\n\t\t\tif (field?.many && LIST_INDEX.test(segment)) {\n\t\t\t\tfield = {\n\t\t\t\t\t...field,\n\t\t\t\t\tmany: false\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (field?.type.kind !== \"valueObject\") return void 0;\n\t\t\tfield = this.#valueObjectAt(field.type)?.fields[segment];\n\t\t}\n\t\treturn field;\n\t}\n\t/**\n\t* A value written to a field is checked against the field's enum and must not be `null` unless the field is nullable; a value compared in a filter is not, so a filter can find stored values the contract does not allow.\n\t*/\n\t#wrapFieldValue(value, field, path, purpose) {\n\t\tif (field === void 0) return ormParam(value, path);\n\t\tif (value === null) return this.#nullParam(field, path, purpose);\n\t\tif (field.type.kind === \"scalar\") {\n\t\t\tif (purpose === \"write\") this.#assertEnumValues(field, value, path);\n\t\t\treturn this.#scalarParam(value, field, path, purpose);\n\t\t}\n\t\tif (field.type.kind === \"valueObject\") {\n\t\t\tconst voDef = this.#valueObjectAt(field.type);\n\t\t\tif (!voDef) return ormParam(value, path);\n\t\t\tif (field.many && Array.isArray(value)) return value.map((item, index) => item === null ? null : this.#wrapValueObject(blindCast(item), voDef, `${path}.${index}`, purpose));\n\t\t\treturn this.#wrapValueObject(blindCast(value), voDef, path, purpose);\n\t\t}\n\t\treturn ormParam(value, path);\n\t}\n\t#nullParam(field, path, purpose) {\n\t\tif (purpose === \"write\" && !field.nullable) throw runtimeError(\"RUNTIME.ENCODE_FAILED\", `Failed to encode field ${path} in collection '${this.#collectionName}': the field is required and cannot be null`, {\n\t\t\tlabel: path,\n\t\t\tcollection: this.#collectionName\n\t\t});\n\t\treturn null;\n\t}\n\t/**\n\t* A contract without a collection validator (TypeScript builder, Prisma 6 schema) stores whatever reaches the driver, so a value outside the field's enum is refused here.\n\t*/\n\t#assertEnumValues(field, value, path) {\n\t\tconst valueSet = field.valueSet;\n\t\tif (valueSet === void 0 || valueSet.entityKind !== \"enum\" || value === null) return;\n\t\tconst contractEnum = this.#contract.domain.namespaces[valueSet.namespaceId]?.enum?.[valueSet.entityName];\n\t\tconst accessor = this.#enums[valueSet.namespaceId]?.[valueSet.entityName];\n\t\tif (contractEnum === void 0 || accessor === void 0) return;\n\t\tconst values = field.many && Array.isArray(value) ? value : [value];\n\t\tconst outside = values.findIndex((entry) => entry !== null && !accessor.has(entry));\n\t\tif (outside === -1) return;\n\t\tconst received = values[outside];\n\t\tconst described = accessor.values.map(describeValue);\n\t\tconst list = described.length > 1 ? `${described.slice(0, -1).join(\", \")} and ${described.at(-1)}` : described.join(\"\");\n\t\tthrow runtimeError(\"RUNTIME.ENCODE_FAILED\", `Failed to encode field ${path} in collection '${this.#collectionName}': ${describeValue(received)} is not a value of enum ${valueSet.entityName}; the values are ${list}`, {\n\t\t\tlabel: path,\n\t\t\tcollection: this.#collectionName,\n\t\t\treceived,\n\t\t\tallowed: contractEnum.members.map((member) => member.value)\n\t\t});\n\t}\n\t/**\n\t* A scalar field's value as parameters: a list field's array is encoded element by element through the element codec, so the codec never sees the whole list.\n\t*/\n\t#scalarParam(value, field, path, purpose) {\n\t\tif (field.type.kind !== \"scalar\") return ormParam(value, path);\n\t\tconst codecId = field.type.codecId;\n\t\tif (field.many && Array.isArray(value)) {\n\t\t\tconst acceptsNull = field.many.elementNullable || purpose === \"filter\";\n\t\t\treturn value.map((element, index) => element === null && acceptsNull ? null : this.#fieldParam(element, codecId, `${path}.${index}`));\n\t\t}\n\t\treturn this.#fieldParam(value, codecId, path);\n\t}\n\t#fieldParam(value, codecId, path) {\n\t\treturn ormParam(value, path, {\n\t\t\tcodecId,\n\t\t\tname: path,\n\t\t\tcollection: this.#collectionName\n\t\t});\n\t}\n\t#wrapValueObject(data, voDef, path, purpose) {\n\t\tconst doc = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst fieldDef = voDef.fields[key];\n\t\t\tdoc[key] = this.#wrapFieldValue(value, fieldDef, `${path}.${key}`, purpose);\n\t\t}\n\t\treturn doc;\n\t}\n\t#toDocument(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst storage = this.#storedNames();\n\t\tconst doc = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst embedStoredName = Object.hasOwn(storage.embedStoredNames, key) ? storage.embedStoredNames[key] : void 0;\n\t\t\tif (embedStoredName !== void 0) {\n\t\t\t\tconst embedded = storage.embedded(key);\n\t\t\t\tdoc[embedStoredName] = ormParam(embedded === void 0 ? value : mapEach(value, (row) => storedDocumentOfRow(row, embedded)), key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdoc[storedNameOfCallerField(storage, key)] = this.#wrapFieldValue(value, fields[key], key, \"write\");\n\t\t}\n\t\treturn doc;\n\t}\n\t#toSetFields(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst storage = this.#storedNames();\n\t\tconst result = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst storedName = storedPathOfCallerPath(storage, key);\n\t\t\tif (storedName === \"_id\") throw ormError(\"ORM.FIELD_IMMUTABLE\", `Mutation payloads cannot modify \\`${key}\\``, { meta: { field: key } });\n\t\t\tconst isEmbed = Object.hasOwn(storage.embedStoredNames, key);\n\t\t\tconst embedded = isEmbed ? storage.embedded(key) : void 0;\n\t\t\tresult[storedName] = !isEmbed ? this.#wrapFieldValue(value, fields[key], key, \"write\") : ormParam(embedded === void 0 ? value : mapEach(value, (row) => storedDocumentOfRow(row, embedded)), key);\n\t\t}\n\t\treturn result;\n\t}\n\t/** The defaults generated for a document whose stored names are the keys of `storedValues`, keyed by field name. A default of the collection for a stored name this model does not store belongs to another model stored in the collection, and is left out. */\n\t#appliedDefaults(op, storedValues, defaultValueCache) {\n\t\tconst applied = this.#mutationDefaults.applyMutationDefaults({\n\t\t\top,\n\t\t\tnamespace: UNBOUND_NAMESPACE_ID,\n\t\t\tentry: this.#collectionName,\n\t\t\tvalues: storedValues,\n\t\t\tdefaultValueCache\n\t\t}) ?? [];\n\t\tconst { fieldNames } = this.#storedNames();\n\t\treturn Object.fromEntries(applied.flatMap(({ field: storedName, value }) => {\n\t\t\tconst fieldName = Object.hasOwn(fieldNames, storedName) ? fieldNames[storedName] : void 0;\n\t\t\treturn fieldName === void 0 ? [] : [[fieldName, value]];\n\t\t}));\n\t}\n\t#withCreateDefaults(values, defaultValueCache) {\n\t\treturn {\n\t\t\t...values,\n\t\t\t...this.#appliedDefaults(\"create\", this.#storedKeys(values), defaultValueCache)\n\t\t};\n\t}\n\t#withUpdateDefaults(updateDoc, defaultValueCache) {\n\t\tconst explicit = Object.fromEntries([...topLevelUpdateFields(updateDoc)].map((field) => [field, true]));\n\t\tconst generated = this.#appliedDefaults(\"update\", explicit, defaultValueCache);\n\t\tif (Object.keys(generated).length === 0) return updateDoc;\n\t\treturn {\n\t\t\t...updateDoc,\n\t\t\t$set: {\n\t\t\t\t...updateDoc[\"$set\"],\n\t\t\t\t...this.#toSetFields(generated)\n\t\t\t}\n\t\t};\n\t}\n\t#stripUndefined(data) {\n\t\tconst result = {};\n\t\tfor (const [key, value] of Object.entries(data)) if (value !== void 0) result[key] = value;\n\t\treturn result;\n\t}\n\t#toUpdateDocument(data) {\n\t\treturn { $set: this.#toSetFields(data) };\n\t}\n\t#resolveUpdateDoc(dataOrCallback) {\n\t\tif (typeof dataOrCallback === \"function\") {\n\t\t\tconst ops = dataOrCallback(createFieldAccessor());\n\t\t\tthis.#rejectDocumentIdOps(ops);\n\t\t\tif (ops.length === 0) return { $set: {} };\n\t\t\treturn compileFieldOperations(ops, (field, value, operator) => this.#wrapFieldOpValue(field, value, operator), (field) => this.#storedPath(field));\n\t\t}\n\t\treturn this.#toUpdateDocument(blindCast(dataOrCallback));\n\t}\n\t/**\n\t* `$set` carries the field's whole value; `$push`, `$addToSet`, `$pull`, `$inc` and `$mul` carry one element or number; `$pop` and `$unset` carry no field value and are not encoded.\n\t*/\n\t#wrapFieldOpValue(path, value, operator) {\n\t\tif (operator === \"$unset\" || operator === \"$pop\" || !(value instanceof MongoParamRef)) return value;\n\t\tconst field = this.#fieldAtPath(path);\n\t\tif (field === void 0) return value;\n\t\tif (operator === \"$set\") return this.#wrapFieldValue(value.value, field, path, \"write\");\n\t\tif (value.value === null && field.many && (field.many.elementNullable || operator === \"$pull\")) return null;\n\t\tif (operator === \"$pull\") return this.#wrapFieldValue(value.value, field, path, \"filter\");\n\t\tif (field.type.kind === \"scalar\") {\n\t\t\tthis.#assertEnumValues(field, field.many ? [value.value] : value.value, path);\n\t\t\treturn this.#fieldParam(value.value, field.type.codecId, path);\n\t\t}\n\t\tif (field.type.kind === \"valueObject\" && isUnknownRecord(value.value)) {\n\t\t\tconst voDef = this.#valueObjectAt(field.type);\n\t\t\tif (voDef) return this.#wrapValueObject(value.value, voDef, path, \"write\");\n\t\t}\n\t\treturn value;\n\t}\n\t#mergeFilters() {\n\t\tconst [single] = this.#state.filters;\n\t\tif (this.#state.filters.length === 1 && single) return single;\n\t\treturn MongoAndExpr.of([...this.#state.filters]);\n\t}\n\t#requireFilters(methodName) {\n\t\tif (this.#state.filters.length === 0) throw ormError(\"ORM.WHERE_MISSING\", `${methodName}() requires a .where() filter. Call .where() before .${methodName}()`, { meta: { method: methodName } });\n\t}\n\t#rejectWindowing(methodName) {\n\t\tif (this.#state.orderBy !== void 0 || this.#state.limit !== void 0 || this.#state.offset !== void 0) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `${methodName}() does not support orderBy/offset/limit. Remove windowing before calling .${methodName}()`, { meta: {\n\t\t\tmethod: methodName,\n\t\t\treason: \"windowing\"\n\t\t} });\n\t}\n\t#rejectIncludes(methodName) {\n\t\tif (this.#state.includes.length > 0) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `${methodName}() does not support .include(). Remove includes before calling .${methodName}()`, { meta: {\n\t\t\tmethod: methodName,\n\t\t\treason: \"includes\"\n\t\t} });\n\t}\n\t#planMeta() {\n\t\treturn {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#contract.storage.storageHash,\n\t\t\tlane: \"mongo-orm\"\n\t\t};\n\t}\n\t#injectDiscriminator(data) {\n\t\tif (!this.#variantValue) return data;\n\t\tconst model = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[this.#modelName];\n\t\tif (!model?.discriminator) return data;\n\t\treturn {\n\t\t\t...data,\n\t\t\t[model.discriminator.field]: this.#variantValue\n\t\t};\n\t}\n\t#clone(overrides) {\n\t\tconst instance = new MongoCollectionImpl(this.#ctx, this.#modelName, this.#enums);\n\t\tinstance.#state = {\n\t\t\t...this.#state,\n\t\t\t...overrides\n\t\t};\n\t\tinstance.#collectionName = this.#collectionName;\n\t\tinstance.#variantValue = this.#variantValue;\n\t\treturn instance;\n\t}\n\t#cloneWithVariant(overrides, variantValue) {\n\t\tconst instance = new MongoCollectionImpl(this.#ctx, this.#modelName, this.#enums);\n\t\tinstance.#state = {\n\t\t\t...this.#state,\n\t\t\t...overrides\n\t\t};\n\t\tinstance.#collectionName = this.#collectionName;\n\t\tinstance.#variantValue = variantValue;\n\t\treturn instance;\n\t}\n};\n/** A collection of `modelName` over the context's contract, which fills generated fields from the context's mutation defaults and checks written enum values against the context's enum accessors. */\nfunction createMongoCollection(ctx, modelName) {\n\treturn new MongoCollectionImpl(ctx, modelName, buildEnumAccessors(ctx.context));\n}\n//#endregion\n//#region src/mongo-orm.ts\nfunction mongoOrm(options) {\n\tconst { context, runtime } = options;\n\tconst enums = buildEnumAccessors(context);\n\tconst client = {};\n\tfor (const [rootName, rootRef] of Object.entries(context.contract.roots)) client[rootName] = new MongoCollectionImpl({\n\t\tcontext,\n\t\truntime\n\t}, blindCast(rootRef.model), enums);\n\treturn blindCast(client);\n}\n//#endregion\n//#region src/raw-collection.ts\nfunction createRawMongoCollection(collectionName, meta) {\n\tfunction buildable(command) {\n\t\treturn { build: () => ({\n\t\t\tcollection: collectionName,\n\t\t\tcommand,\n\t\t\tmeta\n\t\t}) };\n\t}\n\treturn {\n\t\taggregate(pipeline) {\n\t\t\treturn buildable(new RawAggregateCommand(collectionName, pipeline));\n\t\t},\n\t\tinsertOne(document) {\n\t\t\treturn buildable(new RawInsertOneCommand(collectionName, document));\n\t\t},\n\t\tinsertMany(documents) {\n\t\t\treturn buildable(new RawInsertManyCommand(collectionName, documents));\n\t\t},\n\t\tupdateOne(filter, update) {\n\t\t\treturn buildable(new RawUpdateOneCommand(collectionName, filter, update));\n\t\t},\n\t\tupdateMany(filter, update) {\n\t\t\treturn buildable(new RawUpdateManyCommand(collectionName, filter, update));\n\t\t},\n\t\tdeleteOne(filter) {\n\t\t\treturn buildable(new RawDeleteOneCommand(collectionName, filter));\n\t\t},\n\t\tdeleteMany(filter) {\n\t\t\treturn buildable(new RawDeleteManyCommand(collectionName, filter));\n\t\t},\n\t\tfindOneAndUpdate(filter, update, options) {\n\t\t\treturn buildable(new RawFindOneAndUpdateCommand(collectionName, filter, update, options?.upsert ?? false));\n\t\t},\n\t\tfindOneAndDelete(filter) {\n\t\t\treturn buildable(new RawFindOneAndDeleteCommand(collectionName, filter));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/mongo-raw.ts\nfunction mongoRaw(options) {\n\tconst { contract } = options.context;\n\treturn { collection(rootName) {\n\t\tconst modelName = contract.roots[rootName]?.model;\n\t\tconst models = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId);\n\t\tif (!modelName || !Object.hasOwn(models, modelName)) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown model \"${modelName ?? \"\"}\" for root \"${rootName}\"`, { meta: {\n\t\t\tmodel: modelName ?? \"\",\n\t\t\troot: rootName\n\t\t} });\n\t\treturn createRawMongoCollection(models[modelName]?.storage.collection ?? modelName, {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\tlane: \"mongo-raw\"\n\t\t});\n\t} };\n}\n//#endregion\nexport { compileMongoQuery, createFieldAccessor, createMongoCollection, mongoOrm, mongoRaw };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAS,uBAAuB;CAC/B,OAAO;EACN,SAAS,CAAC;EACV,UAAU,CAAC;EACX,SAA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c,SAAS,QAAQ,6BAA6B;EAC3E,IAAI,CAAC,aAAa,CAAC,OAAO,OAAO,QAAQ,SAAS,GAAG,MAAM,SAAS,qBAAqB,kBAAkB,aAAa,GAAG,cAAc,SAAS,IAAI,EAAE,MAAM;GAC7J,OAAO,aAAa;GACpB,MAAM;EACP,EAAE,CAAC;EACH,OAAO,yBAAyB,OAAO,UAAU,EAAE,QAAQ,cAAc,WAAW;GACnF,QAAQ;GACR,aAAa,SAAS,QAAQ;GAC9B,MAAM;EACP,CAAC;CACF,EAAE;AACH"}
|
|
1
|
+
{"version":3,"file":"orm.mjs","names":["#ctx","#enums","#contract","#modelName","#executor","#mutationDefaults","#collectionName","#state","#variantValue","#cloneWithVariant","#encodeFieldFilter","#storedPath","#clone","#compileWhereObject","#storedNames","#query","#run","#describeFirst","#describeRows","#describeFirstOrThrow","#rejectIncludes","#withCreateDefaults","#injectDiscriminator","#stripUndefined","#toDocument","#drainPlan","#insertOneResultShape","#rowOf","#insertManyResultShape","#requireFilters","#rejectFilterPlaceholders","#rejectWindowing","#mergeFilters","#withUpdateDefaults","#resolveUpdateDoc","#modelResultShape","#readMatchingIds","#executePlan","#rejectDocumentIdOps","#wrapFieldOpValue","#toSetFields","#storedKeys","#upsertCommand","#compile","#rowMapper","#variantModelName","#modelWithVariantFields","#planMeta","#wrapCommand","#idFieldShape","#documentShape","#modelFields","#placeholderField","#wrapFieldValue","#fieldAtPath","#rejectNonScalarPlaceholder","#valueObjectAt","#nullParam","#assertEnumValues","#scalarParam","#wrapValueObject","#fieldParam","#appliedDefaults","#toUpdateDocument"],"sources":["../../../../2-mongo-family/5-query-builders/orm/dist/index.mjs"],"sourcesContent":["import { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\nimport { valueObjectAt } from \"@internal/contract/types\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { AsyncIterableResult, runtimeError } from \"@internal/framework-components/runtime\";\nimport { defaultMongoDomainNamespaceId, mongoModelsOf, ownDocumentIdFieldOf, ownEmbedStoredNamesOf, ownStoredNamesOf, storedNamesOf } from \"@internal/mongo-contract\";\nimport { AggregateCommand, DeleteManyCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, InsertOneCommand, MongoAddFieldsStage, MongoAggArrayFilter, MongoAggCond, MongoAggFieldRef, MongoAggLiteral, MongoAggMap, MongoAggOperator, MongoAndExpr, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoProjectStage, MongoSkipStage, MongoSortStage, MongoUnwindStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, enumMemberCodecFor, freezeMongoResultShape, isMongoFilterExpr } from \"@internal/mongo-query-ast/execution\";\nimport { contractFieldToMongoFieldShape, contractModelToMongoResultShape } from \"@internal/mongo-query-builder\";\nimport { MongoParamRef, isMongoPreparedParamRef } from \"@internal/mongo-value\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { isPlainRecord } from \"@internal/contract/is-plain-record\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/collection-state.ts\nfunction emptyCollectionState() {\n\treturn {\n\t\tfilters: [],\n\t\tincludes: [],\n\t\torderBy: void 0,\n\t\tselectedFields: void 0,\n\t\tlimit: void 0,\n\t\toffset: void 0\n\t};\n}\n//#endregion\n//#region src/compile.ts\nfunction isToOne(include) {\n\treturn include.cardinality === \"N:1\" || include.cardinality === \"1:1\";\n}\n/**\n* An included document is decoded through the related model's codecs, like the root document. A to-one include with no related document reads as `null`.\n*/\nfunction includeShape(include, storage) {\n\tconst target = contractModelToMongoResultShape(include.targetModel, { storage });\n\tconst fields = target.kind === \"document\" ? target.fields : {};\n\treturn isToOne(include) ? {\n\t\tkind: \"document\",\n\t\tnullable: true,\n\t\tfields\n\t} : {\n\t\tkind: \"array\",\n\t\tnullable: false,\n\t\telement: {\n\t\t\tkind: \"document\",\n\t\t\tnullable: false,\n\t\t\tfields\n\t\t}\n\t};\n}\nfunction compileIncludes(includes) {\n\tconst stages = [];\n\tfor (const inc of includes) {\n\t\tstages.push(new MongoLookupStage({\n\t\t\tfrom: inc.from,\n\t\t\tlocalField: inc.localField,\n\t\t\tforeignField: inc.foreignField,\n\t\t\tas: inc.relationName\n\t\t}));\n\t\tif (isToOne(inc)) stages.push(new MongoUnwindStage(`$${inc.relationName}`, true));\n\t}\n\treturn stages;\n}\nfunction compileMongoQuery(collection, state, storageHash, model, storage) {\n\tconst stages = [];\n\tconst singleFilter = state.filters.length === 1 ? state.filters[0] : void 0;\n\tif (singleFilter) stages.push(new MongoMatchStage(singleFilter));\n\telse if (state.filters.length > 1) stages.push(new MongoMatchStage(MongoAndExpr.of([...state.filters])));\n\tif (state.includes.length > 0) stages.push(...compileIncludes(state.includes));\n\tif (state.orderBy) stages.push(new MongoSortStage(state.orderBy));\n\tif (state.offset !== void 0) stages.push(new MongoSkipStage(state.offset));\n\tif (state.limit !== void 0) stages.push(new MongoLimitStage(state.limit));\n\tif (state.selectedFields && state.selectedFields.length > 0) {\n\t\tconst projection = {};\n\t\tfor (const field of state.selectedFields) projection[field] = 1;\n\t\tfor (const inc of state.includes) projection[inc.relationName] = 1;\n\t\tif (!Object.hasOwn(projection, \"_id\")) projection[\"_id\"] = 0;\n\t\tstages.push(new MongoProjectStage(projection));\n\t}\n\tconst meta = {\n\t\ttarget: \"mongo\",\n\t\tstorageHash,\n\t\tlane: \"mongo-orm\"\n\t};\n\treturn {\n\t\tcollection,\n\t\tcommand: new AggregateCommand(collection, stages),\n\t\tmeta,\n\t\tresultShape: contractModelToMongoResultShape(model, {\n\t\t\t...ifDefined(\"selection\", state.selectedFields !== void 0 && state.selectedFields.length > 0 ? state.selectedFields : void 0),\n\t\t\tincludes: Object.fromEntries(state.includes.map((inc) => [inc.relationName, includeShape(inc, storage)])),\n\t\t\tstorage\n\t\t})\n\t};\n}\n//#endregion\n//#region src/orm-errors.ts\nfunction ormError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/prepared-placeholders.ts\nconst ALLOWED_POSITIONS = \"A prepared parameter stands for one value in a read: a value compared with a scalar field in a where (an equality, a comparison, or an item of $in or $nin), a limit or an offset.\";\nfunction findPlaceholder(value) {\n\tif (isMongoPreparedParamRef(value)) return value;\n\tif (value instanceof MongoParamRef) return findPlaceholder(value.value);\n\tconst children = Array.isArray(value) ? value : isPlainRecord(value) ? Object.values(value) : [];\n\tfor (const child of children) {\n\t\tconst found = findPlaceholder(child);\n\t\tif (found !== void 0) return found;\n\t}\n}\n/** Refuses a prepared placeholder anywhere in a value for a field with `ORM.ARGUMENT_INVALID`. */\nfunction rejectPlaceholder(value, path) {\n\tconst placeholder = findPlaceholder(value);\n\tif (placeholder === void 0) return;\n\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `The prepared parameter '${placeholder.name}' cannot be used for '${path}'. ${ALLOWED_POSITIONS}`, { meta: {\n\t\tname: placeholder.name,\n\t\tfield: path\n\t} });\n}\n/** Refuses a prepared placeholder in a value the ORM wraps as a parameter, which is a write payload or a value-object literal, with `ORM.ARGUMENT_INVALID`. */\nfunction rejectPlaceholderValue(value, path) {\n\tconst placeholder = findPlaceholder(value);\n\tif (placeholder === void 0) return;\n\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `The prepared parameter '${placeholder.name}' cannot be used for '${path}'. ORM writes run at once, and a value-object literal is built with the query, so neither can take a prepared parameter. In a read, compare the scalar field with it directly in a filter expression, such as where(MongoFieldFilter.eq('${path}', ...)).`, { meta: {\n\t\tname: placeholder.name,\n\t\tfield: path\n\t} });\n}\n/** Refuses a list that holds a prepared placeholder as an item with `ORM.ARGUMENT_INVALID`: a declaration has no list form. */\nfunction rejectPlaceholderList(value, path) {\n\tconst placeholder = value.find(isMongoPreparedParamRef);\n\tif (placeholder === void 0) return;\n\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `The list given for '${path}' holds the prepared parameter '${placeholder.name}'. A declaration has no list form, so a prepared parameter cannot be part of a list; on a list field, one prepared parameter matches one item.`, { meta: {\n\t\tname: placeholder.name,\n\t\tfield: path\n\t} });\n}\n/** Refuses a prepared placeholder at a path the contract has no field for with `ORM.ARGUMENT_INVALID`: no codec can be checked there. */\nfunction rejectUnknownPathPlaceholder(value, path) {\n\tconst placeholder = findPlaceholder(value);\n\tif (placeholder === void 0) return;\n\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `The contract has no field at '${path}', so the prepared parameter '${placeholder.name}' cannot be checked against a codec there.`, { meta: {\n\t\tname: placeholder.name,\n\t\tfield: path\n\t} });\n}\n/** Refuses a prepared placeholder given as a whole value object, or as an item of a value-object list, with `ORM.ARGUMENT_INVALID`. An array given for a single value object is reported at the field's path. */\nfunction rejectValueObjectPlaceholder(value, path, list) {\n\tconst items = !Array.isArray(value) ? [[value, path]] : list ? value.map((item, index) => [item, `${path}.${index}`]) : value.map((item) => [item, path]);\n\tfor (const [item, itemPath] of items) {\n\t\tif (!isMongoPreparedParamRef(item)) continue;\n\t\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `A prepared parameter stands for one scalar value, so the prepared parameter '${item.name}' cannot stand for the value object at '${itemPath}'.`, { meta: {\n\t\t\tname: item.name,\n\t\t\tfield: itemPath\n\t\t} });\n\t}\n}\n/** Refuses a write on a collection whose `where` holds a prepared placeholder with `ORM.ARGUMENT_INVALID`. */\nfunction rejectPreparedWrite(method, placeholder) {\n\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `${method}() cannot run because the collection's where holds the prepared parameter '${placeholder.name}'. ORM writes run at once and cannot be prepared; use a prepared parameter only with .prepared.all(), .prepared.first() or .prepared.firstOrThrow().`, { meta: {\n\t\tname: placeholder.name,\n\t\tmethod\n\t} });\n}\n/** Refuses a prepared placeholder in an `$expr` literal with `ORM.ARGUMENT_INVALID`. */\nfunction rejectExprPlaceholder(value) {\n\tconst placeholder = findPlaceholder(value);\n\tif (placeholder === void 0) return;\n\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `The prepared parameter '${placeholder.name}' cannot be used inside $expr. ${ALLOWED_POSITIONS}`, { meta: {\n\t\tname: placeholder.name,\n\t\toperator: \"$expr\"\n\t} });\n}\n/**\n* Keeps a placeholder compared with a scalar field in a `where`, after checking it fits: its codec must be the field's codec, and it may be nullable only when the field may be null and is not a list.\n*/\nfunction wherePlaceholder(placeholder, field, path) {\n\tconst { name, codecId, nullable } = placeholder;\n\tif (codecId !== field.codecId) throw ormError(\"ORM.ARGUMENT_INVALID\", `The prepared parameter '${name}' has codec '${codecId}', but the field '${path}' has codec '${field.codecId}'.`, { meta: {\n\t\tname,\n\t\tfield: path,\n\t\tcodecId,\n\t\tfieldCodecId: field.codecId\n\t} });\n\tconst { list } = field;\n\tif (nullable && (list || !field.nullable)) throw ormError(\"ORM.ARGUMENT_INVALID\", list ? `The prepared parameter '${name}' is nullable, but the field '${path}' is a list, where a parameter stands for one item, which is never null.` : `The prepared parameter '${name}' is nullable, but the field '${path}' is not.`, { meta: {\n\t\tname,\n\t\tfield: path,\n\t\tnullable: true,\n\t\tlist\n\t} });\n\treturn placeholder;\n}\n//#endregion\n//#region src/orm-param.ts\n/** Wraps a value the ORM sends as a parameter. Every ORM value goes through it, so a prepared placeholder in it is refused. */\nfunction ormParam(value, path, options) {\n\trejectPlaceholderValue(value, path);\n\treturn new MongoParamRef(value, options);\n}\n//#endregion\n//#region src/field-accessor.ts\nfunction createFieldExpression(fieldPath) {\n\treturn {\n\t\tset(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$set\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tunset() {\n\t\t\treturn {\n\t\t\t\toperator: \"$unset\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(\"\", fieldPath)\n\t\t\t};\n\t\t},\n\t\tinc(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$inc\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tmul(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$mul\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tpush(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$push\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tpull(match) {\n\t\t\treturn {\n\t\t\t\toperator: \"$pull\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(match, fieldPath)\n\t\t\t};\n\t\t},\n\t\taddToSet(value) {\n\t\t\treturn {\n\t\t\t\toperator: \"$addToSet\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(value, fieldPath)\n\t\t\t};\n\t\t},\n\t\tpop(end) {\n\t\t\treturn {\n\t\t\t\toperator: \"$pop\",\n\t\t\t\tfield: fieldPath,\n\t\t\t\tvalue: ormParam(end, fieldPath)\n\t\t\t};\n\t\t}\n\t};\n}\nfunction createFieldAccessor() {\n\treturn new Proxy((() => {}), {\n\t\tget(_target, prop) {\n\t\t\treturn createFieldExpression(prop);\n\t\t},\n\t\tapply(_target, _thisArg, args) {\n\t\t\treturn createFieldExpression(args[0]);\n\t\t}\n\t});\n}\nfunction compileFieldOperations(ops, wrapValue, storedPathOf = (field) => field) {\n\tconst grouped = {};\n\tfor (const op of ops) {\n\t\tlet group = grouped[op.operator];\n\t\tif (!group) {\n\t\t\tgroup = {};\n\t\t\tgrouped[op.operator] = group;\n\t\t}\n\t\tgroup[storedPathOf(op.field)] = wrapValue(op.field, op.value, op.operator);\n\t}\n\treturn grouped;\n}\n//#endregion\n//#region src/model-stored-names.ts\nfunction invert(map) {\n\treturn Object.fromEntries(Object.entries(map).map(([key, value]) => [value, key]));\n}\nconst cachedStoredNames = /* @__PURE__ */ new WeakMap();\n/**\n* The stored names of model `modelName`'s fields, its own and those it inherits, and, when `variantModelName` is given, the fields of that variant. Embedded models are looked up when asked for, so a model that embeds itself reuses the same map at every level.\n*/\nfunction modelStoredNamesOf(contract, modelName, variantModelName) {\n\tconst cache = cachedStoredNames.get(contract) ?? /* @__PURE__ */ new Map();\n\tcachedStoredNames.set(contract, cache);\n\tconst key = JSON.stringify([modelName, variantModelName ?? null]);\n\tconst cached = cache.get(key);\n\tif (cached !== void 0) return cached;\n\tconst models = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId);\n\tconst model = models[modelName];\n\tconst variant = variantModelName === void 0 ? void 0 : models[variantModelName];\n\tconst storedNames = {\n\t\t...storedNamesOf(models, modelName),\n\t\t...variant === void 0 ? {} : ownStoredNamesOf(variant)\n\t};\n\tconst embedStoredNames = model === void 0 ? {} : ownEmbedStoredNamesOf(model);\n\tconst storedNamesOfModel = {\n\t\tmodelName,\n\t\tstoredNames,\n\t\tfieldNames: invert(storedNames),\n\t\tembedStoredNames,\n\t\tembedded(relationName) {\n\t\t\tif (!Object.hasOwn(embedStoredNames, relationName)) return void 0;\n\t\t\tconst target = model?.relations[relationName]?.to.model;\n\t\t\treturn target === void 0 ? void 0 : modelStoredNamesOf(contract, target);\n\t\t}\n\t};\n\tcache.set(key, storedNamesOfModel);\n\treturn storedNamesOfModel;\n}\n/** The refusal of a name a caller passed that is not a field of the model. */\nfunction callerFieldUnknown(names, fieldName) {\n\tconst unknown = `Model \"${names.modelName}\" has no field \"${fieldName}\"`;\n\tconst fieldForStoredName = Object.hasOwn(names.fieldNames, fieldName) ? names.fieldNames[fieldName] : void 0;\n\tif (fieldForStoredName !== void 0) return ormError(\"ORM.FIELD_UNKNOWN\", `${unknown}. \"${fieldName}\" is the stored name of field \"${fieldForStoredName}\"; pass the field name.`, { meta: {\n\t\tmodel: names.modelName,\n\t\tfield: fieldName,\n\t\tfieldForStoredName\n\t} });\n\treturn ormError(\"ORM.FIELD_UNKNOWN\", unknown, { meta: {\n\t\tmodel: names.modelName,\n\t\tfield: fieldName\n\t} });\n}\n/** The stored name of a field a caller named. A name that is not a field is refused with `ORM.FIELD_UNKNOWN`. */\nfunction storedNameOfCallerField(names, fieldName) {\n\tconst storedName = Object.hasOwn(names.storedNames, fieldName) ? names.storedNames[fieldName] : void 0;\n\tif (storedName === void 0) throw callerFieldUnknown(names, fieldName);\n\treturn storedName;\n}\n/**\n* The stored path of a dot path a caller named: its first segment is a field, or an embed relation, of the model; a value object stores the rest under their own names.\n*/\nfunction storedPathOfCallerPath(names, path) {\n\tconst [head = path, ...rest] = path.split(\".\");\n\tconst embed = Object.hasOwn(names.embedStoredNames, head) ? names.embedStoredNames[head] : void 0;\n\tif (embed === void 0) return [storedNameOfCallerField(names, head), ...rest].join(\".\");\n\tconst embeddedStorage = names.embedded(head);\n\tconst [next, ...afterNext] = rest;\n\tif (embeddedStorage === void 0 || next === void 0) return [embed, ...rest].join(\".\");\n\tif (/^\\d+$/.test(next)) return afterNext.length === 0 ? [embed, next].join(\".\") : [\n\t\tembed,\n\t\tnext,\n\t\tstoredPathOfCallerPath(embeddedStorage, afterNext.join(\".\"))\n\t].join(\".\");\n\treturn [embed, storedPathOfCallerPath(embeddedStorage, rest.join(\".\"))].join(\".\");\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction mapEach(value, map) {\n\tif (Array.isArray(value)) return value.map((element) => isRecord(element) ? map(element) : element);\n\treturn isRecord(value) ? map(value) : value;\n}\n/** A document of a model as a row of its fields: each stored name under the name of the field that stores it, embedded models likewise, and stored names no field stores left out. */\nfunction rowOfStoredDocument(document, names, extra = {}) {\n\tconst row = {};\n\tconst relationOfEmbed = invert(names.embedStoredNames);\n\tfor (const [storedName, value] of Object.entries(document)) {\n\t\tconst extraKey = Object.hasOwn(extra, storedName) ? extra[storedName] : void 0;\n\t\tif (extraKey !== void 0) {\n\t\t\trow[storedName] = extraKey(value);\n\t\t\tcontinue;\n\t\t}\n\t\tconst fieldName = Object.hasOwn(names.fieldNames, storedName) ? names.fieldNames[storedName] : void 0;\n\t\tif (fieldName !== void 0) {\n\t\t\trow[fieldName] = value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst relationName = Object.hasOwn(relationOfEmbed, storedName) ? relationOfEmbed[storedName] : void 0;\n\t\tif (relationName === void 0) continue;\n\t\tconst embeddedStorage = names.embedded(relationName);\n\t\trow[relationName] = embeddedStorage === void 0 ? value : mapEach(value, (embedded) => rowOfStoredDocument(embedded, embeddedStorage));\n\t}\n\treturn row;\n}\n/** A row of a model's fields as the document that stores it, embedded models likewise. */\nfunction storedDocumentOfRow(row, names) {\n\tconst document = {};\n\tfor (const [name, value] of Object.entries(row)) {\n\t\tconst embed = Object.hasOwn(names.embedStoredNames, name) ? names.embedStoredNames[name] : void 0;\n\t\tif (embed === void 0) {\n\t\t\tdocument[storedNameOfCallerField(names, name)] = value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst embeddedStorage = names.embedded(name);\n\t\tdocument[embed] = embeddedStorage === void 0 ? value : mapEach(value, (embedded) => storedDocumentOfRow(embedded, embeddedStorage));\n\t}\n\treturn document;\n}\n/**\n* Maps each document of model `modelName` to its row. A document of a model with variants is read with the fields of the variant its discriminator value names, unless `variantModelName` already names one; each included relation is read as rows of the model it reads.\n*/\nfunction documentRowMapper(contract, modelName, variantModelName, includes = {}) {\n\tconst model = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId)[modelName];\n\tconst base = modelStoredNamesOf(contract, modelName, variantModelName);\n\tconst discriminator = variantModelName === void 0 && model?.discriminator !== void 0 ? base.storedNames[model.discriminator.field] : void 0;\n\tconst namesOfVariant = (value) => {\n\t\tconst variantModel = typeof value === \"string\" ? model?.variants?.[value]?.model : void 0;\n\t\treturn variantModel === void 0 ? base : modelStoredNamesOf(contract, modelName, variantModel);\n\t};\n\tconst extra = Object.fromEntries(Object.entries(includes).map(([relationName, target]) => {\n\t\tconst targetRow = documentRowMapper(contract, target, void 0);\n\t\treturn [relationName, (value) => mapEach(value, targetRow)];\n\t}));\n\treturn (document) => {\n\t\tif (!isRecord(document)) return document;\n\t\treturn rowOfStoredDocument(document, discriminator === void 0 ? base : namesOfVariant(document[discriminator]), extra);\n\t};\n}\n//#endregion\n//#region src/upsert-pipeline.ts\nfunction fieldNamesIn(filter) {\n\tswitch (filter.kind) {\n\t\tcase \"field\":\n\t\tcase \"exists\": return [filter.field.split(\".\")[0] ?? filter.field];\n\t\tcase \"and\":\n\t\tcase \"or\": return filter.exprs.flatMap(fieldNamesIn);\n\t\tcase \"not\": return fieldNamesIn(filter.expr);\n\t\tcase \"expr\": return [];\n\t}\n}\n/**\n* True while the pipeline runs on the document an upsert is inserting. That document starts with only the equality fields the server copies from the filter, so every one of its keys is a field the filter names; a matched document always has an `_id` the filter does not name, or, when the filter names `_id`, fields besides the filter's.\n*/\nfunction isInsert(filter) {\n\tconst keys = new MongoAggMap(MongoAggOperator.of(\"$objectToArray\", MongoAggFieldRef.of(\"$ROOT\")), MongoAggFieldRef.of(\"$this.k\"), \"this\");\n\treturn MongoAggOperator.of(\"$setIsSubset\", [keys, MongoAggLiteral.of([...new Set(fieldNamesIn(filter))])]);\n}\nfunction orEmptyList(field) {\n\treturn MongoAggOperator.of(\"$ifNull\", [MongoAggFieldRef.of(field), MongoAggLiteral.of([])]);\n}\nfunction whenList(field, expr) {\n\treturn MongoAggCond.of(MongoAggOperator.of(\"$isArray\", MongoAggFieldRef.of(field)), expr, MongoAggFieldRef.of(field));\n}\nfunction popped(field, end) {\n\tconst size = MongoAggOperator.size(MongoAggFieldRef.of(field));\n\tconst rest = MongoAggOperator.subtract(size, MongoAggLiteral.of(1));\n\tconst kept = MongoAggOperator.of(\"$slice\", [\n\t\tMongoAggFieldRef.of(field),\n\t\tMongoAggLiteral.of(end === -1 ? 1 : 0),\n\t\trest\n\t]);\n\treturn whenList(field, MongoAggCond.of(MongoAggOperator.of(\"$lte\", [size, MongoAggLiteral.of(1)]), MongoAggLiteral.of([]), kept));\n}\nfunction operatorExpression(operator, field, value) {\n\tswitch (operator) {\n\t\tcase \"$set\": return MongoAggLiteral.of(value);\n\t\tcase \"$unset\": return MongoAggFieldRef.of(\"$REMOVE\");\n\t\tcase \"$inc\": return MongoAggOperator.add(MongoAggOperator.of(\"$ifNull\", [MongoAggFieldRef.of(field), MongoAggLiteral.of(0)]), MongoAggLiteral.of(value));\n\t\tcase \"$mul\": return MongoAggOperator.multiply(MongoAggOperator.of(\"$ifNull\", [MongoAggFieldRef.of(field), MongoAggLiteral.of(0)]), MongoAggLiteral.of(value));\n\t\tcase \"$push\": return MongoAggOperator.of(\"$concatArrays\", [orEmptyList(field), MongoAggLiteral.of([value])]);\n\t\tcase \"$addToSet\": return MongoAggCond.of(MongoAggOperator.of(\"$in\", [MongoAggLiteral.of(value), orEmptyList(field)]), orEmptyList(field), MongoAggOperator.of(\"$concatArrays\", [orEmptyList(field), MongoAggLiteral.of([value])]));\n\t\tcase \"$pull\":\n\t\t\tif (typeof value === \"object\" && value !== null && !(value instanceof MongoParamRef)) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `upsert() cannot pull by a match document from \"${field}\" when create sets a field that has an update default. Pull a single value, or leave that field out of create.`, { meta: {\n\t\t\t\tmethod: \"upsert\",\n\t\t\t\tfield\n\t\t\t} });\n\t\t\treturn whenList(field, MongoAggArrayFilter.of(MongoAggFieldRef.of(field), MongoAggOperator.of(\"$ne\", [MongoAggFieldRef.of(\"$this\"), MongoAggLiteral.of(value)]), \"this\"));\n\t\tcase \"$pop\": return popped(field, value instanceof MongoParamRef ? value.value : value);\n\t\tdefault: throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `upsert() cannot apply ${operator} to \"${field}\" when create sets a field that has an update default.`, { meta: {\n\t\t\tmethod: \"upsert\",\n\t\t\tfield,\n\t\t\toperator\n\t\t} });\n\t}\n}\n/**\n* The one-command form of an upsert whose `create` sets a field that also has an update default: an update pipeline that, on insert, writes every `create` value, including those fields, and on update applies the update and its defaults. Every value is a `$literal`, so a string such as `'$x'` is not read as a field path.\n*/\nfunction upsertPipeline(input) {\n\tconst inserting = isInsert(input.filter);\n\tconst fields = {};\n\tfor (const [operator, group] of Object.entries(input.update)) for (const [field, value] of Object.entries(group)) {\n\t\tconst onUpdate = operatorExpression(operator, field, value);\n\t\tconst created = input.create[field];\n\t\tfields[field] = operator === \"$set\" && input.createWins.has(field) && created !== void 0 ? MongoAggCond.of(inserting, MongoAggLiteral.of(created), onUpdate) : onUpdate;\n\t}\n\tfor (const [field, value] of Object.entries(input.create)) if (!Object.hasOwn(fields, field)) fields[field] = MongoAggCond.of(inserting, MongoAggLiteral.of(value), MongoAggFieldRef.of(field));\n\treturn [new MongoAddFieldsStage(fields)];\n}\n//#endregion\n//#region src/where-equality.ts\n/**\n* On a list, `{ field: null }` also matches an array holding a null item, and an upsert copies `{ field: element }` into the inserted document as a value that is not a list. So `null` on a list matches any value that is not an array, and one element matches a list item equal to it.\n*/\nfunction whereEquality(path, field, value) {\n\tif (field?.many) {\n\t\tif (value === null) return notAnArray(path);\n\t\tif (!Array.isArray(value)) return holdsItem(path, value);\n\t}\n\treturn MongoFieldFilter.eq(path, value);\n}\nfunction notAnArray(path) {\n\treturn MongoFieldFilter.of(path, \"$not\", { $type: \"array\" });\n}\nfunction holdsItem(path, item) {\n\treturn MongoFieldFilter.of(path, \"$elemMatch\", { $eq: item });\n}\n//#endregion\n//#region src/collection.ts\nconst COMPARISON_OPERATORS = /* @__PURE__ */ new Set([\n\t\"$eq\",\n\t\"$ne\",\n\t\"$gt\",\n\t\"$gte\",\n\t\"$lt\",\n\t\"$lte\"\n]);\nconst MEMBERSHIP_OPERATORS = /* @__PURE__ */ new Set([\"$in\", \"$nin\"]);\nfunction modelOf(contract, modelName) {\n\tconst model = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId)[modelName];\n\tif (model === void 0) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown model: \"${modelName}\".`, { meta: { model: modelName } });\n\treturn model;\n}\nfunction resolveCollectionName(model, modelName) {\n\treturn model.storage.collection ?? modelName;\n}\nfunction topLevelUpdateFields(updateDoc) {\n\tconst fields = /* @__PURE__ */ new Set();\n\tfor (const operatorGroup of Object.values(updateDoc)) for (const fieldPath of Object.keys(operatorGroup)) fields.add(fieldPath.split(\".\")[0] ?? fieldPath);\n\treturn fields;\n}\n/** The context contract's enum accessors, each reading its members through its codec in the context. */\nfunction buildEnumAccessors(context) {\n\treturn buildNamespacedEnums(context.contract.domain, enumMemberCodecFor(context.codecs));\n}\nfunction describeValue(value) {\n\tif (typeof value === \"bigint\") return `${value}n`;\n\ttry {\n\t\treturn JSON.stringify(value) ?? String(value);\n\t} catch {\n\t\treturn String(value);\n\t}\n}\nfunction isUnknownRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nconst LIST_INDEX = /^\\d+$/;\nfunction rejectLiteralPlaceholder(literal) {\n\trejectExprPlaceholder(literal.value);\n\treturn literal;\n}\nfunction placeholderInFilter(filter) {\n\tlet found;\n\tfilter.rewrite({\n\t\tfield: (fieldFilter) => {\n\t\t\tfound ??= findPlaceholder(fieldFilter.value);\n\t\t\treturn fieldFilter;\n\t\t},\n\t\texpr: (exprFilter) => {\n\t\t\texprFilter.aggExpr.rewrite({ literal: (literal) => {\n\t\t\t\tfound ??= findPlaceholder(literal.value);\n\t\t\t\treturn literal;\n\t\t\t} });\n\t\t\treturn exprFilter;\n\t\t}\n\t});\n\treturn found;\n}\nvar MongoCollectionImpl = class MongoCollectionImpl {\n\t#contract;\n\t#modelName;\n\t#ctx;\n\t#enums;\n\t#executor;\n\t#mutationDefaults;\n\t#collectionName;\n\t#state;\n\t#variantValue;\n\tconstructor(ctx, modelName, enums) {\n\t\tthis.#ctx = ctx;\n\t\tthis.#enums = enums;\n\t\tthis.#contract = ctx.context.contract;\n\t\tthis.#modelName = modelName;\n\t\tthis.#executor = ctx.runtime;\n\t\tthis.#mutationDefaults = ctx.context;\n\t\tthis.#collectionName = resolveCollectionName(modelOf(this.#contract, modelName), modelName);\n\t\tthis.#state = emptyCollectionState();\n\t}\n\tvariant(value) {\n\t\tconst model = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[this.#modelName];\n\t\tconst discriminator = model?.discriminator;\n\t\tconst selectedValue = this.#variantValue;\n\t\tif (selectedValue !== void 0) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `variant(\"${value}\") cannot be called on model \"${this.#modelName}\" because variant(\"${selectedValue}\") is already selected; call variant() on the base collection instead`, { meta: {\n\t\t\tmethod: \"variant\",\n\t\t\tmodel: this.#modelName,\n\t\t\tvariant: model?.variants?.[selectedValue]?.model,\n\t\t\tselectedValue,\n\t\t\treason: \"variant-already-selected\"\n\t\t} });\n\t\tif (!discriminator || model?.variants?.[value] === void 0) {\n\t\t\tconst declaredValues = discriminator ? Object.keys(model?.variants ?? {}) : [];\n\t\t\tthrow ormError(\"ORM.ARGUMENT_INVALID\", declaredValues.length === 0 ? `variant(\"${value}\") cannot narrow model \"${this.#modelName}\": it declares no discriminator values` : `variant(\"${value}\") cannot narrow model \"${this.#modelName}\": the declared discriminator values are ${declaredValues.map((declared) => `\"${declared}\"`).join(\", \")}`, { meta: {\n\t\t\t\tmethod: \"variant\",\n\t\t\t\targument: \"value\",\n\t\t\t\tmodel: this.#modelName,\n\t\t\t\tvalue,\n\t\t\t\tdeclaredValues\n\t\t\t} });\n\t\t}\n\t\tconst filter = MongoFieldFilter.eq(storedNameOfCallerField(modelStoredNamesOf(this.#contract, this.#modelName), discriminator.field), ormParam(value, discriminator.field));\n\t\treturn this.#cloneWithVariant({ filters: [...this.#state.filters, filter] }, value);\n\t}\n\twhere(filter) {\n\t\tif (isMongoFilterExpr(filter)) {\n\t\t\tconst encoded = filter.rewrite({\n\t\t\t\tfield: (fieldFilter) => this.#encodeFieldFilter(fieldFilter),\n\t\t\t\texists: (existsFilter) => new MongoExistsExpr(this.#storedPath(existsFilter.field), existsFilter.exists),\n\t\t\t\texpr: (exprFilter) => MongoExprFilter.of(exprFilter.aggExpr.rewrite({\n\t\t\t\t\tfieldRef: (ref) => ref.path.startsWith(\"$\") ? ref : MongoAggFieldRef.of(this.#storedPath(ref.path)),\n\t\t\t\t\tliteral: rejectLiteralPlaceholder\n\t\t\t\t}))\n\t\t\t});\n\t\t\treturn this.#clone({ filters: [...this.#state.filters, encoded] });\n\t\t}\n\t\tconst compiled = this.#compileWhereObject(blindCast(filter));\n\t\treturn this.#clone({ filters: [...this.#state.filters, ...compiled] });\n\t}\n\tselect(...fields) {\n\t\tconst storage = this.#storedNames();\n\t\treturn this.#clone({ selectedFields: [...this.#state.selectedFields ?? [], ...fields.map((field) => storedNameOfCallerField(storage, field))] });\n\t}\n\tinclude(relationName) {\n\t\tconst relation = modelOf(this.#contract, this.#modelName).relations?.[relationName];\n\t\tif (!relation) throw ormError(\"ORM.RELATION_UNKNOWN\", `Unknown relation \"${relationName}\" on model \"${this.#modelName}\"`, { meta: {\n\t\t\tmodel: this.#modelName,\n\t\t\trelation: relationName\n\t\t} });\n\t\tif (!(\"on\" in relation)) throw ormError(\"ORM.INCLUDE_UNSUPPORTED\", `Relation \"${relationName}\" is an embed relation — only reference relations can be included`, { meta: {\n\t\t\tmodel: this.#modelName,\n\t\t\trelation: relationName\n\t\t} });\n\t\tconst ref = relation;\n\t\tconst localField = ref.on.localFields[0];\n\t\tconst foreignField = ref.on.targetFields[0];\n\t\tif (!localField || !foreignField || ref.on.localFields.length !== 1 || ref.on.targetFields.length !== 1) throw ormError(\"ORM.INCLUDE_UNSUPPORTED\", `Compound references are not yet supported: relation \"${relationName}\"`, { meta: {\n\t\t\tmodel: this.#modelName,\n\t\t\trelation: relationName\n\t\t} });\n\t\tconst targetModelName = ref.to.model;\n\t\tconst targetModel = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[targetModelName];\n\t\tif (!targetModel) throw new InternalError(`Target model \"${targetModelName}\" not found for relation \"${relationName}\"`);\n\t\tconst includeExpr = {\n\t\t\trelationName,\n\t\t\ttargetModelName,\n\t\t\ttargetModel,\n\t\t\tfrom: resolveCollectionName(targetModel, targetModelName),\n\t\t\tlocalField: storedNameOfCallerField(this.#storedNames(), localField),\n\t\t\tforeignField: storedNameOfCallerField(modelStoredNamesOf(this.#contract, targetModelName), foreignField),\n\t\t\tcardinality: ref.cardinality\n\t\t};\n\t\treturn blindCast(this.#clone({ includes: [...this.#state.includes, includeExpr] }));\n\t}\n\torderBy(spec) {\n\t\tconst storage = this.#storedNames();\n\t\tconst merged = {\n\t\t\t...this.#state.orderBy,\n\t\t\t...Object.fromEntries(Object.entries(spec).flatMap(([field, direction]) => direction === void 0 ? [] : [[storedNameOfCallerField(storage, field), direction]]))\n\t\t};\n\t\treturn this.#clone({ orderBy: merged });\n\t}\n\tlimit(n) {\n\t\treturn this.#clone({ limit: n });\n\t}\n\toffset(n) {\n\t\treturn this.#clone({ offset: n });\n\t}\n\tall() {\n\t\treturn this.#query();\n\t}\n\tasync first() {\n\t\treturn this.#run(this.#describeFirst());\n\t}\n\tget prepared() {\n\t\treturn {\n\t\t\tall: () => this.#describeRows(),\n\t\t\tfirst: () => this.#describeFirst(),\n\t\t\tfirstOrThrow: () => this.#describeFirstOrThrow()\n\t\t};\n\t}\n\tasync firstOrThrow() {\n\t\treturn this.#run(this.#describeFirstOrThrow());\n\t}\n\tasync create(data) {\n\t\tthis.#rejectIncludes(\"create\");\n\t\tconst normalized = this.#withCreateDefaults(this.#injectDiscriminator(this.#stripUndefined(blindCast(data))), /* @__PURE__ */ new Map());\n\t\tconst document = this.#toDocument(normalized);\n\t\tconst command = new InsertOneCommand(this.#collectionName, document);\n\t\tconst results = await this.#drainPlan(command, this.#insertOneResultShape());\n\t\treturn blindCast(this.#rowOf(blindCast(results[0]).document));\n\t}\n\tcreateAll(data) {\n\t\tthis.#rejectIncludes(\"createAll\");\n\t\tconst self = this;\n\t\tasync function* gen() {\n\t\t\tconst defaultValueCache = /* @__PURE__ */ new Map();\n\t\t\tconst normalizedRows = data.map((d) => self.#withCreateDefaults(self.#injectDiscriminator(self.#stripUndefined(blindCast(d))), defaultValueCache));\n\t\t\tconst command = new InsertManyCommand(self.#collectionName, normalizedRows.map((d) => self.#toDocument(d)));\n\t\t\tconst { documents } = blindCast((await self.#drainPlan(command, self.#insertManyResultShape()))[0]);\n\t\t\tfor (const document of documents) yield blindCast(self.#rowOf(document));\n\t\t}\n\t\treturn new AsyncIterableResult(gen());\n\t}\n\tasync createAndCount(data) {\n\t\tthis.#rejectIncludes(\"createAndCount\");\n\t\tconst defaultValueCache = /* @__PURE__ */ new Map();\n\t\tconst documents = data.map((d) => this.#toDocument(this.#withCreateDefaults(this.#injectDiscriminator(this.#stripUndefined(blindCast(d))), defaultValueCache)));\n\t\tconst command = new InsertManyCommand(this.#collectionName, documents);\n\t\treturn blindCast((await this.#drainPlan(command))[0]).insertedCount;\n\t}\n\tasync update(dataOrCallback) {\n\t\tthis.#requireFilters(\"update\");\n\t\tthis.#rejectFilterPlaceholders(\"update\");\n\t\tthis.#rejectWindowing(\"update\");\n\t\tthis.#rejectIncludes(\"update\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst updateDoc = this.#withUpdateDefaults(this.#resolveUpdateDoc(dataOrCallback), /* @__PURE__ */ new Map());\n\t\tconst command = new FindOneAndUpdateCommand(this.#collectionName, filter, updateDoc, false);\n\t\tconst result = (await this.#drainPlan(command, this.#modelResultShape()))[0];\n\t\treturn result === void 0 ? null : blindCast(this.#rowOf(result));\n\t}\n\tupdateAll(dataOrCallback) {\n\t\tthis.#requireFilters(\"updateAll\");\n\t\tthis.#rejectFilterPlaceholders(\"updateAll\");\n\t\tthis.#rejectWindowing(\"updateAll\");\n\t\tconst self = this;\n\t\tasync function* gen() {\n\t\t\tconst ids = await self.#readMatchingIds();\n\t\t\tif (ids.length === 0) return;\n\t\t\tconst filter = self.#mergeFilters();\n\t\t\tconst updateDoc = self.#withUpdateDefaults(self.#resolveUpdateDoc(dataOrCallback), /* @__PURE__ */ new Map());\n\t\t\tconst command = new UpdateManyCommand(self.#collectionName, filter, updateDoc);\n\t\t\tawait self.#drainPlan(command);\n\t\t\tconst idFilter = MongoFieldFilter.in(\"_id\", ids.map((id) => ormParam(id, \"_id\")));\n\t\t\tyield* self.#clone({ filters: [idFilter] }).#query();\n\t\t}\n\t\treturn new AsyncIterableResult(gen());\n\t}\n\tasync updateAndCount(dataOrCallback) {\n\t\tthis.#requireFilters(\"updateAndCount\");\n\t\tthis.#rejectFilterPlaceholders(\"updateAndCount\");\n\t\tthis.#rejectWindowing(\"updateAndCount\");\n\t\tthis.#rejectIncludes(\"updateAndCount\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst updateDoc = this.#withUpdateDefaults(this.#resolveUpdateDoc(dataOrCallback), /* @__PURE__ */ new Map());\n\t\tconst command = new UpdateManyCommand(this.#collectionName, filter, updateDoc);\n\t\treturn (await this.#executePlan(command)).affectedRows;\n\t}\n\tasync delete() {\n\t\tthis.#requireFilters(\"delete\");\n\t\tthis.#rejectFilterPlaceholders(\"delete\");\n\t\tthis.#rejectWindowing(\"delete\");\n\t\tthis.#rejectIncludes(\"delete\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst command = new FindOneAndDeleteCommand(this.#collectionName, filter);\n\t\tconst result = (await this.#drainPlan(command, this.#modelResultShape()))[0];\n\t\treturn result === void 0 ? null : blindCast(this.#rowOf(result));\n\t}\n\tdeleteAll() {\n\t\tthis.#requireFilters(\"deleteAll\");\n\t\tthis.#rejectFilterPlaceholders(\"deleteAll\");\n\t\tthis.#rejectWindowing(\"deleteAll\");\n\t\tconst self = this;\n\t\tasync function* gen() {\n\t\t\tconst docs = [];\n\t\t\tfor await (const row of self.#query()) docs.push(row);\n\t\t\tconst filter = self.#mergeFilters();\n\t\t\tconst command = new DeleteManyCommand(self.#collectionName, filter);\n\t\t\tawait self.#drainPlan(command);\n\t\t\tyield* docs;\n\t\t}\n\t\treturn new AsyncIterableResult(gen());\n\t}\n\tasync deleteAndCount() {\n\t\tthis.#requireFilters(\"deleteAndCount\");\n\t\tthis.#rejectFilterPlaceholders(\"deleteAndCount\");\n\t\tthis.#rejectWindowing(\"deleteAndCount\");\n\t\tthis.#rejectIncludes(\"deleteAndCount\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst command = new DeleteManyCommand(this.#collectionName, filter);\n\t\treturn (await this.#executePlan(command)).affectedRows;\n\t}\n\tasync upsert(input) {\n\t\tthis.#requireFilters(\"upsert\");\n\t\tthis.#rejectFilterPlaceholders(\"upsert\");\n\t\tthis.#rejectWindowing(\"upsert\");\n\t\tthis.#rejectIncludes(\"upsert\");\n\t\tconst filter = this.#mergeFilters();\n\t\tconst defaultValueCache = /* @__PURE__ */ new Map();\n\t\tconst explicitCreate = this.#injectDiscriminator(this.#stripUndefined(blindCast(input.create)));\n\t\tconst allCreateFields = this.#toDocument(this.#withCreateDefaults(explicitCreate, defaultValueCache));\n\t\tlet updateDoc;\n\t\tif (typeof input.update === \"function\") {\n\t\t\tconst accessor = createFieldAccessor();\n\t\t\tconst ops = input.update(accessor);\n\t\t\tthis.#rejectDocumentIdOps(ops);\n\t\t\tconst dotPathOp = ops.find((op) => op.field.includes(\".\"));\n\t\t\tif (dotPathOp) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `upsert() does not support dot-path field operations (found \"${dotPathOp.field}\"). Dot-path updates conflict with \\$setOnInsert on the insert path, producing incomplete documents. Use top-level field operations instead.`, { meta: {\n\t\t\t\tmethod: \"upsert\",\n\t\t\t\tfield: dotPathOp.field\n\t\t\t} });\n\t\t\tupdateDoc = compileFieldOperations(ops, (field, value, operator) => this.#wrapFieldOpValue(field, value, operator), (field) => this.#storedPath(field));\n\t\t} else {\n\t\t\tconst setFields = this.#toSetFields(blindCast(input.update));\n\t\t\tupdateDoc = {};\n\t\t\tif (Object.keys(setFields).length > 0) updateDoc[\"$set\"] = setFields;\n\t\t}\n\t\tconst explicitUpdateFields = topLevelUpdateFields(updateDoc);\n\t\tconst withUpdateDefaults = this.#withUpdateDefaults(updateDoc, defaultValueCache);\n\t\tconst explicitCreateFields = new Set(Object.keys(this.#storedKeys(explicitCreate)));\n\t\tconst generatedSetByCreate = Object.keys(withUpdateDefaults[\"$set\"] ?? {}).filter((field) => !explicitUpdateFields.has(field) && explicitCreateFields.has(field));\n\t\tif (generatedSetByCreate.length === 0) return this.#upsertCommand(filter, withUpdateDefaults, allCreateFields);\n\t\tconst results = await this.#drainPlan(new FindOneAndUpdateCommand(this.#collectionName, filter, upsertPipeline({\n\t\t\tfilter,\n\t\t\tupdate: withUpdateDefaults,\n\t\t\tcreate: allCreateFields,\n\t\t\tcreateWins: new Set(generatedSetByCreate)\n\t\t}), true), this.#modelResultShape());\n\t\treturn blindCast(this.#rowOf(results[0]));\n\t}\n\tasync #upsertCommand(filter, updateDoc, allCreateFields) {\n\t\tconst updatedFields = topLevelUpdateFields(updateDoc);\n\t\tconst insertOnlyFields = {};\n\t\tfor (const [key, value] of Object.entries(allCreateFields)) if (!updatedFields.has(key)) insertOnlyFields[key] = value;\n\t\tconst command = new FindOneAndUpdateCommand(this.#collectionName, filter, Object.keys(insertOnlyFields).length > 0 ? {\n\t\t\t...updateDoc,\n\t\t\t$setOnInsert: insertOnlyFields\n\t\t} : updateDoc, true);\n\t\tconst results = await this.#drainPlan(command, this.#modelResultShape());\n\t\treturn blindCast(this.#rowOf(results[0]));\n\t}\n\tasync #readMatchingIds() {\n\t\tconst idQuery = this.#clone({\n\t\t\tincludes: [],\n\t\t\tselectedFields: [\"_id\"],\n\t\t\torderBy: void 0,\n\t\t\tlimit: void 0,\n\t\t\toffset: void 0\n\t\t});\n\t\tconst ids = [];\n\t\tconst { resultShape: _rs, ...planWithoutShape } = idQuery.#compile();\n\t\tfor await (const row of this.#executor.query(planWithoutShape)) ids.push(row[\"_id\"]);\n\t\treturn ids;\n\t}\n\t#query() {\n\t\treturn this.#run(this.#describeRows());\n\t}\n\t#run(read) {\n\t\treturn read.consume(this.#executor.query(read.plan));\n\t}\n\t#describeRows() {\n\t\tconst plan = this.#compile();\n\t\tconst rowOf = this.#rowMapper();\n\t\treturn {\n\t\t\tplan,\n\t\t\tconsume: (documents) => {\n\t\t\t\tasync function* rows() {\n\t\t\t\t\tfor await (const document of documents) yield blindCast(rowOf(document));\n\t\t\t\t}\n\t\t\t\treturn new AsyncIterableResult(rows());\n\t\t\t}\n\t\t};\n\t}\n\t#describeFirst() {\n\t\tconst rows = this.#clone({ limit: 1 }).#describeRows();\n\t\treturn {\n\t\t\tplan: rows.plan,\n\t\t\tconsume: async (documents) => {\n\t\t\t\tfor await (const row of rows.consume(documents)) return row;\n\t\t\t\treturn null;\n\t\t\t}\n\t\t};\n\t}\n\t#describeFirstOrThrow() {\n\t\tconst rows = this.#clone({ limit: 1 }).#describeRows();\n\t\treturn {\n\t\t\tplan: rows.plan,\n\t\t\tconsume: (documents) => rows.consume(documents).firstOrThrow()\n\t\t};\n\t}\n\t#rowMapper() {\n\t\treturn documentRowMapper(this.#contract, this.#modelName, this.#variantModelName(), Object.fromEntries(this.#state.includes.map((include) => [include.relationName, include.targetModelName])));\n\t}\n\t#rowOf(document) {\n\t\treturn this.#rowMapper()(document);\n\t}\n\t#variantModelName() {\n\t\tif (this.#variantValue === void 0) return void 0;\n\t\treturn mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[this.#modelName]?.variants?.[this.#variantValue]?.model;\n\t}\n\t#storedNames() {\n\t\treturn modelStoredNamesOf(this.#contract, this.#modelName, this.#variantModelName());\n\t}\n\t#storedPath(path) {\n\t\treturn storedPathOfCallerPath(this.#storedNames(), path);\n\t}\n\t#storedKeys(data) {\n\t\tconst storage = this.#storedNames();\n\t\treturn Object.fromEntries(Object.entries(data).map(([key, value]) => [storedPathOfCallerPath(storage, key), value]));\n\t}\n\t#rejectDocumentIdOps(ops) {\n\t\tconst idOp = ops.find((op) => this.#storedPath(op.field).split(\".\")[0] === \"_id\");\n\t\tif (idOp) throw ormError(\"ORM.FIELD_IMMUTABLE\", `Mutation payloads cannot modify \\`${idOp.field}\\``, { meta: { field: idOp.field } });\n\t}\n\t#compile() {\n\t\tconst model = this.#modelWithVariantFields();\n\t\tif (!model) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown model: \"${this.#modelName}\".`, { meta: { model: this.#modelName } });\n\t\treturn compileMongoQuery(this.#collectionName, this.#state, this.#contract.storage.storageHash, model, this.#contract.storage);\n\t}\n\t#wrapCommand(command, resultShape) {\n\t\treturn {\n\t\t\tcollection: this.#collectionName,\n\t\t\tcommand,\n\t\t\tmeta: this.#planMeta(),\n\t\t\t...ifDefined(\"resultShape\", resultShape)\n\t\t};\n\t}\n\t#executePlan(command) {\n\t\treturn this.#executor.execute(this.#wrapCommand(command));\n\t}\n\tasync #drainPlan(command, resultShape) {\n\t\tconst plan = this.#wrapCommand(command, resultShape);\n\t\tconst result = this.#executor.query(plan);\n\t\tconst rows = [];\n\t\tfor await (const row of result) rows.push(row);\n\t\treturn rows;\n\t}\n\t#modelFields() {\n\t\treturn this.#modelWithVariantFields()?.fields ?? {};\n\t}\n\t#modelWithVariantFields() {\n\t\tconst models = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId);\n\t\tconst model = models[this.#modelName];\n\t\tconst variantRef = this.#variantValue === void 0 ? void 0 : model?.variants?.[this.#variantValue];\n\t\tif (model === void 0 || variantRef === void 0) return model;\n\t\tconst variant = models[variantRef.model];\n\t\treturn variant === void 0 ? model : {\n\t\t\t...model,\n\t\t\tfields: {\n\t\t\t\t...model.fields,\n\t\t\t\t...variant.fields\n\t\t\t},\n\t\t\tstorage: {\n\t\t\t\t...model.storage,\n\t\t\t\tfields: {\n\t\t\t\t\t...model.storage.fields,\n\t\t\t\t\t...variant.storage.fields\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t#idFieldShape() {\n\t\tconst model = this.#modelWithVariantFields();\n\t\tconst idField = model === void 0 ? void 0 : ownDocumentIdFieldOf(model)?.field;\n\t\treturn idField ? contractFieldToMongoFieldShape(idField) : Object.freeze({ kind: \"unknown\" });\n\t}\n\t#insertOneResultShape() {\n\t\treturn freezeMongoResultShape({\n\t\t\tkind: \"document\",\n\t\t\tfields: {\n\t\t\t\tinsertedId: this.#idFieldShape(),\n\t\t\t\tdocument: this.#documentShape()\n\t\t\t}\n\t\t});\n\t}\n\t#insertManyResultShape() {\n\t\treturn freezeMongoResultShape({\n\t\t\tkind: \"document\",\n\t\t\tfields: {\n\t\t\t\tinsertedIds: {\n\t\t\t\t\tkind: \"array\",\n\t\t\t\t\tnullable: false,\n\t\t\t\t\telement: this.#idFieldShape()\n\t\t\t\t},\n\t\t\t\tdocuments: {\n\t\t\t\t\tkind: \"array\",\n\t\t\t\t\tnullable: false,\n\t\t\t\t\telement: this.#documentShape()\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t#documentShape() {\n\t\tconst shape = this.#modelResultShape();\n\t\treturn shape.kind === \"document\" ? {\n\t\t\tkind: \"document\",\n\t\t\tnullable: false,\n\t\t\tfields: shape.fields,\n\t\t\trow: true\n\t\t} : { kind: \"unknown\" };\n\t}\n\t#modelResultShape() {\n\t\tconst model = this.#modelWithVariantFields();\n\t\tif (!model) return Object.freeze({ kind: \"unknown\" });\n\t\treturn contractModelToMongoResultShape(model, { storage: this.#contract.storage });\n\t}\n\t#valueObjectAt(reference) {\n\t\treturn valueObjectAt(this.#contract.storage, reference);\n\t}\n\t#compileWhereObject(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst filters = [];\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst storedName = storedNameOfCallerField(this.#storedNames(), key);\n\t\t\tconst field = fields[key];\n\t\t\tif (Array.isArray(value)) rejectPlaceholderList(value, key);\n\t\t\tconst compared = isMongoPreparedParamRef(value) && field?.type.kind === \"scalar\" ? wherePlaceholder(value, this.#placeholderField(key, field, field.type.codecId), key) : this.#wrapFieldValue(value, field, key, \"filter\");\n\t\t\tfilters.push(whereEquality(storedName, field, compared));\n\t\t}\n\t\treturn filters;\n\t}\n\t/**\n\t* Encodes the comparison values of a filter on a scalar field through the field's codec, as the object form of `where` and every update does. Without it a driver class such as an `ObjectId` would be copied into a plain object and match nothing.\n\t*/\n\t#encodeFieldFilter(filter) {\n\t\tconst storedPath = this.#storedPath(filter.field);\n\t\tconst field = this.#fieldAtPath(filter.field);\n\t\tif (field?.type.kind !== \"scalar\") {\n\t\t\tthis.#rejectNonScalarPlaceholder(filter.value, filter.field, field);\n\t\t\treturn storedPath === filter.field ? filter : MongoFieldFilter.of(storedPath, filter.op, filter.value);\n\t\t}\n\t\tconst placeholderField = this.#placeholderField(filter.field, field, field.type.codecId);\n\t\tconst encode = (value) => {\n\t\t\tif (value === null) return null;\n\t\t\tif (value instanceof MongoParamRef) return value.codecId === void 0 ? this.#wrapFieldValue(value.value, field, filter.field, \"filter\") : value;\n\t\t\tif (field.many && Array.isArray(value)) return value.map(encode);\n\t\t\treturn this.#wrapFieldValue(value, field, filter.field, \"filter\");\n\t\t};\n\t\tconst operand = (value) => {\n\t\t\tif (isMongoPreparedParamRef(value)) return wherePlaceholder(value, placeholderField, filter.field);\n\t\t\tif (Array.isArray(value)) rejectPlaceholderList(value, filter.field);\n\t\t\trejectPlaceholder(value, filter.field);\n\t\t\treturn encode(value);\n\t\t};\n\t\tif (COMPARISON_OPERATORS.has(filter.op)) return MongoFieldFilter.of(storedPath, filter.op, operand(filter.value));\n\t\tif (MEMBERSHIP_OPERATORS.has(filter.op) && Array.isArray(filter.value)) {\n\t\t\tconst values = filter.value;\n\t\t\tconst encoded = values.map(operand);\n\t\t\treturn encoded.every((value, index) => value === values[index]) && storedPath === filter.field ? filter : MongoFieldFilter.of(storedPath, filter.op, encoded);\n\t\t}\n\t\trejectPlaceholder(filter.value, filter.field);\n\t\treturn storedPath === filter.field ? filter : MongoFieldFilter.of(storedPath, filter.op, filter.value);\n\t}\n\t/**\n\t* A path that ends in a list index names one item of the list, so a placeholder there may be null exactly when the list's items may be.\n\t*/\n\t#placeholderField(path, field, codecId) {\n\t\tconst segments = path.split(\".\");\n\t\tconst last = segments.at(-1);\n\t\tconst list = last !== void 0 && LIST_INDEX.test(last) ? this.#fieldAtPath(segments.slice(0, -1).join(\".\"))?.many : void 0;\n\t\treturn {\n\t\t\tcodecId,\n\t\t\tnullable: list ? list.elementNullable : field.nullable,\n\t\t\tlist: Boolean(field.many)\n\t\t};\n\t}\n\t#rejectNonScalarPlaceholder(value, path, field) {\n\t\tconst [head = path] = path.split(\".\");\n\t\tif (field === void 0 && this.#modelFields()[head] !== void 0) rejectUnknownPathPlaceholder(value, path);\n\t\tif (field?.type.kind === \"valueObject\") rejectValueObjectPlaceholder(value, path, Boolean(field.many));\n\t\trejectPlaceholder(value, path);\n\t}\n\t#fieldAtPath(path) {\n\t\tconst [head, ...rest] = path.split(\".\");\n\t\tlet field = head === void 0 ? void 0 : this.#modelFields()[head];\n\t\tfor (const segment of rest) {\n\t\t\tif (field?.many && LIST_INDEX.test(segment)) {\n\t\t\t\tfield = {\n\t\t\t\t\t...field,\n\t\t\t\t\tmany: false\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (field?.type.kind !== \"valueObject\") return void 0;\n\t\t\tfield = this.#valueObjectAt(field.type)?.fields[segment];\n\t\t}\n\t\treturn field;\n\t}\n\t/**\n\t* A value written to a field is checked against the field's enum and must not be `null` unless the field is nullable; a value compared in a filter is not, so a filter can find stored values the contract does not allow.\n\t*/\n\t#wrapFieldValue(value, field, path, purpose) {\n\t\tif (field === void 0) return ormParam(value, path);\n\t\tif (value === null) return this.#nullParam(field, path, purpose);\n\t\tif (field.type.kind === \"scalar\") {\n\t\t\tif (purpose === \"write\") this.#assertEnumValues(field, value, path);\n\t\t\treturn this.#scalarParam(value, field, path, purpose);\n\t\t}\n\t\tif (field.type.kind === \"valueObject\") {\n\t\t\trejectValueObjectPlaceholder(value, path, Boolean(field.many));\n\t\t\tconst voDef = this.#valueObjectAt(field.type);\n\t\t\tif (!voDef) return ormParam(value, path);\n\t\t\tif (field.many && Array.isArray(value)) return value.map((item, index) => item === null ? null : this.#wrapValueObject(blindCast(item), voDef, `${path}.${index}`, purpose));\n\t\t\treturn this.#wrapValueObject(blindCast(value), voDef, path, purpose);\n\t\t}\n\t\treturn ormParam(value, path);\n\t}\n\t#nullParam(field, path, purpose) {\n\t\tif (purpose === \"write\" && !field.nullable) throw runtimeError(\"RUNTIME.ENCODE_FAILED\", `Failed to encode field ${path} in collection '${this.#collectionName}': the field is required and cannot be null`, {\n\t\t\tlabel: path,\n\t\t\tcollection: this.#collectionName\n\t\t});\n\t\treturn null;\n\t}\n\t/**\n\t* A contract without a collection validator (TypeScript builder, Prisma 6 schema) stores whatever reaches the driver, so a value outside the field's enum is refused here.\n\t*/\n\t#assertEnumValues(field, value, path) {\n\t\tconst valueSet = field.valueSet;\n\t\tif (valueSet === void 0 || valueSet.entityKind !== \"enum\" || value === null) return;\n\t\tconst contractEnum = this.#contract.domain.namespaces[valueSet.namespaceId]?.enum?.[valueSet.entityName];\n\t\tconst accessor = this.#enums[valueSet.namespaceId]?.[valueSet.entityName];\n\t\tif (contractEnum === void 0 || accessor === void 0) return;\n\t\tconst values = field.many && Array.isArray(value) ? value : [value];\n\t\tconst outside = values.findIndex((entry) => entry !== null && !accessor.has(entry));\n\t\tif (outside === -1) return;\n\t\tconst received = values[outside];\n\t\tconst described = accessor.values.map(describeValue);\n\t\tconst list = described.length > 1 ? `${described.slice(0, -1).join(\", \")} and ${described.at(-1)}` : described.join(\"\");\n\t\tthrow runtimeError(\"RUNTIME.ENCODE_FAILED\", `Failed to encode field ${path} in collection '${this.#collectionName}': ${describeValue(received)} is not a value of enum ${valueSet.entityName}; the values are ${list}`, {\n\t\t\tlabel: path,\n\t\t\tcollection: this.#collectionName,\n\t\t\treceived,\n\t\t\tallowed: contractEnum.members.map((member) => member.value)\n\t\t});\n\t}\n\t/**\n\t* A scalar field's value as parameters: a list field's array is encoded element by element through the element codec, so the codec never sees the whole list.\n\t*/\n\t#scalarParam(value, field, path, purpose) {\n\t\tif (field.type.kind !== \"scalar\") return ormParam(value, path);\n\t\tconst codecId = field.type.codecId;\n\t\tif (field.many && Array.isArray(value)) {\n\t\t\tconst acceptsNull = field.many.elementNullable || purpose === \"filter\";\n\t\t\treturn value.map((element, index) => element === null && acceptsNull ? null : this.#fieldParam(element, codecId, `${path}.${index}`));\n\t\t}\n\t\treturn this.#fieldParam(value, codecId, path);\n\t}\n\t#fieldParam(value, codecId, path) {\n\t\treturn ormParam(value, path, {\n\t\t\tcodecId,\n\t\t\tname: path,\n\t\t\tcollection: this.#collectionName\n\t\t});\n\t}\n\t#wrapValueObject(data, voDef, path, purpose) {\n\t\tconst doc = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst fieldDef = voDef.fields[key];\n\t\t\tdoc[key] = this.#wrapFieldValue(value, fieldDef, `${path}.${key}`, purpose);\n\t\t}\n\t\treturn doc;\n\t}\n\t#toDocument(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst storage = this.#storedNames();\n\t\tconst doc = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst embedStoredName = Object.hasOwn(storage.embedStoredNames, key) ? storage.embedStoredNames[key] : void 0;\n\t\t\tif (embedStoredName !== void 0) {\n\t\t\t\tconst embedded = storage.embedded(key);\n\t\t\t\tdoc[embedStoredName] = ormParam(embedded === void 0 ? value : mapEach(value, (row) => storedDocumentOfRow(row, embedded)), key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdoc[storedNameOfCallerField(storage, key)] = this.#wrapFieldValue(value, fields[key], key, \"write\");\n\t\t}\n\t\treturn doc;\n\t}\n\t#toSetFields(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst storage = this.#storedNames();\n\t\tconst result = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (value === void 0) continue;\n\t\t\tconst storedName = storedPathOfCallerPath(storage, key);\n\t\t\tif (storedName === \"_id\") throw ormError(\"ORM.FIELD_IMMUTABLE\", `Mutation payloads cannot modify \\`${key}\\``, { meta: { field: key } });\n\t\t\tconst isEmbed = Object.hasOwn(storage.embedStoredNames, key);\n\t\t\tconst embedded = isEmbed ? storage.embedded(key) : void 0;\n\t\t\tresult[storedName] = !isEmbed ? this.#wrapFieldValue(value, fields[key], key, \"write\") : ormParam(embedded === void 0 ? value : mapEach(value, (row) => storedDocumentOfRow(row, embedded)), key);\n\t\t}\n\t\treturn result;\n\t}\n\t/** The defaults generated for a document whose stored names are the keys of `storedValues`, keyed by field name. A default of the collection for a stored name this model does not store belongs to another model stored in the collection, and is left out. */\n\t#appliedDefaults(op, storedValues, defaultValueCache) {\n\t\tconst applied = this.#mutationDefaults.applyMutationDefaults({\n\t\t\top,\n\t\t\tnamespace: UNBOUND_NAMESPACE_ID,\n\t\t\tentry: this.#collectionName,\n\t\t\tvalues: storedValues,\n\t\t\tdefaultValueCache\n\t\t}) ?? [];\n\t\tconst { fieldNames } = this.#storedNames();\n\t\treturn Object.fromEntries(applied.flatMap(({ field: storedName, value }) => {\n\t\t\tconst fieldName = Object.hasOwn(fieldNames, storedName) ? fieldNames[storedName] : void 0;\n\t\t\treturn fieldName === void 0 ? [] : [[fieldName, value]];\n\t\t}));\n\t}\n\t#withCreateDefaults(values, defaultValueCache) {\n\t\treturn {\n\t\t\t...values,\n\t\t\t...this.#appliedDefaults(\"create\", this.#storedKeys(values), defaultValueCache)\n\t\t};\n\t}\n\t#withUpdateDefaults(updateDoc, defaultValueCache) {\n\t\tconst explicit = Object.fromEntries([...topLevelUpdateFields(updateDoc)].map((field) => [field, true]));\n\t\tconst generated = this.#appliedDefaults(\"update\", explicit, defaultValueCache);\n\t\tif (Object.keys(generated).length === 0) return updateDoc;\n\t\treturn {\n\t\t\t...updateDoc,\n\t\t\t$set: {\n\t\t\t\t...updateDoc[\"$set\"],\n\t\t\t\t...this.#toSetFields(generated)\n\t\t\t}\n\t\t};\n\t}\n\t#stripUndefined(data) {\n\t\tconst result = {};\n\t\tfor (const [key, value] of Object.entries(data)) if (value !== void 0) result[key] = value;\n\t\treturn result;\n\t}\n\t#toUpdateDocument(data) {\n\t\treturn { $set: this.#toSetFields(data) };\n\t}\n\t#resolveUpdateDoc(dataOrCallback) {\n\t\tif (typeof dataOrCallback === \"function\") {\n\t\t\tconst ops = dataOrCallback(createFieldAccessor());\n\t\t\tthis.#rejectDocumentIdOps(ops);\n\t\t\tif (ops.length === 0) return { $set: {} };\n\t\t\treturn compileFieldOperations(ops, (field, value, operator) => this.#wrapFieldOpValue(field, value, operator), (field) => this.#storedPath(field));\n\t\t}\n\t\treturn this.#toUpdateDocument(blindCast(dataOrCallback));\n\t}\n\t/**\n\t* `$set` carries the field's whole value; `$push`, `$addToSet`, `$pull`, `$inc` and `$mul` carry one element or number; `$pop` and `$unset` carry no field value and are not encoded.\n\t*/\n\t#wrapFieldOpValue(path, value, operator) {\n\t\tif (operator === \"$unset\" || operator === \"$pop\" || !(value instanceof MongoParamRef)) return value;\n\t\tconst field = this.#fieldAtPath(path);\n\t\tif (field === void 0) return value;\n\t\tif (operator === \"$set\") return this.#wrapFieldValue(value.value, field, path, \"write\");\n\t\tif (value.value === null && field.many && (field.many.elementNullable || operator === \"$pull\")) return null;\n\t\tif (operator === \"$pull\") return this.#wrapFieldValue(value.value, field, path, \"filter\");\n\t\tif (field.type.kind === \"scalar\") {\n\t\t\tthis.#assertEnumValues(field, field.many ? [value.value] : value.value, path);\n\t\t\treturn this.#fieldParam(value.value, field.type.codecId, path);\n\t\t}\n\t\tif (field.type.kind === \"valueObject\" && isUnknownRecord(value.value)) {\n\t\t\tconst voDef = this.#valueObjectAt(field.type);\n\t\t\tif (voDef) return this.#wrapValueObject(value.value, voDef, path, \"write\");\n\t\t}\n\t\treturn value;\n\t}\n\t#mergeFilters() {\n\t\tconst [single] = this.#state.filters;\n\t\tif (this.#state.filters.length === 1 && single) return single;\n\t\treturn MongoAndExpr.of([...this.#state.filters]);\n\t}\n\t#requireFilters(methodName) {\n\t\tif (this.#state.filters.length === 0) throw ormError(\"ORM.WHERE_MISSING\", `${methodName}() requires a .where() filter. Call .where() before .${methodName}()`, { meta: { method: methodName } });\n\t}\n\t/** A write runs at once, so a placeholder a `where` kept is refused before it is sent. */\n\t#rejectFilterPlaceholders(methodName) {\n\t\tfor (const filter of this.#state.filters) {\n\t\t\tconst placeholder = placeholderInFilter(filter);\n\t\t\tif (placeholder !== void 0) rejectPreparedWrite(methodName, placeholder);\n\t\t}\n\t}\n\t#rejectWindowing(methodName) {\n\t\tif (this.#state.orderBy !== void 0 || this.#state.limit !== void 0 || this.#state.offset !== void 0) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `${methodName}() does not support orderBy/offset/limit. Remove windowing before calling .${methodName}()`, { meta: {\n\t\t\tmethod: methodName,\n\t\t\treason: \"windowing\"\n\t\t} });\n\t}\n\t#rejectIncludes(methodName) {\n\t\tif (this.#state.includes.length > 0) throw ormError(\"ORM.OPERATION_UNSUPPORTED\", `${methodName}() does not support .include(). Remove includes before calling .${methodName}()`, { meta: {\n\t\t\tmethod: methodName,\n\t\t\treason: \"includes\"\n\t\t} });\n\t}\n\t#planMeta() {\n\t\treturn {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: this.#contract.storage.storageHash,\n\t\t\tlane: \"mongo-orm\"\n\t\t};\n\t}\n\t#injectDiscriminator(data) {\n\t\tif (!this.#variantValue) return data;\n\t\tconst model = mongoModelsOf(this.#contract.domain, defaultMongoDomainNamespaceId)[this.#modelName];\n\t\tif (!model?.discriminator) return data;\n\t\treturn {\n\t\t\t...data,\n\t\t\t[model.discriminator.field]: this.#variantValue\n\t\t};\n\t}\n\t#clone(overrides) {\n\t\tconst instance = new MongoCollectionImpl(this.#ctx, this.#modelName, this.#enums);\n\t\tinstance.#state = {\n\t\t\t...this.#state,\n\t\t\t...overrides\n\t\t};\n\t\tinstance.#collectionName = this.#collectionName;\n\t\tinstance.#variantValue = this.#variantValue;\n\t\treturn instance;\n\t}\n\t#cloneWithVariant(overrides, variantValue) {\n\t\tconst instance = new MongoCollectionImpl(this.#ctx, this.#modelName, this.#enums);\n\t\tinstance.#state = {\n\t\t\t...this.#state,\n\t\t\t...overrides\n\t\t};\n\t\tinstance.#collectionName = this.#collectionName;\n\t\tinstance.#variantValue = variantValue;\n\t\treturn instance;\n\t}\n};\n/** A collection of `modelName` over the context's contract, which fills generated fields from the context's mutation defaults and checks written enum values against the context's enum accessors. */\nfunction createMongoCollection(ctx, modelName) {\n\treturn new MongoCollectionImpl(ctx, modelName, buildEnumAccessors(ctx.context));\n}\n//#endregion\n//#region src/mongo-orm.ts\nfunction mongoOrm(options) {\n\tconst { context, runtime } = options;\n\tconst enums = buildEnumAccessors(context);\n\tconst client = {};\n\tfor (const [rootName, rootRef] of Object.entries(context.contract.roots)) client[rootName] = new MongoCollectionImpl({\n\t\tcontext,\n\t\truntime\n\t}, blindCast(rootRef.model), enums);\n\treturn blindCast(client);\n}\n//#endregion\n//#region src/raw-collection.ts\nfunction createRawMongoCollection(collectionName, meta) {\n\tfunction buildable(command) {\n\t\treturn { build: () => ({\n\t\t\tcollection: collectionName,\n\t\t\tcommand,\n\t\t\tmeta\n\t\t}) };\n\t}\n\treturn {\n\t\taggregate(pipeline) {\n\t\t\treturn buildable(new RawAggregateCommand(collectionName, pipeline));\n\t\t},\n\t\tinsertOne(document) {\n\t\t\treturn buildable(new RawInsertOneCommand(collectionName, document));\n\t\t},\n\t\tinsertMany(documents) {\n\t\t\treturn buildable(new RawInsertManyCommand(collectionName, documents));\n\t\t},\n\t\tupdateOne(filter, update) {\n\t\t\treturn buildable(new RawUpdateOneCommand(collectionName, filter, update));\n\t\t},\n\t\tupdateMany(filter, update) {\n\t\t\treturn buildable(new RawUpdateManyCommand(collectionName, filter, update));\n\t\t},\n\t\tdeleteOne(filter) {\n\t\t\treturn buildable(new RawDeleteOneCommand(collectionName, filter));\n\t\t},\n\t\tdeleteMany(filter) {\n\t\t\treturn buildable(new RawDeleteManyCommand(collectionName, filter));\n\t\t},\n\t\tfindOneAndUpdate(filter, update, options) {\n\t\t\treturn buildable(new RawFindOneAndUpdateCommand(collectionName, filter, update, options?.upsert ?? false));\n\t\t},\n\t\tfindOneAndDelete(filter) {\n\t\t\treturn buildable(new RawFindOneAndDeleteCommand(collectionName, filter));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/mongo-raw.ts\nfunction mongoRaw(options) {\n\tconst { contract } = options.context;\n\treturn { collection(rootName) {\n\t\tconst modelName = contract.roots[rootName]?.model;\n\t\tconst models = mongoModelsOf(contract.domain, defaultMongoDomainNamespaceId);\n\t\tif (!modelName || !Object.hasOwn(models, modelName)) throw ormError(\"ORM.MODEL_UNKNOWN\", `Unknown model \"${modelName ?? \"\"}\" for root \"${rootName}\"`, { meta: {\n\t\t\tmodel: modelName ?? \"\",\n\t\t\troot: rootName\n\t\t} });\n\t\treturn createRawMongoCollection(models[modelName]?.storage.collection ?? modelName, {\n\t\t\ttarget: \"mongo\",\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\tlane: \"mongo-raw\"\n\t\t});\n\t} };\n}\n//#endregion\nexport { compileMongoQuery, createFieldAccessor, createMongoCollection, mongoOrm, mongoRaw };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAS,uBAAuB;CAC/B,OAAO;EACN,SAAS,CAAC;EACV,UAAU,CAAC;EACX,SAAS,KAAK;EACd,gBAAgB,KAAK;EACrB,OAAO,KAAK;EACZ,QAAQ,KAAK;CACd;AACD;AAGA,SAAS,QAAQ,SAAS;CACzB,OAAO,QAAQ,gBAAgB,SAAS,QAAQ,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M;EACP,CAAC;CACF,EAAE;AACH"}
|
package/dist/query-ast.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { M as MongoIndexKey, N as MongoIndexKeyDirection } from "./mongo-value-set-ChzpEiPK-BVtp7f-a.mjs";
|
|
2
|
-
import { $ as MongoOutStage, A as MongoCountStage, At as
|
|
3
|
-
import { C as MongoOperationMeta, D as isMongoDmlOperation, E as isInspectionCheckSource, O as keysToKeySpec, S as MongoMigrationStep, T as buildIndexOpId, _ as MongoFieldRewriteMeta, a as CollModOptions, b as MongoMigrationCheckSource, c as CreateIndexCommand, d as DropIndexCommand, f as ListCollectionsCommand, g as MongoDmlOperation, h as MongoDmlCheck, i as CollModCommand, l as CreateIndexOptions, m as MongoDdlCommandVisitor, n as AnyMongoInspectionCommand, o as CreateCollectionCommand, p as ListIndexesCommand, r as AnyMongoMigrationOperation, s as CreateCollectionOptions, t as AnyMongoDdlCommand, u as DropCollectionCommand, v as MongoInspectionCommandVisitor, w as RenameCollectionCommand, x as MongoMigrationPlanOperation, y as MongoMigrationCheck } from "./control-
|
|
4
|
-
import { a as InsertOneResult, c as MongoQueryExecutor, d as UpdateResult, f as enumMemberCodecFor, i as InsertManyResult, l as UpdateManyResult, n as DeleteOneResult, o as MongoCodecLookup, r as DeleteResult, s as MongoExecutionContext, t as DeleteManyResult, u as UpdateOneResult } from "./execution-
|
|
5
|
-
export { type AggRecordArgs, AggregateCommand, type AnyMongoCommand, type AnyMongoDdlCommand, type AnyMongoInspectionCommand, type AnyMongoMigrationOperation, CollModCommand, type CollModOptions, CreateCollectionCommand, type CreateCollectionOptions, CreateIndexCommand, type CreateIndexOptions, DeleteManyCommand, type DeleteManyResult, DeleteOneCommand, type DeleteOneResult, type DeleteResult, DropCollectionCommand, DropIndexCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, type InsertManyResult, InsertOneCommand, type InsertOneResult, ListCollectionsCommand, ListIndexesCommand, MongoAddFieldsStage, MongoAggAccumulator, MongoAggArrayFilter, MongoAggCond, type MongoAggExpr, type MongoAggExprRewriter, type MongoAggExprVisitor, MongoAggFieldRef, MongoAggLet, MongoAggLiteral, MongoAggMap, MongoAggMergeObjects, MongoAggOperator, MongoAggReduce, MongoAggSwitch, type MongoAggSwitchBranch, MongoAndExpr, MongoBucketAutoStage, MongoBucketStage, type MongoCodecLookup, MongoCountStage, type MongoDdlCommandVisitor, type MongoDensifyRange, MongoDensifyStage, type MongoDmlCheck, type MongoDmlOperation, type MongoExecutionContext, MongoExistsExpr, MongoExprFilter, MongoFacetStage, MongoFieldFilter, type MongoFieldRewriteMeta, type MongoFieldShape, type MongoFillOutput, MongoFillStage, type MongoFilterExpr, type MongoFilterRewriter, type MongoFilterVisitor, MongoGeoNearStage, MongoGraphLookupStage, type MongoGroupId, MongoGroupStage, type MongoIndexKey, type MongoIndexKeyDirection, type MongoInspectionCommandVisitor, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, type MongoMigrationCheck, type MongoMigrationCheckSource, type MongoMigrationPlanOperation, type MongoMigrationStep, MongoNotExpr, type MongoOperationMeta, MongoOrExpr, MongoOutStage, type MongoPipelineStage, MongoProjectStage, type MongoProjectionValue, type MongoQueryExecutor, type MongoQueryPlan, MongoRedactStage, MongoReplaceRootStage, type MongoResultShape, MongoSampleStage, MongoSearchMetaStage, MongoSearchStage, MongoSetWindowFieldsStage, MongoSkipStage, MongoSortByCountStage, MongoSortStage, type MongoStageRewriterContext, type MongoStageVisitor, MongoUnionWithStage, MongoUnwindStage, type MongoUpdatePipelineStage, type MongoUpdateSpec, MongoVectorSearchStage, type MongoWindowField, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, type RawMongoCommand, RawUpdateManyCommand, RawUpdateOneCommand, RenameCollectionCommand, UpdateManyCommand, type UpdateManyResult, UpdateOneCommand, type UpdateOneResult, type UpdateResult, buildIndexOpId, enumMemberCodecFor, freezeMongoFieldShape, freezeMongoResultShape, isExprArray, isInspectionCheckSource, isMongoDmlOperation, isMongoFilterExpr, isRecordArgs, keysToKeySpec };
|
|
2
|
+
import { $ as MongoOutStage, A as MongoCountStage, At as RawMongoCommand, B as MongoFilterExpr, C as MongoAggReduce, Ct as RawAggregateCommand, Dt as RawFindOneAndUpdateCommand, E as MongoAndExpr, Et as RawFindOneAndDeleteCommand, F as MongoFacetStage, Ft as freezeMongoFieldShape, G as MongoGroupId, H as MongoFilterVisitor, I as MongoFieldFilter, It as freezeMongoResultShape, J as MongoLookupStage, K as MongoGroupStage, L as MongoFieldShape, Lt as isExprArray, M as MongoDensifyStage, Mt as RawUpdateOneCommand, N as MongoExistsExpr, Nt as UpdateManyCommand, O as MongoBucketAutoStage, Ot as RawInsertManyCommand, P as MongoExprFilter, Pt as UpdateOneCommand, Q as MongoOrExpr, R as MongoFillOutput, Rt as isMongoFilterExpr, S as MongoAggOperator, St as MongoWindowField, T as MongoAggSwitchBranch, Tt as RawDeleteOneCommand, U as MongoGeoNearStage, V as MongoFilterRewriter, W as MongoGraphLookupStage, X as MongoMergeStage, Y as MongoMatchStage, Z as MongoNotExpr, _ as MongoAggFieldRef, _t as MongoUnionWithStage, a as DeleteOneCommand, at as MongoRedactStage, b as MongoAggMap, bt as MongoUpdateSpec, c as InsertManyCommand, ct as MongoSampleStage, d as MongoAggAccumulator, dt as MongoSetWindowFieldsStage, et as MongoPipelineStage, f as MongoAggArrayFilter, ft as MongoSkipStage, g as MongoAggExprVisitor, gt as MongoStageVisitor, h as MongoAggExprRewriter, ht as MongoStageRewriterContext, i as DeleteManyCommand, it as MongoQueryPlan, j as MongoDensifyRange, jt as RawUpdateManyCommand, k as MongoBucketStage, kt as RawInsertOneCommand, l as InsertOneCommand, lt as MongoSearchMetaStage, m as MongoAggExpr, mt as MongoSortStage, n as AggregateCommand, nt as MongoProjectStage, o as FindOneAndDeleteCommand, ot as MongoReplaceRootStage, p as MongoAggCond, pt as MongoSortByCountStage, q as MongoLimitStage, r as AnyMongoCommand, rt as MongoProjectionValue, s as FindOneAndUpdateCommand, st as MongoResultShape, t as AggRecordArgs, tt as MongoPreparable, u as MongoAddFieldsStage, ut as MongoSearchStage, v as MongoAggLet, vt as MongoUnwindStage, w as MongoAggSwitch, wt as RawDeleteManyCommand, x as MongoAggMergeObjects, xt as MongoVectorSearchStage, y as MongoAggLiteral, yt as MongoUpdatePipelineStage, z as MongoFillStage, zt as isRecordArgs } from "./query-plan-k7nXo4F_-C07yAGNa.mjs";
|
|
3
|
+
import { C as MongoOperationMeta, D as isMongoDmlOperation, E as isInspectionCheckSource, O as keysToKeySpec, S as MongoMigrationStep, T as buildIndexOpId, _ as MongoFieldRewriteMeta, a as CollModOptions, b as MongoMigrationCheckSource, c as CreateIndexCommand, d as DropIndexCommand, f as ListCollectionsCommand, g as MongoDmlOperation, h as MongoDmlCheck, i as CollModCommand, l as CreateIndexOptions, m as MongoDdlCommandVisitor, n as AnyMongoInspectionCommand, o as CreateCollectionCommand, p as ListIndexesCommand, r as AnyMongoMigrationOperation, s as CreateCollectionOptions, t as AnyMongoDdlCommand, u as DropCollectionCommand, v as MongoInspectionCommandVisitor, w as RenameCollectionCommand, x as MongoMigrationPlanOperation, y as MongoMigrationCheck } from "./control-C60vKgXR.mjs";
|
|
4
|
+
import { a as InsertOneResult, c as MongoQueryExecutor, d as UpdateResult, f as enumMemberCodecFor, i as InsertManyResult, l as UpdateManyResult, n as DeleteOneResult, o as MongoCodecLookup, r as DeleteResult, s as MongoExecutionContext, t as DeleteManyResult, u as UpdateOneResult } from "./execution-BaB-jj-9.mjs";
|
|
5
|
+
export { type AggRecordArgs, AggregateCommand, type AnyMongoCommand, type AnyMongoDdlCommand, type AnyMongoInspectionCommand, type AnyMongoMigrationOperation, CollModCommand, type CollModOptions, CreateCollectionCommand, type CreateCollectionOptions, CreateIndexCommand, type CreateIndexOptions, DeleteManyCommand, type DeleteManyResult, DeleteOneCommand, type DeleteOneResult, type DeleteResult, DropCollectionCommand, DropIndexCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, type InsertManyResult, InsertOneCommand, type InsertOneResult, ListCollectionsCommand, ListIndexesCommand, MongoAddFieldsStage, MongoAggAccumulator, MongoAggArrayFilter, MongoAggCond, type MongoAggExpr, type MongoAggExprRewriter, type MongoAggExprVisitor, MongoAggFieldRef, MongoAggLet, MongoAggLiteral, MongoAggMap, MongoAggMergeObjects, MongoAggOperator, MongoAggReduce, MongoAggSwitch, type MongoAggSwitchBranch, MongoAndExpr, MongoBucketAutoStage, MongoBucketStage, type MongoCodecLookup, MongoCountStage, type MongoDdlCommandVisitor, type MongoDensifyRange, MongoDensifyStage, type MongoDmlCheck, type MongoDmlOperation, type MongoExecutionContext, MongoExistsExpr, MongoExprFilter, MongoFacetStage, MongoFieldFilter, type MongoFieldRewriteMeta, type MongoFieldShape, type MongoFillOutput, MongoFillStage, type MongoFilterExpr, type MongoFilterRewriter, type MongoFilterVisitor, MongoGeoNearStage, MongoGraphLookupStage, type MongoGroupId, MongoGroupStage, type MongoIndexKey, type MongoIndexKeyDirection, type MongoInspectionCommandVisitor, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, type MongoMigrationCheck, type MongoMigrationCheckSource, type MongoMigrationPlanOperation, type MongoMigrationStep, MongoNotExpr, type MongoOperationMeta, MongoOrExpr, MongoOutStage, type MongoPipelineStage, type MongoPreparable, MongoProjectStage, type MongoProjectionValue, type MongoQueryExecutor, type MongoQueryPlan, MongoRedactStage, MongoReplaceRootStage, type MongoResultShape, MongoSampleStage, MongoSearchMetaStage, MongoSearchStage, MongoSetWindowFieldsStage, MongoSkipStage, MongoSortByCountStage, MongoSortStage, type MongoStageRewriterContext, type MongoStageVisitor, MongoUnionWithStage, MongoUnwindStage, type MongoUpdatePipelineStage, type MongoUpdateSpec, MongoVectorSearchStage, type MongoWindowField, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, type RawMongoCommand, RawUpdateManyCommand, RawUpdateOneCommand, RenameCollectionCommand, UpdateManyCommand, type UpdateManyResult, UpdateOneCommand, type UpdateOneResult, type UpdateResult, buildIndexOpId, enumMemberCodecFor, freezeMongoFieldShape, freezeMongoResultShape, isExprArray, isInspectionCheckSource, isMongoDmlOperation, isMongoFilterExpr, isRecordArgs, keysToKeySpec };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { M as MongoIndexKey, N as MongoIndexKeyDirection } from "./mongo-value-set-ChzpEiPK-BVtp7f-a.mjs";
|
|
2
|
-
import { B as MongoFilterExpr, E as MongoAndExpr, H as MongoFilterVisitor, I as MongoFieldFilter, N as MongoExistsExpr, P as MongoExprFilter, Q as MongoOrExpr, Z as MongoNotExpr } from "./query-plan-
|
|
3
|
-
import { C as MongoOperationMeta, D as isMongoDmlOperation, E as isInspectionCheckSource, O as keysToKeySpec, S as MongoMigrationStep, T as buildIndexOpId, _ as MongoFieldRewriteMeta, a as CollModOptions, b as MongoMigrationCheckSource, c as CreateIndexCommand, d as DropIndexCommand, f as ListCollectionsCommand, g as MongoDmlOperation, h as MongoDmlCheck, i as CollModCommand, l as CreateIndexOptions, m as MongoDdlCommandVisitor, n as AnyMongoInspectionCommand, o as CreateCollectionCommand, p as ListIndexesCommand, r as AnyMongoMigrationOperation, s as CreateCollectionOptions, t as AnyMongoDdlCommand, u as DropCollectionCommand, v as MongoInspectionCommandVisitor, w as RenameCollectionCommand, x as MongoMigrationPlanOperation, y as MongoMigrationCheck } from "./control-
|
|
2
|
+
import { B as MongoFilterExpr, E as MongoAndExpr, H as MongoFilterVisitor, I as MongoFieldFilter, N as MongoExistsExpr, P as MongoExprFilter, Q as MongoOrExpr, Z as MongoNotExpr } from "./query-plan-k7nXo4F_-C07yAGNa.mjs";
|
|
3
|
+
import { C as MongoOperationMeta, D as isMongoDmlOperation, E as isInspectionCheckSource, O as keysToKeySpec, S as MongoMigrationStep, T as buildIndexOpId, _ as MongoFieldRewriteMeta, a as CollModOptions, b as MongoMigrationCheckSource, c as CreateIndexCommand, d as DropIndexCommand, f as ListCollectionsCommand, g as MongoDmlOperation, h as MongoDmlCheck, i as CollModCommand, l as CreateIndexOptions, m as MongoDdlCommandVisitor, n as AnyMongoInspectionCommand, o as CreateCollectionCommand, p as ListIndexesCommand, r as AnyMongoMigrationOperation, s as CreateCollectionOptions, t as AnyMongoDdlCommand, u as DropCollectionCommand, v as MongoInspectionCommandVisitor, w as RenameCollectionCommand, x as MongoMigrationPlanOperation, y as MongoMigrationCheck } from "./control-C60vKgXR.mjs";
|
|
4
4
|
export { type AnyMongoDdlCommand, type AnyMongoInspectionCommand, type AnyMongoMigrationOperation, CollModCommand, type CollModOptions, CreateCollectionCommand, type CreateCollectionOptions, CreateIndexCommand, type CreateIndexOptions, DropCollectionCommand, DropIndexCommand, ListCollectionsCommand, ListIndexesCommand, MongoAndExpr, type MongoDdlCommandVisitor, type MongoDmlCheck, type MongoDmlOperation, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, type MongoFieldRewriteMeta, type MongoFilterExpr, type MongoFilterVisitor, type MongoIndexKey, type MongoIndexKeyDirection, type MongoInspectionCommandVisitor, type MongoMigrationCheck, type MongoMigrationCheckSource, type MongoMigrationPlanOperation, type MongoMigrationStep, MongoNotExpr, type MongoOperationMeta, MongoOrExpr, RenameCollectionCommand, buildIndexOpId, isInspectionCheckSource, isMongoDmlOperation, keysToKeySpec };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as MongoOutStage, A as MongoCountStage, At as
|
|
2
|
-
import { a as InsertOneResult, c as MongoQueryExecutor, d as UpdateResult, f as enumMemberCodecFor, i as InsertManyResult, l as UpdateManyResult, n as DeleteOneResult, o as MongoCodecLookup, r as DeleteResult, s as MongoExecutionContext, t as DeleteManyResult, u as UpdateOneResult } from "./execution-
|
|
3
|
-
export { type AggRecordArgs, AggregateCommand, type AnyMongoCommand, DeleteManyCommand, type DeleteManyResult, DeleteOneCommand, type DeleteOneResult, type DeleteResult, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, type InsertManyResult, InsertOneCommand, type InsertOneResult, MongoAddFieldsStage, MongoAggAccumulator, MongoAggArrayFilter, MongoAggCond, type MongoAggExpr, type MongoAggExprRewriter, type MongoAggExprVisitor, MongoAggFieldRef, MongoAggLet, MongoAggLiteral, MongoAggMap, MongoAggMergeObjects, MongoAggOperator, MongoAggReduce, MongoAggSwitch, type MongoAggSwitchBranch, MongoAndExpr, MongoBucketAutoStage, MongoBucketStage, type MongoCodecLookup, MongoCountStage, type MongoDensifyRange, MongoDensifyStage, type MongoExecutionContext, MongoExistsExpr, MongoExprFilter, MongoFacetStage, MongoFieldFilter, type MongoFieldShape, type MongoFillOutput, MongoFillStage, type MongoFilterExpr, type MongoFilterRewriter, type MongoFilterVisitor, MongoGeoNearStage, MongoGraphLookupStage, type MongoGroupId, MongoGroupStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoNotExpr, MongoOrExpr, MongoOutStage, type MongoPipelineStage, MongoProjectStage, type MongoProjectionValue, type MongoQueryExecutor, type MongoQueryPlan, MongoRedactStage, MongoReplaceRootStage, type MongoResultShape, MongoSampleStage, MongoSearchMetaStage, MongoSearchStage, MongoSetWindowFieldsStage, MongoSkipStage, MongoSortByCountStage, MongoSortStage, type MongoStageRewriterContext, type MongoStageVisitor, MongoUnionWithStage, MongoUnwindStage, type MongoUpdatePipelineStage, type MongoUpdateSpec, MongoVectorSearchStage, type MongoWindowField, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, type RawMongoCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, type UpdateManyResult, UpdateOneCommand, type UpdateOneResult, type UpdateResult, enumMemberCodecFor, freezeMongoFieldShape, freezeMongoResultShape, isExprArray, isMongoFilterExpr, isRecordArgs };
|
|
1
|
+
import { $ as MongoOutStage, A as MongoCountStage, At as RawMongoCommand, B as MongoFilterExpr, C as MongoAggReduce, Ct as RawAggregateCommand, Dt as RawFindOneAndUpdateCommand, E as MongoAndExpr, Et as RawFindOneAndDeleteCommand, F as MongoFacetStage, Ft as freezeMongoFieldShape, G as MongoGroupId, H as MongoFilterVisitor, I as MongoFieldFilter, It as freezeMongoResultShape, J as MongoLookupStage, K as MongoGroupStage, L as MongoFieldShape, Lt as isExprArray, M as MongoDensifyStage, Mt as RawUpdateOneCommand, N as MongoExistsExpr, Nt as UpdateManyCommand, O as MongoBucketAutoStage, Ot as RawInsertManyCommand, P as MongoExprFilter, Pt as UpdateOneCommand, Q as MongoOrExpr, R as MongoFillOutput, Rt as isMongoFilterExpr, S as MongoAggOperator, St as MongoWindowField, T as MongoAggSwitchBranch, Tt as RawDeleteOneCommand, U as MongoGeoNearStage, V as MongoFilterRewriter, W as MongoGraphLookupStage, X as MongoMergeStage, Y as MongoMatchStage, Z as MongoNotExpr, _ as MongoAggFieldRef, _t as MongoUnionWithStage, a as DeleteOneCommand, at as MongoRedactStage, b as MongoAggMap, bt as MongoUpdateSpec, c as InsertManyCommand, ct as MongoSampleStage, d as MongoAggAccumulator, dt as MongoSetWindowFieldsStage, et as MongoPipelineStage, f as MongoAggArrayFilter, ft as MongoSkipStage, g as MongoAggExprVisitor, gt as MongoStageVisitor, h as MongoAggExprRewriter, ht as MongoStageRewriterContext, i as DeleteManyCommand, it as MongoQueryPlan, j as MongoDensifyRange, jt as RawUpdateManyCommand, k as MongoBucketStage, kt as RawInsertOneCommand, l as InsertOneCommand, lt as MongoSearchMetaStage, m as MongoAggExpr, mt as MongoSortStage, n as AggregateCommand, nt as MongoProjectStage, o as FindOneAndDeleteCommand, ot as MongoReplaceRootStage, p as MongoAggCond, pt as MongoSortByCountStage, q as MongoLimitStage, r as AnyMongoCommand, rt as MongoProjectionValue, s as FindOneAndUpdateCommand, st as MongoResultShape, t as AggRecordArgs, tt as MongoPreparable, u as MongoAddFieldsStage, ut as MongoSearchStage, v as MongoAggLet, vt as MongoUnwindStage, w as MongoAggSwitch, wt as RawDeleteManyCommand, x as MongoAggMergeObjects, xt as MongoVectorSearchStage, y as MongoAggLiteral, yt as MongoUpdatePipelineStage, z as MongoFillStage, zt as isRecordArgs } from "./query-plan-k7nXo4F_-C07yAGNa.mjs";
|
|
2
|
+
import { a as InsertOneResult, c as MongoQueryExecutor, d as UpdateResult, f as enumMemberCodecFor, i as InsertManyResult, l as UpdateManyResult, n as DeleteOneResult, o as MongoCodecLookup, r as DeleteResult, s as MongoExecutionContext, t as DeleteManyResult, u as UpdateOneResult } from "./execution-BaB-jj-9.mjs";
|
|
3
|
+
export { type AggRecordArgs, AggregateCommand, type AnyMongoCommand, DeleteManyCommand, type DeleteManyResult, DeleteOneCommand, type DeleteOneResult, type DeleteResult, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, type InsertManyResult, InsertOneCommand, type InsertOneResult, MongoAddFieldsStage, MongoAggAccumulator, MongoAggArrayFilter, MongoAggCond, type MongoAggExpr, type MongoAggExprRewriter, type MongoAggExprVisitor, MongoAggFieldRef, MongoAggLet, MongoAggLiteral, MongoAggMap, MongoAggMergeObjects, MongoAggOperator, MongoAggReduce, MongoAggSwitch, type MongoAggSwitchBranch, MongoAndExpr, MongoBucketAutoStage, MongoBucketStage, type MongoCodecLookup, MongoCountStage, type MongoDensifyRange, MongoDensifyStage, type MongoExecutionContext, MongoExistsExpr, MongoExprFilter, MongoFacetStage, MongoFieldFilter, type MongoFieldShape, type MongoFillOutput, MongoFillStage, type MongoFilterExpr, type MongoFilterRewriter, type MongoFilterVisitor, MongoGeoNearStage, MongoGraphLookupStage, type MongoGroupId, MongoGroupStage, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoMergeStage, MongoNotExpr, MongoOrExpr, MongoOutStage, type MongoPipelineStage, type MongoPreparable, MongoProjectStage, type MongoProjectionValue, type MongoQueryExecutor, type MongoQueryPlan, MongoRedactStage, MongoReplaceRootStage, type MongoResultShape, MongoSampleStage, MongoSearchMetaStage, MongoSearchStage, MongoSetWindowFieldsStage, MongoSkipStage, MongoSortByCountStage, MongoSortStage, type MongoStageRewriterContext, type MongoStageVisitor, MongoUnionWithStage, MongoUnwindStage, type MongoUpdatePipelineStage, type MongoUpdateSpec, MongoVectorSearchStage, type MongoWindowField, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, type RawMongoCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, type UpdateManyResult, UpdateOneCommand, type UpdateOneResult, type UpdateResult, enumMemberCodecFor, freezeMongoFieldShape, freezeMongoResultShape, isExprArray, isMongoFilterExpr, isRecordArgs };
|