@pgpmjs/types 2.12.5 → 2.12.7

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
@@ -54,7 +54,6 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
54
54
  * [@pgsql/enums](https://www.npmjs.com/package/@pgsql/enums): **🏷️ TypeScript enums** for PostgreSQL AST for safe and ergonomic parsing logic.
55
55
  * [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
56
56
  * [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
57
- * [pg-ast](https://www.npmjs.com/package/pg-ast): **🔍 Low-level AST tools** and transformations for Postgres query structures.
58
57
 
59
58
  ### 🚀 API & Dev Tools
60
59
 
package/esm/jobs.js CHANGED
@@ -2,22 +2,10 @@
2
2
  * Default configuration values for job system
3
3
  */
4
4
  export const jobsDefaults = {
5
- pg: {
6
- host: 'localhost',
7
- port: 5432,
8
- user: 'postgres',
9
- password: 'password',
10
- database: 'jobs'
11
- },
12
5
  schema: {
13
6
  schema: 'app_jobs'
14
7
  },
15
8
  worker: {
16
- host: 'localhost',
17
- port: 5432,
18
- user: 'postgres',
19
- password: 'password',
20
- database: 'jobs',
21
9
  schema: 'app_jobs',
22
10
  hostname: 'worker-0',
23
11
  supportAny: true,
@@ -26,11 +14,6 @@ export const jobsDefaults = {
26
14
  gracefulShutdown: true
27
15
  },
28
16
  scheduler: {
29
- host: 'localhost',
30
- port: 5432,
31
- user: 'postgres',
32
- password: 'password',
33
- database: 'jobs',
34
17
  schema: 'app_jobs',
35
18
  hostname: 'scheduler-0',
36
19
  supportAny: true,
package/esm/pgpm.js CHANGED
@@ -8,18 +8,23 @@ export const pgpmDefaults = {
8
8
  prefix: 'db-',
9
9
  extensions: [],
10
10
  cwd: process.cwd(),
11
- connection: {
12
- user: 'app_user',
13
- password: 'app_password',
14
- // TODO: check if this is used vs. roles below...
15
- role: 'anonymous'
11
+ connections: {
12
+ app: {
13
+ user: 'app_user',
14
+ password: 'app_password'
15
+ },
16
+ admin: {
17
+ user: 'app_admin',
18
+ password: 'admin_password'
19
+ }
16
20
  },
17
21
  roles: {
18
22
  anonymous: 'anonymous',
19
23
  authenticated: 'authenticated',
20
24
  administrator: 'administrator',
21
25
  default: 'anonymous'
22
- }
26
+ },
27
+ useLocksForRoles: false
23
28
  },
24
29
  pg: {
25
30
  host: 'localhost',
@@ -55,22 +60,10 @@ export const pgpmDefaults = {
55
60
  }
56
61
  },
57
62
  jobs: {
58
- pg: {
59
- host: 'localhost',
60
- port: 5432,
61
- user: 'postgres',
62
- password: 'password',
63
- database: 'jobs'
64
- },
65
63
  schema: {
66
64
  schema: 'app_jobs'
67
65
  },
68
66
  worker: {
69
- host: 'localhost',
70
- port: 5432,
71
- user: 'postgres',
72
- password: 'password',
73
- database: 'jobs',
74
67
  schema: 'app_jobs',
75
68
  hostname: 'worker-0',
76
69
  supportAny: true,
@@ -79,11 +72,6 @@ export const pgpmDefaults = {
79
72
  gracefulShutdown: true
80
73
  },
81
74
  scheduler: {
82
- host: 'localhost',
83
- port: 5432,
84
- user: 'postgres',
85
- password: 'password',
86
- database: 'jobs',
87
75
  schema: 'app_jobs',
88
76
  hostname: 'scheduler-0',
89
77
  supportAny: true,
package/jobs.d.ts CHANGED
@@ -1,12 +1,3 @@
1
- import { PgConfig } from 'pg-env';
2
- /**
3
- * Job system PostgreSQL configuration
4
- * Extends the base PgConfig with job-specific database settings
5
- */
6
- export interface JobPgConfig extends PgConfig {
7
- /** Database name for job system (defaults to 'jobs') */
8
- database: string;
9
- }
10
1
  /**
11
2
  * Job schema configuration
12
3
  */
@@ -141,7 +132,7 @@ export interface Job {
141
132
  /**
142
133
  * Worker configuration options
143
134
  */
144
- export interface JobWorkerConfig extends JobPgConfig, JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig {
135
+ export interface JobWorkerConfig extends JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig {
145
136
  /** Polling interval in milliseconds */
146
137
  pollInterval?: number;
147
138
  /** Whether to enable graceful shutdown */
@@ -150,7 +141,7 @@ export interface JobWorkerConfig extends JobPgConfig, JobSchemaConfig, JobHostna
150
141
  /**
151
142
  * Scheduler configuration options
152
143
  */
153
- export interface JobSchedulerConfig extends JobPgConfig, JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig {
144
+ export interface JobSchedulerConfig extends JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig {
154
145
  /** Polling interval in milliseconds for checking scheduled jobs */
155
146
  pollInterval?: number;
156
147
  /** Whether to enable graceful shutdown */
@@ -160,8 +151,6 @@ export interface JobSchedulerConfig extends JobPgConfig, JobSchemaConfig, JobHos
160
151
  * Complete job system configuration
161
152
  */
162
153
  export interface JobsConfig {
163
- /** PostgreSQL database configuration */
164
- pg?: Partial<JobPgConfig>;
165
154
  /** Job schema configuration */
166
155
  schema?: Partial<JobSchemaConfig>;
167
156
  /** Worker configuration */
package/jobs.js CHANGED
@@ -5,22 +5,10 @@ exports.jobsDefaults = void 0;
5
5
  * Default configuration values for job system
6
6
  */
7
7
  exports.jobsDefaults = {
8
- pg: {
9
- host: 'localhost',
10
- port: 5432,
11
- user: 'postgres',
12
- password: 'password',
13
- database: 'jobs'
14
- },
15
8
  schema: {
16
9
  schema: 'app_jobs'
17
10
  },
18
11
  worker: {
19
- host: 'localhost',
20
- port: 5432,
21
- user: 'postgres',
22
- password: 'password',
23
- database: 'jobs',
24
12
  schema: 'app_jobs',
25
13
  hostname: 'worker-0',
26
14
  supportAny: true,
@@ -29,11 +17,6 @@ exports.jobsDefaults = {
29
17
  gracefulShutdown: true
30
18
  },
31
19
  scheduler: {
32
- host: 'localhost',
33
- port: 5432,
34
- user: 'postgres',
35
- password: 'password',
36
- database: 'jobs',
37
20
  schema: 'app_jobs',
38
21
  hostname: 'scheduler-0',
39
22
  supportAny: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpmjs/types",
3
- "version": "2.12.5",
3
+ "version": "2.12.7",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "PGPM types",
6
6
  "main": "index.js",
@@ -42,5 +42,5 @@
42
42
  "devDependencies": {
43
43
  "makage": "^0.1.9"
44
44
  },
45
- "gitHead": "e45ec95404e48d0c0542da882a3baea0cd6de1c7"
45
+ "gitHead": "f6cb102f2d19174b4f54ed2ba0c02308b1325830"
46
46
  }
package/pgpm.d.ts CHANGED
@@ -25,12 +25,14 @@ export interface PgTestConnectionOptions {
25
25
  extensions?: string[];
26
26
  /** Current working directory for database operations */
27
27
  cwd?: string;
28
- /** Database connection credentials */
29
- connection?: DatabaseConnectionOptions;
28
+ /** Test user credentials for app and admin users */
29
+ connections?: TestUserCredentials;
30
30
  /** Role mapping configuration */
31
31
  roles?: RoleMapping;
32
32
  /** Default authentication options for db connections */
33
33
  auth?: AuthOptions;
34
+ /** Use advisory locks for role/user creation (for concurrency safety) */
35
+ useLocksForRoles?: boolean;
34
36
  }
35
37
  /**
36
38
  * PostgreSQL session context settings for test clients
@@ -70,6 +72,15 @@ export interface DatabaseConnectionOptions {
70
72
  /** Database role to assume */
71
73
  role?: string;
72
74
  }
75
+ /**
76
+ * Test user credentials for app and admin users
77
+ */
78
+ export interface TestUserCredentials {
79
+ /** App user credentials (for RLS simulation) */
80
+ app?: DatabaseConnectionOptions;
81
+ /** Admin user credentials (for test admin operations) */
82
+ admin?: DatabaseConnectionOptions;
83
+ }
73
84
  /**
74
85
  * HTTP server configuration
75
86
  */
package/pgpm.js CHANGED
@@ -12,18 +12,23 @@ exports.pgpmDefaults = {
12
12
  prefix: 'db-',
13
13
  extensions: [],
14
14
  cwd: process.cwd(),
15
- connection: {
16
- user: 'app_user',
17
- password: 'app_password',
18
- // TODO: check if this is used vs. roles below...
19
- role: 'anonymous'
15
+ connections: {
16
+ app: {
17
+ user: 'app_user',
18
+ password: 'app_password'
19
+ },
20
+ admin: {
21
+ user: 'app_admin',
22
+ password: 'admin_password'
23
+ }
20
24
  },
21
25
  roles: {
22
26
  anonymous: 'anonymous',
23
27
  authenticated: 'authenticated',
24
28
  administrator: 'administrator',
25
29
  default: 'anonymous'
26
- }
30
+ },
31
+ useLocksForRoles: false
27
32
  },
28
33
  pg: {
29
34
  host: 'localhost',
@@ -59,22 +64,10 @@ exports.pgpmDefaults = {
59
64
  }
60
65
  },
61
66
  jobs: {
62
- pg: {
63
- host: 'localhost',
64
- port: 5432,
65
- user: 'postgres',
66
- password: 'password',
67
- database: 'jobs'
68
- },
69
67
  schema: {
70
68
  schema: 'app_jobs'
71
69
  },
72
70
  worker: {
73
- host: 'localhost',
74
- port: 5432,
75
- user: 'postgres',
76
- password: 'password',
77
- database: 'jobs',
78
71
  schema: 'app_jobs',
79
72
  hostname: 'worker-0',
80
73
  supportAny: true,
@@ -83,11 +76,6 @@ exports.pgpmDefaults = {
83
76
  gracefulShutdown: true
84
77
  },
85
78
  scheduler: {
86
- host: 'localhost',
87
- port: 5432,
88
- user: 'postgres',
89
- password: 'password',
90
- database: 'jobs',
91
79
  schema: 'app_jobs',
92
80
  hostname: 'scheduler-0',
93
81
  supportAny: true,