@signageos/lib 23.9.1 → 23.9.2

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 (184) hide show
  1. package/README.md +2 -2
  2. package/dist/AMQP/CQRS/ICommand.d.ts +3 -36
  3. package/dist/AMQP/CQRS/ICommand.js +18 -0
  4. package/dist/AMQP/CQRS/ICommand.js.map +1 -1
  5. package/dist/AMQP/CQRS/ICommandError.d.ts +4 -4
  6. package/dist/AMQP/CQRS/commandQueue.d.ts +4 -59
  7. package/dist/AMQP/CQRS/commandQueue.js +16 -308
  8. package/dist/AMQP/CQRS/commandQueue.js.map +1 -1
  9. package/dist/AMQP/CQRS/commandResponseHelper.d.ts +4 -3
  10. package/dist/AMQP/CQRS/commandResponseHelper.js +18 -5
  11. package/dist/AMQP/CQRS/commandResponseHelper.js.map +1 -1
  12. package/dist/AMQP/CQRS/storedCommandQueue.d.ts +4 -27
  13. package/dist/AMQP/CQRS/storedCommandQueue.js +16 -296
  14. package/dist/AMQP/CQRS/storedCommandQueue.js.map +1 -1
  15. package/dist/AMQP/ChannelProvider.d.ts +5 -37
  16. package/dist/AMQP/ChannelProvider.js +9 -868
  17. package/dist/AMQP/ChannelProvider.js.map +1 -1
  18. package/dist/AMQP/DeviceActions/Bridge/deviceActionBridgeFactory.d.ts +4 -39
  19. package/dist/AMQP/DeviceActions/Bridge/deviceActionBridgeFactory.js +16 -287
  20. package/dist/AMQP/DeviceActions/Bridge/deviceActionBridgeFactory.js.map +1 -1
  21. package/dist/AMQP/DeviceActions/IDeviceAction.d.ts +4 -4
  22. package/dist/AMQP/DeviceActions/deviceActionsQueue.d.ts +2 -81
  23. package/dist/AMQP/DeviceActions/deviceActionsQueue.js +14 -531
  24. package/dist/AMQP/DeviceActions/deviceActionsQueue.js.map +1 -1
  25. package/dist/AMQP/EventSourcing/EventConsumer/AmqpEventConsumer.d.ts +2 -45
  26. package/dist/AMQP/EventSourcing/EventConsumer/AmqpEventConsumer.js +14 -211
  27. package/dist/AMQP/EventSourcing/EventConsumer/AmqpEventConsumer.js.map +1 -1
  28. package/dist/AMQP/EventSourcing/EventConsumer/IEventConsumer.d.ts +2 -11
  29. package/dist/AMQP/EventSourcing/EventConsumer/IEventConsumer.js +18 -0
  30. package/dist/AMQP/EventSourcing/EventConsumer/IEventConsumer.js.map +1 -1
  31. package/dist/AMQP/EventSourcing/EventConsumer/InMemoryEventConsumer.d.ts +2 -13
  32. package/dist/AMQP/EventSourcing/EventConsumer/InMemoryEventConsumer.js +14 -69
  33. package/dist/AMQP/EventSourcing/EventConsumer/InMemoryEventConsumer.js.map +1 -1
  34. package/dist/AMQP/EventSourcing/IEvent.d.ts +3 -70
  35. package/dist/AMQP/EventSourcing/IEvent.js +18 -0
  36. package/dist/AMQP/EventSourcing/IEvent.js.map +1 -1
  37. package/dist/AMQP/EventSourcing/Locked/deferredState.d.ts +2 -19
  38. package/dist/AMQP/EventSourcing/Locked/deferredState.js +15 -66
  39. package/dist/AMQP/EventSourcing/Locked/deferredState.js.map +1 -1
  40. package/dist/AMQP/EventSourcing/Locked/lockedEventConsumer.d.ts +2 -68
  41. package/dist/AMQP/EventSourcing/Locked/lockedEventConsumer.js +14 -429
  42. package/dist/AMQP/EventSourcing/Locked/lockedEventConsumer.js.map +1 -1
  43. package/dist/AMQP/EventSourcing/Locked/rejectedTimestamps.d.ts +2 -22
  44. package/dist/AMQP/EventSourcing/Locked/rejectedTimestamps.js +16 -59
  45. package/dist/AMQP/EventSourcing/Locked/rejectedTimestamps.js.map +1 -1
  46. package/dist/AMQP/EventSourcing/Locked/withLock.d.ts +2 -40
  47. package/dist/AMQP/EventSourcing/Locked/withLock.js +14 -134
  48. package/dist/AMQP/EventSourcing/Locked/withLock.js.map +1 -1
  49. package/dist/AMQP/EventSourcing/eventQueue.d.ts +2 -85
  50. package/dist/AMQP/EventSourcing/eventQueue.js +14 -132
  51. package/dist/AMQP/EventSourcing/eventQueue.js.map +1 -1
  52. package/dist/AMQP/EventSourcing/eventQueue.utils.d.ts +2 -71
  53. package/dist/AMQP/EventSourcing/eventQueue.utils.js +16 -152
  54. package/dist/AMQP/EventSourcing/eventQueue.utils.js.map +1 -1
  55. package/dist/AMQP/EventSourcing/eventQueueDetached.d.ts +2 -47
  56. package/dist/AMQP/EventSourcing/eventQueueDetached.js +14 -421
  57. package/dist/AMQP/EventSourcing/eventQueueDetached.js.map +1 -1
  58. package/dist/AMQP/EventSourcing/eventQueueDomain.d.ts +2 -53
  59. package/dist/AMQP/EventSourcing/eventQueueDomain.js +14 -611
  60. package/dist/AMQP/EventSourcing/eventQueueDomain.js.map +1 -1
  61. package/dist/AMQP/EventSourcing/eventQueuePublish.d.ts +2 -17
  62. package/dist/AMQP/EventSourcing/eventQueuePublish.js +14 -202
  63. package/dist/AMQP/EventSourcing/eventQueuePublish.js.map +1 -1
  64. package/dist/AMQP/EventSourcing/synchronization.d.ts +2 -37
  65. package/dist/AMQP/EventSourcing/synchronization.js +18 -9
  66. package/dist/AMQP/EventSourcing/synchronization.js.map +1 -1
  67. package/dist/AMQP/Exchange.d.ts +4 -1
  68. package/dist/AMQP/Exchange.js +18 -0
  69. package/dist/AMQP/Exchange.js.map +1 -1
  70. package/dist/AMQP/IAsyncGotMessage.d.ts +2 -13
  71. package/dist/AMQP/IAsyncGotMessage.js +18 -0
  72. package/dist/AMQP/IAsyncGotMessage.js.map +1 -1
  73. package/dist/AMQP/IChannel.d.ts +5 -43
  74. package/dist/AMQP/IChannel.js +18 -0
  75. package/dist/AMQP/IChannel.js.map +1 -1
  76. package/dist/AMQP/IConsumeOptions.d.ts +5 -106
  77. package/dist/AMQP/IConsumeOptions.js +18 -0
  78. package/dist/AMQP/IConsumeOptions.js.map +1 -1
  79. package/dist/AMQP/IMessageOptions.d.ts +5 -6
  80. package/dist/AMQP/IMessageOptions.js +18 -0
  81. package/dist/AMQP/IMessageOptions.js.map +1 -1
  82. package/dist/AMQP/INackOptions.d.ts +5 -4
  83. package/dist/AMQP/INackOptions.js +18 -0
  84. package/dist/AMQP/INackOptions.js.map +1 -1
  85. package/dist/AMQP/IQueueOptions.d.ts +5 -8
  86. package/dist/AMQP/IQueueOptions.js +18 -0
  87. package/dist/AMQP/IQueueOptions.js.map +1 -1
  88. package/dist/AMQP/Logging/IDeviceLog.d.ts +4 -15
  89. package/dist/AMQP/Logging/IDeviceLog.js +18 -7
  90. package/dist/AMQP/Logging/IDeviceLog.js.map +1 -1
  91. package/dist/AMQP/Logging/logDeviceQueue.d.ts +4 -12
  92. package/dist/AMQP/Logging/logDeviceQueue.js +16 -102
  93. package/dist/AMQP/Logging/logDeviceQueue.js.map +1 -1
  94. package/dist/AMQP/QueueFetcher.d.ts +3 -11
  95. package/dist/AMQP/QueueFetcher.js +17 -156
  96. package/dist/AMQP/QueueFetcher.js.map +1 -1
  97. package/dist/AMQP/QueuePublisher.d.ts +5 -7
  98. package/dist/AMQP/QueuePublisher.js +19 -127
  99. package/dist/AMQP/QueuePublisher.js.map +1 -1
  100. package/dist/AMQP/QueueRepeatableSubscription.d.ts +5 -14
  101. package/dist/AMQP/QueueRepeatableSubscription.js +19 -154
  102. package/dist/AMQP/QueueRepeatableSubscription.js.map +1 -1
  103. package/dist/AMQP/QueueSubscriber.d.ts +5 -27
  104. package/dist/AMQP/QueueSubscriber.js +9 -303
  105. package/dist/AMQP/QueueSubscriber.js.map +1 -1
  106. package/dist/AMQP/ResponseProvider.d.ts +4 -20
  107. package/dist/AMQP/ResponseProvider.js +16 -188
  108. package/dist/AMQP/ResponseProvider.js.map +1 -1
  109. package/dist/AMQP/Static/filesQueue.d.ts +4 -12
  110. package/dist/AMQP/Static/filesQueue.js +6 -205
  111. package/dist/AMQP/Static/filesQueue.js.map +1 -1
  112. package/dist/AMQP/amqpConnectionFactory.d.ts +2 -25
  113. package/dist/AMQP/amqpConnectionFactory.js +4 -219
  114. package/dist/AMQP/amqpConnectionFactory.js.map +1 -1
  115. package/dist/AMQP/amqpErrors.d.ts +4 -5
  116. package/dist/AMQP/amqpErrors.js +18 -27
  117. package/dist/AMQP/amqpErrors.js.map +1 -1
  118. package/dist/AMQP/errors.d.ts +4 -3
  119. package/dist/AMQP/errors.js +18 -27
  120. package/dist/AMQP/errors.js.map +1 -1
  121. package/dist/AMQP/fetchNextMessage.d.ts +3 -12
  122. package/dist/AMQP/fetchNextMessage.js +20 -111
  123. package/dist/AMQP/fetchNextMessage.js.map +1 -1
  124. package/dist/AMQP/queueConfigurator.d.ts +2 -3
  125. package/dist/AMQP/queueConfigurator.js +14 -71
  126. package/dist/AMQP/queueConfigurator.js.map +1 -1
  127. package/dist/DateTime/waitUntil.d.ts +4 -15
  128. package/dist/DateTime/waitUntil.js +17 -139
  129. package/dist/DateTime/waitUntil.js.map +1 -1
  130. package/dist/Events/AsyncEventEmitter.d.ts +2 -29
  131. package/dist/Events/AsyncEventEmitter.js +14 -118
  132. package/dist/Events/AsyncEventEmitter.js.map +1 -1
  133. package/dist/Events/eventsHelpers.d.ts +4 -3
  134. package/dist/Events/eventsHelpers.js +18 -21
  135. package/dist/Events/eventsHelpers.js.map +1 -1
  136. package/dist/Hash/checksum.d.ts +2 -3
  137. package/dist/Hash/checksum.js +16 -15
  138. package/dist/Hash/checksum.js.map +1 -1
  139. package/dist/Hash/checksumFile.d.ts +2 -2
  140. package/dist/Hash/checksumFile.js +4 -65
  141. package/dist/Hash/checksumFile.js.map +1 -1
  142. package/dist/Hash/generator.d.ts +4 -2
  143. package/dist/Hash/generator.js +18 -12
  144. package/dist/Hash/generator.js.map +1 -1
  145. package/dist/HttpStatus/checks/amqpStatusCheck.d.ts +1 -1
  146. package/dist/HttpStatus/statuses/amqpStatus.d.ts +1 -1
  147. package/dist/Metrics/MetricsClient.d.ts +2 -44
  148. package/dist/Metrics/MetricsClient.js +6 -86
  149. package/dist/Metrics/MetricsClient.js.map +1 -1
  150. package/dist/Metrics/metrics.d.ts +2 -82
  151. package/dist/Metrics/metrics.js +4 -238
  152. package/dist/Metrics/metrics.js.map +1 -1
  153. package/dist/Metrics/processSocketsMetrics.d.ts +4 -10
  154. package/dist/Metrics/processSocketsMetrics.js +17 -88
  155. package/dist/Metrics/processSocketsMetrics.js.map +1 -1
  156. package/dist/Service/dbConnections.d.ts +1 -1
  157. package/dist/Service/metrics/connections.js +7 -7
  158. package/dist/Service/metrics/connections.js.map +1 -1
  159. package/dist/ThirdParty/connection.d.ts +0 -11
  160. package/package.json +5 -9
  161. package/dist/AMQP/IAMQPPool.d.ts +0 -5
  162. package/dist/AMQP/IAMQPPool.js +0 -3
  163. package/dist/AMQP/IAMQPPool.js.map +0 -1
  164. package/dist/Events/genericGracefulExit.d.ts +0 -11
  165. package/dist/Events/genericGracefulExit.js +0 -90
  166. package/dist/Events/genericGracefulExit.js.map +0 -1
  167. package/dist/GenericPool/options.d.ts +0 -63
  168. package/dist/GenericPool/options.js +0 -3
  169. package/dist/GenericPool/options.js.map +0 -1
  170. package/dist/Metrics/deviceConsumerMetrics.d.ts +0 -6
  171. package/dist/Metrics/deviceConsumerMetrics.js +0 -59
  172. package/dist/Metrics/deviceConsumerMetrics.js.map +0 -1
  173. package/dist/Metrics/eventConsumerMetrics.d.ts +0 -19
  174. package/dist/Metrics/eventConsumerMetrics.js +0 -52
  175. package/dist/Metrics/eventConsumerMetrics.js.map +0 -1
  176. package/dist/Metrics/eventQueueMetrics.d.ts +0 -7
  177. package/dist/Metrics/eventQueueMetrics.js +0 -19
  178. package/dist/Metrics/eventQueueMetrics.js.map +0 -1
  179. package/dist/Pool/IBasePool.d.ts +0 -6
  180. package/dist/Pool/IBasePool.js +0 -3
  181. package/dist/Pool/IBasePool.js.map +0 -1
  182. package/dist/System/signalSender.d.ts +0 -1
  183. package/dist/System/signalSender.js +0 -7
  184. package/dist/System/signalSender.js.map +0 -1
