@haskou/ddd-kernel 3.0.0 → 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 (66) hide show
  1. package/README.md +1 -1
  2. package/dist/{RetryPredicate-Cch9NXV3.d.ts → RetryPredicate-BR91-irp.d.ts} +4 -6
  3. package/dist/{RetryPredicate-cPJPlGbJ.d.cts → RetryPredicate-Drg7hU3-.d.cts} +4 -6
  4. package/dist/{ServiceClass-Bj3G71L8.d.ts → ServiceClass-C-ZCUQWE.d.ts} +1 -1
  5. package/dist/{ServiceClass-nnDgfgdL.d.cts → ServiceClass-U0Vk46dN.d.cts} +1 -1
  6. package/dist/{ShutdownHook-Cx1Rc40s.d.ts → ShutdownHook-BCQgEMUI.d.ts} +1 -1
  7. package/dist/{ShutdownHook-Ho-CeLu8.d.cts → ShutdownHook-CCtg4Ypg.d.cts} +1 -1
  8. package/dist/adapters/index.cjs +27 -34
  9. package/dist/adapters/index.cjs.map +1 -1
  10. package/dist/adapters/index.d.cts +3 -3
  11. package/dist/adapters/index.d.ts +3 -3
  12. package/dist/adapters/index.js +27 -34
  13. package/dist/adapters/index.js.map +1 -1
  14. package/dist/adapters/pubsub/amqp/index.cjs +22 -6
  15. package/dist/adapters/pubsub/amqp/index.cjs.map +1 -1
  16. package/dist/adapters/pubsub/amqp/index.js +22 -6
  17. package/dist/adapters/pubsub/amqp/index.js.map +1 -1
  18. package/dist/adapters/pubsub/index.cjs +27 -28
  19. package/dist/adapters/pubsub/index.cjs.map +1 -1
  20. package/dist/adapters/pubsub/index.d.cts +3 -6
  21. package/dist/adapters/pubsub/index.d.ts +3 -6
  22. package/dist/adapters/pubsub/index.js +27 -28
  23. package/dist/adapters/pubsub/index.js.map +1 -1
  24. package/dist/adapters/ui/express/index.cjs +0 -6
  25. package/dist/adapters/ui/express/index.cjs.map +1 -1
  26. package/dist/adapters/ui/express/index.d.cts +2 -12
  27. package/dist/adapters/ui/express/index.d.ts +2 -12
  28. package/dist/adapters/ui/express/index.js +0 -6
  29. package/dist/adapters/ui/express/index.js.map +1 -1
  30. package/dist/adapters/ui/index.cjs +22 -12
  31. package/dist/adapters/ui/index.cjs.map +1 -1
  32. package/dist/adapters/ui/index.d.cts +2 -2
  33. package/dist/adapters/ui/index.d.ts +2 -2
  34. package/dist/adapters/ui/index.js +22 -12
  35. package/dist/adapters/ui/index.js.map +1 -1
  36. package/dist/adapters/ui/routes/index.cjs +22 -6
  37. package/dist/adapters/ui/routes/index.cjs.map +1 -1
  38. package/dist/adapters/ui/routes/index.js +22 -6
  39. package/dist/adapters/ui/routes/index.js.map +1 -1
  40. package/dist/contracts/index.d.cts +3 -3
  41. package/dist/contracts/index.d.ts +3 -3
  42. package/dist/contracts/kernel/index.d.cts +3 -3
  43. package/dist/contracts/kernel/index.d.ts +3 -3
  44. package/dist/index.cjs +22 -6
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.js +22 -6
  49. package/dist/index.js.map +1 -1
  50. package/dist/infrastructure/dependency-injection/index.cjs +22 -6
  51. package/dist/infrastructure/dependency-injection/index.cjs.map +1 -1
  52. package/dist/infrastructure/dependency-injection/index.d.cts +6 -2
  53. package/dist/infrastructure/dependency-injection/index.d.ts +6 -2
  54. package/dist/infrastructure/dependency-injection/index.js +22 -6
  55. package/dist/infrastructure/dependency-injection/index.js.map +1 -1
  56. package/dist/infrastructure/express/index.cjs +0 -6
  57. package/dist/infrastructure/express/index.cjs.map +1 -1
  58. package/dist/infrastructure/express/index.d.cts +2 -2
  59. package/dist/infrastructure/express/index.d.ts +2 -2
  60. package/dist/infrastructure/express/index.js +0 -6
  61. package/dist/infrastructure/express/index.js.map +1 -1
  62. package/dist/infrastructure/scheduler/index.cjs +22 -6
  63. package/dist/infrastructure/scheduler/index.cjs.map +1 -1
  64. package/dist/infrastructure/scheduler/index.js +22 -6
  65. package/dist/infrastructure/scheduler/index.js.map +1 -1
  66. package/package.json +1 -1
@@ -117,7 +117,6 @@ var DependencyInjection = class _DependencyInjection {
117
117
  }
118
118
  options;
119
119
  static configuredInstance;
120
- autowire;
121
120
  loader;
122
121
  container;
123
122
  overrideTokenIds = /* @__PURE__ */ new Map();
