@nathapp/nestjs-outbox 3.3.0
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/.eslintrc.js +8 -0
- package/.nax/features/nestjs-outbox/.nax-acceptance.test.ts +878 -0
- package/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +15 -0
- package/README.md +50 -0
- package/dist/constant/index.d.ts +1 -0
- package/dist/constant/index.js +18 -0
- package/dist/constant/index.js.map +1 -0
- package/dist/constant/outbox.constants.d.ts +3 -0
- package/dist/constant/outbox.constants.js +7 -0
- package/dist/constant/outbox.constants.js.map +1 -0
- package/dist/exception/index.d.ts +3 -0
- package/dist/exception/index.js +20 -0
- package/dist/exception/index.js.map +1 -0
- package/dist/exception/outbox-exception-code.enum.d.ts +4 -0
- package/dist/exception/outbox-exception-code.enum.js +9 -0
- package/dist/exception/outbox-exception-code.enum.js.map +1 -0
- package/dist/exception/outbox-invalid-event.exception.d.ts +4 -0
- package/dist/exception/outbox-invalid-event.exception.js +13 -0
- package/dist/exception/outbox-invalid-event.exception.js.map +1 -0
- package/dist/exception/outbox-misconfigured.exception.d.ts +4 -0
- package/dist/exception/outbox-misconfigured.exception.js +13 -0
- package/dist/exception/outbox-misconfigured.exception.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/interface/index.d.ts +6 -0
- package/dist/interface/index.js +6 -0
- package/dist/interface/index.js.map +1 -0
- package/dist/interface/outbox-module-options.interface.d.ts +16 -0
- package/dist/interface/outbox-module-options.interface.js +3 -0
- package/dist/interface/outbox-module-options.interface.js.map +1 -0
- package/dist/interface/outbox-publisher.interface.d.ts +4 -0
- package/dist/interface/outbox-publisher.interface.js +3 -0
- package/dist/interface/outbox-publisher.interface.js.map +1 -0
- package/dist/interface/outbox-record.interface.d.ts +21 -0
- package/dist/interface/outbox-record.interface.js +3 -0
- package/dist/interface/outbox-record.interface.js.map +1 -0
- package/dist/interface/outbox-status.enum.d.ts +6 -0
- package/dist/interface/outbox-status.enum.js +11 -0
- package/dist/interface/outbox-status.enum.js.map +1 -0
- package/dist/interface/outbox-store.interface.d.ts +8 -0
- package/dist/interface/outbox-store.interface.js +3 -0
- package/dist/interface/outbox-store.interface.js.map +1 -0
- package/dist/module/index.d.ts +1 -0
- package/dist/module/index.js +18 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/outbox.module.d.ts +10 -0
- package/dist/module/outbox.module.js +63 -0
- package/dist/module/outbox.module.js.map +1 -0
- package/dist/provider/in-memory-outbox-store.d.ts +12 -0
- package/dist/provider/in-memory-outbox-store.js +97 -0
- package/dist/provider/in-memory-outbox-store.js.map +1 -0
- package/dist/provider/index.d.ts +4 -0
- package/dist/provider/index.js +21 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/outbox-relay.d.ts +20 -0
- package/dist/provider/outbox-relay.js +129 -0
- package/dist/provider/outbox-relay.js.map +1 -0
- package/dist/provider/outbox.service.d.ts +12 -0
- package/dist/provider/outbox.service.js +68 -0
- package/dist/provider/outbox.service.js.map +1 -0
- package/dist/provider/resolve-outbox-options.d.ts +29 -0
- package/dist/provider/resolve-outbox-options.js +34 -0
- package/dist/provider/resolve-outbox-options.js.map +1 -0
- package/dist/util/compute-backoff.d.ts +1 -0
- package/dist/util/compute-backoff.js +8 -0
- package/dist/util/compute-backoff.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +18 -0
- package/dist/util/index.js.map +1 -0
- package/lib/constant/index.ts +1 -0
- package/lib/constant/outbox.constants.ts +3 -0
- package/lib/exception/index.ts +3 -0
- package/lib/exception/outbox-exception-code.enum.ts +4 -0
- package/lib/exception/outbox-invalid-event.exception.ts +9 -0
- package/lib/exception/outbox-misconfigured.exception.ts +9 -0
- package/lib/index.ts +6 -0
- package/lib/interface/index.ts +18 -0
- package/lib/interface/outbox-module-options.interface.ts +18 -0
- package/lib/interface/outbox-publisher.interface.ts +5 -0
- package/lib/interface/outbox-record.interface.ts +23 -0
- package/lib/interface/outbox-status.enum.ts +6 -0
- package/lib/interface/outbox-store.interface.ts +23 -0
- package/lib/module/index.ts +1 -0
- package/lib/module/outbox.module.ts +64 -0
- package/lib/provider/in-memory-outbox-store.ts +114 -0
- package/lib/provider/index.ts +4 -0
- package/lib/provider/outbox-relay.ts +147 -0
- package/lib/provider/outbox.service.ts +70 -0
- package/lib/provider/resolve-outbox-options.ts +51 -0
- package/lib/util/compute-backoff.ts +4 -0
- package/lib/util/index.ts +1 -0
- package/package.json +48 -0
- package/test/barrel/index.spec.ts +45 -0
- package/test/constant/outbox.constants.spec.ts +20 -0
- package/test/e2e/outbox.module.spec.ts +371 -0
- package/test/exception/outbox.exceptions.spec.ts +38 -0
- package/test/interface/outbox-status.enum.spec.ts +19 -0
- package/test/jest-nax-setup.js +31 -0
- package/test/jest-nax.json +30 -0
- package/test/jest-test.json +28 -0
- package/test/module/outbox.module.spec.ts +139 -0
- package/test/provider/in-memory-outbox-store.spec.ts +216 -0
- package/test/provider/outbox-relay.spec.ts +565 -0
- package/test/provider/outbox-service.spec.ts +229 -0
- package/test/provider/resolve-outbox-options.spec.ts +50 -0
- package/test/util/compute-backoff.spec.ts +25 -0
- package/tsconfig.json +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @nathapp/nestjs-outbox
|
|
2
|
+
|
|
3
|
+
## 3.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a27440f: 3.3.0 milestone release. The `@nathapp/nestjs-*` packages now version and publish in lockstep at a unified version.
|
|
8
|
+
|
|
9
|
+
- **nestjs-csrf**: first public release — stateless double-submit-cookie CSRF guard (zero-dep HMAC, Express + Fastify, Bearer coexist skip, `@SkipCsrf()`, auto-binds `APP_GUARD`).
|
|
10
|
+
- **nestjs-health**: first public release — terminus aggregator over cache/prisma/queue with k8s liveness/readiness probes via a dynamic controller factory.
|
|
11
|
+
- **nestjs-idempotency**: first public release — `@Idempotent()` interceptor (zero-dep sha256 fingerprint, Express + Fastify, 409-in-flight, 2xx replay, fingerprint mismatch 422, fail-closed on store error).
|
|
12
|
+
- **nestjs-observability**: first public release — Prometheus RED metrics + OpenTelemetry tracing joined to the logging ALS; `initTracing()` pre-bootstrap hook.
|
|
13
|
+
- **nestjs-outbox**: first public release — transactional outbox relay (at-least-once via `ITransactionManager`, lease-claim + backoff, dead-letter).
|
|
14
|
+
- **nestjs-storage**: migrated from aws-sdk v2 to v3 (zero runtime dep via `import type` + lazy `loadPackage`); NFSStorage stub replaced with an S3-style HTTP file-service client.
|
|
15
|
+
- **nestjs-cache**: `delByPattern` now routes through Redis SCAN instead of an O(n) key sweep, with glob-detection and multi-tier iterator support.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# @nathapp/nestjs-outbox
|
|
2
|
+
|
|
3
|
+
Transactional outbox for NestJS. Record domain events into an outbox store
|
|
4
|
+
**inside the caller's existing database transaction** — the same transaction that
|
|
5
|
+
persists the business change — then let a background relay publish them
|
|
6
|
+
**at-least-once** to a message broker. No dual-write inconsistency.
|
|
7
|
+
|
|
8
|
+
Zero runtime dependencies. Pure seams: you supply the store (a transactional
|
|
9
|
+
Prisma/SQL table) and the publisher (e.g. `@nathapp/nestjs-queue`); the package
|
|
10
|
+
owns the write API, the relay engine, and the contracts.
|
|
11
|
+
|
|
12
|
+
## Why
|
|
13
|
+
|
|
14
|
+
A service that writes to its database and then publishes to a broker has two
|
|
15
|
+
independent operations. If the process dies between them, the state and the event
|
|
16
|
+
diverge. The outbox pattern removes the second write from the critical path: the
|
|
17
|
+
event is persisted atomically with the business change, and a separate relay
|
|
18
|
+
delivers it later, retrying until it succeeds.
|
|
19
|
+
|
|
20
|
+
## Design at a glance
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
txManager.run(async () => {
|
|
24
|
+
await businessRepo.create(...) // business change
|
|
25
|
+
await outbox.record({ type, payload }) // outbox row, SAME transaction
|
|
26
|
+
}) // commit => both durable, or neither
|
|
27
|
+
|
|
28
|
+
OutboxRelay (every pollIntervalMs, or driven from your own cron)
|
|
29
|
+
claimBatch(batchSize, leaseMs) -> publish -> markPublished | markRetry(backoff) | markDead
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **Write path** enrolls in the active transaction via `ITransactionManager`
|
|
33
|
+
(`@nathapp/nestjs-data`) and is **fail-closed**: if the event cannot be
|
|
34
|
+
recorded, the business transaction rolls back.
|
|
35
|
+
- **Relay** is **best-effort background** work: it claims records under a lease
|
|
36
|
+
(crash-safe), publishes each via `IOutboxPublisher`, and on repeated failure
|
|
37
|
+
applies exponential backoff, giving up to a dead-letter state after
|
|
38
|
+
`maxAttempts`. Cycle errors are logged, never fatal.
|
|
39
|
+
- **At-least-once** delivery: pair the consumer with `@nathapp/nestjs-idempotency`
|
|
40
|
+
to dedup.
|
|
41
|
+
|
|
42
|
+
## Seams you implement
|
|
43
|
+
|
|
44
|
+
| Seam | Bind to | Responsibility |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `IOutboxStore` | a transactional table (Prisma/SQL) | `save(record, client)`, `claimBatch`, `markPublished`, `markRetry`, `markDead` |
|
|
47
|
+
| `IOutboxPublisher` | your broker (e.g. `QueueService`) | `publish(record)` |
|
|
48
|
+
|
|
49
|
+
An `InMemoryOutboxStore` is provided for tests and demos only — it is **not**
|
|
50
|
+
transactional and must not be used in production.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './outbox.constants';
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./outbox.constants"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OUTBOX_MODULE_OPTIONS = exports.OUTBOX_PUBLISHER = exports.OUTBOX_STORE = void 0;
|
|
4
|
+
exports.OUTBOX_STORE = Symbol.for('OUTBOX_STORE');
|
|
5
|
+
exports.OUTBOX_PUBLISHER = Symbol.for('OUTBOX_PUBLISHER');
|
|
6
|
+
exports.OUTBOX_MODULE_OPTIONS = 'OUTBOX_MODULE_OPTIONS';
|
|
7
|
+
//# sourceMappingURL=outbox.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.constants.js","sourceRoot":"","sources":["../../lib/constant/outbox.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC1C,QAAA,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAClD,QAAA,qBAAqB,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./outbox-exception-code.enum"), exports);
|
|
18
|
+
__exportStar(require("./outbox-invalid-event.exception"), exports);
|
|
19
|
+
__exportStar(require("./outbox-misconfigured.exception"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/exception/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,mEAAiD;AACjD,mEAAiD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxExceptionCode = void 0;
|
|
4
|
+
var OutboxExceptionCode;
|
|
5
|
+
(function (OutboxExceptionCode) {
|
|
6
|
+
OutboxExceptionCode[OutboxExceptionCode["INVALID_EVENT_TYPE"] = 40010] = "INVALID_EVENT_TYPE";
|
|
7
|
+
OutboxExceptionCode[OutboxExceptionCode["PUBLISHER_NOT_CONFIGURED"] = 50010] = "PUBLISHER_NOT_CONFIGURED";
|
|
8
|
+
})(OutboxExceptionCode || (exports.OutboxExceptionCode = OutboxExceptionCode = {}));
|
|
9
|
+
//# sourceMappingURL=outbox-exception-code.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-exception-code.enum.js","sourceRoot":"","sources":["../../lib/exception/outbox-exception-code.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,6FAA0B,CAAA;IAC1B,yGAAgC,CAAA;AAClC,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxInvalidEventException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
6
|
+
const outbox_exception_code_enum_1 = require("./outbox-exception-code.enum");
|
|
7
|
+
class OutboxInvalidEventException extends nestjs_common_1.AppException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(outbox_exception_code_enum_1.OutboxExceptionCode.INVALID_EVENT_TYPE, undefined, undefined, common_1.HttpStatus.BAD_REQUEST);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.OutboxInvalidEventException = OutboxInvalidEventException;
|
|
13
|
+
//# sourceMappingURL=outbox-invalid-event.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-invalid-event.exception.js","sourceRoot":"","sources":["../../lib/exception/outbox-invalid-event.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,0DAAsD;AACtD,6EAAmE;AAEnE,MAAa,2BAA4B,SAAQ,4BAAY;IAC3D;QACE,KAAK,CAAC,gDAAmB,CAAC,kBAAkB,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;IAC9F,CAAC;CACF;AAJD,kEAIC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxMisconfiguredException = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
6
|
+
const outbox_exception_code_enum_1 = require("./outbox-exception-code.enum");
|
|
7
|
+
class OutboxMisconfiguredException extends nestjs_common_1.AppException {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(outbox_exception_code_enum_1.OutboxExceptionCode.PUBLISHER_NOT_CONFIGURED, undefined, undefined, common_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.OutboxMisconfiguredException = OutboxMisconfiguredException;
|
|
13
|
+
//# sourceMappingURL=outbox-misconfigured.exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-misconfigured.exception.js","sourceRoot":"","sources":["../../lib/exception/outbox-misconfigured.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,0DAAsD;AACtD,6EAAmE;AAEnE,MAAa,4BAA6B,SAAQ,4BAAY;IAC5D;QACE,KAAK,CAAC,gDAAmB,CAAC,wBAAwB,EAAE,SAAS,EAAE,SAAS,EAAE,mBAAU,CAAC,qBAAqB,CAAC,CAAC;IAC9G,CAAC;CACF;AAJD,oEAIC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
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("./constant"), exports);
|
|
18
|
+
__exportStar(require("./exception"), exports);
|
|
19
|
+
__exportStar(require("./interface"), exports);
|
|
20
|
+
__exportStar(require("./module"), exports);
|
|
21
|
+
__exportStar(require("./provider"), exports);
|
|
22
|
+
__exportStar(require("./util"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,2CAAyB;AACzB,6CAA2B;AAC3B,yCAAuB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OutboxRecord, OutboxEventInput } from './outbox-record.interface';
|
|
2
|
+
import { OutboxStatus } from './outbox-status.enum';
|
|
3
|
+
import { IOutboxStore } from './outbox-store.interface';
|
|
4
|
+
import { IOutboxPublisher } from './outbox-publisher.interface';
|
|
5
|
+
import { OutboxRelayOptions, OutboxModuleOptions } from './outbox-module-options.interface';
|
|
6
|
+
export { OutboxStatus, OutboxRecord, OutboxEventInput, IOutboxStore, IOutboxPublisher, OutboxRelayOptions, OutboxModuleOptions, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxStatus = void 0;
|
|
4
|
+
const outbox_status_enum_1 = require("./outbox-status.enum");
|
|
5
|
+
Object.defineProperty(exports, "OutboxStatus", { enumerable: true, get: function () { return outbox_status_enum_1.OutboxStatus; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/interface/index.ts"],"names":[],"mappings":";;;AACA,6DAAoD;AASlD,6FATO,iCAAY,OASP"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IOutboxStore } from './outbox-store.interface';
|
|
2
|
+
import { IOutboxPublisher } from './outbox-publisher.interface';
|
|
3
|
+
export interface OutboxRelayOptions {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
pollIntervalMs?: number;
|
|
6
|
+
batchSize?: number;
|
|
7
|
+
leaseMs?: number;
|
|
8
|
+
maxAttempts?: number;
|
|
9
|
+
backoffBaseMs?: number;
|
|
10
|
+
backoffCapMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OutboxModuleOptions {
|
|
13
|
+
store?: IOutboxStore;
|
|
14
|
+
publisher?: IOutboxPublisher;
|
|
15
|
+
relay?: OutboxRelayOptions;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-module-options.interface.js","sourceRoot":"","sources":["../../lib/interface/outbox-module-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-publisher.interface.js","sourceRoot":"","sources":["../../lib/interface/outbox-publisher.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OutboxStatus } from './outbox-status.enum';
|
|
2
|
+
export interface OutboxRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
payload: unknown;
|
|
6
|
+
status: OutboxStatus;
|
|
7
|
+
attempts: number;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
nextAttemptAt: Date;
|
|
10
|
+
leaseUntil?: Date;
|
|
11
|
+
owner?: string;
|
|
12
|
+
publishedAt?: Date;
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
metadata?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface OutboxEventInput {
|
|
17
|
+
type: string;
|
|
18
|
+
payload: unknown;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-record.interface.js","sourceRoot":"","sources":["../../lib/interface/outbox-record.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OutboxStatus = void 0;
|
|
4
|
+
var OutboxStatus;
|
|
5
|
+
(function (OutboxStatus) {
|
|
6
|
+
OutboxStatus["PENDING"] = "pending";
|
|
7
|
+
OutboxStatus["PROCESSING"] = "processing";
|
|
8
|
+
OutboxStatus["PUBLISHED"] = "published";
|
|
9
|
+
OutboxStatus["DEAD"] = "dead";
|
|
10
|
+
})(OutboxStatus || (exports.OutboxStatus = OutboxStatus = {}));
|
|
11
|
+
//# sourceMappingURL=outbox-status.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-status.enum.js","sourceRoot":"","sources":["../../lib/interface/outbox-status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,6BAAa,CAAA;AACf,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OutboxRecord } from './outbox-record.interface';
|
|
2
|
+
export interface IOutboxStore {
|
|
3
|
+
save(record: OutboxRecord, client: unknown): Promise<void>;
|
|
4
|
+
claimBatch(limit: number, leaseMs: number, now: Date, owner: string): Promise<OutboxRecord[]>;
|
|
5
|
+
markPublished(id: string, publishedAt: Date, owner: string): Promise<void>;
|
|
6
|
+
markRetry(id: string, attempts: number, nextAttemptAt: Date, owner: string): Promise<void>;
|
|
7
|
+
markDead(id: string, attempts: number, owner: string): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox-store.interface.js","sourceRoot":"","sources":["../../lib/interface/outbox-store.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './outbox.module';
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./outbox.module"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/module/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
import { ConfigurableModuleClass } from '@nathapp/nestjs-common';
|
|
3
|
+
import { OutboxModuleOptions } from '../interface/outbox-module-options.interface';
|
|
4
|
+
export type OutboxRegisterAsyncOptions = Parameters<ReturnType<typeof ConfigurableModuleClass<OutboxModuleOptions>>['registerAsync']>[0];
|
|
5
|
+
declare const OutboxModule_base: import("@nathapp/nestjs-common").ConfigurableModuleCls<OutboxModuleOptions, "register", "createOptions", {}>;
|
|
6
|
+
export declare class OutboxModule extends OutboxModule_base {
|
|
7
|
+
static register(options?: OutboxModuleOptions): DynamicModule;
|
|
8
|
+
static registerAsync(options: OutboxRegisterAsyncOptions): DynamicModule;
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.OutboxModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
12
|
+
const outbox_relay_1 = require("../provider/outbox-relay");
|
|
13
|
+
const outbox_service_1 = require("../provider/outbox.service");
|
|
14
|
+
const resolve_outbox_options_1 = require("../provider/resolve-outbox-options");
|
|
15
|
+
const outbox_constants_1 = require("../constant/outbox.constants");
|
|
16
|
+
const OUTBOX_RESOLVED_OPTIONS = Symbol.for('OUTBOX_RESOLVED_OPTIONS');
|
|
17
|
+
let OutboxModule = class OutboxModule extends (0, nestjs_common_1.ConfigurableModuleClass)(outbox_constants_1.OUTBOX_MODULE_OPTIONS) {
|
|
18
|
+
static register(options) {
|
|
19
|
+
return buildDynamicModule(super.register(options));
|
|
20
|
+
}
|
|
21
|
+
static registerAsync(options) {
|
|
22
|
+
return buildDynamicModule(super.registerAsync(options));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.OutboxModule = OutboxModule;
|
|
26
|
+
exports.OutboxModule = OutboxModule = __decorate([
|
|
27
|
+
(0, common_1.Module)({})
|
|
28
|
+
], OutboxModule);
|
|
29
|
+
const buildDynamicModule = (base) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
return ({
|
|
32
|
+
...base,
|
|
33
|
+
module: OutboxModule,
|
|
34
|
+
global: true,
|
|
35
|
+
providers: [...((_a = base.providers) !== null && _a !== void 0 ? _a : []), ...outboxOptionProviders(), outbox_service_1.OutboxService, outbox_relay_1.OutboxRelay],
|
|
36
|
+
exports: [
|
|
37
|
+
...((_b = base.exports) !== null && _b !== void 0 ? _b : []),
|
|
38
|
+
outbox_constants_1.OUTBOX_MODULE_OPTIONS,
|
|
39
|
+
outbox_constants_1.OUTBOX_STORE,
|
|
40
|
+
outbox_constants_1.OUTBOX_PUBLISHER,
|
|
41
|
+
outbox_service_1.OutboxService,
|
|
42
|
+
outbox_relay_1.OutboxRelay,
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const outboxOptionProviders = () => [
|
|
47
|
+
{
|
|
48
|
+
provide: OUTBOX_RESOLVED_OPTIONS,
|
|
49
|
+
useFactory: (raw) => (0, resolve_outbox_options_1.resolveOutboxOptions)(raw),
|
|
50
|
+
inject: [outbox_constants_1.OUTBOX_MODULE_OPTIONS],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
provide: outbox_constants_1.OUTBOX_STORE,
|
|
54
|
+
useFactory: (resolved) => resolved.store,
|
|
55
|
+
inject: [OUTBOX_RESOLVED_OPTIONS],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
provide: outbox_constants_1.OUTBOX_PUBLISHER,
|
|
59
|
+
useFactory: (resolved) => resolved.publisher,
|
|
60
|
+
inject: [OUTBOX_RESOLVED_OPTIONS],
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
//# sourceMappingURL=outbox.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.module.js","sourceRoot":"","sources":["../../lib/module/outbox.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAiE;AACjE,0DAAiE;AAEjE,2DAAuD;AACvD,+DAA2D;AAC3D,+EAAiG;AACjG,mEAIsC;AAMtC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAG/D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,uCAAuB,EACvD,wCAAqB,CACtB;IACC,MAAM,CAAC,QAAQ,CAAC,OAA6B;QAC3C,OAAO,kBAAkB,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,OAAmC;QACtD,OAAO,kBAAkB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF,CAAA;AAVY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,YAAY,CAUxB;AAED,MAAM,kBAAkB,GAAG,CAAC,IAAmB,EAAiB,EAAE;;IAAC,OAAA,CAAC;QAClE,GAAG,IAAI;QACP,MAAM,EAAE,YAAY;QACpB,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,SAAS,mCAAI,EAAE,CAAC,EAAE,GAAG,qBAAqB,EAAE,EAAE,8BAAa,EAAE,0BAAW,CAAC;QAC9F,OAAO,EAAE;YACP,GAAG,CAAC,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC;YACvB,wCAAqB;YACrB,+BAAY;YACZ,mCAAgB;YAChB,8BAAa;YACb,0BAAW;SACZ;KACF,CAAC,CAAA;CAAA,CAAC;AAEH,MAAM,qBAAqB,GAAG,GAAe,EAAE,CAAC;IAC9C;QACE,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE,CAAC,GAAoC,EAAyB,EAAE,CAC1E,IAAA,6CAAoB,EAAC,GAAG,CAAC;QAC3B,MAAM,EAAE,CAAC,wCAAqB,CAAC;KAChC;IACD;QACE,OAAO,EAAE,+BAAY;QACrB,UAAU,EAAE,CAAC,QAA+B,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK;QAC/D,MAAM,EAAE,CAAC,uBAAuB,CAAC;KAClC;IACD;QACE,OAAO,EAAE,mCAAgB;QACzB,UAAU,EAAE,CAAC,QAA+B,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS;QACnE,MAAM,EAAE,CAAC,uBAAuB,CAAC;KAClC;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IOutboxStore } from '../interface/outbox-store.interface';
|
|
2
|
+
import { OutboxRecord } from '../interface/outbox-record.interface';
|
|
3
|
+
export declare class InMemoryOutboxStore implements IOutboxStore {
|
|
4
|
+
private readonly map;
|
|
5
|
+
save(record: OutboxRecord, _client: unknown): Promise<void>;
|
|
6
|
+
claimBatch(limit: number, leaseMs: number, now: Date, owner: string): Promise<OutboxRecord[]>;
|
|
7
|
+
markPublished(id: string, publishedAt: Date, owner: string): Promise<void>;
|
|
8
|
+
markRetry(id: string, attempts: number, nextAttemptAt: Date, owner: string): Promise<void>;
|
|
9
|
+
markDead(id: string, attempts: number, owner: string): Promise<void>;
|
|
10
|
+
private assertOwned;
|
|
11
|
+
private isClaimable;
|
|
12
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryOutboxStore = void 0;
|
|
4
|
+
const outbox_status_enum_1 = require("../interface/outbox-status.enum");
|
|
5
|
+
class InMemoryOutboxStore {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.map = new Map();
|
|
8
|
+
}
|
|
9
|
+
async save(record, _client) {
|
|
10
|
+
this.map.set(record.id, { ...record });
|
|
11
|
+
}
|
|
12
|
+
async claimBatch(limit, leaseMs, now, owner) {
|
|
13
|
+
const leaseUntil = new Date(now.getTime() + leaseMs);
|
|
14
|
+
const claimed = [];
|
|
15
|
+
for (const record of this.map.values()) {
|
|
16
|
+
if (claimed.length >= limit) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
if (!this.isClaimable(record, now)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const updated = {
|
|
23
|
+
...record,
|
|
24
|
+
status: outbox_status_enum_1.OutboxStatus.PROCESSING,
|
|
25
|
+
owner,
|
|
26
|
+
leaseUntil,
|
|
27
|
+
};
|
|
28
|
+
this.map.set(record.id, updated);
|
|
29
|
+
claimed.push({ ...updated });
|
|
30
|
+
}
|
|
31
|
+
return claimed;
|
|
32
|
+
}
|
|
33
|
+
async markPublished(id, publishedAt, owner) {
|
|
34
|
+
const existing = this.assertOwned(id, owner);
|
|
35
|
+
if (existing === undefined) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.map.set(id, {
|
|
39
|
+
...existing,
|
|
40
|
+
status: outbox_status_enum_1.OutboxStatus.PUBLISHED,
|
|
41
|
+
publishedAt,
|
|
42
|
+
leaseUntil: undefined,
|
|
43
|
+
owner: undefined,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async markRetry(id, attempts, nextAttemptAt, owner) {
|
|
47
|
+
const existing = this.assertOwned(id, owner);
|
|
48
|
+
if (existing === undefined) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.map.set(id, {
|
|
52
|
+
...existing,
|
|
53
|
+
status: outbox_status_enum_1.OutboxStatus.PENDING,
|
|
54
|
+
attempts,
|
|
55
|
+
nextAttemptAt,
|
|
56
|
+
leaseUntil: undefined,
|
|
57
|
+
owner: undefined,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async markDead(id, attempts, owner) {
|
|
61
|
+
const existing = this.assertOwned(id, owner);
|
|
62
|
+
if (existing === undefined) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.map.set(id, {
|
|
66
|
+
...existing,
|
|
67
|
+
status: outbox_status_enum_1.OutboxStatus.DEAD,
|
|
68
|
+
attempts,
|
|
69
|
+
leaseUntil: undefined,
|
|
70
|
+
owner: undefined,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
assertOwned(id, owner) {
|
|
74
|
+
const existing = this.map.get(id);
|
|
75
|
+
if (existing === undefined) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
if (existing.owner !== owner) {
|
|
79
|
+
throw new Error(`outbox record "${id}" is no longer held by lease owner "${owner}" (lease reclaimed)`);
|
|
80
|
+
}
|
|
81
|
+
return existing;
|
|
82
|
+
}
|
|
83
|
+
isClaimable(record, now) {
|
|
84
|
+
if (record.status === outbox_status_enum_1.OutboxStatus.PUBLISHED || record.status === outbox_status_enum_1.OutboxStatus.DEAD) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (record.status === outbox_status_enum_1.OutboxStatus.PENDING) {
|
|
88
|
+
return record.nextAttemptAt.getTime() <= now.getTime();
|
|
89
|
+
}
|
|
90
|
+
if (record.status === outbox_status_enum_1.OutboxStatus.PROCESSING) {
|
|
91
|
+
return record.leaseUntil !== undefined && record.leaseUntil.getTime() <= now.getTime();
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.InMemoryOutboxStore = InMemoryOutboxStore;
|
|
97
|
+
//# sourceMappingURL=in-memory-outbox-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-outbox-store.js","sourceRoot":"","sources":["../../lib/provider/in-memory-outbox-store.ts"],"names":[],"mappings":"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"}
|