@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.
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 +1 -1
@@ -286,10 +286,10 @@ var DependencyInjection = class _DependencyInjection {
286
286
  }
287
287
  trackAutowireAliasIds(autowire) {
288
288
  const internals = autowire;
289
- const createLegacyServiceId = internals._getLegacyServiceId.bind(autowire);
289
+ const createServiceId = internals._getLegacyServiceId.bind(autowire);
290
290
  const aliasIds = /* @__PURE__ */ new Set();
291
291
  internals._getLegacyServiceId = async (...args) => {
292
- const id = await createLegacyServiceId(...args);
292
+ const id = await createServiceId(...args);
293
293
  if (!this.container.hasAlias(id) && !this.container.hasDefinition(id)) {
294
294
  aliasIds.add(id);
295
295
  }
@@ -806,34 +806,20 @@ var IdempotencyConsumerMiddleware = class {
806
806
  this.options = options;
807
807
  }
808
808
  options;
809
- async handleClaimedKey(key, next) {
810
- const claimed = await this.options.store.claim?.(key);
809
+ async handle(event, next, context) {
810
+ const key = this.options.key?.(event, context) ?? context.eventId;
811
+ const claimed = await this.options.store.claim(key);
811
812
  if (!claimed) {
812
813
  return;
813
814
  }
814
815
  try {
815
816
  await next();
816
- await (this.options.store.commit?.(key) ?? this.options.store.mark(key));
817
+ await this.options.store.commit(key);
817
818
  } catch (error) {
818
- await this.options.store.release?.(key);
819
+ await this.options.store.release(key);
819
820
  throw error;
820
821
  }
821
822
  }
822
- async handleLegacyKey(key, next) {
823
- if (await this.options.store.has(key)) {
824
- return;
825
- }
826
- await next();
827
- await this.options.store.mark(key);
828
- }
829
- async handle(event, next, context) {
830
- const key = this.options.key?.(event, context) ?? context.eventId;
831
- if (this.options.store.claim) {
832
- await this.handleClaimedKey(key, next);
833
- } else {
834
- await this.handleLegacyKey(key, next);
835
- }
836
- }
837
823
  };
838
824
 
839
825
  // src/adapters/pubsub/InMemoryIdempotencyStore.ts
@@ -857,9 +843,6 @@ var InMemoryIdempotencyStore = class {
857
843
  has(key) {
858
844
  return this.handledKeys.has(key);
859
845
  }
860
- mark(key) {
861
- this.handledKeys.add(key);
862
- }
863
846
  };
864
847
 
865
848
  // src/adapters/pubsub/PublisherHookPipeline.ts
@@ -1088,8 +1071,6 @@ var ExpressKernelServer = class {
1088
1071
  options.postControllerMiddlewares
1089
1072
  );
1090
1073
  this.preControllerMiddlewares = this.copy(options.preControllerMiddlewares);
1091
- this.staticHooks = this.copy(options.staticHooks);
1092
- this.swaggerHooks = this.copy(options.swaggerHooks);
1093
1074
  }
1094
1075
  options;
1095
1076
  applicationRequire = createRequire(
@@ -1105,8 +1086,6 @@ var ExpressKernelServer = class {
1105
1086
  postControllerMiddlewares;
1106
1087
  preControllerMiddlewares;
1107
1088
  serverInstance;
1108
- staticHooks;
1109
- swaggerHooks;
1110
1089
  copy(items) {
1111
1090
  return [...items ?? []];
1112
1091
  }
@@ -1264,8 +1243,6 @@ var ExpressKernelServer = class {
1264
1243
  this.applyMiddlewares(app, this.postControllerMiddlewares);
1265
1244
  await this.runHooks(this.afterControllersHooks, app);
1266
1245
  await this.runPhaseHooks("afterControllers", app);
1267
- await this.runHooks(this.swaggerHooks, app);
1268
- await this.runHooks(this.staticHooks, app);
1269
1246
  await this.runPhaseHooks("beforeErrors", app);
1270
1247
  this.applyErrorHandlers(app);
1271
1248
  this.appInstance = app;