@artstesh/postboy 2.1.10 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +27 -68
  2. package/lib/index.d.ts +2 -3
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +2 -3
  5. package/lib/index.js.map +1 -1
  6. package/lib/locker.store.d.ts +8 -8
  7. package/lib/locker.store.js +26 -26
  8. package/lib/mocks/message-history-item-mock.d.ts +9 -9
  9. package/lib/mocks/message-history-item-mock.js +25 -25
  10. package/lib/mocks/message-history-mock.d.ts +8 -8
  11. package/lib/mocks/message-history-mock.d.ts.map +1 -1
  12. package/lib/mocks/message-history-mock.js +22 -23
  13. package/lib/mocks/message-history-mock.js.map +1 -1
  14. package/lib/mocks/postboy-service-mock.d.ts +21 -21
  15. package/lib/mocks/postboy-service-mock.js +50 -50
  16. package/lib/models/message-queue.model.d.ts +43 -43
  17. package/lib/models/message-queue.model.js +65 -65
  18. package/lib/models/postboy-callback.message.d.ts +18 -0
  19. package/lib/models/postboy-callback.message.d.ts.map +1 -1
  20. package/lib/models/postboy-callback.message.js +18 -0
  21. package/lib/models/postboy-callback.message.js.map +1 -1
  22. package/lib/models/postboy-executor.d.ts +2 -2
  23. package/lib/models/postboy-executor.d.ts.map +1 -1
  24. package/lib/models/postboy-executor.js +2 -2
  25. package/lib/models/postboy-executor.js.map +1 -1
  26. package/lib/models/postboy-generic-message.d.ts +2 -2
  27. package/lib/models/postboy-generic-message.d.ts.map +1 -1
  28. package/lib/models/postboy-generic-message.js +4 -6
  29. package/lib/models/postboy-generic-message.js.map +1 -1
  30. package/lib/models/postboy-middleware.d.ts +5 -0
  31. package/lib/models/postboy-middleware.d.ts.map +1 -0
  32. package/lib/models/{postboy-bbb.js → postboy-middleware.js} +1 -1
  33. package/lib/models/postboy-middleware.js.map +1 -0
  34. package/lib/models/postboy-subscription.d.ts +6 -3
  35. package/lib/models/postboy-subscription.d.ts.map +1 -1
  36. package/lib/models/postboy-subscription.js +11 -2
  37. package/lib/models/postboy-subscription.js.map +1 -1
  38. package/lib/models/postboy.locker.d.ts +5 -5
  39. package/lib/models/postboy.locker.js +2 -2
  40. package/lib/models/postboy.message.d.ts +4 -0
  41. package/lib/models/postboy.message.d.ts.map +1 -0
  42. package/lib/models/postboy.message.js +10 -0
  43. package/lib/models/postboy.message.js.map +1 -0
  44. package/lib/postboy-abstract.registrator.d.ts +0 -24
  45. package/lib/postboy-abstract.registrator.d.ts.map +1 -1
  46. package/lib/postboy-abstract.registrator.js +0 -33
  47. package/lib/postboy-abstract.registrator.js.map +1 -1
  48. package/lib/postboy.service.d.ts +45 -39
  49. package/lib/postboy.service.d.ts.map +1 -1
  50. package/lib/postboy.service.js +63 -76
  51. package/lib/postboy.service.js.map +1 -1
  52. package/lib/services/postboy-dependency.resolver.d.ts +7 -0
  53. package/lib/services/postboy-dependency.resolver.d.ts.map +1 -0
  54. package/lib/services/postboy-dependency.resolver.js +13 -0
  55. package/lib/services/postboy-dependency.resolver.js.map +1 -0
  56. package/lib/services/postboy-message.store.d.ts +16 -0
  57. package/lib/services/postboy-message.store.d.ts.map +1 -0
  58. package/lib/services/postboy-message.store.js +39 -0
  59. package/lib/services/postboy-message.store.js.map +1 -0
  60. package/lib/services/postboy-middleware.service.d.ts +9 -0
  61. package/lib/services/postboy-middleware.service.d.ts.map +1 -0
  62. package/lib/services/postboy-middleware.service.js +20 -0
  63. package/lib/services/postboy-middleware.service.js.map +1 -0
  64. package/lib/tests/integration/models/test-callback-message.d.ts +6 -0
  65. package/lib/tests/integration/models/test-callback-message.d.ts.map +1 -0
  66. package/lib/tests/integration/models/test-callback-message.js +13 -0
  67. package/lib/tests/integration/models/test-callback-message.js.map +1 -0
  68. package/lib/tests/integration/models/test-executor.d.ts +7 -0
  69. package/lib/tests/integration/models/test-executor.d.ts.map +1 -0
  70. package/lib/tests/integration/models/test-executor.js +13 -0
  71. package/lib/tests/integration/models/test-executor.js.map +1 -0
  72. package/lib/tests/integration/models/test-handler.d.ts +8 -0
  73. package/lib/tests/integration/models/test-handler.d.ts.map +1 -0
  74. package/lib/tests/integration/models/test-handler.js +15 -0
  75. package/lib/tests/integration/models/test-handler.js.map +1 -0
  76. package/lib/tests/integration/models/test-message.d.ts +6 -0
  77. package/lib/tests/integration/models/test-message.d.ts.map +1 -0
  78. package/lib/tests/integration/models/test-message.js +13 -0
  79. package/lib/tests/integration/models/test-message.js.map +1 -0
  80. package/lib/tests/integration/models/test-postboy.d.ts +4 -0
  81. package/lib/tests/integration/models/test-postboy.d.ts.map +1 -0
  82. package/lib/tests/integration/models/test-postboy.js +8 -0
  83. package/lib/tests/integration/models/test-postboy.js.map +1 -0
  84. package/lib/tests/integration/models/test-registry.d.ts +8 -0
  85. package/lib/tests/integration/models/test-registry.d.ts.map +1 -0
  86. package/lib/tests/integration/models/test-registry.js +15 -0
  87. package/lib/tests/integration/models/test-registry.js.map +1 -0
  88. package/package.json +2 -4
  89. package/lib/models/dictionary.d.ts +0 -18
  90. package/lib/models/dictionary.d.ts.map +0 -1
  91. package/lib/models/dictionary.js +0 -59
  92. package/lib/models/dictionary.js.map +0 -1
  93. package/lib/models/id-generator.d.ts +0 -4
  94. package/lib/models/id-generator.d.ts.map +0 -1
  95. package/lib/models/id-generator.js +0 -14
  96. package/lib/models/id-generator.js.map +0 -1
  97. package/lib/models/postboy-bbb.d.ts +0 -4
  98. package/lib/models/postboy-bbb.d.ts.map +0 -1
  99. package/lib/models/postboy-bbb.js.map +0 -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,5 +1,23 @@
