@payloadcms/db-sqlite 3.0.0-beta.100 → 3.0.0-beta.101
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 +4 -1
- package/dist/connect.js.map +1 -1
- package/package.json +4 -4
package/dist/connect.js
CHANGED
|
@@ -28,7 +28,10 @@ export const connect = async function connect(options = {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
} catch (err) {
|
|
31
|
-
this.payload.logger.error(
|
|
31
|
+
this.payload.logger.error({
|
|
32
|
+
err,
|
|
33
|
+
msg: `Error: cannot connect to SQLite: ${err.message}`
|
|
34
|
+
});
|
|
32
35
|
if (typeof this.rejectInitializing === 'function') {
|
|
33
36
|
this.rejectInitializing();
|
|
34
37
|
}
|
package/dist/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { LibSQLDatabase } from 'drizzle-orm/libsql'\nimport type { Connect } 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 }) as LibSQLDatabase\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 this.payload.logger.error(`Error: cannot connect to SQLite
|
|
1
|
+
{"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { LibSQLDatabase } from 'drizzle-orm/libsql'\nimport type { Connect } 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 }) as LibSQLDatabase\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 this.payload.logger.error({ err, msg: `Error: cannot connect to SQLite: ${err.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 })\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","error","msg","message","rejectInitializing","exit","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":"AAIA,SAASA,YAAY,QAAQ,iBAAgB;AAC7C,SAASC,a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cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAAC2B,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAIhB,QAAQC,GAAG,CAACY,QAAQ,KAAK,gBAAgB,IAAI,CAACI,cAAc,EAAE;QAChE,MAAM,IAAI,CAACC,OAAO,CAAC;YAAEC,YAAY,IAAI,CAACF,cAAc;QAAC;IACvD;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/db-sqlite",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.101",
|
|
4
4
|
"description": "The officially supported SQLite database adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
"prompts": "2.4.2",
|
|
43
43
|
"to-snake-case": "1.0.0",
|
|
44
44
|
"uuid": "9.0.0",
|
|
45
|
-
"@payloadcms/drizzle": "3.0.0-beta.
|
|
45
|
+
"@payloadcms/drizzle": "3.0.0-beta.101"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/pg": "8.10.2",
|
|
49
49
|
"@types/to-snake-case": "1.0.0",
|
|
50
50
|
"@payloadcms/eslint-config": "3.0.0-beta.97",
|
|
51
|
-
"payload": "3.0.0-beta.
|
|
51
|
+
"payload": "3.0.0-beta.101"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"payload": "3.0.0-beta.
|
|
54
|
+
"payload": "3.0.0-beta.101"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "pnpm build:swc && pnpm build:types",
|