@hemia/core 0.0.7 → 0.0.8
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/dist/hemia-core.esm.js +18 -8
- package/dist/hemia-core.js +18 -8
- package/package.json +5 -4
package/dist/hemia-core.esm.js
CHANGED
|
@@ -322,6 +322,13 @@ class AppFactory {
|
|
|
322
322
|
const app = express();
|
|
323
323
|
app.use(express.json(options.jsonOptions));
|
|
324
324
|
app.use(express.urlencoded({ extended: true, ...options.urlencodedOptions }));
|
|
325
|
+
if (plugins && Array.isArray(plugins) && plugins.length > 0) {
|
|
326
|
+
for (const plugin of plugins) {
|
|
327
|
+
if (plugin && typeof plugin === 'function') {
|
|
328
|
+
await plugin(container);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
325
332
|
if (options.middlewares && Array.isArray(options.middlewares)) {
|
|
326
333
|
options.middlewares.forEach(middleware => {
|
|
327
334
|
app.use(middleware);
|
|
@@ -344,20 +351,23 @@ class AppFactory {
|
|
|
344
351
|
}
|
|
345
352
|
next();
|
|
346
353
|
});
|
|
347
|
-
if (plugins && Array.isArray(plugins) && plugins.length > 0) {
|
|
348
|
-
for (const plugin of plugins) {
|
|
349
|
-
if (plugin && typeof plugin === 'function') {
|
|
350
|
-
await plugin(container);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
354
|
if (!container.isBound(Reflector)) {
|
|
355
355
|
container.bind(Reflector).toSelf().inSingletonScope();
|
|
356
356
|
}
|
|
357
357
|
const autoControllerList = ControllerRegistry.getAll();
|
|
358
|
+
const validAutoControllers = autoControllerList.filter(controllerClass => {
|
|
359
|
+
if (container.isBound(controllerClass)) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
const isManual = Reflect.getMetadata(METADATA_KEYS.MANUAL_REGISTER, controllerClass);
|
|
363
|
+
if (isManual) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
return true;
|
|
367
|
+
});
|
|
358
368
|
const controllers = Array.from(new Set([
|
|
359
369
|
...(options.controllers || []),
|
|
360
|
-
...
|
|
370
|
+
...validAutoControllers,
|
|
361
371
|
]));
|
|
362
372
|
controllers.forEach(controllerClass => {
|
|
363
373
|
if (!container.isBound(controllerClass)) {
|
package/dist/hemia-core.js
CHANGED
|
@@ -324,6 +324,13 @@ class AppFactory {
|
|
|
324
324
|
const app = express();
|
|
325
325
|
app.use(express.json(options.jsonOptions));
|
|
326
326
|
app.use(express.urlencoded({ extended: true, ...options.urlencodedOptions }));
|
|
327
|
+
if (plugins && Array.isArray(plugins) && plugins.length > 0) {
|
|
328
|
+
for (const plugin of plugins) {
|
|
329
|
+
if (plugin && typeof plugin === 'function') {
|
|
330
|
+
await plugin(container);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
327
334
|
if (options.middlewares && Array.isArray(options.middlewares)) {
|
|
328
335
|
options.middlewares.forEach(middleware => {
|
|
329
336
|
app.use(middleware);
|
|
@@ -346,20 +353,23 @@ class AppFactory {
|
|
|
346
353
|
}
|
|
347
354
|
next();
|
|
348
355
|
});
|
|
349
|
-
if (plugins && Array.isArray(plugins) && plugins.length > 0) {
|
|
350
|
-
for (const plugin of plugins) {
|
|
351
|
-
if (plugin && typeof plugin === 'function') {
|
|
352
|
-
await plugin(container);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
356
|
if (!container.isBound(exports.Reflector)) {
|
|
357
357
|
container.bind(exports.Reflector).toSelf().inSingletonScope();
|
|
358
358
|
}
|
|
359
359
|
const autoControllerList = common.ControllerRegistry.getAll();
|
|
360
|
+
const validAutoControllers = autoControllerList.filter(controllerClass => {
|
|
361
|
+
if (container.isBound(controllerClass)) {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
const isManual = Reflect.getMetadata(common.METADATA_KEYS.MANUAL_REGISTER, controllerClass);
|
|
365
|
+
if (isManual) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
return true;
|
|
369
|
+
});
|
|
360
370
|
const controllers = Array.from(new Set([
|
|
361
371
|
...(options.controllers || []),
|
|
362
|
-
...
|
|
372
|
+
...validAutoControllers,
|
|
363
373
|
]));
|
|
364
374
|
controllers.forEach(controllerClass => {
|
|
365
375
|
if (!container.isBound(controllerClass)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hemia/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Core utilities for Hemia projects",
|
|
5
5
|
"main": "dist/hemia-core.js",
|
|
6
6
|
"module": "dist/hemia-core.esm.js",
|
|
@@ -11,16 +11,17 @@
|
|
|
11
11
|
"build": "npm run clean && npm run tscBuild",
|
|
12
12
|
"test": "jest --detectOpenHandles",
|
|
13
13
|
"test:coverage": "jest --coverage",
|
|
14
|
-
"test:watch": "jest --watch"
|
|
14
|
+
"test:watch": "jest --watch",
|
|
15
|
+
"prepublish": "npm run build"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
18
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
18
19
|
"@rollup/plugin-json": "^6.1.0",
|
|
19
20
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
20
|
-
"@hemia/common": "^0.0.
|
|
21
|
+
"@hemia/common": "^0.0.12",
|
|
21
22
|
"@hemia/app-context": "^0.0.6",
|
|
22
23
|
"@hemia/trace-manager": "^0.0.9",
|
|
23
|
-
"@hemia/auth-sdk": "^0.0.
|
|
24
|
+
"@hemia/auth-sdk": "^0.0.11",
|
|
24
25
|
"@types/express": "^5.0.5",
|
|
25
26
|
"express": "^5.1.0",
|
|
26
27
|
"inversify": "^7.10.4",
|