@prisma/orm-family-mongo 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1
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/README.md +1 -5
- package/dist/authoring-entity-types-UA5sY_Xm-DeYf_cYq.mjs +87 -0
- package/dist/authoring-entity-types-UA5sY_Xm-DeYf_cYq.mjs.map +1 -0
- package/dist/{canonicalization-hooks-DF3Z6sjO.mjs → canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs} +4 -3
- package/dist/canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs.map +1 -0
- package/dist/codec.d.mts +1 -1
- package/dist/codec.mjs +1 -1
- package/dist/{config-types-CFDf9ivE.mjs → config-types-DYTCUpAs.mjs} +5 -5
- package/dist/config-types-DYTCUpAs.mjs.map +1 -0
- package/dist/contract-builder-BHzQQk70.mjs +965 -0
- package/dist/contract-builder-BHzQQk70.mjs.map +1 -0
- package/dist/{contract-builder-DB8nguDE.d.mts → contract-builder-ClL-xMK2.d.mts} +271 -89
- package/dist/contract-builder-ClL-xMK2.d.mts.map +1 -0
- package/dist/contract-prisma6__provider.d.mts +35 -0
- package/dist/contract-prisma6__provider.d.mts.map +1 -0
- package/dist/contract-prisma6__provider.mjs +1202 -0
- package/dist/contract-prisma6__provider.mjs.map +1 -0
- package/dist/contract-psl.d.mts +152 -28
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +3 -2
- package/dist/contract-psl__provider.mjs +74 -44
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +2 -2
- package/dist/contract-ts.mjs +2 -2
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +2 -2
- package/dist/contract-ts__contract-builder.mjs +1 -1
- package/dist/contract.d.mts +3 -3
- package/dist/contract.mjs +3 -3
- package/dist/contract__canonicalization-hooks.mjs +1 -1
- package/dist/contract__data-type.d.mts +37 -0
- package/dist/contract__data-type.d.mts.map +1 -0
- package/dist/contract__data-type.mjs +2 -0
- package/dist/contract__entity-kinds.d.mts +1 -1
- package/dist/contract__entity-kinds.mjs +1 -1
- package/dist/{control-C7-kthr1.d.mts → control-4pC8N2Rb.d.mts} +32 -19
- package/dist/control-4pC8N2Rb.d.mts.map +1 -0
- package/dist/{control-CClR5JMr.mjs → control-BQMBG11d.mjs} +19 -2
- package/dist/control-BQMBG11d.mjs.map +1 -0
- package/dist/{control-BbZQqmxo.mjs → control-B_pPN58L.mjs} +195 -87
- package/dist/control-B_pPN58L.mjs.map +1 -0
- package/dist/{control-Cj81sPbj.d.mts → control-CvQSMuxa.d.mts} +29 -6
- package/dist/control-CvQSMuxa.d.mts.map +1 -0
- package/dist/{control-adapter-Db5pT77b.d.mts → control-adapter-Bh_ZraGM--5JDb99k.d.mts} +48 -4
- package/dist/control-adapter-Bh_ZraGM--5JDb99k.d.mts.map +1 -0
- package/dist/control-adapter-CndDiTXW.d.mts +1 -0
- package/dist/dist-B8f-pfcT.mjs +1031 -0
- package/dist/dist-B8f-pfcT.mjs.map +1 -0
- package/dist/dist-Bgk36iLI.mjs +53 -0
- package/dist/dist-Bgk36iLI.mjs.map +1 -0
- package/dist/{dist-C7Ykq48Q.mjs → dist-CO2arS1K.mjs} +3 -1
- package/dist/dist-CO2arS1K.mjs.map +1 -0
- package/dist/{dist-Dyp05u64.mjs → dist-gmGbjhmk.mjs} +56 -32
- package/dist/dist-gmGbjhmk.mjs.map +1 -0
- package/dist/dist-xk_0xOR-.mjs +28 -0
- package/dist/dist-xk_0xOR-.mjs.map +1 -0
- package/dist/emitter.d.mts +2 -4
- package/dist/emitter.d.mts.map +1 -1
- package/dist/emitter.mjs +1 -1
- package/dist/{entity-kinds-B4KNTF8z-DPIuUuuB.mjs → entity-kinds-BQBtfVet-B-Px7NHp.mjs} +35 -18
- package/dist/entity-kinds-BQBtfVet-B-Px7NHp.mjs.map +1 -0
- package/dist/{execution-D5XyZ5XS.mjs → execution-CgP1Sdbr.mjs} +6 -3
- package/dist/execution-CgP1Sdbr.mjs.map +1 -0
- package/dist/{execution-CKnUiOfm.d.mts → execution-tPmN5pge.d.mts} +6 -2
- package/dist/execution-tPmN5pge.d.mts.map +1 -0
- package/dist/{exports-Bx-hlnZ3.mjs → exports-BAimNKOs.mjs} +31 -21
- package/dist/exports-BAimNKOs.mjs.map +1 -0
- package/dist/exports-BHQVApAg.mjs +86 -0
- package/dist/exports-BHQVApAg.mjs.map +1 -0
- package/dist/family.d.mts +11 -10
- package/dist/family.mjs +10 -9
- package/dist/family__control-adapter.d.mts +3 -2
- package/dist/family__control.d.mts +2 -2
- package/dist/family__control.mjs +3 -3
- package/dist/family__ir.d.mts +2 -2
- package/dist/family__ir.mjs +3 -3
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__migration.mjs +1 -1
- package/dist/family__pack.d.mts +1 -1
- package/dist/family__pack.mjs +4 -2
- package/dist/family__pack.mjs.map +1 -1
- package/dist/family__runtime.d.mts +3 -3
- package/dist/family__runtime.mjs +3 -2
- package/dist/family__schema-verify.d.mts +1 -1
- package/dist/family__schema-verify.mjs +1 -1
- package/dist/{field-accessor-0oUt6RZC-B_Z30uAA.mjs → field-accessor-0oUt6RZC-CrJVzQiS.mjs} +2 -2
- package/dist/{field-accessor-0oUt6RZC-B_Z30uAA.mjs.map → field-accessor-0oUt6RZC-CrJVzQiS.mjs.map} +1 -1
- package/dist/{field-accessor-DHsAPiW3-BdYCspQC.d.mts → field-accessor-CmxCw9xP-C6jMngbK.d.mts} +35 -24
- package/dist/field-accessor-CmxCw9xP-C6jMngbK.d.mts.map +1 -0
- package/dist/index-9DDQlC5U.d.mts +87 -0
- package/dist/index-9DDQlC5U.d.mts.map +1 -0
- package/dist/{index-BR0ue13b.d.mts → index-BdXzdXGE.d.mts} +14 -8
- package/dist/index-BdXzdXGE.d.mts.map +1 -0
- package/dist/index-BhIiYIXu.d.mts +845 -0
- package/dist/index-BhIiYIXu.d.mts.map +1 -0
- package/dist/index-CQG5l2o9.d.mts +67 -0
- package/dist/index-CQG5l2o9.d.mts.map +1 -0
- package/dist/{index-DAOkcTCK.d.mts → index-FeVOOdZ0.d.mts} +9 -8
- package/dist/index-FeVOOdZ0.d.mts.map +1 -0
- package/dist/index-YY1SU_7o.d.mts +366 -0
- package/dist/index-YY1SU_7o.d.mts.map +1 -0
- package/dist/{index-DxoO-ywI.d.mts → index-rANtsIZG.d.mts} +9 -5
- package/dist/{index-DxoO-ywI.d.mts.map → index-rANtsIZG.d.mts.map} +1 -1
- package/dist/interpreter-BfHdPd7T-DGqi2_Um.mjs +2186 -0
- package/dist/interpreter-BfHdPd7T-DGqi2_Um.mjs.map +1 -0
- package/dist/{ir-CQrenTYt.d.mts → ir-BLC0t6_x.d.mts} +5 -27
- package/dist/ir-BLC0t6_x.d.mts.map +1 -0
- package/dist/{ir-Ch2aPr7a.mjs → ir-DGm0HXbP.mjs} +3 -8
- package/dist/ir-DGm0HXbP.mjs.map +1 -0
- package/dist/lowering.d.mts +1 -1
- package/dist/{migration-dcM7u4HG.mjs → migration-DnQ7_A_B.mjs} +4 -4
- package/dist/migration-DnQ7_A_B.mjs.map +1 -0
- package/dist/{migration-CNDQv5yB.d.mts → migration-YQVmgFU8.d.mts} +7 -7
- package/dist/{migration-CNDQv5yB.d.mts.map → migration-YQVmgFU8.d.mts.map} +1 -1
- package/dist/{mongo-contract-serializer-Cx7Fae8e-C8ZYPXpc.mjs → mongo-contract-serializer-Zx1rvil3-BywiKCpn.mjs} +27 -8
- package/dist/mongo-contract-serializer-Zx1rvil3-BywiKCpn.mjs.map +1 -0
- package/dist/{mongo-contract-view-AnejqfrQ-BaCFT0xm.d.mts → mongo-contract-view-AnejqfrQ-Wj_ulq2L.d.mts} +3 -3
- package/dist/{mongo-contract-view-AnejqfrQ-BaCFT0xm.d.mts.map → mongo-contract-view-AnejqfrQ-Wj_ulq2L.d.mts.map} +1 -1
- package/dist/{mongo-contract-view-rcWzby6f-wRBCUnBt.mjs → mongo-contract-view-D5yu2LrY-DCAZYJ4q.mjs} +4 -4
- package/dist/{mongo-contract-view-rcWzby6f-wRBCUnBt.mjs.map → mongo-contract-view-D5yu2LrY-DCAZYJ4q.mjs.map} +1 -1
- package/dist/mongo-data-type-DzyzU4LF-C1ydFXgE.mjs +53 -0
- package/dist/mongo-data-type-DzyzU4LF-C1ydFXgE.mjs.map +1 -0
- package/dist/{mongo-value-set-tNn9-pun-dJYx_rVD.d.mts → mongo-value-set-DEd7WLCT-B2Ar2GkJ.d.mts} +20 -4
- package/dist/mongo-value-set-DEd7WLCT-B2Ar2GkJ.d.mts.map +1 -0
- package/dist/orm.d.mts +154 -96
- package/dist/orm.d.mts.map +1 -1
- package/dist/orm.mjs +670 -148
- package/dist/orm.mjs.map +1 -1
- package/dist/pack-qw77Jt2G.d.mts +58 -0
- package/dist/pack-qw77Jt2G.d.mts.map +1 -0
- package/dist/query-ast.d.mts +5 -5
- package/dist/query-ast.mjs +3 -3
- package/dist/query-ast__control.d.mts +4 -4
- package/dist/query-ast__control.mjs +2 -2
- package/dist/query-ast__execution.d.mts +2 -2
- package/dist/query-ast__execution.mjs +1 -1
- package/dist/query-builder.d.mts +4 -836
- package/dist/query-builder.mjs +2 -2
- package/dist/query-builder__contract-free.d.mts +6 -6
- package/dist/query-builder__contract-free.mjs +3 -3
- package/dist/{query-plan-C0-Yu8hf-DdilEdW6.d.mts → query-plan-3fs1HokF-CrNsr-Wx.d.mts} +10 -4
- package/dist/{query-plan-C0-Yu8hf-DdilEdW6.d.mts.map → query-plan-3fs1HokF-CrNsr-Wx.d.mts.map} +1 -1
- package/dist/runtime-B5fNQHQZ.mjs +16 -0
- package/dist/runtime-B5fNQHQZ.mjs.map +1 -0
- package/dist/runtime-yZA30qM2.d.mts +11 -0
- package/dist/runtime-yZA30qM2.d.mts.map +1 -0
- package/dist/runtime.d.mts +74 -87
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +133 -67
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-ir.d.mts +2 -2
- package/dist/schema-ir.mjs +2 -2
- package/dist/{schema-verify-DJGr28XW.d.mts → schema-verify-CVOG6EZx.d.mts} +5 -5
- package/dist/{schema-verify-DJGr28XW.d.mts.map → schema-verify-CVOG6EZx.d.mts.map} +1 -1
- package/dist/value.d.mts +2 -2
- package/dist/value.mjs +1 -1
- package/dist/{verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs → verify-mongo-schema-CeQP5N4k-CNOctppM.mjs} +9 -26
- package/dist/verify-mongo-schema-CeQP5N4k-CNOctppM.mjs.map +1 -0
- package/dist/wire.d.mts +3 -3
- package/dist/wire.mjs +14 -2
- package/dist/wire.mjs.map +1 -1
- package/package.json +24 -21
- package/dist/authoring-entity-types-BGtkMyoN-D32kzx28.mjs +0 -176
- package/dist/authoring-entity-types-BGtkMyoN-D32kzx28.mjs.map +0 -1
- package/dist/canonicalization-hooks-DF3Z6sjO.mjs.map +0 -1
- package/dist/config-types-CFDf9ivE.mjs.map +0 -1
- package/dist/contract-builder-BFq0gOMV.mjs +0 -634
- package/dist/contract-builder-BFq0gOMV.mjs.map +0 -1
- package/dist/contract-builder-DB8nguDE.d.mts.map +0 -1
- package/dist/control-BbZQqmxo.mjs.map +0 -1
- package/dist/control-C7-kthr1.d.mts.map +0 -1
- package/dist/control-CClR5JMr.mjs.map +0 -1
- package/dist/control-Cj81sPbj.d.mts.map +0 -1
- package/dist/control-adapter-Db5pT77b.d.mts.map +0 -1
- package/dist/dist-C7Ykq48Q.mjs.map +0 -1
- package/dist/dist-Czwqx_i3.mjs +0 -58
- package/dist/dist-Czwqx_i3.mjs.map +0 -1
- package/dist/dist-DHrEJnhK.mjs +0 -236
- package/dist/dist-DHrEJnhK.mjs.map +0 -1
- package/dist/dist-Dyp05u64.mjs.map +0 -1
- package/dist/entity-kinds-B4KNTF8z-DPIuUuuB.mjs.map +0 -1
- package/dist/execution-CKnUiOfm.d.mts.map +0 -1
- package/dist/execution-D5XyZ5XS.mjs.map +0 -1
- package/dist/exports-Bx-hlnZ3.mjs.map +0 -1
- package/dist/exports-C4RGBGzZ.mjs +0 -156
- package/dist/exports-C4RGBGzZ.mjs.map +0 -1
- package/dist/field-accessor-DHsAPiW3-BdYCspQC.d.mts.map +0 -1
- package/dist/index-BR0ue13b.d.mts.map +0 -1
- package/dist/index-Cd2zLiU6.d.mts +0 -128
- package/dist/index-Cd2zLiU6.d.mts.map +0 -1
- package/dist/index-DAOkcTCK.d.mts.map +0 -1
- package/dist/index-Dv2PNMiG.d.mts +0 -53
- package/dist/index-Dv2PNMiG.d.mts.map +0 -1
- package/dist/index-wKMm41HC.d.mts +0 -30
- package/dist/index-wKMm41HC.d.mts.map +0 -1
- package/dist/interpreter-BxbUTQ3k-ClR98Ned.mjs +0 -1091
- package/dist/interpreter-BxbUTQ3k-ClR98Ned.mjs.map +0 -1
- package/dist/ir-CQrenTYt.d.mts.map +0 -1
- package/dist/ir-Ch2aPr7a.mjs.map +0 -1
- package/dist/migration-dcM7u4HG.mjs.map +0 -1
- package/dist/mongo-contract-serializer-Cx7Fae8e-C8ZYPXpc.mjs.map +0 -1
- package/dist/mongo-value-set-tNn9-pun-dJYx_rVD.d.mts.map +0 -1
- package/dist/pack-D9aLY50F.d.mts +0 -44
- package/dist/pack-D9aLY50F.d.mts.map +0 -1
- package/dist/query-builder.d.mts.map +0 -1
- package/dist/runtime-DPkRW4iu.d.mts +0 -1
- package/dist/verify-mongo-schema-De0FG2Rm-CCzwnNPY.mjs.map +0 -1
|
@@ -1,14 +1,45 @@
|
|
|
1
|
-
import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
1
|
+
import { t as mongoContractCanonicalizationHooks } from "./canonicalization-hooks-CRVM-Kqh-Qi-VmEVg.mjs";
|
|
2
|
+
import { L as validatorRootShapesOf } from "./dist-B8f-pfcT.mjs";
|
|
3
|
+
import { r as mongoAttributeSpecs, t as describeUnsupportedMongoAttribute } from "./interpreter-BfHdPd7T-DGqi2_Um.mjs";
|
|
4
|
+
import { t as describeUnresolvedMongoType } from "./dist-xk_0xOR-.mjs";
|
|
5
|
+
import { t as mongoEmission } from "./exports-BHQVApAg.mjs";
|
|
6
|
+
import { et as RawUpdateManyCommand } from "./execution-CgP1Sdbr.mjs";
|
|
7
|
+
import { i as verifyMongoSchema } from "./verify-mongo-schema-CeQP5N4k-CNOctppM.mjs";
|
|
8
|
+
import { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from "./authoring-entity-types-UA5sY_Xm-DeYf_cYq.mjs";
|
|
9
|
+
import { t as MongoContractSerializer } from "./mongo-contract-serializer-Zx1rvil3-BywiKCpn.mjs";
|
|
6
10
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
7
|
-
import {
|
|
11
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
8
12
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
9
|
-
import {
|
|
13
|
+
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
14
|
+
import { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from "@prisma/orm-framework/components/control";
|
|
10
15
|
import { assertDescriptorSelfConsistency } from "@prisma/orm-toolchain/migration-tools/spaces";
|
|
11
16
|
//#region ../../../2-mongo-family/9-family/dist/control.mjs
|
|
17
|
+
const FIELD_OPERATORS = /* @__PURE__ */ new Set(["$rename", "$unset"]);
|
|
18
|
+
function onlyKey(value) {
|
|
19
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
20
|
+
const keys = Object.keys(value);
|
|
21
|
+
const [key] = keys;
|
|
22
|
+
return keys.length === 1 ? key : void 0;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips
|
|
26
|
+
* validation and renames or unsets one field.
|
|
27
|
+
*/
|
|
28
|
+
function fieldRewriteOf(operation) {
|
|
29
|
+
const run = Reflect.get(operation, "run");
|
|
30
|
+
if (!Array.isArray(run) || run.length !== 1) return void 0;
|
|
31
|
+
const [step] = run;
|
|
32
|
+
const command = typeof step === "object" && step !== null ? Reflect.get(step, "command") : void 0;
|
|
33
|
+
if (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;
|
|
34
|
+
const operator = onlyKey(command.update);
|
|
35
|
+
if (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;
|
|
36
|
+
const field = onlyKey(Reflect.get(command.update, operator));
|
|
37
|
+
return field === void 0 ? void 0 : {
|
|
38
|
+
collection: command.collection,
|
|
39
|
+
field,
|
|
40
|
+
command
|
|
41
|
+
};
|
|
42
|
+
}
|
|
12
43
|
function formatKeySpec(keys) {
|
|
13
44
|
return `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(", ")} }`;
|
|
14
45
|
}
|
|
@@ -28,21 +59,27 @@ function formatOptions(cmd) {
|
|
|
28
59
|
function formatCreateCollectionOptions(cmd) {
|
|
29
60
|
return formatOptionEntries(cmd);
|
|
30
61
|
}
|
|
62
|
+
function collectionRef(name) {
|
|
63
|
+
return `db.getCollection(${JSON.stringify(name)})`;
|
|
64
|
+
}
|
|
31
65
|
var MongoDdlCommandFormatter = class {
|
|
32
66
|
createIndex(cmd) {
|
|
33
67
|
const keySpec = formatKeySpec(cmd.keys);
|
|
34
68
|
const opts = formatOptions(cmd);
|
|
35
|
-
return opts ?
|
|
69
|
+
return opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;
|
|
36
70
|
}
|
|
37
71
|
dropIndex(cmd) {
|
|
38
|
-
return
|
|
72
|
+
return `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;
|
|
39
73
|
}
|
|
40
74
|
createCollection(cmd) {
|
|
41
75
|
const opts = formatCreateCollectionOptions(cmd);
|
|
42
76
|
return opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;
|
|
43
77
|
}
|
|
44
78
|
dropCollection(cmd) {
|
|
45
|
-
return
|
|
79
|
+
return `${collectionRef(cmd.collection)}.drop()`;
|
|
80
|
+
}
|
|
81
|
+
renameCollection(cmd) {
|
|
82
|
+
return `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;
|
|
46
83
|
}
|
|
47
84
|
collMod(cmd) {
|
|
48
85
|
const parts = [`collMod: ${JSON.stringify(cmd.collection)}`];
|
|
@@ -51,12 +88,32 @@ var MongoDdlCommandFormatter = class {
|
|
|
51
88
|
}
|
|
52
89
|
};
|
|
53
90
|
const formatter = new MongoDdlCommandFormatter();
|
|
91
|
+
function formatUpdateMany(cmd) {
|
|
92
|
+
const args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];
|
|
93
|
+
if (cmd.bypassDocumentValidation) args.push("{ bypassDocumentValidation: true }");
|
|
94
|
+
return `${collectionRef(cmd.collection)}.updateMany(${args.join(", ")})`;
|
|
95
|
+
}
|
|
96
|
+
function arrayAt(value, key) {
|
|
97
|
+
const entry = Reflect.get(value, key);
|
|
98
|
+
return Array.isArray(entry) ? entry : [];
|
|
99
|
+
}
|
|
100
|
+
function objectAt(value, key) {
|
|
101
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
102
|
+
const entry = Reflect.get(value, key);
|
|
103
|
+
return typeof entry === "object" && entry !== null ? entry : void 0;
|
|
104
|
+
}
|
|
105
|
+
function isDdlCommand(value) {
|
|
106
|
+
return value !== void 0 && typeof Reflect.get(value, "accept") === "function";
|
|
107
|
+
}
|
|
54
108
|
function formatMongoOperations(operations) {
|
|
55
109
|
const statements = [];
|
|
56
110
|
for (const operation of operations) {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
for (const step of arrayAt(operation, "execute")) {
|
|
112
|
+
const command = objectAt(step, "command");
|
|
113
|
+
if (isDdlCommand(command)) statements.push(command.accept(formatter));
|
|
114
|
+
}
|
|
115
|
+
const rewrite = fieldRewriteOf(operation);
|
|
116
|
+
if (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));
|
|
60
117
|
}
|
|
61
118
|
return statements;
|
|
62
119
|
}
|
|
@@ -71,6 +128,34 @@ function mongoOperationsToPreview(operations) {
|
|
|
71
128
|
language: "mongodb-shell"
|
|
72
129
|
})) };
|
|
73
130
|
}
|
|
131
|
+
function collectionOfStep(step) {
|
|
132
|
+
if (typeof step !== "object" || step === null) return void 0;
|
|
133
|
+
const command = Reflect.get(step, "command");
|
|
134
|
+
if (typeof command !== "object" || command === null) return void 0;
|
|
135
|
+
const collection = Reflect.get(command, "collection");
|
|
136
|
+
return typeof collection === "string" ? collection : void 0;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The collection an operation's command names, as the database knows it: the name the Mongo
|
|
140
|
+
* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation
|
|
141
|
+
* whose commands name no collection is named by its id.
|
|
142
|
+
*/
|
|
143
|
+
function mongoStorageNameOf(operation) {
|
|
144
|
+
const execute = Reflect.get(operation, "execute");
|
|
145
|
+
const steps = Array.isArray(execute) ? execute : [];
|
|
146
|
+
for (const step of steps) {
|
|
147
|
+
const collection = collectionOfStep(step);
|
|
148
|
+
if (collection !== void 0) return collection;
|
|
149
|
+
}
|
|
150
|
+
const rewrite = fieldRewriteOf(operation);
|
|
151
|
+
if (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;
|
|
152
|
+
const run = Reflect.get(operation, "run");
|
|
153
|
+
for (const step of Array.isArray(run) ? run : []) {
|
|
154
|
+
const collection = collectionOfStep(step);
|
|
155
|
+
if (collection !== void 0) return collection;
|
|
156
|
+
}
|
|
157
|
+
return operation.id;
|
|
158
|
+
}
|
|
74
159
|
function mongoSchemaToView(schema) {
|
|
75
160
|
const collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));
|
|
76
161
|
return { root: new SchemaTreeNode({
|
|
@@ -109,16 +194,20 @@ function collectionToSchemaNode(name, collection) {
|
|
|
109
194
|
}
|
|
110
195
|
if (collection.validator) {
|
|
111
196
|
const validatorChildren = [];
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
197
|
+
const roots = validatorRootShapesOf(collection.validator.jsonSchema);
|
|
198
|
+
const fields = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {
|
|
200
|
+
const types = fields.get(propName) ?? /* @__PURE__ */ new Set();
|
|
201
|
+
for (const type of bsonTypesOf(propDef)) types.add(type);
|
|
202
|
+
fields.set(propName, types);
|
|
203
|
+
}
|
|
204
|
+
for (const [propName, types] of fields) {
|
|
205
|
+
const bsonType = types.has("any") ? "any" : [...types].join(",");
|
|
206
|
+
const required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));
|
|
118
207
|
validatorChildren.push(new SchemaTreeNode({
|
|
119
208
|
kind: "field",
|
|
120
209
|
id: `field-${name}-${propName}`,
|
|
121
|
-
label: `${propName}: ${bsonType}${
|
|
210
|
+
label: `${propName}: ${bsonType}${required ? " (required)" : ""}`
|
|
122
211
|
}));
|
|
123
212
|
}
|
|
124
213
|
children.push(new SchemaTreeNode({
|
|
@@ -161,6 +250,11 @@ function collectionToSchemaNode(name, collection) {
|
|
|
161
250
|
...ifDefined("children", children.length > 0 ? children : void 0)
|
|
162
251
|
});
|
|
163
252
|
}
|
|
253
|
+
function bsonTypesOf(propDef) {
|
|
254
|
+
if (typeof propDef !== "object" || propDef === null || !("bsonType" in propDef)) return ["any"];
|
|
255
|
+
const { bsonType } = propDef;
|
|
256
|
+
return Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];
|
|
257
|
+
}
|
|
164
258
|
function deserializeMongoContract(contractJson) {
|
|
165
259
|
return new MongoContractSerializer().deserializeContract(contractJson);
|
|
166
260
|
}
|
|
@@ -179,7 +273,7 @@ function deserializeMongoContract(contractJson) {
|
|
|
179
273
|
* shape with a single narrow cast.
|
|
180
274
|
*/
|
|
181
275
|
function asValidatedMongoContract(contract) {
|
|
182
|
-
return contract;
|
|
276
|
+
return blindCast(contract);
|
|
183
277
|
}
|
|
184
278
|
function buildVerifyResult(opts) {
|
|
185
279
|
return {
|
|
@@ -206,7 +300,7 @@ function buildVerifyResult(opts) {
|
|
|
206
300
|
};
|
|
207
301
|
}
|
|
208
302
|
function createMongoFamilyInstance(controlStack) {
|
|
209
|
-
const extensions = controlStack.extensions ?? [];
|
|
303
|
+
const extensions = blindCast(controlStack.extensions ?? []);
|
|
210
304
|
for (const extension of extensions) if (extension.contractSpace) {
|
|
211
305
|
const { contractJson, headRef } = extension.contractSpace;
|
|
212
306
|
assertDescriptorSelfConsistency({
|
|
@@ -218,10 +312,10 @@ function createMongoFamilyInstance(controlStack) {
|
|
|
218
312
|
...mongoContractCanonicalizationHooks
|
|
219
313
|
});
|
|
220
314
|
}
|
|
221
|
-
const adapter = controlStack.adapter;
|
|
315
|
+
const adapter = blindCast(controlStack.adapter);
|
|
222
316
|
const getControlAdapter = () => {
|
|
223
317
|
if (!adapter) throw new InternalError("Mongo family requires an adapter descriptor in ControlStack");
|
|
224
|
-
return adapter.create(controlStack);
|
|
318
|
+
return adapter.create(blindCast(controlStack));
|
|
225
319
|
};
|
|
226
320
|
function isMongoTargetDriver(driver) {
|
|
227
321
|
return driver.targetId === "mongo";
|
|
@@ -230,10 +324,64 @@ function createMongoFamilyInstance(controlStack) {
|
|
|
230
324
|
if (!isMongoTargetDriver(driver)) throw structuredError("CONTRACT.TARGET_MISMATCH", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);
|
|
231
325
|
return driver;
|
|
232
326
|
}
|
|
327
|
+
async function signSpaceMarker(driver, { space, contract, expected }) {
|
|
328
|
+
const storageHash = contract.storage.storageHash;
|
|
329
|
+
const profileHash = contract.profileHash;
|
|
330
|
+
const signed = {
|
|
331
|
+
space,
|
|
332
|
+
contract: {
|
|
333
|
+
storageHash,
|
|
334
|
+
profileHash
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
const controlAdapter = getControlAdapter();
|
|
338
|
+
const readHashes = async () => {
|
|
339
|
+
const marker = await controlAdapter.readMarker(driver, space);
|
|
340
|
+
return marker === null ? null : {
|
|
341
|
+
storageHash: marker.storageHash,
|
|
342
|
+
profileHash: marker.profileHash
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
const existing = await readHashes();
|
|
346
|
+
if (!sameMarkerHashes(existing, expected)) return {
|
|
347
|
+
...signed,
|
|
348
|
+
status: "conflict",
|
|
349
|
+
expected,
|
|
350
|
+
found: existing
|
|
351
|
+
};
|
|
352
|
+
if (existing === null) {
|
|
353
|
+
await controlAdapter.initMarker(driver, space, {
|
|
354
|
+
storageHash,
|
|
355
|
+
profileHash
|
|
356
|
+
});
|
|
357
|
+
return {
|
|
358
|
+
...signed,
|
|
359
|
+
status: "created"
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
if (existing.storageHash === storageHash && existing.profileHash === profileHash) return {
|
|
363
|
+
...signed,
|
|
364
|
+
status: "unchanged"
|
|
365
|
+
};
|
|
366
|
+
if (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {
|
|
367
|
+
storageHash,
|
|
368
|
+
profileHash
|
|
369
|
+
})) return {
|
|
370
|
+
...signed,
|
|
371
|
+
status: "conflict",
|
|
372
|
+
expected,
|
|
373
|
+
found: await readHashes()
|
|
374
|
+
};
|
|
375
|
+
return {
|
|
376
|
+
...signed,
|
|
377
|
+
status: "updated",
|
|
378
|
+
previous: existing
|
|
379
|
+
};
|
|
380
|
+
}
|
|
233
381
|
return {
|
|
234
382
|
familyId: "mongo",
|
|
235
383
|
deserializeContract(contractJson) {
|
|
236
|
-
return deserializeMongoContract(contractJson);
|
|
384
|
+
return blindCast(deserializeMongoContract(contractJson));
|
|
237
385
|
},
|
|
238
386
|
async verify(options) {
|
|
239
387
|
const { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;
|
|
@@ -297,65 +445,11 @@ function createMongoFamilyInstance(controlStack) {
|
|
|
297
445
|
frameworkComponents: options.frameworkComponents
|
|
298
446
|
});
|
|
299
447
|
},
|
|
300
|
-
async
|
|
301
|
-
const
|
|
302
|
-
const
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
const contractProfileHash = contract.profileHash;
|
|
306
|
-
const controlAdapter = getControlAdapter();
|
|
307
|
-
const mongoDriver = asMongoDriver(driver);
|
|
308
|
-
const existingMarker = await controlAdapter.readMarker(mongoDriver, APP_SPACE_ID);
|
|
309
|
-
let markerCreated = false;
|
|
310
|
-
let markerUpdated = false;
|
|
311
|
-
let previousHashes;
|
|
312
|
-
if (!existingMarker) {
|
|
313
|
-
await controlAdapter.initMarker(mongoDriver, APP_SPACE_ID, {
|
|
314
|
-
storageHash: contractStorageHash,
|
|
315
|
-
profileHash: contractProfileHash
|
|
316
|
-
});
|
|
317
|
-
markerCreated = true;
|
|
318
|
-
} else {
|
|
319
|
-
const storageHashMatches = existingMarker.storageHash === contractStorageHash;
|
|
320
|
-
const profileHashMatches = existingMarker.profileHash === contractProfileHash;
|
|
321
|
-
if (!storageHashMatches || !profileHashMatches) {
|
|
322
|
-
previousHashes = {
|
|
323
|
-
storageHash: existingMarker.storageHash,
|
|
324
|
-
profileHash: existingMarker.profileHash
|
|
325
|
-
};
|
|
326
|
-
if (!await controlAdapter.updateMarker(mongoDriver, APP_SPACE_ID, existingMarker.storageHash, {
|
|
327
|
-
storageHash: contractStorageHash,
|
|
328
|
-
profileHash: contractProfileHash
|
|
329
|
-
})) throw structuredError("MIGRATION.MARKER_CAS_FAILURE", "CAS conflict: marker was modified by another process during sign");
|
|
330
|
-
markerUpdated = true;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
let summary;
|
|
334
|
-
if (markerCreated) summary = "Database signed (marker created)";
|
|
335
|
-
else if (markerUpdated) summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? "unknown"})`;
|
|
336
|
-
else summary = "Database already signed with this contract";
|
|
337
|
-
return {
|
|
338
|
-
ok: true,
|
|
339
|
-
summary,
|
|
340
|
-
contract: {
|
|
341
|
-
storageHash: contractStorageHash,
|
|
342
|
-
profileHash: contractProfileHash
|
|
343
|
-
},
|
|
344
|
-
target: {
|
|
345
|
-
expected: contract.target,
|
|
346
|
-
actual: contract.target
|
|
347
|
-
},
|
|
348
|
-
marker: {
|
|
349
|
-
created: markerCreated,
|
|
350
|
-
updated: markerUpdated,
|
|
351
|
-
...ifDefined("previous", previousHashes)
|
|
352
|
-
},
|
|
353
|
-
meta: {
|
|
354
|
-
contractPath,
|
|
355
|
-
...ifDefined("configPath", configPath)
|
|
356
|
-
},
|
|
357
|
-
timings: { total: Date.now() - startTime }
|
|
358
|
-
};
|
|
448
|
+
async signSpaces(options) {
|
|
449
|
+
const mongoDriver = asMongoDriver(options.driver);
|
|
450
|
+
const signatures = [];
|
|
451
|
+
for (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));
|
|
452
|
+
return signatures;
|
|
359
453
|
},
|
|
360
454
|
async readMarker(options) {
|
|
361
455
|
return getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);
|
|
@@ -369,14 +463,23 @@ function createMongoFamilyInstance(controlStack) {
|
|
|
369
463
|
async introspect(options) {
|
|
370
464
|
return getControlAdapter().introspectSchema(asMongoDriver(options.driver));
|
|
371
465
|
},
|
|
466
|
+
createRunnerDependencies(options) {
|
|
467
|
+
return getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));
|
|
468
|
+
},
|
|
372
469
|
toSchemaView(schema) {
|
|
373
470
|
return mongoSchemaToView(schema);
|
|
374
471
|
},
|
|
375
472
|
toOperationPreview(operations) {
|
|
376
473
|
return mongoOperationsToPreview(operations);
|
|
474
|
+
},
|
|
475
|
+
storageNameOf(operation) {
|
|
476
|
+
return mongoStorageNameOf(operation);
|
|
377
477
|
}
|
|
378
478
|
};
|
|
379
479
|
}
|
|
480
|
+
const mongoFamilyAttributeSpecs = mongoAttributeSpecs;
|
|
481
|
+
const mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;
|
|
482
|
+
const mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;
|
|
380
483
|
var MongoFamilyDescriptor = class {
|
|
381
484
|
kind = "family";
|
|
382
485
|
id = "mongo";
|
|
@@ -385,7 +488,12 @@ var MongoFamilyDescriptor = class {
|
|
|
385
488
|
emission = mongoEmission;
|
|
386
489
|
authoring = {
|
|
387
490
|
entityTypes: mongoFamilyEntityTypes,
|
|
388
|
-
pslBlockDescriptors: mongoFamilyPslBlockDescriptors
|
|
491
|
+
pslBlockDescriptors: mongoFamilyPslBlockDescriptors,
|
|
492
|
+
attributeSpecs: mongoFamilyAttributeSpecs
|
|
493
|
+
};
|
|
494
|
+
pslDiagnostics = {
|
|
495
|
+
describeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,
|
|
496
|
+
describeUnresolvedType: mongoFamilyDescribeUnresolvedType
|
|
389
497
|
};
|
|
390
498
|
create(stack) {
|
|
391
499
|
return createMongoFamilyInstance(stack);
|
|
@@ -393,6 +501,6 @@ var MongoFamilyDescriptor = class {
|
|
|
393
501
|
};
|
|
394
502
|
const mongoFamilyDescriptor = new MongoFamilyDescriptor();
|
|
395
503
|
//#endregion
|
|
396
|
-
export { mongoOperationsToPreview as i,
|
|
504
|
+
export { mongoOperationsToPreview as a, mongoFamilyDescriptor as i, fieldRewriteOf as n, formatMongoOperations as r, createMongoFamilyInstance as t };
|
|
397
505
|
|
|
398
|
-
//# sourceMappingURL=control-
|
|
506
|
+
//# sourceMappingURL=control-B_pPN58L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-B_pPN58L.mjs","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.mjs"],"sourcesContent":["import { i as contractToMongoSchemaIR, n as canonicalizeSchemasForVerification, r as diffMongoSchemas, t as verifyMongoSchema } from \"./verify-mongo-schema-CeQP5N4k.mjs\";\nimport { n as mongoFamilyPslBlockDescriptors, t as mongoFamilyEntityTypes } from \"./authoring-entity-types-UA5sY_Xm.mjs\";\nimport { t as MongoContractSerializer } from \"./mongo-contract-serializer-Zx1rvil3.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { describeUnresolvedMongoType, describeUnsupportedMongoAttribute, mongoAttributeSpecs } from \"@internal/mongo-contract-psl\";\nimport { mongoEmission } from \"@internal/mongo-emitter\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, sameMarkerHashes } from \"@internal/framework-components/control\";\nimport { validatorRootShapesOf } from \"@internal/mongo-contract\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { assertDescriptorSelfConsistency } from \"@internal/migration-tools/spaces\";\nimport { mongoContractCanonicalizationHooks } from \"@internal/mongo-contract/canonicalization-hooks\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { RawUpdateManyCommand } from \"@internal/mongo-query-ast/execution\";\n//#region src/core/field-rewrite.ts\nconst FIELD_OPERATORS = /* @__PURE__ */ new Set([\"$rename\", \"$unset\"]);\nfunction onlyKey(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return void 0;\n\tconst keys = Object.keys(value);\n\tconst [key] = keys;\n\treturn keys.length === 1 ? key : void 0;\n}\n/**\n* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips\n* validation and renames or unsets one field.\n*/\nfunction fieldRewriteOf(operation) {\n\tconst run = Reflect.get(operation, \"run\");\n\tif (!Array.isArray(run) || run.length !== 1) return void 0;\n\tconst [step] = run;\n\tconst command = typeof step === \"object\" && step !== null ? Reflect.get(step, \"command\") : void 0;\n\tif (!(command instanceof RawUpdateManyCommand) || command.bypassDocumentValidation !== true) return;\n\tconst operator = onlyKey(command.update);\n\tif (operator === void 0 || !FIELD_OPERATORS.has(operator)) return void 0;\n\tconst field = onlyKey(Reflect.get(command.update, operator));\n\treturn field === void 0 ? void 0 : {\n\t\tcollection: command.collection,\n\t\tfield,\n\t\tcommand\n\t};\n}\n//#endregion\n//#region src/core/operation-preview.ts\nfunction formatKeySpec(keys) {\n\treturn `{ ${keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`).join(\", \")} }`;\n}\nconst COMMAND_META_KEYS = /* @__PURE__ */ new Set([\n\t\"kind\",\n\t\"collection\",\n\t\"keys\"\n]);\nfunction formatOptionEntries(cmd) {\n\tconst parts = Object.entries(cmd).filter(([key, value]) => !COMMAND_META_KEYS.has(key) && value !== void 0).map(([key, value]) => `${key}: ${JSON.stringify(value)}`);\n\tif (parts.length === 0) return void 0;\n\treturn `{ ${parts.join(\", \")} }`;\n}\nfunction formatOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction formatCreateCollectionOptions(cmd) {\n\treturn formatOptionEntries(cmd);\n}\nfunction collectionRef(name) {\n\treturn `db.getCollection(${JSON.stringify(name)})`;\n}\nvar MongoDdlCommandFormatter = class {\n\tcreateIndex(cmd) {\n\t\tconst keySpec = formatKeySpec(cmd.keys);\n\t\tconst opts = formatOptions(cmd);\n\t\treturn opts ? `${collectionRef(cmd.collection)}.createIndex(${keySpec}, ${opts})` : `${collectionRef(cmd.collection)}.createIndex(${keySpec})`;\n\t}\n\tdropIndex(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.dropIndex(${JSON.stringify(cmd.name)})`;\n\t}\n\tcreateCollection(cmd) {\n\t\tconst opts = formatCreateCollectionOptions(cmd);\n\t\treturn opts ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})` : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n\t}\n\tdropCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.drop()`;\n\t}\n\trenameCollection(cmd) {\n\t\treturn `${collectionRef(cmd.collection)}.renameCollection(${JSON.stringify(cmd.to)})`;\n\t}\n\tcollMod(cmd) {\n\t\tconst parts = [`collMod: ${JSON.stringify(cmd.collection)}`];\n\t\tfor (const [key, value] of Object.entries(cmd)) if (!COMMAND_META_KEYS.has(key) && value !== void 0) parts.push(`${key}: ${JSON.stringify(value)}`);\n\t\treturn `db.runCommand({ ${parts.join(\", \")} })`;\n\t}\n};\nconst formatter = new MongoDdlCommandFormatter();\nfunction formatUpdateMany(cmd) {\n\tconst args = [JSON.stringify(cmd.filter), JSON.stringify(cmd.update)];\n\tif (cmd.bypassDocumentValidation) args.push(\"{ bypassDocumentValidation: true }\");\n\treturn `${collectionRef(cmd.collection)}.updateMany(${args.join(\", \")})`;\n}\nfunction arrayAt(value, key) {\n\tconst entry = Reflect.get(value, key);\n\treturn Array.isArray(entry) ? entry : [];\n}\nfunction objectAt(value, key) {\n\tif (typeof value !== \"object\" || value === null) return void 0;\n\tconst entry = Reflect.get(value, key);\n\treturn typeof entry === \"object\" && entry !== null ? entry : void 0;\n}\nfunction isDdlCommand(value) {\n\treturn value !== void 0 && typeof Reflect.get(value, \"accept\") === \"function\";\n}\nfunction formatMongoOperations(operations) {\n\tconst statements = [];\n\tfor (const operation of operations) {\n\t\tfor (const step of arrayAt(operation, \"execute\")) {\n\t\t\tconst command = objectAt(step, \"command\");\n\t\t\tif (isDdlCommand(command)) statements.push(command.accept(formatter));\n\t\t}\n\t\tconst rewrite = fieldRewriteOf(operation);\n\t\tif (rewrite !== void 0) statements.push(formatUpdateMany(rewrite.command));\n\t}\n\treturn statements;\n}\n/**\n* Wraps `formatMongoOperations` into the family-agnostic\n* `OperationPreview` shape. Each statement carries\n* `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n*/\nfunction mongoOperationsToPreview(operations) {\n\treturn { statements: formatMongoOperations(operations).map((text) => ({\n\t\ttext,\n\t\tlanguage: \"mongodb-shell\"\n\t})) };\n}\n//#endregion\n//#region src/core/operation-storage-name.ts\nfunction collectionOfStep(step) {\n\tif (typeof step !== \"object\" || step === null) return void 0;\n\tconst command = Reflect.get(step, \"command\");\n\tif (typeof command !== \"object\" || command === null) return void 0;\n\tconst collection = Reflect.get(command, \"collection\");\n\treturn typeof collection === \"string\" ? collection : void 0;\n}\n/**\n* The collection an operation's command names, as the database knows it: the name the Mongo\n* planner gives a dropped collection. A planner field rewrite is named `<collection>.<field>`. An operation\n* whose commands name no collection is named by its id.\n*/\nfunction mongoStorageNameOf(operation) {\n\tconst execute = Reflect.get(operation, \"execute\");\n\tconst steps = Array.isArray(execute) ? execute : [];\n\tfor (const step of steps) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\tconst rewrite = fieldRewriteOf(operation);\n\tif (rewrite !== void 0) return `${rewrite.collection}.${rewrite.field}`;\n\tconst run = Reflect.get(operation, \"run\");\n\tfor (const step of Array.isArray(run) ? run : []) {\n\t\tconst collection = collectionOfStep(step);\n\t\tif (collection !== void 0) return collection;\n\t}\n\treturn operation.id;\n}\n//#endregion\n//#region src/core/schema-to-view.ts\nfunction mongoSchemaToView(schema) {\n\tconst collectionNodes = schema.collections.map((collection) => collectionToSchemaNode(collection.name, collection));\n\treturn { root: new SchemaTreeNode({\n\t\tkind: \"root\",\n\t\tid: \"mongo-schema\",\n\t\tlabel: \"database\",\n\t\t...ifDefined(\"children\", collectionNodes.length > 0 ? collectionNodes : void 0)\n\t}) };\n}\nfunction collectionToSchemaNode(name, collection) {\n\tconst children = [];\n\tfor (const index of collection.indexes) {\n\t\tconst keysSummary = index.keys.map((k) => {\n\t\t\tif (k.direction === 1) return k.field;\n\t\t\tif (k.direction === -1) return `${k.field} desc`;\n\t\t\treturn `${k.field} ${k.direction}`;\n\t\t}).join(\", \");\n\t\tconst prefix = index.unique ? \"unique index\" : \"index\";\n\t\tconst options = [];\n\t\tif (index.sparse) options.push(\"sparse\");\n\t\tif (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n\t\tif (index.partialFilterExpression) options.push(\"partial\");\n\t\tconst optsSuffix = options.length > 0 ? ` (${options.join(\", \")})` : \"\";\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"index\",\n\t\t\tid: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join(\"_\")}`,\n\t\t\tlabel: `${prefix} (${keysSummary})${optsSuffix}`,\n\t\t\tmeta: {\n\t\t\t\tkeys: index.keys,\n\t\t\t\tunique: index.unique,\n\t\t\t\t...ifDefined(\"sparse\", index.sparse || void 0),\n\t\t\t\t...ifDefined(\"expireAfterSeconds\", index.expireAfterSeconds ?? void 0),\n\t\t\t\t...ifDefined(\"partialFilterExpression\", index.partialFilterExpression ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\tif (collection.validator) {\n\t\tconst validatorChildren = [];\n\t\tconst roots = validatorRootShapesOf(collection.validator.jsonSchema);\n\t\tconst fields = /* @__PURE__ */ new Map();\n\t\tfor (const root of roots) for (const [propName, propDef] of Object.entries(root.properties)) {\n\t\t\tconst types = fields.get(propName) ?? /* @__PURE__ */ new Set();\n\t\t\tfor (const type of bsonTypesOf(propDef)) types.add(type);\n\t\t\tfields.set(propName, types);\n\t\t}\n\t\tfor (const [propName, types] of fields) {\n\t\t\tconst bsonType = types.has(\"any\") ? \"any\" : [...types].join(\",\");\n\t\t\tconst required = roots.every((root) => !Object.hasOwn(root.properties, propName) || root.required.includes(propName));\n\t\t\tvalidatorChildren.push(new SchemaTreeNode({\n\t\t\t\tkind: \"field\",\n\t\t\t\tid: `field-${name}-${propName}`,\n\t\t\t\tlabel: `${propName}: ${bsonType}${required ? \" (required)\" : \"\"}`\n\t\t\t}));\n\t\t}\n\t\tchildren.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `validator-${name}`,\n\t\t\tlabel: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n\t\t\tmeta: {\n\t\t\t\tvalidationLevel: collection.validator.validationLevel,\n\t\t\t\tvalidationAction: collection.validator.validationAction,\n\t\t\t\tjsonSchema: collection.validator.jsonSchema\n\t\t\t},\n\t\t\t...ifDefined(\"children\", validatorChildren.length > 0 ? validatorChildren : void 0)\n\t\t}));\n\t}\n\tif (collection.options) {\n\t\tconst opts = collection.options;\n\t\tconst optLabels = [];\n\t\tif (opts.capped) optLabels.push(\"capped\");\n\t\tif (opts.timeseries) optLabels.push(\"timeseries\");\n\t\tif (opts.collation) optLabels.push(\"collation\");\n\t\tif (opts.changeStreamPreAndPostImages) optLabels.push(\"changeStreamPreAndPostImages\");\n\t\tif (opts.clusteredIndex) optLabels.push(\"clusteredIndex\");\n\t\tif (optLabels.length > 0) children.push(new SchemaTreeNode({\n\t\t\tkind: \"field\",\n\t\t\tid: `options-${name}`,\n\t\t\tlabel: `options (${optLabels.join(\", \")})`,\n\t\t\tmeta: {\n\t\t\t\t...ifDefined(\"capped\", opts.capped ?? void 0),\n\t\t\t\t...ifDefined(\"timeseries\", opts.timeseries ?? void 0),\n\t\t\t\t...ifDefined(\"collation\", opts.collation ?? void 0),\n\t\t\t\t...ifDefined(\"changeStreamPreAndPostImages\", opts.changeStreamPreAndPostImages ?? void 0),\n\t\t\t\t...ifDefined(\"clusteredIndex\", opts.clusteredIndex ?? void 0)\n\t\t\t}\n\t\t}));\n\t}\n\treturn new SchemaTreeNode({\n\t\tkind: \"collection\",\n\t\tid: `collection-${name}`,\n\t\tlabel: `collection ${name}`,\n\t\t...ifDefined(\"children\", children.length > 0 ? children : void 0)\n\t});\n}\nfunction bsonTypesOf(propDef) {\n\tif (typeof propDef !== \"object\" || propDef === null || !(\"bsonType\" in propDef)) return [\"any\"];\n\tconst { bsonType } = propDef;\n\treturn Array.isArray(bsonType) ? bsonType.map(String) : [String(bsonType)];\n}\n//#endregion\n//#region src/core/control-instance.ts\nfunction deserializeMongoContract(contractJson) {\n\treturn new MongoContractSerializer().deserializeContract(contractJson);\n}\n/**\n* Family-method contract input. By the time control-plane methods\n* (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n* control client (`client.ts`), the input has already been threaded\n* through `familyInstance.deserializeContract`. The value is therefore a\n* class-form `MongoTargetContract` (or a structurally-equivalent\n* envelope post-deserialization) and must NOT be re-fed through\n* structural validation (arktype rejects extra keys like `namespaces`).\n*\n* The parameter type on the framework SPI is `unknown` for variance\n* reasons (so the family can express its own contract type without\n* leaking it to the framework). This helper recovers the validated\n* shape with a single narrow cast.\n*/\nfunction asValidatedMongoContract(contract) {\n\treturn blindCast(contract);\n}\nfunction buildVerifyResult(opts) {\n\treturn {\n\t\tok: opts.ok,\n\t\t...ifDefined(\"code\", opts.code),\n\t\tsummary: opts.summary,\n\t\tcontract: {\n\t\t\tstorageHash: opts.contractStorageHash,\n\t\t\t...ifDefined(\"profileHash\", opts.contractProfileHash)\n\t\t},\n\t\t...ifDefined(\"marker\", opts.marker ? {\n\t\t\tstorageHash: opts.marker.storageHash,\n\t\t\tprofileHash: opts.marker.profileHash\n\t\t} : void 0),\n\t\ttarget: {\n\t\t\texpected: opts.expectedTargetId,\n\t\t\t...ifDefined(\"actual\", opts.actualTargetId)\n\t\t},\n\t\tmeta: {\n\t\t\tcontractPath: opts.contractPath,\n\t\t\t...ifDefined(\"configPath\", opts.configPath)\n\t\t},\n\t\ttimings: { total: opts.totalTime }\n\t};\n}\nfunction createMongoFamilyInstance(controlStack) {\n\tconst extensions = blindCast(controlStack.extensions ?? []);\n\tfor (const extension of extensions) if (extension.contractSpace) {\n\t\tconst { contractJson, headRef } = extension.contractSpace;\n\t\tassertDescriptorSelfConsistency({\n\t\t\textensionId: extension.id,\n\t\t\ttarget: contractJson.target,\n\t\t\ttargetFamily: contractJson.targetFamily,\n\t\t\tstorage: contractJson.storage,\n\t\t\theadRefHash: headRef.hash,\n\t\t\t...mongoContractCanonicalizationHooks\n\t\t});\n\t}\n\tconst adapter = blindCast(controlStack.adapter);\n\tconst getControlAdapter = () => {\n\t\tif (!adapter) throw new InternalError(\"Mongo family requires an adapter descriptor in ControlStack\");\n\t\treturn adapter.create(blindCast(controlStack));\n\t};\n\tfunction isMongoTargetDriver(driver) {\n\t\treturn driver.targetId === \"mongo\";\n\t}\n\tfunction asMongoDriver(driver) {\n\t\tif (!isMongoTargetDriver(driver)) throw structuredError(\"CONTRACT.TARGET_MISMATCH\", `Expected Mongo control driver with targetId 'mongo', got '${driver.targetId}'`);\n\t\treturn driver;\n\t}\n\tasync function signSpaceMarker(driver, { space, contract, expected }) {\n\t\tconst storageHash = contract.storage.storageHash;\n\t\tconst profileHash = contract.profileHash;\n\t\tconst signed = {\n\t\t\tspace,\n\t\t\tcontract: {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t}\n\t\t};\n\t\tconst controlAdapter = getControlAdapter();\n\t\tconst readHashes = async () => {\n\t\t\tconst marker = await controlAdapter.readMarker(driver, space);\n\t\t\treturn marker === null ? null : {\n\t\t\t\tstorageHash: marker.storageHash,\n\t\t\t\tprofileHash: marker.profileHash\n\t\t\t};\n\t\t};\n\t\tconst existing = await readHashes();\n\t\tif (!sameMarkerHashes(existing, expected)) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: existing\n\t\t};\n\t\tif (existing === null) {\n\t\t\tawait controlAdapter.initMarker(driver, space, {\n\t\t\t\tstorageHash,\n\t\t\t\tprofileHash\n\t\t\t});\n\t\t\treturn {\n\t\t\t\t...signed,\n\t\t\t\tstatus: \"created\"\n\t\t\t};\n\t\t}\n\t\tif (existing.storageHash === storageHash && existing.profileHash === profileHash) return {\n\t\t\t...signed,\n\t\t\tstatus: \"unchanged\"\n\t\t};\n\t\tif (!await controlAdapter.updateMarker(driver, space, existing.storageHash, {\n\t\t\tstorageHash,\n\t\t\tprofileHash\n\t\t})) return {\n\t\t\t...signed,\n\t\t\tstatus: \"conflict\",\n\t\t\texpected,\n\t\t\tfound: await readHashes()\n\t\t};\n\t\treturn {\n\t\t\t...signed,\n\t\t\tstatus: \"updated\",\n\t\t\tprevious: existing\n\t\t};\n\t}\n\treturn {\n\t\tfamilyId: \"mongo\",\n\t\tdeserializeContract(contractJson) {\n\t\t\treturn blindCast(deserializeMongoContract(contractJson));\n\t\t},\n\t\tasync verify(options) {\n\t\t\tconst { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n\t\t\tconst startTime = Date.now();\n\t\t\tconst contract = asValidatedMongoContract(rawContract);\n\t\t\tconst contractStorageHash = contract.storage.storageHash;\n\t\t\tconst contractProfileHash = contract.profileHash;\n\t\t\tconst contractTarget = contract.target;\n\t\t\tconst baseOpts = {\n\t\t\t\tcontractStorageHash,\n\t\t\t\tcontractProfileHash,\n\t\t\t\texpectedTargetId,\n\t\t\t\tcontractPath,\n\t\t\t\t...ifDefined(\"configPath\", configPath)\n\t\t\t};\n\t\t\tif (contractTarget !== expectedTargetId) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_TARGET_MISMATCH,\n\t\t\t\tsummary: \"Target mismatch\",\n\t\t\t\tactualTargetId: contractTarget,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tconst marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\t\t\tif (!marker) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_MARKER_MISSING,\n\t\t\t\tsummary: \"Marker missing\",\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (marker.storageHash !== contractStorageHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\tif (contractProfileHash && marker.profileHash !== contractProfileHash) return buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: false,\n\t\t\t\tcode: VERIFY_CODE_HASH_MISMATCH,\n\t\t\t\tsummary: \"Hash mismatch\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t\treturn buildVerifyResult({\n\t\t\t\t...baseOpts,\n\t\t\t\tok: true,\n\t\t\t\tsummary: \"Database matches contract\",\n\t\t\t\tmarker,\n\t\t\t\ttotalTime: Date.now() - startTime\n\t\t\t});\n\t\t},\n\t\tverifySchema(options) {\n\t\t\treturn verifyMongoSchema({\n\t\t\t\tcontract: asValidatedMongoContract(options.contract),\n\t\t\t\tschema: options.schema,\n\t\t\t\tstrict: options.strict,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t},\n\t\tasync signSpaces(options) {\n\t\t\tconst mongoDriver = asMongoDriver(options.driver);\n\t\t\tconst signatures = [];\n\t\t\tfor (const space of options.spaces) signatures.push(await signSpaceMarker(mongoDriver, space));\n\t\t\treturn signatures;\n\t\t},\n\t\tasync readMarker(options) {\n\t\t\treturn getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync readAllMarkers(options) {\n\t\t\treturn getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n\t\t},\n\t\tasync readLedger(options) {\n\t\t\treturn getControlAdapter().readLedger(asMongoDriver(options.driver), options.space);\n\t\t},\n\t\tasync introspect(options) {\n\t\t\treturn getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n\t\t},\n\t\tcreateRunnerDependencies(options) {\n\t\t\treturn getControlAdapter().createRunnerDependencies(asMongoDriver(options.driver));\n\t\t},\n\t\ttoSchemaView(schema) {\n\t\t\treturn mongoSchemaToView(schema);\n\t\t},\n\t\ttoOperationPreview(operations) {\n\t\t\treturn mongoOperationsToPreview(operations);\n\t\t},\n\t\tstorageNameOf(operation) {\n\t\t\treturn mongoStorageNameOf(operation);\n\t\t}\n\t};\n}\n//#endregion\n//#region src/core/control-descriptor.ts\nconst mongoFamilyAttributeSpecs = mongoAttributeSpecs;\nconst mongoFamilyDescribeUnsupportedAttribute = describeUnsupportedMongoAttribute;\nconst mongoFamilyDescribeUnresolvedType = describeUnresolvedMongoType;\nvar MongoFamilyDescriptor = class {\n\tkind = \"family\";\n\tid = \"mongo\";\n\tfamilyId = \"mongo\";\n\tversion = \"0.0.1\";\n\temission = mongoEmission;\n\tauthoring = {\n\t\tentityTypes: mongoFamilyEntityTypes,\n\t\tpslBlockDescriptors: mongoFamilyPslBlockDescriptors,\n\t\tattributeSpecs: mongoFamilyAttributeSpecs\n\t};\n\tpslDiagnostics = {\n\t\tdescribeUnsupportedAttribute: mongoFamilyDescribeUnsupportedAttribute,\n\t\tdescribeUnresolvedType: mongoFamilyDescribeUnresolvedType\n\t};\n\tcreate(stack) {\n\t\treturn createMongoFamilyInstance(stack);\n\t}\n};\nconst mongoFamilyDescriptor = new MongoFamilyDescriptor();\n//#endregion\nexport { canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, fieldRewriteOf, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,kCAAkC,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC;AACrE,SAAS,QAAQ,OAAO;CACvB,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAK;CACrF,MAAM,OAAO,OAAO,KAAK,KAAK;CAC9B,MAAM,CAAC,OAAO;CACd,OAAO,KAAK,WAAW,IAAI,MAAM,KAAK;AACvC;;;;;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CACzB;CACA,OAAO,OAAO;EACb,OAAO,0BAA0B,KAAK;CACvC;AACD;AACA,MAAM,wBAAwB,IAAI,sBAAsB"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { C as MongoContract,
|
|
2
|
-
import "./index-
|
|
3
|
-
import {
|
|
1
|
+
import { C as MongoContract, G as MongoStorageShape } from "./mongo-value-set-DEd7WLCT-B2Ar2GkJ.mjs";
|
|
2
|
+
import "./index-YY1SU_7o.mjs";
|
|
3
|
+
import { c as MongoSchemaIR } from "./index-rANtsIZG.mjs";
|
|
4
|
+
import { At as RawUpdateManyCommand } from "./query-plan-3fs1HokF-CrNsr-Wx.mjs";
|
|
5
|
+
import "./execution-tPmN5pge.mjs";
|
|
6
|
+
import { i as MongoRunnerDependencies } from "./control-adapter-Bh_ZraGM--5JDb99k.mjs";
|
|
4
7
|
import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
|
|
5
|
-
import { ContractSerializer, ContractSpace, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationPlanOperation, OperationPreview, OperationPreviewCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable } from "@prisma/orm-framework/components/control";
|
|
8
|
+
import { ContractSerializer, ContractSpace, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationPlanOperation, OperationPreview, OperationPreviewCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable } from "@prisma/orm-framework/components/control";
|
|
6
9
|
//#region ../../../2-mongo-family/9-family/dist/control.d.mts
|
|
7
10
|
//#region src/core/contract-to-schema.d.ts
|
|
8
11
|
declare function contractToMongoSchemaIR(contract: MongoContract | null): MongoSchemaIR;
|
|
@@ -20,6 +23,12 @@ interface MongoControlFamilyInstance extends ControlFamilyInstance<'mongo', Mong
|
|
|
20
23
|
* guarded by `pnpm lint:no-contract-cast`.
|
|
21
24
|
*/
|
|
22
25
|
deserializeContract(contractJson: unknown): Contract;
|
|
26
|
+
/**
|
|
27
|
+
* Builds the migration runner's dependencies through the control adapter on the stack, so the target never names the adapter package (ADR 198).
|
|
28
|
+
*/
|
|
29
|
+
createRunnerDependencies(options: {
|
|
30
|
+
readonly driver: ControlDriverInstance<'mongo', string>;
|
|
31
|
+
}): MongoRunnerDependencies;
|
|
23
32
|
}
|
|
24
33
|
declare function createMongoFamilyInstance(controlStack: ControlStack): MongoControlFamilyInstance;
|
|
25
34
|
//#endregion
|
|
@@ -64,6 +73,20 @@ interface MongoControlExtensionDescriptor extends ControlExtensionDescriptor<'mo
|
|
|
64
73
|
readonly contractSpace?: ContractSpace<MongoContract<MongoStorageShape>>;
|
|
65
74
|
}
|
|
66
75
|
//#endregion
|
|
76
|
+
//#region src/core/field-rewrite.d.ts
|
|
77
|
+
/** A document rewrite the planner plans: `renameField` or `unsetField`. */
|
|
78
|
+
interface FieldRewrite {
|
|
79
|
+
readonly collection: string;
|
|
80
|
+
/** The field the rewrite renames or removes, by its old name. */
|
|
81
|
+
readonly field: string;
|
|
82
|
+
readonly command: RawUpdateManyCommand;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The planner's field rewrite an operation is, if it is one: a single `updateMany` that skips
|
|
86
|
+
* validation and renames or unsets one field.
|
|
87
|
+
*/
|
|
88
|
+
declare function fieldRewriteOf(operation: MigrationPlanOperation): FieldRewrite | undefined;
|
|
89
|
+
//#endregion
|
|
67
90
|
//#region src/core/operation-preview.d.ts
|
|
68
91
|
declare function formatMongoOperations(operations: readonly MigrationPlanOperation[]): string[];
|
|
69
92
|
/**
|
|
@@ -97,5 +120,5 @@ interface CanonicalizedSchemas {
|
|
|
97
120
|
}
|
|
98
121
|
declare function canonicalizeSchemasForVerification(live: MongoSchemaIR, expected: MongoSchemaIR): CanonicalizedSchemas;
|
|
99
122
|
//#endregion
|
|
100
|
-
export {
|
|
101
|
-
//# sourceMappingURL=control-
|
|
123
|
+
export { canonicalizeSchemasForVerification as a, diffMongoSchemas as c, mongoFamilyDescriptor as d, mongoOperationsToPreview as f, MongoControlTargetDescriptor as i, fieldRewriteOf as l, MongoControlExtensionDescriptor as n, contractToMongoSchemaIR as o, MongoControlFamilyInstance as r, createMongoFamilyInstance as s, FieldRewrite as t, formatMongoOperations as u };
|
|
124
|
+
//# sourceMappingURL=control-CvQSMuxa.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-CvQSMuxa.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control.d.mts"],"mappings":";;;;;;;;;;iBAOiB,wBAAwB,UAAU,uBAAuB;;;UAGhE,mCAAmC,+BAA+B,gBAAgB,kBAAkB,gBAAgB;;;;;;;;;;;EAW5H,oBAAoB,wBAAwB;;;;EAI5C,yBAAyB;aACd,QAAQ;MACf;;iBAEW,0BAA0B,cAAc,eAAe;;;cAG1D,uBAAuB,iCAAiC;;;;;;;;;;;;;;;UAe5D,6BAA6B,kBAAkB,gBAAgB,uBAAuB,6CAA6C;WAClI,oBAAoB,mBAAmB;WACvC,gBAAgB,eAAe,WAAW;;;;;;;;;;;;;;;;;;;UAmB3C,wCAAwC;WACvC,gBAAgB,cAAc,cAAc;;;;;UAK7C;WACC;;WAEA;WACA,SAAS;;;;;;iBAMH,eAAe,WAAW,yBAAyB;;;iBAGnD,sBAAsB,qBAAqB;;;;;;iBAM3C,yBAAyB,qBAAqB,2BAA2B;;;;;;;;;;;;;UAahF;WACC,mBAAmB;WACnB,mBAAmB;;iBAEb,iBAAiB,MAAM,eAAe,UAAU,eAAe,iBAAiB,0BAA0B,2BAA2B,gBAAgB;;;UAG5J;WACC,MAAM;WACN,UAAU;;iBAEJ,mCAAmC,MAAM,eAAe,UAAU,gBAAgB"}
|
|
@@ -1,8 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as MongoSchemaIR } from "./index-rANtsIZG.mjs";
|
|
2
|
+
import { _ as MongoInspectionCommandVisitor, t as AnyMongoDdlCommand } from "./control-4pC8N2Rb.mjs";
|
|
3
|
+
import { i as MongoDriver, t as MongoAdapter } from "./index-FeVOOdZ0.mjs";
|
|
2
4
|
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
3
5
|
import { ControlAdapterDescriptor, ControlAdapterInstance, ControlDriverInstance } from "@prisma/orm-framework/components/control";
|
|
4
|
-
//#region ../../../2-mongo-family/9-family/dist/control-adapter.d.mts
|
|
6
|
+
//#region ../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts
|
|
5
7
|
//#region src/core/control-adapter.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Marker / ledger operations the Mongo runner depends on. Every method
|
|
10
|
+
* takes a `space` parameter so each loaded contract space addresses its
|
|
11
|
+
* own marker row independently — see ADR 212 for the per-space
|
|
12
|
+
* mechanism.
|
|
13
|
+
*/
|
|
14
|
+
interface MarkerOperations {
|
|
15
|
+
readMarker(space: string): Promise<ContractMarkerRecord | null>;
|
|
16
|
+
initMarker(space: string, destination: {
|
|
17
|
+
readonly storageHash: string;
|
|
18
|
+
readonly profileHash: string;
|
|
19
|
+
readonly invariants?: readonly string[];
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
updateMarker(space: string, expectedFrom: string, destination: {
|
|
22
|
+
readonly storageHash: string;
|
|
23
|
+
readonly profileHash: string;
|
|
24
|
+
readonly invariants?: readonly string[];
|
|
25
|
+
}): Promise<boolean>;
|
|
26
|
+
writeLedgerEntry(space: string, entry: {
|
|
27
|
+
readonly edgeId: string;
|
|
28
|
+
readonly from: string;
|
|
29
|
+
readonly to: string;
|
|
30
|
+
readonly migrationName: string;
|
|
31
|
+
readonly migrationHash: string;
|
|
32
|
+
readonly operations: readonly unknown[];
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Everything the Mongo migration runner needs to talk to one database, bound to a single control driver. See ADR 198.
|
|
37
|
+
*/
|
|
38
|
+
interface MongoRunnerDependencies {
|
|
39
|
+
readonly inspectionExecutor: MongoInspectionCommandVisitor<Promise<Record<string, unknown>[]>>;
|
|
40
|
+
readonly adapter: MongoAdapter;
|
|
41
|
+
readonly driver: MongoDriver;
|
|
42
|
+
readonly executeDdl: (command: AnyMongoDdlCommand) => Promise<void>;
|
|
43
|
+
readonly markerOps: MarkerOperations;
|
|
44
|
+
readonly introspectSchema: () => Promise<MongoSchemaIR>;
|
|
45
|
+
}
|
|
6
46
|
/**
|
|
7
47
|
* Mongo control adapter interface for control-plane operations.
|
|
8
48
|
* Implemented by target-specific adapters (e.g. `@internal/adapter-mongo`).
|
|
@@ -71,6 +111,10 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
|
|
|
71
111
|
* Introspects the live database and returns a `MongoSchemaIR`.
|
|
72
112
|
*/
|
|
73
113
|
introspectSchema(driver: ControlDriverInstance<'mongo', TTarget>): Promise<MongoSchemaIR>;
|
|
114
|
+
/**
|
|
115
|
+
* Builds the migration runner's dependencies bound to `driver`.
|
|
116
|
+
*/
|
|
117
|
+
createRunnerDependencies(driver: ControlDriverInstance<'mongo', TTarget>): MongoRunnerDependencies;
|
|
74
118
|
}
|
|
75
119
|
/**
|
|
76
120
|
* Mongo control adapter descriptor. Mirrors `SqlControlAdapterDescriptor`:
|
|
@@ -79,5 +123,5 @@ interface MongoControlAdapter<TTarget extends string = string> extends ControlAd
|
|
|
79
123
|
*/
|
|
80
124
|
interface MongoControlAdapterDescriptor<TTarget extends string = string> extends ControlAdapterDescriptor<'mongo', TTarget, MongoControlAdapter<TTarget>> {}
|
|
81
125
|
//#endregion
|
|
82
|
-
export {
|
|
83
|
-
//# sourceMappingURL=control-adapter-
|
|
126
|
+
export { MongoRunnerDependencies as i, MongoControlAdapter as n, MongoControlAdapterDescriptor as r, MarkerOperations as t };
|
|
127
|
+
//# sourceMappingURL=control-adapter-Bh_ZraGM--5JDb99k.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-adapter-Bh_ZraGM--5JDb99k.d.mts","names":[],"sources":["../../../../2-mongo-family/9-family/dist/control-adapter-Bh_ZraGM.d.mts"],"mappings":";;;;;;;;;;;;;UAYU;EACR,WAAW,gBAAgB,QAAQ;EACnC,WAAW,eAAe;aACf;aACA;aACA;MACP;EACJ,aAAa,eAAe,sBAAsB;aACvC;aACA;aACA;MACP;EACJ,iBAAiB,eAAe;aACrB;aACA;aACA;aACA;aACA;aACA;MACP;;;;;UAKI;WACC,oBAAoB,8BAA8B,QAAQ;WAC1D,SAAS;WACT,QAAQ;WACR,aAAa,SAAS,uBAAuB;WAC7C,WAAW;WACX,wBAAwB,QAAQ;;;;;;;;;;;;;;;UAejC,oBAAoB,yCAAyC,gCAAgC;;;;;;;EAOrG,WAAW,QAAQ,+BAA+B,UAAU,gBAAgB,QAAQ;;;;;;;EAOpF,eAAe,QAAQ,+BAA+B,WAAW,QAAQ,oBAAoB;;;;EAI7F,WAAW,QAAQ,+BAA+B,UAAU,eAAe;aAChE;aACA;aACA;MACP;;;;;;EAMJ,aAAa,QAAQ,+BAA+B,UAAU,eAAe,sBAAsB;aACxF;aACA;aACA;MACP;;;;;;EAMJ,iBAAiB,QAAQ,+BAA+B,UAAU,eAAe;aACtE;aACA;aACA;aACA;aACA;aACA;MACP;;;;;EAKJ,WAAW,QAAQ,+BAA+B,UAAU,iBAAiB,iBAAiB;;;;EAI9F,iBAAiB,QAAQ,+BAA+B,WAAW,QAAQ;;;;EAI3E,yBAAyB,QAAQ,+BAA+B,WAAW;;;;;;;UAOnE,8BAA8B,yCAAyC,kCAAkC,SAAS,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./control-adapter-Bh_ZraGM--5JDb99k.mjs";
|