@payloadcms/db-vercel-postgres 3.40.0-internal.e3ed6ab → 3.41.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.
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +0 -6
- package/dist/connect.js.map +1 -1
- package/package.json +4 -4
package/dist/connect.d.ts.map
CHANGED
|
@@ -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;AASjD,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,SAAS,CAAA;AASjD,eAAO,MAAM,OAAO,EAAE,OAyFrB,CAAA"}
|
package/dist/connect.js
CHANGED
|
@@ -6,12 +6,6 @@ export const connect = async function connect(options = {
|
|
|
6
6
|
hotReload: false
|
|
7
7
|
}) {
|
|
8
8
|
const { hotReload } = options;
|
|
9
|
-
this.schema = {
|
|
10
|
-
pgSchema: this.pgSchema,
|
|
11
|
-
...this.tables,
|
|
12
|
-
...this.relations,
|
|
13
|
-
...this.enums
|
|
14
|
-
};
|
|
15
9
|
try {
|
|
16
10
|
const logger = this.logger || false;
|
|
17
11
|
let client;
|
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 { Connect, Migration } from 'payload'\n\nimport { pushDevSchema } from '@payloadcms/drizzle'\nimport { sql, VercelPool } from '@vercel/postgres'\nimport { drizzle } from 'drizzle-orm/node-postgres'\nimport pg from 'pg'\n\nimport type { VercelPostgresAdapter } from './types.js'\n\nexport const connect: Connect = async function connect(\n this: VercelPostgresAdapter,\n options = {\n hotReload: false,\n },\n) {\n const { hotReload } = options\n\n
|
|
1
|
+
{"version":3,"sources":["../src/connect.ts"],"sourcesContent":["import type { DrizzleAdapter } from '@payloadcms/drizzle/types'\nimport type { Connect, Migration } from 'payload'\n\nimport { pushDevSchema } from '@payloadcms/drizzle'\nimport { sql, VercelPool } from '@vercel/postgres'\nimport { drizzle } from 'drizzle-orm/node-postgres'\nimport pg from 'pg'\n\nimport type { VercelPostgresAdapter } from './types.js'\n\nexport const connect: Connect = async function connect(\n this: VercelPostgresAdapter,\n options = {\n hotReload: false,\n },\n) {\n const { hotReload } = options\n\n try {\n const logger = this.logger || false\n\n let client: pg.Pool | VercelPool\n\n const connectionString = this.poolOptions?.connectionString ?? process.env.POSTGRES_URL\n\n // Use non-vercel postgres for local database\n if (\n !this.forceUseVercelPostgres &&\n connectionString &&\n ['127.0.0.1', 'localhost'].includes(new URL(connectionString).hostname)\n ) {\n client = new pg.Pool(\n this.poolOptions ?? {\n connectionString,\n },\n )\n } else {\n client = this.poolOptions ? new VercelPool(this.poolOptions) : sql\n }\n\n // Passed the poolOptions if provided,\n // else have vercel/postgres detect the connection string from the environment\n this.drizzle = drizzle({\n client,\n logger,\n schema: this.schema,\n })\n\n if (!hotReload) {\n if (process.env.PAYLOAD_DROP_DATABASE === 'true') {\n this.payload.logger.info(`---- DROPPING TABLES SCHEMA(${this.schemaName || 'public'}) ----`)\n await this.dropDatabase({ adapter: this })\n this.payload.logger.info('---- DROPPED TABLES ----')\n }\n }\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error))\n if (err.message?.match(/database .* does not exist/i) && !this.disableCreateDatabase) {\n // capitalize first char of the err msg\n this.payload.logger.info(\n `${err.message.charAt(0).toUpperCase() + err.message.slice(1)}, creating...`,\n )\n const isCreated = await this.createDatabase()\n\n if (isCreated) {\n await this.connect?.(options)\n return\n }\n } else {\n this.payload.logger.error({\n err,\n msg: `Error: cannot connect to Postgres. Details: ${err.message}`,\n })\n }\n\n if (typeof this.rejectInitializing === 'function') {\n this.rejectInitializing()\n }\n process.exit(1)\n }\n\n await this.createExtensions()\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","sql","VercelPool","drizzle","pg","connect","options","hotReload","logger","client","connectionString","poolOptions","process","env","POSTGRES_URL","forceUseVercelPostgres","includes","URL","hostname","Pool","schema","PAYLOAD_DROP_DATABASE","payload","info","schemaName","dropDatabase","adapter","error","err","Error","String","message","match","disableCreateDatabase","charAt","toUpperCase","slice","isCreated","createDatabase","msg","rejectInitializing","exit","createExtensions","NODE_ENV","PAYLOAD_MIGRATING","push","resolveInitializing","prodMigrations","migrate","migrations"],"mappings":"AAGA,SAASA,aAAa,QAAQ,sBAAqB;AACnD,SAASC,GAAG,EAAEC,UAAU,QAAQ,mBAAkB;AAClD,SAASC,OAAO,QAAQ,4BAA2B;AACnD,OAAOC,QAAQ,KAAI;AAInB,OAAO,MAAMC,UAAmB,eAAeA,QAE7CC,UAAU;IACRC,WAAW;AACb,CAAC;IAED,MAAM,EAAEA,SAAS,EAAE,GAAGD;IAEtB,IAAI;QACF,MAAME,SAAS,IAAI,CAACA,MAAM,IAAI;QAE9B,IAAIC;QAEJ,MAAMC,mBAAmB,IAAI,CAACC,WAAW,EAAED,oBAAoBE,QAAQC,GAAG,CAACC,YAAY;QAEvF,6CAA6C;QAC7C,IACE,CAAC,IAAI,CAACC,sBAAsB,IAC5BL,oBACA;YAAC;YAAa;SAAY,CAACM,QAAQ,CAAC,IAAIC,IAAIP,kBAAkBQ,QAAQ,GACtE;YACAT,SAAS,IAAIL,GAAGe,IAAI,C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YAAY;YACjD,IAAI,CAACA,kBAAkB;QACzB;QACA5B,QAAQ6B,IAAI,CAAC;IACf;IAEA,MAAM,IAAI,CAACC,gBAAgB;IAE3B,wCAAwC;IACxC,IACE9B,QAAQC,GAAG,CAAC8B,QAAQ,KAAK,gBACzB/B,QAAQC,GAAG,CAAC+B,iBAAiB,KAAK,UAClC,IAAI,CAACC,IAAI,KAAK,OACd;QACA,MAAM7C,cAAc,IAAI;IAC1B;IAEA,IAAI,OAAO,IAAI,CAAC8C,mBAAmB,KAAK,YAAY;QAClD,IAAI,CAACA,mBAAmB;IAC1B;IAEA,IAAIlC,QAAQC,GAAG,CAAC8B,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-vercel-postgres",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.41.0-canary.0",
|
|
4
4
|
"description": "Vercel Postgres adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -70,18 +70,18 @@
|
|
|
70
70
|
"prompts": "2.4.2",
|
|
71
71
|
"to-snake-case": "1.0.0",
|
|
72
72
|
"uuid": "10.0.0",
|
|
73
|
-
"@payloadcms/drizzle": "3.
|
|
73
|
+
"@payloadcms/drizzle": "3.41.0-canary.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|
|
77
77
|
"@types/pg": "8.10.2",
|
|
78
78
|
"@types/to-snake-case": "1.0.0",
|
|
79
79
|
"esbuild": "0.24.2",
|
|
80
|
-
"payload": "3.
|
|
80
|
+
"payload": "3.41.0-canary.0",
|
|
81
81
|
"@payloadcms/eslint-config": "3.28.0"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
|
-
"payload": "3.
|
|
84
|
+
"payload": "3.41.0-canary.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build": "rimraf .dist && rimraf tsconfig.tsbuildinfo && pnpm build:types && pnpm build:swc && pnpm build:esbuild && pnpm renamePredefinedMigrations",
|