@prisma-next/family-mongo 0.12.0-dev.3 → 0.12.0-dev.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control-adapter.d.mts +9 -1
- package/dist/control-adapter.d.mts.map +1 -1
- package/dist/control.d.mts +2 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +5 -7
- package/dist/control.mjs.map +1 -1
- package/dist/ir.d.mts +5 -1
- package/dist/ir.d.mts.map +1 -1
- package/dist/ir.mjs +9 -0
- package/dist/ir.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -0
- package/dist/runtime.mjs +2 -0
- package/dist/schema-verify.d.mts.map +1 -1
- package/dist/schema-verify.mjs +1 -1
- package/dist/{verify-mongo-schema-Bhxvdah3.mjs → verify-mongo-schema-CFRMURgz.mjs} +156 -86
- package/dist/verify-mongo-schema-CFRMURgz.mjs.map +1 -0
- package/package.json +16 -15
- package/src/core/control-adapter.ts +18 -2
- package/src/core/control-instance.ts +10 -21
- package/src/core/default-namespace.ts +4 -0
- package/src/core/ir/mongo-schema-verifier-base.ts +24 -2
- package/src/core/schema-diff.ts +148 -84
- package/src/core/schema-verify/mongo-control-verify-emit.ts +53 -0
- package/src/core/schema-verify/verifier-disposition.ts +42 -0
- package/src/core/schema-verify/verify-mongo-schema.ts +20 -2
- package/src/exports/runtime.ts +4 -0
- package/dist/verify-mongo-schema-Bhxvdah3.mjs.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MongoSchemaCollection, MongoSchemaCollectionOptions, MongoSchemaIR, MongoSchemaIndex, MongoSchemaValidator, canonicalize, deepEqual } from "@prisma-next/mongo-schema-ir";
|
|
2
|
-
import { VERIFY_CODE_SCHEMA_FAILURE } from "@prisma-next/framework-components/control";
|
|
2
|
+
import { VERIFY_CODE_SCHEMA_FAILURE, dispositionForCategory } from "@prisma-next/framework-components/control";
|
|
3
3
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
4
|
+
import { effectiveControlPolicy } from "@prisma-next/contract/types";
|
|
4
5
|
import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
5
6
|
//#region src/core/contract-to-schema.ts
|
|
6
7
|
function stripIrKind(node) {
|
|
@@ -56,8 +57,72 @@ function contractToMongoSchemaIR(contract) {
|
|
|
56
57
|
return new MongoSchemaIR(collections);
|
|
57
58
|
}
|
|
58
59
|
//#endregion
|
|
60
|
+
//#region src/core/schema-verify/verifier-disposition.ts
|
|
61
|
+
/**
|
|
62
|
+
* Classifies the verifier issue kinds the Mongo schema differ emits into the
|
|
63
|
+
* target-neutral categories the framework grades. Mongo only emits the kinds
|
|
64
|
+
* listed below (missing/extra collections, missing/extra indexes, missing/extra
|
|
65
|
+
* validators, and validator/options mismatches coded as `type_mismatch`); any
|
|
66
|
+
* other kind never reaches this classifier and is graded conservatively as a
|
|
67
|
+
* declared-incompatible divergence. Mongo owns this mapping rather than
|
|
68
|
+
* importing the SQL classifier — the two families share only the framework's
|
|
69
|
+
* category grading.
|
|
70
|
+
*/
|
|
71
|
+
function classifyMongoVerifierIssueKind(kind) {
|
|
72
|
+
switch (kind) {
|
|
73
|
+
case "extra_table": return "extraTopLevelObject";
|
|
74
|
+
case "extra_index":
|
|
75
|
+
case "extra_validator": return "extraAuxiliary";
|
|
76
|
+
case "missing_table":
|
|
77
|
+
case "type_missing": return "declaredMissing";
|
|
78
|
+
case "index_mismatch":
|
|
79
|
+
case "type_mismatch": return "declaredIncompatible";
|
|
80
|
+
default: return "declaredIncompatible";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function verifierDisposition(controlPolicy, issueKind) {
|
|
84
|
+
return dispositionForCategory(controlPolicy, classifyMongoVerifierIssueKind(issueKind));
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/core/schema-verify/mongo-control-verify-emit.ts
|
|
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 node status. Call sites stamp 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` no longer diverges from `managed` on a non-strict extra index:
|
|
106
|
+
* both soften to `warn`, because the softening comes from the base status the
|
|
107
|
+
* caller already computed from `strict`, not from per-policy special-casing.
|
|
108
|
+
*/
|
|
109
|
+
function reconcileMongoOutcome(controlPolicy, issueKind, baseStatus) {
|
|
110
|
+
const disposition = verifierDisposition(controlPolicy, issueKind);
|
|
111
|
+
return disposition === "fail" ? baseStatus : disposition;
|
|
112
|
+
}
|
|
113
|
+
function emitMongoIssueAndNodeUnderControlPolicy(controlPolicy, issue, node, issues, nodes) {
|
|
114
|
+
const outcome = reconcileMongoOutcome(controlPolicy, issue.kind, node.status);
|
|
115
|
+
if (outcome === "suppress") return "suppress";
|
|
116
|
+
issues.push(issue);
|
|
117
|
+
nodes.push({
|
|
118
|
+
...node,
|
|
119
|
+
status: outcome
|
|
120
|
+
});
|
|
121
|
+
return outcome;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
59
124
|
//#region src/core/schema-diff.ts
|
|
60
|
-
function diffMongoSchemas(live, expected, strict) {
|
|
125
|
+
function diffMongoSchemas(live, expected, strict, collectionControlPolicy) {
|
|
61
126
|
const issues = [];
|
|
62
127
|
const collectionChildren = [];
|
|
63
128
|
let pass = 0;
|
|
@@ -68,12 +133,11 @@ function diffMongoSchemas(live, expected, strict) {
|
|
|
68
133
|
const liveColl = live.collection(name);
|
|
69
134
|
const expectedColl = expected.collection(name);
|
|
70
135
|
if (!liveColl && expectedColl) {
|
|
71
|
-
|
|
136
|
+
const disposition = emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy(name), {
|
|
72
137
|
kind: "missing_table",
|
|
73
138
|
table: name,
|
|
74
139
|
message: `Collection "${name}" is missing from the database`
|
|
75
|
-
}
|
|
76
|
-
collectionChildren.push({
|
|
140
|
+
}, {
|
|
77
141
|
status: "fail",
|
|
78
142
|
kind: "collection",
|
|
79
143
|
name,
|
|
@@ -83,19 +147,18 @@ function diffMongoSchemas(live, expected, strict) {
|
|
|
83
147
|
expected: name,
|
|
84
148
|
actual: null,
|
|
85
149
|
children: []
|
|
86
|
-
});
|
|
87
|
-
fail++;
|
|
150
|
+
}, issues, collectionChildren);
|
|
151
|
+
if (disposition === "fail") fail++;
|
|
152
|
+
else if (disposition === "warn") warn++;
|
|
88
153
|
continue;
|
|
89
154
|
}
|
|
90
155
|
if (liveColl && !expectedColl) {
|
|
91
|
-
const
|
|
92
|
-
issues.push({
|
|
156
|
+
const disposition = emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy(name), {
|
|
93
157
|
kind: "extra_table",
|
|
94
158
|
table: name,
|
|
95
159
|
message: `Extra collection "${name}" exists in the database but not in the contract`
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
status,
|
|
160
|
+
}, {
|
|
161
|
+
status: strict ? "fail" : "warn",
|
|
99
162
|
kind: "collection",
|
|
100
163
|
name,
|
|
101
164
|
contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${name}`,
|
|
@@ -104,16 +167,17 @@ function diffMongoSchemas(live, expected, strict) {
|
|
|
104
167
|
expected: null,
|
|
105
168
|
actual: name,
|
|
106
169
|
children: []
|
|
107
|
-
});
|
|
108
|
-
if (
|
|
109
|
-
else warn++;
|
|
170
|
+
}, issues, collectionChildren);
|
|
171
|
+
if (disposition === "fail") fail++;
|
|
172
|
+
else if (disposition === "warn") warn++;
|
|
110
173
|
continue;
|
|
111
174
|
}
|
|
112
175
|
const lc = liveColl;
|
|
113
176
|
const ec = expectedColl;
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
177
|
+
const controlPolicy = collectionControlPolicy(name);
|
|
178
|
+
const indexChildren = diffIndexes(name, lc, ec, strict, controlPolicy, issues);
|
|
179
|
+
const validatorChildren = diffValidator(name, lc, ec, strict, controlPolicy, issues);
|
|
180
|
+
const optionsChildren = diffOptions(name, lc, ec, strict, controlPolicy, issues);
|
|
117
181
|
const children = [
|
|
118
182
|
...indexChildren,
|
|
119
183
|
...validatorChildren,
|
|
@@ -177,7 +241,7 @@ function buildIndexLookupKey(index) {
|
|
|
177
241
|
function formatIndexName(index) {
|
|
178
242
|
return index.keys.map((k) => `${k.field}:${k.direction}`).join(", ");
|
|
179
243
|
}
|
|
180
|
-
function diffIndexes(collName, live, expected, strict, issues) {
|
|
244
|
+
function diffIndexes(collName, live, expected, strict, collectionControlPolicy, issues) {
|
|
181
245
|
const nodes = [];
|
|
182
246
|
const liveLookup = /* @__PURE__ */ new Map();
|
|
183
247
|
for (const idx of live.indexes) liveLookup.set(buildIndexLookupKey(idx), idx);
|
|
@@ -194,56 +258,50 @@ function diffIndexes(collName, live, expected, strict, issues) {
|
|
|
194
258
|
actual: key,
|
|
195
259
|
children: []
|
|
196
260
|
});
|
|
197
|
-
else {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
code: "EXTRA_INDEX",
|
|
230
|
-
message: `Extra index ${formatIndexName(idx)}`,
|
|
231
|
-
expected: null,
|
|
232
|
-
actual: key,
|
|
233
|
-
children: []
|
|
234
|
-
});
|
|
235
|
-
}
|
|
261
|
+
else emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, {
|
|
262
|
+
kind: "index_mismatch",
|
|
263
|
+
table: collName,
|
|
264
|
+
indexOrConstraint: formatIndexName(idx),
|
|
265
|
+
message: `Index ${formatIndexName(idx)} missing on collection "${collName}"`
|
|
266
|
+
}, {
|
|
267
|
+
status: "fail",
|
|
268
|
+
kind: "index",
|
|
269
|
+
name: formatIndexName(idx),
|
|
270
|
+
contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.indexes`,
|
|
271
|
+
code: "MISSING_INDEX",
|
|
272
|
+
message: `Index ${formatIndexName(idx)} missing`,
|
|
273
|
+
expected: key,
|
|
274
|
+
actual: null,
|
|
275
|
+
children: []
|
|
276
|
+
}, issues, nodes);
|
|
277
|
+
for (const [key, idx] of liveLookup) if (!expectedLookup.has(key)) emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, {
|
|
278
|
+
kind: "extra_index",
|
|
279
|
+
table: collName,
|
|
280
|
+
indexOrConstraint: formatIndexName(idx),
|
|
281
|
+
message: `Extra index ${formatIndexName(idx)} on collection "${collName}"`
|
|
282
|
+
}, {
|
|
283
|
+
status: strict ? "fail" : "warn",
|
|
284
|
+
kind: "index",
|
|
285
|
+
name: formatIndexName(idx),
|
|
286
|
+
contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.indexes`,
|
|
287
|
+
code: "EXTRA_INDEX",
|
|
288
|
+
message: `Extra index ${formatIndexName(idx)}`,
|
|
289
|
+
expected: null,
|
|
290
|
+
actual: key,
|
|
291
|
+
children: []
|
|
292
|
+
}, issues, nodes);
|
|
236
293
|
return nodes;
|
|
237
294
|
}
|
|
238
|
-
function diffValidator(collName, live, expected, strict, issues) {
|
|
295
|
+
function diffValidator(collName, live, expected, strict, collectionControlPolicy, issues) {
|
|
239
296
|
if (!live.validator && !expected.validator) return [];
|
|
240
297
|
if (expected.validator && !live.validator) {
|
|
241
|
-
|
|
298
|
+
const issue = {
|
|
242
299
|
kind: "type_missing",
|
|
243
300
|
table: collName,
|
|
244
301
|
message: `Validator missing on collection "${collName}"`
|
|
245
|
-
}
|
|
246
|
-
|
|
302
|
+
};
|
|
303
|
+
const nodes = [];
|
|
304
|
+
emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, issue, {
|
|
247
305
|
status: "fail",
|
|
248
306
|
kind: "validator",
|
|
249
307
|
name: "validator",
|
|
@@ -253,17 +311,18 @@ function diffValidator(collName, live, expected, strict, issues) {
|
|
|
253
311
|
expected: canonicalize(expected.validator.jsonSchema),
|
|
254
312
|
actual: null,
|
|
255
313
|
children: []
|
|
256
|
-
}
|
|
314
|
+
}, issues, nodes);
|
|
315
|
+
return nodes;
|
|
257
316
|
}
|
|
258
317
|
if (!expected.validator && live.validator) {
|
|
259
|
-
const
|
|
260
|
-
issues.push({
|
|
318
|
+
const issue = {
|
|
261
319
|
kind: "extra_validator",
|
|
262
320
|
table: collName,
|
|
263
321
|
message: `Extra validator on collection "${collName}"`
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
322
|
+
};
|
|
323
|
+
const nodes = [];
|
|
324
|
+
emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, issue, {
|
|
325
|
+
status: strict ? "fail" : "warn",
|
|
267
326
|
kind: "validator",
|
|
268
327
|
name: "validator",
|
|
269
328
|
contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.validator`,
|
|
@@ -272,21 +331,23 @@ function diffValidator(collName, live, expected, strict, issues) {
|
|
|
272
331
|
expected: null,
|
|
273
332
|
actual: canonicalize(live.validator.jsonSchema),
|
|
274
333
|
children: []
|
|
275
|
-
}
|
|
334
|
+
}, issues, nodes);
|
|
335
|
+
return nodes;
|
|
276
336
|
}
|
|
277
337
|
const liveVal = live.validator;
|
|
278
338
|
const expectedVal = expected.validator;
|
|
279
339
|
const liveSchema = canonicalize(liveVal.jsonSchema);
|
|
280
340
|
const expectedSchema = canonicalize(expectedVal.jsonSchema);
|
|
281
341
|
if (liveSchema !== expectedSchema || liveVal.validationLevel !== expectedVal.validationLevel || liveVal.validationAction !== expectedVal.validationAction) {
|
|
282
|
-
|
|
342
|
+
const issue = {
|
|
283
343
|
kind: "type_mismatch",
|
|
284
344
|
table: collName,
|
|
285
345
|
expected: expectedSchema,
|
|
286
346
|
actual: liveSchema,
|
|
287
347
|
message: `Validator mismatch on collection "${collName}"`
|
|
288
|
-
}
|
|
289
|
-
|
|
348
|
+
};
|
|
349
|
+
const nodes = [];
|
|
350
|
+
emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, issue, {
|
|
290
351
|
status: "fail",
|
|
291
352
|
kind: "validator",
|
|
292
353
|
name: "validator",
|
|
@@ -304,7 +365,8 @@ function diffValidator(collName, live, expected, strict, issues) {
|
|
|
304
365
|
validationAction: liveVal.validationAction
|
|
305
366
|
},
|
|
306
367
|
children: []
|
|
307
|
-
}
|
|
368
|
+
}, issues, nodes);
|
|
369
|
+
return nodes;
|
|
308
370
|
}
|
|
309
371
|
return [{
|
|
310
372
|
status: "pass",
|
|
@@ -318,18 +380,18 @@ function diffValidator(collName, live, expected, strict, issues) {
|
|
|
318
380
|
children: []
|
|
319
381
|
}];
|
|
320
382
|
}
|
|
321
|
-
function diffOptions(collName, live, expected, strict, issues) {
|
|
383
|
+
function diffOptions(collName, live, expected, strict, collectionControlPolicy, issues) {
|
|
322
384
|
if (!live.options && !expected.options) return [];
|
|
323
385
|
if (!expected.options && live.options) {
|
|
324
|
-
const
|
|
325
|
-
issues.push({
|
|
386
|
+
const issue = {
|
|
326
387
|
kind: "type_mismatch",
|
|
327
388
|
table: collName,
|
|
328
389
|
actual: canonicalize(live.options),
|
|
329
390
|
message: `Extra collection options on "${collName}"`
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
391
|
+
};
|
|
392
|
+
const nodes = [];
|
|
393
|
+
emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, issue, {
|
|
394
|
+
status: strict ? "fail" : "warn",
|
|
333
395
|
kind: "options",
|
|
334
396
|
name: "options",
|
|
335
397
|
contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.options`,
|
|
@@ -338,7 +400,8 @@ function diffOptions(collName, live, expected, strict, issues) {
|
|
|
338
400
|
expected: null,
|
|
339
401
|
actual: live.options,
|
|
340
402
|
children: []
|
|
341
|
-
}
|
|
403
|
+
}, issues, nodes);
|
|
404
|
+
return nodes;
|
|
342
405
|
}
|
|
343
406
|
if (deepEqual(live.options, expected.options)) return [{
|
|
344
407
|
status: "pass",
|
|
@@ -351,14 +414,15 @@ function diffOptions(collName, live, expected, strict, issues) {
|
|
|
351
414
|
actual: canonicalize(live.options),
|
|
352
415
|
children: []
|
|
353
416
|
}];
|
|
354
|
-
|
|
417
|
+
const issue = {
|
|
355
418
|
kind: "type_mismatch",
|
|
356
419
|
table: collName,
|
|
357
420
|
expected: canonicalize(expected.options),
|
|
358
421
|
actual: canonicalize(live.options),
|
|
359
422
|
message: `Collection options mismatch on "${collName}"`
|
|
360
|
-
}
|
|
361
|
-
|
|
423
|
+
};
|
|
424
|
+
const nodes = [];
|
|
425
|
+
emitMongoIssueAndNodeUnderControlPolicy(collectionControlPolicy, issue, {
|
|
362
426
|
status: "fail",
|
|
363
427
|
kind: "options",
|
|
364
428
|
name: "options",
|
|
@@ -368,7 +432,8 @@ function diffOptions(collName, live, expected, strict, issues) {
|
|
|
368
432
|
expected: expected.options,
|
|
369
433
|
actual: live.options,
|
|
370
434
|
children: []
|
|
371
|
-
}
|
|
435
|
+
}, issues, nodes);
|
|
436
|
+
return nodes;
|
|
372
437
|
}
|
|
373
438
|
//#endregion
|
|
374
439
|
//#region src/core/schema-verify/canonicalize-introspection.ts
|
|
@@ -564,7 +629,7 @@ function verifyMongoSchema(options) {
|
|
|
564
629
|
const { contract, schema, strict, context } = options;
|
|
565
630
|
const startTime = Date.now();
|
|
566
631
|
const { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(schema, contractToMongoSchemaIR(contract));
|
|
567
|
-
const { root, issues, counts } = diffMongoSchemas(canonicalLive, canonicalExpected, strict);
|
|
632
|
+
const { root, issues, counts } = diffMongoSchemas(canonicalLive, canonicalExpected, strict, resolveMongoCollectionControlPolicy(contract));
|
|
568
633
|
const ok = counts.fail === 0;
|
|
569
634
|
const profileHash = typeof contract.profileHash === "string" ? contract.profileHash : "";
|
|
570
635
|
return {
|
|
@@ -589,7 +654,12 @@ function verifyMongoSchema(options) {
|
|
|
589
654
|
timings: { total: Date.now() - startTime }
|
|
590
655
|
};
|
|
591
656
|
}
|
|
657
|
+
function resolveMongoCollectionControlPolicy(contract) {
|
|
658
|
+
const collections = contract.storage.namespaces[UNBOUND_NAMESPACE_ID]?.collections ?? {};
|
|
659
|
+
const defaultControlPolicy = contract.defaultControlPolicy;
|
|
660
|
+
return (collectionName) => effectiveControlPolicy(collections[collectionName]?.control, defaultControlPolicy);
|
|
661
|
+
}
|
|
592
662
|
//#endregion
|
|
593
663
|
export { contractToMongoSchemaIR as i, canonicalizeSchemasForVerification as n, diffMongoSchemas as r, verifyMongoSchema as t };
|
|
594
664
|
|
|
595
|
-
//# sourceMappingURL=verify-mongo-schema-
|
|
665
|
+
//# sourceMappingURL=verify-mongo-schema-CFRMURgz.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-mongo-schema-CFRMURgz.mjs","names":["MongoSchemaIRCtor","MongoSchemaCollectionCtor","MongoSchemaIndexCtor","MongoSchemaCollectionOptionsCtor"],"sources":["../src/core/contract-to-schema.ts","../src/core/schema-verify/verifier-disposition.ts","../src/core/schema-verify/mongo-control-verify-emit.ts","../src/core/schema-diff.ts","../src/core/schema-verify/canonicalize-introspection.ts","../src/core/schema-verify/verify-mongo-schema.ts"],"sourcesContent":["import type {\n MongoCollection,\n MongoCollectionOptions,\n MongoContract,\n MongoIndex,\n MongoValidator,\n} from '@prisma-next/mongo-contract';\nimport {\n MongoSchemaCollection,\n MongoSchemaCollectionOptions,\n MongoSchemaIndex,\n MongoSchemaIR,\n MongoSchemaValidator,\n} from '@prisma-next/mongo-schema-ir';\n\nfunction stripIrKind(node: object): Record<string, unknown> {\n const { kind: _kind, ...rest } = node as Record<string, unknown>;\n return rest;\n}\n\nfunction convertIndex(index: MongoIndex): MongoSchemaIndex {\n return new MongoSchemaIndex({\n keys: index.keys,\n unique: index.unique,\n sparse: index.sparse,\n expireAfterSeconds: index.expireAfterSeconds,\n partialFilterExpression: index.partialFilterExpression,\n wildcardProjection: index.wildcardProjection,\n collation: index.collation,\n weights: index.weights,\n default_language: index.default_language,\n language_override: index.language_override,\n });\n}\n\nfunction convertValidator(v: MongoValidator): MongoSchemaValidator {\n return new MongoSchemaValidator({\n jsonSchema: v.jsonSchema,\n validationLevel: v.validationLevel,\n validationAction: v.validationAction,\n });\n}\n\nfunction convertOptions(o: MongoCollectionOptions): MongoSchemaCollectionOptions {\n return new MongoSchemaCollectionOptions({\n ...(o.capped !== undefined && { capped: o.capped }),\n ...(o.timeseries !== undefined && {\n timeseries: {\n timeField: o.timeseries.timeField,\n ...(o.timeseries.metaField !== undefined && { metaField: o.timeseries.metaField }),\n ...(o.timeseries.granularity !== undefined && { granularity: o.timeseries.granularity }),\n },\n }),\n ...(o.collation !== undefined && {\n collation: stripIrKind(o.collation),\n }),\n ...(o.changeStreamPreAndPostImages !== undefined && {\n changeStreamPreAndPostImages: { enabled: o.changeStreamPreAndPostImages.enabled },\n }),\n ...(o.clusteredIndex !== undefined && { clusteredIndex: o.clusteredIndex }),\n });\n}\n\nfunction convertCollection(name: string, def: MongoCollection): MongoSchemaCollection {\n const indexes = (def.indexes ?? []).map(convertIndex);\n return new MongoSchemaCollection({\n name,\n indexes,\n ...(def.validator != null && { validator: convertValidator(def.validator) }),\n ...(def.options != null && { options: convertOptions(def.options) }),\n });\n}\n\nexport function contractToMongoSchemaIR(contract: MongoContract | null): MongoSchemaIR {\n if (!contract) {\n return new MongoSchemaIR([]);\n }\n\n const collections: MongoSchemaCollection[] = [];\n for (const ns of Object.values(contract.storage.namespaces)) {\n for (const [name, def] of Object.entries(ns.collections)) {\n collections.push(convertCollection(name, def));\n }\n }\n\n return new MongoSchemaIR(collections);\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type {\n SchemaIssue,\n VerifierIssueCategory,\n VerifierOutcome,\n} from '@prisma-next/framework-components/control';\nimport { dispositionForCategory } from '@prisma-next/framework-components/control';\n\n/**\n * Classifies the verifier issue kinds the Mongo schema differ emits into the\n * target-neutral categories the framework grades. Mongo only emits the kinds\n * listed below (missing/extra collections, missing/extra indexes, missing/extra\n * validators, and validator/options mismatches coded as `type_mismatch`); any\n * other kind never reaches this classifier and is graded conservatively as a\n * declared-incompatible divergence. Mongo owns this mapping rather than\n * importing the SQL classifier — the two families share only the framework's\n * category grading.\n */\nexport function classifyMongoVerifierIssueKind(kind: SchemaIssue['kind']): VerifierIssueCategory {\n switch (kind) {\n case 'extra_table':\n return 'extraTopLevelObject';\n case 'extra_index':\n case 'extra_validator':\n return 'extraAuxiliary';\n case 'missing_table':\n case 'type_missing':\n return 'declaredMissing';\n case 'index_mismatch':\n case 'type_mismatch':\n return 'declaredIncompatible';\n default:\n return 'declaredIncompatible';\n }\n}\n\nexport function verifierDisposition(\n controlPolicy: ControlPolicy,\n issueKind: SchemaIssue['kind'],\n): VerifierOutcome {\n return dispositionForCategory(controlPolicy, classifyMongoVerifierIssueKind(issueKind));\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type {\n SchemaIssue,\n SchemaVerificationNode,\n VerifierOutcome,\n} from '@prisma-next/framework-components/control';\nimport { verifierDisposition } from './verifier-disposition';\n\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 node status. Call sites stamp 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` no longer diverges from `managed` on a non-strict extra index:\n * both soften to `warn`, because the softening comes from the base status the\n * caller already computed from `strict`, not from per-policy special-casing.\n */\nfunction reconcileMongoOutcome(\n controlPolicy: ControlPolicy,\n issueKind: SchemaIssue['kind'],\n baseStatus: SchemaVerificationNode['status'],\n): VerifierOutcome {\n const disposition = verifierDisposition(controlPolicy, issueKind);\n return disposition === 'fail' ? baseStatus : disposition;\n}\n\nexport function emitMongoIssueAndNodeUnderControlPolicy(\n controlPolicy: ControlPolicy,\n issue: SchemaIssue,\n node: SchemaVerificationNode,\n issues: SchemaIssue[],\n nodes: SchemaVerificationNode[],\n): VerifierOutcome {\n const outcome = reconcileMongoOutcome(controlPolicy, issue.kind, node.status);\n if (outcome === 'suppress') {\n return 'suppress';\n }\n issues.push(issue);\n nodes.push({ ...node, status: outcome });\n return outcome;\n}\n","import type { ControlPolicy } from '@prisma-next/contract/types';\nimport type {\n SchemaIssue,\n SchemaVerificationNode,\n} from '@prisma-next/framework-components/control';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type {\n MongoSchemaCollection,\n MongoSchemaIndex,\n MongoSchemaIR,\n} from '@prisma-next/mongo-schema-ir';\nimport { canonicalize, deepEqual } from '@prisma-next/mongo-schema-ir';\nimport { emitMongoIssueAndNodeUnderControlPolicy } from './schema-verify/mongo-control-verify-emit';\n\nexport function diffMongoSchemas(\n live: MongoSchemaIR,\n expected: MongoSchemaIR,\n strict: boolean,\n collectionControlPolicy: (collectionName: string) => ControlPolicy,\n): {\n root: SchemaVerificationNode;\n issues: SchemaIssue[];\n counts: { pass: number; warn: number; fail: number; totalNodes: number };\n} {\n const issues: SchemaIssue[] = [];\n const collectionChildren: SchemaVerificationNode[] = [];\n let pass = 0;\n let warn = 0;\n let fail = 0;\n\n const allNames = new Set([...live.collectionNames, ...expected.collectionNames]);\n\n for (const name of [...allNames].sort()) {\n const liveColl = live.collection(name);\n const expectedColl = expected.collection(name);\n\n if (!liveColl && expectedColl) {\n const controlPolicy = collectionControlPolicy(name);\n const issue: SchemaIssue = {\n kind: 'missing_table',\n table: name,\n message: `Collection \"${name}\" is missing from the database`,\n };\n const disposition = emitMongoIssueAndNodeUnderControlPolicy(\n controlPolicy,\n issue,\n {\n status: 'fail',\n kind: 'collection',\n name,\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${name}`,\n code: 'MISSING_COLLECTION',\n message: `Collection \"${name}\" is missing`,\n expected: name,\n actual: null,\n children: [],\n },\n issues,\n collectionChildren,\n );\n if (disposition === 'fail') fail++;\n else if (disposition === 'warn') warn++;\n continue;\n }\n\n if (liveColl && !expectedColl) {\n const controlPolicy = collectionControlPolicy(name);\n const issue: SchemaIssue = {\n kind: 'extra_table',\n table: name,\n message: `Extra collection \"${name}\" exists in the database but not in the contract`,\n };\n const baseStatus = strict ? 'fail' : 'warn';\n const disposition = emitMongoIssueAndNodeUnderControlPolicy(\n controlPolicy,\n issue,\n {\n status: baseStatus,\n kind: 'collection',\n name,\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${name}`,\n code: 'EXTRA_COLLECTION',\n message: `Extra collection \"${name}\" found`,\n expected: null,\n actual: name,\n children: [],\n },\n issues,\n collectionChildren,\n );\n if (disposition === 'fail') fail++;\n else if (disposition === 'warn') warn++;\n continue;\n }\n\n const lc = liveColl as MongoSchemaCollection;\n const ec = expectedColl as MongoSchemaCollection;\n const controlPolicy = collectionControlPolicy(name);\n const indexChildren = diffIndexes(name, lc, ec, strict, controlPolicy, issues);\n const validatorChildren = diffValidator(name, lc, ec, strict, controlPolicy, issues);\n const optionsChildren = diffOptions(name, lc, ec, strict, controlPolicy, issues);\n const children = [...indexChildren, ...validatorChildren, ...optionsChildren];\n\n const worstStatus = children.reduce<'pass' | 'warn' | 'fail'>(\n (s, c) => (c.status === 'fail' ? 'fail' : c.status === 'warn' && s !== 'fail' ? 'warn' : s),\n 'pass',\n );\n\n for (const c of children) {\n if (c.status === 'pass') pass++;\n else if (c.status === 'warn') warn++;\n else fail++;\n }\n\n if (children.length === 0) {\n pass++;\n }\n\n collectionChildren.push({\n status: worstStatus,\n kind: 'collection',\n name,\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${name}`,\n code: worstStatus === 'pass' ? 'MATCH' : 'DRIFT',\n message:\n worstStatus === 'pass' ? `Collection \"${name}\" matches` : `Collection \"${name}\" has drift`,\n expected: name,\n actual: name,\n children,\n });\n }\n\n const rootStatus = fail > 0 ? 'fail' : warn > 0 ? 'warn' : 'pass';\n const totalNodes = pass + warn + fail + collectionChildren.length;\n\n const root: SchemaVerificationNode = {\n status: rootStatus,\n kind: 'root',\n name: 'mongo-schema',\n contractPath: 'storage',\n code: rootStatus === 'pass' ? 'MATCH' : 'DRIFT',\n message: rootStatus === 'pass' ? 'Schema matches' : 'Schema has drift',\n expected: null,\n actual: null,\n children: collectionChildren,\n };\n\n return { root, issues, counts: { pass, warn, fail, totalNodes } };\n}\n\nfunction buildIndexLookupKey(index: MongoSchemaIndex): string {\n const keys = index.keys.map((k) => `${k.field}:${k.direction}`).join(',');\n const opts = [\n index.unique ? 'unique' : '',\n index.sparse ? 'sparse' : '',\n index.expireAfterSeconds != null ? `ttl:${index.expireAfterSeconds}` : '',\n index.partialFilterExpression ? `pfe:${canonicalize(index.partialFilterExpression)}` : '',\n index.wildcardProjection ? `wp:${canonicalize(index.wildcardProjection)}` : '',\n index.collation ? `col:${canonicalize(index.collation)}` : '',\n index.weights ? `wt:${canonicalize(index.weights)}` : '',\n index.default_language ? `dl:${index.default_language}` : '',\n index.language_override ? `lo:${index.language_override}` : '',\n ]\n .filter(Boolean)\n .join(';');\n return opts ? `${keys}|${opts}` : keys;\n}\n\nfunction formatIndexName(index: MongoSchemaIndex): string {\n return index.keys.map((k) => `${k.field}:${k.direction}`).join(', ');\n}\n\nfunction diffIndexes(\n collName: string,\n live: MongoSchemaCollection,\n expected: MongoSchemaCollection,\n strict: boolean,\n collectionControlPolicy: ControlPolicy,\n issues: SchemaIssue[],\n): SchemaVerificationNode[] {\n const nodes: SchemaVerificationNode[] = [];\n const liveLookup = new Map<string, MongoSchemaIndex>();\n for (const idx of live.indexes) liveLookup.set(buildIndexLookupKey(idx), idx);\n\n const expectedLookup = new Map<string, MongoSchemaIndex>();\n for (const idx of expected.indexes) expectedLookup.set(buildIndexLookupKey(idx), idx);\n\n for (const [key, idx] of expectedLookup) {\n if (liveLookup.has(key)) {\n nodes.push({\n status: 'pass',\n kind: 'index',\n name: formatIndexName(idx),\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.indexes`,\n code: 'MATCH',\n message: `Index ${formatIndexName(idx)} matches`,\n expected: key,\n actual: key,\n children: [],\n });\n } else {\n const issue: SchemaIssue = {\n kind: 'index_mismatch',\n table: collName,\n indexOrConstraint: formatIndexName(idx),\n message: `Index ${formatIndexName(idx)} missing on collection \"${collName}\"`,\n };\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: 'fail',\n kind: 'index',\n name: formatIndexName(idx),\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.indexes`,\n code: 'MISSING_INDEX',\n message: `Index ${formatIndexName(idx)} missing`,\n expected: key,\n actual: null,\n children: [],\n },\n issues,\n nodes,\n );\n }\n }\n\n for (const [key, idx] of liveLookup) {\n if (!expectedLookup.has(key)) {\n const issue: SchemaIssue = {\n kind: 'extra_index',\n table: collName,\n indexOrConstraint: formatIndexName(idx),\n message: `Extra index ${formatIndexName(idx)} on collection \"${collName}\"`,\n };\n const baseStatus = strict ? 'fail' : 'warn';\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: baseStatus,\n kind: 'index',\n name: formatIndexName(idx),\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.indexes`,\n code: 'EXTRA_INDEX',\n message: `Extra index ${formatIndexName(idx)}`,\n expected: null,\n actual: key,\n children: [],\n },\n issues,\n nodes,\n );\n }\n }\n\n return nodes;\n}\n\nfunction diffValidator(\n collName: string,\n live: MongoSchemaCollection,\n expected: MongoSchemaCollection,\n strict: boolean,\n collectionControlPolicy: ControlPolicy,\n issues: SchemaIssue[],\n): SchemaVerificationNode[] {\n if (!live.validator && !expected.validator) return [];\n\n if (expected.validator && !live.validator) {\n const issue: SchemaIssue = {\n kind: 'type_missing',\n table: collName,\n message: `Validator missing on collection \"${collName}\"`,\n };\n const nodes: SchemaVerificationNode[] = [];\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: 'fail',\n kind: 'validator',\n name: 'validator',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.validator`,\n code: 'MISSING_VALIDATOR',\n message: 'Validator missing',\n expected: canonicalize(expected.validator.jsonSchema),\n actual: null,\n children: [],\n },\n issues,\n nodes,\n );\n return nodes;\n }\n\n if (!expected.validator && live.validator) {\n const issue: SchemaIssue = {\n kind: 'extra_validator',\n table: collName,\n message: `Extra validator on collection \"${collName}\"`,\n };\n const nodes: SchemaVerificationNode[] = [];\n const baseStatus = strict ? 'fail' : 'warn';\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: baseStatus,\n kind: 'validator',\n name: 'validator',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.validator`,\n code: 'EXTRA_VALIDATOR',\n message: 'Extra validator found',\n expected: null,\n actual: canonicalize(live.validator.jsonSchema),\n children: [],\n },\n issues,\n nodes,\n );\n return nodes;\n }\n\n const liveVal = live.validator as NonNullable<typeof live.validator>;\n const expectedVal = expected.validator as NonNullable<typeof expected.validator>;\n const liveSchema = canonicalize(liveVal.jsonSchema);\n const expectedSchema = canonicalize(expectedVal.jsonSchema);\n\n if (\n liveSchema !== expectedSchema ||\n liveVal.validationLevel !== expectedVal.validationLevel ||\n liveVal.validationAction !== expectedVal.validationAction\n ) {\n const issue: SchemaIssue = {\n kind: 'type_mismatch',\n table: collName,\n expected: expectedSchema,\n actual: liveSchema,\n message: `Validator mismatch on collection \"${collName}\"`,\n };\n const nodes: SchemaVerificationNode[] = [];\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: 'fail',\n kind: 'validator',\n name: 'validator',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.validator`,\n code: 'VALIDATOR_MISMATCH',\n message: 'Validator mismatch',\n expected: {\n jsonSchema: expectedVal.jsonSchema,\n validationLevel: expectedVal.validationLevel,\n validationAction: expectedVal.validationAction,\n },\n actual: {\n jsonSchema: liveVal.jsonSchema,\n validationLevel: liveVal.validationLevel,\n validationAction: liveVal.validationAction,\n },\n children: [],\n },\n issues,\n nodes,\n );\n return nodes;\n }\n\n return [\n {\n status: 'pass',\n kind: 'validator',\n name: 'validator',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.validator`,\n code: 'MATCH',\n message: 'Validator matches',\n expected: expectedSchema,\n actual: liveSchema,\n children: [],\n },\n ];\n}\n\nfunction diffOptions(\n collName: string,\n live: MongoSchemaCollection,\n expected: MongoSchemaCollection,\n strict: boolean,\n collectionControlPolicy: ControlPolicy,\n issues: SchemaIssue[],\n): SchemaVerificationNode[] {\n if (!live.options && !expected.options) return [];\n\n if (!expected.options && live.options) {\n const issue: SchemaIssue = {\n kind: 'type_mismatch',\n table: collName,\n actual: canonicalize(live.options),\n message: `Extra collection options on \"${collName}\"`,\n };\n const nodes: SchemaVerificationNode[] = [];\n const baseStatus = strict ? 'fail' : 'warn';\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: baseStatus,\n kind: 'options',\n name: 'options',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.options`,\n code: 'EXTRA_OPTIONS',\n message: 'Extra collection options found',\n expected: null,\n actual: live.options,\n children: [],\n },\n issues,\n nodes,\n );\n return nodes;\n }\n\n if (deepEqual(live.options, expected.options)) {\n return [\n {\n status: 'pass',\n kind: 'options',\n name: 'options',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.options`,\n code: 'MATCH',\n message: 'Collection options match',\n expected: canonicalize(expected.options),\n actual: canonicalize(live.options),\n children: [],\n },\n ];\n }\n\n const issue: SchemaIssue = {\n kind: 'type_mismatch',\n table: collName,\n expected: canonicalize(expected.options),\n actual: canonicalize(live.options),\n message: `Collection options mismatch on \"${collName}\"`,\n };\n const nodes: SchemaVerificationNode[] = [];\n emitMongoIssueAndNodeUnderControlPolicy(\n collectionControlPolicy,\n issue,\n {\n status: 'fail',\n kind: 'options',\n name: 'options',\n contractPath: `storage.namespaces.${UNBOUND_NAMESPACE_ID}.collections.${collName}.options`,\n code: 'OPTIONS_MISMATCH',\n message: 'Collection options mismatch',\n expected: expected.options,\n actual: live.options,\n children: [],\n },\n issues,\n nodes,\n );\n return nodes;\n}\n","/**\n * Canonicalizes a live (introspected) `MongoSchemaIR` against the expected\n * (contract-built) IR before diffing. MongoDB applies server-side defaults\n * to several option/index families that are absent from authored contracts,\n * which would otherwise cause `verifyMongoSchema` to report false-positive\n * drift on a fresh `migrate` run.\n *\n * The normalization is contract-aware where it has to be: server defaults\n * are stripped from the live IR for fields the contract did not specify, so\n * a contract that *does* specify a value still gets compared faithfully.\n *\n * Symmetric defaults — like `changeStreamPreAndPostImages: { enabled: false }`,\n * which is equivalent to \"absent\" on both sides — are stripped from both IRs\n * so either authoring style verifies.\n */\n\nimport type {\n MongoSchemaCollection,\n MongoSchemaCollectionOptions,\n MongoSchemaIndex,\n MongoSchemaIR,\n} from '@prisma-next/mongo-schema-ir';\nimport {\n MongoSchemaCollection as MongoSchemaCollectionCtor,\n MongoSchemaCollectionOptions as MongoSchemaCollectionOptionsCtor,\n MongoSchemaIndex as MongoSchemaIndexCtor,\n MongoSchemaIR as MongoSchemaIRCtor,\n} from '@prisma-next/mongo-schema-ir';\nimport { ifDefined } from '@prisma-next/utils/defined';\n\nexport interface CanonicalizedSchemas {\n readonly live: MongoSchemaIR;\n readonly expected: MongoSchemaIR;\n}\n\nexport function canonicalizeSchemasForVerification(\n live: MongoSchemaIR,\n expected: MongoSchemaIR,\n): CanonicalizedSchemas {\n const expectedByName = new Map<string, MongoSchemaCollection>();\n for (const c of expected.collections) expectedByName.set(c.name, c);\n\n const liveByName = new Map<string, MongoSchemaCollection>();\n for (const c of live.collections) liveByName.set(c.name, c);\n\n const canonicalLive = live.collections.map((c) =>\n canonicalizeLiveCollection(c, expectedByName.get(c.name)),\n );\n const canonicalExpected = expected.collections.map((c) =>\n canonicalizeExpectedCollection(c, liveByName.get(c.name)),\n );\n\n return {\n live: new MongoSchemaIRCtor(canonicalLive),\n expected: new MongoSchemaIRCtor(canonicalExpected),\n };\n}\n\nfunction canonicalizeLiveCollection(\n liveColl: MongoSchemaCollection,\n expectedColl: MongoSchemaCollection | undefined,\n): MongoSchemaCollection {\n const expectedIndexes = expectedColl?.indexes ?? [];\n const indexes = liveColl.indexes.map((idx) =>\n canonicalizeLiveIndex(idx, findExpectedIndexCounterpart(idx, expectedIndexes)),\n );\n\n const options = liveColl.options\n ? canonicalizeLiveOptions(liveColl.options, expectedColl?.options)\n : undefined;\n\n return new MongoSchemaCollectionCtor({\n name: liveColl.name,\n indexes,\n ...ifDefined('validator', liveColl.validator),\n ...ifDefined('options', options),\n });\n}\n\nfunction canonicalizeExpectedCollection(\n expectedColl: MongoSchemaCollection,\n liveColl: MongoSchemaCollection | undefined,\n): MongoSchemaCollection {\n // Symmetric text-index key ordering: a contract-shaped text index preserves\n // the user-authored field order, but the introspected counterpart comes\n // back from MongoDB with `weights` keys in alphabetical order, so we\n // canonicalize both sides to alphabetical text-key order. The order of\n // text fields within the text block is semantically irrelevant — relevance\n // is governed by `weights`, not key order.\n const indexes = expectedColl.indexes.map(canonicalizeTextIndexKeyOrder);\n\n const options = expectedColl.options\n ? canonicalizeExpectedOptions(expectedColl.options, liveColl?.options)\n : undefined;\n\n return new MongoSchemaCollectionCtor({\n name: expectedColl.name,\n indexes,\n ...ifDefined('validator', expectedColl.validator),\n ...ifDefined('options', options),\n });\n}\n\nfunction canonicalizeTextIndexKeyOrder(index: MongoSchemaIndex): MongoSchemaIndex {\n const hasTextKey = index.keys.some((k) => k.direction === 'text');\n if (!hasTextKey) return index;\n return new MongoSchemaIndexCtor({\n keys: sortTextKeys(index.keys),\n unique: index.unique,\n ...ifDefined('sparse', index.sparse),\n ...ifDefined('expireAfterSeconds', index.expireAfterSeconds),\n ...ifDefined('partialFilterExpression', index.partialFilterExpression),\n ...ifDefined('wildcardProjection', index.wildcardProjection),\n ...ifDefined('collation', index.collation),\n ...ifDefined('weights', index.weights),\n ...ifDefined('default_language', index.default_language),\n ...ifDefined('language_override', index.language_override),\n });\n}\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(\n keys: ReadonlyArray<{\n readonly field: string;\n readonly direction: 'text' | 1 | -1 | '2dsphere' | '2d' | 'hashed';\n }>,\n): ReadonlyArray<{\n readonly field: string;\n readonly direction: 'text' | 1 | -1 | '2dsphere' | '2d' | 'hashed';\n}> {\n const textEntries = keys.filter((k) => k.direction === 'text');\n if (textEntries.length <= 1) return keys;\n const sortedText = [...textEntries].sort((a, b) => a.field.localeCompare(b.field));\n let textIdx = 0;\n return keys.map((k) => {\n if (k.direction !== 'text') return k;\n const next = sortedText[textIdx++];\n /* 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 if (next === undefined) {\n throw new Error('sortTextKeys: text-key counts mismatched');\n }\n return next;\n });\n}\n\nfunction canonicalizeLiveIndex(\n liveIndex: MongoSchemaIndex,\n expectedIndex: MongoSchemaIndex | undefined,\n): MongoSchemaIndex {\n const projectedKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n const collation = liveIndex.collation\n ? stripUnspecifiedFields(liveIndex.collation, expectedIndex?.collation)\n : liveIndex.collation;\n\n // Text-index server defaults: when the contract did not set\n // `weights`/`default_language`/`language_override`, MongoDB applies\n // `weights = {<field>: 1, ...}` (uniform), `'english'`, and `'language'`\n // respectively. Strip them from live *only* when the live value matches\n // those defaults — preserving non-default live values lets the verifier\n // surface drift when the live index is tampered (e.g. weights tuned\n // out-of-band, custom `default_language`/`language_override`) even though\n // the contract authored neither.\n const weights =\n expectedIndex?.weights === undefined && hasDefaultTextWeights(projectedKeys, liveIndex.weights)\n ? undefined\n : liveIndex.weights;\n const default_language =\n expectedIndex?.default_language === undefined && liveIndex.default_language === 'english'\n ? undefined\n : liveIndex.default_language;\n const language_override =\n expectedIndex?.language_override === undefined && liveIndex.language_override === 'language'\n ? undefined\n : liveIndex.language_override;\n\n return new MongoSchemaIndexCtor({\n keys: projectedKeys,\n unique: liveIndex.unique,\n ...ifDefined('sparse', liveIndex.sparse),\n ...ifDefined('expireAfterSeconds', liveIndex.expireAfterSeconds),\n ...ifDefined('partialFilterExpression', liveIndex.partialFilterExpression),\n ...ifDefined('wildcardProjection', liveIndex.wildcardProjection),\n ...ifDefined('collation', collation),\n ...ifDefined('weights', weights),\n ...ifDefined('default_language', default_language),\n ...ifDefined('language_override', language_override),\n });\n}\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(\n liveIndex: MongoSchemaIndex,\n expectedIndexes: ReadonlyArray<MongoSchemaIndex>,\n): MongoSchemaIndex | undefined {\n const projectedLiveKeys = sortTextKeys(projectTextIndexKeys(liveIndex));\n const liveKeySig = projectedLiveKeys.map((k) => `${k.field}:${k.direction}`).join(',');\n for (const expected of expectedIndexes) {\n const expectedKeySig = sortTextKeys(expected.keys)\n .map((k) => `${k.field}:${k.direction}`)\n .join(',');\n if (expectedKeySig === liveKeySig) return expected;\n }\n return undefined;\n}\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: MongoSchemaIndex): ReadonlyArray<{\n readonly field: string;\n readonly direction: 'text' | 1 | -1 | '2dsphere' | '2d' | 'hashed';\n}> {\n const isTextIndex =\n liveIndex.keys.length >= 1 &&\n liveIndex.keys.some((k) => k.field === '_fts' && k.direction === 'text');\n\n if (!isTextIndex || !liveIndex.weights) return liveIndex.keys;\n\n const textKeys = Object.keys(liveIndex.weights).map((field) => ({\n field,\n direction: 'text' as const,\n }));\n\n // Splice the projected text fields into the original `_fts/_ftsx` slot so\n // compound text indexes that mix scalar prefixes *and* suffixes — e.g.\n // `[prefix, _fts, _ftsx, suffix]` — keep their original layout. Flattening\n // scalars first would yield `[prefix, suffix, ...text]`, which `sortTextKeys`\n // (downstream) cannot recover because it only reorders text-direction\n // entries within their existing positions. MongoDB always emits exactly one\n // `_fts`/`_ftsx` pair per index, so we don't need to guard against\n // duplicates.\n type IndexKey = (typeof liveIndex.keys)[number];\n const projectedKeys: IndexKey[] = [];\n for (const key of liveIndex.keys) {\n if (key.field === '_ftsx') continue;\n if (key.field === '_fts') {\n projectedKeys.push(...textKeys);\n continue;\n }\n projectedKeys.push(key);\n }\n return projectedKeys;\n}\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(\n projectedKeys: ReadonlyArray<{\n readonly field: string;\n readonly direction: 'text' | 1 | -1 | '2dsphere' | '2d' | 'hashed';\n }>,\n liveWeights: MongoSchemaIndex['weights'],\n): boolean {\n if (liveWeights === undefined) return false;\n const textFields = projectedKeys.filter((k) => k.direction === 'text').map((k) => k.field);\n return textFields.every((field) => liveWeights[field] === 1);\n}\n\nfunction canonicalizeLiveOptions(\n liveOptions: MongoSchemaCollectionOptions,\n expectedOptions: MongoSchemaCollectionOptions | undefined,\n): MongoSchemaCollectionOptions | undefined {\n const collation = liveOptions.collation\n ? stripUnspecifiedFields(liveOptions.collation, expectedOptions?.collation)\n : undefined;\n\n // Timeseries: drop `bucketMaxSpanSeconds` (and any other server-applied\n // extras) when the contract did not specify them.\n const timeseries = liveOptions.timeseries\n ? (stripUnspecifiedFields(\n liveOptions.timeseries as Record<string, unknown>,\n expectedOptions?.timeseries as Record<string, unknown> | undefined,\n ) as MongoSchemaCollectionOptions['timeseries'])\n : undefined;\n\n // ClusteredIndex: drop `key`, `unique`, `v` and any other server-applied\n // extras when the contract did not specify them.\n const clusteredIndex = liveOptions.clusteredIndex\n ? (stripUnspecifiedFields(\n liveOptions.clusteredIndex as Record<string, unknown>,\n expectedOptions?.clusteredIndex as Record<string, unknown> | undefined,\n ) as MongoSchemaCollectionOptions['clusteredIndex'])\n : undefined;\n\n // changeStreamPreAndPostImages: `{enabled: false}` is equivalent to\n // \"absent\". Strip it from live so it round-trips with a contract that\n // omits the field, and is symmetric with the expected-side stripping.\n const changeStreamPreAndPostImages = isDisabledChangeStream(\n liveOptions.changeStreamPreAndPostImages,\n )\n ? undefined\n : liveOptions.changeStreamPreAndPostImages;\n\n const hasMeaningful =\n liveOptions.capped || timeseries || collation || changeStreamPreAndPostImages || clusteredIndex;\n if (!hasMeaningful) return undefined;\n\n return new MongoSchemaCollectionOptionsCtor({\n ...ifDefined('capped', liveOptions.capped),\n ...ifDefined('timeseries', timeseries),\n ...ifDefined('collation', collation),\n ...ifDefined('changeStreamPreAndPostImages', changeStreamPreAndPostImages),\n ...ifDefined('clusteredIndex', clusteredIndex),\n });\n}\n\nfunction canonicalizeExpectedOptions(\n expectedOptions: MongoSchemaCollectionOptions,\n _liveOptions: MongoSchemaCollectionOptions | undefined,\n): MongoSchemaCollectionOptions | undefined {\n // Symmetric: a contract `{enabled: false}` is equivalent to absent.\n const changeStreamPreAndPostImages = isDisabledChangeStream(\n expectedOptions.changeStreamPreAndPostImages,\n )\n ? undefined\n : expectedOptions.changeStreamPreAndPostImages;\n\n const hasMeaningful =\n expectedOptions.capped ||\n expectedOptions.timeseries ||\n expectedOptions.collation ||\n changeStreamPreAndPostImages ||\n expectedOptions.clusteredIndex;\n if (!hasMeaningful) return undefined;\n\n return new MongoSchemaCollectionOptionsCtor({\n ...ifDefined('capped', expectedOptions.capped),\n ...ifDefined('timeseries', expectedOptions.timeseries),\n ...ifDefined('collation', expectedOptions.collation),\n ...ifDefined('changeStreamPreAndPostImages', changeStreamPreAndPostImages),\n ...ifDefined('clusteredIndex', expectedOptions.clusteredIndex),\n });\n}\n\nfunction isDisabledChangeStream(value: { enabled: boolean } | undefined): boolean {\n return value !== undefined && value.enabled === false;\n}\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 stripUnspecifiedFields(\n live: Record<string, unknown>,\n expected: Record<string, unknown> | undefined,\n): Record<string, unknown> {\n if (expected === undefined) return live;\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(expected)) {\n if (Object.hasOwn(live, key)) out[key] = live[key];\n }\n return out;\n}\n","import { type ControlPolicy, effectiveControlPolicy } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type {\n OperationContext,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport { VERIFY_CODE_SCHEMA_FAILURE } from '@prisma-next/framework-components/control';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type { MongoCollection, MongoContract } from '@prisma-next/mongo-contract';\nimport type { MongoSchemaIR } from '@prisma-next/mongo-schema-ir';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { contractToMongoSchemaIR } from '../contract-to-schema';\nimport { diffMongoSchemas } from '../schema-diff';\nimport { canonicalizeSchemasForVerification } from './canonicalize-introspection';\n\nexport interface VerifyMongoSchemaOptions {\n readonly contract: MongoContract;\n readonly schema: MongoSchemaIR;\n readonly strict: boolean;\n readonly context?: OperationContext;\n /**\n * Active framework components participating in this composition. Mongo\n * verification does not currently consult them, but the parameter exists\n * for parity with `verifySqlSchema` so callers can pass the same envelope.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', string>>;\n}\n\nexport function verifyMongoSchema(options: VerifyMongoSchemaOptions): VerifyDatabaseSchemaResult {\n const { contract, schema, strict, context } = options;\n const startTime = Date.now();\n\n const expectedIR = contractToMongoSchemaIR(contract);\n // Strip server-applied defaults (and authored equivalents) before diffing so\n // the verifier compares like-with-like — see `canonicalize-introspection.ts`.\n const { live: canonicalLive, expected: canonicalExpected } = canonicalizeSchemasForVerification(\n schema,\n expectedIR,\n );\n const collectionControlPolicy = resolveMongoCollectionControlPolicy(contract);\n const { root, issues, counts } = diffMongoSchemas(\n canonicalLive,\n canonicalExpected,\n strict,\n collectionControlPolicy,\n );\n\n const ok = counts.fail === 0;\n const profileHash = typeof contract.profileHash === 'string' ? contract.profileHash : '';\n\n return {\n ok,\n ...ifDefined('code', ok ? undefined : VERIFY_CODE_SCHEMA_FAILURE),\n summary: ok ? 'Schema matches contract' : `Schema verification found ${counts.fail} issue(s)`,\n contract: {\n storageHash: contract.storage.storageHash,\n ...(profileHash ? { profileHash } : {}),\n },\n target: { expected: contract.target },\n schema: { issues, root, counts },\n meta: {\n strict,\n ...ifDefined('contractPath', context?.contractPath),\n ...ifDefined('configPath', context?.configPath),\n },\n timings: { total: Date.now() - startTime },\n };\n}\n\nfunction resolveMongoCollectionControlPolicy(\n contract: MongoContract,\n): (collectionName: string) => ControlPolicy {\n const namespace = contract.storage.namespaces[UNBOUND_NAMESPACE_ID];\n const collections: Record<string, MongoCollection> = namespace?.collections ?? {};\n const defaultControlPolicy = contract.defaultControlPolicy;\n return (collectionName: string) =>\n effectiveControlPolicy(collections[collectionName]?.control, defaultControlPolicy);\n}\n"],"mappings":";;;;;;AAeA,SAAS,YAAY,MAAuC;CA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AAQ,WAAW,iBAC/B,eACA,mBACA,QAJ8B,oCAAoC,QAK5C,CACxB;CAEA,MAAM,KAAK,OAAO,SAAS;CAC3B,MAAM,cAAc,OAAO,SAAS,gBAAgB,WAAW,SAAS,cAAc;CAEtF,OAAO;EACL;EACA,GAAG,UAAU,QAAQ,KAAK,KAAA,IAAY,0BAA0B;EAChE,SAAS,KAAK,4BAA4B,6BAA6B,OAAO,KAAK;EACnF,UAAU;GACR,aAAa,SAAS,QAAQ;GAC9B,GAAI,cAAc,EAAE,YAAY,IAAI,CAAC;EACvC;EACA,QAAQ,EAAE,UAAU,SAAS,OAAO;EACpC,QAAQ;GAAE;GAAQ;GAAM;EAAO;EAC/B,MAAM;GACJ;GACA,GAAG,UAAU,gBAAgB,SAAS,YAAY;GAClD,GAAG,UAAU,cAAc,SAAS,UAAU;EAChD;EACA,SAAS,EAAE,OAAO,KAAK,IAAI,IAAI,UAAU;CAC3C;AACF;AAEA,SAAS,oCACP,UAC2C;CAE3C,MAAM,cADY,SAAS,QAAQ,WAAW,uBACkB,eAAe,CAAC;CAChF,MAAM,uBAAuB,SAAS;CACtC,QAAQ,mBACN,uBAAuB,YAAY,iBAAiB,SAAS,oBAAoB;AACrF"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/family-mongo",
|
|
3
|
-
"version": "0.12.0-dev.
|
|
3
|
+
"version": "0.12.0-dev.30",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "Mongo family descriptor for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/contract": "0.12.0-dev.
|
|
10
|
-
"@prisma-next/emitter": "0.12.0-dev.
|
|
11
|
-
"@prisma-next/errors": "0.12.0-dev.
|
|
12
|
-
"@prisma-next/framework-components": "0.12.0-dev.
|
|
13
|
-
"@prisma-next/migration-tools": "0.12.0-dev.
|
|
14
|
-
"@prisma-next/mongo-contract": "0.12.0-dev.
|
|
15
|
-
"@prisma-next/mongo-emitter": "0.12.0-dev.
|
|
16
|
-
"@prisma-next/mongo-query-ast": "0.12.0-dev.
|
|
17
|
-
"@prisma-next/mongo-schema-ir": "0.12.0-dev.
|
|
18
|
-
"@prisma-next/utils": "0.12.0-dev.
|
|
9
|
+
"@prisma-next/contract": "0.12.0-dev.30",
|
|
10
|
+
"@prisma-next/emitter": "0.12.0-dev.30",
|
|
11
|
+
"@prisma-next/errors": "0.12.0-dev.30",
|
|
12
|
+
"@prisma-next/framework-components": "0.12.0-dev.30",
|
|
13
|
+
"@prisma-next/migration-tools": "0.12.0-dev.30",
|
|
14
|
+
"@prisma-next/mongo-contract": "0.12.0-dev.30",
|
|
15
|
+
"@prisma-next/mongo-emitter": "0.12.0-dev.30",
|
|
16
|
+
"@prisma-next/mongo-query-ast": "0.12.0-dev.30",
|
|
17
|
+
"@prisma-next/mongo-schema-ir": "0.12.0-dev.30",
|
|
18
|
+
"@prisma-next/utils": "0.12.0-dev.30",
|
|
19
19
|
"arktype": "^2.2.0",
|
|
20
20
|
"pathe": "^2.0.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@prisma-next/mongo-contract-ts": "0.12.0-dev.
|
|
24
|
-
"@prisma-next/test-utils": "0.12.0-dev.
|
|
25
|
-
"@prisma-next/tsconfig": "0.12.0-dev.
|
|
26
|
-
"@prisma-next/tsdown": "0.12.0-dev.
|
|
23
|
+
"@prisma-next/mongo-contract-ts": "0.12.0-dev.30",
|
|
24
|
+
"@prisma-next/test-utils": "0.12.0-dev.30",
|
|
25
|
+
"@prisma-next/tsconfig": "0.12.0-dev.30",
|
|
26
|
+
"@prisma-next/tsdown": "0.12.0-dev.30",
|
|
27
27
|
"tsdown": "0.22.0",
|
|
28
28
|
"typescript": "5.9.3",
|
|
29
29
|
"vitest": "4.1.6"
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"./ir": "./dist/ir.mjs",
|
|
48
48
|
"./migration": "./dist/migration.mjs",
|
|
49
49
|
"./pack": "./dist/pack.mjs",
|
|
50
|
+
"./runtime": "./dist/runtime.mjs",
|
|
50
51
|
"./schema-verify": "./dist/schema-verify.mjs",
|
|
51
52
|
"./package.json": "./package.json"
|
|
52
53
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
1
|
+
import type { ContractMarkerRecord, LedgerEntryRecord } from '@prisma-next/contract/types';
|
|
2
2
|
import type {
|
|
3
3
|
ControlAdapterDescriptor,
|
|
4
4
|
ControlAdapterInstance,
|
|
@@ -79,9 +79,25 @@ export interface MongoControlAdapter<TTarget extends string = string>
|
|
|
79
79
|
writeLedgerEntry(
|
|
80
80
|
driver: ControlDriverInstance<'mongo', TTarget>,
|
|
81
81
|
space: string,
|
|
82
|
-
entry: {
|
|
82
|
+
entry: {
|
|
83
|
+
readonly edgeId: string;
|
|
84
|
+
readonly from: string;
|
|
85
|
+
readonly to: string;
|
|
86
|
+
readonly migrationName: string;
|
|
87
|
+
readonly migrationHash: string;
|
|
88
|
+
readonly operations: readonly unknown[];
|
|
89
|
+
},
|
|
83
90
|
): Promise<void>;
|
|
84
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Reads the per-migration ledger journal in apply order. When `space` is
|
|
94
|
+
* omitted, returns rows for every space.
|
|
95
|
+
*/
|
|
96
|
+
readLedger(
|
|
97
|
+
driver: ControlDriverInstance<'mongo', TTarget>,
|
|
98
|
+
space?: string,
|
|
99
|
+
): Promise<readonly LedgerEntryRecord[]>;
|
|
100
|
+
|
|
85
101
|
/**
|
|
86
102
|
* Introspects the live database and returns a `MongoSchemaIR`.
|
|
87
103
|
*/
|