@constructive-io/graphql-server 4.36.3 → 4.37.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.
@@ -241,7 +241,9 @@ const buildPreset = (pool, schemas, anonRole, roleName, databaseSettings) => {
241
241
  if (req.token.kind) {
242
242
  pgSettings['jwt.claims.kind'] = req.token.kind;
243
243
  }
244
- // Enforce read-only transactions for read_only credentials (API keys, etc.)
244
+ // Principal identity always set; equals user_id for human sessions
245
+ pgSettings['jwt.claims.principal_id'] = req.token.principal_id || req.token.user_id;
246
+ // Enforce read-only transactions for read_only credentials
245
247
  if (req.token.access_level === 'read_only') {
246
248
  pgSettings['default_transaction_read_only'] = 'on';
247
249
  }
@@ -250,7 +250,9 @@ const buildPreset = (pool, schemas, anonRole, roleName, databaseSettings) => {
250
250
  if (req.token.kind) {
251
251
  pgSettings['jwt.claims.kind'] = req.token.kind;
252
252
  }
253
- // Enforce read-only transactions for read_only credentials (API keys, etc.)
253
+ // Principal identity always set; equals user_id for human sessions
254
+ pgSettings['jwt.claims.principal_id'] = req.token.principal_id || req.token.user_id;
255
+ // Enforce read-only transactions for read_only credentials
254
256
  if (req.token.access_level === 'read_only') {
255
257
  pgSettings['default_transaction_read_only'] = 'on';
256
258
  }
@@ -2,6 +2,7 @@ import type { ApiStructure } from '../types';
2
2
  export type ConstructiveAPIToken = {
3
3
  id?: string;
4
4
  user_id?: string;
5
+ principal_id?: string;
5
6
  session_id?: string;
6
7
  access_level?: string;
7
8
  kind?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-server",
3
- "version": "4.36.3",
3
+ "version": "4.37.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Constructive GraphQL Server",
6
6
  "main": "index.js",
@@ -42,17 +42,17 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@constructive-io/csrf": "^0.15.0",
45
- "@constructive-io/express-context": "^0.6.0",
46
- "@constructive-io/graphql-env": "^3.13.0",
47
- "@constructive-io/graphql-types": "^3.12.0",
45
+ "@constructive-io/express-context": "^0.7.0",
46
+ "@constructive-io/graphql-env": "^3.13.1",
47
+ "@constructive-io/graphql-types": "^3.12.1",
48
48
  "@constructive-io/s3-utils": "^2.18.0",
49
49
  "@constructive-io/url-domains": "^2.17.0",
50
50
  "@graphile-contrib/pg-many-to-many": "2.0.0-rc.2",
51
- "@pgpmjs/env": "^2.25.0",
51
+ "@pgpmjs/env": "^2.25.1",
52
52
  "@pgpmjs/logger": "^2.12.0",
53
- "@pgpmjs/server-utils": "^3.13.0",
54
- "@pgpmjs/types": "^2.29.0",
55
- "agentic-server": "0.6.0",
53
+ "@pgpmjs/server-utils": "^3.13.1",
54
+ "@pgpmjs/types": "^2.29.1",
55
+ "agentic-server": "0.7.0",
56
56
  "cors": "^2.8.6",
57
57
  "deepmerge": "^4.3.1",
58
58
  "express": "^5.2.1",
@@ -61,15 +61,15 @@
61
61
  "grafserv": "1.0.0",
62
62
  "graphile-build": "5.0.2",
63
63
  "graphile-build-pg": "5.0.2",
64
- "graphile-cache": "^3.13.1",
64
+ "graphile-cache": "^3.13.2",
65
65
  "graphile-config": "1.0.1",
66
- "graphile-settings": "^5.8.1",
66
+ "graphile-settings": "^5.9.0",
67
67
  "graphile-utils": "5.0.1",
68
68
  "graphql": "16.13.0",
69
69
  "graphql-upload": "^13.0.0",
70
70
  "lru-cache": "^11.2.7",
71
71
  "pg": "^8.21.0",
72
- "pg-cache": "^3.12.0",
72
+ "pg-cache": "^3.12.1",
73
73
  "pg-env": "^1.16.0",
74
74
  "pg-query-context": "^2.17.0",
75
75
  "pg-sql2": "5.0.1",
@@ -85,10 +85,10 @@
85
85
  "@types/pg": "^8.20.0",
86
86
  "@types/request-ip": "^0.0.41",
87
87
  "cookie-parser": "^1.4.7",
88
- "graphile-test": "4.17.4",
88
+ "graphile-test": "4.17.5",
89
89
  "makage": "^0.3.0",
90
90
  "nodemon": "^3.1.14",
91
91
  "ts-node": "^10.9.2"
92
92
  },
93
- "gitHead": "d398ac2288f57fa02713353ce36024a63dd6b9f1"
93
+ "gitHead": "03d9e7ed4808d1d957b495a33980022172494340"
94
94
  }