@prisma-next/family-sql 0.4.0-dev.9 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/control.d.mts +2 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +21 -9
- package/dist/control.mjs.map +1 -1
- package/dist/migration.d.mts +36 -0
- package/dist/migration.d.mts.map +1 -0
- package/dist/migration.mjs +35 -0
- package/dist/migration.mjs.map +1 -0
- package/dist/schema-verify.d.mts +1 -1
- package/dist/{types-CH9zsNrU.d.mts → types-C6K4mxDM.d.mts} +33 -3
- package/dist/types-C6K4mxDM.d.mts.map +1 -0
- package/dist/{verify-DZHtfcmj.mjs → verify-4GshvY4p.mjs} +25 -11
- package/dist/verify-4GshvY4p.mjs.map +1 -0
- package/dist/verify-sql-schema-Ovz7RXR5.mjs.map +1 -1
- package/dist/verify.d.mts.map +1 -1
- package/dist/verify.mjs +1 -1
- package/package.json +21 -20
- package/src/core/migrations/contract-to-schema-ir.ts +45 -5
- package/src/core/migrations/types.ts +35 -0
- package/src/core/sql-migration.ts +33 -0
- package/src/core/verify.ts +50 -32
- package/src/exports/control.ts +2 -0
- package/src/exports/migration.ts +1 -0
- package/dist/operation-descriptors.d.mts +0 -380
- package/dist/operation-descriptors.d.mts.map +0 -1
- package/dist/operation-descriptors.mjs +0 -294
- package/dist/operation-descriptors.mjs.map +0 -1
- package/dist/types-CH9zsNrU.d.mts.map +0 -1
- package/dist/verify-DZHtfcmj.mjs.map +0 -1
- package/src/core/migrations/descriptor-schemas.ts +0 -172
- package/src/core/migrations/operation-descriptors.ts +0 -213
- package/src/exports/operation-descriptors.ts +0 -52
package/dist/control.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as SqlPlannerFailureResult, C as SqlMigrationRunnerFailure, D as SqlPlannerConflict, E as SqlPlanTargetDetails, F as isDatabaseDependencyProvider, I as SchemaVerifyOptions, L as SqlControlFamilyInstance, M as SqlPlannerSuccessResult, N as StorageTypePlanResult, O as SqlPlannerConflictKind, P as collectInitDependencies, S as SqlMigrationRunnerExecuteOptions, T as SqlMigrationRunnerSuccessValue, _ as SqlMigrationPlanner, a as ComponentDatabaseDependency, b as SqlMigrationRunnerErrorCode, c as ResolveIdentityValueInput, d as SqlControlTargetDescriptor, f as SqlMigrationPlan, g as SqlMigrationPlanOperationTarget, h as SqlMigrationPlanOperationStep, i as ComponentDatabaseDependencies, j as SqlPlannerResult, k as SqlPlannerConflictLocation, l as SqlControlAdapterDescriptor, m as SqlMigrationPlanOperation, n as AnySqlMigrationOperation, o as CreateSqlMigrationPlanOptions, p as SqlMigrationPlanContractInfo, r as CodecControlHooks, s as ExpandNativeTypeInput, t as AnyRecord, u as SqlControlExtensionDescriptor, v as SqlMigrationPlannerPlanOptions, w as SqlMigrationRunnerResult, x as SqlMigrationRunnerExecuteCallbacks, y as SqlMigrationRunner } from "./types-C6K4mxDM.mjs";
|
|
2
2
|
import { ControlFamilyDescriptor, ControlStack, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, TargetMigrationsCapability, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
|
|
3
3
|
import { NotOk, Ok } from "@prisma-next/utils/result";
|
|
4
4
|
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
@@ -331,5 +331,5 @@ declare const INIT_ADDITIVE_POLICY: MigrationOperationPolicy$1;
|
|
|
331
331
|
//#region src/exports/control.d.ts
|
|
332
332
|
declare const _default: SqlFamilyDescriptor;
|
|
333
333
|
//#endregion
|
|
334
|
-
export { type CodecControlHooks, type ComponentDatabaseDependencies, type ComponentDatabaseDependency, type ContractToSchemaIROptions, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type ExpandNativeTypeInput, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type ResolveIdentityValueInput, type SchemaVerifyOptions, type SqlControlAdapterDescriptor, type SqlControlExtensionDescriptor, 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, type StorageTypePlanResult, type TargetMigrationsCapability, assembleAuthoringContributions, collectInitDependencies, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
|
|
334
|
+
export { type AnySqlMigrationOperation, type CodecControlHooks, type ComponentDatabaseDependencies, type ComponentDatabaseDependency, type ContractToSchemaIROptions, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type ExpandNativeTypeInput, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type ResolveIdentityValueInput, type SchemaVerifyOptions, type SqlControlAdapterDescriptor, type SqlControlExtensionDescriptor, 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 SqlPlanTargetDetails, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, type StorageTypePlanResult, type TargetMigrationsCapability, assembleAuthoringContributions, collectInitDependencies, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess };
|
|
335
335
|
//# sourceMappingURL=control.d.mts.map
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cASa,mBAAA,YACA,+BAA+B;;;;;;;uCAAwB,4BAAA,CAAA;;IADvD,SAAA,mBACX,EAAA,CAAA,QAAA,uCAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,GAAA,MAAA;IAA0C,SAAA,wBAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,KAAA,4CAAA,EAAA,GAAA,MAAA;IAAwB,SAAA,gBAAA,EAAA,GAAA,GAAA,MAAA,EAAA;0FAMhD;;;;;IAOW,SAAA,KAAA,EAAA;MAApB,SAAA,IAAA,EAAA;QACN,SAAA,IAAA,EAAA,aAAA;QAdQ,SAAA,MAAA,EAAA;UAAuB,SAAA,OAAA,EAAA,YAAA;;;;UCYpB,CAAA;QACa,CAAA;MAAd,CAAA;MACA,SAAA,IAAA,EAAA;QAAZ,SAAA,IAAA,EAAA,aAAA;QAAG,SAAA,MAAA,EAAA;;;;
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cASa,mBAAA,YACA,+BAA+B;;;;;;;uCAAwB,4BAAA,CAAA;;IADvD,SAAA,mBACX,EAAA,CAAA,QAAA,uCAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,GAAA,MAAA;IAA0C,SAAA,wBAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,KAAA,4CAAA,EAAA,GAAA,MAAA;IAAwB,SAAA,gBAAA,EAAA,GAAA,GAAA,MAAA,EAAA;0FAMhD;;;;;IAOW,SAAA,KAAA,EAAA;MAApB,SAAA,IAAA,EAAA;QACN,SAAA,IAAA,EAAA,aAAA;QAdQ,SAAA,MAAA,EAAA;UAAuB,SAAA,OAAA,EAAA,YAAA;;;;UCYpB,CAAA;QACa,CAAA;MAAd,CAAA;MACA,SAAA,IAAA,EAAA;QAAZ,SAAA,IAAA,EAAA,aAAA;QAAG,SAAA,MAAA,EAAA;;;;YCYM,SAAkB,MAGN,EAAA,EAAA;UAYZ,CAAA;QAuII,CAAA;MACR,CAAA;MACF,SAAA,MAAA,EAAA;QACM,SAAA,IAAA,EAAA,aAAA;QAAwB,SAAA,IAAA,EAAA,SAAA,CAAA;UAiCnB,SAAA,IAAyB,EAAA,QAAA;UAEZ,SAAA,QAAA,EAAA,IAAA;UACH,SAAA,UAAA,EAAA;YACoB,SAAA,IAAA,EAAA;cAAd,SAAA,IAAA,EAAA,QAAA;cAAa,SAAA,QAAA,EAAA,IAAA;cAkBZ,SAAA,OAAA,EAAA,IAAA;cACb,SAAA,OAAA,EAAA,CAAA;cAAT,SAAA,OAAA,EAAA,GA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A,CAAA,EAmCN,kBAnCM;EAiCnB,SAAA,aAAA,CAAA,EAGU,eAHe;EAEZ,SAAA,mBAAA,CAAA,EAEG,aAFH,CAEiB,8BAFjB,CAAA,KAAA,EAAA,MAAA,CAAA,CAAA;;;;;AAoB9B;;;;;;;;;ACvJA;;;AAEoB,iBDqJJ,kBAAA,CCrJI,QAAA,EDsJR,QCtJQ,CDsJC,UCtJD,CAAA,GAAA,IAAA,EAAA,OAAA,EDuJT,yBCvJS,CAAA,EDwJjB,WCxJiB;;;iBAFJ,6CACL,8BAA8B,kBACtC,iBAAiB;iBAYJ,qCACR,iBAAiB,kBACtB,wBAAwB;iBAOX,cAAA,qBAAmC,uBAAuB;;;;iBAoB1D,aAAA;;;AH/HhB,CAAA,CAAA,EGkII,EHlIS,CGkIN,8BHjIL,CAAA;;;;iBG6Ic,aAAA,OACR;;SAE2B;IAChC,MAAM;;;;;;cCtJI,sBAAsB;;;AJInC,cK2DiG,QL3DpF,EK2DoF,mBL1D/F"}
|
package/dist/control.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-BAR65pSK.mjs";
|
|
2
2
|
import { c as extractCodecControlHooks, o as collectInitDependencies, s as isDatabaseDependencyProvider, t as verifySqlSchema } from "./verify-sql-schema-Ovz7RXR5.mjs";
|
|
3
|
-
import { r as readMarker, t as collectSupportedCodecTypeIds } from "./verify-
|
|
3
|
+
import { r as readMarker, t as collectSupportedCodecTypeIds } from "./verify-4GshvY4p.mjs";
|
|
4
4
|
import { sqlEmission } from "@prisma-next/sql-contract-emitter";
|
|
5
5
|
import { emptyCodecLookup } from "@prisma-next/framework-components/codec";
|
|
6
6
|
import { SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MARKER_MISSING, VERIFY_CODE_TARGET_MISMATCH, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
|
|
@@ -394,18 +394,29 @@ var SqlFamilyDescriptor = class {
|
|
|
394
394
|
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/core/migrations/contract-to-schema-ir.ts
|
|
397
|
-
function convertColumn(name, column, expandNativeType, renderDefault) {
|
|
397
|
+
function convertColumn(name, column, storageTypes, expandNativeType, renderDefault) {
|
|
398
|
+
const resolved = resolveColumnTypeMetadata(column, storageTypes);
|
|
398
399
|
return {
|
|
399
400
|
name,
|
|
400
401
|
nativeType: expandNativeType ? expandNativeType({
|
|
401
|
-
nativeType:
|
|
402
|
-
codecId:
|
|
403
|
-
...ifDefined("typeParams",
|
|
404
|
-
}) :
|
|
402
|
+
nativeType: resolved.nativeType,
|
|
403
|
+
codecId: resolved.codecId,
|
|
404
|
+
...ifDefined("typeParams", resolved.typeParams)
|
|
405
|
+
}) : resolved.nativeType,
|
|
405
406
|
nullable: column.nullable,
|
|
406
407
|
...ifDefined("default", column.default != null && renderDefault ? renderDefault(column.default, column) : void 0)
|
|
407
408
|
};
|
|
408
409
|
}
|
|
410
|
+
function resolveColumnTypeMetadata(column, storageTypes) {
|
|
411
|
+
if (!column.typeRef) return column;
|
|
412
|
+
const referenced = storageTypes[column.typeRef];
|
|
413
|
+
if (!referenced) throw new Error(`Column references storage type "${column.typeRef}" but it is not defined in storage.types.`);
|
|
414
|
+
return {
|
|
415
|
+
codecId: referenced.codecId,
|
|
416
|
+
nativeType: referenced.nativeType,
|
|
417
|
+
typeParams: referenced.typeParams
|
|
418
|
+
};
|
|
419
|
+
}
|
|
409
420
|
function convertUnique(unique) {
|
|
410
421
|
return {
|
|
411
422
|
columns: unique.columns,
|
|
@@ -427,9 +438,9 @@ function convertForeignKey(fk) {
|
|
|
427
438
|
...ifDefined("name", fk.name)
|
|
428
439
|
};
|
|
429
440
|
}
|
|
430
|
-
function convertTable(name, table, expandNativeType, renderDefault) {
|
|
441
|
+
function convertTable(name, table, storageTypes, expandNativeType, renderDefault) {
|
|
431
442
|
const columns = {};
|
|
432
|
-
for (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, expandNativeType, renderDefault);
|
|
443
|
+
for (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault);
|
|
433
444
|
const satisfiedIndexColumns = new Set([
|
|
434
445
|
...table.indexes.map((idx) => idx.columns.join(",")),
|
|
435
446
|
...table.uniques.map((unique) => unique.columns.join(",")),
|
|
@@ -509,8 +520,9 @@ function contractToSchemaIR(contract, options) {
|
|
|
509
520
|
dependencies: []
|
|
510
521
|
};
|
|
511
522
|
const storage = contract.storage;
|
|
523
|
+
const storageTypes = storage.types ?? {};
|
|
512
524
|
const tables = {};
|
|
513
|
-
for (const [tableName, tableDef] of Object.entries(storage.tables)) tables[tableName] = convertTable(tableName, tableDef, options.expandNativeType, options.renderDefault);
|
|
525
|
+
for (const [tableName, tableDef] of Object.entries(storage.tables)) tables[tableName] = convertTable(tableName, tableDef, storageTypes, options.expandNativeType, options.renderDefault);
|
|
514
526
|
return {
|
|
515
527
|
tables,
|
|
516
528
|
dependencies: deduplicateDependencyIRs(collectInitDependencies(options.frameworkComponents ?? [])),
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":["contract: { storageHash: string; profileHash?: string }","target: { expected: string; actual?: string }","meta: { contractPath: string; configPath?: string }","result: VerifyDatabaseResult","sqlValidateContract","missingCodecs: readonly string[] | undefined","previousHashes: { storageHash?: string; profileHash?: string } | undefined","summary: string","tableNodes: readonly SchemaTreeNode[]","children: SchemaTreeNode[]","columnNodes: SchemaTreeNode[]","tableMeta: Record<string, unknown>","dependencyNodes: readonly SchemaTreeNode[]","columns: Record<string, SqlColumnIR>","fkBackingIndexes: SqlIndexIR[]","conflicts: MigrationPlannerConflict[]","tables: Record<string, SqlTableIR>","result: DependencyIR[]","byNativeType: Record<string, (typeof storage.types)[string]>","readOnlyEmptyObject: Record<string, never>","INIT_ADDITIVE_POLICY: MigrationOperationPolicy"],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":["import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';\nimport { emptyCodecLookup } from '@prisma-next/framework-components/codec';\nimport type {\n TargetBoundComponentDescriptor,\n TargetDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type {\n ControlDriverInstance,\n ControlFamilyInstance,\n ControlStack,\n CoreSchemaView,\n OperationContext,\n SchemaViewCapable,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport {\n SchemaTreeNode,\n VERIFY_CODE_HASH_MISMATCH,\n VERIFY_CODE_MARKER_MISSING,\n VERIFY_CODE_TARGET_MISMATCH,\n} from '@prisma-next/framework-components/control';\nimport type { TypesImportSpec } from '@prisma-next/framework-components/emission';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { validateContract as sqlValidateContract } from '@prisma-next/sql-contract/validate';\nimport {\n ensureSchemaStatement,\n ensureTableStatement,\n writeContractMarker,\n} from '@prisma-next/sql-runtime';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type { SqlSchemaIR, SqlTableIR } from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { SqlControlAdapter } from './control-adapter';\nimport type {\n SqlControlAdapterDescriptor,\n SqlControlExtensionDescriptor,\n} from './migrations/types';\nimport { verifySqlSchema } from './schema-verify/verify-sql-schema';\nimport { collectSupportedCodecTypeIds, readMarker } from './verify';\n\nfunction extractCodecTypeIdsFromContract(contract: unknown): readonly string[] {\n const typeIds = new Set<string>();\n\n // Type guard for SQL contract structure\n if (\n typeof contract === 'object' &&\n contract !== null &&\n 'storage' in contract &&\n typeof contract.storage === 'object' &&\n contract.storage !== null &&\n 'tables' in contract.storage\n ) {\n const storage = contract.storage as { tables?: Record<string, unknown> };\n if (storage.tables && typeof storage.tables === 'object') {\n for (const table of Object.values(storage.tables)) {\n if (\n typeof table === 'object' &&\n table !== null &&\n 'columns' in table &&\n typeof table.columns === 'object' &&\n table.columns !== null\n ) {\n const columns = table.columns as Record<string, { codecId: string } | undefined>;\n for (const column of Object.values(columns)) {\n if (\n column &&\n typeof column === 'object' &&\n 'codecId' in column &&\n typeof column.codecId === 'string'\n ) {\n typeIds.add(column.codecId);\n }\n }\n }\n }\n }\n }\n\n return Array.from(typeIds).sort();\n}\n\nfunction createVerifyResult(options: {\n ok: boolean;\n code?: string;\n summary: string;\n contractStorageHash: string;\n contractProfileHash?: string;\n marker?: ContractMarkerRecord;\n expectedTargetId: string;\n actualTargetId?: string;\n missingCodecs?: readonly string[];\n codecCoverageSkipped?: boolean;\n configPath?: string;\n contractPath: string;\n totalTime: number;\n}): VerifyDatabaseResult {\n const contract: { storageHash: string; profileHash?: string } = {\n storageHash: options.contractStorageHash,\n };\n if (options.contractProfileHash) {\n contract.profileHash = options.contractProfileHash;\n }\n\n const target: { expected: string; actual?: string } = {\n expected: options.expectedTargetId,\n };\n if (options.actualTargetId) {\n target.actual = options.actualTargetId;\n }\n\n const meta: { contractPath: string; configPath?: string } = {\n contractPath: options.contractPath,\n };\n if (options.configPath) {\n meta.configPath = options.configPath;\n }\n\n const result: VerifyDatabaseResult = {\n ok: options.ok,\n summary: options.summary,\n contract,\n target,\n meta,\n timings: {\n total: options.totalTime,\n },\n };\n\n if (options.code) {\n (result as { code?: string }).code = options.code;\n }\n\n if (options.marker) {\n (result as { marker?: { storageHash: string; profileHash: string } }).marker = {\n storageHash: options.marker.storageHash,\n profileHash: options.marker.profileHash,\n };\n }\n\n if (options.missingCodecs) {\n (result as { missingCodecs?: readonly string[] }).missingCodecs = options.missingCodecs;\n }\n\n if (options.codecCoverageSkipped) {\n (result as { codecCoverageSkipped?: boolean }).codecCoverageSkipped =\n options.codecCoverageSkipped;\n }\n\n return result;\n}\n\ninterface SqlTypeMetadata {\n readonly typeId: string;\n readonly familyId: 'sql';\n readonly targetId: string;\n readonly nativeType?: string;\n}\n\ntype SqlTypeMetadataRegistry = Map<string, SqlTypeMetadata>;\n\ninterface SqlFamilyInstanceState {\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly typeMetadataRegistry: SqlTypeMetadataRegistry;\n}\n\nexport interface SchemaVerifyOptions {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly strict: boolean;\n readonly context?: OperationContext;\n /**\n * Active framework components participating in this composition.\n * All components must have matching familyId ('sql') and targetId.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\nexport interface SqlControlFamilyInstance\n extends ControlFamilyInstance<'sql', SqlSchemaIR>,\n SchemaViewCapable<SqlSchemaIR>,\n SqlFamilyInstanceState {\n validateContract(contractJson: unknown): Contract;\n\n verify(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult>;\n\n schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;\n\n sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult>;\n\n introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR>;\n}\n\nexport type SqlFamilyInstance = SqlControlFamilyInstance;\n\nfunction isSqlControlAdapter<TTargetId extends string>(\n value: unknown,\n): value is SqlControlAdapter<TTargetId> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'introspect' in value &&\n typeof (value as { introspect: unknown }).introspect === 'function'\n );\n}\n\ninterface DescriptorWithStorageTypes {\n readonly targetId?: string | undefined;\n readonly types?:\n | {\n readonly storage?:\n | ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string | undefined;\n }>\n | undefined;\n }\n | undefined;\n}\n\nfunction buildSqlTypeMetadataRegistry(options: {\n readonly target: DescriptorWithStorageTypes;\n readonly adapter: DescriptorWithStorageTypes & { readonly targetId: string };\n readonly extensionPacks: readonly DescriptorWithStorageTypes[];\n}): SqlTypeMetadataRegistry {\n const { target, adapter, extensionPacks: extensions } = options;\n const registry = new Map<string, SqlTypeMetadata>();\n const targetId = adapter.targetId;\n const descriptors = [target, adapter, ...extensions];\n\n for (const descriptor of descriptors) {\n const types = descriptor.types;\n const storageTypes = types?.storage;\n\n if (!storageTypes) {\n continue;\n }\n\n for (const storageType of storageTypes) {\n if (storageType.familyId === 'sql' && storageType.targetId === targetId) {\n registry.set(storageType.typeId, {\n typeId: storageType.typeId,\n familyId: 'sql',\n targetId: storageType.targetId,\n ...(storageType.nativeType !== undefined ? { nativeType: storageType.nativeType } : {}),\n });\n }\n }\n }\n\n return registry;\n}\n\nexport function createSqlFamilyInstance<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n): SqlFamilyInstance {\n if (!stack.adapter) {\n throw new Error('SQL family requires an adapter descriptor in ControlStack');\n }\n\n const target = stack.target as unknown as TargetDescriptor<'sql', TTargetId> &\n DescriptorWithStorageTypes;\n const adapter = stack.adapter as unknown as SqlControlAdapterDescriptor<TTargetId> &\n DescriptorWithStorageTypes;\n const extensions =\n stack.extensionPacks as unknown as readonly (SqlControlExtensionDescriptor<TTargetId> &\n DescriptorWithStorageTypes)[];\n\n const { codecTypeImports, operationTypeImports, extensionIds } = stack;\n\n const typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n target,\n adapter,\n extensionPacks: extensions,\n });\n\n return {\n familyId: 'sql',\n codecTypeImports,\n operationTypeImports,\n extensionIds,\n typeMetadataRegistry,\n\n validateContract(contractJson: unknown): Contract {\n return sqlValidateContract<Contract<SqlStorage>>(contractJson, emptyCodecLookup);\n },\n\n async verify(verifyOptions: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult> {\n const {\n driver,\n contract: rawContract,\n expectedTargetId,\n contractPath,\n configPath,\n } = verifyOptions;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(rawContract, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n const contractTarget = contract.target;\n\n const marker = await readMarker(driver);\n\n let missingCodecs: readonly string[] | undefined;\n let codecCoverageSkipped = false;\n const supportedTypeIds = collectSupportedCodecTypeIds([adapter, target, ...extensions]);\n if (supportedTypeIds.length === 0) {\n codecCoverageSkipped = true;\n } else {\n const supportedSet = new Set(supportedTypeIds);\n const usedTypeIds = extractCodecTypeIdsFromContract(contract);\n const missing = usedTypeIds.filter((id) => !supportedSet.has(id));\n if (missing.length > 0) {\n missingCodecs = missing;\n }\n }\n\n if (!marker) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_MARKER_MISSING,\n summary: 'Marker missing',\n contractStorageHash,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractTarget !== expectedTargetId) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_TARGET_MISMATCH,\n summary: 'Target mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n actualTargetId: contractTarget,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (marker.storageHash !== contractStorageHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractProfileHash && marker.profileHash !== contractProfileHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n contractProfileHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: true,\n summary: 'Database matches contract',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n },\n\n async schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult> {\n const { driver, contract: contractInput, strict, context, frameworkComponents } = options;\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n const schemaIR = await controlAdapter.introspect(driver, contractInput);\n\n return verifySqlSchema({\n contract,\n schema: schemaIR,\n strict,\n ...ifDefined('context', context),\n typeMetadataRegistry,\n frameworkComponents,\n // Wire up target-specific normalizers if available\n ...ifDefined('normalizeDefault', controlAdapter.normalizeDefault),\n ...ifDefined('normalizeNativeType', controlAdapter.normalizeNativeType),\n });\n },\n async sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult> {\n const { driver, contract: contractInput, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash =\n 'profileHash' in contract && typeof contract.profileHash === 'string'\n ? contract.profileHash\n : contractStorageHash;\n const contractTarget = contract.target;\n\n await driver.query(ensureSchemaStatement.sql, ensureSchemaStatement.params);\n await driver.query(ensureTableStatement.sql, ensureTableStatement.params);\n\n const existingMarker = await readMarker(driver);\n\n let markerCreated = false;\n let markerUpdated = false;\n let previousHashes: { storageHash?: string; profileHash?: string } | undefined;\n\n if (!existingMarker) {\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: 1,\n });\n await driver.query(write.insert.sql, write.insert.params);\n markerCreated = true;\n } else {\n const existingStorageHash = existingMarker.storageHash;\n const existingProfileHash = existingMarker.profileHash;\n\n const storageHashMatches = existingStorageHash === contractStorageHash;\n const profileHashMatches = existingProfileHash === contractProfileHash;\n\n if (!storageHashMatches || !profileHashMatches) {\n previousHashes = {\n storageHash: existingStorageHash,\n profileHash: existingProfileHash,\n };\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: existingMarker.canonicalVersion ?? 1,\n });\n await driver.query(write.update.sql, write.update.params);\n markerUpdated = true;\n }\n }\n\n let summary: string;\n if (markerCreated) {\n summary = 'Database signed (marker created)';\n } else if (markerUpdated) {\n summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? 'unknown'})`;\n } else {\n summary = 'Database already signed with this contract';\n }\n\n const totalTime = Date.now() - startTime;\n\n return {\n ok: true,\n summary,\n contract: {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n target: {\n expected: contractTarget,\n actual: contractTarget,\n },\n marker: {\n created: markerCreated,\n updated: markerUpdated,\n ...(previousHashes ? { previous: previousHashes } : {}),\n },\n meta: {\n contractPath,\n ...(configPath ? { configPath } : {}),\n },\n timings: {\n total: totalTime,\n },\n };\n },\n async readMarker(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n }): Promise<ContractMarkerRecord | null> {\n return readMarker(options.driver);\n },\n async introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR> {\n const { driver, contract } = options;\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n return controlAdapter.introspect(driver, contract);\n },\n\n toSchemaView(schema: SqlSchemaIR): CoreSchemaView {\n const tableNodes: readonly SchemaTreeNode[] = Object.entries(schema.tables).map(\n ([tableName, table]: [string, SqlTableIR]) => {\n const children: SchemaTreeNode[] = [];\n\n const columnNodes: SchemaTreeNode[] = [];\n for (const [columnName, column] of Object.entries(table.columns)) {\n const typeDisplay = column.nativeType;\n const nullability = column.nullable ? 'nullable' : 'not nullable';\n const label = `${columnName}: ${typeDisplay} (${nullability})`;\n columnNodes.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `column-${tableName}-${columnName}`,\n label,\n meta: {\n nativeType: column.nativeType,\n nullable: column.nullable,\n ...ifDefined('default', column.default),\n },\n }),\n );\n }\n\n if (columnNodes.length > 0) {\n children.push(\n new SchemaTreeNode({\n kind: 'collection',\n id: `columns-${tableName}`,\n label: 'columns',\n children: columnNodes,\n }),\n );\n }\n\n if (table.primaryKey) {\n const pkColumns = table.primaryKey.columns.join(', ');\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `primary-key-${tableName}`,\n label: `primary key: ${pkColumns}`,\n meta: {\n columns: table.primaryKey.columns,\n ...(table.primaryKey.name ? { name: table.primaryKey.name } : {}),\n },\n }),\n );\n }\n\n for (const unique of table.uniques) {\n const name = unique.name ?? `${tableName}_${unique.columns.join('_')}_unique`;\n const label = `unique ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `unique-${tableName}-${name}`,\n label,\n meta: {\n columns: unique.columns,\n unique: true,\n },\n }),\n );\n }\n\n for (const index of table.indexes) {\n const name = index.name ?? defaultIndexName(tableName, index.columns);\n const label = index.unique ? `unique index ${name}` : `index ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `index-${tableName}-${name}`,\n label,\n meta: {\n columns: index.columns,\n unique: index.unique,\n },\n }),\n );\n }\n\n const tableMeta: Record<string, unknown> = {};\n if (table.primaryKey) {\n tableMeta['primaryKey'] = table.primaryKey.columns;\n if (table.primaryKey.name) {\n tableMeta['primaryKeyName'] = table.primaryKey.name;\n }\n }\n if (table.foreignKeys.length > 0) {\n tableMeta['foreignKeys'] = table.foreignKeys.map((fk) => ({\n columns: fk.columns,\n referencedTable: fk.referencedTable,\n referencedColumns: fk.referencedColumns,\n ...(fk.name ? { name: fk.name } : {}),\n }));\n }\n\n return new SchemaTreeNode({\n kind: 'entity',\n id: `table-${tableName}`,\n label: `table ${tableName}`,\n ...(Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {}),\n ...(children.length > 0 ? { children } : {}),\n });\n },\n );\n\n const dependencyNodes: readonly SchemaTreeNode[] = schema.dependencies.map((dep) => {\n const shortName = dep.id.split('.').pop() ?? dep.id;\n return new SchemaTreeNode({\n kind: 'dependency',\n id: `dependency-${dep.id}`,\n label: `${shortName} dependency is installed`,\n });\n });\n\n const rootChildren = [...tableNodes, ...dependencyNodes];\n\n return {\n root: new SchemaTreeNode({\n kind: 'root',\n id: 'sql-schema',\n label: 'database',\n ...(rootChildren.length > 0 ? { children: rootChildren } : {}),\n }),\n };\n },\n };\n}\n","import type {\n ControlFamilyDescriptor,\n ControlStack,\n} from '@prisma-next/framework-components/control';\nimport { sqlEmission } from '@prisma-next/sql-contract-emitter';\nimport { sqlFamilyAuthoringFieldPresets } from './authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from './authoring-type-constructors';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './control-instance';\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 version = '0.0.1';\n readonly emission = sqlEmission;\n readonly authoring = {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n } as const;\n\n create<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n ): SqlControlFamilyInstance {\n return createSqlFamilyInstance(stack);\n }\n}\n","import type { ColumnDefault, Contract } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type { MigrationPlannerConflict } from '@prisma-next/framework-components/control';\nimport type {\n ForeignKey,\n Index,\n SqlStorage,\n StorageColumn,\n StorageTable,\n UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type {\n DependencyIR,\n SqlAnnotations,\n SqlColumnIR,\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlTableIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { collectInitDependencies } from './types';\n\n/**\n * Target-specific callback that expands a column's base `nativeType` and optional\n * `typeParams` into the fully-qualified type string used by the database\n * (e.g. `character` + `{ length: 36 }` → `character(36)`).\n *\n * This lives in the family layer as a callback rather than importing a concrete\n * implementation because each target (Postgres, MySQL, SQLite, …) has its own\n * parameterization syntax. The target wires its expander when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type NativeTypeExpander = (input: {\n readonly nativeType: string;\n readonly codecId?: string;\n readonly typeParams?: Record<string, unknown>;\n}) => string;\n\n/**\n * Target-specific callback that renders a `ColumnDefault` into the raw SQL literal\n * string stored in `SqlColumnIR.default`.\n *\n * Default value serialization is target-specific (quoting, casting, type syntax vary\n * between Postgres, MySQL, SQLite, …). This callback follows the same IoC pattern as\n * `NativeTypeExpander`: the target provides its renderer when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type DefaultRenderer = (def: ColumnDefault, column: StorageColumn) => string;\n\nfunction convertColumn(\n name: string,\n column: StorageColumn,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlColumnIR {\n const nativeType = expandNativeType\n ? expandNativeType({\n nativeType: column.nativeType,\n codecId: column.codecId,\n ...ifDefined('typeParams', column.typeParams),\n })\n : column.nativeType;\n return {\n name,\n nativeType,\n nullable: column.nullable,\n ...ifDefined(\n 'default',\n column.default != null && renderDefault ? renderDefault(column.default, column) : undefined,\n ),\n };\n}\n\nfunction convertUnique(unique: UniqueConstraint): SqlUniqueIR {\n return {\n columns: unique.columns,\n ...ifDefined('name', unique.name),\n };\n}\n\nfunction convertIndex(index: Index): SqlIndexIR {\n return {\n columns: index.columns,\n unique: false,\n ...ifDefined('name', index.name),\n };\n}\n\nfunction convertForeignKey(fk: ForeignKey): SqlForeignKeyIR {\n return {\n columns: fk.columns,\n referencedTable: fk.references.table,\n referencedColumns: fk.references.columns,\n ...ifDefined('name', fk.name),\n };\n}\n\nfunction convertTable(\n name: string,\n table: StorageTable,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlTableIR {\n const columns: Record<string, SqlColumnIR> = {};\n for (const [colName, colDef] of Object.entries(table.columns)) {\n columns[colName] = convertColumn(colName, colDef, expandNativeType, renderDefault);\n }\n\n const satisfiedIndexColumns = new Set([\n ...table.indexes.map((idx) => idx.columns.join(',')),\n ...table.uniques.map((unique) => unique.columns.join(',')),\n ...(table.primaryKey ? [table.primaryKey.columns.join(',')] : []),\n ]);\n const fkBackingIndexes: SqlIndexIR[] = [];\n for (const fk of table.foreignKeys) {\n if (fk.index === false) continue;\n const key = fk.columns.join(',');\n if (satisfiedIndexColumns.has(key)) continue;\n fkBackingIndexes.push({\n columns: fk.columns,\n unique: false,\n name: defaultIndexName(name, fk.columns),\n });\n satisfiedIndexColumns.add(key);\n }\n\n return {\n name,\n columns,\n ...ifDefined('primaryKey', table.primaryKey),\n foreignKeys: table.foreignKeys.map(convertForeignKey),\n uniques: table.uniques.map(convertUnique),\n indexes: [...table.indexes.map(convertIndex), ...fkBackingIndexes],\n };\n}\n\n/**\n * Detects destructive changes between two contract storages.\n *\n * The additive-only planner silently ignores removals (tables, columns).\n * This function detects those removals so callers can report them as conflicts\n * rather than silently producing an empty plan.\n *\n * Returns an empty array if no destructive changes are found.\n */\nexport function detectDestructiveChanges(\n from: SqlStorage | null,\n to: SqlStorage,\n): readonly MigrationPlannerConflict[] {\n if (!from) return [];\n\n const hasOwn = (value: object, key: string): boolean => Object.hasOwn(value, key);\n\n const conflicts: MigrationPlannerConflict[] = [];\n\n for (const tableName of Object.keys(from.tables)) {\n if (!hasOwn(to.tables, tableName)) {\n conflicts.push({\n kind: 'tableRemoved',\n summary: `Table \"${tableName}\" was removed`,\n });\n continue;\n }\n\n const toTable = to.tables[tableName] as StorageTable;\n const fromTable = from.tables[tableName];\n if (!fromTable) continue;\n\n for (const columnName of Object.keys(fromTable.columns)) {\n if (!hasOwn(toTable.columns, columnName)) {\n conflicts.push({\n kind: 'columnRemoved',\n summary: `Column \"${tableName}\".\"${columnName}\" was removed`,\n });\n }\n }\n }\n\n return conflicts;\n}\n\nexport interface ContractToSchemaIROptions {\n readonly annotationNamespace: string;\n readonly expandNativeType?: NativeTypeExpander;\n readonly renderDefault?: DefaultRenderer;\n readonly frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Converts a `Contract` to `SqlSchemaIR`.\n *\n * Reads `contract.storage` for tables, `contract.storage.types` for type\n * annotations, and derives database dependencies from `frameworkComponents`\n * (each component's `databaseDependencies.init[].id`).\n * Storage-type annotations are written under `options.annotationNamespace`.\n *\n * Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n * structural information. When `expandNativeType` is provided, parameterized types\n * are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n * resulting IR compares correctly against the \"to\" contract during planning.\n *\n * Returns an empty schema IR when `contract` is `null` (new project).\n */\nexport function contractToSchemaIR(\n contract: Contract<SqlStorage> | null,\n options: ContractToSchemaIROptions,\n): SqlSchemaIR {\n if (options.annotationNamespace.length === 0) {\n throw new Error('annotationNamespace must be a non-empty string');\n }\n\n if (!contract) {\n return { tables: {}, dependencies: [] };\n }\n\n const storage = contract.storage;\n const tables: Record<string, SqlTableIR> = {};\n for (const [tableName, tableDef] of Object.entries(storage.tables)) {\n tables[tableName] = convertTable(\n tableName,\n tableDef,\n options.expandNativeType,\n options.renderDefault,\n );\n }\n\n const dependencies = deduplicateDependencyIRs(\n collectInitDependencies(options.frameworkComponents ?? []),\n );\n const annotations = deriveAnnotations(storage, options.annotationNamespace);\n\n return {\n tables,\n dependencies,\n ...ifDefined('annotations', annotations),\n };\n}\n\nfunction deduplicateDependencyIRs(\n deps: readonly { readonly id: string }[],\n): readonly DependencyIR[] {\n const seen = new Set<string>();\n const result: DependencyIR[] = [];\n for (const dep of deps) {\n if (dep.id.trim().length === 0) {\n throw new Error('Dependency id must be a non-empty string');\n }\n if (seen.has(dep.id)) continue;\n seen.add(dep.id);\n result.push({ id: dep.id });\n }\n return result;\n}\n\nfunction deriveAnnotations(\n storage: SqlStorage,\n annotationNamespace: string,\n): SqlAnnotations | undefined {\n if (!storage.types || Object.keys(storage.types).length === 0) return undefined;\n // Re-key by nativeType to match the structure produced by introspection\n const byNativeType: Record<string, (typeof storage.types)[string]> = {};\n for (const typeInstance of Object.values(storage.types)) {\n byNativeType[typeInstance.nativeType] = typeInstance;\n }\n return { [annotationNamespace]: { storageTypes: byNativeType } };\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>(\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/framework-components/control';\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/control-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/framework-components/control';\nexport { assembleAuthoringContributions } from '@prisma-next/framework-components/control';\nexport { extractCodecControlHooks } from '../core/assembly';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/control-instance';\nexport type {\n ContractToSchemaIROptions,\n DefaultRenderer,\n NativeTypeExpander,\n} from '../core/migrations/contract-to-schema-ir';\n// Contract → SchemaIR conversion for offline migration planning\nexport {\n contractToSchemaIR,\n detectDestructiveChanges,\n} from '../core/migrations/contract-to-schema-ir';\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';\nexport type {\n CodecControlHooks,\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n CreateSqlMigrationPlanOptions,\n ExpandNativeTypeInput,\n ResolveIdentityValueInput,\n SqlControlAdapterDescriptor,\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 StorageTypePlanResult,\n} from '../core/migrations/types';\nexport { collectInitDependencies, isDatabaseDependencyProvider } from '../core/migrations/types';\n\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;;;;;;;AA0CA,SAAS,gCAAgC,UAAsC;CAC7E,MAAM,0BAAU,IAAI,KAAa;AAGjC,KACE,OAAO,aAAa,YACpB,aAAa,QACb,aAAa,YACb,OAAO,SAAS,YAAY,YAC5B,SAAS,YAAY,QACrB,YAAY,SAAS,SACrB;EACA,MAAM,UAAU,SAAS;AACzB,MAAI,QAAQ,UAAU,OAAO,QAAQ,WAAW,UAC9C;QAAK,MAAM,SAAS,OAAO,OAAO,QAAQ,OAAO,CAC/C,KACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACb,OAAO,MAAM,YAAY,YACzB,MAAM,YAAY,MAClB;IACA,MAAM,UAAU,MAAM;AACtB,SAAK,MAAM,UAAU,OAAO,OAAO,QAAQ,CACzC,KACE,UACA,OAAO,WAAW,YAClB,aAAa,UACb,OAAO,OAAO,YAAY,SAE1B,SAAQ,IAAI,OAAO,QAAQ;;;;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expected: string; actual?: string }","meta: { contractPath: string; configPath?: string }","result: VerifyDatabaseResult","sqlValidateContract","missingCodecs: readonly string[] | undefined","previousHashes: { storageHash?: string; profileHash?: string } | undefined","summary: string","tableNodes: readonly SchemaTreeNode[]","children: SchemaTreeNode[]","columnNodes: SchemaTreeNode[]","tableMeta: Record<string, unknown>","dependencyNodes: readonly SchemaTreeNode[]","columns: Record<string, SqlColumnIR>","fkBackingIndexes: SqlIndexIR[]","conflicts: MigrationPlannerConflict[]","tables: Record<string, SqlTableIR>","result: DependencyIR[]","byNativeType: Record<string, (typeof storage.types)[string]>","readOnlyEmptyObject: Record<string, never>","INIT_ADDITIVE_POLICY: MigrationOperationPolicy"],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":["import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';\nimport { emptyCodecLookup } from '@prisma-next/framework-components/codec';\nimport type {\n TargetBoundComponentDescriptor,\n TargetDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type {\n ControlDriverInstance,\n ControlFamilyInstance,\n ControlStack,\n CoreSchemaView,\n OperationContext,\n SchemaViewCapable,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport {\n SchemaTreeNode,\n VERIFY_CODE_HASH_MISMATCH,\n VERIFY_CODE_MARKER_MISSING,\n VERIFY_CODE_TARGET_MISMATCH,\n} from '@prisma-next/framework-components/control';\nimport type { TypesImportSpec } from '@prisma-next/framework-components/emission';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { validateContract as sqlValidateContract } from '@prisma-next/sql-contract/validate';\nimport {\n ensureSchemaStatement,\n ensureTableStatement,\n writeContractMarker,\n} from '@prisma-next/sql-runtime';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type { SqlSchemaIR, SqlTableIR } from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { SqlControlAdapter } from './control-adapter';\nimport type {\n SqlControlAdapterDescriptor,\n SqlControlExtensionDescriptor,\n} from './migrations/types';\nimport { verifySqlSchema } from './schema-verify/verify-sql-schema';\nimport { collectSupportedCodecTypeIds, readMarker } from './verify';\n\nfunction extractCodecTypeIdsFromContract(contract: unknown): readonly string[] {\n const typeIds = new Set<string>();\n\n // Type guard for SQL contract structure\n if (\n typeof contract === 'object' &&\n contract !== null &&\n 'storage' in contract &&\n typeof contract.storage === 'object' &&\n contract.storage !== null &&\n 'tables' in contract.storage\n ) {\n const storage = contract.storage as { tables?: Record<string, unknown> };\n if (storage.tables && typeof storage.tables === 'object') {\n for (const table of Object.values(storage.tables)) {\n if (\n typeof table === 'object' &&\n table !== null &&\n 'columns' in table &&\n typeof table.columns === 'object' &&\n table.columns !== null\n ) {\n const columns = table.columns as Record<string, { codecId: string } | undefined>;\n for (const column of Object.values(columns)) {\n if (\n column &&\n typeof column === 'object' &&\n 'codecId' in column &&\n typeof column.codecId === 'string'\n ) {\n typeIds.add(column.codecId);\n }\n }\n }\n }\n }\n }\n\n return Array.from(typeIds).sort();\n}\n\nfunction createVerifyResult(options: {\n ok: boolean;\n code?: string;\n summary: string;\n contractStorageHash: string;\n contractProfileHash?: string;\n marker?: ContractMarkerRecord;\n expectedTargetId: string;\n actualTargetId?: string;\n missingCodecs?: readonly string[];\n codecCoverageSkipped?: boolean;\n configPath?: string;\n contractPath: string;\n totalTime: number;\n}): VerifyDatabaseResult {\n const contract: { storageHash: string; profileHash?: string } = {\n storageHash: options.contractStorageHash,\n };\n if (options.contractProfileHash) {\n contract.profileHash = options.contractProfileHash;\n }\n\n const target: { expected: string; actual?: string } = {\n expected: options.expectedTargetId,\n };\n if (options.actualTargetId) {\n target.actual = options.actualTargetId;\n }\n\n const meta: { contractPath: string; configPath?: string } = {\n contractPath: options.contractPath,\n };\n if (options.configPath) {\n meta.configPath = options.configPath;\n }\n\n const result: VerifyDatabaseResult = {\n ok: options.ok,\n summary: options.summary,\n contract,\n target,\n meta,\n timings: {\n total: options.totalTime,\n },\n };\n\n if (options.code) {\n (result as { code?: string }).code = options.code;\n }\n\n if (options.marker) {\n (result as { marker?: { storageHash: string; profileHash: string } }).marker = {\n storageHash: options.marker.storageHash,\n profileHash: options.marker.profileHash,\n };\n }\n\n if (options.missingCodecs) {\n (result as { missingCodecs?: readonly string[] }).missingCodecs = options.missingCodecs;\n }\n\n if (options.codecCoverageSkipped) {\n (result as { codecCoverageSkipped?: boolean }).codecCoverageSkipped =\n options.codecCoverageSkipped;\n }\n\n return result;\n}\n\ninterface SqlTypeMetadata {\n readonly typeId: string;\n readonly familyId: 'sql';\n readonly targetId: string;\n readonly nativeType?: string;\n}\n\ntype SqlTypeMetadataRegistry = Map<string, SqlTypeMetadata>;\n\ninterface SqlFamilyInstanceState {\n readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly operationTypeImports: ReadonlyArray<TypesImportSpec>;\n readonly extensionIds: ReadonlyArray<string>;\n readonly typeMetadataRegistry: SqlTypeMetadataRegistry;\n}\n\nexport interface SchemaVerifyOptions {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly strict: boolean;\n readonly context?: OperationContext;\n /**\n * Active framework components participating in this composition.\n * All components must have matching familyId ('sql') and targetId.\n */\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\nexport interface SqlControlFamilyInstance\n extends ControlFamilyInstance<'sql', SqlSchemaIR>,\n SchemaViewCapable<SqlSchemaIR>,\n SqlFamilyInstanceState {\n validateContract(contractJson: unknown): Contract;\n\n verify(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult>;\n\n schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;\n\n sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult>;\n\n introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR>;\n}\n\nexport type SqlFamilyInstance = SqlControlFamilyInstance;\n\nfunction isSqlControlAdapter<TTargetId extends string>(\n value: unknown,\n): value is SqlControlAdapter<TTargetId> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'introspect' in value &&\n typeof (value as { introspect: unknown }).introspect === 'function'\n );\n}\n\ninterface DescriptorWithStorageTypes {\n readonly targetId?: string | undefined;\n readonly types?:\n | {\n readonly storage?:\n | ReadonlyArray<{\n readonly typeId: string;\n readonly familyId: string;\n readonly targetId: string;\n readonly nativeType?: string | undefined;\n }>\n | undefined;\n }\n | undefined;\n}\n\nfunction buildSqlTypeMetadataRegistry(options: {\n readonly target: DescriptorWithStorageTypes;\n readonly adapter: DescriptorWithStorageTypes & { readonly targetId: string };\n readonly extensionPacks: readonly DescriptorWithStorageTypes[];\n}): SqlTypeMetadataRegistry {\n const { target, adapter, extensionPacks: extensions } = options;\n const registry = new Map<string, SqlTypeMetadata>();\n const targetId = adapter.targetId;\n const descriptors = [target, adapter, ...extensions];\n\n for (const descriptor of descriptors) {\n const types = descriptor.types;\n const storageTypes = types?.storage;\n\n if (!storageTypes) {\n continue;\n }\n\n for (const storageType of storageTypes) {\n if (storageType.familyId === 'sql' && storageType.targetId === targetId) {\n registry.set(storageType.typeId, {\n typeId: storageType.typeId,\n familyId: 'sql',\n targetId: storageType.targetId,\n ...(storageType.nativeType !== undefined ? { nativeType: storageType.nativeType } : {}),\n });\n }\n }\n }\n\n return registry;\n}\n\nexport function createSqlFamilyInstance<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n): SqlFamilyInstance {\n if (!stack.adapter) {\n throw new Error('SQL family requires an adapter descriptor in ControlStack');\n }\n\n const target = stack.target as unknown as TargetDescriptor<'sql', TTargetId> &\n DescriptorWithStorageTypes;\n const adapter = stack.adapter as unknown as SqlControlAdapterDescriptor<TTargetId> &\n DescriptorWithStorageTypes;\n const extensions =\n stack.extensionPacks as unknown as readonly (SqlControlExtensionDescriptor<TTargetId> &\n DescriptorWithStorageTypes)[];\n\n const { codecTypeImports, operationTypeImports, extensionIds } = stack;\n\n const typeMetadataRegistry = buildSqlTypeMetadataRegistry({\n target,\n adapter,\n extensionPacks: extensions,\n });\n\n return {\n familyId: 'sql',\n codecTypeImports,\n operationTypeImports,\n extensionIds,\n typeMetadataRegistry,\n\n validateContract(contractJson: unknown): Contract {\n return sqlValidateContract<Contract<SqlStorage>>(contractJson, emptyCodecLookup);\n },\n\n async verify(verifyOptions: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult> {\n const {\n driver,\n contract: rawContract,\n expectedTargetId,\n contractPath,\n configPath,\n } = verifyOptions;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(rawContract, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n const contractTarget = contract.target;\n\n const marker = await readMarker(driver);\n\n let missingCodecs: readonly string[] | undefined;\n let codecCoverageSkipped = false;\n const supportedTypeIds = collectSupportedCodecTypeIds([adapter, target, ...extensions]);\n if (supportedTypeIds.length === 0) {\n codecCoverageSkipped = true;\n } else {\n const supportedSet = new Set(supportedTypeIds);\n const usedTypeIds = extractCodecTypeIdsFromContract(contract);\n const missing = usedTypeIds.filter((id) => !supportedSet.has(id));\n if (missing.length > 0) {\n missingCodecs = missing;\n }\n }\n\n if (!marker) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_MARKER_MISSING,\n summary: 'Marker missing',\n contractStorageHash,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractTarget !== expectedTargetId) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_TARGET_MISMATCH,\n summary: 'Target mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n actualTargetId: contractTarget,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (marker.storageHash !== contractStorageHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n if (contractProfileHash && marker.profileHash !== contractProfileHash) {\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n contractStorageHash,\n contractProfileHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n }\n\n const totalTime = Date.now() - startTime;\n return createVerifyResult({\n ok: true,\n summary: 'Database matches contract',\n contractStorageHash,\n marker,\n expectedTargetId,\n contractPath,\n totalTime,\n ...(contractProfileHash ? { contractProfileHash } : {}),\n ...(missingCodecs ? { missingCodecs } : {}),\n ...(codecCoverageSkipped ? { codecCoverageSkipped } : {}),\n ...(configPath ? { configPath } : {}),\n });\n },\n\n async schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult> {\n const { driver, contract: contractInput, strict, context, frameworkComponents } = options;\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n const schemaIR = await controlAdapter.introspect(driver, contractInput);\n\n return verifySqlSchema({\n contract,\n schema: schemaIR,\n strict,\n ...ifDefined('context', context),\n typeMetadataRegistry,\n frameworkComponents,\n // Wire up target-specific normalizers if available\n ...ifDefined('normalizeDefault', controlAdapter.normalizeDefault),\n ...ifDefined('normalizeNativeType', controlAdapter.normalizeNativeType),\n });\n },\n async sign(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult> {\n const { driver, contract: contractInput, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const contract = sqlValidateContract<Contract<SqlStorage>>(contractInput, emptyCodecLookup);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash =\n 'profileHash' in contract && typeof contract.profileHash === 'string'\n ? contract.profileHash\n : contractStorageHash;\n const contractTarget = contract.target;\n\n await driver.query(ensureSchemaStatement.sql, ensureSchemaStatement.params);\n await driver.query(ensureTableStatement.sql, ensureTableStatement.params);\n\n const existingMarker = await readMarker(driver);\n\n let markerCreated = false;\n let markerUpdated = false;\n let previousHashes: { storageHash?: string; profileHash?: string } | undefined;\n\n if (!existingMarker) {\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: 1,\n });\n await driver.query(write.insert.sql, write.insert.params);\n markerCreated = true;\n } else {\n const existingStorageHash = existingMarker.storageHash;\n const existingProfileHash = existingMarker.profileHash;\n\n const storageHashMatches = existingStorageHash === contractStorageHash;\n const profileHashMatches = existingProfileHash === contractProfileHash;\n\n if (!storageHashMatches || !profileHashMatches) {\n previousHashes = {\n storageHash: existingStorageHash,\n profileHash: existingProfileHash,\n };\n const write = writeContractMarker({\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n contractJson: contractInput,\n canonicalVersion: existingMarker.canonicalVersion ?? 1,\n });\n await driver.query(write.update.sql, write.update.params);\n markerUpdated = true;\n }\n }\n\n let summary: string;\n if (markerCreated) {\n summary = 'Database signed (marker created)';\n } else if (markerUpdated) {\n summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? 'unknown'})`;\n } else {\n summary = 'Database already signed with this contract';\n }\n\n const totalTime = Date.now() - startTime;\n\n return {\n ok: true,\n summary,\n contract: {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n target: {\n expected: contractTarget,\n actual: contractTarget,\n },\n marker: {\n created: markerCreated,\n updated: markerUpdated,\n ...(previousHashes ? { previous: previousHashes } : {}),\n },\n meta: {\n contractPath,\n ...(configPath ? { configPath } : {}),\n },\n timings: {\n total: totalTime,\n },\n };\n },\n async readMarker(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n }): Promise<ContractMarkerRecord | null> {\n return readMarker(options.driver);\n },\n async introspect(options: {\n readonly driver: ControlDriverInstance<'sql', string>;\n readonly contract?: unknown;\n }): Promise<SqlSchemaIR> {\n const { driver, contract } = options;\n\n const controlAdapter = adapter.create();\n if (!isSqlControlAdapter(controlAdapter)) {\n throw new Error('Adapter does not implement SqlControlAdapter.introspect()');\n }\n return controlAdapter.introspect(driver, contract);\n },\n\n toSchemaView(schema: SqlSchemaIR): CoreSchemaView {\n const tableNodes: readonly SchemaTreeNode[] = Object.entries(schema.tables).map(\n ([tableName, table]: [string, SqlTableIR]) => {\n const children: SchemaTreeNode[] = [];\n\n const columnNodes: SchemaTreeNode[] = [];\n for (const [columnName, column] of Object.entries(table.columns)) {\n const typeDisplay = column.nativeType;\n const nullability = column.nullable ? 'nullable' : 'not nullable';\n const label = `${columnName}: ${typeDisplay} (${nullability})`;\n columnNodes.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `column-${tableName}-${columnName}`,\n label,\n meta: {\n nativeType: column.nativeType,\n nullable: column.nullable,\n ...ifDefined('default', column.default),\n },\n }),\n );\n }\n\n if (columnNodes.length > 0) {\n children.push(\n new SchemaTreeNode({\n kind: 'collection',\n id: `columns-${tableName}`,\n label: 'columns',\n children: columnNodes,\n }),\n );\n }\n\n if (table.primaryKey) {\n const pkColumns = table.primaryKey.columns.join(', ');\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `primary-key-${tableName}`,\n label: `primary key: ${pkColumns}`,\n meta: {\n columns: table.primaryKey.columns,\n ...(table.primaryKey.name ? { name: table.primaryKey.name } : {}),\n },\n }),\n );\n }\n\n for (const unique of table.uniques) {\n const name = unique.name ?? `${tableName}_${unique.columns.join('_')}_unique`;\n const label = `unique ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `unique-${tableName}-${name}`,\n label,\n meta: {\n columns: unique.columns,\n unique: true,\n },\n }),\n );\n }\n\n for (const index of table.indexes) {\n const name = index.name ?? defaultIndexName(tableName, index.columns);\n const label = index.unique ? `unique index ${name}` : `index ${name}`;\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `index-${tableName}-${name}`,\n label,\n meta: {\n columns: index.columns,\n unique: index.unique,\n },\n }),\n );\n }\n\n const tableMeta: Record<string, unknown> = {};\n if (table.primaryKey) {\n tableMeta['primaryKey'] = table.primaryKey.columns;\n if (table.primaryKey.name) {\n tableMeta['primaryKeyName'] = table.primaryKey.name;\n }\n }\n if (table.foreignKeys.length > 0) {\n tableMeta['foreignKeys'] = table.foreignKeys.map((fk) => ({\n columns: fk.columns,\n referencedTable: fk.referencedTable,\n referencedColumns: fk.referencedColumns,\n ...(fk.name ? { name: fk.name } : {}),\n }));\n }\n\n return new SchemaTreeNode({\n kind: 'entity',\n id: `table-${tableName}`,\n label: `table ${tableName}`,\n ...(Object.keys(tableMeta).length > 0 ? { meta: tableMeta } : {}),\n ...(children.length > 0 ? { children } : {}),\n });\n },\n );\n\n const dependencyNodes: readonly SchemaTreeNode[] = schema.dependencies.map((dep) => {\n const shortName = dep.id.split('.').pop() ?? dep.id;\n return new SchemaTreeNode({\n kind: 'dependency',\n id: `dependency-${dep.id}`,\n label: `${shortName} dependency is installed`,\n });\n });\n\n const rootChildren = [...tableNodes, ...dependencyNodes];\n\n return {\n root: new SchemaTreeNode({\n kind: 'root',\n id: 'sql-schema',\n label: 'database',\n ...(rootChildren.length > 0 ? { children: rootChildren } : {}),\n }),\n };\n },\n };\n}\n","import type {\n ControlFamilyDescriptor,\n ControlStack,\n} from '@prisma-next/framework-components/control';\nimport { sqlEmission } from '@prisma-next/sql-contract-emitter';\nimport { sqlFamilyAuthoringFieldPresets } from './authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from './authoring-type-constructors';\nimport { createSqlFamilyInstance, type SqlControlFamilyInstance } from './control-instance';\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 version = '0.0.1';\n readonly emission = sqlEmission;\n readonly authoring = {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n } as const;\n\n create<TTargetId extends string>(\n stack: ControlStack<'sql', TTargetId>,\n ): SqlControlFamilyInstance {\n return createSqlFamilyInstance(stack);\n }\n}\n","import type { ColumnDefault, Contract } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type { MigrationPlannerConflict } from '@prisma-next/framework-components/control';\nimport type {\n ForeignKey,\n Index,\n SqlStorage,\n StorageColumn,\n StorageTable,\n StorageTypeInstance,\n UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type {\n DependencyIR,\n SqlAnnotations,\n SqlColumnIR,\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlTableIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { collectInitDependencies } from './types';\n\n/**\n * Target-specific callback that expands a column's base `nativeType` and optional\n * `typeParams` into the fully-qualified type string used by the database\n * (e.g. `character` + `{ length: 36 }` → `character(36)`).\n *\n * This lives in the family layer as a callback rather than importing a concrete\n * implementation because each target (Postgres, MySQL, SQLite, …) has its own\n * parameterization syntax. The target wires its expander when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type NativeTypeExpander = (input: {\n readonly nativeType: string;\n readonly codecId?: string;\n readonly typeParams?: Record<string, unknown>;\n}) => string;\n\n/**\n * Target-specific callback that renders a `ColumnDefault` into the raw SQL literal\n * string stored in `SqlColumnIR.default`.\n *\n * Default value serialization is target-specific (quoting, casting, type syntax vary\n * between Postgres, MySQL, SQLite, …). This callback follows the same IoC pattern as\n * `NativeTypeExpander`: the target provides its renderer when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type DefaultRenderer = (def: ColumnDefault, column: StorageColumn) => string;\n\nfunction convertColumn(\n name: string,\n column: StorageColumn,\n storageTypes: Record<string, StorageTypeInstance>,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlColumnIR {\n // Resolve `typeRef` so columns that delegate their `nativeType`/`codecId`/\n // `typeParams` to a named `storage.types` entry expand the same way as\n // columns that inline those fields. Without this resolution, a\n // `typeRef`-based column like `post.embedding → Embedding1536` would\n // render as the bare `\"vector\"` (dropping the `length` parameter), while\n // `verify-sql-schema.ts`'s `renderExpectedNativeType` resolves the\n // typeRef and produces `\"vector(1536)\"` — making diffs on the same\n // contract falsely report a `type_mismatch`.\n const resolved = resolveColumnTypeMetadata(column, storageTypes);\n const nativeType = expandNativeType\n ? expandNativeType({\n nativeType: resolved.nativeType,\n codecId: resolved.codecId,\n ...ifDefined('typeParams', resolved.typeParams),\n })\n : resolved.nativeType;\n return {\n name,\n nativeType,\n nullable: column.nullable,\n ...ifDefined(\n 'default',\n column.default != null && renderDefault ? renderDefault(column.default, column) : undefined,\n ),\n };\n}\n\nfunction resolveColumnTypeMetadata(\n column: StorageColumn,\n storageTypes: Record<string, StorageTypeInstance>,\n): Pick<StorageColumn, 'codecId' | 'nativeType' | 'typeParams'> {\n if (!column.typeRef) {\n return column;\n }\n const referenced = storageTypes[column.typeRef];\n if (!referenced) {\n throw new Error(\n `Column references storage type \"${column.typeRef}\" but it is not defined in storage.types.`,\n );\n }\n return {\n codecId: referenced.codecId,\n nativeType: referenced.nativeType,\n typeParams: referenced.typeParams,\n };\n}\n\nfunction convertUnique(unique: UniqueConstraint): SqlUniqueIR {\n return {\n columns: unique.columns,\n ...ifDefined('name', unique.name),\n };\n}\n\nfunction convertIndex(index: Index): SqlIndexIR {\n return {\n columns: index.columns,\n unique: false,\n ...ifDefined('name', index.name),\n };\n}\n\nfunction convertForeignKey(fk: ForeignKey): SqlForeignKeyIR {\n return {\n columns: fk.columns,\n referencedTable: fk.references.table,\n referencedColumns: fk.references.columns,\n ...ifDefined('name', fk.name),\n };\n}\n\nfunction convertTable(\n name: string,\n table: StorageTable,\n storageTypes: Record<string, StorageTypeInstance>,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlTableIR {\n const columns: Record<string, SqlColumnIR> = {};\n for (const [colName, colDef] of Object.entries(table.columns)) {\n columns[colName] = convertColumn(\n colName,\n colDef,\n storageTypes,\n expandNativeType,\n renderDefault,\n );\n }\n\n const satisfiedIndexColumns = new Set([\n ...table.indexes.map((idx) => idx.columns.join(',')),\n ...table.uniques.map((unique) => unique.columns.join(',')),\n ...(table.primaryKey ? [table.primaryKey.columns.join(',')] : []),\n ]);\n const fkBackingIndexes: SqlIndexIR[] = [];\n for (const fk of table.foreignKeys) {\n if (fk.index === false) continue;\n const key = fk.columns.join(',');\n if (satisfiedIndexColumns.has(key)) continue;\n fkBackingIndexes.push({\n columns: fk.columns,\n unique: false,\n name: defaultIndexName(name, fk.columns),\n });\n satisfiedIndexColumns.add(key);\n }\n\n return {\n name,\n columns,\n ...ifDefined('primaryKey', table.primaryKey),\n foreignKeys: table.foreignKeys.map(convertForeignKey),\n uniques: table.uniques.map(convertUnique),\n indexes: [...table.indexes.map(convertIndex), ...fkBackingIndexes],\n };\n}\n\n/**\n * Detects destructive changes between two contract storages.\n *\n * The additive-only planner silently ignores removals (tables, columns).\n * This function detects those removals so callers can report them as conflicts\n * rather than silently producing an empty plan.\n *\n * Returns an empty array if no destructive changes are found.\n */\nexport function detectDestructiveChanges(\n from: SqlStorage | null,\n to: SqlStorage,\n): readonly MigrationPlannerConflict[] {\n if (!from) return [];\n\n const hasOwn = (value: object, key: string): boolean => Object.hasOwn(value, key);\n\n const conflicts: MigrationPlannerConflict[] = [];\n\n for (const tableName of Object.keys(from.tables)) {\n if (!hasOwn(to.tables, tableName)) {\n conflicts.push({\n kind: 'tableRemoved',\n summary: `Table \"${tableName}\" was removed`,\n });\n continue;\n }\n\n const toTable = to.tables[tableName] as StorageTable;\n const fromTable = from.tables[tableName];\n if (!fromTable) continue;\n\n for (const columnName of Object.keys(fromTable.columns)) {\n if (!hasOwn(toTable.columns, columnName)) {\n conflicts.push({\n kind: 'columnRemoved',\n summary: `Column \"${tableName}\".\"${columnName}\" was removed`,\n });\n }\n }\n }\n\n return conflicts;\n}\n\nexport interface ContractToSchemaIROptions {\n readonly annotationNamespace: string;\n readonly expandNativeType?: NativeTypeExpander;\n readonly renderDefault?: DefaultRenderer;\n readonly frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Converts a `Contract` to `SqlSchemaIR`.\n *\n * Reads `contract.storage` for tables, `contract.storage.types` for type\n * annotations, and derives database dependencies from `frameworkComponents`\n * (each component's `databaseDependencies.init[].id`).\n * Storage-type annotations are written under `options.annotationNamespace`.\n *\n * Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n * structural information. When `expandNativeType` is provided, parameterized types\n * are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n * resulting IR compares correctly against the \"to\" contract during planning.\n *\n * Returns an empty schema IR when `contract` is `null` (new project).\n */\nexport function contractToSchemaIR(\n contract: Contract<SqlStorage> | null,\n options: ContractToSchemaIROptions,\n): SqlSchemaIR {\n if (options.annotationNamespace.length === 0) {\n throw new Error('annotationNamespace must be a non-empty string');\n }\n\n if (!contract) {\n return { tables: {}, dependencies: [] };\n }\n\n const storage = contract.storage;\n const storageTypes = storage.types ?? {};\n const tables: Record<string, SqlTableIR> = {};\n for (const [tableName, tableDef] of Object.entries(storage.tables)) {\n tables[tableName] = convertTable(\n tableName,\n tableDef,\n storageTypes,\n options.expandNativeType,\n options.renderDefault,\n );\n }\n\n const dependencies = deduplicateDependencyIRs(\n collectInitDependencies(options.frameworkComponents ?? []),\n );\n const annotations = deriveAnnotations(storage, options.annotationNamespace);\n\n return {\n tables,\n dependencies,\n ...ifDefined('annotations', annotations),\n };\n}\n\nfunction deduplicateDependencyIRs(\n deps: readonly { readonly id: string }[],\n): readonly DependencyIR[] {\n const seen = new Set<string>();\n const result: DependencyIR[] = [];\n for (const dep of deps) {\n if (dep.id.trim().length === 0) {\n throw new Error('Dependency id must be a non-empty string');\n }\n if (seen.has(dep.id)) continue;\n seen.add(dep.id);\n result.push({ id: dep.id });\n }\n return result;\n}\n\nfunction deriveAnnotations(\n storage: SqlStorage,\n annotationNamespace: string,\n): SqlAnnotations | undefined {\n if (!storage.types || Object.keys(storage.types).length === 0) return undefined;\n // Re-key by nativeType to match the structure produced by introspection\n const byNativeType: Record<string, (typeof storage.types)[string]> = {};\n for (const typeInstance of Object.values(storage.types)) {\n byNativeType[typeInstance.nativeType] = typeInstance;\n }\n return { [annotationNamespace]: { storageTypes: byNativeType } };\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>(\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/framework-components/control';\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/control-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/framework-components/control';\nexport { assembleAuthoringContributions } from '@prisma-next/framework-components/control';\nexport { extractCodecControlHooks } from '../core/assembly';\nexport type { SchemaVerifyOptions, SqlControlFamilyInstance } from '../core/control-instance';\nexport type {\n ContractToSchemaIROptions,\n DefaultRenderer,\n NativeTypeExpander,\n} from '../core/migrations/contract-to-schema-ir';\n// Contract → SchemaIR conversion for offline migration planning\nexport {\n contractToSchemaIR,\n detectDestructiveChanges,\n} from '../core/migrations/contract-to-schema-ir';\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';\nexport type {\n AnySqlMigrationOperation,\n CodecControlHooks,\n ComponentDatabaseDependencies,\n ComponentDatabaseDependency,\n CreateSqlMigrationPlanOptions,\n ExpandNativeTypeInput,\n ResolveIdentityValueInput,\n SqlControlAdapterDescriptor,\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 SqlPlanTargetDetails,\n StorageTypePlanResult,\n} from '../core/migrations/types';\nexport { collectInitDependencies, isDatabaseDependencyProvider } from '../core/migrations/types';\n\nexport default new SqlFamilyDescriptor();\n"],"mappings":";;;;;;;;;;;;;AA0CA,SAAS,gCAAgC,UAAsC;CAC7E,MAAM,0BAAU,IAAI,KAAa;AAGjC,KACE,OAAO,aAAa,YACpB,aAAa,QACb,aAAa,YACb,OAAO,SAAS,YAAY,YAC5B,SAAS,YAAY,QACrB,YAAY,SAAS,SACrB;EACA,MAAM,UAAU,SAAS;AACzB,MAAI,QAAQ,UAAU,OAAO,QAAQ,WAAW,UAC9C;QAAK,MAAM,SAAS,OAAO,OAAO,QAAQ,OAAO,CAC/C,KACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACb,OAAO,MAAM,YAAY,YACzB,MAAM,YAAY,MAClB;IACA,MAAM,UAAU,MAAM;AACtB,SAAK,MAAM,UAAU,OAAO,OAAO,QAAQ,CACzC,KACE,UACA,OAAO,WAAW,YAClB,aAAa,UACb,OAAO,OAAO,YAAY,SAE1B,SAAQ,IAAI,OAAO,QAAQ;;;;AAQvC,QAAO,MAAM,KAAK,QAAQ,CAAC,MAAM;;AAGnC,SAAS,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AAM,YAAY,QAAQ,KAAK,EAAE,GAAG,EAAE;EAC7D,CAAC,CACmB;;;;;;;;AC7JvB,MAAaC,uBAAiD,OAAO,OAAO,EAC1E,yBAAyB,OAAO,OAAO,CAAC,WAAW,CAAU,EAC9D,CAAC;;;;AC+DF,sBAAe,IAAI,qBAAqB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { E as SqlPlanTargetDetails, n as AnySqlMigrationOperation } from "./types-C6K4mxDM.mjs";
|
|
2
|
+
import { Migration } from "@prisma-next/migration-tools/migration";
|
|
3
|
+
|
|
4
|
+
//#region src/core/sql-migration.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Family-owned base class for SQL migrations.
|
|
8
|
+
*
|
|
9
|
+
* Parameterized on the target-details shape because SQL-family targets
|
|
10
|
+
* (Postgres, MySQL, SQLite, …) each carry their own `target.details` payload
|
|
11
|
+
* on `SqlMigrationPlanOperation`. The type parameter is narrowed to
|
|
12
|
+
* `SqlPlanTargetDetails` so every target-specific shape must at minimum
|
|
13
|
+
* identify the object being targeted (schema + name); concrete targets
|
|
14
|
+
* extend the shape with their own fields.
|
|
15
|
+
*
|
|
16
|
+
* Each concrete target-side subclass (e.g. Postgres's
|
|
17
|
+
* `TypeScriptRenderablePostgresMigration`) fixes `targetId` to its own
|
|
18
|
+
* target-id string literal, since SQL can't hardcode a single `targetId`:
|
|
19
|
+
* `targetId` is a target-level identity, not a family-level one, and
|
|
20
|
+
* belongs on the subclass.
|
|
21
|
+
*
|
|
22
|
+
* `familyId` is intentionally not declared here. The SQL family has no
|
|
23
|
+
* family-scoped runtime identity today — consumers reach the family via
|
|
24
|
+
* target descriptors rather than by family-id lookup, so adding one would
|
|
25
|
+
* be purely decorative. Introducing it later is a non-breaking superset.
|
|
26
|
+
*
|
|
27
|
+
* The operation type parameter is `AnySqlMigrationOperation<TDetails>` — the
|
|
28
|
+
* union of DDL-shaped `SqlMigrationPlanOperation` and `DataTransformOperation`
|
|
29
|
+
* — so subclasses can return a mix of schema operations (e.g. `setNotNull`,
|
|
30
|
+
* `addColumn`) and data-transform operations (e.g. `dataTransform`). Mirrors
|
|
31
|
+
* `MongoMigration`'s parameterization on `AnyMongoMigrationOperation`.
|
|
32
|
+
*/
|
|
33
|
+
declare abstract class SqlMigration<TDetails extends SqlPlanTargetDetails> extends Migration<AnySqlMigrationOperation<TDetails>> {}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { SqlMigration as Migration };
|
|
36
|
+
//# sourceMappingURL=migration.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.d.mts","names":[],"sources":["../src/core/sql-migration.ts"],"sourcesContent":[],"mappings":";;;;;;;AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;uBAAsB,8BAA8B,8BAA8B,UAChF,yBAAyB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Migration } from "@prisma-next/migration-tools/migration";
|
|
2
|
+
|
|
3
|
+
//#region src/core/sql-migration.ts
|
|
4
|
+
/**
|
|
5
|
+
* Family-owned base class for SQL migrations.
|
|
6
|
+
*
|
|
7
|
+
* Parameterized on the target-details shape because SQL-family targets
|
|
8
|
+
* (Postgres, MySQL, SQLite, …) each carry their own `target.details` payload
|
|
9
|
+
* on `SqlMigrationPlanOperation`. The type parameter is narrowed to
|
|
10
|
+
* `SqlPlanTargetDetails` so every target-specific shape must at minimum
|
|
11
|
+
* identify the object being targeted (schema + name); concrete targets
|
|
12
|
+
* extend the shape with their own fields.
|
|
13
|
+
*
|
|
14
|
+
* Each concrete target-side subclass (e.g. Postgres's
|
|
15
|
+
* `TypeScriptRenderablePostgresMigration`) fixes `targetId` to its own
|
|
16
|
+
* target-id string literal, since SQL can't hardcode a single `targetId`:
|
|
17
|
+
* `targetId` is a target-level identity, not a family-level one, and
|
|
18
|
+
* belongs on the subclass.
|
|
19
|
+
*
|
|
20
|
+
* `familyId` is intentionally not declared here. The SQL family has no
|
|
21
|
+
* family-scoped runtime identity today — consumers reach the family via
|
|
22
|
+
* target descriptors rather than by family-id lookup, so adding one would
|
|
23
|
+
* be purely decorative. Introducing it later is a non-breaking superset.
|
|
24
|
+
*
|
|
25
|
+
* The operation type parameter is `AnySqlMigrationOperation<TDetails>` — the
|
|
26
|
+
* union of DDL-shaped `SqlMigrationPlanOperation` and `DataTransformOperation`
|
|
27
|
+
* — so subclasses can return a mix of schema operations (e.g. `setNotNull`,
|
|
28
|
+
* `addColumn`) and data-transform operations (e.g. `dataTransform`). Mirrors
|
|
29
|
+
* `MongoMigration`'s parameterization on `AnyMongoMigrationOperation`.
|
|
30
|
+
*/
|
|
31
|
+
var SqlMigration = class extends Migration {};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { SqlMigration as Migration };
|
|
35
|
+
//# sourceMappingURL=migration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/sql-migration.ts"],"sourcesContent":["import { Migration } from '@prisma-next/migration-tools/migration';\nimport type { AnySqlMigrationOperation, SqlPlanTargetDetails } from './migrations/types';\n\n/**\n * Family-owned base class for SQL migrations.\n *\n * Parameterized on the target-details shape because SQL-family targets\n * (Postgres, MySQL, SQLite, …) each carry their own `target.details` payload\n * on `SqlMigrationPlanOperation`. The type parameter is narrowed to\n * `SqlPlanTargetDetails` so every target-specific shape must at minimum\n * identify the object being targeted (schema + name); concrete targets\n * extend the shape with their own fields.\n *\n * Each concrete target-side subclass (e.g. Postgres's\n * `TypeScriptRenderablePostgresMigration`) fixes `targetId` to its own\n * target-id string literal, since SQL can't hardcode a single `targetId`:\n * `targetId` is a target-level identity, not a family-level one, and\n * belongs on the subclass.\n *\n * `familyId` is intentionally not declared here. The SQL family has no\n * family-scoped runtime identity today — consumers reach the family via\n * target descriptors rather than by family-id lookup, so adding one would\n * be purely decorative. Introducing it later is a non-breaking superset.\n *\n * The operation type parameter is `AnySqlMigrationOperation<TDetails>` — the\n * union of DDL-shaped `SqlMigrationPlanOperation` and `DataTransformOperation`\n * — so subclasses can return a mix of schema operations (e.g. `setNotNull`,\n * `addColumn`) and data-transform operations (e.g. `dataTransform`). Mirrors\n * `MongoMigration`'s parameterization on `AnyMongoMigrationOperation`.\n */\nexport abstract class SqlMigration<TDetails extends SqlPlanTargetDetails> extends Migration<\n AnySqlMigrationOperation<TDetails>\n> {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAsB,eAAtB,cAAkF,UAEhF"}
|
package/dist/schema-verify.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-BBhkqEDo.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { a as ComponentDatabaseDependency } from "./types-C6K4mxDM.mjs";
|
|
3
3
|
import { SchemaIssue, SchemaVerificationNode } from "@prisma-next/framework-components/control";
|
|
4
4
|
import { SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ControlAdapterDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlannerConflict, MigrationPlannerFailureResult, MigrationPlannerSuccessResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerSuccessValue, OperationContext, SchemaIssue, SchemaViewCapable, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
|
|
1
|
+
import { ControlAdapterDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, DataTransformOperation, MigratableTargetDescriptor, MigrationOperationPolicy, MigrationPlan, MigrationPlanOperation, MigrationPlannerConflict, MigrationPlannerFailureResult, MigrationPlannerSuccessResult, MigrationRunnerExecutionChecks, MigrationRunnerFailure, MigrationRunnerSuccessValue, OperationContext, SchemaIssue, SchemaViewCapable, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
|
|
2
2
|
import { Result } from "@prisma-next/utils/result";
|
|
3
3
|
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
4
4
|
import { Contract } from "@prisma-next/contract/types";
|
|
@@ -145,6 +145,17 @@ interface SqlMigrationPlanOperationStep {
|
|
|
145
145
|
readonly sql: string;
|
|
146
146
|
readonly meta?: AnyRecord;
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Minimal shape every SQL-family target must conform to for its per-operation
|
|
150
|
+
* `target.details` payload. Each SQL operation addresses a named database
|
|
151
|
+
* object in some schema; targets (Postgres, MySQL, SQLite, …) extend this
|
|
152
|
+
* shape with their own fields (e.g. Postgres adds `objectType` and optional
|
|
153
|
+
* `table`).
|
|
154
|
+
*/
|
|
155
|
+
interface SqlPlanTargetDetails {
|
|
156
|
+
readonly schema: string;
|
|
157
|
+
readonly name: string;
|
|
158
|
+
}
|
|
148
159
|
interface SqlMigrationPlanOperationTarget<TTargetDetails> {
|
|
149
160
|
readonly id: string;
|
|
150
161
|
readonly details?: TTargetDetails;
|
|
@@ -157,6 +168,16 @@ interface SqlMigrationPlanOperation<TTargetDetails> extends MigrationPlanOperati
|
|
|
157
168
|
readonly postcheck: readonly SqlMigrationPlanOperationStep[];
|
|
158
169
|
readonly meta?: AnyRecord;
|
|
159
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Union of all operation shapes a SQL-family migration may emit: schema-facing
|
|
173
|
+
* `SqlMigrationPlanOperation`s and family-agnostic `DataTransformOperation`s.
|
|
174
|
+
*
|
|
175
|
+
* Mirrors `AnyMongoMigrationOperation` in shape — the runner already handles
|
|
176
|
+
* both branches via `isDataTransformOperation`, and authored `migration.ts`
|
|
177
|
+
* files must be able to intermix `dataTransform(endContract, …)` calls with
|
|
178
|
+
* DDL factory calls (e.g. `setNotNull(…)`) in a single `operations` array.
|
|
179
|
+
*/
|
|
180
|
+
type AnySqlMigrationOperation<TTargetDetails> = SqlMigrationPlanOperation<TTargetDetails> | DataTransformOperation;
|
|
160
181
|
interface SqlMigrationPlanContractInfo {
|
|
161
182
|
readonly storageHash: string;
|
|
162
183
|
readonly profileHash?: string;
|
|
@@ -201,6 +222,15 @@ interface SqlMigrationPlannerPlanOptions {
|
|
|
201
222
|
readonly schema: SqlSchemaIR;
|
|
202
223
|
readonly policy: MigrationOperationPolicy;
|
|
203
224
|
readonly schemaName?: string;
|
|
225
|
+
/**
|
|
226
|
+
* The "from" contract (state the planner assumes the database starts at).
|
|
227
|
+
* Only `migration plan` supplies this; `db update` / `db init` reconcile
|
|
228
|
+
* against the live schema with no old contract. Strategies that need
|
|
229
|
+
* from/to column-shape comparisons (unsafe type change, nullability
|
|
230
|
+
* tightening) use this to decide whether to emit `dataTransform`
|
|
231
|
+
* placeholders.
|
|
232
|
+
*/
|
|
233
|
+
readonly fromContract?: Contract<SqlStorage> | null;
|
|
204
234
|
/**
|
|
205
235
|
* Active framework components participating in this composition.
|
|
206
236
|
* SQL targets can interpret this list to derive database dependencies.
|
|
@@ -267,5 +297,5 @@ interface CreateSqlMigrationPlanOptions<TTargetDetails> {
|
|
|
267
297
|
readonly meta?: AnyRecord;
|
|
268
298
|
}
|
|
269
299
|
//#endregion
|
|
270
|
-
export {
|
|
271
|
-
//# sourceMappingURL=types-
|
|
300
|
+
export { SqlPlannerFailureResult as A, SqlMigrationRunnerFailure as C, SqlPlannerConflict as D, SqlPlanTargetDetails as E, isDatabaseDependencyProvider as F, SchemaVerifyOptions as I, SqlControlFamilyInstance as L, SqlPlannerSuccessResult as M, StorageTypePlanResult as N, SqlPlannerConflictKind as O, collectInitDependencies as P, SqlMigrationRunnerExecuteOptions as S, SqlMigrationRunnerSuccessValue as T, SqlMigrationPlanner as _, ComponentDatabaseDependency as a, SqlMigrationRunnerErrorCode as b, ResolveIdentityValueInput as c, SqlControlTargetDescriptor as d, SqlMigrationPlan as f, SqlMigrationPlanOperationTarget as g, SqlMigrationPlanOperationStep as h, ComponentDatabaseDependencies as i, SqlPlannerResult as j, SqlPlannerConflictLocation as k, SqlControlAdapterDescriptor as l, SqlMigrationPlanOperation as m, AnySqlMigrationOperation as n, CreateSqlMigrationPlanOptions as o, SqlMigrationPlanContractInfo as p, CodecControlHooks as r, ExpandNativeTypeInput as s, AnyRecord as t, SqlControlExtensionDescriptor as u, SqlMigrationPlannerPlanOptions as v, SqlMigrationRunnerResult as w, SqlMigrationRunnerExecuteCallbacks as x, SqlMigrationRunner as y };
|
|
301
|
+
//# sourceMappingURL=types-C6K4mxDM.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-C6K4mxDM.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/migrations/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAyJU,eAAA;;;;;AAzHsE;AAyHvD,KAOpB,uBAAA,GAA0B,GAAH,CAAA,MAAA,EAAe,eAAA,CAAZ;AAAG,UAExB,sBAAA,CAAsB;EACW,SAAA,gBAAA,EAAd,aAAc,CAAA,eAAA,CAAA;EAAd,SAAA,oBAAA,EACI,aADJ,CACkB,eADlB,CAAA;EACkB,SAAA,YAAA,EACtB,aADsB,CAAA,MAAA,CAAA;EAAd,SAAA,oBAAA,EAEA,uBAFA;;AAEA,UAGhB,mBAAA,CAHgB;EAAuB,SAAA,MAAA,EAIrC,qBAJqC,CAAA,KAAA,EAAA,MAAA,CAAA;EAGvC,SAAA,QAAA,EAAA,OAAmB;EACjB,SAAA,MAAA,EAAA,OAAA;EAGE,SAAA,OAAA,CAAA,EAAA,gBAAA;EAKyB;;;AAG9C;EACuC,SAAA,mBAAA,EAJP,aAIO,CAJO,8BAIP,CAAA,KAAA,EAAA,MAAA,CAAA,CAAA;;AAGI,UAJ1B,wBAAA,SACP,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