@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.
- package/README.md +1 -1
- package/dist/{RetryPredicate-Cch9NXV3.d.ts → RetryPredicate-BR91-irp.d.ts} +4 -6
- package/dist/{RetryPredicate-cPJPlGbJ.d.cts → RetryPredicate-Drg7hU3-.d.cts} +4 -6
- package/dist/{ServiceClass-Bj3G71L8.d.ts → ServiceClass-C-ZCUQWE.d.ts} +1 -1
- package/dist/{ServiceClass-nnDgfgdL.d.cts → ServiceClass-U0Vk46dN.d.cts} +1 -1
- package/dist/{ShutdownHook-Cx1Rc40s.d.ts → ShutdownHook-BCQgEMUI.d.ts} +1 -1
- package/dist/{ShutdownHook-Ho-CeLu8.d.cts → ShutdownHook-CCtg4Ypg.d.cts} +1 -1
- package/dist/adapters/index.cjs +27 -34
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +3 -3
- package/dist/adapters/index.d.ts +3 -3
- package/dist/adapters/index.js +27 -34
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/pubsub/amqp/index.cjs +22 -6
- package/dist/adapters/pubsub/amqp/index.cjs.map +1 -1
- package/dist/adapters/pubsub/amqp/index.js +22 -6
- package/dist/adapters/pubsub/amqp/index.js.map +1 -1
- package/dist/adapters/pubsub/index.cjs +27 -28
- package/dist/adapters/pubsub/index.cjs.map +1 -1
- package/dist/adapters/pubsub/index.d.cts +3 -6
- package/dist/adapters/pubsub/index.d.ts +3 -6
- package/dist/adapters/pubsub/index.js +27 -28
- 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 +2 -12
- package/dist/adapters/ui/express/index.d.ts +2 -12
- 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 +22 -12
- package/dist/adapters/ui/index.cjs.map +1 -1
- package/dist/adapters/ui/index.d.cts +2 -2
- package/dist/adapters/ui/index.d.ts +2 -2
- package/dist/adapters/ui/index.js +22 -12
- package/dist/adapters/ui/index.js.map +1 -1
- package/dist/adapters/ui/routes/index.cjs +22 -6
- package/dist/adapters/ui/routes/index.cjs.map +1 -1
- package/dist/adapters/ui/routes/index.js +22 -6
- package/dist/adapters/ui/routes/index.js.map +1 -1
- package/dist/contracts/index.d.cts +3 -3
- package/dist/contracts/index.d.ts +3 -3
- package/dist/contracts/kernel/index.d.cts +3 -3
- package/dist/contracts/kernel/index.d.ts +3 -3
- package/dist/index.cjs +22 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/dependency-injection/index.cjs +22 -6
- package/dist/infrastructure/dependency-injection/index.cjs.map +1 -1
- package/dist/infrastructure/dependency-injection/index.d.cts +6 -2
- package/dist/infrastructure/dependency-injection/index.d.ts +6 -2
- package/dist/infrastructure/dependency-injection/index.js +22 -6
- 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.d.cts +2 -2
- package/dist/infrastructure/express/index.d.ts +2 -2
- package/dist/infrastructure/express/index.js +0 -6
- package/dist/infrastructure/express/index.js.map +1 -1
- package/dist/infrastructure/scheduler/index.cjs +22 -6
- package/dist/infrastructure/scheduler/index.cjs.map +1 -1
- package/dist/infrastructure/scheduler/index.js +22 -6
- package/dist/infrastructure/scheduler/index.js.map +1 -1
- package/package.json +1 -1
package/dist/adapters/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
309
|
-
|
|
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
|
|
794
|
-
const
|
|
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
|
|
817
|
+
await this.options.store.commit(key);
|
|
801
818
|
} catch (error) {
|
|
802
|
-
await this.options.store.release
|
|
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;
|