exodus-framework 2.0.763 → 2.0.765
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/app/app.d.ts +4 -0
- package/lib/app/app.d.ts.map +1 -1
- package/lib/app/app.js +35 -0
- package/lib/models/System.d.ts +10 -0
- package/lib/models/System.d.ts.map +1 -0
- package/lib/models/System.js +51 -0
- package/lib/models/index.d.ts.map +1 -1
- package/lib/models/index.js +2 -1
- package/package.json +1 -1
package/lib/app/app.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { IService } from '../contracts/service';
|
2
2
|
import Core from './core';
|
3
|
+
import { System } from '../models/System';
|
3
4
|
declare class Exodus extends Core {
|
4
5
|
private services;
|
5
6
|
constructor();
|
@@ -10,6 +11,9 @@ declare class Exodus extends Core {
|
|
10
11
|
registerSingletonService(service: IService): void;
|
11
12
|
initServices(): Promise<void>;
|
12
13
|
static getVersion(): string | undefined;
|
14
|
+
static getSystemVariable(tenantId: string, key: string): Promise<System>;
|
15
|
+
static setSystemVariable(tenantId: string, key: string, value: string): Promise<void>;
|
16
|
+
static createSystemVariable(tenantId: string, key: string, value: string): Promise<System>;
|
13
17
|
}
|
14
18
|
export default Exodus;
|
15
19
|
//# sourceMappingURL=app.d.ts.map
|
package/lib/app/app.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,IAAI,MAAM,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/app/app.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAQ1C,cAAM,MAAO,SAAQ,IAAI;IACvB,OAAO,CAAC,QAAQ,CAAa;;IAOvB,KAAK;IASL,UAAU;IAOV,WAAW;IAIX,cAAc;IAgBpB,wBAAwB,CAAC,OAAO,EAAE,QAAQ;IAGpC,YAAY;IASlB,MAAM,CAAC,UAAU,IAAI,MAAM,GAAG,SAAS;WAW1B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;WAI/C,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;WAS9D,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAO/E;AACD,eAAe,MAAM,CAAC"}
|
package/lib/app/app.js
CHANGED
@@ -8,6 +8,8 @@ var _cluster = _interopRequireDefault(require("cluster"));
|
|
8
8
|
var fs = _interopRequireWildcard(require("fs"));
|
9
9
|
var _path = _interopRequireDefault(require("path"));
|
10
10
|
var _core = _interopRequireDefault(require("./core"));
|
11
|
+
var _services = require("../services");
|
12
|
+
var _System = require("../models/System");
|
11
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
12
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
13
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
@@ -80,5 +82,38 @@ class Exodus extends _core.default {
|
|
80
82
|
return undefined;
|
81
83
|
}
|
82
84
|
}
|
85
|
+
static async getSystemVariable(tenantId, key) {
|
86
|
+
const Entity = await _services.SequelizeService.singleton().getModel(_System.System, tenantId);
|
87
|
+
return Entity.findOne({
|
88
|
+
where: {
|
89
|
+
key
|
90
|
+
}
|
91
|
+
});
|
92
|
+
}
|
93
|
+
static async setSystemVariable(tenantId, key, value) {
|
94
|
+
const Entity = await _services.SequelizeService.singleton().getModel(_System.System, tenantId);
|
95
|
+
const variable = await Entity.findOne({
|
96
|
+
where: {
|
97
|
+
key
|
98
|
+
}
|
99
|
+
});
|
100
|
+
if (!variable) throw new Error('System variable not found: ' + key);
|
101
|
+
variable.value = value;
|
102
|
+
variable.changed('value', true);
|
103
|
+
await variable.save();
|
104
|
+
}
|
105
|
+
static async createSystemVariable(tenantId, key, value) {
|
106
|
+
const Entity = await _services.SequelizeService.singleton().getModel(_System.System, tenantId);
|
107
|
+
const variable = await Entity.findOne({
|
108
|
+
where: {
|
109
|
+
key
|
110
|
+
}
|
111
|
+
});
|
112
|
+
if (variable) throw new Error('System variable has exists: ' + key);
|
113
|
+
return await Entity.create({
|
114
|
+
key,
|
115
|
+
value
|
116
|
+
});
|
117
|
+
}
|
83
118
|
}
|
84
119
|
var _default = exports.default = Exodus;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { CreationOptional, InferAttributes, InferCreationAttributes, Model, Sequelize } from 'sequelize';
|
2
|
+
export declare class System extends Model<InferAttributes<System>, InferCreationAttributes<System>> {
|
3
|
+
uuid: CreationOptional<string>;
|
4
|
+
key: string;
|
5
|
+
value: string;
|
6
|
+
comments: string;
|
7
|
+
data: CreationOptional<Record<string, any>>;
|
8
|
+
static initialize(connection: Sequelize): import("sequelize").ModelCtor<System>;
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=System.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../../src/models/System.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEhB,eAAe,EACf,uBAAuB,EAEvB,KAAK,EAGL,SAAS,EACV,MAAM,WAAW,CAAC;AAInB,qBAAa,MAAO,SAAQ,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACjF,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS;CAGxC"}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.System = void 0;
|
7
|
+
var _sequelize = require("sequelize");
|
8
|
+
var _database = require("../utils/database");
|
9
|
+
class System extends _sequelize.Model {
|
10
|
+
static initialize(connection) {
|
11
|
+
return connection.define('system', SystemParams, SystemConnParams);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
exports.System = System;
|
15
|
+
const SystemParams = {
|
16
|
+
uuid: {
|
17
|
+
type: _sequelize.DataTypes.UUID,
|
18
|
+
defaultValue: _sequelize.DataTypes.UUIDV4,
|
19
|
+
primaryKey: true,
|
20
|
+
allowNull: false,
|
21
|
+
autoIncrement: false
|
22
|
+
},
|
23
|
+
key: {
|
24
|
+
type: _sequelize.DataTypes.STRING(100),
|
25
|
+
allowNull: false
|
26
|
+
},
|
27
|
+
value: {
|
28
|
+
type: _sequelize.DataTypes.STRING(255),
|
29
|
+
allowNull: false
|
30
|
+
},
|
31
|
+
comments: {
|
32
|
+
type: _sequelize.DataTypes.STRING(255),
|
33
|
+
allowNull: true
|
34
|
+
},
|
35
|
+
data: {
|
36
|
+
type: _sequelize.DataTypes.JSON,
|
37
|
+
defaultValue: {},
|
38
|
+
allowNull: true
|
39
|
+
}
|
40
|
+
};
|
41
|
+
const SystemConnParams = {
|
42
|
+
tableName: 'system',
|
43
|
+
sequelize: _database.serviceDB,
|
44
|
+
indexes: [{
|
45
|
+
fields: ['key']
|
46
|
+
}, {
|
47
|
+
fields: ['value']
|
48
|
+
}, {
|
49
|
+
fields: ['comments']
|
50
|
+
}]
|
51
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAOxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,GAAG,CAAC,EAAwD,CAAC"}
|
package/lib/models/index.js
CHANGED
@@ -44,4 +44,5 @@ Object.keys(_Application).forEach(function (key) {
|
|
44
44
|
});
|
45
45
|
});
|
46
46
|
var _Log = require("./Log");
|
47
|
-
|
47
|
+
var _System = require("./System");
|
48
|
+
const NativeModels = exports.NativeModels = [_DatabaseHost.DatabaseHost, _EnvConnection.EnvDBHost, _Application.Application, _Log.Log, _System.System];
|