1
1
  import { Observable, Subject } from 'rxjs';
2
2
  import { PostboyGenericMessage } from './postboy-generic-message';
3
+ /**
4
+ * An abstract class extending PostboyGenericMessage that provides mechanisms for managing
5
+ * asynchronous data communication using RxJS observables. It is designed to work with
6
+ * callback-based operations that emit a result of type T.
7
+ *
8
+ * @template T - The type of the data emitted by the observables in this class.
9
+ *
10
+ * @extends PostboyGenericMessage
11
+ *
12
+ * @property {Observable<T>} result - An observable that emits the result of the operation
13
+ * and completes once the operation is finished.
14
+ *
15
+ * @method next - Emits the next value for the result observable.
16
+ * @param {T} value - The value to be emitted by the result observable.
17
+ *
18
+ * @method finish - Emits the final value for the result observable and completes it.
19
+ * @param {T} value - The final value for the observable emission.
20
+ */
3
21
  export declare abstract class PostboyCallbackMessage<T> extends PostboyGenericMessage {
4
22
  protected result$: Subject<T>;
5
23
  result: Observable<T>;
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-callback.message.d.ts","sourceRoot":"","sources":["../../src/models/postboy-callback.message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,8BAAsB,sBAAsB,CAAC,CAAC,CAAE,SAAQ,qBAAqB;IAC3E,SAAS,CAAC,OAAO,aAAoB;IAC9B,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAA+B;IAEpD,IAAI,UAAW,CAAC,KAAG,IAAI,CAA6B;IAEpD,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;CAI9B"}
1
+ {"version":3,"file":"postboy-callback.message.d.ts","sourceRoot":"","sources":["../../src/models/postboy-callback.message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,8BAAsB,sBAAsB,CAAC,CAAC,CAAE,SAAQ,qBAAqB;IAC3E,SAAS,CAAC,OAAO,aAAoB;IAC9B,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAA+B;IAEpD,IAAI,GAAI,OAAO,CAAC,KAAG,IAAI,CAA6B;IAEpD,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;CAI9B"}
@@ -3,6 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PostboyCallbackMessage = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const postboy_generic_message_1 = require("./postboy-generic-message");
6
+ /**
7
+ * An abstract class extending PostboyGenericMessage that provides mechanisms for managing
8
+ * asynchronous data communication using RxJS observables. It is designed to work with
9
+ * callback-based operations that emit a result of type T.
10
+ *
11
+ * @template T - The type of the data emitted by the observables in this class.
12
+ *
13
+ * @extends PostboyGenericMessage
14
+ *
15
+ * @property {Observable<T>} result - An observable that emits the result of the operation
16
+ * and completes once the operation is finished.
17
+ *
18
+ * @method next - Emits the next value for the result observable.
19
+ * @param {T} value - The value to be emitted by the result observable.
20
+ *
21
+ * @method finish - Emits the final value for the result observable and completes it.
22
+ * @param {T} value - The final value for the observable emission.
23
+ */
6
24
  class PostboyCallbackMessage extends postboy_generic_message_1.PostboyGenericMessage {
7
25
  constructor() {
8
26
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-callback.message.js","sourceRoot":"","sources":["../../src/models/postboy-callback.message.ts"],"names":[],"mappings":";;;AAAA,+BAA2C;AAC3C,uEAAkE;AAElE,MAAsB,sBAA0B,SAAQ,+CAAqB;IAA7E;;QACY,YAAO,GAAG,IAAI,cAAO,EAAK,CAAC;QAC9B,WAAM,GAAkB,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAEpD,SAAI,GAAG,CAAC,KAAQ,EAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAM7D,CAAC;IAJQ,MAAM,CAAC,KAAQ;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACF;AAVD,wDAUC"}
1
+ {"version":3,"file":"postboy-callback.message.js","sourceRoot":"","sources":["../../src/models/postboy-callback.message.ts"],"names":[],"mappings":";;;AAAA,+BAA2C;AAC3C,uEAAkE;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAsB,sBAA0B,SAAQ,+CAAqB;IAA7E;;QACY,YAAO,GAAG,IAAI,cAAO,EAAK,CAAC;QAC9B,WAAM,GAAkB,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAEpD,SAAI,GAAG,CAAC,KAAQ,EAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAM7D,CAAC;IAJQ,MAAM,CAAC,KAAQ;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACF;AAVD,wDAUC"}
@@ -1,4 +1,4 @@
1
- import { PostboyGenericMessage } from './postboy-generic-message';
2
- export declare abstract class PostboyExecutor<T> extends PostboyGenericMessage {
1
+ import { PostboyMessage } from './postboy.message';
2
+ export declare abstract class PostboyExecutor<T> extends PostboyMessage {
3
3
  }
4
4
  //# sourceMappingURL=postboy-executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-executor.d.ts","sourceRoot":"","sources":["../../src/models/postboy-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,8BAAsB,eAAe,CAAC,CAAC,CAAE,SAAQ,qBAAqB;CAAG"}
1
+ {"version":3,"file":"postboy-executor.d.ts","sourceRoot":"","sources":["../../src/models/postboy-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,8BAAsB,eAAe,CAAC,CAAC,CAAE,SAAQ,cAAc;CAAG"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PostboyExecutor = void 0;
4
- const postboy_generic_message_1 = require("./postboy-generic-message");
5
- class PostboyExecutor extends postboy_generic_message_1.PostboyGenericMessage {
4
+ const postboy_message_1 = require("./postboy.message");
5
+ class PostboyExecutor extends postboy_message_1.PostboyMessage {
6
6
  }
7
7
  exports.PostboyExecutor = PostboyExecutor;
8
8
  //# sourceMappingURL=postboy-executor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-executor.js","sourceRoot":"","sources":["../../src/models/postboy-executor.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAElE,MAAsB,eAAmB,SAAQ,+CAAqB;CAAG;AAAzE,0CAAyE"}
1
+ {"version":3,"file":"postboy-executor.js","sourceRoot":"","sources":["../../src/models/postboy-executor.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAEnD,MAAsB,eAAmB,SAAQ,gCAAc;CAAG;AAAlE,0CAAkE"}
@@ -1,8 +1,8 @@
1
+ import { PostboyMessage } from './postboy.message';
1
2
  /**
2
3
  * An inheritor should have a static ID field
3
4
  */
4
- export declare abstract class PostboyGenericMessage {
5
- get id(): string;
5
+ export declare abstract class PostboyGenericMessage extends PostboyMessage {
6
6
  }
7
7
  export declare function checkId(message: new (...args: any[]) => any): string;
8
8
  //# sourceMappingURL=postboy-generic-message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-generic-message.d.ts","sourceRoot":"","sources":["../../src/models/postboy-generic-message.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,8BAAsB,qBAAqB;IACzC,IAAW,EAAE,IAAI,MAAM,CAEtB;CACF;AACD,wBAAgB,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,MAAM,CAGpE"}
1
+ {"version":3,"file":"postboy-generic-message.d.ts","sourceRoot":"","sources":["../../src/models/postboy-generic-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,8BAAsB,qBAAsB,SAAQ,cAAc;CAAG;AACrE,wBAAgB,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,MAAM,CAGpE"}
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkId = exports.PostboyGenericMessage = void 0;
3
+ exports.PostboyGenericMessage = void 0;
4
+ exports.checkId = checkId;
5
+ const postboy_message_1 = require("./postboy.message");
4
6
  /**
5
7
  * An inheritor should have a static ID field
6
8
  */
7
- class PostboyGenericMessage {
8
- get id() {
9
- return this.constructor.ID;
10
- }
9
+ class PostboyGenericMessage extends postboy_message_1.PostboyMessage {
11
10
  }
12
11
  exports.PostboyGenericMessage = PostboyGenericMessage;
13
12
  function checkId(message) {
@@ -15,5 +14,4 @@ function checkId(message) {
15
14
  throw new Error(`${message.name} should have a static ID field`);
16
15
  return message.ID;
17
16
  }
18
- exports.checkId = checkId;
19
17
  //# sourceMappingURL=postboy-generic-message.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-generic-message.js","sourceRoot":"","sources":["../../src/models/postboy-generic-message.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAsB,qBAAqB;IACzC,IAAW,EAAE;QACX,OAAQ,IAAI,CAAC,WAAmB,CAAC,EAAE,CAAC;IACtC,CAAC;CACF;AAJD,sDAIC;AACD,SAAgB,OAAO,CAAC,OAAoC;IAC1D,IAAI,CAAE,OAAe,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC3F,OAAQ,OAAe,CAAC,EAAE,CAAC;AAC7B,CAAC;AAHD,0BAGC"}
1
+ {"version":3,"file":"postboy-generic-message.js","sourceRoot":"","sources":["../../src/models/postboy-generic-message.ts"],"names":[],"mappings":";;;AAMA,0BAGC;AATD,uDAAmD;AAEnD;;GAEG;AACH,MAAsB,qBAAsB,SAAQ,gCAAc;CAAG;AAArE,sDAAqE;AACrE,SAAgB,OAAO,CAAC,OAAoC;IAC1D,IAAI,CAAE,OAAe,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,gCAAgC,CAAC,CAAC;IAC3F,OAAQ,OAAe,CAAC,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { PostboyMessage } from './postboy.message';
2
+ export interface PostboyMiddleware {
3
+ handle(message: PostboyMessage): void;
4
+ }
5
+ //# sourceMappingURL=postboy-middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postboy-middleware.d.ts","sourceRoot":"","sources":["../../src/models/postboy-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=postboy-bbb.js.map
3
+ //# sourceMappingURL=postboy-middleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postboy-middleware.js","sourceRoot":"","sources":["../../src/models/postboy-middleware.ts"],"names":[],"mappings":""}
@@ -1,7 +1,10 @@
1
1
  import { Observable, Subject } from 'rxjs';
2
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>);
3
+ private subscription;
4
+ private pipe;
5
+ constructor(subscription: Subject<T>, pipe: (s: Subject<T>) => Observable<T>);
6
+ sub(): Observable<T>;
7
+ fire(data: T): void;
8
+ finish(): void;
6
9
  }
7
10
  //# sourceMappingURL=postboy-subscription.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-subscription.d.ts","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3C,qBAAa,mBAAmB,CAAC,CAAC;IAEvB,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;IACf,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;gBADtC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,EACf,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;CAEhD"}
1
+ {"version":3,"file":"postboy-subscription.d.ts","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE3C,qBAAa,mBAAmB,CAAC,CAAC;IAE9B,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,IAAI;gBADJ,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,EACxB,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;IAGzC,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC;IAIpB,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAInB,MAAM,IAAI,IAAI;CAGtB"}
@@ -2,10 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PostboySubscription = void 0;
4
4
  class PostboySubscription {
5
- constructor(sub, pipe) {
6
- this.sub = sub;
5
+ constructor(subscription, pipe) {
6
+ this.subscription = subscription;
7
7
  this.pipe = pipe;
8
8
  }
9
+ sub() {
10
+ return this.pipe(this.subscription);
11
+ }
12
+ fire(data) {
13
+ this.subscription.next(data);
14
+ }
15
+ finish() {
16
+ this.subscription.complete();
17
+ }
9
18
  }
10
19
  exports.PostboySubscription = PostboySubscription;
11
20
  //# sourceMappingURL=postboy-subscription.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-subscription.js","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IAC9B,YACS,GAAe,EACf,IAAsC;QADtC,QAAG,GAAH,GAAG,CAAY;QACf,SAAI,GAAJ,IAAI,CAAkC;IAC5C,CAAC;CACL;AALD,kDAKC"}
1
+ {"version":3,"file":"postboy-subscription.js","sourceRoot":"","sources":["../../src/models/postboy-subscription.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IAC9B,YACU,YAAwB,EACxB,IAAsC;QADtC,iBAAY,GAAZ,YAAY,CAAY;QACxB,SAAI,GAAJ,IAAI,CAAkC;IAC7C,CAAC;IAEG,GAAG;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAEM,IAAI,CAAC,IAAO;QACjB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM;QACX,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;CACF;AAjBD,kDAiBC"}
@@ -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
@@ -0,0 +1,4 @@
1
+ export declare abstract class PostboyMessage {
2
+ get id(): string;
3
+ }
4
+ //# sourceMappingURL=postboy.message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postboy.message.d.ts","sourceRoot":"","sources":["../../src/models/postboy.message.ts"],"names":[],"mappings":"AAAA,8BAAsB,cAAc;IAClC,IAAW,EAAE,IAAI,MAAM,CAEtB;CACF"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PostboyMessage = void 0;
4
+ class PostboyMessage {
5
+ get id() {
6
+ return this.constructor.ID;
7
+ }
8
+ }
9
+ exports.PostboyMessage = PostboyMessage;
10
+ //# sourceMappingURL=postboy.message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postboy.message.js","sourceRoot":"","sources":["../../src/models/postboy.message.ts"],"names":[],"mappings":";;;AAAA,MAAsB,cAAc;IAClC,IAAW,EAAE;QACX,OAAQ,IAAI,CAAC,WAAmB,CAAC,EAAE,CAAC;IACtC,CAAC;CACF;AAJD,wCAIC"}
@@ -19,30 +19,6 @@ export declare abstract class PostboyAbstractRegistrator {
19
19
  registerServices(services: IPostboyDependingService[]): void;
20
20
  up(): void;
21
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
22
  down(): void;
47
23
  /**
48
24
  * Records a type and its corresponding Subject<T> into the Postboy system and updates the internal identifiers.
@@ -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,EAAiB,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3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E,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI;IAIhH;;;;;;OAMG;IACI,aAAa,CAAC,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,EAClD,QAAQ,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EACnC,OAAO,EAAE,uBAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,GACrC,IAAI;IAIP;;;;;;;;;;;;OAYG;IACI,YAAY,GAAI,CAAC,SAAS,qBAAqB,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAAE,mBAAc,UACtC;IAEtD;;;;;;;;;OASG;IACI,cAAc,GAAI,CAAC,SAAS,qBAAqB,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,UACrC;IAErD;;;;;;OAMG;IACI,aAAa,GAAI,CAAC,SAAS,qBAAqB,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,UAAyC;CACvH"}
@@ -8,18 +8,6 @@ class PostboyAbstractRegistrator {
8
8
  this.postboy = postboy;
9
9
  this.ids = [];
10
10
  this.services = [];
11
- /**
12
- * @deprecated The method should be replaced with recordReplay<T>
13
- */
14
- this.registerReplay = (id, bufferSize = 1) => this.register(id, new rxjs_1.ReplaySubject(bufferSize));
15
- /**
16
- * @deprecated The method should be replaced with recordBehavior<T>
17
- */
18
- this.registerBehavior = (id, initial) => this.register(id, new rxjs_1.BehaviorSubject(initial));
19
- /**
20
- * @deprecated The method should be replaced with recordSubject<T>
21
- */
22
- this.registerSubject = (id) => this.register(id, new rxjs_1.Subject());
23
11
  /**
24
12
  * A utility function that facilitates the recording and replaying of messages
25
13
  * using a ReplaySubject. This function is designed to handle messages of a
@@ -67,31 +55,10 @@ class PostboyAbstractRegistrator {
67
55
  this._up();
68
56
  this.services.forEach((s) => s.up());
69
57
  }
70
- /**
71
- * @deprecated The method should be replaced with recordExecutor<T>
72
- */
73
- registerExecutor(id, exec) {
74
- this.postboy.registerExecutor(id, exec);
75
- }
76
- /**
77
- * @deprecated The method should be replaced with record<T>
78
- */
79
- register(id, sub) {
80
- this.ids.push(id);
81
- this.postboy.register(id, sub);
82
- }
83
- /**
84
- * @deprecated The method should be replaced with recordWithPipe<T>
85
- */
86
- registerWithPipe(id, sub, pipe) {
87
- this.ids.push(id);
88
- this.postboy.registerWithPipe(id, sub, pipe);
89
- }
90
58
  down() {
91
59
  this.services = [];
92
60
  this.ids.forEach((id) => this.postboy.unregister(id));
93
61
  }
94
- // future
95
62
  /**
96
63
  * Records a type and its corresponding Subject<T> into the Postboy system and updates the internal identifiers.
97
64
  *
@@ -1 +1 @@
1
- {"version":3,"file":"postboy-abstract.registrator.js","sourceRoot":"","sources":["../src/postboy-abstract.registrator.ts"],"names":[],"mappings":";;;AACA,+BAA2E;AAG3E,8EAAkF;AAKlF,MAAsB,0BAA0B;IAI9C,YAAsB,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;QAHrC,QAAG,GAAa,EAAE,CAAC;QACnB,aAAQ,GAA+B,EAAE,CAAC;QA4ClD;;WAEG;QACI,mBAAc,GAAG,CAAI,EAAU,EAAE,UAAU,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,oBAAa,CAAI,UAAU,CAAC,CAAC,CAAC;QAE/G;;WAEG;QACI,qBAAgB,GAAG,CAAI,EAAU,EAAE,OAAU,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,sBAAe,CAAI,OAAO,CAAC,CAAC,CAAC;QAE5G;;WAEG;QACI,oBAAe,GAAG,CAAI,EAAU,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,cAAO,EAAK,CAAC,CAAC;QAiEhF;;;;;;;;;;;;WAYG;QACI,iBAAY,GAAG,CA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AC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACI,cAAc,CACnB,IAAoB,EACpB,GAAe,EACf,IAAsC;QAEtC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,iCAAO,EAAC,IAAI,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACI,cAAc,CAAkC,IAA+B,EAAE,IAAiB;QACvG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACI,aAAa,CAClB,QAAmC,EACnC,OAAsC;QAEtC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CAuCF;AAzHD,gEAyHC"}
@@ -1,45 +1,51 @@
1
1
  import { Observable, Subject } from 'rxjs';
2
2
  import { PostboyGenericMessage } from './models/postboy-generic-message';
3
- import { LockerStore } from './locker.store';
4
- import { PostboyLocker } from './models/postboy.locker';
5
- import { PostboySubscription } from './models/postboy-subscription';
6
3
  import { PostboyExecutor } from './models/postboy-executor';
7
4
  import { PostboyCallbackMessage } from './models/postboy-callback.message';
8
- import { Dictionary } from '@artstesh/collections';
9
5
  import { MessageType } from './postboy-abstract.registrator';
10
6
  import { PostboyExecutionHandler } from './models/postboy-execution.handler';
7
+ import { PostboyMiddleware } from './models/postboy-middleware';
8
+ import { PostboyDependencyResolver } from './services/postboy-dependency.resolver';
11
9
  export declare class PostboyService {
12
- protected applications: Dictionary<PostboySubscription<any>>;
13
- protected locker: LockerStore;
14
- protected executors: Dictionary<(e: PostboyExecutor<any>) => any>;
10
+ protected locked: Set<string>;
11
+ private middleware;
12
+ private store;
13
+ constructor(resolver?: PostboyDependencyResolver);
15
14
  /**
16
- * Adds a locker to the current list of lockers.
15
+ * Locks a specific message type to prevent further modifications or actions.
17
16
  *
18
- * @param {PostboyLocker} locker - The locker object to be added.
17
+ * @param {MessageType<T>} type - The message type to be locked. It must extend from the `PostboyGenericMessage`.
19
18
  * @return {void} This method does not return a value.
20
19
  */
21
- addLocker(locker: PostboyLocker): void;
20
+ lock<T extends PostboyGenericMessage>(type: MessageType<T>): void;
22
21
  /**
23
- * @deprecated The method should be replaced with recordExecutor<T>
22
+ * Unlocks a previously locked message type by removing its ID from the locked set.
23
+ *
24
+ * @param {MessageType<T>} type - The message type to unlock, which is a generic type extending PostboyGenericMessage.
25
+ * @return {void} This method does not return any value.
24
26
  */
25
- registerExecutor<E extends PostboyExecutor<T>, T>(id: string, exec: (e: E) => T): void;
27
+ unlock<T extends PostboyGenericMessage>(type: MessageType<T>): void;
26
28
  /**
27
- * @deprecated The method should be replaced with exec<T>
29
+ * Adds a middleware to the middleware stack.
30
+ *
31
+ * @param {PostboyMiddleware} middleware - The middleware instance to be added.
32
+ * @return {void}
28
33
  */
29
- execute<E extends PostboyExecutor<T>, T>(executor: E): T;
34
+ addMiddleware(middleware: PostboyMiddleware): void;
30
35
  /**
31
- * @deprecated The method should be replaced with record<T>
36
+ * Removes a middleware from the current middleware stack.
37
+ *
38
+ * @param {PostboyMiddleware} middleware - The middleware instance to be removed.
39
+ * @return {void} No return value.
32
40
  */
33
- register<T>(id: string, sub: Subject<T>): void;
41
+ removeMiddleware(middleware: PostboyMiddleware): void;
34
42
  /**
35
- * @deprecated The method should be replaced with recordWithPipe<T>
43
+ * Unregisters a message identified by the given ID from the store.
44
+ *
45
+ * @param {string} id - The unique identifier of the item to unregister.
46
+ * @return {void} No value is returned.
36
47
  */
37
- registerWithPipe<T>(id: string, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): void;
38
48
  unregister(id: string): void;
39
- /**
40
- * @deprecated The method should be replaced with sub<T>
41
- */
42
- subscribe<T>(id: string): Observable<T>;
43
49
  /**
44
50
  * Fires a registered event and passes the message to its subscribers.
45
51
  *
@@ -57,6 +63,14 @@ export declare class PostboyService {
57
63
  * @return {void} This method does not return any value.
58
64
  */
59
65
  fireCallback<T>(message: PostboyCallbackMessage<T>, action?: (e: T) => void): Observable<T>;
66
+ /**
67
+ * Executes the provided executor function and returns its result.
68
+ *
69
+ * @param {PostboyExecutor<T>} executor The executor to be executed, which includes its identifier and logic.
70
+ * @return {T} The resulting output from the executed executor function.
71
+ * @throws {Error} If the specified executor is not registered.
72
+ */
73
+ exec<T>(executor: PostboyExecutor<T>): T;
60
74
  /**
61
75
  * Subscribes to a specific message type and returns an observable of that type.
62
76
  *
@@ -82,27 +96,19 @@ export declare class PostboyService {
82
96
  */
83
97
  recordWithPipe<T extends PostboyGenericMessage>(type: MessageType<T>, sub: Subject<T>, pipe: (s: Subject<T>) => Observable<T>): void;
84
98
  /**
85
- * Records an executor instance and its corresponding execution function.
86
- *
87
- * @param {new (...args: any[]) => E} type - The constructor type of the executor.
88
- * @param {(e: E) => T} exec - The function to execute with the provided executor instance.
89
- * @return {void} No return value.
90
- */
91
- recordExecutor<E extends PostboyExecutor<T>, T>(type: new (...args: any[]) => E, exec: (e: E) => T): void;
92
- /**
93
- * Executes the provided executor function and returns its result.
99
+ * Registers an executor for a specified message type.
94
100
  *
95
- * @param {PostboyExecutor<T>} executor The executor to be executed, which includes its identifier and logic.
96
- * @return {T} The resulting output from the executed executor function.
97
- * @throws {Error} If the specified executor is not registered.
101
+ * @param {MessageType<E>} type - The message type for which the executor is being registered.
102
+ * @param {(e: E) => T} exec - The executor function that will handle messages of the specified type.
103
+ * @return {void} This method does not return any value.
98
104
  */
99
- exec<T>(executor: PostboyExecutor<T>): T;
105
+ recordExecutor<E extends PostboyExecutor<T>, T>(type: MessageType<E>, exec: (e: E) => T): void;
100
106
  /**
101
- * Manages the recording of an executor and its corresponding handler into internal storage.
107
+ * Registers a handler for a specific executor type.
102
108
  *
103
- * @param {new (...args: any[]) => E} executor - The constructor for a class extending PostboyExecutor, used to register the executor type.
104
- * @param {PostboyExecutionHandler<R, E>} handler - The handler responsible for processing the specific executor.
105
- * @return {void} No return value.
109
+ * @param executor The constructor of the executor class that extends `PostboyExecutor<R>`.
110
+ * @param handler An instance of `PostboyExecutionHandler<R, E>` that defines the logic for handling the executor.
111
+ * @return void
106
112
  */
107
113
  recordHandler<E extends PostboyExecutor<R>, R>(executor: new (...args: any[]) => E, handler: PostboyExecutionHandler<R, E>): void;
108
114
  }