@payloadcms/db-d1-sqlite 3.65.0-canary.1 → 3.65.0-canary.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/connect.js CHANGED
@@ -40,7 +40,7 @@ export const connect = async function connect(options = {
40
40
  this.rejectInitializing();
41
41
  }
42
42
  console.error(err);
43
- process.exit(1);
43
+ throw new Error(`Error: cannot connect to SQLite: ${message}`);
44
44
  }
45
45
  // Only push schema if not in production
46
46
  if (process.env.NODE_ENV !== 'production' && process.env.PAYLOAD_MIGRATING !== 'true' && this.push !== false) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle'\nimport type { Connect, Migration } from 'payload'\n\nimport { pushDevSchema } from '@payloadcms/drizzle'\nimport { drizzle } from 'drizzle-orm/d1'\n\nimport type { SQLiteD1Adapter } from './types.js'\n\nexport const connect: Connect = async function connect(\n this: SQLiteD1Adapter,\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 const logger = this.logger || false\n const readReplicas = this.readReplicas\n\n let binding = this.binding\n\n if (readReplicas && readReplicas === 'first-primary') {\n // @ts-expect-error - need to have types that support withSession binding from D1\n binding = this.binding.withSession('first-primary')\n }\n\n this.drizzle = drizzle(binding, {\n logger,\n schema: this.schema,\n })\n\n this.client = this.drizzle.$client as any\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 console.error(err)\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":["pushDevSchema","drizzle","connect","options","hotReload","schema","tables","relations","logger","readReplicas","binding","withSession","client","$client","process","env","PAYLOAD_DROP_DATABASE","payload","info","dropDatabase","adapter","err","message","Error","String","error","msg","rejectInitializing","console","exit","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":"AAGA,SAASA,aAAa,QAAQ,sBAAqB;AACnD,SAASC,OAAO,QAAQ,iBAAgB;AAIxC,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,MAAMC,SAAS,IAAI,CAACA,MAAM,IAAI;QAC9B,MAAMC,eAAe,IAAI,CAACA,YAAY;QAEtC,IAAIC,UAAU,IAAI,CAACA,OAAO;QAE1B,IAAID,gBAAgBA,iBAAiB,iBAAiB;YACpD,iFAAiF;YACjFC,UAAU,IAAI,CAACA,OAAO,CAACC,WAAW,CAAC;QACrC;QAEA,IAAI,CAACV,OAAO,GAAGA,QAAQS,SAAS;YAC9BF;YACAH,QAAQ,IAAI,CAACA,MAAM;QACrB;QAEA,IAAI,CAACO,MAAM,GAAG,IAAI,CAACX,OAAO,CAACY,OAAO;QAElC,IAAI,CAACT,WAAW;YACd,IAAIU,QAAQC,GAAG,CAACC,qBAAqB,KAAK,QAAQ;gBAChD,IAAI,CAACC,OAAO,CAACT,MAAM,CAACU,IAAI,CAAC,CAAC,yBAAyB,CAAC;gBACpD,MAAM,IAAI,CAACC,YAAY,CAAC;oBAAEC,SAAS,IAAI;gBAAC;gBACxC,IAAI,CAACH,OAAO,CAACT,MAAM,CAACU,IAAI,CAAC;YAC3B;QACF;IACF,EAAE,OAAOG,KAAK;QACZ,MAAMC,UAAUD,eAAeE,QAAQF,IAAIC,OAAO,GAAGE,OAAOH;QAC5D,IAAI,CAACJ,OAAO,CAACT,MAAM,CAACiB,KAAK,CAAC;YAAEJ;YAAKK,KAAK,CAAC,iCAAiC,EAAEJ,SAAS;QAAC;QACpF,IAAI,OAAO,IAAI,CAACK,kBAAkB,KAAK,YAAY;YACjD,IAAI,CAACA,kBAAkB;QACzB;QACAC,QAAQH,KAAK,CAACJ;QACdP,QAAQe,IAAI,CAAC;IACf;IAEA,wCAAwC;IACxC,IACEf,QAAQC,GAAG,CAACe,QAAQ,KAAK,gBACzBhB,QAAQC,GAAG,CAACgB,iBAAiB,KAAK,UAClC,IAAI,CAACC,IAAI,KAAK,OACd;QACA,MAAMhC,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAACiC,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAInB,QAAQC,GAAG,CAACe,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 { pushDevSchema } from '@payloadcms/drizzle'\nimport { drizzle } from 'drizzle-orm/d1'\n\nimport type { SQLiteD1Adapter } from './types.js'\n\nexport const connect: Connect = async function connect(\n this: SQLiteD1Adapter,\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 const logger = this.logger || false\n const readReplicas = this.readReplicas\n\n let binding = this.binding\n\n if (readReplicas && readReplicas === 'first-primary') {\n // @ts-expect-error - need to have types that support withSession binding from D1\n binding = this.binding.withSession('first-primary')\n }\n\n this.drizzle = drizzle(binding, {\n logger,\n schema: this.schema,\n })\n\n this.client = this.drizzle.$client as any\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 console.error(err)\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":["pushDevSchema","drizzle","connect","options","hotReload","schema","tables","relations","logger","readReplicas","binding","withSession","client","$client","process","env","PAYLOAD_DROP_DATABASE","payload","info","dropDatabase","adapter","err","message","Error","String","error","msg","rejectInitializing","console","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":"AAGA,SAASA,aAAa,QAAQ,sBAAqB;AACnD,SAASC,OAAO,QAAQ,iBAAgB;AAIxC,OAAO,MAAMC,UAAmB,eAAeA,QAE7CC,UAAU;IACRC,WAAW;AACb,CAAC;IAED,MAAM,EAAEA,SAAS,EAAE,GAAGD;IAEtB,IAAI,C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IAAI,CAACC,IAAI,KAAK,OACd;QACA,MAAM/B,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAACgC,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/db-d1-sqlite",
3
- "version": "3.65.0-canary.1",
3
+ "version": "3.65.0-canary.11",
4
4
  "description": "The officially supported D1 SQLite database adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -63,22 +63,22 @@
63
63
  ],
64
64
  "dependencies": {
65
65
  "console-table-printer": "2.12.1",
66
- "drizzle-kit": "0.31.5",
67
- "drizzle-orm": "0.44.6",
66
+ "drizzle-kit": "0.31.7",
67
+ "drizzle-orm": "0.44.7",
68
68
  "prompts": "2.4.2",
69
69
  "to-snake-case": "1.0.0",
70
70
  "uuid": "9.0.0",
71
- "@payloadcms/drizzle": "3.65.0-canary.1"
71
+ "@payloadcms/drizzle": "3.65.0-canary.11"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/pg": "8.10.2",
75
75
  "@types/to-snake-case": "1.0.0",
76
76
  "@types/uuid": "10.0.0",
77
- "@payloadcms/eslint-config": "3.28.0",
78
- "payload": "3.65.0-canary.1"
77
+ "payload": "3.65.0-canary.11",
78
+ "@payloadcms/eslint-config": "3.28.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "payload": "3.65.0-canary.1"
81
+ "payload": "3.65.0-canary.11"
82
82
  },
83
83
  "scripts": {
84
84
  "build": "pnpm build:swc && pnpm build:types",