@xrystal/core 3.13.0 → 3.13.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.13.0",
4
+ "version": "3.13.3",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -70,8 +70,8 @@ export default class LoggerService {
70
70
  connectKafka();
71
71
  }
72
72
  this.winstonLoader({
73
- loadPath: config?.loadPath || "./logs",
74
- loggerLevel: config?.loggerLevel || "debug"
73
+ loadPath: config?.loadPath,
74
+ loggerLevel: config?.loggerLevel
75
75
  });
76
76
  };
77
77
  safeReplacer = (key, value) => {
@@ -50,7 +50,7 @@ const coreLoader = async ({}) => {
50
50
  {
51
51
  service: LocalizationsService,
52
52
  props: {
53
- loadPath: path.resolve(rootFolderPath, configs.loaders.localization.loadPath),
53
+ loadPath: path.join(rootFolderPath, configs.loaders.localization.loadPath),
54
54
  fallbackLang: configs.loaders.localization.fallbackLang,
55
55
  preloadLang: configs.loaders.localization.preloadLangs
56
56
  }
@@ -11,7 +11,7 @@ export declare class X {
11
11
  } | {
12
12
  service: any;
13
13
  props?: any;
14
- }[]): Promise<this>;
14
+ }[], verbose?: boolean): Promise<this>;
15
15
  get<T>(target: string | any): T;
16
16
  get cradle(): any;
17
17
  private isRegistered;
@@ -8,7 +8,7 @@ export class X {
8
8
  strict: true
9
9
  });
10
10
  }
11
- load(patterns, verbose = true) {
11
+ load(patterns, verbose = false) {
12
12
  const cwd = process.cwd();
13
13
  const resolvedPatterns = (Array.isArray(patterns) ? patterns : [patterns]).map(p => {
14
14
  const resolved = path.isAbsolute(p) ? p : path.resolve(cwd, p);
@@ -66,27 +66,27 @@ export class X {
66
66
  });
67
67
  return this;
68
68
  }
69
- async initialize(input) {
69
+ async initialize(input, verbose = true) {
70
70
  const cradle = this.container.cradle;
71
71
  const inputList = input ? (Array.isArray(input) ? input : [input]) : [];
72
72
  const propsMap = new Map();
73
+ const initializedNames = [];
73
74
  inputList.forEach(item => {
74
75
  const name = typeof item.service === 'function'
75
76
  ? item.service.name.charAt(0).toLowerCase() + item.service.name.slice(1)
76
77
  : item.service;
77
78
  propsMap.set(name, item.props);
78
79
  });
79
- for (const key of Object.keys(cradle)) {
80
+ for (const key of Object.keys(this.container.registrations)) {
80
81
  const instance = cradle[key];
81
82
  if (instance && typeof instance.load === 'function') {
82
- if (propsMap.has(key)) {
83
- await instance.load(propsMap.get(key));
84
- }
85
- else {
86
- await instance.load();
87
- }
83
+ const props = propsMap.get(key) || {};
84
+ await instance.load(props);
85
+ initializedNames.push(key);
88
86
  }
89
87
  }
88
+ if (verbose && initializedNames.length > 0)
89
+ console.log('[DI] Initialized Services:', initializedNames);
90
90
  return this;
91
91
  }
92
92
  get(target) {