@payloadcms/db-sqlite 3.40.0-internal.9e8d70e → 3.40.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,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,SAAS,CAAA;AAQjD,eAAO,MAAM,OAAO,EAAE,OAqDrB,CAAA"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,SAAS,CAAA;AAQjD,eAAO,MAAM,OAAO,EAAE,OAgDrB,CAAA"}
package/dist/connect.js CHANGED
@@ -5,10 +5,6 @@ export const connect = async function connect(options = {
5
5
  hotReload: false
6
6
  }) {
7
7
  const { hotReload } = options;
8
- this.schema = {
9
- ...this.tables,
10
- ...this.relations
11
- };
12
8
  try {
13
9
  if (!this.client) {
14
10
  this.client = createClient(this.clientConfig);
@@ -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 this.schema = {\n ...this.tables,\n ...this.relations,\n }\n\n try {\n if (!this.client) {\n this.client = createClient(this.clientConfig)\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 process.exit(1)\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","schema","tables","relations","client","clientConfig","logger","process","env","PAYLOAD_DROP_DATABASE","payload","info","dropDatabase","adapter","err","message","Error","String","error","msg","rejectInitializing","exit","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,CAACE,MAAM,GAAG;QACZ,GAAG,IAAI,CAACC,MAAM;QACd,GAAG,IAAI,CAACC,SAAS;IACnB;IAEA,IAAI;QACF,IAAI,CAAC,IAAI,CAACC,MAAM,EAAE;YAChB,IAAI,CAACA,MAAM,GAAGT,aAAa,IAAI,CAACU,YAAY;QAC9C;QAEA,MAAMC,SAAS,IAAI,CAACA,MAAM,IAAI;QAC9B,IAAI,CAACT,OAAO,GAAGA,QAAQ,IAAI,CAACO,MAAM,EAAE;YAAEE;YAAQL,QAAQ,IAAI,CAACA,MAAM;QAAC;QAElE,IAAI,CAACD,WAAW;YACd,IAAIO,QAAQC,GAAG,CAACC,qBAAqB,KAAK,QAAQ;gBAChD,IAAI,CAACC,OAAO,CAACJ,MAAM,CAACK,IAAI,CAAC,CAAC,yBAAyB,CAAC;gBACpD,MAAM,IAAI,CAACC,YAAY,CAAC;oBAAEC,SAAS,IAAI;gBAAC;gBACxC,IAAI,CAACH,OAAO,CAACJ,MAAM,CAACK,IAAI,CAAC;YAC3B;QACF;IACF,EAAE,OAAOG,KAAK;QACZ,MAAMC,UAAUD,eAAeE,QAAQF,IAAIC,OAAO,GAAGE,OAAOH;QAC5D,IAAI,CAACJ,OAAO,CAACJ,MAAM,CAACY,KAAK,CAAC;YAAEJ;YAAKK,KAAK,CAAC,iCAAiC,EAAEJ,SAAS;QAAC;QACpF,IAAI,OAAO,IAAI,CAACK,kBAAkB,KAAK,YAAY;YACjD,IAAI,CAACA,kBAAkB;QACzB;QACAb,QAAQc,IAAI,CAAC;IACf;IAEA,wCAAwC;IACxC,IACEd,QAAQC,GAAG,CAACc,QAAQ,KAAK,gBACzBf,QAAQC,GAAG,CAACe,iBAAiB,KAAK,UAClC,IAAI,CAACC,IAAI,KAAK,OACd;QACA,MAAM5B,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAAC6B,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAIlB,QAAQC,GAAG,CAACc,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/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\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 process.exit(1)\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","logger","schema","process","env","PAYLOAD_DROP_DATABASE","payload","info","dropDatabase","adapter","err","message","Error","String","error","msg","rejectInitializing","exit","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,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file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AASnC,eAAO,MAAM,IAAI,EAAE,IA4BlB,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AASnC,eAAO,MAAM,IAAI,EAAE,IAiClB,CAAA"}
package/dist/init.js CHANGED
@@ -31,6 +31,10 @@ export const init = async function init() {
31
31
  type: 'afterSchemaInit',
32
32
  adapter: this
33
33
  });
34
+ this.schema = {
35
+ ...this.tables,
36
+ ...this.relations
37
+ };
34
38
  };
35
39
 
36
40
  //# sourceMappingURL=init.js.map
package/dist/init.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/init.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { Init } from 'payload'\n\nimport { buildDrizzleRelations, buildRawSchema, executeSchemaHooks } from '@payloadcms/drizzle'\n\nimport type { SQLiteAdapter } from './types.js'\n\nimport { buildDrizzleTable } from './schema/buildDrizzleTable.js'\nimport { setColumnID } from './schema/setColumnID.js'\n\nexport const init: Init = async function init(this: SQLiteAdapter) {\n let locales: string[] | undefined\n\n this.rawRelations = {}\n this.rawTables = {}\n\n if (this.payload.config.localization) {\n locales = this.payload.config.localization.locales.map(({ code }) => code)\n }\n\n const adapter = this as unknown as DrizzleAdapter\n\n buildRawSchema({\n adapter,\n setColumnID,\n })\n\n await executeSchemaHooks({ type: 'beforeSchemaInit', adapter: this })\n\n for (const tableName in this.rawTables) {\n buildDrizzleTable({ adapter, locales: locales!, rawTable: this.rawTables[tableName]! })\n }\n\n buildDrizzleRelations({\n adapter,\n })\n\n await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })\n}\n"],"names":["buildDrizzleRelations","buildRawSchema","executeSchemaHooks","buildDrizzleTable","setColumnID","init","locales","rawRelations","rawTables","payload","config","localization","map","code","adapter","type","tableName","rawTable"],"mappings":"AAGA,SAASA,qBAAqB,EAAEC,cAAc,EAAEC,kBAAkB,QAAQ,sBAAqB;AAI/F,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,WAAW,QAAQ,0BAAyB;AAErD,OAAO,MAAMC,OAAa,eAAeA;IACvC,IAAIC;IAEJ,IAAI,CAACC,YAAY,GAAG,CAAC;IACrB,IAAI,CAACC,SAAS,GAAG,CAAC;IAElB,IAAI,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpCL,UAAU,IAAI,CAACG,OAAO,CAACC,MAAM,CAACC,YAAY,CAACL,OAAO,CAACM,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IACvE;IAEA,MAAMC,UAAU,IAAI;IAEpBb,eAAe;QACba;QACAV;IACF;IAEA,MAAMF,mBAAmB;QAAEa,MAAM;QAAoBD,SAAS,IAAI;IAAC;IAEnE,IAAK,MAAME,aAAa,IAAI,CAACR,SAAS,CAAE;QACtCL,kBAAkB;YAAEW;YAASR,SAASA;YAAUW,UAAU,IAAI,CAACT,SAAS,CAACQ,UAAU;QAAE;IACvF;IAEAhB,sBAAsB;QACpBc;IACF;IAEA,MAAMZ,mBAAmB;QAAEa,MAAM;QAAmBD,SAAS,IAAI;IAAC;AACpE,EAAC"}
1
+ {"version":3,"sources":["../src/init.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { Init } from 'payload'\n\nimport { buildDrizzleRelations, buildRawSchema, executeSchemaHooks } from '@payloadcms/drizzle'\n\nimport type { SQLiteAdapter } from './types.js'\n\nimport { buildDrizzleTable } from './schema/buildDrizzleTable.js'\nimport { setColumnID } from './schema/setColumnID.js'\n\nexport const init: Init = async function init(this: SQLiteAdapter) {\n let locales: string[] | undefined\n\n this.rawRelations = {}\n this.rawTables = {}\n\n if (this.payload.config.localization) {\n locales = this.payload.config.localization.locales.map(({ code }) => code)\n }\n\n const adapter = this as unknown as DrizzleAdapter\n\n buildRawSchema({\n adapter,\n setColumnID,\n })\n\n await executeSchemaHooks({ type: 'beforeSchemaInit', adapter: this })\n\n for (const tableName in this.rawTables) {\n buildDrizzleTable({ adapter, locales: locales!, rawTable: this.rawTables[tableName]! })\n }\n\n buildDrizzleRelations({\n adapter,\n })\n\n await executeSchemaHooks({ type: 'afterSchemaInit', adapter: this })\n\n this.schema = {\n ...this.tables,\n ...this.relations,\n }\n}\n"],"names":["buildDrizzleRelations","buildRawSchema","executeSchemaHooks","buildDrizzleTable","setColumnID","init","locales","rawRelations","rawTables","payload","config","localization","map","code","adapter","type","tableName","rawTable","schema","tables","relations"],"mappings":"AAGA,SAASA,qBAAqB,EAAEC,cAAc,EAAEC,kBAAkB,QAAQ,sBAAqB;AAI/F,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,WAAW,QAAQ,0BAAyB;AAErD,OAAO,MAAMC,OAAa,eAAeA;IACvC,IAAIC;IAEJ,IAAI,CAACC,YAAY,GAAG,CAAC;IACrB,IAAI,CAACC,SAAS,GAAG,CAAC;IAElB,IAAI,IAAI,CAACC,OAAO,CAACC,MAAM,CAACC,YAAY,EAAE;QACpCL,UAAU,IAAI,CAACG,OAAO,CAACC,MAAM,CAACC,YAAY,CAACL,OAAO,CAACM,GAAG,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA;IACvE;IAEA,MAAMC,UAAU,IAAI;IAEpBb,eAAe;QACba;QACAV;IACF;IAEA,MAAMF,mBAAmB;QAAEa,MAAM;QAAoBD,SAAS,IAAI;IAAC;IAEnE,IAAK,MAAME,aAAa,IAAI,CAACR,SAAS,CAAE;QACtCL,kBAAkB;YAAEW;YAASR,SAASA;YAAUW,UAAU,IAAI,CAACT,SAAS,CAACQ,UAAU;QAAE;IACvF;IAEAhB,sBAAsB;QACpBc;IACF;IAEA,MAAMZ,mBAAmB;QAAEa,MAAM;QAAmBD,SAAS,IAAI;IAAC;IAElE,IAAI,CAACI,MAAM,GAAG;QACZ,GAAG,IAAI,CAACC,MAAM;QACd,GAAG,IAAI,CAACC,SAAS;IACnB;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-sqlite",
3
- "version": "3.40.0-internal.9e8d70e",
3
+ "version": "3.40.0",
4
4
  "description": "The officially supported SQLite database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -69,17 +69,17 @@
69
69
  "prompts": "2.4.2",
70
70
  "to-snake-case": "1.0.0",
71
71
  "uuid": "9.0.0",
72
- "@payloadcms/drizzle": "3.40.0-internal.9e8d70e"
72
+ "@payloadcms/drizzle": "3.40.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/pg": "8.10.2",
76
76
  "@types/to-snake-case": "1.0.0",
77
77
  "@types/uuid": "10.0.0",
78
78
  "@payloadcms/eslint-config": "3.28.0",
79
- "payload": "3.40.0-internal.9e8d70e"
79
+ "payload": "3.40.0"
80
80
  },
81
81
  "peerDependencies": {
82
- "payload": "3.40.0-internal.9e8d70e"
82
+ "payload": "3.40.0"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "pnpm build:swc && pnpm build:types",