@xrystal/core 3.20.1 → 3.20.2

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.20.1",
4
+ "version": "3.20.2",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -1,14 +1,13 @@
1
1
  import { IService } from "../../utils";
2
2
  export default class SystemService implements IService {
3
- private _tmp;
3
+ protected _core: Record<string, any>;
4
+ protected _tmp: Record<string, any>;
4
5
  cwd: string;
5
- core: {
6
- _: any;
7
- };
8
- load: ({}: {
9
- tmp: any;
6
+ load: ({ core }: {
7
+ core: any;
10
8
  }) => Promise<void>;
11
9
  private initializeKafkaInfrastructure;
12
10
  private _systemLoader;
11
+ get core(): Record<string, any>;
13
12
  get tmp(): Record<string, any>;
14
13
  }
@@ -1,11 +1,12 @@
1
1
  import { Kafka, logLevel } from "kafkajs";
2
- import { Constants, getTmp } from "../../utils";
2
+ import { Constants } from "../../utils";
3
3
  export default class SystemService {
4
+ _core = {};
4
5
  _tmp = {};
5
6
  cwd = process.cwd();
6
- core = getTmp();
7
- load = async ({}) => {
8
- this._tmp = this.core._;
7
+ load = async ({ core }) => {
8
+ this._core = core;
9
+ this._tmp = this._core._;
9
10
  await this.initializeKafkaInfrastructure();
10
11
  await this._systemLoader({});
11
12
  };
@@ -60,6 +61,9 @@ export default class SystemService {
60
61
  _systemLoader = async ({}) => {
61
62
  return;
62
63
  };
64
+ get core() {
65
+ return this._core;
66
+ }
63
67
  get tmp() {
64
68
  return this._tmp;
65
69
  }
@@ -1,3 +1,6 @@
1
+ export declare const core: {
2
+ _: any;
3
+ };
1
4
  export declare const coreInit: (params: {
2
5
  locales?: Record<string, any>;
3
6
  }) => Promise<void>;
@@ -1,13 +1,14 @@
1
1
  import path from 'path';
2
2
  import { SystemService, ConfigsService, LoggerService, EventsService, LocalizationsService, ClientsService, ControllerService } from '../loader';
3
- import { Constants, x, } from '../utils';
3
+ import { Constants, getCore, x, } from '../utils';
4
4
  //
5
- let coreHasRun = false;
5
+ export const core = getCore();
6
6
  export const coreInit = async (params) => {
7
7
  const { locales } = params;
8
8
  if (locales)
9
9
  globalThis.__LOCAL_MESSAGES__ = locales;
10
10
  };
11
+ let coreHasRun = false;
11
12
  const coreLoader = async ({}) => {
12
13
  if (coreHasRun)
13
14
  return {};
@@ -20,7 +21,9 @@ const coreLoader = async ({}) => {
20
21
  .initialize([
21
22
  {
22
23
  service: SystemService,
23
- props: {}
24
+ props: {
25
+ core
26
+ }
24
27
  },
25
28
  {
26
29
  service: ConfigsService,
@@ -1,4 +1,4 @@
1
- export declare const getTmp: () => {
1
+ export declare const getCore: () => {
2
2
  _: any;
3
3
  };
4
4
  export declare const getTmpConfig: ({ root, tmpFileName, ext }: {
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import fs from 'fs';
3
3
  import Handlebars from 'handlebars';
4
4
  import { Constants, TmpFileLoader } from "../../index.js";
5
- export const getTmp = () => {
5
+ export const getCore = () => {
6
6
  const ownerTmpFilePath = findFileRecursively(".", Constants.defaultTmpFileName, Constants.defaultTmpFileExt);
7
7
  if (!ownerTmpFilePath) {
8
8
  throw new Error(`${Constants.defaultTmpFileName} file not found`);
@@ -1,5 +1,5 @@
1
1
  export { default as pic } from "picocolors";
2
- export * from './tmp/index';
2
+ export * from './core/index';
3
3
  export * from './path/index';
4
4
  export * from './is/index';
5
5
  export * from './id/index';
@@ -1,5 +1,5 @@
1
1
  export { default as pic } from "picocolors";
2
- export * from './tmp/index';
2
+ export * from './core/index';
3
3
  export * from './path/index';
4
4
  export * from './is/index';
5
5
  export * from './id/index';