@nextage/era-lib 1.0.210 → 1.0.212

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 (70) hide show
  1. package/build/constants.d.ts +3 -3
  2. package/build/constants.d.ts.map +1 -1
  3. package/build/constants.js +3 -3
  4. package/build/constants.js.map +1 -1
  5. package/build/events/access-revoked-publisher.d.ts +1 -1
  6. package/build/events/access-revoked-publisher.js +1 -1
  7. package/build/events/base/base-event.controller.d.ts +35 -5
  8. package/build/events/base/base-event.controller.d.ts.map +1 -1
  9. package/build/events/base/base-event.controller.js +43 -6
  10. package/build/events/base/base-event.controller.js.map +1 -1
  11. package/build/events/base/base-msg-listener.js +1 -1
  12. package/build/events/base/base-msg-listener.js.map +1 -1
  13. package/build/events/base/base-nats-listener.d.ts +14 -4
  14. package/build/events/base/base-nats-listener.d.ts.map +1 -1
  15. package/build/events/base/base-nats-listener.js +28 -11
  16. package/build/events/base/base-nats-listener.js.map +1 -1
  17. package/build/events/dlq-manager.js +3 -3
  18. package/build/events/event-relay.js +2 -2
  19. package/build/events/field-map.js +1 -1
  20. package/build/events/interfaces.d.ts +1 -1
  21. package/build/events/organization/interfaces.d.ts +3 -3
  22. package/build/events/organization/restored-event.d.ts +1 -1
  23. package/build/events/publisher-registry.js +1 -1
  24. package/build/events/revocation-denylist.js +2 -2
  25. package/build/events/revocation-listener.js +1 -1
  26. package/build/events/transport/base-client-wrapper.d.ts +1 -1
  27. package/build/events/transport/base-client-wrapper.js +1 -1
  28. package/build/events/transport/nats-client-manager.d.ts +1 -1
  29. package/build/events/transport/nats-client-manager.js +1 -1
  30. package/build/events/types/dlq.constants.js +1 -1
  31. package/build/events/types/dlq.constants.js.map +1 -1
  32. package/build/events/types/dlq.interfaces.js +1 -1
  33. package/build/events/types/dlq.interfaces.js.map +1 -1
  34. package/build/events/types/enums.d.ts +1 -1
  35. package/build/events/types/enums.js +3 -3
  36. package/build/events/types/enums.js.map +1 -1
  37. package/build/events/types/relay.constants.js +1 -1
  38. package/build/events/types/relay.constants.js.map +1 -1
  39. package/build/events/types/relay.interfaces.js +1 -1
  40. package/build/events/types/relay.interfaces.js.map +1 -1
  41. package/build/events/types/revocation.constants.js +1 -1
  42. package/build/events/types/revocation.constants.js.map +1 -1
  43. package/build/events/types/revocation.interfaces.js +1 -1
  44. package/build/events/types/revocation.interfaces.js.map +1 -1
  45. package/build/interfaces.d.ts +1 -1
  46. package/build/services/tenant-archive.d.ts +2 -2
  47. package/build/services/tenant-archive.js +2 -2
  48. package/build/types/app-config.d.ts +3 -3
  49. package/build/types/nx-context.d.ts +1 -1
  50. package/build/types/nx-context.js +1 -1
  51. package/build/utils/domain.d.ts +1 -1
  52. package/build/utils/domain.js +1 -1
  53. package/build/utils/env.constants.js +1 -1
  54. package/build/utils/env.constants.js.map +1 -1
  55. package/build/utils/express.d.ts +1 -1
  56. package/build/utils/express.js +2 -2
  57. package/build/utils/express.js.map +1 -1
  58. package/build/utils/functs.d.ts +2 -2
  59. package/build/utils/functs.js +6 -6
  60. package/build/utils/functs.js.map +1 -1
  61. package/build/utils/jwt.constants.d.ts +2 -2
  62. package/build/utils/jwt.constants.js +2 -2
  63. package/build/utils/jwt.js +3 -3
  64. package/build/utils/jwt.js.map +1 -1
  65. package/build/utils/tenancy.d.ts +4 -4
  66. package/build/utils/tenancy.js +5 -5
  67. package/build/utils/tenant.d.ts +6 -6
  68. package/build/utils/tenant.js +7 -7
  69. package/build/utils/tenant.js.map +1 -1
  70. package/package.json +1 -1