@@ -1,64 +1,21 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RejectedTimestamps = void 0;
4
17
  /**
5
- * A stateful class used for temporary storing of rejected consumptions of lockedEventConsumer
6
- * to prevent processing/consuming events in incorrect order based on random (temporary) failing events.
7
- *
8
- * This class helps maintain event ordering by keeping track of rejected events' timestamps,
9
- * ensuring that later events cannot be processed until earlier failed events are resolved.
10
- * It has to be sideloaded to __rejected queues (dead-letter queues) so it doesn't affect
11
- * processing of other events with different lockKeys.
12
- *
13
- * The main goal is to react as soon as possible and skip failing events, but continue
14
- * processing others to prevent downtimes or outages. This implementation should only slow down
15
- * or block a single lockDomain without significantly affecting others.
16
- *
17
- * Usually, the errors are temporary (for example MongoDB transactions), so this keeps in memory
18
- * the last rejected events' timestamps to know that later events cannot be processed yet (by lockKeys).
18
+ * @deprecated Use `@signageos/amqp` instead.
19
19
  */
20
- var RejectedTimestamps = /** @class */ (function () {
21
- function RejectedTimestamps() {
22
- this.rejectedTimestamps = new Map();
23
- }
24
- RejectedTimestamps.prototype.addRejection = function (lockKeys, timestamp) {
25
- for (var _i = 0, lockKeys_1 = lockKeys; _i < lockKeys_1.length; _i++) {
26
- var key = lockKeys_1[_i];
27
- this.rejectedTimestamps.set(key, timestamp);
28
- }
29
- };
30
- RejectedTimestamps.prototype.removeRejection = function (lockKeys, timestamp) {
31
- for (var _i = 0, lockKeys_2 = lockKeys; _i < lockKeys_2.length; _i++) {
32
- var key = lockKeys_2[_i];
33
- var rejectedTimestamp = this.rejectedTimestamps.get(key);
34
- if (rejectedTimestamp && this.compareTimestamps(rejectedTimestamp, timestamp) === 0) {
35
- this.rejectedTimestamps.delete(key);
36
- }
37
- }
38
- };
39
- RejectedTimestamps.prototype.previousWasRejected = function (lockKeys, timestamp) {
40
- for (var _i = 0, lockKeys_3 = lockKeys; _i < lockKeys_3.length; _i++) {
41
- var key = lockKeys_3[_i];
42
- var rejectedTimestamp = this.rejectedTimestamps.get(key);
43
- if (rejectedTimestamp && this.compareTimestamps(rejectedTimestamp, timestamp) < 0) {
44
- return true;
45
- }
46
- }
47
- return false;
48
- };
49
- RejectedTimestamps.prototype.compareTimestamps = function (ts1, ts2) {
50
- if (ts1.receivedAt.valueOf() === ts2.receivedAt.valueOf() && ts1.secondaryIndex === ts2.secondaryIndex) {
51
- return 0;
52
- }
53
- else if (ts1.receivedAt.valueOf() < ts2.receivedAt.valueOf() ||
54
- (ts1.receivedAt.valueOf() === ts2.receivedAt.valueOf() && ts1.secondaryIndex < ts2.secondaryIndex)) {
55
- return -1;
56
- }
57
- else {
58
- return 1;
59
- }
60
- };
61
- return RejectedTimestamps;
62
- }());
63
- exports.RejectedTimestamps = RejectedTimestamps;
20
+ __exportStar(require("@signageos/amqp/dist/EventSourcing/Locked/rejectedTimestamps"), exports);
64
21
  //# sourceMappingURL=rejectedTimestamps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rejectedTimestamps.js","sourceRoot":"","sources":["../../../../src/AMQP/EventSourcing/Locked/rejectedTimestamps.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;GAeG;AACH;IAAA;QACS,uBAAkB,GAA4B,IAAI,GAAG,EAAE,CAAC;IAuCjE,CAAC;IArCO,yCAAY,GAAnB,UAAoB,QAAkB,EAAE,SAAqB;QAC5D,KAAkB,UAAQ,EAAR,qBAAQ,EAAR,sBAAQ,EAAR,IAAQ,EAAE,CAAC;YAAxB,IAAM,GAAG,iBAAA;YACb,IAAI,CAAC,kBAA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AAC,OAAO,EAAE;YACnD,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC,EACjG,CAAC;YACF,OAAO,CAAC,CAAC,CAAC;QACX,CAAC;aAAM,CAAC;YACP,OAAO,CAAC,CAAC;QACV,CAAC;IACF,CAAC;IACF,yBAAC;AAAD,CAAC,AAxCD,IAwCC;AAxCY,gDAAkB"}
