vrack2-core 0.0.1 → 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 +33 -4
- package/docs/Bootstrap.md +77 -0
- package/docs/Container.md +124 -0
- package/docs/Device.md +272 -0
- package/docs/FastStart.md +111 -0
- package/docs/Structure.md +148 -0
- package/lib/Bootstrap.d.ts +79 -0
- package/lib/Bootstrap.js +103 -0
- package/lib/Container.d.ts +202 -6
- package/lib/Container.js +295 -27
- package/lib/IServiceStructure.d.ts +8 -0
- package/lib/IStructureDevice.d.ts +5 -0
- package/lib/ImportManager.d.ts +85 -3
- package/lib/ImportManager.js +122 -16
- package/lib/MainProcess.d.ts +30 -3
- package/lib/MainProcess.js +28 -6
- package/lib/Utility.d.ts +15 -21
- package/lib/Utility.js +40 -40
- package/lib/actions/Action.d.ts +10 -0
- package/lib/actions/Action.js +10 -0
- package/lib/actions/BasicAction.d.ts +60 -0
- package/lib/actions/BasicAction.js +62 -0
- package/lib/actions/GlobalAction.d.ts +5 -0
- package/lib/actions/GlobalAction.js +5 -0
- package/lib/actions/IAction.d.ts +7 -0
- package/lib/actions/ILocalAction.d.ts +7 -0
- package/lib/boot/BootClass.d.ts +93 -0
- package/lib/boot/BootClass.js +101 -0
- package/lib/boot/DeviceFileStorage.d.ts +38 -0
- package/lib/boot/DeviceFileStorage.js +112 -0
- package/lib/boot/DeviceManager.d.ts +190 -0
- package/lib/boot/DeviceManager.js +311 -0
- package/lib/boot/DeviceMetrics.d.ts +82 -0
- package/lib/boot/DeviceMetrics.js +128 -0
- package/lib/boot/StructureStorage.d.ts +59 -0
- package/lib/boot/StructureStorage.js +125 -0
- package/lib/errors/CoreError.d.ts +42 -25
- package/lib/errors/CoreError.js +44 -24
- package/lib/errors/ErrorManager.d.ts +18 -20
- package/lib/errors/ErrorManager.js +23 -22
- package/lib/index.d.ts +20 -4
- package/lib/index.js +28 -4
- package/lib/metrics/BasicMetric.d.ts +49 -0
- package/lib/metrics/BasicMetric.js +79 -0
- package/lib/metrics/IMetricSettings.d.ts +32 -0
- package/lib/metrics/IMetricSettings.js +2 -0
- package/lib/metrics/IvMs.d.ts +9 -0
- package/lib/metrics/IvMs.js +22 -0
- package/lib/metrics/IvS.d.ts +9 -0
- package/lib/metrics/IvS.js +22 -0
- package/lib/metrics/IvUs.d.ts +9 -0
- package/lib/metrics/IvUs.js +22 -0
- package/lib/metrics/Metric.d.ts +17 -0
- package/lib/metrics/Metric.js +27 -0
- package/lib/ports/BasicPort.d.ts +39 -0
- package/lib/ports/BasicPort.js +39 -0
- package/lib/ports/ILocalPort.d.ts +7 -0
- package/lib/ports/IPort.d.ts +7 -0
- package/lib/ports/Port.d.ts +10 -0
- package/lib/ports/Port.js +10 -0
- package/lib/ports/ReturnPort.d.ts +5 -0
- package/lib/ports/ReturnPort.js +5 -0
- package/lib/service/Device.d.ts +213 -78
- package/lib/service/Device.js +185 -83
- package/lib/service/DeviceConnect.d.ts +4 -8
- package/lib/service/DeviceConnect.js +4 -8
- package/lib/service/DevicePort.d.ts +15 -6
- package/lib/service/DevicePort.js +29 -12
- package/lib/service/IDeviceEvent.d.ts +4 -1
- package/lib/validator/IValidationProblem.d.ts +7 -0
- package/lib/validator/IValidationRule.d.ts +12 -0
- package/lib/validator/IValidationSubrule.d.ts +2 -0
- package/lib/validator/Rule.d.ts +6 -2
- package/lib/validator/Rule.js +12 -2
- package/lib/validator/Validator.d.ts +48 -3
- package/lib/validator/Validator.js +70 -18
- package/lib/validator/types/AnyType.d.ts +17 -0
- package/lib/validator/types/AnyType.js +34 -0
- package/lib/validator/types/ArrayType.d.ts +37 -4
- package/lib/validator/types/ArrayType.js +42 -6
- package/lib/validator/types/BasicType.d.ts +67 -7
- package/lib/validator/types/BasicType.js +74 -8
- package/lib/validator/types/BooleanType.d.ts +23 -0
- package/lib/validator/types/BooleanType.js +47 -0
- package/lib/validator/types/FunctionType.d.ts +17 -0
- package/lib/validator/types/FunctionType.js +38 -0
- package/lib/validator/types/NumberType.d.ts +40 -5
- package/lib/validator/types/NumberType.js +53 -14
- package/lib/validator/types/ObjectType.d.ts +32 -5
- package/lib/validator/types/ObjectType.js +42 -8
- package/lib/validator/types/StringType.d.ts +30 -5
- package/lib/validator/types/StringType.js +33 -7
- package/package.json +15 -14
- package/src/Bootstrap.ts +122 -0
- package/src/Container.ts +411 -43
- package/src/IServiceStructure.ts +9 -0
- package/src/IStructureDevice.ts +5 -0
- package/src/ImportManager.ts +119 -11
- package/src/MainProcess.ts +53 -8
- package/src/Utility.ts +35 -36
- package/src/actions/Action.ts +12 -0
- package/src/actions/BasicAction.ts +63 -0
- package/src/actions/GlobalAction.ts +5 -0
- package/src/actions/IAction.ts +7 -0
- package/src/actions/ILocalAction.ts +7 -0
- package/src/boot/BootClass.ts +117 -0
- package/src/boot/DeviceFileStorage.ts +96 -0
- package/src/boot/DeviceManager.ts +346 -0
- package/src/boot/DeviceMetrics.ts +129 -0
- package/src/boot/StructureStorage.ts +108 -0
- package/src/errors/CoreError.ts +52 -26
- package/src/errors/ErrorManager.ts +46 -33
- package/src/index.ts +30 -6
- package/src/metrics/BasicMetric.ts +84 -0
- package/src/metrics/IMetricSettings.ts +38 -0
- package/src/metrics/IvMs.ts +18 -0
- package/src/metrics/IvS.ts +18 -0
- package/src/metrics/IvUs.ts +17 -0
- package/src/metrics/Metric.ts +25 -0
- package/src/ports/BasicPort.ts +39 -0
- package/src/ports/ILocalPort.ts +7 -0
- package/src/ports/IPort.ts +7 -0
- package/src/ports/Port.ts +11 -1
- package/src/ports/ReturnPort.ts +5 -0
- package/src/service/Device.ts +234 -103
- package/src/service/DeviceConnect.ts +4 -8
- package/src/service/DevicePort.ts +30 -11
- package/src/service/IDeviceEvent.ts +4 -1
- package/src/validator/IValidationProblem.ts +7 -0
- package/src/validator/IValidationRule.ts +12 -0
- package/src/validator/IValidationSubrule.ts +3 -0
- package/src/validator/Rule.ts +16 -2
- package/src/validator/Validator.ts +74 -23
- package/src/validator/types/AnyType.ts +32 -0
- package/src/validator/types/ArrayType.ts +43 -7
- package/src/validator/types/BasicType.ts +78 -9
- package/src/validator/types/BooleanType.ts +49 -0
- package/src/validator/types/FunctionType.ts +39 -0
- package/src/validator/types/NumberType.ts +53 -15
- package/src/validator/types/ObjectType.ts +52 -14
- package/src/validator/types/StringType.ts +34 -10
- package/docs/RU-README.md +0 -6
- package/lib/DeviceManager.d.ts +0 -32
- package/lib/DeviceManager.js +0 -143
- package/lib/test.d.ts +0 -1
- package/lib/test.js +0 -58
- package/src/DeviceManager.ts +0 -124
- package/src/test.ts +0 -82
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Boris Bobylev. All rights reserved.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const vrack_db_1 = require("vrack-db");
|
|
8
|
+
/**
|
|
9
|
+
* Metric base class. Used internally to define device metrics.
|
|
10
|
+
*/
|
|
11
|
+
class BasicMetric {
|
|
12
|
+
constructor() {
|
|
13
|
+
/**
|
|
14
|
+
* Default metric setting
|
|
15
|
+
*/
|
|
16
|
+
this.metric = {
|
|
17
|
+
retentions: '5s:10m, 1m:2h, 15m:1d, 1h:1w, 6h:1mon, 1d:1y',
|
|
18
|
+
interval: 's',
|
|
19
|
+
vType: vrack_db_1.StorageTypes.Float,
|
|
20
|
+
tType: vrack_db_1.StorageTypes.Uint64
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Defines the type of time storage
|
|
25
|
+
*
|
|
26
|
+
* @param type StorageTypes type like a StorageTypes.Uint64 (default)
|
|
27
|
+
*/
|
|
28
|
+
timeStorage(type) {
|
|
29
|
+
this.metric.tType = type;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Defines the type of value storage
|
|
34
|
+
*
|
|
35
|
+
* @param type StorageTypes type like a StorageTypes.Uint64 (default)
|
|
36
|
+
*/
|
|
37
|
+
valueStorage(type) {
|
|
38
|
+
this.metric.vType = type;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Specifies the accuracy and storage period size of Graphite-style metrics
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
* @see SingleDB.metric
|
|
46
|
+
* @param req retentions Graphite-style `5s:10m, 1m:2h, 15m:1d, 1h:1w, 6h:1mon, 1d:1y`
|
|
47
|
+
*/
|
|
48
|
+
retentions(req) {
|
|
49
|
+
this.metric.retentions = req;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Metric Description
|
|
54
|
+
*
|
|
55
|
+
* @param des Short text description of the metric
|
|
56
|
+
*/
|
|
57
|
+
description(des) {
|
|
58
|
+
this.metric.description = des;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* To add additional data to the metric, you can specify
|
|
63
|
+
* any object describing the metric in this method.
|
|
64
|
+
*
|
|
65
|
+
* @param add Additional information for the metric
|
|
66
|
+
*/
|
|
67
|
+
additional(add) {
|
|
68
|
+
this.metric.additional = add;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns the internal metric settings object. Used inside Container
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
export() {
|
|
76
|
+
return this.metric;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.default = BasicMetric;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { StorageTypes } from "vrack-db";
|
|
2
|
+
export default interface IMetricSettings {
|
|
3
|
+
/**
|
|
4
|
+
* Specifies the accuracy and storage period size of Graphite-style metrics
|
|
5
|
+
* @see SingleDB.metric
|
|
6
|
+
*/
|
|
7
|
+
retentions: string;
|
|
8
|
+
/**
|
|
9
|
+
* Interval that defines the minimal time unit
|
|
10
|
+
*
|
|
11
|
+
* s - second
|
|
12
|
+
* ms - millisecond
|
|
13
|
+
* us - microsecond
|
|
14
|
+
*/
|
|
15
|
+
interval: 's' | 'ms' | 'us';
|
|
16
|
+
/**
|
|
17
|
+
* Defines the type of value storage
|
|
18
|
+
* StorageTypes type like a StorageTypes.Uint64 (default)
|
|
19
|
+
*/
|
|
20
|
+
vType: StorageTypes;
|
|
21
|
+
/**
|
|
22
|
+
* Defines the type of time storage
|
|
23
|
+
* StorageTypes type like a StorageTypes.Uint64 (default)
|
|
24
|
+
*/
|
|
25
|
+
tType: StorageTypes;
|
|
26
|
+
/** Metric Description */
|
|
27
|
+
description?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Additional information for the metric
|
|
30
|
+
*/
|
|
31
|
+
additional?: any;
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Boris Bobylev. All rights reserved.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const BasicMetric_1 = __importDefault(require("./BasicMetric"));
|
|
11
|
+
/**
|
|
12
|
+
* Creating a new metric with minimum time unit in milliseconds
|
|
13
|
+
*
|
|
14
|
+
* @see BasicMetric
|
|
15
|
+
*/
|
|
16
|
+
class IvMS extends BasicMetric_1.default {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.metric.interval = 'ms';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = IvMS;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Boris Bobylev. All rights reserved.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const BasicMetric_1 = __importDefault(require("./BasicMetric"));
|
|
11
|
+
/**
|
|
12
|
+
* Creating a new metric with minimum time unit in Seconds
|
|
13
|
+
*
|
|
14
|
+
* @see BasicMetric
|
|
15
|
+
*/
|
|
16
|
+
class IvS extends BasicMetric_1.default {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.metric.interval = 's';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = IvS;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Boris Bobylev. All rights reserved.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const BasicMetric_1 = __importDefault(require("./BasicMetric"));
|
|
11
|
+
/**
|
|
12
|
+
* Creating a new metric with minimum time unit in Microseconds
|
|
13
|
+
*
|
|
14
|
+
* @see BasicMetric
|
|
15
|
+
*/
|
|
16
|
+
class IvUs extends BasicMetric_1.default {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.metric.interval = 'us';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = IvUs;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import IvMS from "./IvMs";
|
|
2
|
+
import IvS from "./IvS";
|
|
3
|
+
import IvUs from "./IvUs";
|
|
4
|
+
export default class Metric {
|
|
5
|
+
/**
|
|
6
|
+
* Creating a new metric with minimum time unit in Seconds
|
|
7
|
+
*/
|
|
8
|
+
static inS(): IvS;
|
|
9
|
+
/**
|
|
10
|
+
* Creating a new metric with minimum time unit in Milliseconds
|
|
11
|
+
*/
|
|
12
|
+
static inMs(): IvMS;
|
|
13
|
+
/**
|
|
14
|
+
* Creating a new metric with minimum time unit in Microsecond
|
|
15
|
+
*/
|
|
16
|
+
static inUs(): IvUs;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright © 2025 Boris Bobylev. All rights reserved.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
const IvMs_1 = __importDefault(require("./IvMs"));
|
|
11
|
+
const IvS_1 = __importDefault(require("./IvS"));
|
|
12
|
+
const IvUs_1 = __importDefault(require("./IvUs"));
|
|
13
|
+
class Metric {
|
|
14
|
+
/**
|
|
15
|
+
* Creating a new metric with minimum time unit in Seconds
|
|
16
|
+
*/
|
|
17
|
+
static inS() { return new IvS_1.default(); }
|
|
18
|
+
/**
|
|
19
|
+
* Creating a new metric with minimum time unit in Milliseconds
|
|
20
|
+
*/
|
|
21
|
+
static inMs() { return new IvMs_1.default(); }
|
|
22
|
+
/**
|
|
23
|
+
* Creating a new metric with minimum time unit in Microsecond
|
|
24
|
+
*/
|
|
25
|
+
static inUs() { return new IvUs_1.default(); }
|
|
26
|
+
}
|
|
27
|
+
exports.default = Metric;
|
package/lib/ports/BasicPort.d.ts
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
1
|
import BasicType from "../validator/types/BasicType";
|
|
2
2
|
import ILocalPort from "./ILocalPort";
|
|
3
3
|
import IPort from "./IPort";
|
|
4
|
+
/**
|
|
5
|
+
* Port basic class. Used internally to define device ports.
|
|
6
|
+
*/
|
|
4
7
|
export default class BasicPort {
|
|
5
8
|
protected port: ILocalPort;
|
|
6
9
|
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* Sets this port to dynamic
|
|
12
|
+
*
|
|
13
|
+
* If you specify a port to be dynamic, you must specify the number of those ports.
|
|
14
|
+
* Also if you specify a port as dynamic, you must specify `%d` in the name,
|
|
15
|
+
* which will be replaced by the port number.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* {
|
|
20
|
+
* 'command%d': Port.return().dynamic(this.options.inputs)
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param count Count of ports
|
|
25
|
+
*/
|
|
7
26
|
dynamic(count: number): this;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies a recommendation to the data passing through the port.
|
|
29
|
+
* This data is not actually validated by these rules,
|
|
30
|
+
* but these rules can be used in the documentation to clarify perception.
|
|
31
|
+
*
|
|
32
|
+
* @param req BasicType type
|
|
33
|
+
*/
|
|
8
34
|
requirement(req: BasicType): this;
|
|
35
|
+
/**
|
|
36
|
+
* Port descriptions
|
|
37
|
+
*/
|
|
9
38
|
description(des: string): this;
|
|
39
|
+
/**
|
|
40
|
+
* Exports the port data.
|
|
41
|
+
* Collects all data into an IPort object.
|
|
42
|
+
* Internal types of type BasicType are also exported to the corresponding properties
|
|
43
|
+
*
|
|
44
|
+
* @see IPort
|
|
45
|
+
*
|
|
46
|
+
* !hide for external users
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
10
49
|
export(): IPort;
|
|
11
50
|
}
|
package/lib/ports/BasicPort.js
CHANGED
|
@@ -8,6 +8,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const BasicType_1 = __importDefault(require("../validator/types/BasicType"));
|
|
11
|
+
/**
|
|
12
|
+
* Port basic class. Used internally to define device ports.
|
|
13
|
+
*/
|
|
11
14
|
class BasicPort {
|
|
12
15
|
constructor() {
|
|
13
16
|
this.port = {
|
|
@@ -18,19 +21,55 @@ class BasicPort {
|
|
|
18
21
|
count: 0
|
|
19
22
|
};
|
|
20
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Sets this port to dynamic
|
|
26
|
+
*
|
|
27
|
+
* If you specify a port to be dynamic, you must specify the number of those ports.
|
|
28
|
+
* Also if you specify a port as dynamic, you must specify `%d` in the name,
|
|
29
|
+
* which will be replaced by the port number.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* {
|
|
34
|
+
* 'command%d': Port.return().dynamic(this.options.inputs)
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param count Count of ports
|
|
39
|
+
*/
|
|
21
40
|
dynamic(count) {
|
|
22
41
|
this.port.count = count;
|
|
23
42
|
this.port.dynamic = true;
|
|
24
43
|
return this;
|
|
25
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Specifies a recommendation to the data passing through the port.
|
|
47
|
+
* This data is not actually validated by these rules,
|
|
48
|
+
* but these rules can be used in the documentation to clarify perception.
|
|
49
|
+
*
|
|
50
|
+
* @param req BasicType type
|
|
51
|
+
*/
|
|
26
52
|
requirement(req) {
|
|
27
53
|
this.port.requirement = req;
|
|
28
54
|
return this;
|
|
29
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Port descriptions
|
|
58
|
+
*/
|
|
30
59
|
description(des) {
|
|
31
60
|
this.port.description = des;
|
|
32
61
|
return this;
|
|
33
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Exports the port data.
|
|
65
|
+
* Collects all data into an IPort object.
|
|
66
|
+
* Internal types of type BasicType are also exported to the corresponding properties
|
|
67
|
+
*
|
|
68
|
+
* @see IPort
|
|
69
|
+
*
|
|
70
|
+
* !hide for external users
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
34
73
|
export() {
|
|
35
74
|
const nPort = {
|
|
36
75
|
type: this.port.type,
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import BasicType from "../validator/types/BasicType";
|
|
2
2
|
export default interface ILocalPort {
|
|
3
|
+
/** Port Type - Returned or Standard */
|
|
3
4
|
type: string;
|
|
5
|
+
/** Specifies a recommendation to the data passing through the port. */
|
|
4
6
|
requirement?: BasicType;
|
|
7
|
+
/** Specifies a recommendation for the data returned by the port */
|
|
5
8
|
return?: BasicType;
|
|
9
|
+
/** Port description */
|
|
6
10
|
description: string;
|
|
11
|
+
/** Is the connection of this port mandatory */
|
|
7
12
|
required: boolean;
|
|
13
|
+
/** Whether the port is dynamic */
|
|
8
14
|
dynamic: boolean;
|
|
15
|
+
/** Count of dynamic ports */
|
|
9
16
|
count: number;
|
|
10
17
|
}
|
package/lib/ports/IPort.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import IValidationRule from "../validator/IValidationRule";
|
|
2
2
|
export default interface IPort {
|
|
3
|
+
/** Port Type - Returned or Standard */
|
|
3
4
|
type: string;
|
|
5
|
+
/** Specifies a recommendation to the data passing through the port. */
|
|
4
6
|
requirement?: IValidationRule;
|
|
7
|
+
/** Specifies a recommendation for the data returned by the port */
|
|
5
8
|
return?: IValidationRule;
|
|
9
|
+
/** Port description */
|
|
6
10
|
description: string;
|
|
11
|
+
/** Is the connection of this port mandatory */
|
|
7
12
|
required: boolean;
|
|
13
|
+
/** Whether the port is dynamic */
|
|
8
14
|
dynamic: boolean;
|
|
15
|
+
/** Count of dynamic ports */
|
|
9
16
|
count: number;
|
|
10
17
|
}
|
package/lib/ports/Port.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import ReturnPort from "./ReturnPort";
|
|
2
2
|
import StandartPort from "./StandartPort";
|
|
3
|
+
/**
|
|
4
|
+
* Creating a new port. Used internally to create a port
|
|
5
|
+
*/
|
|
3
6
|
export default class Port {
|
|
7
|
+
/**
|
|
8
|
+
* Standard Port.
|
|
9
|
+
* Used to cast a value to another port or to signal a value to another port
|
|
10
|
+
*/
|
|
4
11
|
static standart(): StandartPort;
|
|
12
|
+
/**
|
|
13
|
+
* Return Port. Used to get the value over connections
|
|
14
|
+
*/
|
|
5
15
|
static return(): ReturnPort;
|
|
6
16
|
}
|
package/lib/ports/Port.js
CHANGED
|
@@ -9,10 +9,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const ReturnPort_1 = __importDefault(require("./ReturnPort"));
|
|
11
11
|
const StandartPort_1 = __importDefault(require("./StandartPort"));
|
|
12
|
+
/**
|
|
13
|
+
* Creating a new port. Used internally to create a port
|
|
14
|
+
*/
|
|
12
15
|
class Port {
|
|
16
|
+
/**
|
|
17
|
+
* Standard Port.
|
|
18
|
+
* Used to cast a value to another port or to signal a value to another port
|
|
19
|
+
*/
|
|
13
20
|
static standart() {
|
|
14
21
|
return new StandartPort_1.default();
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Return Port. Used to get the value over connections
|
|
25
|
+
*/
|
|
16
26
|
static return() {
|
|
17
27
|
return new ReturnPort_1.default();
|
|
18
28
|
}
|
|
@@ -2,5 +2,10 @@ import BasicType from "../validator/types/BasicType";
|
|
|
2
2
|
import BasicPort from "./BasicPort";
|
|
3
3
|
export default class ReturnPort extends BasicPort {
|
|
4
4
|
constructor();
|
|
5
|
+
/**
|
|
6
|
+
* Specifies a recommendation to the data return from the port.
|
|
7
|
+
*
|
|
8
|
+
* @param req BasicType type
|
|
9
|
+
*/
|
|
5
10
|
return(req: BasicType): this;
|
|
6
11
|
}
|
package/lib/ports/ReturnPort.js
CHANGED
|
@@ -13,6 +13,11 @@ class ReturnPort extends BasicPort_1.default {
|
|
|
13
13
|
super();
|
|
14
14
|
this.port.type = 'return';
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Specifies a recommendation to the data return from the port.
|
|
18
|
+
*
|
|
19
|
+
* @param req BasicType type
|
|
20
|
+
*/
|
|
16
21
|
return(req) {
|
|
17
22
|
this.port.return = req;
|
|
18
23
|
return this;
|