@venizia/ignis-kernel 0.2.0-1 → 0.2.0-11

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 (225) hide show
  1. package/dist/cjs/base/auth/authenticate/common/constants.d.ts +28 -1
  2. package/dist/cjs/base/auth/authenticate/common/constants.d.ts.map +1 -1
  3. package/dist/cjs/base/auth/authenticate/common/constants.js +29 -2
  4. package/dist/cjs/base/auth/authenticate/common/constants.js.map +1 -1
  5. package/dist/cjs/base/auth/authenticate/common/errors.d.ts +40 -1
  6. package/dist/cjs/base/auth/authenticate/common/errors.d.ts.map +1 -1
  7. package/dist/cjs/base/auth/authenticate/common/errors.js +41 -1
  8. package/dist/cjs/base/auth/authenticate/common/errors.js.map +1 -1
  9. package/dist/cjs/base/auth/authenticate/common/keys.d.ts +2 -0
  10. package/dist/cjs/base/auth/authenticate/common/keys.d.ts.map +1 -1
  11. package/dist/cjs/base/auth/authenticate/common/keys.js +2 -0
  12. package/dist/cjs/base/auth/authenticate/common/keys.js.map +1 -1
  13. package/dist/cjs/base/auth/authenticate/common/types.d.ts +147 -1
  14. package/dist/cjs/base/auth/authenticate/common/types.d.ts.map +1 -1
  15. package/dist/cjs/base/auth/authenticate/strategies/strategy-registry.d.ts +37 -0
  16. package/dist/cjs/base/auth/authenticate/strategies/strategy-registry.d.ts.map +1 -1
  17. package/dist/cjs/base/auth/authenticate/strategies/strategy-registry.js +54 -0
  18. package/dist/cjs/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
  19. package/dist/cjs/base/auth/authorize/builders/policy.builder.d.ts +28 -33
  20. package/dist/cjs/base/auth/authorize/builders/policy.builder.d.ts.map +1 -1
  21. package/dist/cjs/base/auth/authorize/builders/policy.builder.js.map +1 -1
  22. package/dist/cjs/base/auth/authorize/common/constants.d.ts +25 -1
  23. package/dist/cjs/base/auth/authorize/common/constants.d.ts.map +1 -1
  24. package/dist/cjs/base/auth/authorize/common/constants.js +12 -18
  25. package/dist/cjs/base/auth/authorize/common/constants.js.map +1 -1
  26. package/dist/cjs/base/auth/authorize/common/errors.d.ts +9 -0
  27. package/dist/cjs/base/auth/authorize/common/errors.d.ts.map +1 -1
  28. package/dist/cjs/base/auth/authorize/common/errors.js +9 -0
  29. package/dist/cjs/base/auth/authorize/common/errors.js.map +1 -1
  30. package/dist/cjs/base/auth/authorize/common/types.d.ts +1 -1
  31. package/dist/cjs/base/auth/authorize/common/types.d.ts.map +1 -1
  32. package/dist/cjs/base/auth/authorize/enforcers/enforcer-registry.d.ts +17 -0
  33. package/dist/cjs/base/auth/authorize/enforcers/enforcer-registry.d.ts.map +1 -1
  34. package/dist/cjs/base/auth/authorize/enforcers/enforcer-registry.js +39 -3
  35. package/dist/cjs/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
  36. package/dist/cjs/base/auth/authorize/providers/authorization.provider.d.ts.map +1 -1
  37. package/dist/cjs/base/auth/authorize/providers/authorization.provider.js +33 -10
  38. package/dist/cjs/base/auth/authorize/providers/authorization.provider.js.map +1 -1
  39. package/dist/cjs/base/auth/base/abstract-auth-registry.d.ts +10 -0
  40. package/dist/cjs/base/auth/base/abstract-auth-registry.d.ts.map +1 -1
  41. package/dist/cjs/base/auth/base/abstract-auth-registry.js +12 -0
  42. package/dist/cjs/base/auth/base/abstract-auth-registry.js.map +1 -1
  43. package/dist/cjs/base/auth/context-variables.d.ts +7 -1
  44. package/dist/cjs/base/auth/context-variables.d.ts.map +1 -1
  45. package/dist/cjs/base/controllers/factory/controller.d.ts +1 -1
  46. package/dist/cjs/base/controllers/factory/controller.d.ts.map +1 -1
  47. package/dist/cjs/base/controllers/factory/definition.d.ts +1 -1
  48. package/dist/cjs/base/controllers/factory/definition.d.ts.map +1 -1
  49. package/dist/cjs/base/controllers/factory/definition.js +3 -5
  50. package/dist/cjs/base/controllers/factory/definition.js.map +1 -1
  51. package/dist/cjs/base/controllers/rest/abstract.d.ts.map +1 -1
  52. package/dist/cjs/base/controllers/rest/abstract.js +10 -0
  53. package/dist/cjs/base/controllers/rest/abstract.js.map +1 -1
  54. package/dist/cjs/base/events/common/constants.d.ts +37 -0
  55. package/dist/cjs/base/events/common/constants.d.ts.map +1 -0
  56. package/dist/cjs/base/events/common/constants.js +42 -0
  57. package/dist/cjs/base/events/common/constants.js.map +1 -0
  58. package/dist/cjs/base/events/common/index.d.ts +3 -0
  59. package/dist/cjs/base/events/common/index.d.ts.map +1 -0
  60. package/dist/cjs/base/events/common/index.js +19 -0
  61. package/dist/cjs/base/events/common/index.js.map +1 -0
  62. package/dist/cjs/base/events/common/types.d.ts +64 -0
  63. package/dist/cjs/base/events/common/types.d.ts.map +1 -0
  64. package/dist/cjs/base/events/common/types.js +3 -0
  65. package/dist/cjs/base/events/common/types.js.map +1 -0
  66. package/dist/cjs/base/events/event-bus.d.ts +78 -0
  67. package/dist/cjs/base/events/event-bus.d.ts.map +1 -0
  68. package/dist/cjs/base/events/event-bus.js +220 -0
  69. package/dist/cjs/base/events/event-bus.js.map +1 -0
  70. package/dist/cjs/base/events/index.d.ts +3 -0
  71. package/dist/cjs/base/events/index.d.ts.map +1 -0
  72. package/dist/cjs/base/events/index.js +19 -0
  73. package/dist/cjs/base/events/index.js.map +1 -0
  74. package/dist/cjs/base/index.d.ts +1 -0
  75. package/dist/cjs/base/index.d.ts.map +1 -1
  76. package/dist/cjs/base/index.js +1 -5
  77. package/dist/cjs/base/index.js.map +1 -1
  78. package/dist/cjs/base/metadata/persistents.js +1 -1
  79. package/dist/cjs/base/metadata/persistents.js.map +1 -1
  80. package/dist/cjs/base/middlewares/not-found/not-found.middleware.d.ts.map +1 -1
  81. package/dist/cjs/base/middlewares/not-found/not-found.middleware.js +4 -1
  82. package/dist/cjs/base/middlewares/not-found/not-found.middleware.js.map +1 -1
  83. package/dist/cjs/base/models/common/types.d.ts +20 -0
  84. package/dist/cjs/base/models/common/types.d.ts.map +1 -1
  85. package/dist/cjs/base/models/common/types.js +9 -1
  86. package/dist/cjs/base/models/common/types.js.map +1 -1
  87. package/dist/cjs/base/repositories/common/constants.d.ts +26 -0
  88. package/dist/cjs/base/repositories/common/constants.d.ts.map +1 -1
  89. package/dist/cjs/base/repositories/common/constants.js +29 -1
  90. package/dist/cjs/base/repositories/common/constants.js.map +1 -1
  91. package/dist/cjs/base/repositories/core/abstract.d.ts +29 -0
  92. package/dist/cjs/base/repositories/core/abstract.d.ts.map +1 -1
  93. package/dist/cjs/base/repositories/core/abstract.js +71 -1
  94. package/dist/cjs/base/repositories/core/abstract.js.map +1 -1
  95. package/dist/cjs/base/repositories/index.d.ts +1 -0
  96. package/dist/cjs/base/repositories/index.d.ts.map +1 -1
  97. package/dist/cjs/base/repositories/index.js +1 -0
  98. package/dist/cjs/base/repositories/index.js.map +1 -1
  99. package/dist/cjs/base/repositories/query-schemas/index.d.ts +26 -3
  100. package/dist/cjs/base/repositories/query-schemas/index.d.ts.map +1 -1
  101. package/dist/cjs/base/repositories/query-schemas/index.js +26 -3
  102. package/dist/cjs/base/repositories/query-schemas/index.js.map +1 -1
  103. package/dist/cjs/base/repositories/sqls/index.d.ts +2 -0
  104. package/dist/cjs/base/repositories/sqls/index.d.ts.map +1 -0
  105. package/dist/cjs/base/repositories/sqls/index.js +18 -0
  106. package/dist/cjs/base/repositories/sqls/index.js.map +1 -0
  107. package/dist/cjs/base/repositories/sqls/recursive-tree.d.ts +56 -0
  108. package/dist/cjs/base/repositories/sqls/recursive-tree.d.ts.map +1 -0
  109. package/dist/cjs/base/repositories/sqls/recursive-tree.js +148 -0
  110. package/dist/cjs/base/repositories/sqls/recursive-tree.js.map +1 -0
  111. package/dist/cjs/helpers/inversion/common/types.d.ts +34 -4
  112. package/dist/cjs/helpers/inversion/common/types.d.ts.map +1 -1
  113. package/dist/esm/base/auth/authenticate/common/constants.d.ts +28 -1
  114. package/dist/esm/base/auth/authenticate/common/constants.d.ts.map +1 -1
  115. package/dist/esm/base/auth/authenticate/common/constants.js +27 -1
  116. package/dist/esm/base/auth/authenticate/common/constants.js.map +1 -1
  117. package/dist/esm/base/auth/authenticate/common/errors.d.ts +40 -1
  118. package/dist/esm/base/auth/authenticate/common/errors.d.ts.map +1 -1
  119. package/dist/esm/base/auth/authenticate/common/errors.js +41 -1
  120. package/dist/esm/base/auth/authenticate/common/errors.js.map +1 -1
  121. package/dist/esm/base/auth/authenticate/common/keys.d.ts +2 -0
  122. package/dist/esm/base/auth/authenticate/common/keys.d.ts.map +1 -1
  123. package/dist/esm/base/auth/authenticate/common/keys.js +2 -0
  124. package/dist/esm/base/auth/authenticate/common/keys.js.map +1 -1
  125. package/dist/esm/base/auth/authenticate/common/types.d.ts +147 -1
  126. package/dist/esm/base/auth/authenticate/common/types.d.ts.map +1 -1
  127. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.d.ts +37 -0
  128. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.d.ts.map +1 -1
  129. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js +54 -0
  130. package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
  131. package/dist/esm/base/auth/authorize/builders/policy.builder.d.ts +28 -33
  132. package/dist/esm/base/auth/authorize/builders/policy.builder.d.ts.map +1 -1
  133. package/dist/esm/base/auth/authorize/builders/policy.builder.js.map +1 -1
  134. package/dist/esm/base/auth/authorize/common/constants.d.ts +25 -1
  135. package/dist/esm/base/auth/authorize/common/constants.d.ts.map +1 -1
  136. package/dist/esm/base/auth/authorize/common/constants.js +12 -18
  137. package/dist/esm/base/auth/authorize/common/constants.js.map +1 -1
  138. package/dist/esm/base/auth/authorize/common/errors.d.ts +9 -0
  139. package/dist/esm/base/auth/authorize/common/errors.d.ts.map +1 -1
  140. package/dist/esm/base/auth/authorize/common/errors.js +9 -0
  141. package/dist/esm/base/auth/authorize/common/errors.js.map +1 -1
  142. package/dist/esm/base/auth/authorize/common/types.d.ts +1 -1
  143. package/dist/esm/base/auth/authorize/common/types.d.ts.map +1 -1
  144. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.d.ts +17 -0
  145. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.d.ts.map +1 -1
  146. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js +39 -3
  147. package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
  148. package/dist/esm/base/auth/authorize/providers/authorization.provider.d.ts.map +1 -1
  149. package/dist/esm/base/auth/authorize/providers/authorization.provider.js +33 -10
  150. package/dist/esm/base/auth/authorize/providers/authorization.provider.js.map +1 -1
  151. package/dist/esm/base/auth/base/abstract-auth-registry.d.ts +10 -0
  152. package/dist/esm/base/auth/base/abstract-auth-registry.d.ts.map +1 -1
  153. package/dist/esm/base/auth/base/abstract-auth-registry.js +12 -0
  154. package/dist/esm/base/auth/base/abstract-auth-registry.js.map +1 -1
  155. package/dist/esm/base/auth/context-variables.d.ts +7 -1
  156. package/dist/esm/base/auth/context-variables.d.ts.map +1 -1
  157. package/dist/esm/base/controllers/factory/controller.d.ts +1 -1
  158. package/dist/esm/base/controllers/factory/controller.d.ts.map +1 -1
  159. package/dist/esm/base/controllers/factory/definition.d.ts +1 -1
  160. package/dist/esm/base/controllers/factory/definition.d.ts.map +1 -1
  161. package/dist/esm/base/controllers/factory/definition.js +4 -6
  162. package/dist/esm/base/controllers/factory/definition.js.map +1 -1
  163. package/dist/esm/base/controllers/rest/abstract.d.ts.map +1 -1
  164. package/dist/esm/base/controllers/rest/abstract.js +10 -0
  165. package/dist/esm/base/controllers/rest/abstract.js.map +1 -1
  166. package/dist/esm/base/events/common/constants.d.ts +37 -0
  167. package/dist/esm/base/events/common/constants.d.ts.map +1 -0
  168. package/dist/esm/base/events/common/constants.js +37 -0
  169. package/dist/esm/base/events/common/constants.js.map +1 -0
  170. package/dist/esm/base/events/common/index.d.ts +3 -0
  171. package/dist/esm/base/events/common/index.d.ts.map +1 -0
  172. package/dist/esm/base/events/common/index.js +3 -0
  173. package/dist/esm/base/events/common/index.js.map +1 -0
  174. package/dist/esm/base/events/common/types.d.ts +64 -0
  175. package/dist/esm/base/events/common/types.d.ts.map +1 -0
  176. package/dist/esm/base/events/common/types.js +2 -0
  177. package/dist/esm/base/events/common/types.js.map +1 -0
  178. package/dist/esm/base/events/event-bus.d.ts +78 -0
  179. package/dist/esm/base/events/event-bus.d.ts.map +1 -0
  180. package/dist/esm/base/events/event-bus.js +213 -0
  181. package/dist/esm/base/events/event-bus.js.map +1 -0
  182. package/dist/esm/base/events/index.d.ts +3 -0
  183. package/dist/esm/base/events/index.d.ts.map +1 -0
  184. package/dist/esm/base/events/index.js +3 -0
  185. package/dist/esm/base/events/index.js.map +1 -0
  186. package/dist/esm/base/index.d.ts +1 -0
  187. package/dist/esm/base/index.d.ts.map +1 -1
  188. package/dist/esm/base/index.js +1 -5
  189. package/dist/esm/base/index.js.map +1 -1
  190. package/dist/esm/base/metadata/persistents.js +1 -1
  191. package/dist/esm/base/metadata/persistents.js.map +1 -1
  192. package/dist/esm/base/middlewares/not-found/not-found.middleware.d.ts.map +1 -1
  193. package/dist/esm/base/middlewares/not-found/not-found.middleware.js +4 -1
  194. package/dist/esm/base/middlewares/not-found/not-found.middleware.js.map +1 -1
  195. package/dist/esm/base/models/common/types.d.ts +20 -0
  196. package/dist/esm/base/models/common/types.d.ts.map +1 -1
  197. package/dist/esm/base/models/common/types.js +7 -0
  198. package/dist/esm/base/models/common/types.js.map +1 -1
  199. package/dist/esm/base/repositories/common/constants.d.ts +26 -0
  200. package/dist/esm/base/repositories/common/constants.d.ts.map +1 -1
  201. package/dist/esm/base/repositories/common/constants.js +26 -0
  202. package/dist/esm/base/repositories/common/constants.js.map +1 -1
  203. package/dist/esm/base/repositories/core/abstract.d.ts +29 -0
  204. package/dist/esm/base/repositories/core/abstract.d.ts.map +1 -1
  205. package/dist/esm/base/repositories/core/abstract.js +73 -3
  206. package/dist/esm/base/repositories/core/abstract.js.map +1 -1
  207. package/dist/esm/base/repositories/index.d.ts +1 -0
  208. package/dist/esm/base/repositories/index.d.ts.map +1 -1
  209. package/dist/esm/base/repositories/index.js +1 -0
  210. package/dist/esm/base/repositories/index.js.map +1 -1
  211. package/dist/esm/base/repositories/query-schemas/index.d.ts +26 -3
  212. package/dist/esm/base/repositories/query-schemas/index.d.ts.map +1 -1
  213. package/dist/esm/base/repositories/query-schemas/index.js +25 -2
  214. package/dist/esm/base/repositories/query-schemas/index.js.map +1 -1
  215. package/dist/esm/base/repositories/sqls/index.d.ts +2 -0
  216. package/dist/esm/base/repositories/sqls/index.d.ts.map +1 -0
  217. package/dist/esm/base/repositories/sqls/index.js +2 -0
  218. package/dist/esm/base/repositories/sqls/index.js.map +1 -0
  219. package/dist/esm/base/repositories/sqls/recursive-tree.d.ts +56 -0
  220. package/dist/esm/base/repositories/sqls/recursive-tree.d.ts.map +1 -0
  221. package/dist/esm/base/repositories/sqls/recursive-tree.js +143 -0
  222. package/dist/esm/base/repositories/sqls/recursive-tree.js.map +1 -0
  223. package/dist/esm/helpers/inversion/common/types.d.ts +34 -4
  224. package/dist/esm/helpers/inversion/common/types.d.ts.map +1 -1
  225. package/package.json +5 -5
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EventBus = void 0;
7
+ const core_1 = require("@venizia/ignis-helpers/core");
8
+ const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
9
+ const constants_1 = require("./common/constants");
10
+ /** In-process, fire-and-forget domain event bus. `TPayloadMap` keys the event names, so a wrong name
11
+ * or payload shape is a compile error. Delivery is always async. Retry timing is a property of the
12
+ * handler's own failure mode, not of the event, so `register` may tune it per registration. But
13
+ * nobody awaits a fire-and-forget dispatch, so an unbounded window would let one event hold a
14
+ * handler - and whatever it holds open, e.g. a database connection - for an unbounded time with no
15
+ * one to report it. What the bus guarantees instead: a bounded MAXIMUM time a single dispatch can
16
+ * occupy, enforced as a hard ceiling at `register()` - see `EventDispatchRetry`. Retry makes
17
+ * delivery at-least-once: handlers must be idempotent, see `IEventHandler`. */
18
+ class EventBus extends core_1.BaseHelper {
19
+ constructor(opts) {
20
+ super({ scope: opts.scope ?? EventBus.name });
21
+ this.container = opts.container;
22
+ this.registrationsByName = new Map();
23
+ }
24
+ /** The pre-jitter total of every inter-attempt delay `maxAttempts`/`baseDelayMs` would produce -
25
+ * jitter (always on, see `dispatch`) only ever shrinks a delay, so this is a true upper bound. */
26
+ static computeTotalWindowMs(opts) {
27
+ const { maxAttempts, baseDelayMs } = opts;
28
+ let totalWindowMs = 0;
29
+ for (let attempt = 1; attempt < maxAttempts; attempt++) {
30
+ totalWindowMs += core_1.RetryHelper.computeBackoffDelayMs({
31
+ attempt,
32
+ backoff: {
33
+ strategy: core_1.RetryBackoffStrategies.EXPONENTIAL,
34
+ initialDelayMs: baseDelayMs,
35
+ jitter: core_1.RetryJitterModes.NONE,
36
+ },
37
+ });
38
+ }
39
+ return totalWindowMs;
40
+ }
41
+ /** Loud rejection, never a silent clamp: a caller who believes a number the bus does not honour is
42
+ * worse off than one who sees the ceiling at boot. */
43
+ static assertValidRetry(opts) {
44
+ const { name, maxAttempts, baseDelayMs } = opts;
45
+ if (!Number.isInteger(maxAttempts) || maxAttempts < 1) {
46
+ throw (0, core_1.getError)({
47
+ message: `[EventBus][register] retry.maxAttempts must be a positive integer | name: ${name} | Got: ${maxAttempts}`,
48
+ });
49
+ }
50
+ if (!Number.isInteger(baseDelayMs) || baseDelayMs < 1) {
51
+ throw (0, core_1.getError)({
52
+ message: `[EventBus][register] retry.baseDelayMs must be a positive integer | name: ${name} | Got: ${baseDelayMs}`,
53
+ });
54
+ }
55
+ if (maxAttempts > constants_1.EventDispatchRetry.MAX_ATTEMPTS_CEILING) {
56
+ throw (0, core_1.getError)({
57
+ message: `[EventBus][register] retry.maxAttempts exceeds the ceiling | name: ${name} | Got: ${maxAttempts} | Ceiling: ${constants_1.EventDispatchRetry.MAX_ATTEMPTS_CEILING} | Lower retry.maxAttempts`,
58
+ });
59
+ }
60
+ const totalWindowMs = EventBus.computeTotalWindowMs({ maxAttempts, baseDelayMs });
61
+ if (totalWindowMs > constants_1.EventDispatchRetry.MAX_TOTAL_WINDOW_MS) {
62
+ throw (0, core_1.getError)({
63
+ message: `[EventBus][register] retry window exceeds the ceiling | name: ${name} | Got: ${totalWindowMs}ms | Ceiling: ${constants_1.EventDispatchRetry.MAX_TOTAL_WINDOW_MS}ms | Lower retry.maxAttempts or retry.baseDelayMs`,
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * Turns `handler` into a uniform invoker plus a description for the exhaustion log line.
69
+ * `BINDING_KEY` resolves through the container INSIDE the returned closure, so every call re-reads
70
+ * the current binding; `FUNCTION` calls `fn` directly, so the closure IS the resolution - there is
71
+ * nothing left to re-read on a later attempt. The tag (`handler.type`) is what this switches on,
72
+ * not which field happens to be present - see `EventHandlerTypes`' doc.
73
+ */
74
+ static buildHandlerInvoker(opts) {
75
+ const { container, handler, name } = opts;
76
+ if ((0, isEmpty_1.default)(handler)) {
77
+ throw (0, core_1.getError)({
78
+ message: `[EventBus][register] Invalid handler | name: ${name} | Got: ${handler}`,
79
+ });
80
+ }
81
+ switch (handler.type) {
82
+ case constants_1.EventHandlerTypes.BINDING_KEY: {
83
+ const { key } = handler;
84
+ if ((0, isEmpty_1.default)(key)) {
85
+ throw (0, core_1.getError)({
86
+ message: `[EventBus][register] Invalid handler.key | name: ${name} | Got: ${key}`,
87
+ });
88
+ }
89
+ return {
90
+ invokeHandler: ({ event }) => container.get({ key }).handle({ event }),
91
+ description: `binding-key:${key}`,
92
+ };
93
+ }
94
+ case constants_1.EventHandlerTypes.FUNCTION: {
95
+ const { fn } = handler;
96
+ if (typeof fn !== 'function') {
97
+ throw (0, core_1.getError)({
98
+ message: `[EventBus][register] Invalid handler.fn | name: ${name} | Expected a function | Got: ${typeof fn}`,
99
+ });
100
+ }
101
+ return {
102
+ invokeHandler: ({ event }) => fn({ event }),
103
+ description: `function:${fn.name || 'anonymous'}`,
104
+ };
105
+ }
106
+ default: {
107
+ throw (0, core_1.getError)({
108
+ message: `[EventBus][register] Unknown handler.type | name: ${name} | Expected one of: ${[...constants_1.EventHandlerTypes.SCHEME_SET].join(', ')} | Got: ${handler.type}`,
109
+ });
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * `retry` is optional and per REGISTRATION, not per publish: the right window belongs to the
115
+ * handler's own failure mode, and two handlers on the same event name may each pick their own.
116
+ * Omitting it reproduces today's `EventDispatchRetry` defaults exactly. Both `maxAttempts` and the
117
+ * total backoff window it implies are bounded - see `EventDispatchRetry` - and exceeding either
118
+ * throws here, at boot where a human sees it, rather than being silently clamped at dispatch time.
119
+ */
120
+ register(opts) {
121
+ const { name, handler, retry } = opts;
122
+ if ((0, isEmpty_1.default)(name)) {
123
+ throw (0, core_1.getError)({
124
+ message: `[EventBus][register] Invalid registration | name: ${String(name)}`,
125
+ });
126
+ }
127
+ const maxAttempts = retry?.maxAttempts ?? constants_1.EventDispatchRetry.MAX_ATTEMPTS;
128
+ const baseDelayMs = retry?.baseDelayMs ?? constants_1.EventDispatchRetry.BASE_DELAY_MS;
129
+ EventBus.assertValidRetry({ name, maxAttempts, baseDelayMs });
130
+ const { invokeHandler, description } = EventBus.buildHandlerInvoker({
131
+ container: this.container,
132
+ handler,
133
+ name,
134
+ });
135
+ const registration = {
136
+ invokeHandler,
137
+ description,
138
+ maxAttempts,
139
+ baseDelayMs,
140
+ };
141
+ const existing = this.registrationsByName.get(name);
142
+ if (existing) {
143
+ existing.push(registration);
144
+ return;
145
+ }
146
+ this.registrationsByName.set(name, [registration]);
147
+ }
148
+ /**
149
+ * Never blocks and never throws back to the caller: dispatch runs outside this call's flow via
150
+ * `queueMicrotask`, and a handler failure is caught and logged where it happens (`dispatch`),
151
+ * never here.
152
+ */
153
+ publish(opts) {
154
+ const { name, payload, traceId } = opts;
155
+ const event = {
156
+ name,
157
+ payload,
158
+ occurredAt: new Date().toISOString(),
159
+ traceId,
160
+ };
161
+ const registrations = this.registrationsByName.get(name);
162
+ if (!registrations?.length) {
163
+ // A typo is already a compile error, so at runtime this only means nobody is listening yet -
164
+ // a legitimate state on a fire-and-forget bus, not an incident.
165
+ this.logger.debug('[publish] No handler registered | name: %s | traceId: %s', name, traceId);
166
+ return;
167
+ }
168
+ for (const registration of registrations) {
169
+ queueMicrotask(() => {
170
+ // `dispatch` catches every failure path itself and never rejects - this `.catch` is an
171
+ // unreachable backstop, kept (and logged) rather than left floating, for the day it isn't.
172
+ this.dispatch({ event, registration }).catch((error) => {
173
+ this.logger.error('[publish] Unexpected dispatch failure | name: %s | Error: %s', event.name, error);
174
+ });
175
+ });
176
+ }
177
+ }
178
+ /**
179
+ * Attempts/backoff come from the registration (`EventDispatchRetry`'s defaults when omitted),
180
+ * always with full jitter - `RetryJitterModes.FULL` decorrelates a shared-resource pile-up hardest,
181
+ * so many handlers retrying the same lock do not collide on the same instant a second and third
182
+ * time. `invokeHandler` already encodes whether that re-resolves (`BINDING_KEY`) or was captured
183
+ * once (`FUNCTION`) - see `buildHandlerInvoker` - so this method calls it uniformly. A handler that
184
+ * throws synchronously is caught exactly like one that returns a rejected promise: `execution`
185
+ * here is itself `async`, and JS converts a synchronous throw inside an async function body into a
186
+ * rejection of that function's own promise - `RetryHelper.executeWithRetry`'s attempt loop never
187
+ * sees the difference.
188
+ *
189
+ * `RetryHelper.executeWithRetry` is used without its own `logger` - its internal per-attempt/exhaustion
190
+ * logging knows nothing about the event name or `traceId`, so it cannot be the trace anyone
191
+ * relies on. The one line below, logged only on final failure, is.
192
+ */
193
+ async dispatch(opts) {
194
+ const { event, registration } = opts;
195
+ const { invokeHandler, description, maxAttempts, baseDelayMs } = registration;
196
+ let lastAttempt = 0;
197
+ try {
198
+ await core_1.RetryHelper.executeWithRetry({
199
+ operation: `EventBus.dispatch:${event.name}`,
200
+ maxAttempts,
201
+ backoff: {
202
+ strategy: core_1.RetryBackoffStrategies.EXPONENTIAL,
203
+ initialDelayMs: baseDelayMs,
204
+ jitter: core_1.RetryJitterModes.FULL,
205
+ },
206
+ execution: async ({ attempt }) => {
207
+ lastAttempt = attempt;
208
+ await invokeHandler({ event });
209
+ },
210
+ });
211
+ }
212
+ catch (error) {
213
+ // The only trace this failure leaves: it is caught here and never reaches the publisher, so
214
+ // the event name, traceId and attempt count all have to be on this one line.
215
+ this.logger.error('[dispatch] Handler exhausted retries | name: %s | traceId: %s | attempts: %d | handler: %s | Error: %s', event.name, event.traceId, lastAttempt, description, error);
216
+ }
217
+ }
218
+ }
219
+ exports.EventBus = EventBus;
220
+ //# sourceMappingURL=event-bus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../../src/base/events/event-bus.ts"],"names":[],"mappings":";;;;;;AAEA,sDAMqC;AACrC,6DAAqC;AACrC,kDAA2E;AAqB3E;;;;;;;+EAO+E;AAC/E,MAAa,QAAqC,SAAQ,iBAAU;IAOlE,YAAY,IAA8C;QACxD,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAE,CAAC;IACvC,CAAC;IAED;sGACkG;IAC1F,MAAM,CAAC,oBAAoB,CAAC,IAAkD;QACpF,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAC1C,IAAI,aAAa,GAAG,CAAC,CAAC;QAEtB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;YACvD,aAAa,IAAI,kBAAW,CAAC,qBAAqB,CAAC;gBACjD,OAAO;gBACP,OAAO,EAAE;oBACP,QAAQ,EAAE,6BAAsB,CAAC,WAAW;oBAC5C,cAAc,EAAE,WAAW;oBAC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,gBAAgB,CAAC;gBACjC,SAAS,EAAE,qBAAqB,KAAK,CAAC,IAAI,EAAE;gBAC5C,WAAW;gBACX,OAAO,EAAE;oBACP,QAAQ,EAAE,6BAAsB,CAAC,WAAW;oBAC5C,cAAc,EAAE,WAAW;oBAC3B,MAAM,EAAE,uBAAgB,CAAC,IAAI;iBAC9B;gBACD,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;oBAC/B,WAAW,GAAG,OAAO,CAAC;oBACtB,MAAM,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBACjC,CAAC;aACF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,4FAA4F;YAC5F,6EAA6E;YAC7E,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,wGAAwG,EACxG,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,OAAO,EACb,WAAW,EACX,WAAW,EACX,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AA3QD,4BA2QC"}
@@ -0,0 +1,3 @@
1
+ export * from './common';
2
+ export * from './event-bus';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/base/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./common"), exports);
18
+ __exportStar(require("./event-bus"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/base/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B"}
@@ -3,6 +3,7 @@ export * from './auth';
3
3
  export * from './components';
4
4
  export * from './controllers';
5
5
  export * from './datasources';
6
+ export * from './events';
6
7
  export * from './metadata';
7
8
  export * from './middlewares';
8
9
  export * from './mixins';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAM3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
@@ -19,12 +19,8 @@ __exportStar(require("./auth"), exports);
19
19
  __exportStar(require("./components"), exports);
20
20
  __exportStar(require("./controllers"), exports);
21
21
  __exportStar(require("./datasources"), exports);
22
+ __exportStar(require("./events"), exports);
22
23
  __exportStar(require("./metadata"), exports);
23
- // Deliberately public, not an accidental leak: core's own `base/applications/base.ts` (registers
24
- // `emojiFavicon`/`notFoundHandler`) and `base/middlewares/request-spy/request-spy.middleware.ts`
25
- // (reads `REQUEST_ID_KEY`, registers `RequestErrors`) both need these across the package boundary
26
- // the split introduced - core did not export this barrel before the move, but two of its own files
27
- // now depend on symbols that only live here.
28
24
  __exportStar(require("./middlewares"), exports);
29
25
  __exportStar(require("./mixins"), exports);
30
26
  __exportStar(require("./models"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yCAAuB;AACvB,+CAA6B;AAC7B,gDAA8B;AAC9B,gDAA8B;AAC9B,6CAA2B;AAC3B,iGAAiG;AACjG,iGAAiG;AACjG,kGAAkG;AAClG,mGAAmG;AACnG,6CAA6C;AAC7C,gDAA8B;AAC9B,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,iDAA+B;AAC/B,oDAAkC;AAClC,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yCAAuB;AACvB,+CAA6B;AAC7B,gDAA8B;AAC9B,gDAA8B;AAC9B,2CAAyB;AACzB,6CAA2B;AAC3B,gDAA8B;AAC9B,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,iDAA+B;AAC/B,oDAAkC;AAClC,6CAA2B"}
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.repository = exports.datasource = exports.model = void 0;
4
4
  const bindings_1 = require("../../common/bindings");
5
5
  const inversion_1 = require("../../helpers/inversion");
6
- const core_1 = require("@venizia/ignis-helpers/core");
7
6
  const common_1 = require("@venizia/ignis-helpers/common");
7
+ const core_1 = require("@venizia/ignis-helpers/core");
8
8
  const datasources_1 = require("../datasources");
9
9
  /** Registers a model class with its static schema and relations. */
10
10
  const model = (metadata) => {
@@ -1 +1 @@
1
- {"version":3,"file":"persistents.js","sourceRoot":"","sources":["../../../../src/base/metadata/persistents.ts"],"names":[],"mappings":";;;AAAA,gDAAsD;AAQtD,mDAAkF;AAClF,sDAAuD;AACvD,0DAA2E;AAE3E,gDAAmD;AAGnD,oEAAoE;AAC7D,MAAM,KAAK,GAAG,CAAC,QAAwB,EAAkB,EAAE;IAChE,OAAO,MAAM,CAAC,EAAE;QACd,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;QACrD,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,EAAE,CAAC;YACzF,MAAM,IAAA,eAAQ,EAAC;gBACb,OAAO,EAAE,WAAW,MAAM,CAAC,IAAI,iEAAiE,YAAY,EAAE;aAC/G,CAAC,CAAC;QACL,CAAC;QAED,0FAA0F;QAC1F,4FAA4F;QAC5F,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC7C,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC;YAC7E,MAAM,IAAA,eAAQ,EAAC;gBACb,OAAO,EAAE,WAAW,MAAM,CAAC,IAAI,6DAA6D,QAAQ,EAAE;aACvG,CAAC,CAAC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AY,CAAC;AAGlD,eAAO,MAAM,eAAe,GAAI,MAAM;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,oBA0BzD,CAAC"}
1
+ {"version":3,"file":"not-found.middleware.d.ts","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGlD,eAAO,MAAM,eAAe,GAAI,MAAM;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,oBA6BzD,CAAC"}
@@ -7,7 +7,10 @@ const notFoundHandler = (opts) => {
7
7
  const { logger = console } = opts;
8
8
  const mw = async (context) => {
9
9
  const requestId = context.get(common_2.REQUEST_ID_KEY);
10
- logger.error('[%s] URL NOT FOUND | path: %s | url: %s', requestId, context.req.path, context.req.url);
10
+ // WARN, not ERROR: an unrouted path is the callers mistake, and this middleware is installed
11
+ // unconditionally - so scanner traffic filled the dedicated error log and tripped error-volume
12
+ // alerting. The same reasoning is already applied to an expired token elsewhere in the tree.
13
+ logger.warn('[%s] URL NOT FOUND | path: %s | url: %s', requestId, context.req.path, context.req.url);
11
14
  return context.json({
12
15
  message: 'URL NOT FOUND',
13
16
  statusCode: common_1.HTTP.ResultCodes.RS_4.NotFound,
@@ -1 +1 @@
1
- {"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAErD,sCAA2C;AAEpC,MAAM,eAAe,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,EAAC,OAAO,EAAC,EAAE;QAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAc,CAAC,CAAC;QAE9C,MAAM,CAAC,KAAK,CACV,yCAAyC,EACzC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CACjB;YACE,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;YAC1C,SAAS;YACT,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;SACrB,EACD,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AA1BW,QAAA,eAAe,mBA0B1B"}
1
+ {"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AAErD,sCAA2C;AAEpC,MAAM,eAAe,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,EAAC,OAAO,EAAC,EAAE;QAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAc,CAAC,CAAC;QAE9C,6FAA6F;QAC7F,+FAA+F;QAC/F,6FAA6F;QAC7F,MAAM,CAAC,IAAI,CACT,yCAAyC,EACzC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CACjB;YACE,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;YAC1C,SAAS;YACT,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;SACrB,EACD,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AA7BW,QAAA,eAAe,mBA6B1B"}
@@ -21,6 +21,26 @@ export type NumberIdType = number;
21
21
  export type StringIdType = string;
22
22
  export type BigIntIdType = bigint;
23
23
  export type IdType = NumberIdType | StringIdType | BigIntIdType;
24
+ declare const entityIdBrand: unique symbol;
25
+ /**
26
+ * A string id a plain `string` cannot be assigned to, so passing a name, code or email where an id
27
+ * belongs is a compile error. Opt a column in with `.$type<TEntityId>()`.
28
+ *
29
+ * IT VALIDATES NOTHING. `toEntityId` is a cast with a non-empty check; the value is making the
30
+ * laundering VISIBLE at each boundary, not proving the string is a real id.
31
+ *
32
+ * The cost is not optional: Drizzle derives `$inferInsert` and `$inferSelect` from the same field,
33
+ * so a branded column rejects every literal - `create({ data: { merchantId: 'M1' } })`, seeds,
34
+ * fixtures, path params - until each converts. A union with `string` would restore those but makes
35
+ * a plain `string` assignable again, which erases the whole guarantee. Measured, not assumed.
36
+ */
37
+ export type TEntityId = string & {
38
+ readonly [entityIdBrand]: never;
39
+ };
40
+ /** The only way into `TEntityId`. Rejects an empty string - an id that is `''` collapses a `where` to no condition. */
41
+ export declare const toEntityId: (opts: {
42
+ value: string;
43
+ }) => TEntityId;
24
44
  /** Path-param id shape every entity family resolves to (`AbstractEntity.getIdType()`). */
25
45
  export type TIdSchemaType = 'number' | 'string';
26
46
  export declare const idParamsSchema: (opts?: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/base/models/common/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAItC;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;iBA6BpB,CA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;;;;;;;;;;;;;;;;;;;;;CAcrD,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GACxE,GAAG,CAAC,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,GACzC,CAAC,CAAC;AAEN,KAAK,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,IAAI;KAC5C,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAC1F,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GACZ,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,0SAW7D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.snakeToCamel = exports.jsonResponse = exports.jsonContent = exports.idParamsSchema = exports.ErrorSchema = void 0;
3
+ exports.snakeToCamel = exports.jsonResponse = exports.jsonContent = exports.idParamsSchema = exports.toEntityId = exports.ErrorSchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const core_1 = require("@venizia/ignis-helpers/core");
6
6
  const common_1 = require("@venizia/ignis-helpers/common");
@@ -40,6 +40,14 @@ exports.ErrorSchema = zod_openapi_1.z
40
40
  details: { url: 'http://localhost:3000/categories', path: '/categories' },
41
41
  },
42
42
  });
43
+ /** The only way into `TEntityId`. Rejects an empty string - an id that is `''` collapses a `where` to no condition. */
44
+ const toEntityId = (opts) => {
45
+ if (opts.value.length === 0) {
46
+ throw (0, core_1.getError)({ message: '[toEntityId] Refusing an empty string as an entity id' });
47
+ }
48
+ return opts.value;
49
+ };
50
+ exports.toEntityId = toEntityId;
43
51
  const idParamsSchema = (opts) => {
44
52
  const { idType = 'number' } = opts ?? {};
45
53
  switch (idType) {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/base/models/common/types.ts"],"names":[],"mappings":";;;AAAA,mDAAsC;AACtC,sDAA6E;AAC7E,0DAAqD;AAErD;;;;;GAKG;AACU,QAAA,WAAW,GAAG,eAAC;KACzB,MAAM,CAAC;IACN,UAAU,EAAE,eAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,eAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,eAAC;SACV,MAAM,CAAC;QACN,IAAI,EAAE,eAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,eAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,eAAC,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,EAAE,eAAC,CAAC,GAAG,EAAE,CAAC;KACpC,CAAC;SACD,QAAQ,EAAE;IACb,KAAK,EAAE,eAAC,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,EAAE,eAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,SAAS,EAAE,eAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,eAAC,CAAC,MAAM,CAAC,eAAC,CAAC,MAAM,EAAE,EAAE,eAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CAClD,CAAC;KACD,OAAO,CAAC;IACP,WAAW,EAAE,cAAc;IAC3B,OAAO,EAAE;QACP,UAAU,EAAE,GAAG;QACf,OAAO,EAAE,0CAA0C;QACnD,UAAU,EAAE;YACV,IAAI,EAAE,0CAA0C;YAChD,IAAI,EAAE,gDAAgD;YACtD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SACzB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AAQ,EAAE,EAAE;IAChE,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CACnC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzC,OAAO,CAAC,IAAA,cAAO,EAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC,CAAC,CACkB,CAAC;IAEvB,OAAO,eAAC;SACL,MAAM,CAAC,KAAK,CAAC;SACb,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,kBAAW,EAAC,IAAI,CAAC,CAAC;SACpC,IAAI,CAAC,eAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB"}
@@ -23,6 +23,32 @@ export declare class RepositoryOperationScopes {
23
23
  }
24
24
  /** Valid repository operation scope values. */
25
25
  export type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;
26
+ /** What a row-scope filter (`@model` settings.scopeFilter) does when `resolve()` returns null/undefined. */
27
+ export declare class ScopeFilterMissingBehaviors {
28
+ /** An unresolved scope matches ZERO rows - the safe reading of "caller's scope is unknown". */
29
+ static readonly DENY = "deny";
30
+ /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */
31
+ static readonly ALLOW = "allow";
32
+ static readonly SCHEME_SET: Set<string>;
33
+ static isValid(behavior: string): boolean;
34
+ }
35
+ /** Valid scope-filter missing-behavior values. */
36
+ export type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;
37
+ /**
38
+ * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted
39
+ * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static
40
+ * settings, so using it for a per-user bypass (an internal operator) would also unscope every
41
+ * ordinary user whose `resolve()` happens to return nothing.
42
+ */
43
+ export declare class ScopeFilters {
44
+ /**
45
+ * Return from `resolve()` to apply NO scope for this request - a caller the application has
46
+ * decided sees everything. Deliberately a symbol: forgetting to return must land in deny, and no
47
+ * JSON body, query string, or header can ever produce this value. `Symbol.for` so two installed
48
+ * copies of this package agree on identity, same as `DATA_SOURCE_BRAND`.
49
+ */
50
+ static readonly UNRESTRICTED: unique symbol;
51
+ }
26
52
  /** Machine-readable codes for repository-level failures, in the dotted namespace core already uses (`core.not_supported`, `core.search_engine.*`) - a client maps the code, never the message. */
27
53
  export declare class RepositoryErrorCodes {
28
54
  /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,uDAAuD;AACvD,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,gGAAgG;AAChG,qBAAa,yBAAyB;IACpC,MAAM,CAAC,QAAQ,CAAC,SAAS,eAAe;IACxC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,UAAU,cAA+D;IAEzF,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAGzC;AAED,+CAA+C;AAC/C,MAAM,MAAM,yBAAyB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEtF,kMAAkM;AAClM,qBAAa,oBAAoB;IAC/B,qGAAqG;IACrG,MAAM,CAAC,QAAQ,CAAC,qBAAqB,SAElC;CACJ;AAED,0CAA0C;AAC1C,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E,mEAAmE;AACnE,qBAA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AAC,QAAQ,CAAC,SAAS,eAAe;IACxC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAKvB;IAEH,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAG1C;AAED,kCAAkC;AAClC,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LockStrengths = exports.RelationTypes = exports.RepositoryErrorCodes = exports.RepositoryOperationScopes = exports.DEFAULT_MAX_LIMIT = exports.DEFAULT_LIMIT = void 0;
3
+ exports.LockStrengths = exports.RelationTypes = exports.RepositoryErrorCodes = exports.ScopeFilters = exports.ScopeFilterMissingBehaviors = exports.RepositoryOperationScopes = exports.DEFAULT_MAX_LIMIT = exports.DEFAULT_LIMIT = void 0;
4
4
  const core_1 = require("@venizia/ignis-helpers/core");
5
5
  /** Default pagination limit for repository queries. */
6
6
  exports.DEFAULT_LIMIT = 10;
@@ -27,6 +27,34 @@ class RepositoryOperationScopes {
27
27
  }
28
28
  }
29
29
  exports.RepositoryOperationScopes = RepositoryOperationScopes;
30
+ /** What a row-scope filter (`@model` settings.scopeFilter) does when `resolve()` returns null/undefined. */
31
+ class ScopeFilterMissingBehaviors {
32
+ /** An unresolved scope matches ZERO rows - the safe reading of "caller's scope is unknown". */
33
+ static { this.DENY = 'deny'; }
34
+ /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */
35
+ static { this.ALLOW = 'allow'; }
36
+ static { this.SCHEME_SET = new Set([this.DENY, this.ALLOW]); }
37
+ static isValid(behavior) {
38
+ return this.SCHEME_SET.has(behavior);
39
+ }
40
+ }
41
+ exports.ScopeFilterMissingBehaviors = ScopeFilterMissingBehaviors;
42
+ /**
43
+ * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted
44
+ * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static
45
+ * settings, so using it for a per-user bypass (an internal operator) would also unscope every
46
+ * ordinary user whose `resolve()` happens to return nothing.
47
+ */
48
+ class ScopeFilters {
49
+ /**
50
+ * Return from `resolve()` to apply NO scope for this request - a caller the application has
51
+ * decided sees everything. Deliberately a symbol: forgetting to return must land in deny, and no
52
+ * JSON body, query string, or header can ever produce this value. `Symbol.for` so two installed
53
+ * copies of this package agree on identity, same as `DATA_SOURCE_BRAND`.
54
+ */
55
+ static { this.UNRESTRICTED = Symbol.for('@venizia/ignis-kernel:scope-filter-unrestricted'); }
56
+ }
57
+ exports.ScopeFilters = ScopeFilters;
30
58
  /** Machine-readable codes for repository-level failures, in the dotted namespace core already uses (`core.not_supported`, `core.search_engine.*`) - a client maps the code, never the message. */
31
59
  class RepositoryErrorCodes {
32
60
  /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,uDAAuD;AAC1C,QAAA,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACU,QAAA,iBAAiB,GAAG,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAa,yBAAyB;aACpB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAEzF,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;;AARH,8DASC;AAKD,kMAAkM;AAClM,MAAa,oBAAoB;IAC/B,qGAAqG;aACrF,0BAAqB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACxD,KAAK,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,uBAAuB,CAAC;KACvD,CAAC,CAAC;;AAJL,oDAKC;AAKD,mEAAmE;AACnE,MAAa,aAAa;aACR,QAAG,GAAG,KAAK,CAAC;aACZ,SAAI,GAAG,MAAM,CAAC;aACd,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE5D,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;;AAPH,sCAQC;AAKD,yEAAyE;AACzE,MAAa,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,kBAAa,GAAG,eAAe,CAAC;aAChC,UAAK,GAAG,OAAO,CAAC;aAChB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;;AAdH,sCAeC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,uDAAuD;AAC1C,QAAA,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACU,QAAA,iBAAiB,GAAG,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAa,yBAAyB;aACpB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,YAAY,CAAC;aAC1B,eAAU,GAAG,IAA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CAQC;AAKD,yEAAyE;AACzE,MAAa,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,kBAAa,GAAG,eAAe,CAAC;aAChC,UAAK,GAAG,OAAO,CAAC;aAChB,cAAS,GAAG,WAAW,CAAC;aACxB,eAAU,GAAG,IAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,aAAa;QAClB,IAAI,CAAC,KAAK;QACV,IAAI,CAAC,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;;AAdH,sCAeC"}
@@ -47,6 +47,35 @@ export declare abstract class AbstractRepository<TDataObject extends object, TPe
47
47
  protected get defaultLimit(): number | undefined;
48
48
  /** Largest `limit` a caller may ask for, when the model declares one; undefined leaves the tier's own default in force. */
49
49
  protected get maxLimit(): number | undefined;
50
+ /**
51
+ * Both bounds, in one place, for every tier.
52
+ *
53
+ * The upper bound is the point: `@model({ settings: { maxLimit } })` is public and validated at
54
+ * decoration time, but the relational tier read it nowhere, so `maxLimit: 2` still issued
55
+ * `LIMIT 50000000`.
56
+ *
57
+ * The lower bound matters just as much and is easy to miss: a NEGATIVE limit is not a smaller
58
+ * page. Drizzle renders the LIMIT clause only when the value is `>= 0`, so a negative one removes
59
+ * the clause and returns the whole table. The wire schema now rejects it too, but a server-side
60
+ * caller reaches this method without passing through the schema at all.
61
+ */
62
+ protected assertLimitWithinCeiling(opts: {
63
+ limit?: number;
64
+ scope?: string;
65
+ }): void;
66
+ /**
67
+ * The whole filter, relations included. Checking only the top-level `limit` left the identical
68
+ * defect reachable one level down: a relation scope's negative limit drops Drizzle's LIMIT clause
69
+ * for that relation and loads the entire related table.
70
+ *
71
+ * A relation's limit gets the SHAPE check only, not a ceiling. The ceiling belongs to the
72
+ * relation's own model, which this repository cannot resolve - claiming otherwise would enforce
73
+ * the parent's `maxLimit` on a different entity.
74
+ */
75
+ protected assertFilterLimits(opts: {
76
+ filter?: TFilter;
77
+ scope?: string;
78
+ }): void;
50
79
  /** Resolves the entity instance from @repository metadata on first access. */
51
80
  protected resolveEntity(): AbstractEntity;
52
81
  /** Rejects a verb the current operation scope does not permit. */