1
+ {"version":3,"file":"rejectedTimestamps.js","sourceRoot":"","sources":["../../../../src/AMQP/EventSourcing/Locked/rejectedTimestamps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,+FAA6E"}
@@ -1,42 +1,4 @@
1
- import { DeferredState } from './deferredState';
2
- import { RejectedTimestamps } from './rejectedTimestamps';
3
- import { ITimestamp } from '../synchronization';
4
1
  /**
5
- * Function type that executes a callback with locking and timestamp-based ordering.
6
- *
7
- * @param lockKeys - Array of lock keys that determine which events should be processed sequentially
8
- * @param timestamp - Event timestamp used for ordering and rejection tracking
9
- * @param callback - The async function to execute within the lock
2
+ * @deprecated Use `@signageos/amqp` instead.
10
3
  */
11
- export type WithLock = (lockKeys: string[], timestamp: ITimestamp, callback: () => Promise<void>) => Promise<void>;
12
- /**
13
- * Configuration object for creating a withLock function.
14
- */
15
- type WithLockArgs = {
16
- /** State manager for deferred promises */
17
- deferredState: DeferredState;
18
- /** Timestamp tracker for rejected events */
19
- rejectedTimestamps: RejectedTimestamps;
20
- };
21
- /**
22
- * Creates a locking function that uses deferredState for managing deferred promises and
23
- * rejectedTimestamps for handling timestamp-based event ordering.
24
- *
25
- * The returned function will:
26
- * 1. Wait for all previous promises with the same lock-keys to finish before executing the callback
27
- * 2. Check if previous events with the same lock-keys were rejected based on timestamps
28
- * 3. If the callback throws an error, all subsequent waiting promises with the same lock-keys will be rejected
29
- * 4. Store rejection timestamps to prevent processing later events until earlier ones are resolved
30
- *
31
- * This ensures proper event ordering and prevents processing events out of sequence when temporary
32
- * failures occur (e.g., MongoDB transaction failures).
33
- */
34
- export declare const createWithLock: ({ deferredState, rejectedTimestamps }: WithLockArgs) => (lockKeys: string[], timestamp: ITimestamp, callback: () => Promise<void>) => Promise<void>;
35
- /**
36
- * Error thrown when a previous promise with the same lock keys failed,
37
- * causing subsequent promises to be rejected to maintain event ordering.
38
- */
39
- export declare class WithLockPreviousError extends Error {
40
- constructor(lockKeys: string[]);
41
- }
42
- export {};
4
+ export * from '@signageos/amqp/dist/EventSourcing/Locked/withLock';
@@ -1,141 +1,21 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
51
7
  }
