@zenofolio/hyper-decor 1.0.75 → 1.0.76
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.
|
@@ -275,6 +275,16 @@ function ensureResolvable(target) {
|
|
|
275
275
|
tsyringe_1.container.register(target, target);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
+
function registerRoutes(target, instance, router, namespace, log) {
|
|
279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
const methods = getMethodMetadataMap(target);
|
|
281
|
+
for (const key of Object.keys(methods)) {
|
|
282
|
+
const route = methods[key].route;
|
|
283
|
+
if (route)
|
|
284
|
+
yield prepareRoute(target, router, route, instance, namespace, log);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
278
288
|
function prepareController(descriptor, context, log) {
|
|
279
289
|
return __awaiter(this, void 0, void 0, function* () {
|
|
280
290
|
var _a;
|
|
@@ -285,12 +295,7 @@ function prepareController(descriptor, context, log) {
|
|
|
285
295
|
yield prepareImportsInternal((_a = metadata.imports) !== null && _a !== void 0 ? _a : [], context, log);
|
|
286
296
|
yield registerInstanceHandlers(instance, target, context.namespace, log);
|
|
287
297
|
applyCommonPipeline(target.name, { use: (...args) => router.use(...args) }, data, log);
|
|
288
|
-
|
|
289
|
-
for (const key of Object.keys(methods)) {
|
|
290
|
-
const route = methods[key].route;
|
|
291
|
-
if (route)
|
|
292
|
-
yield prepareRoute(target, router, route, instance, context.namespace, log);
|
|
293
|
-
}
|
|
298
|
+
yield registerRoutes(target, instance, router, context.namespace, log);
|
|
294
299
|
context.parentRouter.use(context.prefix, router);
|
|
295
300
|
});
|
|
296
301
|
}
|
|
@@ -319,6 +324,8 @@ function prepareModule(descriptor, context, log) {
|
|
|
319
324
|
}, log);
|
|
320
325
|
}
|
|
321
326
|
}
|
|
327
|
+
// Direct routes on module
|
|
328
|
+
yield registerRoutes(target, instance, router, context.namespace, log);
|
|
322
329
|
// Controllers
|
|
323
330
|
if ((_c = metadata.controllers) === null || _c === void 0 ? void 0 : _c.length) {
|
|
324
331
|
for (const c of metadata.controllers) {
|
|
@@ -364,6 +371,8 @@ function prepareApplication(options, Target, log) {
|
|
|
364
371
|
yield prepareImportsInternal((_b = options.imports) !== null && _b !== void 0 ? _b : [], context, log);
|
|
365
372
|
yield registerInstanceHandlers(appInstance, Target, context.namespace, log);
|
|
366
373
|
applyCommonPipeline(Target.name, { use: (...args) => appServer.use(...args) }, data, log);
|
|
374
|
+
// Direct routes on app
|
|
375
|
+
yield registerRoutes(Target, appInstance, appServer, context.namespace, log);
|
|
367
376
|
if ((_c = options.modules) === null || _c === void 0 ? void 0 : _c.length) {
|
|
368
377
|
for (const m of options.modules) {
|
|
369
378
|
const mData = getData(m).metadata;
|