@prisma/orm-target-mongo 8.0.0-rc.2-dev.2 → 8.0.0-rc.20

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.
Files changed (122) hide show
  1. package/README.md +1 -5
  2. package/dist/adapter.d.mts +2 -2
  3. package/dist/adapter.d.mts.map +1 -1
  4. package/dist/adapter.mjs +3 -3
  5. package/dist/adapter.mjs.map +1 -1
  6. package/dist/adapter__control.d.mts +204 -3
  7. package/dist/adapter__control.d.mts.map +1 -0
  8. package/dist/adapter__control.mjs +481 -3
  9. package/dist/adapter__control.mjs.map +1 -0
  10. package/dist/adapter__runtime.d.mts +3 -1
  11. package/dist/adapter__runtime.d.mts.map +1 -1
  12. package/dist/adapter__runtime.mjs +5 -3
  13. package/dist/adapter__runtime.mjs.map +1 -1
  14. package/dist/codec-ids-BKQbXhZt.d.mts +18 -0
  15. package/dist/codec-ids-BKQbXhZt.d.mts.map +1 -0
  16. package/dist/codec-ids-WdrumsYA-CZVjuKW8.mjs +18 -0
  17. package/dist/codec-ids-WdrumsYA-CZVjuKW8.mjs.map +1 -0
  18. package/dist/codec-types-oKxM85p-.d.mts +89 -0
  19. package/dist/codec-types-oKxM85p-.d.mts.map +1 -0
  20. package/dist/codecs-B1ab7vfj-QL33tkm2.mjs +392 -0
  21. package/dist/codecs-B1ab7vfj-QL33tkm2.mjs.map +1 -0
  22. package/dist/codecs-Y5GYsLPj.d.mts +36 -0
  23. package/dist/codecs-Y5GYsLPj.d.mts.map +1 -0
  24. package/dist/control-Cq6qWohQ.mjs +2421 -0
  25. package/dist/control-Cq6qWohQ.mjs.map +1 -0
  26. package/dist/{control-CxXmTy_h.d.mts → control-CrFS8bqh.d.mts} +133 -95
  27. package/dist/control-CrFS8bqh.d.mts.map +1 -0
  28. package/dist/data-types-LShlnAUM.d.mts +25 -0
  29. package/dist/data-types-LShlnAUM.d.mts.map +1 -0
  30. package/dist/data-types-hoKLBrYZ-h9cAgbOy.mjs +624 -0
  31. package/dist/data-types-hoKLBrYZ-h9cAgbOy.mjs.map +1 -0
  32. package/dist/descriptor-meta-DTj807jv-CjvK2XDD.mjs +146 -0
  33. package/dist/descriptor-meta-DTj807jv-CjvK2XDD.mjs.map +1 -0
  34. package/dist/descriptor-meta-runtime-BaRbjvD7-D0786_Lv.mjs +20 -0
  35. package/dist/descriptor-meta-runtime-BaRbjvD7-D0786_Lv.mjs.map +1 -0
  36. package/dist/driver.d.mts +1 -1
  37. package/dist/driver.mjs +1 -1
  38. package/dist/driver__control.d.mts +4 -3
  39. package/dist/driver__control.d.mts.map +1 -1
  40. package/dist/driver__control.mjs +5 -2
  41. package/dist/driver__control.mjs.map +1 -1
  42. package/dist/{migration-BkqcE2Uv.d.mts → migration-C4m4Uj8E.d.mts} +15 -7
  43. package/dist/migration-C4m4Uj8E.d.mts.map +1 -0
  44. package/dist/migration-factories-BqROEHRs-CfExMr9r.mjs +406 -0
  45. package/dist/migration-factories-BqROEHRs-CfExMr9r.mjs.map +1 -0
  46. package/dist/{mongo-adapter-B2HEyX0b-CQt2HH_o.mjs → mongo-adapter-Bo6ciURK-DIMJdC7y.mjs} +37 -18
  47. package/dist/mongo-adapter-Bo6ciURK-DIMJdC7y.mjs.map +1 -0
  48. package/dist/{mongo-adapter-CjJU3S9o-BIJruFYW.d.mts → mongo-adapter-wvK2fQOZ-FswLS-PJ.d.mts} +2 -2
  49. package/dist/mongo-adapter-wvK2fQOZ-FswLS-PJ.d.mts.map +1 -0
  50. package/dist/{mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts → mongo-driver-CTyvKDUg-Bm9sBrfs.d.mts} +9 -4
  51. package/dist/mongo-driver-CTyvKDUg-Bm9sBrfs.d.mts.map +1 -0
  52. package/dist/{mongo-driver-CMzJAzeQ-B3Q4RoHN.mjs → mongo-driver-Cu6FP6OU-DhOzFM2D.mjs} +34 -8
  53. package/dist/mongo-driver-Cu6FP6OU-DhOzFM2D.mjs.map +1 -0
  54. package/dist/mongo-target-errors-Btf3ML1w-QOtEG7EX.mjs +9 -0
  55. package/dist/mongo-target-errors-Btf3ML1w-QOtEG7EX.mjs.map +1 -0
  56. package/dist/{op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts → op-factory-call-BoYr7vvM-CjA8nx36.d.mts} +43 -9
  57. package/dist/op-factory-call-BoYr7vvM-CjA8nx36.d.mts.map +1 -0
  58. package/dist/pack-CIfujQmd.d.mts +266 -0
  59. package/dist/pack-CIfujQmd.d.mts.map +1 -0
  60. package/dist/prisma6-binding-DhnqslLT.d.mts +54 -0
  61. package/dist/prisma6-binding-DhnqslLT.d.mts.map +1 -0
  62. package/dist/prisma6-binding-vt4tbT-Z.mjs +45 -0
  63. package/dist/prisma6-binding-vt4tbT-Z.mjs.map +1 -0
  64. package/dist/{runtime-B9_-kjBX.d.mts → runtime-DbFgyDql.d.mts} +2 -2
  65. package/dist/runtime-DbFgyDql.d.mts.map +1 -0
  66. package/dist/target.d.mts +11 -8
  67. package/dist/target.mjs +7 -3
  68. package/dist/target__codec-ids.d.mts +2 -0
  69. package/dist/target__codec-ids.mjs +2 -0
  70. package/dist/target__codec-types.d.mts +2 -2
  71. package/dist/target__codecs.d.mts +2 -0
  72. package/dist/target__codecs.mjs +2 -0
  73. package/dist/target__control.d.mts +3 -4
  74. package/dist/target__control.mjs +2 -2
  75. package/dist/target__data-types.d.mts +2 -0
  76. package/dist/target__data-types.mjs +2 -0
  77. package/dist/target__migration.d.mts +2 -2
  78. package/dist/target__migration.mjs +2 -2
  79. package/dist/target__pack.d.mts +3 -2
  80. package/dist/target__pack.mjs +2 -2
  81. package/dist/target__pack.mjs.map +1 -1
  82. package/dist/target__prisma6-binding.d.mts +2 -0
  83. package/dist/target__prisma6-binding.mjs +2 -0
  84. package/dist/target__runtime.d.mts +1 -1
  85. package/dist/target__runtime.mjs +3 -3
  86. package/dist/target__runtime.mjs.map +1 -1
  87. package/package.json +16 -15
  88. package/dist/adapter__codec-ids.d.mts +0 -12
  89. package/dist/adapter__codec-ids.d.mts.map +0 -1
  90. package/dist/adapter__codec-ids.mjs +0 -2
  91. package/dist/adapter__codec-types.d.mts +0 -38
  92. package/dist/adapter__codec-types.d.mts.map +0 -1
  93. package/dist/adapter__codec-types.mjs +0 -1
  94. package/dist/adapter__codecs.d.mts +0 -14
  95. package/dist/adapter__codecs.d.mts.map +0 -1
  96. package/dist/adapter__codecs.mjs +0 -2
  97. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs +0 -12
  98. package/dist/codec-ids-BennPcpQ-Btzz3ILV.mjs.map +0 -1
  99. package/dist/codec-types-Bx2fHyq_.d.mts +0 -35
  100. package/dist/codec-types-Bx2fHyq_.d.mts.map +0 -1
  101. package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs +0 -170
  102. package/dist/codecs-DLWO-Cjc-CWfQj0bY.mjs.map +0 -1
  103. package/dist/control-CxXmTy_h.d.mts.map +0 -1
  104. package/dist/control-DQD76x-1.mjs +0 -437
  105. package/dist/control-DQD76x-1.mjs.map +0 -1
  106. package/dist/control-Dfe3dqw9.mjs +0 -1563
  107. package/dist/control-Dfe3dqw9.mjs.map +0 -1
  108. package/dist/control-rPM2HNxW.d.mts +0 -170
  109. package/dist/control-rPM2HNxW.d.mts.map +0 -1
  110. package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs +0 -17
  111. package/dist/descriptor-meta-CBiaTwe5-HX742pZh.mjs.map +0 -1
  112. package/dist/migration-BkqcE2Uv.d.mts.map +0 -1
  113. package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs +0 -201
  114. package/dist/migration-factories-CCJFG_3e-75oJ8xn2.mjs.map +0 -1
  115. package/dist/mongo-adapter-B2HEyX0b-CQt2HH_o.mjs.map +0 -1
  116. package/dist/mongo-adapter-CjJU3S9o-BIJruFYW.d.mts.map +0 -1
  117. package/dist/mongo-driver-CMzJAzeQ-B3Q4RoHN.mjs.map +0 -1
  118. package/dist/mongo-driver-D1lEf5Kl-KPfGUVXK.d.mts.map +0 -1
  119. package/dist/op-factory-call-B7EKa4Ri-B2Lb6W68.d.mts.map +0 -1
  120. package/dist/pack-MK8ZQfrL.d.mts +0 -22
  121. package/dist/pack-MK8ZQfrL.d.mts.map +0 -1
  122. package/dist/runtime-B9_-kjBX.d.mts.map +0 -1
