@prodforcode/event-forge-core 1.0.0 → 1.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.
- package/dist/config/inbox.config.d.ts +6 -0
- package/dist/config/inbox.config.d.ts.map +1 -0
- package/dist/config/inbox.config.js +8 -0
- package/dist/config/inbox.config.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/outbox.config.d.ts +14 -0
- package/dist/config/outbox.config.d.ts.map +1 -0
- package/dist/config/outbox.config.js +16 -0
- package/dist/config/outbox.config.js.map +1 -0
- package/dist/decorators/inbox-handler.decorator.d.ts +8 -0
- package/dist/decorators/inbox-handler.decorator.d.ts.map +1 -0
- package/dist/decorators/inbox-handler.decorator.js +13 -0
- package/dist/decorators/inbox-handler.decorator.js.map +1 -0
- package/dist/decorators/index.d.ts +3 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +19 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/outbox-handler.decorator.d.ts +9 -0
- package/dist/decorators/outbox-handler.decorator.d.ts.map +1 -0
- package/dist/decorators/outbox-handler.decorator.js +13 -0
- package/dist/decorators/outbox-handler.decorator.js.map +1 -0
- package/dist/errors/duplicate-message.error.d.ts +6 -0
- package/dist/errors/duplicate-message.error.d.ts.map +1 -0
- package/dist/errors/duplicate-message.error.js +18 -0
- package/dist/errors/duplicate-message.error.js.map +1 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +19 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/processing.error.d.ts +7 -0
- package/dist/errors/processing.error.d.ts.map +1 -0
- package/dist/errors/processing.error.js +18 -0
- package/dist/errors/processing.error.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/create-inbox-message.dto.d.ts +7 -0
- package/dist/interfaces/create-inbox-message.dto.d.ts.map +1 -0
- package/dist/interfaces/create-inbox-message.dto.js +3 -0
- package/dist/interfaces/create-inbox-message.dto.js.map +1 -0
- package/dist/interfaces/create-outbox-message.dto.d.ts +10 -0
- package/dist/interfaces/create-outbox-message.dto.d.ts.map +1 -0
- package/dist/interfaces/create-outbox-message.dto.js +3 -0
- package/dist/interfaces/create-outbox-message.dto.js.map +1 -0
- package/dist/interfaces/inbox-message.interface.d.ts +18 -0
- package/dist/interfaces/inbox-message.interface.d.ts.map +1 -0
- package/dist/interfaces/inbox-message.interface.js +11 -0
- package/dist/interfaces/inbox-message.interface.js.map +1 -0
- package/dist/interfaces/inbox-repository.interface.d.ts +15 -0
- package/dist/interfaces/inbox-repository.interface.d.ts.map +1 -0
- package/dist/interfaces/inbox-repository.interface.js +3 -0
- package/dist/interfaces/inbox-repository.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +24 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/message-publisher.interface.d.ts +16 -0
- package/dist/interfaces/message-publisher.interface.d.ts.map +1 -0
- package/dist/interfaces/message-publisher.interface.js +3 -0
- package/dist/interfaces/message-publisher.interface.js.map +1 -0
- package/dist/interfaces/outbox-message.interface.d.ts +25 -0
- package/dist/interfaces/outbox-message.interface.d.ts.map +1 -0
- package/dist/interfaces/outbox-message.interface.js +12 -0
- package/dist/interfaces/outbox-message.interface.js.map +1 -0
- package/dist/interfaces/outbox-repository.interface.d.ts +13 -0
- package/dist/interfaces/outbox-repository.interface.d.ts.map +1 -0
- package/dist/interfaces/outbox-repository.interface.js +3 -0
- package/dist/interfaces/outbox-repository.interface.js.map +1 -0
- package/dist/services/inbox.service.d.ts +28 -0
- package/dist/services/inbox.service.d.ts.map +1 -0
- package/dist/services/inbox.service.js +111 -0
- package/dist/services/inbox.service.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +19 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/outbox.service.d.ts +33 -0
- package/dist/services/outbox.service.d.ts.map +1 -0
- package/dist/services/outbox.service.js +128 -0
- package/dist/services/outbox.service.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.config.d.ts","sourceRoot":"","sources":["../../src/config/inbox.config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAE1B,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAKD,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAGtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.config.js","sourceRoot":"","sources":["../../src/config/inbox.config.ts"],"names":[],"mappings":";;;AAca,QAAA,oBAAoB,GAA0B;IACzD,eAAe,EAAE,QAAQ;IACzB,aAAa,EAAE,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./inbox.config"), exports);
|
|
18
|
+
__exportStar(require("./outbox.config"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,kDAAgC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface OutboxConfig {
|
|
2
|
+
pollingInterval?: number;
|
|
3
|
+
batchSize?: number;
|
|
4
|
+
maxRetries?: number;
|
|
5
|
+
lockTimeoutSeconds?: number;
|
|
6
|
+
backoffBaseSeconds?: number;
|
|
7
|
+
maxBackoffSeconds?: number;
|
|
8
|
+
cleanupInterval?: number;
|
|
9
|
+
retentionDays?: number;
|
|
10
|
+
immediateProcessing?: boolean;
|
|
11
|
+
workerId?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const DEFAULT_OUTBOX_CONFIG: Required<OutboxConfig>;
|
|
14
|
+
//# sourceMappingURL=outbox.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.config.d.ts","sourceRoot":"","sources":["../../src/config/outbox.config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAE3B,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAG3B,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAG9B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAWxD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_OUTBOX_CONFIG = void 0;
|
|
4
|
+
exports.DEFAULT_OUTBOX_CONFIG = {
|
|
5
|
+
pollingInterval: 1000,
|
|
6
|
+
batchSize: 10,
|
|
7
|
+
maxRetries: 3,
|
|
8
|
+
lockTimeoutSeconds: 300,
|
|
9
|
+
backoffBaseSeconds: 2,
|
|
10
|
+
maxBackoffSeconds: 3600,
|
|
11
|
+
cleanupInterval: 86400000,
|
|
12
|
+
retentionDays: 7,
|
|
13
|
+
immediateProcessing: true,
|
|
14
|
+
workerId: `${process.env.HOSTNAME || 'unknown'}-${process.pid}`,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=outbox.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.config.js","sourceRoot":"","sources":["../../src/config/outbox.config.ts"],"names":[],"mappings":";;;AAsCa,QAAA,qBAAqB,GAA2B;IAC3D,eAAe,EAAE,IAAI;IACrB,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,GAAG;IACvB,kBAAkB,EAAE,CAAC;IACrB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,QAAQ;IACzB,aAAa,EAAE,CAAC;IAChB,mBAAmB,EAAE,IAAI;IACzB,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE;CAChE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export declare const INBOX_HANDLER_METADATA = "inbox-outbox:inbox-handler";
|
|
3
|
+
export interface InboxHandlerOptions {
|
|
4
|
+
eventType: string;
|
|
5
|
+
source?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function InboxHandler(options: InboxHandlerOptions): MethodDecorator;
|
|
8
|
+
//# sourceMappingURL=inbox-handler.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-handler.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/inbox-handler.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AAKnE,MAAM,WAAW,mBAAmB;IAElC,SAAS,EAAE,MAAM,CAAC;IAGlB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAcD,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,eAAe,CAM1E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INBOX_HANDLER_METADATA = void 0;
|
|
4
|
+
exports.InboxHandler = InboxHandler;
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
exports.INBOX_HANDLER_METADATA = 'inbox-outbox:inbox-handler';
|
|
7
|
+
function InboxHandler(options) {
|
|
8
|
+
return (_target, _propertyKey, descriptor) => {
|
|
9
|
+
Reflect.defineMetadata(exports.INBOX_HANDLER_METADATA, options, descriptor.value);
|
|
10
|
+
return descriptor;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=inbox-handler.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-handler.decorator.js","sourceRoot":"","sources":["../../src/decorators/inbox-handler.decorator.ts"],"names":[],"mappings":";;;AA8BA,oCAMC;AApCD,4BAA0B;AAKb,QAAA,sBAAsB,GAAG,4BAA4B,CAAC;AAyBnE,SAAgB,YAAY,CAAC,OAA4B;IACvD,OAAO,CAAC,OAAe,EAAE,YAA6B,EAAE,UAA8B,EAAE,EAAE;QAEvF,OAAe,CAAC,cAAc,CAAC,8BAAsB,EAAE,OAAO,EAAE,UAAU,CAAC,KAAe,CAAC,CAAC;QAC7F,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./inbox-handler.decorator"), exports);
|
|
18
|
+
__exportStar(require("./outbox-handler.decorator"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,6DAA2C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export declare const OUTBOX_HANDLER_METADATA = "inbox-outbox:outbox-handler";
|
|
3
|
+
export interface OutboxHandlerOptions {
|
|
4
|
+
eventType: string;
|
|
5
|
+
cron?: string;
|
|
6
|
+
eventBased?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function OutboxHandler(options: OutboxHandlerOptions): MethodDecorator;
|
|
9
|
+
//# sourceMappingURL=outbox-handler.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-handler.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/outbox-handler.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,eAAO,MAAM,uBAAuB,gCAAgC,CAAC;AAKrE,MAAM,WAAW,oBAAoB;IAEnC,SAAS,EAAE,MAAM,CAAC;IAGlB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAcD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,CAM5E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OUTBOX_HANDLER_METADATA = void 0;
|
|
4
|
+
exports.OutboxHandler = OutboxHandler;
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
exports.OUTBOX_HANDLER_METADATA = 'inbox-outbox:outbox-handler';
|
|
7
|
+
function OutboxHandler(options) {
|
|
8
|
+
return (_target, _propertyKey, descriptor) => {
|
|
9
|
+
Reflect.defineMetadata(exports.OUTBOX_HANDLER_METADATA, options, descriptor.value);
|
|
10
|
+
return descriptor;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=outbox-handler.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-handler.decorator.js","sourceRoot":"","sources":["../../src/decorators/outbox-handler.decorator.ts"],"names":[],"mappings":";;;AAiCA,sCAMC;AAvCD,4BAA0B;AAKb,QAAA,uBAAuB,GAAG,6BAA6B,CAAC;AA4BrE,SAAgB,aAAa,CAAC,OAA6B;IACzD,OAAO,CAAC,OAAe,EAAE,YAA6B,EAAE,UAA8B,EAAE,EAAE;QAEvF,OAAe,CAAC,cAAc,CAAC,+BAAuB,EAAE,OAAO,EAAE,UAAU,CAAC,KAAe,CAAC,CAAC;QAC9F,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicate-message.error.d.ts","sourceRoot":"","sources":["../../src/errors/duplicate-message.error.ts"],"names":[],"mappings":"AAIA,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,SAAS,EAAE,MAAM;aACjB,MAAM,EAAE,MAAM;gBADd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM;CAUjC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DuplicateMessageError = void 0;
|
|
4
|
+
class DuplicateMessageError extends Error {
|
|
5
|
+
messageId;
|
|
6
|
+
source;
|
|
7
|
+
constructor(messageId, source) {
|
|
8
|
+
super(`Duplicate message: ${messageId} from ${source}`);
|
|
9
|
+
this.messageId = messageId;
|
|
10
|
+
this.source = source;
|
|
11
|
+
this.name = 'DuplicateMessageError';
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.DuplicateMessageError = DuplicateMessageError;
|
|
18
|
+
//# sourceMappingURL=duplicate-message.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duplicate-message.error.js","sourceRoot":"","sources":["../../src/errors/duplicate-message.error.ts"],"names":[],"mappings":";;;AAIA,MAAa,qBAAsB,SAAQ,KAAK;IAE5B;IACA;IAFlB,YACkB,SAAiB,EACjB,MAAc;QAE9B,KAAK,CAAC,sBAAsB,SAAS,SAAS,MAAM,EAAE,CAAC,CAAC;QAHxC,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QAGpC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAbD,sDAaC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./duplicate-message.error"), exports);
|
|
18
|
+
__exportStar(require("./processing.error"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,qDAAmC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class ProcessingError extends Error {
|
|
2
|
+
readonly messageId: string;
|
|
3
|
+
readonly eventType: string;
|
|
4
|
+
readonly cause?: Error | undefined;
|
|
5
|
+
constructor(message: string, messageId: string, eventType: string, cause?: Error | undefined);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=processing.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing.error.d.ts","sourceRoot":"","sources":["../../src/errors/processing.error.ts"],"names":[],"mappings":"AAKA,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,SAAS,EAAE,MAAM;aACjB,SAAS,EAAE,MAAM;aACjB,KAAK,CAAC,EAAE,KAAK;gBAH7B,OAAO,EAAE,MAAM,EACC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,KAAK,YAAA;CAMhC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProcessingError = void 0;
|
|
4
|
+
class ProcessingError extends Error {
|
|
5
|
+
messageId;
|
|
6
|
+
eventType;
|
|
7
|
+
cause;
|
|
8
|
+
constructor(message, messageId, eventType, cause) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.messageId = messageId;
|
|
11
|
+
this.eventType = eventType;
|
|
12
|
+
this.cause = cause;
|
|
13
|
+
this.name = 'ProcessingError';
|
|
14
|
+
Error.captureStackTrace(this, this.constructor);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ProcessingError = ProcessingError;
|
|
18
|
+
//# sourceMappingURL=processing.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing.error.js","sourceRoot":"","sources":["../../src/errors/processing.error.ts"],"names":[],"mappings":";;;AAKA,MAAa,eAAgB,SAAQ,KAAK;IAGtB;IACA;IACA;IAJlB,YACE,OAAe,EACC,SAAiB,EACjB,SAAiB,EACjB,KAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,cAAS,GAAT,SAAS,CAAQ;QACjB,cAAS,GAAT,SAAS,CAAQ;QACjB,UAAK,GAAL,KAAK,CAAQ;QAG7B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF;AAXD,0CAWC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AAGzB,cAAc,cAAc,CAAC;AAG7B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./decorators"), exports);
|
|
19
|
+
__exportStar(require("./errors"), exports);
|
|
20
|
+
__exportStar(require("./interfaces"), exports);
|
|
21
|
+
__exportStar(require("./services"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAAyB;AAGzB,+CAA6B;AAG7B,2CAAyB;AAGzB,+CAA6B;AAG7B,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-inbox-message.dto.d.ts","sourceRoot":"","sources":["../../src/interfaces/create-inbox-message.dto.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IAEpC,SAAS,EAAE,MAAM,CAAC;IAGlB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-inbox-message.dto.js","sourceRoot":"","sources":["../../src/interfaces/create-inbox-message.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CreateOutboxMessageDto {
|
|
2
|
+
aggregateType: string;
|
|
3
|
+
aggregateId: string;
|
|
4
|
+
eventType: string;
|
|
5
|
+
payload: Record<string, unknown>;
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
7
|
+
scheduledAt?: Date;
|
|
8
|
+
maxRetries?: number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=create-outbox-message.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-outbox-message.dto.d.ts","sourceRoot":"","sources":["../../src/interfaces/create-outbox-message.dto.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IAErC,aAAa,EAAE,MAAM,CAAC;IAGtB,WAAW,EAAE,MAAM,CAAC;IAGpB,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGnC,WAAW,CAAC,EAAE,IAAI,CAAC;IAGnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-outbox-message.dto.js","sourceRoot":"","sources":["../../src/interfaces/create-outbox-message.dto.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface InboxMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
messageId: string;
|
|
4
|
+
source: string;
|
|
5
|
+
eventType: string;
|
|
6
|
+
payload: Record<string, unknown>;
|
|
7
|
+
status: InboxMessageStatus;
|
|
8
|
+
processedAt?: Date;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
}
|
|
12
|
+
export declare enum InboxMessageStatus {
|
|
13
|
+
RECEIVED = "received",
|
|
14
|
+
PROCESSING = "processing",
|
|
15
|
+
PROCESSED = "processed",
|
|
16
|
+
FAILED = "failed"
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=inbox-message.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-message.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/inbox-message.interface.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAE3B,EAAE,EAAE,MAAM,CAAC;IAGX,SAAS,EAAE,MAAM,CAAC;IAGlB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGjC,MAAM,EAAE,kBAAkB,CAAC;IAG3B,WAAW,CAAC,EAAE,IAAI,CAAC;IAGnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,IAAI,CAAC;CACjB;AAKD,oBAAY,kBAAkB;IAC5B,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InboxMessageStatus = void 0;
|
|
4
|
+
var InboxMessageStatus;
|
|
5
|
+
(function (InboxMessageStatus) {
|
|
6
|
+
InboxMessageStatus["RECEIVED"] = "received";
|
|
7
|
+
InboxMessageStatus["PROCESSING"] = "processing";
|
|
8
|
+
InboxMessageStatus["PROCESSED"] = "processed";
|
|
9
|
+
InboxMessageStatus["FAILED"] = "failed";
|
|
10
|
+
})(InboxMessageStatus || (exports.InboxMessageStatus = InboxMessageStatus = {}));
|
|
11
|
+
//# sourceMappingURL=inbox-message.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-message.interface.js","sourceRoot":"","sources":["../../src/interfaces/inbox-message.interface.ts"],"names":[],"mappings":";;;AAoCA,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,6CAAuB,CAAA;IACvB,uCAAiB,CAAA;AACnB,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CreateInboxMessageDto } from './create-inbox-message.dto';
|
|
2
|
+
import { InboxMessage } from './inbox-message.interface';
|
|
3
|
+
export interface RecordInboxMessageResult {
|
|
4
|
+
message: InboxMessage;
|
|
5
|
+
isDuplicate: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface IInboxRepository {
|
|
8
|
+
record(dto: CreateInboxMessageDto): Promise<RecordInboxMessageResult>;
|
|
9
|
+
exists(messageId: string, source: string): Promise<boolean>;
|
|
10
|
+
markProcessing(id: string): Promise<void>;
|
|
11
|
+
markProcessed(id: string): Promise<void>;
|
|
12
|
+
markFailed(id: string, error: string): Promise<void>;
|
|
13
|
+
deleteOlderThan(date: Date): Promise<number>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=inbox-repository.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-repository.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/inbox-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAKzD,MAAM,WAAW,wBAAwB;IAEvC,OAAO,EAAE,YAAY,CAAC;IAGtB,WAAW,EAAE,OAAO,CAAC;CACtB;AAMD,MAAM,WAAW,gBAAgB;IAM/B,MAAM,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAQtE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAM5D,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAM1C,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAOzC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAOrD,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-repository.interface.js","sourceRoot":"","sources":["../../src/interfaces/inbox-repository.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './create-inbox-message.dto';
|
|
2
|
+
export * from './create-outbox-message.dto';
|
|
3
|
+
export * from './inbox-message.interface';
|
|
4
|
+
export * from './outbox-message.interface';
|
|
5
|
+
export * from './inbox-repository.interface';
|
|
6
|
+
export * from './outbox-repository.interface';
|
|
7
|
+
export * from './message-publisher.interface';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAG3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAG9C,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-inbox-message.dto"), exports);
|
|
18
|
+
__exportStar(require("./create-outbox-message.dto"), exports);
|
|
19
|
+
__exportStar(require("./inbox-message.interface"), exports);
|
|
20
|
+
__exportStar(require("./outbox-message.interface"), exports);
|
|
21
|
+
__exportStar(require("./inbox-repository.interface"), exports);
|
|
22
|
+
__exportStar(require("./outbox-repository.interface"), exports);
|
|
23
|
+
__exportStar(require("./message-publisher.interface"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAA2C;AAC3C,8DAA4C;AAG5C,4DAA0C;AAC1C,6DAA2C;AAG3C,+DAA6C;AAC7C,gEAA8C;AAG9C,gEAA8C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OutboxMessage } from './outbox-message.interface';
|
|
2
|
+
export interface PublishOptions {
|
|
3
|
+
exchange?: string;
|
|
4
|
+
routingKey?: string;
|
|
5
|
+
topic?: string;
|
|
6
|
+
priority?: number;
|
|
7
|
+
expiration?: number;
|
|
8
|
+
headers?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface IMessagePublisher {
|
|
11
|
+
publish(message: OutboxMessage, options?: PublishOptions): Promise<void>;
|
|
12
|
+
connect?(): Promise<void>;
|
|
13
|
+
disconnect?(): Promise<void>;
|
|
14
|
+
isConnected?(): boolean;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=message-publisher.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-publisher.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/message-publisher.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAK3D,MAAM,WAAW,cAAc;IAE7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAMD,MAAM,WAAW,iBAAiB;IAOhC,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAMzE,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAM1B,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAK7B,WAAW,CAAC,IAAI,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-publisher.interface.js","sourceRoot":"","sources":["../../src/interfaces/message-publisher.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface OutboxMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
aggregateType: string;
|
|
4
|
+
aggregateId: string;
|
|
5
|
+
eventType: string;
|
|
6
|
+
payload: Record<string, unknown>;
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
status: OutboxMessageStatus;
|
|
9
|
+
retryCount: number;
|
|
10
|
+
maxRetries: number;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
scheduledAt?: Date;
|
|
13
|
+
lockedBy?: string;
|
|
14
|
+
lockedAt?: Date;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}
|
|
18
|
+
export declare enum OutboxMessageStatus {
|
|
19
|
+
PENDING = "pending",
|
|
20
|
+
PROCESSING = "processing",
|
|
21
|
+
PUBLISHED = "published",
|
|
22
|
+
FAILED = "failed",
|
|
23
|
+
PERMANENTLY_FAILED = "permanently_failed"
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=outbox-message.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-message.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/outbox-message.interface.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAE5B,EAAE,EAAE,MAAM,CAAC;IAGX,aAAa,EAAE,MAAM,CAAC;IAGtB,WAAW,EAAE,MAAM,CAAC;IAGpB,SAAS,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGnC,MAAM,EAAE,mBAAmB,CAAC;IAG5B,UAAU,EAAE,MAAM,CAAC;IAGnB,UAAU,EAAE,MAAM,CAAC;IAGnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,WAAW,CAAC,EAAE,IAAI,CAAC;IAGnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;IAGhB,SAAS,EAAE,IAAI,CAAC;CACjB;AAKD,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,kBAAkB,uBAAuB;CAC1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxMessageStatus = void 0;
|
|
4
|
+
var OutboxMessageStatus;
|
|
5
|
+
(function (OutboxMessageStatus) {
|
|
6
|
+
OutboxMessageStatus["PENDING"] = "pending";
|
|
7
|
+
OutboxMessageStatus["PROCESSING"] = "processing";
|
|
8
|
+
OutboxMessageStatus["PUBLISHED"] = "published";
|
|
9
|
+
OutboxMessageStatus["FAILED"] = "failed";
|
|
10
|
+
OutboxMessageStatus["PERMANENTLY_FAILED"] = "permanently_failed";
|
|
11
|
+
})(OutboxMessageStatus || (exports.OutboxMessageStatus = OutboxMessageStatus = {}));
|
|
12
|
+
//# sourceMappingURL=outbox-message.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-message.interface.js","sourceRoot":"","sources":["../../src/interfaces/outbox-message.interface.ts"],"names":[],"mappings":";;;AAsDA,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,gDAAyB,CAAA;IACzB,8CAAuB,CAAA;IACvB,wCAAiB,CAAA;IACjB,gEAAyC,CAAA;AAC3C,CAAC,EANW,mBAAmB,mCAAnB,mBAAmB,QAM9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CreateOutboxMessageDto } from './create-outbox-message.dto';
|
|
2
|
+
import { OutboxMessage } from './outbox-message.interface';
|
|
3
|
+
export interface IOutboxRepository {
|
|
4
|
+
create(dto: CreateOutboxMessageDto, transactionContext?: unknown): Promise<OutboxMessage>;
|
|
5
|
+
fetchAndLockPending(limit: number, lockerId: string): Promise<OutboxMessage[]>;
|
|
6
|
+
markPublished(id: string): Promise<void>;
|
|
7
|
+
markFailed(id: string, error: string, permanent?: boolean): Promise<void>;
|
|
8
|
+
releaseLock(id: string): Promise<void>;
|
|
9
|
+
releaseStaleLocks(olderThan: Date): Promise<number>;
|
|
10
|
+
deleteOlderThan(date: Date): Promise<number>;
|
|
11
|
+
withTransaction<T>(operation: (context: unknown) => Promise<T>): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=outbox-repository.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-repository.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/outbox-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAM3D,MAAM,WAAW,iBAAiB;IAOhC,MAAM,CAAC,GAAG,EAAE,sBAAsB,EAAE,kBAAkB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAS1F,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAM/E,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAQzC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAM1E,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAOvC,iBAAiB,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAOpD,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAO7C,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-repository.interface.js","sourceRoot":"","sources":["../../src/interfaces/outbox-repository.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { InboxConfig } from '../config/inbox.config';
|
|
3
|
+
import { CreateInboxMessageDto } from '../interfaces/create-inbox-message.dto';
|
|
4
|
+
import { InboxMessage } from '../interfaces/inbox-message.interface';
|
|
5
|
+
import { IInboxRepository } from '../interfaces/inbox-repository.interface';
|
|
6
|
+
export type MessageHandler = (message: InboxMessage) => Promise<void> | void;
|
|
7
|
+
export declare enum InboxEvents {
|
|
8
|
+
MESSAGE_RECEIVED = "inbox:message:received",
|
|
9
|
+
MESSAGE_DUPLICATE = "inbox:message:duplicate",
|
|
10
|
+
MESSAGE_PROCESSED = "inbox:message:processed",
|
|
11
|
+
MESSAGE_FAILED = "inbox:message:failed"
|
|
12
|
+
}
|
|
13
|
+
export declare class InboxService extends EventEmitter {
|
|
14
|
+
private readonly repository;
|
|
15
|
+
private readonly config;
|
|
16
|
+
private readonly handlers;
|
|
17
|
+
private cleanupTimer?;
|
|
18
|
+
constructor(repository: IInboxRepository, config?: InboxConfig);
|
|
19
|
+
registerHandler(eventType: string, handler: MessageHandler): void;
|
|
20
|
+
unregisterHandler(eventType: string, handler: MessageHandler): void;
|
|
21
|
+
receiveMessage(dto: CreateInboxMessageDto): Promise<void>;
|
|
22
|
+
processMessage(message: InboxMessage): Promise<void>;
|
|
23
|
+
private handleProcessingError;
|
|
24
|
+
startCleanup(): void;
|
|
25
|
+
stopCleanup(): void;
|
|
26
|
+
private cleanup;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=inbox.service.d.ts.map
|
|
@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@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InboxService = exports.InboxEvents = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const inbox_config_1 = require("../config/inbox.config");
|
|
6
|
+
const duplicate_message_error_1 = require("../errors/duplicate-message.error");
|
|
7
|
+
const processing_error_1 = require("../errors/processing.error");
|
|
8
|
+
var InboxEvents;
|
|
9
|
+
(function (InboxEvents) {
|
|
10
|
+
InboxEvents["MESSAGE_RECEIVED"] = "inbox:message:received";
|
|
11
|
+
InboxEvents["MESSAGE_DUPLICATE"] = "inbox:message:duplicate";
|
|
12
|
+
InboxEvents["MESSAGE_PROCESSED"] = "inbox:message:processed";
|
|
13
|
+
InboxEvents["MESSAGE_FAILED"] = "inbox:message:failed";
|
|
14
|
+
})(InboxEvents || (exports.InboxEvents = InboxEvents = {}));
|
|
15
|
+
class InboxService extends events_1.EventEmitter {
|
|
16
|
+
repository;
|
|
17
|
+
config;
|
|
18
|
+
handlers = new Map();
|
|
19
|
+
cleanupTimer;
|
|
20
|
+
constructor(repository, config) {
|
|
21
|
+
super();
|
|
22
|
+
this.repository = repository;
|
|
23
|
+
this.config = { ...inbox_config_1.DEFAULT_INBOX_CONFIG, ...config };
|
|
24
|
+
}
|
|
25
|
+
registerHandler(eventType, handler) {
|
|
26
|
+
const existingHandlers = this.handlers.get(eventType) || [];
|
|
27
|
+
existingHandlers.push(handler);
|
|
28
|
+
this.handlers.set(eventType, existingHandlers);
|
|
29
|
+
}
|
|
30
|
+
unregisterHandler(eventType, handler) {
|
|
31
|
+
const existingHandlers = this.handlers.get(eventType);
|
|
32
|
+
if (!existingHandlers) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const index = existingHandlers.indexOf(handler);
|
|
36
|
+
if (index > -1) {
|
|
37
|
+
existingHandlers.splice(index, 1);
|
|
38
|
+
}
|
|
39
|
+
if (existingHandlers.length === 0) {
|
|
40
|
+
this.handlers.delete(eventType);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async receiveMessage(dto) {
|
|
44
|
+
const result = await this.repository.record(dto);
|
|
45
|
+
if (result.isDuplicate) {
|
|
46
|
+
this.emit(InboxEvents.MESSAGE_DUPLICATE, result.message);
|
|
47
|
+
throw new duplicate_message_error_1.DuplicateMessageError(dto.messageId, dto.source);
|
|
48
|
+
}
|
|
49
|
+
this.emit(InboxEvents.MESSAGE_RECEIVED, result.message);
|
|
50
|
+
await this.processMessage(result.message);
|
|
51
|
+
}
|
|
52
|
+
async processMessage(message) {
|
|
53
|
+
const handlers = this.handlers.get(message.eventType);
|
|
54
|
+
if (!handlers || handlers.length === 0) {
|
|
55
|
+
await this.repository.markProcessed(message.id);
|
|
56
|
+
this.emit(InboxEvents.MESSAGE_PROCESSED, message);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
await this.repository.markProcessing(message.id);
|
|
61
|
+
const results = await Promise.allSettled(handlers.map((handler) => handler(message)));
|
|
62
|
+
const failures = results.filter((r) => r.status === 'rejected');
|
|
63
|
+
if (failures.length > 0) {
|
|
64
|
+
throw failures[0].reason;
|
|
65
|
+
}
|
|
66
|
+
await this.repository.markProcessed(message.id);
|
|
67
|
+
this.emit(InboxEvents.MESSAGE_PROCESSED, message);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
await this.handleProcessingError(message, error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async handleProcessingError(message, error) {
|
|
74
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
75
|
+
await this.repository.markFailed(message.id, errorMessage);
|
|
76
|
+
this.emit(InboxEvents.MESSAGE_FAILED, { message, error });
|
|
77
|
+
if (error instanceof processing_error_1.ProcessingError) {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`Failed to process inbox message ${message.id}: ${errorMessage}`);
|
|
81
|
+
}
|
|
82
|
+
startCleanup() {
|
|
83
|
+
if (this.cleanupTimer) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.cleanupTimer = setInterval(() => {
|
|
87
|
+
void this.cleanup();
|
|
88
|
+
}, this.config.cleanupInterval);
|
|
89
|
+
void this.cleanup();
|
|
90
|
+
}
|
|
91
|
+
stopCleanup() {
|
|
92
|
+
if (this.cleanupTimer) {
|
|
93
|
+
clearInterval(this.cleanupTimer);
|
|
94
|
+
this.cleanupTimer = undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async cleanup() {
|
|
98
|
+
try {
|
|
99
|
+
const cutoffDate = new Date(Date.now() - this.config.retentionDays * 24 * 60 * 60 * 1000);
|
|
100
|
+
const deleted = await this.repository.deleteOlderThan(cutoffDate);
|
|
101
|
+
if (deleted > 0) {
|
|
102
|
+
this.emit('cleanup', { deleted, cutoffDate });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
this.emit('error', error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.InboxService = InboxService;
|
|
111
|
+
//# sourceMappingURL=inbox.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.service.js","sourceRoot":"","sources":["../../src/services/inbox.service.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,yDAA2E;AAC3E,+EAA0E;AAC1E,iEAA6D;AAe7D,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0DAA2C,CAAA;IAC3C,4DAA6C,CAAA;IAC7C,4DAA6C,CAAA;IAC7C,sDAAuC,CAAA;AACzC,CAAC,EALW,WAAW,2BAAX,WAAW,QAKtB;AAMD,MAAa,YAAa,SAAQ,qBAAY;IAMzB;IALF,MAAM,CAAwB;IAC9B,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IACxD,YAAY,CAAkB;IAEtC,YACmB,UAA4B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AAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;YAC1F,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;YAElE,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;gBAChB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAhKD,oCAgKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./inbox.service"), exports);
|
|
18
|
+
__exportStar(require("./outbox.service"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { OutboxConfig } from '../config/outbox.config';
|
|
3
|
+
import { CreateOutboxMessageDto } from '../interfaces/create-outbox-message.dto';
|
|
4
|
+
import { IMessagePublisher } from '../interfaces/message-publisher.interface';
|
|
5
|
+
import { OutboxMessage } from '../interfaces/outbox-message.interface';
|
|
6
|
+
import { IOutboxRepository } from '../interfaces/outbox-repository.interface';
|
|
7
|
+
export declare enum OutboxEvents {
|
|
8
|
+
MESSAGE_CREATED = "outbox:message:created",
|
|
9
|
+
MESSAGE_PUBLISHED = "outbox:message:published",
|
|
10
|
+
MESSAGE_FAILED = "outbox:message:failed",
|
|
11
|
+
POLLING_STARTED = "outbox:polling:started",
|
|
12
|
+
POLLING_STOPPED = "outbox:polling:stopped"
|
|
13
|
+
}
|
|
14
|
+
export declare class OutboxService extends EventEmitter {
|
|
15
|
+
private readonly repository;
|
|
16
|
+
private readonly publisher;
|
|
17
|
+
private readonly config;
|
|
18
|
+
private pollingTimer?;
|
|
19
|
+
private cleanupTimer?;
|
|
20
|
+
private isProcessing;
|
|
21
|
+
constructor(repository: IOutboxRepository, publisher: IMessagePublisher, config?: OutboxConfig);
|
|
22
|
+
createMessage(dto: CreateOutboxMessageDto, transactionContext?: unknown): Promise<OutboxMessage>;
|
|
23
|
+
withTransaction<T>(operation: (context: unknown) => Promise<T>): Promise<T>;
|
|
24
|
+
startPolling(): void;
|
|
25
|
+
stopPolling(): void;
|
|
26
|
+
processMessage(_messageId: string): Promise<void>;
|
|
27
|
+
private pollAndProcess;
|
|
28
|
+
private publishMessage;
|
|
29
|
+
private handlePublishError;
|
|
30
|
+
private startCleanup;
|
|
31
|
+
private cleanup;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=outbox.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.service.d.ts","sourceRoot":"","sources":["../../src/services/outbox.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAyB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAK9E,oBAAY,YAAY;IACtB,eAAe,2BAA2B;IAC1C,iBAAiB,6BAA6B;IAC9C,cAAc,0BAA0B;IACxC,eAAe,2BAA2B;IAC1C,eAAe,2BAA2B;CAC3C;AAMD,qBAAa,aAAc,SAAQ,YAAY;IAO3C,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAP5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,YAAY,CAAC,CAAiB;IACtC,OAAO,CAAC,YAAY,CAAC,CAAiB;IACtC,OAAO,CAAC,YAAY,CAAS;gBAGV,UAAU,EAAE,iBAAiB,EAC7B,SAAS,EAAE,iBAAiB,EAC7C,MAAM,CAAC,EAAE,YAAY;IAUjB,aAAa,CACjB,GAAG,EAAE,sBAAsB,EAC3B,kBAAkB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,aAAa,CAAC;IAoBnB,eAAe,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAOjF,YAAY,IAAI,IAAI;IAoBpB,WAAW,IAAI,IAAI;IAgBb,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YASzC,cAAc;YAoCd,cAAc;YAiBd,kBAAkB;IAmBhC,OAAO,CAAC,YAAY;YAYN,OAAO;CAatB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxService = exports.OutboxEvents = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const outbox_config_1 = require("../config/outbox.config");
|
|
6
|
+
const processing_error_1 = require("../errors/processing.error");
|
|
7
|
+
var OutboxEvents;
|
|
8
|
+
(function (OutboxEvents) {
|
|
9
|
+
OutboxEvents["MESSAGE_CREATED"] = "outbox:message:created";
|
|
10
|
+
OutboxEvents["MESSAGE_PUBLISHED"] = "outbox:message:published";
|
|
11
|
+
OutboxEvents["MESSAGE_FAILED"] = "outbox:message:failed";
|
|
12
|
+
OutboxEvents["POLLING_STARTED"] = "outbox:polling:started";
|
|
13
|
+
OutboxEvents["POLLING_STOPPED"] = "outbox:polling:stopped";
|
|
14
|
+
})(OutboxEvents || (exports.OutboxEvents = OutboxEvents = {}));
|
|
15
|
+
class OutboxService extends events_1.EventEmitter {
|
|
16
|
+
repository;
|
|
17
|
+
publisher;
|
|
18
|
+
config;
|
|
19
|
+
pollingTimer;
|
|
20
|
+
cleanupTimer;
|
|
21
|
+
isProcessing = false;
|
|
22
|
+
constructor(repository, publisher, config) {
|
|
23
|
+
super();
|
|
24
|
+
this.repository = repository;
|
|
25
|
+
this.publisher = publisher;
|
|
26
|
+
this.config = { ...outbox_config_1.DEFAULT_OUTBOX_CONFIG, ...config };
|
|
27
|
+
}
|
|
28
|
+
async createMessage(dto, transactionContext) {
|
|
29
|
+
const message = await this.repository.create({
|
|
30
|
+
...dto,
|
|
31
|
+
maxRetries: dto.maxRetries ?? this.config.maxRetries,
|
|
32
|
+
}, transactionContext);
|
|
33
|
+
if (this.config.immediateProcessing) {
|
|
34
|
+
this.emit(OutboxEvents.MESSAGE_CREATED, message.id);
|
|
35
|
+
}
|
|
36
|
+
return message;
|
|
37
|
+
}
|
|
38
|
+
async withTransaction(operation) {
|
|
39
|
+
return this.repository.withTransaction(operation);
|
|
40
|
+
}
|
|
41
|
+
startPolling() {
|
|
42
|
+
if (this.pollingTimer) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.emit(OutboxEvents.POLLING_STARTED);
|
|
46
|
+
this.pollingTimer = setInterval(() => {
|
|
47
|
+
void this.pollAndProcess();
|
|
48
|
+
}, this.config.pollingInterval);
|
|
49
|
+
void this.pollAndProcess();
|
|
50
|
+
this.startCleanup();
|
|
51
|
+
}
|
|
52
|
+
stopPolling() {
|
|
53
|
+
if (this.pollingTimer) {
|
|
54
|
+
clearInterval(this.pollingTimer);
|
|
55
|
+
this.pollingTimer = undefined;
|
|
56
|
+
this.emit(OutboxEvents.POLLING_STOPPED);
|
|
57
|
+
}
|
|
58
|
+
if (this.cleanupTimer) {
|
|
59
|
+
clearInterval(this.cleanupTimer);
|
|
60
|
+
this.cleanupTimer = undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async processMessage(_messageId) {
|
|
64
|
+
await this.pollAndProcess();
|
|
65
|
+
}
|
|
66
|
+
async pollAndProcess() {
|
|
67
|
+
if (this.isProcessing) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
this.isProcessing = true;
|
|
71
|
+
try {
|
|
72
|
+
const lockTimeout = new Date(Date.now() - this.config.lockTimeoutSeconds * 1000);
|
|
73
|
+
await this.repository.releaseStaleLocks(lockTimeout);
|
|
74
|
+
const messages = await this.repository.fetchAndLockPending(this.config.batchSize, this.config.workerId);
|
|
75
|
+
if (!messages || messages.length === 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
await Promise.all(messages.map((message) => this.publishMessage(message)));
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
this.emit('error', error);
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
this.isProcessing = false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async publishMessage(message) {
|
|
88
|
+
try {
|
|
89
|
+
await this.publisher.publish(message);
|
|
90
|
+
await this.repository.markPublished(message.id);
|
|
91
|
+
this.emit(OutboxEvents.MESSAGE_PUBLISHED, message);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
await this.handlePublishError(message, error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async handlePublishError(message, error) {
|
|
98
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
99
|
+
const isPermanent = error instanceof processing_error_1.ProcessingError;
|
|
100
|
+
if (message.retryCount >= message.maxRetries || isPermanent) {
|
|
101
|
+
await this.repository.markFailed(message.id, errorMessage, true);
|
|
102
|
+
this.emit(OutboxEvents.MESSAGE_FAILED, { message, error, permanent: true });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
await this.repository.markFailed(message.id, errorMessage, false);
|
|
106
|
+
this.emit(OutboxEvents.MESSAGE_FAILED, { message, error, permanent: false });
|
|
107
|
+
}
|
|
108
|
+
startCleanup() {
|
|
109
|
+
this.cleanupTimer = setInterval(() => {
|
|
110
|
+
void this.cleanup();
|
|
111
|
+
}, this.config.cleanupInterval);
|
|
112
|
+
void this.cleanup();
|
|
113
|
+
}
|
|
114
|
+
async cleanup() {
|
|
115
|
+
try {
|
|
116
|
+
const cutoffDate = new Date(Date.now() - this.config.retentionDays * 24 * 60 * 60 * 1000);
|
|
117
|
+
const deleted = await this.repository.deleteOlderThan(cutoffDate);
|
|
118
|
+
if (deleted > 0) {
|
|
119
|
+
this.emit('cleanup', { deleted, cutoffDate });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
this.emit('error', error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.OutboxService = OutboxService;
|
|
128
|
+
//# sourceMappingURL=outbox.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.service.js","sourceRoot":"","sources":["../../src/services/outbox.service.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,2DAA8E;AAC9E,iEAA6D;AAS7D,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,0DAA0C,CAAA;IAC1C,8DAA8C,CAAA;IAC9C,wDAAwC,CAAA;IACxC,0DAA0C,CAAA;IAC1C,0DAA0C,CAAA;AAC5C,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAMD,MAAa,aAAc,SAAQ,qBAAY;IAO1B;IACA;IAPF,MAAM,CAAyB;IACxC,YAAY,CAAkB;IAC9B,YAAY,CAAkB;IAC9B,YAAY,GAAG,KAAK,CAAC;IAE7B,YACmB,UAA6B,EAC7B,SAA4B,EAC7C,MAAqB;QAErB,KAAK,EAAE,CAAC;QAJS,eAAU,GAAV,UAAU,CAAmB;QAC7B,cAAS,GAAT,SAAS,CAAmB;QAI7C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,qCAAqB,EAAE,GAAG,MAAM,EAAE,CAAC;IACxD,CAAC;IAMD,KAAK,CAAC,aAAa,CACjB,GAA2B,EAC3B,kBAA4B;QAE5B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAC1C;YACE,GAAG,GAAG;YACN,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU;SACrD,EACD,kBAAkB,CACnB,CAAC;QAGF,IAAI,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC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