@prisma-next/family-sql 0.1.0-dev.19 → 0.1.0-dev.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.
@@ -1,14 +1,17 @@
1
1
  import { OperationRegistry } from '@prisma-next/operations';
2
2
  import { ExtensionPackManifest } from '@prisma-next/contract/pack-manifest-types';
3
- import { ControlTargetDescriptor, ControlTargetInstance, MigrationOperationPolicy, MigrationPlannerSuccessResult, MigrationPlan, MigrationPlanOperation, MigrationPlannerFailureResult, MigrationPlannerConflict, ControlDriverInstance, OperationContext, MigrationRunnerSuccessValue, MigrationRunnerFailure, ControlFamilyInstance, VerifyDatabaseResult, VerifyDatabaseSchemaResult, SignDatabaseResult, EmitContractResult, ControlFamilyDescriptor, ControlAdapterDescriptor, ControlDriverDescriptor, ControlExtensionDescriptor } from '@prisma-next/core-control-plane/types';
3
+ import { ControlFamilyDescriptor, ControlAdapterDescriptor, ControlDriverDescriptor, ControlExtensionDescriptor, MigrationOperationPolicy } from '@prisma-next/core-control-plane/types';
4
4
  export { MigrationOperationClass, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerResult, TargetMigrationsCapability } from '@prisma-next/core-control-plane/types';
5
5
  import { SqlControlAdapter } from './control-adapter.js';
