@nextage/era-lib 1.0.190 → 1.0.192

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.
Files changed (64) hide show
  1. package/build/constants.d.ts +56 -6
  2. package/build/constants.d.ts.map +1 -1
  3. package/build/constants.js +57 -7
  4. package/build/constants.js.map +1 -1
  5. package/build/enums.d.ts +16 -0
  6. package/build/enums.d.ts.map +1 -1
  7. package/build/enums.js +18 -1
  8. package/build/enums.js.map +1 -1
  9. package/build/events/base/base-event.controller.d.ts +1 -1
  10. package/build/events/base/base-event.controller.js +1 -1
  11. package/build/events/base/base-msg-listener.d.ts +1 -1
  12. package/build/events/base/base-msg-listener.js +1 -1
  13. package/build/events/publisher-registry.d.ts +1 -1
  14. package/build/events/publisher-registry.js +3 -3
  15. package/build/events/revocation-denylist.js +1 -1
  16. package/build/events/transport/nats-client-manager.d.ts +1 -1
  17. package/build/events/transport/nats-client-manager.js +1 -1
  18. package/build/index.d.ts +1 -0
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +1 -0
  21. package/build/index.js.map +1 -1
  22. package/build/interfaces.d.ts +21 -1
  23. package/build/interfaces.d.ts.map +1 -1
  24. package/build/types/base-user/index.d.ts +2 -1
  25. package/build/types/base-user/index.d.ts.map +1 -1
  26. package/build/types/nx-context.d.ts +18 -0
  27. package/build/types/nx-context.d.ts.map +1 -0
  28. package/build/types/nx-context.js +14 -0
  29. package/build/types/nx-context.js.map +1 -0
  30. package/build/utils/claims.d.ts +42 -0
  31. package/build/utils/claims.d.ts.map +1 -0
  32. package/build/utils/claims.interfaces.d.ts +42 -0
  33. package/build/utils/claims.interfaces.d.ts.map +1 -0
  34. package/build/utils/claims.interfaces.js +9 -0
  35. package/build/utils/claims.interfaces.js.map +1 -0
  36. package/build/utils/claims.js +61 -0
  37. package/build/utils/claims.js.map +1 -0
  38. package/build/utils/express.js +2 -2
  39. package/build/utils/functs.d.ts +4 -31
  40. package/build/utils/functs.d.ts.map +1 -1
  41. package/build/utils/functs.js +3 -54
  42. package/build/utils/functs.js.map +1 -1
  43. package/build/utils/index.d.ts +6 -0
  44. package/build/utils/index.d.ts.map +1 -1
  45. package/build/utils/index.js +6 -0
  46. package/build/utils/index.js.map +1 -1
  47. package/build/utils/scope.d.ts +75 -0
  48. package/build/utils/scope.d.ts.map +1 -0
  49. package/build/utils/scope.interfaces.d.ts +20 -0
  50. package/build/utils/scope.interfaces.d.ts.map +1 -0
  51. package/build/utils/scope.interfaces.js +10 -0
  52. package/build/utils/scope.interfaces.js.map +1 -0
  53. package/build/utils/scope.js +121 -0
  54. package/build/utils/scope.js.map +1 -0
  55. package/build/utils/start-service.js +1 -1
  56. package/build/utils/tenant.d.ts +98 -0
  57. package/build/utils/tenant.d.ts.map +1 -0
  58. package/build/utils/tenant.interfaces.d.ts +19 -0
  59. package/build/utils/tenant.interfaces.d.ts.map +1 -0
  60. package/build/utils/tenant.interfaces.js +9 -0
  61. package/build/utils/tenant.interfaces.js.map +1 -0
  62. package/build/utils/tenant.js +124 -0
  63. package/build/utils/tenant.js.map +1 -0
  64. package/package.json +1 -1
@@ -2,20 +2,57 @@ import { BaseRoles } from './enums';
2
2
  import { ThreatLikelihood } from './events/types/threat.enums';
3
3
  export declare const LICENSE_DATE_FORMAT = "YYYY-MM-DD";
4
4
  /**
5
- * Gruppi di ruoli, per livello (ADR-0005).
5
+ * Role groups, by tier (ADR-0005).
6
6
  *
7
- * I gruppi `SYSTEM_*`/`TENANT_*` sono **cumulativi**: ogni livello include quelli superiori.
8
- * `TENANT_ADMIN_ROLES` e successivi vanno usati nelle direttive `@auth`, ma **non bastano**:
9
- * ogni operazione su una specifica organizzazione deve passare anche da `resolveOrgScope`.
7
+ * The `SYSTEM_*`/`TENANT_*` groups are **cumulative**: every tier includes the ones above it.
8
+ * `TENANT_ADMIN_ROLES` and below belong in the `@auth` directives, but they are **never
9
+ * enough**: any operation on a SPECIFIC organization must also go through `resolveOrgScope`.
10
10
  */
11
11
  export declare const ADMIN_ROLES: BaseRoles[];
12
12
  export declare const SYSTEM_ROLES: BaseRoles[];
13
13
  export declare const TENANT_ADMIN_ROLES: BaseRoles[];
