@fjall/payload 0.87.4 → 0.87.9
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/adapters/postgres.d.ts +9 -13
- package/dist/adapters/postgres.d.ts.map +1 -1
- package/dist/adapters/postgres.js +22 -6
- package/dist/adapters/postgres.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -22,20 +22,16 @@ export interface FjallPostgresAdapterOptions {
|
|
|
22
22
|
/**
|
|
23
23
|
* Pre-compiled migrations for production.
|
|
24
24
|
* Required for Lambda deployments where filesystem migrations aren't available.
|
|
25
|
+
*
|
|
26
|
+
* Pass the migrations array exported from your migrations index file:
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { migrations } from './migrations'
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Type is `unknown[]` to avoid contravariance issues with Payload's
|
|
32
|
+
* specific migration argument types (MigrateUpArgs, MigrateDownArgs).
|
|
25
33
|
*/
|
|
26
|
-
prodMigrations?:
|
|
27
|
-
up: (args: {
|
|
28
|
-
db: unknown;
|
|
29
|
-
payload: unknown;
|
|
30
|
-
req: unknown;
|
|
31
|
-
}) => Promise<void>;
|
|
32
|
-
down: (args: {
|
|
33
|
-
db: unknown;
|
|
34
|
-
payload: unknown;
|
|
35
|
-
req: unknown;
|
|
36
|
-
}) => Promise<void>;
|
|
37
|
-
name: string;
|
|
38
|
-
}>;
|
|
34
|
+
prodMigrations?: unknown[];
|
|
39
35
|
}
|
|
40
36
|
/**
|
|
41
37
|
* Create a Fjall-configured PostgreSQL adapter for Payload CMS.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/adapters/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,yCAAyC;AACzC,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/adapters/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,yCAAyC;AACzC,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAwEhE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,OAAO,EAAE,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,qBAAqB,CAAC,CAkBhC"}
|
|
@@ -23,22 +23,35 @@ let cachedDbUrl = null;
|
|
|
23
23
|
* In development, falls back to DATABASE_URL environment variable.
|
|
24
24
|
*/
|
|
25
25
|
async function getDatabaseUrl() {
|
|
26
|
-
// Return cached URL if already resolved
|
|
27
|
-
if (cachedDbUrl)
|
|
26
|
+
// Return cached URL if already resolved (use explicit null check to handle empty string cache)
|
|
27
|
+
if (cachedDbUrl !== null)
|
|
28
28
|
return cachedDbUrl;
|
|
29
29
|
// If Fjall env vars are present (production Lambda environment)
|
|
30
30
|
if (process.env.DATABASE_HOST) {
|
|
31
31
|
const host = process.env.DATABASE_HOST;
|
|
32
32
|
const port = process.env.DATABASE_PORT || "5432";
|
|
33
33
|
const name = process.env.DATABASE_NAME;
|
|
34
|
+
if (!name) {
|
|
35
|
+
throw new Error("[fjall] DATABASE_NAME environment variable not configured. " +
|
|
36
|
+
"Ensure DATABASE_NAME is set alongside DATABASE_HOST.");
|
|
37
|
+
}
|
|
34
38
|
// Fetch credentials from Lambda Extension
|
|
35
|
-
const user =
|
|
36
|
-
const pass =
|
|
39
|
+
const user = await fetchSecretField("DATABASE_USERNAME");
|
|
40
|
+
const pass = await fetchSecretField("DATABASE_PASSWORD");
|
|
41
|
+
if (!user || !pass) {
|
|
42
|
+
throw new Error("[fjall] Database credentials not found in Secrets Manager. " +
|
|
43
|
+
"Ensure DATABASE_USERNAME and DATABASE_PASSWORD are configured in your secrets.");
|
|
44
|
+
}
|
|
37
45
|
cachedDbUrl = `postgresql://${user}:${encodeURIComponent(pass)}@${host}:${port}/${name}`;
|
|
38
46
|
return cachedDbUrl;
|
|
39
47
|
}
|
|
40
48
|
// Fallback to DATABASE_URL for local development
|
|
41
|
-
|
|
49
|
+
const databaseUrl = process.env.DATABASE_URL;
|
|
50
|
+
if (!databaseUrl) {
|
|
51
|
+
throw new Error("[fjall] DATABASE_URL environment variable not configured. " +
|
|
52
|
+
"Set DATABASE_URL for local development or DATABASE_HOST for production.");
|
|
53
|
+
}
|
|
54
|
+
cachedDbUrl = databaseUrl;
|
|
42
55
|
return cachedDbUrl;
|
|
43
56
|
}
|
|
44
57
|
/**
|
|
@@ -83,7 +96,10 @@ export async function fjallPostgresAdapter(options = {}) {
|
|
|
83
96
|
ssl: getSslConfig(),
|
|
84
97
|
},
|
|
85
98
|
migrationDir,
|
|
86
|
-
prodMigrations
|
|
99
|
+
// Type assertion: prodMigrations is typed as unknown[] in our interface to avoid
|
|
100
|
+
// exposing Payload's internal migration types. The assertion is safe because
|
|
101
|
+
// migrations are generated by `payload migrate:create` which produces the correct type.
|
|
102
|
+
prodMigrations: prodMigrations,
|
|
87
103
|
});
|
|
88
104
|
}
|
|
89
105
|
//# sourceMappingURL=postgres.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../src/adapters/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,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AAC;QACJ,CAAC;QAED,WAAW,GAAG,gBAAgB,IAAI,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACzF,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,iDAAiD;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACb,4DAA4D;YAC1D,yEAAyE,CAC5E,CAAC;IACJ,CAAC;IACD,WAAW,GAAG,WAAW,CAAC;IAC1B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY;IACnB,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,MAAM;QACxC,CAAC,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE;QAC/B,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC;AA2BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,UAAuC,EAAE;IAEzC,MAAM,EAAE,YAAY,GAAG,kBAAkB,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAEtE,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAE3C,OAAO,eAAe,CAAC;QACrB,IAAI,EAAE;YACJ,gBAAgB,EAAE,WAAW;YAC7B,GAAG,EAAE,YAAY,EAAE;SACpB;QACD,YAAY;QACZ,iFAAiF;QACjF,6EAA6E;QAC7E,wFAAwF;QACxF,cAAc,EAAE,cAEM;KACvB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,GACjC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mBAAmB;AACnB,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAEhC,qBAAqB;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAA4B,MAAM,iBAAiB,CAAC;AAEzE,wBAAwB;AACxB,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/payload",
|
|
3
|
-
"version": "0.87.
|
|
3
|
+
"version": "0.87.9",
|
|
4
4
|
"description": "Fjall AWS adapters and utilities for Payload CMS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"payload": "^3.73.0",
|
|
50
50
|
"typescript": "^5.8.2"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "aeb92339334a299afb04e95a24fa3adebc54cc2e"
|
|
53
53
|
}
|