@pgpmjs/env 2.8.11 → 2.9.1

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/README.md CHANGED
@@ -44,9 +44,14 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
44
44
 
45
45
  ## Related Constructive Tooling
46
46
 
47
+ ### 📦 Package Management
48
+
49
+ * [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
50
+
47
51
  ### 🧪 Testing
48
52
 
49
53
  * [pgsql-test](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
54
+ * [pgsql-seed](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-seed): **🌱 PostgreSQL seeding utilities** for CSV, JSON, SQL data loading, and pgpm deployment.
50
55
  * [supabase-test](https://github.com/constructive-io/constructive/tree/main/postgres/supabase-test): **🧪 Supabase-native test harness** preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
51
56
  * [graphile-test](https://github.com/constructive-io/constructive/tree/main/graphile/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
52
57
  * [pg-query-context](https://github.com/constructive-io/constructive/tree/main/postgres/pg-query-context): **🔒 Session context injection** to add session-local context (e.g., `SET LOCAL`) into queries—ideal for setting `role`, `jwt.claims`, and other session settings.
@@ -60,28 +65,6 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
60
65
  * [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
61
66
  * [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
62
67
 
63
- ### 🚀 API & Dev Tools
64
-
65
- * [@constructive-io/graphql-server](https://github.com/constructive-io/constructive/tree/main/graphql/server): **⚡ Express-based API server** powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
66
- * [@constructive-io/graphql-explorer](https://github.com/constructive-io/constructive/tree/main/graphql/explorer): **🔎 Visual API explorer** with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
67
-
68
- ### 🔁 Streaming & Uploads
69
-
70
- * [etag-hash](https://github.com/constructive-io/constructive/tree/main/streaming/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
71
- * [etag-stream](https://github.com/constructive-io/constructive/tree/main/streaming/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
72
- * [uuid-hash](https://github.com/constructive-io/constructive/tree/main/streaming/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
73
- * [uuid-stream](https://github.com/constructive-io/constructive/tree/main/streaming/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
74
- * [@constructive-io/s3-streamer](https://github.com/constructive-io/constructive/tree/main/streaming/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
75
- * [@constructive-io/upload-names](https://github.com/constructive-io/constructive/tree/main/streaming/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
76
-
77
- ### 🧰 CLI & Codegen
78
-
79
- * [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
80
- * [@constructive-io/cli](https://github.com/constructive-io/constructive/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing Constructive projects—supports database scaffolding, migrations, seeding, code generation, and automation.
81
- * [@constructive-io/graphql-codegen](https://github.com/constructive-io/constructive/tree/main/graphql/codegen): **✨ GraphQL code generation** (types, operations, SDK) from schema/endpoint introspection.
82
- * [@constructive-io/query-builder](https://github.com/constructive-io/constructive/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
83
- * [@constructive-io/graphql-query](https://github.com/constructive-io/constructive/tree/main/graphql/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
84
-
85
68
  ## Credits
86
69
 
87
70
  **🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
package/env.d.ts CHANGED
@@ -3,8 +3,10 @@ export declare const parseEnvBoolean: (val?: string) => boolean | undefined;
3
3
  /**
4
4
  * Parse core PGPM environment variables.
5
5
  * GraphQL-related env vars (GRAPHILE_*, FEATURES_*, API_*) are handled by @constructive-io/graphql-env.
6
+ *
7
+ * @param env - Environment object to read from (defaults to process.env for backwards compatibility)
6
8
  */
7
- export declare const getEnvVars: () => PgpmOptions;
9
+ export declare const getEnvVars: (env?: NodeJS.ProcessEnv) => PgpmOptions;
8
10
  type NodeEnv = 'development' | 'production' | 'test';
9
11
  export declare const getNodeEnv: () => NodeEnv;
10
12
  export {};
package/env.js CHANGED
@@ -22,13 +22,15 @@ const parseEnvStringArray = (val) => {
22
22
  /**
23
23
  * Parse core PGPM environment variables.
24
24
  * GraphQL-related env vars (GRAPHILE_*, FEATURES_*, API_*) are handled by @constructive-io/graphql-env.
25
+ *
26
+ * @param env - Environment object to read from (defaults to process.env for backwards compatibility)
25
27
  */
26
- const getEnvVars = () => {
28
+ const getEnvVars = (env = process.env) => {
27
29
  const { PGROOTDATABASE, PGTEMPLATE, DB_PREFIX, DB_EXTENSIONS, DB_CWD, DB_CONNECTION_USER, DB_CONNECTION_PASSWORD, DB_CONNECTION_ROLE,
28
30
  // New connections.app and connections.admin env vars
29
- DB_CONNECTIONS_APP_USER, DB_CONNECTIONS_APP_PASSWORD, DB_CONNECTIONS_ADMIN_USER, DB_CONNECTIONS_ADMIN_PASSWORD, PORT, SERVER_HOST, SERVER_TRUST_PROXY, SERVER_ORIGIN, SERVER_STRICT_AUTH, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE, BUCKET_NAME, AWS_REGION, AWS_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SECRET_KEY, AWS_SECRET_ACCESS_KEY, MINIO_ENDPOINT, DEPLOYMENT_USE_TX, DEPLOYMENT_FAST, DEPLOYMENT_USE_PLAN, DEPLOYMENT_CACHE, DEPLOYMENT_TO_CHANGE, MIGRATIONS_CODEGEN_USE_TX,
31
+ DB_CONNECTIONS_APP_USER, DB_CONNECTIONS_APP_PASSWORD, DB_CONNECTIONS_ADMIN_USER, DB_CONNECTIONS_ADMIN_PASSWORD, PORT, SERVER_HOST, SERVER_TRUST_PROXY, SERVER_ORIGIN, SERVER_STRICT_AUTH, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE, BUCKET_PROVIDER, BUCKET_NAME, AWS_REGION, AWS_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SECRET_KEY, AWS_SECRET_ACCESS_KEY, MINIO_ENDPOINT, DEPLOYMENT_USE_TX, DEPLOYMENT_FAST, DEPLOYMENT_USE_PLAN, DEPLOYMENT_CACHE, DEPLOYMENT_TO_CHANGE, MIGRATIONS_CODEGEN_USE_TX,
30
32
  // Jobs-related env vars
31
- JOBS_SCHEMA, JOBS_SUPPORT_ANY, JOBS_SUPPORTED, INTERNAL_GATEWAY_URL, INTERNAL_JOBS_CALLBACK_URL, INTERNAL_JOBS_CALLBACK_PORT } = process.env;
33
+ JOBS_SCHEMA, JOBS_SUPPORT_ANY, JOBS_SUPPORTED, INTERNAL_GATEWAY_URL, INTERNAL_JOBS_CALLBACK_URL, INTERNAL_JOBS_CALLBACK_PORT } = env;
32
34
  return {
33
35
  db: {
34
36
  ...(PGROOTDATABASE && { rootDb: PGROOTDATABASE }),
@@ -75,6 +77,7 @@ const getEnvVars = () => {
75
77
  ...(PGDATABASE && { database: PGDATABASE }),
76
78
  },
77
79
  cdn: {
80
+ ...(BUCKET_PROVIDER && { provider: BUCKET_PROVIDER }),
78
81
  ...(BUCKET_NAME && { bucketName: BUCKET_NAME }),
79
82
  ...(AWS_REGION && { awsRegion: AWS_REGION }),
80
83
  ...((AWS_ACCESS_KEY || AWS_ACCESS_KEY_ID) && { awsAccessKey: AWS_ACCESS_KEY || AWS_ACCESS_KEY_ID }),
package/esm/env.js CHANGED
@@ -18,13 +18,15 @@ const parseEnvStringArray = (val) => {
18
18
  /**
19
19
  * Parse core PGPM environment variables.
20
20
  * GraphQL-related env vars (GRAPHILE_*, FEATURES_*, API_*) are handled by @constructive-io/graphql-env.
21
+ *
22
+ * @param env - Environment object to read from (defaults to process.env for backwards compatibility)
21
23
  */
22
- export const getEnvVars = () => {
24
+ export const getEnvVars = (env = process.env) => {
23
25
  const { PGROOTDATABASE, PGTEMPLATE, DB_PREFIX, DB_EXTENSIONS, DB_CWD, DB_CONNECTION_USER, DB_CONNECTION_PASSWORD, DB_CONNECTION_ROLE,
24
26
  // New connections.app and connections.admin env vars
25
- DB_CONNECTIONS_APP_USER, DB_CONNECTIONS_APP_PASSWORD, DB_CONNECTIONS_ADMIN_USER, DB_CONNECTIONS_ADMIN_PASSWORD, PORT, SERVER_HOST, SERVER_TRUST_PROXY, SERVER_ORIGIN, SERVER_STRICT_AUTH, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE, BUCKET_NAME, AWS_REGION, AWS_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SECRET_KEY, AWS_SECRET_ACCESS_KEY, MINIO_ENDPOINT, DEPLOYMENT_USE_TX, DEPLOYMENT_FAST, DEPLOYMENT_USE_PLAN, DEPLOYMENT_CACHE, DEPLOYMENT_TO_CHANGE, MIGRATIONS_CODEGEN_USE_TX,
27
+ DB_CONNECTIONS_APP_USER, DB_CONNECTIONS_APP_PASSWORD, DB_CONNECTIONS_ADMIN_USER, DB_CONNECTIONS_ADMIN_PASSWORD, PORT, SERVER_HOST, SERVER_TRUST_PROXY, SERVER_ORIGIN, SERVER_STRICT_AUTH, PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE, BUCKET_PROVIDER, BUCKET_NAME, AWS_REGION, AWS_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SECRET_KEY, AWS_SECRET_ACCESS_KEY, MINIO_ENDPOINT, DEPLOYMENT_USE_TX, DEPLOYMENT_FAST, DEPLOYMENT_USE_PLAN, DEPLOYMENT_CACHE, DEPLOYMENT_TO_CHANGE, MIGRATIONS_CODEGEN_USE_TX,
26
28
  // Jobs-related env vars
27
- JOBS_SCHEMA, JOBS_SUPPORT_ANY, JOBS_SUPPORTED, INTERNAL_GATEWAY_URL, INTERNAL_JOBS_CALLBACK_URL, INTERNAL_JOBS_CALLBACK_PORT } = process.env;
29
+ JOBS_SCHEMA, JOBS_SUPPORT_ANY, JOBS_SUPPORTED, INTERNAL_GATEWAY_URL, INTERNAL_JOBS_CALLBACK_URL, INTERNAL_JOBS_CALLBACK_PORT } = env;
28
30
  return {
29
31
  db: {
30
32
  ...(PGROOTDATABASE && { rootDb: PGROOTDATABASE }),
@@ -71,6 +73,7 @@ export const getEnvVars = () => {
71
73
  ...(PGDATABASE && { database: PGDATABASE }),
72
74
  },
73
75
  cdn: {
76
+ ...(BUCKET_PROVIDER && { provider: BUCKET_PROVIDER }),
74
77
  ...(BUCKET_NAME && { bucketName: BUCKET_NAME }),
75
78
  ...(AWS_REGION && { awsRegion: AWS_REGION }),
76
79
  ...((AWS_ACCESS_KEY || AWS_ACCESS_KEY_ID) && { awsAccessKey: AWS_ACCESS_KEY || AWS_ACCESS_KEY_ID }),
package/esm/merge.js CHANGED
@@ -11,10 +11,14 @@ import { mergeArraysUnique } from './utils';
11
11
  * 4. Runtime overrides
12
12
  *
13
13
  * For Constructive applications that need GraphQL options, use @constructive-io/graphql-env instead.
14
+ *
15
+ * @param overrides - Runtime overrides to apply last
16
+ * @param cwd - Working directory for config file resolution
17
+ * @param env - Environment object to read from (defaults to process.env for backwards compatibility)
14
18
  */
15
- export const getEnvOptions = (overrides = {}, cwd = process.cwd()) => {
19
+ export const getEnvOptions = (overrides = {}, cwd = process.cwd(), env = process.env) => {
16
20
  const configOptions = loadConfigSync(cwd);
17
- const envOptions = getEnvVars();
21
+ const envOptions = getEnvVars(env);
18
22
  return deepmerge.all([pgpmDefaults, configOptions, envOptions, overrides], {
19
23
  arrayMerge: mergeArraysUnique
20
24
  });
package/merge.d.ts CHANGED
@@ -7,7 +7,11 @@ import { PgpmOptions, PgTestConnectionOptions, DeploymentOptions } from '@pgpmjs
7
7
  * 4. Runtime overrides
8
8
  *
9
9
  * For Constructive applications that need GraphQL options, use @constructive-io/graphql-env instead.
10
+ *
11
+ * @param overrides - Runtime overrides to apply last
12
+ * @param cwd - Working directory for config file resolution
13
+ * @param env - Environment object to read from (defaults to process.env for backwards compatibility)
10
14
  */
11
- export declare const getEnvOptions: (overrides?: PgpmOptions, cwd?: string) => PgpmOptions;
15
+ export declare const getEnvOptions: (overrides?: PgpmOptions, cwd?: string, env?: NodeJS.ProcessEnv) => PgpmOptions;
12
16
  export declare const getConnEnvOptions: (overrides?: Partial<PgTestConnectionOptions>, cwd?: string) => PgTestConnectionOptions;
13
17
  export declare const getDeploymentEnvOptions: (overrides?: Partial<DeploymentOptions>, cwd?: string) => DeploymentOptions;
package/merge.js CHANGED
@@ -17,10 +17,14 @@ const utils_1 = require("./utils");
17
17
  * 4. Runtime overrides
18
18
  *
19
19
  * For Constructive applications that need GraphQL options, use @constructive-io/graphql-env instead.
20
+ *
21
+ * @param overrides - Runtime overrides to apply last
22
+ * @param cwd - Working directory for config file resolution
23
+ * @param env - Environment object to read from (defaults to process.env for backwards compatibility)
20
24
  */
21
- const getEnvOptions = (overrides = {}, cwd = process.cwd()) => {
25
+ const getEnvOptions = (overrides = {}, cwd = process.cwd(), env = process.env) => {
22
26
  const configOptions = (0, config_1.loadConfigSync)(cwd);
23
- const envOptions = (0, env_1.getEnvVars)();
27
+ const envOptions = (0, env_1.getEnvVars)(env);
24
28
  return deepmerge_1.default.all([types_1.pgpmDefaults, configOptions, envOptions, overrides], {
25
29
  arrayMerge: utils_1.mergeArraysUnique
26
30
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/env",
3
- "version": "2.8.11",
3
+ "version": "2.9.1",
4
4
  "author": "Dan Lynch <Dan Lynch>",
5
5
  "description": "PGPM environment management",
6
6
  "main": "index.js",
@@ -29,7 +29,7 @@
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "dependencies": {
32
- "@pgpmjs/types": "^2.12.8",
32
+ "@pgpmjs/types": "^2.13.0",
33
33
  "deepmerge": "^4.3.1"
34
34
  },
35
35
  "keywords": [
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "makage": "^0.1.9"
45
45
  },
46
- "gitHead": "c2e68f9808a87e3231d9b9af5e706bef5dbd2af8"
46
+ "gitHead": "14ed679aeb6172e013c817b8a458e5bee68ab492"
47
47
  }