@artstesh/postboy 3.2.0 → 3.3.1

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 (104) hide show
  1. package/lib/index.d.ts +1 -0
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +1 -0
  4. package/lib/index.js.map +1 -1
  5. package/lib/messages/add-middleware.executor.d.ts +19 -0
  6. package/lib/messages/add-middleware.executor.d.ts.map +1 -0
  7. package/lib/messages/add-middleware.executor.js +24 -0
  8. package/lib/messages/add-middleware.executor.js.map +1 -0
  9. package/lib/messages/add-namespace.executor.d.ts +19 -0
  10. package/lib/messages/add-namespace.executor.d.ts.map +1 -0
  11. package/lib/messages/add-namespace.executor.js +24 -0
  12. package/lib/messages/add-namespace.executor.js.map +1 -0
  13. package/lib/messages/connect-executor.executor.d.ts +25 -0
  14. package/lib/messages/connect-executor.executor.d.ts.map +1 -0
  15. package/lib/messages/connect-executor.executor.js +30 -0
  16. package/lib/messages/connect-executor.executor.js.map +1 -0
  17. package/lib/messages/connect-handler.executor.d.ts +25 -0
  18. package/lib/messages/connect-handler.executor.d.ts.map +1 -0
  19. package/lib/messages/connect-handler.executor.js +30 -0
  20. package/lib/messages/connect-handler.executor.js.map +1 -0
  21. package/lib/messages/connect-message.executor.d.ts +28 -0
  22. package/lib/messages/connect-message.executor.d.ts.map +1 -0
  23. package/lib/messages/connect-message.executor.js +31 -0
  24. package/lib/messages/connect-message.executor.js.map +1 -0
  25. package/lib/messages/connect.message.executor.d.ts +28 -0
  26. package/lib/messages/connect.message.executor.d.ts.map +1 -0
  27. package/lib/messages/connect.message.executor.js +31 -0
  28. package/lib/messages/connect.message.executor.js.map +1 -0
  29. package/lib/messages/disconnect-message.executor.d.ts +19 -0
  30. package/lib/messages/disconnect-message.executor.d.ts.map +1 -0
  31. package/lib/messages/disconnect-message.executor.js +25 -0
  32. package/lib/messages/disconnect-message.executor.js.map +1 -0
  33. package/lib/messages/eliminate-namespace.executor.d.ts +16 -0
  34. package/lib/messages/eliminate-namespace.executor.d.ts.map +1 -0
  35. package/lib/messages/eliminate-namespace.executor.js +22 -0
  36. package/lib/messages/eliminate-namespace.executor.js.map +1 -0
  37. package/lib/messages/index.d.ts +11 -0
  38. package/lib/messages/index.d.ts.map +1 -0
  39. package/lib/messages/index.js +24 -0
  40. package/lib/messages/index.js.map +1 -0
  41. package/lib/messages/lock-message.executor.d.ts +22 -0
  42. package/lib/messages/lock-message.executor.d.ts.map +1 -0
  43. package/lib/messages/lock-message.executor.js +26 -0
  44. package/lib/messages/lock-message.executor.js.map +1 -0
  45. package/lib/messages/remove-middleware.executor.d.ts +17 -0
  46. package/lib/messages/remove-middleware.executor.d.ts.map +1 -0
  47. package/lib/messages/remove-middleware.executor.js +22 -0
  48. package/lib/messages/remove-middleware.executor.js.map +1 -0
  49. package/lib/messages/unlock-message.executor.d.ts +21 -0
  50. package/lib/messages/unlock-message.executor.d.ts.map +1 -0
  51. package/lib/messages/unlock-message.executor.js +25 -0
  52. package/lib/messages/unlock-message.executor.js.map +1 -0
  53. package/lib/models/cancel-details.d.ts +9 -0
  54. package/lib/models/cancel-details.d.ts.map +1 -0
  55. package/lib/models/cancel-details.js +3 -0
  56. package/lib/models/cancel-details.js.map +1 -0
  57. package/lib/models/cancel-error.d.ts +7 -0
  58. package/lib/models/cancel-error.d.ts.map +1 -0
  59. package/lib/models/cancel-error.js +18 -0
  60. package/lib/models/cancel-error.js.map +1 -0
  61. package/lib/models/middleware-decision.enum.d.ts +5 -0
  62. package/lib/models/middleware-decision.enum.d.ts.map +1 -0
  63. package/lib/models/middleware-decision.enum.js +9 -0
  64. package/lib/models/middleware-decision.enum.js.map +1 -0
  65. package/lib/models/middleware-stage.enum.d.ts +6 -0
  66. package/lib/models/middleware-stage.enum.d.ts.map +1 -0
  67. package/lib/models/middleware-stage.enum.js +10 -0
  68. package/lib/models/middleware-stage.enum.js.map +1 -0
  69. package/lib/models/pipeline-context.d.ts +7 -0
  70. package/lib/models/pipeline-context.d.ts.map +1 -0
  71. package/lib/models/pipeline-context.js +3 -0
  72. package/lib/models/pipeline-context.js.map +1 -0
  73. package/lib/models/pipeline-result.d.ts +6 -0
  74. package/lib/models/pipeline-result.d.ts.map +1 -0
  75. package/lib/models/pipeline-result.js +3 -0
  76. package/lib/models/pipeline-result.js.map +1 -0
  77. package/lib/models/postboy-subscription.d.ts +1 -1
  78. package/lib/models/postboy-subscription.d.ts.map +1 -1
  79. package/lib/models/postboy-subscription.js +1 -1
  80. package/lib/models/postboy-subscription.js.map +1 -1
  81. package/lib/postboy-abstract.registrator.d.ts.map +1 -1
  82. package/lib/postboy-abstract.registrator.js +11 -5
  83. package/lib/postboy-abstract.registrator.js.map +1 -1
  84. package/lib/postboy.service.d.ts +14 -5
  85. package/lib/postboy.service.d.ts.map +1 -1
  86. package/lib/postboy.service.js +63 -26
  87. package/lib/postboy.service.js.map +1 -1
  88. package/lib/services/postboy-context.service.d.ts +1 -0
  89. package/lib/services/postboy-context.service.d.ts.map +1 -1
  90. package/lib/services/postboy-context.service.js +3 -0
  91. package/lib/services/postboy-context.service.js.map +1 -1
  92. package/lib/services/postboy-dependency.resolver.d.ts +1 -5
  93. package/lib/services/postboy-dependency.resolver.d.ts.map +1 -1
  94. package/lib/services/postboy-dependency.resolver.js +1 -4
  95. package/lib/services/postboy-dependency.resolver.js.map +1 -1
  96. package/lib/services/postboy-middleware.d.ts +35 -0
  97. package/lib/services/postboy-middleware.d.ts.map +1 -0
  98. package/lib/services/postboy-middleware.js +47 -0
  99. package/lib/services/postboy-middleware.js.map +1 -0
  100. package/lib/services/postboy-namespace.store.d.ts +5 -6
  101. package/lib/services/postboy-namespace.store.d.ts.map +1 -1
  102. package/lib/services/postboy-namespace.store.js +7 -7
  103. package/lib/services/postboy-namespace.store.js.map +1 -1
  104. package/package.json +2 -1