14
14
  export declare const TENANT_MANAGE_ROLES: BaseRoles[];
15
15
  export declare const TENANT_EDIT_ROLES: BaseRoles[];
16
- /** Ruoli di livello organizzazione: gli unici delegabili per invito o concessione (T16). */
16
+ /**
17
+ * Groups built on the **capabilities** of the ADR-0005 section 4 matrix, not by stacking tiers.
18
+ *
19
+ * They serve the **tenant application data** (assets, controls, risk analysis), where every
20
+ * cumulative group above is unusable: they all contain `APP_CONFIG`, which configures the
21
+ * application and has **no** capability whatsoever on customer data.
22
+ *
23
+ * - `CROSS_TENANT_ROLES` - operates on **any** tenant, with no organization constraint.
24
+ * - `TENANT_DATA_READ_ROLES` - reads a tenant's data (`ORG_MEMBER` included).
25
+ * - `TENANT_DATA_WRITE_ROLES` - writes it: `ORG_MEMBER` is **read-only**.
26
+ *
27
+ * Like the cumulative groups, they are **not enough**: they say *which role*, never *which
28
+ * organization*. Tenant scoping stays with `setTenant` and the model filters.
29
+ */
30
+ export declare const CROSS_TENANT_ROLES: BaseRoles[];
31
+ export declare const TENANT_DATA_WRITE_ROLES: BaseRoles[];
32
+ export declare const TENANT_DATA_READ_ROLES: BaseRoles[];
33
+ /**
34
+ * Groups for the capabilities on the **organization as a record** (registry data, members,
35
+ * invitations). Not to be confused with the `TENANT_DATA_*` above, which cover the
36
+ * **application data** of a tenant.
37
+ *
38
+ * - `ORG_MANAGE_ROLES` - manages an organization and its members: assign organization
39
+ * roles, activate/deactivate, invite, edit the registry data.
40
+ * - `ORG_READ_ROLES` - reads an organization and the list of its members.
41
+ *
42
+ * Both **exclude `APP_CONFIG`**, which in the ADR-0005 section 4 matrix has a dash on the
43
+ * whole organization row: it configures the application, not the customers. That does
44
+ * **not** stop it from seeing its **own** organization (`main`): that access does not come
45
+ * from the `APP_CONFIG` role but from the organization role it holds as a member - roles
46
+ * sum, and `resolveOrgScope` resolves it on the membership branch.
47
+ *
48
+ * Like all the others, they say *which role* and are **not enough**: any operation on a
49
+ * specific organization must also go through `resolveOrgScope`.
50
+ */
51
+ export declare const ORG_MANAGE_ROLES: BaseRoles[];
52
+ export declare const ORG_READ_ROLES: BaseRoles[];
53
+ /** Organization-tier roles: the only ones delegable by invitation or grant (T16). */
17
54
  export declare const ORG_MEMBER_ROLES: BaseRoles[];
18
- /** Ruoli di livello provider: trasversali ai tenant, assegnabili solo dal livello sistema. */
55
+ /** Provider-tier roles: cross-tenant by nature, assignable from the system tier alone. */
19
56
  export declare const APP_ROLES: BaseRoles[];
20
57
  /**
21
58
  * Application response codes returned in API/GraphQL error payloads.
@@ -170,4 +207,17 @@ export declare const GDPR_DEFAULTS: {
170
207
  THREAT_CAPACITY_LEVEL: number;
171
208
  THREAT_CAPACITY_MAX_LEVEL: number;
172
209
  };
210
+ /**
211
+ * Transport of the organization selected by the caller.
212
+ *
213
+ * OUT OF BAND on purpose: a request names its organization through this header
214
+ * (or through the homonymous WebSocket connection param), never through the
215
+ * payload. A `tenantId` carried inside a mutation input would be forgeable by
216
+ * any client, which is exactly the hole T34 closes.
217
+ *
218
+ * Read once where the context is built; from there on it lives on
219
+ * `NxContext.orgId` and is only ever consumed through `resolveTenant`.
220
+ */
221
+ export declare const ORG_ID_HEADER = "X-Org-Id";
222
+ export declare const ORG_ID_PARAM = "orgId";
173
223
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAa,SAAS,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,aAAuD,CAAC;AAChF,eAAO,MAAM,YAAY,aAA2D,CAAC;AACrF,eAAO,MAAM,kBAA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O,MAAM,gBAAgB,aAA8D,CAAC;AAC5F,eAAO,MAAM,cAAc,aAAqF,CAAC;AAEjH,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,aAAiF,CAAC;AAE/G,0FAA0F;AAC1F,eAAO,MAAM,SAAS,aAAsE,CAAC;AAE7F;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAapB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;CAmBzB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;CAmB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiB3B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CAezB,CAAC;AAMF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,YAAY,UAAW,CAAC"}
@@ -1,24 +1,61 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GDPR_DEFAULTS = exports.N22301_DEFAULTS = exports.N20000_DEFAULTS = exports.N27001_DEFAULTS = exports.FNSC_DEFAULTS = exports.RES_CODE = exports.APP_ROLES = exports.ORG_MEMBER_ROLES = exports.TENANT_EDIT_ROLES = exports.TENANT_MANAGE_ROLES = exports.TENANT_ADMIN_ROLES = exports.SYSTEM_ROLES = exports.ADMIN_ROLES = exports.LICENSE_DATE_FORMAT = void 0;
3
+ exports.ORG_ID_PARAM = exports.ORG_ID_HEADER = exports.GDPR_DEFAULTS = exports.N22301_DEFAULTS = exports.N20000_DEFAULTS = exports.N27001_DEFAULTS = exports.FNSC_DEFAULTS = exports.RES_CODE = exports.APP_ROLES = exports.ORG_MEMBER_ROLES = exports.ORG_READ_ROLES = exports.ORG_MANAGE_ROLES = exports.TENANT_DATA_READ_ROLES = exports.TENANT_DATA_WRITE_ROLES = exports.CROSS_TENANT_ROLES = exports.TENANT_EDIT_ROLES = exports.TENANT_MANAGE_ROLES = exports.TENANT_ADMIN_ROLES = exports.SYSTEM_ROLES = exports.ADMIN_ROLES = exports.LICENSE_DATE_FORMAT = void 0;
4
4
  const enums_1 = require("./enums");