@@ -285,14 +284,31 @@ var DependencyInjection = class _DependencyInjection {
285
284
  this.applyValueOverride(override);
286
285
  }
287
286
  }
288
- async processAutowire() {
287
+ trackAutowireAliasIds(autowire) {
288
+ const internals = autowire;
289
+ const createServiceId = internals._getLegacyServiceId.bind(autowire);
290
+ const aliasIds = /* @__PURE__ */ new Set();
291
+ internals._getLegacyServiceId = async (...args) => {
292
+ const id = await createServiceId(...args);
293
+ if (!this.container.hasAlias(id) && !this.container.hasDefinition(id)) {
294
+ aliasIds.add(id);
295
+ }
296
+ return id;
297
+ };
298
+ return aliasIds;
299
+ }
300
+ async processAutowire(autowire) {
289
301
  const previousLogger = this.container.logger;
302
+ const autowireAliasIds = this.trackAutowireAliasIds(autowire);
290
303
  this.container.logger = new AutowireWarningFilter(previousLogger);
291
304
  try {
292
- await this.autowire?.process();
305
+ await autowire.process();
293
306
  } finally {
294
307
  this.container.logger = previousLogger;
295
308
  }
309
+ for (const id of autowireAliasIds) {
310
+ this.aliases.delete(id);
311
+ }
296
312
  }
297
313
  registerParentAliases() {
298
314
  for (const [id, definition] of this.definitions.entries()) {
@@ -305,12 +321,12 @@ var DependencyInjection = class _DependencyInjection {
305
321
  async compile() {
306
322
  if (this.options.containerBuild) {
307
323
  await this.ensureFolderExists(this.options.servicesYamlPath);
308
- this.autowire = new Autowire(this.container);
309
- this.autowire.serviceFile = new ServiceFile(
324
+ const autowire = new Autowire(this.container);
325
+ autowire.serviceFile = new ServiceFile(
310
326
  this.options.servicesYamlPath,
311
327
  false
312
328
  );
313
- await this.processAutowire();
329
+ await this.processAutowire(autowire);
314
330
  } else {
315
331
  this.loader = new YamlFileLoader(this.container);
316
332
  await this.loader.load(this.options.servicesYamlPath);
@@ -790,34 +806,20 @@ var IdempotencyConsumerMiddleware = class {
790
806
  this.options = options;
791
807
  }
792
808
  options;
793
- async handleClaimedKey(key, next) {
794
- 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);
795
812
  if (!claimed) {
796
813
  return;
797
814
  }
798
815
  try {
799
816
  await next();
800
- await (this.options.store.commit?.(key) ?? this.options.store.mark(key));
817
+ await this.options.store.commit(key);
801
818
  } catch (error) {
802
- await this.options.store.release?.(key);
819
+ await this.options.store.release(key);
803
820
  throw error;
804
821
  }
805
822
  }
806
- async handleLegacyKey(key, next) {
807
- if (await this.options.store.has(key)) {
808
- return;
809
- }
810
- await next();
811
- await this.options.store.mark(key);
812
- }
813
- async handle(event, next, context) {
814
- const key = this.options.key?.(event, context) ?? context.eventId;
815
- if (this.options.store.claim) {
816
- await this.handleClaimedKey(key, next);
817
- } else {
818
- await this.handleLegacyKey(key, next);
819
- }
820
- }
821
823
  };
822
824
 
823
825
  // src/adapters/pubsub/InMemoryIdempotencyStore.ts
@@ -841,9 +843,6 @@ var InMemoryIdempotencyStore = class {
841
843
  has(key) {
842
844
  return this.handledKeys.has(key);
843
845
  }
844
- mark(key) {
845
- this.handledKeys.add(key);
846
- }
847
846
  };
848
847
 
849
848
  // src/adapters/pubsub/PublisherHookPipeline.ts
@@ -1072,8 +1071,6 @@ var ExpressKernelServer = class {
1072
1071
  options.postControllerMiddlewares
1073
1072
  );
1074
1073
  this.preControllerMiddlewares = this.copy(options.preControllerMiddlewares);
1075
- this.staticHooks = this.copy(options.staticHooks);
1076
- this.swaggerHooks = this.copy(options.swaggerHooks);
1077
1074
  }
1078
1075
  options;
1079
1076
  applicationRequire = createRequire(
@@ -1089,8 +1086,6 @@ var ExpressKernelServer = class {
1089
1086
  postControllerMiddlewares;
1090
1087
  preControllerMiddlewares;
1091
1088
  serverInstance;
1092
- staticHooks;
1093
- swaggerHooks;
1094
1089
  copy(items) {
1095
1090
  return [...items ?? []];
1096
1091
  }
@@ -1248,8 +1243,6 @@ var ExpressKernelServer = class {
1248
1243
  this.applyMiddlewares(app, this.postControllerMiddlewares);
1249
1244
  await this.runHooks(this.afterControllersHooks, app);
1250
1245
  await this.runPhaseHooks("afterControllers", app);
1251
- await this.runHooks(this.swaggerHooks, app);
1252
- await this.runHooks(this.staticHooks, app);
1253
1246
  await this.runPhaseHooks("beforeErrors", app);
1254
1247
  this.applyErrorHandlers(app);
1255
1248
  this.appInstance = app;