@payloadcms/db-sqlite 3.4.1-canary.b6681a9 → 3.5.1-canary.15a5791

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,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAA;AAuC1D,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAgBrD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,aAAa,CAAC,CA4G3E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAA;AAyC1D,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAcrD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAIjC,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAmH3E"}
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { beginTransaction, commitTransaction, count, countGlobalVersions, countVersions, create, createGlobal, createGlobalVersion, createVersion, deleteMany, deleteOne, deleteVersions, destroy, find, findGlobal, findGlobalVersions, findMigrationDir, findOne, findVersions, migrate, migrateDown, migrateFresh, migrateRefresh, migrateReset, migrateStatus, operatorMap, queryDrafts, rollbackTransaction, updateGlobal, updateGlobalVersion, updateOne, updateVersion } from '@payloadcms/drizzle';
1
+ import { beginTransaction, buildCreateMigration, commitTransaction, count, countGlobalVersions, countVersions, create, createGlobal, createGlobalVersion, createVersion, deleteMany, deleteOne, deleteVersions, destroy, find, findGlobal, findGlobalVersions, findMigrationDir, findOne, findVersions, migrate, migrateDown, migrateFresh, migrateRefresh, migrateReset, migrateStatus, operatorMap, queryDrafts, rollbackTransaction, updateGlobal, updateGlobalVersion, updateOne, updateVersion } from '@payloadcms/drizzle';
2
2
  import { like } from 'drizzle-orm';
3
3
  import { createDatabaseAdapter, defaultBeginTransaction } from 'payload';
4
+ import { fileURLToPath } from 'url';
4
5
  import { connect } from './connect.js';
5
6
  import { countDistinct } from './countDistinct.js';
