@payloadcms/db-sqlite 3.85.0 → 4.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { Connect, Migration } from 'payload'\n\nimport { createClient } from '@libsql/client'\nimport { pushDevSchema } from '@payloadcms/drizzle'\nimport { drizzle } from 'drizzle-orm/libsql'\n\nimport type { SQLiteAdapter } from './types.js'\n\nexport const connect: Connect = async function connect(\n this: SQLiteAdapter,\n options = {\n hotReload: false,\n },\n) {\n const { hotReload } = options\n\n try {\n if (!this.client) {\n this.client = createClient(this.clientConfig)\n\n if (this.busyTimeout > 0) {\n await this.client.execute(`PRAGMA busy_timeout = ${this.busyTimeout};`)\n }\n\n if (this.wal) {\n const result = await this.client.execute('PRAGMA journal_mode;')\n\n if (result.rows[0]?.journal_mode !== 'wal') {\n this.payload.logger.info(\n `[db-sqlite] Enabling WAL mode with journal size limit ${this.wal.journalSizeLimit}.`,\n )\n await this.client.execute(`PRAGMA journal_mode = WAL;`)\n await this.client.execute(`PRAGMA journal_size_limit = ${this.wal.journalSizeLimit};`)\n }\n\n await this.client.execute(`PRAGMA synchronous = ${this.wal.synchronous};`)\n }\n }\n\n const logger = this.logger || false\n this.drizzle = drizzle(this.client, { logger, schema: this.schema })\n\n if (!hotReload) {\n if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n this.payload.logger.info(`---- DROPPING TABLES ----`)\n await this.dropDatabase({ adapter: this })\n this.payload.logger.info('---- DROPPED TABLES ----')\n }\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n this.payload.logger.error({ err, msg: `Error: cannot connect to SQLite: ${message}` })\n if (typeof this.rejectInitializing === 'function') {\n this.rejectInitializing()\n }\n throw new Error(`Error: cannot connect to SQLite: ${message}`)\n }\n\n // Only push schema if not in production\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_MIGRATING !== 'true' &&\n this.push !== false\n ) {\n await pushDevSchema(this as unknown as DrizzleAdapter)\n }\n\n if (typeof this.resolveInitializing === 'function') {\n this.resolveInitializing()\n }\n\n if (process.env.NODE_ENV === 'production' && this.prodMigrations) {\n await this.migrate({ migrations: this.prodMigrations as Migration[] })\n }\n}\n"],"names":["createClient","pushDevSchema","drizzle","connect","options","hotReload","client","clientConfig","busyTimeout","execute","wal","result","rows","journal_mode","payload","logger","info","journalSizeLimit","synchronous","schema","process","env","PAYLOAD_DROP_DATABASE","dropDatabase","adapter","err","message","Error","String","error","msg","rejectInitializing","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":"AAGA,SAASA,YAAY,QAAQ,iBAAgB;AAC7C,SAASC,aAAa,QAAQ,sBAAqB;AACnD,SAASC,OAAO,QAAQ,qBAAoB;AAI5C,OAAO,MAAMC,UAAmB,eAAeA,QAE7CC,UAAU;IACRC,WAAW;AACb,CAAC;IAED,MAAM,EAAEA,SAAS,EAAE,GAAGD;IAEtB,IAAI;QACF,IAAI,CAAC,IAAI,CAACE,MAAM,EAAE;YAChB,IAAI,CAACA,MAAM,GAAGN,aAAa,IAAI,CAACO,YAAY;YAE5C,IAAI,IAAI,CAACC,WAAW,GAAG,GAAG;gBACxB,MAAM,IAAI,CAACF,MAAM,CAACG,OAAO,CAAC,CAAC,sBAAsB,EAAE,IAAI,CAACD,WAAW,CAAC,CAAC,CAAC;YACxE;YAEA,IAAI,IAAI,CAACE,GAAG,EAAE;gBACZ,MAAMC,SAAS,MAAM,IAAI,CAACL,MAAM,CAACG,OAAO,CAAC;gBAEzC,IAAIE,OAAOC,IAAI,CAAC,EAAE,EAAEC,iBAAiB,OAAO;oBAC1C,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,IAAI,CACtB,CAAC,sDAAsD,EAAE,IAAI,CAACN,GAAG,CAACO,gBAAgB,CAAC,CA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AACC,IAAI,KAAK,OACd;QACA,MAAMjC,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAACkC,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAIf,QAAQC,GAAG,CAACW,QAAQ,KAAK,gBAAgB,IAAI,CAACI,cAAc,EAAE;QAChE,MAAM,IAAI,CAACC,OAAO,CAAC;YAAEC,YAAY,IAAI,CAACF,cAAc;QAAgB;IACtE;AACF,EAAC"}
1
+ {"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle'\nimport type { Connect, Migration } from 'payload'\n\nimport { createClient } from '@libsql/client'\nimport { pushDevSchema } from '@payloadcms/drizzle'\nimport { drizzle } from 'drizzle-orm/libsql'\n\nimport type { SQLiteAdapter } from './types.js'\n\nexport const connect: Connect = async function connect(\n this: SQLiteAdapter,\n options = {\n hotReload: false,\n },\n) {\n const { hotReload } = options\n\n try {\n if (!this.client) {\n this.client = createClient(this.clientConfig)\n\n if (this.busyTimeout > 0) {\n await this.client.execute(`PRAGMA busy_timeout = ${this.busyTimeout};`)\n }\n\n if (this.wal) {\n const result = await this.client.execute('PRAGMA journal_mode;')\n\n if (result.rows[0]?.journal_mode !== 'wal') {\n this.payload.logger.info(\n `[db-sqlite] Enabling WAL mode with journal size limit ${this.wal.journalSizeLimit}.`,\n )\n await this.client.execute(`PRAGMA journal_mode = WAL;`)\n await this.client.execute(`PRAGMA journal_size_limit = ${this.wal.journalSizeLimit};`)\n }\n\n await this.client.execute(`PRAGMA synchronous = ${this.wal.synchronous};`)\n }\n }\n\n const logger = this.logger || false\n this.drizzle = drizzle(this.client, { logger, schema: this.schema })\n\n if (!hotReload) {\n if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n this.payload.logger.info(`---- DROPPING TABLES ----`)\n await this.dropDatabase({ adapter: this })\n this.payload.logger.info('---- DROPPED TABLES ----')\n }\n }\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err)\n this.payload.logger.error({ err, msg: `Error: cannot connect to SQLite: ${message}` })\n if (typeof this.rejectInitializing === 'function') {\n this.rejectInitializing()\n }\n throw new Error(`Error: cannot connect to SQLite: ${message}`)\n }\n\n // Only push schema if not in production\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_MIGRATING !== 'true' &&\n this.push !== false\n ) {\n await pushDevSchema(this as unknown as DrizzleAdapter)\n }\n\n if (typeof this.resolveInitializing === 'function') {\n this.resolveInitializing()\n }\n\n if (process.env.NODE_ENV === 'production' && this.prodMigrations) {\n await this.migrate({ migrations: this.prodMigrations as Migration[] })\n }\n}\n"],"names":["createClient","pushDevSchema","drizzle","connect","options","hotReload","client","clientConfig","busyTimeout","execute","wal","result","rows","journal_mode","payload","logger","info","journalSizeLimit","synchronous","schema","process","env","PAYLOAD_DROP_DATABASE","dropDatabase","adapter","err","message","Error","String","error","msg","rejectInitializing","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":"AAGA,SAASA,YAAY,QAAQ,iBAAgB;AAC7C,SAASC,aAAa,QAAQ,sBAAqB;AACnD,SAASC,OAAO,QAAQ,qBAAoB;AAI5C,OAAO,MAAMC,UAAmB,eAAeA,QAE7CC,UAAU;IACRC,WAAW;AACb,CAAC;IAED,MAAM,EAAEA,SAAS,EAAE,GAAGD;IAEtB,IAAI;QACF,IAAI,CAAC,IAAI,CAACE,MAAM,EAAE;YAChB,IAAI,CAACA,MAAM,GAAGN,aAAa,IAAI,CAACO,YAAY;YAE5C,IAAI,IAAI,CAACC,WAAW,GAAG,GAAG;gBACxB,MAAM,IAAI,CAACF,MAAM,CAACG,OAAO,CAAC,CAAC,sBAAsB,EAAE,IAAI,CAACD,WAAW,CAAC,CAAC,CAAC;YACxE;YAEA,IAAI,IAAI,CAACE,GAAG,EAAE;gBACZ,MAAMC,SAAS,MAAM,IAAI,CAACL,MAAM,CAACG,OAAO,CAAC;gBAEzC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ACA,MAAM,IAAIJ,MAAM,CAAC,iCAAiC,EAAED,SAAS;IAC/D;IAEA,wCAAwC;IACxC,IACEN,QAAQC,GAAG,CAACW,QAAQ,KAAK,gBACzBZ,QAAQC,GAAG,CAACY,iBAAiB,KAAK,UAClC,IAAI,CAACC,IAAI,KAAK,OACd;QACA,MAAMjC,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAACkC,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAIf,QAAQC,GAAG,CAACW,QAAQ,KAAK,gBAAgB,IAAI,CAACI,cAAc,EAAE;QAChE,MAAM,IAAI,CAACC,OAAO,CAAC;YAAEC,YAAY,IAAI,CAACF,cAAc;QAAgB;IACtE;AACF,EAAC"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type { Client, Config, ResultSet } from '@libsql/client';
2
- import type { extendDrizzleTable } from '@payloadcms/drizzle';
2
+ import type { BuildQueryJoinAliases, DrizzleAdapter, extendDrizzleTable } from '@payloadcms/drizzle';
3
3
  import type { BaseSQLiteAdapter, BaseSQLiteArgs } from '@payloadcms/drizzle/sqlite';
4
- import type { BuildQueryJoinAliases, DrizzleAdapter } from '@payloadcms/drizzle/types';
5
4
  import type { DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm';
6
5
  import type { LibSQLDatabase } from 'drizzle-orm/libsql';
7
6
  import type { AnySQLiteColumn, SQLiteColumn, SQLiteInsertOnConflictDoUpdateConfig, SQLiteTableWithColumns, SQLiteTransactionConfig } from 'drizzle-orm/sqlite-core';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAa,MAAM,qBAAqB,CAAA;AACxE,OAAO,KAAK,EAAE,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AAE,eAAe,GAAG,YAAY,CAAC,CAAA;QACtD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACjC,kBAAkB,EAAE,uBAAuB,CAAA;QAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB;CACF"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Client, Config, ResultSet } from '@libsql/client'\nimport type { extendDrizzleTable, Operators } from '@payloadcms/drizzle'\nimport type { BaseSQLiteAdapter, BaseSQLiteArgs } from '@payloadcms/drizzle/sqlite'\nimport type { BuildQueryJoinAliases, DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm'\nimport type { LibSQLDatabase } from 'drizzle-orm/libsql'\nimport type {\n AnySQLiteColumn,\n SQLiteColumn,\n SQLiteInsertOnConflictDoUpdateConfig,\n SQLiteTableWithColumns,\n SQLiteTransactionConfig,\n} from 'drizzle-orm/sqlite-core'\nimport type { SQLiteRaw } from 'drizzle-orm/sqlite-core/query-builders/raw'\nimport type { Payload, PayloadRequest } from 'payload'\n\ntype SQLiteSchema = {\n relations: Record<string, GenericRelation>\n tables: Record<string, SQLiteTableWithColumns<any>>\n}\n\ntype SQLiteSchemaHookArgs = {\n extendTable: typeof extendDrizzleTable\n schema: SQLiteSchema\n}\n\nexport type SQLiteSchemaHook = (args: SQLiteSchemaHookArgs) => Promise<SQLiteSchema> | SQLiteSchema\n\nexport type Args = {\n /**\n * Transform the schema after it's built.\n * You can use it to customize the schema with features that aren't supported by Payload.\n * Examples may include: composite indices, generated columns, vectors\n */\n afterSchemaInit?: SQLiteSchemaHook[]\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * // doc created with id 1\n * const doc = await payload.create({ collection: 'posts', data: {id: 1, title: \"my title\"}})\n * ```\n */\n allowIDOnCreate?: boolean\n /**\n * Enable [AUTOINCREMENT](https://www.sqlite.org/autoinc.html) for Primary Keys.\n * This ensures that the same ID cannot be reused from previously deleted rows.\n */\n autoIncrement?: boolean\n /**\n * Transform the schema before it's built.\n * You can use it to preserve an existing database schema and if there are any collissions Payload will override them.\n * To generate Drizzle schema from the database, see [Drizzle Kit introspection](https://orm.drizzle.team/kit-docs/commands#introspect--pull)\n */\n beforeSchemaInit?: SQLiteSchemaHook[]\n /**\n * Maximum time in milliseconds to wait when the database is locked.\n * @default 0\n */\n busyTimeout?: number\n client: Config\n wal?: boolean | Partial<WalConfig>\n} & BaseSQLiteArgs\n\nexport type GenericColumns = {\n [x: string]: AnySQLiteColumn\n}\n\nexport type GenericTable = SQLiteTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: string\n}>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type CountDistinct = (args: {\n column?: SQLiteColumn<any>\n db: LibSQLDatabase\n joins: BuildQueryJoinAliases\n tableName: string\n where: SQL\n}) => Promise<number>\n\nexport type DeleteWhere = (args: {\n db: LibSQLDatabase\n tableName: string\n where: SQL\n}) => Promise<void>\n\nexport type DropDatabase = (args: { adapter: SQLiteAdapter }) => Promise<void>\n\nexport type Execute<T> = (args: {\n db?: LibSQLDatabase\n drizzle?: LibSQLDatabase\n raw?: string\n sql?: SQL<unknown>\n}) => SQLiteRaw<Promise<T>> | SQLiteRaw<ResultSet>\n\nexport type Insert = (args: {\n db: LibSQLDatabase\n onConflictDoUpdate?: SQLiteInsertOnConflictDoUpdateConfig<any>\n tableName: string\n values: Record<string, unknown> | Record<string, unknown>[]\n}) => Promise<Record<string, unknown>[]>\n\n// Explicitly omit drizzle property for complete override in SQLiteAdapter, required in ts 5.5\ntype SQLiteDrizzleAdapter = Omit<\n DrizzleAdapter,\n | 'countDistinct'\n | 'deleteWhere'\n | 'drizzle'\n | 'dropDatabase'\n | 'execute'\n | 'idType'\n | 'insert'\n | 'operators'\n | 'relations'\n>\n\nexport interface GeneratedDatabaseSchema {\n schemaUntyped: Record<string, unknown>\n}\n\ntype ResolveSchemaType<T> = 'schema' extends keyof T\n ? T['schema']\n : GeneratedDatabaseSchema['schemaUntyped']\n\ntype Drizzle = { $client: Client } & LibSQLDatabase<ResolveSchemaType<GeneratedDatabaseSchema>>\n\nexport type WalConfig = {\n /**\n * Maximum size of the WAL file before it is written back to the main database.\n * @default 67108864 (64MB)\n */\n journalSizeLimit: number\n\n /**\n * Controls how often data is synced to disk:\n * - 'EXTRA': Highest data safety\n * - 'FULL': Safe and balanced\n * - 'NORMAL': Moderate safety, better performance\n * - 'OFF': Fastest, but risk of data loss\n *\n * @default 'FULL'\n */\n synchronous: 'EXTRA' | 'FULL' | 'NORMAL' | 'OFF'\n}\n\nexport type SQLiteAdapter = {\n busyTimeout: number\n client: Client\n clientConfig: Args['client']\n drizzle: Drizzle\n /**\n * Write-Ahead Logging (WAL) configuration. If false or not set, WAL mode is disabled.\n */\n wal: false | WalConfig\n} & BaseSQLiteAdapter &\n SQLiteDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'text'\n\nexport type MigrateUpArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateUpArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateUpArgs } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\nexport type MigrateDownArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateDownArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateDownArgs } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n beginTransaction: (options?: SQLiteTransactionConfig) => Promise<null | number | string>\n busyTimeout: number\n drizzle: Drizzle\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push: boolean\n rejectInitializing: () => void\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericRelation | GenericTable>\n tableNameMap: Map<string, string>\n transactionOptions: SQLiteTransactionConfig\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAkMA,WA8BC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { Client, Config, ResultSet } from '@libsql/client'\nimport type {\n BuildQueryJoinAliases,\n DrizzleAdapter,\n extendDrizzleTable,\n Operators,\n} from '@payloadcms/drizzle'\nimport type { BaseSQLiteAdapter, BaseSQLiteArgs } from '@payloadcms/drizzle/sqlite'\nimport type { DrizzleConfig, Relation, Relations, SQL } from 'drizzle-orm'\nimport type { LibSQLDatabase } from 'drizzle-orm/libsql'\nimport type {\n AnySQLiteColumn,\n SQLiteColumn,\n SQLiteInsertOnConflictDoUpdateConfig,\n SQLiteTableWithColumns,\n SQLiteTransactionConfig,\n} from 'drizzle-orm/sqlite-core'\nimport type { SQLiteRaw } from 'drizzle-orm/sqlite-core/query-builders/raw'\nimport type { Payload, PayloadRequest } from 'payload'\n\ntype SQLiteSchema = {\n relations: Record<string, GenericRelation>\n tables: Record<string, SQLiteTableWithColumns<any>>\n}\n\ntype SQLiteSchemaHookArgs = {\n extendTable: typeof extendDrizzleTable\n schema: SQLiteSchema\n}\n\nexport type SQLiteSchemaHook = (args: SQLiteSchemaHookArgs) => Promise<SQLiteSchema> | SQLiteSchema\n\nexport type Args = {\n /**\n * Transform the schema after it's built.\n * You can use it to customize the schema with features that aren't supported by Payload.\n * Examples may include: composite indices, generated columns, vectors\n */\n afterSchemaInit?: SQLiteSchemaHook[]\n /**\n * Enable this flag if you want to thread your own ID to create operation data, for example:\n * ```ts\n * // doc created with id 1\n * const doc = await payload.create({ collection: 'posts', data: {id: 1, title: \"my title\"}})\n * ```\n */\n allowIDOnCreate?: boolean\n /**\n * Enable [AUTOINCREMENT](https://www.sqlite.org/autoinc.html) for Primary Keys.\n * This ensures that the same ID cannot be reused from previously deleted rows.\n */\n autoIncrement?: boolean\n /**\n * Transform the schema before it's built.\n * You can use it to preserve an existing database schema and if there are any collissions Payload will override them.\n * To generate Drizzle schema from the database, see [Drizzle Kit introspection](https://orm.drizzle.team/kit-docs/commands#introspect--pull)\n */\n beforeSchemaInit?: SQLiteSchemaHook[]\n /**\n * Maximum time in milliseconds to wait when the database is locked.\n * @default 0\n */\n busyTimeout?: number\n client: Config\n wal?: boolean | Partial<WalConfig>\n} & BaseSQLiteArgs\n\nexport type GenericColumns = {\n [x: string]: AnySQLiteColumn\n}\n\nexport type GenericTable = SQLiteTableWithColumns<{\n columns: GenericColumns\n dialect: string\n name: string\n schema: string\n}>\n\nexport type GenericRelation = Relations<string, Record<string, Relation<string>>>\n\nexport type CountDistinct = (args: {\n column?: SQLiteColumn<any>\n db: LibSQLDatabase\n joins: BuildQueryJoinAliases\n tableName: string\n where: SQL\n}) => Promise<number>\n\nexport type DeleteWhere = (args: {\n db: LibSQLDatabase\n tableName: string\n where: SQL\n}) => Promise<void>\n\nexport type DropDatabase = (args: { adapter: SQLiteAdapter }) => Promise<void>\n\nexport type Execute<T> = (args: {\n db?: LibSQLDatabase\n drizzle?: LibSQLDatabase\n raw?: string\n sql?: SQL<unknown>\n}) => SQLiteRaw<Promise<T>> | SQLiteRaw<ResultSet>\n\nexport type Insert = (args: {\n db: LibSQLDatabase\n onConflictDoUpdate?: SQLiteInsertOnConflictDoUpdateConfig<any>\n tableName: string\n values: Record<string, unknown> | Record<string, unknown>[]\n}) => Promise<Record<string, unknown>[]>\n\n// Explicitly omit drizzle property for complete override in SQLiteAdapter, required in ts 5.5\ntype SQLiteDrizzleAdapter = Omit<\n DrizzleAdapter,\n | 'countDistinct'\n | 'deleteWhere'\n | 'drizzle'\n | 'dropDatabase'\n | 'execute'\n | 'idType'\n | 'insert'\n | 'operators'\n | 'relations'\n>\n\nexport interface GeneratedDatabaseSchema {\n schemaUntyped: Record<string, unknown>\n}\n\ntype ResolveSchemaType<T> = 'schema' extends keyof T\n ? T['schema']\n : GeneratedDatabaseSchema['schemaUntyped']\n\ntype Drizzle = { $client: Client } & LibSQLDatabase<ResolveSchemaType<GeneratedDatabaseSchema>>\n\nexport type WalConfig = {\n /**\n * Maximum size of the WAL file before it is written back to the main database.\n * @default 67108864 (64MB)\n */\n journalSizeLimit: number\n\n /**\n * Controls how often data is synced to disk:\n * - 'EXTRA': Highest data safety\n * - 'FULL': Safe and balanced\n * - 'NORMAL': Moderate safety, better performance\n * - 'OFF': Fastest, but risk of data loss\n *\n * @default 'FULL'\n */\n synchronous: 'EXTRA' | 'FULL' | 'NORMAL' | 'OFF'\n}\n\nexport type SQLiteAdapter = {\n busyTimeout: number\n client: Client\n clientConfig: Args['client']\n drizzle: Drizzle\n /**\n * Write-Ahead Logging (WAL) configuration. If false or not set, WAL mode is disabled.\n */\n wal: false | WalConfig\n} & BaseSQLiteAdapter &\n SQLiteDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'text'\n\nexport type MigrateUpArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateUpArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateUpArgs } from '@payloadcms/db-sqlite'\n *\n * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\nexport type MigrateDownArgs = {\n /**\n * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.\n * @example\n * ```ts\n * import { type MigrateDownArgs, sql } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)\n * }\n * ```\n */\n db: Drizzle\n /**\n * The Payload instance that you can use to execute Local API methods\n * To use the current transaction you must pass `req` to arguments\n * @example\n * ```ts\n * import { type MigrateDownArgs } from '@payloadcms/db-sqlite'\n *\n * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {\n * const posts = await payload.find({ collection: 'posts', req })\n * }\n * ```\n */\n payload: Payload\n /**\n * The `PayloadRequest` object that contains the current transaction\n */\n req: PayloadRequest\n}\n\ndeclare module 'payload' {\n export interface DatabaseAdapter\n extends Omit<Args, 'idType' | 'logger' | 'migrationDir' | 'pool'>,\n DrizzleAdapter {\n beginTransaction: (options?: SQLiteTransactionConfig) => Promise<null | number | string>\n busyTimeout: number\n drizzle: Drizzle\n /**\n * An object keyed on each table, with a key value pair where the constraint name is the key, followed by the dot-notation field name\n * Used for returning properly formed errors from unique fields\n */\n fieldConstraints: Record<string, Record<string, string>>\n idType: Args['idType']\n initializing: Promise<void>\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push: boolean\n rejectInitializing: () => void\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericRelation | GenericTable>\n tableNameMap: Map<string, string>\n transactionOptions: SQLiteTransactionConfig\n versionsSuffix?: string\n }\n}\n"],"names":[],"mappings":"AAsMA,WA8BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-sqlite",
3
- "version": "3.85.0",
3
+ "version": "4.0.0-canary.0",
4
4
  "description": "The officially supported SQLite database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -25,11 +25,6 @@
25
25
  "require": "./dist/index.js",
26
26
  "types": "./dist/index.d.ts"
27
27
  },
28
- "./types": {
29
- "import": "./dist/exports/types-deprecated.js",
30
- "require": "./dist/exports/types-deprecated.js",
31
- "types": "./dist/exports/types-deprecated.d.ts"
32
- },
33
28
  "./migration-utils": {
34
29
  "import": "./dist/exports/migration-utils.js",
35
30
  "require": "./dist/exports/migration-utils.js",
@@ -64,22 +59,22 @@
64
59
  ],
65
60
  "dependencies": {
66
61
  "@libsql/client": "0.14.0",
67
- "console-table-printer": "2.12.1",
62
+ "console-table-printer": "2.15.0",
68
63
  "drizzle-kit": "0.31.7",
69
64
  "drizzle-orm": "0.45.2",
70
65
  "prompts": "2.4.2",
71
66
  "to-snake-case": "1.0.0",
72
- "uuid": "13.0.2",
73
- "@payloadcms/drizzle": "3.85.0"
67
+ "uuid": "14.0.0",
68
+ "@payloadcms/drizzle": "4.0.0-canary.0"
74
69
  },
75
70
  "devDependencies": {
76
71
  "@types/pg": "8.20.0",
77
72
  "@types/to-snake-case": "1.0.0",
78
73
  "@payloadcms/eslint-config": "3.28.0",
79
- "payload": "3.85.0"
74
+ "payload": "4.0.0-canary.0"
80
75
  },
81
76
  "peerDependencies": {
82
- "payload": "3.85.0"
77
+ "payload": "4.0.0-canary.0"
83
78
  },
84
79
  "scripts": {
85
80
  "build": "pnpm build:swc && pnpm build:types",
@@ -1,62 +0,0 @@
1
- import type { Args as _Args, CountDistinct as _CountDistinct, DeleteWhere as _DeleteWhere, DropDatabase as _DropDatabase, Execute as _Execute, GeneratedDatabaseSchema as _GeneratedDatabaseSchema, GenericColumns as _GenericColumns, GenericRelation as _GenericRelation, GenericTable as _GenericTable, IDType as _IDType, Insert as _Insert, MigrateDownArgs as _MigrateDownArgs, MigrateUpArgs as _MigrateUpArgs, SQLiteAdapter as _SQLiteAdapter, SQLiteSchemaHook as _SQLiteSchemaHook } from '../types.js';
2
- /**
3
- * @deprecated - import from `@payloadcms/db-sqlite` instead
4
- */
5
- export type SQLiteAdapter = _SQLiteAdapter;
6
- /**
7
- * @deprecated - import from `@payloadcms/db-sqlite` instead
8
- */
9
- export type Args = _Args;
10
- /**
11
- * @deprecated - import from `@payloadcms/db-sqlite` instead
12
- */
13
- export type CountDistinct = _CountDistinct;
14
- /**
15
- * @deprecated - import from `@payloadcms/db-sqlite` instead
16
- */
17
- export type DeleteWhere = _DeleteWhere;
18
- /**
19
- * @deprecated - import from `@payloadcms/db-sqlite` instead
20
- */
21
- export type DropDatabase = _DropDatabase;
22
- /**
23
- * @deprecated - import from `@payloadcms/db-sqlite` instead
24
- */
25
- export type Execute<T> = _Execute<T>;
26
- /**
27
- * @deprecated - import from `@payloadcms/db-sqlite` instead
28
- */
29
- export type GeneratedDatabaseSchema = _GeneratedDatabaseSchema;
30
- /**
31
- * @deprecated - import from `@payloadcms/db-sqlite` instead
32
- */
33
- export type GenericColumns = _GenericColumns;
34
- /**
35
- * @deprecated - import from `@payloadcms/db-sqlite` instead
36
- */
37
- export type GenericRelation = _GenericRelation;
38
- /**
39
- * @deprecated - import from `@payloadcms/db-sqlite` instead
40
- */
41
- export type GenericTable = _GenericTable;
42
- /**
43
- * @deprecated - import from `@payloadcms/db-sqlite` instead
44
- */
45
- export type IDType = _IDType;
46
- /**
47
- * @deprecated - import from `@payloadcms/db-sqlite` instead
48
- */
49
- export type Insert = _Insert;
50
- /**
51
- * @deprecated - import from `@payloadcms/db-sqlite` instead
52
- */
53
- export type MigrateDownArgs = _MigrateDownArgs;
54
- /**
55
- * @deprecated - import from `@payloadcms/db-sqlite` instead
56
- */
57
- export type MigrateUpArgs = _MigrateUpArgs;
58
- /**
59
- * @deprecated - import from `@payloadcms/db-sqlite` instead
60
- */
61
- export type SQLiteSchemaHook = _SQLiteSchemaHook;
62
- //# sourceMappingURL=types-deprecated.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-deprecated.d.ts","sourceRoot":"","sources":["../../src/exports/types-deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,IAAI,KAAK,EACb,aAAa,IAAI,cAAc,EAC/B,WAAW,IAAI,YAAY,EAC3B,YAAY,IAAI,aAAa,EAC7B,OAAO,IAAI,QAAQ,EACnB,uBAAuB,IAAI,wBAAwB,EACnD,cAAc,IAAI,eAAe,EACjC,eAAe,IAAI,gBAAgB,EACnC,YAAY,IAAI,aAAa,EAC7B,MAAM,IAAI,OAAO,EACjB,MAAM,IAAI,OAAO,EACjB,eAAe,IAAI,gBAAgB,EACnC,aAAa,IAAI,cAAc,EAC/B,aAAa,IAAI,cAAc,EAC/B,gBAAgB,IAAI,iBAAiB,EACtC,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAE1C;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,CAAA;AACxB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAC1C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,CAAA;AACtC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,CAAA;AACxC;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAA;AACpC;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,CAAA;AAC9D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,eAAe,CAAA;AAC5C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAC9C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,CAAA;AACxC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,CAAA;AAC5B;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,CAAA;AAC5B;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAA;AAC9C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAC1C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAA"}
@@ -1,5 +0,0 @@
1
- /**
2
- * @deprecated - import from `@payloadcms/db-sqlite` instead
3
- */ export { };
4
-
5
- //# sourceMappingURL=types-deprecated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/exports/types-deprecated.ts"],"sourcesContent":["import type {\n Args as _Args,\n CountDistinct as _CountDistinct,\n DeleteWhere as _DeleteWhere,\n DropDatabase as _DropDatabase,\n Execute as _Execute,\n GeneratedDatabaseSchema as _GeneratedDatabaseSchema,\n GenericColumns as _GenericColumns,\n GenericRelation as _GenericRelation,\n GenericTable as _GenericTable,\n IDType as _IDType,\n Insert as _Insert,\n MigrateDownArgs as _MigrateDownArgs,\n MigrateUpArgs as _MigrateUpArgs,\n SQLiteAdapter as _SQLiteAdapter,\n SQLiteSchemaHook as _SQLiteSchemaHook,\n} from '../types.js'\n\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type SQLiteAdapter = _SQLiteAdapter\n\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type Args = _Args\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type CountDistinct = _CountDistinct\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type DeleteWhere = _DeleteWhere\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type DropDatabase = _DropDatabase\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type Execute<T> = _Execute<T>\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type GeneratedDatabaseSchema = _GeneratedDatabaseSchema\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type GenericColumns = _GenericColumns\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type GenericRelation = _GenericRelation\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type GenericTable = _GenericTable\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type IDType = _IDType\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type Insert = _Insert\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type MigrateDownArgs = _MigrateDownArgs\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type MigrateUpArgs = _MigrateUpArgs\n/**\n * @deprecated - import from `@payloadcms/db-sqlite` instead\n */\nexport type SQLiteSchemaHook = _SQLiteSchemaHook\n"],"names":[],"mappings":"AA2EA;;CAEC,GACD,WAAgD"}