@prisma-next/target-sqlite 0.15.0-dev.9 → 0.16.0-dev.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.
Files changed (76) hide show
  1. package/dist/{codec-ids-BfPkjMmk.d.mts → codec-ids-Dof8fZfe.d.mts} +1 -2
  2. package/dist/codec-ids-Dof8fZfe.d.mts.map +1 -0
  3. package/dist/codec-ids.d.mts +1 -1
  4. package/dist/{codec-types-izdPhp_9.d.mts → codec-types-CcFkbJ3o.d.mts} +3 -4
  5. package/dist/codec-types-CcFkbJ3o.d.mts.map +1 -0
  6. package/dist/codec-types.d.mts +2 -2
  7. package/dist/{codecs-BGeJavlQ.d.mts → codecs-DGgo--O0.d.mts} +2 -3
  8. package/dist/codecs-DGgo--O0.d.mts.map +1 -0
  9. package/dist/codecs.d.mts +1 -1
  10. package/dist/contract-free.d.mts +1 -2
  11. package/dist/contract-free.d.mts.map +1 -1
  12. package/dist/control-tables.d.mts.map +1 -1
  13. package/dist/control.d.mts +0 -1
  14. package/dist/control.d.mts.map +1 -1
  15. package/dist/control.mjs +14 -14
  16. package/dist/control.mjs.map +1 -1
  17. package/dist/ddl.d.mts +1 -1
  18. package/dist/default-normalizer.d.mts +0 -1
  19. package/dist/default-normalizer.d.mts.map +1 -1
  20. package/dist/{descriptor-meta-D1fap-5t.mjs → descriptor-meta-BPrgV878.mjs} +12 -6
  21. package/dist/descriptor-meta-BPrgV878.mjs.map +1 -0
  22. package/dist/migration.d.mts +2 -3
  23. package/dist/migration.d.mts.map +1 -1
  24. package/dist/migration.mjs +2 -2
  25. package/dist/native-type-normalizer.d.mts.map +1 -1
  26. package/dist/{nodes-VzaaeUTb.d.mts → nodes-COZjF41I.d.mts} +1 -2
  27. package/dist/nodes-COZjF41I.d.mts.map +1 -0
  28. package/dist/{op-factory-call-BlMqc5G_.mjs → op-factory-call-8pTnIHhR.mjs} +2 -2
  29. package/dist/{op-factory-call-BlMqc5G_.mjs.map → op-factory-call-8pTnIHhR.mjs.map} +1 -1
  30. package/dist/op-factory-call.d.mts +2 -3
  31. package/dist/op-factory-call.d.mts.map +1 -1
  32. package/dist/op-factory-call.mjs +1 -1
  33. package/dist/pack.d.mts +41 -2
  34. package/dist/pack.d.mts.map +1 -1
  35. package/dist/pack.mjs +1 -1
  36. package/dist/{planner-CxbLEZHF.mjs → planner-D4B8Rugz.mjs} +3 -3
  37. package/dist/{planner-CxbLEZHF.mjs.map → planner-D4B8Rugz.mjs.map} +1 -1
  38. package/dist/{planner-produced-sqlite-migration-DKopa0rd.d.mts → planner-produced-sqlite-migration-C9k0q8Il.d.mts} +2 -3
  39. package/dist/planner-produced-sqlite-migration-C9k0q8Il.d.mts.map +1 -0
  40. package/dist/{planner-produced-sqlite-migration-D5415zDp.mjs → planner-produced-sqlite-migration-hyDa7QK-.mjs} +2 -2
  41. package/dist/{planner-produced-sqlite-migration-D5415zDp.mjs.map → planner-produced-sqlite-migration-hyDa7QK-.mjs.map} +1 -1
  42. package/dist/planner-produced-sqlite-migration.d.mts +1 -1
  43. package/dist/planner-produced-sqlite-migration.mjs +1 -1
  44. package/dist/planner-target-details-xR6UfIcz.d.mts.map +1 -1
  45. package/dist/planner.d.mts +1 -2
  46. package/dist/planner.d.mts.map +1 -1
  47. package/dist/planner.mjs +1 -1
  48. package/dist/render-ops.d.mts +0 -1
  49. package/dist/render-ops.d.mts.map +1 -1
  50. package/dist/runtime.d.mts +1 -2
  51. package/dist/runtime.d.mts.map +1 -1
  52. package/dist/{shared-CaiRyjA0.d.mts → shared-DLUM4Ae2.d.mts} +1 -2
  53. package/dist/shared-DLUM4Ae2.d.mts.map +1 -0
  54. package/dist/sql-utils.d.mts.map +1 -1
  55. package/dist/{sqlite-contract-view-J32K82Gi.d.mts → sqlite-contract-view-CMgE0L4W.d.mts} +4 -3
  56. package/dist/sqlite-contract-view-CMgE0L4W.d.mts.map +1 -0
  57. package/dist/{sqlite-migration-Dzz9p0Gw.d.mts → sqlite-migration-BbSrmBAa.d.mts} +5 -6
  58. package/dist/sqlite-migration-BbSrmBAa.d.mts.map +1 -0
  59. package/dist/{sqlite-migration-WdRHavfF.mjs → sqlite-migration-BcFf2OFa.mjs} +8 -8
  60. package/dist/sqlite-migration-BcFf2OFa.mjs.map +1 -0
  61. package/package.json +19 -19
  62. package/src/core/authoring.ts +11 -5
  63. package/src/core/errors.ts +12 -8
  64. package/src/core/migrations/op-factory-call.ts +1 -1
  65. package/src/core/migrations/runner.ts +13 -12
  66. package/src/core/migrations/sqlite-migration.ts +2 -2
  67. package/dist/codec-ids-BfPkjMmk.d.mts.map +0 -1
  68. package/dist/codec-types-izdPhp_9.d.mts.map +0 -1
  69. package/dist/codecs-BGeJavlQ.d.mts.map +0 -1
  70. package/dist/descriptor-meta-D1fap-5t.mjs.map +0 -1
  71. package/dist/nodes-VzaaeUTb.d.mts.map +0 -1
  72. package/dist/planner-produced-sqlite-migration-DKopa0rd.d.mts.map +0 -1
  73. package/dist/shared-CaiRyjA0.d.mts.map +0 -1
  74. package/dist/sqlite-contract-view-J32K82Gi.d.mts.map +0 -1
  75. package/dist/sqlite-migration-Dzz9p0Gw.d.mts.map +0 -1
  76. package/dist/sqlite-migration-WdRHavfF.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-contract-view-CMgE0L4W.d.mts","names":[],"sources":["../src/core/sqlite-contract-view.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;KAwBY,mBAAmB,kBAAkB,SAAS,cAAc,SAAS,eAC/E,uBAAuB;cAEZ;;OAEN,kBAAkB,SAAS,aAAW,UAAY,YAAY,mBAAmB;;WAK7E,kBAAkB,SAAS,cAAW,SAAA,qBAAA,gBAE5C,mBAAmB"}
@@ -1,6 +1,6 @@
1
1
  import { t as SqlitePlanTargetDetails } from "./planner-target-details-xR6UfIcz.mjs";