5
5
  const threat_enums_1 = require("./events/types/threat.enums");
6
6
  exports.LICENSE_DATE_FORMAT = 'YYYY-MM-DD';
7
7
  /**
8
- * Gruppi di ruoli, per livello (ADR-0005).
8
+ * Role groups, by tier (ADR-0005).
9
9
  *
10
- * I gruppi `SYSTEM_*`/`TENANT_*` sono **cumulativi**: ogni livello include quelli superiori.
11
- * `TENANT_ADMIN_ROLES` e successivi vanno usati nelle direttive `@auth`, ma **non bastano**:
12
- * ogni operazione su una specifica organizzazione deve passare anche da `resolveOrgScope`.
10
+ * The `SYSTEM_*`/`TENANT_*` groups are **cumulative**: every tier includes the ones above it.
11
+ * `TENANT_ADMIN_ROLES` and below belong in the `@auth` directives, but they are **never
12
+ * enough**: any operation on a SPECIFIC organization must also go through `resolveOrgScope`.
13
13
  */
14
14
  exports.ADMIN_ROLES = [enums_1.BaseRoles.SADMIN, enums_1.BaseRoles.ADMIN];
15
15
  exports.SYSTEM_ROLES = [...exports.ADMIN_ROLES, enums_1.BaseRoles.APP_CONFIG];
16
16
  exports.TENANT_ADMIN_ROLES = [...exports.SYSTEM_ROLES, enums_1.BaseRoles.APP_TENANT_MNG];
17
17
  exports.TENANT_MANAGE_ROLES = [...exports.TENANT_ADMIN_ROLES, enums_1.BaseRoles.ORG_MANAGER];
18
18
  exports.TENANT_EDIT_ROLES = [...exports.TENANT_MANAGE_ROLES, enums_1.BaseRoles.ORG_EDITOR];
19
- /** Ruoli di livello organizzazione: gli unici delegabili per invito o concessione (T16). */
19
+ /**
20
+ * Groups built on the **capabilities** of the ADR-0005 section 4 matrix, not by stacking tiers.
21
+ *
22
+ * They serve the **tenant application data** (assets, controls, risk analysis), where every
23
+ * cumulative group above is unusable: they all contain `APP_CONFIG`, which configures the
24
+ * application and has **no** capability whatsoever on customer data.
25
+ *
26
+ * - `CROSS_TENANT_ROLES` - operates on **any** tenant, with no organization constraint.
27
+ * - `TENANT_DATA_READ_ROLES` - reads a tenant's data (`ORG_MEMBER` included).
28
+ * - `TENANT_DATA_WRITE_ROLES` - writes it: `ORG_MEMBER` is **read-only**.
29
+ *
30
+ * Like the cumulative groups, they are **not enough**: they say *which role*, never *which
31
+ * organization*. Tenant scoping stays with `setTenant` and the model filters.
32
+ */
33
+ exports.CROSS_TENANT_ROLES = [...exports.ADMIN_ROLES, enums_1.BaseRoles.APP_TENANT_MNG];
34
+ exports.TENANT_DATA_WRITE_ROLES = [...exports.CROSS_TENANT_ROLES, enums_1.BaseRoles.ORG_MANAGER, enums_1.BaseRoles.ORG_EDITOR];
35
+ exports.TENANT_DATA_READ_ROLES = [...exports.TENANT_DATA_WRITE_ROLES, enums_1.BaseRoles.ORG_MEMBER];
36
+ /**
37
+ * Groups for the capabilities on the **organization as a record** (registry data, members,
38
+ * invitations). Not to be confused with the `TENANT_DATA_*` above, which cover the
39
+ * **application data** of a tenant.
40
+ *
41
+ * - `ORG_MANAGE_ROLES` - manages an organization and its members: assign organization
42
+ * roles, activate/deactivate, invite, edit the registry data.
43
+ * - `ORG_READ_ROLES` - reads an organization and the list of its members.
44
+ *
45
+ * Both **exclude `APP_CONFIG`**, which in the ADR-0005 section 4 matrix has a dash on the
46
+ * whole organization row: it configures the application, not the customers. That does
47
+ * **not** stop it from seeing its **own** organization (`main`): that access does not come
48
+ * from the `APP_CONFIG` role but from the organization role it holds as a member - roles
49
+ * sum, and `resolveOrgScope` resolves it on the membership branch.
50
+ *
51
+ * Like all the others, they say *which role* and are **not enough**: any operation on a
52
+ * specific organization must also go through `resolveOrgScope`.
53
+ */
54
+ exports.ORG_MANAGE_ROLES = [...exports.CROSS_TENANT_ROLES, enums_1.BaseRoles.ORG_MANAGER];
55
+ exports.ORG_READ_ROLES = [...exports.ORG_MANAGE_ROLES, enums_1.BaseRoles.ORG_EDITOR, enums_1.BaseRoles.ORG_MEMBER];
56
+ /** Organization-tier roles: the only ones delegable by invitation or grant (T16). */
20
57
  exports.ORG_MEMBER_ROLES = [enums_1.BaseRoles.ORG_MANAGER, enums_1.BaseRoles.ORG_EDITOR, enums_1.BaseRoles.ORG_MEMBER];
