@nextage/era-lib 1.0.191 → 1.0.193

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 (59) hide show
  1. package/build/constants.d.ts +48 -15
  2. package/build/constants.d.ts.map +1 -1
  3. package/build/constants.js +49 -16
  4. package/build/constants.js.map +1 -1
  5. package/build/enums.d.ts +26 -2
  6. package/build/enums.d.ts.map +1 -1
  7. package/build/enums.js +27 -2
  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 +50 -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 +36 -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 +64 -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 +3 -3
  40. package/build/utils/functs.js +3 -3
  41. package/build/utils/index.d.ts +4 -0
  42. package/build/utils/index.d.ts.map +1 -1
  43. package/build/utils/index.js +4 -0
  44. package/build/utils/index.js.map +1 -1
  45. package/build/utils/scope.d.ts +75 -0
  46. package/build/utils/scope.d.ts.map +1 -0
  47. package/build/utils/scope.interfaces.d.ts +20 -0
  48. package/build/utils/scope.interfaces.d.ts.map +1 -0
  49. package/build/utils/scope.interfaces.js +10 -0
  50. package/build/utils/scope.interfaces.js.map +1 -0
  51. package/build/utils/scope.js +121 -0
  52. package/build/utils/scope.js.map +1 -0
  53. package/build/utils/start-service.js +1 -1
  54. package/build/utils/tenant.d.ts +71 -38
  55. package/build/utils/tenant.d.ts.map +1 -1
  56. package/build/utils/tenant.interfaces.d.ts +5 -5
  57. package/build/utils/tenant.js +83 -54
  58. package/build/utils/tenant.js.map +1 -1
  59. package/package.json +1 -1
@@ -2,11 +2,11 @@ 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[];
@@ -14,25 +14,45 @@ 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
16
  /**
17
- * Gruppi costruiti sulle **capability** della matrice ADR-0005 §4, non per accumulo di livelli.
17
+ * Groups built on the **capabilities** of the ADR-0005 section 4 matrix, not by stacking tiers.
18
18
  *
19
- * Servono ai **dati applicativi dei tenant** (asset, controlli, analisi di rischio), dove i
20
- * gruppi cumulativi qui sopra sono tutti inadatti: includono `APP_CONFIG`, che configura
21
- * l'applicativo e **non** ha alcuna capability sui dati dei clienti.
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
22
  *
23
- * - `CROSS_TENANT_ROLES` — chi opera su **qualunque** tenant senza vincolo di organizzazione.
24
- * - `TENANT_DATA_READ_ROLES` — chi legge i dati di un tenant (`ORG_MEMBER` incluso).
25
- * - `TENANT_DATA_WRITE_ROLES` — chi li modifica: `ORG_MEMBER` è in **sola lettura**.
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
26
  *
27
- * ⚠️ Come i gruppi cumulativi, **non bastano**: dicono *quale ruolo*, non *quale organizzazione*.
28
- * Lo scoping del tenant resta a carico di `setTenant` e dei filtri del modello.
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
29
  */
30
30
  export declare const CROSS_TENANT_ROLES: BaseRoles[];
31
31
  export declare const TENANT_DATA_WRITE_ROLES: BaseRoles[];
32
32
  export declare const TENANT_DATA_READ_ROLES: BaseRoles[];
33
- /** Ruoli di livello organizzazione: gli unici delegabili per invito o concessione (T16). */
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). */
34
54
  export declare const ORG_MEMBER_ROLES: BaseRoles[];
35
- /** 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. */
36
56
  export declare const APP_ROLES: BaseRoles[];
