@artstesh/postboy 1.2.3 → 1.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.
- package/README.md +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/messages/add-middleware.executor.d.ts +19 -0
- package/lib/messages/add-middleware.executor.d.ts.map +1 -0
- package/lib/messages/add-middleware.executor.js +24 -0
- package/lib/messages/add-middleware.executor.js.map +1 -0
- package/lib/messages/add-namespace.executor.d.ts +19 -0
- package/lib/messages/add-namespace.executor.d.ts.map +1 -0
- package/lib/messages/add-namespace.executor.js +24 -0
- package/lib/messages/add-namespace.executor.js.map +1 -0
- package/lib/messages/connect-executor.executor.d.ts +25 -0
- package/lib/messages/connect-executor.executor.d.ts.map +1 -0
- package/lib/messages/connect-executor.executor.js +30 -0
- package/lib/messages/connect-executor.executor.js.map +1 -0
- package/lib/messages/connect-handler.executor.d.ts +25 -0
- package/lib/messages/connect-handler.executor.d.ts.map +1 -0
- package/lib/messages/connect-handler.executor.js +30 -0
- package/lib/messages/connect-handler.executor.js.map +1 -0
- package/lib/messages/connect-message.executor.d.ts +28 -0
- package/lib/messages/connect-message.executor.d.ts.map +1 -0
- package/lib/messages/connect-message.executor.js +31 -0
- package/lib/messages/connect-message.executor.js.map +1 -0
- package/lib/messages/connect.message.executor.d.ts +28 -0
- package/lib/messages/connect.message.executor.d.ts.map +1 -0
- package/lib/messages/connect.message.executor.js +31 -0
- package/lib/messages/connect.message.executor.js.map +1 -0
- package/lib/messages/disconnect-message.executor.d.ts +19 -0
- package/lib/messages/disconnect-message.executor.d.ts.map +1 -0
- package/lib/messages/disconnect-message.executor.js +25 -0
- package/lib/messages/disconnect-message.executor.js.map +1 -0
- package/lib/messages/eliminate-namespace.executor.d.ts +16 -0
- package/lib/messages/eliminate-namespace.executor.d.ts.map +1 -0
- package/lib/messages/eliminate-namespace.executor.js +22 -0
- package/lib/messages/eliminate-namespace.executor.js.map +1 -0
- package/lib/messages/index.d.ts +11 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +24 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/lock-message.executor.d.ts +22 -0
- package/lib/messages/lock-message.executor.d.ts.map +1 -0
- package/lib/messages/lock-message.executor.js +26 -0
- package/lib/messages/lock-message.executor.js.map +1 -0
- package/lib/messages/remove-middleware.executor.d.ts +17 -0
- package/lib/messages/remove-middleware.executor.d.ts.map +1 -0
- package/lib/messages/remove-middleware.executor.js +22 -0
- package/lib/messages/remove-middleware.executor.js.map +1 -0
- package/lib/messages/unlock-message.executor.d.ts +21 -0
- package/lib/messages/unlock-message.executor.d.ts.map +1 -0
- package/lib/messages/unlock-message.executor.js +25 -0
- package/lib/messages/unlock-message.executor.js.map +1 -0
- package/lib/models/cancel-details.d.ts +9 -0
- package/lib/models/cancel-details.d.ts.map +1 -0
- package/lib/models/cancel-details.js +3 -0
- package/lib/models/cancel-details.js.map +1 -0
- package/lib/models/cancel-error.d.ts +7 -0
- package/lib/models/cancel-error.d.ts.map +1 -0
- package/lib/models/cancel-error.js +18 -0
- package/lib/models/cancel-error.js.map +1 -0
- package/lib/models/middleware-decision.enum.d.ts +5 -0
- package/lib/models/middleware-decision.enum.d.ts.map +1 -0
- package/lib/models/middleware-decision.enum.js +9 -0
- package/lib/models/middleware-decision.enum.js.map +1 -0
- package/lib/models/middleware-stage.enum.d.ts +6 -0
- package/lib/models/middleware-stage.enum.d.ts.map +1 -0
- package/lib/models/middleware-stage.enum.js +10 -0
- package/lib/models/middleware-stage.enum.js.map +1 -0
- package/lib/models/pipeline-context.d.ts +7 -0
- package/lib/models/pipeline-context.d.ts.map +1 -0
- package/lib/models/pipeline-context.js +3 -0
- package/lib/models/pipeline-context.js.map +1 -0
- package/lib/models/pipeline-result.d.ts +6 -0
- package/lib/models/pipeline-result.d.ts.map +1 -0
- package/lib/models/pipeline-result.js +3 -0
- package/lib/models/pipeline-result.js.map +1 -0
- package/lib/models/postboy-callback.message.d.ts +21 -0
- package/lib/models/postboy-callback.message.d.ts.map +1 -1
- package/lib/models/postboy-callback.message.js +23 -0
- package/lib/models/postboy-callback.message.js.map +1 -1
- package/lib/models/postboy-execution.handler.d.ts +6 -0
- package/lib/models/postboy-execution.handler.d.ts.map +1 -1
- package/lib/models/postboy-execution.handler.js.map +1 -1
- package/lib/models/postboy-message-metadata.d.ts +26 -0
- package/lib/models/postboy-message-metadata.d.ts.map +1 -0
- package/lib/models/postboy-message-metadata.js +3 -0
- package/lib/models/postboy-message-metadata.js.map +1 -0
- package/lib/models/postboy-message.context.d.ts +9 -0
- package/lib/models/postboy-message.context.d.ts.map +1 -0
- package/lib/models/postboy-message.context.js +3 -0
- package/lib/models/postboy-message.context.js.map +1 -0
- package/lib/models/postboy-subscription.d.ts +31 -2
- package/lib/models/postboy-subscription.d.ts.map +1 -1
- package/lib/models/postboy-subscription.js +31 -2
- package/lib/models/postboy-subscription.js.map +1 -1
- package/lib/models/postboy.message.d.ts +3 -0
- package/lib/models/postboy.message.d.ts.map +1 -1
- package/lib/models/postboy.message.js +7 -0
- package/lib/models/postboy.message.js.map +1 -1
- package/lib/models/postboy.settings.d.ts +13 -0
- package/lib/models/postboy.settings.d.ts.map +1 -0
- package/lib/models/postboy.settings.js +20 -0
- package/lib/models/postboy.settings.js.map +1 -0
- package/lib/postboy-abstract.registrator.d.ts +15 -32
- package/lib/postboy-abstract.registrator.d.ts.map +1 -1
- package/lib/postboy-abstract.registrator.js +68 -73
- package/lib/postboy-abstract.registrator.js.map +1 -1
- package/lib/postboy.service.d.ts +73 -39
- package/lib/postboy.service.d.ts.map +1 -1
- package/lib/postboy.service.js +135 -63
- package/lib/postboy.service.js.map +1 -1
- package/lib/services/namespace-registrator.d.ts +13 -13
- package/lib/services/namespace-registrator.js +20 -20
- package/lib/services/postboy-context.service.d.ts +13 -0
- package/lib/services/postboy-context.service.d.ts.map +1 -0
- package/lib/services/postboy-context.service.js +50 -0
- package/lib/services/postboy-context.service.js.map +1 -0
- package/lib/services/postboy-dependency.resolver.d.ts +25 -0
- package/lib/services/postboy-dependency.resolver.d.ts.map +1 -1
- package/lib/services/postboy-dependency.resolver.js +25 -0
- package/lib/services/postboy-dependency.resolver.js.map +1 -1
- package/lib/services/postboy-message.store.d.ts +5 -1
- package/lib/services/postboy-message.store.d.ts.map +1 -1
- package/lib/services/postboy-message.store.js +23 -7
- package/lib/services/postboy-message.store.js.map +1 -1
- package/lib/services/postboy-middleware.d.ts +35 -0
- package/lib/services/postboy-middleware.d.ts.map +1 -0
- package/lib/services/postboy-middleware.js +47 -0
- package/lib/services/postboy-middleware.js.map +1 -0
- package/lib/services/postboy-middleware.service.d.ts +28 -0
- package/lib/services/postboy-middleware.service.d.ts.map +1 -1
- package/lib/services/postboy-middleware.service.js +30 -0
- package/lib/services/postboy-middleware.service.js.map +1 -1
- package/lib/services/postboy-namespace.store.d.ts +33 -34
- package/lib/services/postboy-namespace.store.d.ts.map +1 -1
- package/lib/services/postboy-namespace.store.js +53 -53
- package/lib/services/postboy-namespace.store.js.map +1 -1
- package/lib/utils/id.generator.d.ts +4 -4
- package/lib/utils/id.generator.js +17 -17
- package/lib/utils/id.generator.js.map +1 -1
- package/package.json +5 -10
package/lib/postboy.service.js
CHANGED
|
@@ -1,27 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PostboyService = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
4
5
|
const postboy_generic_message_1 = require("./models/postboy-generic-message");
|
|
5
|
-
const locker_store_1 = require("./locker.store");
|
|
6
6
|
const postboy_subscription_1 = require("./models/postboy-subscription");
|
|
7
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
|
+
const operators_1 = require("rxjs/internal/operators");
|
|
8
19
|
class PostboyService {
|
|
9
20
|
constructor(resolver) {
|
|
10
|
-
this.locker = new locker_store_1.LockerStore();
|
|
11
21
|
this.locked = new Set();
|
|
12
|
-
|
|
13
|
-
this.middleware =
|
|
14
|
-
this.store =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.
|
|
22
|
+
this.dependencyResolver = resolver || new postboy_dependency_resolver_1.PostboyDependencyResolver();
|
|
23
|
+
this.middleware = this.dependencyResolver.getMiddlewareService();
|
|
24
|
+
this.store = this.dependencyResolver.getMessageStore();
|
|
25
|
+
this.namespaceStore = this.dependencyResolver.getNamespaceStore();
|
|
26
|
+
this.registerInfrastructureMessages();
|
|
27
|
+
}
|
|
28
|
+
registerInfrastructureMessages() {
|
|
29
|
+
this.store.registerExecutor(disconnect_message_executor_1.DisconnectMessage.ID, (e) => this.store.unregister(e.messageId));
|
|
30
|
+
this.store.registerExecutor(unlock_message_executor_1.UnlockMessage.ID, (e) => this.locked.delete((0, postboy_generic_message_1.checkId)(e.type)));
|
|
31
|
+
this.store.registerExecutor(lock_message_executor_1.LockMessage.ID, (e) => this.locked.add((0, postboy_generic_message_1.checkId)(e.type)));
|
|
32
|
+
this.store.registerExecutor(add_middleware_executor_1.AddMiddleware.ID, (e) => this.middleware.addMiddleware(e.middleware));
|
|
33
|
+
this.store.registerExecutor(remove_middleware_executor_1.RemoveMiddleware.ID, (e) => this.middleware.removeMiddleware(e.middleware));
|
|
34
|
+
this.store.registerExecutor(add_namespace_executor_1.AddNamespace.ID, (e) => this.namespaceStore.addSpace(e.space, this));
|
|
35
|
+
this.store.registerExecutor(eliminate_namespace_executor_1.EliminateNamespace.ID, (e) => this.namespaceStore.eliminateSpace(e.space));
|
|
36
|
+
this.store.registerExecutor(connect_message_executor_1.ConnectMessage.ID, (e) => {
|
|
37
|
+
const { type, sub, pipe } = e;
|
|
38
|
+
this.store.registerMessage((0, postboy_generic_message_1.checkId)(type), new postboy_subscription_1.PostboySubscription(sub, pipe));
|
|
39
|
+
});
|
|
40
|
+
this.store.registerExecutor(connect_executor_executor_1.ConnectExecutor.ID, (e) => {
|
|
41
|
+
const { type, exec } = e;
|
|
42
|
+
this.store.registerExecutor((0, postboy_generic_message_1.checkId)(type), exec);
|
|
43
|
+
});
|
|
44
|
+
this.store.registerExecutor(connect_handler_executor_1.ConnectHandler.ID, (e) => {
|
|
45
|
+
const { executor, handler } = e;
|
|
46
|
+
this.store.registerExecutor((0, postboy_generic_message_1.checkId)(executor), (e) => handler.handle(e));
|
|
47
|
+
});
|
|
21
48
|
}
|
|
22
49
|
/**
|
|
23
50
|
* Locks a specific message type to prevent further modifications or actions.
|
|
24
51
|
*
|
|
52
|
+
* @deprecated The method should be replaced with firing {@link LockMessage} message.
|
|
25
53
|
* @param {MessageType<T>} type - The message type to be locked. It must extend from the `PostboyGenericMessage`.
|
|
26
54
|
* @return {void} This method does not return a value.
|
|
27
55
|
*/
|
|
@@ -31,52 +59,43 @@ class PostboyService {
|
|
|
31
59
|
/**
|
|
32
60
|
* Unlocks a previously locked message type by removing its ID from the locked set.
|
|
33
61
|
*
|
|
62
|
+
* @deprecated The method should be replaced with firing {@link UnlockMessage} message.
|
|
34
63
|
* @param {MessageType<T>} type - The message type to unlock, which is a generic type extending PostboyGenericMessage.
|
|
35
64
|
* @return {void} This method does not return any value.
|
|
36
65
|
*/
|
|
37
66
|
unlock(type) {
|
|
38
67
|
this.locked.delete((0, postboy_generic_message_1.checkId)(type));
|
|
39
68
|
}
|
|
40
|
-
addMiddleware(middleware) {
|
|
41
|
-
return this.middleware.addMiddleware(middleware);
|
|
42
|
-
}
|
|
43
|
-
removeMiddleware(middleware) {
|
|
44
|
-
return this.middleware.removeMiddleware(middleware);
|
|
45
|
-
}
|
|
46
69
|
/**
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @deprecated The method should be replaced with exec<T>
|
|
70
|
+
* Adds a middleware to the middleware stack.
|
|
71
|
+
*
|
|
72
|
+
* @deprecated The method should be replaced with firing {@link AddMiddleware} message.
|
|
73
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be added.
|
|
74
|
+
* @return {void}
|
|
54
75
|
*/
|
|
55
|
-
|
|
56
|
-
this.middleware.
|
|
57
|
-
return this.store.getExecutor(executor.id)(executor);
|
|
76
|
+
addMiddleware(middleware) {
|
|
77
|
+
return this.middleware.addMiddleware(middleware);
|
|
58
78
|
}
|
|
59
79
|
/**
|
|
60
|
-
*
|
|
80
|
+
* Removes a middleware from the current middleware stack.
|
|
81
|
+
*
|
|
82
|
+
* @deprecated The method should be replaced with firing {@link RemoveMiddleware} message.
|
|
83
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be removed.
|
|
84
|
+
* @return {void} No return value.
|
|
61
85
|
*/
|
|
62
|
-
|
|
63
|
-
this.
|
|
86
|
+
removeMiddleware(middleware) {
|
|
87
|
+
return this.middleware.removeMiddleware(middleware);
|
|
64
88
|
}
|
|
65
89
|
/**
|
|
66
|
-
*
|
|
90
|
+
* Unregisters a message identified by the given ID from the store.
|
|
91
|
+
*
|
|
92
|
+
* @deprecated The method should be replaced with firing {@link DisconnectMessage} message.
|
|
93
|
+
* @param {string} id - The unique identifier of the item to unregister.
|
|
94
|
+
* @return {void} No value is returned.
|
|
67
95
|
*/
|
|
68
|
-
registerWithPipe(id, sub, pipe) {
|
|
69
|
-
this.store.registerMessage(id, new postboy_subscription_1.PostboySubscription(sub, pipe));
|
|
70
|
-
}
|
|
71
96
|
unregister(id) {
|
|
72
97
|
return this.store.unregister(id);
|
|
73
98
|
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated The method should be replaced with sub<T>
|
|
76
|
-
*/
|
|
77
|
-
subscribe(id) {
|
|
78
|
-
return this.store.getMessage(id, id).sub();
|
|
79
|
-
}
|
|
80
99
|
/**
|
|
81
100
|
* Fires a registered event and passes the message to its subscribers.
|
|
82
101
|
*
|
|
@@ -86,7 +105,7 @@ class PostboyService {
|
|
|
86
105
|
*/
|
|
87
106
|
fire(message) {
|
|
88
107
|
this.middleware.manage(message);
|
|
89
|
-
if (this.
|
|
108
|
+
if (!this.locked.has(message.id))
|
|
90
109
|
this.store.getMessage(message.id, message.constructor.name).fire(message);
|
|
91
110
|
}
|
|
92
111
|
/**
|
|
@@ -99,12 +118,30 @@ class PostboyService {
|
|
|
99
118
|
*/
|
|
100
119
|
fireCallback(message, action) {
|
|
101
120
|
this.middleware.manage(message);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
121
|
+
this.store.callbackFired(message);
|
|
122
|
+
const result$ = action ? message.result.pipe((0, operators_1.tap)(action)) : message.result;
|
|
123
|
+
const observable = new rxjs_1.Observable((subscriber) => {
|
|
124
|
+
const subscription = result$.subscribe(subscriber);
|
|
125
|
+
if (!this.locked.has(message.id)) {
|
|
126
|
+
this.store.getMessage(message.id, message.constructor.name).fire(message);
|
|
127
|
+
}
|
|
128
|
+
return () => subscription.unsubscribe();
|
|
129
|
+
});
|
|
130
|
+
if (!!action)
|
|
131
|
+
observable.subscribe();
|
|
132
|
+
return observable;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Executes the provided executor function and returns its result.
|
|
136
|
+
*
|
|
137
|
+
* @param {PostboyExecutor<T>} executor The executor to be executed, which includes its identifier and logic.
|
|
138
|
+
* @return {T} The resulting output from the executed executor function.
|
|
139
|
+
* @throws {Error} If the specified executor is not registered.
|
|
140
|
+
*/
|
|
141
|
+
exec(executor) {
|
|
142
|
+
this.middleware.manage(executor);
|
|
143
|
+
return this.store.getExecutor(executor.id)(executor);
|
|
106
144
|
}
|
|
107
|
-
// future
|
|
108
145
|
/**
|
|
109
146
|
* Subscribes to a specific message type and returns an observable of that type.
|
|
110
147
|
*
|
|
@@ -114,9 +151,19 @@ class PostboyService {
|
|
|
114
151
|
sub(type) {
|
|
115
152
|
return this.store.getMessage((0, postboy_generic_message_1.checkId)(type), type.name).sub();
|
|
116
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Subscribes to a specific message type and automatically unsubscribes after receiving the first message.
|
|
156
|
+
*
|
|
157
|
+
* @param type The type of message to subscribe to.
|
|
158
|
+
* @return An observable that emits the first message of the specified type and then completes.
|
|
159
|
+
*/
|
|
160
|
+
once(type) {
|
|
161
|
+
return this.sub(type).pipe((0, operators_1.first)());
|
|
162
|
+
}
|
|
117
163
|
/**
|
|
118
164
|
* Registers a given message type and its associated subject subscription with the system.
|
|
119
165
|
*
|
|
166
|
+
* @deprecated The method should be replaced with firing {@link ConnectMessage} message.
|
|
120
167
|
* @param type The constructor function of the message type that extends the PostboyGenericMessage.
|
|
121
168
|
* @param sub The Subject instance for the provided message type, used for managing subscriptions.
|
|
122
169
|
* @return {void} No return value.
|
|
@@ -127,6 +174,7 @@ class PostboyService {
|
|
|
127
174
|
/**
|
|
128
175
|
* Registers a generic message type with a Subject and a transformation pipe.
|
|
129
176
|
*
|
|
177
|
+
* @deprecated The method should be replaced with firing {@link ConnectMessage} message.
|
|
130
178
|
* @param {MessageType<T>} type - The constructor of the message type being registered.
|
|
131
179
|
* @param {Subject<T>} sub - The Subject instance used to handle incoming messages of the specified type.
|
|
132
180
|
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that applies a transformation or processing logic to the Subject and returns an Observable.
|
|
@@ -136,35 +184,59 @@ class PostboyService {
|
|
|
136
184
|
this.store.registerMessage((0, postboy_generic_message_1.checkId)(type), new postboy_subscription_1.PostboySubscription(sub, pipe));
|
|
137
185
|
}
|
|
138
186
|
/**
|
|
139
|
-
*
|
|
187
|
+
* Registers an executor for a specified message type.
|
|
140
188
|
*
|
|
141
|
-
* @
|
|
142
|
-
* @param {
|
|
143
|
-
* @
|
|
189
|
+
* @deprecated The method should be replaced with firing {@link ConnectExecutor} message.
|
|
190
|
+
* @param {MessageType<E>} type - The message type for which the executor is being registered.
|
|
191
|
+
* @param {(e: E) => T} exec - The executor function that will handle messages of the specified type.
|
|
192
|
+
* @return {void} This method does not return any value.
|
|
144
193
|
*/
|
|
145
194
|
recordExecutor(type, exec) {
|
|
146
195
|
this.store.registerExecutor((0, postboy_generic_message_1.checkId)(type), exec);
|
|
147
196
|
}
|
|
148
197
|
/**
|
|
149
|
-
*
|
|
198
|
+
* Registers a handler for a specific executor type.
|
|
150
199
|
*
|
|
151
|
-
* @
|
|
152
|
-
* @
|
|
153
|
-
* @
|
|
200
|
+
* @deprecated The method should be replaced with firing {@link ConnectHandler} message.
|
|
201
|
+
* @param executor The constructor of the executor class that extends `PostboyExecutor<R>`.
|
|
202
|
+
* @param handler An instance of `PostboyExecutionHandler<R, E>` that defines the logic for handling the executor.
|
|
203
|
+
* @return void
|
|
154
204
|
*/
|
|
155
|
-
|
|
156
|
-
this.
|
|
157
|
-
return this.store.getExecutor(executor.id)(executor);
|
|
205
|
+
recordHandler(executor, handler) {
|
|
206
|
+
this.store.registerExecutor((0, postboy_generic_message_1.checkId)(executor), (e) => handler.handle(e));
|
|
158
207
|
}
|
|
159
208
|
/**
|
|
160
|
-
*
|
|
209
|
+
* Adds a namespace to the namespace store.
|
|
161
210
|
*
|
|
162
|
-
* @
|
|
163
|
-
* @param {
|
|
164
|
-
* @return {
|
|
211
|
+
* @deprecated The method should be replaced with firing {@link AddNamespace} message.
|
|
212
|
+
* @param {string} space - The name of the namespace to be added.
|
|
213
|
+
* @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.
|
|
165
214
|
*/
|
|
166
|
-
|
|
167
|
-
this.
|
|
215
|
+
addNamespace(space) {
|
|
216
|
+
return this.namespaceStore.addSpace(space, this);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Removes the specified namespace from the namespace store.
|
|
220
|
+
*
|
|
221
|
+
* @deprecated The method should be replaced with firing {@link EliminateNamespace} message.
|
|
222
|
+
* @param {string} space - The name of the namespace to be removed.
|
|
223
|
+
* @return {void} This method does not return a value.
|
|
224
|
+
*/
|
|
225
|
+
eliminateNamespace(space) {
|
|
226
|
+
var _a;
|
|
227
|
+
return (_a = this.namespaceStore) === null || _a === void 0 ? void 0 : _a.eliminateSpace(space);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Disposes of resources and cleans up any internal components or stores associated with the instance.
|
|
231
|
+
* This method ensures that all resources are properly released to avoid memory leaks.
|
|
232
|
+
*
|
|
233
|
+
* @return {void} This method does not return a value.
|
|
234
|
+
*/
|
|
235
|
+
dispose() {
|
|
236
|
+
var _a;
|
|
237
|
+
(_a = this.namespaceStore) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
238
|
+
this.store.dispose();
|
|
239
|
+
this.middleware.dispose();
|
|
168
240
|
}
|
|
169
241
|
}
|
|
170
242
|
exports.PostboyService = PostboyService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy.service.js","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"postboy.service.js","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":";;;AAAA,+BAA2C;AAC3C,8EAAkF;AAClF,wEAAoE;AAMpE,wFAAmF;AAInF,8EAAiE;AACjE,0FAA6E;AAC7E,gFAAmE;AACnE,s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C,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"}
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
}
|
|
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
14
|
//# sourceMappingURL=namespace-registrator.d.ts.map
|
|
@@ -1,21 +1,21 @@
|
|
|
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;
|
|
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
21
|
//# sourceMappingURL=namespace-registrator.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
|
@@ -0,0 +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;IAmB3D,OAAO,IAAI,IAAI;CAGvB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
|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B,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,7 +1,32 @@
|
|
|
1
1
|
import { PostboyMiddlewareService } from './postboy-middleware.service';
|
|
2
2
|
import { PostboyMessageStore } from './postboy-message.store';
|
|
3
|
+
import { PostboyNamespaceStore } from './postboy-namespace.store';
|
|
3
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
|
+
*/
|
|
4
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
|
+
*/
|
|
5
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;
|
|
6
31
|
}
|
|
7
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;
|
|
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"}
|
|
@@ -3,10 +3,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
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
|
+
const postboy_namespace_store_1 = require("./postboy-namespace.store");
|
|
6
7
|
class PostboyDependencyResolver {
|
|
7
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
|
+
*/
|
|
8
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
|
+
*/
|
|
9
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();
|
|
10
35
|
}
|
|
11
36
|
}
|
|
12
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;
|
|
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,16 +1,20 @@
|
|
|
1
1
|
import { PostboySubscription } from '../models/postboy-subscription';
|
|
2
2
|
import { PostboyExecutor } from '../models/postboy-executor';
|
|
3
|
+
import { PostboyCallbackMessage } from '../models/postboy-callback.message';
|
|
3
4
|
/**
|
|
4
5
|
* The PostboyMessageStore is a utility class for managing message subscriptions and executors.
|
|
5
6
|
* It provides functionality to register, retrieve, and unregister subscription-based messages and executors.
|
|
6
7
|
*/
|
|
7
8
|
export declare class PostboyMessageStore {
|
|
8
|
-
protected
|
|
9
|
+
protected messages: Map<string, PostboySubscription<any>>;
|
|
9
10
|
protected executors: Map<string, (e: PostboyExecutor<any>) => any>;
|
|
11
|
+
protected callbacks: Map<string, (() => void)[]>;
|
|
10
12
|
registerMessage(id: string, sub: PostboySubscription<any>): void;
|
|
11
13
|
registerExecutor(id: string, executor: (e: PostboyExecutor<any>) => any): void;
|
|
14
|
+
callbackFired(message: PostboyCallbackMessage<any>): void;
|
|
12
15
|
getMessage(id: string, name: string): PostboySubscription<any>;
|
|
13
16
|
getExecutor<T>(id: string): (e: PostboyExecutor<T>) => T;
|
|
14
17
|
unregister(id: string): void;
|
|
18
|
+
dispose(): void;
|
|
15
19
|
}
|
|
16
20
|
//# sourceMappingURL=postboy-message.store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,gBAAgB,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"}
|