@@ -5,19 +5,50 @@ const rxjs_1 = require("rxjs");
5
5
  const postboy_generic_message_1 = require("./models/postboy-generic-message");
6
6
  const postboy_subscription_1 = require("./models/postboy-subscription");
7
7
  const postboy_dependency_resolver_1 = require("./services/postboy-dependency.resolver");
8
- const postboy_settings_1 = require("./models/postboy.settings");
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");
9
18
  class PostboyService {
10
- constructor(settings, resolver) {
19
+ constructor(resolver) {
11
20
  this.locked = new Set();
12
- this.settings = new postboy_settings_1.PostboySettings(settings);
13
21
  this.dependencyResolver = resolver || new postboy_dependency_resolver_1.PostboyDependencyResolver();
14
22
  this.middleware = this.dependencyResolver.getMiddlewareService();
15
23
  this.store = this.dependencyResolver.getMessageStore();
16
- this.context = this.dependencyResolver.getPostboyContextService(this.settings.metadata);
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
+ });
17
47
  }
18
48
  /**
19
49
  * Locks a specific message type to prevent further modifications or actions.
20
50
  *
51
+ * @deprecated The method should be replaced with firing {@link LockMessage} message.
21
52
  * @param {MessageType<T>} type - The message type to be locked. It must extend from the `PostboyGenericMessage`.
22
53
  * @return {void} This method does not return a value.
23
54
  */