37
57
  /**
38
58
  * Application response codes returned in API/GraphQL error payloads.
@@ -187,4 +207,17 @@ export declare const GDPR_DEFAULTS: {
187
207
  THREAT_CAPACITY_LEVEL: number;
188
208
  THREAT_CAPACITY_MAX_LEVEL: number;
189
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";
190
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,kBAAkB,aAAyD,CAAC;AACzF,eAAO,MAAM,mBAAmB,aAAqD,CAAC;AACtF,eAAO,MAAM,iBAAiB,aAAsD,CAAC;AAErF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,aAA+D,CAAC;AAC/F,eAAO,MAAM,uBAAuB,aAA6E,CAAC;AAClH,eAAO,MAAM,sBAAsB,aAAuD,CAAC;AAE3F,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,aAA6E,CAAC;AAE3G,8FAA8F;AAC9F,eAAO,MAAM,SAAS,aAAkE,CAAC;AAEzF;;;;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"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,M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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_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;
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];
@@ -17,25 +17,45 @@ exports.TENANT_ADMIN_ROLES = [...exports.SYSTEM_ROLES, enums_1.BaseRoles.APP_TEN
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
19
  /**
20
- * Gruppi costruiti sulle **capability** della matrice ADR-0005 §4, non per accumulo di livelli.
20
+ * Groups built on the **capabilities** of the ADR-0005 section 4 matrix, not by stacking tiers.
21
21
  *
22
- * Servono ai **dati applicativi dei tenant** (asset, controlli, analisi di rischio), dove i
23
- * gruppi cumulativi qui sopra sono tutti inadatti: includono `APP_CONFIG`, che configura
24
- * l'applicativo e **non** ha alcuna capability sui dati dei clienti.
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
25
  *
26
- * - `CROSS_TENANT_ROLES` — chi opera su **qualunque** tenant senza vincolo di organizzazione.
27
- * - `TENANT_DATA_READ_ROLES` — chi legge i dati di un tenant (`ORG_MEMBER` incluso).
28
- * - `TENANT_DATA_WRITE_ROLES` — chi li modifica: `ORG_MEMBER` è in **sola lettura**.
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
29
  *
30
- * ⚠️ Come i gruppi cumulativi, **non bastano**: dicono *quale ruolo*, non *quale organizzazione*.
31
- * Lo scoping del tenant resta a carico di `setTenant` e dei filtri del modello.
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
32
  */
33
33
  exports.CROSS_TENANT_ROLES = [...exports.ADMIN_ROLES, enums_1.BaseRoles.APP_TENANT_MNG];
34
34
  exports.TENANT_DATA_WRITE_ROLES = [...exports.CROSS_TENANT_ROLES, enums_1.BaseRoles.ORG_MANAGER, enums_1.BaseRoles.ORG_EDITOR];
35
35
  exports.TENANT_DATA_READ_ROLES = [...exports.TENANT_DATA_WRITE_ROLES, enums_1.BaseRoles.ORG_MEMBER];
36
- /** Ruoli di livello organizzazione: gli unici delegabili per invito o concessione (T16). */
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). */
37
57
  exports.ORG_MEMBER_ROLES = [enums_1.BaseRoles.ORG_MANAGER, enums_1.BaseRoles.ORG_EDITOR, enums_1.BaseRoles.ORG_MEMBER];
38
- /** 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. */
39
59
  exports.APP_ROLES = [enums_1.BaseRoles.APP_CONFIG, enums_1.BaseRoles.APP_TENANT_MNG];
40
60
  /**
41
61
  * Application response codes returned in API/GraphQL error payloads.
@@ -154,4 +174,17 @@ exports.GDPR_DEFAULTS = {
154
174
  THREAT_CAPACITY_LEVEL: 2,
155
175
  THREAT_CAPACITY_MAX_LEVEL: 4,
156
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';
157
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,GAAU,CAAC,GAAG,mBAAW,EAAa,iBAAS,CAAC,UAAU,CAAC,CAAC;AACxE,QAAA,kBAAkB,GAAI,CAAC,GAAG,oBAAY,EAAY,iBAAS,CAAC,cAAc,CAA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BAAmB,EAAc,CAAC;IAClC,uBAAuB,EAAU,CAAC;IAClC,uBAAuB,EAAU,CAAC;IAClC,2BAA2B,EAAM,CAAC;IAClC,0BAA0B,EAAO,CAAC;IAClC,8BAA8B,EAAG,CAAC;IAClC,qBAAqB,EAAY,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
@@ -1,5 +1,11 @@
1
1
  /**
2
- * Identifiers for security-audit log events (login outcomes, password changes).
2
+ * Identifiers for security-audit log events (login outcomes, password changes,
3
+ * cross-organization grants).
4
+ *
5
+ * `orgGrantAdded`/`orgGrantRevoked` are here and not among the CRUD events on
6
+ * purpose: a grant is the only way an account reaches data OUTSIDE the
7
+ * organization it belongs to, so opening or closing one is a security event in
8
+ * the same sense a login is - and belongs to the same trail (ADR-0005 section 3).
3
9
  */