52
- };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
55
15
  };
56
16
  Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.WithLockPreviousError = exports.createWithLock = void 0;
58
- var debug_1 = __importDefault(require("debug"));
59
- var debug = (0, debug_1.default)('@signageos/lib:AMQP:EventSourcing:Locked:withLock');
60
- /**
61
- * Creates a locking function that uses deferredState for managing deferred promises and
62
- * rejectedTimestamps for handling timestamp-based event ordering.
63
- *
64
- * The returned function will:
65
- * 1. Wait for all previous promises with the same lock-keys to finish before executing the callback
66
- * 2. Check if previous events with the same lock-keys were rejected based on timestamps
67
- * 3. If the callback throws an error, all subsequent waiting promises with the same lock-keys will be rejected
68
- * 4. Store rejection timestamps to prevent processing later events until earlier ones are resolved
69
- *
70
- * This ensures proper event ordering and prevents processing events out of sequence when temporary
71
- * failures occur (e.g., MongoDB transaction failures).
72
- */
73
- var createWithLock = function (_a) {
74
- var deferredState = _a.deferredState, rejectedTimestamps = _a.rejectedTimestamps;
75
- return function (lockKeys, timestamp, callback) { return __awaiter(void 0, void 0, void 0, function () {
76
- var previousPromises, currentDeferred, error_1;
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
79
- case 0:
80
- previousPromises = deferredState.getPreviousPromises(lockKeys);
81
- currentDeferred = deferredState.addDeferred(lockKeys);
82
- _a.label = 1;
83
- case 1:
84
- _a.trys.push([1, , 7, 8]);
85
- // Wait for all previous promises with the same lock-keys to finish
86
- return [4 /*yield*/, Promise.all(previousPromises)];
87
- case 2:
88
- // Wait for all previous promises with the same lock-keys to finish
89
- _a.sent();
90
- if (rejectedTimestamps.previousWasRejected(lockKeys, timestamp)) {
91
- debug('Error in previous locked callback', { lockKeys: lockKeys, timestamp: timestamp });
92
- currentDeferred.reject(new WithLockPreviousError(lockKeys));
93
- throw new Error("Previous callback with same lock-key ".concat(lockKeys.join(','), " failed."));
94
- }
95
- _a.label = 3;
96
- case 3:
97
- _a.trys.push([3, 5, , 6]);
98
- debug('Starting locked callback', { lockKeys: lockKeys });
99
- return [4 /*yield*/, callback()];
100
- case 4:
101
- _a.sent();
102
- debug('Finished locked callback', { lockKeys: lockKeys });
103
- // Resolve the current deferred to allow the next promise to proceed
104
- currentDeferred.resolve();
105
- return [3 /*break*/, 6];
106
- case 5:
107
- error_1 = _a.sent();
108
- debug('Error in locked callback', { lockKeys: lockKeys, error: error_1 });
109
- // Reject all subsequent waiting promises with the same lock-keys in the same order
110
- currentDeferred.reject(new WithLockPreviousError(lockKeys));
111
- // Store current event timestamp (receivedAt + secondaryIndex) in memory and reject all events with the higher timestamp
112
- rejectedTimestamps.addRejection(lockKeys, timestamp);
113
- // Because of call stack of JS, following error will be thrown and promise rejected first, before the above rejected promise
114
- throw error_1;
115
- case 6:
116
- rejectedTimestamps.removeRejection(lockKeys, timestamp);
117
- return [3 /*break*/, 8];
118
- case 7:
119
- deferredState.removeDeferred(lockKeys, currentDeferred);
120
- return [7 /*endfinally*/];
121
- case 8: return [2 /*return*/];
122
- }
123
- });
124
- }); };
125
- };
126
- exports.createWithLock = createWithLock;
127
17
  /**
128
- * Error thrown when a previous promise with the same lock keys failed,
129
- * causing subsequent promises to be rejected to maintain event ordering.
18
+ * @deprecated Use `@signageos/amqp` instead.
130
19
  */