@@ -1,20 +1,21 @@
1
- import { a as MongoRunnerDependencies } from "./control-rPM2HNxW.mjs";
2
- import { s as OpFactoryCall$1 } from "./op-factory-call-B7EKa4Ri-B2Lb6W68.mjs";
1
+ import { c as RenameCollectionCall, l as RenameFieldCall, s as OpFactoryCall$1, u as UnsetFieldCall } from "./op-factory-call-BoYr7vvM-CjA8nx36.mjs";
2
+ import "@prisma/orm-framework/utils/structured-error";
3
3
  import { Namespace, NamespaceBase } from "@prisma/orm-framework/components/ir";
4
- import { AnyMongoMigrationOperation, MongoAndExpr, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoFilterExpr, MongoFilterVisitor, MongoMigrationPlanOperation, MongoNotExpr, MongoOrExpr } from "@prisma/orm-family-mongo/query-ast/control";
4
+ import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
5
5
  import { MongoSchemaIR } from "@prisma/orm-family-mongo/schema-ir";
6
+ import { AnyMongoMigrationOperation, MongoAndExpr, MongoExistsExpr, MongoExprFilter, MongoFieldFilter, MongoFilterExpr, MongoFilterVisitor, MongoNotExpr, MongoOrExpr } from "@prisma/orm-family-mongo/query-ast/control";
6
7
  import { MongoControlTargetDescriptor } from "@prisma/orm-family-mongo/family/control";