4
10
  export declare enum SecurityLogs {
5
11
  changePwdFailed = "changePwdFailed",
@@ -10,7 +16,9 @@ export declare enum SecurityLogs {
10
16
  loginUserNotActive = "loginUserNotActive",
11
17
  loginSuccess = "loginSuccess",
12
18
  loginAttempts = "loginAttempts",
13
- authRequired = "authRequired"
19
+ authRequired = "authRequired",
20
+ orgGrantAdded = "orgGrantAdded",
21
+ orgGrantRevoked = "orgGrantRevoked"
14
22
  }
15
23
  export declare enum SecurityLogLevel {
16
24
  info = "info",
@@ -54,6 +62,22 @@ export declare enum RolesType {
54
62
  ORG = "org",
55
63
  APP = "app"
56
64
  }
65
+ /**
66
+ * How a user reaches a given organization (ADR-0005 section 5).
67
+ *
68
+ * - `PROVIDER` cross-tenant tier (`CROSS_TENANT_ROLES`): reaches **every** organization
69
+ * by definition of tier, so no organization role applies
70
+ * - `MEMBER` membership (`organizations[]`): the role is the highest organization
71
+ * role the user holds
72
+ * - `GRANTED` grant (`grants[]`): the role is the one carried **by the grant**, so the
73
+ * same user can be `ORG_MANAGER` on one organization and `ORG_EDITOR` on
74
+ * another
75
+ */
76
+ export declare enum OrgScopeTier {
77
+ PROVIDER = "provider",
78
+ MEMBER = "member",
79
+ GRANTED = "granted"
80
+ }
57
81
  export declare enum UserCrudEventType {
58
82
  addRole = "addRole",
59
83
  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,kBAAkB;IACjC,YAAY,gBAAmB;IAC/B,OAAO,YAAoB;CAC5B;AAED;;;;;;;;;;GAUG;AACH,oBAAY,SAAS;IACnB,MAAM,eAAuB;IAC7B,KAAK,UAAmB;IACxB,UAAU,eAAmB;IAC7B,cAAc,mBAAmB;IACjC,WAAW,gBAAmB;IAC9B,UAAU,eAAmB;IAC7B,UAAU,eAAmB;CAC9B;AAED,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,iBAAiB;IAC3B,OAAO,YAAuB;IAC9B,UAAU,eAAuB;IACjC,eAAe,oBAAuB;IACtC,kBAAkB,uBAAuB;IACzC,QAAQ,aAAuB;CAChC"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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;IAClC,aAAa,kBAAsB;IACnC,eAAe,oBAAsB;CACtC;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,kBAAkB;IACjC,YAAY,gBAAmB;IAC/B,OAAO,YAAoB;CAC5B;AAED;;;;;;;;;;GAUG;AACH,oBAAY,SAAS;IACnB,MAAM,eAAuB;IAC7B,KAAK,UAAmB;IACxB,UAAU,eAAmB;IAC7B,cAAc,mBAAmB;IACjC,WAAW,gBAAmB;IAC9B,UAAU,eAAmB;IAC7B,UAAU,eAAmB;CAC9B;AAED,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,8 +1,14 @@
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
- * Identifiers for security-audit log events (login outcomes, password changes).
5
+ * Identifiers for security-audit log events (login outcomes, password changes,
6
+ * cross-organization grants).
7
+ *
8
+ * `orgGrantAdded`/`orgGrantRevoked` are here and not among the CRUD events on
9
+ * purpose: a grant is the only way an account reaches data OUTSIDE the
10
+ * organization it belongs to, so opening or closing one is a security event in
11
+ * the same sense a login is - and belongs to the same trail (ADR-0005 section 3).
6
12
  */
7
13
  var SecurityLogs;
8
14
  (function (SecurityLogs) {
@@ -15,6 +21,8 @@ var SecurityLogs;
15
21
  SecurityLogs["loginSuccess"] = "loginSuccess";
16
22
  SecurityLogs["loginAttempts"] = "loginAttempts";
17
23
  SecurityLogs["authRequired"] = "authRequired";
24
+ SecurityLogs["orgGrantAdded"] = "orgGrantAdded";
25
+ SecurityLogs["orgGrantRevoked"] = "orgGrantRevoked";
18
26
  })(SecurityLogs || (exports.SecurityLogs = SecurityLogs = {}));
19
27
  var SecurityLogLevel;
20
28
  (function (SecurityLogLevel) {
@@ -63,6 +71,23 @@ var RolesType;
63
71
  RolesType["ORG"] = "org";
64
72
  RolesType["APP"] = "app";
65
73
  })(RolesType || (exports.RolesType = RolesType = {}));
74
+ /**
75
+ * How a user reaches a given organization (ADR-0005 section 5).
76
+ *
77
+ * - `PROVIDER` cross-tenant tier (`CROSS_TENANT_ROLES`): reaches **every** organization
78
+ * by definition of tier, so no organization role applies
79
+ * - `MEMBER` membership (`organizations[]`): the role is the highest organization
80
+ * role the user holds
81
+ * - `GRANTED` grant (`grants[]`): the role is the one carried **by the grant**, so the
82
+ * same user can be `ORG_MANAGER` on one organization and `ORG_EDITOR` on
83
+ * another
84
+ */
85
+ var OrgScopeTier;
86
+ (function (OrgScopeTier) {
87
+ OrgScopeTier["PROVIDER"] = "provider";
88
+ OrgScopeTier["MEMBER"] = "member";
89
+ OrgScopeTier["GRANTED"] = "granted";
90
+ })(OrgScopeTier || (exports.OrgScopeTier = OrgScopeTier = {}));
66
91
  var UserCrudEventType;
67
92
  (function (UserCrudEventType) {
68
93
  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;IACj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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,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,55 @@ 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
+ * The pair `{ id, role }` is ALL of authorization: `resolveOrgScope` and
42
+ * `reachableOrgIds` read nothing else, and it is verbatim what travels in the
43
+ * `grn` claim. It is NOT denormalized: `code`/`name` used to be carried here "to
44
+ * avoid a join on every authorization check", but no check has ever read them -
45
+ * they were display data on the authorization path, and the only effect of
46
+ * keeping them was a second copy of the organization registry to keep in sync.
47
+ * The UI resolves the name from `organization`, the source of truth.
48
+ */
49
+ export interface OrgGrant {
50
+ id: string;
51
+ role: BaseRoles;
52
+ }
53
+ /**
54
+ * A grant AS PERSISTED on `users.grants[]`.
55
+ *
56
+ * Splits provenance from authorization on purpose: `grantedBy`/`grantedAt` answer
57
+ * "who opened this door, and when" - an audit question - and are read only when
58
+ * the grant is displayed or reviewed. Keeping them off `OrgGrant` is what stops
59
+ * them from ending up in the access token, which is repeated on every request and
60
+ * whose contents cannot be revoked before expiry.
61
+ *
62
+ * Both are OPTIONAL, and not out of laziness: this is the type of `BaseUser.grants`,
63
+ * and on a resource service that user is rebuilt from the TOKEN, which carries
64
+ * `{ id, role }` and nothing else. Provenance is genuinely absent there, so a
65
+ * required field would be a promise the type could not keep. It is written in full
66
+ * by the single write path (`OrganizationCtrl.grantOrgRole`) and by nothing else.
67
+ *
68
+ * `grantedBy` is the granter's user ID and nothing else: the display name is
69
+ * resolved from `users` when shown, so no personal datum is copied into a
70
+ * different user's document.
71
+ */
72
+ export interface OrgGrantRecord extends OrgGrant {
73
+ grantedBy?: string;
74
+ grantedAt?: Date;
75
+ }
27
76
  /**
28
77
  * Base shape for a versioned MongoDB entity whose `name`/`description` are
29
78
  * 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,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAG,MAAM,CAAC;IACpB,OAAO,EAAM,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,IAAI,CAAC,EAAK,MAAM,CAAC;IACjB,IAAI,CAAC,EAA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AAO,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, OrgGrantRecord } from '../../interfaces';
2
2
  declare module '@nextage/nx-frame-be' {
3
3
  interface BaseUser {
4
4
  organizations?: BaseEntity[];
5
+ grants?: OrgGrantRecord[];
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,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAKhB,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC;QAS7B,MAAM,CAAC,EAAS,cAAc,EAAE,CAAC;KAClC;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"}