@xrystal/core 3.10.1 → 3.10.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.10.1",
4
+ "version": "3.10.2",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -1,4 +1,4 @@
1
- export declare const getTmpFile: () => {
1
+ export declare const core: {
2
2
  _: any;
3
3
  };
4
4
  export declare const coreInit: (params: {
@@ -1,19 +1,10 @@
1
1
  // => import dependencies
2
2
  import path from 'path';
3
3
  import { SystemService, ConfigsService, LoggerService, EventsService, LocalizationsService, ClientsService } from '../loader/index';
4
- import { packageName, tmpFileDefaultName, tmpFileDefaultExt, findFileRecursively, x, kafkaBrokers, systemLoggerLayer, getTmpConfig, } from '../utils/index';
4
+ import { packageName, x, kafkaBrokers, systemLoggerLayer, getTmp, } from '../utils/index';
5
5
  //
6
6
  let coreHasRun = false;
7
- export const getTmpFile = () => {
8
- const ownerTmpFilePath = findFileRecursively(".", tmpFileDefaultName, tmpFileDefaultExt);
9
- if (!ownerTmpFilePath) {
10
- throw new Error(`${tmpFileDefaultName} file not found`);
11
- }
12
- const tmpFileObject = getTmpConfig({});
13
- return {
14
- _: tmpFileObject
15
- };
16
- };
7
+ export const core = getTmp();
17
8
  export const coreInit = async (params) => {
18
9
  const { locales } = params;
19
10
  if (locales)
@@ -23,12 +14,7 @@ const coreLoader = async ({}) => {
23
14
  if (coreHasRun)
24
15
  return {};
25
16
  try {
26
- const ownerTmpFilePath = findFileRecursively(".", tmpFileDefaultName, tmpFileDefaultExt);
27
- if (!ownerTmpFilePath) {
28
- throw new Error(`${tmpFileDefaultName} file not found`);
29
- }
30
- const tmpFileObject = getTmpConfig({});
31
- const { configs } = tmpFileObject;
17
+ const { configs } = core._;
32
18
  const rootFolderPath = configs.rootFolderPath;
33
19
  const services = [
34
20
  SystemService,
@@ -46,10 +32,10 @@ const coreLoader = async ({}) => {
46
32
  const i18n = x.get(LocalizationsService);
47
33
  const clientsService = x.get(ClientsService);
48
34
  await system.load({
49
- tmp: tmpFileObject
35
+ tmp: core._
50
36
  });
51
37
  configService.load({
52
- tmp: tmpFileObject,
38
+ tmp: core._,
53
39
  systemService: system,
54
40
  ...(configs.loaders.configs.globalEnvFileName && { globalEnvFileName: configs.loaders.configs.globalEnvFileName })
55
41
  });
@@ -1,3 +1,6 @@
1
+ export declare const getTmp: () => {
2
+ _: any;
3
+ };
1
4
  export declare const getTmpConfig: ({ root, tmpFileName, ext }: {
2
5
  root?: string;
3
6
  tmpFileName?: string;
@@ -1,7 +1,17 @@
1
1
  import path from "path";
2
2
  import fs from 'fs';
3
3
  import Handlebars from 'handlebars';
4
- import { SupportFileExtensionsEnum, tmpFileDefaultName, TmpFileLoader } from "../../index.js";
4
+ import { SupportFileExtensionsEnum, tmpFileDefaultExt, tmpFileDefaultName, TmpFileLoader } from "../../index.js";
5
+ export const getTmp = () => {
6
+ const ownerTmpFilePath = findFileRecursively(".", tmpFileDefaultName, tmpFileDefaultExt);
7
+ if (!ownerTmpFilePath) {
8
+ throw new Error(`${tmpFileDefaultName} file not found`);
9
+ }
10
+ const tmpFileObject = getTmpConfig({});
11
+ return {
12
+ _: tmpFileObject
13
+ };
14
+ };
5
15
  export const getTmpConfig = ({ root = '.', tmpFileName = tmpFileDefaultName, ext = '.yml' }) => {
6
16
  const path = findFileRecursively(root, tmpFileName, ext);
7
17
  if (!path) {