@prisma-next/family-sql 0.3.0-dev.4 → 0.3.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{exports/chunk-6P44BVZ4.js → chunk-6K3RPBDP.js} +3 -3
- package/dist/chunk-6K3RPBDP.js.map +1 -0
- package/dist/{exports/chunk-F252JMEU.js → chunk-BHEGVBY7.js} +1 -1
- package/dist/chunk-BHEGVBY7.js.map +1 -0
- package/dist/{exports/chunk-C3GKWCKA.js → chunk-SU7LN2UH.js} +1 -1
- package/dist/chunk-SU7LN2UH.js.map +1 -0
- package/dist/core/assembly.d.ts +25 -0
- package/dist/core/assembly.d.ts.map +1 -0
- package/dist/core/control-adapter.d.ts +42 -0
- package/dist/core/control-adapter.d.ts.map +1 -0
- package/dist/core/descriptor.d.ts +31 -0
- package/dist/core/descriptor.d.ts.map +1 -0
- package/dist/{exports/instance-DiZi2k_2.d.ts → core/instance.d.ts} +30 -15
- package/dist/core/instance.d.ts.map +1 -0
- package/dist/core/migrations/plan-helpers.d.ts +20 -0
- package/dist/core/migrations/plan-helpers.d.ts.map +1 -0
- package/dist/core/migrations/policies.d.ts +6 -0
- package/dist/core/migrations/policies.d.ts.map +1 -0
- package/dist/{exports/types-Bh7ftf0Q.d.ts → core/migrations/types.d.ts} +41 -36
- package/dist/core/migrations/types.d.ts.map +1 -0
- package/dist/core/runtime-descriptor.d.ts +19 -0
- package/dist/core/runtime-descriptor.d.ts.map +1 -0
- package/dist/core/runtime-instance.d.ts +54 -0
- package/dist/core/runtime-instance.d.ts.map +1 -0
- package/dist/core/schema-verify/verify-helpers.d.ts +50 -0
- package/dist/core/schema-verify/verify-helpers.d.ts.map +1 -0
- package/dist/core/schema-verify/verify-sql-schema.d.ts +45 -0
- package/dist/core/schema-verify/verify-sql-schema.d.ts.map +1 -0
- package/dist/core/verify.d.ts +39 -0
- package/dist/core/verify.d.ts.map +1 -0
- package/dist/exports/control-adapter.d.ts +2 -44
- package/dist/exports/control-adapter.d.ts.map +1 -0
- package/dist/exports/control.d.ts +8 -70
- package/dist/exports/control.d.ts.map +1 -0
- package/dist/exports/control.js +3 -3
- package/dist/exports/runtime.d.ts +3 -61
- package/dist/exports/runtime.d.ts.map +1 -0
- package/dist/exports/schema-verify.d.ts +8 -72
- package/dist/exports/schema-verify.d.ts.map +1 -0
- package/dist/exports/schema-verify.js +1 -1
- package/dist/exports/test-utils.d.ts +5 -31
- package/dist/exports/test-utils.d.ts.map +1 -0
- package/dist/exports/test-utils.js +3 -3
- package/dist/exports/verify.d.ts +2 -28
- package/dist/exports/verify.d.ts.map +1 -0
- package/dist/exports/verify.js +1 -1
- package/package.json +19 -18
- package/src/core/assembly.ts +117 -0
- package/src/core/control-adapter.ts +52 -0
- package/src/core/descriptor.ts +37 -0
- package/src/core/instance.ts +887 -0
- package/src/core/migrations/plan-helpers.ts +164 -0
- package/src/core/migrations/policies.ts +8 -0
- package/src/core/migrations/types.ts +380 -0
- package/src/core/runtime-descriptor.ts +45 -0
- package/src/core/runtime-instance.ts +144 -0
- package/src/core/schema-verify/verify-helpers.ts +514 -0
- package/src/core/schema-verify/verify-sql-schema.ts +584 -0
- package/src/core/verify.ts +177 -0
- package/src/exports/control-adapter.ts +1 -0
- package/src/exports/control.ts +56 -0
- package/src/exports/runtime.ts +7 -0
- package/src/exports/schema-verify.ts +11 -0
- package/src/exports/test-utils.ts +11 -0
- package/src/exports/verify.ts +1 -0
- package/dist/exports/chunk-6P44BVZ4.js.map +0 -1
- package/dist/exports/chunk-C3GKWCKA.js.map +0 -1
- package/dist/exports/chunk-F252JMEU.js.map +0 -1
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
|
|
2
|
-
import { ControlTargetDescriptor, ControlTargetInstance, MigrationOperationPolicy, MigrationPlannerSuccessResult, MigrationPlan, MigrationPlanOperation, MigrationPlannerFailureResult, MigrationPlannerConflict, ControlDriverInstance, OperationContext, MigrationRunnerExecutionChecks, MigrationRunnerSuccessValue, MigrationRunnerFailure, SchemaIssue, ControlExtensionDescriptor } from '@prisma-next/core-control-plane/types';
|
|
3
|
-
import { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
4
|
-
import { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
|
|
5
|
-
import { Result } from '@prisma-next/utils/result';
|
|
6
|
-
import { S as SqlControlFamilyInstance } from './instance-DiZi2k_2.js';
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
2
|
* SQL-specific migration types.
|
|
10
3
|
*
|
|
11
4
|
* These types extend the canonical migration types from the framework control plane
|
|
12
5
|
* with SQL-specific fields for execution (precheck SQL, execute SQL, etc.).
|
|
13
6
|
*/
|
|
14
|
-
|
|
15
|
-
type
|
|
7
|
+
import type { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
|
|
8
|
+
import type { ControlDriverInstance, ControlExtensionDescriptor, ControlTargetDescriptor, ControlTargetInstance, MigrationOperationPolicy, MigrationPlan, MigrationPlannerConflict, MigrationPlannerFailureResult, MigrationPlannerSuccessResult, MigrationPlanOperation, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerSuccessValue, OperationContext, SchemaIssue } from '@prisma-next/core-control-plane/types';
|
|
9
|
+
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
10
|
+
import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
|
|
11
|
+
import type { Result } from '@prisma-next/utils/result';
|
|
12
|
+
import type { SqlControlFamilyInstance } from '../instance';
|
|
13
|
+
export type AnyRecord = Readonly<Record<string, unknown>>;
|
|
16
14
|
/**
|
|
17
15
|
* A single database dependency declared by a framework component.
|
|
18
16
|
* Uses SqlMigrationPlanOperation so we inherit the existing precheck/execute/postcheck contract.
|
|
@@ -22,7 +20,7 @@ type AnyRecord = Readonly<Record<string, unknown>>;
|
|
|
22
20
|
* The planner emits these as migration operations, and the verifier uses the pure verification
|
|
23
21
|
* hook to check satisfaction against the schema IR.
|
|
24
22
|
*/
|
|
25
|
-
interface ComponentDatabaseDependency<TTargetDetails> {
|
|
23
|
+
export interface ComponentDatabaseDependency<TTargetDetails> {
|
|
26
24
|
/** Stable identifier for the dependency (e.g. 'postgres.extension.vector') */
|
|
27
25
|
readonly id: string;
|
|
28
26
|
/** Human label for output (e.g. 'Enable vector extension') */
|
|
@@ -43,13 +41,21 @@ interface ComponentDatabaseDependency<TTargetDetails> {
|
|
|
43
41
|
/**
|
|
44
42
|
* Database dependencies declared by a framework component.
|
|
45
43
|
*/
|
|
46
|
-
interface ComponentDatabaseDependencies<TTargetDetails> {
|
|
44
|
+
export interface ComponentDatabaseDependencies<TTargetDetails> {
|
|
47
45
|
/**
|
|
48
46
|
* Dependencies required for db init.
|
|
49
47
|
* Future: update dependencies can be added later (e.g. widening/destructive).
|
|
50
48
|
*/
|
|
51
49
|
readonly init?: readonly ComponentDatabaseDependency<TTargetDetails>[];
|
|
52
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Minimal structural type implemented by any descriptor that can expose
|
|
53
|
+
* component-owned database dependencies. Targets/adapters typically omit
|
|
54
|
+
* the property, while extensions provide dependency metadata.
|
|
55
|
+
*/
|
|
56
|
+
export interface DatabaseDependencyProvider {
|
|
57
|
+
readonly databaseDependencies?: ComponentDatabaseDependencies<unknown>;
|
|
58
|
+
}
|
|
53
59
|
/**
|
|
54
60
|
* SQL-specific extension descriptor with optional database dependencies.
|
|
55
61
|
* Extends the core ControlExtensionDescriptor with SQL-specific metadata.
|
|
@@ -57,14 +63,14 @@ interface ComponentDatabaseDependencies<TTargetDetails> {
|
|
|
57
63
|
* Database dependencies are attached to the descriptor (not the instance) because
|
|
58
64
|
* they are declarative metadata that planner/verifier need without constructing instances.
|
|
59
65
|
*/
|
|
60
|
-
interface SqlControlExtensionDescriptor<TTargetId extends string> extends ControlExtensionDescriptor<'sql', TTargetId> {
|
|
66
|
+
export interface SqlControlExtensionDescriptor<TTargetId extends string> extends ControlExtensionDescriptor<'sql', TTargetId> {
|
|
61
67
|
/** Optional database dependencies this extension requires. */
|
|
62
68
|
readonly databaseDependencies?: ComponentDatabaseDependencies<unknown>;
|
|
63
69
|
}
|
|
64
70
|
/**
|
|
65
71
|
* A single step in a SQL migration operation (precheck, execute, or postcheck).
|
|
66
72
|
*/
|
|
67
|
-
interface SqlMigrationPlanOperationStep {
|
|
73
|
+
export interface SqlMigrationPlanOperationStep {
|
|
68
74
|
readonly description: string;
|
|
69
75
|
readonly sql: string;
|
|
70
76
|
readonly meta?: AnyRecord;
|
|
@@ -72,7 +78,7 @@ interface SqlMigrationPlanOperationStep {
|
|
|
72
78
|
/**
|
|
73
79
|
* Target details for a SQL migration operation (table, column, index, etc.).
|
|
74
80
|
*/
|
|
75
|
-
interface SqlMigrationPlanOperationTarget<TTargetDetails> {
|
|
81
|
+
export interface SqlMigrationPlanOperationTarget<TTargetDetails> {
|
|
76
82
|
readonly id: string;
|
|
77
83
|
readonly details?: TTargetDetails;
|
|
78
84
|
}
|
|
@@ -80,7 +86,7 @@ interface SqlMigrationPlanOperationTarget<TTargetDetails> {
|
|
|
80
86
|
* A single SQL migration operation with SQL-specific fields.
|
|
81
87
|
* Extends the core MigrationPlanOperation with SQL execution details.
|
|
82
88
|
*/
|
|
83
|
-
interface SqlMigrationPlanOperation<TTargetDetails> extends MigrationPlanOperation {
|
|
89
|
+
export interface SqlMigrationPlanOperation<TTargetDetails> extends MigrationPlanOperation {
|
|
84
90
|
/** Optional detailed explanation of what this operation does and why. */
|
|
85
91
|
readonly summary?: string;
|
|
86
92
|
readonly target: SqlMigrationPlanOperationTarget<TTargetDetails>;
|
|
@@ -92,7 +98,7 @@ interface SqlMigrationPlanOperation<TTargetDetails> extends MigrationPlanOperati
|
|
|
92
98
|
/**
|
|
93
99
|
* Contract identity information for SQL migrations.
|
|
94
100
|
*/
|
|
95
|
-
interface SqlMigrationPlanContractInfo {
|
|
101
|
+
export interface SqlMigrationPlanContractInfo {
|
|
96
102
|
readonly coreHash: string;
|
|
97
103
|
readonly profileHash?: string;
|
|
98
104
|
}
|
|
@@ -100,7 +106,7 @@ interface SqlMigrationPlanContractInfo {
|
|
|
100
106
|
* A SQL migration plan with SQL-specific fields.
|
|
101
107
|
* Extends the core MigrationPlan with origin tracking and metadata.
|
|
102
108
|
*/
|
|
103
|
-
interface SqlMigrationPlan<TTargetDetails> extends MigrationPlan {
|
|
109
|
+
export interface SqlMigrationPlan<TTargetDetails> extends MigrationPlan {
|
|
104
110
|
/**
|
|
105
111
|
* Origin contract identity that the plan expects the database to currently be at.
|
|
106
112
|
* If omitted, the runner treats the origin as "no marker present" (empty database),
|
|
@@ -117,11 +123,11 @@ interface SqlMigrationPlan<TTargetDetails> extends MigrationPlan {
|
|
|
117
123
|
/**
|
|
118
124
|
* Specific conflict kinds for SQL migrations.
|
|
119
125
|
*/
|
|
120
|
-
type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedExtension' | 'extensionMissing' | 'unsupportedOperation';
|
|
126
|
+
export type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedExtension' | 'extensionMissing' | 'unsupportedOperation';
|
|
121
127
|
/**
|
|
122
128
|
* Location information for SQL planner conflicts.
|
|
123
129
|
*/
|
|
124
|
-
interface SqlPlannerConflictLocation {
|
|
130
|
+
export interface SqlPlannerConflictLocation {
|
|
125
131
|
readonly table?: string;
|
|
126
132
|
readonly column?: string;
|
|
127
133
|
readonly index?: string;
|
|
@@ -132,7 +138,7 @@ interface SqlPlannerConflictLocation {
|
|
|
132
138
|
* A SQL-specific planner conflict with additional location information.
|
|
133
139
|
* Extends the core MigrationPlannerConflict.
|
|
134
140
|
*/
|
|
135
|
-
interface SqlPlannerConflict extends MigrationPlannerConflict {
|
|
141
|
+
export interface SqlPlannerConflict extends MigrationPlannerConflict {
|
|
136
142
|
readonly kind: SqlPlannerConflictKind;
|
|
137
143
|
readonly location?: SqlPlannerConflictLocation;
|
|
138
144
|
readonly meta?: AnyRecord;
|
|
@@ -140,25 +146,25 @@ interface SqlPlannerConflict extends MigrationPlannerConflict {
|
|
|
140
146
|
/**
|
|
141
147
|
* Successful SQL planner result with the migration plan.
|
|
142
148
|
*/
|
|
143
|
-
interface SqlPlannerSuccessResult<TTargetDetails> extends Omit<MigrationPlannerSuccessResult, 'plan'> {
|
|
149
|
+
export interface SqlPlannerSuccessResult<TTargetDetails> extends Omit<MigrationPlannerSuccessResult, 'plan'> {
|
|
144
150
|
readonly kind: 'success';
|
|
145
151
|
readonly plan: SqlMigrationPlan<TTargetDetails>;
|
|
146
152
|
}
|
|
147
153
|
/**
|
|
148
154
|
* Failed SQL planner result with the list of conflicts.
|
|
149
155
|
*/
|
|
150
|
-
interface SqlPlannerFailureResult extends Omit<MigrationPlannerFailureResult, 'conflicts'> {
|
|
156
|
+
export interface SqlPlannerFailureResult extends Omit<MigrationPlannerFailureResult, 'conflicts'> {
|
|
151
157
|
readonly kind: 'failure';
|
|
152
158
|
readonly conflicts: readonly SqlPlannerConflict[];
|
|
153
159
|
}
|
|
154
160
|
/**
|
|
155
161
|
* Union type for SQL planner results.
|
|
156
162
|
*/
|
|
157
|
-
type SqlPlannerResult<TTargetDetails> = SqlPlannerSuccessResult<TTargetDetails> | SqlPlannerFailureResult;
|
|
163
|
+
export type SqlPlannerResult<TTargetDetails> = SqlPlannerSuccessResult<TTargetDetails> | SqlPlannerFailureResult;
|
|
158
164
|
/**
|
|
159
165
|
* Options for SQL migration planner.
|
|
160
166
|
*/
|
|
161
|
-
interface SqlMigrationPlannerPlanOptions {
|
|
167
|
+
export interface SqlMigrationPlannerPlanOptions {
|
|
162
168
|
readonly contract: SqlContract<SqlStorage>;
|
|
163
169
|
readonly schema: SqlSchemaIR;
|
|
164
170
|
readonly policy: MigrationOperationPolicy;
|
|
@@ -174,20 +180,20 @@ interface SqlMigrationPlannerPlanOptions {
|
|
|
174
180
|
* SQL migration planner interface.
|
|
175
181
|
* Extends the core MigrationPlanner with SQL-specific types.
|
|
176
182
|
*/
|
|
177
|
-
interface SqlMigrationPlanner<TTargetDetails> {
|
|
183
|
+
export interface SqlMigrationPlanner<TTargetDetails> {
|
|
178
184
|
plan(options: SqlMigrationPlannerPlanOptions): SqlPlannerResult<TTargetDetails>;
|
|
179
185
|
}
|
|
180
186
|
/**
|
|
181
187
|
* Callbacks for SQL migration runner execution.
|
|
182
188
|
*/
|
|
183
|
-
interface SqlMigrationRunnerExecuteCallbacks<TTargetDetails> {
|
|
189
|
+
export interface SqlMigrationRunnerExecuteCallbacks<TTargetDetails> {
|
|
184
190
|
onOperationStart?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
|
|
185
191
|
onOperationComplete?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
|
|
186
192
|
}
|
|
187
193
|
/**
|
|
188
194
|
* Options for SQL migration runner execution.
|
|
189
195
|
*/
|
|
190
|
-
interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
|
|
196
|
+
export interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
|
|
191
197
|
readonly plan: SqlMigrationPlan<TTargetDetails>;
|
|
192
198
|
readonly driver: ControlDriverInstance<'sql', string>;
|
|
193
199
|
/**
|
|
@@ -219,12 +225,12 @@ interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
|
|
|
219
225
|
/**
|
|
220
226
|
* Error codes for SQL migration runner failures.
|
|
221
227
|
*/
|
|
222
|
-
type SqlMigrationRunnerErrorCode = 'DESTINATION_CONTRACT_MISMATCH' | 'MARKER_ORIGIN_MISMATCH' | 'POLICY_VIOLATION' | 'PRECHECK_FAILED' | 'POSTCHECK_FAILED' | 'SCHEMA_VERIFY_FAILED' | 'EXECUTION_FAILED';
|
|
228
|
+
export type SqlMigrationRunnerErrorCode = 'DESTINATION_CONTRACT_MISMATCH' | 'MARKER_ORIGIN_MISMATCH' | 'POLICY_VIOLATION' | 'PRECHECK_FAILED' | 'POSTCHECK_FAILED' | 'SCHEMA_VERIFY_FAILED' | 'EXECUTION_FAILED';
|
|
223
229
|
/**
|
|
224
230
|
* Detailed information about a SQL migration runner failure.
|
|
225
231
|
* Extends the core MigrationRunnerFailure with SQL-specific error codes.
|
|
226
232
|
*/
|
|
227
|
-
interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
|
|
233
|
+
export interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
|
|
228
234
|
readonly code: SqlMigrationRunnerErrorCode;
|
|
229
235
|
readonly meta?: AnyRecord;
|
|
230
236
|
}
|
|
@@ -232,24 +238,24 @@ interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
|
|
|
232
238
|
* Success value for SQL migration runner execution.
|
|
233
239
|
* Extends core type for type branding and potential SQL-specific extensions.
|
|
234
240
|
*/
|
|
235
|
-
interface SqlMigrationRunnerSuccessValue extends MigrationRunnerSuccessValue {
|
|
241
|
+
export interface SqlMigrationRunnerSuccessValue extends MigrationRunnerSuccessValue {
|
|
236
242
|
}
|
|
237
243
|
/**
|
|
238
244
|
* Result type for SQL migration runner execution.
|
|
239
245
|
*/
|
|
240
|
-
type SqlMigrationRunnerResult = Result<SqlMigrationRunnerSuccessValue, SqlMigrationRunnerFailure>;
|
|
246
|
+
export type SqlMigrationRunnerResult = Result<SqlMigrationRunnerSuccessValue, SqlMigrationRunnerFailure>;
|
|
241
247
|
/**
|
|
242
248
|
* SQL migration runner interface.
|
|
243
249
|
* Extends the core MigrationRunner with SQL-specific types.
|
|
244
250
|
*/
|
|
245
|
-
interface SqlMigrationRunner<TTargetDetails> {
|
|
251
|
+
export interface SqlMigrationRunner<TTargetDetails> {
|
|
246
252
|
execute(options: SqlMigrationRunnerExecuteOptions<TTargetDetails>): Promise<SqlMigrationRunnerResult>;
|
|
247
253
|
}
|
|
248
254
|
/**
|
|
249
255
|
* SQL control target descriptor with migration support.
|
|
250
256
|
* Extends the core ControlTargetDescriptor with SQL-specific migration methods.
|
|
251
257
|
*/
|
|
252
|
-
interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails> extends ControlTargetDescriptor<'sql', TTargetId, ControlTargetInstance<'sql', TTargetId>, SqlControlFamilyInstance> {
|
|
258
|
+
export interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails> extends ControlTargetDescriptor<'sql', TTargetId, ControlTargetInstance<'sql', TTargetId>, SqlControlFamilyInstance> {
|
|
253
259
|
/**
|
|
254
260
|
* Creates a SQL migration planner for this target.
|
|
255
261
|
* Direct method for SQL-specific usage.
|
|
@@ -264,12 +270,11 @@ interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails> e
|
|
|
264
270
|
/**
|
|
265
271
|
* Options for creating a SQL migration plan.
|
|
266
272
|
*/
|
|
267
|
-
interface CreateSqlMigrationPlanOptions<TTargetDetails> {
|
|
273
|
+
export interface CreateSqlMigrationPlanOptions<TTargetDetails> {
|
|
268
274
|
readonly targetId: string;
|
|
269
275
|
readonly origin?: SqlMigrationPlanContractInfo | null;
|
|
270
276
|
readonly destination: SqlMigrationPlanContractInfo;
|
|
271
277
|
readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
|
|
272
278
|
readonly meta?: AnyRecord;
|
|
273
279
|
}
|
|
274
|
-
|
|
275
|
-
export type { AnyRecord as A, CreateSqlMigrationPlanOptions as C, SqlControlTargetDescriptor as S, SqlMigrationPlan as a, SqlPlannerConflict as b, SqlPlannerFailureResult as c, SqlPlannerSuccessResult as d, SqlMigrationRunnerErrorCode as e, SqlMigrationRunnerFailure as f, SqlMigrationRunnerSuccessValue as g, ComponentDatabaseDependencies as h, ComponentDatabaseDependency as i, SqlControlExtensionDescriptor as j, SqlMigrationPlanContractInfo as k, SqlMigrationPlanner as l, SqlMigrationPlannerPlanOptions as m, SqlMigrationPlanOperation as n, SqlMigrationPlanOperationStep as o, SqlMigrationPlanOperationTarget as p, SqlMigrationRunner as q, SqlMigrationRunnerExecuteCallbacks as r, SqlMigrationRunnerExecuteOptions as s, SqlMigrationRunnerResult as t, SqlPlannerConflictKind as u, SqlPlannerConflictLocation as v, SqlPlannerResult as w };
|
|
280
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,aAAa,EACb,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,EAChB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAM1D;;;;;;;;GAQG;AACH,MAAM,WAAW,2BAA2B,CAAC,cAAc;IACzD,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,yBAAyB,CAAC,cAAc,CAAC,EAAE,CAAC;IACvE;;;;;OAKG;I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AACH,MAAM,WAAW,kBAAkB,CAAC,cAAc;IAChD,OAAO,CACL,OAAO,EAAE,gCAAgC,CAAC,cAAc,CAAC,GACxD,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtC;AAMD;;;GAGG;AACH,MAAM,WAAW,0BAA0B,CAAC,SAAS,SAAS,MAAM,EAAE,cAAc,CAClF,SAAQ,uBAAuB,CAC7B,KAAK,EACL,SAAS,EACT,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,EACvC,wBAAwB,CACzB;IACD;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,wBAAwB,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACrF;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,wBAAwB,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;CACpF;AAMD;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAAC,cAAc;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,4BAA4B,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,SAAS,yBAAyB,CAAC,cAAc,CAAC,EAAE,CAAC;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RuntimeAdapterDescriptor, RuntimeDriverDescriptor, RuntimeExtensionDescriptor, RuntimeFamilyDescriptor, RuntimeTargetDescriptor } from '@prisma-next/core-execution-plane/types';
|
|
2
|
+
import { type SqlRuntimeAdapterInstance, type SqlRuntimeDriverInstance, type SqlRuntimeFamilyInstance } from './runtime-instance';
|
|
3
|
+
/**
|
|
4
|
+
* SQL runtime family descriptor implementation.
|
|
5
|
+
* Provides factory method to create SQL runtime family instance.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SqlRuntimeFamilyDescriptor implements RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance> {
|
|
8
|
+
readonly kind: "family";
|
|
9
|
+
readonly id = "sql";
|
|
10
|
+
readonly familyId: "sql";
|
|
11
|
+
readonly version = "0.0.1";
|
|
12
|
+
create<TTargetId extends string>(options: {
|
|
13
|
+
readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;
|
|
14
|
+
readonly adapter: RuntimeAdapterDescriptor<'sql', TTargetId, SqlRuntimeAdapterInstance<TTargetId>>;
|
|
15
|
+
readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, SqlRuntimeDriverInstance<TTargetId>>;
|
|
16
|
+
readonly extensionPacks: readonly RuntimeExtensionDescriptor<'sql', TTargetId>[];
|
|
17
|
+
}): SqlRuntimeFamilyInstance;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=runtime-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-descriptor.d.ts","sourceRoot":"","sources":["../../src/core/runtime-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,0BACX,YAAW,uBAAuB,CAAC,KAAK,EAAE,wBAAwB,CAAC;IAEnE,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAClC,QAAQ,CAAC,EAAE,SAAS;IACpB,QAAQ,CAAC,QAAQ,EAAG,KAAK,CAAU;IACnC,QAAQ,CAAC,OAAO,WAAW;IAE3B,MAAM,CAAC,SAAS,SAAS,MAAM,EAAE,OAAO,EAAE;QACxC,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3D,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CACxC,KAAK,EACL,SAAS,EACT,yBAAyB,CAAC,SAAS,CAAC,CACrC,CAAC;QACF,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;QAChG,QAAQ,CAAC,cAAc,EAAE,SAAS,0BAA0B,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;KAClF,GAAG,wBAAwB;CAS7B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RuntimeAdapterDescriptor, RuntimeDriverDescriptor, RuntimeDriverInstance, RuntimeFamilyDescriptor, RuntimeFamilyInstance, RuntimeTargetDescriptor } from '@prisma-next/core-execution-plane/types';
|
|
2
|
+
import type { Log, Plugin, RuntimeVerifyOptions } from '@prisma-next/runtime-executor';
|
|
3
|
+
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
4
|
+
import type { Adapter, LoweredStatement, SelectAst, SqlDriver } from '@prisma-next/sql-relational-core/ast';
|
|
5
|
+
import type { Runtime, SqlRuntimeAdapterInstance, SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';
|
|
6
|
+
/**
|
|
7
|
+
* SQL runtime driver instance type.
|
|
8
|
+
* Combines identity properties with SQL-specific behavior methods.
|
|
9
|
+
*/
|
|
10
|
+
export type SqlRuntimeDriverInstance<TTargetId extends string = string> = RuntimeDriverInstance<'sql', TTargetId> & SqlDriver;
|
|
11
|
+
export type { SqlRuntimeAdapterInstance } from '@prisma-next/sql-runtime';
|
|
12
|
+
/**
|
|
13
|
+
* SQL runtime family instance interface.
|
|
14
|
+
* Extends base RuntimeFamilyInstance with SQL-specific runtime creation method.
|
|
15
|
+
*/
|
|
16
|
+
export interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {
|
|
17
|
+
/**
|
|
18
|
+
* Creates a SQL runtime from contract, driver options, and verification settings.
|
|
19
|
+
*
|
|
20
|
+
* Extension packs are routed through composition (at instance creation time),
|
|
21
|
+
* not through this method. This aligns with control-plane composition patterns.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Runtime creation options
|
|
24
|
+
* @param options.contract - SQL contract
|
|
25
|
+
* @param options.driverOptions - Driver options (e.g., PostgresDriverOptions)
|
|
26
|
+
* @param options.verify - Runtime verification options
|
|
27
|
+
* @param options.plugins - Optional plugins
|
|
28
|
+
* @param options.mode - Optional runtime mode
|
|
29
|
+
* @param options.log - Optional log instance
|
|
30
|
+
* @returns Runtime instance
|
|
31
|
+
*/
|
|
32
|
+
createRuntime<TContract extends SqlContract<SqlStorage>>(options: {
|
|
33
|
+
readonly contract: TContract;
|
|
34
|
+
readonly driverOptions: unknown;
|
|
35
|
+
readonly verify: RuntimeVerifyOptions;
|
|
36
|
+
readonly plugins?: readonly Plugin<TContract, Adapter<SelectAst, SqlContract<SqlStorage>, LoweredStatement>, SqlDriver>[];
|
|
37
|
+
readonly mode?: 'strict' | 'permissive';
|
|
38
|
+
readonly log?: Log;
|
|
39
|
+
}): Runtime;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates a SQL runtime family instance from runtime descriptors.
|
|
43
|
+
*
|
|
44
|
+
* Routes the same framework composition as control-plane:
|
|
45
|
+
* family, target, adapter, driver, extensionPacks (all as descriptors with IDs).
|
|
46
|
+
*/
|
|
47
|
+
export declare function createSqlRuntimeFamilyInstance<TTargetId extends string>(options: {
|
|
48
|
+
readonly family: RuntimeFamilyDescriptor<'sql'>;
|
|
49
|
+
readonly target: RuntimeTargetDescriptor<'sql', TTargetId>;
|
|
50
|
+
readonly adapter: RuntimeAdapterDescriptor<'sql', TTargetId, SqlRuntimeAdapterInstance<TTargetId>>;
|
|
51
|
+
readonly driver: RuntimeDriverDescriptor<'sql', TTargetId, SqlRuntimeDriverInstance<TTargetId>>;
|
|
52
|
+
readonly extensionPacks?: readonly SqlRuntimeExtensionDescriptor<TTargetId>[];
|
|
53
|
+
}): SqlRuntimeFamilyInstance;
|
|
54
|
+
//# sourceMappingURL=runtime-instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-instance.d.ts","sourceRoot":"","sources":["../../src/core/runtime-instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EACV,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,SAAS,EACV,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,OAAO,EAEP,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,MAAM,MAAM,wBAAwB,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,qBAAqB,CAC7F,KAAK,EACL,SAAS,CACV,GACC,SAAS,CAAC;AAGZ,YAAY,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB,CAAC,KAAK,CAAC;IAC5E;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,SAAS,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE;QAChE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC7B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;QAChC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;QACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,CAChC,SAAS,EACT,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC,EAC7D,SAAS,CACV,EAAE,CAAC;QACJ,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;QACxC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;KACpB,GAAG,OAAO,CAAC;CACb;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,SAAS,SAAS,MAAM,EAAE,OAAO,EAAE;IAChF,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAChD,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CACxC,KAAK,EACL,SAAS,EACT,yBAAyB,CAAC,SAAS,CAAC,CACrC,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;IAChG,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,6BAA6B,CAAC,SAAS,CAAC,EAAE,CAAC;CAC/E,GAAG,wBAAwB,CAuD3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure verification helper functions for SQL schema verification.
|
|
3
|
+
* These functions verify schema IR against contract requirements.
|
|
4
|
+
*/
|
|
5
|
+
import type { SchemaIssue, SchemaVerificationNode } from '@prisma-next/core-control-plane/types';
|
|
6
|
+
import type { ForeignKey, Index, PrimaryKey, UniqueConstraint } from '@prisma-next/sql-contract/types';
|
|
7
|
+
import type { SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from '@prisma-next/sql-schema-ir/types';
|
|
8
|
+
import type { ComponentDatabaseDependency } from '../migrations/types';
|
|
9
|
+
/**
|
|
10
|
+
* Compares two arrays of strings for equality (order-sensitive).
|
|
11
|
+
*/
|
|
12
|
+
export declare function arraysEqual(a: readonly string[], b: readonly string[]): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Verifies primary key matches between contract and schema.
|
|
15
|
+
* Returns 'pass' or 'fail'.
|
|
16
|
+
*/
|
|
17
|
+
export declare function verifyPrimaryKey(contractPK: PrimaryKey, schemaPK: PrimaryKey | undefined, tableName: string, issues: SchemaIssue[]): 'pass' | 'fail';
|
|
18
|
+
/**
|
|
19
|
+
* Verifies foreign keys match between contract and schema.
|
|
20
|
+
* Returns verification nodes for the tree.
|
|
21
|
+
*/
|
|
22
|
+
export declare function verifyForeignKeys(contractFKs: readonly ForeignKey[], schemaFKs: readonly SqlForeignKeyIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
23
|
+
/**
|
|
24
|
+
* Verifies unique constraints match between contract and schema.
|
|
25
|
+
* Returns verification nodes for the tree.
|
|
26
|
+
*/
|
|
27
|
+
export declare function verifyUniqueConstraints(contractUniques: readonly UniqueConstraint[], schemaUniques: readonly SqlUniqueIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
28
|
+
/**
|
|
29
|
+
* Verifies indexes match between contract and schema.
|
|
30
|
+
* Returns verification nodes for the tree.
|
|
31
|
+
*/
|
|
32
|
+
export declare function verifyIndexes(contractIndexes: readonly Index[], schemaIndexes: readonly SqlIndexIR[], tableName: string, tablePath: string, issues: SchemaIssue[], strict: boolean): SchemaVerificationNode[];
|
|
33
|
+
/**
|
|
34
|
+
* Verifies database dependencies are installed using component-owned verification hooks.
|
|
35
|
+
* Each dependency provides a pure verifyDatabaseDependencyInstalled function that checks
|
|
36
|
+
* whether the dependency is satisfied based on the in-memory schema IR (no DB I/O).
|
|
37
|
+
*
|
|
38
|
+
* Returns verification nodes for the tree.
|
|
39
|
+
*/
|
|
40
|
+
export declare function verifyDatabaseDependencies(dependencies: ReadonlyArray<ComponentDatabaseDependency<unknown>>, schema: SqlSchemaIR, issues: SchemaIssue[]): SchemaVerificationNode[];
|
|
41
|
+
/**
|
|
42
|
+
* Computes counts of pass/warn/fail nodes by traversing the tree.
|
|
43
|
+
*/
|
|
44
|
+
export declare function computeCounts(node: SchemaVerificationNode): {
|
|
45
|
+
pass: number;
|
|
46
|
+
warn: number;
|
|
47
|
+
fail: number;
|
|
48
|
+
totalNodes: number;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=verify-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-helpers.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,KAAK,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAU/E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,UAAU,GAAG,SAAS,EAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,GACpB,MAAM,GAAG,MAAM,CAoCjB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,OAAO,GACd,sBAAsB,EAAE,CAuG1B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,SAAS,gBAAgB,EAAE,EAC5C,aAAa,EAAE,SAAS,WAAW,EAAE,EACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,OAAO,GACd,sBAAsB,EAAE,CAmG1B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,eAAe,EAAE,SAAS,KAAK,EAAE,EACjC,aAAa,EAAE,SAAS,UAAU,EAAE,EACpC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,OAAO,GACd,sBAAsB,EAAE,CAoG1B;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,aAAa,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC,EACjE,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EAAE,GACpB,sBAAsB,EAAE,CAwC1B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,sBAAsB,GAAG;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CA6BA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure SQL schema verification function.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a pure function that verifies a SqlSchemaIR against
|
|
5
|
+
* a SqlContract without requiring a database connection. It can be reused
|
|
6
|
+
* by migration planners and other tools that need to compare schema states.
|
|
7
|
+
*/
|
|
8
|
+
import type { TargetBoundComponentDescriptor } from '@prisma-next/contract/framework-components';
|
|
9
|
+
import type { OperationContext, VerifyDatabaseSchemaResult } from '@prisma-next/core-control-plane/types';
|
|
10
|
+
import type { SqlContract, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
11
|
+
import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
|
|
12
|
+
/**
|
|
13
|
+
* Options for the pure schema verification function.
|
|
14
|
+
*/
|
|
15
|
+
export interface VerifySqlSchemaOptions {
|
|
16
|
+
/** The validated SQL contract to verify against */
|
|
17
|
+
readonly contract: SqlContract<SqlStorage>;
|
|
18
|
+
/** The schema IR from introspection (or another source) */
|
|
19
|
+
readonly schema: SqlSchemaIR;
|
|
20
|
+
/** Whether to run in strict mode (detects extra tables/columns) */
|
|
21
|
+
readonly strict: boolean;
|
|
22
|
+
/** Optional operation context for metadata */
|
|
23
|
+
readonly context?: OperationContext;
|
|
24
|
+
/** Type metadata registry for codec consistency warnings */
|
|
25
|
+
readonly typeMetadataRegistry: ReadonlyMap<string, {
|
|
26
|
+
nativeType?: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Active framework components participating in this composition.
|
|
30
|
+
* All components must have matching familyId ('sql') and targetId.
|
|
31
|
+
*/
|
|
32
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Verifies that a SqlSchemaIR matches a SqlContract.
|
|
36
|
+
*
|
|
37
|
+
* This is a pure function that does NOT perform any database I/O.
|
|
38
|
+
* It takes an already-introspected schema IR and compares it against
|
|
39
|
+
* the contract requirements.
|
|
40
|
+
*
|
|
41
|
+
* @param options - Verification options
|
|
42
|
+
* @returns VerifyDatabaseSchemaResult with verification tree and issues
|
|
43
|
+
*/
|
|
44
|
+
export declare function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult;
|
|
45
|
+
//# sourceMappingURL=verify-sql-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-sql-schema.d.ts","sourceRoot":"","sources":["../../../src/core/schema-verify/verify-sql-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAGhB,0BAA0B,EAC3B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAYpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IAC3C,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,0BAA0B,CAqe3F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
2
|
+
import type { ControlAdapterDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlTargetDescriptor } from '@prisma-next/core-control-plane/types';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a contract marker row from database query result.
|
|
5
|
+
* This is SQL-specific parsing logic (handles SQL row structure with snake_case columns).
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseContractMarkerRow(row: unknown): ContractMarkerRecord;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the SQL statement to read the contract marker.
|
|
10
|
+
* This is a migration-plane helper (no runtime imports).
|
|
11
|
+
* @internal - Used internally by readMarker(). Prefer readMarker() for Control Plane usage.
|
|
12
|
+
*/
|
|
13
|
+
export declare function readMarkerSql(): {
|
|
14
|
+
readonly sql: string;
|
|
15
|
+
readonly params: readonly unknown[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Reads the contract marker from the database using the provided driver.
|
|
19
|
+
* Returns the parsed marker record or null if no marker is found.
|
|
20
|
+
* This abstracts SQL-specific details from the Control Plane.
|
|
21
|
+
*
|
|
22
|
+
* @param driver - ControlDriverInstance instance for executing queries
|
|
23
|
+
* @returns Promise resolving to ContractMarkerRecord or null if marker not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function readMarker(driver: ControlDriverInstance<'sql', string>): Promise<ContractMarkerRecord | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Collects supported codec type IDs from adapter and extension manifests.
|
|
28
|
+
* Returns a sorted, unique array of type IDs that are declared in the manifests.
|
|
29
|
+
* This enables coverage checks by comparing contract column types against supported types.
|
|
30
|
+
*
|
|
31
|
+
* Note: This extracts type IDs from manifest type imports, not from runtime codec registries.
|
|
32
|
+
* The manifests declare which codec types are available, but the actual type IDs
|
|
33
|
+
* are defined in the codec-types TypeScript modules that are imported.
|
|
34
|
+
*
|
|
35
|
+
* For MVP, we return an empty array since extracting type IDs from TypeScript modules
|
|
36
|
+
* would require runtime evaluation or static analysis. This can be enhanced later.
|
|
37
|
+
*/
|
|
38
|
+
export declare function collectSupportedCodecTypeIds<TFamilyId extends string, TTargetId extends string>(descriptors: ReadonlyArray<ControlTargetDescriptor<TFamilyId, TTargetId> | ControlAdapterDescriptor<TFamilyId, TTargetId> | ControlExtensionDescriptor<TFamilyId, TTargetId>>): readonly string[];
|
|
39
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/core/verify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAuC/C;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAgCzE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,CAc7F;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,GAC3C,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAoCtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,SAAS,MAAM,EAAE,SAAS,SAAS,MAAM,EAC7F,WAAW,EAAE,aAAa,CACtB,uBAAuB,CAAC,SAAS,EAAE,SAAS,CAAC,GAC7C,wBAAwB,CAAC,SAAS,EAAE,SAAS,CAAC,GAC9C,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CACnD,GACA,SAAS,MAAM,EAAE,CAMnB"}
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* SQL control adapter interface for control-plane operations.
|
|
6
|
-
* Implemented by target-specific adapters (e.g., Postgres, MySQL).
|
|
7
|
-
*
|
|
8
|
-
* @template TTarget - The target ID (e.g., 'postgres', 'mysql')
|
|
9
|
-
*/
|
|
10
|
-
interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget> {
|
|
11
|
-
/**
|
|
12
|
-
* The target ID this adapter implements.
|
|
13
|
-
* Used for type tracking and runtime validation.
|
|
14
|
-
* @deprecated Use targetId from ControlAdapterInstance instead
|
|
15
|
-
*/
|
|
16
|
-
readonly target: TTarget;
|
|
17
|
-
/**
|
|
18
|
-
* Introspects a database schema and returns a raw SqlSchemaIR.
|
|
19
|
-
*
|
|
20
|
-
* This is a pure schema discovery operation that queries the database catalog
|
|
21
|
-
* and returns the schema structure without type mapping or contract enrichment.
|
|
22
|
-
* Type mapping and enrichment are handled separately by enrichment helpers.
|
|
23
|
-
*
|
|
24
|
-
* @param driver - ControlDriverInstance instance for executing queries (target-specific)
|
|
25
|
-
* @param contractIR - Optional contract IR for contract-guided introspection (filtering, optimization)
|
|
26
|
-
* @param schema - Schema name to introspect (defaults to 'public')
|
|
27
|
-
* @returns Promise resolving to SqlSchemaIR representing the live database schema
|
|
28
|
-
*/
|
|
29
|
-
introspect(driver: ControlDriverInstance<'sql', TTarget>, contractIR?: unknown, schema?: string): Promise<SqlSchemaIR>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* SQL control adapter descriptor interface.
|
|
33
|
-
* Provides a factory method to create control adapter instances.
|
|
34
|
-
*
|
|
35
|
-
* @template TTarget - The target ID (e.g., 'postgres', 'mysql')
|
|
36
|
-
*/
|
|
37
|
-
interface SqlControlAdapterDescriptor<TTarget extends string = string> {
|
|
38
|
-
/**
|
|
39
|
-
* Creates a SQL control adapter instance for control-plane operations.
|
|
40
|
-
*/
|
|
41
|
-
create(): SqlControlAdapter<TTarget>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type { SqlControlAdapter, SqlControlAdapterDescriptor };
|
|
1
|
+
export type { SqlControlAdapter, SqlControlAdapterDescriptor } from '../core/control-adapter';
|
|
2
|
+
//# sourceMappingURL=control-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-adapter.d.ts","sourceRoot":"","sources":["../../src/exports/control-adapter.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|