@@ -10,14 +10,14 @@
10
10
  * restated, because two implementations of one rule eventually disagree and any *
11
11
  * disagreement is a leak. *
12
12
  * *
13
- * WHY THE SCOPING IS NOW OPT-OUT (T55, T58) *
13
+ * WHY THE SCOPING IS NOW OPT-OUT *
14
14
  * *
15
15
  * It used to be opt-IN: a model owning a `tenantId` was isolated only for as long as its *
16
16
  * author remembered to override five hooks, one class at a time. That is 45 methods saying *
17
17
  * the same thing across nine models, and the failure mode is silence - the collection *
18
- * simply answers every tenant. It went wrong three times: T31 (a read by id escaping the *
19
- * filters), T37 (a delete with no tenancy filter at all), T55 (`controlAttribute`, whose *
20
- * body is empty). T58 is the same shape once more, on the two hooks nobody had even *
18
+ * simply answers every tenant. It went wrong three times: a read by id escaping the *
19
+ * filters, a delete with no tenancy filter at all, and `controlAttribute`, whose *
20
+ * body is empty. The same shape turned up once more, on the two hooks nobody had even *
21
21
  * counted among the five: the subscription ones. *
22
22
  * *
23
23
  * Registering this provider inverts the default. A model with the field is scoped unless *
@@ -11,14 +11,14 @@
11
11
  * restated, because two implementations of one rule eventually disagree and any *
12
12
  * disagreement is a leak. *
13
13
  * *
14
- * WHY THE SCOPING IS NOW OPT-OUT (T55, T58) *
14
+ * WHY THE SCOPING IS NOW OPT-OUT *
15
15
  * *
16
16
  * It used to be opt-IN: a model owning a `tenantId` was isolated only for as long as its *
17
17
  * author remembered to override five hooks, one class at a time. That is 45 methods saying *
18
18
  * the same thing across nine models, and the failure mode is silence - the collection *
19
- * simply answers every tenant. It went wrong three times: T31 (a read by id escaping the *
20
- * filters), T37 (a delete with no tenancy filter at all), T55 (`controlAttribute`, whose *
21
- * body is empty). T58 is the same shape once more, on the two hooks nobody had even *
19
+ * simply answers every tenant. It went wrong three times: a read by id escaping the *
20
+ * filters, a delete with no tenancy filter at all, and `controlAttribute`, whose *
21
+ * body is empty. The same shape turned up once more, on the two hooks nobody had even *
22
22
  * counted among the five: the subscription ones. *
23
23
  * *
24
24
  * Registering this provider inverts the default. A model with the field is scoped unless *