21
- /** Ruoli di livello provider: trasversali ai tenant, assegnabili solo dal livello sistema. */
58
+ /** Provider-tier roles: cross-tenant by nature, assignable from the system tier alone. */
22
59
  exports.APP_ROLES = [enums_1.BaseRoles.APP_CONFIG, enums_1.BaseRoles.APP_TENANT_MNG];
23
60
  /**
24
61
  * Application response codes returned in API/GraphQL error payloads.
@@ -137,4 +174,17 @@ exports.GDPR_DEFAULTS = {
137
174
  THREAT_CAPACITY_LEVEL: 2,
138
175
  THREAT_CAPACITY_MAX_LEVEL: 4,
139
176
  };
177
+ /**
178
+ * Transport of the organization selected by the caller.
179
+ *
180
+ * OUT OF BAND on purpose: a request names its organization through this header
181
+ * (or through the homonymous WebSocket connection param), never through the
182
+ * payload. A `tenantId` carried inside a mutation input would be forgeable by
183
+ * any client, which is exactly the hole T34 closes.
184
+ *
185
+ * Read once where the context is built; from there on it lives on
186
+ * `NxContext.orgId` and is only ever consumed through `resolveTenant`.
187
+ */
188
+ exports.ORG_ID_HEADER = 'X-Org-Id';
189
+ exports.ORG_ID_PARAM = 'orgId';
140
190
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAC3C,8DAA+D;AAElD,QAAA,mBAAmB,GAAG,YAAY,CAAC;AAEhD;;;;;;GAMG;AACU,QAAA,WAAW,GAAW,CAAC,iBAAS,CAAC,MAAM,EAAW,iBAAS,CAAC,KAAK,CAAC,CAAC;AACnE,QAAA,YAAY,GA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,CAAC;IAClC,yBAAyB,EAAQ,CAAC;CACnC,CAAC;AAMF;;;;;;;;;;GAUG;AACU,QAAA,aAAa,GAAG,UAAU,CAAC;AAC3B,QAAA,YAAY,GAAI,OAAO,CAAC"}
package/build/enums.d.ts CHANGED
@@ -54,6 +54,22 @@ export declare enum RolesType {
54
54
  ORG = "org",
55
55
  APP = "app"
56
56
  }
57
+ /**
58
+ * How a user reaches a given organization (ADR-0005 section 5).
59
+ *
60
+ * - `PROVIDER` cross-tenant tier (`CROSS_TENANT_ROLES`): reaches **every** organization
61
+ * by definition of tier, so no organization role applies
62
+ * - `MEMBER` membership (`organizations[]`): the role is the highest organization
63
+ * role the user holds
64
+ * - `GRANTED` grant (`grants[]`): the role is the one carried **by the grant**, so the
65
+ * same user can be `ORG_MANAGER` on one organization and `ORG_EDITOR` on
66
+ * another
67
+ */
68
+ export declare enum OrgScopeTier {
69
+ PROVIDER = "provider",
70
+ MEMBER = "member",
71
+ GRANTED = "granted"
72
+ }
57
73
  export declare enum UserCrudEventType {
58
74
  addRole = "addRole",
59
75
  removeRole = "removeRole",
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY;IACtB,eAAe,oBAAsB;IACrC,gBAAgB,qBAAsB;IACtC,eAAe,oBAAsB;IACrC,eAAe,oBAAsB;IACrC,gBAAgB,qBAAsB;IACtC,kBAAkB,uBAAsB;IACxC,YAAY,iBAAsB;IAClC,aAAa,kBAAsB;IACnC,YAAY,iBAAsB;CACnC;AAED,oBAAY,gBAAgB;IAC1B,IAAI,SAAY;IAChB,OAAO,SAAS;IAChB,KAAK,UAAY;IACjB,KAAK,UAAY;CAClB;AAED,oBAAY,UAAU;IACpB,IAAI,SAAW;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,GAAG,WAAc;CAClB;AAED,oBAAY,YAAY;IACtB,cAAc,iBAAkB;IAChC,eAAe,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oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED;;;;;;;;;;GAUG;AACH,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,MAAM,WAAa;IACnB,OAAO,YAAa;CACrB;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAuB;IAC9B,UAAU,eAAuB;IACjC,eAAe,oBAAuB;IACtC,kBAAkB,uBAAuB;IACzC,QAAQ,aAAuB;CAChC"}
package/build/enums.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserCrudEventType = exports.RolesType = exports.BaseRoles = exports.LOGIN_ERRORS = exports.AuthIssuer = exports.SecurityLogLevel = exports.SecurityLogs = void 0;
3
+ exports.UserCrudEventType = exports.OrgScopeTier = exports.RolesType = exports.BaseRoles = exports.LOGIN_ERRORS = exports.AuthIssuer = exports.SecurityLogLevel = exports.SecurityLogs = void 0;
4
4
  /**
5
5
  * Identifiers for security-audit log events (login outcomes, password changes).
6
6
  */
@@ -63,6 +63,23 @@ var RolesType;
63
63
  RolesType["ORG"] = "org";
64
64
  RolesType["APP"] = "app";
65
65
  })(RolesType || (exports.RolesType = RolesType = {}));
