@haskou/ddd-kernel 3.0.1 → 4.0.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/README.md +1 -1
- package/dist/{RetryPredicate-DG6jcGCX.d.ts → RetryPredicate-BR91-irp.d.ts} +3 -5
- package/dist/{RetryPredicate-BKlKFvI4.d.cts → RetryPredicate-Drg7hU3-.d.cts} +3 -5
- package/dist/adapters/index.cjs +7 -30
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +7 -30
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/pubsub/amqp/index.cjs +2 -2
- package/dist/adapters/pubsub/amqp/index.cjs.map +1 -1
- package/dist/adapters/pubsub/amqp/index.js +2 -2
- package/dist/adapters/pubsub/amqp/index.js.map +1 -1
- package/dist/adapters/pubsub/index.cjs +7 -24
- package/dist/adapters/pubsub/index.cjs.map +1 -1
- package/dist/adapters/pubsub/index.d.cts +1 -4
- package/dist/adapters/pubsub/index.d.ts +1 -4
- package/dist/adapters/pubsub/index.js +7 -24
- package/dist/adapters/pubsub/index.js.map +1 -1
- package/dist/adapters/ui/express/index.cjs +0 -6
- package/dist/adapters/ui/express/index.cjs.map +1 -1
- package/dist/adapters/ui/express/index.d.cts +0 -10
- package/dist/adapters/ui/express/index.d.ts +0 -10
- package/dist/adapters/ui/express/index.js +0 -6
- package/dist/adapters/ui/express/index.js.map +1 -1
- package/dist/adapters/ui/index.cjs +2 -8
- package/dist/adapters/ui/index.cjs.map +1 -1
- package/dist/adapters/ui/index.js +2 -8
- package/dist/adapters/ui/index.js.map +1 -1
- package/dist/adapters/ui/routes/index.cjs +2 -2
- package/dist/adapters/ui/routes/index.cjs.map +1 -1
- package/dist/adapters/ui/routes/index.js +2 -2
- package/dist/adapters/ui/routes/index.js.map +1 -1
- package/dist/contracts/index.d.cts +1 -1
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/kernel/index.d.cts +1 -1
- package/dist/contracts/kernel/index.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/dependency-injection/index.cjs +2 -2
- package/dist/infrastructure/dependency-injection/index.cjs.map +1 -1
- package/dist/infrastructure/dependency-injection/index.js +2 -2
- package/dist/infrastructure/dependency-injection/index.js.map +1 -1
- package/dist/infrastructure/express/index.cjs +0 -6
- package/dist/infrastructure/express/index.cjs.map +1 -1
- package/dist/infrastructure/express/index.js +0 -6
- package/dist/infrastructure/express/index.js.map +1 -1
- package/dist/infrastructure/scheduler/index.cjs +2 -2
- package/dist/infrastructure/scheduler/index.cjs.map +1 -1
- package/dist/infrastructure/scheduler/index.js +2 -2
- package/dist/infrastructure/scheduler/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ The package separates stable contracts from concrete infrastructure:
|
|
|
42
42
|
at the composition root.
|
|
43
43
|
|
|
44
44
|
Constructor injection is the preferred application pattern. Direct service
|
|
45
|
-
lookup
|
|
45
|
+
lookup is available for composition and integration boundaries, but it is
|
|
46
46
|
not the primary dependency model.
|
|
47
47
|
|
|
48
48
|
## Documentation
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { C as ConsumerExecutionContext } from './ShutdownHook-BCQgEMUI.js';
|
|
2
2
|
|
|
3
3
|
interface IdempotencyStore {
|
|
4
|
-
claim
|
|
5
|
-
commit
|
|
6
|
-
release
|
|
7
|
-
has(key: string): Promise<boolean> | boolean;
|
|
8
|
-
mark(key: string): Promise<void> | void;
|
|
4
|
+
claim(key: string): Promise<boolean> | boolean;
|
|
5
|
+
commit(key: string): Promise<void> | void;
|
|
6
|
+
release(key: string): Promise<void> | void;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
type RetryDelayResolver = (attempt: number, error: unknown, context: ConsumerExecutionContext) => number | Promise<number>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { C as ConsumerExecutionContext } from './ShutdownHook-CCtg4Ypg.cjs';
|
|
2
2
|
|
|
3
3
|
interface IdempotencyStore {
|
|
4
|
-
claim
|
|
5
|
-
commit
|
|
6
|
-
release
|
|
7
|
-
has(key: string): Promise<boolean> | boolean;
|
|
8
|
-
mark(key: string): Promise<void> | void;
|
|
4
|
+
claim(key: string): Promise<boolean> | boolean;
|
|
5
|
+
commit(key: string): Promise<void> | void;
|
|
6
|
+
release(key: string): Promise<void> | void;
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
type RetryDelayResolver = (attempt: number, error: unknown, context: ConsumerExecutionContext) => number | Promise<number>;
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -336,10 +336,10 @@ var DependencyInjection = class _DependencyInjection {
|
|
|
336
336
|
}
|
|
337
337
|
trackAutowireAliasIds(autowire) {
|
|
338
338
|
const internals = autowire;
|
|
339
|
-
const
|
|
339
|
+
const createServiceId = internals._getLegacyServiceId.bind(autowire);
|
|
340
340
|
const aliasIds = /* @__PURE__ */ new Set();
|
|
341
341
|
internals._getLegacyServiceId = async (...args) => {
|
|
342
|
-
const id = await
|
|
342
|
+
const id = await createServiceId(...args);
|
|
343
343
|
if (!this.container.hasAlias(id) && !this.container.hasDefinition(id)) {
|
|
344
344
|
aliasIds.add(id);
|
|
345
345
|
}
|
|
@@ -856,34 +856,20 @@ var IdempotencyConsumerMiddleware = class {
|
|
|
856
856
|
this.options = options;
|
|
857
857
|
}
|
|
858
858
|
options;
|
|
859
|
-
async
|
|
860
|
-
const
|
|
859
|
+
async handle(event, next, context) {
|
|
860
|
+
const key = this.options.key?.(event, context) ?? context.eventId;
|
|
861
|
+
const claimed = await this.options.store.claim(key);
|
|
861
862
|
if (!claimed) {
|
|
862
863
|
return;
|
|
863
864
|
}
|
|
864
865
|
try {
|
|
865
866
|
await next();
|
|
866
|
-
await
|
|
867
|
+
await this.options.store.commit(key);
|
|
867
868
|
} catch (error) {
|
|
868
|
-
await this.options.store.release
|
|
869
|
+
await this.options.store.release(key);
|
|
869
870
|
throw error;
|
|
870
871
|
}
|
|
871
872
|
}
|
|
872
|
-
async handleLegacyKey(key, next) {
|
|
873
|
-
if (await this.options.store.has(key)) {
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
await next();
|
|
877
|
-
await this.options.store.mark(key);
|
|
878
|
-
}
|
|
879
|
-
async handle(event, next, context) {
|
|
880
|
-
const key = this.options.key?.(event, context) ?? context.eventId;
|
|
881
|
-
if (this.options.store.claim) {
|
|
882
|
-
await this.handleClaimedKey(key, next);
|
|
883
|
-
} else {
|
|
884
|
-
await this.handleLegacyKey(key, next);
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
873
|
};
|
|
888
874
|
|
|
889
875
|
// src/adapters/pubsub/InMemoryIdempotencyStore.ts
|
|
@@ -907,9 +893,6 @@ var InMemoryIdempotencyStore = class {
|
|
|
907
893
|
has(key) {
|
|
908
894
|
return this.handledKeys.has(key);
|
|
909
895
|
}
|
|
910
|
-
mark(key) {
|
|
911
|
-
this.handledKeys.add(key);
|
|
912
|
-
}
|
|
913
896
|
};
|
|
914
897
|
|
|
915
898
|
// src/adapters/pubsub/PublisherHookPipeline.ts
|
|
@@ -1138,8 +1121,6 @@ var ExpressKernelServer = class {
|
|
|
1138
1121
|
options.postControllerMiddlewares
|
|
1139
1122
|
);
|
|
1140
1123
|
this.preControllerMiddlewares = this.copy(options.preControllerMiddlewares);
|
|
1141
|
-
this.staticHooks = this.copy(options.staticHooks);
|
|
1142
|
-
this.swaggerHooks = this.copy(options.swaggerHooks);
|
|
1143
1124
|
}
|
|
1144
1125
|
options;
|
|
1145
1126
|
applicationRequire = (0, import_node_module.createRequire)(
|
|
@@ -1155,8 +1136,6 @@ var ExpressKernelServer = class {
|
|
|
1155
1136
|
postControllerMiddlewares;
|
|
1156
1137
|
preControllerMiddlewares;
|
|
1157
1138
|
serverInstance;
|
|
1158
|
-
staticHooks;
|
|
1159
|
-
swaggerHooks;
|
|
1160
1139
|
copy(items) {
|
|
1161
1140
|
return [...items ?? []];
|
|
1162
1141
|
}
|
|
@@ -1314,8 +1293,6 @@ var ExpressKernelServer = class {
|
|
|
1314
1293
|
this.applyMiddlewares(app, this.postControllerMiddlewares);
|
|
1315
1294
|
await this.runHooks(this.afterControllersHooks, app);
|
|
1316
1295
|
await this.runPhaseHooks("afterControllers", app);
|
|
1317
|
-
await this.runHooks(this.swaggerHooks, app);
|
|
1318
|
-
await this.runHooks(this.staticHooks, app);
|
|
1319
1296
|
await this.runPhaseHooks("beforeErrors", app);
|
|
1320
1297
|
this.applyErrorHandlers(app);
|
|
1321
1298
|
this.appInstance = app;
|