node-opcua-modeler 2.97.0 → 2.98.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/dist/addExtensionObjectDataType.d.ts +21 -21
- package/dist/addExtensionObjectDataType.js +132 -132
- package/dist/build_model_inner.d.ts +17 -17
- package/dist/build_model_inner.js +42 -42
- package/dist/displayNodeElement.d.ts +6 -6
- package/dist/displayNodeElement.js +220 -220
- package/dist/generate_markdown_doc.d.ts +41 -41
- package/dist/generate_markdown_doc.js +314 -314
- package/dist/index.d.ts +24 -24
- package/dist/index.js +52 -52
- package/dist/promoteToMandatory.d.ts +8 -8
- package/dist/promoteToMandatory.js +89 -89
- package/dist/setNamespaceMetaData.d.ts +1 -1
- package/dist/setNamespaceMetaData.js +5 -5
- package/dist/symbol.d.ts +1 -1
- package/dist/symbol.js +2 -2
- package/dist/tableHelper.d.ts +9 -9
- package/dist/tableHelper.js +60 -60
- package/dist/to_cvs.d.ts +2 -2
- package/dist/to_cvs.js +11 -11
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -2
- package/distNodeJS/build_documentation_to_file.d.ts +3 -3
- package/distNodeJS/build_documentation_to_file.js +26 -26
- package/distNodeJS/build_model.d.ts +7 -7
- package/distNodeJS/build_model.js +21 -21
- package/distNodeJS/index.d.ts +5 -5
- package/distNodeJS/index.js +23 -23
- package/distNodeJS/symbol_cvs.d.ts +3 -3
- package/distNodeJS/symbol_cvs.js +63 -63
- package/package.json +28 -21
- package/MyModelIds.csv +0 -151
- package/examples/make_model.ts +0 -153
- package/source_nodejs/build_documentation_to_file.ts +0 -13
- package/source_nodejs/build_model.ts +0 -12
- package/source_nodejs/index.ts +0 -5
- package/source_nodejs/symbol_cvs.ts +0 -50
- package/tsconfig_common.json +0 -66
- package/tsconfig_nodejs.json +0 -25
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export * from "./displayNodeElement";
|
|
3
|
-
export * from "./promoteToMandatory";
|
|
4
|
-
export * from "./setNamespaceMetaData";
|
|
5
|
-
export * from "./build_model_inner";
|
|
6
|
-
export * from "./addExtensionObjectDataType";
|
|
7
|
-
export * from "./symbol";
|
|
8
|
-
export * from "./to_cvs";
|
|
9
|
-
export * from "./generate_markdown_doc";
|
|
10
|
-
export * from "./tableHelper";
|
|
11
|
-
export * from "node-opcua-address-space";
|
|
12
|
-
export * from "node-opcua-nodesets";
|
|
13
|
-
export * from "node-opcua-variant";
|
|
14
|
-
export * from "node-opcua-assert";
|
|
15
|
-
export * from "node-opcua-data-model";
|
|
16
|
-
export * from "node-opcua-nodeid";
|
|
17
|
-
export * from "node-opcua-numeric-range";
|
|
18
|
-
export * from "node-opcua-status-code";
|
|
19
|
-
export * from "node-opcua-basic-types";
|
|
20
|
-
export * from "node-opcua-constants";
|
|
21
|
-
export * from "node-opcua-assert";
|
|
22
|
-
export * from "node-opcua-service-translate-browse-path";
|
|
23
|
-
export { MethodIds, DataTypeIds, ReferenceTypeIds, VariableIds, VariableTypeIds, ObjectTypeIds, ObjectIds } from "node-opcua-constants";
|
|
24
|
-
export { DataTypeDefinition, EnumDefinition, EnumDefinitionOptions, StructureDefinition, StructureDefinitionOptions } from "node-opcua-types";
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export * from "./displayNodeElement";
|
|
3
|
+
export * from "./promoteToMandatory";
|
|
4
|
+
export * from "./setNamespaceMetaData";
|
|
5
|
+
export * from "./build_model_inner";
|
|
6
|
+
export * from "./addExtensionObjectDataType";
|
|
7
|
+
export * from "./symbol";
|
|
8
|
+
export * from "./to_cvs";
|
|
9
|
+
export * from "./generate_markdown_doc";
|
|
10
|
+
export * from "./tableHelper";
|
|
11
|
+
export * from "node-opcua-address-space";
|
|
12
|
+
export * from "node-opcua-nodesets";
|
|
13
|
+
export * from "node-opcua-variant";
|
|
14
|
+
export * from "node-opcua-assert";
|
|
15
|
+
export * from "node-opcua-data-model";
|
|
16
|
+
export * from "node-opcua-nodeid";
|
|
17
|
+
export * from "node-opcua-numeric-range";
|
|
18
|
+
export * from "node-opcua-status-code";
|
|
19
|
+
export * from "node-opcua-basic-types";
|
|
20
|
+
export * from "node-opcua-constants";
|
|
21
|
+
export * from "node-opcua-assert";
|
|
22
|
+
export * from "node-opcua-service-translate-browse-path";
|
|
23
|
+
export { MethodIds, DataTypeIds, ReferenceTypeIds, VariableIds, VariableTypeIds, ObjectTypeIds, ObjectIds } from "node-opcua-constants";
|
|
24
|
+
export { DataTypeDefinition, EnumDefinition, EnumDefinitionOptions, StructureDefinition, StructureDefinitionOptions } from "node-opcua-types";
|
package/dist/index.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.StructureDefinition = exports.EnumDefinition = exports.DataTypeDefinition = exports.ObjectIds = exports.ObjectTypeIds = exports.VariableTypeIds = exports.VariableIds = exports.ReferenceTypeIds = exports.DataTypeIds = exports.MethodIds = void 0;
|
|
18
|
-
__exportStar(require("./types"), exports);
|
|
19
|
-
__exportStar(require("./displayNodeElement"), exports);
|
|
20
|
-
__exportStar(require("./promoteToMandatory"), exports);
|
|
21
|
-
__exportStar(require("./setNamespaceMetaData"), exports);
|
|
22
|
-
__exportStar(require("./build_model_inner"), exports);
|
|
23
|
-
__exportStar(require("./addExtensionObjectDataType"), exports);
|
|
24
|
-
__exportStar(require("./symbol"), exports);
|
|
25
|
-
__exportStar(require("./to_cvs"), exports);
|
|
26
|
-
__exportStar(require("./generate_markdown_doc"), exports);
|
|
27
|
-
__exportStar(require("./tableHelper"), exports);
|
|
28
|
-
//
|
|
29
|
-
__exportStar(require("node-opcua-address-space"), exports);
|
|
30
|
-
__exportStar(require("node-opcua-nodesets"), exports);
|
|
31
|
-
__exportStar(require("node-opcua-variant"), exports);
|
|
32
|
-
__exportStar(require("node-opcua-assert"), exports);
|
|
33
|
-
__exportStar(require("node-opcua-data-model"), exports);
|
|
34
|
-
__exportStar(require("node-opcua-nodeid"), exports);
|
|
35
|
-
__exportStar(require("node-opcua-numeric-range"), exports);
|
|
36
|
-
__exportStar(require("node-opcua-status-code"), exports);
|
|
37
|
-
__exportStar(require("node-opcua-basic-types"), exports);
|
|
38
|
-
__exportStar(require("node-opcua-constants"), exports);
|
|
39
|
-
__exportStar(require("node-opcua-assert"), exports);
|
|
40
|
-
__exportStar(require("node-opcua-service-translate-browse-path"), exports);
|
|
41
|
-
var node_opcua_constants_1 = require("node-opcua-constants");
|
|
42
|
-
Object.defineProperty(exports, "MethodIds", { enumerable: true, get: function () { return node_opcua_constants_1.MethodIds; } });
|
|
43
|
-
Object.defineProperty(exports, "DataTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.DataTypeIds; } });
|
|
44
|
-
Object.defineProperty(exports, "ReferenceTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ReferenceTypeIds; } });
|
|
45
|
-
Object.defineProperty(exports, "VariableIds", { enumerable: true, get: function () { return node_opcua_constants_1.VariableIds; } });
|
|
46
|
-
Object.defineProperty(exports, "VariableTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.VariableTypeIds; } });
|
|
47
|
-
Object.defineProperty(exports, "ObjectTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectTypeIds; } });
|
|
48
|
-
Object.defineProperty(exports, "ObjectIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectIds; } });
|
|
49
|
-
var node_opcua_types_1 = require("node-opcua-types");
|
|
50
|
-
Object.defineProperty(exports, "DataTypeDefinition", { enumerable: true, get: function () { return node_opcua_types_1.DataTypeDefinition; } });
|
|
51
|
-
Object.defineProperty(exports, "EnumDefinition", { enumerable: true, get: function () { return node_opcua_types_1.EnumDefinition; } });
|
|
52
|
-
Object.defineProperty(exports, "StructureDefinition", { enumerable: true, get: function () { return node_opcua_types_1.StructureDefinition; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.StructureDefinition = exports.EnumDefinition = exports.DataTypeDefinition = exports.ObjectIds = exports.ObjectTypeIds = exports.VariableTypeIds = exports.VariableIds = exports.ReferenceTypeIds = exports.DataTypeIds = exports.MethodIds = void 0;
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./displayNodeElement"), exports);
|
|
20
|
+
__exportStar(require("./promoteToMandatory"), exports);
|
|
21
|
+
__exportStar(require("./setNamespaceMetaData"), exports);
|
|
22
|
+
__exportStar(require("./build_model_inner"), exports);
|
|
23
|
+
__exportStar(require("./addExtensionObjectDataType"), exports);
|
|
24
|
+
__exportStar(require("./symbol"), exports);
|
|
25
|
+
__exportStar(require("./to_cvs"), exports);
|
|
26
|
+
__exportStar(require("./generate_markdown_doc"), exports);
|
|
27
|
+
__exportStar(require("./tableHelper"), exports);
|
|
28
|
+
//
|
|
29
|
+
__exportStar(require("node-opcua-address-space"), exports);
|
|
30
|
+
__exportStar(require("node-opcua-nodesets"), exports);
|
|
31
|
+
__exportStar(require("node-opcua-variant"), exports);
|
|
32
|
+
__exportStar(require("node-opcua-assert"), exports);
|
|
33
|
+
__exportStar(require("node-opcua-data-model"), exports);
|
|
34
|
+
__exportStar(require("node-opcua-nodeid"), exports);
|
|
35
|
+
__exportStar(require("node-opcua-numeric-range"), exports);
|
|
36
|
+
__exportStar(require("node-opcua-status-code"), exports);
|
|
37
|
+
__exportStar(require("node-opcua-basic-types"), exports);
|
|
38
|
+
__exportStar(require("node-opcua-constants"), exports);
|
|
39
|
+
__exportStar(require("node-opcua-assert"), exports);
|
|
40
|
+
__exportStar(require("node-opcua-service-translate-browse-path"), exports);
|
|
41
|
+
var node_opcua_constants_1 = require("node-opcua-constants");
|
|
42
|
+
Object.defineProperty(exports, "MethodIds", { enumerable: true, get: function () { return node_opcua_constants_1.MethodIds; } });
|
|
43
|
+
Object.defineProperty(exports, "DataTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.DataTypeIds; } });
|
|
44
|
+
Object.defineProperty(exports, "ReferenceTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ReferenceTypeIds; } });
|
|
45
|
+
Object.defineProperty(exports, "VariableIds", { enumerable: true, get: function () { return node_opcua_constants_1.VariableIds; } });
|
|
46
|
+
Object.defineProperty(exports, "VariableTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.VariableTypeIds; } });
|
|
47
|
+
Object.defineProperty(exports, "ObjectTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectTypeIds; } });
|
|
48
|
+
Object.defineProperty(exports, "ObjectIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectIds; } });
|
|
49
|
+
var node_opcua_types_1 = require("node-opcua-types");
|
|
50
|
+
Object.defineProperty(exports, "DataTypeDefinition", { enumerable: true, get: function () { return node_opcua_types_1.DataTypeDefinition; } });
|
|
51
|
+
Object.defineProperty(exports, "EnumDefinition", { enumerable: true, get: function () { return node_opcua_types_1.EnumDefinition; } });
|
|
52
|
+
Object.defineProperty(exports, "StructureDefinition", { enumerable: true, get: function () { return node_opcua_types_1.StructureDefinition; } });
|
|
53
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { UAMethod, UAObject, UAObjectType, UAReference, UAVariable, UAVariableType, ModellingRuleType } from "node-opcua-address-space";
|
|
2
|
-
export type UAConcrete = UAVariable | UAObject | UAMethod;
|
|
3
|
-
export declare function getChildInTypeOrBaseType(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number): {
|
|
4
|
-
propInSuperType: UAConcrete;
|
|
5
|
-
reference: UAReference;
|
|
6
|
-
};
|
|
7
|
-
export declare function promoteToMandatory(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number): UAConcrete;
|
|
8
|
-
export declare function promoteChild(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number, modellingRule?: ModellingRuleType): UAConcrete;
|
|
1
|
+
import { UAMethod, UAObject, UAObjectType, UAReference, UAVariable, UAVariableType, ModellingRuleType } from "node-opcua-address-space";
|
|
2
|
+
export type UAConcrete = UAVariable | UAObject | UAMethod;
|
|
3
|
+
export declare function getChildInTypeOrBaseType(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number): {
|
|
4
|
+
propInSuperType: UAConcrete;
|
|
5
|
+
reference: UAReference;
|
|
6
|
+
};
|
|
7
|
+
export declare function promoteToMandatory(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number): UAConcrete;
|
|
8
|
+
export declare function promoteChild(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number, modellingRule?: ModellingRuleType): UAConcrete;
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promoteChild = exports.promoteToMandatory = exports.getChildInTypeOrBaseType = void 0;
|
|
4
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
5
|
-
const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
|
|
6
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
7
|
-
const displayNodeElement_1 = require("./displayNodeElement");
|
|
8
|
-
const warningLog = (0, node_opcua_debug_1.make_warningLog)("promoteToMandatory");
|
|
9
|
-
// find the reference that links node1 to node2
|
|
10
|
-
function findReferenceToNode(node1, node2) {
|
|
11
|
-
const references = node1.allReferences();
|
|
12
|
-
const r = references.filter((reference) => {
|
|
13
|
-
return reference.nodeId.toString() === node2.nodeId.toString();
|
|
14
|
-
});
|
|
15
|
-
const ref = r ? r[0] : null;
|
|
16
|
-
/* istanbul ignore next */
|
|
17
|
-
if (!ref) {
|
|
18
|
-
// may be from subtype
|
|
19
|
-
if (node1.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType ||
|
|
20
|
-
node1.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType ||
|
|
21
|
-
node1.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
|
|
22
|
-
const uaType = node1;
|
|
23
|
-
if (uaType.subtypeOfObj) {
|
|
24
|
-
return findReferenceToNode(uaType.subtypeOfObj, node2);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
throw new Error("Internal Error cannot find ref from node " + node1.nodeId.toString() + " " + node2.nodeId.toString());
|
|
28
|
-
}
|
|
29
|
-
return ref;
|
|
30
|
-
}
|
|
31
|
-
function getChildInTypeOrBaseType(node, propertyName, namespaceIndex) {
|
|
32
|
-
const addressSpace = node.addressSpace;
|
|
33
|
-
const subtypeOf = node.subtypeOfObj;
|
|
34
|
-
/* istanbul ignore next */
|
|
35
|
-
if (!subtypeOf) {
|
|
36
|
-
throw new Error("Expecting a super type");
|
|
37
|
-
}
|
|
38
|
-
const browseResult = addressSpace.browsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(subtypeOf.nodeId, `.${namespaceIndex}:${propertyName}`));
|
|
39
|
-
const propNodeId = !browseResult.targets || !browseResult.targets[0] ? null : browseResult.targets[0].targetId;
|
|
40
|
-
/* istanbul ignore next */
|
|
41
|
-
if (!propNodeId) {
|
|
42
|
-
(0, displayNodeElement_1.displayNodeElement)(subtypeOf);
|
|
43
|
-
throw new Error("property " + propertyName + " do not exists on " + subtypeOf.browseName.toString() + " or any superType");
|
|
44
|
-
}
|
|
45
|
-
const propInSuperType = addressSpace.findNode(propNodeId);
|
|
46
|
-
/* istanbul ignore next */
|
|
47
|
-
if (!propInSuperType) {
|
|
48
|
-
throw new Error("cannot find " + propNodeId.toString());
|
|
49
|
-
}
|
|
50
|
-
// replicate property
|
|
51
|
-
const reference = findReferenceToNode(subtypeOf, propInSuperType);
|
|
52
|
-
/* istanbul ignore next */
|
|
53
|
-
if (!reference) {
|
|
54
|
-
throw new Error("cannot find reference");
|
|
55
|
-
}
|
|
56
|
-
return { propInSuperType, reference };
|
|
57
|
-
}
|
|
58
|
-
exports.getChildInTypeOrBaseType = getChildInTypeOrBaseType;
|
|
59
|
-
function promoteToMandatory(node, propertyName, namespaceIndex) {
|
|
60
|
-
// get base node
|
|
61
|
-
const { propInSuperType, reference } = getChildInTypeOrBaseType(node, propertyName, namespaceIndex);
|
|
62
|
-
// check mandatory
|
|
63
|
-
/* istanbul ignore next */
|
|
64
|
-
if (propInSuperType.modellingRule === "Mandatory") {
|
|
65
|
-
warningLog("property " + propertyName + " is already Mandatory in super type");
|
|
66
|
-
}
|
|
67
|
-
return promoteChild(node, propertyName, namespaceIndex, "Mandatory");
|
|
68
|
-
}
|
|
69
|
-
exports.promoteToMandatory = promoteToMandatory;
|
|
70
|
-
function promoteChild(node, propertyName, namespaceIndex, modellingRule) {
|
|
71
|
-
const { propInSuperType, reference } = getChildInTypeOrBaseType(node, propertyName, namespaceIndex);
|
|
72
|
-
if (!modellingRule) {
|
|
73
|
-
modellingRule = propInSuperType.modellingRule || null;
|
|
74
|
-
}
|
|
75
|
-
const newRef = {
|
|
76
|
-
isForward: false,
|
|
77
|
-
nodeId: node.nodeId,
|
|
78
|
-
referenceType: reference.referenceType
|
|
79
|
-
};
|
|
80
|
-
const newProp = propInSuperType.clone({
|
|
81
|
-
namespace: node.namespace,
|
|
82
|
-
modellingRule,
|
|
83
|
-
references: [Object.assign({}, newRef)],
|
|
84
|
-
copyAlsoModellingRules: true,
|
|
85
|
-
ignoreChildren: false
|
|
86
|
-
});
|
|
87
|
-
return newProp;
|
|
88
|
-
}
|
|
89
|
-
exports.promoteChild = promoteChild;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.promoteChild = exports.promoteToMandatory = exports.getChildInTypeOrBaseType = void 0;
|
|
4
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
5
|
+
const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
|
|
6
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
7
|
+
const displayNodeElement_1 = require("./displayNodeElement");
|
|
8
|
+
const warningLog = (0, node_opcua_debug_1.make_warningLog)("promoteToMandatory");
|
|
9
|
+
// find the reference that links node1 to node2
|
|
10
|
+
function findReferenceToNode(node1, node2) {
|
|
11
|
+
const references = node1.allReferences();
|
|
12
|
+
const r = references.filter((reference) => {
|
|
13
|
+
return reference.nodeId.toString() === node2.nodeId.toString();
|
|
14
|
+
});
|
|
15
|
+
const ref = r ? r[0] : null;
|
|
16
|
+
/* istanbul ignore next */
|
|
17
|
+
if (!ref) {
|
|
18
|
+
// may be from subtype
|
|
19
|
+
if (node1.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType ||
|
|
20
|
+
node1.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType ||
|
|
21
|
+
node1.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
|
|
22
|
+
const uaType = node1;
|
|
23
|
+
if (uaType.subtypeOfObj) {
|
|
24
|
+
return findReferenceToNode(uaType.subtypeOfObj, node2);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error("Internal Error cannot find ref from node " + node1.nodeId.toString() + " " + node2.nodeId.toString());
|
|
28
|
+
}
|
|
29
|
+
return ref;
|
|
30
|
+
}
|
|
31
|
+
function getChildInTypeOrBaseType(node, propertyName, namespaceIndex) {
|
|
32
|
+
const addressSpace = node.addressSpace;
|
|
33
|
+
const subtypeOf = node.subtypeOfObj;
|
|
34
|
+
/* istanbul ignore next */
|
|
35
|
+
if (!subtypeOf) {
|
|
36
|
+
throw new Error("Expecting a super type");
|
|
37
|
+
}
|
|
38
|
+
const browseResult = addressSpace.browsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(subtypeOf.nodeId, `.${namespaceIndex}:${propertyName}`));
|
|
39
|
+
const propNodeId = !browseResult.targets || !browseResult.targets[0] ? null : browseResult.targets[0].targetId;
|
|
40
|
+
/* istanbul ignore next */
|
|
41
|
+
if (!propNodeId) {
|
|
42
|
+
(0, displayNodeElement_1.displayNodeElement)(subtypeOf);
|
|
43
|
+
throw new Error("property " + propertyName + " do not exists on " + subtypeOf.browseName.toString() + " or any superType");
|
|
44
|
+
}
|
|
45
|
+
const propInSuperType = addressSpace.findNode(propNodeId);
|
|
46
|
+
/* istanbul ignore next */
|
|
47
|
+
if (!propInSuperType) {
|
|
48
|
+
throw new Error("cannot find " + propNodeId.toString());
|
|
49
|
+
}
|
|
50
|
+
// replicate property
|
|
51
|
+
const reference = findReferenceToNode(subtypeOf, propInSuperType);
|
|
52
|
+
/* istanbul ignore next */
|
|
53
|
+
if (!reference) {
|
|
54
|
+
throw new Error("cannot find reference");
|
|
55
|
+
}
|
|
56
|
+
return { propInSuperType, reference };
|
|
57
|
+
}
|
|
58
|
+
exports.getChildInTypeOrBaseType = getChildInTypeOrBaseType;
|
|
59
|
+
function promoteToMandatory(node, propertyName, namespaceIndex) {
|
|
60
|
+
// get base node
|
|
61
|
+
const { propInSuperType, reference } = getChildInTypeOrBaseType(node, propertyName, namespaceIndex);
|
|
62
|
+
// check mandatory
|
|
63
|
+
/* istanbul ignore next */
|
|
64
|
+
if (propInSuperType.modellingRule === "Mandatory") {
|
|
65
|
+
warningLog("property " + propertyName + " is already Mandatory in super type");
|
|
66
|
+
}
|
|
67
|
+
return promoteChild(node, propertyName, namespaceIndex, "Mandatory");
|
|
68
|
+
}
|
|
69
|
+
exports.promoteToMandatory = promoteToMandatory;
|
|
70
|
+
function promoteChild(node, propertyName, namespaceIndex, modellingRule) {
|
|
71
|
+
const { propInSuperType, reference } = getChildInTypeOrBaseType(node, propertyName, namespaceIndex);
|
|
72
|
+
if (!modellingRule) {
|
|
73
|
+
modellingRule = propInSuperType.modellingRule || null;
|
|
74
|
+
}
|
|
75
|
+
const newRef = {
|
|
76
|
+
isForward: false,
|
|
77
|
+
nodeId: node.nodeId,
|
|
78
|
+
referenceType: reference.referenceType
|
|
79
|
+
};
|
|
80
|
+
const newProp = propInSuperType.clone({
|
|
81
|
+
namespace: node.namespace,
|
|
82
|
+
modellingRule,
|
|
83
|
+
references: [Object.assign({}, newRef)],
|
|
84
|
+
copyAlsoModellingRules: true,
|
|
85
|
+
ignoreChildren: false
|
|
86
|
+
});
|
|
87
|
+
return newProp;
|
|
88
|
+
}
|
|
89
|
+
exports.promoteChild = promoteChild;
|
|
90
90
|
//# sourceMappingURL=promoteToMandatory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { setNamespaceMetaData } from "node-opcua-address-space";
|
|
1
|
+
export { setNamespaceMetaData } from "node-opcua-address-space";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setNamespaceMetaData = void 0;
|
|
4
|
-
var node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
5
|
-
Object.defineProperty(exports, "setNamespaceMetaData", { enumerable: true, get: function () { return node_opcua_address_space_1.setNamespaceMetaData; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setNamespaceMetaData = void 0;
|
|
4
|
+
var node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
5
|
+
Object.defineProperty(exports, "setNamespaceMetaData", { enumerable: true, get: function () { return node_opcua_address_space_1.setNamespaceMetaData; } });
|
|
6
6
|
//# sourceMappingURL=setNamespaceMetaData.js.map
|
package/dist/symbol.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type Symbols = [string, number, string][];
|
|
1
|
+
export type Symbols = [string, number, string][];
|
package/dist/symbol.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=symbol.js.map
|
package/dist/tableHelper.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare class TableHelper {
|
|
2
|
-
private readonly rows;
|
|
3
|
-
private readonly table;
|
|
4
|
-
private readonly head;
|
|
5
|
-
constructor(head: string[]);
|
|
6
|
-
push(row: unknown[]): void;
|
|
7
|
-
toString(): string;
|
|
8
|
-
toMarkdownTable(): string;
|
|
9
|
-
}
|
|
1
|
+
export declare class TableHelper {
|
|
2
|
+
private readonly rows;
|
|
3
|
+
private readonly table;
|
|
4
|
+
private readonly head;
|
|
5
|
+
constructor(head: string[]);
|
|
6
|
+
push(row: unknown[]): void;
|
|
7
|
+
toString(): string;
|
|
8
|
+
toMarkdownTable(): string;
|
|
9
|
+
}
|
package/dist/tableHelper.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableHelper = void 0;
|
|
4
|
-
// tslint:disable-next-line: no-var-requires
|
|
5
|
-
const Table = require("cli-table3");
|
|
6
|
-
const chars1 = {
|
|
7
|
-
// tslint:disable-next-line: object-literal-sort-keys
|
|
8
|
-
"top": "-", "top-mid": "+", "top-left": "+", "top-right": "+",
|
|
9
|
-
"bottom": "-", "bottom-mid": "+", "bottom-left": "+", "bottom-right": "+",
|
|
10
|
-
"left": "|", "left-mid": "+", "mid": "-", "mid-mid": "+",
|
|
11
|
-
"right": "|", "right-mid": "+", "middle": "|"
|
|
12
|
-
};
|
|
13
|
-
const chars2 = {
|
|
14
|
-
// tslint:disable-next-line: object-literal-sort-keys
|
|
15
|
-
"top": " ", "top-mid": " ", "top-left": " ", "top-right": " ",
|
|
16
|
-
"bottom": " ", "bottom-mid": " ", "bottom-left": " ", "bottom-right": " ",
|
|
17
|
-
"left": "| ", "left-mid": "| ", "mid": "-", "mid-mid": " | ",
|
|
18
|
-
"right": " |", "right-mid": "| ", "middle": " | "
|
|
19
|
-
};
|
|
20
|
-
const chars3 = {
|
|
21
|
-
// tslint:disable-next-line: object-literal-sort-keys
|
|
22
|
-
"top": "", "top-mid": "", "top-left": "", "top-right": "",
|
|
23
|
-
"bottom": "", "bottom-mid": "", "bottom-left": "", "bottom-right": "",
|
|
24
|
-
"left": "| ", "left-mid": "", "mid": "-", "mid-mid": " | ",
|
|
25
|
-
"right": " |", "right-mid": "", "middle": " | "
|
|
26
|
-
};
|
|
27
|
-
function toMarkdownTable(table) {
|
|
28
|
-
const t = [];
|
|
29
|
-
t.push("| " + table.head.join(" | ") + " |");
|
|
30
|
-
t.push("| " + table.head.map(() => "---").join(" | ") + " |");
|
|
31
|
-
for (const r of table.rows) {
|
|
32
|
-
t.push("| " + r.join(" | ") + " |");
|
|
33
|
-
}
|
|
34
|
-
return t.join("\n");
|
|
35
|
-
}
|
|
36
|
-
class TableHelper {
|
|
37
|
-
constructor(head) {
|
|
38
|
-
this.rows = [];
|
|
39
|
-
this.rows = [];
|
|
40
|
-
// instantiate
|
|
41
|
-
this.table = new Table({
|
|
42
|
-
// chars,
|
|
43
|
-
head,
|
|
44
|
-
// colWidths: [100, 200, 50, 50,]
|
|
45
|
-
});
|
|
46
|
-
this.head = head;
|
|
47
|
-
}
|
|
48
|
-
push(row) {
|
|
49
|
-
this.table.push(row);
|
|
50
|
-
const row2 = row.map((c) => (c.content) ? c.content : c);
|
|
51
|
-
this.rows.push(row2);
|
|
52
|
-
}
|
|
53
|
-
toString() {
|
|
54
|
-
return this.table.toString();
|
|
55
|
-
}
|
|
56
|
-
toMarkdownTable() {
|
|
57
|
-
return toMarkdownTable({ head: this.head, rows: this.rows });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.TableHelper = TableHelper;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHelper = void 0;
|
|
4
|
+
// tslint:disable-next-line: no-var-requires
|
|
5
|
+
const Table = require("cli-table3");
|
|
6
|
+
const chars1 = {
|
|
7
|
+
// tslint:disable-next-line: object-literal-sort-keys
|
|
8
|
+
"top": "-", "top-mid": "+", "top-left": "+", "top-right": "+",
|
|
9
|
+
"bottom": "-", "bottom-mid": "+", "bottom-left": "+", "bottom-right": "+",
|
|
10
|
+
"left": "|", "left-mid": "+", "mid": "-", "mid-mid": "+",
|
|
11
|
+
"right": "|", "right-mid": "+", "middle": "|"
|
|
12
|
+
};
|
|
13
|
+
const chars2 = {
|
|
14
|
+
// tslint:disable-next-line: object-literal-sort-keys
|
|
15
|
+
"top": " ", "top-mid": " ", "top-left": " ", "top-right": " ",
|
|
16
|
+
"bottom": " ", "bottom-mid": " ", "bottom-left": " ", "bottom-right": " ",
|
|
17
|
+
"left": "| ", "left-mid": "| ", "mid": "-", "mid-mid": " | ",
|
|
18
|
+
"right": " |", "right-mid": "| ", "middle": " | "
|
|
19
|
+
};
|
|
20
|
+
const chars3 = {
|
|
21
|
+
// tslint:disable-next-line: object-literal-sort-keys
|
|
22
|
+
"top": "", "top-mid": "", "top-left": "", "top-right": "",
|
|
23
|
+
"bottom": "", "bottom-mid": "", "bottom-left": "", "bottom-right": "",
|
|
24
|
+
"left": "| ", "left-mid": "", "mid": "-", "mid-mid": " | ",
|
|
25
|
+
"right": " |", "right-mid": "", "middle": " | "
|
|
26
|
+
};
|
|
27
|
+
function toMarkdownTable(table) {
|
|
28
|
+
const t = [];
|
|
29
|
+
t.push("| " + table.head.join(" | ") + " |");
|
|
30
|
+
t.push("| " + table.head.map(() => "---").join(" | ") + " |");
|
|
31
|
+
for (const r of table.rows) {
|
|
32
|
+
t.push("| " + r.join(" | ") + " |");
|
|
33
|
+
}
|
|
34
|
+
return t.join("\n");
|
|
35
|
+
}
|
|
36
|
+
class TableHelper {
|
|
37
|
+
constructor(head) {
|
|
38
|
+
this.rows = [];
|
|
39
|
+
this.rows = [];
|
|
40
|
+
// instantiate
|
|
41
|
+
this.table = new Table({
|
|
42
|
+
// chars,
|
|
43
|
+
head,
|
|
44
|
+
// colWidths: [100, 200, 50, 50,]
|
|
45
|
+
});
|
|
46
|
+
this.head = head;
|
|
47
|
+
}
|
|
48
|
+
push(row) {
|
|
49
|
+
this.table.push(row);
|
|
50
|
+
const row2 = row.map((c) => (c.content) ? c.content : c);
|
|
51
|
+
this.rows.push(row2);
|
|
52
|
+
}
|
|
53
|
+
toString() {
|
|
54
|
+
return this.table.toString();
|
|
55
|
+
}
|
|
56
|
+
toMarkdownTable() {
|
|
57
|
+
return toMarkdownTable({ head: this.head, rows: this.rows });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.TableHelper = TableHelper;
|
|
61
61
|
//# sourceMappingURL=tableHelper.js.map
|
package/dist/to_cvs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Symbols } from "./symbol";
|
|
2
|
-
export declare function toCSV(arr: Symbols): string;
|
|
1
|
+
import { Symbols } from "./symbol";
|
|
2
|
+
export declare function toCSV(arr: Symbols): string;
|
package/dist/to_cvs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCSV = void 0;
|
|
4
|
-
function toCSV(arr) {
|
|
5
|
-
const line = [];
|
|
6
|
-
for (const [name, value, nodeClass] of arr) {
|
|
7
|
-
line.push([name, value, nodeClass].join(","));
|
|
8
|
-
}
|
|
9
|
-
return line.join("\n");
|
|
10
|
-
}
|
|
11
|
-
exports.toCSV = toCSV;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCSV = void 0;
|
|
4
|
+
function toCSV(arr) {
|
|
5
|
+
const line = [];
|
|
6
|
+
for (const [name, value, nodeClass] of arr) {
|
|
7
|
+
line.push([name, value, nodeClass].join(","));
|
|
8
|
+
}
|
|
9
|
+
return line.join("\n");
|
|
10
|
+
}
|
|
11
|
+
exports.toCSV = toCSV;
|
|
12
12
|
//# sourceMappingURL=to_cvs.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { UANamespaceMetadata } from "node-opcua-address-space";
|
|
1
|
+
export { UANamespaceMetadata } from "node-opcua-address-space";
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Namespace } from "node-opcua-address-space";
|
|
2
|
-
import { BuildDocumentationOptions } from "..";
|
|
3
|
-
export declare function buildDocumentationToFile(namespace: Namespace, filename: string, options?: BuildDocumentationOptions): Promise<void>;
|
|
1
|
+
import { Namespace } from "node-opcua-address-space";
|
|
2
|
+
import { BuildDocumentationOptions } from "..";
|
|
3
|
+
export declare function buildDocumentationToFile(namespace: Namespace, filename: string, options?: BuildDocumentationOptions): Promise<void>;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.buildDocumentationToFile = void 0;
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const __1 = require("..");
|
|
15
|
-
function buildDocumentationToFile(namespace, filename, options) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const str = yield (0, __1.buildDocumentationToString)(namespace, options);
|
|
18
|
-
const stream = fs.createWriteStream("documentation.md");
|
|
19
|
-
stream.write(str);
|
|
20
|
-
yield new Promise((resolve) => {
|
|
21
|
-
stream.on("finish", resolve);
|
|
22
|
-
stream.end();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
exports.buildDocumentationToFile = buildDocumentationToFile;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildDocumentationToFile = void 0;
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const __1 = require("..");
|
|
15
|
+
function buildDocumentationToFile(namespace, filename, options) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const str = yield (0, __1.buildDocumentationToString)(namespace, options);
|
|
18
|
+
const stream = fs.createWriteStream("documentation.md");
|
|
19
|
+
stream.write(str);
|
|
20
|
+
yield new Promise((resolve) => {
|
|
21
|
+
stream.on("finish", resolve);
|
|
22
|
+
stream.end();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.buildDocumentationToFile = buildDocumentationToFile;
|
|
27
27
|
//# sourceMappingURL=build_documentation_to_file.js.map
|