@constructive-io/express-context 0.6.1 → 0.7.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.
@@ -30,6 +30,10 @@ export function buildPgSettings(input) {
30
30
  if (token?.session_id) {
31
31
  settings['jwt.claims.session_id'] = token.session_id;
32
32
  }
33
+ // Principal identity (service accounts / bots)
34
+ if (token?.principal_id) {
35
+ settings['jwt.claims.principal_id'] = token.principal_id;
36
+ }
33
37
  // Database context
34
38
  if (api.databaseId) {
35
39
  settings['jwt.claims.database_id'] = api.databaseId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/express-context",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Extractable Express middleware for Constructive tenant context — domain resolution, JWT auth, pgSettings, and withPgClient",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "homepage": "https://github.com/constructive-io/constructive",
@@ -59,5 +59,5 @@
59
59
  "jwt",
60
60
  "pgSettings"
61
61
  ],
62
- "gitHead": "00ebac5e8314330aa47564ed71758a4bcc8f8f8e"
62
+ "gitHead": "03d9e7ed4808d1d957b495a33980022172494340"
63
63
  }
package/pg-settings.js CHANGED
@@ -33,6 +33,10 @@ function buildPgSettings(input) {
33
33
  if (token?.session_id) {
34
34
  settings['jwt.claims.session_id'] = token.session_id;
35
35
  }
36
+ // Principal identity (service accounts / bots)
37
+ if (token?.principal_id) {
38
+ settings['jwt.claims.principal_id'] = token.principal_id;
39
+ }
36
40
  // Database context
37
41
  if (api.databaseId) {
38
42
  settings['jwt.claims.database_id'] = api.databaseId;
package/types.d.ts CHANGED
@@ -116,6 +116,7 @@ export type ApiConfigResult = ApiStructure | ApiError | null;
116
116
  export type ConstructiveAPIToken = {
117
117
  id?: string;
118
118
  user_id?: string;
119
+ principal_id?: string;
119
120
  session_id?: string;
120
121
  access_level?: string;
121
122
  kind?: string;