@prisma-next/target-sqlite 0.12.0-dev.5 → 0.12.0-dev.51
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/{codec-ids-C4UfWqAE.d.mts → codec-ids-yG2RRHnw.d.mts} +1 -1
- package/dist/{codec-ids-C4UfWqAE.d.mts.map → codec-ids-yG2RRHnw.d.mts.map} +1 -1
- package/dist/codec-ids.d.mts +1 -1
- package/dist/{codec-types-B2ci-b_W.d.mts → codec-types-CM7OkQLM.d.mts} +2 -2
- package/dist/{codec-types-B2ci-b_W.d.mts.map → codec-types-CM7OkQLM.d.mts.map} +1 -1
- package/dist/codec-types.d.mts +2 -2
- package/dist/{codecs-DqDWNIKq.d.mts → codecs-t6YnHZkK.d.mts} +2 -2
- package/dist/{codecs-DqDWNIKq.d.mts.map → codecs-t6YnHZkK.d.mts.map} +1 -1
- package/dist/codecs.d.mts +1 -1
- package/dist/contract-free.d.mts +50 -0
- package/dist/contract-free.d.mts.map +1 -0
- package/dist/contract-free.mjs +107 -0
- package/dist/contract-free.mjs.map +1 -0
- package/dist/control-tables-C0Nkzhv9.mjs +12 -0
- package/dist/control-tables-C0Nkzhv9.mjs.map +1 -0
- package/dist/control-tables.d.mts +11 -0
- package/dist/control-tables.d.mts.map +1 -0
- package/dist/control-tables.mjs +2 -0
- package/dist/control.d.mts +31 -15
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +62 -120
- package/dist/control.mjs.map +1 -1
- package/dist/ddl.d.mts +2 -0
- package/dist/ddl.mjs +2 -0
- package/dist/{descriptor-meta-DIbCXU65.mjs → descriptor-meta-rKforwQA.mjs} +3 -1
- package/dist/descriptor-meta-rKforwQA.mjs.map +1 -0
- package/dist/migration.d.mts +2 -2
- package/dist/migration.mjs +2 -2
- package/dist/nodes-09ul6DNV.mjs +28 -0
- package/dist/nodes-09ul6DNV.mjs.map +1 -0
- package/dist/nodes-D8LGV4Yk.d.mts +27 -0
- package/dist/nodes-D8LGV4Yk.d.mts.map +1 -0
- package/dist/{op-factory-call-VBm-wu5R.mjs → op-factory-call-DulOHPZX.mjs} +2 -2
- package/dist/{op-factory-call-VBm-wu5R.mjs.map → op-factory-call-DulOHPZX.mjs.map} +1 -1
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +1 -1
- package/dist/pack.d.mts +2 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-BBvwGy0f.mjs → planner-D7RauQHI.mjs} +6 -6
- package/dist/planner-D7RauQHI.mjs.map +1 -0
- package/dist/{planner-produced-sqlite-migration-D4FSvPE4.d.mts → planner-produced-sqlite-migration-BwFkd0br.d.mts} +3 -3
- package/dist/{planner-produced-sqlite-migration-D4FSvPE4.d.mts.map → planner-produced-sqlite-migration-BwFkd0br.d.mts.map} +1 -1
- package/dist/planner-produced-sqlite-migration.d.mts +1 -1
- package/dist/{planner-target-details-BRS591Zt.mjs → planner-target-details-B-H_bvo0.mjs} +1 -1
- package/dist/{planner-target-details-BRS591Zt.mjs.map → planner-target-details-B-H_bvo0.mjs.map} +1 -1
- package/dist/{planner-target-details-B-VJkUsu.d.mts → planner-target-details-RVPqF2ug.d.mts} +1 -1
- package/dist/{planner-target-details-B-VJkUsu.d.mts.map → planner-target-details-RVPqF2ug.d.mts.map} +1 -1
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner-target-details.mjs +1 -1
- package/dist/planner.d.mts +2 -2
- package/dist/planner.mjs +1 -1
- package/dist/render-ops.d.mts +1 -1
- package/dist/runtime.d.mts +17 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-DDOJntxk.d.mts → shared-Bw5G0I-c.d.mts} +2 -2
- package/dist/{shared-DDOJntxk.d.mts.map → shared-Bw5G0I-c.d.mts.map} +1 -1
- package/dist/{sql-utils-D0gQAMLB.mjs → sql-utils-DcrE1Hm4.mjs} +1 -1
- package/dist/{sql-utils-D0gQAMLB.mjs.map → sql-utils-DcrE1Hm4.mjs.map} +1 -1
- package/dist/sql-utils.mjs +1 -1
- package/dist/sqlite-contract-serializer-WdLA-K49.mjs +101 -0
- package/dist/sqlite-contract-serializer-WdLA-K49.mjs.map +1 -0
- package/dist/{sqlite-migration-Feio34n3.d.mts → sqlite-migration-D-O3Glz1.d.mts} +2 -2
- package/dist/{sqlite-migration-Feio34n3.d.mts.map → sqlite-migration-D-O3Glz1.d.mts.map} +1 -1
- package/dist/{tables-gB0XiFu8.mjs → tables-zrEJsCi9.mjs} +3 -3
- package/dist/{tables-gB0XiFu8.mjs.map → tables-zrEJsCi9.mjs.map} +1 -1
- package/package.json +21 -19
- package/src/contract-free/columns.ts +44 -0
- package/src/contract-free/control-bootstrap.ts +54 -0
- package/src/contract-free/ddl.ts +21 -0
- package/src/core/control-tables.ts +11 -0
- package/src/core/ddl/nodes.ts +41 -0
- package/src/core/descriptor-meta.ts +2 -0
- package/src/core/migrations/issue-planner.ts +1 -1
- package/src/core/migrations/planner-strategies.ts +1 -1
- package/src/core/migrations/runner.ts +78 -83
- package/src/core/sqlite-contract-serializer.ts +21 -9
- package/src/core/sqlite-unbound-database.ts +113 -26
- package/src/exports/contract-free.ts +6 -0
- package/src/exports/control-tables.ts +5 -0
- package/src/exports/ddl.ts +6 -0
- package/src/exports/runtime.ts +1 -0
- package/dist/descriptor-meta-DIbCXU65.mjs.map +0 -1
- package/dist/planner-BBvwGy0f.mjs.map +0 -1
- package/dist/statement-builders-BiRmeyJM.mjs +0 -158
- package/dist/statement-builders-BiRmeyJM.mjs.map +0 -1
- package/dist/statement-builders.d.mts +0 -68
- package/dist/statement-builders.d.mts.map +0 -1
- package/dist/statement-builders.mjs +0 -2
- package/src/core/migrations/statement-builders.ts +0 -212
- package/src/exports/statement-builders.ts +0 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
1
|
+
import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';
|
|
2
2
|
import type {
|
|
3
3
|
MigrationOperationPolicy,
|
|
4
4
|
SqlControlFamilyInstance,
|
|
@@ -13,27 +13,17 @@ import type {
|
|
|
13
13
|
} from '@prisma-next/family-sql/control';
|
|
14
14
|
import { runnerFailure, runnerSuccess } from '@prisma-next/family-sql/control';
|
|
15
15
|
import { verifySqlSchema } from '@prisma-next/family-sql/schema-verify';
|
|
16
|
-
import
|
|
17
|
-
import type {
|
|
18
|
-
ControlDriverInstance,
|
|
19
|
-
MigrationRunnerResult,
|
|
20
|
-
} from '@prisma-next/framework-components/control';
|
|
16
|
+
import type { MigrationRunnerResult } from '@prisma-next/framework-components/control';
|
|
21
17
|
import { APP_SPACE_ID } from '@prisma-next/framework-components/control';
|
|
18
|
+
import type { SqlControlDriverInstance, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
19
|
+
import type { LoweredStatement } from '@prisma-next/sql-relational-core/ast';
|
|
22
20
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
23
21
|
import type { Result } from '@prisma-next/utils/result';
|
|
24
22
|
import { notOk, ok, okVoid } from '@prisma-next/utils/result';
|
|
23
|
+
import { MARKER_TABLE_NAME } from '../control-tables';
|
|
25
24
|
import { parseSqliteDefault } from '../default-normalizer';
|
|
26
25
|
import { normalizeSqliteNativeType } from '../native-type-normalizer';
|
|
27
26
|
import type { SqlitePlanTargetDetails } from './planner-target-details';
|
|
28
|
-
import {
|
|
29
|
-
buildLedgerInsertStatement,
|
|
30
|
-
buildWriteMarkerStatements,
|
|
31
|
-
ensureLedgerTableStatement,
|
|
32
|
-
ensureMarkerTableStatement,
|
|
33
|
-
MARKER_TABLE_NAME,
|
|
34
|
-
readMarkerStatement,
|
|
35
|
-
type SqlStatement,
|
|
36
|
-
} from './statement-builders';
|
|
37
27
|
|
|
38
28
|
export function createSqliteMigrationRunner(
|
|
39
29
|
family: SqlControlFamilyInstance,
|
|
@@ -70,9 +60,9 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
70
60
|
const policyCheck = this.enforcePolicyCompatibility(options.policy, options.plan.operations);
|
|
71
61
|
if (!policyCheck.ok) return policyCheck;
|
|
72
62
|
|
|
73
|
-
const ensureResult = await this.ensureControlTables(driver);
|
|
63
|
+
const ensureResult = await this.ensureControlTables(driver, options.destinationContract);
|
|
74
64
|
if (!ensureResult.ok) return ensureResult;
|
|
75
|
-
const existingMarker = await this.readMarker(driver, space);
|
|
65
|
+
const existingMarker = await this.family.readMarker({ driver, space });
|
|
76
66
|
|
|
77
67
|
const markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);
|
|
78
68
|
if (!markerCheck.ok) return markerCheck;
|
|
@@ -126,8 +116,9 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
126
116
|
const isSelfEdgeNoOp = isSelfEdge && operationsExecuted === 0 && incomingIsSubsetOfExisting;
|
|
127
117
|
|
|
128
118
|
if (!isSelfEdgeNoOp) {
|
|
129
|
-
await this.upsertMarker(driver, options, existingMarker, space);
|
|
130
|
-
|
|
119
|
+
const markerResult = await this.upsertMarker(driver, options, existingMarker, space);
|
|
120
|
+
if (!markerResult.ok) return markerResult;
|
|
121
|
+
await this.recordLedgerEntries(driver, options, executedOperations);
|
|
131
122
|
}
|
|
132
123
|
|
|
133
124
|
return runnerSuccess({
|
|
@@ -137,7 +128,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
137
128
|
}
|
|
138
129
|
|
|
139
130
|
async execute(options: {
|
|
140
|
-
readonly driver:
|
|
131
|
+
readonly driver: SqlControlDriverInstance<string>;
|
|
141
132
|
readonly perSpaceOptions: ReadonlyArray<
|
|
142
133
|
SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>
|
|
143
134
|
>;
|
|
@@ -306,17 +297,16 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
306
297
|
|
|
307
298
|
private async ensureControlTables(
|
|
308
299
|
driver: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>['driver'],
|
|
300
|
+
contract: Contract<SqlStorage>,
|
|
309
301
|
): Promise<Result<void, SqlMigrationRunnerFailure>> {
|
|
310
|
-
// Pre-1.0 zero-range guardrail: detect a pre-cleanup single-row
|
|
311
|
-
// marker table (no `space` column) and surface a structured failure
|
|
312
|
-
// rather than silently rebuilding the table into the per-space
|
|
313
|
-
// shape. See `specs/framework-mechanism.spec.md § 2`.
|
|
314
302
|
const legacyDetection = await this.detectLegacyMarkerShape(driver);
|
|
315
303
|
if (!legacyDetection.ok) {
|
|
316
304
|
return legacyDetection;
|
|
317
305
|
}
|
|
318
|
-
|
|
319
|
-
|
|
306
|
+
const lowererContext = { contract };
|
|
307
|
+
for (const query of this.family.bootstrapControlTableQueries()) {
|
|
308
|
+
await this.executeStatement(driver, this.family.lowerAst(query, lowererContext));
|
|
309
|
+
}
|
|
320
310
|
return okVoid();
|
|
321
311
|
}
|
|
322
312
|
|
|
@@ -347,32 +337,6 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
347
337
|
);
|
|
348
338
|
}
|
|
349
339
|
|
|
350
|
-
private async readMarker(
|
|
351
|
-
driver: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>['driver'],
|
|
352
|
-
space: string,
|
|
353
|
-
): Promise<ContractMarkerRecord | null> {
|
|
354
|
-
const stmt = readMarkerStatement(space);
|
|
355
|
-
try {
|
|
356
|
-
const result = await driver.query<ContractMarkerRow>(stmt.sql, stmt.params);
|
|
357
|
-
const row = result.rows[0];
|
|
358
|
-
if (!row) return null;
|
|
359
|
-
// SQLite stores arrays as JSON-encoded TEXT (no native array type), so
|
|
360
|
-
// the driver returns `invariants` as a string. Decode before delegating
|
|
361
|
-
// to the shared row schema, which expects `string[]`.
|
|
362
|
-
const invariants =
|
|
363
|
-
typeof row.invariants === 'string'
|
|
364
|
-
? (JSON.parse(row.invariants) as unknown)
|
|
365
|
-
: row.invariants;
|
|
366
|
-
return parseContractMarkerRow({ ...row, invariants });
|
|
367
|
-
} catch (error) {
|
|
368
|
-
// Table might not exist yet
|
|
369
|
-
if (error instanceof Error && error.message.includes('no such table')) {
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
throw error;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
340
|
private async runExpectationSteps(
|
|
377
341
|
driver: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>['driver'],
|
|
378
342
|
steps: readonly SqlMigrationPlanOperationStep[],
|
|
@@ -600,48 +564,79 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
600
564
|
options: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>,
|
|
601
565
|
existingMarker: ContractMarkerRecord | null,
|
|
602
566
|
space: string,
|
|
603
|
-
): Promise<void
|
|
604
|
-
//
|
|
605
|
-
// the
|
|
606
|
-
// BEGIN EXCLUSIVE —
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
const invariants = Array.from(merged).sort();
|
|
610
|
-
const writeStatements = buildWriteMarkerStatements({
|
|
611
|
-
space,
|
|
567
|
+
): Promise<Result<void, SqlMigrationRunnerFailure>> {
|
|
568
|
+
// Pass the plan's incoming invariants verbatim; `updateMarker` unions them
|
|
569
|
+
// with the stored set (TS-side, dialect-uniform) under the runner's
|
|
570
|
+
// BEGIN EXCLUSIVE — no client-side pre-merge here, so there is no
|
|
571
|
+
// double-merge with the SPI's internal accumulate-dedupe.
|
|
572
|
+
const destination = {
|
|
612
573
|
storageHash: options.plan.destination.storageHash,
|
|
613
574
|
profileHash:
|
|
614
575
|
options.plan.destination.profileHash ??
|
|
615
576
|
options.destinationContract.profileHash ??
|
|
616
577
|
options.plan.destination.storageHash,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
578
|
+
invariants: options.plan.providedInvariants ?? [],
|
|
579
|
+
};
|
|
580
|
+
if (!existingMarker) {
|
|
581
|
+
await this.family.initMarker({ driver, space, destination });
|
|
582
|
+
return okVoid();
|
|
583
|
+
}
|
|
584
|
+
const updated = await this.family.updateMarker({
|
|
585
|
+
driver,
|
|
586
|
+
space,
|
|
587
|
+
expectedFrom: existingMarker.storageHash,
|
|
588
|
+
destination,
|
|
621
589
|
});
|
|
622
|
-
|
|
623
|
-
|
|
590
|
+
if (!updated) {
|
|
591
|
+
return runnerFailure(
|
|
592
|
+
'MARKER_CAS_FAILURE',
|
|
593
|
+
'Marker was modified by another process during migration execution.',
|
|
594
|
+
{
|
|
595
|
+
meta: {
|
|
596
|
+
space,
|
|
597
|
+
expectedStorageHash: existingMarker.storageHash,
|
|
598
|
+
destinationStorageHash: options.plan.destination.storageHash,
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
return okVoid();
|
|
624
604
|
}
|
|
625
605
|
|
|
626
|
-
private async
|
|
606
|
+
private async recordLedgerEntries(
|
|
627
607
|
driver: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>['driver'],
|
|
628
608
|
options: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>,
|
|
629
|
-
existingMarker: ContractMarkerRecord | null,
|
|
630
609
|
executedOperations: readonly SqlMigrationPlanOperation<SqlitePlanTargetDetails>[],
|
|
631
610
|
): Promise<void> {
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
611
|
+
const plan = options.plan;
|
|
612
|
+
const space = plan.spaceId;
|
|
613
|
+
const edges = options.migrationEdges;
|
|
614
|
+
const totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);
|
|
615
|
+
if (totalEdgeOps !== plan.operations.length) {
|
|
616
|
+
throw new Error(
|
|
617
|
+
`Ledger write: plan.operations length (${plan.operations.length}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`,
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
// The ledger records the operations as executed — idempotency-skipped ops
|
|
621
|
+
// are substituted with skip records (empty `execute`) by `applyPlan`, so the
|
|
622
|
+
// journal reflects what actually ran rather than the raw plan.
|
|
623
|
+
let offset = 0;
|
|
624
|
+
for (const edge of edges) {
|
|
625
|
+
const edgeOps = executedOperations.slice(offset, offset + edge.operationCount);
|
|
626
|
+
offset += edge.operationCount;
|
|
627
|
+
await this.family.writeLedgerEntry({
|
|
628
|
+
driver,
|
|
629
|
+
space,
|
|
630
|
+
entry: {
|
|
631
|
+
edgeId: `${edge.from}->${edge.to}`,
|
|
632
|
+
from: edge.from,
|
|
633
|
+
to: edge.to,
|
|
634
|
+
migrationName: edge.dirName,
|
|
635
|
+
migrationHash: edge.migrationHash,
|
|
636
|
+
operations: edgeOps,
|
|
637
|
+
},
|
|
638
|
+
});
|
|
639
|
+
}
|
|
645
640
|
}
|
|
646
641
|
|
|
647
642
|
private async beginExclusiveTransaction(
|
|
@@ -664,7 +659,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
|
|
|
664
659
|
|
|
665
660
|
private async executeStatement(
|
|
666
661
|
driver: SqlMigrationRunnerExecuteOptions<SqlitePlanTargetDetails>['driver'],
|
|
667
|
-
statement:
|
|
662
|
+
statement: LoweredStatement,
|
|
668
663
|
): Promise<void> {
|
|
669
664
|
if (statement.params.length > 0) {
|
|
670
665
|
await driver.query(statement.sql, statement.params);
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import type { Contract } from '@prisma-next/contract/types';
|
|
2
2
|
import { SqlContractSerializerBase } from '@prisma-next/family-sql/ir';
|
|
3
|
-
import type
|
|
3
|
+
import { type Namespace, NamespaceBase } from '@prisma-next/framework-components/ir';
|
|
4
|
+
import type { SqlNamespaceTablesInput, SqlStorage } from '@prisma-next/sql-contract/types';
|
|
5
|
+
import { blindCast } from '@prisma-next/utils/casts';
|
|
6
|
+
import { buildSqliteNamespace } from './sqlite-unbound-database';
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* SQLite target `ContractSerializer` concretion. Mirrors the Postgres
|
|
7
|
-
* shape: inherits the full SQL-family deserialization pipeline
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `serializeContract` falls through to the family-base default —
|
|
12
|
-
* SQLite's contract is JSON-clean today. Once target-only fields land
|
|
13
|
-
* (e.g. per-target derived storage fields) this is the home for
|
|
14
|
-
* stripping them from the persisted envelope.
|
|
10
|
+
* shape: inherits the full SQL-family deserialization pipeline and
|
|
11
|
+
* materialises namespace entries as SQLite database concretions that
|
|
12
|
+
* expose `qualifyTable()` for runtime SQL rendering.
|
|
15
13
|
*/
|
|
16
14
|
export class SqliteContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {
|
|
17
15
|
constructor() {
|
|
18
16
|
super(new Map());
|
|
19
17
|
}
|
|
18
|
+
|
|
19
|
+
protected override hydrateSqlNamespaceEntry(
|
|
20
|
+
nsId: string,
|
|
21
|
+
raw: Namespace | Record<string, unknown>,
|
|
22
|
+
): Namespace | SqlNamespaceTablesInput {
|
|
23
|
+
if (raw instanceof NamespaceBase) {
|
|
24
|
+
return raw;
|
|
25
|
+
}
|
|
26
|
+
const hydrated = blindCast<
|
|
27
|
+
SqlNamespaceTablesInput,
|
|
28
|
+
'super.hydrateSqlNamespaceEntry returns the tables form when raw is not a NamespaceBase'
|
|
29
|
+
>(super.hydrateSqlNamespaceEntry(nsId, raw));
|
|
30
|
+
return buildSqliteNamespace(hydrated);
|
|
31
|
+
}
|
|
20
32
|
}
|
|
@@ -1,9 +1,81 @@
|
|
|
1
1
|
import {
|
|
2
2
|
freezeNode,
|
|
3
|
+
type Namespace,
|
|
3
4
|
NamespaceBase,
|
|
4
5
|
UNBOUND_NAMESPACE_ID,
|
|
5
6
|
} from '@prisma-next/framework-components/ir';
|
|
6
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
type SqlNamespaceTablesInput,
|
|
9
|
+
StorageTable,
|
|
10
|
+
type StorageTableInput,
|
|
11
|
+
} from '@prisma-next/sql-contract/types';
|
|
12
|
+
import { blindCast, castAs } from '@prisma-next/utils/casts';
|
|
13
|
+
|
|
14
|
+
export type SqliteDatabaseInput = {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly entries: {
|
|
17
|
+
readonly table: Readonly<Record<string, StorageTable | StorageTableInput>>;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const SQLITE_NAMESPACE_KIND = 'sqlite-namespace' as const;
|
|
22
|
+
|
|
23
|
+
function isMaterializedSqliteNamespace(
|
|
24
|
+
ns: Namespace | SqlNamespaceTablesInput,
|
|
25
|
+
): ns is SqliteDatabase | SqliteUnboundDatabase {
|
|
26
|
+
if (typeof ns !== 'object' || ns === null) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const proto = Object.getPrototypeOf(ns);
|
|
30
|
+
if (proto === Object.prototype || proto === null) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return (ns as { kind?: unknown }).kind === SQLITE_NAMESPACE_KIND;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* SQLite namespace concretion carrying table metadata under
|
|
38
|
+
* `entries.table` and unqualified `qualifyTable()` emission for runtime
|
|
39
|
+
* SQL rendering.
|
|
40
|
+
*/
|
|
41
|
+
export class SqliteDatabase extends NamespaceBase {
|
|
42
|
+
declare readonly kind: string;
|
|
43
|
+
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly entries: Readonly<{
|
|
46
|
+
readonly table: Readonly<Record<string, StorageTable>>;
|
|
47
|
+
}>;
|
|
48
|
+
|
|
49
|
+
constructor(input: SqliteDatabaseInput) {
|
|
50
|
+
super();
|
|
51
|
+
this.id = input.id;
|
|
52
|
+
this.entries = Object.freeze({
|
|
53
|
+
table: Object.freeze(
|
|
54
|
+
Object.fromEntries(
|
|
55
|
+
Object.entries(input.entries.table).map(([k, v]) => [
|
|
56
|
+
k,
|
|
57
|
+
v instanceof StorageTable ? v : new StorageTable(v as StorageTableInput),
|
|
58
|
+
]),
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(this, 'kind', {
|
|
63
|
+
value: SQLITE_NAMESPACE_KIND,
|
|
64
|
+
writable: false,
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true,
|
|
67
|
+
});
|
|
68
|
+
freezeNode(this);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
qualifier(): string {
|
|
72
|
+
return '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
qualifyTable(tableName: string): string {
|
|
76
|
+
return `"${tableName}"`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
7
79
|
|
|
8
80
|
/**
|
|
9
81
|
* SQLite target `Namespace` concretion. SQLite has no schema or
|
|
@@ -22,43 +94,58 @@ import type { StorageTable } from '@prisma-next/sql-contract/types';
|
|
|
22
94
|
* `__unspecified__` AST bucket reaches the SQLite interpreter, which
|
|
23
95
|
* lowers it to this singleton.
|
|
24
96
|
*/
|
|
25
|
-
export class SqliteUnboundDatabase extends
|
|
97
|
+
export class SqliteUnboundDatabase extends SqliteDatabase {
|
|
26
98
|
static readonly instance: SqliteUnboundDatabase = new SqliteUnboundDatabase();
|
|
27
99
|
|
|
28
|
-
readonly kind = 'database' as const;
|
|
29
|
-
readonly id = UNBOUND_NAMESPACE_ID;
|
|
30
|
-
readonly tables: Readonly<Record<string, StorageTable>>;
|
|
31
|
-
|
|
32
100
|
private constructor() {
|
|
33
|
-
super();
|
|
34
|
-
this.tables = Object.freeze({});
|
|
35
|
-
freezeNode(this);
|
|
101
|
+
super({ id: UNBOUND_NAMESPACE_ID, entries: { table: {} } });
|
|
36
102
|
}
|
|
103
|
+
}
|
|
37
104
|
|
|
38
|
-
|
|
39
|
-
|
|
105
|
+
export function buildSqliteNamespace(
|
|
106
|
+
input: SqlNamespaceTablesInput,
|
|
107
|
+
): SqliteDatabase | SqliteUnboundDatabase {
|
|
108
|
+
if (input.id !== UNBOUND_NAMESPACE_ID) {
|
|
109
|
+
throw new Error(
|
|
110
|
+
`buildSqliteNamespace: SQLite has no schema concept; the only valid namespace id is "${UNBOUND_NAMESPACE_ID}" (received "${input.id}").`,
|
|
111
|
+
);
|
|
40
112
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return `"${tableName}"`;
|
|
113
|
+
if (Object.keys(input.entries.table).length === 0) {
|
|
114
|
+
return castAs<SqliteUnboundDatabase>(SqliteUnboundDatabase.instance);
|
|
44
115
|
}
|
|
116
|
+
return new SqliteDatabase({ id: input.id, entries: input.entries });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function buildSqliteNamespaceMap(
|
|
120
|
+
namespaces: Readonly<Record<string, Namespace | SqlNamespaceTablesInput>>,
|
|
121
|
+
): Readonly<Record<string, SqliteDatabase | SqliteUnboundDatabase>> {
|
|
122
|
+
return Object.fromEntries(
|
|
123
|
+
Object.entries(namespaces).map(([nsKey, ns]) => [
|
|
124
|
+
nsKey,
|
|
125
|
+
isMaterializedSqliteNamespace(ns)
|
|
126
|
+
? ns
|
|
127
|
+
: buildSqliteNamespace(
|
|
128
|
+
blindCast<
|
|
129
|
+
SqlNamespaceTablesInput,
|
|
130
|
+
'non-materialized SQLite namespace map entry is a SqlNamespaceTablesInput'
|
|
131
|
+
>(ns),
|
|
132
|
+
),
|
|
133
|
+
]),
|
|
134
|
+
);
|
|
45
135
|
}
|
|
46
136
|
|
|
47
137
|
/**
|
|
48
138
|
* Target-supplied `Namespace` factory the SQLite target plumbs through
|
|
49
139
|
* `defineContract({ createNamespace })`. SQLite has only one
|
|
50
140
|
* effective namespace slot — the framework `UNBOUND_NAMESPACE_ID`
|
|
51
|
-
* sentinel — so the factory always returns the singleton
|
|
52
|
-
*
|
|
53
|
-
* `defineContract` already rejects
|
|
54
|
-
* this throw is a structural
|
|
55
|
-
* surface.
|
|
141
|
+
* sentinel — so the factory always returns the singleton or a fresh
|
|
142
|
+
* `SqliteDatabase` for the unbound slot with tables. The SQL family's
|
|
143
|
+
* defensive validation in `defineContract` already rejects
|
|
144
|
+
* user-declared SQLite namespaces, so this throw is a structural
|
|
145
|
+
* safety net rather than a user-facing surface.
|
|
56
146
|
*/
|
|
57
|
-
export function sqliteCreateNamespace(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
throw new Error(
|
|
62
|
-
`sqliteCreateNamespace: SQLite has no schema concept; the only valid namespace id is "${UNBOUND_NAMESPACE_ID}" (received "${id}").`,
|
|
63
|
-
);
|
|
147
|
+
export function sqliteCreateNamespace(
|
|
148
|
+
input: SqlNamespaceTablesInput,
|
|
149
|
+
): SqliteDatabase | SqliteUnboundDatabase {
|
|
150
|
+
return buildSqliteNamespace(input);
|
|
64
151
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { datetime, integer, jsonText, sqliteTable, text } from '../contract-free/columns';
|
|
2
|
+
export {
|
|
3
|
+
buildControlTableBootstrapQueries,
|
|
4
|
+
buildSignMarkerBootstrapQueries,
|
|
5
|
+
} from '../contract-free/control-bootstrap';
|
|
6
|
+
export { createTable } from '../contract-free/ddl';
|
package/src/exports/runtime.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-DIbCXU65.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import { temporalAuthoringPresets } from '@prisma-next/family-sql/control';\nimport type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const sqliteAuthoringFieldPresets = {\n temporal: /* @__PURE__ */ temporalAuthoringPresets({\n codecId: 'sqlite/datetime@1',\n nativeType: 'text',\n }),\n} as const satisfies AuthoringFieldNamespace;\n","import type { CodecTypes } from '../exports/codec-types';\nimport { sqliteAuthoringFieldPresets } from './authoring';\nimport { sqliteTargetDescriptorMetaRuntime } from './descriptor-meta-runtime';\n\nconst sqliteTargetDescriptorMetaBase = {\n ...sqliteTargetDescriptorMetaRuntime,\n authoring: {\n field: sqliteAuthoringFieldPresets,\n },\n} as const;\n\nexport const sqliteTargetDescriptorMeta: typeof sqliteTargetDescriptorMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = sqliteTargetDescriptorMetaBase;\n"],"mappings":";;;AAGA,MAAa,8BAA8B,EACzC,UAA0B,yCAAyB;CACjD,SAAS;CACT,YAAY;AACd,CAAC,EACH;ACGA,MAAa,6BAET;CARF,GAAG;CACH,WAAW,EACT,OAAO,4BACT;AAKE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"planner-BBvwGy0f.mjs","names":[],"sources":["../src/core/migrations/planner-strategies.ts","../src/core/migrations/issue-planner.ts","../src/core/migrations/planner.ts"],"sourcesContent":["/**\n * SQLite migration strategies.\n *\n * Each strategy examines the issue list, consumes issues it handles, and\n * returns the `SqliteOpFactoryCall[]` to address them. The issue planner\n * runs each strategy in order and routes whatever's left through\n * `mapIssueToCall`.\n *\n * SQLite has no enums, no data-safe backfill, and no component-declared\n * database dependencies. The only recipe that needs strategy-level\n * multi-issue consumption is `recreateTable` (added in a later phase), which\n * absorbs type/nullability/default/constraint mismatches for a given table\n * into a single recreate operation.\n */\n\nimport type { Contract } from '@prisma-next/contract/types';\nimport type {\n CodecControlHooks,\n MigrationOperationClass,\n MigrationOperationPolicy,\n} from '@prisma-next/family-sql/control';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type { SchemaIssue } from '@prisma-next/framework-components/control';\nimport { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type {\n PostgresEnumStorageEntry,\n SqlStorage,\n StorageTable,\n StorageTypeInstance,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\nimport { toTableSpec } from './issue-planner';\nimport { DataTransformCall, RecreateTableCall, type SqliteOpFactoryCall } from './op-factory-call';\nimport type { SqliteIndexSpec } from './operations/shared';\nimport { buildRecreatePostchecks, buildRecreateSummary } from './operations/tables';\n\nexport interface StrategyContext {\n readonly toContract: Contract<SqlStorage>;\n readonly fromContract: Contract<SqlStorage> | null;\n readonly codecHooks: ReadonlyMap<string, CodecControlHooks>;\n readonly storageTypes: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>;\n readonly schema: SqlSchemaIR;\n readonly policy: MigrationOperationPolicy;\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n}\n\n/**\n * Look up a storage table by its explicit namespace coordinate. Returns\n * `undefined` when the namespace has no table by that name (or no such\n * namespace exists). Callers that get `undefined` MUST treat it as an\n * explicit conflict rather than silently falling back to a name-only\n * walk across namespaces — the SQLite target currently has a single\n * namespace, but this helper enforces the explicit-coordinate\n * discipline so a future multi-namespace SQLite shape inherits the\n * conflict-on-stale-coordinate behaviour the Postgres planner already\n * has.\n */\nexport function tableAt(\n storage: SqlStorage,\n namespaceId: string,\n tableName: string,\n): StorageTable | undefined {\n return storage.namespaces[namespaceId]?.tables[tableName] as StorageTable | undefined;\n}\n\n/**\n * Default namespace coordinate for an issue that does not carry one\n * explicitly. Hand-crafted unit-test issues fall back to `__unbound__`,\n * the only namespace any single-namespace contract carries —\n * verifier-emitted issues for legacy single-namespace contracts already\n * stamp this id explicitly. Typed structurally so issue variants\n * without a `namespaceId` slot flow through to the same fallback.\n */\nexport function resolveNamespaceIdForIssue(issue: { readonly namespaceId?: string }): string {\n return issue.namespaceId ?? UNBOUND_NAMESPACE_ID;\n}\n\nexport type CallMigrationStrategy = (\n issues: readonly SchemaIssue[],\n context: StrategyContext,\n) =>\n | {\n kind: 'match';\n issues: readonly SchemaIssue[];\n calls: readonly SqliteOpFactoryCall[];\n recipe?: boolean;\n }\n | { kind: 'no_match' };\n\n// ============================================================================\n// Recreate-table strategy\n// ============================================================================\n\nconst WIDENING_ISSUE_KINDS = new Set<SchemaIssue['kind']>(['default_mismatch', 'default_missing']);\n\nconst DESTRUCTIVE_ISSUE_KINDS = new Set<SchemaIssue['kind']>([\n 'extra_default',\n 'type_mismatch',\n 'primary_key_mismatch',\n 'foreign_key_mismatch',\n 'unique_constraint_mismatch',\n 'extra_foreign_key',\n 'extra_unique_constraint',\n 'extra_primary_key',\n]);\n\nfunction classifyIssue(issue: SchemaIssue): 'widening' | 'destructive' | null {\n if (issue.kind === 'enum_values_changed') return null;\n if (!issue.table) return null;\n if (issue.kind === 'nullability_mismatch') {\n // Relaxing (NOT NULL → nullable) is widening; tightening is destructive.\n return issue.expected === 'true' ? 'widening' : 'destructive';\n }\n if (WIDENING_ISSUE_KINDS.has(issue.kind)) return 'widening';\n if (DESTRUCTIVE_ISSUE_KINDS.has(issue.kind)) return 'destructive';\n return null;\n}\n\n/**\n * Groups recreate-eligible issues by table, decides per-table operation class\n * (destructive wins over widening), and emits one `RecreateTableCall` per\n * table. Returns unchanged-or-smaller issue list — issues the strategy\n * consumed are removed so `mapIssueToCall` doesn't double-handle them.\n */\nexport const recreateTableStrategy: CallMigrationStrategy = (issues, ctx) => {\n const byTable = new Map<\n string,\n { issues: SchemaIssue[]; hasDestructive: boolean; namespaceId: string }\n >();\n const consumed = new Set<SchemaIssue>();\n\n for (const issue of issues) {\n const cls = classifyIssue(issue);\n if (!cls) continue;\n if (issue.kind === 'enum_values_changed') continue;\n if (!issue.table) continue;\n const table = issue.table;\n const entry = byTable.get(table);\n if (entry) {\n entry.issues.push(issue);\n if (cls === 'destructive') entry.hasDestructive = true;\n } else {\n byTable.set(table, {\n issues: [issue],\n hasDestructive: cls === 'destructive',\n namespaceId: resolveNamespaceIdForIssue(issue),\n });\n }\n consumed.add(issue);\n }\n\n if (byTable.size === 0) return { kind: 'no_match' };\n\n const calls: SqliteOpFactoryCall[] = [];\n for (const [tableName, entry] of byTable) {\n const contractTable = tableAt(ctx.toContract.storage, entry.namespaceId, tableName);\n const schemaTable = ctx.schema.tables[tableName];\n if (!contractTable || !schemaTable) continue;\n const operationClass: MigrationOperationClass = entry.hasDestructive\n ? 'destructive'\n : 'widening';\n\n // Flatten the contract table to a self-contained spec — the Call holds\n // pre-rendered SQL fragments only, no `StorageColumn` or `storageTypes`.\n const tableSpec = toTableSpec(contractTable, ctx.storageTypes);\n\n const seenIndexColumnKeys = new Set<string>();\n const indexes: SqliteIndexSpec[] = [];\n for (const idx of contractTable.indexes) {\n const key = idx.columns.join(',');\n if (seenIndexColumnKeys.has(key)) continue;\n seenIndexColumnKeys.add(key);\n indexes.push({\n name: idx.name ?? defaultIndexName(tableName, idx.columns),\n columns: idx.columns,\n });\n }\n for (const fk of contractTable.foreignKeys) {\n if (fk.index === false) continue;\n const key = fk.source.columns.join(',');\n if (seenIndexColumnKeys.has(key)) continue;\n seenIndexColumnKeys.add(key);\n indexes.push({\n name: defaultIndexName(tableName, fk.source.columns),\n columns: fk.source.columns,\n });\n }\n\n calls.push(\n new RecreateTableCall({\n tableName,\n contractTable: tableSpec,\n schemaColumnNames: Object.keys(schemaTable.columns),\n indexes,\n summary: buildRecreateSummary(tableName, entry.issues),\n postchecks: buildRecreatePostchecks(tableName, entry.issues, tableSpec),\n operationClass,\n }),\n );\n }\n\n return {\n kind: 'match',\n issues: issues.filter((i) => !consumed.has(i)),\n calls,\n recipe: true,\n };\n};\n\n// ============================================================================\n// Nullability-tightening backfill strategy\n// ============================================================================\n\n/**\n * When the policy allows `'data'` and the contract tightens one or more\n * columns from nullable to NOT NULL, emit a `DataTransformCall` stub per\n * tightened column. The user fills the backfill `UPDATE` in the rendered\n * `migration.ts` before the subsequent `RecreateTableCall` copies data into\n * the tightened schema (whose `INSERT INTO temp SELECT … FROM old` would\n * otherwise fail at runtime if any `NULL`s remain).\n *\n * Does NOT consume the tightening issue — `recreateTableStrategy` still\n * needs it to produce the actual recreate that enforces the NOT NULL at\n * the schema level. The backfill op and the recreate op end up in the\n * recipe slot in strategy order (backfill first, recreate second), which\n * matches the required execution order.\n *\n * Mirrors Postgres's `nullableTighteningCallStrategy` / `'data'`-class\n * gating. When `'data'` is not in the policy (the default `db update` /\n * `db init` path), the strategy short-circuits and the recreate alone\n * runs with its current destructive-class gating — preserving today's\n * behavior where a tightening blows up at runtime if NULLs are present.\n */\nexport const nullabilityTighteningBackfillStrategy: CallMigrationStrategy = (issues, ctx) => {\n if (!ctx.policy.allowedOperationClasses.includes('data')) {\n return { kind: 'no_match' };\n }\n\n const calls: SqliteOpFactoryCall[] = [];\n for (const issue of issues) {\n if (issue.kind !== 'nullability_mismatch') continue;\n if (!issue.table || !issue.column) continue;\n // Tightening only: `expected === 'true'` means the contract wants the\n // column nullable (relaxing from NOT NULL → nullable), which is safe and\n // needs no backfill.\n if (issue.expected === 'true') continue;\n\n const namespaceId = resolveNamespaceIdForIssue(issue);\n const column = tableAt(ctx.toContract.storage, namespaceId, issue.table)?.columns[issue.column];\n if (!column || column.nullable === true) continue;\n\n calls.push(\n new DataTransformCall(\n `data_migration.backfill-${issue.table}-${issue.column}`,\n `Backfill NULLs in \"${issue.table}\".\"${issue.column}\" before NOT NULL tightening`,\n issue.table,\n issue.column,\n ),\n );\n }\n\n if (calls.length === 0) return { kind: 'no_match' };\n\n return {\n kind: 'match',\n issues,\n calls,\n recipe: true,\n };\n};\n\nexport const sqlitePlannerStrategies: readonly CallMigrationStrategy[] = [\n nullabilityTighteningBackfillStrategy,\n recreateTableStrategy,\n];\n","/**\n * SQLite migration issue planner.\n *\n * Takes schema issues (from `verifySqlSchema`) and emits migration IR\n * (`SqliteOpFactoryCall[]`). Strategies consume issues they recognize and\n * produce specialized call sequences (e.g. recreateTableStrategy absorbs\n * type/nullability/default/constraint mismatches into a single recreate op);\n * remaining issues flow through `mapIssueToCall` for the default case.\n */\n\nimport type { Contract } from '@prisma-next/contract/types';\nimport type {\n CodecControlHooks,\n MigrationOperationPolicy,\n SqlPlannerConflict,\n SqlPlannerConflictLocation,\n} from '@prisma-next/family-sql/control';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type { SchemaIssue } from '@prisma-next/framework-components/control';\nimport type {\n PostgresEnumStorageEntry,\n SqlStorage,\n StorageColumn,\n StorageTable,\n StorageTypeInstance,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';\nimport type { Result } from '@prisma-next/utils/result';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport {\n AddColumnCall,\n CreateIndexCall,\n CreateTableCall,\n DropColumnCall,\n DropIndexCall,\n DropTableCall,\n type SqliteOpFactoryCall,\n} from './op-factory-call';\nimport type {\n SqliteColumnSpec,\n SqliteForeignKeySpec,\n SqliteTableSpec,\n SqliteUniqueSpec,\n} from './operations/shared';\nimport {\n buildColumnDefaultSql,\n buildColumnTypeSql,\n isInlineAutoincrementPrimaryKey,\n} from './planner-ddl-builders';\nimport {\n type CallMigrationStrategy,\n resolveNamespaceIdForIssue,\n type StrategyContext,\n sqlitePlannerStrategies,\n tableAt,\n} from './planner-strategies';\nimport { CONTROL_TABLE_NAMES } from './statement-builders';\n\nexport type { CallMigrationStrategy, StrategyContext };\n\n// ============================================================================\n// Issue kind ordering (dependency order)\n// ============================================================================\n\nconst ISSUE_KIND_ORDER: Record<string, number> = {\n // Drops (reconciliation — clear the way for creates)\n extra_foreign_key: 10,\n extra_unique_constraint: 11,\n extra_primary_key: 12,\n extra_index: 13,\n extra_default: 14,\n extra_column: 15,\n extra_table: 16,\n\n // Tables before columns\n missing_table: 20,\n\n // Columns before constraints\n missing_column: 30,\n\n // Reconciliation alters (on existing objects)\n type_mismatch: 40,\n nullability_mismatch: 41,\n default_missing: 42,\n default_mismatch: 43,\n\n // Constraints after columns exist\n primary_key_mismatch: 50,\n unique_constraint_mismatch: 51,\n index_mismatch: 52,\n foreign_key_mismatch: 60,\n};\n\nfunction issueOrder(issue: SchemaIssue): number {\n return ISSUE_KIND_ORDER[issue.kind] ?? 99;\n}\n\nfunction issueKey(issue: SchemaIssue): string {\n const table = 'table' in issue && typeof issue.table === 'string' ? issue.table : '';\n const column = 'column' in issue && typeof issue.column === 'string' ? issue.column : '';\n const name =\n 'indexOrConstraint' in issue && typeof issue.indexOrConstraint === 'string'\n ? issue.indexOrConstraint\n : '';\n return `${table}\\u0000${column}\\u0000${name}`;\n}\n\n// ============================================================================\n// Conflict helpers\n// ============================================================================\n\nfunction issueConflict(\n kind: SqlPlannerConflict['kind'],\n summary: string,\n location?: SqlPlannerConflict['location'],\n): SqlPlannerConflict {\n return {\n kind,\n summary,\n why: 'Use `migration new` to author a custom migration for this change.',\n ...(location ? { location } : {}),\n };\n}\n\nfunction conflictKindForIssue(issue: SchemaIssue): SqlPlannerConflict['kind'] {\n switch (issue.kind) {\n case 'type_mismatch':\n return 'typeMismatch';\n case 'nullability_mismatch':\n return 'nullabilityConflict';\n case 'primary_key_mismatch':\n case 'unique_constraint_mismatch':\n case 'index_mismatch':\n case 'extra_primary_key':\n case 'extra_unique_constraint':\n return 'indexIncompatible';\n case 'foreign_key_mismatch':\n case 'extra_foreign_key':\n return 'foreignKeyConflict';\n default:\n return 'missingButNonAdditive';\n }\n}\n\nfunction issueLocation(issue: SchemaIssue): SqlPlannerConflictLocation | undefined {\n if (issue.kind === 'enum_values_changed') return undefined;\n const location: {\n table?: string;\n column?: string;\n constraint?: string;\n } = {};\n if (issue.table) location.table = issue.table;\n if (issue.column) location.column = issue.column;\n if (issue.indexOrConstraint) location.constraint = issue.indexOrConstraint;\n return Object.keys(location).length > 0 ? (location as SqlPlannerConflictLocation) : undefined;\n}\n\nfunction conflictForDisallowedCall(\n call: SqliteOpFactoryCall,\n allowed: readonly string[],\n): SqlPlannerConflict {\n const summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(', ')}`;\n const location = locationForCall(call);\n return {\n kind: conflictKindForCall(call),\n summary,\n why: 'Use `migration new` to author a custom migration for this change.',\n ...(location ? { location } : {}),\n };\n}\n\nfunction conflictKindForCall(call: SqliteOpFactoryCall): SqlPlannerConflict['kind'] {\n switch (call.factoryName) {\n case 'createIndex':\n case 'dropIndex':\n return 'indexIncompatible';\n default:\n return 'missingButNonAdditive';\n }\n}\n\nfunction locationForCall(call: SqliteOpFactoryCall): SqlPlannerConflictLocation | undefined {\n const location: { table?: string; column?: string; index?: string } = {};\n if ('tableName' in call) location.table = call.tableName;\n if ('columnName' in call) location.column = call.columnName;\n if ('indexName' in call) location.index = call.indexName;\n return Object.keys(location).length > 0 ? (location as SqlPlannerConflictLocation) : undefined;\n}\n\nfunction isMissing(issue: SchemaIssue): boolean {\n if (issue.kind === 'enum_values_changed') return false;\n return issue.actual === undefined;\n}\n\n// ============================================================================\n// StorageTable / StorageColumn → flat SqliteTableSpec\n// ============================================================================\n\n/**\n * Resolves codec / `typeRef` / default rendering into a flat\n * `SqliteColumnSpec`. Mirrors Postgres's `toColumnSpec`. Once a column is\n * flattened, downstream Calls and operation factories never see\n * `StorageColumn` again — they deal in pre-rendered SQL fragments.\n */\nexport function toColumnSpec(\n name: string,\n column: StorageColumn,\n storageTypes: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>,\n inlineAutoincrementPrimaryKey = false,\n): SqliteColumnSpec {\n const typeSql = buildColumnTypeSql(\n column,\n storageTypes as Record<string, StorageTypeInstance | PostgresEnumStorageEntry>,\n );\n const defaultSql = buildColumnDefaultSql(column.default);\n return {\n name,\n typeSql,\n defaultSql,\n nullable: column.nullable,\n ...(inlineAutoincrementPrimaryKey ? { inlineAutoincrementPrimaryKey: true } : {}),\n };\n}\n\n/**\n * Flattens a `StorageTable` into a `SqliteTableSpec` ready for\n * `CreateTableCall` / `RecreateTableCall`. Sole-column AUTOINCREMENT\n * primary keys are detected here and marked on the column spec so the\n * renderer emits `INTEGER PRIMARY KEY AUTOINCREMENT` inline.\n */\nexport function toTableSpec(\n table: StorageTable,\n storageTypes: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>,\n): SqliteTableSpec {\n const columns: SqliteColumnSpec[] = Object.entries(table.columns).map(([name, column]) =>\n toColumnSpec(name, column, storageTypes, isInlineAutoincrementPrimaryKey(table, name)),\n );\n const uniques: SqliteUniqueSpec[] = table.uniques.map((u) => ({\n columns: u.columns,\n ...(u.name !== undefined ? { name: u.name } : {}),\n }));\n const foreignKeys: SqliteForeignKeySpec[] = table.foreignKeys.map((fk) => ({\n columns: fk.source.columns,\n references: { table: fk.target.tableName, columns: fk.target.columns },\n constraint: fk.constraint !== false,\n ...(fk.name !== undefined ? { name: fk.name } : {}),\n ...(fk.onDelete !== undefined ? { onDelete: fk.onDelete } : {}),\n ...(fk.onUpdate !== undefined ? { onUpdate: fk.onUpdate } : {}),\n }));\n return {\n columns,\n ...(table.primaryKey ? { primaryKey: { columns: table.primaryKey.columns } } : {}),\n uniques,\n foreignKeys,\n };\n}\n\n// ============================================================================\n// Issue planner\n// ============================================================================\n\nexport interface IssuePlannerOptions {\n readonly issues: readonly SchemaIssue[];\n readonly toContract: Contract<SqlStorage>;\n readonly fromContract: Contract<SqlStorage> | null;\n readonly codecHooks: ReadonlyMap<string, CodecControlHooks>;\n readonly storageTypes: Readonly<Record<string, StorageTypeInstance | PostgresEnumStorageEntry>>;\n readonly schema?: SqlSchemaIR;\n readonly policy?: MigrationOperationPolicy;\n readonly frameworkComponents?: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n readonly strategies?: readonly CallMigrationStrategy[];\n}\n\nexport interface IssuePlannerValue {\n readonly calls: readonly SqliteOpFactoryCall[];\n}\n\nconst DEFAULT_POLICY: MigrationOperationPolicy = {\n allowedOperationClasses: ['additive', 'widening', 'destructive', 'data'],\n};\n\nfunction emptySchemaIR(): SqlSchemaIR {\n return { tables: {} };\n}\n\n// ============================================================================\n// Issue → Call mapping (per-issue default path)\n// ============================================================================\n\nfunction mapIssueToCall(\n issue: SchemaIssue,\n ctx: StrategyContext,\n): Result<readonly SqliteOpFactoryCall[], SqlPlannerConflict> {\n switch (issue.kind) {\n case 'missing_table': {\n if (!issue.table) {\n return notOk(\n issueConflict('unsupportedOperation', 'Missing table issue has no table name'),\n );\n }\n const namespaceId = resolveNamespaceIdForIssue(issue);\n const contractTable = tableAt(ctx.toContract.storage, namespaceId, issue.table);\n if (!contractTable) {\n return notOk(\n issueConflict(\n 'unsupportedOperation',\n `Table \"${issue.table}\" in namespace \"${namespaceId}\" reported missing but not found in destination contract`,\n ),\n );\n }\n const tableSpec = toTableSpec(contractTable, ctx.storageTypes);\n const calls: SqliteOpFactoryCall[] = [new CreateTableCall(issue.table, tableSpec)];\n const declaredIndexColumnKeys = new Set<string>();\n for (const index of contractTable.indexes) {\n const indexName = index.name ?? defaultIndexName(issue.table, index.columns);\n declaredIndexColumnKeys.add(index.columns.join(','));\n calls.push(new CreateIndexCall(issue.table, indexName, index.columns));\n }\n for (const fk of contractTable.foreignKeys) {\n if (fk.index === false) continue;\n if (declaredIndexColumnKeys.has(fk.source.columns.join(','))) continue;\n const indexName = defaultIndexName(issue.table, fk.source.columns);\n calls.push(new CreateIndexCall(issue.table, indexName, fk.source.columns));\n }\n return ok(calls);\n }\n\n case 'missing_column': {\n if (!issue.table || !issue.column) {\n return notOk(\n issueConflict('unsupportedOperation', 'Missing column issue has no table/column name'),\n );\n }\n const namespaceId = resolveNamespaceIdForIssue(issue);\n const contractTable2 = tableAt(ctx.toContract.storage, namespaceId, issue.table);\n const column = contractTable2?.columns[issue.column];\n if (!column) {\n return notOk(\n issueConflict(\n 'unsupportedOperation',\n `Column \"${issue.table}\".\"${issue.column}\" not in destination contract`,\n ),\n );\n }\n const contractTable = contractTable2;\n const columnSpec = toColumnSpec(\n issue.column,\n column,\n ctx.storageTypes,\n contractTable ? isInlineAutoincrementPrimaryKey(contractTable, issue.column) : false,\n );\n return ok([new AddColumnCall(issue.table, columnSpec)]);\n }\n\n case 'index_mismatch': {\n if (!issue.table) {\n return notOk(issueConflict('indexIncompatible', 'Index issue has no table name'));\n }\n if (!isMissing(issue) || !issue.expected) {\n return notOk(\n issueConflict(\n 'indexIncompatible',\n `Index on \"${issue.table}\" differs (expected: ${issue.expected}, actual: ${issue.actual})`,\n { table: issue.table },\n ),\n );\n }\n const namespaceId = resolveNamespaceIdForIssue(issue);\n const columns = issue.expected.split(', ');\n const contractTable = tableAt(ctx.toContract.storage, namespaceId, issue.table);\n if (!contractTable) {\n return notOk(\n issueConflict(\n 'unsupportedOperation',\n `Table \"${issue.table}\" not found in destination contract`,\n ),\n );\n }\n const explicitIndex = contractTable.indexes.find(\n (idx) => idx.columns.join(',') === columns.join(','),\n );\n const indexName = explicitIndex?.name ?? defaultIndexName(issue.table, columns);\n return ok([new CreateIndexCall(issue.table, indexName, columns)]);\n }\n\n case 'extra_table': {\n if (!issue.table) {\n return notOk(issueConflict('unsupportedOperation', 'Extra table issue has no table name'));\n }\n // Runner-owned control tables must never be dropped.\n if (CONTROL_TABLE_NAMES.has(issue.table)) return ok([]);\n return ok([new DropTableCall(issue.table)]);\n }\n\n case 'extra_column': {\n if (!issue.table || !issue.column) {\n return notOk(\n issueConflict('unsupportedOperation', 'Extra column issue has no table/column name'),\n );\n }\n return ok([new DropColumnCall(issue.table, issue.column)]);\n }\n\n case 'extra_index': {\n if (!issue.table || !issue.indexOrConstraint) {\n return notOk(\n issueConflict('unsupportedOperation', 'Extra index issue has no table/index name'),\n );\n }\n return ok([new DropIndexCall(issue.table, issue.indexOrConstraint)]);\n }\n\n // SQLite has no enum types (capability `sql.enums: false`). The verifier\n // should never emit `enum_values_changed` against a SQLite schema, so if\n // we receive one it is a verifier bug — surface it as an explicit\n // conflict rather than silently dropping it.\n case 'enum_values_changed':\n return notOk(\n issueConflict(\n 'unsupportedOperation',\n 'Received enum_values_changed against a SQLite schema (sql.enums: false) — verifier bug',\n ),\n );\n\n // Everything below is absorbed by recreateTableStrategy. If it falls\n // through here, policy or context didn't allow the recreate — surface as\n // a conflict.\n case 'type_mismatch':\n case 'nullability_mismatch':\n case 'default_mismatch':\n case 'default_missing':\n case 'extra_default':\n case 'primary_key_mismatch':\n case 'unique_constraint_mismatch':\n case 'foreign_key_mismatch':\n case 'extra_foreign_key':\n case 'extra_unique_constraint':\n case 'extra_primary_key':\n return notOk(issueConflict(conflictKindForIssue(issue), issue.message, issueLocation(issue)));\n\n default:\n return notOk(\n issueConflict(\n 'unsupportedOperation',\n `Unhandled issue kind: ${(issue as SchemaIssue).kind}`,\n ),\n );\n }\n}\n\n// ============================================================================\n// Call categorization for final emission order\n// ============================================================================\n\ntype CallCategory =\n | 'drop-column'\n | 'drop-index'\n | 'drop-table'\n | 'create-table'\n | 'add-column'\n | 'create-index';\n\nfunction classifyCall(call: SqliteOpFactoryCall): CallCategory | null {\n switch (call.factoryName) {\n case 'createTable':\n return 'create-table';\n case 'addColumn':\n return 'add-column';\n case 'createIndex':\n return 'create-index';\n case 'dropColumn':\n return 'drop-column';\n case 'dropIndex':\n return 'drop-index';\n case 'dropTable':\n return 'drop-table';\n // recreateTable goes into the recipe slot; return null for bucketable.\n case 'recreateTable':\n return null;\n default:\n return null;\n }\n}\n\n// ============================================================================\n// Top-level planIssues\n// ============================================================================\n\nexport function planIssues(\n options: IssuePlannerOptions,\n): Result<IssuePlannerValue, readonly SqlPlannerConflict[]> {\n const policyProvided = options.policy !== undefined;\n const policy = options.policy ?? DEFAULT_POLICY;\n const schema = options.schema ?? emptySchemaIR();\n const frameworkComponents = options.frameworkComponents ?? [];\n\n const context: StrategyContext = {\n toContract: options.toContract,\n fromContract: options.fromContract,\n codecHooks: options.codecHooks,\n storageTypes: options.storageTypes,\n schema,\n policy,\n frameworkComponents,\n };\n\n const strategies = options.strategies ?? sqlitePlannerStrategies;\n\n let remaining = options.issues;\n const recipeCalls: SqliteOpFactoryCall[] = [];\n const bucketableCalls: SqliteOpFactoryCall[] = [];\n\n for (const strategy of strategies) {\n const result = strategy(remaining, context);\n if (result.kind === 'match') {\n remaining = result.issues;\n if (result.recipe) {\n recipeCalls.push(...result.calls);\n } else {\n bucketableCalls.push(...result.calls);\n }\n }\n }\n\n const sorted = [...remaining].sort((a, b) => {\n const kindDelta = issueOrder(a) - issueOrder(b);\n if (kindDelta !== 0) return kindDelta;\n const keyA = issueKey(a);\n const keyB = issueKey(b);\n return keyA < keyB ? -1 : keyA > keyB ? 1 : 0;\n });\n\n const defaultCalls: SqliteOpFactoryCall[] = [];\n const conflicts: SqlPlannerConflict[] = [];\n\n for (const issue of sorted) {\n const result = mapIssueToCall(issue, context);\n if (result.ok) {\n defaultCalls.push(...result.value);\n } else {\n conflicts.push(result.failure);\n }\n }\n\n // Policy gating for recipe + bucketable. Default-mapped calls for disallowed\n // classes never get here (they're surfaced as per-issue conflicts above).\n const allowed = policy.allowedOperationClasses;\n let gatedRecipe = recipeCalls;\n let gatedBucketable = bucketableCalls;\n let gatedDefault = defaultCalls;\n if (policyProvided) {\n const sink = (acc: SqliteOpFactoryCall[]) => (call: SqliteOpFactoryCall) => {\n if (allowed.includes(call.operationClass)) {\n acc.push(call);\n return;\n }\n conflicts.push(conflictForDisallowedCall(call, allowed));\n };\n const gatedRecipeBucket: SqliteOpFactoryCall[] = [];\n const gatedBucketableBucket: SqliteOpFactoryCall[] = [];\n const gatedDefaultBucket: SqliteOpFactoryCall[] = [];\n recipeCalls.forEach(sink(gatedRecipeBucket));\n bucketableCalls.forEach(sink(gatedBucketableBucket));\n defaultCalls.forEach(sink(gatedDefaultBucket));\n gatedRecipe = gatedRecipeBucket;\n gatedBucketable = gatedBucketableBucket;\n gatedDefault = gatedDefaultBucket;\n }\n\n if (conflicts.length > 0) {\n return notOk(conflicts);\n }\n\n // Final emission order matches the current monolithic planner:\n // create-table → add-column → create-index → recreate → drop-column → drop-index → drop-table\n const combined = [...gatedDefault, ...gatedBucketable];\n const byCategory = (cat: CallCategory) => combined.filter((c) => classifyCall(c) === cat);\n\n const calls: SqliteOpFactoryCall[] = [\n ...byCategory('create-table'),\n ...byCategory('add-column'),\n ...byCategory('create-index'),\n ...gatedRecipe,\n ...byCategory('drop-column'),\n ...byCategory('drop-index'),\n ...byCategory('drop-table'),\n ];\n\n return ok({ calls });\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type {\n MigrationOperationPolicy,\n SqlMigrationPlanner,\n SqlMigrationPlannerPlanOptions,\n SqlPlannerFailureResult,\n} from '@prisma-next/family-sql/control';\nimport {\n extractCodecControlHooks,\n planFieldEventOperations,\n plannerFailure,\n} from '@prisma-next/family-sql/control';\nimport { verifySqlSchema } from '@prisma-next/family-sql/schema-verify';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type {\n MigrationPlanner,\n MigrationScaffoldContext,\n SchemaIssue,\n} from '@prisma-next/framework-components/control';\nimport { parseSqliteDefault } from '../default-normalizer';\nimport { normalizeSqliteNativeType } from '../native-type-normalizer';\nimport { planIssues } from './issue-planner';\nimport {\n type SqliteMigrationDestinationInfo,\n TypeScriptRenderableSqliteMigration,\n} from './planner-produced-sqlite-migration';\nimport { sqlitePlannerStrategies } from './planner-strategies';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\n\nexport function createSqliteMigrationPlanner(): SqliteMigrationPlanner {\n return new SqliteMigrationPlanner();\n}\n\nexport type SqlitePlanResult =\n | { readonly kind: 'success'; readonly plan: TypeScriptRenderableSqliteMigration }\n | SqlPlannerFailureResult;\n\n/**\n * SQLite migration planner — a thin wrapper over `planIssues`.\n *\n * `plan()` verifies the live schema against the target contract (producing\n * `SchemaIssue[]`) and delegates to `planIssues` with the registered\n * strategies. Strategies absorb groups of related issues into composite\n * recipes (e.g. recreating a table to apply type/nullability/default/\n * constraint changes at once); anything not absorbed by a strategy flows\n * through `mapIssueToCall` in the issue planner as a one-off call.\n *\n * FK-backing indexes are surfaced by `verifySqlSchema`'s index expansion\n * (see `verify-sql-schema.ts:459-469`), so `mapIssueToCall` handles them\n * uniformly alongside user-declared indexes.\n */\nexport class SqliteMigrationPlanner\n implements SqlMigrationPlanner<SqlitePlanTargetDetails>, MigrationPlanner<'sql', 'sqlite'>\n{\n plan(options: {\n readonly contract: unknown;\n readonly schema: unknown;\n readonly policy: MigrationOperationPolicy;\n /**\n * The \"from\" contract (state the planner assumes the database starts at),\n * or `null` for reconciliation flows.\n *\n * Typed as the framework `Contract | null` to satisfy the\n * `MigrationPlanner` interface contract; `planSql` narrows to the SQL\n * shape via `SqlMigrationPlannerPlanOptions`. Used to populate\n * `describe().from` on the produced plan as\n * `fromContract?.storage.storageHash ?? null`.\n */\n readonly fromContract: Contract | null;\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;\n /**\n * Contract space this plan applies to. Stamped onto the produced\n * {@link TypeScriptRenderableSqliteMigration.spaceId} so the runner keys\n * the marker row by the right space.\n */\n readonly spaceId: string;\n }): SqlitePlanResult {\n return this.planSql(options as SqlMigrationPlannerPlanOptions);\n }\n\n emptyMigration(\n context: MigrationScaffoldContext,\n spaceId: string,\n ): TypeScriptRenderableSqliteMigration {\n return new TypeScriptRenderableSqliteMigration(\n [],\n {\n from: context.fromHash,\n to: context.toHash,\n },\n spaceId,\n );\n }\n\n private planSql(options: SqlMigrationPlannerPlanOptions): SqlitePlanResult {\n const policyResult = this.ensureAdditivePolicy(options.policy);\n if (policyResult) return policyResult;\n\n const schemaIssues = this.collectSchemaIssues(options);\n const codecHooks = extractCodecControlHooks(options.frameworkComponents);\n const storageTypes = options.contract.storage.types ?? {};\n\n const result = planIssues({\n issues: schemaIssues,\n toContract: options.contract,\n fromContract: options.fromContract,\n codecHooks,\n storageTypes,\n schema: options.schema,\n policy: options.policy,\n frameworkComponents: options.frameworkComponents,\n strategies: sqlitePlannerStrategies,\n });\n\n if (!result.ok) {\n return plannerFailure(result.failure);\n }\n\n // Codec lifecycle hook (T2.2): inline `onFieldEvent`-emitted ops after\n // structural DDL. Sub-spec § 5 fixes the ordering as\n // `structural → added → dropped → altered`, with within-group sorting by\n // `(tableName, fieldName)` deterministic for byte-stable re-emits.\n // Hook fires only at the application emitter — extension-space planning\n // (M2 R2) never reaches this helper.\n const fieldEventOps = planFieldEventOperations({\n priorContract: options.fromContract,\n newContract: options.contract,\n codecHooks,\n });\n // Codec-emitted calls already conform to `OpFactoryCall` — render +\n // toOp + importRequirements ride directly through the same emit path\n // as structural ops, no `RawSqlCall` wrap.\n const calls = [...result.value.calls, ...fieldEventOps];\n\n const destination: SqliteMigrationDestinationInfo = {\n storageHash: options.contract.storage.storageHash,\n ...(options.contract.profileHash !== undefined\n ? { profileHash: options.contract.profileHash }\n : {}),\n };\n\n return {\n kind: 'success' as const,\n plan: new TypeScriptRenderableSqliteMigration(\n calls,\n {\n from: options.fromContract?.storage.storageHash ?? null,\n to: options.contract.storage.storageHash,\n },\n options.spaceId,\n destination,\n ),\n };\n }\n\n private ensureAdditivePolicy(policy: MigrationOperationPolicy): SqlPlannerFailureResult | null {\n if (!policy.allowedOperationClasses.includes('additive')) {\n return plannerFailure([\n {\n kind: 'unsupportedOperation',\n summary: 'Migration planner requires additive operations be allowed',\n why: 'The planner requires the \"additive\" operation class to be allowed in the policy.',\n },\n ]);\n }\n return null;\n }\n\n private collectSchemaIssues(options: SqlMigrationPlannerPlanOptions): readonly SchemaIssue[] {\n const allowed = options.policy.allowedOperationClasses;\n const strict = allowed.includes('widening') || allowed.includes('destructive');\n const verifyResult = verifySqlSchema({\n contract: options.contract,\n schema: options.schema,\n strict,\n typeMetadataRegistry: new Map(),\n frameworkComponents: options.frameworkComponents,\n normalizeDefault: parseSqliteDefault,\n normalizeNativeType: normalizeSqliteNativeType,\n });\n return verifyResult.schema.issues;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,QACd,SACA,aACA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