@quatrain/core 1.0.0-beta20 → 1.0.0-beta22
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/lib/Core.d.ts +1 -0
- package/lib/Core.js +5 -4
- package/package.json +2 -2
package/lib/Core.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type BackendRegistry<T extends AbstractAdapter> = {
|
|
|
8
8
|
export interface AuthAdapter extends AbstractAuthAdapter {
|
|
9
9
|
}
|
|
10
10
|
export declare class Core {
|
|
11
|
+
static storage: any;
|
|
11
12
|
static storagePrefix: string;
|
|
12
13
|
static defaultBackend: string;
|
|
13
14
|
static defaultStorage: string;
|
package/lib/Core.js
CHANGED
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.Core = void 0;
|
|
13
13
|
const DataObject_1 = require("./components/DataObject");
|
|
14
14
|
const User_1 = require("./components/User");
|
|
15
|
-
const storage = require('node-persist');
|
|
16
|
-
storage.init( /* options ... */);
|
|
17
15
|
class Core {
|
|
18
16
|
static definition(key) {
|
|
19
17
|
return {
|
|
@@ -25,12 +23,14 @@ class Core {
|
|
|
25
23
|
}
|
|
26
24
|
static addConfig(key, value) {
|
|
27
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
yield storage.
|
|
26
|
+
yield this.storage.init( /* options ... */);
|
|
27
|
+
yield this.storage.set(`${this.storagePrefix}_${key}`, value);
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
static getConfig(key) {
|
|
32
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
|
|
32
|
+
yield this.storage.init( /* options ... */);
|
|
33
|
+
return yield this.storage.get(`${this.storagePrefix}_${key}`);
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
static addBackend(backend, alias, setDefault = false) {
|
|
@@ -86,6 +86,7 @@ class Core {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
exports.Core = Core;
|
|
89
|
+
Core.storage = require('node-persist');
|
|
89
90
|
Core.storagePrefix = 'core';
|
|
90
91
|
Core.defaultBackend = '@default';
|
|
91
92
|
Core.defaultStorage = '@default';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quatrain/core",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta22",
|
|
4
4
|
"description": "Core objects for business apps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@tsconfig/recommended": "^1.0.1",
|
|
15
15
|
"@types/jest": "^27.0.3",
|
|
16
|
+
"@types/node-persist": "^3.1.8",
|
|
16
17
|
"jest": "^27.4.7",
|
|
17
18
|
"jest-node-exports-resolver": "^1.1.6",
|
|
18
19
|
"trace-unhandled": "^2.0.1",
|
|
@@ -22,7 +23,6 @@
|
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@faker-js/faker": "^7.6.0",
|
|
25
|
-
"@types/node-persist": "^3.1.8",
|
|
26
26
|
"node-persist": "^4.0.3"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|