@@ -73,7 +73,7 @@ exports.eraTenancy = {
73
73
  * caller's own tenant - a silent downgrade would let a client discover the rule by
74
74
  * watching where its documents end up.
75
75
  *
76
- * Anything else in the payload is ignored outright, which is the invariant of T34: the
76
+ * Anything else in the payload is ignored outright, and that is the invariant: the
77
77
  * owner comes from the request context and never from the body.
78
78
  *
79
79
  * ### What happens when nothing is asked, on a mixed collection
@@ -16,7 +16,7 @@ import { ExistenceCheckModel, ScopedReadModel } from './tenant.interfaces';
16
16
  * The selection NEVER comes from the payload: it travels out of band (`X-Org-Id`
17
17
  * header, or `orgId` in the WebSocket connection params) and lands on
18
18
  * `NxContext.orgId`. Reading it from the body would let a client name any tenant
19
- * simply by adding a field to a mutation input (T34).
19
+ * simply by adding a field to a mutation input.
20
20
  *
21
21
  * Resolution order (ADR-0005 section 5.1) - the first match wins:
22
22
  *
@@ -54,7 +54,7 @@ export declare function resolveTenant(user?: BaseUser, orgId?: string): string;
54
54
  * defect D2 of ADR-0005 section 5.1, a fail-open by default.
55
55
  *
56
56
  * IMPORTANT: **What it is FOR, since 2026-08-13.** Scoping is no longer its job: `BaseModel`
57
- * applies the tenant on its own (opt-out, T55), so this is not what keeps a query
57
+ * applies the tenant on its own (opt-out), so this is not what keeps a query
58
58
  * inside its organization anymore. The four remaining callers use it for a different
59
59
  * reason - they need the resolved tenant as a VALUE, to then load
60
60
  * `organization.get(params.tenantId)` or to pick the right items while composing a
@@ -84,11 +84,11 @@ export declare function getTenant(user?: BaseUser): string;
84
84
  * tenant scoping is **opt-out**: `BaseModel.beforeRemove` refuses an out-of-scope `_id`
85
85
  * on its own, so the nine `beforeRemove` overrides that called this helper are gone
86
86
  * (OPS-10) and it has **no production caller left**. Do NOT reach for it in new code -
87
- * a second copy of the rule is exactly what T55 set out to remove. It stays exported,
87
+ * a second copy of the rule is exactly what the opt-out design removed. It stays exported,
88
88
  * and covered by its test, because the framework keeps its old behaviour whenever no
89
89
  * tenancy provider is registered: a consumer in that state still needs this.
90
90
  *
91
- * Fills the gap of **T37**: `BaseModel.remove(id)` calls `beforeRemove` and then
91
+ * Fills a gap in the framework: `BaseModel.remove(id)` calls `beforeRemove` and then
92
92
  * `findByIdAndDelete(id)`, applying neither `updateFilters` nor any `tenantId`
93
93
  * constraint - and `bulkRemove(ids)` is nothing but `ids.map(remove)`. Without this
94
94
  * check any user deletes documents belonging to OTHER organizations, knowing only
@@ -103,7 +103,7 @@ export declare function getTenant(user?: BaseUser): string;
103
103
  * **Fail-closed**: a missing or out-of-scope `id` raises an error, without telling
104
104
  * the two cases apart (the existence of someone else's document is never confirmed).
105
105
  * That muteness was lost when the guard moved into the framework, which at first
106
- * refused only EXISTING documents - an enumeration oracle, filed as **T60** and
106
+ * refused only EXISTING documents - an enumeration oracle, since
107
107
  * repaired in nx-frame-be 1.0.47.
108
108
  *
109
109
  * @param model the model the removal happens on (`this` inside the hook)
@@ -114,7 +114,7 @@ export declare function getTenant(user?: BaseUser): string;
114
114
  */
115
115
  export declare function assertTenantScope(model: ScopedReadModel, id: string, context?: NxContext): Promise<string>;
116
116
  /**
117
- * Answers whether the organization NAMED by a request actually exists (T49).
117
+ * Answers whether the organization NAMED by a request actually exists.
118
118
  *
119
119
  * {@link resolveTenant} answers one question - "may this user REACH the
120
120
  * selection" - and for a cross-tenant role the answer is "any of them", so it
@@ -25,7 +25,7 @@ const scope_1 = require("./scope");
25
25
  * The selection NEVER comes from the payload: it travels out of band (`X-Org-Id`
26
26
  * header, or `orgId` in the WebSocket connection params) and lands on
27
27
  * `NxContext.orgId`. Reading it from the body would let a client name any tenant
28
- * simply by adding a field to a mutation input (T34).
28
+ * simply by adding a field to a mutation input.
29
29
  *
30
30
  * Resolution order (ADR-0005 section 5.1) - the first match wins:
31
31
  *
@@ -62,7 +62,7 @@ function resolveTenant(user, orgId) {
62
62
  return orgId;
63
63
  // `messages.forbidden` was defined by NO dictionary, so the client - which
64
64
  // falls back to the message when `extensions.i18n` is absent - showed the raw
65
- // key to the user (T52). This refusal is an access denial, and reads as one.
65
+ // key to the user. This refusal is an access denial, and reads as one.
66
66
  if (!reachable.includes(orgId))
67
67
  throw new nx_frame_be_1.AppError('messages.authorization.accessDenied');
68
68
  return orgId;
@@ -76,7 +76,7 @@ function resolveTenant(user, orgId) {
76
76
  * defect D2 of ADR-0005 section 5.1, a fail-open by default.
77
77
  *
78
78
  * IMPORTANT: **What it is FOR, since 2026-08-13.** Scoping is no longer its job: `BaseModel`
79
- * applies the tenant on its own (opt-out, T55), so this is not what keeps a query
79
+ * applies the tenant on its own (opt-out), so this is not what keeps a query
80
80
  * inside its organization anymore. The four remaining callers use it for a different
81
81
  * reason - they need the resolved tenant as a VALUE, to then load
82
82
  * `organization.get(params.tenantId)` or to pick the right items while composing a
@@ -112,11 +112,11 @@ function getTenant(user) {
112
112
  * tenant scoping is **opt-out**: `BaseModel.beforeRemove` refuses an out-of-scope `_id`
113
113
  * on its own, so the nine `beforeRemove` overrides that called this helper are gone
114
114
  * (OPS-10) and it has **no production caller left**. Do NOT reach for it in new code -
115
- * a second copy of the rule is exactly what T55 set out to remove. It stays exported,
115
+ * a second copy of the rule is exactly what the opt-out design removed. It stays exported,
116
116
  * and covered by its test, because the framework keeps its old behaviour whenever no
117
117
  * tenancy provider is registered: a consumer in that state still needs this.
118
118
  *
119
- * Fills the gap of **T37**: `BaseModel.remove(id)` calls `beforeRemove` and then
119
+ * Fills a gap in the framework: `BaseModel.remove(id)` calls `beforeRemove` and then
120
120
  * `findByIdAndDelete(id)`, applying neither `updateFilters` nor any `tenantId`
121
121
  * constraint - and `bulkRemove(ids)` is nothing but `ids.map(remove)`. Without this
122
122
  * check any user deletes documents belonging to OTHER organizations, knowing only
@@ -131,7 +131,7 @@ function getTenant(user) {
131
131
  * **Fail-closed**: a missing or out-of-scope `id` raises an error, without telling
132
132
  * the two cases apart (the existence of someone else's document is never confirmed).
133
133
  * That muteness was lost when the guard moved into the framework, which at first
134
- * refused only EXISTING documents - an enumeration oracle, filed as **T60** and
134
+ * refused only EXISTING documents - an enumeration oracle, since
135
135
  * repaired in nx-frame-be 1.0.47.
136
136
  *
137
137
  * @param model the model the removal happens on (`this` inside the hook)
@@ -146,7 +146,7 @@ async function assertTenantScope(model, id, context = {}) {
146
146
  return id;
147
147
  }
148
148
  /**
149
- * Answers whether the organization NAMED by a request actually exists (T49).
149
+ * Answers whether the organization NAMED by a request actually exists.
150
150
  *
151
151
  * {@link resolveTenant} answers one question - "may this user REACH the
152
152
  * selection" - and for a cross-tenant role the answer is "any of them", so it
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.js","sourceRoot":"","sources":["../../src/utils/tenant.ts"],"names":[],"mappings":";AAAA;;;;;;;;;+FAS+F;;AA0C/F,sCAkBC;AAqBD,8BAGC;AAaD,8BAMC;AAqCD,8CAMC;AAqDD,8CASC;AAkBD,0DAIC;AApOD,sDAA+E;AAC/E,oFAA6G;AAE7G,mCAAkE;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,aAAa,CAAC,IAAe,EAAE,KAAc;IAE3D,IAAI,CAAC,KAAK;QACR,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IAEzB,MAAM,SAAS,GAAG,IAAA,uBAAe,EAAC,IAAI,CAAC,CAAC;IAExC,sEAAsE;IACtE,IAAI,CAAC,SAAS;QACZ,OAAO,KAAK,CAAC;IAEf,2EAA2E;IAC3E,8EAA8E;IAC9E,6EAA6E;IAC7E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC5B,MAAM,IAAI,sBAAQ,CAAC,qCAAqC,CAAC,CAAC;IAE5D,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,SAAS,CAAC,IAAc,EAAE,UAAqB,EAAE;IAE/D,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,SAAS,CAAC,IAAe;IAEvC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM;QAC9B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAE1D,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,CAAC,IAAA,6BAAe,EAAC,KAAK,CAAC;QACzB,OAAO,KAAK,CAAC;IAEf,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAA,wBAAU,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,uBAAuB,CAAC,KAA0B,EAAE,KAAc;IAEtF,IAAI,CAAC,MAAM,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC;QACxC,MAAM,IAAI,sBAAQ,CAAC,qCAAqC,CAAC,CAAC;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextage/era-lib",
3
- "version": "1.0.210",
3
+ "version": "1.0.212",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [