vrack2-core 1.0.2 → 1.0.3
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 +3 -3
- package/lib/Container.d.ts +6 -0
- package/lib/Container.js +2 -2
- package/lib/service/DevicePort.d.ts +4 -1
- package/lib/service/DevicePort.js +2 -1
- package/package.json +1 -1
- package/src/Container.ts +7 -2
- package/src/service/DevicePort.ts +6 -1
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@ VRack2 Core
|
|
|
9
9
|
|
|
10
10
|
--------
|
|
11
11
|
|
|
12
|
+
### Последнее обновленте 1.0.3
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- Откат от валидации в `DeviceManager.getDeviceInfo()`
|
|
14
|
+
- Теперь порты `DevicePort` имеют ссылки на устройство своего владельца `Device`
|
|
15
|
+
- Добавлено свойство meta внутри контейнера для хранения дополнительной информации
|
|
16
16
|
|
|
17
17
|
**Использовать эту документацию имеет смысл только для более глубокого изучения устройства VRack2 или для создания сервиса независимого от VRack2**
|
|
18
18
|
|
package/lib/Container.d.ts
CHANGED
package/lib/Container.js
CHANGED
|
@@ -368,7 +368,7 @@ class Container extends events_1.default {
|
|
|
368
368
|
this.checkPortName(subkey);
|
|
369
369
|
const handler = ImportManager_1.default.camelize('input.' + subkey);
|
|
370
370
|
this.checkInputHandler(subkey, handler, dev);
|
|
371
|
-
const ndp = new DevicePort_1.default(subkey, pList[subkey]);
|
|
371
|
+
const ndp = new DevicePort_1.default(subkey, pList[subkey], dev);
|
|
372
372
|
dev.ports.input[subkey] = ndp;
|
|
373
373
|
// add structure device input ports
|
|
374
374
|
this.structure[dconf.id].inputs[subkey] = [];
|
|
@@ -384,7 +384,7 @@ class Container extends events_1.default {
|
|
|
384
384
|
const pList = this.getPortList(key, exp);
|
|
385
385
|
for (const subkey in pList) {
|
|
386
386
|
this.checkPortName(subkey);
|
|
387
|
-
const ndp = new DevicePort_1.default(subkey, pList[subkey]);
|
|
387
|
+
const ndp = new DevicePort_1.default(subkey, pList[subkey], dev);
|
|
388
388
|
dev.ports.output[subkey] = ndp;
|
|
389
389
|
// add structure device output ports
|
|
390
390
|
this.structure[dconf.id].outputs[subkey] = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import IPort from "../ports/IPort";
|
|
2
2
|
import DeviceConnect from "./DeviceConnect";
|
|
3
|
+
import Device from "./Device";
|
|
3
4
|
/**
|
|
4
5
|
* A class to implement a device port.
|
|
5
6
|
* The port can be either incoming or outgoing
|
|
@@ -15,13 +16,15 @@ export default class DevicePort {
|
|
|
15
16
|
type: string;
|
|
16
17
|
/** Flag determines whether the port should be connected */
|
|
17
18
|
required: boolean;
|
|
19
|
+
/** Ссылка на устройсто владельца */
|
|
20
|
+
Device: Device;
|
|
18
21
|
/**
|
|
19
22
|
* Список слушателей порта
|
|
20
23
|
* Используется для захвата порта. Если какие либо данные будут проброшены
|
|
21
24
|
* в порт, они будут переданы для каждого вызнванного слушателя
|
|
22
25
|
*/
|
|
23
26
|
listens: Map<number, (data: any) => void>;
|
|
24
|
-
constructor(id: string, port: IPort);
|
|
27
|
+
constructor(id: string, port: IPort, device: Device);
|
|
25
28
|
/**
|
|
26
29
|
* Adding communication to a port
|
|
27
30
|
*/
|
|
@@ -13,7 +13,7 @@ const Utility_1 = __importDefault(require("../Utility"));
|
|
|
13
13
|
* The port can be either incoming or outgoing
|
|
14
14
|
*/
|
|
15
15
|
class DevicePort {
|
|
16
|
-
constructor(id, port) {
|
|
16
|
+
constructor(id, port, device) {
|
|
17
17
|
/** Flag to determine if the port is connected */
|
|
18
18
|
this.connected = false;
|
|
19
19
|
/** Port connection list. One port can have multiple connections */
|
|
@@ -27,6 +27,7 @@ class DevicePort {
|
|
|
27
27
|
this.id = id;
|
|
28
28
|
this.type = port.type;
|
|
29
29
|
this.required = port.required;
|
|
30
|
+
this.Device = device;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Adding communication to a port
|
package/package.json
CHANGED
package/src/Container.ts
CHANGED
|
@@ -173,6 +173,11 @@ export default class Container extends EventEmitter {
|
|
|
173
173
|
* */
|
|
174
174
|
confFile?: string
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Дополнительные метаданные
|
|
178
|
+
*/
|
|
179
|
+
meta?: {[key: string]: any}
|
|
180
|
+
|
|
176
181
|
/**
|
|
177
182
|
* Container bootstrap class
|
|
178
183
|
*
|
|
@@ -462,7 +467,7 @@ export default class Container extends EventEmitter {
|
|
|
462
467
|
this.checkPortName(subkey)
|
|
463
468
|
const handler = ImportManager.camelize('input.' + subkey) as keyof Device
|
|
464
469
|
this.checkInputHandler(subkey, handler, dev)
|
|
465
|
-
const ndp = new DevicePort(subkey, pList[subkey])
|
|
470
|
+
const ndp = new DevicePort(subkey, pList[subkey], dev)
|
|
466
471
|
dev.ports.input[subkey] = ndp
|
|
467
472
|
// add structure device input ports
|
|
468
473
|
this.structure[dconf.id].inputs[subkey] = []
|
|
@@ -480,7 +485,7 @@ export default class Container extends EventEmitter {
|
|
|
480
485
|
const pList = this.getPortList(key, exp)
|
|
481
486
|
for (const subkey in pList) {
|
|
482
487
|
this.checkPortName(subkey)
|
|
483
|
-
const ndp = new DevicePort(subkey, pList[subkey])
|
|
488
|
+
const ndp = new DevicePort(subkey, pList[subkey], dev)
|
|
484
489
|
dev.ports.output[subkey] = ndp
|
|
485
490
|
// add structure device output ports
|
|
486
491
|
this.structure[dconf.id].outputs[subkey] = []
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import IPort from "../ports/IPort"
|
|
7
7
|
import DeviceConnect from "./DeviceConnect"
|
|
8
8
|
import Utility from "../Utility"
|
|
9
|
+
import Device from "./Device"
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* A class to implement a device port.
|
|
@@ -26,6 +27,9 @@ export default class DevicePort {
|
|
|
26
27
|
/** Flag determines whether the port should be connected */
|
|
27
28
|
required: boolean
|
|
28
29
|
|
|
30
|
+
/** Ссылка на устройсто владельца */
|
|
31
|
+
Device: Device
|
|
32
|
+
|
|
29
33
|
/**
|
|
30
34
|
* Список слушателей порта
|
|
31
35
|
* Используется для захвата порта. Если какие либо данные будут проброшены
|
|
@@ -33,10 +37,11 @@ export default class DevicePort {
|
|
|
33
37
|
*/
|
|
34
38
|
listens = new Map<number, (data:any) => void>()
|
|
35
39
|
|
|
36
|
-
constructor(id: string, port: IPort) {
|
|
40
|
+
constructor(id: string, port: IPort, device: Device) {
|
|
37
41
|
this.id = id
|
|
38
42
|
this.type = port.type
|
|
39
43
|
this.required = port.required
|
|
44
|
+
this.Device = device
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
/**
|