@@ -27,6 +58,7 @@ class PostboyService {
27
58
  /**
28
59
  * Unlocks a previously locked message type by removing its ID from the locked set.
29
60
  *
61
+ * @deprecated The method should be replaced with firing {@link UnlockMessage} message.
30
62
  * @param {MessageType<T>} type - The message type to unlock, which is a generic type extending PostboyGenericMessage.
31
63
  * @return {void} This method does not return any value.
32
64
  */
@@ -36,6 +68,7 @@ class PostboyService {
36
68
  /**
37
69
  * Adds a middleware to the middleware stack.
38
70
  *
71
+ * @deprecated The method should be replaced with firing {@link AddMiddleware} message.
39
72
  * @param {PostboyMiddleware} middleware - The middleware instance to be added.
40
73
  * @return {void}
41
74
  */
@@ -45,6 +78,7 @@ class PostboyService {
45
78
  /**
46
79
  * Removes a middleware from the current middleware stack.
47
80
  *
81
+ * @deprecated The method should be replaced with firing {@link RemoveMiddleware} message.
48
82
  * @param {PostboyMiddleware} middleware - The middleware instance to be removed.
49
83
  * @return {void} No return value.
50
84
  */
@@ -54,6 +88,7 @@ class PostboyService {
54
88
  /**
55
89
  * Unregisters a message identified by the given ID from the store.
56
90
  *
91
+ * @deprecated The method should be replaced with firing {@link DisconnectMessage} message.
57
92
  * @param {string} id - The unique identifier of the item to unregister.
58
93
  * @return {void} No value is returned.
59
94
  */
@@ -68,12 +103,9 @@ class PostboyService {
68
103
  * @throws {Error} Throws an error if no registered event is found for the provided message ID.
69
104
  */
70
105
  fire(message) {
71
- const context = this.context.createChild(message);
72
- this.context.run(context, () => {
73
- this.middleware.manage(message);
74
- if (!this.locked.has(message.id))
75
- this.store.getMessage(message.id, message.constructor.name).fire(message);
76
- });
106
+ this.middleware.manage(message);
107
+ if (!this.locked.has(message.id))
108
+ this.store.getMessage(message.id, message.constructor.name).fire(message);
77
109
  }
78
110
  /**
79
111
  * Triggers a callback function associated with a given message.
@@ -84,15 +116,19 @@ class PostboyService {
84
116
  * @return {void} This method does not return any value.
85
117
  */
86
118
  fireCallback(message, action) {
87
- const context = this.context.createChild(message);
88
- return this.context.run(context, () => {
89
- this.middleware.manage(message);
90
- this.store.callbackFired(message);
91
- message.result.subscribe(action);
92
- if (!this.locked.has(message.id))
93
- setTimeout(() => this.store.getMessage(message.id, message.constructor.name).fire(message));
94
- return message.result;
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();
95
128
  });
129
+ if (!!action)
130
+ observable.subscribe();
131
+ return observable;
96
132
  }
97
133
  /**
98
134
  * Executes the provided executor function and returns its result.
@@ -102,11 +138,8 @@ class PostboyService {
102
138
  * @throws {Error} If the specified executor is not registered.
103
139
  */
104
140
  exec(executor) {
105
- const context = this.context.createChild(executor);
106
- return this.context.run(context, () => {
107
- this.middleware.manage(executor);
108
- return this.store.getExecutor(executor.id)(executor);
109
- });
141
+ this.middleware.manage(executor);
142
+ return this.store.getExecutor(executor.id)(executor);
110
143
  }
111
144
  /**
112
145
  * Subscribes to a specific message type and returns an observable of that type.
@@ -129,6 +162,7 @@ class PostboyService {
129
162
  /**
130
163
  * Registers a given message type and its associated subject subscription with the system.
131
164
  *
165
+ * @deprecated The method should be replaced with firing {@link ConnectMessage} message.
132
166
  * @param type The constructor function of the message type that extends the PostboyGenericMessage.
133
167
  * @param sub The Subject instance for the provided message type, used for managing subscriptions.
134
168
  * @return {void} No return value.
@@ -139,6 +173,7 @@ class PostboyService {
139
173
  /**
140
174
  * Registers a generic message type with a Subject and a transformation pipe.
141
175
  *
176
+ * @deprecated The method should be replaced with firing {@link ConnectMessage} message.
142
177
  * @param {MessageType<T>} type - The constructor of the message type being registered.
143
178
  * @param {Subject<T>} sub - The Subject instance used to handle incoming messages of the specified type.
144
179
  * @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation or processing logic to the Subject and returns an Observable.
@@ -150,6 +185,7 @@ class PostboyService {
150
185
  /**
151
186
  * Registers an executor for a specified message type.
152
187
  *
188
+ * @deprecated The method should be replaced with firing {@link ConnectExecutor} message.
153
189
  * @param {MessageType<E>} type - The message type for which the executor is being registered.
154
190
  * @param {(e: E) => T} exec - The executor function that will handle messages of the specified type.
155
191
  * @return {void} This method does not return any value.
@@ -160,6 +196,7 @@ class PostboyService {
160
196
  /**
161
197
  * Registers a handler for a specific executor type.
162
198
  *
199
+ * @deprecated The method should be replaced with firing {@link ConnectHandler} message.
163
200
  * @param executor The constructor of the executor class that extends `PostboyExecutor<R>`.
164
201
  * @param handler An instance of `PostboyExecutionHandler<R, E>` that defines the logic for handling the executor.
165
202
  * @return void
@@ -170,17 +207,17 @@ class PostboyService {
170
207
  /**
171
208
  * Adds a namespace to the namespace store.
172
209
  *
210
+ * @deprecated The method should be replaced with firing {@link AddNamespace} message.
173
211
  * @param {string} space - The name of the namespace to be added.
174
212
  * @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.
175
213
  */
176
214
  addNamespace(space) {
177
- if (!this.namespaceStore)
178
- this.namespaceStore = this.dependencyResolver.getNamespaceStore(this);
179
- return this.namespaceStore.addSpace(space);
215
+ return this.namespaceStore.addSpace(space, this);
180
216
  }
181
217
  /**
182
218
  * Removes the specified namespace from the namespace store.
183
219
  *
220
+ * @deprecated The method should be replaced with firing {@link EliminateNamespace} message.
184
221
  * @param {string} space - The name of the namespace to be removed.
185
222
  * @return {void} This method does not return a value.
186
223
  */
@@ -1 +1 @@
1
- {"version":3,"file":"postboy.service.js","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":";;;AAAA,+BAAkD;AAClD,8EAAkF;AAClF,wEAAoE;AAMpE,wFAAmF;AAKnF,gEAA4D;AAE5D,MAAa,cAAc;IASzB,YAAY,QAAmC,EAAE,QAAoC;QAR3E,WAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QASnC,IAAI,CAAC,QAAQ,GAAG,IAAI,kCAAe,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,CAAC,kBAAkB,GAAG,QAAQ,IAAI,IAAI,uDAAyB,EAAE,CAAC;QACtE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,EAAE,CAAC;QACjE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;QACvD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAkC,IAA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AC;IAED;;;;;;;OAOG;IACI,cAAc,CAAkC,IAAoB,EAAE,IAAiB;QAC5F,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAA,iCAAO,EAAC,IAAI,CAAC,EAAE,IAAoC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;OAOG;IACI,aAAa,CAClB,QAAmC,EACnC,OAAsC;QAEtC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAA,iCAAO,EAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAM,CAAC,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;OAMG;IACI,YAAY,CAAC,KAAa;QAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACI,kBAAkB,CAAC,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"}
@@ -8,5 +8,6 @@ export declare class PostboyContextService {
8
8
  run<T>(context: PostboyMessageContext, action: () => T): T;
9
9
  private createRoot;
10
10
  createChild(message: PostboyMessage): PostboyMessageContext;
11
+ dispose(): void;
11
12
  }
12
13
  //# sourceMappingURL=postboy-context.service.d.ts.map
@@ -1 +1 @@
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;CAkBnE"}
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"}
@@ -42,6 +42,9 @@ class PostboyContextService {
42
42
  message.setMetadata({ correlationId: data.correlationId, causationId: data.parentMessageId, tags: data.tags });
43
43
  return data;
44
44
  }
45
+ dispose() {
46
+ this.storage.disable();
47
+ }
45
48
  }
46
49
  exports.PostboyContextService = PostboyContextService;
47
50
  //# sourceMappingURL=postboy-context.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-context.service.js","sourceRoot":"","sources":["../../src/services/postboy-context.service.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAI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C,OAAO,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,MAAM,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,mCAAI,IAAI,GAAG,EAAE,CAAC;QAC7C,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,IAAI,0CAAE,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,CAAC,MAAM;YAClB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAC1B,CAAC,CAAC;gBACE,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,gBAAgB,EAAE,OAAO,CAAC,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,8 +1,6 @@
1
1
  import { PostboyMiddlewareService } from './postboy-middleware.service';
2
2
  import { PostboyMessageStore } from './postboy-message.store';
3
3
  import { PostboyNamespaceStore } from './postboy-namespace.store';
4
- import { PostboyService } from '../postboy.service';
5
- import { PostboyContextService } from './postboy-context.service';
6
4
  export declare class PostboyDependencyResolver {
7
5
  /**
8
6
  * Retrieves an instance of the PostboyMiddlewareService.
@@ -27,10 +25,8 @@ export declare class PostboyDependencyResolver {
27
25
  * Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.
28
26
  *
29
27
  * @function getNamespaceStore
30
- * @param {PostboyService} postboy - An instance of the PostboyService used to create the namespace store.
31
28
  * @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
32
29
  */
33
- getNamespaceStore: (postboy: PostboyService) => PostboyNamespaceStore;
34
- getPostboyContextService: (active: boolean) => PostboyContextService;
30
+ getNamespaceStore: () => PostboyNamespaceStore;
35
31
  }
36
32
  //# sourceMappingURL=postboy-dependency.resolver.d.ts.map
@@ -1 +1 @@
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;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,qBAAa,yBAAyB;IACpC;;;;;;;;OAQG;IACH,oBAAoB,iCAAwC;IAC5D;;;;;;;OAOG;IACH,eAAe,4BAAmC;IAClD;;;;;;OAMG;IACH,iBAAiB,GAAI,SAAS,cAAc,2BAAwC;IACpF,wBAAwB,GAAI,QAAQ,OAAO,2BAAuC;CACnF"}
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"}
@@ -4,7 +4,6 @@ exports.PostboyDependencyResolver = void 0;
4
4
  const postboy_middleware_service_1 = require("./postboy-middleware.service");
5
5
  const postboy_message_store_1 = require("./postboy-message.store");
6
6
  const postboy_namespace_store_1 = require("./postboy-namespace.store");
7
- const postboy_context_service_1 = require("./postboy-context.service");
8
7
  class PostboyDependencyResolver {
9
8
  constructor() {
10
9
  /**
@@ -30,11 +29,9 @@ class PostboyDependencyResolver {
30
29
  * Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.
31
30
  *
32
31
  * @function getNamespaceStore
33
- * @param {PostboyService} postboy - An instance of the PostboyService used to create the namespace store.
34
32
  * @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
35
33
  */
36
- this.getNamespaceStore = (postboy) => new postboy_namespace_store_1.PostboyNamespaceStore(postboy);
37
- this.getPostboyContextService = (active) => new postboy_context_service_1.PostboyContextService(active);
34
+ this.getNamespaceStore = () => new postboy_namespace_store_1.PostboyNamespaceStore();
38
35
  }
39
36
  }
40
37
  exports.PostboyDependencyResolver = PostboyDependencyResolver;
@@ -1 +1 @@
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,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;;;;;;WAMG;QACH,sBAAiB,GAAG,CAAC,OAAuB,EAAE,EAAE,CAAC,IAAI,+CAAqB,CAAC,OAAO,CAAC,CAAC;QACpF,6BAAwB,GAAG,CAAC,MAAe,EAAE,EAAE,CAAC,IAAI,+CAAqB,CAAC,MAAM,CAAC,CAAC;IACpF,CAAC;CAAA;AA7BD,8DA6BC"}
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"}
@@ -0,0 +1,35 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,47 @@
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
@@ -0,0 +1 @@
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"}
@@ -5,16 +5,15 @@ import { PostboyService } from '../postboy.service';
5
5
  * Provides functionality to add, eliminate, and dispose namespaces.
6
6
  */
7
7
  export declare class PostboyNamespaceStore {
8
- private postboy;
9
8
  private spaces;
10
- constructor(postboy: PostboyService);
11
9
  /**
12
- * Adds a new namespace to the registry.
10
+ * Adds a new space or retrieves an existing one if it already exists.
13
11
  *
14
- * @param {string} space - The name of the namespace to add or retrieve.
15
- * @return {PostboyAbstractRegistrator} An instance of the registrator corresponding to the specified namespace.
12
+ * @param {string} space - The name of the space to add or retrieve.
13
+ * @param {PostboyService} postboy - The PostboyService instance used to create a namespace registrator.
14
+ * @return {PostboyAbstractRegistrator} The registrator associated with the specified space.
16
15
  */
17
- addSpace(space: string): PostboyAbstractRegistrator;
16
+ addSpace(space: string, postboy: PostboyService): PostboyAbstractRegistrator;
18
17
  /**
19
18
  * Removes a specified space from the spaces collection if it exists.
20
19
  * If the space exists, it will be deleted after invoking its down method.
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-namespace.store.d.ts","sourceRoot":"","sources":["../../src/services/postboy-namespace.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,qBAAqB;IAGpB,OAAO,CAAC,OAAO;IAF3B,OAAO,CAAC,MAAM,CAAsD;gBAEhD,OAAO,EAAE,cAAc;IAE3C;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,0BAA0B;IAO1D;;;;;;OAMG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM1C;;;;;;OAMG;IACI,OAAO,IAAI,IAAI;CAIvB"}
1
+ {"version":3,"file":"postboy-namespace.store.d.ts","sourceRoot":"","sources":["../../src/services/postboy-namespace.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAsD;IAEpE;;;;;;OAMG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,0BAA0B;IAOnF;;;;;;OAMG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAM1C;;;;;;OAMG;IACI,OAAO,IAAI,IAAI;CAIvB"}
@@ -7,20 +7,20 @@ const namespace_registrator_1 = require("./namespace-registrator");
7
7
  * Provides functionality to add, eliminate, and dispose namespaces.
8
8
  */
9
9
  class PostboyNamespaceStore {
10
- constructor(postboy) {
11
- this.postboy = postboy;
10
+ constructor() {
12
11
  this.spaces = new Map();
13
12
  }
14
13
  /**
15
- * Adds a new namespace to the registry.
14
+ * Adds a new space or retrieves an existing one if it already exists.
16
15
  *
17
- * @param {string} space - The name of the namespace to add or retrieve.
18
- * @return {PostboyAbstractRegistrator} An instance of the registrator corresponding to the specified namespace.
16
+ * @param {string} space - The name of the space to add or retrieve.
17
+ * @param {PostboyService} postboy - The PostboyService instance used to create a namespace registrator.
18
+ * @return {PostboyAbstractRegistrator} The registrator associated with the specified space.
19
19
  */
20
- addSpace(space) {
20
+ addSpace(space, postboy) {
21
21
  if (this.spaces.has(space))
22
22
  return this.spaces.get(space);
23
- const registrator = new namespace_registrator_1.NamespaceRegistrator(this.postboy);
23
+ const registrator = new namespace_registrator_1.NamespaceRegistrator(postboy);
24
24
  this.spaces.set(space, registrator);
25
25
  return registrator;
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-namespace.store.js","sourceRoot":"","sources":["../../src/services/postboy-namespace.store.ts"],"names":[],"mappings":";;;AACA,mEAA+D;AAG/D;;;GAGG;AACH,MAAa,qBAAqB;IAGhC,YAAoB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;QAFnC,WAAM,GAA4C,IAAI,GAAG,EAAE,CAAC;IAEtB,CAAC;IAE/C;;;;;OAKG;IACI,QAAQ,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QAC3D,MAAM,WAAW,GAAG,IAAI,4CAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,KAAa;;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO;QACpC,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAE,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACI,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF;AA1CD,sDA0CC"}
1
+ {"version":3,"file":"postboy-namespace.store.js","sourceRoot":"","sources":["../../src/services/postboy-namespace.store.ts"],"names":[],"mappings":";;;AACA,mEAA+D;AAG/D;;;GAGG;AACH,MAAa,qBAAqB;IAAlC;QACU,WAAM,GAA4C,IAAI,GAAG,EAAE,CAAC;IAwCtE,CAAC;IAtCC;;;;;;OAMG;IACI,QAAQ,CAAC,KAAa,EAAE,OAAuB;QACpD,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;QAC3D,MAAM,WAAW,GAAG,IAAI,4CAAoB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAC,KAAa;;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO;QACpC,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAE,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACI,OAAO;QACZ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF;AAzCD,sDAyCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artstesh/postboy",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "author": "artstesh",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -38,6 +38,7 @@
38
38
  "devDependencies": {
39
39
  "@artstesh/forger": "^2.0.0",
40
40
  "@artstesh/it-should": "^2.0.0",
41
+ "@artstesh/postboy-testing": "1.2.0",
41
42
  "@types/jest": "29.5.12",
42
43
  "jest": "29.7.0",
43
44
  "prettier": "^3.1.1",