8
+ import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationScaffoldContext, OperationContext, PlanOrigin, ResolvedMigrationStatement, SchemaDiffIssue, SchemaVerifyOptions, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
7
9
  import { Result } from "@prisma/orm-framework/utils/result";
8
- import { Migration, MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
9
- import { MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanWithAuthoringSurface, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerPerSpaceSuccessValue, MigrationScaffoldContext, OperationContext, SchemaDiffIssue, SchemaVerifyOptions, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
10
- import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
11
10
  import { MongoContractSerializerBase, MongoSchemaVerifierBase } from "@prisma/orm-family-mongo/family/ir";
12
11
  import { MongoCollection, MongoCollectionInput, MongoContract, MongoNamespaceEntries, MongoStorage, MongoValueSetInput } from "@prisma/orm-family-mongo/contract";
13
12
  import { Contract } from "@prisma/orm-framework/contract/types";
14
- import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
13
+ import { Migration, MigrationMeta } from "@prisma/orm-toolchain/migration-tools/migration";
14
+ import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
15
+ import { MongoRunnerDependencies } from "@prisma/orm-family-mongo/family/control-adapter";
15
16
  import { AggregateMigrationEdgeRef } from "@prisma/orm-toolchain/migration-tools/aggregate";
16
17
  import { JsonObject } from "@prisma/orm-framework/utils/json";
17
- //#region ../../../3-mongo-target/1-mongo-target/dist/control.d.mts
18
+ //#region ../../../3-targets/mongo/1-target/dist/control.d.mts
18
19
  //#region src/core/mongo-target-contract.d.ts
19
20
  /**
20
21
  * Mongo target contract envelope: the result of
@@ -30,7 +31,7 @@ type MongoTargetContract = Omit<MongoContract, 'storage'> & {
30
31
  readonly storage: MongoStorage;
31
32
  };
32
33
  //#endregion
33
- //#region src/core/control-target.d.ts
34
+ //#region src/core/migrations/control-target.d.ts
34
35
  /**
35
36
  * `migration.ts` default-exports a `Migration` subclass whose `operations`
36
37
  * getter returns the ordered list of operations and whose `describe()`
@@ -43,7 +44,7 @@ type MongoTargetContract = Omit<MongoContract, 'storage'> & {
43
44
  */
44
45
  declare const mongoTargetDescriptor: MongoControlTargetDescriptor<MongoTargetContract>;
45
46
  //#endregion
46
- //#region src/core/filter-evaluator.d.ts
47
+ //#region src/core/migrations/filter-evaluator.d.ts
47
48
  declare class FilterEvaluator implements MongoFilterVisitor<boolean> {
48
49
  private doc;
49
50
  evaluate(filter: MongoFilterExpr, doc: Record<string, unknown>): boolean;
@@ -55,15 +56,31 @@ declare class FilterEvaluator implements MongoFilterVisitor<boolean> {
55
56
  expr(_expr: MongoExprFilter): boolean;
56
57
  }
57
58
  //#endregion
58
- //#region src/core/mongo-ops-serializer.d.ts
59
+ //#region src/core/migrations/mongo-ops-serializer.d.ts
59
60
  declare function deserializeMongoOp(json: unknown): AnyMongoMigrationOperation;
60
61
  declare function deserializeMongoOps(json: readonly unknown[]): AnyMongoMigrationOperation[];
61
62
  declare function serializeMongoOps(ops: readonly AnyMongoMigrationOperation[]): string;
62
63
  //#endregion
63
- //#region src/core/mongo-planner.d.ts
64
+ //#region src/core/migrations/mongo-statement-planning.d.ts
65
+ /**
66
+ * The calls statements and removed fields add to a plan, with the schema the diff starts from:
67
+ * the origin with each renamed collection under its new name, so the diff does not drop and
68
+ * create it again.
69
+ */
70
+ interface StatementCalls {
71
+ readonly schema: MongoSchemaIR;
72
+ /** Run first. */
73
+ readonly collectionRenames: readonly RenameCollectionCall[];
74
+ /** Run after index drops and before index creates. */
75
+ readonly rewrites: readonly (RenameFieldCall | UnsetFieldCall)[];
76
+ }
77
+ //#endregion
78
+ //#region src/core/migrations/mongo-planner.d.ts
64
79
  type PlanCallsResult = {
65
80
  readonly kind: 'success';
66
81
  readonly calls: OpFactoryCall$1[];
82
+ /** One for each change a collection's control policy left out of the plan. */
83
+ readonly warnings: readonly MigrationPlannerConflict[];
67
84
  } | {
68
85
  readonly kind: 'failure';
69
86
  readonly conflicts: MigrationPlannerConflict[];
@@ -74,17 +91,21 @@ declare class MongoMigrationPlanner implements MigrationPlanner<'mongo', 'mongo'
74
91
  readonly schema: unknown;
75
92
  readonly policy: MigrationOperationPolicy;
76
93
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', 'mongo'>>;
94
+ /** The contract the planner reads as the starting state, or `null` when it has none. */
95
+ readonly fromContract: Contract | null;
96
+ /** What the statements and removed fields plan; its `schema` is diffed in place of `schema`. */
97
+ readonly statementCalls?: StatementCalls;
77
98
  }): PlanCallsResult;
78
99
  plan(options: {
79
100
  readonly contract: unknown;
80
101
  readonly schema: unknown;
81
102
  readonly policy: MigrationOperationPolicy;
82
- /**
83
- * The "from" contract (state the planner assumes the database starts at),
84
- * or `null` for reconciliation flows. Used to populate `describe().from`
85
- * on the produced plan as `fromContract?.storage.storageHash ?? null`.
86
- */
103
+ /** The contract the planner reads as the starting state, or `null` when it has none. */
87
104
  readonly fromContract: Contract | null;
105
+ /** The origin the produced plan asserts: its `describe().from` and `origin`. */
106
+ readonly origin: PlanOrigin | null;
107
+ /** The `--rename` statements, resolved. */
108
+ readonly statements: readonly ResolvedMigrationStatement[];
88
109
  readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', 'mongo'>>;
89
110
  /**
90
111
  * POSIX-relative path from the migration package dir to
@@ -105,7 +126,11 @@ declare class MongoMigrationPlanner implements MigrationPlanner<'mongo', 'mongo'
105
126
  emptyMigration(context: MigrationScaffoldContext): MigrationPlanWithAuthoringSurface;
106
127
  }
107
128
  //#endregion
108
- //#region src/core/mongo-runner.d.ts
129
+ //#region src/core/mongo-target-errors.d.ts
130
+ /** The codes the Mongo migration runner returns a failure with. */
131
+ type MongoMigrationRunnerErrorCode = 'MIGRATION.EXECUTION_FAILED' | 'MIGRATION.MARKER_CAS_FAILURE' | 'MIGRATION.MARKER_ORIGIN_MISMATCH' | 'MIGRATION.POLICY_VIOLATION' | 'MIGRATION.POSTCHECK_FAILED' | 'MIGRATION.PRECHECK_FAILED' | 'MIGRATION.SCHEMA_VERIFY_FAILED';
132
+ //#endregion
133
+ //#region src/core/migrations/mongo-runner.d.ts
109
134
  interface MongoMigrationRunnerExecuteOptions {
110
135
  readonly plan: MigrationPlan;
111
136
  readonly destinationContract: MongoContract;
@@ -131,89 +156,35 @@ interface MongoMigrationRunnerExecuteOptions {
131
156
  readonly scopeVerifyResult?: (result: VerifyDatabaseSchemaResult) => VerifyDatabaseSchemaResult;
132
157
  /** Per-edge breakdown from graph-walk planning; drives per-edge ledger writes. */
133
158
  readonly migrationEdges: readonly AggregateMigrationEdgeRef[];
159
+ /** Whether an earlier space of the same apply already changed the database. */
160
+ readonly databaseChangedBefore?: boolean;
161
+ }
162
+ /** A failure of the Mongo runner: one of the codes it returns. */
163
+ interface MongoMigrationRunnerFailure extends MigrationRunnerFailure {
164
+ readonly code: MongoMigrationRunnerErrorCode;
134
165
  }
135
- type MongoMigrationRunnerResult = Result<MigrationRunnerPerSpaceSuccessValue, MigrationRunnerFailure>;
166
+ /** A space's apply: what the framework reports, and whether it changed the database, its marker and ledger included. */
167
+ interface MongoSpaceSuccessValue extends MigrationRunnerPerSpaceSuccessValue {
168
+ readonly changedDatabase: boolean;
169
+ }
170
+ type MongoMigrationRunnerResult = Result<MongoSpaceSuccessValue, MongoMigrationRunnerFailure>;
136
171
  declare class MongoMigrationRunner {
137
172
  private readonly deps;
138
173
  constructor(deps: MongoRunnerDependencies);
139
174
  execute(options: MongoMigrationRunnerExecuteOptions): Promise<MongoMigrationRunnerResult>;
175
+ /** Applies the plan, calling `wrote` after each command that changes the database. */
176
+ private apply;
140
177
  private recordLedgerEntries;
141
- private executeDataTransform;
142
- private evaluateDataTransformChecks;
178
+ private executeDmlOperation;
179
+ private evaluateDmlChecks;
143
180
  private evaluateChecks;
181
+ private firstFailingCheck;
144
182
  private allChecksSatisfied;
145
183
  private enforcePolicyCompatibility;
146
184
  private ensureMarkerCompatibility;
147
185
  }
148
186
  //#endregion
149
- //#region src/core/mongo-target-contract-serializer.d.ts
150
- declare class MongoTargetContractSerializer extends MongoContractSerializerBase<MongoTargetContract> {
151
- protected constructTargetContract(validated: MongoContract): MongoTargetContract;
152
- serializeContract(contract: MongoTargetContract): JsonObject;
153
- }
154
- //#endregion
155
- //#region src/core/mongo-target-database.d.ts
156
- interface MongoTargetDatabaseInput {
157
- readonly id: string;
158
- readonly entries?: Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
159
- readonly collection?: Readonly<Record<string, MongoCollectionInput>>;
160
- readonly valueSet?: Readonly<Record<string, MongoValueSetInput>>;
161
- };
162
- }
163
- /**
164
- * Mongo target `Namespace` concretion. In Mongo the "namespace" concept
165
- * binds to the connection's `db` field — a `MongoTargetDatabase` instance
166
- * names the database the collections live under. `entries['collection']`
167
- * holds collection IR. The unbound singleton (below) is the late-bound
168
- * namespace whose binding the connection's `db` resolves at runtime rather
169
- * than at authoring time.
170
- *
171
- * Qualifier emission is the rendering seam: query / DDL emission asks the
172
- * namespace for its qualifier (e.g. `"<db>.<collection>"`) and consumes
173
- * the result polymorphically. The unbound singleton overrides these
174
- * methods to elide the prefix entirely — call sites stay polymorphic and
175
- * never branch on `id === UNBOUND_NAMESPACE_ID`.
176
- */
177
- declare class MongoTargetDatabase extends NamespaceBase {
178
- readonly kind: string;
179
- readonly id: string;
180
- readonly entries: MongoNamespaceEntries;
181
- constructor(input: MongoTargetDatabaseInput);
182
- get collection(): Readonly<Record<string, MongoCollection>>;
183
- /**
184
- * The bare qualifier as it would appear in a rendered string. The
185
- * unbound-database singleton overrides this to return `''`.
186
- */
187
- qualifier(): string;
188
- /**
189
- * Qualify a collection name with the database prefix. The
190
- * unbound-database singleton overrides this to emit just the
191
- * collection name. Used by emission/introspection paths that need a
192
- * fully-qualified reference.
193
- */
194
- qualifyCollection(collectionName: string): string;
195
- }
196
- /**
197
- * Singleton subclass for the reserved sentinel namespace id
198
- * (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the
199
- * connection's `db` resolves at runtime. Overrides qualifier emission
200
- * to elide the database prefix; call sites that consume `qualifier()`
201
- * / `qualifyCollection()` get unqualified output without branching on
202
- * the namespace id.
203
- *
204
- * This is the target-side materialization of "the framework provides
205
- * affordances; targets implement specifics": the framework names the
206
- * sentinel; Mongo decides what late-bound means here (the collection
207
- * name, naked — the database is supplied by the live connection).
208
- */
209
- declare class MongoTargetUnboundDatabase extends MongoTargetDatabase {
210
- static readonly instance: MongoTargetUnboundDatabase;
211
- private constructor();
212
- qualifier(): string;
213
- qualifyCollection(collectionName: string): string;
214
- }
215
- //#endregion
216
- //#region src/core/mongo-target-schema-verifier.d.ts
187
+ //#region src/core/migrations/mongo-target-schema-verifier.d.ts
217
188
  /**
218
189
  * Mongo target `SchemaVerifier` concretion. Extends the family base's
219
190
  * namespace-walk scaffolding and contributes the per-namespace diff via
@@ -245,7 +216,7 @@ declare class MongoTargetSchemaVerifier extends MongoSchemaVerifierBase<MongoTar
245
216
  protected verifyTargetExtensions(_options: SchemaVerifyOptions<MongoTargetContract, MongoSchemaIR>): readonly SchemaDiffIssue[];
246
217
  }
247
218
  //#endregion
248
- //#region src/core/planner-produced-migration.d.ts
219
+ //#region src/core/migrations/planner-produced-migration.d.ts
249
220
  /**
250
221
  * Planner-produced Mongo migration, returned by `MongoMigrationPlanner.plan(...)`
251
222
  * and `MongoMigrationPlanner.emptyMigration(...)`.
@@ -272,10 +243,10 @@ declare class PlannerProducedMongoMigration extends Migration<AnyMongoMigrationO
272
243
  renderTypeScript(resolveImportSpecifier: ImportSpecifierResolver): string;
273
244
  }
274
245
  //#endregion
275
- //#region src/core/render-ops.d.ts
276
- declare function renderOps(calls: ReadonlyArray<OpFactoryCall$1>): MongoMigrationPlanOperation[];
246
+ //#region src/core/migrations/render-ops.d.ts
247
+ declare function renderOps(calls: ReadonlyArray<OpFactoryCall$1>): AnyMongoMigrationOperation[];
277
248
  //#endregion
278
- //#region src/core/render-typescript.d.ts
249
+ //#region src/core/migrations/render-typescript.d.ts
279
250
  interface RenderMigrationMeta {
280
251
  readonly from: string | null;
281
252
  readonly to: string;
@@ -308,5 +279,72 @@ interface RenderMigrationMeta {
308
279
  */
309
280
  declare function renderCallsToTypeScript(calls: ReadonlyArray<OpFactoryCall$1>, meta: RenderMigrationMeta): string;
310
281
  //#endregion
311
- export { renderOps as _, MongoTargetContract as a, MongoTargetSchemaVerifier as c, PlannerProducedMongoMigration as d, RenderMigrationMeta as f, renderCallsToTypeScript as g, mongoTargetDescriptor as h, MongoMigrationRunnerExecuteOptions as i, MongoTargetUnboundDatabase as l, deserializeMongoOps as m, MongoMigrationPlanner as n, MongoTargetContractSerializer as o, deserializeMongoOp as p, MongoMigrationRunner as r, MongoTargetDatabase as s, FilterEvaluator as t, PlanCallsResult as u, serializeMongoOps as v };
312
- //# sourceMappingURL=control-CxXmTy_h.d.mts.map
282
+ //#region src/core/mongo-target-contract-serializer.d.ts
283
+ declare class MongoTargetContractSerializer extends MongoContractSerializerBase<MongoTargetContract> {
284
+ protected constructTargetContract(validated: MongoContract): MongoTargetContract;
285
+ serializeContract(contract: MongoTargetContract): JsonObject;
286
+ }
287
+ //#endregion
288
+ //#region src/core/mongo-target-database.d.ts
289
+ interface MongoTargetDatabaseInput {
290
+ readonly id: string;
291
+ readonly entries?: Readonly<Record<string, Readonly<Record<string, unknown>>>> & {
292
+ readonly collection?: Readonly<Record<string, MongoCollectionInput>>;
293
+ readonly valueSet?: Readonly<Record<string, MongoValueSetInput>>;
294
+ };
295
+ }
296
+ /**
297
+ * Mongo target `Namespace` concretion. In Mongo the "namespace" concept
298
+ * binds to the connection's `db` field — a `MongoTargetDatabase` instance
299
+ * names the database the collections live under. `entries['collection']`
300
+ * holds collection IR. The unbound singleton (below) is the late-bound
301
+ * namespace whose binding the connection's `db` resolves at runtime rather
302
+ * than at authoring time.
303
+ *
304
+ * Qualifier emission is the rendering seam: query / DDL emission asks the
305
+ * namespace for its qualifier (e.g. `"<db>.<collection>"`) and consumes
306
+ * the result polymorphically. The unbound singleton overrides these
307
+ * methods to elide the prefix entirely — call sites stay polymorphic and
308
+ * never branch on `id === UNBOUND_NAMESPACE_ID`.
309
+ */
310
+ declare class MongoTargetDatabase extends NamespaceBase {
311
+ readonly kind: string;
312
+ readonly id: string;
313
+ readonly entries: MongoNamespaceEntries;
314
+ constructor(input: MongoTargetDatabaseInput);
315
+ get collection(): Readonly<Record<string, MongoCollection>>;
316
+ /**
317
+ * The bare qualifier as it would appear in a rendered string. The
318
+ * unbound-database singleton overrides this to return `''`.
319
+ */
320
+ qualifier(): string;
321
+ /**
322
+ * Qualify a collection name with the database prefix. The
323
+ * unbound-database singleton overrides this to emit just the
324
+ * collection name. Used by emission/introspection paths that need a
325
+ * fully-qualified reference.
326
+ */
327
+ qualifyCollection(collectionName: string): string;
328
+ }
329
+ /**
330
+ * Singleton subclass for the reserved sentinel namespace id
331
+ * (`UNBOUND_NAMESPACE_ID`) — the late-bound namespace whose binding the
332
+ * connection's `db` resolves at runtime. Overrides qualifier emission
333
+ * to elide the database prefix; call sites that consume `qualifier()`
334
+ * / `qualifyCollection()` get unqualified output without branching on
335
+ * the namespace id.
336
+ *
337
+ * This is the target-side materialization of "the framework provides
338
+ * affordances; targets implement specifics": the framework names the
339
+ * sentinel; Mongo decides what late-bound means here (the collection
340
+ * name, naked — the database is supplied by the live connection).
341
+ */
342
+ declare class MongoTargetUnboundDatabase extends MongoTargetDatabase {
343
+ static readonly instance: MongoTargetUnboundDatabase;
344
+ private constructor();
345
+ qualifier(): string;
346
+ qualifyCollection(collectionName: string): string;
347
+ }
348
+ //#endregion
349
+ export { deserializeMongoOps as _, MongoMigrationRunnerExecuteOptions as a, renderOps as b, MongoTargetContract as c, MongoTargetSchemaVerifier as d, MongoTargetUnboundDatabase as f, deserializeMongoOp as g, RenderMigrationMeta as h, MongoMigrationRunnerErrorCode as i, MongoTargetContractSerializer as l, PlannerProducedMongoMigration as m, MongoMigrationPlanner as n, MongoMigrationRunnerFailure as o, PlanCallsResult as p, MongoMigrationRunner as r, MongoMigrationRunnerResult as s, FilterEvaluator as t, MongoTargetDatabase as u, mongoTargetDescriptor as v, serializeMongoOps as x, renderCallsToTypeScript as y };
350
+ //# sourceMappingURL=control-CrFS8bqh.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-CrFS8bqh.d.mts","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BK,sBAAsB,KAAK;WACrB,SAAS;;;;;;;;;;;;;;cAcN,uBAAuB,6BAA6B;;;cAGpD,2BAA2B;UAC/B;EACR,SAAS,QAAQ,iBAAiB,KAAK;EACvC,MAAM,MAAM;EACZ,IAAI,MAAM;EACV,GAAG,MAAM;EACT,IAAI,MAAM;EACV,OAAO,MAAM;EACb,KAAK,OAAO;;;;iBAIG,mBAAmB,gBAAgB;iBACnC,oBAAoB,2BAA2B;iBAC/C,kBAAkB,cAAc;;;;;;;;UAQvC;WACC,QAAQ;;WAER,4BAA4B;;WAE5B,oBAAoB,kBAAkB;;;;KAI5C;WACM;WACA,OAAO;;WAEP,mBAAmB;;WAEnB;WACA,WAAW;;cAER,iCAAiC;EAC7C,UAAU;aACC;aACA;aACA,QAAQ;aACR,qBAAqB,cAAc;;aAEnC,cAAc;;aAEd,iBAAiB;MACxB;EACJ,KAAK;aACM;aACA;aACA,QAAQ;;aAER,cAAc;;aAEd,QAAQ;;aAER,qBAAqB;aACrB,qBAAqB,cAAc;;;;;;aAMnC;MACP;;;;;;;;;;EAUJ,eAAe,SAAS,2BAA2B;;;;;KAKhD;;;UAGK;WACC,MAAM;WACN,qBAAqB;WACrB,QAAQ;WACR;IACP,kBAAkB,IAAI;IACtB,qBAAqB,IAAI;;WAElB,kBAAkB;WAClB,qBAAqB,cAAc;WACnC;WACA,UAAU;;;;;;;;;;;WAWV,qBAAqB,QAAQ,+BAA+B;;WAE5D,yBAAyB;;WAEzB;;;UAGD,oCAAoC;WACnC,MAAM;;;UAGP,+BAA+B;WAC9B;;KAEN,6BAA6B,OAAO,wBAAwB;cACnD;mBACK;EACjB,YAAY,MAAM;EAClB,QAAQ,SAAS,qCAAqC,QAAQ;;UAEtD;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;;;;;;;;;;;;;;;;;;;;;;;;cAyBI,kCAAkC,wBAAwB,qBAAqB;YACjF,gBAAgB;aACf,UAAU;aACV,QAAQ;aACR;aACA,WAAW;eACT;YACH,uBAAuB,UAAU,oBAAoB,qBAAqB,0BAA0B;;;;;;;;;;;;;;;;;;;cAmBlG,sCAAsC,UAAU,uCAAuC;mBAClF;mBACA;mBACA;WACR;EACT,YAAY,gBAAgB,mBAAiB,MAAM,eAAe;MAC9D,uBAAuB;EAC3B,YAAY;EACZ,iBAAiB,wBAAwB;;;;iBAI1B,UAAU,OAAO,cAAc,mBAAiB;;;UAGvD;WACC;WACA;;WAEA;;;;;;;WAOA,yBAAyB;;;;;;;;;;;;;;;;;;;iBAmBnB,wBAAwB,OAAO,cAAc,kBAAgB,MAAM;;;cAGtE,sCAAsC,4BAA4B;YACpE,wBAAwB,WAAW,gBAAgB;EAC7D,kBAAkB,UAAU,sBAAsB;;;;UAI1C;WACC;WACA,UAAU,SAAS,eAAe,SAAS;aACzC,aAAa,SAAS,eAAe;aACrC,WAAW,SAAS,eAAe;;;;;;;;;;;;;;;;;cAiBlC,4BAA4B;WAC/B;WACA;WACA,SAAS;EAClB,YAAY,OAAO;MACf,cAAc,SAAS,eAAe;;;;;EAK1C;;;;;;;EAOA,kBAAkB;;;;;;;;;;;;;;;cAeN,mCAAmC;kBAC/B,UAAU;UAClB;EACR;EACA,kBAAkB"}
@@ -0,0 +1,25 @@
1
+ import { DataType, DataTypeId } from "@prisma/orm-framework/components/codec";
2
+ //#region ../../../3-targets/mongo/1-target/dist/data-types.d.mts
3
+ //#region src/core/data-types.d.ts
4
+ /** The vector's dimension: the TypeScript type `Vector<n>` and the type's reader read it. */
5
+ declare const mongoVectorParams: import("arktype/internal/variants/object.ts").ObjectType<{
6
+ length?: number;
7
+ }, {}>;
8
+ declare const mongoString: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
9
+ declare const mongoInt32: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
10
+ declare const mongoInt64: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
11
+ declare const mongoDecimal128: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
12
+ declare const mongoDouble: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
13
+ declare const mongoObjectId: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
14
+ declare const mongoBool: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
15
+ declare const mongoDate: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
16
+ declare const mongoVector: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
17
+ declare const mongoBinary: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
18
+ declare const mongoJson: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
19
+ declare const mongoBson: import("@prisma/orm-family-mongo/contract/data-type").MongoDataType;
20
+ declare const mongoDataTypes: readonly DataType[];
21
+ /** MongoDB's text data type: `string`. */
22
+ declare const mongoTextDataTypes: readonly DataTypeId[];
23
+ //#endregion
24
+ export { mongoDate as a, mongoInt32 as c, mongoObjectId as d, mongoString as f, mongoVectorParams as h, mongoDataTypes as i, mongoInt64 as l, mongoVector as m, mongoBool as n, mongoDecimal128 as o, mongoTextDataTypes as p, mongoBson as r, mongoDouble as s, mongoBinary as t, mongoJson as u };
25
+ //# sourceMappingURL=data-types-LShlnAUM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-types-LShlnAUM.d.mts","names":[],"sources":["../../../../3-targets/mongo/1-target/dist/data-types.d.mts"],"mappings":";;;;cAGc,iEAAiE;EAC7E;;cAEY,0DAA0D;cAC1D,yDAAyD;cACzD,yDAAyD;cACzD,8DAA8D;cAC9D,0DAA0D;cAC1D,4DAA4D;cAC5D,wDAAwD;cACxD,wDAAwD;cACxD,0DAA0D;cAC1D,0DAA0D;cAC1D,wDAAwD;cACxD,wDAAwD;cACxD,yBAAyB;;cAEzB,6BAA6B"}