2
- import { i as SqliteTableSpec, n as SqliteColumnSpec, r as SqliteIndexSpec } from "./shared-CaiRyjA0.mjs";
3
- import { t as SqliteContractView } from "./sqlite-contract-view-J32K82Gi.mjs";
2
+ import { i as SqliteTableSpec, n as SqliteColumnSpec, r as SqliteIndexSpec } from "./shared-DLUM4Ae2.mjs";
3
+ import { t as SqliteContractView } from "./sqlite-contract-view-CMgE0L4W.mjs";
4
4
  import { DdlColumn, DdlTableConstraint } from "@prisma-next/sql-relational-core/ast";
5
5
  import { SqlStorage } from "@prisma-next/sql-contract/types";
6
6
  import { MigrationOperationClass, SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
@@ -8,7 +8,6 @@ import { ControlStack } from "@prisma-next/framework-components/control";
8
8
  import { Migration } from "@prisma-next/family-sql/migration";
9
9
  import { Contract } from "@prisma-next/contract/types";
10
10
  import { SqlControlAdapter } from "@prisma-next/family-sql/control-adapter";
11
-
12
11
  //#region src/core/migrations/sqlite-migration.d.ts
13
12
  type Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;
14
13
  /**
@@ -39,12 +38,12 @@ declare abstract class SqliteMigration<Start extends Contract<SqlStorage> = Cont
39
38
  * Materialized SQLite control adapter, created once per migration
40
39
  * instance from the injected stack. `undefined` only when the migration
41
40
  * was instantiated without a stack (test fixtures); `controlAdapterFor`
42
- * throws a PN-MIG-2008 in that case to surface the misuse.
41
+ * throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING in that case to surface the misuse.
43
42
  */
44
43
  protected readonly controlAdapter: SqlControlAdapter<'sqlite'> | undefined;
45
44
  constructor(stack?: ControlStack<'sql', 'sqlite'>);
46
45
  /**
47
- * Returns the materialized control adapter, or throws a PN-MIG-2008 naming
46
+ * Returns the materialized control adapter, or throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING naming
48
47
  * `operation` when the migration was constructed without a `ControlStack`.
49
48
  * Single home for the null-check that every DDL/DML method shares.
50
49
  */
@@ -101,4 +100,4 @@ declare abstract class SqliteMigration<Start extends Contract<SqlStorage> = Cont
101
100
  }
102
101
  //#endregion
103
102
  export { SqliteMigration as t };
104
- //# sourceMappingURL=sqlite-migration-Dzz9p0Gw.d.mts.map
103
+ //# sourceMappingURL=sqlite-migration-BbSrmBAa.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-migration-BbSrmBAa.d.mts","names":[],"sources":["../src/core/migrations/sqlite-migration.ts"],"mappings":";;;;;;;;;;;KA0BK,KAAK,0BAA0B;;;;;;;;;;;;;;;;;;;;;;uBAuBd,gBACpB,cAAc,SAAS,cAAc,SAAS,aAC9C,YAAY,SAAS,cAAc,SAAS,qBACpC,UAAa,mCAAmC,OAAO;;WACtD;;;;;;;qBAQU,gBAAgB;cAWvB,QAAQ;;;;;;UAeZ;;;;;;MAYJ,eAAe,mBAAmB;;;;;MAQlC,iBAAiB,mBAAmB;YAI9B,YAAY;aACX;aACA;aACA,kBAAkB;aAClB,uBAAuB;MAC9B,QAAQ;YAMF,UAAU;aAAoB;MAAkB,QAAQ;YAIxD,UAAU;aACT;aACA,QAAQ;MACf,QAAQ;YAMF,WAAW;aAAoB;aAAwB;MAAmB,QAAQ;YAMlF,YAAY;aACX;aACA;aACA;MACP,QAAQ;YAMF,UAAU;aAAoB;aAAwB;MAAkB,QAAQ;YAMhF,cAAc;aACb;aACA,eAAe;aACf;aACA,kBAAkB;aAClB;aACA;eAAgC;eAA8B;;aAC9D,gBAAgB;MACvB,QAAQ"}
@@ -1,4 +1,4 @@
1
- import { a as DropColumnCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from "./op-factory-call-BlMqc5G_.mjs";
1
+ import { a as DropColumnCall, l as RecreateTableCall, n as CreateIndexCall, o as DropIndexCall, r as CreateTableCall, s as DropTableCall, t as AddColumnCall } from "./op-factory-call-8pTnIHhR.mjs";
2
2
  import { t as SqliteContractView } from "./sqlite-contract-view-B8qeCczc.mjs";
3
3
  import { blindCast } from "@prisma-next/utils/casts";
4
4
  import { Migration } from "@prisma-next/family-sql/migration";
@@ -17,8 +17,9 @@ import { CliStructuredError } from "@prisma-next/errors/control";
17
17
  * The `operation` argument is required so every throw site names the operation
18
18
  * that actually failed; a new operation cannot inherit a misattributed message.
19
19
  *
20
- * Distinct from `PN-MIG-2001` (placeholder not filled) because the missing
21
- * input is the stack itself, not the per-operation contract.
20
+ * Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)
21
+ * because the missing input is the stack itself, not the per-operation
22
+ * contract.
22
23
  *
23
24
  * Lives in `@prisma-next/target-sqlite/errors` rather than the shared
24
25
  * framework migration errors module because the failure is target-specific:
@@ -26,8 +27,7 @@ import { CliStructuredError } from "@prisma-next/errors/control";
26
27
  * adapter, the SQLite-target stack) only exists in this package.
27
28
  */
