@haskou/ddd-kernel 3.0.1 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/dist/{RetryPredicate-DG6jcGCX.d.ts → RetryPredicate-BR91-irp.d.ts} +3 -5
  3. package/dist/{RetryPredicate-BKlKFvI4.d.cts → RetryPredicate-Drg7hU3-.d.cts} +3 -5
  4. package/dist/adapters/index.cjs +7 -30
  5. package/dist/adapters/index.cjs.map +1 -1
  6. package/dist/adapters/index.d.cts +1 -1
  7. package/dist/adapters/index.d.ts +1 -1
  8. package/dist/adapters/index.js +7 -30
  9. package/dist/adapters/index.js.map +1 -1
  10. package/dist/adapters/pubsub/amqp/index.cjs +2 -2
  11. package/dist/adapters/pubsub/amqp/index.cjs.map +1 -1
  12. package/dist/adapters/pubsub/amqp/index.js +2 -2
  13. package/dist/adapters/pubsub/amqp/index.js.map +1 -1
  14. package/dist/adapters/pubsub/index.cjs +7 -24
  15. package/dist/adapters/pubsub/index.cjs.map +1 -1
  16. package/dist/adapters/pubsub/index.d.cts +1 -4
  17. package/dist/adapters/pubsub/index.d.ts +1 -4
  18. package/dist/adapters/pubsub/index.js +7 -24
  19. package/dist/adapters/pubsub/index.js.map +1 -1
  20. package/dist/adapters/ui/express/index.cjs +0 -6
  21. package/dist/adapters/ui/express/index.cjs.map +1 -1
  22. package/dist/adapters/ui/express/index.d.cts +0 -10
  23. package/dist/adapters/ui/express/index.d.ts +0 -10
  24. package/dist/adapters/ui/express/index.js +0 -6
  25. package/dist/adapters/ui/express/index.js.map +1 -1
  26. package/dist/adapters/ui/index.cjs +2 -8
  27. package/dist/adapters/ui/index.cjs.map +1 -1
  28. package/dist/adapters/ui/index.js +2 -8
  29. package/dist/adapters/ui/index.js.map +1 -1
  30. package/dist/adapters/ui/routes/index.cjs +2 -2
  31. package/dist/adapters/ui/routes/index.cjs.map +1 -1
  32. package/dist/adapters/ui/routes/index.js +2 -2
  33. package/dist/adapters/ui/routes/index.js.map +1 -1
  34. package/dist/contracts/index.d.cts +1 -1
  35. package/dist/contracts/index.d.ts +1 -1
  36. package/dist/contracts/kernel/index.d.cts +1 -1
  37. package/dist/contracts/kernel/index.d.ts +1 -1
  38. package/dist/index.cjs +2 -2
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +2 -2
  43. package/dist/index.js.map +1 -1
  44. package/dist/infrastructure/dependency-injection/index.cjs +2 -2
  45. package/dist/infrastructure/dependency-injection/index.cjs.map +1 -1
  46. package/dist/infrastructure/dependency-injection/index.js +2 -2
  47. package/dist/infrastructure/dependency-injection/index.js.map +1 -1
  48. package/dist/infrastructure/express/index.cjs +0 -6
  49. package/dist/infrastructure/express/index.cjs.map +1 -1
  50. package/dist/infrastructure/express/index.js +0 -6
  51. package/dist/infrastructure/express/index.js.map +1 -1
  52. package/dist/infrastructure/scheduler/index.cjs +2 -2
  53. package/dist/infrastructure/scheduler/index.cjs.map +1 -1
  54. package/dist/infrastructure/scheduler/index.js +2 -2
  55. package/dist/infrastructure/scheduler/index.js.map +1 -1
  56. package/package.json +2 -2
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 remains available for compatibility and integration boundaries, but it is
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?(key: string): Promise<boolean> | boolean;
5
- commit?(key: string): Promise<void> | void;
6
- release?(key: string): Promise<void> | void;
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?(key: string): Promise<boolean> | boolean;
5
- commit?(key: string): Promise<void> | void;
6
- release?(key: string): Promise<void> | void;
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>;
@@ -336,10 +336,10 @@ var DependencyInjection = class _DependencyInjection {
336
336
  }
337
337
  trackAutowireAliasIds(autowire) {
338
338
  const internals = autowire;
339
- const createLegacyServiceId = internals._getLegacyServiceId.bind(autowire);
339
+ const createServiceId = internals._getLegacyServiceId.bind(autowire);
340
340
  const aliasIds = /* @__PURE__ */ new Set();
341
341
  internals._getLegacyServiceId = async (...args) => {
342
- const id = await createLegacyServiceId(...args);
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 handleClaimedKey(key, next) {
860
- const claimed = await this.options.store.claim?.(key);
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 (this.options.store.commit?.(key) ?? this.options.store.mark(key));
867
+ await this.options.store.commit(key);
867
868
  } catch (error) {
868
- await this.options.store.release?.(key);
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;