6
7
  import { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js';
7
8
  import { createJSONQuery } from './createJSONQuery/index.js';
8
- import { createMigration } from './createMigration.js';
9
9
  import { defaultDrizzleSnapshot } from './defaultSnapshot.js';
10
10
  import { deleteWhere } from './deleteWhere.js';
11
11
  import { dropDatabase } from './dropDatabase.js';
12
12
  import { execute } from './execute.js';
13
- import { getMigrationTemplate } from './getMigrationTemplate.js';
14
13
  import { init } from './init.js';
15
14
  import { insert } from './insert.js';
16
15
  import { requireDrizzleKit } from './requireDrizzleKit.js';
17
16
  export { sql } from 'drizzle-orm';
17
+ const filename = fileURLToPath(import.meta.url);
18
18
  export function sqliteAdapter(args) {
19
19
  const postgresIDType = args.idType || 'serial';
20
20
  const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text';
@@ -44,7 +44,6 @@ export function sqliteAdapter(args) {
44
44
  json: true
45
45
  },
46
46
  fieldConstraints: {},
47
- getMigrationTemplate,
48
47
  idType: postgresIDType,
49
48
  initializing,
50
49
  localesSuffix: args.localesSuffix || '_locales',
@@ -74,7 +73,13 @@ export function sqliteAdapter(args) {
74
73
  createGlobal,
75
74
  createGlobalVersion,
76
75
  createJSONQuery,
77
- createMigration,
76
+ createMigration: buildCreateMigration({
77
+ executeMethod: 'run',
78
+ filename,
79
+ sanitizeStatements ({ sqlExecute, statements }) {
80
+ return statements.map((statement)=>`${sqlExecute}${statement?.replaceAll('`', '\\`')}\`)`).join('\n');
81
+ }
82
+ }),
78
83
  createVersion,
79
84
  defaultIDType: payloadIDType,
80
85
  deleteMany,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Operators } from '@payloadcms/drizzle'\nimport type { DatabaseAdapterObj, Payload } from 'payload'\n\nimport {\n beginTransaction,\n commitTransaction,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createVersion,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findMigrationDir,\n findOne,\n findVersions,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n operatorMap,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n} from '@payloadcms/drizzle'\nimport { like } from 'drizzle-orm'\nimport { createDatabaseAdapter, defaultBeginTransaction } from 'payload'\n\nimport type { Args, SQLiteAdapter } from './types.js'\n\nimport { connect } from './connect.js'\nimport { countDistinct } from './countDistinct.js'\nimport { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js'\nimport { createJSONQuery } from './createJSONQuery/index.js'\nimport { createMigration } from './createMigration.js'\nimport { defaultDrizzleSnapshot } from './defaultSnapshot.js'\nimport { deleteWhere } from './deleteWhere.js'\nimport { dropDatabase } from './dropDatabase.js'\nimport { execute } from './execute.js'\nimport { getMigrationTemplate } from './getMigrationTemplate.js'\nimport { init } from './init.js'\nimport { insert } from './insert.js'\nimport { requireDrizzleKit } from './requireDrizzleKit.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport { sql } from 'drizzle-orm'\n\nexport function sqliteAdapter(args: Args): DatabaseAdapterObj<SQLiteAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n let resolveInitializing\n let rejectInitializing\n\n const initializing = new Promise<void>((res, rej) => {\n resolveInitializing = res\n rejectInitializing = rej\n })\n\n // sqlite's like operator is case-insensitive, so we overwrite the DrizzleAdapter operators to not use ilike\n const operators = {\n ...operatorMap,\n contains: like,\n like,\n } as unknown as Operators\n\n return createDatabaseAdapter<SQLiteAdapter>({\n name: 'sqlite',\n afterSchemaInit: args.afterSchemaInit ?? [],\n beforeSchemaInit: args.beforeSchemaInit ?? [],\n client: undefined,\n clientConfig: args.client,\n defaultDrizzleSnapshot,\n drizzle: undefined,\n features: {\n json: true,\n },\n fieldConstraints: {},\n getMigrationTemplate,\n idType: postgresIDType,\n initializing,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n operators,\n prodMigrations: args.prodMigrations,\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n transactionOptions: args.transactionOptions || undefined,\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction: args.transactionOptions ? beginTransaction : defaultBeginTransaction(),\n commitTransaction,\n connect,\n convertPathToJSONTraversal,\n count,\n countDistinct,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createJSONQuery,\n createMigration,\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n deleteWhere,\n destroy,\n dropDatabase,\n execute,\n find,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n indexes: new Set<string>(),\n init,\n insert,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n packageName: '@payloadcms/db-sqlite',\n payload,\n queryDrafts,\n rejectInitializing,\n requireDrizzleKit,\n resolveInitializing,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert: updateOne,\n })\n }\n\n return {\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n"],"names":["beginTransaction","commitTransaction","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findMigrationDir","findOne","findVersions","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","operatorMap","queryDrafts","rollbackTransaction","updateGlobal","updateGlobalVersion","updateOne","updateVersion","like","createDatabaseAdapter","defaultBeginTransaction","connect","countDistinct","convertPathToJSONTraversal","createJSONQuery","createMigration","defaultDrizzleSnapshot","deleteWhere","dropDatabase","execute","getMigrationTemplate","init","insert","requireDrizzleKit","sql","sqliteAdapter","args","postgresIDType","idType","payloadIDType","adapter","payload","migrationDir","resolveInitializing","rejectInitializing","initializing","Promise","res","rej","operators","contains","name","afterSchemaInit","beforeSchemaInit","client","undefined","clientConfig","drizzle","features","json","fieldConstraints","localesSuffix","logger","prodMigrations","push","relations","relationshipsSuffix","schema","schemaName","sessions","tableNameMap","Map","tables","transactionOptions","versionsSuffix","defaultIDType","indexes","Set","packageName","upsert"],"mappings":"AAGA,SACEA,gBAAgB,EAChBC,iBAAiB,EACjBC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,EACbC,MAAM,EACNC,YAAY,EACZC,mBAAmB,EACnBC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,EACnBC,SAAS,EACTC,aAAa,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AAQD;YACRQ;YACAgB,eAAezB,KAAKyB,aAAa,IAAI;YACrCC,QAAQ1B,KAAK0B,MAAM;YACnBb;YACAc,gBAAgB3B,KAAK2B,cAAc;YACnCC,MAAM5B,KAAK4B,IAAI;YACfC,WAAW,CAAC;YACZC,qBAAqB9B,KAAK8B,mBAAmB,IAAI;YACjDC,QAAQ,CAAC;YACTC,YAAYhC,KAAKgC,UAAU;YAC3BC,UAAU,CAAC;YACXC,cAAc,IAAIC;YAClBC,QAAQ,CAAC;YACTC,oBAAoBrC,KAAKqC,kBAAkB,IAAIlB;YAC/CmB,gBAAgBtC,KAAKsC,cAAc,IAAI;YAEvC,kBAAkB;YAClBxF,kBAAkBkD,KAAKqC,kBAAkB,GAAGvF,mBAAmBkC;YAC/DjC;YACAkC;YACAE;YACAnC;YACAkC;YACAjC;YACAC;YACAC;YACAC;YACAC;YACA+B;YACAC;YACA/B;YACAiF,eAAepC;YACf5C;YACAC;YACAC;YACA8B;YACA7B;YACA8B;YACAC;YACA9B;YACAC;YACAC;YACAE;YACAC;YACAwE,SAAS,IAAIC;YACb9C;YACAC;YACA3B;YACAC;YACAC;YACAC;YACAC;YACAC;YACAgC;YACAoC,aAAa;YACbrC;YACA7B;YACAgC;YACAX;YACAU;YACA9B;YACAC;YACAC;YACAC;YACAC;YACA8D,QAAQ/D;QACV;IACF;IAEA,OAAO;QACL2D,eAAepC;QACfR,MAAMS;IACR;AACF"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Operators } from '@payloadcms/drizzle'\nimport type { DatabaseAdapterObj, Payload } from 'payload'\n\nimport {\n beginTransaction,\n buildCreateMigration,\n commitTransaction,\n count,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createVersion,\n deleteMany,\n deleteOne,\n deleteVersions,\n destroy,\n find,\n findGlobal,\n findGlobalVersions,\n findMigrationDir,\n findOne,\n findVersions,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n operatorMap,\n queryDrafts,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n} from '@payloadcms/drizzle'\nimport { like } from 'drizzle-orm'\nimport { createDatabaseAdapter, defaultBeginTransaction } from 'payload'\nimport { fileURLToPath } from 'url'\n\nimport type { Args, SQLiteAdapter } from './types.js'\n\nimport { connect } from './connect.js'\nimport { countDistinct } from './countDistinct.js'\nimport { convertPathToJSONTraversal } from './createJSONQuery/convertPathToJSONTraversal.js'\nimport { createJSONQuery } from './createJSONQuery/index.js'\nimport { defaultDrizzleSnapshot } from './defaultSnapshot.js'\nimport { deleteWhere } from './deleteWhere.js'\nimport { dropDatabase } from './dropDatabase.js'\nimport { execute } from './execute.js'\nimport { init } from './init.js'\nimport { insert } from './insert.js'\nimport { requireDrizzleKit } from './requireDrizzleKit.js'\n\nexport type { MigrateDownArgs, MigrateUpArgs } from './types.js'\n\nexport { sql } from 'drizzle-orm'\n\nconst filename = fileURLToPath(import.meta.url)\n\nexport function sqliteAdapter(args: Args): DatabaseAdapterObj<SQLiteAdapter> {\n const postgresIDType = args.idType || 'serial'\n const payloadIDType = postgresIDType === 'serial' ? 'number' : 'text'\n\n function adapter({ payload }: { payload: Payload }) {\n const migrationDir = findMigrationDir(args.migrationDir)\n let resolveInitializing\n let rejectInitializing\n\n const initializing = new Promise<void>((res, rej) => {\n resolveInitializing = res\n rejectInitializing = rej\n })\n\n // sqlite's like operator is case-insensitive, so we overwrite the DrizzleAdapter operators to not use ilike\n const operators = {\n ...operatorMap,\n contains: like,\n like,\n } as unknown as Operators\n\n return createDatabaseAdapter<SQLiteAdapter>({\n name: 'sqlite',\n afterSchemaInit: args.afterSchemaInit ?? [],\n beforeSchemaInit: args.beforeSchemaInit ?? [],\n client: undefined,\n clientConfig: args.client,\n defaultDrizzleSnapshot,\n drizzle: undefined,\n features: {\n json: true,\n },\n fieldConstraints: {},\n idType: postgresIDType,\n initializing,\n localesSuffix: args.localesSuffix || '_locales',\n logger: args.logger,\n operators,\n prodMigrations: args.prodMigrations,\n push: args.push,\n relations: {},\n relationshipsSuffix: args.relationshipsSuffix || '_rels',\n schema: {},\n schemaName: args.schemaName,\n sessions: {},\n tableNameMap: new Map<string, string>(),\n tables: {},\n transactionOptions: args.transactionOptions || undefined,\n versionsSuffix: args.versionsSuffix || '_v',\n\n // DatabaseAdapter\n beginTransaction: args.transactionOptions ? beginTransaction : defaultBeginTransaction(),\n commitTransaction,\n connect,\n convertPathToJSONTraversal,\n count,\n countDistinct,\n countGlobalVersions,\n countVersions,\n create,\n createGlobal,\n createGlobalVersion,\n createJSONQuery,\n createMigration: buildCreateMigration({\n executeMethod: 'run',\n filename,\n sanitizeStatements({ sqlExecute, statements }) {\n return statements\n .map((statement) => `${sqlExecute}${statement?.replaceAll('`', '\\\\`')}\\`)`)\n .join('\\n')\n },\n }),\n createVersion,\n defaultIDType: payloadIDType,\n deleteMany,\n deleteOne,\n deleteVersions,\n deleteWhere,\n destroy,\n dropDatabase,\n execute,\n find,\n findGlobal,\n findGlobalVersions,\n findOne,\n findVersions,\n indexes: new Set<string>(),\n init,\n insert,\n migrate,\n migrateDown,\n migrateFresh,\n migrateRefresh,\n migrateReset,\n migrateStatus,\n migrationDir,\n packageName: '@payloadcms/db-sqlite',\n payload,\n queryDrafts,\n rejectInitializing,\n requireDrizzleKit,\n resolveInitializing,\n rollbackTransaction,\n updateGlobal,\n updateGlobalVersion,\n updateOne,\n updateVersion,\n upsert: updateOne,\n })\n }\n\n return {\n defaultIDType: payloadIDType,\n init: adapter,\n }\n}\n"],"names":["beginTransaction","buildCreateMigration","commitTransaction","count","countGlobalVersions","countVersions","create","createGlobal","createGlobalVersion","createVersion","deleteMany","deleteOne","deleteVersions","destroy","find","findGlobal","findGlobalVersions","findMigrationDir","findOne","findVersions","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","operatorMap","queryDrafts","rollbackTransaction","updateGlobal","updateGlobalVersion","updateOne","updateVersion","like","createDatabaseAdapter","defaultBeginTransaction","fileURLToPath","connect","countDistinct","convertPathToJSONTraversal","createJSONQuery","defaultDrizzleSnapshot","deleteWhere","dropDatabase","execute","init","insert","requireDrizzleKit","sql","filename","url","sqliteAdapter","args","postgresIDType","idType","payloadIDType","adapter","payload","migrationDir","resolveInitializing","rejectInitializing","initializing","Promise","res","rej","operators","contains","name","afterSchemaInit","beforeSchemaInit","client","undefined","clientConfig","drizzle","features","json","fieldConstraints","localesSuffix","logger","prodMigrations","push","relations","relationshipsSuffix","schema","schemaName","sessions","tableNameMap","Map","tables","transactionOptions","versionsSuffix","createMigration","executeMethod","sanitizeStatements","sqlExecute","statements","map","statement","replaceAll","join","defaultIDType","indexes","Set","packageName","upsert"],"mappings":"AAGA,SACEA,gBAAgB,EAChBC,oBAAoB,EACpBC,iBAAiB,EACjBC,KAAK,EACLC,mBAAmB,EACnBC,aAAa,EACbC,MAAM,EACNC,YAAY,EACZC,mBAAmB,EACnBC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,IAAI,EACJC,UAAU,EACVC,kBAAkB,EAClBC,gBAAgB,EAChBC,OAAO,EACPC,YAAY,EACZC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,EACnBC,SAAS,EACTC,aAAa,QACR,sBAAqB;AAC5B,SAASC,IAAI,QAAQ,cAAa;AAClC,SAASC,qBAAqB,EAAEC,uBAAuB,QAAQ,UAAS;AACxE,SAASC,aAAa,QAAQ,MAAK;AAInC,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,0BAA0B,QAAQ,kDAAiD;AAC5F,SAASC,eAAe,QAAQ,6BAA4B;AAC5D,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,WAAW,QAAQ,mBAA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KqC,kBAAkB,IAAIlB;YAC/CmB,gBAAgBtC,KAAKsC,cAAc,IAAI;YAEvC,kBAAkB;YAClB1F,kBAAkBoD,KAAKqC,kBAAkB,GAAGzF,mBAAmBmC;YAC/DjC;YACAmC;YACAE;YACApC;YACAmC;YACAlC;YACAC;YACAC;YACAC;YACAC;YACAgC;YACAmD,iBAAiB1F,qBAAqB;gBACpC2F,eAAe;gBACf3C;gBACA4C,oBAAmB,EAAEC,UAAU,EAAEC,UAAU,EAAE;oBAC3C,OAAOA,WACJC,GAAG,CAAC,CAACC,YAAc,GAAGH,aAAaG,WAAWC,WAAW,KAAK,OAAO,GAAG,CAAC,EACzEC,IAAI,CAAC;gBACV;YACF;YACA1F;YACA2F,eAAe7C;YACf7C;YACAC;YACAC;YACA8B;YACA7B;YACA8B;YACAC;YACA9B;YACAC;YACAC;YACAE;YACAC;YACAkF,SAAS,IAAIC;YACbzD;YACAC;YACA1B;YACAC;YACAC;YACAC;YACAC;YACAC;YACAiC;YACA6C,aAAa;YACb9C;YACA9B;YACAiC;YACAb;YACAY;YACA/B;YACAC;YACAC;YACAC;YACAC;YACAwE,QAAQzE;QACV;IACF;IAEA,OAAO;QACLqE,eAAe7C;QACfV,MAAMW;IACR;AACF"}
@@ -1,6 +1,3 @@
1
1
  import type { RequireDrizzleKit } from '@payloadcms/drizzle/types';
2
- /**
3
- * Dynamically requires the `drizzle-kit` package to access the `generateSQLiteDrizzleJson` and `pushSQLiteSchema` functions and exports them generically to call them from @payloadcms/drizzle.
4
- */
5
2
  export declare const requireDrizzleKit: RequireDrizzleKit;
6
3
  //# sourceMappingURL=requireDrizzleKit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requireDrizzleKit.d.ts","sourceRoot":"","sources":["../src/requireDrizzleKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAKlE;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBAM/B,CAAA"}
1
+ {"version":3,"file":"requireDrizzleKit.d.ts","sourceRoot":"","sources":["../src/requireDrizzleKit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAMlE,eAAO,MAAM,iBAAiB,EAAE,iBAY/B,CAAA"}
@@ -1,12 +1,11 @@
1
1
  import { createRequire } from 'module';
2
2
  const require = createRequire(import.meta.url);
3
- /**
4
- * Dynamically requires the `drizzle-kit` package to access the `generateSQLiteDrizzleJson` and `pushSQLiteSchema` functions and exports them generically to call them from @payloadcms/drizzle.
5
- */ export const requireDrizzleKit = ()=>{
6
- const { generateSQLiteDrizzleJson: generateDrizzleJson, pushSQLiteSchema: pushSchema } = require('drizzle-kit/api');
3
+ export const requireDrizzleKit = ()=>{
4
+ const { generateSQLiteDrizzleJson, generateSQLiteMigration, pushSQLiteSchema } = require('drizzle-kit/api');
7
5
  return {
8
- generateDrizzleJson,
9
- pushSchema
6
+ generateDrizzleJson: generateSQLiteDrizzleJson,
7
+ generateMigration: generateSQLiteMigration,
8
+ pushSchema: pushSQLiteSchema
10
9
  };
11
10
  };
12
11
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/requireDrizzleKit.ts"],"sourcesContent":["import type { RequireDrizzleKit } from '@payloadcms/drizzle/types'\n\nimport { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\n\n/**\n * Dynamically requires the `drizzle-kit` package to access the `generateSQLiteDrizzleJson` and `pushSQLiteSchema` functions and exports them generically to call them from @payloadcms/drizzle.\n */\nexport const requireDrizzleKit: RequireDrizzleKit = () => {\n const {\n generateSQLiteDrizzleJson: generateDrizzleJson,\n pushSQLiteSchema: pushSchema,\n } = require('drizzle-kit/api')\n return { generateDrizzleJson, pushSchema }\n}\n"],"names":["createRequire","require","url","requireDrizzleKit","generateSQLiteDrizzleJson","generateDrizzleJson","pushSQLiteSchema","pushSchema"],"mappings":"AAEA,SAASA,aAAa,QAAQ,SAAQ;AACtC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAE7C;;CAEC,GACD,OAAO,MAAMC,oBAAuC;IAClD,MAAM,EACJC,2BAA2BC,mBAAmB,EAC9CC,kBAAkBC,UAAU,EAC7B,GAAGN,QAAQ;IACZ,OAAO;QAAEI;QAAqBE;IAAW;AAC3C,EAAC"}
1
+ {"version":3,"sources":["../src/requireDrizzleKit.ts"],"sourcesContent":["import type { RequireDrizzleKit } from '@payloadcms/drizzle/types'\n\nimport { createRequire } from 'module'\n\nconst require = createRequire(import.meta.url)\n\nexport const requireDrizzleKit: RequireDrizzleKit = () => {\n const {\n generateSQLiteDrizzleJson,\n generateSQLiteMigration,\n pushSQLiteSchema,\n } = require('drizzle-kit/api')\n\n return {\n generateDrizzleJson: generateSQLiteDrizzleJson,\n generateMigration: generateSQLiteMigration,\n pushSchema: pushSQLiteSchema,\n }\n}\n"],"names":["createRequire","require","url","requireDrizzleKit","generateSQLiteDrizzleJson","generateSQLiteMigration","pushSQLiteSchema","generateDrizzleJson","generateMigration","pushSchema"],"mappings":"AAEA,SAASA,aAAa,QAAQ,SAAQ;AAEtC,MAAMC,UAAUD,cAAc,YAAYE,GAAG;AAE7C,OAAO,MAAMC,oBAAuC;IAClD,MAAM,EACJC,yBAAyB,EACzBC,uBAAuB,EACvBC,gBAAgB,EACjB,GAAGL,QAAQ;IAEZ,OAAO;QACLM,qBAAqBH;QACrBI,mBAAmBH;QACnBI,YAAYH;IACd;AACF,EAAC"}
package/dist/types.d.ts CHANGED
@@ -124,11 +124,65 @@ export type SQLiteAdapter = {
124
124
  } & SQLiteDrizzleAdapter;
125
125
  export type IDType = 'integer' | 'numeric' | 'text';
126
126
  export type MigrateUpArgs = {
127
+ /**
128
+ * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.
129
+ * @example
130
+ * ```ts
131
+ * import { type MigrateUpArgs, sql } from '@payloadcms/db-sqlite'
132
+ *
133
+ * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
134
+ * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)
135
+ * }
136
+ * ```
137
+ */
138
+ db: LibSQLDatabase;
139
+ /**
140
+ * The Payload instance that you can use to execute Local API methods
141
+ * To use the current transaction you must pass `req` to arguments
142
+ * @example
143
+ * ```ts
144
+ * import { type MigrateUpArgs } from '@payloadcms/db-sqlite'
145
+ *
146
+ * export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
147
+ * const posts = await payload.find({ collection: 'posts', req })
148
+ * }
149
+ * ```
150
+ */
127
151
  payload: Payload;
152
+ /**
153
+ * The `PayloadRequest` object that contains the current transaction
154
+ */
128
155
  req: PayloadRequest;
129
156
  };
130
157
  export type MigrateDownArgs = {
158
+ /**
159
+ * The SQLite Drizzle instance that you can use to execute SQL directly within the current transaction.
160
+ * @example
161
+ * ```ts
162
+ * import { type MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
163
+ *
164
+ * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
165
+ * const { rows: posts } = await db.run(sql`SELECT * FROM posts`)
166
+ * }
167
+ * ```
168
+ */
169
+ db: LibSQLDatabase;
170
+ /**
171
+ * The Payload instance that you can use to execute Local API methods
172
+ * To use the current transaction you must pass `req` to arguments
173
+ * @example
174
+ * ```ts
175
+ * import { type MigrateDownArgs } from '@payloadcms/db-sqlite'
176
+ *
177
+ * export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
178
+ * const posts = await payload.find({ collection: 'posts', req })
179
+ * }
180
+ * ```
181
+ */
131
182
  payload: Payload;
183
+ /**
184
+ * The `PayloadRequest` object that contains the current transaction
185
+ */
132
186
  req: PayloadRequest;
133
187
  };
134
188
  declare module 'payload' {
@@ -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,EA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c,GAAG,MAAM,CAAC,EAC/D,cAAc;QAChB,gBAAgB,EAAE,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;QACxF,OAAO,EAAE,cAAc,CAAA;QACvB;;;WAGG;QACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QACxD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QACtB,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;QAC/B,cAAc,CAAC,EAAE;YACf,IAAI,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;YAC9C,IAAI,EAAE,MAAM,CAAA;YACZ,EAAE,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;SAC3C,EAAE,CAAA;QACH,IAAI,EAAE,OAAO,CAAA;QACb,kBAAkB,EAAE,MAAM,IAAI,CAAA;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;QAC5B,mBAAmB,EAAE,MAAM,IAAI,CAAA;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,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 { 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 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 * 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 client: Config\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push?: boolean\n relationshipsSuffix?: string\n schemaName?: string\n transactionOptions?: false | SQLiteTransactionConfig\n versionsSuffix?: string\n}\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 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 | 'insert'\n | 'operators'\n | 'relations'\n>\n\nexport type SQLiteAdapter = {\n afterSchemaInit: SQLiteSchemaHook[]\n beforeSchemaInit: SQLiteSchemaHook[]\n client: Client\n clientConfig: Args['client']\n countDistinct: CountDistinct\n defaultDrizzleSnapshot: any\n deleteWhere: DeleteWhere\n drizzle: { $client: Client } & LibSQLDatabase<\n Record<string, GenericRelation | GenericTable> & Record<string, unknown>\n >\n dropDatabase: DropDatabase\n execute: Execute<unknown>\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 insert: Insert\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n operators: Operators\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 relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable>\n transactionOptions: SQLiteTransactionConfig\n versionsSuffix?: string\n} & SQLiteDrizzleAdapter\n\nexport type IDType = 'integer' | 'numeric' | 'text'\n\nexport type MigrateUpArgs = {\n payload: Payload\n req: PayloadRequest\n}\nexport type MigrateDownArgs = {\n payload: Payload\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 drizzle: LibSQLDatabase\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":"AA+JA,WAGC"}
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 { 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 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 * 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 client: Config\n idType?: 'serial' | 'uuid'\n localesSuffix?: string\n logger?: DrizzleConfig['logger']\n migrationDir?: string\n prodMigrations?: {\n down: (args: MigrateDownArgs) => Promise<void>\n name: string\n up: (args: MigrateUpArgs) => Promise<void>\n }[]\n push?: boolean\n relationshipsSuffix?: string\n schemaName?: string\n transactionOptions?: false | SQLiteTransactionConfig\n versionsSuffix?: string\n}\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 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 | 'insert'\n | 'operators'\n | 'relations'\n>\n\nexport type SQLiteAdapter = {\n afterSchemaInit: SQLiteSchemaHook[]\n beforeSchemaInit: SQLiteSchemaHook[]\n client: Client\n clientConfig: Args['client']\n countDistinct: CountDistinct\n defaultDrizzleSnapshot: any\n deleteWhere: DeleteWhere\n drizzle: { $client: Client } & LibSQLDatabase<\n Record<string, GenericRelation | GenericTable> & Record<string, unknown>\n >\n dropDatabase: DropDatabase\n execute: Execute<unknown>\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 insert: Insert\n localesSuffix?: string\n logger: DrizzleConfig['logger']\n operators: Operators\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 relations: Record<string, GenericRelation>\n relationshipsSuffix?: string\n resolveInitializing: () => void\n schema: Record<string, GenericRelation | GenericTable>\n schemaName?: Args['schemaName']\n tableNameMap: Map<string, string>\n tables: Record<string, GenericTable>\n transactionOptions: SQLiteTransactionConfig\n versionsSuffix?: string\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: LibSQLDatabase\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: LibSQLDatabase\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 drizzle: LibSQLDatabase\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":"AA0LA,WA8BC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-sqlite",
3
- "version": "3.4.1-canary.b6681a9",
3
+ "version": "3.5.1-canary.15a5791",
4
4
  "description": "The officially supported SQLite database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -49,16 +49,16 @@
49
49
  "prompts": "2.4.2",
50
50
  "to-snake-case": "1.0.0",
51
51
  "uuid": "9.0.0",
52
- "@payloadcms/drizzle": "3.4.1-canary.b6681a9"
52
+ "@payloadcms/drizzle": "3.5.1-canary.15a5791"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/pg": "8.10.2",
56
56
  "@types/to-snake-case": "1.0.0",
57
- "payload": "3.4.1-canary.b6681a9",
58
- "@payloadcms/eslint-config": "3.0.0"
57
+ "@payloadcms/eslint-config": "3.0.0",
58
+ "payload": "3.5.1-canary.15a5791"
59
59
  },
60
60
  "peerDependencies": {
61
- "payload": "3.4.1-canary.b6681a9"
61
+ "payload": "3.5.1-canary.15a5791"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "pnpm build:swc && pnpm build:types",
@@ -1,3 +0,0 @@
1
- import type { CreateMigration } from 'payload';
2
- export declare const createMigration: CreateMigration;
3
- //# sourceMappingURL=createMigration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createMigration.d.ts","sourceRoot":"","sources":["../src/createMigration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAgB9C,eAAO,MAAM,eAAe,EAAE,eAyG7B,CAAA"}
@@ -1,87 +0,0 @@
1
- import fs from 'fs';
2
- import { createRequire } from 'module';
3
- import path from 'path';
4
- import { getPredefinedMigration, writeMigrationIndex } from 'payload';
5
- import prompts from 'prompts';
6
- import { fileURLToPath } from 'url';
7
- import { defaultDrizzleSnapshot } from './defaultSnapshot.js';
8
- import { getMigrationTemplate } from './getMigrationTemplate.js';
9
- const require = createRequire(import.meta.url);
10
- export const createMigration = async function createMigration({ file, migrationName, payload, skipEmpty }) {
11
- const filename = fileURLToPath(import.meta.url);
12
- const dirname = path.dirname(filename);
13
- const dir = payload.db.migrationDir;
14
- if (!fs.existsSync(dir)) {
15
- fs.mkdirSync(dir);
16
- }
17
- const { generateSQLiteDrizzleJson, generateSQLiteMigration } = require('drizzle-kit/api');
18
- const drizzleJsonAfter = await generateSQLiteDrizzleJson(this.schema);
19
- const [yyymmdd, hhmmss] = new Date().toISOString().split('T');
20
- const formattedDate = yyymmdd.replace(/\D/g, '');
21
- const formattedTime = hhmmss.split('.')[0].replace(/\D/g, '');
22
- let imports = '';
23
- let downSQL;
24
- let upSQL;
25
- ({ downSQL, imports, upSQL } = await getPredefinedMigration({
26
- dirname,
27
- file,
28
- migrationName,
29
- payload
30
- }));
31
- const timestamp = `${formattedDate}_${formattedTime}`;
32
- const name = migrationName || file?.split('/').slice(2).join('/');
33
- const fileName = `${timestamp}${name ? `_${name.replace(/\W/g, '_')}` : ''}`;
34
- const filePath = `${dir}/${fileName}`;
35
- let drizzleJsonBefore = defaultDrizzleSnapshot;
36
- if (!upSQL) {
37
- // Get latest migration snapshot
38
- const latestSnapshot = fs.readdirSync(dir).filter((file)=>file.endsWith('.json')).sort().reverse()?.[0];
39
- if (latestSnapshot) {
40
- drizzleJsonBefore = JSON.parse(fs.readFileSync(`${dir}/${latestSnapshot}`, 'utf8'));
41
- }
42
- const sqlStatementsUp = await generateSQLiteMigration(drizzleJsonBefore, drizzleJsonAfter);
43
- const sqlStatementsDown = await generateSQLiteMigration(drizzleJsonAfter, drizzleJsonBefore);
44
- // need to create tables as separate statements
45
- const sqlExecute = 'await payload.db.drizzle.run(sql`';
46
- if (sqlStatementsUp?.length) {
47
- upSQL = sqlStatementsUp.map((statement)=>`${sqlExecute}${statement?.replaceAll('`', '\\`')}\`)`).join('\n');
48
- }
49
- if (sqlStatementsDown?.length) {
50
- downSQL = sqlStatementsDown.map((statement)=>`${sqlExecute}${statement?.replaceAll('`', '\\`')}\`)`).join('\n');
51
- }
52
- if (!upSQL?.length && !downSQL?.length) {
53
- if (skipEmpty) {
54
- process.exit(0);
55
- }
56
- const { confirm: shouldCreateBlankMigration } = await prompts({
57
- name: 'confirm',
58
- type: 'confirm',
59
- initial: false,
60
- message: 'No schema changes detected. Would you like to create a blank migration file?'
61
- }, {
62
- onCancel: ()=>{
63
- process.exit(0);
64
- }
65
- });
66
- if (!shouldCreateBlankMigration) {
67
- process.exit(0);
68
- }
69
- }
70
- // write schema
71
- fs.writeFileSync(`${filePath}.json`, JSON.stringify(drizzleJsonAfter, null, 2));
72
- }
73
- // write migration
74
- fs.writeFileSync(`${filePath}.ts`, getMigrationTemplate({
75
- downSQL: downSQL || ` // Migration code`,
76
- imports,
77
- upSQL: upSQL || ` // Migration code`
78
- }));
79
- writeMigrationIndex({
80
- migrationsDir: payload.db.migrationDir
81
- });
82
- payload.logger.info({
83
- msg: `Migration created at ${filePath}.ts`
84
- });
85
- };
86
-
87
- //# sourceMappingURL=createMigration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/createMigration.ts"],"sourcesContent":["import type { DrizzleSnapshotJSON } from 'drizzle-kit/api'\nimport type { CreateMigration } from 'payload'\n\nimport fs from 'fs'\nimport { createRequire } from 'module'\nimport path from 'path'\nimport { getPredefinedMigration, writeMigrationIndex } from 'payload'\nimport prompts from 'prompts'\nimport { fileURLToPath } from 'url'\n\nimport type { SQLiteAdapter } from './types.js'\n\nimport { defaultDrizzleSnapshot } from './defaultSnapshot.js'\nimport { getMigrationTemplate } from './getMigrationTemplate.js'\n\nconst require = createRequire(import.meta.url)\n\nexport const createMigration: CreateMigration = async function createMigration(\n this: SQLiteAdapter,\n { file, migrationName, payload, skipEmpty },\n) {\n const filename = fileURLToPath(import.meta.url)\n const dirname = path.dirname(filename)\n const dir = payload.db.migrationDir\n if (!fs.existsSync(dir)) {\n fs.mkdirSync(dir)\n }\n const { generateSQLiteDrizzleJson, generateSQLiteMigration } = require('drizzle-kit/api')\n const drizzleJsonAfter = await generateSQLiteDrizzleJson(this.schema)\n const [yyymmdd, hhmmss] = new Date().toISOString().split('T')\n const formattedDate = yyymmdd.replace(/\\D/g, '')\n const formattedTime = hhmmss.split('.')[0].replace(/\\D/g, '')\n let imports: string = ''\n let downSQL: string\n let upSQL: string\n ;({ downSQL, imports, upSQL } = await getPredefinedMigration({\n dirname,\n file,\n migrationName,\n payload,\n }))\n\n const timestamp = `${formattedDate}_${formattedTime}`\n\n const name = migrationName || file?.split('/').slice(2).join('/')\n const fileName = `${timestamp}${name ? `_${name.replace(/\\W/g, '_')}` : ''}`\n\n const filePath = `${dir}/${fileName}`\n\n let drizzleJsonBefore = defaultDrizzleSnapshot as any\n\n if (!upSQL) {\n // Get latest migration snapshot\n const latestSnapshot = fs\n .readdirSync(dir)\n .filter((file) => file.endsWith('.json'))\n .sort()\n .reverse()?.[0]\n\n if (latestSnapshot) {\n drizzleJsonBefore = JSON.parse(\n fs.readFileSync(`${dir}/${latestSnapshot}`, 'utf8'),\n ) as DrizzleSnapshotJSON\n }\n\n const sqlStatementsUp = await generateSQLiteMigration(drizzleJsonBefore, drizzleJsonAfter)\n const sqlStatementsDown = await generateSQLiteMigration(drizzleJsonAfter, drizzleJsonBefore)\n // need to create tables as separate statements\n const sqlExecute = 'await payload.db.drizzle.run(sql`'\n\n if (sqlStatementsUp?.length) {\n upSQL = sqlStatementsUp\n .map((statement) => `${sqlExecute}${statement?.replaceAll('`', '\\\\`')}\\`)`)\n .join('\\n')\n }\n if (sqlStatementsDown?.length) {\n downSQL = sqlStatementsDown\n .map((statement) => `${sqlExecute}${statement?.replaceAll('`', '\\\\`')}\\`)`)\n .join('\\n')\n }\n\n if (!upSQL?.length && !downSQL?.length) {\n if (skipEmpty) {\n process.exit(0)\n }\n\n const { confirm: shouldCreateBlankMigration } = await prompts(\n {\n name: 'confirm',\n type: 'confirm',\n initial: false,\n message: 'No schema changes detected. Would you like to create a blank migration file?',\n },\n {\n onCancel: () => {\n process.exit(0)\n },\n },\n )\n\n if (!shouldCreateBlankMigration) {\n process.exit(0)\n }\n }\n\n // write schema\n fs.writeFileSync(`${filePath}.json`, JSON.stringify(drizzleJsonAfter, null, 2))\n }\n\n // write migration\n fs.writeFileSync(\n `${filePath}.ts`,\n getMigrationTemplate({\n downSQL: downSQL || ` // Migration code`,\n imports,\n upSQL: upSQL || ` // Migration code`,\n }),\n )\n\n writeMigrationIndex({ migrationsDir: payload.db.migrationDir })\n\n payload.logger.info({ msg: `Migration created at ${filePath}.ts` })\n}\n"],"names":["fs","createRequire","path","getPredefinedMigration","writeMigrationIndex","prompts","fileURLToPath","defaultDrizzleSnapshot","getMigrationTemplate","require","url","createMigration","file","migrationName","payload","skipEmpty","filename","dirname","dir","db","migrationDir","existsSync","mkdirSync","generateSQLiteDrizzleJson","generateSQLiteMigration","drizzleJsonAfter","schema","yyymmdd","hhmmss","Date","toISOString","split","formattedDate","replace","formattedTime","imports","downSQL","upSQL","timestamp","name","slice","join","fileName","filePath","drizzleJsonBefore","latestSnapshot","readdirSync","filter","endsWith","sort","reverse","JSON","parse","readFileSync","sqlStatementsUp","sqlStatementsDown","sqlExecute","length","map","statement","replaceAll","process","exit","confirm","shouldCreateBlankMigration","type","initial","message","onCancel","writeFileSync","stringify","migrationsDir","logger","info","msg"],"mappings":"AAGA,OAAOA,QAAQ,KAAI;AACnB,SAASC,aAAa,QAAQ,SAAQ;AACtC,O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;YACf;QACF;QAEA,eAAe;QACf9D,GAAGqE,aAAa,CAAC,GAAG1B,SAAS,KAAK,CAAC,EAAEQ,KAAKmB,SAAS,CAAC7C,kBAAkB,MAAM;IAC9E;IAEA,kBAAkB;IAClBzB,GAAGqE,aAAa,CACd,GAAG1B,SAAS,GAAG,CAAC,EAChBnC,qBAAqB;QACnB4B,SAASA,WAAW,CAAC,mBAAmB,CAAC;QACzCD;QACAE,OAAOA,SAAS,CAAC,mBAAmB,CAAC;IACvC;IAGFjC,oBAAoB;QAAEmE,eAAezD,QAAQK,EAAE,CAACC,YAAY;IAAC;IAE7DN,QAAQ0D,MAAM,CAACC,IAAI,CAAC;QAAEC,KAAK,CAAC,qBAAqB,EAAE/B,SAAS,GAAG,CAAC;IAAC;AACnE,EAAC"}
@@ -1,4 +0,0 @@
1
- import type { MigrationTemplateArgs } from 'payload';
2
- export declare const indent: (text: string) => string;
3
- export declare const getMigrationTemplate: ({ downSQL, imports, upSQL, }: MigrationTemplateArgs) => string;
4
- //# sourceMappingURL=getMigrationTemplate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMigrationTemplate.d.ts","sourceRoot":"","sources":["../src/getMigrationTemplate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,eAAO,MAAM,MAAM,SAAU,MAAM,WAIpB,CAAA;AAEf,eAAO,MAAM,oBAAoB,iCAI9B,qBAAqB,KAAG,MAS1B,CAAA"}
@@ -1,13 +0,0 @@
1
- export const indent = (text)=>text.split('\n').map((line)=>` ${line}`).join('\n');
2
- export const getMigrationTemplate = ({ downSQL, imports, upSQL })=>`import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
3
- ${imports ? `${imports}\n` : ''}
4
- export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
5
- ${indent(upSQL)}
6
- }
7
-
8
- export async function down({ payload, req }: MigrateDownArgs): Promise<void> {
9
- ${indent(downSQL)}
10
- }
11
- `;
12
-
13
- //# sourceMappingURL=getMigrationTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/getMigrationTemplate.ts"],"sourcesContent":["import type { MigrationTemplateArgs } from 'payload'\n\nexport const indent = (text: string) =>\n text\n .split('\\n')\n .map((line) => ` ${line}`)\n .join('\\n')\n\nexport const getMigrationTemplate = ({\n downSQL,\n imports,\n upSQL,\n}: MigrationTemplateArgs): string => `import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-sqlite'\n${imports ? `${imports}\\n` : ''}\nexport async function up({ payload, req }: MigrateUpArgs): Promise<void> {\n${indent(upSQL)}\n}\n\nexport async function down({ payload, req }: MigrateDownArgs): Promise<void> {\n${indent(downSQL)}\n}\n`\n"],"names":["indent","text","split","map","line","join","getMigrationTemplate","downSQL","imports","upSQL"],"mappings":"AAEA,OAAO,MAAMA,SAAS,CAACC,OACrBA,KACGC,KAAK,CAAC,MACNC,GAAG,CAAC,CAACC,OAAS,CAAC,EAAE,EAAEA,MAAM,EACzBC,IAAI,CAAC,MAAK;AAEf,OAAO,MAAMC,uBAAuB,CAAC,EACnCC,OAAO,EACPC,OAAO,EACPC,KAAK,EACiB,GAAa,CAAC;AACtC,EAAED,UAAU,GAAGA,QAAQ,EAAE,CAAC,GAAG,GAAG;;AAEhC,EAAER,OAAOS,OAAO;;;;AAIhB,EAAET,OAAOO,SAAS;;AAElB,CAAC,CAAA"}