@prisma/orm-family-mongo 0.16.0-dev.36
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/LICENSE +201 -0
- package/README.md +27 -0
- package/dist/authoring-entity-types-BGtkMyoN-D32kzx28.mjs +176 -0
- package/dist/authoring-entity-types-BGtkMyoN-D32kzx28.mjs.map +1 -0
- package/dist/canonicalization-hooks-DF3Z6sjO.mjs +22 -0
- package/dist/canonicalization-hooks-DF3Z6sjO.mjs.map +1 -0
- package/dist/codec.d.mts +2 -0
- package/dist/codec.mjs +2 -0
- package/dist/config-types-CFDf9ivE.mjs +37 -0
- package/dist/config-types-CFDf9ivE.mjs.map +1 -0
- package/dist/config-types-CQOf5N7R.d.mts +12 -0
- package/dist/config-types-CQOf5N7R.d.mts.map +1 -0
- package/dist/contract-builder-BFq0gOMV.mjs +634 -0
- package/dist/contract-builder-BFq0gOMV.mjs.map +1 -0
- package/dist/contract-builder-DB8nguDE.d.mts +445 -0
- package/dist/contract-builder-DB8nguDE.d.mts.map +1 -0
- package/dist/contract-errors-BCN6RVI5-kMurtAbI.mjs +9 -0
- package/dist/contract-errors-BCN6RVI5-kMurtAbI.mjs.map +1 -0
- package/dist/contract-psl.d.mts +45 -0
- package/dist/contract-psl.d.mts.map +1 -0
- package/dist/contract-psl.mjs +2 -0
- package/dist/contract-psl__provider.d.mts +15 -0
- package/dist/contract-psl__provider.d.mts.map +1 -0
- package/dist/contract-psl__provider.mjs +82 -0
- package/dist/contract-psl__provider.mjs.map +1 -0
- package/dist/contract-ts.d.mts +3 -0
- package/dist/contract-ts.mjs +3 -0
- package/dist/contract-ts__config-types.d.mts +2 -0
- package/dist/contract-ts__config-types.mjs +2 -0
- package/dist/contract-ts__contract-builder.d.mts +2 -0
- package/dist/contract-ts__contract-builder.mjs +2 -0
- package/dist/contract.d.mts +3 -0
- package/dist/contract.mjs +3 -0
- package/dist/contract__canonicalization-hooks.d.mts +9 -0
- package/dist/contract__canonicalization-hooks.d.mts.map +1 -0
- package/dist/contract__canonicalization-hooks.mjs +2 -0
- package/dist/contract__entity-kinds.d.mts +17 -0
- package/dist/contract__entity-kinds.d.mts.map +1 -0
- package/dist/contract__entity-kinds.mjs +2 -0
- package/dist/control-C7-kthr1.d.mts +193 -0
- package/dist/control-C7-kthr1.d.mts.map +1 -0
- package/dist/control-CClR5JMr.mjs +127 -0
- package/dist/control-CClR5JMr.mjs.map +1 -0
- package/dist/control-CFr3tYsg.mjs +398 -0
- package/dist/control-CFr3tYsg.mjs.map +1 -0
- package/dist/control-Cj81sPbj.d.mts +101 -0
- package/dist/control-Cj81sPbj.d.mts.map +1 -0
- package/dist/control-adapter-Db5pT77b.d.mts +83 -0
- package/dist/control-adapter-Db5pT77b.d.mts.map +1 -0
- package/dist/dist-C7Ykq48Q.mjs +19 -0
- package/dist/dist-C7Ykq48Q.mjs.map +1 -0
- package/dist/dist-Czwqx_i3.mjs +58 -0
- package/dist/dist-Czwqx_i3.mjs.map +1 -0
- package/dist/dist-DHrEJnhK.mjs +236 -0
- package/dist/dist-DHrEJnhK.mjs.map +1 -0
- package/dist/dist-Dyp05u64.mjs +1546 -0
- package/dist/dist-Dyp05u64.mjs.map +1 -0
- package/dist/emitter.d.mts +22 -0
- package/dist/emitter.d.mts.map +1 -0
- package/dist/emitter.mjs +2 -0
- package/dist/entity-kinds-B4KNTF8z-DPIuUuuB.mjs +603 -0
- package/dist/entity-kinds-B4KNTF8z-DPIuUuuB.mjs.map +1 -0
- package/dist/execution-CKnUiOfm.d.mts +48 -0
- package/dist/execution-CKnUiOfm.d.mts.map +1 -0
- package/dist/execution-D5XyZ5XS.mjs +1269 -0
- package/dist/execution-D5XyZ5XS.mjs.map +1 -0
- package/dist/exports-Bx-hlnZ3.mjs +209 -0
- package/dist/exports-Bx-hlnZ3.mjs.map +1 -0
- package/dist/exports-CJMh0VTU.mjs +156 -0
- package/dist/exports-CJMh0VTU.mjs.map +1 -0
- package/dist/family.d.mts +10 -0
- package/dist/family.mjs +9 -0
- package/dist/family__control-adapter.d.mts +2 -0
- package/dist/family__control-adapter.mjs +1 -0
- package/dist/family__control.d.mts +2 -0
- package/dist/family__control.mjs +3 -0
- package/dist/family__ir.d.mts +3 -0
- package/dist/family__ir.mjs +4 -0
- package/dist/family__migration.d.mts +2 -0
- package/dist/family__migration.mjs +2 -0
- package/dist/family__pack.d.mts +2 -0
- package/dist/family__pack.mjs +16 -0
- package/dist/family__pack.mjs.map +1 -0
- package/dist/family__runtime.d.mts +3 -0
- package/dist/family__runtime.mjs +2 -0
- package/dist/family__schema-verify.d.mts +2 -0
- package/dist/family__schema-verify.mjs +2 -0
- package/dist/field-accessor-0oUt6RZC-B_Z30uAA.mjs +234 -0
- package/dist/field-accessor-0oUt6RZC-B_Z30uAA.mjs.map +1 -0
- package/dist/field-accessor-DHsAPiW3-BdYCspQC.d.mts +588 -0
- package/dist/field-accessor-DHsAPiW3-BdYCspQC.d.mts.map +1 -0
- package/dist/filter-expressions-Uo8ZdzwB-53qnqceS.mjs +181 -0
- package/dist/filter-expressions-Uo8ZdzwB-53qnqceS.mjs.map +1 -0
- package/dist/index-BR0ue13b.d.mts +136 -0
- package/dist/index-BR0ue13b.d.mts.map +1 -0
- package/dist/index-Cd2zLiU6.d.mts +128 -0
- package/dist/index-Cd2zLiU6.d.mts.map +1 -0
- package/dist/index-DAOkcTCK.d.mts +151 -0
- package/dist/index-DAOkcTCK.d.mts.map +1 -0
- package/dist/index-Dv2PNMiG.d.mts +53 -0
- package/dist/index-Dv2PNMiG.d.mts.map +1 -0
- package/dist/index-DxoO-ywI.d.mts +178 -0
- package/dist/index-DxoO-ywI.d.mts.map +1 -0
- package/dist/index-wKMm41HC.d.mts +30 -0
- package/dist/index-wKMm41HC.d.mts.map +1 -0
- package/dist/interpreter-BxbUTQ3k-ClR98Ned.mjs +1091 -0
- package/dist/interpreter-BxbUTQ3k-ClR98Ned.mjs.map +1 -0
- package/dist/ir-CQrenTYt.d.mts +147 -0
- package/dist/ir-CQrenTYt.d.mts.map +1 -0
- package/dist/ir-Ch2aPr7a.mjs +62 -0
- package/dist/ir-Ch2aPr7a.mjs.map +1 -0
- package/dist/lowering.d.mts +2 -0
- package/dist/lowering.mjs +1 -0
- package/dist/migration-CNDQv5yB.d.mts +50 -0
- package/dist/migration-CNDQv5yB.d.mts.map +1 -0
- package/dist/migration-dcM7u4HG.mjs +52 -0
- package/dist/migration-dcM7u4HG.mjs.map +1 -0
- package/dist/mongo-contract-serializer-Cx7Fae8e-C8ZYPXpc.mjs +119 -0
- package/dist/mongo-contract-serializer-Cx7Fae8e-C8ZYPXpc.mjs.map +1 -0
- package/dist/mongo-contract-view-AnejqfrQ-BaCFT0xm.d.mts +27 -0
- package/dist/mongo-contract-view-AnejqfrQ-BaCFT0xm.d.mts.map +1 -0
- package/dist/mongo-contract-view-rcWzby6f-wRBCUnBt.mjs +17 -0
- package/dist/mongo-contract-view-rcWzby6f-wRBCUnBt.mjs.map +1 -0
- package/dist/mongo-value-set-tNn9-pun-dJYx_rVD.d.mts +536 -0
- package/dist/mongo-value-set-tNn9-pun-dJYx_rVD.d.mts.map +1 -0
- package/dist/mongodb-types-B4HmhF1S.d.mts +2 -0
- package/dist/orm.d.mts +311 -0
- package/dist/orm.d.mts.map +1 -0
- package/dist/orm.mjs +664 -0
- package/dist/orm.mjs.map +1 -0
- package/dist/pack-D9aLY50F.d.mts +44 -0
- package/dist/pack-D9aLY50F.d.mts.map +1 -0
- package/dist/query-ast.d.mts +5 -0
- package/dist/query-ast.mjs +4 -0
- package/dist/query-ast__control.d.mts +4 -0
- package/dist/query-ast__control.mjs +3 -0
- package/dist/query-ast__execution.d.mts +3 -0
- package/dist/query-ast__execution.mjs +3 -0
- package/dist/query-builder.d.mts +836 -0
- package/dist/query-builder.d.mts.map +1 -0
- package/dist/query-builder.mjs +3 -0
- package/dist/query-builder__contract-free.d.mts +83 -0
- package/dist/query-builder__contract-free.d.mts.map +1 -0
- package/dist/query-builder__contract-free.mjs +107 -0
- package/dist/query-builder__contract-free.mjs.map +1 -0
- package/dist/query-plan-C0-Yu8hf-DdilEdW6.d.mts +822 -0
- package/dist/query-plan-C0-Yu8hf-DdilEdW6.d.mts.map +1 -0
- package/dist/runtime-DPkRW4iu.d.mts +1 -0
- package/dist/runtime.d.mts +286 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +532 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/schema-ir.d.mts +2 -0
- package/dist/schema-ir.mjs +2 -0
- package/dist/schema-verify-DJGr28XW.d.mts +23 -0
- package/dist/schema-verify-DJGr28XW.d.mts.map +1 -0
- package/dist/value.d.mts +2 -0
- package/dist/value.mjs +2 -0
- package/dist/value__mongodb-types.d.mts +2 -0
- package/dist/value__mongodb-types.mjs +1 -0
- package/dist/verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs +447 -0
- package/dist/verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs.map +1 -0
- package/dist/wire.d.mts +3 -0
- package/dist/wire.mjs +190 -0
- package/dist/wire.mjs.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
import { a as MongoSchemaIndex, c as deepEqual, n as MongoSchemaCollectionOptions, o as MongoSchemaValidator, r as MongoSchemaIR, s as canonicalize, t as MongoSchemaCollection } from "./exports-Bx-hlnZ3.mjs";
|
|
2
|
+
import { effectiveControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
3
|
+
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
4
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
5
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
6
|
+
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
7
|
+
import { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from "@prisma/orm-framework/components/control";
|
|
8
|
+
//#region ../../../2-mongo-family/9-family/dist/verify-mongo-schema-De0FG2Rm.mjs
|
|
9
|
+
function convertIndex(index) {
|
|
10
|
+
return new MongoSchemaIndex({
|
|
11
|
+
keys: index.keys,
|
|
12
|
+
unique: index.unique,
|
|
13
|
+
sparse: index.sparse,
|
|
14
|
+
expireAfterSeconds: index.expireAfterSeconds,
|
|
15
|
+
partialFilterExpression: index.partialFilterExpression,
|
|
16
|
+
wildcardProjection: index.wildcardProjection,
|
|
17
|
+
collation: index.collation,
|
|
18
|
+
weights: index.weights,
|
|
19
|
+
default_language: index.default_language,
|
|
20
|
+
language_override: index.language_override
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function convertValidator(v) {
|
|
24
|
+
return new MongoSchemaValidator({
|
|
25
|
+
jsonSchema: v.jsonSchema,
|
|
26
|
+
validationLevel: v.validationLevel,
|
|
27
|
+
validationAction: v.validationAction
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function convertOptions(o) {
|
|
31
|
+
return new MongoSchemaCollectionOptions({
|
|
32
|
+
...ifDefined("capped", o.capped !== void 0 ? {
|
|
33
|
+
size: o.capped.size,
|
|
34
|
+
...ifDefined("max", o.capped.max)
|
|
35
|
+
} : void 0),
|
|
36
|
+
...o.timeseries !== void 0 ? { timeseries: {
|
|
37
|
+
timeField: o.timeseries.timeField,
|
|
38
|
+
...ifDefined("metaField", o.timeseries.metaField),
|
|
39
|
+
...ifDefined("granularity", o.timeseries.granularity)
|
|
40
|
+
} } : {},
|
|
41
|
+
...o.collation !== void 0 ? { collation: {
|
|
42
|
+
locale: o.collation.locale,
|
|
43
|
+
...ifDefined("caseLevel", o.collation.caseLevel),
|
|
44
|
+
...ifDefined("caseFirst", o.collation.caseFirst),
|
|
45
|
+
...ifDefined("strength", o.collation.strength),
|
|
46
|
+
...ifDefined("numericOrdering", o.collation.numericOrdering),
|
|
47
|
+
...ifDefined("alternate", o.collation.alternate),
|
|
48
|
+
...ifDefined("maxVariable", o.collation.maxVariable),
|
|
49
|
+
...ifDefined("backwards", o.collation.backwards),
|
|
50
|
+
...ifDefined("normalization", o.collation.normalization)
|
|
51
|
+
} } : {},
|
|
52
|
+
...ifDefined("changeStreamPreAndPostImages", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),
|
|
53
|
+
...ifDefined("clusteredIndex", o.clusteredIndex)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function convertCollection(name, def) {
|
|
57
|
+
return new MongoSchemaCollection({
|
|
58
|
+
name,
|
|
59
|
+
indexes: (def.indexes ?? []).map(convertIndex),
|
|
60
|
+
...ifDefined("validator", def.validator != null ? convertValidator(def.validator) : void 0),
|
|
61
|
+
...ifDefined("options", def.options != null ? convertOptions(def.options) : void 0)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function contractToMongoSchemaIR(contract) {
|
|
65
|
+
if (!contract) return new MongoSchemaIR([]);
|
|
66
|
+
const collections = [];
|
|
67
|
+
for (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));
|
|
68
|
+
return new MongoSchemaIR(collections);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Classifies a Mongo schema-diff issue into the target-neutral categories the
|
|
72
|
+
* framework grades. Mongo issues carry their coordinate as `path`
|
|
73
|
+
* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`
|
|
74
|
+
* for an index/validator/options finding), so a `not-expected` issue at
|
|
75
|
+
* depth 1 is an undeclared whole collection and anything deeper is an
|
|
76
|
+
* undeclared auxiliary. Mongo owns this mapping rather than importing the
|
|
77
|
+
* SQL classifier — the two families share only the framework's category
|
|
78
|
+
* grading.
|
|
79
|
+
*/
|
|
80
|
+
function classifyMongoDiffIssue(issue) {
|
|
81
|
+
if (issueOutcome(issue) === "not-found") return "declaredMissing";
|
|
82
|
+
if (issueOutcome(issue) === "not-expected") return issue.path.length <= 1 ? "extraTopLevelObject" : "extraAuxiliary";
|
|
83
|
+
return "declaredIncompatible";
|
|
84
|
+
}
|
|
85
|
+
function verifierDisposition(controlPolicy, issue) {
|
|
86
|
+
return dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Reconciles a control-policy disposition with the Mongo family's strict-mode
|
|
90
|
+
* contract for live-only extras — the single point where `strict` and the
|
|
91
|
+
* control policy meet.
|
|
92
|
+
*
|
|
93
|
+
* The control policy decides first; only a `fail` is reconciled against the
|
|
94
|
+
* caller's base outcome. Call sites grade a live-only extra with
|
|
95
|
+
* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so
|
|
96
|
+
* this one step encodes the whole matrix:
|
|
97
|
+
*
|
|
98
|
+
* | live-vs-declared | strict | non-strict |
|
|
99
|
+
* |-------------------------------------|----------|------------|
|
|
100
|
+
* | declared missing / mismatch | fail | fail |
|
|
101
|
+
* | live-only extra (managed/tolerated) | fail | warn |
|
|
102
|
+
* | live-only extra (external) | suppress (extras ignored, both modes) |
|
|
103
|
+
* | anything (observed) | warn (both modes) |
|
|
104
|
+
*
|
|
105
|
+
* `tolerated` does not diverge from `managed` on a non-strict extra index:
|
|
106
|
+
* both soften to `warn`, because the softening comes from the base outcome the
|
|
107
|
+
* caller already computed from `strict`, not from per-policy special-casing.
|
|
108
|
+
*/
|
|
109
|
+
function emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {
|
|
110
|
+
const disposition = verifierDisposition(controlPolicy, issue);
|
|
111
|
+
const outcome = disposition === "fail" ? baseOutcome : disposition;
|
|
112
|
+
if (outcome === "suppress") return "suppress";
|
|
113
|
+
if (outcome === "warn") warnings.push(issue);
|
|
114
|
+
else failures.push(issue);
|
|
115
|
+
return outcome;
|
|
116
|
+
}
|
|
117
|
+
function diffMongoSchemas(live, expected, strict, collectionControlPolicy) {
|
|
118
|
+
const failures = [];
|
|
119
|
+
const warnings = [];
|
|
120
|
+
const allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);
|
|
121
|
+
for (const name of [...allNames].sort()) {
|
|
122
|
+
const liveColl = live.collection(name);
|
|
123
|
+
const expectedColl = expected.collection(name);
|
|
124
|
+
if (!liveColl && expectedColl) {
|
|
125
|
+
emitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {
|
|
126
|
+
path: [name],
|
|
127
|
+
expected: expectedColl
|
|
128
|
+
}, "fail", failures, warnings);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (liveColl && !expectedColl) {
|
|
132
|
+
emitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {
|
|
133
|
+
path: [name],
|
|
134
|
+
actual: liveColl
|
|
135
|
+
}, strict ? "fail" : "warn", failures, warnings);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const lc = liveColl;
|
|
139
|
+
const ec = expectedColl;
|
|
140
|
+
const controlPolicy = collectionControlPolicy(name);
|
|
141
|
+
diffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);
|
|
142
|
+
diffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);
|
|
143
|
+
diffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
failures,
|
|
147
|
+
warnings
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function buildIndexLookupKey(index) {
|
|
151
|
+
const keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(",");
|
|
152
|
+
const opts = [
|
|
153
|
+
index.unique ? "unique" : "",
|
|
154
|
+
index.sparse ? "sparse" : "",
|
|
155
|
+
index.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : "",
|
|
156
|
+
index.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : "",
|
|
157
|
+
index.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : "",
|
|
158
|
+
index.collation ? `col:${canonicalize(index.collation)}` : "",
|
|
159
|
+
index.weights ? `wt:${canonicalize(index.weights)}` : "",
|
|
160
|
+
index.default_language ? `dl:${index.default_language}` : "",
|
|
161
|
+
index.language_override ? `lo:${index.language_override}` : ""
|
|
162
|
+
].filter(Boolean).join(";");
|
|
163
|
+
return opts ? `${keys}|${opts}` : keys;
|
|
164
|
+
}
|
|
165
|
+
function formatIndexName(index) {
|
|
166
|
+
return index.keys.map((k) => `${k.field}:${k.direction}`).join(", ");
|
|
167
|
+
}
|
|
168
|
+
function diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {
|
|
169
|
+
const liveLookup = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const idx of live.indexes) liveLookup.set(buildIndexLookupKey(idx), idx);
|
|
171
|
+
const expectedLookup = /* @__PURE__ */ new Map();
|
|
172
|
+
for (const idx of expected.indexes) expectedLookup.set(buildIndexLookupKey(idx), idx);
|
|
173
|
+
for (const [key, idx] of expectedLookup) if (!liveLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
174
|
+
path: [collName, `index:${formatIndexName(idx)}`],
|
|
175
|
+
expected: idx
|
|
176
|
+
}, "fail", failures, warnings);
|
|
177
|
+
for (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
178
|
+
path: [collName, `index:${formatIndexName(idx)}`],
|
|
179
|
+
actual: idx
|
|
180
|
+
}, strict ? "fail" : "warn", failures, warnings);
|
|
181
|
+
}
|
|
182
|
+
function diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {
|
|
183
|
+
if (!live.validator && !expected.validator) return;
|
|
184
|
+
if (expected.validator && !live.validator) {
|
|
185
|
+
emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
186
|
+
path: [collName, "validator"],
|
|
187
|
+
expected: expected.validator
|
|
188
|
+
}, "fail", failures, warnings);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (!expected.validator && live.validator) {
|
|
192
|
+
emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
193
|
+
path: [collName, "validator"],
|
|
194
|
+
actual: live.validator
|
|
195
|
+
}, strict ? "fail" : "warn", failures, warnings);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const liveVal = live.validator;
|
|
199
|
+
const expectedVal = expected.validator;
|
|
200
|
+
if (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
201
|
+
path: [collName, "validator"],
|
|
202
|
+
expected: expectedVal,
|
|
203
|
+
actual: liveVal
|
|
204
|
+
}, "fail", failures, warnings);
|
|
205
|
+
}
|
|
206
|
+
function diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {
|
|
207
|
+
if (!live.options && !expected.options) return;
|
|
208
|
+
if (!expected.options && live.options) {
|
|
209
|
+
emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
210
|
+
path: [collName, "options"],
|
|
211
|
+
actual: live.options
|
|
212
|
+
}, strict ? "fail" : "warn", failures, warnings);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (deepEqual(live.options, expected.options)) return;
|
|
216
|
+
emitMongoIssueUnderControlPolicy(collectionControlPolicy, {
|
|
217
|
+
path: [collName, "options"],
|
|
218
|
+
...ifDefined("expected", expected.options),
|
|
219
|
+
...ifDefined("actual", live.options)
|
|
220
|
+
}, "fail", failures, warnings);
|
|
221
|
+
}
|
|
222
|
+
function canonicalizeSchemasForVerification(live, expected) {
|
|
223
|
+
const expectedByName = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const c of expected.collections) expectedByName.set(c.name, c);
|
|
225
|
+
const liveByName = /* @__PURE__ */ new Map();
|
|
226
|
+
for (const c of live.collections) liveByName.set(c.name, c);
|
|
227
|
+
const canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));
|
|
228
|
+
const canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));
|
|
229
|
+
return {
|
|
230
|
+
live: new MongoSchemaIR(canonicalLive),
|
|
231
|
+
expected: new MongoSchemaIR(canonicalExpected)
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function canonicalizeLiveCollection(liveColl, expectedColl) {
|
|
235
|
+
const expectedIndexes = expectedColl?.indexes ?? [];
|
|
236
|
+
const indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));
|
|
237
|
+
const options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;
|
|
238
|
+
return new MongoSchemaCollection({
|
|
239
|
+
name: liveColl.name,
|
|
240
|
+
indexes,
|
|
241
|
+
...ifDefined("validator", liveColl.validator),
|
|
242
|
+
...ifDefined("options", options)
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function canonicalizeExpectedCollection(expectedColl, liveColl) {
|
|
246
|
+
const indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);
|
|
247
|
+
const options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;
|
|
248
|
+
return new MongoSchemaCollection({
|
|
249
|
+
name: expectedColl.name,
|
|
250
|
+
indexes,
|
|
251
|
+
...ifDefined("validator", expectedColl.validator),
|
|
252
|
+
...ifDefined("options", options)
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function canonicalizeTextIndexKeyOrder(index) {
|
|
256
|
+
if (!index.keys.some((k) => k.direction === "text")) return index;
|
|
257
|
+
return new MongoSchemaIndex({
|
|
258
|
+
keys: sortTextKeys(index.keys),
|
|
259
|
+
unique: index.unique,
|
|
260
|
+
...ifDefined("sparse", index.sparse),
|
|
261
|
+
...ifDefined("expireAfterSeconds", index.expireAfterSeconds),
|
|
262
|
+
...ifDefined("partialFilterExpression", index.partialFilterExpression),
|
|
263
|
+
...ifDefined("wildcardProjection", index.wildcardProjection),
|
|
264
|
+
...ifDefined("collation", index.collation),
|
|
265
|
+
...ifDefined("weights", index.weights),
|
|
266
|
+
...ifDefined("default_language", index.default_language),
|
|
267
|
+
...ifDefined("language_override", index.language_override)
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Returns a copy of `keys` with text-direction entries sorted alphabetically
|
|
272
|
+
* while preserving the relative position of non-text entries. Compound text
|
|
273
|
+
* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar
|
|
274
|
+
* prefix/suffix layout; only the contiguous text block is reordered.
|
|
275
|
+
*/
|
|
276
|
+
function sortTextKeys(keys) {
|
|
277
|
+
const textEntries = keys.filter((k) => k.direction === "text");
|
|
278
|
+
if (textEntries.length <= 1) return keys;
|
|
279
|
+
const sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));
|
|
280
|
+
let textIdx = 0;
|
|
281
|
+
return keys.map((k) => {
|
|
282
|
+
if (k.direction !== "text") return k;
|
|
283
|
+
const next = sortedText[textIdx++];
|
|
284
|
+
/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */
|
|
285
|
+
if (next === void 0) throw new InternalError("sortTextKeys: text-key counts mismatched");
|
|
286
|
+
return next;
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function canonicalizeLiveIndex(liveIndex, expectedIndex) {
|
|
290
|
+
const projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));
|
|
291
|
+
const collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;
|
|
292
|
+
const weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;
|
|
293
|
+
const default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === "english" ? void 0 : liveIndex.default_language;
|
|
294
|
+
const language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === "language" ? void 0 : liveIndex.language_override;
|
|
295
|
+
return new MongoSchemaIndex({
|
|
296
|
+
keys: projectedKeys,
|
|
297
|
+
unique: liveIndex.unique,
|
|
298
|
+
...ifDefined("sparse", liveIndex.sparse),
|
|
299
|
+
...ifDefined("expireAfterSeconds", liveIndex.expireAfterSeconds),
|
|
300
|
+
...ifDefined("partialFilterExpression", liveIndex.partialFilterExpression),
|
|
301
|
+
...ifDefined("wildcardProjection", liveIndex.wildcardProjection),
|
|
302
|
+
...ifDefined("collation", collation),
|
|
303
|
+
...ifDefined("weights", weights),
|
|
304
|
+
...ifDefined("default_language", default_language),
|
|
305
|
+
...ifDefined("language_override", language_override)
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Locate the contract-side index that corresponds to a live index for the
|
|
310
|
+
* purpose of contract-aware normalization. We deliberately match by the
|
|
311
|
+
* *projected* (contract-shaped) key list — so a live `_fts/_ftsx` index
|
|
312
|
+
* resolves to a contract `{title: 'text', body: 'text'}` index — and pick
|
|
313
|
+
* the first match. Contracts very rarely contain duplicate-key indexes; if
|
|
314
|
+
* we have no counterpart we fall back to no normalization for that index.
|
|
315
|
+
*/
|
|
316
|
+
function findExpectedIndexCounterpart(liveIndex, expectedIndexes) {
|
|
317
|
+
const liveKeySig = sortTextKeys(projectTextIndexKeys(liveIndex)).map((k) => `${k.field}:${k.direction}`).join(",");
|
|
318
|
+
for (const expected of expectedIndexes) if (sortTextKeys(expected.keys).map((k) => `${k.field}:${k.direction}`).join(",") === liveKeySig) return expected;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* MongoDB expands a contract-shaped text index like
|
|
322
|
+
* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector
|
|
323
|
+
* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to
|
|
324
|
+
* contract-shaped keys via `weights`, iterating in whatever order MongoDB
|
|
325
|
+
* returns them (alphabetical, in practice). `sortTextKeys` is applied
|
|
326
|
+
* downstream to canonicalize the order on both sides, so this projection
|
|
327
|
+
* does not depend on a specific iteration order.
|
|
328
|
+
*/
|
|
329
|
+
function projectTextIndexKeys(liveIndex) {
|
|
330
|
+
if (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === "_fts" && k.direction === "text")) || !liveIndex.weights) return liveIndex.keys;
|
|
331
|
+
const textKeys = Object.keys(liveIndex.weights).map((field) => ({
|
|
332
|
+
field,
|
|
333
|
+
direction: "text"
|
|
334
|
+
}));
|
|
335
|
+
const projectedKeys = [];
|
|
336
|
+
for (const key of liveIndex.keys) {
|
|
337
|
+
if (key.field === "_ftsx") continue;
|
|
338
|
+
if (key.field === "_fts") {
|
|
339
|
+
projectedKeys.push(...textKeys);
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
projectedKeys.push(key);
|
|
343
|
+
}
|
|
344
|
+
return projectedKeys;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* MongoDB's server-default `weights` for an authored-without-weights text
|
|
348
|
+
* index assigns `1` to every text-direction field. Returns `true` only when
|
|
349
|
+
* `liveWeights` is exactly that uniform shape (every projected text-direction
|
|
350
|
+
* key weighted at `1`) so the canonicalizer leaves non-default weights —
|
|
351
|
+
* including out-of-band relevance tweaks — visible to the verifier.
|
|
352
|
+
*
|
|
353
|
+
* `projectTextIndexKeys` derives text-direction keys from the live weights
|
|
354
|
+
* map, so the count is guaranteed to match; we only have to check the value
|
|
355
|
+
* shape.
|
|
356
|
+
*/
|
|
357
|
+
function hasDefaultTextWeights(projectedKeys, liveWeights) {
|
|
358
|
+
if (liveWeights === void 0) return false;
|
|
359
|
+
return projectedKeys.filter((k) => k.direction === "text").map((k) => k.field).every((field) => liveWeights[field] === 1);
|
|
360
|
+
}
|
|
361
|
+
function canonicalizeLiveOptions(liveOptions, expectedOptions) {
|
|
362
|
+
const collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;
|
|
363
|
+
const timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;
|
|
364
|
+
const clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;
|
|
365
|
+
const changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;
|
|
366
|
+
if (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;
|
|
367
|
+
return new MongoSchemaCollectionOptions({
|
|
368
|
+
...ifDefined("capped", liveOptions.capped),
|
|
369
|
+
...ifDefined("timeseries", timeseries),
|
|
370
|
+
...ifDefined("collation", collation),
|
|
371
|
+
...ifDefined("changeStreamPreAndPostImages", changeStreamPreAndPostImages),
|
|
372
|
+
...ifDefined("clusteredIndex", clusteredIndex)
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function canonicalizeExpectedOptions(expectedOptions, _liveOptions) {
|
|
376
|
+
const changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;
|
|
377
|
+
if (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;
|
|
378
|
+
return new MongoSchemaCollectionOptions({
|
|
379
|
+
...ifDefined("capped", expectedOptions.capped),
|
|
380
|
+
...ifDefined("timeseries", expectedOptions.timeseries),
|
|
381
|
+
...ifDefined("collation", expectedOptions.collation),
|
|
382
|
+
...ifDefined("changeStreamPreAndPostImages", changeStreamPreAndPostImages),
|
|
383
|
+
...ifDefined("clusteredIndex", expectedOptions.clusteredIndex)
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function isDisabledChangeStream(value) {
|
|
387
|
+
return value !== void 0 && value.enabled === false;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Returns a copy of `live` containing only the keys that `expected` defines.
|
|
391
|
+
* Used for option families whose individual sub-fields are server-extended
|
|
392
|
+
* with platform defaults (collation, timeseries, clusteredIndex), so the
|
|
393
|
+
* verifier should compare only what the contract actually authored.
|
|
394
|
+
*
|
|
395
|
+
* When `expected` is `undefined` — i.e. the contract authored nothing for
|
|
396
|
+
* this whole option family but the live IR has it — we return `live`
|
|
397
|
+
* unchanged so the verifier still sees the entire live block and can
|
|
398
|
+
* surface it as drift. (Returning `undefined` here would silently strip a
|
|
399
|
+
* server-attached collation/timeseries/clusteredIndex that the contract
|
|
400
|
+
* never asked for, hiding real drift.)
|
|
401
|
+
*/
|
|
402
|
+
function stripCollationFields(live, expected) {
|
|
403
|
+
return blindCast(stripUnspecifiedFields(live, expected));
|
|
404
|
+
}
|
|
405
|
+
function stripUnspecifiedFields(live, expected) {
|
|
406
|
+
if (expected === void 0) return live;
|
|
407
|
+
const out = {};
|
|
408
|
+
for (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];
|
|
409
|
+
return out;
|
|
410
|
+
}
|
|
411
|
+
function verifyMongoSchema(options) {
|
|
412
|
+
const { contract, schema, strict, context } = options;
|
|
413
|
+
const startTime = Date.now();
|
|
414
|
+
const { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));
|
|
415
|
+
const { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));
|
|
416
|
+
const ok = failures.length === 0;
|
|
417
|
+
const profileHash = typeof contract.profileHash === "string" ? contract.profileHash : "";
|
|
418
|
+
return {
|
|
419
|
+
ok,
|
|
420
|
+
...ifDefined("code", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),
|
|
421
|
+
summary: ok ? "Schema matches contract" : `Schema verification found ${failures.length} issue(s)`,
|
|
422
|
+
contract: {
|
|
423
|
+
storageHash: contract.storage.storageHash,
|
|
424
|
+
...profileHash ? { profileHash } : {}
|
|
425
|
+
},
|
|
426
|
+
target: { expected: contract.target },
|
|
427
|
+
schema: {
|
|
428
|
+
issues: failures,
|
|
429
|
+
warnings: { issues: warnings }
|
|
430
|
+
},
|
|
431
|
+
meta: {
|
|
432
|
+
strict,
|
|
433
|
+
...ifDefined("contractPath", context?.contractPath),
|
|
434
|
+
...ifDefined("configPath", context?.configPath)
|
|
435
|
+
},
|
|
436
|
+
timings: { total: Date.now() - startTime }
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function resolveMongoCollectionControlPolicy(contract) {
|
|
440
|
+
const collections = contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.collection ?? {};
|
|
441
|
+
const defaultControlPolicy = contract.defaultControlPolicy;
|
|
442
|
+
return (collectionName) => effectiveControlPolicy(collections[collectionName]?.control, defaultControlPolicy);
|
|
443
|
+
}
|
|
444
|
+
//#endregion
|
|
445
|
+
export { verifyMongoSchema as i, contractToMongoSchemaIR as n, diffMongoSchemas as r, canonicalizeSchemasForVerification as t };
|
|
446
|
+
|
|
447
|
+
//# sourceMappingURL=verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/verify-mongo-schema-De0FG2Rm.mjs"],"sourcesContent":["import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual } from \"@internal/mongo-schema-ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/contract-to-schema.ts\nfunction convertIndex(index) {\n\treturn new MongoSchemaIndex({\n\t\tkeys: index.keys,\n\t\tunique: index.unique,\n\t\tsparse: index.sparse,\n\t\texpireAfterSeconds: index.expireAfterSeconds,\n\t\tpartialFilterExpression: index.partialFilterExpression,\n\t\twildcardProjection: index.wildcardProjection,\n\t\tcollation: index.collation,\n\t\tweights: index.weights,\n\t\tdefault_language: index.default_language,\n\t\tlanguage_override: index.language_override\n\t});\n}\nfunction convertValidator(v) {\n\treturn new MongoSchemaValidator({\n\t\tjsonSchema: v.jsonSchema,\n\t\tvalidationLevel: v.validationLevel,\n\t\tvalidationAction: v.validationAction\n\t});\n}\nfunction convertOptions(o) {\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", o.capped !== void 0 ? {\n\t\t\tsize: o.capped.size,\n\t\t\t...ifDefined(\"max\", o.capped.max)\n\t\t} : void 0),\n\t\t...o.timeseries !== void 0 ? { timeseries: {\n\t\t\ttimeField: o.timeseries.timeField,\n\t\t\t...ifDefined(\"metaField\", o.timeseries.metaField),\n\t\t\t...ifDefined(\"granularity\", o.timeseries.granularity)\n\t\t} } : {},\n\t\t...o.collation !== void 0 ? { collation: {\n\t\t\tlocale: o.collation.locale,\n\t\t\t...ifDefined(\"caseLevel\", o.collation.caseLevel),\n\t\t\t...ifDefined(\"caseFirst\", o.collation.caseFirst),\n\t\t\t...ifDefined(\"strength\", o.collation.strength),\n\t\t\t...ifDefined(\"numericOrdering\", o.collation.numericOrdering),\n\t\t\t...ifDefined(\"alternate\", o.collation.alternate),\n\t\t\t...ifDefined(\"maxVariable\", o.collation.maxVariable),\n\t\t\t...ifDefined(\"backwards\", o.collation.backwards),\n\t\t\t...ifDefined(\"normalization\", o.collation.normalization)\n\t\t} } : {},\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", o.changeStreamPreAndPostImages !== void 0 ? { enabled: o.changeStreamPreAndPostImages.enabled } : void 0),\n\t\t...ifDefined(\"clusteredIndex\", o.clusteredIndex)\n\t});\n}\nfunction convertCollection(name, def) {\n\treturn new MongoSchemaCollection({\n\t\tname,\n\t\tindexes: (def.indexes ?? []).map(convertIndex),\n\t\t...ifDefined(\"validator\", def.validator != null ? convertValidator(def.validator) : void 0),\n\t\t...ifDefined(\"options\", def.options != null ? convertOptions(def.options) : void 0)\n\t});\n}\nfunction contractToMongoSchemaIR(contract) {\n\tif (!contract) return new MongoSchemaIR([]);\n\tconst collections = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) for (const [name, def] of Object.entries(ns.entries.collection ?? {})) collections.push(convertCollection(name, def));\n\treturn new MongoSchemaIR(collections);\n}\n//#endregion\n//#region src/core/schema-verify/verifier-disposition.ts\n/**\n* Classifies a Mongo schema-diff issue into the target-neutral categories the\n* framework grades. Mongo issues carry their coordinate as `path`\n* (`[collectionName]` for a whole collection, `[collectionName, auxiliary]`\n* for an index/validator/options finding), so a `not-expected` issue at\n* depth 1 is an undeclared whole collection and anything deeper is an\n* undeclared auxiliary. Mongo owns this mapping rather than importing the\n* SQL classifier — the two families share only the framework's category\n* grading.\n*/\nfunction classifyMongoDiffIssue(issue) {\n\tif (issueOutcome(issue) === \"not-found\") return \"declaredMissing\";\n\tif (issueOutcome(issue) === \"not-expected\") return issue.path.length <= 1 ? \"extraTopLevelObject\" : \"extraAuxiliary\";\n\treturn \"declaredIncompatible\";\n}\nfunction verifierDisposition(controlPolicy, issue) {\n\treturn dispositionForCategory(controlPolicy, classifyMongoDiffIssue(issue));\n}\n//#endregion\n//#region src/core/schema-diff.ts\n/**\n* Reconciles a control-policy disposition with the Mongo family's strict-mode\n* contract for live-only extras — the single point where `strict` and the\n* control policy meet.\n*\n* The control policy decides first; only a `fail` is reconciled against the\n* caller's base outcome. Call sites grade a live-only extra with\n* `strict ? 'fail' : 'warn'` and a declared missing/mismatch with `fail`, so\n* this one step encodes the whole matrix:\n*\n* | live-vs-declared | strict | non-strict |\n* |-------------------------------------|----------|------------|\n* | declared missing / mismatch | fail | fail |\n* | live-only extra (managed/tolerated) | fail | warn |\n* | live-only extra (external) | suppress (extras ignored, both modes) |\n* | anything (observed) | warn (both modes) |\n*\n* `tolerated` does not diverge from `managed` on a non-strict extra index:\n* both soften to `warn`, because the softening comes from the base outcome the\n* caller already computed from `strict`, not from per-policy special-casing.\n*/\nfunction emitMongoIssueUnderControlPolicy(controlPolicy, issue, baseOutcome, failures, warnings) {\n\tconst disposition = verifierDisposition(controlPolicy, issue);\n\tconst outcome = disposition === \"fail\" ? baseOutcome : disposition;\n\tif (outcome === \"suppress\") return \"suppress\";\n\tif (outcome === \"warn\") warnings.push(issue);\n\telse failures.push(issue);\n\treturn outcome;\n}\nfunction diffMongoSchemas(live, expected, strict, collectionControlPolicy) {\n\tconst failures = [];\n\tconst warnings = [];\n\tconst allNames = /* @__PURE__ */ new Set([...live.collectionNames, ...expected.collectionNames]);\n\tfor (const name of [...allNames].sort()) {\n\t\tconst liveColl = live.collection(name);\n\t\tconst expectedColl = expected.collection(name);\n\t\tif (!liveColl && expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\texpected: expectedColl\n\t\t\t}, \"fail\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tif (liveColl && !expectedColl) {\n\t\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy(name), {\n\t\t\t\tpath: [name],\n\t\t\t\tactual: liveColl\n\t\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\t\tcontinue;\n\t\t}\n\t\tconst lc = liveColl;\n\t\tconst ec = expectedColl;\n\t\tconst controlPolicy = collectionControlPolicy(name);\n\t\tdiffIndexes(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffValidator(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t\tdiffOptions(name, lc, ec, strict, controlPolicy, failures, warnings);\n\t}\n\treturn {\n\t\tfailures,\n\t\twarnings\n\t};\n}\nfunction buildIndexLookupKey(index) {\n\tconst keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tconst opts = [\n\t\tindex.unique ? \"unique\" : \"\",\n\t\tindex.sparse ? \"sparse\" : \"\",\n\t\tindex.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : \"\",\n\t\tindex.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : \"\",\n\t\tindex.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : \"\",\n\t\tindex.collation ? `col:${canonicalize(index.collation)}` : \"\",\n\t\tindex.weights ? `wt:${canonicalize(index.weights)}` : \"\",\n\t\tindex.default_language ? `dl:${index.default_language}` : \"\",\n\t\tindex.language_override ? `lo:${index.language_override}` : \"\"\n\t].filter(Boolean).join(\";\");\n\treturn opts ? `${keys}|${opts}` : keys;\n}\nfunction formatIndexName(index) {\n\treturn index.keys.map((k) => `${k.field}:${k.direction}`).join(\", \");\n}\nfunction diffIndexes(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tconst liveLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of live.indexes) liveLookup.set(buildIndexLookupKey(idx), idx);\n\tconst expectedLookup = /* @__PURE__ */ new Map();\n\tfor (const idx of expected.indexes) expectedLookup.set(buildIndexLookupKey(idx), idx);\n\tfor (const [key, idx] of expectedLookup) if (!liveLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\texpected: idx\n\t}, \"fail\", failures, warnings);\n\tfor (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, `index:${formatIndexName(idx)}`],\n\t\tactual: idx\n\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n}\nfunction diffValidator(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.validator && !expected.validator) return;\n\tif (expected.validator && !live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\texpected: expected.validator\n\t\t}, \"fail\", failures, warnings);\n\t\treturn;\n\t}\n\tif (!expected.validator && live.validator) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"validator\"],\n\t\t\tactual: live.validator\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tconst liveVal = live.validator;\n\tconst expectedVal = expected.validator;\n\tif (canonicalize(liveVal.jsonSchema) !== canonicalize(expectedVal.jsonSchema) || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) emitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"validator\"],\n\t\texpected: expectedVal,\n\t\tactual: liveVal\n\t}, \"fail\", failures, warnings);\n}\nfunction diffOptions(collName, live, expected, strict, collectionControlPolicy, failures, warnings) {\n\tif (!live.options && !expected.options) return;\n\tif (!expected.options && live.options) {\n\t\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\t\tpath: [collName, \"options\"],\n\t\t\tactual: live.options\n\t\t}, strict ? \"fail\" : \"warn\", failures, warnings);\n\t\treturn;\n\t}\n\tif (deepEqual(live.options, expected.options)) return;\n\temitMongoIssueUnderControlPolicy(collectionControlPolicy, {\n\t\tpath: [collName, \"options\"],\n\t\t...ifDefined(\"expected\", expected.options),\n\t\t...ifDefined(\"actual\", live.options)\n\t}, \"fail\", failures, warnings);\n}\n//#endregion\n//#region src/core/schema-verify/canonicalize-introspection.ts\nfunction canonicalizeSchemasForVerification(live, expected) {\n\tconst expectedByName = /* @__PURE__ */ new Map();\n\tfor (const c of expected.collections) expectedByName.set(c.name, c);\n\tconst liveByName = /* @__PURE__ */ new Map();\n\tfor (const c of live.collections) liveByName.set(c.name, c);\n\tconst canonicalLive = live.collections.map((c) => canonicalizeLiveCollection(c, expectedByName.get(c.name)));\n\tconst canonicalExpected = expected.collections.map((c) => canonicalizeExpectedCollection(c, liveByName.get(c.name)));\n\treturn {\n\t\tlive: new MongoSchemaIR(canonicalLive),\n\t\texpected: new MongoSchemaIR(canonicalExpected)\n\t};\n}\nfunction canonicalizeLiveCollection(liveColl, expectedColl) {\n\tconst expectedIndexes = expectedColl?.indexes ?? [];\n\tconst indexes = liveColl.indexes.map((idx) => canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)));\n\tconst options = liveColl.options ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: liveColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", liveColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeExpectedCollection(expectedColl, liveColl) {\n\tconst indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\tconst options = expectedColl.options ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options) : void 0;\n\treturn new MongoSchemaCollection({\n\t\tname: expectedColl.name,\n\t\tindexes,\n\t\t...ifDefined(\"validator\", expectedColl.validator),\n\t\t...ifDefined(\"options\", options)\n\t});\n}\nfunction canonicalizeTextIndexKeyOrder(index) {\n\tif (!index.keys.some((k) => k.direction === \"text\")) return index;\n\treturn new MongoSchemaIndex({\n\t\tkeys: sortTextKeys(index.keys),\n\t\tunique: index.unique,\n\t\t...ifDefined(\"sparse\", index.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", index.wildcardProjection),\n\t\t...ifDefined(\"collation\", index.collation),\n\t\t...ifDefined(\"weights\", index.weights),\n\t\t...ifDefined(\"default_language\", index.default_language),\n\t\t...ifDefined(\"language_override\", index.language_override)\n\t});\n}\n/**\n* Returns a copy of `keys` with text-direction entries sorted alphabetically\n* while preserving the relative position of non-text entries. Compound text\n* indexes (`{a: 1, _fts: 'text', _ftsx: 1, b: 1}`) keep their scalar\n* prefix/suffix layout; only the contiguous text block is reordered.\n*/\nfunction sortTextKeys(keys) {\n\tconst textEntries = keys.filter((k) => k.direction === \"text\");\n\tif (textEntries.length <= 1) return keys;\n\tconst sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n\tlet textIdx = 0;\n\treturn keys.map((k) => {\n\t\tif (k.direction !== \"text\") return k;\n\t\tconst next = sortedText[textIdx++];\n\t\t/* v8 ignore next 3 -- @preserve invariant guard: textIdx is always < sortedText.length here because we only consume sortedText for text-direction entries and sortedText is built from the same filter. */\n\t\tif (next === void 0) throw new InternalError(\"sortTextKeys: text-key counts mismatched\");\n\t\treturn next;\n\t});\n}\nfunction canonicalizeLiveIndex(liveIndex, expectedIndex) {\n\tconst projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n\tconst collation = liveIndex.collation ? stripCollationFields(liveIndex.collation, expectedIndex?.collation) : liveIndex.collation;\n\tconst weights = expectedIndex?.weights === void 0 && hasDefaultTextWeights(projectedKeys, liveIndex.weights) ? void 0 : liveIndex.weights;\n\tconst default_language = expectedIndex?.default_language === void 0 && liveIndex.default_language === \"english\" ? void 0 : liveIndex.default_language;\n\tconst language_override = expectedIndex?.language_override === void 0 && liveIndex.language_override === \"language\" ? void 0 : liveIndex.language_override;\n\treturn new MongoSchemaIndex({\n\t\tkeys: projectedKeys,\n\t\tunique: liveIndex.unique,\n\t\t...ifDefined(\"sparse\", liveIndex.sparse),\n\t\t...ifDefined(\"expireAfterSeconds\", liveIndex.expireAfterSeconds),\n\t\t...ifDefined(\"partialFilterExpression\", liveIndex.partialFilterExpression),\n\t\t...ifDefined(\"wildcardProjection\", liveIndex.wildcardProjection),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"weights\", weights),\n\t\t...ifDefined(\"default_language\", default_language),\n\t\t...ifDefined(\"language_override\", language_override)\n\t});\n}\n/**\n* Locate the contract-side index that corresponds to a live index for the\n* purpose of contract-aware normalization. We deliberately match by the\n* *projected* (contract-shaped) key list — so a live `_fts/_ftsx` index\n* resolves to a contract `{title: 'text', body: 'text'}` index — and pick\n* the first match. Contracts very rarely contain duplicate-key indexes; if\n* we have no counterpart we fall back to no normalization for that index.\n*/\nfunction findExpectedIndexCounterpart(liveIndex, expectedIndexes) {\n\tconst liveKeySig = sortTextKeys(projectTextIndexKeys(liveIndex)).map((k) => `${k.field}:${k.direction}`).join(\",\");\n\tfor (const expected of expectedIndexes) if (sortTextKeys(expected.keys).map((k) => `${k.field}:${k.direction}`).join(\",\") === liveKeySig) return expected;\n}\n/**\n* MongoDB expands a contract-shaped text index like\n* `[{title: 'text'}, {body: 'text'}]` into its internal weighted vector\n* representation `[{_fts: 'text'}, {_ftsx: 1}]`. We project back to\n* contract-shaped keys via `weights`, iterating in whatever order MongoDB\n* returns them (alphabetical, in practice). `sortTextKeys` is applied\n* downstream to canonicalize the order on both sides, so this projection\n* does not depend on a specific iteration order.\n*/\nfunction projectTextIndexKeys(liveIndex) {\n\tif (!(liveIndex.keys.length >= 1 && liveIndex.keys.some((k) => k.field === \"_fts\" && k.direction === \"text\")) || !liveIndex.weights) return liveIndex.keys;\n\tconst textKeys = Object.keys(liveIndex.weights).map((field) => ({\n\t\tfield,\n\t\tdirection: \"text\"\n\t}));\n\tconst projectedKeys = [];\n\tfor (const key of liveIndex.keys) {\n\t\tif (key.field === \"_ftsx\") continue;\n\t\tif (key.field === \"_fts\") {\n\t\t\tprojectedKeys.push(...textKeys);\n\t\t\tcontinue;\n\t\t}\n\t\tprojectedKeys.push(key);\n\t}\n\treturn projectedKeys;\n}\n/**\n* MongoDB's server-default `weights` for an authored-without-weights text\n* index assigns `1` to every text-direction field. Returns `true` only when\n* `liveWeights` is exactly that uniform shape (every projected text-direction\n* key weighted at `1`) so the canonicalizer leaves non-default weights —\n* including out-of-band relevance tweaks — visible to the verifier.\n*\n* `projectTextIndexKeys` derives text-direction keys from the live weights\n* map, so the count is guaranteed to match; we only have to check the value\n* shape.\n*/\nfunction hasDefaultTextWeights(projectedKeys, liveWeights) {\n\tif (liveWeights === void 0) return false;\n\treturn projectedKeys.filter((k) => k.direction === \"text\").map((k) => k.field).every((field) => liveWeights[field] === 1);\n}\nfunction canonicalizeLiveOptions(liveOptions, expectedOptions) {\n\tconst collation = liveOptions.collation ? stripCollationFields(liveOptions.collation, expectedOptions?.collation) : void 0;\n\tconst timeseries = liveOptions.timeseries ? stripUnspecifiedFields(liveOptions.timeseries, expectedOptions?.timeseries) : void 0;\n\tconst clusteredIndex = liveOptions.clusteredIndex ? stripUnspecifiedFields(liveOptions.clusteredIndex, expectedOptions?.clusteredIndex) : void 0;\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(liveOptions.changeStreamPreAndPostImages) ? void 0 : liveOptions.changeStreamPreAndPostImages;\n\tif (!(liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", liveOptions.capped),\n\t\t...ifDefined(\"timeseries\", timeseries),\n\t\t...ifDefined(\"collation\", collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", clusteredIndex)\n\t});\n}\nfunction canonicalizeExpectedOptions(expectedOptions, _liveOptions) {\n\tconst changeStreamPreAndPostImages = isDisabledChangeStream(expectedOptions.changeStreamPreAndPostImages) ? void 0 : expectedOptions.changeStreamPreAndPostImages;\n\tif (!(expectedOptions.capped || expectedOptions.timeseries || expectedOptions.collation || changeStreamPreAndPostImages || expectedOptions.clusteredIndex)) return void 0;\n\treturn new MongoSchemaCollectionOptions({\n\t\t...ifDefined(\"capped\", expectedOptions.capped),\n\t\t...ifDefined(\"timeseries\", expectedOptions.timeseries),\n\t\t...ifDefined(\"collation\", expectedOptions.collation),\n\t\t...ifDefined(\"changeStreamPreAndPostImages\", changeStreamPreAndPostImages),\n\t\t...ifDefined(\"clusteredIndex\", expectedOptions.clusteredIndex)\n\t});\n}\nfunction isDisabledChangeStream(value) {\n\treturn value !== void 0 && value.enabled === false;\n}\n/**\n* Returns a copy of `live` containing only the keys that `expected` defines.\n* Used for option families whose individual sub-fields are server-extended\n* with platform defaults (collation, timeseries, clusteredIndex), so the\n* verifier should compare only what the contract actually authored.\n*\n* When `expected` is `undefined` — i.e. the contract authored nothing for\n* this whole option family but the live IR has it — we return `live`\n* unchanged so the verifier still sees the entire live block and can\n* surface it as drift. (Returning `undefined` here would silently strip a\n* server-attached collation/timeseries/clusteredIndex that the contract\n* never asked for, hiding real drift.)\n*/\nfunction stripCollationFields(live, expected) {\n\treturn blindCast(stripUnspecifiedFields(live, expected));\n}\nfunction stripUnspecifiedFields(live, expected) {\n\tif (expected === void 0) return live;\n\tconst out = {};\n\tfor (const key of Object.keys(expected)) if (Object.hasOwn(live, key)) out[key] = live[key];\n\treturn out;\n}\n//#endregion\n//#region src/core/schema-verify/verify-mongo-schema.ts\nfunction verifyMongoSchema(options) {\n\tconst { contract, schema, strict, context } = options;\n\tconst startTime = Date.now();\n\tconst { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));\n\tconst { failures, warnings } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));\n\tconst ok = failures.length === 0;\n\tconst profileHash = typeof contract.profileHash === \"string\" ? contract.profileHash : \"\";\n\treturn {\n\t\tok,\n\t\t...ifDefined(\"code\", ok ? void 0 : VERIFY_CODE_SCHEMA_FAILURE),\n\t\tsummary: ok ? \"Schema matches contract\" : `Schema verification found ${failures.length} issue(s)`,\n\t\tcontract: {\n\t\t\tstorageHash: contract.storage.storageHash,\n\t\t\t...profileHash ? { profileHash } : {}\n\t\t},\n\t\ttarget: { expected: contract.target },\n\t\tschema: {\n\t\t\tissues: failures,\n\t\t\twarnings: { issues: warnings }\n\t\t},\n\t\tmeta: {\n\t\t\tstrict,\n\t\t\t...ifDefined(\"contractPath\", context?.contractPath),\n\t\t\t...ifDefined(\"configPath\", context?.configPath)\n\t\t},\n\t\ttimings: { total: Date.now() - startTime }\n\t};\n}\nfunction resolveMongoCollectionControlPolicy(contract) {\n\tconst collections = contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.entries.collection ?? {};\n\tconst defaultControlPolicy = contract.defaultControlPolicy;\n\treturn (collectionName) => effectiveControlPolicy(collections[collectionName]?.control, defaultControlPolicy);\n}\n//#endregion\nexport { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };\n\n//# sourceMappingURL=verify-mongo-schema-De0FG2Rm.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,OAAO;CAC5B,OAAO,IAAI,iBAAiB;EAC3B,MAAM,MAAM;EACZ,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,oBAAoB,MAAM;EAC1B,yBAAyB,MAAM;EAC/B,oBAAoB,MAAM;EAC1B,WAAW,MAAM;EACjB,SAAS,MAAM;EACf,kBAAkB,MAAM;EACxB,mBAAmB,MAAM;CAC1B,CAAC;AACF;AACA,SAAS,iBAAiB,GAAG;CAC5B,OAAO,IAAI,qBAAqB;EAC/B,YAAY,EAAE;EACd,iBAAiB,EAAE;EACnB,kBAAkB,EAAE;CACrB,CAAC;AACF;AACA,SAAS,eAAe,GAAG;CAC1B,OAAO,IAAI,6BAA6B;EACvC,GAAG,UAAU,UAAU,EAAE,WAAW,KAAK,IAAI;GAC5C,MAAM,EAAE,OAAO;GACf,GAAG,UAAU,OAAO,EAAE,OAAO,GAAG;EACjC,IAAI,KAAK,CAAC;EACV,GAAG,EAAE,eAAe,KAAK,IAAI,EAAE,YAAY;GAC1C,WAAW,EAAE,WAAW;GACxB,GAAG,UAAU,aAAa,EAAE,WAAW,SAAS;GAChD,GAAG,UAAU,e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,SAAS,cAAc;CACtF,OAAO;EACN;EACA,GAAG,UAAU,QAAQ,KAAK,KAAK,IAAI,0BAA0B;EAC7D,SAAS,KAAK,4BAA4B,6BAA6B,SAAS,OAAO;EACvF,UAAU;GACT,aAAa,SAAS,QAAQ;GAC9B,GAAG,cAAc,EAAE,YAAY,IAAI,CAAC;EACrC;EACA,QAAQ,EAAE,UAAU,SAAS,OAAO;EACpC,QAAQ;GACP,QAAQ;GACR,UAAU,EAAE,QAAQ,SAAS;EAC9B;EACA,MAAM;GACL;GACA,GAAG,UAAU,gBAAgB,SAAS,YAAY;GAClD,GAAG,UAAU,cAAc,SAAS,UAAU;EAC/C;EACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC1C;AACD;AACA,SAAS,oCAAoC,UAAU;CACtD,MAAM,cAAc,SAAS,QAAQ,WAAW,qBAAqB,EAAE,QAAQ,cAAc,CAAC;CAC9F,MAAM,uBAAuB,SAAS;CACtC,QAAQ,mBAAmB,uBAAuB,YAAY,eAAe,EAAE,SAAS,oBAAoB;AAC7G"}
|
package/dist/wire.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as InsertOneResult, i as InsertManyResult, n as DeleteOneResult, o as UpdateManyResult, s as UpdateOneResult, t as DeleteManyResult } from "./execution-CKnUiOfm.mjs";
|
|
2
|
+
import { _ as UpdateOneWireCommand, a as CollModWireCommand, c as DeleteManyWireCommand, d as DropIndexWireCommand, f as FindOneAndDeleteWireCommand, g as UpdateManyWireCommand, h as InsertOneWireCommand, i as AnyMongoWireCommand, l as DeleteOneWireCommand, m as InsertManyWireCommand, n as AnyMongoDdlWireCommand, o as CreateCollectionWireCommand, p as FindOneAndUpdateWireCommand, r as AnyMongoDmlWireCommand, s as CreateIndexWireCommand, t as AggregateWireCommand, u as DropCollectionWireCommand, v as isDdlWireCommand } from "./index-BR0ue13b.mjs";
|
|
3
|
+
export { AggregateWireCommand, type AnyMongoDdlWireCommand, type AnyMongoDmlWireCommand, type AnyMongoWireCommand, CollModWireCommand, CreateCollectionWireCommand, CreateIndexWireCommand, type DeleteManyResult, DeleteManyWireCommand, type DeleteOneResult, DeleteOneWireCommand, DropCollectionWireCommand, DropIndexWireCommand, FindOneAndDeleteWireCommand, FindOneAndUpdateWireCommand, type InsertManyResult, InsertManyWireCommand, type InsertOneResult, InsertOneWireCommand, type UpdateManyResult, UpdateManyWireCommand, type UpdateOneResult, UpdateOneWireCommand, isDdlWireCommand };
|