@artstesh/postboy 3.1.1 → 3.1.3
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/locker.store.js.map +1 -0
- package/lib/mocks/message-history-item-mock.js.map +1 -0
- package/lib/mocks/message-history-mock.js.map +1 -0
- package/lib/mocks/postboy-service-mock.js.map +1 -0
- package/lib/models/postboy.locker.js.map +1 -0
- package/lib/postboy-abstract.registrator.d.ts +10 -8
- package/lib/postboy-abstract.registrator.d.ts.map +1 -1
- package/lib/postboy-abstract.registrator.js +52 -35
- package/lib/postboy-abstract.registrator.js.map +1 -1
- package/lib/postboy.service.d.ts +24 -1
- package/lib/postboy.service.d.ts.map +1 -1
- package/lib/postboy.service.js +36 -3
- package/lib/postboy.service.js.map +1 -1
- package/lib/services/namespace-registrator.d.ts +14 -0
- package/lib/services/namespace-registrator.d.ts.map +1 -0
- package/lib/services/namespace-registrator.js +21 -0
- package/lib/services/namespace-registrator.js.map +1 -0
- package/lib/services/postboy-dependency.resolver.d.ts +27 -0
- package/lib/services/postboy-dependency.resolver.d.ts.map +1 -1
- package/lib/services/postboy-dependency.resolver.js +26 -0
- package/lib/services/postboy-dependency.resolver.js.map +1 -1
- package/lib/services/postboy-message.store.d.ts +1 -0
- package/lib/services/postboy-message.store.d.ts.map +1 -1
- package/lib/services/postboy-message.store.js +13 -0
- package/lib/services/postboy-message.store.js.map +1 -1
- 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 +35 -0
- package/lib/services/postboy-namespace.store.d.ts.map +1 -0
- package/lib/services/postboy-namespace.store.js +54 -0
- package/lib/services/postboy-namespace.store.js.map +1 -0
- package/lib/tests/integration/models/test-callback-message.js.map +1 -0
- package/lib/tests/integration/models/test-executor.js.map +1 -0
- package/lib/tests/integration/models/test-handler.js.map +1 -0
- package/lib/tests/integration/models/test-message.js.map +1 -0
- package/lib/tests/integration/models/test-postboy.js.map +1 -0
- package/lib/tests/integration/models/test-registry.js.map +1 -0
- package/lib/utils/id.generator.d.ts +5 -0
- package/lib/utils/id.generator.d.ts.map +1 -0
- package/lib/utils/id.generator.js +18 -0
- package/lib/utils/id.generator.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locker.store.js","sourceRoot":"","sources":["../src/locker.store.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAAxB;QACU,YAAO,GAA+B,EAAE,CAAC;QACzC,cAAS,GAA+B,EAAE,CAAC;QAC3C,WAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAarC,CAAC;IAXC,SAAS,CAAC,MAAqB;QAC7B,IAAI,MAAM,CAAC,MAAM;YAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;QAChE,IAAI,MAAM,CAAC,QAAQ;YAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,OAAe;QACnB,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAC3C,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7F,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAhBD,kCAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-history-item-mock.js","sourceRoot":"","sources":["../../src/mocks/message-history-item-mock.ts"],"names":[],"mappings":";;;AAEA,MAAa,sBAAsB;IAAnC;QACU,SAAI,GAAQ,EAAE,CAAC;IAsBzB,CAAC;IApBC,GAAG,CAAC,OAAU;QACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,GAAG;QACL,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF;AAvBD,wDAuBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-history-mock.js","sourceRoot":"","sources":["../../src/mocks/message-history-mock.ts"],"names":[],"mappings":";;;AACA,2EAAqE;AAErE,MAAa,kBAAkB;IAA/B;QACU,WAAM,GAAG,IAAI,GAAG,EAAuC,CAAC;IAclE,CAAC;IAZC,GAAG,CAAkC,EAAU;;QAC7C,OAAO,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,mCAAI,IAAI,kDAAsB,EAAE,CAAC;IAC7D,CAAC;IAED,GAAG,CAAC,OAA8B;;QAChC,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,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I,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,KAAK,CAAC,CAAC;IAChD,CAAC;IAID,IAAI,CAAkC,QAAW;QAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,CAAI,EAAU;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAkC,IAAoB;QAC9D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAA,iCAAO,EAAC,IAAI,CAAC,CAAC,CAAC;QACvC,OAAO,KAAK,CAAC,SAAS,CAAC,IAAA,iCAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,CAAkC,OAAU;QAC9C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,YAAY,CAAI,OAAkC,EAAE,MAAuB;QACzE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAkC,IAAoB;QAC3D,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAA,iCAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;CACF;AAhDD,gDAgDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postboy.locker.js","sourceRoot":"","sources":["../../src/models/postboy.locker.ts"],"names":[],"mappings":""}
|
|
@@ -7,9 +7,11 @@ import { PostboyExecutionHandler } from './models/postboy-execution.handler';
|
|
|
7
7
|
export type MessageType<T extends PostboyGenericMessage> = new (...args: any[]) => T;
|
|
8
8
|
export declare abstract class PostboyAbstractRegistrator {
|
|
9
9
|
protected postboy: PostboyService;
|
|
10
|
+
get namespace(): string;
|
|
10
11
|
private ids;
|
|
11
12
|
private services;
|
|
12
|
-
|
|
13
|
+
private readonly _namespace;
|
|
14
|
+
constructor(postboy: PostboyService, namespace?: string | null);
|
|
13
15
|
/**
|
|
14
16
|
* Registers a list of services to be used by the application.
|
|
15
17
|
*
|
|
@@ -32,7 +34,7 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
32
34
|
* @param {Subject<T>} sub - The subject associated with the generic message type.
|
|
33
35
|
* @return {this} Returns the current instance for method chaining.
|
|
34
36
|
*/
|
|
35
|
-
record<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>):
|
|
37
|
+
record<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>): PostboyAbstractRegistrator;
|
|
36
38
|
/**
|
|
37
39
|
* Records a message type with a specific subject and applies a transformation pipe to the subject.
|
|
38
40
|
*
|
|
@@ -41,7 +43,7 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
41
43
|
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that takes the subject as input and returns an Observable with transformations applied.
|
|
42
44
|
* @return {this} The current instance of the class for chaining.
|
|
43
45
|
*/
|
|
44
|
-
recordWithPipe<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>):
|
|
46
|
+
recordWithPipe<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): PostboyAbstractRegistrator;
|
|
45
47
|
/**
|
|
46
48
|
* Records an executor associated with a specific type and execution logic.
|
|
47
49
|
*
|
|
@@ -49,7 +51,7 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
49
51
|
* @param exec A callback function that executes the logic using an instance of the specified executor type.
|
|
50
52
|
* @return void
|
|
51
53
|
*/
|
|
52
|
-
recordExecutor<E extends PostboyExecutor<T>, T>(type: new (...args: any[]) => E, exec: (e: E) => T):
|
|
54
|
+
recordExecutor<E extends PostboyExecutor<T>, T>(type: new (...args: any[]) => E, exec: (e: E) => T): PostboyAbstractRegistrator;
|
|
53
55
|
/**
|
|
54
56
|
* Records a handler for a specific executor type.
|
|
55
57
|
*
|
|
@@ -57,7 +59,7 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
57
59
|
* @param handler The execution handler associated with the given executor type.
|
|
58
60
|
* @return void
|
|
59
61
|
*/
|
|
60
|
-
recordHandler<E extends PostboyExecutor<R>, R>(executor: new (...args: any[]) => E, handler: PostboyExecutionHandler<R, E>):
|
|
62
|
+
recordHandler<E extends PostboyExecutor<R>, R>(executor: new (...args: any[]) => E, handler: PostboyExecutionHandler<R, E>): PostboyAbstractRegistrator;
|
|
61
63
|
/**
|
|
62
64
|
* A utility function that facilitates the recording and replaying of messages
|
|
63
65
|
* using a ReplaySubject. This function is designed to handle messages of a
|
|
@@ -71,7 +73,7 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
71
73
|
* Defaults to 1 if not specified.
|
|
72
74
|
* @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.
|
|
73
75
|
*/
|
|
74
|
-
recordReplay
|
|
76
|
+
recordReplay<T extends PostboyGenericMessage>(type: MessageType<T>, bufferSize?: number): PostboyAbstractRegistrator;
|
|
75
77
|
/**
|
|
76
78
|
* Represents a method that records a specific behavior associated with a message type.
|
|
77
79
|
* It creates a `BehaviorSubject` initialized with the provided initial message
|
|
@@ -82,7 +84,7 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
82
84
|
* @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.
|
|
83
85
|
* @returns {void} - This function does not return a value; instead, it modifies the internal state.
|
|
84
86
|
*/
|
|
85
|
-
recordBehavior
|
|
87
|
+
recordBehavior<T extends PostboyGenericMessage>(type: MessageType<T>, initial: T): PostboyAbstractRegistrator;
|
|
86
88
|
/**
|
|
87
89
|
* A function that creates and returns a new generic message recorder for a specific message type.
|
|
88
90
|
*
|
|
@@ -90,6 +92,6 @@ export declare abstract class PostboyAbstractRegistrator {
|
|
|
90
92
|
* @param {MessageType<T>} type - The constructor for the message type being recorded.
|
|
91
93
|
* @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.
|
|
92
94
|
*/
|
|
93
|
-
recordSubject
|
|
95
|
+
recordSubject<T extends PostboyGenericMessage>(type: MessageType<T>): this;
|
|
94
96
|
}
|
|
95
97
|
//# sourceMappingURL=postboy-abstract.registrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-abstract.registrator.d.ts","sourceRoot":"","sources":["../src/postboy-abstract.registrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmB,UAAU,
|
|
1
|
+
{"version":3,"file":"postboy-abstract.registrator.d.ts","sourceRoot":"","sources":["../src/postboy-abstract.registrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAmB,UAAU,EAAuB,OAAO,EAAE,MAAM,MAAM,CAAC;AACjF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAW,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,qBAAqB,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAErF,8BAAsB,0BAA0B;IAS5C,SAAS,CAAC,OAAO,EAAE,cAAc;IARnC,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,OAAO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CAAC,CAAC,SAAS,qBAAqB,EACjD,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,UAAU,SAAI,GACb,0BAA0B;IAK7B;;;;;;;;;OASG;IACI,cAAc,CAAC,CAAC,SAAS,qBAAqB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,0BAA0B;IAKpH;;;;;;OAMG;IACI,aAAa,CAAC,CAAC,SAAS,qBAAqB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;CAI3E"}
|
|
@@ -3,44 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PostboyAbstractRegistrator = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const postboy_generic_message_1 = require("./models/postboy-generic-message");
|
|
6
|
+
const id_generator_1 = require("./utils/id.generator");
|
|
6
7
|
class PostboyAbstractRegistrator {
|
|
7
|
-
|
|
8
|
+
get namespace() {
|
|
9
|
+
return this._namespace;
|
|
10
|
+
}
|
|
11
|
+
constructor(postboy, namespace = null) {
|
|
8
12
|
this.postboy = postboy;
|
|
9
13
|
this.ids = [];
|
|
10
14
|
this.services = [];
|
|
11
|
-
|
|
12
|
-
* A utility function that facilitates the recording and replaying of messages
|
|
13
|
-
* using a ReplaySubject. This function is designed to handle messages of a
|
|
14
|
-
* specific type and allows specifying a buffer size to determine how many
|
|
15
|
-
* of the most recent messages should be replayed.
|
|
16
|
-
*
|
|
17
|
-
* @template T Extends the PostboyGenericMessage type, representing the type of message
|
|
18
|
-
* to be recorded and replayed.
|
|
19
|
-
* @param {MessageType<T>} type The constructor of the message type to be recorded and replayed.
|
|
20
|
-
* @param {number} [bufferSize=1] The number of recent messages to retain in the ReplaySubject's buffer.
|
|
21
|
-
* Defaults to 1 if not specified.
|
|
22
|
-
* @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.
|
|
23
|
-
*/
|
|
24
|
-
this.recordReplay = (type, bufferSize = 1) => this.record(type, new rxjs_1.ReplaySubject(bufferSize));
|
|
25
|
-
/**
|
|
26
|
-
* Represents a method that records a specific behavior associated with a message type.
|
|
27
|
-
* It creates a `BehaviorSubject` initialized with the provided initial message
|
|
28
|
-
* and associates it with the given message type using the `record` method.
|
|
29
|
-
*
|
|
30
|
-
* @template T - A type parameter extending `PostboyGenericMessage` that defines the message structure.
|
|
31
|
-
* @param {MessageType<T>} type - The constructor function of the message type to be recorded.
|
|
32
|
-
* @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.
|
|
33
|
-
* @returns {void} - This function does not return a value; instead, it modifies the internal state.
|
|
34
|
-
*/
|
|
35
|
-
this.recordBehavior = (type, initial) => this.record(type, new rxjs_1.BehaviorSubject(initial));
|
|
36
|
-
/**
|
|
37
|
-
* A function that creates and returns a new generic message recorder for a specific message type.
|
|
38
|
-
*
|
|
39
|
-
* @template T - A type parameter extending from `PostboyGenericMessage`.
|
|
40
|
-
* @param {MessageType<T>} type - The constructor for the message type being recorded.
|
|
41
|
-
* @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.
|
|
42
|
-
*/
|
|
43
|
-
this.recordSubject = (type) => this.record(type, new rxjs_1.Subject());
|
|
15
|
+
this._namespace = namespace !== null && namespace !== void 0 ? namespace : id_generator_1.IdGenerator.get();
|
|
44
16
|
}
|
|
45
17
|
/**
|
|
46
18
|
* Registers a list of services to be used by the application.
|
|
@@ -57,7 +29,8 @@ class PostboyAbstractRegistrator {
|
|
|
57
29
|
* @return {void} Does not return a value.
|
|
58
30
|
*/
|
|
59
31
|
up() {
|
|
60
|
-
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = this._up) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
61
34
|
this.services.forEach((s) => s.up());
|
|
62
35
|
}
|
|
63
36
|
down() {
|
|
@@ -99,6 +72,7 @@ class PostboyAbstractRegistrator {
|
|
|
99
72
|
*/
|
|
100
73
|
recordExecutor(type, exec) {
|
|
101
74
|
this.postboy.recordExecutor(type, exec);
|
|
75
|
+
return this;
|
|
102
76
|
}
|
|
103
77
|
/**
|
|
104
78
|
* Records a handler for a specific executor type.
|
|
@@ -109,6 +83,49 @@ class PostboyAbstractRegistrator {
|
|
|
109
83
|
*/
|
|
110
84
|
recordHandler(executor, handler) {
|
|
111
85
|
this.postboy.recordHandler(executor, handler);
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A utility function that facilitates the recording and replaying of messages
|
|
90
|
+
* using a ReplaySubject. This function is designed to handle messages of a
|
|
91
|
+
* specific type and allows specifying a buffer size to determine how many
|
|
92
|
+
* of the most recent messages should be replayed.
|
|
93
|
+
*
|
|
94
|
+
* @template T Extends the PostboyGenericMessage type, representing the type of message
|
|
95
|
+
* to be recorded and replayed.
|
|
96
|
+
* @param {MessageType<T>} type The constructor of the message type to be recorded and replayed.
|
|
97
|
+
* @param {number} [bufferSize=1] The number of recent messages to retain in the ReplaySubject's buffer.
|
|
98
|
+
* Defaults to 1 if not specified.
|
|
99
|
+
* @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.
|
|
100
|
+
*/
|
|
101
|
+
recordReplay(type, bufferSize = 1) {
|
|
102
|
+
this.record(type, new rxjs_1.ReplaySubject(bufferSize));
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Represents a method that records a specific behavior associated with a message type.
|
|
107
|
+
* It creates a `BehaviorSubject` initialized with the provided initial message
|
|
108
|
+
* and associates it with the given message type using the `record` method.
|
|
109
|
+
*
|
|
110
|
+
* @template T - A type parameter extending `PostboyGenericMessage` that defines the message structure.
|
|
111
|
+
* @param {MessageType<T>} type - The constructor function of the message type to be recorded.
|
|
112
|
+
* @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.
|
|
113
|
+
* @returns {void} - This function does not return a value; instead, it modifies the internal state.
|
|
114
|
+
*/
|
|
115
|
+
recordBehavior(type, initial) {
|
|
116
|
+
this.record(type, new rxjs_1.BehaviorSubject(initial));
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* A function that creates and returns a new generic message recorder for a specific message type.
|
|
121
|
+
*
|
|
122
|
+
* @template T - A type parameter extending from `PostboyGenericMessage`.
|
|
123
|
+
* @param {MessageType<T>} type - The constructor for the message type being recorded.
|
|
124
|
+
* @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.
|
|
125
|
+
*/
|
|
126
|
+
recordSubject(type) {
|
|
127
|
+
this.record(type, new rxjs_1.Subject());
|
|
128
|
+
return this;
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
exports.PostboyAbstractRegistrator = PostboyAbstractRegistrator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-abstract.registrator.js","sourceRoot":"","sources":["../src/postboy-abstract.registrator.ts"],"names":[],"mappings":";;;AACA,+
|
|
1
|
+
{"version":3,"file":"postboy-abstract.registrator.js","sourceRoot":"","sources":["../src/postboy-abstract.registrator.ts"],"names":[],"mappings":";;;AACA,+BAAiF;AAGjF,8EAAkF;AAElF,uDAAmD;AAInD,MAAsB,0BAA0B;IAC9C,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAKD,YACY,OAAuB,EACjC,YAA2B,IAAI;QADrB,YAAO,GAAP,OAAO,CAAgB;QAL3B,QAAG,GAAa,EAAE,CAAC;QACnB,aAAQ,GAA+B,EAAE,CAAC;QAOhD,IAAI,CAAC,UAAU,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,0BAAW,CAAC,GAAG,EAAE,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,QAAoC;QAC1D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,EAAE;;QACP,MAAA,IAAI,CAAC,GAAG,oDAAI,CAAC;QACb,IAAI,CAAC,QAAQ,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EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,YAAY,CACjB,IAAoB,EACpB,UAAU,GAAG,CAAC;QAEd,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,oBAAa,CAAI,UAAU,CAAC,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;OASG;IACI,cAAc,CAAkC,IAAoB,EAAE,OAAU;QACrF,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,sBAAe,CAAI,OAAO,CAAC,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACI,aAAa,CAAkC,IAAoB;QACxE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,cAAO,EAAK,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvJD,gEAuJC"}
|
package/lib/postboy.service.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Observable, Subject } from 'rxjs';
|
|
|
2
2
|
import { PostboyGenericMessage } from './models/postboy-generic-message';
|
|
3
3
|
import { PostboyExecutor } from './models/postboy-executor';
|
|
4
4
|
import { PostboyCallbackMessage } from './models/postboy-callback.message';
|
|
5
|
-
import { MessageType } from './postboy-abstract.registrator';
|
|
5
|
+
import { MessageType, PostboyAbstractRegistrator } from './postboy-abstract.registrator';
|
|
6
6
|
import { PostboyExecutionHandler } from './models/postboy-execution.handler';
|
|
7
7
|
import { PostboyMiddleware } from './models/postboy-middleware';
|
|
8
8
|
import { PostboyDependencyResolver } from './services/postboy-dependency.resolver';
|
|
@@ -10,6 +10,8 @@ export declare class PostboyService {
|
|
|
10
10
|
protected locked: Set<string>;
|
|
11
11
|
private middleware;
|
|
12
12
|
private store;
|
|
13
|
+
private namespaceStore?;
|
|
14
|
+
private dependencyResolver;
|
|
13
15
|
constructor(resolver?: PostboyDependencyResolver);
|
|
14
16
|
/**
|
|
15
17
|
* Locks a specific message type to prevent further modifications or actions.
|
|
@@ -111,5 +113,26 @@ export declare class PostboyService {
|
|
|
111
113
|
* @return void
|
|
112
114
|
*/
|
|
113
115
|
recordHandler<E extends PostboyExecutor<R>, R>(executor: new (...args: any[]) => E, handler: PostboyExecutionHandler<R, E>): void;
|
|
116
|
+
/**
|
|
117
|
+
* Adds a namespace to the namespace store.
|
|
118
|
+
*
|
|
119
|
+
* @param {string} space - The name of the namespace to be added.
|
|
120
|
+
* @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.
|
|
121
|
+
*/
|
|
122
|
+
addNamespace(space: string): PostboyAbstractRegistrator;
|
|
123
|
+
/**
|
|
124
|
+
* Removes the specified namespace from the namespace store.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} space - The name of the namespace to be removed.
|
|
127
|
+
* @return {void} This method does not return a value.
|
|
128
|
+
*/
|
|
129
|
+
eliminateNamespace(space: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* Disposes of resources and cleans up any internal components or stores associated with the instance.
|
|
132
|
+
* This method ensures that all resources are properly released to avoid memory leaks.
|
|
133
|
+
*
|
|
134
|
+
* @return {void} This method does not return a value.
|
|
135
|
+
*/
|
|
136
|
+
dispose(): void;
|
|
114
137
|
}
|
|
115
138
|
//# sourceMappingURL=postboy.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy.service.d.ts","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAW,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version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C,KAAK,EAAE,MAAM,GAAG,0BAA0B;IAK9D;;;;;OAKG;IACI,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI9C;;;;;OAKG;IACI,OAAO,IAAI,IAAI;CAKvB"}
|
package/lib/postboy.service.js
CHANGED
|
@@ -7,9 +7,9 @@ const postboy_dependency_resolver_1 = require("./services/postboy-dependency.res
|
|
|
7
7
|
class PostboyService {
|
|
8
8
|
constructor(resolver) {
|
|
9
9
|
this.locked = new Set();
|
|
10
|
-
|
|
11
|
-
this.middleware =
|
|
12
|
-
this.store =
|
|
10
|
+
this.dependencyResolver = resolver || new postboy_dependency_resolver_1.PostboyDependencyResolver();
|
|
11
|
+
this.middleware = this.dependencyResolver.getMiddlewareService();
|
|
12
|
+
this.store = this.dependencyResolver.getMessageStore();
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Locks a specific message type to prevent further modifications or actions.
|
|
@@ -145,6 +145,39 @@ class PostboyService {
|
|
|
145
145
|
recordHandler(executor, handler) {
|
|
146
146
|
this.store.registerExecutor((0, postboy_generic_message_1.checkId)(executor), (e) => handler.handle(e));
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Adds a namespace to the namespace store.
|
|
150
|
+
*
|
|
151
|
+
* @param {string} space - The name of the namespace to be added.
|
|
152
|
+
* @return {PostboyAbstractRegistrator} The instance of the namespace after adding the specified namespace.
|
|
153
|
+
*/
|
|
154
|
+
addNamespace(space) {
|
|
155
|
+
if (!this.namespaceStore)
|
|
156
|
+
this.namespaceStore = this.dependencyResolver.getNamespaceStore(this);
|
|
157
|
+
return this.namespaceStore.addSpace(space);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Removes the specified namespace from the namespace store.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} space - The name of the namespace to be removed.
|
|
163
|
+
* @return {void} This method does not return a value.
|
|
164
|
+
*/
|
|
165
|
+
eliminateNamespace(space) {
|
|
166
|
+
var _a;
|
|
167
|
+
return (_a = this.namespaceStore) === null || _a === void 0 ? void 0 : _a.eliminateSpace(space);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Disposes of resources and cleans up any internal components or stores associated with the instance.
|
|
171
|
+
* This method ensures that all resources are properly released to avoid memory leaks.
|
|
172
|
+
*
|
|
173
|
+
* @return {void} This method does not return a value.
|
|
174
|
+
*/
|
|
175
|
+
dispose() {
|
|
176
|
+
var _a;
|
|
177
|
+
(_a = this.namespaceStore) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
178
|
+
this.store.dispose();
|
|
179
|
+
this.middleware.dispose();
|
|
180
|
+
}
|
|
148
181
|
}
|
|
149
182
|
exports.PostboyService = PostboyService;
|
|
150
183
|
//# sourceMappingURL=postboy.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy.service.js","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":";;;AACA,8EAAkF;AAClF,wEAAoE;AAMpE,wFAAmF;
|
|
1
|
+
{"version":3,"file":"postboy.service.js","sourceRoot":"","sources":["../src/postboy.service.ts"],"names":[],"mappings":";;;AACA,8EAAkF;AAClF,wEAAoE;AAMpE,wFAAmF;AAKnF,MAAa,cAAc;IAOzB,YAAY,QAAoC;QANtC,WAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QAOnC,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;IACzD,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAkC,IAAoB;QAC/D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAA,iCAAO,EAAC,IAAI,CAAC,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,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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;;;;;OAKG;IACI,YAAY,CAAC,KAAa;QAC/B,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAChG,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;OAKG;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;AAtMD,wCAsMC"}
|
|
@@ -0,0 +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
|
+
}
|
|
14
|
+
//# sourceMappingURL=namespace-registrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-registrator.d.ts","sourceRoot":"","sources":["../../src/services/namespace-registrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,0BAA0B;gBACtD,OAAO,EAAE,cAAc;IAInC,SAAS,CAAC,GAAG,IAAI,IAAI;CAGtB"}
|
|
@@ -0,0 +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;
|
|
21
|
+
//# sourceMappingURL=namespace-registrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-registrator.js","sourceRoot":"","sources":["../../src/services/namespace-registrator.ts"],"names":[],"mappings":";;;AAAA,kFAA6E;AAG7E;;;;;;GAMG;AACH,MAAa,oBAAqB,SAAQ,yDAA0B;IAClE,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAES,GAAG;QACX,SAAS;IACX,CAAC;CACF;AARD,oDAQC"}
|
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
import { PostboyMiddlewareService } from './postboy-middleware.service';
|
|
2
2
|
import { PostboyMessageStore } from './postboy-message.store';
|
|
3
|
+
import { PostboyNamespaceStore } from './postboy-namespace.store';
|
|
4
|
+
import { PostboyService } from '../postboy.service';
|
|
3
5
|
export declare class PostboyDependencyResolver {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves an instance of the PostboyMiddlewareService.
|
|
8
|
+
*
|
|
9
|
+
* This function initializes and returns a new instance of the
|
|
10
|
+
* PostboyMiddlewareService, which can be used to configure and manage
|
|
11
|
+
* middleware for a specific module or application.
|
|
12
|
+
*
|
|
13
|
+
* @returns {PostboyMiddlewareService} A new instance of PostboyMiddlewareService.
|
|
14
|
+
*/
|
|
4
15
|
getMiddlewareService: () => PostboyMiddlewareService;
|
|
16
|
+
/**
|
|
17
|
+
* A function that instantiates and returns a new instance of PostboyMessageStore.
|
|
18
|
+
*
|
|
19
|
+
* This function serves as a factory method for creating instances
|
|
20
|
+
* of the PostboyMessageStore class.
|
|
21
|
+
*
|
|
22
|
+
* @returns {PostboyMessageStore} A new instance of the PostboyMessageStore class.
|
|
23
|
+
*/
|
|
5
24
|
getMessageStore: () => PostboyMessageStore;
|
|
25
|
+
/**
|
|
26
|
+
* Creates and initializes a new instance of PostboyNamespaceStore using the provided PostboyService instance.
|
|
27
|
+
*
|
|
28
|
+
* @function getNamespaceStore
|
|
29
|
+
* @param {PostboyService} postboy - An instance of the PostboyService used to create the namespace store.
|
|
30
|
+
* @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
|
|
31
|
+
*/
|
|
32
|
+
getNamespaceStore: (postboy: PostboyService) => PostboyNamespaceStore;
|
|
6
33
|
}
|
|
7
34
|
//# 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;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,qBAAa,yBAAyB;IACpC;;;;;;;;OAQG;IACH,oBAAoB,iCAAwC;IAC5D;;;;;;;OAOG;IACH,eAAe,4BAAmC;IAClD;;;;;;OAMG;IACH,iBAAiB,GAAI,SAAS,cAAc,2BAAwC;CACrF"}
|
|
@@ -3,10 +3,36 @@ 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
|
+
* @param {PostboyService} postboy - An instance of the PostboyService used to create the namespace store.
|
|
33
|
+
* @returns {PostboyNamespaceStore} A new instance of PostboyNamespaceStore associated with the given PostboyService.
|
|
34
|
+
*/
|
|
35
|
+
this.getNamespaceStore = (postboy) => new postboy_namespace_store_1.PostboyNamespaceStore(postboy);
|
|
10
36
|
}
|
|
11
37
|
}
|
|
12
38
|
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;AAGlE,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;IACtF,CAAC;CAAA;AA5BD,8DA4BC"}
|
|
@@ -15,5 +15,6 @@ export declare class PostboyMessageStore {
|
|
|
15
15
|
getMessage(id: string, name: string): PostboySubscription<any>;
|
|
16
16
|
getExecutor<T>(id: string): (e: PostboyExecutor<T>) => T;
|
|
17
17
|
unregister(id: string): void;
|
|
18
|
+
dispose(): void;
|
|
18
19
|
}
|
|
19
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;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,SAAS,CAAC,QAAQ,wCAA+C;IACjE,SAAS,CAAC,SAAS,kBAAuB,eAAe,CAAC,GAAG,CAAC,KAAK,GAAG,EAAI;IAC1E,SAAS,CAAC,SAAS,qBAA0B,IAAI,KAAO;IAEjD,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"postboy-message.store.d.ts","sourceRoot":"","sources":["../../src/services/postboy-message.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,SAAS,CAAC,QAAQ,wCAA+C;IACjE,SAAS,CAAC,SAAS,kBAAuB,eAAe,CAAC,GAAG,CAAC,KAAK,GAAG,EAAI;IAC1E,SAAS,CAAC,SAAS,qBAA0B,IAAI,KAAO;IAEjD,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAAG,IAAI;IAMhE,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,IAAI;IAMrF,aAAa,CAAC,OAAO,EAAE,sBAAsB,CAAC,GAAG,CAAC,GAAG,IAAI;IAOlD,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC;IAM9D,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAMxD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQ5B,OAAO,IAAI,IAAI;CAOvB"}
|
|
@@ -12,9 +12,15 @@ class PostboyMessageStore {
|
|
|
12
12
|
this.callbacks = new Map();
|
|
13
13
|
}
|
|
14
14
|
registerMessage(id, sub) {
|
|
15
|
+
// tslint:disable-next-line:no-console
|
|
16
|
+
if (this.messages.has(id))
|
|
17
|
+
console.warn(`Message with id ${id} already registered. Overriding...`);
|
|
15
18
|
this.messages.set(id, sub);
|
|
16
19
|
}
|
|
17
20
|
registerExecutor(id, executor) {
|
|
21
|
+
// tslint:disable-next-line:no-console
|
|
22
|
+
if (this.executors.has(id))
|
|
23
|
+
console.warn(`Executor with id ${id} already registered. Overriding...`);
|
|
18
24
|
this.executors.set(id, executor);
|
|
19
25
|
}
|
|
20
26
|
callbackFired(message) {
|
|
@@ -43,6 +49,13 @@ class PostboyMessageStore {
|
|
|
43
49
|
this.callbacks.delete(id);
|
|
44
50
|
this.executors.delete(id);
|
|
45
51
|
}
|
|
52
|
+
dispose() {
|
|
53
|
+
this.messages.forEach((m, id) => this.unregister(id));
|
|
54
|
+
this.callbacks.forEach((fs) => fs.forEach((f) => f()));
|
|
55
|
+
this.messages.clear();
|
|
56
|
+
this.executors.clear();
|
|
57
|
+
this.callbacks.clear();
|
|
58
|
+
}
|
|
46
59
|
}
|
|
47
60
|
exports.PostboyMessageStore = PostboyMessageStore;
|
|
48
61
|
//# sourceMappingURL=postboy-message.store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-message.store.js","sourceRoot":"","sources":["../../src/services/postboy-message.store.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,MAAa,mBAAmB;IAAhC;QACY,aAAQ,GAAG,IAAI,GAAG,EAAoC,CAAC;QACvD,cAAS,GAAG,IAAI,GAAG,EAA4C,CAAC;QAChE,cAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"postboy-message.store.js","sourceRoot":"","sources":["../../src/services/postboy-message.store.ts"],"names":[],"mappings":";;;AAIA;;;GAGG;AACH,MAAa,mBAAmB;IAAhC;QACY,aAAQ,GAAG,IAAI,GAAG,EAAoC,CAAC;QACvD,cAAS,GAAG,IAAI,GAAG,EAA4C,CAAC;QAChE,cAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;IAgD1D,CAAC;IA9CQ,eAAe,CAAC,EAAU,EAAE,GAA6B;QAC9D,sCAAsC;QACtC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,oCAAoC,CAAC,CAAC;QACnG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,gBAAgB,CAAC,EAAU,EAAE,QAA0C;QAC5E,sCAAsC;QACtC,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,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0CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF;AAnDD,kDAmDC"}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { PostboyMiddleware } from '../models/postboy-middleware';
|
|
2
2
|
import { PostboyMessage } from '../models/postboy.message';
|
|
3
|
+
/**
|
|
4
|
+
* A service class that manages middleware functions for processing PostboyMessage objects.
|
|
5
|
+
* It provides methods to add, remove, and execute middlewares in sequence.
|
|
6
|
+
*/
|
|
3
7
|
export declare class PostboyMiddlewareService {
|
|
4
8
|
protected middlewares: PostboyMiddleware[];
|
|
9
|
+
/**
|
|
10
|
+
* Adds a middleware function to the collection of middlewares.
|
|
11
|
+
*
|
|
12
|
+
* @param {PostboyMiddleware} middleware - The middleware function to be added.
|
|
13
|
+
* @return {void}
|
|
14
|
+
*/
|
|
5
15
|
addMiddleware(middleware: PostboyMiddleware): void;
|
|
16
|
+
/**
|
|
17
|
+
* Removes a middleware from the list of registered middlewares.
|
|
18
|
+
*
|
|
19
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be removed.
|
|
20
|
+
* @return {void} No return value.
|
|
21
|
+
*/
|
|
6
22
|
removeMiddleware(middleware: PostboyMiddleware): void;
|
|
23
|
+
/**
|
|
24
|
+
* Manages the processing of a PostboyMessage by sequentially applying all middlewares.
|
|
25
|
+
*
|
|
26
|
+
* @param {PostboyMessage} msg - The message object to be processed by the middlewares.
|
|
27
|
+
* @return {void} - This method does not return any value.
|
|
28
|
+
*/
|
|
7
29
|
manage(msg: PostboyMessage): void;
|
|
30
|
+
/**
|
|
31
|
+
* Disposes of the current object by clearing its middlewares array.
|
|
32
|
+
*
|
|
33
|
+
* @return {void} This method does not return a value.
|
|
34
|
+
*/
|
|
35
|
+
dispose(): void;
|
|
8
36
|
}
|
|
9
37
|
//# sourceMappingURL=postboy-middleware.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-middleware.service.d.ts","sourceRoot":"","sources":["../../src/services/postboy-middleware.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,qBAAa,wBAAwB;IACnC,SAAS,CAAC,WAAW,EAAE,iBAAiB,EAAE,CAAM;
|
|
1
|
+
{"version":3,"file":"postboy-middleware.service.d.ts","sourceRoot":"","sources":["../../src/services/postboy-middleware.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,SAAS,CAAC,WAAW,EAAE,iBAAiB,EAAE,CAAM;IAEhD;;;;;OAKG;IACI,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAIzD;;;;;OAKG;IACI,gBAAgB,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI;IAI5D;;;;;OAKG;IACI,MAAM,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;IAIxC;;;;OAIG;IACI,OAAO,IAAI,IAAI;CAGvB"}
|
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PostboyMiddlewareService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A service class that manages middleware functions for processing PostboyMessage objects.
|
|
6
|
+
* It provides methods to add, remove, and execute middlewares in sequence.
|
|
7
|
+
*/
|
|
4
8
|
class PostboyMiddlewareService {
|
|
5
9
|
constructor() {
|
|
6
10
|
this.middlewares = [];
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Adds a middleware function to the collection of middlewares.
|
|
14
|
+
*
|
|
15
|
+
* @param {PostboyMiddleware} middleware - The middleware function to be added.
|
|
16
|
+
* @return {void}
|
|
17
|
+
*/
|
|
8
18
|
addMiddleware(middleware) {
|
|
9
19
|
this.middlewares.push(middleware);
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Removes a middleware from the list of registered middlewares.
|
|
23
|
+
*
|
|
24
|
+
* @param {PostboyMiddleware} middleware - The middleware instance to be removed.
|
|
25
|
+
* @return {void} No return value.
|
|
26
|
+
*/
|
|
11
27
|
removeMiddleware(middleware) {
|
|
12
28
|
this.middlewares = this.middlewares.filter((m) => m !== middleware);
|
|
13
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Manages the processing of a PostboyMessage by sequentially applying all middlewares.
|
|
32
|
+
*
|
|
33
|
+
* @param {PostboyMessage} msg - The message object to be processed by the middlewares.
|
|
34
|
+
* @return {void} - This method does not return any value.
|
|
35
|
+
*/
|
|
14
36
|
manage(msg) {
|
|
15
37
|
for (const item of this.middlewares)
|
|
16
38
|
item.handle(msg);
|
|
17
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Disposes of the current object by clearing its middlewares array.
|
|
42
|
+
*
|
|
43
|
+
* @return {void} This method does not return a value.
|
|
44
|
+
*/
|
|
45
|
+
dispose() {
|
|
46
|
+
this.middlewares = [];
|
|
47
|
+
}
|
|
18
48
|
}
|
|
19
49
|
exports.PostboyMiddlewareService = PostboyMiddlewareService;
|
|
20
50
|
//# sourceMappingURL=postboy-middleware.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postboy-middleware.service.js","sourceRoot":"","sources":["../../src/services/postboy-middleware.service.ts"],"names":[],"mappings":";;;AAGA,MAAa,wBAAwB;IAArC;QACY,gBAAW,GAAwB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"postboy-middleware.service.js","sourceRoot":"","sources":["../../src/services/postboy-middleware.service.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,MAAa,wBAAwB;IAArC;QACY,gBAAW,GAAwB,EAAE,CAAC;IAwClD,CAAC;IAtCC;;;;;OAKG;IACI,aAAa,CAAC,UAA6B;QAChD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,UAA6B;QACnD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC;IACtE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,GAAmB;QAC/B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,WAAW;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACI,OAAO;QACZ,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;CACF;AAzCD,4DAyCC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PostboyAbstractRegistrator } from '../postboy-abstract.registrator';
|
|
2
|
+
import { PostboyService } from '../postboy.service';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a store for managing namespaces in the Postboy system.
|
|
5
|
+
* Provides functionality to add, eliminate, and dispose namespaces.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PostboyNamespaceStore {
|
|
8
|
+
private postboy;
|
|
9
|
+
private spaces;
|
|
10
|
+
constructor(postboy: PostboyService);
|
|
11
|
+
/**
|
|
12
|
+
* Adds a new namespace to the registry.
|
|
13
|
+
*
|
|
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.
|
|
16
|
+
*/
|
|
17
|
+
addSpace(space: string): PostboyAbstractRegistrator;
|
|
18
|
+
/**
|
|
19
|
+
* Removes a specified space from the spaces collection if it exists.
|
|
20
|
+
* If the space exists, it will be deleted after invoking its down method.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} space - The name of the space to be removed.
|
|
23
|
+
* @return {void} This method does not return a value.
|
|
24
|
+
*/
|
|
25
|
+
eliminateSpace(space: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Disposes of the current instance by performing cleanup operations.
|
|
28
|
+
* Iterates through all spaces, performs a "down" operation on each,
|
|
29
|
+
* and then clears the collection of spaces.
|
|
30
|
+
*
|
|
31
|
+
* @return {void} No return value.
|
|
32
|
+
*/
|
|
33
|
+
dispose(): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=postboy-namespace.store.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostboyNamespaceStore = void 0;
|
|
4
|
+
const namespace_registrator_1 = require("./namespace-registrator");
|
|
5
|
+
/**
|
|
6
|
+
* Represents a store for managing namespaces in the Postboy system.
|
|
7
|
+
* Provides functionality to add, eliminate, and dispose namespaces.
|
|
8
|
+
*/
|
|
9
|
+
class PostboyNamespaceStore {
|
|
10
|
+
constructor(postboy) {
|
|
11
|
+
this.postboy = postboy;
|
|
12
|
+
this.spaces = new Map();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds a new namespace to the registry.
|
|
16
|
+
*
|
|
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.
|
|
19
|
+
*/
|
|
20
|
+
addSpace(space) {
|
|
21
|
+
if (this.spaces.has(space))
|
|
22
|
+
return this.spaces.get(space);
|
|
23
|
+
const registrator = new namespace_registrator_1.NamespaceRegistrator(this.postboy);
|
|
24
|
+
this.spaces.set(space, registrator);
|
|
25
|
+
return registrator;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Removes a specified space from the spaces collection if it exists.
|
|
29
|
+
* If the space exists, it will be deleted after invoking its down method.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} space - The name of the space to be removed.
|
|
32
|
+
* @return {void} This method does not return a value.
|
|
33
|
+
*/
|
|
34
|
+
eliminateSpace(space) {
|
|
35
|
+
var _a;
|
|
36
|
+
if (!this.spaces.has(space))
|
|
37
|
+
return;
|
|
38
|
+
(_a = this.spaces.get(space)) === null || _a === void 0 ? void 0 : _a.down();
|
|
39
|
+
this.spaces.delete(space);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Disposes of the current instance by performing cleanup operations.
|
|
43
|
+
* Iterates through all spaces, performs a "down" operation on each,
|
|
44
|
+
* and then clears the collection of spaces.
|
|
45
|
+
*
|
|
46
|
+
* @return {void} No return value.
|
|
47
|
+
*/
|
|
48
|
+
dispose() {
|
|
49
|
+
this.spaces.forEach((space) => space.down());
|
|
50
|
+
this.spaces.clear();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.PostboyNamespaceStore = PostboyNamespaceStore;
|
|
54
|
+
//# sourceMappingURL=postboy-namespace.store.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-callback-message.js","sourceRoot":"","sources":["../../../../src/tests/integration/models/test-callback-message.ts"],"names":[],"mappings":";;;AAAA,uFAAkF;AAElF,MAAa,mBAAoB,SAAQ,iDAA8B;IAAvE;;QAEE,SAAI,GAAG,mBAAmB,CAAC;IAC7B,CAAC;;AAHD,kDAGC;AAFQ,sBAAE,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-executor.js","sourceRoot":"","sources":["../../../../src/tests/integration/models/test-executor.ts"],"names":[],"mappings":";;;AAAA,qFAAgF;AAEhF,MAAa,YAAa,SAAQ,+CAAqB;IAGrD,YAAmB,KAAa;QAC9B,KAAK,EAAE,CAAC;QADS,UAAK,GAAL,KAAK,CAAQ;IAEhC,CAAC;;AALH,oCAMC;AALiB,eAAE,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-handler.js","sourceRoot":"","sources":["../../../../src/tests/integration/models/test-handler.ts"],"names":[],"mappings":";;;AAAA,yFAAoF;AAGpF,MAAa,WAAY,SAAQ,mDAA6C;IAC5E,YAAmB,QAAgB;QACjC,KAAK,EAAE,CAAC;QADS,aAAQ,GAAR,QAAQ,CAAQ;IAEnC,CAAC;IAED,MAAM,CAAC,QAAsB;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AARD,kCAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-message.js","sourceRoot":"","sources":["../../../../src/tests/integration/models/test-message.ts"],"names":[],"mappings":";;;AAAA,qFAAgF;AAEhF,MAAa,WAAY,SAAQ,+CAAqB;IAAtD;;QAEE,SAAI,GAAG,WAAW,CAAC;IACrB,CAAC;;AAHD,kCAGC;AAFQ,cAAE,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-postboy.js","sourceRoot":"","sources":["../../../../src/tests/integration/models/test-postboy.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAE1D,MAAa,WAAY,SAAQ,gCAAc;CAAG;AAAlD,kCAAkD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-registry.js","sourceRoot":"","sources":["../../../../src/tests/integration/models/test-registry.ts"],"names":[],"mappings":";;;AAAA,wFAAmF;AAGnF,MAAa,OAAQ,SAAQ,yDAA0B;IAGrD,YAAY,OAAoB;QAC9B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHjB,QAAG,GAA0B,EAAE,CAAC;IAIhC,CAAC;IAES,GAAG;QACX,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACrC,CAAC;CACF;AAVD,0BAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.generator.d.ts","sourceRoot":"","sources":["../../src/utils/id.generator.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAoD;WAE/D,GAAG,IAAI,MAAM;CAY5B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdGenerator = void 0;
|
|
4
|
+
class IdGenerator {
|
|
5
|
+
static get() {
|
|
6
|
+
const result = [];
|
|
7
|
+
for (let i = 0; i < 7; i++) {
|
|
8
|
+
result.push(IdGenerator.collection
|
|
9
|
+
.sort(() => 0.5 - Math.random())
|
|
10
|
+
.slice(0, 5)
|
|
11
|
+
.join(''));
|
|
12
|
+
}
|
|
13
|
+
return result.join('-');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.IdGenerator = IdGenerator;
|
|
17
|
+
IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
18
|
+
//# sourceMappingURL=id.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.generator.js","sourceRoot":"","sources":["../../src/utils/id.generator.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAGf,MAAM,CAAC,GAAG;QACf,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CACT,WAAW,CAAC,UAAU;iBACnB,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;iBAC/B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;iBACX,IAAI,CAAC,EAAE,CAAC,CACZ,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;;AAdH,kCAeC;AAdgB,sBAAU,GAAG,sCAAsC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC"}
|