@artstesh/postboy 2.1.7 → 2.1.10
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/i-postboy-depending.service.d.ts +3 -3
- package/lib/i-postboy-depending.service.js +2 -2
- package/lib/index.d.ts +10 -10
- package/lib/index.js +29 -29
- package/lib/locker.store.d.ts +8 -8
- package/lib/locker.store.js +26 -26
- package/lib/mocks/message-history-item-mock.d.ts +9 -9
- package/lib/mocks/message-history-item-mock.js +25 -25
- package/lib/mocks/message-history-mock.d.ts +8 -8
- package/lib/mocks/message-history-mock.js +23 -23
- package/lib/mocks/postboy-service-mock.d.ts +21 -21
- package/lib/mocks/postboy-service-mock.d.ts.map +1 -1
- package/lib/mocks/postboy-service-mock.js +50 -50
- package/lib/models/message-queue.model.d.ts +43 -43
- package/lib/models/message-queue.model.js +65 -65
- package/lib/models/postboy-callback.message.d.ts +8 -8
- package/lib/models/postboy-callback.message.js +18 -18
- package/lib/models/postboy-execution.handler.d.ts +14 -14
- package/lib/models/postboy-execution.handler.js +16 -16
- package/lib/models/postboy-executor.d.ts +3 -3
- package/lib/models/postboy-executor.js +7 -7
- package/lib/models/postboy-generic-message.d.ts +7 -7
- package/lib/models/postboy-generic-message.js +18 -18
- package/lib/models/postboy-subscription.d.ts +6 -6
- package/lib/models/postboy-subscription.js +10 -10
- package/lib/models/postboy.locker.d.ts +5 -5
- package/lib/models/postboy.locker.js +2 -2
- package/lib/postboy-abstract.registrator.d.ts +113 -113
- package/lib/postboy-abstract.registrator.d.ts.map +1 -1
- package/lib/postboy-abstract.registrator.js +141 -141
- package/lib/postboy.service.d.ts +108 -105
- package/lib/postboy.service.d.ts.map +1 -1
- package/lib/postboy.service.js +161 -160
- package/lib/postboy.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageQueue = void 0;
|
|
4
|
-
const collections_1 = require("@artstesh/collections");
|
|
5
|
-
class MessageQueue {
|
|
6
|
-
/**
|
|
7
|
-
* Gets the current data stored in the instance.
|
|
8
|
-
*
|
|
9
|
-
* @return {D | null} The current data or null if no data is set.
|
|
10
|
-
*/
|
|
11
|
-
get data() {
|
|
12
|
-
return this._data;
|
|
13
|
-
}
|
|
14
|
-
constructor(cache = true) {
|
|
15
|
-
this.cache = cache;
|
|
16
|
-
this.queries = new collections_1.Queue();
|
|
17
|
-
this._requestInProgress = true;
|
|
18
|
-
this._data = null;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Resets the state of the instance by clearing stored data.
|
|
22
|
-
* This method sets the internal data to null, effectively resetting the object.
|
|
23
|
-
*
|
|
24
|
-
* @return {void} Does not return a value.
|
|
25
|
-
*/
|
|
26
|
-
reset() {
|
|
27
|
-
this._data = null;
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Attempts to finalize the provided query. It either queues the query for later processing
|
|
32
|
-
* if a request is in progress or data is missing, or completes the query immediately.
|
|
33
|
-
*
|
|
34
|
-
* @param {PostboyCallbackMessage<D>} query - The callback message to be finalized.
|
|
35
|
-
* @return {boolean} - Returns true if the query was successfully finalized, otherwise false.
|
|
36
|
-
*/
|
|
37
|
-
tryFinish(query) {
|
|
38
|
-
if (this._requestInProgress || this._data === null)
|
|
39
|
-
return this.queries.put(query) && false;
|
|
40
|
-
query.finish(this._data);
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Adds a new query to the query queue.
|
|
45
|
-
*
|
|
46
|
-
* @param {PostboyCallbackMessage<D>} query - The query to be added to the queue.
|
|
47
|
-
* @return {MessageQueue<D>} The updated QueryQueue instance.
|
|
48
|
-
*/
|
|
49
|
-
add(query) {
|
|
50
|
-
return this.queries.put(query) && this;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Marks the operation as finished by updating the internal state and handling each query.
|
|
54
|
-
*
|
|
55
|
-
* @param {D} data - The data to be set for the current operation.
|
|
56
|
-
* @return {void} This method does not return a value.
|
|
57
|
-
*/
|
|
58
|
-
finish(data) {
|
|
59
|
-
if (this.cache)
|
|
60
|
-
this._data = data;
|
|
61
|
-
this._requestInProgress = false;
|
|
62
|
-
this.queries.each((q) => q.finish(data));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.MessageQueue = MessageQueue;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageQueue = void 0;
|
|
4
|
+
const collections_1 = require("@artstesh/collections");
|
|
5
|
+
class MessageQueue {
|
|
6
|
+
/**
|
|
7
|
+
* Gets the current data stored in the instance.
|
|
8
|
+
*
|
|
9
|
+
* @return {D | null} The current data or null if no data is set.
|
|
10
|
+
*/
|
|
11
|
+
get data() {
|
|
12
|
+
return this._data;
|
|
13
|
+
}
|
|
14
|
+
constructor(cache = true) {
|
|
15
|
+
this.cache = cache;
|
|
16
|
+
this.queries = new collections_1.Queue();
|
|
17
|
+
this._requestInProgress = true;
|
|
18
|
+
this._data = null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resets the state of the instance by clearing stored data.
|
|
22
|
+
* This method sets the internal data to null, effectively resetting the object.
|
|
23
|
+
*
|
|
24
|
+
* @return {void} Does not return a value.
|
|
25
|
+
*/
|
|
26
|
+
reset() {
|
|
27
|
+
this._data = null;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Attempts to finalize the provided query. It either queues the query for later processing
|
|
32
|
+
* if a request is in progress or data is missing, or completes the query immediately.
|
|
33
|
+
*
|
|
34
|
+
* @param {PostboyCallbackMessage<D>} query - The callback message to be finalized.
|
|
35
|
+
* @return {boolean} - Returns true if the query was successfully finalized, otherwise false.
|
|
36
|
+
*/
|
|
37
|
+
tryFinish(query) {
|
|
38
|
+
if (this._requestInProgress || this._data === null)
|
|
39
|
+
return this.queries.put(query) && false;
|
|
40
|
+
query.finish(this._data);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Adds a new query to the query queue.
|
|
45
|
+
*
|
|
46
|
+
* @param {PostboyCallbackMessage<D>} query - The query to be added to the queue.
|
|
47
|
+
* @return {MessageQueue<D>} The updated QueryQueue instance.
|
|
48
|
+
*/
|
|
49
|
+
add(query) {
|
|
50
|
+
return this.queries.put(query) && this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Marks the operation as finished by updating the internal state and handling each query.
|
|
54
|
+
*
|
|
55
|
+
* @param {D} data - The data to be set for the current operation.
|
|
56
|
+
* @return {void} This method does not return a value.
|
|
57
|
+
*/
|
|
58
|
+
finish(data) {
|
|
59
|
+
if (this.cache)
|
|
60
|
+
this._data = data;
|
|
61
|
+
this._requestInProgress = false;
|
|
62
|
+
this.queries.each((q) => q.finish(data));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.MessageQueue = MessageQueue;
|
|
66
66
|
//# sourceMappingURL=message-queue.model.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Observable, Subject } from 'rxjs';
|
|
2
|
-
import { PostboyGenericMessage } from './postboy-generic-message';
|
|
3
|
-
export declare abstract class PostboyCallbackMessage<T> extends PostboyGenericMessage {
|
|
4
|
-
protected result$: Subject<T>;
|
|
5
|
-
result: Observable<T>;
|
|
6
|
-
next: (value: T) => void;
|
|
7
|
-
finish(value: T): void;
|
|
8
|
-
}
|
|
1
|
+
import { Observable, Subject } from 'rxjs';
|
|
2
|
+
import { PostboyGenericMessage } from './postboy-generic-message';
|
|
3
|
+
export declare abstract class PostboyCallbackMessage<T> extends PostboyGenericMessage {
|
|
4
|
+
protected result$: Subject<T>;
|
|
5
|
+
result: Observable<T>;
|
|
6
|
+
next: (value: T) => void;
|
|
7
|
+
finish(value: T): void;
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=postboy-callback.message.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostboyCallbackMessage = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const postboy_generic_message_1 = require("./postboy-generic-message");
|
|
6
|
-
class PostboyCallbackMessage extends postboy_generic_message_1.PostboyGenericMessage {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.result$ = new rxjs_1.Subject();
|
|
10
|
-
this.result = this.result$.asObservable();
|
|
11
|
-
this.next = (value) => this.result$.next(value);
|
|
12
|
-
}
|
|
13
|
-
finish(value) {
|
|
14
|
-
this.result$.next(value);
|
|
15
|
-
this.result$.complete();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.PostboyCallbackMessage = PostboyCallbackMessage;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostboyCallbackMessage = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const postboy_generic_message_1 = require("./postboy-generic-message");
|
|
6
|
+
class PostboyCallbackMessage extends postboy_generic_message_1.PostboyGenericMessage {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.result$ = new rxjs_1.Subject();
|
|
10
|
+
this.result = this.result$.asObservable();
|
|
11
|
+
this.next = (value) => this.result$.next(value);
|
|
12
|
+
}
|
|
13
|
+
finish(value) {
|
|
14
|
+
this.result$.next(value);
|
|
15
|
+
this.result$.complete();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.PostboyCallbackMessage = PostboyCallbackMessage;
|
|
19
19
|
//# sourceMappingURL=postboy-callback.message.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { PostboyExecutor } from './postboy-executor';
|
|
2
|
-
/**
|
|
3
|
-
* Abstract class representing a handler for executing a Postboy task.
|
|
4
|
-
*
|
|
5
|
-
* This class is intended to manage the execution flow of a PostboyExecutor instance.
|
|
6
|
-
* Subclasses must implement the `handle` method, which executes a given PostboyExecutor
|
|
7
|
-
* and returns a result of type R.
|
|
8
|
-
*
|
|
9
|
-
* @template R The type of the result returned by the `handle` method.
|
|
10
|
-
* @template E The type of the executor extending the PostboyExecutor.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class PostboyExecutionHandler<R, E extends PostboyExecutor<R>> {
|
|
13
|
-
abstract handle(executor: E): R;
|
|
14
|
-
}
|
|
1
|
+
import { PostboyExecutor } from './postboy-executor';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract class representing a handler for executing a Postboy task.
|
|
4
|
+
*
|
|
5
|
+
* This class is intended to manage the execution flow of a PostboyExecutor instance.
|
|
6
|
+
* Subclasses must implement the `handle` method, which executes a given PostboyExecutor
|
|
7
|
+
* and returns a result of type R.
|
|
8
|
+
*
|
|
9
|
+
* @template R The type of the result returned by the `handle` method.
|
|
10
|
+
* @template E The type of the executor extending the PostboyExecutor.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class PostboyExecutionHandler<R, E extends PostboyExecutor<R>> {
|
|
13
|
+
abstract handle(executor: E): R;
|
|
14
|
+
}
|
|
15
15
|
//# sourceMappingURL=postboy-execution.handler.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostboyExecutionHandler = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Abstract class representing a handler for executing a Postboy task.
|
|
6
|
-
*
|
|
7
|
-
* This class is intended to manage the execution flow of a PostboyExecutor instance.
|
|
8
|
-
* Subclasses must implement the `handle` method, which executes a given PostboyExecutor
|
|
9
|
-
* and returns a result of type R.
|
|
10
|
-
*
|
|
11
|
-
* @template R The type of the result returned by the `handle` method.
|
|
12
|
-
* @template E The type of the executor extending the PostboyExecutor.
|
|
13
|
-
*/
|
|
14
|
-
class PostboyExecutionHandler {
|
|
15
|
-
}
|
|
16
|
-
exports.PostboyExecutionHandler = PostboyExecutionHandler;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostboyExecutionHandler = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Abstract class representing a handler for executing a Postboy task.
|
|
6
|
+
*
|
|
7
|
+
* This class is intended to manage the execution flow of a PostboyExecutor instance.
|
|
8
|
+
* Subclasses must implement the `handle` method, which executes a given PostboyExecutor
|
|
9
|
+
* and returns a result of type R.
|
|
10
|
+
*
|
|
11
|
+
* @template R The type of the result returned by the `handle` method.
|
|
12
|
+
* @template E The type of the executor extending the PostboyExecutor.
|
|
13
|
+
*/
|
|
14
|
+
class PostboyExecutionHandler {
|
|
15
|
+
}
|
|
16
|
+
exports.PostboyExecutionHandler = PostboyExecutionHandler;
|
|
17
17
|
//# sourceMappingURL=postboy-execution.handler.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PostboyGenericMessage } from './postboy-generic-message';
|
|
2
|
-
export declare abstract class PostboyExecutor<T> extends PostboyGenericMessage {
|
|
3
|
-
}
|
|
1
|
+
import { PostboyGenericMessage } from './postboy-generic-message';
|
|
2
|
+
export declare abstract class PostboyExecutor<T> extends PostboyGenericMessage {
|
|
3
|
+
}
|
|
4
4
|
//# sourceMappingURL=postboy-executor.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostboyExecutor = void 0;
|
|
4
|
-
const postboy_generic_message_1 = require("./postboy-generic-message");
|
|
5
|
-
class PostboyExecutor extends postboy_generic_message_1.PostboyGenericMessage {
|
|
6
|
-
}
|
|
7
|
-
exports.PostboyExecutor = PostboyExecutor;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostboyExecutor = void 0;
|
|
4
|
+
const postboy_generic_message_1 = require("./postboy-generic-message");
|
|
5
|
+
class PostboyExecutor extends postboy_generic_message_1.PostboyGenericMessage {
|
|
6
|
+
}
|
|
7
|
+
exports.PostboyExecutor = PostboyExecutor;
|
|
8
8
|
//# sourceMappingURL=postboy-executor.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An inheritor should have a static ID field
|
|
3
|
-
*/
|
|
4
|
-
export declare abstract class PostboyGenericMessage {
|
|
5
|
-
get id(): string;
|
|
6
|
-
}
|
|
7
|
-
export declare function checkId(message: new (...args: any[]) => any): string;
|
|
1
|
+
/**
|
|
2
|
+
* An inheritor should have a static ID field
|
|
3
|
+
*/
|
|
4
|
+
export declare abstract class PostboyGenericMessage {
|
|
5
|
+
get id(): string;
|
|
6
|
+
}
|
|
7
|
+
export declare function checkId(message: new (...args: any[]) => any): string;
|
|
8
8
|
//# sourceMappingURL=postboy-generic-message.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkId = exports.PostboyGenericMessage = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* An inheritor should have a static ID field
|
|
6
|
-
*/
|
|
7
|
-
class PostboyGenericMessage {
|
|
8
|
-
get id() {
|
|
9
|
-
return this.constructor.ID;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.PostboyGenericMessage = PostboyGenericMessage;
|
|
13
|
-
function checkId(message) {
|
|
14
|
-
if (!message.ID)
|
|
15
|
-
throw new Error(`${message.name} should have a static ID field`);
|
|
16
|
-
return message.ID;
|
|
17
|
-
}
|
|
18
|
-
exports.checkId = checkId;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkId = exports.PostboyGenericMessage = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* An inheritor should have a static ID field
|
|
6
|
+
*/
|
|
7
|
+
class PostboyGenericMessage {
|
|
8
|
+
get id() {
|
|
9
|
+
return this.constructor.ID;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.PostboyGenericMessage = PostboyGenericMessage;
|
|
13
|
+
function checkId(message) {
|
|
14
|
+
if (!message.ID)
|
|
15
|
+
throw new Error(`${message.name} should have a static ID field`);
|
|
16
|
+
return message.ID;
|
|
17
|
+
}
|
|
18
|
+
exports.checkId = checkId;
|
|
19
19
|
//# sourceMappingURL=postboy-generic-message.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Observable, Subject } from 'rxjs';
|
|
2
|
-
export declare class PostboySubscription<T> {
|
|
3
|
-
sub: Subject<T>;
|
|
4
|
-
pipe: (s: Subject<T>) => Observable<T>;
|
|
5
|
-
constructor(sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>);
|
|
6
|
-
}
|
|
1
|
+
import { Observable, Subject } from 'rxjs';
|
|
2
|
+
export declare class PostboySubscription<T> {
|
|
3
|
+
sub: Subject<T>;
|
|
4
|
+
pipe: (s: Subject<T>) => Observable<T>;
|
|
5
|
+
constructor(sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>);
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=postboy-subscription.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PostboySubscription = void 0;
|
|
4
|
-
class PostboySubscription {
|
|
5
|
-
constructor(sub, pipe) {
|
|
6
|
-
this.sub = sub;
|
|
7
|
-
this.pipe = pipe;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.PostboySubscription = PostboySubscription;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostboySubscription = void 0;
|
|
4
|
+
class PostboySubscription {
|
|
5
|
+
constructor(sub, pipe) {
|
|
6
|
+
this.sub = sub;
|
|
7
|
+
this.pipe = pipe;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.PostboySubscription = PostboySubscription;
|
|
11
11
|
//# sourceMappingURL=postboy-subscription.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface PostboyLocker {
|
|
2
|
-
locker?: string;
|
|
3
|
-
unlocker?: string;
|
|
4
|
-
locking: string[];
|
|
5
|
-
}
|
|
1
|
+
export interface PostboyLocker {
|
|
2
|
+
locker?: string;
|
|
3
|
+
unlocker?: string;
|
|
4
|
+
locking: string[];
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=postboy.locker.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=postboy.locker.js.map
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { PostboyService } from './postboy.service';
|
|
2
|
-
import { Observable, Subject } from 'rxjs';
|
|
3
|
-
import { IPostboyDependingService } from './i-postboy-depending.service';
|
|
4
|
-
import { PostboyExecutor } from './models/postboy-executor';
|
|
5
|
-
import { PostboyGenericMessage } from './models/postboy-generic-message';
|
|
6
|
-
import { PostboyExecutionHandler } from './models/postboy-execution.handler';
|
|
7
|
-
export type MessageType<T extends PostboyGenericMessage> = new (...args: any[]) => T;
|
|
8
|
-
export declare abstract class PostboyAbstractRegistrator {
|
|
9
|
-
protected postboy: PostboyService;
|
|
10
|
-
private ids;
|
|
11
|
-
private services;
|
|
12
|
-
constructor(postboy: PostboyService);
|
|
13
|
-
/**
|
|
14
|
-
* Registers a list of services to be used by the application.
|
|
15
|
-
*
|
|
16
|
-
* @param {IPostboyDependingService[]} services - An array of services to register.
|
|
17
|
-
* @return {void} This method does not return a value.
|
|
18
|
-
*/
|
|
19
|
-
registerServices(services: IPostboyDependingService[]): void;
|
|
20
|
-
up(): void;
|
|
21
|
-
protected abstract _up(): void;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated The method should be replaced with recordExecutor<T>
|
|
24
|
-
*/
|
|
25
|
-
registerExecutor<E extends PostboyExecutor<T>, T>(id: string, exec: (e: E) => T): void;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated The method should be replaced with record<T>
|
|
28
|
-
*/
|
|
29
|
-
register<T>(id: string, sub: Subject<T>): void;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated The method should be replaced with recordWithPipe<T>
|
|
32
|
-
*/
|
|
33
|
-
registerWithPipe<T>(id: string, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): void;
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated The method should be replaced with recordReplay<T>
|
|
36
|
-
*/
|
|
37
|
-
registerReplay: <T>(id: string, bufferSize?: number) => void;
|
|
38
|
-
/**
|
|
39
|
-
* @deprecated The method should be replaced with recordBehavior<T>
|
|
40
|
-
*/
|
|
41
|
-
registerBehavior: <T>(id: string, initial: T) => void;
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated The method should be replaced with recordSubject<T>
|
|
44
|
-
*/
|
|
45
|
-
registerSubject: <T>(id: string) => void;
|
|
46
|
-
down(): void;
|
|
47
|
-
/**
|
|
48
|
-
* Records a type and its corresponding Subject<T> into the Postboy system and updates the internal identifiers.
|
|
49
|
-
*
|
|
50
|
-
* @param {MessageType<T>} type - A constructor for the generic message type T.
|
|
51
|
-
* @param {Subject<T>} sub - The subject associated with the generic message type.
|
|
52
|
-
* @return {this} Returns the current instance for method chaining.
|
|
53
|
-
*/
|
|
54
|
-
record<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>): this;
|
|
55
|
-
/**
|
|
56
|
-
* Records a message type with a specific subject and applies a transformation pipe to the subject.
|
|
57
|
-
*
|
|
58
|
-
* @param {MessageType<T>} type - The constructor of the message type to record, which extends PostboyGenericMessage.
|
|
59
|
-
* @param {Subject<T>} sub - The Subject instance to associate with the message type.
|
|
60
|
-
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that takes the subject as input and returns an Observable with transformations applied.
|
|
61
|
-
* @return {this} The current instance of the class for chaining.
|
|
62
|
-
*/
|
|
63
|
-
recordWithPipe<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): this;
|
|
64
|
-
/**
|
|
65
|
-
* Records an executor associated with a specific type and execution logic.
|
|
66
|
-
*
|
|
67
|
-
* @param type The class constructor of the executor type to be recorded, which extends PostboyExecutor.
|
|
68
|
-
* @param exec A callback function that executes the logic using an instance of the specified executor type.
|
|
69
|
-
* @return void
|
|
70
|
-
*/
|
|
71
|
-
recordExecutor<E extends PostboyExecutor<T>, T>(type: new (...args: any[]) => E, exec: (e: E) => T): void;
|
|
72
|
-
/**
|
|
73
|
-
* Records a handler for a specific executor type.
|
|
74
|
-
*
|
|
75
|
-
* @param executor The constructor of the executor type, which extends `PostboyExecutor`.
|
|
76
|
-
* @param handler The execution handler associated with the given executor type.
|
|
77
|
-
* @return void
|
|
78
|
-
*/
|
|
79
|
-
recordHandler<E extends PostboyExecutor<R>, R>(executor: new (...args: any[]) => E, handler: PostboyExecutionHandler<R, E>): void;
|
|
80
|
-
/**
|
|
81
|
-
* A utility function that facilitates the recording and replaying of messages
|
|
82
|
-
* using a ReplaySubject. This function is designed to handle messages of a
|
|
83
|
-
* specific type and allows specifying a buffer size to determine how many
|
|
84
|
-
* of the most recent messages should be replayed.
|
|
85
|
-
*
|
|
86
|
-
* @template T Extends the PostboyGenericMessage type, representing the type of message
|
|
87
|
-
* to be recorded and replayed.
|
|
88
|
-
* @param {MessageType<T>} type The constructor of the message type to be recorded and replayed.
|
|
89
|
-
* @param {number} [bufferSize=1] The number of recent messages to retain in the ReplaySubject's buffer.
|
|
90
|
-
* Defaults to 1 if not specified.
|
|
91
|
-
* @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.
|
|
92
|
-
*/
|
|
93
|
-
recordReplay: <T extends PostboyGenericMessage>(type: MessageType<T>, bufferSize?: number) => this;
|
|
94
|
-
/**
|
|
95
|
-
* Represents a method that records a specific behavior associated with a message type.
|
|
96
|
-
* It creates a `BehaviorSubject` initialized with the provided initial message
|
|
97
|
-
* and associates it with the given message type using the `record` method.
|
|
98
|
-
*
|
|
99
|
-
* @template T - A type parameter extending `PostboyGenericMessage` that defines the message structure.
|
|
100
|
-
* @param {MessageType<T>} type - The constructor function of the message type to be recorded.
|
|
101
|
-
* @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.
|
|
102
|
-
* @returns {void} - This function does not return a value; instead, it modifies the internal state.
|
|
103
|
-
*/
|
|
104
|
-
recordBehavior: <T extends PostboyGenericMessage>(type: MessageType<T>, initial: T) => this;
|
|
105
|
-
/**
|
|
106
|
-
* A function that creates and returns a new generic message recorder for a specific message type.
|
|
107
|
-
*
|
|
108
|
-
* @template T - A type parameter extending from `PostboyGenericMessage`.
|
|
109
|
-
* @param {MessageType<T>} type - The constructor for the message type being recorded.
|
|
110
|
-
* @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.
|
|
111
|
-
*/
|
|
112
|
-
recordSubject: <T extends PostboyGenericMessage>(type: MessageType<T>) => this;
|
|
113
|
-
}
|
|
1
|
+
import { PostboyService } from './postboy.service';
|
|
2
|
+
import { Observable, Subject } from 'rxjs';
|
|
3
|
+
import { IPostboyDependingService } from './i-postboy-depending.service';
|
|
4
|
+
import { PostboyExecutor } from './models/postboy-executor';
|
|
5
|
+
import { PostboyGenericMessage } from './models/postboy-generic-message';
|
|
6
|
+
import { PostboyExecutionHandler } from './models/postboy-execution.handler';
|
|
7
|
+
export type MessageType<T extends PostboyGenericMessage> = new (...args: any[]) => T;
|
|
8
|
+
export declare abstract class PostboyAbstractRegistrator {
|
|
9
|
+
protected postboy: PostboyService;
|
|
10
|
+
private ids;
|
|
11
|
+
private services;
|
|
12
|
+
constructor(postboy: PostboyService);
|
|
13
|
+
/**
|
|
14
|
+
* Registers a list of services to be used by the application.
|
|
15
|
+
*
|
|
16
|
+
* @param {IPostboyDependingService[]} services - An array of services to register.
|
|
17
|
+
* @return {void} This method does not return a value.
|
|
18
|
+
*/
|
|
19
|
+
registerServices(services: IPostboyDependingService[]): void;
|
|
20
|
+
up(): void;
|
|
21
|
+
protected abstract _up(): void;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated The method should be replaced with recordExecutor<T>
|
|
24
|
+
*/
|
|
25
|
+
registerExecutor<E extends PostboyExecutor<T>, T>(id: string, exec: (e: E) => T): void;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated The method should be replaced with record<T>
|
|
28
|
+
*/
|
|
29
|
+
register<T>(id: string, sub: Subject<T>): void;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated The method should be replaced with recordWithPipe<T>
|
|
32
|
+
*/
|
|
33
|
+
registerWithPipe<T>(id: string, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): void;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated The method should be replaced with recordReplay<T>
|
|
36
|
+
*/
|
|
37
|
+
registerReplay: <T>(id: string, bufferSize?: number) => void;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated The method should be replaced with recordBehavior<T>
|
|
40
|
+
*/
|
|
41
|
+
registerBehavior: <T>(id: string, initial: T) => void;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated The method should be replaced with recordSubject<T>
|
|
44
|
+
*/
|
|
45
|
+
registerSubject: <T>(id: string) => void;
|
|
46
|
+
down(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Records a type and its corresponding Subject<T> into the Postboy system and updates the internal identifiers.
|
|
49
|
+
*
|
|
50
|
+
* @param {MessageType<T>} type - A constructor for the generic message type T.
|
|
51
|
+
* @param {Subject<T>} sub - The subject associated with the generic message type.
|
|
52
|
+
* @return {this} Returns the current instance for method chaining.
|
|
53
|
+
*/
|
|
54
|
+
record<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>): this;
|
|
55
|
+
/**
|
|
56
|
+
* Records a message type with a specific subject and applies a transformation pipe to the subject.
|
|
57
|
+
*
|
|
58
|
+
* @param {MessageType<T>} type - The constructor of the message type to record, which extends PostboyGenericMessage.
|
|
59
|
+
* @param {Subject<T>} sub - The Subject instance to associate with the message type.
|
|
60
|
+
* @param {(s: Subject<T>) => Observable<T>} pipe - A function that takes the subject as input and returns an Observable with transformations applied.
|
|
61
|
+
* @return {this} The current instance of the class for chaining.
|
|
62
|
+
*/
|
|
63
|
+
recordWithPipe<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): this;
|
|
64
|
+
/**
|
|
65
|
+
* Records an executor associated with a specific type and execution logic.
|
|
66
|
+
*
|
|
67
|
+
* @param type The class constructor of the executor type to be recorded, which extends PostboyExecutor.
|
|
68
|
+
* @param exec A callback function that executes the logic using an instance of the specified executor type.
|
|
69
|
+
* @return void
|
|
70
|
+
*/
|
|
71
|
+
recordExecutor<E extends PostboyExecutor<T>, T>(type: new (...args: any[]) => E, exec: (e: E) => T): void;
|
|
72
|
+
/**
|
|
73
|
+
* Records a handler for a specific executor type.
|
|
74
|
+
*
|
|
75
|
+
* @param executor The constructor of the executor type, which extends `PostboyExecutor`.
|
|
76
|
+
* @param handler The execution handler associated with the given executor type.
|
|
77
|
+
* @return void
|
|
78
|
+
*/
|
|
79
|
+
recordHandler<E extends PostboyExecutor<R>, R>(executor: new (...args: any[]) => E, handler: PostboyExecutionHandler<R, E>): void;
|
|
80
|
+
/**
|
|
81
|
+
* A utility function that facilitates the recording and replaying of messages
|
|
82
|
+
* using a ReplaySubject. This function is designed to handle messages of a
|
|
83
|
+
* specific type and allows specifying a buffer size to determine how many
|
|
84
|
+
* of the most recent messages should be replayed.
|
|
85
|
+
*
|
|
86
|
+
* @template T Extends the PostboyGenericMessage type, representing the type of message
|
|
87
|
+
* to be recorded and replayed.
|
|
88
|
+
* @param {MessageType<T>} type The constructor of the message type to be recorded and replayed.
|
|
89
|
+
* @param {number} [bufferSize=1] The number of recent messages to retain in the ReplaySubject's buffer.
|
|
90
|
+
* Defaults to 1 if not specified.
|
|
91
|
+
* @returns The result of invoking the `record` method with the given message type and configured ReplaySubject.
|
|
92
|
+
*/
|
|
93
|
+
recordReplay: <T extends PostboyGenericMessage>(type: MessageType<T>, bufferSize?: number) => this;
|
|
94
|
+
/**
|
|
95
|
+
* Represents a method that records a specific behavior associated with a message type.
|
|
96
|
+
* It creates a `BehaviorSubject` initialized with the provided initial message
|
|
97
|
+
* and associates it with the given message type using the `record` method.
|
|
98
|
+
*
|
|
99
|
+
* @template T - A type parameter extending `PostboyGenericMessage` that defines the message structure.
|
|
100
|
+
* @param {MessageType<T>} type - The constructor function of the message type to be recorded.
|
|
101
|
+
* @param {T} initial - The initial value of the message that will be set in the `BehaviorSubject`.
|
|
102
|
+
* @returns {void} - This function does not return a value; instead, it modifies the internal state.
|
|
103
|
+
*/
|
|
104
|
+
recordBehavior: <T extends PostboyGenericMessage>(type: MessageType<T>, initial: T) => this;
|
|
105
|
+
/**
|
|
106
|
+
* A function that creates and returns a new generic message recorder for a specific message type.
|
|
107
|
+
*
|
|
108
|
+
* @template T - A type parameter extending from `PostboyGenericMessage`.
|
|
109
|
+
* @param {MessageType<T>} type - The constructor for the message type being recorded.
|
|
110
|
+
* @returns {Subject<T>} A new instance of `Subject<T>` bound to the specified message type.
|
|
111
|
+
*/
|
|
112
|
+
recordSubject: <T extends PostboyGenericMessage>(type: MessageType<T>) => this;
|
|
113
|
+
}
|
|
114
114
|
//# 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":[],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