@artstesh/postboy 1.4.4 → 1.4.6
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.
- package/lib/index.cjs +825 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.mts +701 -0
- package/lib/index.d.ts +701 -10
- package/lib/index.mjs +802 -1
- package/lib/index.mjs.map +1 -1
- package/package.json +3 -3
- package/lib/i-postboy-depending.service.d.ts +0 -5
- package/lib/i-postboy-depending.service.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/messages/add-middleware.executor.d.ts +0 -19
- package/lib/messages/add-middleware.executor.d.ts.map +0 -1
- package/lib/messages/add-namespace.executor.d.ts +0 -19
- package/lib/messages/add-namespace.executor.d.ts.map +0 -1
- package/lib/messages/connect-executor.executor.d.ts +0 -25
- package/lib/messages/connect-executor.executor.d.ts.map +0 -1
- package/lib/messages/connect-handler.executor.d.ts +0 -25
- package/lib/messages/connect-handler.executor.d.ts.map +0 -1
- package/lib/messages/connect-message.executor.d.ts +0 -28
- package/lib/messages/connect-message.executor.d.ts.map +0 -1
- package/lib/messages/disconnect-message.executor.d.ts +0 -19
- package/lib/messages/disconnect-message.executor.d.ts.map +0 -1
- package/lib/messages/eliminate-namespace.executor.d.ts +0 -16
- package/lib/messages/eliminate-namespace.executor.d.ts.map +0 -1
- package/lib/messages/index.d.ts +0 -11
- package/lib/messages/index.d.ts.map +0 -1
- package/lib/messages/lock-message.executor.d.ts +0 -22
- package/lib/messages/lock-message.executor.d.ts.map +0 -1
- package/lib/messages/remove-middleware.executor.d.ts +0 -17
- package/lib/messages/remove-middleware.executor.d.ts.map +0 -1
- package/lib/messages/unlock-message.executor.d.ts +0 -21
- package/lib/messages/unlock-message.executor.d.ts.map +0 -1
- package/lib/models/index.d.ts +0 -8
- package/lib/models/index.d.ts.map +0 -1
- package/lib/models/postboy-callback.message.d.ts +0 -48
- package/lib/models/postboy-callback.message.d.ts.map +0 -1
- package/lib/models/postboy-execution.handler.d.ts +0 -21
- package/lib/models/postboy-execution.handler.d.ts.map +0 -1
- package/lib/models/postboy-executor.d.ts +0 -5
- package/lib/models/postboy-executor.d.ts.map +0 -1
- package/lib/models/postboy-generic-message.d.ts +0 -8
- package/lib/models/postboy-generic-message.d.ts.map +0 -1
- package/lib/models/postboy-message-metadata.d.ts +0 -26
- package/lib/models/postboy-message-metadata.d.ts.map +0 -1
- package/lib/models/postboy-message.context.d.ts +0 -9
- package/lib/models/postboy-message.context.d.ts.map +0 -1
- package/lib/models/postboy-middleware.d.ts +0 -5
- package/lib/models/postboy-middleware.d.ts.map +0 -1
- package/lib/models/postboy-subscription.d.ts +0 -39
- package/lib/models/postboy-subscription.d.ts.map +0 -1
- package/lib/models/postboy.message.d.ts +0 -7
- package/lib/models/postboy.message.d.ts.map +0 -1
- package/lib/models/postboy.settings.d.ts +0 -13
- package/lib/models/postboy.settings.d.ts.map +0 -1
- package/lib/postboy-abstract.registrator.d.ts +0 -97
- package/lib/postboy-abstract.registrator.d.ts.map +0 -1
- package/lib/postboy.service.d.ts +0 -157
- package/lib/postboy.service.d.ts.map +0 -1
- package/lib/services/index.d.ts +0 -4
- package/lib/services/index.d.ts.map +0 -1
- package/lib/services/namespace-registrator.d.ts +0 -14
- package/lib/services/namespace-registrator.d.ts.map +0 -1
- package/lib/services/postboy-context.service.d.ts +0 -13
- package/lib/services/postboy-context.service.d.ts.map +0 -1
- package/lib/services/postboy-dependency.resolver.d.ts +0 -32
- package/lib/services/postboy-dependency.resolver.d.ts.map +0 -1
- package/lib/services/postboy-message.store.d.ts +0 -20
- package/lib/services/postboy-message.store.d.ts.map +0 -1
- package/lib/services/postboy-middleware.service.d.ts +0 -37
- package/lib/services/postboy-middleware.service.d.ts.map +0 -1
- package/lib/services/postboy-namespace.store.d.ts +0 -34
- package/lib/services/postboy-namespace.store.d.ts.map +0 -1
- package/lib/tests/integration/models/test-callback-message.d.ts +0 -6
- package/lib/tests/integration/models/test-callback-message.d.ts.map +0 -1
- package/lib/tests/integration/models/test-executor.d.ts +0 -7
- package/lib/tests/integration/models/test-executor.d.ts.map +0 -1
- package/lib/tests/integration/models/test-handler.d.ts +0 -8
- package/lib/tests/integration/models/test-handler.d.ts.map +0 -1
- package/lib/tests/integration/models/test-message.d.ts +0 -6
- package/lib/tests/integration/models/test-message.d.ts.map +0 -1
- package/lib/tests/integration/models/test-middleware.d.ts +0 -7
- package/lib/tests/integration/models/test-middleware.d.ts.map +0 -1
- package/lib/tests/integration/models/test-postboy.d.ts +0 -4
- package/lib/tests/integration/models/test-postboy.d.ts.map +0 -1
- package/lib/tests/integration/models/test-registry.d.ts +0 -8
- package/lib/tests/integration/models/test-registry.d.ts.map +0 -1
- package/lib/utils/id.generator.d.ts +0 -5
- package/lib/utils/id.generator.d.ts.map +0 -1
package/lib/index.cjs
CHANGED
|
@@ -1,2 +1,826 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var rxjs = require('rxjs');
|
|
4
|
+
var operators = require('rxjs/operators');
|
|
5
|
+
|
|
6
|
+
// src/postboy.service.ts
|
|
7
|
+
|
|
8
|
+
// src/models/postboy.message.ts
|
|
9
|
+
var PostboyMessage = class {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.metadata = {};
|
|
12
|
+
}
|
|
13
|
+
get id() {
|
|
14
|
+
return this.constructor.ID;
|
|
15
|
+
}
|
|
16
|
+
setMetadata(metadata) {
|
|
17
|
+
this.metadata = { ...this.metadata, ...metadata };
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/models/postboy-generic-message.ts
|
|
23
|
+
var PostboyGenericMessage = class extends PostboyMessage {
|
|
24
|
+
};
|
|
25
|
+
function checkId(message) {
|
|
26
|
+
if (!message.ID) throw new Error(`${message.name} should have a static ID field`);
|
|
27
|
+
return message.ID;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/models/postboy-subscription.ts
|
|
31
|
+
var PostboySubscription = class {
|
|
32
|
+
/**
|
|
33
|
+
* Constructs an instance of the class with a given subscription and a transformation pipe.
|
|
34
|
+
*
|
|
35
|
+
* @param {Subject<T>} subscription - The source Subject that will be transformed.
|
|
36
|
+
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation to the subscription.
|
|
37
|
+
*/
|
|
38
|
+
constructor(subscription, pipe2) {
|
|
39
|
+
this.subscription = subscription;
|
|
40
|
+
this._subscription = !!pipe2 ? pipe2(subscription) : subscription.asObservable();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns an observable subscription.
|
|
44
|
+
*
|
|
45
|
+
* @return {Observable<T>} An observable instance of type T.
|
|
46
|
+
*/
|
|
47
|
+
sub() {
|
|
48
|
+
return this._subscription;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Triggers an event by emitting the provided data to all subscribers.
|
|
52
|
+
*
|
|
53
|
+
* @param {T} data - The data to emit to the subscribers.
|
|
54
|
+
* @return {void} - Does not return any value.
|
|
55
|
+
*/
|
|
56
|
+
fire(data) {
|
|
57
|
+
this.subscription.next(data);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Completes the subscription, signaling that no further values will be sent.
|
|
61
|
+
* This is typically used to finalize or clean up resources.
|
|
62
|
+
* @return {void} This method does not return any value.
|
|
63
|
+
*/
|
|
64
|
+
finish() {
|
|
65
|
+
this.subscription.complete();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/services/postboy-middleware.service.ts
|
|
70
|
+
var PostboyMiddlewareService = class {
|
|
71
|
+
constructor() {
|
|
72
|
+
this.middlewares = [];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Adds a middleware function to the collection of middlewares.
|
|
76
|
+
*
|
|
77
|
+
* @param {PostboyMiddleware} middleware - The middleware function to be added.
|
|
78
|
+
* @return {void}
|
|
79
|
+
*/
|
|
80
|
+
addMiddleware(middleware) {
|
|
81
|
+
this.middlewares.push(middleware);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Removes a middleware from the list of registered middlewares.
|
|
85
|
+
*
|
|
86
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be removed.
|
|
87
|
+
* @return {void} No return value.
|
|
88
|
+
*/
|
|
89
|
+
removeMiddleware(middleware) {
|
|
90
|
+
this.middlewares = this.middlewares.filter((m) => m !== middleware);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Manages the processing of a PostboyMessage by sequentially applying all middlewares.
|
|
94
|
+
*
|
|
95
|
+
* @param {PostboyMessage} msg - The message object to be processed by the middlewares.
|
|
96
|
+
* @return {void} - This method does not return any value.
|
|
97
|
+
*/
|
|
98
|
+
manage(msg) {
|
|
99
|
+
for (const item of this.middlewares) item.handle(msg);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Disposes of the current object by clearing its middlewares array.
|
|
103
|
+
*
|
|
104
|
+
* @return {void} This method does not return a value.
|
|
105
|
+
*/
|
|
106
|
+
dispose() {
|
|
107
|
+
this.middlewares = [];
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// src/services/postboy-message.store.ts
|
|
112
|
+
var PostboyMessageStore = class {
|
|
113
|
+
constructor() {
|
|
114
|
+
this.messages = /* @__PURE__ */ new Map();
|
|
115
|
+
this.executors = /* @__PURE__ */ new Map();
|
|
116
|
+
this.callbacks = /* @__PURE__ */ new Map();
|
|
117
|
+
}
|
|
118
|
+
registerMessage(id, sub) {
|
|
119
|
+
if (this.messages.has(id)) console.warn(`Message with id ${id} already registered. Overriding...`);
|
|
120
|
+
this.messages.set(id, sub);
|
|
121
|
+
}
|
|
122
|
+
registerExecutor(id, executor) {
|
|
123
|
+
if (this.executors.has(id)) console.warn(`Executor with id ${id} already registered. Overriding...`);
|
|
124
|
+
this.executors.set(id, executor);
|
|
125
|
+
}
|
|
126
|
+
callbackFired(message) {
|
|
127
|
+
const existingCallbacks = this.callbacks.get(message.id);
|
|
128
|
+
existingCallbacks ? existingCallbacks.push(() => message.complete()) : this.callbacks.set(message.id, [() => message.complete()]);
|
|
129
|
+
}
|
|
130
|
+
getMessage(id, name) {
|
|
131
|
+
const msg = this.messages.get(id);
|
|
132
|
+
if (!msg) throw new Error(`There is no registered event ${name}`);
|
|
133
|
+
return msg;
|
|
134
|
+
}
|
|
135
|
+
getExecutor(id) {
|
|
136
|
+
const executorFunction = this.executors.get(id);
|
|
137
|
+
if (!executorFunction) throw new Error(`There is no registered executor with id ${id}`);
|
|
138
|
+
return executorFunction;
|
|
139
|
+
}
|
|
140
|
+
unregister(id) {
|
|
141
|
+
this.messages.get(id)?.finish();
|
|
142
|
+
this.messages.delete(id);
|
|
143
|
+
this.callbacks.get(id)?.forEach((c) => c());
|
|
144
|
+
this.callbacks.delete(id);
|
|
145
|
+
this.executors.delete(id);
|
|
146
|
+
}
|
|
147
|
+
dispose() {
|
|
148
|
+
this.messages.forEach((m, id) => this.unregister(id));
|
|
149
|
+
this.callbacks.forEach((fs) => fs.forEach((f) => f()));
|
|
150
|
+
this.messages.clear();
|
|
151
|
+
this.executors.clear();
|
|
152
|
+
this.callbacks.clear();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// src/utils/id.generator.ts
|
|
157
|
+
var _IdGenerator = class _IdGenerator {
|
|
158
|
+
static get() {
|
|
159
|
+
const result = [];
|
|
160
|
+
for (let i = 0; i < 7; i++) {
|
|
161
|
+
result.push(
|
|
162
|
+
_IdGenerator.collection.sort(() => 0.5 - Math.random()).slice(0, 5).join("")
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return result.join("-");
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
_IdGenerator.collection = "ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789".split("");
|
|
169
|
+
var IdGenerator = _IdGenerator;
|
|
170
|
+
|
|
171
|
+
// src/models/postboy-executor.ts
|
|
172
|
+
var PostboyExecutor = class extends PostboyMessage {
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// src/messages/connect-message.executor.ts
|
|
176
|
+
var ConnectMessage = class extends PostboyExecutor {
|
|
177
|
+
/**
|
|
178
|
+
* Constructs a new instance of the class.
|
|
179
|
+
*
|
|
180
|
+
* @param {MessageType<T>} type - The type of the message.
|
|
181
|
+
* @param {Subject<T>} sub - The subject to be used for message handling.
|
|
182
|
+
* @param {(s: Subject<T>) => Observable<T>} [pipe] - An optional function to transform the subject.
|
|
183
|
+
*/
|
|
184
|
+
constructor(type, sub, pipe2) {
|
|
185
|
+
super();
|
|
186
|
+
this.type = type;
|
|
187
|
+
this.sub = sub;
|
|
188
|
+
this.pipe = pipe2;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
ConnectMessage.ID = "aa03a192-bdc7-402d-9f2f-bf3748229ea2";
|
|
192
|
+
|
|
193
|
+
// src/messages/disconnect-message.executor.ts
|
|
194
|
+
var DisconnectMessage = class extends PostboyExecutor {
|
|
195
|
+
/**
|
|
196
|
+
* Creates an instance of the class with the specified message identifier.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} messageId - The unique identifier for the message.
|
|
199
|
+
*/
|
|
200
|
+
constructor(messageId) {
|
|
201
|
+
super();
|
|
202
|
+
this.messageId = messageId;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
DisconnectMessage.ID = "94579e43-5bc9-4517-bcda-b595bcda1ae7";
|
|
206
|
+
|
|
207
|
+
// src/messages/connect-executor.executor.ts
|
|
208
|
+
var ConnectExecutor = class extends PostboyExecutor {
|
|
209
|
+
/**
|
|
210
|
+
* Constructs an instance of the class with the specified type and execution function.
|
|
211
|
+
*
|
|
212
|
+
* @param {MessageType<E>} type - The type of the message.
|
|
213
|
+
* @param {(e: E) => T} exec - The function to be executed with the input of type E that returns a value of type T.
|
|
214
|
+
*/
|
|
215
|
+
constructor(type, exec) {
|
|
216
|
+
super();
|
|
217
|
+
this.type = type;
|
|
218
|
+
this.exec = exec;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
ConnectExecutor.ID = "cb80e8ad-b68c-4b2d-8c44-617ea6017cb3";
|
|
222
|
+
|
|
223
|
+
// src/messages/connect-handler.executor.ts
|
|
224
|
+
var ConnectHandler = class extends PostboyExecutor {
|
|
225
|
+
/**
|
|
226
|
+
* Constructs an instance of the class.
|
|
227
|
+
*
|
|
228
|
+
* @param {new (...args: any[]) => E} executor - A constructor function for the executor object.
|
|
229
|
+
* @param {PostboyExecutionHandler<R, E>} handler - A handler that processes the execution logic.
|
|
230
|
+
*/
|
|
231
|
+
constructor(executor, handler) {
|
|
232
|
+
super();
|
|
233
|
+
this.executor = executor;
|
|
234
|
+
this.handler = handler;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
ConnectHandler.ID = "bf618cea-6f32-417c-9548-8eafe937378b";
|
|
238
|
+
|
|
239
|
+
// src/postboy-abstract.registrator.ts
|
|
240
|
+
var PostboyAbstractRegistrator = class {
|
|
241
|
+
constructor(postboy, namespace = null) {
|
|
242
|
+
this.postboy = postboy;
|
|
243
|
+
this.ids = [];
|
|
244
|
+
this.services = [];
|
|
245
|
+
this._namespace = namespace ?? IdGenerator.get();
|
|
246
|
+
}
|
|
247
|
+
get namespace() {
|
|
248
|
+
return this._namespace;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Registers a list of services to be used by the application.
|
|
252
|
+
*
|
|
253
|
+
* @param {IPostboyDependingService[]} services - An array of services to register.
|
|
254
|
+
* @return {void} This method does not return a value.
|
|
255
|
+
*/
|
|
256
|
+
registerServices(services) {
|
|
257
|
+
this.services = services;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Initiates the 'up' process for the current instance and all associated services.
|
|
261
|
+
*
|
|
262
|
+
* @return {void} Does not return a value.
|
|
263
|
+
*/
|
|
264
|
+
up() {
|
|
265
|
+
this._up?.();
|
|
266
|
+
this.services.forEach((s) => s.up());
|
|
267
|
+
}
|
|
268
|
+
down() {
|
|
269
|
+
this.services.forEach((s) => !!s.down && s.down());
|
|
270
|
+
this.services = [];
|
|
271
|
+
this.ids.forEach((id) => this.postboy.exec(new DisconnectMessage(id)));
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Records a type and its corresponding Subject<T> into the Postboy system and updates the internal identifiers.
|
|
275
|
+
*
|
|
276
|
+
* @param {MessageType<T>} type - A constructor for the generic message type T.
|
|
277
|
+
* @param {Subject<T>} sub - The subject associated with the generic message type.
|
|
278
|
+
* @return {this} Returns the current instance for method chaining.
|
|
279
|
+
*/
|
|
280
|
+
record(type, sub) {
|
|
281
|
+
this.ids.push(checkId(type));
|
|
282
|
+
this.postboy.exec(new ConnectMessage(type, sub));
|
|
283
|
+
return this;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Records a message type with a specific subject and applies a transformation pipe to the subject.
|
|
287
|
+
*
|
|
288
|
+
* @param {MessageType<T>} type - The constructor of the message type to record, which extends PostboyGenericMessage.
|
|
289
|
+
* @param {Subject<T>} sub - The Subject instance to associate with the message type.
|
|
290
|
+
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that takes the subject as input and returns an Observable with transformations applied.
|
|
291
|
+
* @return {this} The current instance of the class for chaining.
|
|
292
|
+
*/
|
|
293
|
+
recordWithPipe(type, sub, pipe2) {
|
|
294
|
+
this.ids.push(checkId(type));
|
|
295
|
+
this.postboy.exec(new ConnectMessage(type, sub, pipe2));
|
|
296
|
+
return this;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Records an executor associated with a specific type and execution logic.
|
|
300
|
+
*
|
|
301
|
+
* @param type The class constructor of the executor type to be recorded, which extends PostboyExecutor.
|
|
302
|
+
* @param exec A callback function that executes the logic using an instance of the specified executor type.
|
|
303
|
+
* @return void
|
|
304
|
+
*/
|
|
305
|
+
recordExecutor(type, exec) {
|
|
306
|
+
this.ids.push(checkId(type));
|
|
307
|
+
this.postboy.exec(new ConnectExecutor(type, exec));
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Records a handler for a specific executor type.
|
|
312
|
+
*
|
|
313
|
+
* @param executor The constructor of the executor type, which extends `PostboyExecutor`.
|
|
314
|
+
* @param handler The execution handler associated with the given executor type.
|
|
315
|
+
* @return void
|
|
316
|
+
*/
|
|
317
|
+
recordHandler(executor, handler) {
|
|
318
|
+
this.ids.push(checkId(executor));
|
|
319
|
+
this.postboy.exec(new ConnectHandler(executor, handler));
|
|
320
|
+
return this;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* A utility function that facilitates the recording and replaying of messages
|
|
324
|
+
* using a ReplaySubject. This function is designed to handle messages of a
|
|
325
|
+
* specific type and allows specifying a buffer size to determine how many
|
|
326
|
+
* of the most recent messages should be replayed.
|
|
327
|
+
*
|
|
328
|
+
* @template T Extends the PostboyGenericMessage type, representing the type of message
|
|
329
|
+
* to be recorded and replayed.
|
|
330
|
+
* @param {MessageType<T>} type The constructor of the message type to be recorded and replayed.
|
|
331
|
+
* @param {number} [bufferSize=1] The number of recent messages to retain in the ReplaySubject's buffer.
|
|
332
|
+
* Defaults to 1 if not specified.
|
|
333
|
+
* @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.
|
|
334
|
+
*/
|
|
335
|
+
recordReplay(type, bufferSize = 1) {
|
|
336
|
+
this.record(type, new rxjs.ReplaySubject(bufferSize));
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Represents a method that records a specific behavior associated with a message type.
|
|
341
|
+
* It creates a `BehaviorSubject` initialized with the provided initial message
|
|
342
|
+
* and associates it with the given message type using the `record` method.
|
|
343
|
+
*
|
|
344
|
+
* @template T - A type parameter extending `PostboyGenericMessage` that defines the message structure.
|
|
345
|
+
* @param {MessageType<T>} type - The constructor function of the message type to be recorded.
|
|
346
|
+
* @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.
|
|
347
|
+
* @returns {void} - This function does not return a value; instead, it modifies the internal state.
|
|
348
|
+
*/
|
|
349
|
+
recordBehavior(type, initial) {
|
|
350
|
+
this.record(type, new rxjs.BehaviorSubject(initial));
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* A function that creates and returns a new generic message recorder for a specific message type.
|
|
355
|
+
*
|
|
356
|
+
* @template T - A type parameter extending from `PostboyGenericMessage`.
|
|
357
|
+
* @param {MessageType<T>} type - The constructor for the message type being recorded.
|
|
358
|
+
* @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.
|
|
359
|
+
*/
|
|
360
|
+
recordSubject(type) {
|
|
361
|
+
this.record(type, new rxjs.Subject());
|
|
362
|
+
return this;
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// src/services/namespace-registrator.ts
|
|
367
|
+
var NamespaceRegistrator = class extends PostboyAbstractRegistrator {
|
|
368
|
+
constructor(postboy) {
|
|
369
|
+
super(postboy);
|
|
370
|
+
}
|
|
371
|
+
_up() {
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// src/services/postboy-namespace.store.ts
|
|
376
|
+
var PostboyNamespaceStore = class {
|
|
377
|
+
constructor() {
|
|
378
|
+
this.spaces = /* @__PURE__ */ new Map();
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Adds a new space or retrieves an existing one if it already exists.
|
|
382
|
+
*
|
|
383
|
+
* @param {string} space - The name of the space to add or retrieve.
|
|
384
|
+
* @param {PostboyService} postboy - The PostboyService instance used to create a namespace registrator.
|
|
385
|
+
* @return {PostboyAbstractRegistrator} The registrator associated with the specified space.
|
|
386
|
+
*/
|
|
387
|
+
addSpace(space, postboy) {
|
|
388
|
+
if (this.spaces.has(space)) return this.spaces.get(space);
|
|
389
|
+
const registrator = new NamespaceRegistrator(postboy);
|
|
390
|
+
this.spaces.set(space, registrator);
|
|
391
|
+
return registrator;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Removes a specified space from the spaces collection if it exists.
|
|
395
|
+
* If the space exists, it will be deleted after invoking its down method.
|
|
396
|
+
*
|
|
397
|
+
* @param {string} space - The name of the space to be removed.
|
|
398
|
+
* @return {void} This method does not return a value.
|
|
399
|
+
*/
|
|
400
|
+
eliminateSpace(space) {
|
|
401
|
+
if (!this.spaces.has(space)) return;
|
|
402
|
+
this.spaces.get(space)?.down();
|
|
403
|
+
this.spaces.delete(space);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Disposes of the current instance by performing cleanup operations.
|
|
407
|
+
* Iterates through all spaces, performs a "down" operation on each,
|
|
408
|
+
* and then clears the collection of spaces.
|
|
409
|
+
*
|
|
410
|
+
* @return {void} No return value.
|
|
411
|
+
*/
|
|
412
|
+
dispose() {
|
|
413
|
+
this.spaces.forEach((space) => space.down());
|
|
414
|
+
this.spaces.clear();
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/services/postboy-dependency.resolver.ts
|
|
419
|
+
var PostboyDependencyResolver = class {
|
|
420
|
+
constructor() {
|
|
421
|
+
/**
|
|
422
|
+
* Retrieves an instance of the PostboyMiddlewareService.
|
|
423
|
+
*
|
|
424
|
+
* This function initializes and returns a new instance of the
|
|
425
|
+
* PostboyMiddlewareService, which can be used to configure and manage
|
|
426
|
+
* middleware for a specific module or application.
|
|
427
|
+
*
|
|
428
|
+
* @returns {PostboyMiddlewareService} A new instance of PostboyMiddlewareService.
|
|
429
|
+
*/
|
|
430
|
+
this.getMiddlewareService = () => new PostboyMiddlewareService();
|
|
431
|
+
/**
|
|
432
|
+
* A function that instantiates and returns a new instance of PostboyMessageStore.
|
|
433
|
+
*
|
|
434
|
+
* This function serves as a factory method for creating instances
|
|
435
|
+
* of the PostboyMessageStore class.
|
|
436
|
+
*
|
|
437
|
+
* @returns {PostboyMessageStore} A new instance of the PostboyMessageStore class.
|
|
438
|
+
*/
|
|
439
|
+
this.getMessageStore = () => new PostboyMessageStore();
|
|
440
|
+
/**
|
|
441
|
+
* Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.
|
|
442
|
+
*
|
|
443
|
+
* @function getNamespaceStore
|
|
444
|
+
* @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
|
|
445
|
+
*/
|
|
446
|
+
this.getNamespaceStore = () => new PostboyNamespaceStore();
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
// src/messages/add-namespace.executor.ts
|
|
451
|
+
var AddNamespace = class extends PostboyExecutor {
|
|
452
|
+
/**
|
|
453
|
+
* Creates an instance of the class with the specified space identifier.
|
|
454
|
+
*
|
|
455
|
+
* @param {string} space - The identifier for the space.
|
|
456
|
+
*/
|
|
457
|
+
constructor(space) {
|
|
458
|
+
super();
|
|
459
|
+
this.space = space;
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
AddNamespace.ID = "6d1a6f7d-6b6e-4c4d-8af8-9cc9a32e850c";
|
|
463
|
+
|
|
464
|
+
// src/messages/eliminate-namespace.executor.ts
|
|
465
|
+
var EliminateNamespace = class extends PostboyExecutor {
|
|
466
|
+
/**
|
|
467
|
+
* Creates an instance of the class with the specified space value.
|
|
468
|
+
*
|
|
469
|
+
* @param {string} space - The string value representing the space configuration.
|
|
470
|
+
*/
|
|
471
|
+
constructor(space) {
|
|
472
|
+
super();
|
|
473
|
+
this.space = space;
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
EliminateNamespace.ID = "03bb03bb-53e0-4b74-9aad-64d5c54a8972";
|
|
477
|
+
|
|
478
|
+
// src/messages/add-middleware.executor.ts
|
|
479
|
+
var AddMiddleware = class extends PostboyExecutor {
|
|
480
|
+
/**
|
|
481
|
+
* Initializes a new instance of the class with the specified middleware.
|
|
482
|
+
*
|
|
483
|
+
* @param {PostboyMiddleware} middleware - The {@link PostboyMiddleware} to be used for processing.
|
|
484
|
+
*/
|
|
485
|
+
constructor(middleware) {
|
|
486
|
+
super();
|
|
487
|
+
this.middleware = middleware;
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
AddMiddleware.ID = "0a8cfe0a-6193-4082-8440-d0793367b21d";
|
|
491
|
+
|
|
492
|
+
// src/messages/remove-middleware.executor.ts
|
|
493
|
+
var RemoveMiddleware = class extends PostboyExecutor {
|
|
494
|
+
/**
|
|
495
|
+
* Constructs an instance of the class with the specified middleware.
|
|
496
|
+
*
|
|
497
|
+
* @param {PostboyMiddleware} middleware - The {@link PostboyMiddleware} instance to be removed.
|
|
498
|
+
*/
|
|
499
|
+
constructor(middleware) {
|
|
500
|
+
super();
|
|
501
|
+
this.middleware = middleware;
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
RemoveMiddleware.ID = "c25c708c-53c9-498d-a28b-936fbaf68b91";
|
|
505
|
+
|
|
506
|
+
// src/messages/lock-message.executor.ts
|
|
507
|
+
var LockMessage = class extends PostboyExecutor {
|
|
508
|
+
/**
|
|
509
|
+
* Constructs an instance of the class with the specified message type.
|
|
510
|
+
*
|
|
511
|
+
* @param {MessageType<T>} type - The type of the message to be used for the instance.
|
|
512
|
+
*/
|
|
513
|
+
constructor(type) {
|
|
514
|
+
super();
|
|
515
|
+
this.type = type;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
LockMessage.ID = "477df3e2-1f99-4476-9a3b-afd1fa426436";
|
|
519
|
+
|
|
520
|
+
// src/messages/unlock-message.executor.ts
|
|
521
|
+
var UnlockMessage = class extends PostboyExecutor {
|
|
522
|
+
/**
|
|
523
|
+
* Creates an instance of the class with the specified message type.
|
|
524
|
+
*
|
|
525
|
+
* @param {MessageType<T>} type - The message type for this instance.
|
|
526
|
+
*/
|
|
527
|
+
constructor(type) {
|
|
528
|
+
super();
|
|
529
|
+
this.type = type;
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
UnlockMessage.ID = "d71d25e3-90ac-4009-b972-9e6c6b05611e";
|
|
533
|
+
|
|
534
|
+
// src/postboy.service.ts
|
|
535
|
+
var PostboyService = class {
|
|
536
|
+
constructor(resolver) {
|
|
537
|
+
this.locked = /* @__PURE__ */ new Set();
|
|
538
|
+
this.dependencyResolver = resolver || new PostboyDependencyResolver();
|
|
539
|
+
this.middleware = this.dependencyResolver.getMiddlewareService();
|
|
540
|
+
this.store = this.dependencyResolver.getMessageStore();
|
|
541
|
+
this.namespaceStore = this.dependencyResolver.getNamespaceStore();
|
|
542
|
+
this.registerInfrastructureMessages();
|
|
543
|
+
}
|
|
544
|
+
registerInfrastructureMessages() {
|
|
545
|
+
this.store.registerExecutor(DisconnectMessage.ID, (e) => this.store.unregister(e.messageId));
|
|
546
|
+
this.store.registerExecutor(UnlockMessage.ID, (e) => this.locked.delete(checkId(e.type)));
|
|
547
|
+
this.store.registerExecutor(LockMessage.ID, (e) => this.locked.add(checkId(e.type)));
|
|
548
|
+
this.store.registerExecutor(
|
|
549
|
+
AddMiddleware.ID,
|
|
550
|
+
(e) => this.middleware.addMiddleware(e.middleware)
|
|
551
|
+
);
|
|
552
|
+
this.store.registerExecutor(
|
|
553
|
+
RemoveMiddleware.ID,
|
|
554
|
+
(e) => this.middleware.removeMiddleware(e.middleware)
|
|
555
|
+
);
|
|
556
|
+
this.store.registerExecutor(AddNamespace.ID, (e) => this.namespaceStore.addSpace(e.space, this));
|
|
557
|
+
this.store.registerExecutor(
|
|
558
|
+
EliminateNamespace.ID,
|
|
559
|
+
(e) => this.namespaceStore.eliminateSpace(e.space)
|
|
560
|
+
);
|
|
561
|
+
this.store.registerExecutor(ConnectMessage.ID, (e) => {
|
|
562
|
+
const { type, sub, pipe: pipe2 } = e;
|
|
563
|
+
this.store.registerMessage(checkId(type), new PostboySubscription(sub, pipe2));
|
|
564
|
+
});
|
|
565
|
+
this.store.registerExecutor(ConnectExecutor.ID, (e) => {
|
|
566
|
+
const { type, exec } = e;
|
|
567
|
+
this.store.registerExecutor(checkId(type), exec);
|
|
568
|
+
});
|
|
569
|
+
this.store.registerExecutor(ConnectHandler.ID, (e) => {
|
|
570
|
+
const { executor, handler } = e;
|
|
571
|
+
this.store.registerExecutor(checkId(executor), (e2) => handler.handle(e2));
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Locks a specific message type to prevent further modifications or actions.
|
|
576
|
+
*
|
|
577
|
+
* @deprecated The method should be replaced with firing {@link LockMessage} message.
|
|
578
|
+
* @param {MessageType<T>} type - The message type to be locked. It must extend from the `PostboyGenericMessage`.
|
|
579
|
+
* @return {void} This method does not return a value.
|
|
580
|
+
*/
|
|
581
|
+
lock(type) {
|
|
582
|
+
this.locked.add(checkId(type));
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Unlocks a previously locked message type by removing its ID from the locked set.
|
|
586
|
+
*
|
|
587
|
+
* @deprecated The method should be replaced with firing {@link UnlockMessage} message.
|
|
588
|
+
* @param {MessageType<T>} type - The message type to unlock, which is a generic type extending PostboyGenericMessage.
|
|
589
|
+
* @return {void} This method does not return any value.
|
|
590
|
+
*/
|
|
591
|
+
unlock(type) {
|
|
592
|
+
this.locked.delete(checkId(type));
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Adds a middleware to the middleware stack.
|
|
596
|
+
*
|
|
597
|
+
* @deprecated The method should be replaced with firing {@link AddMiddleware} message.
|
|
598
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be added.
|
|
599
|
+
* @return {void}
|
|
600
|
+
*/
|
|
601
|
+
addMiddleware(middleware) {
|
|
602
|
+
return this.middleware.addMiddleware(middleware);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Removes a middleware from the current middleware stack.
|
|
606
|
+
*
|
|
607
|
+
* @deprecated The method should be replaced with firing {@link RemoveMiddleware} message.
|
|
608
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be removed.
|
|
609
|
+
* @return {void} No return value.
|
|
610
|
+
*/
|
|
611
|
+
removeMiddleware(middleware) {
|
|
612
|
+
return this.middleware.removeMiddleware(middleware);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Unregisters a message identified by the given ID from the store.
|
|
616
|
+
*
|
|
617
|
+
* @deprecated The method should be replaced with firing {@link DisconnectMessage} message.
|
|
618
|
+
* @param {string} id - The unique identifier of the item to unregister.
|
|
619
|
+
* @return {void} No value is returned.
|
|
620
|
+
*/
|
|
621
|
+
unregister(id) {
|
|
622
|
+
return this.store.unregister(id);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Fires a registered event and passes the message to its subscribers.
|
|
626
|
+
*
|
|
627
|
+
* @param {PostboyGenericMessage} message - The message object containing the event data.
|
|
628
|
+
* @return {void} This method does not return a value.
|
|
629
|
+
* @throws {Error} Throws an error if no registered event is found for the provided message ID.
|
|
630
|
+
*/
|
|
631
|
+
fire(message) {
|
|
632
|
+
this.middleware.manage(message);
|
|
633
|
+
if (!this.locked.has(message.id)) this.store.getMessage(message.id, message.constructor.name).fire(message);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Triggers a callback function associated with a given message.
|
|
637
|
+
*
|
|
638
|
+
* @param {PostboyCallbackMessage<T>} message - The message object used to trigger the callback.
|
|
639
|
+
* It contains details about the event and result subscription.
|
|
640
|
+
* @param {(e: T) => void} [action] - Optional callback function to execute when the result of the message is emitted.
|
|
641
|
+
* @return {void} This method does not return any value.
|
|
642
|
+
*/
|
|
643
|
+
fireCallback(message, action) {
|
|
644
|
+
this.middleware.manage(message);
|
|
645
|
+
this.store.callbackFired(message);
|
|
646
|
+
const result$ = action ? message.result.pipe(operators.tap(action)) : message.result;
|
|
647
|
+
const observable = new rxjs.Observable((subscriber) => {
|
|
648
|
+
const subscription = result$.subscribe(subscriber);
|
|
649
|
+
if (!this.locked.has(message.id)) {
|
|
650
|
+
this.store.getMessage(message.id, message.constructor.name).fire(message);
|
|
651
|
+
}
|
|
652
|
+
return () => subscription.unsubscribe();
|
|
653
|
+
});
|
|
654
|
+
if (!!action) observable.subscribe();
|
|
655
|
+
return observable;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Executes the provided executor function and returns its result.
|
|
659
|
+
*
|
|
660
|
+
* @param {PostboyExecutor<T>} executor The executor to be executed, which includes its identifier and logic.
|
|
661
|
+
* @return {T} The resulting output from the executed executor function.
|
|
662
|
+
* @throws {Error} If the specified executor is not registered.
|
|
663
|
+
*/
|
|
664
|
+
exec(executor) {
|
|
665
|
+
this.middleware.manage(executor);
|
|
666
|
+
return this.store.getExecutor(executor.id)(executor);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Subscribes to a specific message type and returns an observable of that type.
|
|
670
|
+
*
|
|
671
|
+
* @param type The constructor function of the type that extends PostboyGenericMessage.
|
|
672
|
+
* @return An Observable of the specified generic message type.
|
|
673
|
+
*/
|
|
674
|
+
sub(type) {
|
|
675
|
+
return this.store.getMessage(checkId(type), type.name).sub();
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Subscribes to a specific message type and automatically unsubscribes after receiving the first message.
|
|
679
|
+
*
|
|
680
|
+
* @param type The type of message to subscribe to.
|
|
681
|
+
* @return An observable that emits the first message of the specified type and then completes.
|
|
682
|
+
*/
|
|
683
|
+
once(type) {
|
|
684
|
+
return this.sub(type).pipe(operators.first());
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Registers a given message type and its associated subject subscription with the system.
|
|
688
|
+
*
|
|
689
|
+
* @deprecated The method should be replaced with firing {@link ConnectMessage} message.
|
|
690
|
+
* @param type The constructor function of the message type that extends the PostboyGenericMessage.
|
|
691
|
+
* @param sub The Subject instance for the provided message type, used for managing subscriptions.
|
|
692
|
+
* @return {void} No return value.
|
|
693
|
+
*/
|
|
694
|
+
record(type, sub) {
|
|
695
|
+
this.store.registerMessage(checkId(type), new PostboySubscription(sub, (s) => s.asObservable()));
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Registers a generic message type with a Subject and a transformation pipe.
|
|
699
|
+
*
|
|
700
|
+
* @deprecated The method should be replaced with firing {@link ConnectMessage} message.
|
|
701
|
+
* @param {MessageType<T>} type - The constructor of the message type being registered.
|
|
702
|
+
* @param {Subject<T>} sub - The Subject instance used to handle incoming messages of the specified type.
|
|
703
|
+
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation or processing logic to the Subject and returns an Observable.
|
|
704
|
+
* @return {void} No return value.
|
|
705
|
+
*/
|
|
706
|
+
recordWithPipe(type, sub, pipe2) {
|
|
707
|
+
this.store.registerMessage(checkId(type), new PostboySubscription(sub, pipe2));
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Registers an executor for a specified message type.
|
|
711
|
+
*
|
|
712
|
+
* @deprecated The method should be replaced with firing {@link ConnectExecutor} message.
|
|
713
|
+
* @param {MessageType<E>} type - The message type for which the executor is being registered.
|
|
714
|
+
* @param {(e: E) => T} exec - The executor function that will handle messages of the specified type.
|
|
715
|
+
* @return {void} This method does not return any value.
|
|
716
|
+
*/
|
|
717
|
+
recordExecutor(type, exec) {
|
|
718
|
+
this.store.registerExecutor(checkId(type), exec);
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Registers a handler for a specific executor type.
|
|
722
|
+
*
|
|
723
|
+
* @deprecated The method should be replaced with firing {@link ConnectHandler} message.
|
|
724
|
+
* @param executor The constructor of the executor class that extends `PostboyExecutor<R>`.
|
|
725
|
+
* @param handler An instance of `PostboyExecutionHandler<R, E>` that defines the logic for handling the executor.
|
|
726
|
+
* @return void
|
|
727
|
+
*/
|
|
728
|
+
recordHandler(executor, handler) {
|
|
729
|
+
this.store.registerExecutor(checkId(executor), (e) => handler.handle(e));
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Adds a namespace to the namespace store.
|
|
733
|
+
*
|
|
734
|
+
* @deprecated The method should be replaced with firing {@link AddNamespace} message.
|
|
735
|
+
* @param {string} space - The name of the namespace to be added.
|
|
736
|
+
* @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.
|
|
737
|
+
*/
|
|
738
|
+
addNamespace(space) {
|
|
739
|
+
return this.namespaceStore.addSpace(space, this);
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Removes the specified namespace from the namespace store.
|
|
743
|
+
*
|
|
744
|
+
* @deprecated The method should be replaced with firing {@link EliminateNamespace} message.
|
|
745
|
+
* @param {string} space - The name of the namespace to be removed.
|
|
746
|
+
* @return {void} This method does not return a value.
|
|
747
|
+
*/
|
|
748
|
+
eliminateNamespace(space) {
|
|
749
|
+
return this.namespaceStore?.eliminateSpace(space);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Disposes of resources and cleans up any internal components or stores associated with the instance.
|
|
753
|
+
* This method ensures that all resources are properly released to avoid memory leaks.
|
|
754
|
+
*
|
|
755
|
+
* @return {void} This method does not return a value.
|
|
756
|
+
*/
|
|
757
|
+
dispose() {
|
|
758
|
+
this.namespaceStore?.dispose();
|
|
759
|
+
this.store.dispose();
|
|
760
|
+
this.middleware.dispose();
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
var PostboyCallbackMessage = class extends PostboyGenericMessage {
|
|
764
|
+
constructor() {
|
|
765
|
+
super(...arguments);
|
|
766
|
+
this.result$ = new rxjs.Subject();
|
|
767
|
+
this.result = this.result$.asObservable();
|
|
768
|
+
/**
|
|
769
|
+
* Emits the provided value.
|
|
770
|
+
*
|
|
771
|
+
* @template T - The type of the value to emit.
|
|
772
|
+
* @param {T} value - The value to emit through the `result$` observable.
|
|
773
|
+
* @returns {void}
|
|
774
|
+
*/
|
|
775
|
+
this.next = (value) => this.result$.next(value);
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Marks the operation as complete by emitting the provided value and then completing the result stream.
|
|
779
|
+
*
|
|
780
|
+
* @param {T} value - The value to emit prior to completing the result stream.
|
|
781
|
+
* @return {void} This method does not return a value.
|
|
782
|
+
*/
|
|
783
|
+
finish(value) {
|
|
784
|
+
this.result$.next(value);
|
|
785
|
+
this.result$.complete();
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Completes the current observable result stream.
|
|
789
|
+
* This method marks the result observable as complete, ensuring no further values
|
|
790
|
+
* or events will be emitted from it.
|
|
791
|
+
*
|
|
792
|
+
* @return {void} No value is returned from this method.
|
|
793
|
+
*/
|
|
794
|
+
complete() {
|
|
795
|
+
this.result$.complete();
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
// src/models/postboy-execution.handler.ts
|
|
800
|
+
var PostboyExecutionHandler = class {
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
exports.AddMiddleware = AddMiddleware;
|
|
804
|
+
exports.AddNamespace = AddNamespace;
|
|
805
|
+
exports.ConnectExecutor = ConnectExecutor;
|
|
806
|
+
exports.ConnectHandler = ConnectHandler;
|
|
807
|
+
exports.ConnectMessage = ConnectMessage;
|
|
808
|
+
exports.DisconnectMessage = DisconnectMessage;
|
|
809
|
+
exports.EliminateNamespace = EliminateNamespace;
|
|
810
|
+
exports.LockMessage = LockMessage;
|
|
811
|
+
exports.PostboyAbstractRegistrator = PostboyAbstractRegistrator;
|
|
812
|
+
exports.PostboyCallbackMessage = PostboyCallbackMessage;
|
|
813
|
+
exports.PostboyExecutionHandler = PostboyExecutionHandler;
|
|
814
|
+
exports.PostboyExecutor = PostboyExecutor;
|
|
815
|
+
exports.PostboyGenericMessage = PostboyGenericMessage;
|
|
816
|
+
exports.PostboyMessage = PostboyMessage;
|
|
817
|
+
exports.PostboyMessageStore = PostboyMessageStore;
|
|
818
|
+
exports.PostboyMiddlewareService = PostboyMiddlewareService;
|
|
819
|
+
exports.PostboyNamespaceStore = PostboyNamespaceStore;
|
|
820
|
+
exports.PostboyService = PostboyService;
|
|
821
|
+
exports.PostboySubscription = PostboySubscription;
|
|
822
|
+
exports.RemoveMiddleware = RemoveMiddleware;
|
|
823
|
+
exports.UnlockMessage = UnlockMessage;
|
|
824
|
+
exports.checkId = checkId;
|
|
825
|
+
//# sourceMappingURL=index.cjs.map
|
|
2
826
|
//# sourceMappingURL=index.cjs.map
|