vrack2-core 1.0.0 → 1.0.1
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/README.md +9 -1
- package/lib/boot/DeviceManager.js +5 -0
- package/package.json +7 -7
- package/src/boot/DeviceManager.ts +7 -0
package/README.md
CHANGED
|
@@ -9,13 +9,21 @@ VRack2 Core
|
|
|
9
9
|
|
|
10
10
|
--------
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
### Последнее обновление 1.0.1
|
|
14
|
+
|
|
15
|
+
- Обновлены пакеты TypeScript
|
|
16
|
+
- Добавлена валидация параметров класса устройства в `DeviceManager.getDeviceInfo()`
|
|
17
|
+
|
|
12
18
|
**Использовать эту документацию имеет смысл только для более глубокого изучения устройства VRack2 или для создания сервиса независимого от VRack2**
|
|
13
19
|
|
|
14
20
|
-------
|
|
15
21
|
|
|
16
22
|
- [VRack2](https://github.com/VRack2/vrack2) - Официальный репозиторий
|
|
17
|
-
- [VRack2-service](https://github.com/VRack2/vrack2-service) -
|
|
23
|
+
- [VRack2-service](https://github.com/VRack2/vrack2-service) - Запуск сервисов на VRack2-Core
|
|
18
24
|
- [VRack2 Manager](https://github.com/VRack2/vrack2-manager) - Интерфейс для работы с сервисами VRack2
|
|
25
|
+
- [VGranite](https://github.com/VRack2/VGranite) - Сервис для создания туннелей Socket -> Serial
|
|
26
|
+
|
|
19
27
|
|
|
20
28
|
Основная документация для VRack2-Core на данный момент не готова. Часть документации в виде черновиков уже есть.
|
|
21
29
|
|
|
@@ -42,6 +42,7 @@ const Rule_1 = __importDefault(require("../validator/Rule"));
|
|
|
42
42
|
const CoreError_1 = __importDefault(require("../errors/CoreError"));
|
|
43
43
|
const BootClass_1 = __importDefault(require("./BootClass"));
|
|
44
44
|
const ImportManager_1 = __importDefault(require("../ImportManager"));
|
|
45
|
+
const Validator_1 = __importDefault(require("../validator/Validator"));
|
|
45
46
|
ErrorManager_1.default.register('DeviceManager', 'S5dBTBKTnVbF', 'DM_DEVICE_NOT_FOUND', 'Device not found', {
|
|
46
47
|
device: Rule_1.default.string().require().example('Master').description('Device name')
|
|
47
48
|
});
|
|
@@ -129,6 +130,10 @@ class DeviceManager extends BootClass_1.default {
|
|
|
129
130
|
const di = [vendor, device].join('.');
|
|
130
131
|
const DeviceClass = yield this.get(di);
|
|
131
132
|
const dev = new DeviceClass('1', di, this);
|
|
133
|
+
// Заполняем значения по умолчанию валидатором
|
|
134
|
+
// Это нужно динамических портов которые определяются через options
|
|
135
|
+
const rules = dev.checkOptions();
|
|
136
|
+
Validator_1.default.validate(rules, dev.options);
|
|
132
137
|
const result = { actions: {}, metrics: {}, inputs: {}, outputs: {}, options: {}, description: '' };
|
|
133
138
|
try {
|
|
134
139
|
const preOptions = dev.checkOptions();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vrack2-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Фреймворк для создания событийно-ориентированных сервисов на JavaScript/TypeScript",
|
|
5
5
|
"main": "./lib/index",
|
|
6
6
|
"scripts": {},
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://github.com/VRack2/vrack2-core#readme",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/node": "^
|
|
19
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
20
|
-
"@typescript-eslint/parser": "^
|
|
21
|
-
"eslint": "^
|
|
22
|
-
"typescript": "^
|
|
18
|
+
"@types/node": "^24.9.1",
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
20
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
21
|
+
"eslint": "^9.38.0",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"vrack-db": "^3.0.
|
|
25
|
+
"vrack-db": "^3.0.2"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -11,6 +11,7 @@ import IAction from '../actions/IAction'
|
|
|
11
11
|
import IMetricSettings from '../metrics/IMetricSettings'
|
|
12
12
|
import IPort from '../ports/IPort'
|
|
13
13
|
import IValidationRule from '../validator/IValidationRule'
|
|
14
|
+
import Validator from '../validator/Validator'
|
|
14
15
|
|
|
15
16
|
export interface IDeviceVendor {
|
|
16
17
|
/** Group name = Vendor name */
|
|
@@ -174,6 +175,12 @@ export default class DeviceManager extends BootClass {
|
|
|
174
175
|
const di = [vendor, device].join('.')
|
|
175
176
|
const DeviceClass = await this.get(di)
|
|
176
177
|
const dev = new DeviceClass('1', di, this) as Device
|
|
178
|
+
|
|
179
|
+
// Заполняем значения по умолчанию валидатором
|
|
180
|
+
// Это нужно динамических портов которые определяются через options
|
|
181
|
+
const rules = dev.checkOptions()
|
|
182
|
+
Validator.validate(rules, dev.options)
|
|
183
|
+
|
|
177
184
|
const result: IDeivceInfo = { actions: {}, metrics: {}, inputs: {}, outputs: {}, options: {}, description: '' }
|
|
178
185
|
try {
|
|
179
186
|
const preOptions = dev.checkOptions();
|