131
- var WithLockPreviousError = /** @class */ (function (_super) {
132
- __extends(WithLockPreviousError, _super);
133
- function WithLockPreviousError(lockKeys) {
134
- var _this = _super.call(this, "Previous promise with same lock-key ".concat(lockKeys.join(','), " failed, rejecting all subsequent waiting promises.")) || this;
135
- Object.setPrototypeOf(_this, WithLockPreviousError.prototype);
136
- return _this;
137
- }
138
- return WithLockPreviousError;
139
- }(Error));
140
- exports.WithLockPreviousError = WithLockPreviousError;
20
+ __exportStar(require("@signageos/amqp/dist/EventSourcing/Locked/withLock"), exports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AE,CAAC,CAAC;oBAChD,oEAAoE;oBACpE,eAAe,CAAC,OAAO,EAAE,CAAC;;;;oBAE1B,KAAK,CAAC,0BAA0B,EAAE,EAAE,QAAQ,UAAA,EAAE,KAAK,SAAA,EAAE,CAAC,CAAC;oBACvD,mFAAmF;oBACnF,eAAe,CAAC,MAAM,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAC5D,wHAAwH;oBACxH,kBAAkB,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;oBACrD,4HAA4H;oBAC5H,MAAM,OAAK,CAAC;;oBAEb,kBAAkB,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;;;oBAExD,aAAa,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;;;;;SAEzD;AAjCD,CAiCC,CAAC;AAnCU,QAAA,cAAc,kBAmCxB;AAEH;;;GAGG;AACH;IAA2C,yCAAK;IAC/C,+BAAY,QAAkB;QAC7B,YAAA,MAAK,YAAC,8CAAuC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,wDAAqD,CAAC,SAAC;QACtH,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;;IAC9D,CAAC;IACF,4BAAC;AAAD,CAAC,AALD,CAA2C,KAAK,GAK/C;AALY,sDAAqB"}
1
+ {"version":3,"file":"withLock.js","sourceRoot":"","sources":["../../../../src/AMQP/EventSourcing/Locked/withLock.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qFAAmE"}
@@ -1,87 +1,4 @@
1
- import IEvent, { IEventPayload } from './IEvent';
2
- import { IAMQPConnection } from '../amqpConnectionFactory';
3
- import IQueueOptions from '../IQueueOptions';
4
- import { deleteQueues, IBindOptions, IRejectedRedeliverOptions, purgeQueue } from './eventQueue.utils';
5
- import { bindDetached, bindDetachedExpectingConfirmation, fetchRejectedDetached, prepareDetached, prepareRejectedDetached, IEventDetachedMessage, bindRejectedDetached } from './eventQueueDetached';
6
- import { bindDomain, bindRejectedDomain, bindRPCDomain, fetchRejectedDomain, prepareDomain, prepareRejectedDomain as prepareRejected, processRPCDomain, IEventDomainMessage as IEventMessage } from './eventQueueDomain';
7
- import { enqueue, enqueueBatch, enqueueNotification, enqueueToConsumer } from './eventQueuePublish';
8
1
  /**
9
- * Fetch one event from the queue, either it's domain type or detached type.
10
- * It automatically asserts exchanges and queues that is non-standard.
11
- * The fetched message is automatically acked.
12
- * This function is meant mostly for testing purposes.
13
- * @deprecated Use fetchDomain or fetchDetached instead
2
+ * @deprecated Use `@signageos/amqp` instead.
14
3
  */
15
- export declare function fetchNext<TPayload extends IEventPayload>(amqpConnection: IAMQPConnection, eventType: string, consumerType: string, bindOptions?: IBindOptions, queueOptions?: IQueueOptions, domainName?: string): Promise<IEvent<TPayload> | null>;
16
- export {
17
- /** @deprecated Use IBindOptions from './eventQueue.utils' instead. */
18
- IBindOptions,
19
- /** @deprecated Use IRejectedRedeliverOptions from './eventQueue.utils' instead. */
20
- IRejectedRedeliverOptions,
21
- /** @deprecated Use IEventDomainMessage from './eventQueueDomain' instead. */
22
- IEventMessage,
23
- /** @deprecated Use IEventDetachedMessage from './eventQueueDetached' instead. */
24
- IEventDetachedMessage, };
25
- export {
26
- /** @deprecated Use enqueue from './eventQueuePublish' instead. */
27
- enqueue,
28
- /** @deprecated Use enqueueBatch from './eventQueuePublish' instead. */
29
- enqueueBatch,
30
- /** @deprecated Use enqueueNotification from './eventQueuePublish' instead. */
31
- enqueueNotification,
32
- /** @deprecated Use enqueueToConsumer from './eventQueuePublish' instead. */
33
- enqueueToConsumer,
34
- /** @deprecated Use bindRejectedDetached from './eventQueueDetached' instead. */
35
- bindRejectedDetached,
36
- /** @deprecated Use prepareRejectedDomain from './eventQueueDomain' instead. */
37
- prepareRejected,
38
- /** @deprecated Use prepareRejectedDetached from './eventQueueDetached' instead. */
39
- prepareRejectedDetached, };
40
- /**
41
- * @deprecated Use bindDetached from './eventQueueDetached' instead. This alias will be removed in the next major version.
42
- */
43
- export declare const bindOne: typeof bindDetached;
44
- /**
45
- * @deprecated Use bindDetachedExpectingConfirmation from './eventQueueDetached' instead. This alias will be removed in the next major version.
46
- */
47
- export declare const bindOneExpectingConfirmation: typeof bindDetachedExpectingConfirmation;
48
- /**
49
- * @deprecated Use purgeQueue from './eventQueueDetached' instead. This alias will be removed in the next major version.
50
- */
51
- export declare const purgeOne: typeof purgeQueue;
52
- /**
53
- * @deprecated Use deleteQueues from './eventQueueDetached' instead. This alias will be removed in the next major version.
54
- */
55
- export declare const deleteMore: typeof deleteQueues;
56
- /**
57
- * @deprecated Use bindDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
58
- */
59
- export declare const bindMany: typeof bindDomain;
60
- /**
61
- * @deprecated Use bindRejectedDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
62
- */
63
- export declare const bindRejectedMany: typeof bindRejectedDomain;
64
- /**
65
- * @deprecated Use prepareDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
66
- */
67
- export declare const prepareMany: typeof prepareDomain;
68
- /**
69
- * @deprecated Use fetchRejectedDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
70
- */
71
- export declare const fetchOneRejected: typeof fetchRejectedDomain;
72
- /**
73
- * @deprecated Use fetchRejectedDetached from './eventQueueDetached' instead. This alias will be removed in the next major version.
74
- */
75
- export declare const fetchOneRejectedDetached: typeof fetchRejectedDetached;
76
- /**
77
- * @deprecated Use prepareDetached from './eventQueueDetached' instead. This alias will be removed in the next major version.
78
- */
79
- export declare const prepareMore: typeof prepareDetached;
80
- /**
81
- * @deprecated Use bindRPCDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
82
- */
83
- export declare const bindRPC: typeof bindRPCDomain;
84
- /**
85
- * @deprecated Use processRPCDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
86
- */
87
- export declare const processRPC: typeof processRPCDomain;
4
+ export * from '@signageos/amqp/dist/EventSourcing/eventQueue';
@@ -1,139 +1,21 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
47
7
  }
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
51
15
  };
