@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 +1 -1
- package/source/loader/system/index.d.ts +5 -6
- package/source/loader/system/index.js +8 -4
- package/source/project/index.d.ts +3 -0
- package/source/project/index.js +6 -3
- package/source/utils/helpers/{tmp → core}/index.d.ts +1 -1
- package/source/utils/helpers/{tmp → core}/index.js +1 -1
- package/source/utils/helpers/index.d.ts +1 -1
- package/source/utils/helpers/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { IService } from "../../utils";
|
|
2
2
|
export default class SystemService implements IService {
|
|
3
|
-
|
|
3
|
+
protected _core: Record<string, any>;
|
|
4
|
+
protected _tmp: Record<string, any>;
|
|
4
5
|
cwd: string;
|
|
5
|
-
core: {
|
|
6
|
-
|
|
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
|
|
2
|
+
import { Constants } from "../../utils";
|
|
3
3
|
export default class SystemService {
|
|
4
|
+
_core = {};
|
|
4
5
|
_tmp = {};
|
|
5
6
|
cwd = process.cwd();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this._tmp = this.
|
|
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
|
}
|
package/source/project/index.js
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
@@ -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
|
|
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`);
|