@artstesh/postboy 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/lib/index.cjs +2 -0
  2. package/lib/index.cjs.map +1 -0
  3. package/lib/index.d.mts +701 -0
  4. package/lib/index.d.ts +701 -13
  5. package/lib/index.mjs +2 -0
  6. package/lib/index.mjs.map +1 -0
  7. package/package.json +52 -19
  8. package/lib/i-postboy-depending.service.d.ts +0 -5
  9. package/lib/i-postboy-depending.service.d.ts.map +0 -1
  10. package/lib/i-postboy-depending.service.js +0 -3
  11. package/lib/i-postboy-depending.service.js.map +0 -1
  12. package/lib/index.d.ts.map +0 -1
  13. package/lib/index.js +0 -32
  14. package/lib/index.js.map +0 -1
  15. package/lib/locker.store.d.ts +0 -9
  16. package/lib/locker.store.d.ts.map +0 -1
  17. package/lib/locker.store.js +0 -27
  18. package/lib/locker.store.js.map +0 -1
  19. package/lib/messages/add-middleware.executor.d.ts +0 -19
  20. package/lib/messages/add-middleware.executor.d.ts.map +0 -1
  21. package/lib/messages/add-middleware.executor.js +0 -24
  22. package/lib/messages/add-middleware.executor.js.map +0 -1
  23. package/lib/messages/add-namespace.executor.d.ts +0 -19
  24. package/lib/messages/add-namespace.executor.d.ts.map +0 -1
  25. package/lib/messages/add-namespace.executor.js +0 -24
  26. package/lib/messages/add-namespace.executor.js.map +0 -1
  27. package/lib/messages/connect-executor.executor.d.ts +0 -25
  28. package/lib/messages/connect-executor.executor.d.ts.map +0 -1
  29. package/lib/messages/connect-executor.executor.js +0 -30
  30. package/lib/messages/connect-executor.executor.js.map +0 -1
  31. package/lib/messages/connect-handler.executor.d.ts +0 -25
  32. package/lib/messages/connect-handler.executor.d.ts.map +0 -1
  33. package/lib/messages/connect-handler.executor.js +0 -30
  34. package/lib/messages/connect-handler.executor.js.map +0 -1
  35. package/lib/messages/connect-message.executor.d.ts +0 -28
  36. package/lib/messages/connect-message.executor.d.ts.map +0 -1
  37. package/lib/messages/connect-message.executor.js +0 -31
  38. package/lib/messages/connect-message.executor.js.map +0 -1
  39. package/lib/messages/connect.message.executor.d.ts +0 -28
  40. package/lib/messages/connect.message.executor.d.ts.map +0 -1
  41. package/lib/messages/connect.message.executor.js +0 -31
  42. package/lib/messages/connect.message.executor.js.map +0 -1
  43. package/lib/messages/disconnect-message.executor.d.ts +0 -19
  44. package/lib/messages/disconnect-message.executor.d.ts.map +0 -1
  45. package/lib/messages/disconnect-message.executor.js +0 -25
  46. package/lib/messages/disconnect-message.executor.js.map +0 -1
  47. package/lib/messages/eliminate-namespace.executor.d.ts +0 -16
  48. package/lib/messages/eliminate-namespace.executor.d.ts.map +0 -1
  49. package/lib/messages/eliminate-namespace.executor.js +0 -22
  50. package/lib/messages/eliminate-namespace.executor.js.map +0 -1
  51. package/lib/messages/index.d.ts +0 -11
  52. package/lib/messages/index.d.ts.map +0 -1
  53. package/lib/messages/index.js +0 -24
  54. package/lib/messages/index.js.map +0 -1
  55. package/lib/messages/lock-message.executor.d.ts +0 -22
  56. package/lib/messages/lock-message.executor.d.ts.map +0 -1
  57. package/lib/messages/lock-message.executor.js +0 -26
  58. package/lib/messages/lock-message.executor.js.map +0 -1
  59. package/lib/messages/remove-middleware.executor.d.ts +0 -17
  60. package/lib/messages/remove-middleware.executor.d.ts.map +0 -1
  61. package/lib/messages/remove-middleware.executor.js +0 -22
  62. package/lib/messages/remove-middleware.executor.js.map +0 -1
  63. package/lib/messages/unlock-message.executor.d.ts +0 -21
  64. package/lib/messages/unlock-message.executor.d.ts.map +0 -1
  65. package/lib/messages/unlock-message.executor.js +0 -25
  66. package/lib/messages/unlock-message.executor.js.map +0 -1
  67. package/lib/mocks/message-history-item-mock.d.ts +0 -10
  68. package/lib/mocks/message-history-item-mock.d.ts.map +0 -1
  69. package/lib/mocks/message-history-item-mock.js +0 -26
  70. package/lib/mocks/message-history-item-mock.js.map +0 -1
  71. package/lib/mocks/message-history-mock.d.ts +0 -9
  72. package/lib/mocks/message-history-mock.d.ts.map +0 -1
  73. package/lib/mocks/message-history-mock.js +0 -23
  74. package/lib/mocks/message-history-mock.js.map +0 -1
  75. package/lib/mocks/postboy-service-mock.d.ts +0 -22
  76. package/lib/mocks/postboy-service-mock.d.ts.map +0 -1
  77. package/lib/mocks/postboy-service-mock.js +0 -51
  78. package/lib/mocks/postboy-service-mock.js.map +0 -1
  79. package/lib/models/cancel-details.d.ts +0 -9
  80. package/lib/models/cancel-details.d.ts.map +0 -1
  81. package/lib/models/cancel-details.js +0 -3
  82. package/lib/models/cancel-details.js.map +0 -1
  83. package/lib/models/cancel-error.d.ts +0 -7
  84. package/lib/models/cancel-error.d.ts.map +0 -1
  85. package/lib/models/cancel-error.js +0 -18
  86. package/lib/models/cancel-error.js.map +0 -1
  87. package/lib/models/message-queue.model.d.ts +0 -44
  88. package/lib/models/message-queue.model.d.ts.map +0 -1
  89. package/lib/models/message-queue.model.js +0 -66
  90. package/lib/models/middleware-decision.enum.d.ts +0 -5
  91. package/lib/models/middleware-decision.enum.d.ts.map +0 -1
  92. package/lib/models/middleware-decision.enum.js +0 -9
  93. package/lib/models/middleware-decision.enum.js.map +0 -1
  94. package/lib/models/middleware-stage.enum.d.ts +0 -6
  95. package/lib/models/middleware-stage.enum.d.ts.map +0 -1
  96. package/lib/models/middleware-stage.enum.js +0 -10
  97. package/lib/models/middleware-stage.enum.js.map +0 -1
  98. package/lib/models/pipeline-context.d.ts +0 -7
  99. package/lib/models/pipeline-context.d.ts.map +0 -1
  100. package/lib/models/pipeline-context.js +0 -3
  101. package/lib/models/pipeline-context.js.map +0 -1
  102. package/lib/models/pipeline-result.d.ts +0 -6
  103. package/lib/models/pipeline-result.d.ts.map +0 -1
  104. package/lib/models/pipeline-result.js +0 -3
  105. package/lib/models/pipeline-result.js.map +0 -1
  106. package/lib/models/postboy-callback.message.d.ts +0 -48
  107. package/lib/models/postboy-callback.message.d.ts.map +0 -1
  108. package/lib/models/postboy-callback.message.js +0 -60
  109. package/lib/models/postboy-callback.message.js.map +0 -1
  110. package/lib/models/postboy-execution.handler.d.ts +0 -21
  111. package/lib/models/postboy-execution.handler.d.ts.map +0 -1
  112. package/lib/models/postboy-execution.handler.js +0 -17
  113. package/lib/models/postboy-execution.handler.js.map +0 -1
  114. package/lib/models/postboy-executor.d.ts +0 -5
  115. package/lib/models/postboy-executor.d.ts.map +0 -1
  116. package/lib/models/postboy-executor.js +0 -8
  117. package/lib/models/postboy-executor.js.map +0 -1
  118. package/lib/models/postboy-generic-message.d.ts +0 -8
  119. package/lib/models/postboy-generic-message.d.ts.map +0 -1
  120. package/lib/models/postboy-generic-message.js +0 -17
  121. package/lib/models/postboy-generic-message.js.map +0 -1
  122. package/lib/models/postboy-message-metadata.d.ts +0 -26
  123. package/lib/models/postboy-message-metadata.d.ts.map +0 -1
  124. package/lib/models/postboy-message-metadata.js +0 -3
  125. package/lib/models/postboy-message-metadata.js.map +0 -1
  126. package/lib/models/postboy-message.context.d.ts +0 -9
  127. package/lib/models/postboy-message.context.d.ts.map +0 -1
  128. package/lib/models/postboy-message.context.js +0 -3
  129. package/lib/models/postboy-message.context.js.map +0 -1
  130. package/lib/models/postboy-middleware.d.ts +0 -5
  131. package/lib/models/postboy-middleware.d.ts.map +0 -1
  132. package/lib/models/postboy-middleware.js +0 -3
  133. package/lib/models/postboy-middleware.js.map +0 -1
  134. package/lib/models/postboy-subscription.d.ts +0 -39
  135. package/lib/models/postboy-subscription.d.ts.map +0 -1
  136. package/lib/models/postboy-subscription.js +0 -49
  137. package/lib/models/postboy-subscription.js.map +0 -1
  138. package/lib/models/postboy.locker.d.ts +0 -6
  139. package/lib/models/postboy.locker.d.ts.map +0 -1
  140. package/lib/models/postboy.locker.js +0 -3
  141. package/lib/models/postboy.locker.js.map +0 -1
  142. package/lib/models/postboy.message.d.ts +0 -7
  143. package/lib/models/postboy.message.d.ts.map +0 -1
  144. package/lib/models/postboy.message.js +0 -17
  145. package/lib/models/postboy.message.js.map +0 -1
  146. package/lib/models/postboy.settings.d.ts +0 -13
  147. package/lib/models/postboy.settings.d.ts.map +0 -1
  148. package/lib/models/postboy.settings.js +0 -20
  149. package/lib/models/postboy.settings.js.map +0 -1
  150. package/lib/postboy-abstract.registrator.d.ts +0 -97
  151. package/lib/postboy-abstract.registrator.d.ts.map +0 -1
  152. package/lib/postboy-abstract.registrator.js +0 -138
  153. package/lib/postboy-abstract.registrator.js.map +0 -1
  154. package/lib/postboy.service.d.ts +0 -157
  155. package/lib/postboy.service.d.ts.map +0 -1
  156. package/lib/postboy.service.js +0 -242
  157. package/lib/postboy.service.js.map +0 -1
  158. package/lib/services/namespace-registrator.d.ts +0 -14
  159. package/lib/services/namespace-registrator.d.ts.map +0 -1
  160. package/lib/services/namespace-registrator.js +0 -21
  161. package/lib/services/namespace-registrator.js.map +0 -1
  162. package/lib/services/postboy-context.service.d.ts +0 -13
  163. package/lib/services/postboy-context.service.d.ts.map +0 -1
  164. package/lib/services/postboy-context.service.js +0 -50
  165. package/lib/services/postboy-context.service.js.map +0 -1
  166. package/lib/services/postboy-dependency.resolver.d.ts +0 -32
  167. package/lib/services/postboy-dependency.resolver.d.ts.map +0 -1
  168. package/lib/services/postboy-dependency.resolver.js +0 -38
  169. package/lib/services/postboy-dependency.resolver.js.map +0 -1
  170. package/lib/services/postboy-message.store.d.ts +0 -20
  171. package/lib/services/postboy-message.store.d.ts.map +0 -1
  172. package/lib/services/postboy-message.store.js +0 -61
  173. package/lib/services/postboy-message.store.js.map +0 -1
  174. package/lib/services/postboy-middleware.d.ts +0 -35
  175. package/lib/services/postboy-middleware.d.ts.map +0 -1
  176. package/lib/services/postboy-middleware.js +0 -47
  177. package/lib/services/postboy-middleware.js.map +0 -1
  178. package/lib/services/postboy-middleware.service.d.ts +0 -37
  179. package/lib/services/postboy-middleware.service.d.ts.map +0 -1
  180. package/lib/services/postboy-middleware.service.js +0 -50
  181. package/lib/services/postboy-middleware.service.js.map +0 -1
  182. package/lib/services/postboy-namespace.store.d.ts +0 -34
  183. package/lib/services/postboy-namespace.store.d.ts.map +0 -1
  184. package/lib/services/postboy-namespace.store.js +0 -54
  185. package/lib/services/postboy-namespace.store.js.map +0 -1
  186. package/lib/tests/integration/models/test-callback-message.d.ts +0 -6
  187. package/lib/tests/integration/models/test-callback-message.d.ts.map +0 -1
  188. package/lib/tests/integration/models/test-callback-message.js +0 -13
  189. package/lib/tests/integration/models/test-callback-message.js.map +0 -1
  190. package/lib/tests/integration/models/test-executor.d.ts +0 -7
  191. package/lib/tests/integration/models/test-executor.d.ts.map +0 -1
  192. package/lib/tests/integration/models/test-executor.js +0 -13
  193. package/lib/tests/integration/models/test-executor.js.map +0 -1
  194. package/lib/tests/integration/models/test-handler.d.ts +0 -8
  195. package/lib/tests/integration/models/test-handler.d.ts.map +0 -1
  196. package/lib/tests/integration/models/test-handler.js +0 -15
  197. package/lib/tests/integration/models/test-handler.js.map +0 -1
  198. package/lib/tests/integration/models/test-message.d.ts +0 -6
  199. package/lib/tests/integration/models/test-message.d.ts.map +0 -1
  200. package/lib/tests/integration/models/test-message.js +0 -13
  201. package/lib/tests/integration/models/test-message.js.map +0 -1
  202. package/lib/tests/integration/models/test-postboy.d.ts +0 -4
  203. package/lib/tests/integration/models/test-postboy.d.ts.map +0 -1
  204. package/lib/tests/integration/models/test-postboy.js +0 -8
  205. package/lib/tests/integration/models/test-postboy.js.map +0 -1
  206. package/lib/tests/integration/models/test-registry.d.ts +0 -8
  207. package/lib/tests/integration/models/test-registry.d.ts.map +0 -1
  208. package/lib/tests/integration/models/test-registry.js +0 -15
  209. package/lib/tests/integration/models/test-registry.js.map +0 -1
  210. package/lib/utils/id.generator.d.ts +0 -5
  211. package/lib/utils/id.generator.d.ts.map +0 -1
  212. package/lib/utils/id.generator.js +0 -18
  213. package/lib/utils/id.generator.js.map +0 -1