66
+ /**
67
+ * How a user reaches a given organization (ADR-0005 section 5).
68
+ *
69
+ * - `PROVIDER` cross-tenant tier (`CROSS_TENANT_ROLES`): reaches **every** organization
70
+ * by definition of tier, so no organization role applies
71
+ * - `MEMBER` membership (`organizations[]`): the role is the highest organization
72
+ * role the user holds
73
+ * - `GRANTED` grant (`grants[]`): the role is the one carried **by the grant**, so the
74
+ * same user can be `ORG_MANAGER` on one organization and `ORG_EDITOR` on
75
+ * another
76
+ */
77
+ var OrgScopeTier;
78
+ (function (OrgScopeTier) {
79
+ OrgScopeTier["PROVIDER"] = "provider";
80
+ OrgScopeTier["MEMBER"] = "member";
81
+ OrgScopeTier["GRANTED"] = "granted";
82
+ })(OrgScopeTier || (exports.OrgScopeTier = OrgScopeTier = {}));
66
83
  var UserCrudEventType;
67
84
  (function (UserCrudEventType) {
68
85
  UserCrudEventType["addRole"] = "addRole";
@@ -1 +1 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,YAUX;AAVD,WAAY,YAAY;IACtB,mDAAqC,CAAA;IACrC,qDAAsC,CAAA;IACtC,mDAAqC,CAAA;IACrC,mDAAqC,CAAA;IACrC,qDAAsC,CAAA;IACtC,yDAAwC,CAAA;IACxC,6CAAkC,CAAA;IAClC,+CAAmC,CAAA;IACnC,6CAAkC,CAAA;AACpC,CAAC,EAVW,YAAY,4BAAZ,YAAY,QAUvB;AAED,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,iCAAgB,CAAA;IAChB,oCAAgB,CAAA;IAChB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAED,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,2BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,4BAAiB,CAAA;AACnB,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,+CAAgC,CAAA;IAChC,iDAAiC,CAAA;IACjC,4CAA+B,CAAA;IAC/B,mCAA2B,CAAA;AAC7B,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;;;;;;;;;GAUG;AACH,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,kCAA6B,CAAA;IAC7B,4BAAwB,CAAA;IACxB,sCAA6B,CAAA;IAC7B,8CAAiC,CAAA;IACjC,wCAA8B,CAAA;IAC9B,sCAA6B,CAAA;IAC7B,sCAA6B,CAAA;AAC/B,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAA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jC,wCAA8B,CAAA;IAC9B,sCAA6B,CAAA;IAC7B,sCAA6B,CAAA;AAC/B,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;AACb,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED;;;;;;;;;;GAUG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,iCAAmB,CAAA;IACnB,mCAAoB,CAAA;AACtB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,wCAA8B,CAAA;IAC9B,8CAAiC,CAAA;IACjC,wDAAsC,CAAA;IACtC,8DAAyC,CAAA;IACzC,0CAA+B,CAAA;AACjC,CAAC,EANW,iBAAiB,iCAAjB,iBAAiB,QAM5B"}
@@ -36,7 +36,7 @@ export declare abstract class BaseEventCtrl<TCreate extends Event, TUpdate exten
36
36
  /**
37
37
  * All publishers this controller owns (create + update + remove). Read LAZILY by
38
38
  * the relay's publisher registry to route a `sent:false` outbox row back to its
39
- * publisher family by subject — so it runs after the subclass field initialisers.
39
+ * publisher family by subject — so it runs after the subclass field initializers.
40
40
  */
41
41
  eventPublishers(): IPublisher<Event>[];
42
42
  private publishConfig?;
@@ -47,7 +47,7 @@ class BaseEventCtrl extends base_controller_1.BaseController {
47
47
  /**
48
48
  * All publishers this controller owns (create + update + remove). Read LAZILY by
49
49
  * the relay's publisher registry to route a `sent:false` outbox row back to its
50
- * publisher family by subject — so it runs after the subclass field initialisers.
50
+ * publisher family by subject — so it runs after the subclass field initializers.
51
51
  */
52
52
  eventPublishers() {
53
53
  return [...this.createPublisher, ...this.updatePublisher, ...this.removePublisher];
@@ -28,7 +28,7 @@ export declare abstract class MsgListener<T extends Event> extends Listener<T> {
28
28
  /**
29
29
  * Drains the in-memory message stack one message at a time.
30
30
  *
31
- * A `wait` flag serialises processing so messages are handled strictly in FIFO
31
+ * A `wait` flag serializes processing so messages are handled strictly in FIFO
32
32
  * order; the method re-invokes itself until the stack is empty.
33
33
  */
34
34
  checkMessages(): Promise<void>;
@@ -46,7 +46,7 @@ class MsgListener extends base_listener_1.Listener {
46
46
  /**
47
47
  * Drains the in-memory message stack one message at a time.
48
48
  *
49
- * A `wait` flag serialises processing so messages are handled strictly in FIFO
49
+ * A `wait` flag serializes processing so messages are handled strictly in FIFO
50
50
  * order; the method re-invokes itself until the stack is empty.
51
51
  */
52
52
  async checkMessages() {
@@ -11,7 +11,7 @@ export declare function registerPublisherProvider(provider: PublisherProvider):
11
11
  /**
12
12
  * All registered publishers whose `subject` matches, gathered across every
13
13
  * provider. Read lazily at call time, so a provider registered in a constructor
14
- * (before its publisher fields are initialised) still resolves correctly later.
14
+ * (before its publisher fields are initialized) still resolves correctly later.
15
15
  *
16
16
  * @param subject
17
17
  */
@@ -6,8 +6,8 @@
6
6
  * concrete publisher lives PER-CONTROLLER (create/update/removePublisher on each
7
7
  * BaseEventCtrl). A controller registers ITSELF as a provider in its constructor;
8
8
  * the relay later asks `resolvePublishers(subject)`, which reads each provider's
9
- * `eventPublishers()` LAZILY — so it runs at relay-time (fields initialised), not
10
- * at construction-time (subclass field initialisers run AFTER super()).
9
+ * `eventPublishers()` LAZILY — so it runs at relay-time (fields initialized), not
10
+ * at construction-time (subclass field initializers run AFTER super()).
11
11
  * ──────────────────────────────────────────────────────────────────────────── */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.registerPublisherProvider = registerPublisherProvider;
@@ -27,7 +27,7 @@ function registerPublisherProvider(provider) {
27
27
  /**
28
28
  * All registered publishers whose `subject` matches, gathered across every
29
29
  * provider. Read lazily at call time, so a provider registered in a constructor
30
- * (before its publisher fields are initialised) still resolves correctly later.
30
+ * (before its publisher fields are initialized) still resolves correctly later.
31
31
  *
32
32
  * @param subject
33
33
  */
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * In-memory + best-effort BY DESIGN: it is an OPTIMISATION on top of the short
13
13
  * TTL, never a correctness dependency. If the broker is down or an entry is lost
14
- * (process restart without replay) the behaviour degrades gracefully to the
14
+ * (process restart without replay) the behavior degrades gracefully to the
15
15
  * opzione-C baseline (≤ 1 access TTL of staleness). Entries auto-expire once the
16
16
  * revoked token could no longer be presented, so the map cannot grow unbounded.
17
17
  * ──────────────────────────────────────────────────────────────────────────── */
@@ -24,7 +24,7 @@ export declare class NatsClientManager extends EventEmitter implements MsgClient
24
24
  /** Local `subs` map key for a consumer on a stream. */
25
25
  private subKey;
26
26
  /**
27
- * Connect to NATS and initialise the JetStream client + manager from the
27
+ * Connect to NATS and initialize the JetStream client + manager from the
28
28
  * `servers`/`clientName` passed at construction. No-op when no server is
29
29
  * configured (msg-only mode), so the transport can stay optional.
30
30
  */
@@ -44,7 +44,7 @@ class NatsClientManager extends node_events_1.EventEmitter {
44
44
  return `${streamName}.${consumerName}`;
45
45
  }
46
46
  /**
47
- * Connect to NATS and initialise the JetStream client + manager from the
47
+ * Connect to NATS and initialize the JetStream client + manager from the
48
48
  * `servers`/`clientName` passed at construction. No-op when no server is
49
49
  * configured (msg-only mode), so the transport can stay optional.
50
50
  */
package/build/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './types/express-session';
2
2
  export * from './types/base-user';
3
3
  export * from './types/app-config';
4
+ export * from './types/nx-context';
4
5
  export * from './constants';
5
6
  export * from './enums';
6
7
  export * from './events';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
package/build/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./types/express-session"), exports);
18
18
  __exportStar(require("./types/base-user"), exports);
19
19
  __exportStar(require("./types/app-config"), exports);
20
+ __exportStar(require("./types/nx-context"), exports);
20
21
  __exportStar(require("./constants"), exports);
21
22
  __exportStar(require("./enums"), exports);
22
23
  __exportStar(require("./events"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,oDAAkC;AAClC,qDAAmC;AAEnC,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,oDAAkC;AAClC,qDAAmC;AACnC,qDAAmC;AAEnC,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB"}
@@ -1,5 +1,5 @@
1
1
  import { BaseDBItem, BaseUser, ModelCrudEventType, NxTypeObject } from '@nextage/nx-frame-be';
2
- import { SecurityLogLevel, UserCrudEventType } from './enums';
2
+ import { BaseRoles, SecurityLogLevel, UserCrudEventType } from './enums';
3
3
  export type NxCallback<T> = (err: Error | null, res?: T) => void;
4
4
  /**
5
5
  * Payload recorded by the security logger for an auditable event.
@@ -24,6 +24,26 @@ export interface BaseEntity extends BaseDBItem {
24
24
  name?: string;
25
25
  version?: number;
26
26
  }
27
+ /**
28
+ * A GRANT: "on this organization you hold this role" (ADR-0005 section 3).
29
+ *
30
+ * Grants are AUTHORIZATION, deliberately kept apart from MEMBERSHIP
31
+ * (`users.organizations[]`, exactly one entry, which is IDENTITY):
32
+ *
33
+ * - membership -> drives the account lifecycle and CONSUMES license slots;
34
+ * - grant -> zero or more, consumes NO slot, is NOT membership.
35
+ *
36
+ * `role` is restricted to `ORG_MEMBER_ROLES`: system and `APP_*` roles are
37
+ * cross-tenant by definition, so granting one on a single organization would be
38
+ * meaningless. The same user may therefore be ORG_MANAGER on one organization
39
+ * and ORG_EDITOR on another.
40
+ *
41
+ * `id`/`code`/`name` are denormalized exactly like `organizations[]`, to avoid a
42
+ * join on every authorization check; `organization` stays the source of truth.
43
+ */
44
+ export interface OrgGrant extends BaseEntity {
45
+ role: BaseRoles;
46
+ }
27
47
  /**
28
48
  * Base shape for a versioned MongoDB entity whose `name`/`description` are
29
49
  * internationalised (per-language map or plain string).
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAyB,SAAS,CAAC;AAEjF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,IAAI,CAAA;AAEhE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAI,MAAM,CAAC;IACjB,MAAM,EAAI,MAAM,CAAC;IACjB,MAAM,EAAI,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAI,gBAAgB,CAAC;CAC5B;AAED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W,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC5C,OAAO,CAAC,EAAM,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAM,MAAM,CAAC;IACnB,IAAI,EAAQ,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAK,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAW,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,GAAG,CAAC,EAAa,MAAM,CAAC;IACxB,MAAM,CAAC,EAAU,MAAM,CAAC;IACxB,MAAM,CAAC,EAAU,MAAM,CAAC;IACxB,MAAM,CAAC,EAAU,MAAM,CAAC;IACxB,OAAO,CAAC,EAAS,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAG,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAOD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAW,QAAQ,CAAC;IACzB,OAAO,CAAC,EAAQ,GAAG,CAAC;IACpB,OAAO,CAAC,EAAQ,kBAAkB,GAAG,iBAAiB,CAAC;IACvD,SAAS,CAAC,EAAM,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -1,7 +1,8 @@
1
- import { BaseEntity } from '../../interfaces';
1
+ import { BaseEntity, OrgGrant } from '../../interfaces';
2
2
  declare module '@nextage/nx-frame-be' {
3
3
  interface BaseUser {
4
4
  organizations?: BaseEntity[];
5
+ grants?: OrgGrant[];
5
6
  }
6
7
  }
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/base-user/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC;KAC9B;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/base-user/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAKhB,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC;QAI7B,MAAM,CAAC,EAAS,QAAQ,EAAE,CAAC;KAC5B;CACF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Request context augmentation.
3
+ *
4
+ * The organization a request operates on is a property OF THE REQUEST, not of the
5
+ * payload: it travels out of band (`X-Org-Id` header over HTTP, `orgId` in the
6
+ * WebSocket connection params) and is resolved once, where the context is built.
7
+ *
8
+ * Keeping it here rather than inside every input type is what makes T34 fixable at
9
+ * all: a single field the models read through `setTenant`, instead of a `tenantId`
10
+ * repeated across mutation inputs and therefore forgeable by any client.
11
+ */
12
+ declare module '@nextage/nx-frame-be' {
13
+ interface NxContext {
14
+ orgId?: string;
15
+ }
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=nx-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-context.d.ts","sourceRoot":"","sources":["../../src/types/nx-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,SAAS;QAIjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;CACF;AAED,OAAO,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * Request context augmentation.
4
+ *
5
+ * The organization a request operates on is a property OF THE REQUEST, not of the
6
+ * payload: it travels out of band (`X-Org-Id` header over HTTP, `orgId` in the
7
+ * WebSocket connection params) and is resolved once, where the context is built.
8
+ *
9
+ * Keeping it here rather than inside every input type is what makes T34 fixable at
10
+ * all: a single field the models read through `setTenant`, instead of a `tenantId`
11
+ * repeated across mutation inputs and therefore forgeable by any client.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ //# sourceMappingURL=nx-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-context.js","sourceRoot":"","sources":["../../src/types/nx-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,42 @@
1
+ /*********************************************************************************************
2
+ * *
3
+ * Identity claims - the SINGLE definition of what identity travels inside an access token. *
4
+ * *
5
+ * Two operations, kept together on purpose because they MUST stay each other's inverse: *
6
+ * *
7
+ * buildAuthClaims - auth-srv, when signing a token (login and refresh); *
8
+ * identityFromClaims - every resource service, when rebuilding the caller per request. *
9
+ * *
10
+ * They used to be four hand-written literals across two services. A drift between them is *
11
+ * not a cosmetic bug: a claim that is written but not read means the authorization data *
12
+ * silently disappears, and the checks that depend on it fail OPEN or CLOSED at random. *
13
+ * *
14
+ * NOTE: resource services do NOT re-read the user from the database - they trust these *
15
+ * claims (ADR-0005 section 5.1). Revoking a grant therefore takes effect only after the *
16
+ * token is refreshed: a declared property, bounded by the access-token TTL. *
17
+ * *
18
+ *********************************************************************************************/
19
+ import { BaseUser } from '@nextage/nx-frame-be';
20
+ import { AuthClaims, ClaimIdentity } from './claims.interfaces';
21
+ /**
22
+ * Builds the identity claims to embed in an access token.
23
+ *
24
+ * `grn` is omitted entirely when the user holds no grant, so the common case adds
25
+ * nothing to the token.
26
+ *
27
+ * @param user the user the token is being issued for, as read from the database
28
+ * @returns the identity claims to sign
29
+ */
30
+ export declare function buildAuthClaims(user: Partial<BaseUser>): AuthClaims;
31
+ /**
32
+ * Rebuilds the caller's identity from the claims of a verified token.
33
+ *
34
+ * Tolerant of a MISSING key but never of a malformed one: an older token issued
35
+ * before grants existed simply yields an empty list, whereas an entry without an
36
+ * `id` or a `role` is dropped rather than trusted half-formed.
37
+ *
38
+ * @param data the `data` payload of the verified access token
39
+ * @returns roles, memberships and grants, shaped as the `BaseUser` augmentation
40
+ */
41
+ export declare function identityFromClaims(data?: Partial<AuthClaims>): ClaimIdentity;
42
+ //# sourceMappingURL=claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/utils/claims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;+FAiB+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,MAAuB,sBAAsB,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,UAAU,CAWnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,aAAa,CAS5E"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * JWT identity-claim types (ADR-0005 section 5.1).
3
+ *
4
+ * Kept separate from the logic in `claims.ts` (house-style: types live in a
5
+ * dedicated `*.interfaces.ts`, never mixed with the logic that consumes them).
6
+ */
7
+ import { BaseRoles } from '../enums';
8
+ import { BaseEntity, OrgGrant } from '../interfaces';
9
+ /**
10
+ * A grant as it travels INSIDE the token.
11
+ *
12
+ * Only `id` and `role` are carried: they are all authorization needs. The
13
+ * denormalized `code`/`name` exist for the UI and are re-read from the database
14
+ * when displayed, so keeping them out bounds the token size as grants grow.
15
+ */
16
+ export interface GrantClaim {
17
+ id: string;
18
+ role: BaseRoles;
19
+ }
20
+ /**
21
+ * The identity portion of the access-token payload.
22
+ *
23
+ * Deliberately terse: these keys are repeated in every request. `rls` and `orgs`
24
+ * predate this ADR and keep their historic names and shapes.
25
+ */
26
+ export interface AuthClaims {
27
+ rls: string[];
28
+ orgs: string[];
29
+ grn?: GrantClaim[];
30
+ }
31
+ /**
32
+ * The identity rebuilt from a token by a resource service.
33
+ *
34
+ * Mirrors the fields the `BaseUser` augmentation adds, so the result can be spread
35
+ * straight onto the user stand-in a resource service builds per request.
36
+ */
37
+ export interface ClaimIdentity {
38
+ roles: string[];
39
+ organizations: BaseEntity[];
40
+ grants: OrgGrant[];
41
+ }
42
+ //# sourceMappingURL=claims.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claims.interfaces.d.ts","sourceRoot":"","sources":["../../src/utils/claims.interfaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAiB,UAAU,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAI,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAG,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAU,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,MAAM,EAAS,QAAQ,EAAE,CAAC;CAC3B"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * JWT identity-claim types (ADR-0005 section 5.1).
4
+ *
5
+ * Kept separate from the logic in `claims.ts` (house-style: types live in a
6
+ * dedicated `*.interfaces.ts`, never mixed with the logic that consumes them).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=claims.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claims.interfaces.js","sourceRoot":"","sources":["../../src/utils/claims.interfaces.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}