52
16
  Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.processRPC = exports.bindRPC = exports.prepareMore = exports.fetchOneRejectedDetached = exports.fetchOneRejected = exports.prepareMany = exports.bindRejectedMany = exports.bindMany = exports.deleteMore = exports.purgeOne = exports.bindOneExpectingConfirmation = exports.bindOne = exports.prepareRejectedDetached = exports.prepareRejected = exports.bindRejectedDetached = exports.enqueueToConsumer = exports.enqueueNotification = exports.enqueueBatch = exports.enqueue = void 0;
54
- exports.fetchNext = fetchNext;
55
- // Import functions from separated files
56
- var fetchNextMessage_1 = __importDefault(require("../fetchNextMessage"));
57
- var eventQueue_utils_1 = require("./eventQueue.utils");
58
- var eventQueueDetached_1 = require("./eventQueueDetached");
59
- Object.defineProperty(exports, "prepareRejectedDetached", { enumerable: true, get: function () { return eventQueueDetached_1.prepareRejectedDetached; } });
60
- Object.defineProperty(exports, "bindRejectedDetached", { enumerable: true, get: function () { return eventQueueDetached_1.bindRejectedDetached; } });
61
- var eventQueueDomain_1 = require("./eventQueueDomain");
62
- Object.defineProperty(exports, "prepareRejected", { enumerable: true, get: function () { return eventQueueDomain_1.prepareRejectedDomain; } });
63
- var eventQueuePublish_1 = require("./eventQueuePublish");
64
- Object.defineProperty(exports, "enqueue", { enumerable: true, get: function () { return eventQueuePublish_1.enqueue; } });
65
- Object.defineProperty(exports, "enqueueBatch", { enumerable: true, get: function () { return eventQueuePublish_1.enqueueBatch; } });
66
- Object.defineProperty(exports, "enqueueNotification", { enumerable: true, get: function () { return eventQueuePublish_1.enqueueNotification; } });
67
- Object.defineProperty(exports, "enqueueToConsumer", { enumerable: true, get: function () { return eventQueuePublish_1.enqueueToConsumer; } });
68
- /**
69
- * Fetch one event from the queue, either it's domain type or detached type.
70
- * It automatically asserts exchanges and queues that is non-standard.
71
- * The fetched message is automatically acked.
72
- * This function is meant mostly for testing purposes.
73
- * @deprecated Use fetchDomain or fetchDetached instead
74
- */
75
- function fetchNext(amqpConnection_1, eventType_1, consumerType_1) {
76
- return __awaiter(this, arguments, void 0, function (amqpConnection, eventType, consumerType, bindOptions, queueOptions, domainName) {
77
- var exchangeName, queueName, options;
78
- if (bindOptions === void 0) { bindOptions = {}; }
79
- return __generator(this, function (_a) {
80
- switch (_a.label) {
81
- case 0:
82
- exchangeName = (0, eventQueue_utils_1.getExchangeName)(bindOptions, eventType);
83
- queueName = (0, eventQueue_utils_1.getQueueName)(consumerType, domainName !== null && domainName !== void 0 ? domainName : eventType);
84
- options = __assign(__assign(__assign({}, queueOptions), bindOptions), (domainName ? (0, eventQueueDomain_1.getDomainConsumeOptions)(bindOptions, consumerType, domainName) : (0, eventQueue_utils_1.getConsumeOptionsByBindOptions)(bindOptions)));
85
- return [4 /*yield*/, (0, fetchNextMessage_1.default)(amqpConnection, queueName, (0, eventQueue_utils_1.getBasicEventRoutingKey)(eventType), exchangeName, eventQueue_utils_1.FAILED_EXCHANGE_NAME, options, 'fanout', 'direct')];
86
- case 1: return [2 /*return*/, _a.sent()];
87
- }
88
- });
89
- });
90
- }
91
- /**
92
- * @deprecated Use bindDetached from './eventQueueDetached' instead. This alias will be removed in the next major version.
93
- */
94
- exports.bindOne = eventQueueDetached_1.bindDetached;
95
- /**
96
- * @deprecated Use bindDetachedExpectingConfirmation from './eventQueueDetached' instead. This alias will be removed in the next major version.
97
- */
98
- exports.bindOneExpectingConfirmation = eventQueueDetached_1.bindDetachedExpectingConfirmation;
99
- /**
100
- * @deprecated Use purgeQueue from './eventQueueDetached' instead. This alias will be removed in the next major version.
101
- */
102
- exports.purgeOne = eventQueue_utils_1.purgeQueue;
103
- /**
104
- * @deprecated Use deleteQueues from './eventQueueDetached' instead. This alias will be removed in the next major version.
105
- */
106
- exports.deleteMore = eventQueue_utils_1.deleteQueues;
107
- /**
108
- * @deprecated Use bindDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
109
- */
110
- exports.bindMany = eventQueueDomain_1.bindDomain;
111
- /**
112
- * @deprecated Use bindRejectedDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
113
- */
114
- exports.bindRejectedMany = eventQueueDomain_1.bindRejectedDomain;
115
- /**
116
- * @deprecated Use prepareDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
117
- */
118
- exports.prepareMany = eventQueueDomain_1.prepareDomain;
119
- /**
120
- * @deprecated Use fetchRejectedDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
121
- */
122
- exports.fetchOneRejected = eventQueueDomain_1.fetchRejectedDomain;
123
- /**
124
- * @deprecated Use fetchRejectedDetached from './eventQueueDetached' instead. This alias will be removed in the next major version.
125
- */
126
- exports.fetchOneRejectedDetached = eventQueueDetached_1.fetchRejectedDetached;
127
- /**
128
- * @deprecated Use prepareDetached from './eventQueueDetached' instead. This alias will be removed in the next major version.
129
- */
130
- exports.prepareMore = eventQueueDetached_1.prepareDetached;
131
- /**
132
- * @deprecated Use bindRPCDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
133
- */
134
- exports.bindRPC = eventQueueDomain_1.bindRPCDomain;
135
17
  /**
136
- * @deprecated Use processRPCDomain from './eventQueueDomain' instead. This alias will be removed in the next major version.
18
+ * @deprecated Use `@signageos/amqp` instead.
137
19
  */