@@ -1,242 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PostboyService = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const postboy_generic_message_1 = require("./models/postboy-generic-message");
6
- const postboy_subscription_1 = require("./models/postboy-subscription");
7
- const postboy_dependency_resolver_1 = require("./services/postboy-dependency.resolver");
8
- const add_namespace_executor_1 = require("./messages/add-namespace.executor");
9
- const eliminate_namespace_executor_1 = require("./messages/eliminate-namespace.executor");
10
- const add_middleware_executor_1 = require("./messages/add-middleware.executor");
11
- const remove_middleware_executor_1 = require("./messages/remove-middleware.executor");
12
- const lock_message_executor_1 = require("./messages/lock-message.executor");
13
- const unlock_message_executor_1 = require("./messages/unlock-message.executor");
14
- const disconnect_message_executor_1 = require("./messages/disconnect-message.executor");
15
- const connect_message_executor_1 = require("./messages/connect-message.executor");
16
- const connect_executor_executor_1 = require("./messages/connect-executor.executor");
17
- const connect_handler_executor_1 = require("./messages/connect-handler.executor");
18
- class PostboyService {
19
- constructor(resolver) {
20
- this.locked = new Set();
21
- this.dependencyResolver = resolver || new postboy_dependency_resolver_1.PostboyDependencyResolver();
22
- this.middleware = this.dependencyResolver.getMiddlewareService();
23
- this.store = this.dependencyResolver.getMessageStore();
24
- this.namespaceStore = this.dependencyResolver.getNamespaceStore();
25
- this.registerInfrastructureMessages();
26
- }
27
- registerInfrastructureMessages() {
28
- this.store.registerExecutor(disconnect_message_executor_1.DisconnectMessage.ID, (e) => this.store.unregister(e.messageId));
29
- this.store.registerExecutor(unlock_message_executor_1.UnlockMessage.ID, (e) => this.locked.delete((0, postboy_generic_message_1.checkId)(e.type)));
30
- this.store.registerExecutor(lock_message_executor_1.LockMessage.ID, (e) => this.locked.add((0, postboy_generic_message_1.checkId)(e.type)));
31
- this.store.registerExecutor(add_middleware_executor_1.AddMiddleware.ID, (e) => this.middleware.addMiddleware(e.middleware));
32
- this.store.registerExecutor(remove_middleware_executor_1.RemoveMiddleware.ID, (e) => this.middleware.removeMiddleware(e.middleware));
33
- this.store.registerExecutor(add_namespace_executor_1.AddNamespace.ID, (e) => this.namespaceStore.addSpace(e.space, this));
34
- this.store.registerExecutor(eliminate_namespace_executor_1.EliminateNamespace.ID, (e) => this.namespaceStore.eliminateSpace(e.space));
35
- this.store.registerExecutor(connect_message_executor_1.ConnectMessage.ID, (e) => {
36
- const { type, sub, pipe } = e;
37
- this.store.registerMessage((0, postboy_generic_message_1.checkId)(type), new postboy_subscription_1.PostboySubscription(sub, pipe));
38
- });
39
- this.store.registerExecutor(connect_executor_executor_1.ConnectExecutor.ID, (e) => {
40
- const { type, exec } = e;
41
- this.store.registerExecutor((0, postboy_generic_message_1.checkId)(type), exec);
42
- });
43
- this.store.registerExecutor(connect_handler_executor_1.ConnectHandler.ID, (e) => {
44
- const { executor, handler } = e;
45
- this.store.registerExecutor((0, postboy_generic_message_1.checkId)(executor), (e) => handler.handle(e));
46
- });
47
- }
48
- /**
49
- * Locks a specific message type to prevent further modifications or actions.
50
- *
51
- * @deprecated The method should be replaced with firing {@link LockMessage} message.
52
- * @param {MessageType<T>} type - The message type to be locked. It must extend from the `PostboyGenericMessage`.
53
- * @return {void} This method does not return a value.
54
- */
55
- lock(type) {
56
- this.locked.add((0, postboy_generic_message_1.checkId)(type));
57
- }
58
- /**
59
- * Unlocks a previously locked message type by removing its ID from the locked set.
60
- *
61
- * @deprecated The method should be replaced with firing {@link UnlockMessage} message.
62
- * @param {MessageType<T>} type - The message type to unlock, which is a generic type extending PostboyGenericMessage.
63
- * @return {void} This method does not return any value.
64
- */
65
- unlock(type) {
66
- this.locked.delete((0, postboy_generic_message_1.checkId)(type));
67
- }
68
- /**
69
- * Adds a middleware to the middleware stack.
70
- *
71
- * @deprecated The method should be replaced with firing {@link AddMiddleware} message.
72
- * @param {PostboyMiddleware} middleware - The middleware instance to be added.
73
- * @return {void}
74
- */
75
- addMiddleware(middleware) {
76
- return this.middleware.addMiddleware(middleware);
77
- }
78
- /**
79
- * Removes a middleware from the current middleware stack.
80
- *
81
- * @deprecated The method should be replaced with firing {@link RemoveMiddleware} message.
82
- * @param {PostboyMiddleware} middleware - The middleware instance to be removed.
83
- * @return {void} No return value.
84
- */
85
- removeMiddleware(middleware) {
86
- return this.middleware.removeMiddleware(middleware);
87
- }
88
- /**
89
- * Unregisters a message identified by the given ID from the store.
90
- *
91
- * @deprecated The method should be replaced with firing {@link DisconnectMessage} message.
92
- * @param {string} id - The unique identifier of the item to unregister.
93
- * @return {void} No value is returned.
94
- */
95
- unregister(id) {
96
- return this.store.unregister(id);
97
- }
98
- /**
99
- * Fires a registered event and passes the message to its subscribers.
100
- *
101
- * @param {PostboyGenericMessage} message - The message object containing the event data.
102
- * @return {void} This method does not return a value.
103
- * @throws {Error} Throws an error if no registered event is found for the provided message ID.
104
- */
105
- fire(message) {
106
- this.middleware.manage(message);
107
- if (!this.locked.has(message.id))
108
- this.store.getMessage(message.id, message.constructor.name).fire(message);
109
- }
110
- /**
111
- * Triggers a callback function associated with a given message.
112
- *
113
- * @param {PostboyCallbackMessage<T>} message - The message object used to trigger the callback.
114
- * It contains details about the event and result subscription.
115
- * @param {(e: T) => void} [action] - Optional callback function to execute when the result of the message is emitted.
116
- * @return {void} This method does not return any value.
117
- */
118
- fireCallback(message, action) {
119
- this.middleware.manage(message);
120
- this.store.callbackFired(message);
121
- const result$ = action ? message.result.pipe((0, rxjs_1.tap)(action)) : message.result;
122
- const observable = new rxjs_1.Observable((subscriber) => {
123
- const subscription = result$.subscribe(subscriber);
124
- if (!this.locked.has(message.id)) {
125
- this.store.getMessage(message.id, message.constructor.name).fire(message);
126
- }
127
- return () => subscription.unsubscribe();
128
- });
129
- if (!!action)
130
- observable.subscribe();
131
- return observable;
132
- }
133
- /**
134
- * Executes the provided executor function and returns its result.
135
- *
136
- * @param {PostboyExecutor<T>} executor The executor to be executed, which includes its identifier and logic.
137
- * @return {T} The resulting output from the executed executor function.
138
- * @throws {Error} If the specified executor is not registered.
139
- */
140
- exec(executor) {
141
- this.middleware.manage(executor);
142
- return this.store.getExecutor(executor.id)(executor);
143
- }
144
- /**
145
- * Subscribes to a specific message type and returns an observable of that type.
146
- *
147
- * @param type The constructor function of the type that extends PostboyGenericMessage.
148
- * @return An Observable of the specified generic message type.
149
- */
150
- sub(type) {
151
- return this.store.getMessage((0, postboy_generic_message_1.checkId)(type), type.name).sub();
152
- }
153
- /**
154
- * Subscribes to a specific message type and automatically unsubscribes after receiving the first message.
155
- *
156
- * @param type The type of message to subscribe to.
157
- * @return An observable that emits the first message of the specified type and then completes.
158
- */
159
- once(type) {
160
- return this.sub(type).pipe((0, rxjs_1.first)());
161
- }
162
- /**
163
- * Registers a given message type and its associated subject subscription with the system.
164
- *
165
- * @deprecated The method should be replaced with firing {@link ConnectMessage} message.
166
- * @param type The constructor function of the message type that extends the PostboyGenericMessage.
167
- * @param sub The Subject instance for the provided message type, used for managing subscriptions.
168
- * @return {void} No return value.
169
- */
170
- record(type, sub) {
171
- this.store.registerMessage((0, postboy_generic_message_1.checkId)(type), new postboy_subscription_1.PostboySubscription(sub, (s) => s.asObservable()));
172
- }
173
- /**
174
- * Registers a generic message type with a Subject and a transformation pipe.
175
- *
176
- * @deprecated The method should be replaced with firing {@link ConnectMessage} message.
177
- * @param {MessageType<T>} type - The constructor of the message type being registered.
178
- * @param {Subject<T>} sub - The Subject instance used to handle incoming messages of the specified type.
179
- * @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation or processing logic to the Subject and returns an Observable.
180
- * @return {void} No return value.
181
- */
182
- recordWithPipe(type, sub, pipe) {
183
- this.store.registerMessage((0, postboy_generic_message_1.checkId)(type), new postboy_subscription_1.PostboySubscription(sub, pipe));
184
- }
185
- /**
186
- * Registers an executor for a specified message type.
187
- *
188
- * @deprecated The method should be replaced with firing {@link ConnectExecutor} message.
189
- * @param {MessageType<E>} type - The message type for which the executor is being registered.
190
- * @param {(e: E) => T} exec - The executor function that will handle messages of the specified type.
191
- * @return {void} This method does not return any value.
192
- */
193
- recordExecutor(type, exec) {
194
- this.store.registerExecutor((0, postboy_generic_message_1.checkId)(type), exec);
195
- }
196
- /**
197
- * Registers a handler for a specific executor type.
198
- *
199
- * @deprecated The method should be replaced with firing {@link ConnectHandler} message.
200
- * @param executor The constructor of the executor class that extends `PostboyExecutor<R>`.
201
- * @param handler An instance of `PostboyExecutionHandler<R, E>` that defines the logic for handling the executor.
202
- * @return void
203
- */
204
- recordHandler(executor, handler) {
205
- this.store.registerExecutor((0, postboy_generic_message_1.checkId)(executor), (e) => handler.handle(e));
206
- }
207
- /**
208
- * Adds a namespace to the namespace store.
209
- *
210
- * @deprecated The method should be replaced with firing {@link AddNamespace} message.
211
- * @param {string} space - The name of the namespace to be added.
212
- * @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.
213
- */
214
- addNamespace(space) {
215
- return this.namespaceStore.addSpace(space, this);
216
- }
217
- /**
218
- * Removes the specified namespace from the namespace store.
219
- *
220
- * @deprecated The method should be replaced with firing {@link EliminateNamespace} message.
221
- * @param {string} space - The name of the namespace to be removed.
222
- * @return {void} This method does not return a value.
223
- */
224
- eliminateNamespace(space) {
225
- var _a;
226
- return (_a = this.namespaceStore) === null || _a === void 0 ? void 0 : _a.eliminateSpace(space);
227
- }
228
- /**
229
- * Disposes of resources and cleans up any internal components or stores associated with the instance.
230
- * This method ensures that all resources are properly released to avoid memory leaks.
231
- *
232
- * @return {void} This method does not return a value.
233
- */
234
- dispose() {
235
- var _a;
236
- (_a = this.namespaceStore) === null || _a === void 0 ? void 0 : _a.dispose();
237
- this.store.dispose();
238
- this.middleware.dispose();
239
- }
240
- }
241
- exports.PostboyService = PostboyService;
242
- //# sourceMappingURL=postboy.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy.service.js","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":";;;AAAA,+BAAuD;AACvD,8EAAkF;AAClF,wEAAoE;AAMpE,wFAAmF;AAInF,8EAAiE;AACjE,0FAA6E;AAC7E,gFAAmE;AACnE,sFAAyE;AACzE,4EAA+D;AAC/D,gFAAmE;AACnE,wFAA2E;AAC3E,kFAAqE;AACrE,oFAAuE;AACvE,k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,KAAa;;QACrC,OAAO,MAAA,IAAI,CAAC,cAAc,0CAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACI,OAAO;;QACZ,MAAA,IAAI,CAAC,cAAc,0CAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF;AAhQD,wCAgQC"}
@@ -1,14 +0,0 @@
1
- import { PostboyAbstractRegistrator } from '../postboy-abstract.registrator';
2
- import { PostboyService } from '../postboy.service';
3
- /**
4
- * NamespaceRegistrator is a specialized class that extends PostboyAbstractRegistrator.
5
- *
6
- * @class NamespaceRegistrator
7
- * @extends PostboyAbstractRegistrator
8
- * @param {PostboyService} postboy - An instance of the PostboyService, used for managing registrations.
9
- */
10
- export declare class NamespaceRegistrator extends PostboyAbstractRegistrator {
11
- constructor(postboy: PostboyService);
12
- protected _up(): void;
13
- }
14
- //# sourceMappingURL=namespace-registrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"namespace-registrator.d.ts","sourceRoot":"","sources":["../../src/services/namespace-registrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,0BAA0B;gBACtD,OAAO,EAAE,cAAc;IAInC,SAAS,CAAC,GAAG,IAAI,IAAI;CAGtB"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NamespaceRegistrator = void 0;
4
- const postboy_abstract_registrator_1 = require("../postboy-abstract.registrator");
5
- /**
6
- * NamespaceRegistrator is a specialized class that extends PostboyAbstractRegistrator.
7
- *
8
- * @class NamespaceRegistrator
9
- * @extends PostboyAbstractRegistrator
10
- * @param {PostboyService} postboy - An instance of the PostboyService, used for managing registrations.
11
- */
12
- class NamespaceRegistrator extends postboy_abstract_registrator_1.PostboyAbstractRegistrator {
13
- constructor(postboy) {
14
- super(postboy);
15
- }
16
- _up() {
17
- // ignore
18
- }
19
- }
20
- exports.NamespaceRegistrator = NamespaceRegistrator;
21
- //# sourceMappingURL=namespace-registrator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"namespace-registrator.js","sourceRoot":"","sources":["../../src/services/namespace-registrator.ts"],"names":[],"mappings":";;;AAAA,kFAA6E;AAG7E;;;;;;GAMG;AACH,MAAa,oBAAqB,SAAQ,yDAA0B;IAClE,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAES,GAAG;QACX,SAAS;IACX,CAAC;CACF;AARD,oDAQC"}
@@ -1,13 +0,0 @@
1
- import { PostboyMessageContext } from '../models/postboy-message.context';
2
- import { PostboyMessage } from '../models/postboy.message';
3
- export declare class PostboyContextService {
4
- active: boolean;
5
- private readonly storage;
6
- constructor(active?: boolean);
7
- private get current();
8
- run<T>(context: PostboyMessageContext, action: () => T): T;
9
- private createRoot;
10
- createChild(message: PostboyMessage): PostboyMessageContext;
11
- dispose(): void;
12
- }
13
- //# sourceMappingURL=postboy-context.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-context.service.d.ts","sourceRoot":"","sources":["../../src/services/postboy-context.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,qBAAa,qBAAqB;IAGb,MAAM,EAAE,OAAO;IAFlC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkD;gBAEvD,MAAM,GAAE,OAAc;IAEzC,OAAO,KAAK,OAAO,GAElB;IAEM,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC;IAIjE,OAAO,CAAC,UAAU;IAUX,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,qBAAqB;IAmB3D,OAAO,IAAI,IAAI;CAGvB"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PostboyContextService = void 0;
4
- const node_async_hooks_1 = require("node:async_hooks");
5
- class PostboyContextService {
6
- constructor(active = true) {
7
- this.active = active;
8
- this.storage = new node_async_hooks_1.AsyncLocalStorage();
9
- }
10
- get current() {
11
- return this.storage.getStore();
12
- }
13
- run(context, action) {
14
- return this.active ? this.storage.run(context, action) : action();
15
- }
16
- createRoot(message) {
17
- return {
18
- correlationId: message.id,
19
- currentMessageId: message.id,
20
- depth: 0,
21
- startedAt: new Date(),
22
- tags: new Set(),
23
- };
24
- }
25
- createChild(message) {
26
- var _a, _b, _c, _d;
27
- if (!this.active)
28
- return this.createRoot(message);
29
- const parent = this.current;
30
- const tags = (_b = (_a = this.current) === null || _a === void 0 ? void 0 : _a.tags) !== null && _b !== void 0 ? _b : new Set();
31
- (_d = (_c = message.metadata) === null || _c === void 0 ? void 0 : _c.tags) === null || _d === void 0 ? void 0 : _d.forEach((tag) => tags.add(tag));
32
- const data = !parent
33
- ? this.createRoot(message)
34
- : {
35
- correlationId: parent.correlationId,
36
- currentMessageId: message.id,
37
- parentMessageId: parent.currentMessageId,
38
- depth: parent.depth + 1,
39
- startedAt: parent.startedAt,
40
- tags,
41
- };
42
- message.setMetadata({ correlationId: data.correlationId, causationId: data.parentMessageId, tags: data.tags });
43
- return data;
44
- }
45
- dispose() {
46
- this.storage.disable();
47
- }
48
- }
49
- exports.PostboyContextService = PostboyContextService;
50
- //# sourceMappingURL=postboy-context.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-context.service.js","sourceRoot":"","sources":["../../src/services/postboy-context.service.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAIrD,MAAa,qB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EAAE;gBAC5B,eAAe,EAAE,MAAM,CAAC,gBAAgB;gBACxC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC;gBACvB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,IAAI;aACL,CAAC;QACN,OAAO,CAAC,WAAW,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/G,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF;AA7CD,sDA6CC"}
@@ -1,32 +0,0 @@
1
- import { PostboyMiddlewareService } from './postboy-middleware.service';
2
- import { PostboyMessageStore } from './postboy-message.store';
3
- import { PostboyNamespaceStore } from './postboy-namespace.store';
4
- export declare class PostboyDependencyResolver {
5
- /**
6
- * Retrieves an instance of the PostboyMiddlewareService.
7
- *
8
- * This function initializes and returns a new instance of the
9
- * PostboyMiddlewareService, which can be used to configure and manage
10
- * middleware for a specific module or application.
11
- *
12
- * @returns {PostboyMiddlewareService} A new instance of PostboyMiddlewareService.
13
- */
14
- getMiddlewareService: () => PostboyMiddlewareService;
15
- /**
16
- * A function that instantiates and returns a new instance of PostboyMessageStore.
17
- *
18
- * This function serves as a factory method for creating instances
19
- * of the PostboyMessageStore class.
20
- *
21
- * @returns {PostboyMessageStore} A new instance of the PostboyMessageStore class.
22
- */
23
- getMessageStore: () => PostboyMessageStore;
24
- /**
25
- * Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.
26
- *
27
- * @function getNamespaceStore
28
- * @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
29
- */
30
- getNamespaceStore: () => PostboyNamespaceStore;
31
- }
32
- //# sourceMappingURL=postboy-dependency.resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-dependency.resolver.d.ts","sourceRoot":"","sources":["../../src/services/postboy-dependency.resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,qBAAa,yBAAyB;IACpC;;;;;;;;OAQG;IACH,oBAAoB,iCAAwC;IAC5D;;;;;;;OAOG;IACH,eAAe,4BAAmC;IAClD;;;;;OAKG;IACH,iBAAiB,8BAAqC;CACvD"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PostboyDependencyResolver = void 0;
4
- const postboy_middleware_service_1 = require("./postboy-middleware.service");
5
- const postboy_message_store_1 = require("./postboy-message.store");
6
- const postboy_namespace_store_1 = require("./postboy-namespace.store");
7
- class PostboyDependencyResolver {
8
- constructor() {
9
- /**
10
- * Retrieves an instance of the PostboyMiddlewareService.
11
- *
12
- * This function initializes and returns a new instance of the
13
- * PostboyMiddlewareService, which can be used to configure and manage
14
- * middleware for a specific module or application.
15
- *
16
- * @returns {PostboyMiddlewareService} A new instance of PostboyMiddlewareService.
17
- */
18
- this.getMiddlewareService = () => new postboy_middleware_service_1.PostboyMiddlewareService();
19
- /**
20
- * A function that instantiates and returns a new instance of PostboyMessageStore.
21
- *
22
- * This function serves as a factory method for creating instances
23
- * of the PostboyMessageStore class.
24
- *
25
- * @returns {PostboyMessageStore} A new instance of the PostboyMessageStore class.
26
- */
27
- this.getMessageStore = () => new postboy_message_store_1.PostboyMessageStore();
28
- /**
29
- * Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.
30
- *
31
- * @function getNamespaceStore
32
- * @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
33
- */
34
- this.getNamespaceStore = () => new postboy_namespace_store_1.PostboyNamespaceStore();
35
- }
36
- }
37
- exports.PostboyDependencyResolver = PostboyDependencyResolver;
38
- //# sourceMappingURL=postboy-dependency.resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-dependency.resolver.js","sourceRoot":"","sources":["../../src/services/postboy-dependency.resolver.ts"],"names":[],"mappings":";;;AAAA,6EAAwE;AACxE,mEAA8D;AAC9D,uEAAkE;AAElE,MAAa,yBAAyB;IAAtC;QACE;;;;;;;;WAQG;QACH,yBAAoB,GAAG,GAAG,EAAE,CAAC,IAAI,qDAAwB,EAAE,CAAC;QAC5D;;;;;;;WAOG;QACH,oBAAe,GAAG,GAAG,EAAE,CAAC,IAAI,2CAAmB,EAAE,CAAC;QAClD;;;;;WAKG;QACH,sBAAiB,GAAG,GAAG,EAAE,CAAC,IAAI,+CAAqB,EAAE,CAAC;IACxD,CAAC;CAAA;AA3BD,8DA2BC"}
@@ -1,20 +0,0 @@
1
- import { PostboySubscription } from '../models/postboy-subscription';
2
- import { PostboyExecutor } from '../models/postboy-executor';
3
- import { PostboyCallbackMessage } from '../models/postboy-callback.message';
4
- /**
5
- * The PostboyMessageStore is a utility class for managing message subscriptions and executors.
6
- * It provides functionality to register, retrieve, and unregister subscription-based messages and executors.
7
- */
8
- export declare class PostboyMessageStore {
9
- protected messages: Map<string, PostboySubscription<any>>;
10
- protected executors: Map<string, (e: PostboyExecutor<any>) => any>;
11
- protected callbacks: Map<string, (() => void)[]>;
12
- registerMessage(id: string, sub: PostboySubscription<any>): void;
13
- registerExecutor(id: string, executor: (e: PostboyExecutor<any>) => any): void;
14
- callbackFired(message: PostboyCallbackMessage<any>): void;
15
- getMessage(id: string, name: string): PostboySubscription<any>;
16
- getExecutor<T>(id: string): (e: PostboyExecutor<T>) => T;
17
- unregister(id: string): void;
18
- dispose(): void;
19
- }
20
- //# sourceMappingURL=postboy-message.store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-message.store.d.ts","sourceRoot":"","sources":["../../src/services/postboy-message.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,SAAS,CAAC,QAAQ,wCAA+C;IACjE,SAAS,CAAC,SAAS,kBAAuB,eAAe,CAAC,GAAG,CAAC,KAAK,GAAG,EAAI;IAC1E,SAAS,CAAC,SAAS,qBAA0B,IAAI,KAAO;IAEjD,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAAG,IAAI;IAMhE,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,IAAI;IAMrF,aAAa,CAAC,OAAO,EAAE,sBAAsB,CAAC,GAAG,CAAC,GAAG,IAAI;IAOlD,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC;IAM9D,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAMxD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQ5B,OAAO,IAAI,IAAI;CAOvB"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PostboyMessageStore = void 0;
4
- /**
5
- * The PostboyMessageStore is a utility class for managing message subscriptions and executors.
6
- * It provides functionality to register, retrieve, and unregister subscription-based messages and executors.
7
- */
8
- class PostboyMessageStore {
9
- constructor() {
10
- this.messages = new Map();
11
- this.executors = new Map();
12
- this.callbacks = new Map();
13
- }
14
- registerMessage(id, sub) {
15
- // tslint:disable-next-line:no-console
16
- if (this.messages.has(id))
17
- console.warn(`Message with id ${id} already registered. Overriding...`);
18
- this.messages.set(id, sub);
19
- }
20
- registerExecutor(id, executor) {
21
- // tslint:disable-next-line:no-console
22
- if (this.executors.has(id))
23
- console.warn(`Executor with id ${id} already registered. Overriding...`);
24
- this.executors.set(id, executor);
25
- }
26
- callbackFired(message) {
27
- const existingCallbacks = this.callbacks.get(message.id);
28
- existingCallbacks
29
- ? existingCallbacks.push(() => message.complete())
30
- : this.callbacks.set(message.id, [() => message.complete()]);
31
- }
32
- getMessage(id, name) {
33
- const msg = this.messages.get(id);
34
- if (!msg)
35
- throw new Error(`There is no registered event ${name}`);
36
- return msg;
37
- }
38
- getExecutor(id) {
39
- const executorFunction = this.executors.get(id);
40
- if (!executorFunction)
41
- throw new Error(`There is no registered executor with id ${id}`);
42
- return executorFunction;
43
- }
44
- unregister(id) {
45
- var _a, _b;
46
- (_a = this.messages.get(id)) === null || _a === void 0 ? void 0 : _a.finish();
47
- this.messages.delete(id);
48
- (_b = this.callbacks.get(id)) === null || _b === void 0 ? void 0 : _b.forEach((c) => c());
49
- this.callbacks.delete(id);
50
- this.executors.delete(id);
51
- }
52
- dispose() {
53
- this.messages.forEach((m, id) => this.unregister(id));
54
- this.callbacks.forEach((fs) => fs.forEach((f) => f()));
55
- this.messages.clear();
56
- this.executors.clear();
57
- this.callbacks.clear();
58
- }
59
- }
60
- exports.PostboyMessageStore = PostboyMessageStore;
61
- //# sourceMappingURL=postboy-message.store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-message.store.js","sourceRoot":"","sources":["../../src/services/postboy-message.store.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,MAAa,mBAAmB;IAAhC;QACY,aAAQ,GAAG,IAAI,GAAG,EAAoC,CAAC;QACvD,cAAS,GAAG,IAAI,GAAG,EAA4C,CAAC;QAChE,cAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;IAgD1D,CAAC;IA9CQ,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EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,gBAAgB;YAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,EAAE,EAAE,CAAC,CAAC;QACxF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAEM,UAAU,CAAC,EAAU;;QAC1B,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,0CAAE,MAAM,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzB,MAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,0CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF;AAnDD,kDAmDC"}
@@ -1,35 +0,0 @@
1
- import { PipelineContext } from "../models/pipeline-context";
2
- import { MiddlewareDecision } from "../models/middleware-decision.enum";
3
- /**
4
- * Abstract base class for defining middleware in a pipeline.
5
- * Middleware acts on various stages of pipeline execution, allowing operations
6
- * to be intercepted, modified, or monitored.
7
- */
8
- export declare abstract class PostboyMiddleware {
9
- readonly name: string;
10
- /**
11
- * Creates an instance of a class, optionally assigning a name.
12
- *
13
- * @param {string} [name] - An optional name to be assigned. If not provided, defaults to the class name.
14
- */
15
- constructor(name?: string);
16
- /**
17
- * Optional filter to skip middleware for unrelated messages/stages.
18
- */
19
- canHandle(_context: PipelineContext): boolean;
20
- /**
21
- * Called before the stage is executed.
22
- * Return Interrupt to cancel the operation.
23
- */
24
- before(_context: PipelineContext): MiddlewareDecision;
25
- /**
26
- * Called after the stage has finished successfully.
27
- * `result` is typically set for execute-stage.
28
- */
29
- after(_context: PipelineContext, _result?: unknown): void;
30
- /**
31
- * Optional cleanup hook.
32
- */
33
- dispose(): void;
34
- }
35
- //# sourceMappingURL=postboy-middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-middleware.d.ts","sourceRoot":"","sources":["../../src/services/postboy-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AAGtE;;;;GAIG;AACH,8BAAsB,iBAAiB;IACrC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;gBACS,IAAI,CAAC,EAAE,MAAM;IAIzB;;OAEG;IACI,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO;IAIpD;;;OAGG;IACI,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,kBAAkB;IAI5D;;;OAGG;IACI,KAAK,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAIhE;;OAEG;IACI,OAAO,IAAI,IAAI;CAGvB"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PostboyMiddleware = void 0;
4
- const middleware_decision_enum_1 = require("../models/middleware-decision.enum");
5
- /**
6
- * Abstract base class for defining middleware in a pipeline.
7
- * Middleware acts on various stages of pipeline execution, allowing operations
8
- * to be intercepted, modified, or monitored.
9
- */
10
- class PostboyMiddleware {
11
- /**
12
- * Creates an instance of a class, optionally assigning a name.
13
- *
14
- * @param {string} [name] - An optional name to be assigned. If not provided, defaults to the class name.
15
- */
16
- constructor(name) {
17
- this.name = name !== null && name !== void 0 ? name : this.constructor.name;
18
- }
19
- /**
20
- * Optional filter to skip middleware for unrelated messages/stages.
21
- */
22
- canHandle(_context) {
23
- return true;
24
- }
25
- /**
26
- * Called before the stage is executed.
27
- * Return Interrupt to cancel the operation.
28
- */
29
- before(_context) {
30
- return middleware_decision_enum_1.MiddlewareDecision.Continue;
31
- }
32
- /**
33
- * Called after the stage has finished successfully.
34
- * `result` is typically set for execute-stage.
35
- */
36
- after(_context, _result) {
37
- // noop
38
- }
39
- /**
40
- * Optional cleanup hook.
41
- */
42
- dispose() {
43
- // noop
44
- }
45
- }
46
- exports.PostboyMiddleware = PostboyMiddleware;
47
- //# sourceMappingURL=postboy-middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postboy-middleware.js","sourceRoot":"","sources":["../../src/services/postboy-middleware.ts"],"names":[],"mappings":";;;AACA,iFAAsE;AAGtE;;;;GAIG;AACH,MAAsB,iBAAiB;IAGrC;;;;OAIG;IACH,YAAY,IAAa;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,QAAyB;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAyB;QACrC,OAAO,6CAAkB,CAAC,QAAQ,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAyB,EAAE,OAAiB;QACvD,OAAO;IACT,CAAC;IAED;;OAEG;IACI,OAAO;QACZ,OAAO;IACT,CAAC;CACF;AAzCD,8CAyCC"}