@prisma/orm-family-mongo 8.0.0-rc.18-dev.23 → 8.0.0-rc.18-dev.25
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/orm.d.mts +9 -2
- package/dist/orm.d.mts.map +1 -1
- package/dist/orm.mjs +18 -2
- package/dist/orm.mjs.map +1 -1
- package/package.json +20 -20
package/dist/orm.d.mts
CHANGED
|
@@ -169,7 +169,14 @@ type MongoWhereFilter<TContract extends MongoContractWithTypeMaps<MongoContract,
|
|
|
169
169
|
readonly kind: 'scalar';
|
|
170
170
|
readonly codecId: infer CId extends string & keyof TCodecTypes;
|
|
171
171
|
};
|
|
172
|
-
} ? TCodecTypes[CId]['output'] : unknown; };
|
|
172
|
+
} ? WhereScalarValue<MongoModelsMap<TContract>[ModelName]['fields'][K], TCodecTypes[CId]['output']> : unknown; };
|
|
173
|
+
type WhereScalarValue<Field, Element> = (Field extends {
|
|
174
|
+
readonly many: {
|
|
175
|
+
readonly elementNullable: infer ElementNullable;
|
|
176
|
+
};
|
|
177
|
+
} ? Element | readonly (ElementNullable extends true ? Element | null : Element)[] : Element) | (Field extends {
|
|
178
|
+
readonly nullable: true;
|
|
179
|
+
} ? null : never);
|
|
173
180
|
type MongoIncludeSpec<TContract extends MongoContract, ModelName extends string & keyof MongoModelsMap<TContract>> = { readonly [K in ReferenceRelationKeys<TContract, ModelName>]?: true; };
|
|
174
181
|
type NoIncludes = Pick<Record<string, boolean>, never>;
|
|
175
182
|
type IncludedRow<TContract extends MongoContractWithTypeMaps<MongoContract, AnyMongoTypeMaps>, ModelName extends string & keyof MongoModelsMap<TContract>, TIncludes extends MongoIncludeSpec<TContract, ModelName> = NoIncludes> = InferRootRow<TContract, ModelName> & IncludeResultFields<TContract, ModelName, TIncludes>;
|
|
@@ -230,7 +237,7 @@ interface MongoCollection<TContract extends MongoContractWithTypeMaps<MongoContr
|
|
|
230
237
|
* a collection that already has a variant selected refuses it.
|
|
231
238
|
*/
|
|
232
239
|
variant<V extends DiscriminatorValues<TContract, ModelName>>(this: VariantSelectable<TVariantValue>, value: V): MongoCollection<TContract, ModelName, TIncludes, V>;
|
|
233
|
-
/** Appends equality filters from a plain object. Values are encoded through codecs. */
|
|
240
|
+
/** Appends equality filters from a plain object. Values are encoded through codecs. On a list field, one element matches lists containing it, a whole list matches exactly, and `null` matches a null or missing field. */
|
|
234
241
|
where(filter: MongoWhereFilter<TContract, ModelName>): MongoCollection<TContract, ModelName, TIncludes, TVariantValue>;
|
|
235
242
|
/** Appends a filter condition from a raw filter expression. Comparison and `$in`/`$nin` values on a scalar field are encoded through the field's codec. */
|
|
236
243
|
where(filter: MongoFilterExpr): MongoCollection<TContract, ModelName, TIncludes, TVariantValue>;
|
package/dist/orm.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orm.d.mts","names":[],"sources":["../../../../2-mongo-family/5-query-builders/orm/dist/index.d.mts"],"mappings":";;;;;;;;;;;;UASU;EACR,MAAM,KAAK,MAAM,eAAiB,OAAO,oBAAoB;EAC7D,QAAQ,MAAM,iBAAmB,QAAQ;;;;KAItC;UACK;WACC,UAAU;WACV;WACA,OAAO;;KAEb,gBAAgB,kBAAkB,eAAe,iCAAiC,eAAe,iBAAiB,WAAW,eAAe,WAAW,gCAAgC,eAAe,WAAW,qBAAqB;WAChO;aACE;;IAET,mBAAmB,eAAe,WAAW;KAC5C,qBAAqB,kBAAkB,eAAe,iCAAiC,eAAe,iBAAiB,WAAW,eAAe,WAAW,gCAAgC,eAAe,WAAW,qBAAqB;WACrO;aACE;aACA;;IAET,mBAAmB,eAAe,WAAW;KAC5C,cAAc,kBAAkB,0BAA0B,eAAe,mBAAmB,4BAA4B,wBAAwB,4BAA4B,aAAa,4BAA4B,WAAW,aAAa;KAC7O,iBAAiB,kBAAkB,0BAA0B,eAAe,mBAAmB,iCAAiC,eAAe,YAAY,oBAAoB,gBAAgB,cAAc,WAAW,aAAa,cAAc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object.hasOwn(fields, field)) fields[field] = MongoAggCond.of(inserting, MongoAggLiteral.of(value), MongoAggFieldRef.of(field));
|
|
243
243
|
return [new MongoAddFieldsStage(fields)];
|
|
244
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* 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.
|
|
247
|
+
*/
|
|
248
|
+
function whereEquality(path, field, value) {
|
|
249
|
+
if (field?.many) {
|
|
250
|
+
if (value === null) return notAnArray(path);
|
|
251
|
+
if (!Array.isArray(value)) return holdsItem(path, value);
|
|
252
|
+
}
|
|
253
|
+
return MongoFieldFilter.eq(path, value);
|
|
254
|
+
}
|
|
255
|
+
function notAnArray(path) {
|
|
256
|
+
return MongoFieldFilter.of(path, "$not", { $type: "array" });
|
|
257
|
+
}
|
|
258
|
+
function holdsItem(path, item) {
|
|
259
|
+
return MongoFieldFilter.of(path, "$elemMatch", { $eq: item });
|
|
260
|
+
}
|
|
245
261
|
const COMPARISON_OPERATORS = /* @__PURE__ */ new Set([
|
|
246
262
|
"$eq",
|
|
247
263
|
"$ne",
|
|
@@ -627,8 +643,8 @@ var MongoCollectionImpl = class MongoCollectionImpl {
|
|
|
627
643
|
const filters = [];
|
|
628
644
|
for (const [key, value] of Object.entries(data)) {
|
|
629
645
|
if (value === void 0) continue;
|
|
630
|
-
const
|
|
631
|
-
filters.push(
|
|
646
|
+
const field = fields[key];
|
|
647
|
+
filters.push(whereEquality(key, field, this.#wrapFieldValue(value, field, key, "filter")));
|
|
632
648
|
}
|
|
633
649
|
return filters;
|
|
634
650
|
}
|
package/dist/orm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orm.mjs","names":["#contract","#modelName","#executor","#mutationDefaults","#enums","#collectionName","#state","#variantValue","#cloneWithVariant","#encodeFieldFilter","#clone","#compileWhereObject","#query","#rejectIncludes","#withCreateDefaults","#injectDiscriminator","#stripUndefined","#toDocument","#drainPlan","#insertOneResultShape","#insertManyResultShape","#requireFilters","#rejectWindowing","#mergeFilters","#withUpdateDefaults","#resolveUpdateDoc","#modelResultShape","#readMatchingIds","#executePlan","#wrapFieldOpValue","#toSetFields","#upsertCommand","#compile","#modelWithVariantFields","#valueObjects","#planMeta","#wrapCommand","#modelFields","#idFieldShape","#documentShape","#wrapFieldValue","#fieldAtPath","#nullParam","#assertEnumValues","#scalarParam","#wrapValueObject","#fieldParam","#appliedDefaults","#toUpdateDocument"],"sources":["../../../../2-mongo-family/5-query-builders/orm/dist/index.mjs"],"sourcesContent":["import { domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace } from \"@internal/contract/types\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { AsyncIterableResult, runtimeError } from \"@internal/framework-components/runtime\";\nimport { AggregateCommand, DeleteManyCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, InsertOneCommand, MongoAddFieldsStage, MongoAggArrayFilter, MongoAggCond, MongoAggFieldRef, MongoAggLiteral, MongoAggMap, MongoAggOperator, MongoAndExpr, MongoFieldFilter, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoProjectStage, MongoSkipStage, MongoSortStage, MongoUnwindStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, freezeMongoResultShape, isMongoFilterExpr } from \"@internal/mongo-query-ast/execution\";\nimport { contractFieldToMongoFieldShape, contractModelToMongoResultShape } from \"@internal/mongo-query-builder\";\nimport { MongoParamRef } from \"@internal/mongo-value\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\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, valueObjects) {\n\tconst target = contractModelToMongoResultShape(include.targetModel, { valueObjects });\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, valueObjects) {\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, valueObjects)])),\n\t\t\tvalueObjects\n\t\t})\n\t};\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: new MongoParamRef(value)\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: new MongoParamRef(\"\")\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: new MongoParamRef(value)\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: new MongoParamRef(value)\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: new MongoParamRef(value)\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: new MongoParamRef(match)\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: new MongoParamRef(value)\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: new MongoParamRef(end)\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) {\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[op.field] = wrapValue(op.field, op.value, op.operator);\n\t}\n\treturn grouped;\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/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/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 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}\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}\nvar MongoCollectionImpl = class MongoCollectionImpl {\n\t#contract;\n\t#modelName;\n\t#executor;\n\t#mutationDefaults;\n\t#enums;\n\t#collectionName;\n\t#state;\n\t#variantValue;\n\tconstructor(contract, modelName, executor, mutationDefaults, enums) {\n\t\tthis.#contract = contract;\n\t\tthis.#modelName = modelName;\n\t\tthis.#executor = executor;\n\t\tthis.#mutationDefaults = mutationDefaults;\n\t\tthis.#enums = enums;\n\t\tconst model = blindCast(domainModelsAtDefaultNamespace(contract.domain)[modelName]);\n\t\tthis.#collectionName = resolveCollectionName(model, modelName);\n\t\tthis.#state = emptyCollectionState();\n\t}\n\tvariant(value) {\n\t\tconst model = blindCast(domainModelsAtDefaultNamespace(this.#contract.domain)[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(discriminator.field, new MongoParamRef(value));\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({ field: (fieldFilter) => this.#encodeFieldFilter(fieldFilter) });\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\treturn this.#clone({ selectedFields: [...this.#state.selectedFields ?? [], ...fields] });\n\t}\n\tinclude(relationName) {\n\t\tconst relation = blindCast(domainModelsAtDefaultNamespace(this.#contract.domain)[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 = castAs(domainModelsAtDefaultNamespace(this.#contract.domain)[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\ttargetModel,\n\t\t\tfrom: resolveCollectionName(targetModel, targetModelName),\n\t\t\tlocalField,\n\t\t\tforeignField,\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 merged = {\n\t\t\t...this.#state.orderBy,\n\t\t\t...spec\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\treturn blindCast(blindCast((await this.#drainPlan(command, this.#insertOneResultShape()))[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(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(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) => new MongoParamRef(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(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\tif (ops.find((op) => op.field === \"_id\")) throw ormError(\"ORM.FIELD_IMMUTABLE\", \"Mutation payloads cannot modify `_id`\", { meta: { field: \"_id\" } });\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));\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 generatedSetByCreate = Object.keys(withUpdateDefaults[\"$set\"] ?? {}).filter((field) => !explicitUpdateFields.has(field) && Object.hasOwn(explicitCreate, field));\n\t\tif (generatedSetByCreate.length === 0) return this.#upsertCommand(filter, withUpdateDefaults, allCreateFields);\n\t\treturn blindCast((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()))[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\treturn blindCast((await this.#drainPlan(command, this.#modelResultShape()))[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\treturn this.#executor.query(plan);\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.#valueObjects());\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 = domainModelsAtDefaultNamespace(this.#contract.domain);\n\t\tconst model = blindCast(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 = blindCast(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};\n\t}\n\t#idFieldShape() {\n\t\tconst idField = this.#modelFields()[\"_id\"];\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, { valueObjects: this.#valueObjects() });\n\t}\n\t#valueObjects() {\n\t\treturn domainValueObjectsAtDefaultNamespace(this.#contract.domain) ?? {};\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 wrapped = this.#wrapFieldValue(value, fields[key], key, \"filter\");\n\t\t\tfilters.push(MongoFieldFilter.eq(key, wrapped));\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 field = this.#fieldAtPath(filter.field);\n\t\tif (field?.type.kind !== \"scalar\") return filter;\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(filter.field, 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]) ? filter : MongoFieldFilter.of(filter.field, filter.op, encoded);\n\t\t}\n\t\treturn filter;\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?.type.kind !== \"valueObject\") return void 0;\n\t\t\tfield = domainValueObjectsAtDefaultNamespace(this.#contract.domain)?.[field.type.name]?.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 new MongoParamRef(value);\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 voName = field.type.name;\n\t\t\tconst voDef = domainValueObjectsAtDefaultNamespace(this.#contract.domain)?.[voName];\n\t\t\tif (!voDef) return new MongoParamRef(value);\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 new MongoParamRef(value);\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\tif (contractEnum === void 0) return;\n\t\tconst accessor = this.#enums[valueSet.namespaceId]?.[valueSet.entityName];\n\t\tif (accessor === void 0) throw ormError(\"ORM.ARGUMENT_INVALID\", `The ORM has no accessor for enum ${valueSet.entityName}, so it cannot check the value written to ${path} in collection '${this.#collectionName}'. Pass the contract's enum accessors: enums: buildMongoEnums(contract, context.codecs).`, { meta: {\n\t\t\targument: \"enums\",\n\t\t\tenum: valueSet.entityName\n\t\t} });\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 new MongoParamRef(value);\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 new MongoParamRef(value, {\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 doc = {};\n\t\tfor (const [key, value] of Object.entries(data)) if (value !== void 0) doc[key] = this.#wrapFieldValue(value, fields[key], key, \"write\");\n\t\treturn doc;\n\t}\n\t#toSetFields(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst result = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (key === \"_id\" && value !== void 0) throw ormError(\"ORM.FIELD_IMMUTABLE\", \"Mutation payloads cannot modify `_id`\", { meta: { field: \"_id\" } });\n\t\t\tif (value !== void 0) result[key] = this.#wrapFieldValue(value, fields[key], key, \"write\");\n\t\t}\n\t\treturn result;\n\t}\n\t#appliedDefaults(op, values, 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,\n\t\t\tdefaultValueCache\n\t\t}) ?? [];\n\t\treturn Object.fromEntries(applied.map(({ field, value }) => [field, value]));\n\t}\n\t#withCreateDefaults(values, defaultValueCache) {\n\t\treturn {\n\t\t\t...values,\n\t\t\t...this.#appliedDefaults(\"create\", 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\tif (ops.find((op) => op.field === \"_id\")) throw ormError(\"ORM.FIELD_IMMUTABLE\", \"Mutation payloads cannot modify `_id`\", { meta: { field: \"_id\" } });\n\t\t\tif (ops.length === 0) return { $set: {} };\n\t\t\treturn compileFieldOperations(ops, (field, value, operator) => this.#wrapFieldOpValue(field, value, operator));\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 = domainValueObjectsAtDefaultNamespace(this.#contract.domain)?.[field.type.name];\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 = blindCast(domainModelsAtDefaultNamespace(this.#contract.domain)[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.#contract, this.#modelName, this.#executor, this.#mutationDefaults, 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.#contract, this.#modelName, this.#executor, this.#mutationDefaults, 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};\nfunction createMongoCollection(contract, modelName, executor, enums, mutationDefaults) {\n\treturn new MongoCollectionImpl(contract, modelName, executor, mutationDefaults, enums);\n}\n//#endregion\n//#region src/mongo-orm.ts\nfunction assertEnumsComplete(contract, enums) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst accessors = enums[namespaceId] ?? {};\n\t\tfor (const enumName of Object.keys(namespace.enum ?? {})) {\n\t\t\tif (enumName in accessors) continue;\n\t\t\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `mongoOrm() has no accessor for enum ${enumName} in namespace ${namespaceId}, so it cannot check a value written to a field of that enum. Pass the contract's enum accessors: enums: buildMongoEnums(contract, context.codecs).`, { meta: {\n\t\t\t\targument: \"enums\",\n\t\t\t\tnamespace: namespaceId,\n\t\t\t\tenum: enumName\n\t\t\t} });\n\t\t}\n\t}\n}\nfunction mongoOrm(options) {\n\tconst { contract, executor, mutationDefaults, enums } = options;\n\tconst executionDefaults = contract.execution?.mutations.defaults ?? [];\n\tif (executionDefaults.length > 0 && mutationDefaults === void 0) throw ormError(\"ORM.MUTATION_DEFAULTS_MISSING\", \"The contract has execution defaults (fields such as temporal.createdAt() that the ORM fills on write), but mongoOrm() was built without mutationDefaults, so those fields would never be written. Pass the execution context: mongoOrm({ contract, executor, mutationDefaults: context }), or create the client with mongo().\", { meta: { fields: executionDefaults.map((d) => `${d.ref.entry}.${d.ref.field}`) } });\n\tassertEnumsComplete(contract, enums);\n\tconst client = {};\n\tfor (const [rootName, rootRef] of Object.entries(contract.roots)) client[rootName] = createMongoCollection(contract, blindCast(rootRef.model), executor, enums, mutationDefaults);\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;\n\treturn { collection(rootName) {\n\t\tconst modelName = contract.roots[rootName]?.model;\n\t\tconst models = domainModelsAtDefaultNamespace(contract.domain);\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":";;;;;;;;;;;;AAWA,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,gBAAgB;AACjE;;;;AAIA,SAAS,aAAa,SAAS,cAAc;CAC5C,MAAM,SAAS,gCAAgC,QAAQ,aAAa,EAAE,aAAa,CAAC;CACpF,MAAM,SAAS,OAAO,SAAS,aAAa,OAAO,SAAS,CAAC;CAC7D,OAAO,QAAQ,OAAO,IAAI;EACzB,MAAM;EACN,UAAU;EACV;CACD,IAAI;EACH,MAAM;EACN,UAAU;EACV,SAAS;GACR,MAAM;GACN,UAAU;GACV;EACD;CACD;AACD;AACA,SAAS,gBAAgB,UAAU;CAClC,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,UAAU;EAC3B,OAAO,KAAK,IAAI,iBAAiB;GAChC,MAAM,IAAI;GACV,YAAY,IAAI;GAChB,cAAc,IAAI;GAClB,IAAI,IAAI;EACT,CAAC,CAAC;EACF,IAAI,QAAQ,GAAG,GAAG,OAAO,KAAK,IAAI,iBAAiB,IAAI,IAAI,gBAAgB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qBAAqB,gBAAgB,SAAS,CAAC;EACrE;EACA,UAAU,QAAQ,QAAQ;GACzB,OAAO,UAAU,IAAI,oBAAoB,gBAAgB,QAAQ,MAAM,CAAC;EACzE;EACA,WAAW,QAAQ,QAAQ;GAC1B,OAAO,UAAU,IAAI,qBAAqB,gBAAgB,QAAQ,MAAM,CAAC;EAC1E;EACA,UAAU,QAAQ;GACjB,OAAO,UAAU,IAAI,oBAAoB,gBAAgB,MAAM,CAAC;EACjE;EACA,WAAW,QAAQ;GAClB,OAAO,UAAU,IAAI,qBAAqB,gBAAgB,MAAM,CAAC;EAClE;EACA,iBAAiB,QAAQ,QAAQ,SAAS;GACzC,OAAO,UAAU,IAAI,2BAA2B,gBAAgB,QAAQ,QAAQ,SAAS,UAAU,KAAK,CAAC;EAC1G;EACA,iBAAiB,QAAQ;GACxB,OAAO,UAAU,IAAI,2BAA2B,gBAAgB,MAAM,CAAC;EACxE;CACD;AACD;AAGA,SAAS,SAAS,SAAS;CAC1B,MAAM,EAAE,aAAa;CACrB,OAAO,EAAE,WAAW,UAAU;EAC7B,MAAM,YAAY,SAAS,MAAM,SAAS,EAAE;EAC5C,MAAM,SAAS,+BAA+B,SAAS,MAAM;EAC7D,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,CAAC,QAAQ,cAAc,WAAW;GAClF,QAAQ;GACR,aAAa,SAAS,QAAQ;GAC9B,MAAM;EACP,CAAC;CACF,EAAE;AACH"}
|
|
1
|
+
{"version":3,"file":"orm.mjs","names":["#contract","#modelName","#executor","#mutationDefaults","#enums","#collectionName","#state","#variantValue","#cloneWithVariant","#encodeFieldFilter","#clone","#compileWhereObject","#query","#rejectIncludes","#withCreateDefaults","#injectDiscriminator","#stripUndefined","#toDocument","#drainPlan","#insertOneResultShape","#insertManyResultShape","#requireFilters","#rejectWindowing","#mergeFilters","#withUpdateDefaults","#resolveUpdateDoc","#modelResultShape","#readMatchingIds","#executePlan","#wrapFieldOpValue","#toSetFields","#upsertCommand","#compile","#modelWithVariantFields","#valueObjects","#planMeta","#wrapCommand","#modelFields","#idFieldShape","#documentShape","#wrapFieldValue","#fieldAtPath","#nullParam","#assertEnumValues","#scalarParam","#wrapValueObject","#fieldParam","#appliedDefaults","#toUpdateDocument"],"sources":["../../../../2-mongo-family/5-query-builders/orm/dist/index.mjs"],"sourcesContent":["import { domainModelsAtDefaultNamespace, domainValueObjectsAtDefaultNamespace } from \"@internal/contract/types\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { AsyncIterableResult, runtimeError } from \"@internal/framework-components/runtime\";\nimport { AggregateCommand, DeleteManyCommand, FindOneAndDeleteCommand, FindOneAndUpdateCommand, InsertManyCommand, InsertOneCommand, MongoAddFieldsStage, MongoAggArrayFilter, MongoAggCond, MongoAggFieldRef, MongoAggLiteral, MongoAggMap, MongoAggOperator, MongoAndExpr, MongoFieldFilter, MongoLimitStage, MongoLookupStage, MongoMatchStage, MongoProjectStage, MongoSkipStage, MongoSortStage, MongoUnwindStage, RawAggregateCommand, RawDeleteManyCommand, RawDeleteOneCommand, RawFindOneAndDeleteCommand, RawFindOneAndUpdateCommand, RawInsertManyCommand, RawInsertOneCommand, RawUpdateManyCommand, RawUpdateOneCommand, UpdateManyCommand, freezeMongoResultShape, isMongoFilterExpr } from \"@internal/mongo-query-ast/execution\";\nimport { contractFieldToMongoFieldShape, contractModelToMongoResultShape } from \"@internal/mongo-query-builder\";\nimport { MongoParamRef } from \"@internal/mongo-value\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\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, valueObjects) {\n\tconst target = contractModelToMongoResultShape(include.targetModel, { valueObjects });\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, valueObjects) {\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, valueObjects)])),\n\t\t\tvalueObjects\n\t\t})\n\t};\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: new MongoParamRef(value)\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: new MongoParamRef(\"\")\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: new MongoParamRef(value)\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: new MongoParamRef(value)\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: new MongoParamRef(value)\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: new MongoParamRef(match)\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: new MongoParamRef(value)\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: new MongoParamRef(end)\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) {\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[op.field] = wrapValue(op.field, op.value, op.operator);\n\t}\n\treturn grouped;\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/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 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}\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}\nvar MongoCollectionImpl = class MongoCollectionImpl {\n\t#contract;\n\t#modelName;\n\t#executor;\n\t#mutationDefaults;\n\t#enums;\n\t#collectionName;\n\t#state;\n\t#variantValue;\n\tconstructor(contract, modelName, executor, mutationDefaults, enums) {\n\t\tthis.#contract = contract;\n\t\tthis.#modelName = modelName;\n\t\tthis.#executor = executor;\n\t\tthis.#mutationDefaults = mutationDefaults;\n\t\tthis.#enums = enums;\n\t\tconst model = blindCast(domainModelsAtDefaultNamespace(contract.domain)[modelName]);\n\t\tthis.#collectionName = resolveCollectionName(model, modelName);\n\t\tthis.#state = emptyCollectionState();\n\t}\n\tvariant(value) {\n\t\tconst model = blindCast(domainModelsAtDefaultNamespace(this.#contract.domain)[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(discriminator.field, new MongoParamRef(value));\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({ field: (fieldFilter) => this.#encodeFieldFilter(fieldFilter) });\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\treturn this.#clone({ selectedFields: [...this.#state.selectedFields ?? [], ...fields] });\n\t}\n\tinclude(relationName) {\n\t\tconst relation = blindCast(domainModelsAtDefaultNamespace(this.#contract.domain)[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 = castAs(domainModelsAtDefaultNamespace(this.#contract.domain)[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\ttargetModel,\n\t\t\tfrom: resolveCollectionName(targetModel, targetModelName),\n\t\t\tlocalField,\n\t\t\tforeignField,\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 merged = {\n\t\t\t...this.#state.orderBy,\n\t\t\t...spec\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\treturn blindCast(blindCast((await this.#drainPlan(command, this.#insertOneResultShape()))[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(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(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) => new MongoParamRef(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(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\tif (ops.find((op) => op.field === \"_id\")) throw ormError(\"ORM.FIELD_IMMUTABLE\", \"Mutation payloads cannot modify `_id`\", { meta: { field: \"_id\" } });\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));\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 generatedSetByCreate = Object.keys(withUpdateDefaults[\"$set\"] ?? {}).filter((field) => !explicitUpdateFields.has(field) && Object.hasOwn(explicitCreate, field));\n\t\tif (generatedSetByCreate.length === 0) return this.#upsertCommand(filter, withUpdateDefaults, allCreateFields);\n\t\treturn blindCast((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()))[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\treturn blindCast((await this.#drainPlan(command, this.#modelResultShape()))[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\treturn this.#executor.query(plan);\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.#valueObjects());\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 = domainModelsAtDefaultNamespace(this.#contract.domain);\n\t\tconst model = blindCast(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 = blindCast(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};\n\t}\n\t#idFieldShape() {\n\t\tconst idField = this.#modelFields()[\"_id\"];\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, { valueObjects: this.#valueObjects() });\n\t}\n\t#valueObjects() {\n\t\treturn domainValueObjectsAtDefaultNamespace(this.#contract.domain) ?? {};\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 field = fields[key];\n\t\t\tfilters.push(whereEquality(key, 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 field = this.#fieldAtPath(filter.field);\n\t\tif (field?.type.kind !== \"scalar\") return filter;\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(filter.field, 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]) ? filter : MongoFieldFilter.of(filter.field, filter.op, encoded);\n\t\t}\n\t\treturn filter;\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?.type.kind !== \"valueObject\") return void 0;\n\t\t\tfield = domainValueObjectsAtDefaultNamespace(this.#contract.domain)?.[field.type.name]?.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 new MongoParamRef(value);\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 voName = field.type.name;\n\t\t\tconst voDef = domainValueObjectsAtDefaultNamespace(this.#contract.domain)?.[voName];\n\t\t\tif (!voDef) return new MongoParamRef(value);\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 new MongoParamRef(value);\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\tif (contractEnum === void 0) return;\n\t\tconst accessor = this.#enums[valueSet.namespaceId]?.[valueSet.entityName];\n\t\tif (accessor === void 0) throw ormError(\"ORM.ARGUMENT_INVALID\", `The ORM has no accessor for enum ${valueSet.entityName}, so it cannot check the value written to ${path} in collection '${this.#collectionName}'. Pass the contract's enum accessors: enums: buildMongoEnums(contract, context.codecs).`, { meta: {\n\t\t\targument: \"enums\",\n\t\t\tenum: valueSet.entityName\n\t\t} });\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 new MongoParamRef(value);\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 new MongoParamRef(value, {\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 doc = {};\n\t\tfor (const [key, value] of Object.entries(data)) if (value !== void 0) doc[key] = this.#wrapFieldValue(value, fields[key], key, \"write\");\n\t\treturn doc;\n\t}\n\t#toSetFields(data) {\n\t\tconst fields = this.#modelFields();\n\t\tconst result = {};\n\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\tif (key === \"_id\" && value !== void 0) throw ormError(\"ORM.FIELD_IMMUTABLE\", \"Mutation payloads cannot modify `_id`\", { meta: { field: \"_id\" } });\n\t\t\tif (value !== void 0) result[key] = this.#wrapFieldValue(value, fields[key], key, \"write\");\n\t\t}\n\t\treturn result;\n\t}\n\t#appliedDefaults(op, values, 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,\n\t\t\tdefaultValueCache\n\t\t}) ?? [];\n\t\treturn Object.fromEntries(applied.map(({ field, value }) => [field, value]));\n\t}\n\t#withCreateDefaults(values, defaultValueCache) {\n\t\treturn {\n\t\t\t...values,\n\t\t\t...this.#appliedDefaults(\"create\", 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\tif (ops.find((op) => op.field === \"_id\")) throw ormError(\"ORM.FIELD_IMMUTABLE\", \"Mutation payloads cannot modify `_id`\", { meta: { field: \"_id\" } });\n\t\t\tif (ops.length === 0) return { $set: {} };\n\t\t\treturn compileFieldOperations(ops, (field, value, operator) => this.#wrapFieldOpValue(field, value, operator));\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 = domainValueObjectsAtDefaultNamespace(this.#contract.domain)?.[field.type.name];\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 = blindCast(domainModelsAtDefaultNamespace(this.#contract.domain)[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.#contract, this.#modelName, this.#executor, this.#mutationDefaults, 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.#contract, this.#modelName, this.#executor, this.#mutationDefaults, 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};\nfunction createMongoCollection(contract, modelName, executor, enums, mutationDefaults) {\n\treturn new MongoCollectionImpl(contract, modelName, executor, mutationDefaults, enums);\n}\n//#endregion\n//#region src/mongo-orm.ts\nfunction assertEnumsComplete(contract, enums) {\n\tfor (const [namespaceId, namespace] of Object.entries(contract.domain.namespaces)) {\n\t\tconst accessors = enums[namespaceId] ?? {};\n\t\tfor (const enumName of Object.keys(namespace.enum ?? {})) {\n\t\t\tif (enumName in accessors) continue;\n\t\t\tthrow ormError(\"ORM.ARGUMENT_INVALID\", `mongoOrm() has no accessor for enum ${enumName} in namespace ${namespaceId}, so it cannot check a value written to a field of that enum. Pass the contract's enum accessors: enums: buildMongoEnums(contract, context.codecs).`, { meta: {\n\t\t\t\targument: \"enums\",\n\t\t\t\tnamespace: namespaceId,\n\t\t\t\tenum: enumName\n\t\t\t} });\n\t\t}\n\t}\n}\nfunction mongoOrm(options) {\n\tconst { contract, executor, mutationDefaults, enums } = options;\n\tconst executionDefaults = contract.execution?.mutations.defaults ?? [];\n\tif (executionDefaults.length > 0 && mutationDefaults === void 0) throw ormError(\"ORM.MUTATION_DEFAULTS_MISSING\", \"The contract has execution defaults (fields such as temporal.createdAt() that the ORM fills on write), but mongoOrm() was built without mutationDefaults, so those fields would never be written. Pass the execution context: mongoOrm({ contract, executor, mutationDefaults: context }), or create the client with mongo().\", { meta: { fields: executionDefaults.map((d) => `${d.ref.entry}.${d.ref.field}`) } });\n\tassertEnumsComplete(contract, enums);\n\tconst client = {};\n\tfor (const [rootName, rootRef] of Object.entries(contract.roots)) client[rootName] = createMongoCollection(contract, blindCast(rootRef.model), executor, enums, mutationDefaults);\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;\n\treturn { collection(rootName) {\n\t\tconst modelName = contract.roots[rootName]?.model;\n\t\tconst models = domainModelsAtDefaultNamespace(contract.domain);\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":";;;;;;;;;;;;AAWA,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,gBAAgB;AACjE;;;;AAIA,SAAS,aAAa,SAAS,cAAc;CAC5C,MAAM,SAAS,gCAAgC,QAAQ,aAAa,EAAE,aAAa,CAAC;CACpF,MAAM,SAAS,OAAO,SAAS,aAAa,OAAO,SAAS,CAAC;CAC7D,OAAO,QAAQ,OAAO,IAAI;EACzB,MA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BAA2B,gBAAgB,QAAQ,QAAQ,SAAS,UAAU,KAAK,CAAC;EAC1G;EACA,iBAAiB,QAAQ;GACxB,OAAO,UAAU,IAAI,2BAA2B,gBAAgB,MAAM,CAAC;EACxE;CACD;AACD;AAGA,SAAS,SAAS,SAAS;CAC1B,MAAM,EAAE,aAAa;CACrB,OAAO,EAAE,WAAW,UAAU;EAC7B,MAAM,YAAY,SAAS,MAAM,SAAS,EAAE;EAC5C,MAAM,SAAS,+BAA+B,SAAS,MAAM;EAC7D,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,CAAC,QAAQ,cAAc,WAAW;GAClF,QAAQ;GACR,aAAa,SAAS,QAAQ;GAC9B,MAAM;EACP,CAAC;CACF,EAAE;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-family-mongo",
|
|
3
|
-
"version": "8.0.0-rc.18-dev.
|
|
3
|
+
"version": "8.0.0-rc.18-dev.25",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -9,30 +9,30 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.18-dev.
|
|
13
|
-
"@prisma/orm-toolchain": "8.0.0-rc.18-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.18-dev.25",
|
|
13
|
+
"@prisma/orm-toolchain": "8.0.0-rc.18-dev.25",
|
|
14
14
|
"arktype": "^2.2.2",
|
|
15
15
|
"mongodb": "^7.4.0",
|
|
16
16
|
"pathe": "^2.0.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@internal/family-mongo": "8.0.0-rc.18-dev.
|
|
20
|
-
"@internal/mongo-codec": "8.0.0-rc.18-dev.
|
|
21
|
-
"@internal/mongo-contract": "8.0.0-rc.18-dev.
|
|
22
|
-
"@internal/mongo-contract-prisma6": "8.0.0-rc.18-dev.
|
|
23
|
-
"@internal/mongo-contract-psl": "8.0.0-rc.18-dev.
|
|
24
|
-
"@internal/mongo-contract-ts": "8.0.0-rc.18-dev.
|
|
25
|
-
"@internal/mongo-emitter": "8.0.0-rc.18-dev.
|
|
26
|
-
"@internal/mongo-lowering": "8.0.0-rc.18-dev.
|
|
27
|
-
"@internal/mongo-orm": "8.0.0-rc.18-dev.
|
|
28
|
-
"@internal/mongo-query-ast": "8.0.0-rc.18-dev.
|
|
29
|
-
"@internal/mongo-query-builder": "8.0.0-rc.18-dev.
|
|
30
|
-
"@internal/mongo-runtime": "8.0.0-rc.18-dev.
|
|
31
|
-
"@internal/mongo-schema-ir": "8.0.0-rc.18-dev.
|
|
32
|
-
"@internal/mongo-value": "8.0.0-rc.18-dev.
|
|
33
|
-
"@internal/mongo-wire": "8.0.0-rc.18-dev.
|
|
34
|
-
"@repo/tsconfig": "8.0.0-rc.18-dev.
|
|
35
|
-
"@repo/tsdown": "8.0.0-rc.18-dev.
|
|
19
|
+
"@internal/family-mongo": "8.0.0-rc.18-dev.25",
|
|
20
|
+
"@internal/mongo-codec": "8.0.0-rc.18-dev.25",
|
|
21
|
+
"@internal/mongo-contract": "8.0.0-rc.18-dev.25",
|
|
22
|
+
"@internal/mongo-contract-prisma6": "8.0.0-rc.18-dev.25",
|
|
23
|
+
"@internal/mongo-contract-psl": "8.0.0-rc.18-dev.25",
|
|
24
|
+
"@internal/mongo-contract-ts": "8.0.0-rc.18-dev.25",
|
|
25
|
+
"@internal/mongo-emitter": "8.0.0-rc.18-dev.25",
|
|
26
|
+
"@internal/mongo-lowering": "8.0.0-rc.18-dev.25",
|
|
27
|
+
"@internal/mongo-orm": "8.0.0-rc.18-dev.25",
|
|
28
|
+
"@internal/mongo-query-ast": "8.0.0-rc.18-dev.25",
|
|
29
|
+
"@internal/mongo-query-builder": "8.0.0-rc.18-dev.25",
|
|
30
|
+
"@internal/mongo-runtime": "8.0.0-rc.18-dev.25",
|
|
31
|
+
"@internal/mongo-schema-ir": "8.0.0-rc.18-dev.25",
|
|
32
|
+
"@internal/mongo-value": "8.0.0-rc.18-dev.25",
|
|
33
|
+
"@internal/mongo-wire": "8.0.0-rc.18-dev.25",
|
|
34
|
+
"@repo/tsconfig": "8.0.0-rc.18-dev.25",
|
|
35
|
+
"@repo/tsdown": "8.0.0-rc.18-dev.25",
|
|
36
36
|
"tsdown": "0.22.14",
|
|
37
37
|
"typescript": "5.9.3"
|
|
38
38
|
},
|