6
- import { ContractIR as ContractIR$1 } from '@prisma-next/contract/ir';
7
- import { TypesImportSpec as TypesImportSpec$1 } from '@prisma-next/contract/types';
8
- import { CoreSchemaView } from '@prisma-next/core-control-plane/schema-view';
9
- import { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
10
- import { SqlContract, SqlStorage as SqlStorage$1 } from '@prisma-next/sql-contract/types';
11
- import { Result, NotOk, Ok } from '@prisma-next/utils/result';
6
+ import { S as SqlControlFamilyInstance, a as SqlControlTargetDescriptor, C as CreateSqlMigrationPlanOptions, b as SqlMigrationPlan, c as SqlPlannerConflict, d as SqlPlannerFailureResult, e as SqlPlannerSuccessResult, f as SqlMigrationRunnerErrorCode, A as AnyRecord, g as SqlMigrationRunnerFailure, h as SqlMigrationRunnerSuccessValue } from './instance-BDpyIYu5.js';
7
+ export { j as ComponentDatabaseDependencies, k as ComponentDatabaseDependency, i as SchemaVerifyOptions, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanContractInfo, p as SqlMigrationPlanOperation, q as SqlMigrationPlanOperationStep, r as SqlMigrationPlanOperationTarget, n as SqlMigrationPlanner, o as SqlMigrationPlannerPlanOptions, s as SqlMigrationRunner, t as SqlMigrationRunnerExecuteCallbacks, u as SqlMigrationRunnerExecuteOptions, v as SqlMigrationRunnerResult, w as SqlPlannerConflictKind, x as SqlPlannerConflictLocation, y as SqlPlannerResult } from './instance-BDpyIYu5.js';
8
+ import { NotOk, Ok } from '@prisma-next/utils/result';
9
+ import '@prisma-next/sql-schema-ir/types';
10
+ import '@prisma-next/contract/framework-components';
11
+ import '@prisma-next/sql-contract/types';
12
+ import '@prisma-next/contract/ir';
13
+ import '@prisma-next/contract/types';
14
+ import '@prisma-next/core-control-plane/schema-view';
12
15
 
13
16
  type StorageColumn = {
14
17
  readonly nativeType: string;
@@ -100,314 +103,6 @@ interface ValidationContext {
100
103
  readonly extensionIds?: ReadonlyArray<string>;
101
104
  }
102
105
 
103
- /**
104
- * SQL-specific migration types.
105
- *
106
- * These types extend the canonical migration types from the framework control plane
107
- * with SQL-specific fields for execution (precheck SQL, execute SQL, etc.).
108
- */
109
-
110
- type AnyRecord = Readonly<Record<string, unknown>>;
111
- /**
112
- * A single step in a SQL migration operation (precheck, execute, or postcheck).
113
- */
114
- interface SqlMigrationPlanOperationStep {
115
- readonly description: string;
116
- readonly sql: string;
117
- readonly meta?: AnyRecord;
118
- }
119
- /**
120
- * Target details for a SQL migration operation (table, column, index, etc.).
121
- */
122
- interface SqlMigrationPlanOperationTarget<TTargetDetails> {
123
- readonly id: string;
124
- readonly details?: TTargetDetails;
125
- }
126
- /**
127
- * A single SQL migration operation with SQL-specific fields.
128
- * Extends the core MigrationPlanOperation with SQL execution details.
129
- */
130
- interface SqlMigrationPlanOperation<TTargetDetails = Record<string, never>> extends MigrationPlanOperation {
131
- /** Optional detailed explanation of what this operation does and why. */
132
- readonly summary?: string;
133
- readonly target: SqlMigrationPlanOperationTarget<TTargetDetails>;
134
- readonly precheck: readonly SqlMigrationPlanOperationStep[];
135
- readonly execute: readonly SqlMigrationPlanOperationStep[];
136
- readonly postcheck: readonly SqlMigrationPlanOperationStep[];
137
- readonly meta?: AnyRecord;
138
- }
139
- /**
140
- * Contract identity information for SQL migrations.
141
- */
142
- interface SqlMigrationPlanContractInfo {
143
- readonly coreHash: string;
144
- readonly profileHash?: string;
145
- }
146
- /**
147
- * A SQL migration plan with SQL-specific fields.
148
- * Extends the core MigrationPlan with origin tracking and metadata.
149
- */
150
- interface SqlMigrationPlan<TTargetDetails = Record<string, never>> extends MigrationPlan {
151
- /**
152
- * Origin contract identity that the plan expects the database to currently be at.
153
- * If omitted, the runner treats the origin as "no marker present" (empty database),
154
- * and will only proceed if no marker exists (or if the marker already matches destination).
155
- */
156
- readonly origin?: SqlMigrationPlanContractInfo | null;
157
- /**
158
- * Destination contract identity that the plan intends to reach.
159
- */
160
- readonly destination: SqlMigrationPlanContractInfo;
161
- readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
162
- readonly meta?: AnyRecord;
163
- }
164
- /**
165
- * Specific conflict kinds for SQL migrations.
166
- */
167
- type SqlPlannerConflictKind = 'typeMismatch' | 'nullabilityConflict' | 'indexIncompatible' | 'foreignKeyConflict' | 'missingButNonAdditive' | 'unsupportedExtension' | 'extensionMissing' | 'unsupportedOperation';
168
- /**
169
- * Location information for SQL planner conflicts.
170
- */
171
- interface SqlPlannerConflictLocation {
172
- readonly table?: string;
173
- readonly column?: string;
174
- readonly index?: string;
175
- readonly constraint?: string;
176
- readonly extension?: string;
177
- }
178
- /**
179
- * A SQL-specific planner conflict with additional location information.
180
- * Extends the core MigrationPlannerConflict.
181
- */
182
- interface SqlPlannerConflict extends MigrationPlannerConflict {
183
- readonly kind: SqlPlannerConflictKind;
184
- readonly location?: SqlPlannerConflictLocation;
185
- readonly meta?: AnyRecord;
186
- }
187
- /**
188
- * Successful SQL planner result with the migration plan.
189
- */
190
- interface SqlPlannerSuccessResult<TTargetDetails> extends Omit<MigrationPlannerSuccessResult, 'plan'> {
191
- readonly kind: 'success';
192
- readonly plan: SqlMigrationPlan<TTargetDetails>;
193
- }
194
- /**
195
- * Failed SQL planner result with the list of conflicts.
196
- */
197
- interface SqlPlannerFailureResult extends Omit<MigrationPlannerFailureResult, 'conflicts'> {
198
- readonly kind: 'failure';
199
- readonly conflicts: readonly SqlPlannerConflict[];
200
- }
201
- /**
202
- * Union type for SQL planner results.
203
- */
204
- type SqlPlannerResult<TTargetDetails = Record<string, never>> = SqlPlannerSuccessResult<TTargetDetails> | SqlPlannerFailureResult;
205
- /**
206
- * Options for SQL migration planner.
207
- */
208
- interface SqlMigrationPlannerPlanOptions {
209
- readonly contract: SqlContract<SqlStorage$1>;
210
- readonly schema: SqlSchemaIR;
211
- readonly policy: MigrationOperationPolicy;
212
- readonly schemaName?: string;
213
- }
214
- /**
215
- * SQL migration planner interface.
216
- * Extends the core MigrationPlanner with SQL-specific types.
217
- */
218
- interface SqlMigrationPlanner<TTargetDetails = Record<string, never>> {
219
- plan(options: SqlMigrationPlannerPlanOptions): SqlPlannerResult<TTargetDetails>;
220
- }
221
- /**
222
- * Callbacks for SQL migration runner execution.
223
- */
224
- interface SqlMigrationRunnerExecuteCallbacks<TTargetDetails = Record<string, never>> {
225
- onOperationStart?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
226
- onOperationComplete?(operation: SqlMigrationPlanOperation<TTargetDetails>): void;
227
- }
228
- /**
229
- * Options for SQL migration runner execution.
230
- */
231
- interface SqlMigrationRunnerExecuteOptions<TTargetDetails = Record<string, never>> {
232
- readonly plan: SqlMigrationPlan<TTargetDetails>;
233
- readonly driver: ControlDriverInstance<'sql', string>;
234
- /**
235
- * Destination contract IR.
236
- * Must correspond to `plan.destination` and is used for schema verification and marker/ledger writes.
237
- */
238
- readonly destinationContract: SqlContract<SqlStorage$1>;
239
- /**
240
- * Execution-time policy that defines which operation classes are allowed.
241
- * The runner validates each operation against this policy before execution.
242
- */
243
- readonly policy: MigrationOperationPolicy;
244
- readonly schemaName?: string;
245
- readonly strictVerification?: boolean;
246
- readonly callbacks?: SqlMigrationRunnerExecuteCallbacks<TTargetDetails>;
247
- readonly context?: OperationContext;
248
- }
249
- /**
250
- * Error codes for SQL migration runner failures.
251
- */
252
- type SqlMigrationRunnerErrorCode = 'DESTINATION_CONTRACT_MISMATCH' | 'MARKER_ORIGIN_MISMATCH' | 'POLICY_VIOLATION' | 'PRECHECK_FAILED' | 'POSTCHECK_FAILED' | 'SCHEMA_VERIFY_FAILED' | 'EXECUTION_FAILED';
253
- /**
254
- * Detailed information about a SQL migration runner failure.
255
- * Extends the core MigrationRunnerFailure with SQL-specific error codes.
256
- */
257
- interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
258
- readonly code: SqlMigrationRunnerErrorCode;
259
- readonly meta?: AnyRecord;
260
- }
261
- /**
262
- * Success value for SQL migration runner execution.
263
- * Extends core type for type branding and potential SQL-specific extensions.
264
- */
265
- interface SqlMigrationRunnerSuccessValue extends MigrationRunnerSuccessValue {
266
- }
267
- /**
268
- * Result type for SQL migration runner execution.
269
- */
270
- type SqlMigrationRunnerResult = Result<SqlMigrationRunnerSuccessValue, SqlMigrationRunnerFailure>;
271
- /**
272
- * SQL migration runner interface.
273
- * Extends the core MigrationRunner with SQL-specific types.
274
- */
275
- interface SqlMigrationRunner<TTargetDetails = Record<string, never>> {
276
- execute(options: SqlMigrationRunnerExecuteOptions<TTargetDetails>): Promise<SqlMigrationRunnerResult>;
277
- }
278
- /**
279
- * SQL control target descriptor with migration support.
280
- * Extends the core ControlTargetDescriptor with SQL-specific migration methods.
281
- */
282
- interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails = Record<string, never>> extends ControlTargetDescriptor<'sql', TTargetId, ControlTargetInstance<'sql', TTargetId>, SqlControlFamilyInstance> {
283
- /**
284
- * Creates a SQL migration planner for this target.
285
- * Direct method for SQL-specific usage.
286
- */
287
- createPlanner(family: SqlControlFamilyInstance): SqlMigrationPlanner<TTargetDetails>;
288
- /**
289
- * Creates a SQL migration runner for this target.
290
- * Direct method for SQL-specific usage.
291
- */
292
- createRunner(family: SqlControlFamilyInstance): SqlMigrationRunner<TTargetDetails>;
293
- }
294
- /**
295
- * Options for creating a SQL migration plan.
296
- */
297
- interface CreateSqlMigrationPlanOptions<TTargetDetails> {
298
- readonly targetId: string;
299
- readonly origin?: SqlMigrationPlanContractInfo | null;
300
- readonly destination: SqlMigrationPlanContractInfo;
301
- readonly operations: readonly SqlMigrationPlanOperation<TTargetDetails>[];
302
- readonly meta?: AnyRecord;
303
- }
304
-
305
- /**
306
- * Type metadata for SQL storage types.
307
- * Maps contract storage type IDs to native database types.
308
- */
309
- interface SqlTypeMetadata {
310
- readonly typeId: string;
311
- readonly familyId: 'sql';
312
- readonly targetId: string;
313
- readonly nativeType?: string;
314
- }
315
- /**
316
- * Registry mapping type IDs to their metadata.
317
- * Keyed by contract storage type ID (e.g., 'pg/int4@1').
318
- */
319
- type SqlTypeMetadataRegistry = Map<string, SqlTypeMetadata>;
320
- /**
321
- * State fields for SQL family instance that hold assembly data.
322
- */
323
- interface SqlFamilyInstanceState {
324
- readonly operationRegistry: OperationRegistry;
325
- readonly codecTypeImports: ReadonlyArray<TypesImportSpec$1>;
326
- readonly operationTypeImports: ReadonlyArray<TypesImportSpec$1>;
327
- readonly extensionIds: ReadonlyArray<string>;
328
- readonly typeMetadataRegistry: SqlTypeMetadataRegistry;
329
- }
330
- /**
331
- * Options for schema verification.
332
- */
333
- interface SchemaVerifyOptions {
334
- readonly driver: ControlDriverInstance<'sql', string>;
335
- readonly contractIR: unknown;
336
- readonly strict: boolean;
337
- readonly context?: OperationContext;
338
- }
339
- /**
340
- * SQL control family instance interface.
341
- * Extends ControlFamilyInstance with SQL-specific domain actions.
342
- */
343
- interface SqlControlFamilyInstance extends ControlFamilyInstance<'sql'>, SqlFamilyInstanceState {
344
- /**
345
- * Validates a contract JSON and returns a validated ContractIR (without mappings).
346
- * Mappings are runtime-only and should not be part of ContractIR.
347
- */
348
- validateContractIR(contractJson: unknown): ContractIR$1;
349
- /**
350
- * Verifies the database marker against the contract.
351
- * Compares target, coreHash, and profileHash.
352
- */
353
- verify(options: {
354
- readonly driver: ControlDriverInstance<'sql', string>;
355
- readonly contractIR: unknown;
356
- readonly expectedTargetId: string;
357
- readonly contractPath: string;
358
- readonly configPath?: string;
359
- }): Promise<VerifyDatabaseResult>;
360
- /**
361
- * Verifies the database schema against the contract.
362
- * Compares contract requirements against live database schema.
363
- */
364
- schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;
365
- /**
366
- * Signs the database with the contract marker.
367
- * Writes or updates the contract marker if schema verification passes.
368
- * This operation is idempotent - if the marker already matches, no changes are made.
369
- */
370
- sign(options: {
371
- readonly driver: ControlDriverInstance<'sql', string>;
372
- readonly contractIR: unknown;
373
- readonly contractPath: string;
374
- readonly configPath?: string;
375
- }): Promise<SignDatabaseResult>;
376
- /**
377
- * Introspects the database schema and returns a family-specific schema IR.
378
- *
379
- * This is a read-only operation that returns a snapshot of the live database schema.
380
- * The method is family-owned and delegates to target/adapter-specific introspectors
381
- * to perform the actual schema introspection.
382
- *
383
- * @param options - Introspection options
384
- * @param options.driver - Control plane driver for database connection
385
- * @param options.contractIR - Optional contract IR for contract-guided introspection.
386
- * When provided, families may use it for filtering, optimization, or validation
387
- * during introspection. The contract IR does not change the meaning of "what exists"
388
- * in the database - it only guides how introspection is performed.
389
- * @returns Promise resolving to the family-specific Schema IR (e.g., `SqlSchemaIR` for SQL).
390
- * The IR represents the complete schema snapshot at the time of introspection.
391
- */
392
- introspect(options: {
393
- readonly driver: ControlDriverInstance<'sql', string>;
394
- readonly contractIR?: unknown;
395
- }): Promise<SqlSchemaIR>;
396
- /**
397
- * Projects a SQL Schema IR into a core schema view for CLI visualization.
398
- * Converts SqlSchemaIR (tables, columns, indexes, extensions) into a tree structure.
399
- */
400
- toSchemaView(schema: SqlSchemaIR): CoreSchemaView;
401
- /**
402
- * Emits contract JSON and DTS as strings.
403
- * Uses the instance's preassembled state (operation registry, type imports, extension IDs).
404
- * Handles stripping mappings and validation internally.
405
- */
406
- emitContract(options: {
407
- readonly contractIR: ContractIR$1 | unknown;
408
- }): Promise<EmitContractResult>;
409
- }
410
-
411
106
  /**
412
107
  * SQL family descriptor implementation.
413
108
  * Provides the SQL family hook and factory method.
@@ -419,7 +114,7 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
419
114
  readonly manifest: ExtensionPackManifest;
420
115
  readonly hook: {
421
116
  readonly id: "sql";
422
- readonly validateTypes: (ir: ContractIR, ctx: ValidationContext) => void;
117
+ readonly validateTypes: (ir: ContractIR, _ctx: ValidationContext) => void;
423
118
  readonly validateStructure: (ir: ContractIR) => void;
424
119
  readonly generateContractTypes: (ir: ContractIR, codecTypeImports: ReadonlyArray<TypesImportSpec>, operationTypeImports: ReadonlyArray<TypesImportSpec>) => string;
425
120
  readonly generateStorageType: (storage: SqlStorage) => string;
@@ -464,4 +159,4 @@ declare const INIT_ADDITIVE_POLICY: MigrationOperationPolicy;
464
159
  */
465
160
  declare const _default: SqlFamilyDescriptor;
466
161
 
467
- export { type CreateSqlMigrationPlanOptions, INIT_ADDITIVE_POLICY, type SchemaVerifyOptions, type SqlControlFamilyInstance, type SqlControlTargetDescriptor, type SqlMigrationPlan, type SqlMigrationPlanContractInfo, type SqlMigrationPlanOperation, type SqlMigrationPlanOperationStep, type SqlMigrationPlanOperationTarget, type SqlMigrationPlanner, type SqlMigrationPlannerPlanOptions, type SqlMigrationRunner, type SqlMigrationRunnerErrorCode, type SqlMigrationRunnerExecuteCallbacks, type SqlMigrationRunnerExecuteOptions, type SqlMigrationRunnerFailure, type SqlMigrationRunnerResult, type SqlMigrationRunnerSuccessValue, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, createMigrationPlan, _default as default, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
162
+ export { CreateSqlMigrationPlanOptions, INIT_ADDITIVE_POLICY, SqlControlFamilyInstance, SqlControlTargetDescriptor, SqlMigrationPlan, SqlMigrationRunnerErrorCode, SqlMigrationRunnerFailure, SqlMigrationRunnerSuccessValue, SqlPlannerConflict, SqlPlannerFailureResult, SqlPlannerSuccessResult, createMigrationPlan, _default as default, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createSqlFamilyInstance
3
- } from "./chunk-ZAI6E4PG.js";
3
+ } from "./chunk-NUALBK4N.js";
4
4
  import "./chunk-2L5DCW2L.js";
5
- import "./chunk-I7QWTBWS.js";
5
+ import "./chunk-6AMLAAA2.js";
6
6
 
7
7
  // src/core/descriptor.ts
8
8
  import { sqlTargetFamilyHook } from "@prisma-next/sql-contract-emitter";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/descriptor.ts","../../src/core/migrations/plan-helpers.ts","../../src/core/migrations/policies.ts","../../src/exports/control.ts"],"sourcesContent":["import type { ExtensionPackManifest } from '@prisma-next/contract/pack-manifest-types';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n} from '@prisma-next/core-control-plane/types';\nimport { sqlTargetFamilyHook } from '@prisma-next/sql-contract-emitter';\nimport type { SqlControlAdapter } from './control-adapter';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './instance';\nimport type { SqlControlTargetDescriptor } from './migrations/types';\n\n/**\n * SQL family manifest.\n */\nconst sqlFamilyManifest: ExtensionPackManifest = {\n id: 'sql',\n version: '0.0.1',\n};\n\n/**\n * SQL family descriptor implementation.\n * Provides the SQL family hook and factory method.\n */\nexport class SqlFamilyDescriptor\n implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly manifest = sqlFamilyManifest;\n readonly hook = sqlTargetFamilyHook;\n\n create<TTargetId extends string, TTargetDetails = Record<string, never>>(options: {\n readonly target: SqlControlTargetDescriptor<TTargetId, TTargetDetails>;\n readonly adapter: ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>>;\n readonly driver: ControlDriverDescriptor<'sql', TTargetId>;\n readonly extensions: readonly ControlExtensionDescriptor<'sql', TTargetId>[];\n }): SqlControlFamilyInstance {\n return createSqlFamilyInstance({\n target: options.target,\n adapter: options.adapter,\n extensions: options.extensions,\n });\n }\n}\n","import type { NotOk, Ok } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type {\n AnyRecord,\n CreateSqlMigrationPlanOptions,\n SqlMigrationPlan,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerFailureResult,\n SqlPlannerSuccessResult,\n} from './types';\n\nconst readOnlyEmptyObject: Record<string, never> = Object.freeze({});\n\nfunction cloneRecord<T extends AnyRecord>(value: T): T {\n if (value === readOnlyEmptyObject) {\n return value;\n }\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeSteps(\n steps: readonly SqlMigrationPlanOperationStep[],\n): readonly SqlMigrationPlanOperationStep[] {\n if (steps.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(\n steps.map((step) =>\n Object.freeze({\n description: step.description,\n sql: step.sql,\n ...(step.meta ? { meta: cloneRecord(step.meta) } : {}),\n }),\n ),\n );\n}\n\nfunction freezeDetailsValue<T>(value: T): T {\n // Primitives and null/undefined are already immutable, return as-is\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n return value;\n }\n // Arrays: shallow clone and freeze\n if (Array.isArray(value)) {\n return Object.freeze([...value]) as T;\n }\n // Objects: shallow clone and freeze (matching cloneRecord pattern)\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeTargetDetails<TTargetDetails>(\n target: SqlMigrationPlanOperationTarget<TTargetDetails>,\n): SqlMigrationPlanOperationTarget<TTargetDetails> {\n return Object.freeze({\n id: target.id,\n ...(target.details !== undefined ? { details: freezeDetailsValue(target.details) } : {}),\n });\n}\n\nfunction freezeOperation<TTargetDetails>(\n operation: SqlMigrationPlanOperation<TTargetDetails>,\n): SqlMigrationPlanOperation<TTargetDetails> {\n return Object.freeze({\n id: operation.id,\n label: operation.label,\n ...(operation.summary ? { summary: operation.summary } : {}),\n operationClass: operation.operationClass,\n target: freezeTargetDetails(operation.target),\n precheck: freezeSteps(operation.precheck),\n execute: freezeSteps(operation.execute),\n postcheck: freezeSteps(operation.postcheck),\n ...(operation.meta ? { meta: cloneRecord(operation.meta) } : {}),\n });\n}\n\nfunction freezeOperations<TTargetDetails>(\n operations: readonly SqlMigrationPlanOperation<TTargetDetails>[],\n): readonly SqlMigrationPlanOperation<TTargetDetails>[] {\n if (operations.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\n\nexport function createMigrationPlan<TTargetDetails = Record<string, never>>(\n options: CreateSqlMigrationPlanOptions<TTargetDetails>,\n): SqlMigrationPlan<TTargetDetails> {\n return Object.freeze({\n targetId: options.targetId,\n ...(options.origin !== undefined\n ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null }\n : {}),\n destination: Object.freeze({ ...options.destination }),\n operations: freezeOperations(options.operations),\n ...(options.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n}\n\nexport function plannerSuccess<TTargetDetails>(\n plan: SqlMigrationPlan<TTargetDetails>,\n): SqlPlannerSuccessResult<TTargetDetails> {\n return Object.freeze({\n kind: 'success',\n plan,\n });\n}\n\nexport function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult {\n return Object.freeze({\n kind: 'failure' as const,\n conflicts: Object.freeze(\n conflicts.map((conflict) =>\n Object.freeze({\n kind: conflict.kind,\n summary: conflict.summary,\n ...(conflict.why ? { why: conflict.why } : {}),\n ...(conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {}),\n ...(conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}),\n }),\n ),\n ),\n });\n}\n\n/**\n * Creates a successful migration runner result.\n */\nexport function runnerSuccess(value: {\n operationsPlanned: number;\n operationsExecuted: number;\n}): Ok<SqlMigrationRunnerSuccessValue> {\n return ok(\n Object.freeze({\n operationsPlanned: value.operationsPlanned,\n operationsExecuted: value.operationsExecuted,\n }),\n );\n}\n\n/**\n * Creates a failed migration runner result.\n */\nexport function runnerFailure(\n code: SqlMigrationRunnerErrorCode,\n summary: string,\n options?: { why?: string; meta?: AnyRecord },\n): NotOk<SqlMigrationRunnerFailure> {\n const failure: SqlMigrationRunnerFailure = Object.freeze({\n code,\n summary,\n ...(options?.why ? { why: options.why } : {}),\n ...(options?.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n return notOk(failure);\n}\n","import type { MigrationOperationPolicy } from '@prisma-next/core-control-plane/types';\n\n/**\n * Policy used by `db init`: additive-only operations, no widening/destructive steps.\n */\nexport const INIT_ADDITIVE_POLICY: MigrationOperationPolicy = Object.freeze({\n allowedOperationClasses: Object.freeze(['additive'] as const),\n});\n","import { SqlFamilyDescriptor } from '../core/descriptor';\n\n// Re-export core types from canonical source\nexport type {\n MigrationOperationClass,\n MigrationOperationPolicy,\n MigrationPlan,\n MigrationPlanner,\n MigrationPlannerConflict,\n MigrationPlannerResult,\n MigrationPlanOperation,\n TargetMigrationsCapability,\n} from '@prisma-next/core-control-plane/types';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/instance';\nexport {\n createMigrationPlan,\n plannerFailure,\n plannerSuccess,\n runnerFailure,\n runnerSuccess,\n} from '../core/migrations/plan-helpers';\nexport { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';\n// SQL-specific types\nexport type {\n CreateSqlMigrationPlanOptions,\n SqlControlTargetDescriptor,\n SqlMigrationPlan,\n SqlMigrationPlanContractInfo,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunner,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerExecuteCallbacks,\n SqlMigrationRunnerExecuteOptions,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerResult,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerConflictKind,\n SqlPlannerConflictLocation,\n SqlPlannerFailureResult,\n SqlPlannerResult,\n SqlPlannerSuccessResult,\n} from '../core/migrations/types';\n\n/**\n * SQL family descriptor for control plane (CLI/config).\n * Provides the SQL family hook and conversion helpers.\n */\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;AAOA,SAAS,2BAA2B;AAQpC,IAAM,oBAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,SAAS;AACX;AAMO,IAAM,sBAAN,MAEP;AAAA,EACW,OAAO;AAAA,EACP,KAAK;AAAA,EACL,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EAEhB,OAAyE,SAK5C;AAC3B,WAAO,wBAAwB;AAAA,MAC7B,QAAQ,QAAQ;AAAA,MAChB,SAAS,QAAQ;AAAA,MACjB,YAAY,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH;AACF;;;AC5CA,SAAS,OAAO,UAAU;AAgB1B,IAAM,sBAA6C,OAAO,OAAO,CAAC,CAAC;AAEnE,SAAS,YAAiC,OAAa;AACrD,MAAI,UAAU,qBAAqB;AACjC,WAAO;AAAA,EACT;AAC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A,MACH;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAKO,SAAS,cAAc,OAGS;AACrC,SAAO;AAAA,IACL,OAAO,OAAO;AAAA,MACZ,mBAAmB,MAAM;AAAA,MACzB,oBAAoB,MAAM;AAAA,IAC5B,CAAC;AAAA,EACH;AACF;AAKO,SAAS,cACd,MACA,SACA,SACkC;AAClC,QAAM,UAAqC,OAAO,OAAO;AAAA,IACvD;AAAA,IACA;AAAA,IACA,GAAI,SAAS,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;AAAA,IAC3C,GAAI,SAAS,OAAO,EAAE,MAAM,YAAY,QAAQ,IAAI,EAAE,IAAI,CAAC;AAAA,EAC7D,CAAC;AACD,SAAO,MAAM,OAAO;AACtB;;;AC9JO,IAAM,uBAAiD,OAAO,OAAO;AAAA,EAC1E,yBAAyB,OAAO,OAAO,CAAC,UAAU,CAAU;AAC9D,CAAC;;;AC6CD,IAAO,kBAAQ,IAAI,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../../src/core/descriptor.ts","../../src/core/migrations/plan-helpers.ts","../../src/core/migrations/policies.ts","../../src/exports/control.ts"],"sourcesContent":["import type { ExtensionPackManifest } from '@prisma-next/contract/pack-manifest-types';\nimport type {\n ControlAdapterDescriptor,\n ControlDriverDescriptor,\n ControlExtensionDescriptor,\n ControlFamilyDescriptor,\n} from '@prisma-next/core-control-plane/types';\nimport { sqlTargetFamilyHook } from '@prisma-next/sql-contract-emitter';\nimport type { SqlControlAdapter } from './control-adapter';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './instance';\nimport type { SqlControlTargetDescriptor } from './migrations/types';\n\n/**\n * SQL family manifest.\n */\nconst sqlFamilyManifest: ExtensionPackManifest = {\n id: 'sql',\n version: '0.0.1',\n};\n\n/**\n * SQL family descriptor implementation.\n * Provides the SQL family hook and factory method.\n */\nexport class SqlFamilyDescriptor\n implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'sql';\n readonly familyId = 'sql' as const;\n readonly manifest = sqlFamilyManifest;\n readonly hook = sqlTargetFamilyHook;\n\n create<TTargetId extends string, TTargetDetails = Record<string, never>>(options: {\n readonly target: SqlControlTargetDescriptor<TTargetId, TTargetDetails>;\n readonly adapter: ControlAdapterDescriptor<'sql', TTargetId, SqlControlAdapter<TTargetId>>;\n readonly driver: ControlDriverDescriptor<'sql', TTargetId>;\n readonly extensions: readonly ControlExtensionDescriptor<'sql', TTargetId>[];\n }): SqlControlFamilyInstance {\n return createSqlFamilyInstance({\n target: options.target,\n adapter: options.adapter,\n extensions: options.extensions,\n });\n }\n}\n","import type { NotOk, Ok } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type {\n AnyRecord,\n CreateSqlMigrationPlanOptions,\n SqlMigrationPlan,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerFailureResult,\n SqlPlannerSuccessResult,\n} from './types';\n\nconst readOnlyEmptyObject: Record<string, never> = Object.freeze({});\n\nfunction cloneRecord<T extends AnyRecord>(value: T): T {\n if (value === readOnlyEmptyObject) {\n return value;\n }\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeSteps(\n steps: readonly SqlMigrationPlanOperationStep[],\n): readonly SqlMigrationPlanOperationStep[] {\n if (steps.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(\n steps.map((step) =>\n Object.freeze({\n description: step.description,\n sql: step.sql,\n ...(step.meta ? { meta: cloneRecord(step.meta) } : {}),\n }),\n ),\n );\n}\n\nfunction freezeDetailsValue<T>(value: T): T {\n // Primitives and null/undefined are already immutable, return as-is\n if (value === null || value === undefined) {\n return value;\n }\n if (typeof value !== 'object') {\n return value;\n }\n // Arrays: shallow clone and freeze\n if (Array.isArray(value)) {\n return Object.freeze([...value]) as T;\n }\n // Objects: shallow clone and freeze (matching cloneRecord pattern)\n return Object.freeze({ ...value }) as T;\n}\n\nfunction freezeTargetDetails<TTargetDetails>(\n target: SqlMigrationPlanOperationTarget<TTargetDetails>,\n): SqlMigrationPlanOperationTarget<TTargetDetails> {\n return Object.freeze({\n id: target.id,\n ...(target.details !== undefined ? { details: freezeDetailsValue(target.details) } : {}),\n });\n}\n\nfunction freezeOperation<TTargetDetails>(\n operation: SqlMigrationPlanOperation<TTargetDetails>,\n): SqlMigrationPlanOperation<TTargetDetails> {\n return Object.freeze({\n id: operation.id,\n label: operation.label,\n ...(operation.summary ? { summary: operation.summary } : {}),\n operationClass: operation.operationClass,\n target: freezeTargetDetails(operation.target),\n precheck: freezeSteps(operation.precheck),\n execute: freezeSteps(operation.execute),\n postcheck: freezeSteps(operation.postcheck),\n ...(operation.meta ? { meta: cloneRecord(operation.meta) } : {}),\n });\n}\n\nfunction freezeOperations<TTargetDetails>(\n operations: readonly SqlMigrationPlanOperation<TTargetDetails>[],\n): readonly SqlMigrationPlanOperation<TTargetDetails>[] {\n if (operations.length === 0) {\n return Object.freeze([]);\n }\n return Object.freeze(operations.map((operation) => freezeOperation(operation)));\n}\n\nexport function createMigrationPlan<TTargetDetails = Record<string, never>>(\n options: CreateSqlMigrationPlanOptions<TTargetDetails>,\n): SqlMigrationPlan<TTargetDetails> {\n return Object.freeze({\n targetId: options.targetId,\n ...(options.origin !== undefined\n ? { origin: options.origin ? Object.freeze({ ...options.origin }) : null }\n : {}),\n destination: Object.freeze({ ...options.destination }),\n operations: freezeOperations(options.operations),\n ...(options.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n}\n\nexport function plannerSuccess<TTargetDetails>(\n plan: SqlMigrationPlan<TTargetDetails>,\n): SqlPlannerSuccessResult<TTargetDetails> {\n return Object.freeze({\n kind: 'success',\n plan,\n });\n}\n\nexport function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult {\n return Object.freeze({\n kind: 'failure' as const,\n conflicts: Object.freeze(\n conflicts.map((conflict) =>\n Object.freeze({\n kind: conflict.kind,\n summary: conflict.summary,\n ...(conflict.why ? { why: conflict.why } : {}),\n ...(conflict.location ? { location: Object.freeze({ ...conflict.location }) } : {}),\n ...(conflict.meta ? { meta: cloneRecord(conflict.meta) } : {}),\n }),\n ),\n ),\n });\n}\n\n/**\n * Creates a successful migration runner result.\n */\nexport function runnerSuccess(value: {\n operationsPlanned: number;\n operationsExecuted: number;\n}): Ok<SqlMigrationRunnerSuccessValue> {\n return ok(\n Object.freeze({\n operationsPlanned: value.operationsPlanned,\n operationsExecuted: value.operationsExecuted,\n }),\n );\n}\n\n/**\n * Creates a failed migration runner result.\n */\nexport function runnerFailure(\n code: SqlMigrationRunnerErrorCode,\n summary: string,\n options?: { why?: string; meta?: AnyRecord },\n): NotOk<SqlMigrationRunnerFailure> {\n const failure: SqlMigrationRunnerFailure = Object.freeze({\n code,\n summary,\n ...(options?.why ? { why: options.why } : {}),\n ...(options?.meta ? { meta: cloneRecord(options.meta) } : {}),\n });\n return notOk(failure);\n}\n","import type { MigrationOperationPolicy } from '@prisma-next/core-control-plane/types';\n\n/**\n * Policy used by `db init`: additive-only operations, no widening/destructive steps.\n */\nexport const INIT_ADDITIVE_POLICY: MigrationOperationPolicy = Object.freeze({\n allowedOperationClasses: Object.freeze(['additive'] as const),\n});\n","import { SqlFamilyDescriptor } from '../core/descriptor';\n\n// Re-export core types from canonical source\nexport type {\n MigrationOperationClass,\n MigrationOperationPolicy,\n MigrationPlan,\n MigrationPlanner,\n MigrationPlannerConflict,\n MigrationPlannerResult,\n MigrationPlanOperation,\n TargetMigrationsCapability,\n} from '@prisma-next/core-control-plane/types';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/instance';\nexport {\n createMigrationPlan,\n plannerFailure,\n plannerSuccess,\n runnerFailure,\n runnerSuccess,\n} from '../core/migrations/plan-helpers';\nexport { INIT_ADDITIVE_POLICY } from '../core/migrations/policies';\n// SQL-specific types\nexport type {\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n CreateSqlMigrationPlanOptions,\n SqlControlExtensionDescriptor,\n SqlControlTargetDescriptor,\n SqlMigrationPlan,\n SqlMigrationPlanContractInfo,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlMigrationPlanOperation,\n SqlMigrationPlanOperationStep,\n SqlMigrationPlanOperationTarget,\n SqlMigrationRunner,\n SqlMigrationRunnerErrorCode,\n SqlMigrationRunnerExecuteCallbacks,\n SqlMigrationRunnerExecuteOptions,\n SqlMigrationRunnerFailure,\n SqlMigrationRunnerResult,\n SqlMigrationRunnerSuccessValue,\n SqlPlannerConflict,\n SqlPlannerConflictKind,\n SqlPlannerConflictLocation,\n SqlPlannerFailureResult,\n SqlPlannerResult,\n SqlPlannerSuccessResult,\n} from '../core/migrations/types';\n\n/**\n * SQL family descriptor for control plane (CLI/config).\n * Provides the SQL family hook and conversion helpers.\n */\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;AAOA,SAAS,2BAA2B;AAQpC,IAAM,oBAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,SAAS;AACX;AAMO,IAAM,sBAAN,MAEP;AAAA,EACW,OAAO;AAAA,EACP,KAAK;AAAA,EACL,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EAEhB,OAAyE,SAK5C;AAC3B,WAAO,wBAAwB;AAAA,MAC7B,QAAQ,QAAQ;AAAA,MAChB,SAAS,QAAQ;AAAA,MACjB,YAAY,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH;AACF;;;AC5CA,SAAS,OAAO,UAAU;AAgB1B,IAAM,sBAA6C,OAAO,OAAO,CAAC,CAAC;AAEnE,SAAS,YAAiC,OAAa;AACrD,MAAI,UAAU,qBAAqB;AACjC,WAAO;AAAA,EACT;AACA,SAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC;AACnC;AAEA,SAAS,YACP,OAC0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