138
- exports.processRPC = eventQueueDomain_1.processRPCDomain;
20
+ __exportStar(require("@signageos/amqp/dist/EventSourcing/eventQueue"), exports);
139
21
  //# sourceMappingURL=eventQueue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventQueue.js","sourceRoot":"","sources":["../../../src/AMQP/EventSourcing/eventQueue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,8BAyBC;AAtED,wCAAwC;AACxC,yEAAmD;AAInD,uDAU4B;AAC5B,2DAQ8B;AA8E7B,wGAjFA,4CAAuB,OAiFA;AAJvB,qGA3EA,yCAAoB,OA2EA;AAzErB,uDAU4B;AAiE3B,gGApEyB,wCAAe,OAoEzB;AAhEhB,yDAAoG;AAsDnG,wFAtDQ,2BAAO,OAsDR;AAEP,6FAxDiB,gCAAY,OAwDjB;AAEZ,oGA1D+B,uCAAmB,OA0D/B;AAEnB,kGA5DoD,qCAAiB,OA4DpD;AA1DlB;;;;;;GAMG;AACH,SAAsB,SAAS;wDAC9B,cAA+B,EAC/B,SAAiB,EACjB,YAAoB,EACpB,WAA8B,EAC9B,YAA4B,EAC5B,UAAmB;;QAFnB,4BAAA,EAAA,gBAA8B;;;;oBAIxB,YAAY,GAAG,IAAA,kCAAe,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC;oBACvD,S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G;AACH,gFAA8D"}
