@bool-ts/core 1.6.3 → 1.6.5

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.
@@ -91,7 +91,7 @@ export const BoolFactory = async (target, options) => {
91
91
  fetch: () => new Response()
92
92
  });
93
93
  }
94
- const { loaders, middlewares, guards, beforeDispatchers, controllers, afterDispatchers, prefix: modulePrefix, config: moduleConfig } = moduleMetadata;
94
+ const { loaders, middlewares, guards, beforeDispatchers, controllers, afterDispatchers, dependencies, prefix: modulePrefix, config: moduleConfig } = moduleMetadata;
95
95
  // Configuration(s)
96
96
  const { allowLogsMethods, config } = Object.freeze({
97
97
  allowLogsMethods: options?.log?.methods,
@@ -128,6 +128,8 @@ export const BoolFactory = async (target, options) => {
128
128
  Injector.set(key, value);
129
129
  }
130
130
  }
131
+ // Dependencies
132
+ !dependencies || dependencies.map((dependency) => Injector.get(dependency));
131
133
  // Middleware(s)
132
134
  const middlewareGroup = !middlewares
133
135
  ? []
@@ -413,6 +415,7 @@ export const BoolFactory = async (target, options) => {
413
415
  });
414
416
  }
415
417
  catch (error) {
418
+ options.debug && console.error(error);
416
419
  // Set default header(s)
417
420
  context[responseHeadersArgsKey].set("X-Powered-By", "Bool Typescript");
418
421
  return jsonErrorInfer(error, context[responseHeadersArgsKey]);
@@ -15,7 +15,6 @@ export const Injector = new (class {
15
15
  }
16
16
  const ownMetadataKeys = Reflect.getMetadataKeys(definition);
17
17
  if (![injectableKey, controllerKey, middlewareKey, guardKey, dispatcherKey].some((value) => ownMetadataKeys.includes(value))) {
18
- console.error(definition);
19
18
  throw Error("Missing dependency declaration, please check @Injectable() used on dependency(ies).");
20
19
  }
21
20
  // Initialize dependencies injection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bool-ts/core",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -155,6 +155,7 @@ export const BoolFactory = async (target: new (...args: any[]) => unknown, optio
155
155
  beforeDispatchers,
156
156
  controllers,
157
157
  afterDispatchers,
158
+ dependencies,
158
159
  prefix: modulePrefix,
159
160
  config: moduleConfig
160
161
  } = moduleMetadata;
@@ -200,6 +201,9 @@ export const BoolFactory = async (target: new (...args: any[]) => unknown, optio
200
201
  }
201
202
  }
202
203
 
204
+ // Dependencies
205
+ !dependencies || dependencies.map((dependency) => Injector.get(dependency));
206
+
203
207
  // Middleware(s)
204
208
  const middlewareGroup = !middlewares
205
209
  ? []
@@ -629,6 +633,8 @@ export const BoolFactory = async (target: new (...args: any[]) => unknown, optio
629
633
  }
630
634
  );
631
635
  } catch (error) {
636
+ options.debug && console.error(error);
637
+
632
638
  // Set default header(s)
633
639
  context[responseHeadersArgsKey].set("X-Powered-By", "Bool Typescript");
634
640
 
@@ -31,7 +31,6 @@ export const Injector: IInjector = new (class {
31
31
  ownMetadataKeys.includes(value)
32
32
  )
33
33
  ) {
34
- console.error(definition);
35
34
  throw Error("Missing dependency declaration, please check @Injectable() used on dependency(ies).");
36
35
  }
37
36