@prisma-next/target-sqlite 0.14.0-dev.70 → 0.14.0-dev.71
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/codecs.mjs +217 -2
- package/dist/codecs.mjs.map +1 -1
- package/dist/{control-tables-7KwMyJ6i.mjs → control-tables-D_o8dKRB.mjs} +2 -2
- package/dist/{control-tables-7KwMyJ6i.mjs.map → control-tables-D_o8dKRB.mjs.map} +1 -1
- package/dist/control-tables.mjs +1 -1
- package/dist/control.mjs +3 -3
- package/dist/migration.mjs +1 -1
- package/dist/{planner-WSbIizIE.mjs → planner-D2hMk3oC.mjs} +3 -3
- package/dist/{planner-WSbIizIE.mjs.map → planner-D2hMk3oC.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-BDzhFAoW.mjs → planner-produced-sqlite-migration-CeGjNfd2.mjs} +2 -2
- package/dist/{planner-produced-sqlite-migration-BDzhFAoW.mjs.map → planner-produced-sqlite-migration-CeGjNfd2.mjs.map} +1 -1
- package/dist/planner-produced-sqlite-migration.mjs +1 -1
- package/dist/planner.mjs +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/{sqlite-contract-view-BEwi0mUC.mjs → sqlite-contract-view-B8qeCczc.mjs} +2 -2
- package/dist/{sqlite-contract-view-BEwi0mUC.mjs.map → sqlite-contract-view-B8qeCczc.mjs.map} +1 -1
- package/dist/{sqlite-migration-BNiSiP0z.mjs → sqlite-migration-C9bD6XDl.mjs} +2 -2
- package/dist/{sqlite-migration-BNiSiP0z.mjs.map → sqlite-migration-C9bD6XDl.mjs.map} +1 -1
- package/package.json +20 -20
- package/dist/codecs-DsC4OGmU.mjs +0 -220
- package/dist/codecs-DsC4OGmU.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-migration-BNiSiP0z.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,QAAQ,SAAS,QAAQ,WAAW,CAAC,CAAC,KAC9E,KAAK,kBAAkB,aAAa,CACtC;CACF;CAEA,UAAoB,SAAkD;EACpE,OAAO,IAAI,cAAc,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,WAAW,CAAC;CAClF;CAEA,UAAoB,SAGJ;EACd,OAAO,IAAI,cAAc,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KACtD,KAAK,kBAAkB,WAAW,CACpC;CACF;CAEA,WAAqB,SAA2E;EAC9F,OAAO,IAAI,eAAe,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KACvD,KAAK,kBAAkB,YAAY,CACrC;CACF;CAEA,YAAsB,SAIN;EACd,OAAO,IAAI,gBAAgB,QAAQ,OAAO,QAAQ,OAAO,QAAQ,OAAO,CAAC,CAAC,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"}
|
|
1
|
+
{"version":3,"file":"sqlite-migration-C9bD6XDl.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,QAAQ,SAAS,QAAQ,WAAW,CAAC,CAAC,KAC9E,KAAK,kBAAkB,aAAa,CACtC;CACF;CAEA,UAAoB,SAAkD;EACpE,OAAO,IAAI,cAAc,QAAQ,KAAK,CAAC,CAAC,KAAK,KAAK,kBAAkB,WAAW,CAAC;CAClF;CAEA,UAAoB,SAGJ;EACd,OAAO,IAAI,cAAc,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KACtD,KAAK,kBAAkB,WAAW,CACpC;CACF;CAEA,WAAqB,SAA2E;EAC9F,OAAO,IAAI,eAAe,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KACvD,KAAK,kBAAkB,YAAY,CACrC;CACF;CAEA,YAAsB,SAIN;EACd,OAAO,IAAI,gBAAgB,QAAQ,OAAO,QAAQ,OAAO,QAAQ,OAAO,CAAC,CAAC,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,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/target-sqlite",
|
|
3
|
-
"version": "0.14.0-dev.
|
|
3
|
+
"version": "0.14.0-dev.71",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@prisma-next/cli": "0.14.0-dev.
|
|
9
|
-
"@prisma-next/contract": "0.14.0-dev.
|
|
10
|
-
"@prisma-next/errors": "0.14.0-dev.
|
|
11
|
-
"@prisma-next/family-sql": "0.14.0-dev.
|
|
12
|
-
"@prisma-next/framework-components": "0.14.0-dev.
|
|
13
|
-
"@prisma-next/migration-tools": "0.14.0-dev.
|
|
14
|
-
"@prisma-next/sql-contract": "0.14.0-dev.
|
|
15
|
-
"@prisma-next/sql-errors": "0.14.0-dev.
|
|
16
|
-
"@prisma-next/sql-relational-core": "0.14.0-dev.
|
|
17
|
-
"@prisma-next/sql-runtime": "0.14.0-dev.
|
|
18
|
-
"@prisma-next/sql-schema-ir": "0.14.0-dev.
|
|
19
|
-
"@prisma-next/ts-render": "0.14.0-dev.
|
|
20
|
-
"@prisma-next/utils": "0.14.0-dev.
|
|
8
|
+
"@prisma-next/cli": "0.14.0-dev.71",
|
|
9
|
+
"@prisma-next/contract": "0.14.0-dev.71",
|
|
10
|
+
"@prisma-next/errors": "0.14.0-dev.71",
|
|
11
|
+
"@prisma-next/family-sql": "0.14.0-dev.71",
|
|
12
|
+
"@prisma-next/framework-components": "0.14.0-dev.71",
|
|
13
|
+
"@prisma-next/migration-tools": "0.14.0-dev.71",
|
|
14
|
+
"@prisma-next/sql-contract": "0.14.0-dev.71",
|
|
15
|
+
"@prisma-next/sql-errors": "0.14.0-dev.71",
|
|
16
|
+
"@prisma-next/sql-relational-core": "0.14.0-dev.71",
|
|
17
|
+
"@prisma-next/sql-runtime": "0.14.0-dev.71",
|
|
18
|
+
"@prisma-next/sql-schema-ir": "0.14.0-dev.71",
|
|
19
|
+
"@prisma-next/ts-render": "0.14.0-dev.71",
|
|
20
|
+
"@prisma-next/utils": "0.14.0-dev.71",
|
|
21
21
|
"@standard-schema/spec": "1.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@prisma-next/driver-sqlite": "0.14.0-dev.
|
|
25
|
-
"@prisma-next/test-utils": "0.14.0-dev.
|
|
26
|
-
"@prisma-next/tsconfig": "0.14.0-dev.
|
|
27
|
-
"@prisma-next/tsdown": "0.14.0-dev.
|
|
28
|
-
"tsdown": "0.22.
|
|
24
|
+
"@prisma-next/driver-sqlite": "0.14.0-dev.71",
|
|
25
|
+
"@prisma-next/test-utils": "0.14.0-dev.71",
|
|
26
|
+
"@prisma-next/tsconfig": "0.14.0-dev.71",
|
|
27
|
+
"@prisma-next/tsdown": "0.14.0-dev.71",
|
|
28
|
+
"tsdown": "0.22.3",
|
|
29
29
|
"typescript": "5.9.3",
|
|
30
|
-
"vitest": "4.1.
|
|
30
|
+
"vitest": "4.1.10"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"typescript": ">=5.9"
|
package/dist/codecs-DsC4OGmU.mjs
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-DSU7S2Li.mjs";
|
|
2
|
-
import { sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlVarcharDescriptor } from "@prisma-next/sql-relational-core/ast";
|
|
3
|
-
import { CodecDescriptorImpl, CodecImpl, column, voidParamsSchema } from "@prisma-next/framework-components/codec";
|
|
4
|
-
//#region src/core/codecs.ts
|
|
5
|
-
var SqliteTextCodec = class extends CodecImpl {
|
|
6
|
-
async encode(value, _ctx) {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
async decode(wire, _ctx) {
|
|
10
|
-
return wire;
|
|
11
|
-
}
|
|
12
|
-
encodeJson(value) {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
decodeJson(json) {
|
|
16
|
-
return json;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
var SqliteTextDescriptor = class extends CodecDescriptorImpl {
|
|
20
|
-
codecId = SQLITE_TEXT_CODEC_ID;
|
|
21
|
-
traits = [
|
|
22
|
-
"equality",
|
|
23
|
-
"order",
|
|
24
|
-
"textual"
|
|
25
|
-
];
|
|
26
|
-
targetTypes = ["text"];
|
|
27
|
-
paramsSchema = voidParamsSchema;
|
|
28
|
-
factory() {
|
|
29
|
-
return () => new SqliteTextCodec(this);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const sqliteTextDescriptor = new SqliteTextDescriptor();
|
|
33
|
-
const sqliteTextColumn = () => column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, void 0, "text");
|
|
34
|
-
var SqliteIntegerCodec = class extends CodecImpl {
|
|
35
|
-
async encode(value, _ctx) {
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
async decode(wire, _ctx) {
|
|
39
|
-
return wire;
|
|
40
|
-
}
|
|
41
|
-
encodeJson(value) {
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
decodeJson(json) {
|
|
45
|
-
return json;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var SqliteIntegerDescriptor = class extends CodecDescriptorImpl {
|
|
49
|
-
codecId = SQLITE_INTEGER_CODEC_ID;
|
|
50
|
-
traits = [
|
|
51
|
-
"equality",
|
|
52
|
-
"order",
|
|
53
|
-
"numeric"
|
|
54
|
-
];
|
|
55
|
-
targetTypes = ["integer"];
|
|
56
|
-
paramsSchema = voidParamsSchema;
|
|
57
|
-
factory() {
|
|
58
|
-
return () => new SqliteIntegerCodec(this);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const sqliteIntegerDescriptor = new SqliteIntegerDescriptor();
|
|
62
|
-
const sqliteIntegerColumn = () => column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, void 0, "integer");
|
|
63
|
-
var SqliteRealCodec = class extends CodecImpl {
|
|
64
|
-
async encode(value, _ctx) {
|
|
65
|
-
return value;
|
|
66
|
-
}
|
|
67
|
-
async decode(wire, _ctx) {
|
|
68
|
-
return wire;
|
|
69
|
-
}
|
|
70
|
-
encodeJson(value) {
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
decodeJson(json) {
|
|
74
|
-
return json;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var SqliteRealDescriptor = class extends CodecDescriptorImpl {
|
|
78
|
-
codecId = SQLITE_REAL_CODEC_ID;
|
|
79
|
-
traits = [
|
|
80
|
-
"equality",
|
|
81
|
-
"order",
|
|
82
|
-
"numeric"
|
|
83
|
-
];
|
|
84
|
-
targetTypes = ["real"];
|
|
85
|
-
paramsSchema = voidParamsSchema;
|
|
86
|
-
factory() {
|
|
87
|
-
return () => new SqliteRealCodec(this);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const sqliteRealDescriptor = new SqliteRealDescriptor();
|
|
91
|
-
const sqliteRealColumn = () => column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, void 0, "real");
|
|
92
|
-
var SqliteBlobCodec = class extends CodecImpl {
|
|
93
|
-
async encode(value, _ctx) {
|
|
94
|
-
return value;
|
|
95
|
-
}
|
|
96
|
-
async decode(wire, _ctx) {
|
|
97
|
-
return wire;
|
|
98
|
-
}
|
|
99
|
-
encodeJson(value) {
|
|
100
|
-
return Buffer.from(value).toString("base64");
|
|
101
|
-
}
|
|
102
|
-
decodeJson(json) {
|
|
103
|
-
if (typeof json !== "string") throw new TypeError("sqlite/blob@1 contract value must be a base64 string");
|
|
104
|
-
return new Uint8Array(Buffer.from(json, "base64"));
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
var SqliteBlobDescriptor = class extends CodecDescriptorImpl {
|
|
108
|
-
codecId = SQLITE_BLOB_CODEC_ID;
|
|
109
|
-
traits = ["equality"];
|
|
110
|
-
targetTypes = ["blob"];
|
|
111
|
-
paramsSchema = voidParamsSchema;
|
|
112
|
-
factory() {
|
|
113
|
-
return () => new SqliteBlobCodec(this);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const sqliteBlobDescriptor = new SqliteBlobDescriptor();
|
|
117
|
-
const sqliteBlobColumn = () => column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, void 0, "blob");
|
|
118
|
-
var SqliteDatetimeCodec = class extends CodecImpl {
|
|
119
|
-
parseDate(value) {
|
|
120
|
-
const date = new Date(value);
|
|
121
|
-
if (Number.isNaN(date.getTime())) throw new TypeError(`sqlite/datetime@1 value must be a valid ISO-8601 string: ${value}`);
|
|
122
|
-
return date;
|
|
123
|
-
}
|
|
124
|
-
async encode(value, _ctx) {
|
|
125
|
-
return value.toISOString();
|
|
126
|
-
}
|
|
127
|
-
async decode(wire, _ctx) {
|
|
128
|
-
return this.parseDate(wire);
|
|
129
|
-
}
|
|
130
|
-
encodeJson(value) {
|
|
131
|
-
return value.toISOString();
|
|
132
|
-
}
|
|
133
|
-
decodeJson(json) {
|
|
134
|
-
if (typeof json !== "string") throw new TypeError("sqlite/datetime@1 contract value must be an ISO-8601 string");
|
|
135
|
-
return this.parseDate(json);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
var SqliteDatetimeDescriptor = class extends CodecDescriptorImpl {
|
|
139
|
-
codecId = SQLITE_DATETIME_CODEC_ID;
|
|
140
|
-
traits = ["equality", "order"];
|
|
141
|
-
targetTypes = ["text"];
|
|
142
|
-
paramsSchema = voidParamsSchema;
|
|
143
|
-
factory() {
|
|
144
|
-
return () => new SqliteDatetimeCodec(this);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();
|
|
148
|
-
const sqliteDatetimeColumn = () => column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, void 0, "text");
|
|
149
|
-
var SqliteJsonCodec = class extends CodecImpl {
|
|
150
|
-
async encode(value, _ctx) {
|
|
151
|
-
return JSON.stringify(value);
|
|
152
|
-
}
|
|
153
|
-
async decode(wire, _ctx) {
|
|
154
|
-
return typeof wire === "string" ? JSON.parse(wire) : wire;
|
|
155
|
-
}
|
|
156
|
-
encodeJson(value) {
|
|
157
|
-
return value;
|
|
158
|
-
}
|
|
159
|
-
decodeJson(json) {
|
|
160
|
-
return json;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
var SqliteJsonDescriptor = class extends CodecDescriptorImpl {
|
|
164
|
-
codecId = SQLITE_JSON_CODEC_ID;
|
|
165
|
-
traits = ["equality"];
|
|
166
|
-
targetTypes = ["text"];
|
|
167
|
-
paramsSchema = voidParamsSchema;
|
|
168
|
-
factory() {
|
|
169
|
-
return () => new SqliteJsonCodec(this);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
const sqliteJsonDescriptor = new SqliteJsonDescriptor();
|
|
173
|
-
const sqliteJsonColumn = () => column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, void 0, "text");
|
|
174
|
-
var SqliteBigintCodec = class extends CodecImpl {
|
|
175
|
-
async encode(value, _ctx) {
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
async decode(wire, _ctx) {
|
|
179
|
-
return BigInt(wire);
|
|
180
|
-
}
|
|
181
|
-
encodeJson(value) {
|
|
182
|
-
return value.toString();
|
|
183
|
-
}
|
|
184
|
-
decodeJson(json) {
|
|
185
|
-
if (typeof json !== "string" && typeof json !== "number") throw new TypeError("sqlite/bigint@1 contract value must be a string or number");
|
|
186
|
-
return BigInt(json);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var SqliteBigintDescriptor = class extends CodecDescriptorImpl {
|
|
190
|
-
codecId = SQLITE_BIGINT_CODEC_ID;
|
|
191
|
-
traits = [
|
|
192
|
-
"equality",
|
|
193
|
-
"order",
|
|
194
|
-
"numeric"
|
|
195
|
-
];
|
|
196
|
-
targetTypes = ["integer"];
|
|
197
|
-
paramsSchema = voidParamsSchema;
|
|
198
|
-
factory() {
|
|
199
|
-
return () => new SqliteBigintCodec(this);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const sqliteBigintDescriptor = new SqliteBigintDescriptor();
|
|
203
|
-
const sqliteBigintColumn = () => column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, void 0, "integer");
|
|
204
|
-
const codecDescriptors = [
|
|
205
|
-
sqlCharDescriptor,
|
|
206
|
-
sqlVarcharDescriptor,
|
|
207
|
-
sqlIntDescriptor,
|
|
208
|
-
sqlFloatDescriptor,
|
|
209
|
-
sqliteTextDescriptor,
|
|
210
|
-
sqliteIntegerDescriptor,
|
|
211
|
-
sqliteRealDescriptor,
|
|
212
|
-
sqliteBlobDescriptor,
|
|
213
|
-
sqliteDatetimeDescriptor,
|
|
214
|
-
sqliteJsonDescriptor,
|
|
215
|
-
sqliteBigintDescriptor
|
|
216
|
-
];
|
|
217
|
-
//#endregion
|
|
218
|
-
export { sqliteIntegerColumn as a, sqliteTextColumn as c, sqliteDatetimeColumn as i, sqliteBigintColumn as n, sqliteJsonColumn as o, sqliteBlobColumn as r, sqliteRealColumn as s, codecDescriptors as t };
|
|
219
|
-
|
|
220
|
-
//# sourceMappingURL=codecs-DsC4OGmU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codecs-DsC4OGmU.mjs","names":[],"sources":["../src/core/codecs.ts"],"sourcesContent":["/**\n * Native SQLite target codecs (TML-2357). Mirrors the Postgres codec class form in `packages/3-targets/3-targets/postgres/src/core/codecs.ts`.\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `SqliteXCodec` class extending {@link CodecImpl} that wraps the encode/decode/encodeJson/decodeJson conversions inline. SQLite's runtime conversions are simple enough that there is no shared helper module; the class bodies are the single source of truth. 2. A `SqliteXDescriptor` class extending {@link CodecDescriptorImpl} declaring the codec id, traits, target types, and params schema. SQLite codecs do not carry\n * `meta` (no per-target native-type meta today) and are all non-parameterized. 3. A per-codec column helper (`sqliteXColumn`) that calls `descriptor.factory()` directly and packages the result into a {@link ColumnSpec} via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor` + `ColumnHelperForStrict` (every SQLite codec's resolved type is well-defined).\n *\n * After TML-2357 this is the canonical source of SQLite codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers (and the parallel `byScalar` / `codecDescriptorDefinitions` collection exports) retired with the deletion sweep.\n *\n * Audit: every SQLite codec is non-parameterized and parameter-stateless; `factory()` takes no params (`P = void`) and returns a fresh codec constructed solely from `this`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport {\n sqlCharDescriptor,\n sqlFloatDescriptor,\n sqlIntDescriptor,\n sqlVarcharDescriptor,\n} from '@prisma-next/sql-relational-core/ast';\nimport {\n SQLITE_BIGINT_CODEC_ID,\n SQLITE_BLOB_CODEC_ID,\n SQLITE_DATETIME_CODEC_ID,\n SQLITE_INTEGER_CODEC_ID,\n SQLITE_JSON_CODEC_ID,\n SQLITE_REAL_CODEC_ID,\n SQLITE_TEXT_CODEC_ID,\n} from './codec-ids';\n\nexport class SqliteTextCodec extends CodecImpl<\n typeof SQLITE_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqliteTextDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteTextCodec {\n return () => new SqliteTextCodec(this);\n }\n}\n\nexport const sqliteTextDescriptor = new SqliteTextDescriptor();\n\nexport const sqliteTextColumn = () =>\n column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, undefined, 'text');\n\nsqliteTextColumn satisfies ColumnHelperFor<SqliteTextDescriptor>;\nsqliteTextColumn satisfies ColumnHelperForStrict<SqliteTextDescriptor>;\n\nexport class SqliteIntegerCodec extends CodecImpl<\n typeof SQLITE_INTEGER_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqliteIntegerDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_INTEGER_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['integer'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteIntegerCodec {\n return () => new SqliteIntegerCodec(this);\n }\n}\n\nexport const sqliteIntegerDescriptor = new SqliteIntegerDescriptor();\n\nexport const sqliteIntegerColumn = () =>\n column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, undefined, 'integer');\n\nsqliteIntegerColumn satisfies ColumnHelperFor<SqliteIntegerDescriptor>;\nsqliteIntegerColumn satisfies ColumnHelperForStrict<SqliteIntegerDescriptor>;\n\nexport class SqliteRealCodec extends CodecImpl<\n typeof SQLITE_REAL_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqliteRealDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_REAL_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['real'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteRealCodec {\n return () => new SqliteRealCodec(this);\n }\n}\n\nexport const sqliteRealDescriptor = new SqliteRealDescriptor();\n\nexport const sqliteRealColumn = () =>\n column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, undefined, 'real');\n\nsqliteRealColumn satisfies ColumnHelperFor<SqliteRealDescriptor>;\nsqliteRealColumn satisfies ColumnHelperForStrict<SqliteRealDescriptor>;\n\nexport class SqliteBlobCodec extends CodecImpl<\n typeof SQLITE_BLOB_CODEC_ID,\n readonly ['equality'],\n Uint8Array,\n Uint8Array\n> {\n async encode(value: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return value;\n }\n async decode(wire: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return wire;\n }\n encodeJson(value: Uint8Array): JsonValue {\n return Buffer.from(value).toString('base64');\n }\n decodeJson(json: JsonValue): Uint8Array {\n if (typeof json !== 'string') {\n throw new TypeError('sqlite/blob@1 contract value must be a base64 string');\n }\n return new Uint8Array(Buffer.from(json, 'base64'));\n }\n}\n\nexport class SqliteBlobDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_BLOB_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['blob'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteBlobCodec {\n return () => new SqliteBlobCodec(this);\n }\n}\n\nexport const sqliteBlobDescriptor = new SqliteBlobDescriptor();\n\nexport const sqliteBlobColumn = () =>\n column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, undefined, 'blob');\n\nsqliteBlobColumn satisfies ColumnHelperFor<SqliteBlobDescriptor>;\nsqliteBlobColumn satisfies ColumnHelperForStrict<SqliteBlobDescriptor>;\n\nexport class SqliteDatetimeCodec extends CodecImpl<\n typeof SQLITE_DATETIME_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n Date\n> {\n // Reject `Invalid Date` (NaN-time) at every decode ingress so consumers never receive a Date object whose downstream operations silently produce NaN. Mirrors the stricter ISO-8601 validation on the postgres timestamp helpers.\n private parseDate(value: string): Date {\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) {\n throw new TypeError(`sqlite/datetime@1 value must be a valid ISO-8601 string: ${value}`);\n }\n return date;\n }\n async encode(value: Date, _ctx: CodecCallContext): Promise<string> {\n return value.toISOString();\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<Date> {\n return this.parseDate(wire);\n }\n encodeJson(value: Date): JsonValue {\n return value.toISOString();\n }\n decodeJson(json: JsonValue): Date {\n if (typeof json !== 'string') {\n throw new TypeError('sqlite/datetime@1 contract value must be an ISO-8601 string');\n }\n return this.parseDate(json);\n }\n}\n\nexport class SqliteDatetimeDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_DATETIME_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteDatetimeCodec {\n return () => new SqliteDatetimeCodec(this);\n }\n}\n\nexport const sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();\n\nexport const sqliteDatetimeColumn = () =>\n column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, undefined, 'text');\n\nsqliteDatetimeColumn satisfies ColumnHelperFor<SqliteDatetimeDescriptor>;\nsqliteDatetimeColumn satisfies ColumnHelperForStrict<SqliteDatetimeDescriptor>;\n\nexport class SqliteJsonCodec extends CodecImpl<\n typeof SQLITE_JSON_CODEC_ID,\n readonly ['equality'],\n string | JsonValue,\n JsonValue\n> {\n async encode(value: JsonValue, _ctx: CodecCallContext): Promise<string> {\n return JSON.stringify(value);\n }\n async decode(wire: string | JsonValue, _ctx: CodecCallContext): Promise<JsonValue> {\n return typeof wire === 'string' ? (JSON.parse(wire) as JsonValue) : wire;\n }\n encodeJson(value: JsonValue): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): JsonValue {\n return json;\n }\n}\n\nexport class SqliteJsonDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_JSON_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteJsonCodec {\n return () => new SqliteJsonCodec(this);\n }\n}\n\nexport const sqliteJsonDescriptor = new SqliteJsonDescriptor();\n\nexport const sqliteJsonColumn = () =>\n column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, undefined, 'text');\n\nsqliteJsonColumn satisfies ColumnHelperFor<SqliteJsonDescriptor>;\nsqliteJsonColumn satisfies ColumnHelperForStrict<SqliteJsonDescriptor>;\n\nexport class SqliteBigintCodec extends CodecImpl<\n typeof SQLITE_BIGINT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number | bigint,\n bigint\n> {\n async encode(value: bigint, _ctx: CodecCallContext): Promise<number | bigint> {\n return value;\n }\n async decode(wire: number | bigint, _ctx: CodecCallContext): Promise<bigint> {\n return BigInt(wire);\n }\n encodeJson(value: bigint): JsonValue {\n return value.toString();\n }\n decodeJson(json: JsonValue): bigint {\n if (typeof json !== 'string' && typeof json !== 'number') {\n throw new TypeError('sqlite/bigint@1 contract value must be a string or number');\n }\n return BigInt(json);\n }\n}\n\nexport class SqliteBigintDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_BIGINT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['integer'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteBigintCodec {\n return () => new SqliteBigintCodec(this);\n }\n}\n\nexport const sqliteBigintDescriptor = new SqliteBigintDescriptor();\n\nexport const sqliteBigintColumn = () =>\n column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, undefined, 'integer');\n\nsqliteBigintColumn satisfies ColumnHelperFor<SqliteBigintDescriptor>;\nsqliteBigintColumn satisfies ColumnHelperForStrict<SqliteBigintDescriptor>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = [\n sqlCharDescriptor,\n sqlVarcharDescriptor,\n sqlIntDescriptor,\n sqlFloatDescriptor,\n sqliteTextDescriptor,\n sqliteIntegerDescriptor,\n sqliteRealDescriptor,\n sqliteBlobDescriptor,\n sqliteDatetimeDescriptor,\n sqliteJsonDescriptor,\n sqliteBigintDescriptor,\n];\n"],"mappings":";;;;AAyCA,IAAa,kBAAb,cAAqC,UAKnC;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,OAAO;CACT;CACA,MAAM,OAAO,MAAc,MAAyC;EAClE,OAAO;CACT;CACA,WAAW,OAA0B;EACnC,OAAO;CACT;CACA,WAAW,MAAyB;EAClC,OAAO;CACT;AACF;AAEA,IAAa,uBAAb,cAA0C,oBAA0B;CAClE,UAA4B;CAC5B,SAA2B;EAAC;EAAY;EAAS;CAAS;CAC1D,cAAgC,CAAC,MAAM;CACvC,eAAiC;CACjC,UAAmE;EACjE,aAAa,IAAI,gBAAgB,IAAI;CACvC;AACF;AAEA,MAAa,uBAAuB,IAAI,qBAAqB;AAE7D,MAAa,yBACX,OAAO,qBAAqB,QAAQ,GAAG,qBAAqB,SAAS,KAAA,GAAW,MAAM;AAKxF,IAAa,qBAAb,cAAwC,UAKtC;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,OAAO;CACT;CACA,MAAM,OAAO,MAAc,MAAyC;EAClE,OAAO;CACT;CACA,WAAW,OAA0B;EACnC,OAAO;CACT;CACA,WAAW,MAAyB;EAClC,OAAO;CACT;AACF;AAEA,IAAa,0BAAb,cAA6C,oBAA0B;CACrE,UAA4B;CAC5B,SAA2B;EAAC;EAAY;EAAS;CAAS;CAC1D,cAAgC,CAAC,SAAS;CAC1C,eAAiC;CACjC,UAAsE;EACpE,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