@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,156 +0,0 @@
|
|
|
1
|
-
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
-
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
|
-
import { serializeObjectKey, serializeValue } from "@prisma/orm-toolchain/emitter/domain-type-generation";
|
|
4
|
-
//#region ../../../2-mongo-family/3-tooling/emitter/dist/exports/index.mjs
|
|
5
|
-
function validationError(message, model) {
|
|
6
|
-
return structuredError("CONTRACT.VALIDATION_FAILED", message, model === void 0 ? void 0 : { meta: { model } });
|
|
7
|
-
}
|
|
8
|
-
const MONGO_NAMESPACE_KIND_FALLBACK = "mongo-namespace";
|
|
9
|
-
function mongoNamespaceSerializedKind(ns) {
|
|
10
|
-
const kind = ns.kind;
|
|
11
|
-
if (typeof kind === "string") return `readonly kind: ${serializeValue(kind)}`;
|
|
12
|
-
return `readonly kind: "${MONGO_NAMESPACE_KIND_FALLBACK}"`;
|
|
13
|
-
}
|
|
14
|
-
function assertUniqueMongoCollectionNames(storage) {
|
|
15
|
-
const seen = /* @__PURE__ */ new Map();
|
|
16
|
-
for (const [namespaceId, ns] of Object.entries(storage.namespaces)) for (const coll of Object.keys(ns.entries.collection ?? {})) {
|
|
17
|
-
const existing = seen.get(coll);
|
|
18
|
-
if (existing !== void 0 && existing !== namespaceId) throw structuredError("CONTRACT.NAME_DUPLICATE", `Duplicate collection name "${coll}" in namespaces "${existing}" and "${namespaceId}"`);
|
|
19
|
-
seen.set(coll, namespaceId);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function generateMongoCollectionEntryType(coll) {
|
|
23
|
-
if (Object.entries(coll).filter(([key, v]) => v !== void 0 && key !== "kind").length === 0) return "MongoCollection";
|
|
24
|
-
return serializeValue(coll);
|
|
25
|
-
}
|
|
26
|
-
function generateMongoNamespaceCollectionsType(collections) {
|
|
27
|
-
const entries = [];
|
|
28
|
-
for (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => a.localeCompare(b))) entries.push(`readonly ${serializeObjectKey(collName)}: ${generateMongoCollectionEntryType(coll)}`);
|
|
29
|
-
if (entries.length === 0) return "Record<string, never>";
|
|
30
|
-
return `{ ${entries.join("; ")} }`;
|
|
31
|
-
}
|
|
32
|
-
function generateMongoNamespacesType(namespaces) {
|
|
33
|
-
const sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
34
|
-
if (sorted.length === 0) return "Record<string, never>";
|
|
35
|
-
const parts = [];
|
|
36
|
-
for (const [name, ns] of sorted) {
|
|
37
|
-
const collectionsType = generateMongoNamespaceCollectionsType(ns.entries.collection ?? {});
|
|
38
|
-
parts.push(`readonly ${serializeObjectKey(name)}: { readonly id: ${serializeValue(ns.id)}; ${mongoNamespaceSerializedKind(ns)}; readonly entries: { readonly collection: ${collectionsType} } }`);
|
|
39
|
-
}
|
|
40
|
-
return `{ ${parts.join("; ")} }`;
|
|
41
|
-
}
|
|
42
|
-
const mongoEmission = {
|
|
43
|
-
id: "mongo",
|
|
44
|
-
validateTypes(contract, _ctx) {
|
|
45
|
-
const typeIdRegex = /^([^/]+)\/([^@]+)@(\d+)$/;
|
|
46
|
-
for (const [namespaceId, domainNs] of Object.entries(contract.domain.namespaces)) {
|
|
47
|
-
const models = domainNs.models;
|
|
48
|
-
for (const [modelName, model] of Object.entries(models)) {
|
|
49
|
-
const qualifiedName = `${namespaceId}:${modelName}`;
|
|
50
|
-
for (const [fieldName, field] of Object.entries(model.fields)) {
|
|
51
|
-
const fieldType = field.type;
|
|
52
|
-
if (!fieldType) continue;
|
|
53
|
-
const scalarTypes = fieldType.kind === "scalar" ? [fieldType] : fieldType.kind === "union" && fieldType.members ? fieldType.members.filter((m) => m.kind === "scalar") : [];
|
|
54
|
-
for (const scalarType of scalarTypes) {
|
|
55
|
-
const { codecId } = scalarType;
|
|
56
|
-
if (!codecId) throw validationError(`Field "${fieldName}" on model "${qualifiedName}" is missing codecId`, qualifiedName);
|
|
57
|
-
if (!codecId.match(typeIdRegex)?.[1]) throw validationError(`Field "${fieldName}" on model "${qualifiedName}" has invalid codec ID format "${codecId}". Expected format: ns/name@version`, qualifiedName);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
validateStructure(contract) {
|
|
64
|
-
if (contract.targetFamily !== "mongo") throw validationError(`Expected targetFamily "mongo", got "${contract.targetFamily}"`);
|
|
65
|
-
const storage = contract.storage;
|
|
66
|
-
if (!storage?.namespaces || typeof storage.namespaces !== "object") throw validationError("Mongo contract must have storage.namespaces");
|
|
67
|
-
assertUniqueMongoCollectionNames(storage);
|
|
68
|
-
const collectionNames = /* @__PURE__ */ new Set();
|
|
69
|
-
for (const ns of Object.values(storage.namespaces)) for (const c of Object.keys(ns.entries.collection ?? {})) collectionNames.add(c);
|
|
70
|
-
for (const [namespaceId, domainNs] of Object.entries(contract.domain.namespaces)) {
|
|
71
|
-
const models = domainNs.models;
|
|
72
|
-
if (Object.keys(models).length === 0) continue;
|
|
73
|
-
for (const [modelName, model] of Object.entries(models)) {
|
|
74
|
-
const qualifiedName = `${namespaceId}:${modelName}`;
|
|
75
|
-
if (!model.fields || typeof model.fields !== "object") throw validationError(`Model "${qualifiedName}" is missing required field "fields"`, qualifiedName);
|
|
76
|
-
if (!model.relations || typeof model.relations !== "object") throw validationError(`Model "${qualifiedName}" is missing required field "relations" (must be an object)`, qualifiedName);
|
|
77
|
-
if (!model.storage || typeof model.storage !== "object") throw validationError(`Model "${qualifiedName}" is missing required field "storage" (must be an object)`, qualifiedName);
|
|
78
|
-
const collectionValue = model.storage["collection"];
|
|
79
|
-
const collection = typeof collectionValue === "string" ? collectionValue : void 0;
|
|
80
|
-
if (model.owner) {
|
|
81
|
-
if (collection) throw validationError(`Owned model "${qualifiedName}" must not have storage.collection (embedded models are stored within their owner)`, qualifiedName);
|
|
82
|
-
if (!models[model.owner]) throw validationError(`Model "${qualifiedName}" declares owner "${model.owner}" which does not exist in models`, qualifiedName);
|
|
83
|
-
} else if (collection) {
|
|
84
|
-
if (!collectionNames.has(collection)) throw validationError(`Model "${qualifiedName}" references collection "${collection}" which is not in storage.namespaces[..].entries.collection`, qualifiedName);
|
|
85
|
-
}
|
|
86
|
-
if (model.base) {
|
|
87
|
-
const baseModel = models[model.base.model];
|
|
88
|
-
if (!baseModel) throw validationError(`Model "${qualifiedName}" declares base "${model.base.namespace}:${model.base.model}" which does not exist in models`, qualifiedName);
|
|
89
|
-
const variantCollection = collection;
|
|
90
|
-
const baseCollection = baseModel.storage["collection"];
|
|
91
|
-
if (variantCollection !== baseCollection) throw validationError(`Variant "${qualifiedName}" must share its base's collection ("${baseCollection ?? "(none)"}"), but has "${variantCollection ?? "(none)"}"`, qualifiedName);
|
|
92
|
-
}
|
|
93
|
-
const storageRelations = model.storage["relations"];
|
|
94
|
-
if (storageRelations) {
|
|
95
|
-
for (const relName of Object.keys(storageRelations)) if (!model.relations[relName]) throw validationError(`Model "${qualifiedName}" has storage.relations.${relName} but no matching domain-level relation`, qualifiedName);
|
|
96
|
-
}
|
|
97
|
-
for (const [relName, rel] of Object.entries(model.relations)) {
|
|
98
|
-
const targetModelName = rel["to"]?.model;
|
|
99
|
-
if (targetModelName) {
|
|
100
|
-
if (models[targetModelName]?.owner === modelName && !storageRelations?.[relName]) throw validationError(`Model "${qualifiedName}" has embed relation "${relName}" to owned model "${targetModelName}" but no matching storage.relations entry`, qualifiedName);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
generateStorageType(contract, storageHashTypeName) {
|
|
107
|
-
const storage = contract.storage;
|
|
108
|
-
return `{ readonly namespaces: ${generateMongoNamespacesType(storage.namespaces)}; readonly storageHash: ${storageHashTypeName} }`;
|
|
109
|
-
},
|
|
110
|
-
generateModelStorageType(_modelName, model) {
|
|
111
|
-
const parts = [];
|
|
112
|
-
const collection = model.storage["collection"];
|
|
113
|
-
if (collection) parts.push(`readonly collection: ${serializeValue(collection)}`);
|
|
114
|
-
const storageRelations = model.storage["relations"];
|
|
115
|
-
if (storageRelations && Object.keys(storageRelations).length > 0) {
|
|
116
|
-
const relEntries = [];
|
|
117
|
-
for (const [relName, relVal] of Object.entries(storageRelations)) relEntries.push(`readonly ${serializeObjectKey(relName)}: ${serializeValue(relVal)}`);
|
|
118
|
-
parts.push(`readonly relations: { ${relEntries.join("; ")} }`);
|
|
119
|
-
}
|
|
120
|
-
return parts.length > 0 ? `{ ${parts.join("; ")} }` : "Record<string, never>";
|
|
121
|
-
},
|
|
122
|
-
resolveFieldValueSet(_modelName, fieldName, model, contract) {
|
|
123
|
-
const field = model.fields[fieldName];
|
|
124
|
-
if (field === void 0 || field.type.kind !== "scalar") return void 0;
|
|
125
|
-
const ref = field.valueSet;
|
|
126
|
-
if (ref === void 0) return void 0;
|
|
127
|
-
const valueSet = blindCast(contract.storage).namespaces[ref.namespaceId]?.entries.valueSet?.[ref.entityName];
|
|
128
|
-
if (valueSet === void 0) return void 0;
|
|
129
|
-
return {
|
|
130
|
-
encodedValues: valueSet.values,
|
|
131
|
-
codecId: field.type.codecId
|
|
132
|
-
};
|
|
133
|
-
},
|
|
134
|
-
getFamilyImports(resolveImportSpecifier) {
|
|
135
|
-
return [
|
|
136
|
-
"import type {",
|
|
137
|
-
" MongoCollection,",
|
|
138
|
-
" MongoContractWithTypeMaps,",
|
|
139
|
-
" MongoTypeMaps,",
|
|
140
|
-
`} from '${resolveImportSpecifier("@internal/mongo-contract")}';`
|
|
141
|
-
];
|
|
142
|
-
},
|
|
143
|
-
getFamilyTypeAliases() {
|
|
144
|
-
return "";
|
|
145
|
-
},
|
|
146
|
-
getTypeMapsExpression() {
|
|
147
|
-
return "MongoTypeMaps<CodecTypes, FieldOutputTypes, FieldInputTypes>";
|
|
148
|
-
},
|
|
149
|
-
getContractWrapper(contractBaseName, typeMapsName) {
|
|
150
|
-
return `export type Contract = MongoContractWithTypeMaps<${contractBaseName}, ${typeMapsName}>;`;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
//#endregion
|
|
154
|
-
export { mongoEmission as t };
|
|
155
|
-
|
|
156
|
-
//# sourceMappingURL=exports-C4RGBGzZ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports-C4RGBGzZ.mjs","names":[],"sources":["../../../../2-mongo-family/3-tooling/emitter/dist/exports/index.mjs"],"sourcesContent":["import { serializeObjectKey, serializeValue } from \"@internal/emitter/domain-type-generation\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/index.ts\nfunction validationError(message, model) {\n\treturn structuredError(\"CONTRACT.VALIDATION_FAILED\", message, model === void 0 ? void 0 : { meta: { model } });\n}\nconst MONGO_NAMESPACE_KIND_FALLBACK = \"mongo-namespace\";\nfunction mongoNamespaceSerializedKind(ns) {\n\tconst kind = ns.kind;\n\tif (typeof kind === \"string\") return `readonly kind: ${serializeValue(kind)}`;\n\treturn `readonly kind: \"${MONGO_NAMESPACE_KIND_FALLBACK}\"`;\n}\nfunction assertUniqueMongoCollectionNames(storage) {\n\tconst seen = /* @__PURE__ */ new Map();\n\tfor (const [namespaceId, ns] of Object.entries(storage.namespaces)) for (const coll of Object.keys(ns.entries.collection ?? {})) {\n\t\tconst existing = seen.get(coll);\n\t\tif (existing !== void 0 && existing !== namespaceId) throw structuredError(\"CONTRACT.NAME_DUPLICATE\", `Duplicate collection name \"${coll}\" in namespaces \"${existing}\" and \"${namespaceId}\"`);\n\t\tseen.set(coll, namespaceId);\n\t}\n}\nfunction generateMongoCollectionEntryType(coll) {\n\tif (Object.entries(coll).filter(([key, v]) => v !== void 0 && key !== \"kind\").length === 0) return \"MongoCollection\";\n\treturn serializeValue(coll);\n}\nfunction generateMongoNamespaceCollectionsType(collections) {\n\tconst entries = [];\n\tfor (const [collName, coll] of Object.entries(collections).sort(([a], [b]) => a.localeCompare(b))) entries.push(`readonly ${serializeObjectKey(collName)}: ${generateMongoCollectionEntryType(coll)}`);\n\tif (entries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${entries.join(\"; \")} }`;\n}\nfunction generateMongoNamespacesType(namespaces) {\n\tconst sorted = Object.entries(namespaces ?? {}).sort(([a], [b]) => a.localeCompare(b));\n\tif (sorted.length === 0) return \"Record<string, never>\";\n\tconst parts = [];\n\tfor (const [name, ns] of sorted) {\n\t\tconst collectionsType = generateMongoNamespaceCollectionsType(ns.entries.collection ?? {});\n\t\tparts.push(`readonly ${serializeObjectKey(name)}: { readonly id: ${serializeValue(ns.id)}; ${mongoNamespaceSerializedKind(ns)}; readonly entries: { readonly collection: ${collectionsType} } }`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nconst mongoEmission = {\n\tid: \"mongo\",\n\tvalidateTypes(contract, _ctx) {\n\t\tconst typeIdRegex = /^([^/]+)\\/([^@]+)@(\\d+)$/;\n\t\tfor (const [namespaceId, domainNs] of Object.entries(contract.domain.namespaces)) {\n\t\t\tconst models = domainNs.models;\n\t\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\t\tfor (const [fieldName, field] of Object.entries(model.fields)) {\n\t\t\t\t\tconst fieldType = field.type;\n\t\t\t\t\tif (!fieldType) continue;\n\t\t\t\t\tconst scalarTypes = fieldType.kind === \"scalar\" ? [fieldType] : fieldType.kind === \"union\" && fieldType.members ? fieldType.members.filter((m) => m.kind === \"scalar\") : [];\n\t\t\t\t\tfor (const scalarType of scalarTypes) {\n\t\t\t\t\t\tconst { codecId } = scalarType;\n\t\t\t\t\t\tif (!codecId) throw validationError(`Field \"${fieldName}\" on model \"${qualifiedName}\" is missing codecId`, qualifiedName);\n\t\t\t\t\t\tif (!codecId.match(typeIdRegex)?.[1]) throw validationError(`Field \"${fieldName}\" on model \"${qualifiedName}\" has invalid codec ID format \"${codecId}\". Expected format: ns/name@version`, qualifiedName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tvalidateStructure(contract) {\n\t\tif (contract.targetFamily !== \"mongo\") throw validationError(`Expected targetFamily \"mongo\", got \"${contract.targetFamily}\"`);\n\t\tconst storage = contract.storage;\n\t\tif (!storage?.namespaces || typeof storage.namespaces !== \"object\") throw validationError(\"Mongo contract must have storage.namespaces\");\n\t\tassertUniqueMongoCollectionNames(storage);\n\t\tconst collectionNames = /* @__PURE__ */ new Set();\n\t\tfor (const ns of Object.values(storage.namespaces)) for (const c of Object.keys(ns.entries.collection ?? {})) collectionNames.add(c);\n\t\tfor (const [namespaceId, domainNs] of Object.entries(contract.domain.namespaces)) {\n\t\t\tconst models = domainNs.models;\n\t\t\tif (Object.keys(models).length === 0) continue;\n\t\t\tfor (const [modelName, model] of Object.entries(models)) {\n\t\t\t\tconst qualifiedName = `${namespaceId}:${modelName}`;\n\t\t\t\tif (!model.fields || typeof model.fields !== \"object\") throw validationError(`Model \"${qualifiedName}\" is missing required field \"fields\"`, qualifiedName);\n\t\t\t\tif (!model.relations || typeof model.relations !== \"object\") throw validationError(`Model \"${qualifiedName}\" is missing required field \"relations\" (must be an object)`, qualifiedName);\n\t\t\t\tif (!model.storage || typeof model.storage !== \"object\") throw validationError(`Model \"${qualifiedName}\" is missing required field \"storage\" (must be an object)`, qualifiedName);\n\t\t\t\tconst collectionValue = model.storage[\"collection\"];\n\t\t\t\tconst collection = typeof collectionValue === \"string\" ? collectionValue : void 0;\n\t\t\t\tif (model.owner) {\n\t\t\t\t\tif (collection) throw validationError(`Owned model \"${qualifiedName}\" must not have storage.collection (embedded models are stored within their owner)`, qualifiedName);\n\t\t\t\t\tif (!models[model.owner]) throw validationError(`Model \"${qualifiedName}\" declares owner \"${model.owner}\" which does not exist in models`, qualifiedName);\n\t\t\t\t} else if (collection) {\n\t\t\t\t\tif (!collectionNames.has(collection)) throw validationError(`Model \"${qualifiedName}\" references collection \"${collection}\" which is not in storage.namespaces[..].entries.collection`, qualifiedName);\n\t\t\t\t}\n\t\t\t\tif (model.base) {\n\t\t\t\t\tconst baseModel = models[model.base.model];\n\t\t\t\t\tif (!baseModel) throw validationError(`Model \"${qualifiedName}\" declares base \"${model.base.namespace}:${model.base.model}\" which does not exist in models`, qualifiedName);\n\t\t\t\t\tconst variantCollection = collection;\n\t\t\t\t\tconst baseCollection = baseModel.storage[\"collection\"];\n\t\t\t\t\tif (variantCollection !== baseCollection) throw validationError(`Variant \"${qualifiedName}\" must share its base's collection (\"${baseCollection ?? \"(none)\"}\"), but has \"${variantCollection ?? \"(none)\"}\"`, qualifiedName);\n\t\t\t\t}\n\t\t\t\tconst storageRelations = model.storage[\"relations\"];\n\t\t\t\tif (storageRelations) {\n\t\t\t\t\tfor (const relName of Object.keys(storageRelations)) if (!model.relations[relName]) throw validationError(`Model \"${qualifiedName}\" has storage.relations.${relName} but no matching domain-level relation`, qualifiedName);\n\t\t\t\t}\n\t\t\t\tfor (const [relName, rel] of Object.entries(model.relations)) {\n\t\t\t\t\tconst targetModelName = rel[\"to\"]?.model;\n\t\t\t\t\tif (targetModelName) {\n\t\t\t\t\t\tif (models[targetModelName]?.owner === modelName && !storageRelations?.[relName]) throw validationError(`Model \"${qualifiedName}\" has embed relation \"${relName}\" to owned model \"${targetModelName}\" but no matching storage.relations entry`, qualifiedName);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tgenerateStorageType(contract, storageHashTypeName) {\n\t\tconst storage = contract.storage;\n\t\treturn `{ readonly namespaces: ${generateMongoNamespacesType(storage.namespaces)}; readonly storageHash: ${storageHashTypeName} }`;\n\t},\n\tgenerateModelStorageType(_modelName, model) {\n\t\tconst parts = [];\n\t\tconst collection = model.storage[\"collection\"];\n\t\tif (collection) parts.push(`readonly collection: ${serializeValue(collection)}`);\n\t\tconst storageRelations = model.storage[\"relations\"];\n\t\tif (storageRelations && Object.keys(storageRelations).length > 0) {\n\t\t\tconst relEntries = [];\n\t\t\tfor (const [relName, relVal] of Object.entries(storageRelations)) relEntries.push(`readonly ${serializeObjectKey(relName)}: ${serializeValue(relVal)}`);\n\t\t\tparts.push(`readonly relations: { ${relEntries.join(\"; \")} }`);\n\t\t}\n\t\treturn parts.length > 0 ? `{ ${parts.join(\"; \")} }` : \"Record<string, never>\";\n\t},\n\tresolveFieldValueSet(_modelName, fieldName, model, contract) {\n\t\tconst field = model.fields[fieldName];\n\t\tif (field === void 0 || field.type.kind !== \"scalar\") return void 0;\n\t\tconst ref = field.valueSet;\n\t\tif (ref === void 0) return void 0;\n\t\tconst valueSet = blindCast(contract.storage).namespaces[ref.namespaceId]?.entries.valueSet?.[ref.entityName];\n\t\tif (valueSet === void 0) return void 0;\n\t\treturn {\n\t\t\tencodedValues: valueSet.values,\n\t\t\tcodecId: field.type.codecId\n\t\t};\n\t},\n\tgetFamilyImports(resolveImportSpecifier) {\n\t\treturn [\n\t\t\t\"import type {\",\n\t\t\t\" MongoCollection,\",\n\t\t\t\" MongoContractWithTypeMaps,\",\n\t\t\t\" MongoTypeMaps,\",\n\t\t\t`} from '${resolveImportSpecifier(\"@internal/mongo-contract\")}';`\n\t\t];\n\t},\n\tgetFamilyTypeAliases() {\n\t\treturn \"\";\n\t},\n\tgetTypeMapsExpression() {\n\t\treturn \"MongoTypeMaps<CodecTypes, FieldOutputTypes, FieldInputTypes>\";\n\t},\n\tgetContractWrapper(contractBaseName, typeMapsName) {\n\t\treturn `export type Contract = MongoContractWithTypeMaps<${contractBaseName}, ${typeMapsName}>;`;\n\t}\n};\n//#endregion\nexport { mongoEmission };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;AAIA,SAAS,gBAAgB,SAAS,OAAO;CACxC,OAAO,gBAAgB,8BAA8B,SAAS,UAAU,KAAK,IAAI,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC9G;AACA,MAAM,gCAAgC;AACtC,SAAS,6BAA6B,IAAI;CACzC,MAAM,OAAO,GAAG;CAChB,IAAI,OAAO,SAAS,UAAU,OAAO,kBAAkB,eAAe,IAAI;CAC1E,OAAO,mBAAmB,8BAA8B;AACzD;AACA,SAAS,iCAAiC,SAAS;CAClD,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,CAAC,aAAa,OAAO,OAAO,QAAQ,QAAQ,UAAU,GAAG,KAAK,MAAM,QAAQ,OAAO,KAAK,GAAG,QAAQ,cAAc,CAAC,CAAC,GAAG;EAChI,MAAM,WAAW,KA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E,MAAM,MAAM,MAAM;EAClB,IAAI,QAAQ,KAAK,GAAG,OAAO,KAAK;EAChC,MAAM,WAAW,UAAU,SAAS,OAAO,CAAC,CAAC,WAAW,IAAI,YAAY,EAAE,QAAQ,WAAW,IAAI;EACjG,IAAI,aAAa,KAAK,GAAG,OAAO,KAAK;EACrC,OAAO;GACN,eAAe,SAAS;GACxB,SAAS,MAAM,KAAK;EACrB;CACD;CACA,iBAAiB,wBAAwB;EACxC,OAAO;GACN;GACA;GACA;GACA;GACA,WAAW,uBAAuB,0BAA0B,EAAE;EAC/D;CACD;CACA,uBAAuB;EACtB,OAAO;CACR;CACA,wBAAwB;EACvB,OAAO;CACR;CACA,mBAAmB,kBAAkB,cAAc;EAClD,OAAO,oDAAoD,iBAAiB,IAAI,aAAa;CAC9F;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field-accessor-DHsAPiW3-BdYCspQC.d.mts","names":[],"sources":["../../../../2-mongo-family/5-query-builders/query-builder/dist/field-accessor-DHsAPiW3.d.mts"],"mappings":";;;;;;;;UAKU;WACC;WACA;;KAEN;WACM;WACA;;KAEN;WACM;WACA;;KAEN;WACM;WACA;;KAEN;WACM;WACA;;KAEN;WACM;WACA;;KAEN;WACM;WACA;;KAEN;WACM;WACA;;KAEN,aAAa,UAAU,YAAY,UAAU,uBAAuB,UAAU,wBAAwB,UAAU,yBAAyB,UAAU,YAAY;KAC/J,WAAW,eAAe;KAC1B,eAAe,KAAK;EACvB;IACE;IACA,eAAe;;IAEf,IAAI;EACN,eAAe;IACb;KACC,gBAAgB,kBAAkB,eAAe,iCAAiC,eAAe,iBAAiB,WAAW,eAAe,WAAW;WACjJ,SAAS,eAAe,eAAe,WAAW,qBAAqB;WACvE,UAAU,eAAe,WAAW,qBAAqB;OAC7D,mBAAmB;;;;;;;;;KASrB,cAAc,cAAc,UAAU,mBAAmB;WACnD;IACP,kBAAkB,8BAA8B,WAAW,iBAAiB,MAAM,WAAW,sBAAsB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C;WACA,QAAQ;WACR,QAAQ,WAAW,cAAc;WACjC;WACA,MAAM;;;;;WAKN;EACT,YAAY,oBAAoB,QAAQ,UAAU,QAAQ,WAAW,cAAc,WAAW,kBAAkB,OAAO,wBAAwB;;cAEnI,oCAAoC;WACvC;WACA,QAAQ;WACR,MAAM;EACf,YAAY,oBAAoB,QAAQ,UAAU,OAAO;;cAE7C,6BAA6B;WAChC;WACA,UAAU;EACnB,YAAY,oBAAoB,UAAU;;cAE9B,oCAAoC,4BAA4B;WACnE;WACA,YAAY;WACZ;WACA;WACA;WACA;WACA;WACA;IACP;IACA;IACA;;WAEO,YAAY;WACZ;IACP;;WAEO;IACP,KAAK;IACL;IACA;;EAEF,YAAY,oBAAoB,SAAS;;cAE7B,+BAA+B,4BAA4B;WAC9D;WACA,KAAK,eAAe;WACpB;WACA;WACA;WACA,0BAA0B;WAC1B;WACA,qBAAqB;WACrB,YAAY;WACZ,UAAU;WACV;WACA;EACT,YAAY,oBAAoB,KAAK,eAAe,yBAAyB,SAAS;;cAE1E,kCAAkC;WACrC;EACT,YAAY;;cAEA,6BAA6B;WAChC;WACA;EACT,YAAY,oBAAoB;;cAEpB,2BAA2B;WAC9B;WACA,YAAY;WACZ;WACA;WACA;IACP;;EAEF,YAAY,oBAAoB,SAAS;;KAEtC,yBAAyB,uBAAuB,wBAAwB,uBAAuB,wBAAwB,uBAAuB,wBAAwB,8BAA8B,8BAA8B;KAClO,yBAAyB,8BAA8B,yBAAyB,4BAA4B,uBAAuB;KACnI,sBAAsB,yBAAyB;iBACnC,iBAAiB,KAAK,sBAAsB,OAAO"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { C as MongoContract, T as MongoIndex, nt as MongoValueSet, rt as MongoValueSetInput, v as MongoCollection, y as MongoCollectionInput } from "./mongo-value-set-tNn9-pun-dJYx_rVD.mjs";
|
|
2
|
-
import { StorageHashBase } from "@prisma/orm-framework/contract/types";
|
|
3
|
-
import { Type } from "arktype";
|
|
4
|
-
import { DefaultNamespaceEntries, IRNodeBase, Namespace, NamespaceBase, NamespacedEntities, SingleNamespaceView, Storage } from "@prisma/orm-framework/components/ir";
|
|
5
|
-
//#region ../../../2-mongo-family/1-foundation/mongo-contract/dist/index.d.mts
|
|
6
|
-
//#region src/contract-schema.d.ts
|
|
7
|
-
declare const StorageValueSetSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
8
|
-
kind: "valueSet";
|
|
9
|
-
values: readonly (string | number | boolean | Record<string, unknown> | unknown[] | null)[];
|
|
10
|
-
}, {}>;
|
|
11
|
-
/**
|
|
12
|
-
* Builds the per-namespace envelope schema for Mongo storage. Pack
|
|
13
|
-
* contributions are keyed by the descriptor's `discriminator` and
|
|
14
|
-
* validate each entry by matching the entry's `kind` field. Mongo today
|
|
15
|
-
* has no pack contributions; the composition surface exists for symmetry
|
|
16
|
-
* with SQL and as the substrate for future entity kinds.
|
|
17
|
-
*
|
|
18
|
-
* `'kind?': 'string'` because `kind` is non-enumerable on built
|
|
19
|
-
* Mongo namespace IR classes and therefore absent from the wire shape; the
|
|
20
|
-
* type-side narrowing is enforced by the IR class, not by this validator.
|
|
21
|
-
*/
|
|
22
|
-
declare function createMongoNamespaceEnvelopeSchema(fragments?: ReadonlyMap<string, Type<unknown>>): Type<unknown>;
|
|
23
|
-
/**
|
|
24
|
-
* Builds the full Mongo contract schema. The per-namespace entry
|
|
25
|
-
* threading happens through {@link createMongoNamespaceEnvelopeSchema};
|
|
26
|
-
* the rest of the envelope is family-shared.
|
|
27
|
-
*/
|
|
28
|
-
declare function createMongoContractSchema(fragments?: ReadonlyMap<string, Type<unknown>>): Type<unknown>;
|
|
29
|
-
declare const MongoContractSchema: import("arktype").BaseType<unknown, {}>;
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/contract-view.d.ts
|
|
32
|
-
declare const MONGO_BUILTIN_KINDS: readonly ["collection"];
|
|
33
|
-
type MongoBuiltinKind = (typeof MONGO_BUILTIN_KINDS)[number];
|
|
34
|
-
type MongoEntries<TContract extends MongoContract> = DefaultNamespaceEntries<TContract['storage']>;
|
|
35
|
-
/**
|
|
36
|
-
* The Mongo accessors: the built-in `collection` kind promoted to a top-level
|
|
37
|
-
* accessor, pack-contributed kinds under `entries` (singular keys).
|
|
38
|
-
*/
|
|
39
|
-
type MongoContractAccessors<TContract extends MongoContract> = SingleNamespaceView<MongoEntries<TContract>, MongoBuiltinKind>;
|
|
40
|
-
/**
|
|
41
|
-
* A Mongo contract view: the deserialized contract intersected with the by-name
|
|
42
|
-
* accessors, so the value is substitutable for `Contract` (carries `storage`,
|
|
43
|
-
* `domain`, …) while also exposing:
|
|
44
|
-
* - `view.collection.<name>` — the built-in kind, sole namespace unwrapped to
|
|
45
|
-
* the root (Mongo is single-namespace).
|
|
46
|
-
* - `view.entries.<kind>` — pack-contributed kinds (singular keys).
|
|
47
|
-
* - `view.namespace.<id>` — the namespace-keyed entity map (Mongo's sole
|
|
48
|
-
* namespace is `__unbound__`). This mirrors the runtime `db.enums` pattern:
|
|
49
|
-
* a single fixed `namespace` member, collision-proof.
|
|
50
|
-
*
|
|
51
|
-
* The factory (`MongoContractView.from` / `.fromJson`) lives in
|
|
52
|
-
* `@internal/family-mongo/ir`, where the Mongo serializer is reachable; this
|
|
53
|
-
* package owns the serializer-agnostic projection type and builder.
|
|
54
|
-
*/
|
|
55
|
-
type MongoContractView<TContract extends MongoContract = MongoContract> = TContract & MongoContractAccessors<TContract> & {
|
|
56
|
-
readonly namespace: NamespacedEntities<TContract['storage'], MongoBuiltinKind>;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Builds the Mongo view: unwraps the sole namespace's built-in `collection` kind
|
|
60
|
-
* to the root, attaches the namespace-keyed `namespace` map, and layers both
|
|
61
|
-
* over the deserialized contract so the result is a structural superset of the
|
|
62
|
-
* contract.
|
|
63
|
-
*/
|
|
64
|
-
declare function buildMongoContractView<TContract extends MongoContract>(contract: TContract): MongoContractView<TContract>;
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/default-namespace.d.ts
|
|
67
|
-
/** Default storage namespace for Mongo-family contracts at runtime. */
|
|
68
|
-
declare const defaultMongoStorageNamespaceId: "__unbound__";
|
|
69
|
-
/** Default domain namespace for Mongo-family contracts at runtime. */
|
|
70
|
-
declare const defaultMongoDomainNamespaceId: "__unbound__";
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/ir/mongo-storage.d.ts
|
|
73
|
-
type MongoNamespaceEntries = Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
|
|
74
|
-
readonly collection?: Readonly<Record<string, MongoCollection>>;
|
|
75
|
-
readonly valueSet?: Readonly<Record<string, MongoValueSet>>;
|
|
76
|
-
};
|
|
77
|
-
interface MongoNamespaceCollectionsInput {
|
|
78
|
-
readonly id: string;
|
|
79
|
-
readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
|
|
80
|
-
readonly collection?: Readonly<Record<string, MongoCollectionInput>>;
|
|
81
|
-
readonly valueSet?: Readonly<Record<string, MongoValueSetInput>>;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
type MongoNamespace = Namespace & {
|
|
85
|
-
readonly entries: MongoNamespaceEntries;
|
|
86
|
-
};
|
|
87
|
-
interface MongoStorageInput<THash extends string = string> {
|
|
88
|
-
readonly storageHash: StorageHashBase<THash>;
|
|
89
|
-
readonly namespaces: Readonly<Record<string, MongoNamespace>>;
|
|
90
|
-
}
|
|
91
|
-
declare class MongoStorage<THash extends string = string> extends IRNodeBase implements Storage {
|
|
92
|
-
readonly kind: 'mongo-storage';
|
|
93
|
-
readonly storageHash: StorageHashBase<THash>;
|
|
94
|
-
readonly namespaces: Readonly<Record<string, MongoNamespace>>;
|
|
95
|
-
constructor(input: MongoStorageInput<THash>);
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/ir/build-mongo-namespace.d.ts
|
|
99
|
-
declare function buildMongoNamespace(input: MongoNamespaceCollectionsInput): MongoNamespace;
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/ir/mongo-unbound-namespace.d.ts
|
|
102
|
-
declare class MongoUnboundNamespace extends NamespaceBase {
|
|
103
|
-
static readonly instance: MongoUnboundNamespace;
|
|
104
|
-
readonly id: "__unbound__";
|
|
105
|
-
readonly entries: MongoNamespaceEntries;
|
|
106
|
-
readonly kind: string;
|
|
107
|
-
private constructor();
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/polymorphic-index-scope.d.ts
|
|
111
|
-
type PolymorphicIndexScope = {
|
|
112
|
-
readonly discriminatorField: string;
|
|
113
|
-
readonly discriminatorValue: string | number | boolean;
|
|
114
|
-
};
|
|
115
|
-
type ApplyScopeResult = {
|
|
116
|
-
readonly kind: 'ok';
|
|
117
|
-
readonly index: MongoIndex;
|
|
118
|
-
} | {
|
|
119
|
-
readonly kind: 'conflict';
|
|
120
|
-
readonly reason: string;
|
|
121
|
-
};
|
|
122
|
-
declare function applyPolymorphicScopeToMongoIndex(index: MongoIndex, scope: PolymorphicIndexScope): ApplyScopeResult;
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/validate-storage.d.ts
|
|
125
|
-
declare function validateMongoStorage(contract: MongoContract): void;
|
|
126
|
-
//#endregion
|
|
127
|
-
export { defaultMongoDomainNamespaceId as _, MongoNamespace as a, MongoStorageInput as c, StorageValueSetSchema as d, applyPolymorphicScopeToMongoIndex as f, createMongoNamespaceEnvelopeSchema as g, createMongoContractSchema as h, MongoContractView as i, MongoUnboundNamespace as l, buildMongoNamespace as m, MongoContractAccessors as n, MongoNamespaceEntries as o, buildMongoContractView as p, MongoContractSchema as r, MongoStorage as s, ApplyScopeResult as t, PolymorphicIndexScope as u, defaultMongoStorageNamespaceId as v, validateMongoStorage as y };
|
|
128
|
-
//# sourceMappingURL=index-Cd2zLiU6.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-Cd2zLiU6.d.mts","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-contract/dist/index.d.mts"],"mappings":";;;;;;cAKc,qEAAqE;EACjF;EACA,8CAA8C;;;;;;;;;;;;;iBAa/B,mCAAmC,YAAY,oBAAoB,iBAAiB;;;;;;iBAMpF,0BAA0B,YAAY,oBAAoB,iBAAiB;cAC9E,uCAAuC;;;cAGvC;KACT,2BAA2B;KAC3B,aAAa,kBAAkB,iBAAiB,wBAAwB;;;;;KAKxE,uBAAuB,kBAAkB,iBAAiB,oBAAoB,aAAa,YAAY;;;;;;;;;;;;;;;;KAgBvG,kBAAkB,kBAAkB,gBAAgB,iBAAiB,YAAY,uBAAuB;WAClG,WAAW,mBAAmB,sBAAsB;;;;;;;;iBAQ9C,uBAAuB,kBAAkB,eAAe,UAAU,YAAY,kBAAkB;;;;cAInG;;cAEA;;;KAGT,wBAAwB,SAAS,eAAe,SAAS;WACnD,aAAa,SAAS,eAAe;WACrC,WAAW,SAAS,eAAe;;UAEpC;WACC;WACA,SAAS,SAAS,eAAe,SAAS;aACxC,aAAa,SAAS,eAAe;aACrC,WAAW,SAAS,eAAe;;;KAG3C,iBAAiB;WACX,SAAS;;UAEV,kBAAkB;WACjB,aAAa,gBAAgB;WAC7B,YAAY,SAAS,eAAe;;cAEjC,aAAa,uCAAuC,sBAAsB;WAC7E;WACA,aAAa,gBAAgB;WAC7B,YAAY,SAAS,eAAe;EAC7C,YAAY,OAAO,kBAAkB;;;;iBAItB,oBAAoB,OAAO,iCAAiC;;;cAG/D,8BAA8B;kBAC1B,UAAU;WACjB;WACA,SAAS;WACT;UACD;;;;KAIL;WACM;WACA;;KAEN;WACM;WACA,OAAO;;WAEP;WACA;;iBAEM,kCAAkC,OAAO,YAAY,OAAO,wBAAwB;;;iBAGpF,qBAAqB,UAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DAOkcTCK.d.mts","names":[],"sources":["../../../../2-mongo-family/6-transport/mongo-lowering/dist/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAkBK;WACM;WACA;WACA,UAAU;;WAEV;WACA;WACA,WAAW,cAAc;;WAEzB;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;;WAEA;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;WACA,MAAM;WACN;;WAEA;WACA;WACA,QAAQ;WACR,MAAM;;WAEN;WACA;WACA,UAAU,cAAc;;WAExB;WACA;WACA,UAAU;;WAEV;WACA;WACA,WAAW,cAAc;;WAEzB;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;;WAEhD;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;;WAEhD;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;;WAER;WACA;WACA,QAAQ;WACR,QAAQ,0BAA0B,cAAc;WAChD;WACA,MAAM;WACN;;WAEA;WACA;WACA,QAAQ;WACR,MAAM;;WAEN;WACA;WACA,UAAU,cAAc;;;UAGzB;WACC,SAAS;;UAEV;EACR,MAAM,MAAM,cAAc,KAAK,mBAAmB,QAAQ;EAC1D,MAAM,MAAM,gBAAgB,KAAK,mBAAmB,QAAQ;EAC5D,MAAM,MAAM,iBAAiB,cAAc,KAAK,mBAAmB,QAAQ;;;;;;;;;;;EAW3E,gBAAgB,MAAM,iBAAiB;;;;;;;;;EASvC,cAAc,OAAO,mBAAmB,KAAK,mBAAmB,QAAQ;;;;UAIhE;EACR,QAAQ,KAAK,aAAa,yBAAyB,cAAc;EACjE,IAAI,aAAa,yBAAyB;EAC1C,SAAS;;UAED,mCAAmC,yCAAyC;WAC3E,IAAI"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
2
|
-
import { Codec, CodecCallContext, CodecTrait } from "@prisma/orm-framework/components/codec";
|
|
3
|
-
//#region ../../../2-mongo-family/1-foundation/mongo-codec/dist/index.d.mts
|
|
4
|
-
//#region src/codecs.d.ts
|
|
5
|
-
type MongoCodecTrait = CodecTrait;
|
|
6
|
-
/**
|
|
7
|
-
* A codec for the Mongo target. Translates between an application value and the BSON-shaped wire form the Mongo driver exchanges, and between an application value and the JSON form stored in contract artifacts.
|
|
8
|
-
*
|
|
9
|
-
* Same shape as the framework codec base — see `Codec` in `@internal/framework-components/codec` for the contract. Codec-id-keyed static metadata (`traits`, `targetTypes`, `renderOutputType`) lives on the unified {@link import('@prisma/orm-framework/components/codec').CodecDescriptor}; Mongo's full migration to descriptor-side registration is tracked under TML-2324.
|
|
10
|
-
*/
|
|
11
|
-
interface MongoCodec<Id extends string = string, TTraits extends readonly MongoCodecTrait[] = readonly MongoCodecTrait[], TWire = unknown, TInput = unknown> extends Codec<Id, TTraits, TWire, TInput> {}
|
|
12
|
-
/**
|
|
13
|
-
* Conditional bundle for `encodeJson`/`decodeJson`: when `TInput` is structurally assignable to `JsonValue` the identity defaults are sound and both fields are optional; otherwise both fields are required so an author cannot silently produce a non-JSON-safe contract artifact.
|
|
14
|
-
*/
|
|
15
|
-
type JsonRoundTripConfig<TInput> = [TInput] extends [JsonValue] ? {
|
|
16
|
-
encodeJson?: (value: TInput) => JsonValue;
|
|
17
|
-
decodeJson?: (json: JsonValue) => TInput;
|
|
18
|
-
} : {
|
|
19
|
-
encodeJson: (value: TInput) => JsonValue;
|
|
20
|
-
decodeJson: (json: JsonValue) => TInput;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Construct a Mongo codec from author functions.
|
|
24
|
-
*
|
|
25
|
-
* Author `encode` and `decode` as sync or async functions; the factory produces a {@link MongoCodec} whose query-time methods follow the boundary contract documented on the framework {@link BaseCodec}. Authors receive a second `ctx` options argument carrying the per-call context; ignore it if you don't need it.
|
|
26
|
-
*
|
|
27
|
-
* Both `encode` and `decode` are required so `TInput` and `TWire` are always covered by an explicit author function — the factory installs no identity fallback. `encodeJson` and `decodeJson` default to identity **only when `TInput` is assignable to `JsonValue`**; otherwise both are required so the contract artifact stays JSON-safe.
|
|
28
|
-
*
|
|
29
|
-
* Codec-id-keyed static metadata (`traits`, `targetTypes`, `renderOutputType`) lives on the unified `CodecDescriptor` rather than on the codec instance itself (TML-2357).
|
|
30
|
-
*/
|
|
31
|
-
declare function mongoCodec<Id extends string, const TTraits extends readonly MongoCodecTrait[] = readonly [], TWire = unknown, TInput = unknown>(config: {
|
|
32
|
-
typeId: Id;
|
|
33
|
-
encode: (value: TInput, ctx: CodecCallContext) => TWire | Promise<TWire>;
|
|
34
|
-
decode: (wire: TWire, ctx: CodecCallContext) => TInput | Promise<TInput>;
|
|
35
|
-
} & JsonRoundTripConfig<TInput>): MongoCodec<Id, TTraits, TWire, TInput>;
|
|
36
|
-
/** Extract the JS application type carried by a Mongo codec — used both as `encode` input and as `decode` output. */
|
|
37
|
-
type MongoCodecInput<T> = T extends MongoCodec<string, readonly MongoCodecTrait[], unknown, infer TInput> ? TInput : never;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/codec-registry.d.ts
|
|
40
|
-
interface MongoCodecRegistry {
|
|
41
|
-
get(id: string): MongoCodec<string> | undefined;
|
|
42
|
-
has(id: string): boolean;
|
|
43
|
-
register(codec: MongoCodec<string>): void;
|
|
44
|
-
[Symbol.iterator](): Iterator<MongoCodec<string>>;
|
|
45
|
-
values(): IterableIterator<MongoCodec<string>>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Create a new Mongo codec registry. Inline object literal — no class implementation; the registry is just a private `Map` with the documented surface methods.
|
|
49
|
-
*/
|
|
50
|
-
declare function newMongoCodecRegistry(): MongoCodecRegistry;
|
|
51
|
-
//#endregion
|
|
52
|
-
export { mongoCodec as a, MongoCodecTrait as i, MongoCodecInput as n, newMongoCodecRegistry as o, MongoCodecRegistry as r, MongoCodec as t };
|
|
53
|
-
//# sourceMappingURL=index-Dv2PNMiG.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-Dv2PNMiG.d.mts","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-codec/dist/index.d.mts"],"mappings":";;;;KAGK,kBAAkB;;;;;;UAMb,WAAW,4BAA4B,yBAAyB,6BAA6B,mBAAmB,iBAAiB,0BAA0B,MAAM,IAAI,SAAS,OAAO;;;;KAI1L,oBAAoB,WAAW,iBAAiB;EACnD,cAAc,OAAO,WAAW;EAChC,cAAc,MAAM,cAAc;;EAElC,aAAa,OAAO,WAAW;EAC/B,aAAa,MAAM,cAAc;;;;;;;;;;;iBAWlB,WAAW,yBAAyB,yBAAyB,iCAAiC,iBAAiB,kBAAkB;EAChJ,QAAQ;EACR,SAAS,OAAO,QAAQ,KAAK,qBAAqB,QAAQ,QAAQ;EAClE,SAAS,MAAM,OAAO,KAAK,qBAAqB,SAAS,QAAQ;IAC/D,oBAAoB,UAAU,WAAW,IAAI,SAAS,OAAO;;KAE5D,gBAAgB,KAAK,UAAU,4BAA4B,kCAAkC,UAAU;;;UAGlG;EACR,IAAI,aAAa;EACjB,IAAI;EACJ,SAAS,OAAO;GACf,OAAO,aAAa,SAAS;EAC9B,UAAU,iBAAiB;;;;;iBAKZ,yBAAyB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region ../../../2-mongo-family/1-foundation/mongo-value/dist/index.d.mts
|
|
2
|
-
//#region src/param-ref.d.ts
|
|
3
|
-
declare class MongoParamRef {
|
|
4
|
-
readonly value: unknown;
|
|
5
|
-
readonly name: string | undefined;
|
|
6
|
-
readonly codecId: string | undefined;
|
|
7
|
-
constructor(value: unknown, options?: {
|
|
8
|
-
name?: string;
|
|
9
|
-
codecId?: string;
|
|
10
|
-
});
|
|
11
|
-
static of(value: unknown, options?: {
|
|
12
|
-
name?: string;
|
|
13
|
-
codecId?: string;
|
|
14
|
-
}): MongoParamRef;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/values.d.ts
|
|
18
|
-
type LiteralValue = string | number | boolean | null | Date;
|
|
19
|
-
type MongoValue = MongoParamRef | LiteralValue | MongoDocument | MongoArray;
|
|
20
|
-
interface MongoDocument {
|
|
21
|
-
readonly [key: string]: MongoValue;
|
|
22
|
-
}
|
|
23
|
-
interface MongoArray extends ReadonlyArray<MongoValue> {}
|
|
24
|
-
type MongoExpr = MongoDocument;
|
|
25
|
-
type MongoUpdateDocument = Record<string, MongoValue>;
|
|
26
|
-
type RawPipeline = ReadonlyArray<Record<string, unknown>>;
|
|
27
|
-
type Document = Record<string, unknown>;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { MongoExpr as a, MongoValue as c, MongoDocument as i, RawPipeline as l, LiteralValue as n, MongoParamRef as o, MongoArray as r, MongoUpdateDocument as s, Document as t };
|
|
30
|
-
//# sourceMappingURL=index-wKMm41HC.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-wKMm41HC.d.mts","names":[],"sources":["../../../../2-mongo-family/1-foundation/mongo-value/dist/index.d.mts"],"mappings":";;cACc;WACH;WACA;WACA;EACT,YAAY,gBAAgB;IAC1B;IACA;;SAEK,GAAG,gBAAgB;IACxB;IACA;MACE;;;;KAID,kDAAkD;KAClD,aAAa,gBAAgB,eAAe,gBAAgB;UACvD;YACE,cAAc;;UAEhB,mBAAmB,cAAc;KACtC,YAAY;KACZ,sBAAsB,eAAe;KACrC,cAAc,cAAc;KAC5B,WAAW"}
|