@@ -1,73 +1,4 @@
1
- import IConsumeOptions, { QueueType } from '../IConsumeOptions';
2
- import IQueueOptions from '../IQueueOptions';
3
- import { IAMQPConnection } from '../amqpConnectionFactory';
4
- export declare const EXCHANGE_PREFIX = "events";
5
- /** @deprecated Use @signageos/user-domain-model/dist/Lib/CQRS/commandSynchronization instead */
6
- export declare const EXCHANGE_NOTIFICATIONS_PREFIX = "events_notifications";
7
- /** Alternate exchange for events (currently unused) */
8
- export declare const FAILED_EXCHANGE_NAME = "events_failed";
9
- /** Rejected exchange for (currently domain only) queues. Detached queue uses "__rejected." prefix for backwards compatibility reason */
10
- export declare const REJECTED_EXCHANGE_NAME = "events_rejected";
11
- export declare const OPTIONS: IQueueOptions;
12
1
  /**
13
- * @deprecated Use @signageos/user-domain-model/dist/Lib/CQRS/commandSynchronization instead
2
+ * @deprecated Use `@signageos/amqp` instead.
14
3
  */
15
- export interface INotificationOptions {
16
- /** @deprecated Use @signageos/user-domain-model/dist/Lib/CQRS/commandSynchronization instead */
17
- notification?: boolean;
18
- }
19
- export interface IBindOptions extends INotificationOptions {
20
- /** Incorrect naming. It means not autoDelete */
21
- persistent?: boolean;
22
- exclusive?: boolean;
23
- prefetchCount?: number;
24
- singleActiveConsumer?: boolean;
25
- deadLetterIfErred?: boolean;
26
- /** @deprecated Use deadLetterIfErred instead. The suppressFirstError is misused and should not exists. */
27
- deadLetterIfRedeliveredAndErred?: boolean;
28
- /**
29
- * Whether first simple consumption error should not be thrown (just nacked for next redeliver)
30
- * @deprecated Use deadLetterIfErred instead. The suppressFirstError is misused and should not exists.
31
- */
32
- suppressFirstError?: boolean;
33
- /**
34
- * When message was already nacked (requeue: true), then next consumption will be delayed by number of milliseconds
35
- * @deprecated Use messageExpiresMs in dead-letter queue instead. This option is misused and should not exists.
36
- * It's called redeliverDelayMs in bindRejected*() functions in IRejectedRedeliverOptions.
37
- */
38
- redeliverDelayMs?: number;
39
- /**
40
- * Whether the queue type is created as quorum or classic.
41
- * It cannot be changed later. Only strictly persistent queue with "mirroring" requirements should be quorum.
42
- * Default value is quorum.
43
- */
44
- queueType?: QueueType;
45
- /**
46
- * Whether the queue is created as durable or not.
47
- * Default value is `true`.
48
- */
49
- durable?: boolean;
50
- /**
51
- * Limits number of messages in the queue.
52
- */
53
- maxLength?: number;
54
- /**
55
- * defines strategy for handling messages when the queue is full.
56
- * @see IBasicConsumeOptions#overflow
57
- */
58
- overflow?: 'reject-publish' | 'reject-publish-dlx' | 'drop-head';
59
- }
60
- export interface IRejectedRedeliverOptions {
61
- /**
62
- * Configure how long it will wait in the rejected queue until it's tried to be redelivered to the original queue.
63
- * Specify in milliseconds.
64
- */
65
- redeliverDelayMs: number;
66
- }
67
- export declare function getConsumeOptionsByBindOptions(options: IBindOptions): IConsumeOptions;
68
- export declare function getExchangeName(options: INotificationOptions, eventType: string): string;
69
- export declare function getQueueName(consumerType: string, queueIdentification: string): string;
70
- export declare function parseQueueName(consumerType: string, queueName: string): string;
71
- export declare function getBasicEventRoutingKey(eventType: string): string;
72
- export declare function purgeQueue(amqpConnection: IAMQPConnection, queueIdentification: string, consumerType: string): Promise<void>;
73
- export declare function deleteQueues(amqpConnection: IAMQPConnection, queueIdentifications: string[], consumerType: string): Promise<void>;
4
+ export * from '@signageos/amqp/dist/EventSourcing/eventQueue.utils';