@pgpm/database-jobs 0.28.0 → 0.28.4
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/Makefile +1 -1
- package/README.md +1 -16
- package/deploy/schemas/app_jobs/procedures/add_job.sql +8 -0
- package/deploy/schemas/app_jobs/tables/jobs/table.sql +2 -0
- package/package.json +5 -5
- package/pgpm-database-jobs.control +1 -1
- /package/sql/{pgpm-database-jobs--0.26.3.sql → pgpm-database-jobs--0.22.0.sql} +0 -0
package/Makefile
CHANGED
package/README.md
CHANGED
|
@@ -348,7 +348,7 @@ The test suite validates:
|
|
|
348
348
|
|
|
349
349
|
## Related Tooling
|
|
350
350
|
|
|
351
|
-
* [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/
|
|
351
|
+
* [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/cli): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
|
|
352
352
|
* [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.
|
|
353
353
|
* [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.
|
|
354
354
|
* [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.
|
|
@@ -356,21 +356,6 @@ The test suite validates:
|
|
|
356
356
|
* [libpg-query-node](https://github.com/constructive-io/libpg-query-node): **🌉 Node.js bindings** for `libpg_query`, converting SQL into parse trees.
|
|
357
357
|
* [pg-proto-parser](https://github.com/constructive-io/pg-proto-parser): **📦 Protobuf parser** for parsing PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
|
|
358
358
|
|
|
359
|
-
### 📚 Documentation & Skills
|
|
360
|
-
|
|
361
|
-
* [constructive-skills](https://github.com/constructive-io/constructive-skills): **📖 Platform documentation and AI agent skills** — feature catalog, blueprint reference, SDK guides, and deployment guides.
|
|
362
|
-
|
|
363
|
-
Install skills for AI coding agents:
|
|
364
|
-
|
|
365
|
-
```bash
|
|
366
|
-
# All platform skills (security, blueprints, codegen, billing, etc.)
|
|
367
|
-
npx skills add constructive-io/constructive-skills
|
|
368
|
-
|
|
369
|
-
# Individual repo skills (pgpm, testing, CLI, search, etc.)
|
|
370
|
-
npx skills add https://github.com/constructive-io/constructive --skill pgpm
|
|
371
|
-
npx skills add https://github.com/constructive-io/constructive --skill constructive-testing
|
|
372
|
-
```
|
|
373
|
-
|
|
374
359
|
## Disclaimer
|
|
375
360
|
|
|
376
361
|
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
-- requires: schemas/app_jobs/tables/job_queues/table
|
|
5
5
|
-- requires: pgpm-jwt-claims:schemas/jwt_private/procedures/current_database_id
|
|
6
6
|
-- requires: pgpm-jwt-claims:schemas/jwt_public/procedures/current_user_id
|
|
7
|
+
-- requires: pgpm-jwt-claims:schemas/jwt_public/procedures/current_principal_id
|
|
7
8
|
|
|
8
9
|
BEGIN;
|
|
9
10
|
CREATE FUNCTION app_jobs.add_job (
|
|
@@ -24,16 +25,20 @@ DECLARE
|
|
|
24
25
|
v_job app_jobs.jobs;
|
|
25
26
|
v_database_id uuid;
|
|
26
27
|
v_actor_id uuid;
|
|
28
|
+
v_principal_id uuid;
|
|
27
29
|
BEGIN
|
|
28
30
|
-- Read context from JWT claims
|
|
29
31
|
v_database_id := jwt_private.current_database_id();
|
|
30
32
|
v_actor_id := jwt_public.current_user_id();
|
|
31
33
|
|
|
34
|
+
v_principal_id := jwt_public.current_principal_id();
|
|
35
|
+
|
|
32
36
|
IF job_key IS NOT NULL THEN
|
|
33
37
|
-- Upsert job
|
|
34
38
|
INSERT INTO app_jobs.jobs (
|
|
35
39
|
database_id,
|
|
36
40
|
actor_id,
|
|
41
|
+
principal_id,
|
|
37
42
|
entity_id,
|
|
38
43
|
organization_id,
|
|
39
44
|
entity_type,
|
|
@@ -47,6 +52,7 @@ BEGIN
|
|
|
47
52
|
) VALUES (
|
|
48
53
|
v_database_id,
|
|
49
54
|
v_actor_id,
|
|
55
|
+
v_principal_id,
|
|
50
56
|
add_job.entity_id,
|
|
51
57
|
add_job.organization_id,
|
|
52
58
|
add_job.entity_type,
|
|
@@ -93,6 +99,7 @@ BEGIN
|
|
|
93
99
|
INSERT INTO app_jobs.jobs (
|
|
94
100
|
database_id,
|
|
95
101
|
actor_id,
|
|
102
|
+
principal_id,
|
|
96
103
|
entity_id,
|
|
97
104
|
organization_id,
|
|
98
105
|
entity_type,
|
|
@@ -105,6 +112,7 @@ BEGIN
|
|
|
105
112
|
) VALUES (
|
|
106
113
|
v_database_id,
|
|
107
114
|
v_actor_id,
|
|
115
|
+
v_principal_id,
|
|
108
116
|
add_job.entity_id,
|
|
109
117
|
add_job.organization_id,
|
|
110
118
|
add_job.entity_type,
|
|
@@ -6,6 +6,7 @@ CREATE TABLE app_jobs.jobs (
|
|
|
6
6
|
id bigserial PRIMARY KEY,
|
|
7
7
|
database_id uuid,
|
|
8
8
|
actor_id uuid,
|
|
9
|
+
principal_id uuid,
|
|
9
10
|
entity_id uuid,
|
|
10
11
|
organization_id uuid,
|
|
11
12
|
entity_type text,
|
|
@@ -33,6 +34,7 @@ COMMENT ON TABLE app_jobs.jobs IS 'Background job queue: each row is a pending o
|
|
|
33
34
|
COMMENT ON COLUMN app_jobs.jobs.id IS 'Auto-incrementing job identifier';
|
|
34
35
|
COMMENT ON COLUMN app_jobs.jobs.database_id IS 'Database this job belongs to (nullable for system-level jobs without tenant context)';
|
|
35
36
|
COMMENT ON COLUMN app_jobs.jobs.actor_id IS 'User who triggered this job, read from JWT claims at enqueue time';
|
|
37
|
+
COMMENT ON COLUMN app_jobs.jobs.principal_id IS 'Principal that triggered this job; equals actor_id for human-triggered jobs, differs when an agent/API-key acts on behalf of a user';
|
|
36
38
|
COMMENT ON COLUMN app_jobs.jobs.entity_id IS 'Entity (org/team) this job is scoped to for billing; NULL means platform-level (resolved via database_id → owner_id)';
|
|
37
39
|
COMMENT ON COLUMN app_jobs.jobs.organization_id IS 'Top-level organization for this entity; resolved at enqueue time via get_organization_id(entity_type, entity_id)';
|
|
38
40
|
COMMENT ON COLUMN app_jobs.jobs.entity_type IS 'Entity type prefix (org, team, app, etc.) for interpreting entity_id';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpm/database-jobs",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.4",
|
|
4
4
|
"description": "Database-specific job handling and queue management",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"test:watch": "jest --watch"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"pgpm": "^4.
|
|
24
|
+
"pgpm": "^4.28.7"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@pgpm/jwt-claims": "0.28.
|
|
28
|
-
"@pgpm/verify": "0.28.
|
|
27
|
+
"@pgpm/jwt-claims": "0.28.4",
|
|
28
|
+
"@pgpm/verify": "0.28.4"
|
|
29
29
|
},
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/constructive-io/pgpm-modules/issues"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "08979b82f1f68af396b540c6ce0cda4b438d34f0"
|
|
39
39
|
}
|
|
File without changes
|