28
29
  function errorSqliteMigrationStackMissing(operation) {
29
- return new CliStructuredError("2008", `SqliteMigration.${operation} requires a control adapter`, {
30
- domain: "MIG",
30
+ return new CliStructuredError("MIGRATION.SQLITE_CONTROL_STACK_MISSING", `SqliteMigration.${operation} requires a control adapter`, {
31
31
  why: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,
32
32
  fix: "Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.",
33
33
  meta: { operation }
@@ -62,7 +62,7 @@ var SqliteMigration = class extends Migration {
62
62
  * Materialized SQLite control adapter, created once per migration
63
63
  * instance from the injected stack. `undefined` only when the migration
64
64
  * was instantiated without a stack (test fixtures); `controlAdapterFor`
65
- * throws a PN-MIG-2008 in that case to surface the misuse.
65
+ * throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING in that case to surface the misuse.
66
66
  */
67
67
  controlAdapter;
68
68
  #endView = new MigrationContractViews(this, "SqliteMigration", (json) => SqliteContractView.fromJson(json));
@@ -72,7 +72,7 @@ var SqliteMigration = class extends Migration {
72
72
  this.controlAdapter = stack?.adapter ? blindCast(stack.adapter.create(stack)) : void 0;
73
73
  }
74
74
  /**
75
- * Returns the materialized control adapter, or throws a PN-MIG-2008 naming
75
+ * Returns the materialized control adapter, or throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING naming
76
76
  * `operation` when the migration was constructed without a `ControlStack`.
77
77
  * Single home for the null-check that every DDL/DML method shares.
78
78
  */
@@ -120,4 +120,4 @@ var SqliteMigration = class extends Migration {
120
120
  //#endregion
121
121
  export { SqliteMigration as t };
122
122
 
123
- //# sourceMappingURL=sqlite-migration-WdRHavfF.mjs.map
123
+ //# sourceMappingURL=sqlite-migration-BcFf2OFa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-migration-BcFf2OFa.mjs","names":["SqlMigration","#endView","#startView"],"sources":["../src/core/errors.ts","../src/core/migrations/sqlite-migration.ts"],"sourcesContent":["import { CliStructuredError } from '@prisma-next/errors/control';\n\n/**\n * A `SqliteMigration` operation that needs the materialized control adapter\n * — named by `operation` (e.g. `createTable`, `dropColumn`, `recreateTable`) —\n * was invoked, but the migration was constructed without a `ControlStack`.\n * Concrete authoring usage always goes through the migration CLI entrypoint,\n * which assembles a stack from the loaded `prisma-next.config.ts`; reaching this\n * error means a test fixture or ad-hoc consumer instantiated `SqliteMigration`\n * with the no-arg form (legal for `operations` / `describe` introspection only).\n *\n * The `operation` argument is required so every throw site names the operation\n * that actually failed; a new operation cannot inherit a misattributed message.\n *\n * Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)\n * because the missing input is the stack itself, not the per-operation\n * contract.\n *\n * Lives in `@prisma-next/target-sqlite/errors` rather than the shared\n * framework migration errors module because the failure is target-specific:\n * the contract it talks about (`SqliteMigration`, the SQLite control\n * adapter, the SQLite-target stack) only exists in this package.\n */\nexport function errorSqliteMigrationStackMissing(operation: string): CliStructuredError {\n return new CliStructuredError(\n 'MIGRATION.SQLITE_CONTROL_STACK_MISSING',\n `SqliteMigration.${operation} requires a control adapter`,\n {\n why: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,\n fix: 'Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.',\n meta: { operation },\n },\n );\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type {\n MigrationOperationClass,\n SqlMigrationPlanOperation,\n} from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport { Migration as SqlMigration } from '@prisma-next/family-sql/migration';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { MigrationContractViews } from '@prisma-next/migration-tools/migration';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-core/ast';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { errorSqliteMigrationStackMissing } from '../errors';\nimport { SqliteContractView } from '../sqlite-contract-view';\nimport {\n AddColumnCall,\n CreateIndexCall,\n CreateTableCall,\n DropColumnCall,\n DropIndexCall,\n DropTableCall,\n RecreateTableCall,\n} from './op-factory-call';\nimport type { SqliteColumnSpec, SqliteIndexSpec, SqliteTableSpec } from './operations/shared';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\n\ntype Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;\n\n/**\n * Target-owned base class for SQLite migrations. Fixes the `SqlMigration`\n * generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the\n * SQLite literal, so both user-authored migrations and renderer-generated\n * scaffolds can extend `SqliteMigration` directly without redeclaring\n * target-local identity.\n *\n * The constructor materializes a single SQLite `SqlControlAdapter` from\n * `stack.adapter.create(stack)` and stores it; the protected instance methods\n * forward to the corresponding `*Call` with that stored adapter, so user\n * migrations can write `this.createTable({...})` without threading the adapter\n * through every call.\n *\n * Binds the framework base's `Start` / `End` contract generics so a subclass\n * that assigns its `start-contract.json` / `end-contract.json` imports gets\n * fully-typed view accessors: `this.endContract` is a `SqliteContractView<End>`\n * (sole namespace unwrapped to the root — `this.endContract.table.<name>`),\n * built lazily from the JSON fields via the shared `MigrationContractViews`\n * helper. Mirrors `MongoMigration`'s view getters; the framework base derives\n * `describe()` from the same JSON.\n */\nexport abstract class SqliteMigration<\n Start extends Contract<SqlStorage> = Contract<SqlStorage>,\n End extends Contract<SqlStorage> = Contract<SqlStorage>,\n> extends SqlMigration<SqlitePlanTargetDetails, 'sqlite', Start, End> {\n readonly targetId = 'sqlite' as const;\n\n /**\n * Materialized SQLite control adapter, created once per migration\n * instance from the injected stack. `undefined` only when the migration\n * was instantiated without a stack (test fixtures); `controlAdapterFor`\n * throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING in that case to surface the misuse.\n */\n protected readonly controlAdapter: SqlControlAdapter<'sqlite'> | undefined;\n\n #endView = new MigrationContractViews<SqliteContractView<End>>(this, 'SqliteMigration', (json) =>\n SqliteContractView.fromJson<End>(json),\n );\n #startView = new MigrationContractViews<SqliteContractView<Start>>(\n this,\n 'SqliteMigration',\n (json) => SqliteContractView.fromJson<Start>(json),\n );\n\n constructor(stack?: ControlStack<'sql', 'sqlite'>) {\n super(stack);\n this.controlAdapter = stack?.adapter\n ? blindCast<\n SqlControlAdapter<'sqlite'>,\n 'The SQLite descriptor create() returns SqlControlAdapter<sqlite>; typed as wider ControlAdapterInstance at the framework boundary'\n >(stack.adapter.create(stack))\n : undefined;\n }\n\n /**\n * Returns the materialized control adapter, or throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING naming\n * `operation` when the migration was constructed without a `ControlStack`.\n * Single home for the null-check that every DDL/DML method shares.\n */\n private controlAdapterFor(operation: string): SqlControlAdapter<'sqlite'> {\n if (!this.controlAdapter) {\n throw errorSqliteMigrationStackMissing(operation);\n }\n return this.controlAdapter;\n }\n\n /**\n * The typed SQLite view over this migration's end-state contract — sole\n * namespace unwrapped to the root, so `this.endContract.table.<name>` etc.\n * Throws if no `endContractJson` was provided.\n */\n get endContract(): SqliteContractView<End> {\n return this.#endView.endContract;\n }\n\n /**\n * The typed SQLite view over this migration's start-state contract, or\n * `null` for a baseline migration (no `startContractJson`).\n */\n get startContract(): SqliteContractView<Start> | null {\n return this.#startView.startContract;\n }\n\n protected createTable(options: {\n readonly table: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n readonly constraints?: readonly DdlTableConstraint[];\n }): Promise<Op> {\n return new CreateTableCall(options.table, options.columns, options.constraints).toOp(\n this.controlAdapterFor('createTable'),\n );\n }\n\n protected dropTable(options: { readonly table: string }): Promise<Op> {\n return new DropTableCall(options.table).toOp(this.controlAdapterFor('dropTable'));\n }\n\n protected addColumn(options: {\n readonly table: string;\n readonly column: SqliteColumnSpec;\n }): Promise<Op> {\n return new AddColumnCall(options.table, options.column).toOp(\n this.controlAdapterFor('addColumn'),\n );\n }\n\n protected dropColumn(options: { readonly table: string; readonly column: string }): Promise<Op> {\n return new DropColumnCall(options.table, options.column).toOp(\n this.controlAdapterFor('dropColumn'),\n );\n }\n\n protected createIndex(options: {\n readonly table: string;\n readonly index: string;\n readonly columns: readonly string[];\n }): Promise<Op> {\n return new CreateIndexCall(options.table, options.index, options.columns).toOp(\n this.controlAdapterFor('createIndex'),\n );\n }\n\n protected dropIndex(options: { readonly table: string; readonly index: string }): Promise<Op> {\n return new DropIndexCall(options.table, options.index).toOp(\n this.controlAdapterFor('dropIndex'),\n );\n }\n\n protected recreateTable(options: {\n readonly tableName: string;\n readonly contractTable: SqliteTableSpec;\n readonly schemaColumnNames: readonly string[];\n readonly indexes: readonly SqliteIndexSpec[];\n readonly summary: string;\n readonly postchecks: readonly { readonly description: string; readonly sql: string }[];\n readonly operationClass: MigrationOperationClass;\n }): Promise<Op> {\n return new RecreateTableCall(options).toOp(this.controlAdapterFor('recreateTable'));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,iCAAiC,WAAuC;CACtF,OAAO,IAAI,mBACT,0CACA,mBAAmB,UAAU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AAC,KACxE,KAAK,kBAAkB,aAAa,CACtC;CACF;CAEA,UAAoB,SAA0E;EAC5F,OAAO,IAAI,cAAc,QAAQ,OAAO,QAAQ,KAAK,CAAC,CAAC,KACrD,KAAK,kBAAkB,WAAW,CACpC;CACF;CAEA,cAAwB,SAQR;EACd,OAAO,IAAI,kBAAkB,OAAO,CAAC,CAAC,KAAK,KAAK,kBAAkB,eAAe,CAAC;CACpF;AACF"}
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
2
  "name": "@prisma-next/target-sqlite",
3
- "version": "0.15.0-dev.9",
3
+ "version": "0.16.0-dev.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "dependencies": {
8
- "@prisma-next/cli": "0.15.0-dev.9",
9
- "@prisma-next/contract": "0.15.0-dev.9",
10
- "@prisma-next/errors": "0.15.0-dev.9",
11
- "@prisma-next/family-sql": "0.15.0-dev.9",
12
- "@prisma-next/framework-components": "0.15.0-dev.9",
13
- "@prisma-next/migration-tools": "0.15.0-dev.9",
14
- "@prisma-next/sql-contract": "0.15.0-dev.9",
15
- "@prisma-next/sql-errors": "0.15.0-dev.9",
16
- "@prisma-next/sql-relational-core": "0.15.0-dev.9",
17
- "@prisma-next/sql-runtime": "0.15.0-dev.9",
18
- "@prisma-next/sql-schema-ir": "0.15.0-dev.9",
19
- "@prisma-next/ts-render": "0.15.0-dev.9",
20
- "@prisma-next/utils": "0.15.0-dev.9",
8
+ "@prisma-next/cli": "0.16.0-dev.1",
9
+ "@prisma-next/contract": "0.16.0-dev.1",
10
+ "@prisma-next/errors": "0.16.0-dev.1",
11
+ "@prisma-next/family-sql": "0.16.0-dev.1",
12
+ "@prisma-next/framework-components": "0.16.0-dev.1",
13
+ "@prisma-next/migration-tools": "0.16.0-dev.1",
14
+ "@prisma-next/sql-contract": "0.16.0-dev.1",
15
+ "@prisma-next/sql-errors": "0.16.0-dev.1",
16
+ "@prisma-next/sql-relational-core": "0.16.0-dev.1",
17
+ "@prisma-next/sql-runtime": "0.16.0-dev.1",
18
+ "@prisma-next/sql-schema-ir": "0.16.0-dev.1",
19
+ "@prisma-next/ts-render": "0.16.0-dev.1",
20
+ "@prisma-next/utils": "0.16.0-dev.1",
21
21
  "@standard-schema/spec": "1.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@prisma-next/driver-sqlite": "0.15.0-dev.9",
25
- "@prisma-next/test-utils": "0.15.0-dev.9",
26
- "@prisma-next/tsconfig": "0.15.0-dev.9",
27
- "@prisma-next/tsdown": "0.15.0-dev.9",
28
- "tsdown": "0.22.3",
24
+ "@prisma-next/driver-sqlite": "0.16.0-dev.1",
25
+ "@prisma-next/test-utils": "0.16.0-dev.1",
26
+ "@prisma-next/tsconfig": "0.16.0-dev.1",
27
+ "@prisma-next/tsdown": "0.16.0-dev.1",
28
+ "tsdown": "0.22.8",
29
29
  "typescript": "5.9.3",
30
30
  "vitest": "4.1.10"
31
31
  },
@@ -1,9 +1,15 @@
1
- import { temporalAuthoringPresets } from '@prisma-next/family-sql/control';
1
+ import { temporalAuthoringPresets, temporalCodecPreset } from '@prisma-next/family-sql/control';
2
2
  import type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';
3
3
 
4
4
  export const sqliteAuthoringFieldPresets = {
5
- temporal: /* @__PURE__ */ temporalAuthoringPresets({
6
- codecId: 'sqlite/datetime@1',
7
- nativeType: 'text',
8
- }),
5
+ temporal: {
6
+ .../* @__PURE__ */ temporalAuthoringPresets({
7
+ codecId: 'sqlite/datetime@1',
8
+ nativeType: 'text',
9
+ }),
10
+ datetime: /* @__PURE__ */ temporalCodecPreset({
11
+ codecId: 'sqlite/datetime@1',
12
+ nativeType: 'text',
13
+ }),
14
+ },
9
15
  } as const satisfies AuthoringFieldNamespace;
@@ -12,8 +12,9 @@ import { CliStructuredError } from '@prisma-next/errors/control';
12
12
  * The `operation` argument is required so every throw site names the operation
13
13
  * that actually failed; a new operation cannot inherit a misattributed message.
14
14
  *
15
- * Distinct from `PN-MIG-2001` (placeholder not filled) because the missing
16
- * input is the stack itself, not the per-operation contract.
15
+ * Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)
16
+ * because the missing input is the stack itself, not the per-operation
17
+ * contract.
17
18
  *
18
19
  * Lives in `@prisma-next/target-sqlite/errors` rather than the shared
19
20
  * framework migration errors module because the failure is target-specific:
@@ -21,10 +22,13 @@ import { CliStructuredError } from '@prisma-next/errors/control';
21
22
  * adapter, the SQLite-target stack) only exists in this package.
22
23
  */
23
24
  export function errorSqliteMigrationStackMissing(operation: string): CliStructuredError {
24
- return new CliStructuredError('2008', `SqliteMigration.${operation} requires a control adapter`, {
25
- domain: 'MIG',
26
- why: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,
27
- fix: 'Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.',
28
- meta: { operation },
29
- });
25
+ return new CliStructuredError(
26
+ 'MIGRATION.SQLITE_CONTROL_STACK_MISSING',
27
+ `SqliteMigration.${operation} requires a control adapter`,
28
+ {
29
+ why: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,
30
+ fix: 'Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.',
31
+ meta: { operation },
32
+ },
33
+ );
30
34
  }
@@ -563,7 +563,7 @@ export class DropIndexCall extends SqliteOpFactoryCallNode {
563
563
  * any future strategy that needs a placeholder data step can construct one
564
564
  * with its own id/label.
565
565
  *
566
- * `toOp()` always throws `PN-MIG-2001`: the planner cannot lower a stubbed
566
+ * `toOp()` always throws `MIGRATION.UNFILLED_PLACEHOLDER`: the planner cannot lower a stubbed
567
567
  * transform to a runtime op — the user must edit the rendered
568
568
  * `migration.ts` and re-emit.
569
569
  */
@@ -102,7 +102,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
102
102
  frameworkComponents: options.frameworkComponents,
103
103
  });
104
104
  if (!schemaVerifyResult.ok) {
105
- return runnerFailure('SCHEMA_VERIFY_FAILED', schemaVerifyResult.summary, {
105
+ return runnerFailure('MIGRATION.SCHEMA_VERIFY_FAILED', schemaVerifyResult.summary, {
106
106
  why: 'The resulting database schema does not satisfy the destination contract.',
107
107
  meta: { issues: schemaVerifyResult.schema.issues },
108
108
  });
@@ -215,7 +215,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
215
215
  return okVoid();
216
216
  }
217
217
  return runnerFailure(
218
- 'FOREIGN_KEY_VIOLATION',
218
+ 'MIGRATION.FOREIGN_KEY_VIOLATION',
219
219
  `Foreign key integrity check failed after migration: ${result.rows.length} violation(s).`,
220
220
  {
221
221
  why: 'PRAGMA foreign_key_check reported violations after applying recreate-table operations.',
@@ -326,7 +326,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
326
326
  return okVoid();
327
327
  }
328
328
  return runnerFailure(
329
- 'LEGACY_MARKER_SHAPE',
329
+ 'MIGRATION.LEGACY_MARKER_SHAPE',
330
330
  `Legacy marker-table shape detected on ${MARKER_TABLE_NAME} (no \`space\` column). ` +
331
331
  'Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. ' +
332
332
  `Drop \`${MARKER_TABLE_NAME}\` and re-run \`dbInit\` to reinitialise from a clean baseline.`,
@@ -348,7 +348,8 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
348
348
  for (const step of steps) {
349
349
  const result = await driver.query(step.sql, step.params ?? []);
350
350
  if (!this.stepResultIsTrue(result.rows)) {
351
- const code = phase === 'precheck' ? 'PRECHECK_FAILED' : 'POSTCHECK_FAILED';
351
+ const code =
352
+ phase === 'precheck' ? 'MIGRATION.PRECHECK_FAILED' : 'MIGRATION.POSTCHECK_FAILED';
352
353
  return runnerFailure(
353
354
  code,
354
355
  `Operation ${operation.id} failed during ${phase}: ${step.description}`,
@@ -376,7 +377,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
376
377
  } catch (error: unknown) {
377
378
  const message = error instanceof Error ? error.message : String(error);
378
379
  return runnerFailure(
379
- 'EXECUTION_FAILED',
380
+ 'MIGRATION.EXECUTION_FAILED',
380
381
  `Operation ${operation.id} failed during execution: ${step.description}`,
381
382
  {
382
383
  why: message,
@@ -468,7 +469,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
468
469
  for (const operation of operations) {
469
470
  if (!allowedClasses.has(operation.operationClass)) {
470
471
  return runnerFailure(
471
- 'POLICY_VIOLATION',
472
+ 'MIGRATION.POLICY_VIOLATION',
472
473
  `Operation ${operation.id} has class "${operation.operationClass}" which is not allowed by policy.`,
473
474
  {
474
475
  why: `Policy only allows: ${policy.allowedOperationClasses.join(', ')}.`,
@@ -494,14 +495,14 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
494
495
  }
495
496
  if (!marker) {
496
497
  return runnerFailure(
497
- 'MARKER_ORIGIN_MISMATCH',
498
+ 'MIGRATION.MARKER_ORIGIN_MISMATCH',
498
499
  `Missing contract marker: expected origin storage hash ${origin.storageHash}.`,
499
500
  { meta: { expectedOriginStorageHash: origin.storageHash } },
500
501
  );
501
502
  }
502
503
  if (marker.storageHash !== origin.storageHash) {
503
504
  return runnerFailure(
504
- 'MARKER_ORIGIN_MISMATCH',
505
+ 'MIGRATION.MARKER_ORIGIN_MISMATCH',
505
506
  `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`,
506
507
  {
507
508
  meta: {
@@ -513,7 +514,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
513
514
  }
514
515
  if (origin.profileHash && marker.profileHash !== origin.profileHash) {
515
516
  return runnerFailure(
516
- 'MARKER_ORIGIN_MISMATCH',
517
+ 'MIGRATION.MARKER_ORIGIN_MISMATCH',
517
518
  `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`,
518
519
  {
519
520
  meta: {
@@ -532,7 +533,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
532
533
  ): Result<void, SqlMigrationRunnerFailure> {
533
534
  if (destination.storageHash !== contract.storage.storageHash) {
534
535
  return runnerFailure(
535
- 'DESTINATION_CONTRACT_MISMATCH',
536
+ 'MIGRATION.DESTINATION_CONTRACT_MISMATCH',
536
537
  `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`,
537
538
  {
538
539
  meta: {
@@ -548,7 +549,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
548
549
  destination.profileHash !== contract.profileHash
549
550
  ) {
550
551
  return runnerFailure(
551
- 'DESTINATION_CONTRACT_MISMATCH',
552
+ 'MIGRATION.DESTINATION_CONTRACT_MISMATCH',
552
553
  `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`,
553
554
  {
554
555
  meta: {
@@ -591,7 +592,7 @@ class SqliteMigrationRunner implements SqlMigrationRunner<SqlitePlanTargetDetail
591
592
  });
592
593
  if (!updated) {
593
594
  return runnerFailure(
594
- 'MARKER_CAS_FAILURE',
595
+ 'MIGRATION.MARKER_CAS_FAILURE',
595
596
  'Marker was modified by another process during migration execution.',
596
597
  {
597
598
  meta: {
@@ -57,7 +57,7 @@ export abstract class SqliteMigration<
57
57
  * Materialized SQLite control adapter, created once per migration
58
58
  * instance from the injected stack. `undefined` only when the migration
59
59
  * was instantiated without a stack (test fixtures); `controlAdapterFor`
60
- * throws a PN-MIG-2008 in that case to surface the misuse.
60
+ * throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING in that case to surface the misuse.
61
61
  */
62
62
  protected readonly controlAdapter: SqlControlAdapter<'sqlite'> | undefined;
63
63
 
@@ -81,7 +81,7 @@ export abstract class SqliteMigration<
81
81
  }
82
82
 
83
83
  /**
84
- * Returns the materialized control adapter, or throws a PN-MIG-2008 naming
84
+ * Returns the materialized control adapter, or throws a MIGRATION.SQLITE_CONTROL_STACK_MISSING naming
85
85
  * `operation` when the migration was constructed without a `ControlStack`.
86
86
  * Single home for the null-check that every DDL/DML method shares.
87
87
  */
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-ids-BfPkjMmk.d.mts","names":[],"sources":["../src/core/codec-ids.ts"],"mappings":";;;cAMa,oBAAA;AAAA,cACA,uBAAA;AAAA,cACA,oBAAA;AAAA,cACA,oBAAA;AAAA,cACA,wBAAA;AAAA,cACA,oBAAA;AAAA,cACA,sBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"codec-types-izdPhp_9.d.mts","names":[],"sources":["../src/exports/codec-types.ts"],"mappings":";;;;cAwBM,kBAAA;EAAA;;;;iBAYI,oBAAA;EAAA;;;;;;;KAEL,OAAA,6BAAoC,CAAA,0BAA2B,CAAA,CAAE,CAAA,IAAK,CAAA,CAAE,CAAA,EAAG,CAAA;AAAA,KAEpE,UAAA,GAAa,OAAA,CAAQ,iBAAA,QAAyB,kBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"codecs-BGeJavlQ.d.mts","names":[],"sources":["../src/core/codec-helpers.ts","../src/core/codecs.ts","../src/core/registry.ts"],"mappings":";;;;;;;;;KAIY,WAAA;EAAA,UAKI,GAAA,WAAc,WAAA;AAAA,aACjB,WAAS;;;cC+BT,eAAA,SAAwB,SAAA,QAC5B,oBAAA;EAKD,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAG/C,MAAA,CAAO,IAAA,UAAc,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAGpD,UAAA,CAAW,KAAA,WAAgB,SAAA;EAG3B,UAAA,CAAW,IAAA,EAAM,SAAA;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lD,MAAA,CAAO,IAAA,WAAe,SAAA,EAAW,IAAA,EAAM,gBAAA,GAAmB,OAAA,CAAQ,SAAA;EAGxE,UAAA,CAAW,KAAA,EAAO,SAAA,GAAY,SAAA;EAG9B,UAAA,CAAW,IAAA,EAAM,SAAA,GAAY,SAAA;AAAA;AAAA,cAKlB,oBAAA,SAA6B,mBAAA;EAAA,SACtB,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA,kCAAY,gBAAA;EACrB,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,eAAA;AAAA;AAAA,cAOxC,gBAAA,0DAAgB,UAAA,CAAA,eAAA;AAAA,cAMhB,iBAAA,SAA0B,SAAA,QAC9B,sBAAA;EAKD,MAAA,CAAO,KAAA,UAAe,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAG/C,MAAA,CAAO,IAAA,mBAAuB,IAAA,EAAM,gBAAA,GAAmB,OAAA;EAG7D,UAAA,CAAW,KAAA,WAAgB,SAAA;EAO3B,UAAA,CAAW,IAAA,EAAM,SAAA;AAAA;AAAA,cAWN,sBAAA,SAA+B,mBAAA;EAAA,SACxB,OAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,YAAA,kCAAY,gBAAA;EACrB,OAAA,KAAY,GAAA,EAAK,oBAAA,KAAyB,iBAAA;AAAA;AAAA,cAOxC,kBAAA,0DAAkB,UAAA,CAAA,iBAAA;;;;;;;;cC5TlB,mBAAA,EAAqB,uBACc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-D1fap-5t.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 { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type { CodecTypes } from '../exports/codec-types';\nimport { sqliteAuthoringFieldPresets } from './authoring';\nimport { sqliteTargetDescriptorMetaRuntime } from './descriptor-meta-runtime';\n\nconst sqliteTargetDescriptorMetaBase = {\n ...sqliteTargetDescriptorMetaRuntime,\n defaultNamespaceId: UNBOUND_NAMESPACE_ID,\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;ACKA,MAAa,6BAET;CATF,GAAG;CACH,oBAAoB;CACpB,WAAW,EACT,OAAO,4BACT;AAKE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodes-VzaaeUTb.d.mts","names":[],"sources":["../src/core/ddl/nodes.ts"],"mappings":";;;UAMiB,gBAAA;EACf,WAAA,CAAY,IAAA,EAAM,iBAAA,GAAoB,CAAC;AAAA;AAAA,uBAGnB,aAAA,SAAsB,OAAA;EAAA,SACjC,MAAA,IAAU,OAAA,EAAS,gBAAA,CAAiB,CAAA,IAAK,CAAA;AAAA;AAAA,cAavC,iBAAA,SAA0B,aAAA;EAAA,SAC5B,IAAA;EAAA,SACA,KAAA;EAAA,SACA,MAAA;EAAA,SACA,WAAA;EAAA,SACA,OAAA,EAAS,aAAA,CAAc,SAAA;EAAA,SACvB,WAAA,EAAa,aAAA,CAAc,kBAAA;cAExB,OAAA;IAAA,SACD,KAAA;IAAA,SACA,MAAA;IAAA,SACA,WAAA;IAAA,SACA,OAAA,WAAkB,SAAA;IAAA,SAClB,WAAA,YAAuB,kBAAA;EAAA;EAWzB,MAAA,IAAU,OAAA,EAAS,gBAAA,CAAiB,CAAA,IAAK,CAAA;AAAA;AAAA,KAKxC,gBAAA,GAAmB,iBAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-produced-sqlite-migration-DKopa0rd.d.mts","names":[],"sources":["../src/core/migrations/planner-produced-sqlite-migration.ts"],"mappings":";;;;;;;;KAYK,EAAA,GAAK,yBAAyB,CAAC,uBAAA;AAAA,UAEnB,8BAAA;EAAA,SACN,WAAA;EAAA,SACA,WAAW;AAAA;AAAA,cAGT,mCAAA,SACH,eAAA,YACG,iCAAA;EAAA;cAUT,KAAA,WAAgB,aAAA,IAChB,IAAA,EAAM,aAAA,EACN,OAAA,UACA,WAAA,GAAc,8BAAA,EACd,OAAA,GAAU,qBAAA;EAAA,IAUC,UAAA,cAAwB,EAAA,GAAK,OAAA,CAAQ,EAAA;EAKzC,QAAA,IAAY,aAAA;EAAA,IAIR,WAAA,IAAe,8BAAA;EAtCR;AAGtB;;;;EAHsB,IA+ChB,OAAA;EAIJ,gBAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-CaiRyjA0.d.mts","names":[],"sources":["../src/core/migrations/operations/shared.ts"],"mappings":";;;;;KAUY,EAAA,GAAK,yBAAyB,CAAC,uBAAA;AAA3C;;;;AAAkE;AA0BlE;;;;;;;;;;AAKwC;AA/BxC,UA0BiB,gBAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA;EAAA,SACA,QAAA;EAAA,SACA,6BAAA;AAAA;AAAA,UAGM,oBAAA;EAAA,SACN,OAAO;AAAA;AAAA,UAGD,gBAAA;EAAA,SACN,OAAA;EAAA,SACA,IAAI;AAAA;AAAA,UAGE,oBAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA;IAAA,SACE,KAAA;IAAA,SACA,OAAA;EAAA;EAAA,SAEF,IAAA;EAAA,SACA,QAAA,GAAW,iBAAA;EAAA,SACX,QAAA,GAAW,iBAAiB;AAAA;AAAA;AAOvC;;;AAPuC,UAOtB,eAAA;EAAA,SACN,OAAA,WAAkB,gBAAA;EAAA,SAClB,UAAA,GAAa,oBAAA;EAAA,SACb,OAAA,YAAmB,gBAAA;EAAA,SACnB,WAAA,YAAuB,oBAAA;AAAA;;;;;;UAQjB,eAAA;EAAA,SACN,IAAA;EAAA,SACA,OAAO;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-contract-view-J32K82Gi.d.mts","names":[],"sources":["../src/core/sqlite-contract-view.ts"],"mappings":";;;;;;;AAwBA;;;;;;;;;;;;;;KAAY,kBAAA,mBAAqC,QAAA,CAAS,UAAA,IAAc,QAAA,CAAS,UAAA,KAC/E,sBAAA,CAAuB,SAAA;AAAA,cAEZ,kBAAA;EAFX,qFAIuB,QAAA,CAAS,UAAA,GAAW,QAAA,EAAY,SAAA,GAAY,kBAAA,CAAmB,SAAA,GAJtD;6BASL,QAAA,CAAS,UAAA,IAAW,QAAA,CAAA,UAAA,WAAA,IAAA,YAE5C,kBAAA,CAAmB,SAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-migration-Dzz9p0Gw.d.mts","names":[],"sources":["../src/core/migrations/sqlite-migration.ts"],"mappings":";;;;;;;;;;;;KA0BK,EAAA,GAAK,yBAAyB,CAAC,uBAAA;;AAFoC;;;;AAEb;AAuB3D;;;;;;;;;;;;;;;uBAAsB,eAAA,eACN,QAAA,CAAS,UAAA,IAAc,QAAA,CAAS,UAAA,eAClC,QAAA,CAAS,UAAA,IAAc,QAAA,CAAS,UAAA,WACpC,SAAA,CAAa,uBAAA,YAAmC,KAAA,EAAO,GAAA;EAAA;WACtD,QAAA;EAsD+B;;;;;;EAAA,mBA9CrB,cAAA,EAAgB,iBAAA;cAWvB,KAAA,GAAQ,YAAA;EAwDD;;;;;EAAA,QAzCX,iBAAA;EA0DJ;;;;;EAAA,IA9CA,WAAA,IAAe,kBAAA,CAAmB,GAAA;EAkE1B;;;;EAAA,IA1DR,aAAA,IAAiB,kBAAA,CAAmB,KAAA;EAAA,UAI9B,WAAA,CAAY,OAAA;IAAA,SACX,KAAA;IAAA,SACA,WAAA;IAAA,SACA,OAAA,WAAkB,SAAA;IAAA,SAClB,WAAA,YAAuB,kBAAA;EAAA,IAC9B,OAAA,CAAQ,EAAA;EAAA,UAMF,SAAA,CAAU,OAAA;IAAA,SAAoB,KAAA;EAAA,IAAkB,OAAA,CAAQ,EAAA;EAAA,UAIxD,SAAA,CAAU,OAAA;IAAA,SACT,KAAA;IAAA,SACA,MAAA,EAAQ,gBAAA;EAAA,IACf,OAAA,CAAQ,EAAA;EAAA,UAMF,UAAA,CAAW,OAAA;IAAA,SAAoB,KAAA;IAAA,SAAwB,MAAA;EAAA,IAAmB,OAAA,CAAQ,EAAA;EAAA,UAMlF,WAAA,CAAY,OAAA;IAAA,SACX,KAAA;IAAA,SACA,KAAA;IAAA,SACA,OAAA;EAAA,IACP,OAAA,CAAQ,EAAA;EAAA,UAMF,SAAA,CAAU,OAAA;IAAA,SAAoB,KAAA;IAAA,SAAwB,KAAA;EAAA,IAAkB,OAAA,CAAQ,EAAA;EAAA,UAMhF,aAAA,CAAc,OAAA;IAAA,SACb,SAAA;IAAA,SACA,aAAA,EAAe,eAAA;IAAA,SACf,iBAAA;IAAA,SACA,OAAA,WAAkB,eAAA;IAAA,SAClB,OAAA;IAAA,SACA,UAAA;MAAA,SAAgC,WAAA;MAAA,SAA8B,GAAA;IAAA;IAAA,SAC9D,cAAA,EAAgB,uBAAA;EAAA,IACvB,OAAA,CAAQ,EAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-migration-WdRHavfF.mjs","names":["SqlMigration","#endView","#startView"],"sources":["../src/core/errors.ts","../src/core/migrations/sqlite-migration.ts"],"sourcesContent":["import { CliStructuredError } from '@prisma-next/errors/control';\n\n/**\n * A `SqliteMigration` operation that needs the materialized control adapter\n * — named by `operation` (e.g. `createTable`, `dropColumn`, `recreateTable`) —\n * was invoked, but the migration was constructed without a `ControlStack`.\n * Concrete authoring usage always goes through the migration CLI entrypoint,\n * which assembles a stack from the loaded `prisma-next.config.ts`; reaching this\n * error means a test fixture or ad-hoc consumer instantiated `SqliteMigration`\n * with the no-arg form (legal for `operations` / `describe` introspection only).\n *\n * The `operation` argument is required so every throw site names the operation\n * that actually failed; a new operation cannot inherit a misattributed message.\n *\n * Distinct from `PN-MIG-2001` (placeholder not filled) because the missing\n * input is the stack itself, not the per-operation contract.\n *\n * Lives in `@prisma-next/target-sqlite/errors` rather than the shared\n * framework migration errors module because the failure is target-specific:\n * the contract it talks about (`SqliteMigration`, the SQLite control\n * adapter, the SQLite-target stack) only exists in this package.\n */\nexport function errorSqliteMigrationStackMissing(operation: string): CliStructuredError {\n return new CliStructuredError('2008', `SqliteMigration.${operation} requires a control adapter`, {\n domain: 'MIG',\n why: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,\n fix: 'Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.',\n meta: { operation },\n });\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type {\n MigrationOperationClass,\n SqlMigrationPlanOperation,\n} from '@prisma-next/family-sql/control';\nimport type { SqlControlAdapter } from '@prisma-next/family-sql/control-adapter';\nimport { Migration as SqlMigration } from '@prisma-next/family-sql/migration';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { MigrationContractViews } from '@prisma-next/migration-tools/migration';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-core/ast';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { errorSqliteMigrationStackMissing } from '../errors';\nimport { SqliteContractView } from '../sqlite-contract-view';\nimport {\n AddColumnCall,\n CreateIndexCall,\n CreateTableCall,\n DropColumnCall,\n DropIndexCall,\n DropTableCall,\n RecreateTableCall,\n} from './op-factory-call';\nimport type { SqliteColumnSpec, SqliteIndexSpec, SqliteTableSpec } from './operations/shared';\nimport type { SqlitePlanTargetDetails } from './planner-target-details';\n\ntype Op = SqlMigrationPlanOperation<SqlitePlanTargetDetails>;\n\n/**\n * Target-owned base class for SQLite migrations. Fixes the `SqlMigration`\n * generic to `SqlitePlanTargetDetails` and the abstract `targetId` to the\n * SQLite literal, so both user-authored migrations and renderer-generated\n * scaffolds can extend `SqliteMigration` directly without redeclaring\n * target-local identity.\n *\n * The constructor materializes a single SQLite `SqlControlAdapter` from\n * `stack.adapter.create(stack)` and stores it; the protected instance methods\n * forward to the corresponding `*Call` with that stored adapter, so user\n * migrations can write `this.createTable({...})` without threading the adapter\n * through every call.\n *\n * Binds the framework base's `Start` / `End` contract generics so a subclass\n * that assigns its `start-contract.json` / `end-contract.json` imports gets\n * fully-typed view accessors: `this.endContract` is a `SqliteContractView<End>`\n * (sole namespace unwrapped to the root — `this.endContract.table.<name>`),\n * built lazily from the JSON fields via the shared `MigrationContractViews`\n * helper. Mirrors `MongoMigration`'s view getters; the framework base derives\n * `describe()` from the same JSON.\n */\nexport abstract class SqliteMigration<\n Start extends Contract<SqlStorage> = Contract<SqlStorage>,\n End extends Contract<SqlStorage> = Contract<SqlStorage>,\n> extends SqlMigration<SqlitePlanTargetDetails, 'sqlite', Start, End> {\n readonly targetId = 'sqlite' as const;\n\n /**\n * Materialized SQLite control adapter, created once per migration\n * instance from the injected stack. `undefined` only when the migration\n * was instantiated without a stack (test fixtures); `controlAdapterFor`\n * throws a PN-MIG-2008 in that case to surface the misuse.\n */\n protected readonly controlAdapter: SqlControlAdapter<'sqlite'> | undefined;\n\n #endView = new MigrationContractViews<SqliteContractView<End>>(this, 'SqliteMigration', (json) =>\n SqliteContractView.fromJson<End>(json),\n );\n #startView = new MigrationContractViews<SqliteContractView<Start>>(\n this,\n 'SqliteMigration',\n (json) => SqliteContractView.fromJson<Start>(json),\n );\n\n constructor(stack?: ControlStack<'sql', 'sqlite'>) {\n super(stack);\n this.controlAdapter = stack?.adapter\n ? blindCast<\n SqlControlAdapter<'sqlite'>,\n 'The SQLite descriptor create() returns SqlControlAdapter<sqlite>; typed as wider ControlAdapterInstance at the framework boundary'\n >(stack.adapter.create(stack))\n : undefined;\n }\n\n /**\n * Returns the materialized control adapter, or throws a PN-MIG-2008 naming\n * `operation` when the migration was constructed without a `ControlStack`.\n * Single home for the null-check that every DDL/DML method shares.\n */\n private controlAdapterFor(operation: string): SqlControlAdapter<'sqlite'> {\n if (!this.controlAdapter) {\n throw errorSqliteMigrationStackMissing(operation);\n }\n return this.controlAdapter;\n }\n\n /**\n * The typed SQLite view over this migration's end-state contract — sole\n * namespace unwrapped to the root, so `this.endContract.table.<name>` etc.\n * Throws if no `endContractJson` was provided.\n */\n get endContract(): SqliteContractView<End> {\n return this.#endView.endContract;\n }\n\n /**\n * The typed SQLite view over this migration's start-state contract, or\n * `null` for a baseline migration (no `startContractJson`).\n */\n get startContract(): SqliteContractView<Start> | null {\n return this.#startView.startContract;\n }\n\n protected createTable(options: {\n readonly table: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n readonly constraints?: readonly DdlTableConstraint[];\n }): Promise<Op> {\n return new CreateTableCall(options.table, options.columns, options.constraints).toOp(\n this.controlAdapterFor('createTable'),\n );\n }\n\n protected dropTable(options: { readonly table: string }): Promise<Op> {\n return new DropTableCall(options.table).toOp(this.controlAdapterFor('dropTable'));\n }\n\n protected addColumn(options: {\n readonly table: string;\n readonly column: SqliteColumnSpec;\n }): Promise<Op> {\n return new AddColumnCall(options.table, options.column).toOp(\n this.controlAdapterFor('addColumn'),\n );\n }\n\n protected dropColumn(options: { readonly table: string; readonly column: string }): Promise<Op> {\n return new DropColumnCall(options.table, options.column).toOp(\n this.controlAdapterFor('dropColumn'),\n );\n }\n\n protected createIndex(options: {\n readonly table: string;\n readonly index: string;\n readonly columns: readonly string[];\n }): Promise<Op> {\n return new CreateIndexCall(options.table, options.index, options.columns).toOp(\n this.controlAdapterFor('createIndex'),\n );\n }\n\n protected dropIndex(options: { readonly table: string; readonly index: string }): Promise<Op> {\n return new DropIndexCall(options.table, options.index).toOp(\n this.controlAdapterFor('dropIndex'),\n );\n }\n\n protected recreateTable(options: {\n readonly tableName: string;\n readonly contractTable: SqliteTableSpec;\n readonly schemaColumnNames: readonly string[];\n readonly indexes: readonly SqliteIndexSpec[];\n readonly summary: string;\n readonly postchecks: readonly { readonly description: string; readonly sql: string }[];\n readonly operationClass: MigrationOperationClass;\n }): Promise<Op> {\n return new RecreateTableCall(options).toOp(this.controlAdapterFor('recreateTable'));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,iCAAiC,WAAuC;CACtF,OAAO,IAAI,mBAAmB,QAAQ,mBAAmB,UAAU,8BAA8B;EAC/F,QAAQ;EACR,KAAK,mBAAmB,UAAU;EAClC,KAAK;EACL,MAAM,EAAE,UAAU;CACpB,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;ACoBA,IAAsB,kBAAtB,cAGUA,UAA4D;CACpE,WAAoB;;;;;;;CAQpB;CAEA,WAAW,IAAI,uBAAgD,MAAM,oBAAoB,SACvF,mBAAmB,SAAc,IAAI,CACvC;CACA,aAAa,IAAI,uBACf,MACA,oBACC,SAAS,mBAAmB,SAAgB,IAAI,CACnD;CAEA,YAAY,OAAuC;EACjD,MAAM,KAAK;EACX,KAAK,iBAAiB,OAAO,UACzB,UAGE,MAAM,QAAQ,OAAO,KAAK,CAAC,IAC7B,KAAA;CACN;;;;;;CAOA,kBAA0B,WAAgD;EACxE,IAAI,CAAC,KAAK,gBACR,MAAM,iCAAiC,SAAS;EAElD,OAAO,KAAK;CACd;;;;;;CAOA,IAAI,cAAuC;EACzC,OAAO,KAAKC,SAAS;CACvB;;;;;CAMA,IAAI,gBAAkD;EACpD,OAAO,KAAKC,WAAW;CACzB;CAEA,YAAsB,SAKN;EACd,OAAO,IAAI,gBAAgB,QAAQ,OAAO,QA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