node-opcua-modeler 2.97.0 → 2.98.2
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
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Namespace as INamespace, UADataType, UAObject, UAVariableType } from "node-opcua-address-space";
|
|
2
|
-
import { LocalizedTextLike, QualifiedNameLike } from "node-opcua-data-model";
|
|
3
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
-
import { StructureDefinitionOptions } from "node-opcua-types";
|
|
5
|
-
/**
|
|
6
|
-
* create the deprecated DataTypeDictionary node that was
|
|
7
|
-
* used up to version 1.03
|
|
8
|
-
*/
|
|
9
|
-
export declare function getOrCreateDataTypeSystem(namespace: INamespace): UAObject;
|
|
10
|
-
export interface ExtensionObjectDefinition {
|
|
11
|
-
browseName: QualifiedNameLike;
|
|
12
|
-
description: LocalizedTextLike;
|
|
13
|
-
isAbstract: boolean;
|
|
14
|
-
structureDefinition: StructureDefinitionOptions;
|
|
15
|
-
binaryEncoding?: NodeId;
|
|
16
|
-
xmlEncoding?: NodeId;
|
|
17
|
-
jsonEncoding?: NodeId;
|
|
18
|
-
subtypeOf?: UADataType;
|
|
19
|
-
}
|
|
20
|
-
export declare function addExtensionObjectDataType(namespace: INamespace, options: ExtensionObjectDefinition): Promise<UADataType>;
|
|
21
|
-
export declare function addVariableTypeForDataType(namespace: INamespace, dataType: UADataType): UAVariableType;
|
|
1
|
+
import { Namespace as INamespace, UADataType, UAObject, UAVariableType } from "node-opcua-address-space";
|
|
2
|
+
import { LocalizedTextLike, QualifiedNameLike } from "node-opcua-data-model";
|
|
3
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
+
import { StructureDefinitionOptions } from "node-opcua-types";
|
|
5
|
+
/**
|
|
6
|
+
* create the deprecated DataTypeDictionary node that was
|
|
7
|
+
* used up to version 1.03
|
|
8
|
+
*/
|
|
9
|
+
export declare function getOrCreateDataTypeSystem(namespace: INamespace): UAObject;
|
|
10
|
+
export interface ExtensionObjectDefinition {
|
|
11
|
+
browseName: QualifiedNameLike;
|
|
12
|
+
description: LocalizedTextLike;
|
|
13
|
+
isAbstract: boolean;
|
|
14
|
+
structureDefinition: StructureDefinitionOptions;
|
|
15
|
+
binaryEncoding?: NodeId;
|
|
16
|
+
xmlEncoding?: NodeId;
|
|
17
|
+
jsonEncoding?: NodeId;
|
|
18
|
+
subtypeOf?: UADataType;
|
|
19
|
+
}
|
|
20
|
+
export declare function addExtensionObjectDataType(namespace: INamespace, options: ExtensionObjectDefinition): Promise<UADataType>;
|
|
21
|
+
export declare function addVariableTypeForDataType(namespace: INamespace, dataType: UADataType): UAVariableType;
|
|
@@ -1,133 +1,133 @@
|
|
|
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.addVariableTypeForDataType = exports.addExtensionObjectDataType = exports.getOrCreateDataTypeSystem = void 0;
|
|
13
|
-
const node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
14
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
15
|
-
const node_opcua_client_dynamic_extension_object_1 = require("node-opcua-client-dynamic-extension-object");
|
|
16
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
17
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
18
|
-
const node_opcua_schemas_1 = require("node-opcua-schemas");
|
|
19
|
-
const node_opcua_types_1 = require("node-opcua-types");
|
|
20
|
-
/**
|
|
21
|
-
* create the deprecated DataTypeDictionary node that was
|
|
22
|
-
* used up to version 1.03
|
|
23
|
-
*/
|
|
24
|
-
function getOrCreateDataTypeSystem(namespace) {
|
|
25
|
-
const addressSpace = namespace.addressSpace;
|
|
26
|
-
const opcBinaryTypeSystem = addressSpace.findNode("OPCBinarySchema_TypeSystem");
|
|
27
|
-
/* istanbul ignore next */
|
|
28
|
-
if (!opcBinaryTypeSystem) {
|
|
29
|
-
throw new Error("Cannot find OPCBinarySchema_TypeSystem");
|
|
30
|
-
}
|
|
31
|
-
(0, node_opcua_assert_1.default)(opcBinaryTypeSystem.nodeId.toString() === "ns=0;i=93");
|
|
32
|
-
(0, node_opcua_assert_1.default)(opcBinaryTypeSystem.browseName.toString() === "OPC Binary");
|
|
33
|
-
return opcBinaryTypeSystem;
|
|
34
|
-
}
|
|
35
|
-
exports.getOrCreateDataTypeSystem = getOrCreateDataTypeSystem;
|
|
36
|
-
function addExtensionObjectDataType(namespace, options) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const addressSpace = namespace.addressSpace;
|
|
39
|
-
// encodings
|
|
40
|
-
const dataTypeEncodingType = addressSpace.findObjectType("DataTypeEncodingType");
|
|
41
|
-
/* istanbul ignore next */
|
|
42
|
-
if (!dataTypeEncodingType) {
|
|
43
|
-
throw new Error("Cannot find DataTypeEncodingType");
|
|
44
|
-
}
|
|
45
|
-
/* istanbul ignore next */
|
|
46
|
-
if (!options.browseName.toString().match(/DataType$/)) {
|
|
47
|
-
throw new Error("DataType name must end up with DataType ! " + options.browseName.toString());
|
|
48
|
-
}
|
|
49
|
-
const baseSuperType = "Structure";
|
|
50
|
-
const subtypeOf = addressSpace.findDataType(options.subtypeOf ? options.subtypeOf : baseSuperType);
|
|
51
|
-
if (!subtypeOf) {
|
|
52
|
-
throw new Error("Cannot find base DataType ");
|
|
53
|
-
}
|
|
54
|
-
const structureDefinition = options.structureDefinition;
|
|
55
|
-
structureDefinition.baseDataType = (0, node_opcua_nodeid_1.resolveNodeId)(structureDefinition.baseDataType || "Structure");
|
|
56
|
-
const isAbstract = options.isAbstract || false;
|
|
57
|
-
const dataType = namespace.createDataType({
|
|
58
|
-
browseName: options.browseName,
|
|
59
|
-
description: options.description,
|
|
60
|
-
isAbstract,
|
|
61
|
-
subtypeOf
|
|
62
|
-
});
|
|
63
|
-
const defaultBinary = dataTypeEncodingType.instantiate({
|
|
64
|
-
browseName: (0, node_opcua_data_model_1.coerceQualifiedName)("0:Default Binary"),
|
|
65
|
-
encodingOf: dataType
|
|
66
|
-
// nodeId: defaultBinaryEncodingNode,
|
|
67
|
-
});
|
|
68
|
-
(0, node_opcua_assert_1.default)(defaultBinary.browseName.toString() === "Default Binary");
|
|
69
|
-
dataType.$fullDefinition = new node_opcua_types_1.StructureDefinition(structureDefinition);
|
|
70
|
-
const d = dataType.getStructureDefinition();
|
|
71
|
-
(0, node_opcua_assert_1.default)(!node_opcua_nodeid_1.NodeId.sameNodeId(d.baseDataType, node_opcua_nodeid_1.NodeId.nullNodeId));
|
|
72
|
-
/// --------------- Create constructor
|
|
73
|
-
const dataTypeManager = addressSpace.$$extraDataTypeManager;
|
|
74
|
-
const dataTypeFactory = dataTypeManager.getDataTypeFactory(namespace.index);
|
|
75
|
-
const session = new node_opcua_address_space_1.PseudoSession(addressSpace);
|
|
76
|
-
const className = dataType.browseName.name;
|
|
77
|
-
const cache = {};
|
|
78
|
-
const schema = yield (0, node_opcua_client_dynamic_extension_object_1.convertDataTypeDefinitionToStructureTypeSchema)(session, dataType.nodeId, className, dataType.getStructureDefinition(), dataTypeFactory, isAbstract, cache);
|
|
79
|
-
const Constructor = (0, node_opcua_schemas_1.createDynamicObjectConstructor)(schema, dataTypeFactory);
|
|
80
|
-
return dataType;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
exports.addExtensionObjectDataType = addExtensionObjectDataType;
|
|
84
|
-
function addVariableTypeForDataType(namespace, dataType) {
|
|
85
|
-
var _a;
|
|
86
|
-
const addressSpace = namespace.addressSpace;
|
|
87
|
-
// get Definition
|
|
88
|
-
const definition = dataType.getStructureDefinition();
|
|
89
|
-
// istanbul ignore next
|
|
90
|
-
if (!definition || !(definition instanceof node_opcua_types_1.StructureDefinition)) {
|
|
91
|
-
throw new Error("dataType is not a structure");
|
|
92
|
-
}
|
|
93
|
-
const variableTypeName = (_a = dataType.browseName.name) === null || _a === void 0 ? void 0 : _a.replace("DataType", "Type");
|
|
94
|
-
const variableType = namespace.addVariableType({
|
|
95
|
-
browseName: variableTypeName,
|
|
96
|
-
dataType: dataType.nodeId
|
|
97
|
-
});
|
|
98
|
-
const structure = addressSpace.findDataType("Structure");
|
|
99
|
-
for (const field of definition.fields || []) {
|
|
100
|
-
let typeDefinition = "BaseVariableType";
|
|
101
|
-
const fType = addressSpace.findDataType(field.dataType);
|
|
102
|
-
/* istanbul ignore next */
|
|
103
|
-
if (!fType) {
|
|
104
|
-
throw new Error("Cannot find dataType" + field.dataType.toString());
|
|
105
|
-
}
|
|
106
|
-
if (fType.isSubtypeOf(structure)) {
|
|
107
|
-
const name = fType.browseName.name.replace("DataType", "Type");
|
|
108
|
-
typeDefinition = addressSpace.findVariableType(name, field.dataType.namespace);
|
|
109
|
-
const comp = typeDefinition.instantiate({
|
|
110
|
-
browseName: field.name,
|
|
111
|
-
componentOf: variableType,
|
|
112
|
-
dataType: field.dataType,
|
|
113
|
-
description: field.description,
|
|
114
|
-
modellingRule: "Mandatory",
|
|
115
|
-
valueRank: field.valueRank === undefined ? -1 : field.valueRank
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
const comp = namespace.addVariable({
|
|
120
|
-
browseName: field.name,
|
|
121
|
-
componentOf: variableType,
|
|
122
|
-
dataType: field.dataType,
|
|
123
|
-
description: field.description,
|
|
124
|
-
modellingRule: "Mandatory",
|
|
125
|
-
typeDefinition,
|
|
126
|
-
valueRank: field.valueRank === undefined ? -1 : field.valueRank
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return variableType;
|
|
131
|
-
}
|
|
132
|
-
exports.addVariableTypeForDataType = addVariableTypeForDataType;
|
|
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.addVariableTypeForDataType = exports.addExtensionObjectDataType = exports.getOrCreateDataTypeSystem = void 0;
|
|
13
|
+
const node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
14
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
15
|
+
const node_opcua_client_dynamic_extension_object_1 = require("node-opcua-client-dynamic-extension-object");
|
|
16
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
17
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
18
|
+
const node_opcua_schemas_1 = require("node-opcua-schemas");
|
|
19
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
20
|
+
/**
|
|
21
|
+
* create the deprecated DataTypeDictionary node that was
|
|
22
|
+
* used up to version 1.03
|
|
23
|
+
*/
|
|
24
|
+
function getOrCreateDataTypeSystem(namespace) {
|
|
25
|
+
const addressSpace = namespace.addressSpace;
|
|
26
|
+
const opcBinaryTypeSystem = addressSpace.findNode("OPCBinarySchema_TypeSystem");
|
|
27
|
+
/* istanbul ignore next */
|
|
28
|
+
if (!opcBinaryTypeSystem) {
|
|
29
|
+
throw new Error("Cannot find OPCBinarySchema_TypeSystem");
|
|
30
|
+
}
|
|
31
|
+
(0, node_opcua_assert_1.default)(opcBinaryTypeSystem.nodeId.toString() === "ns=0;i=93");
|
|
32
|
+
(0, node_opcua_assert_1.default)(opcBinaryTypeSystem.browseName.toString() === "OPC Binary");
|
|
33
|
+
return opcBinaryTypeSystem;
|
|
34
|
+
}
|
|
35
|
+
exports.getOrCreateDataTypeSystem = getOrCreateDataTypeSystem;
|
|
36
|
+
function addExtensionObjectDataType(namespace, options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const addressSpace = namespace.addressSpace;
|
|
39
|
+
// encodings
|
|
40
|
+
const dataTypeEncodingType = addressSpace.findObjectType("DataTypeEncodingType");
|
|
41
|
+
/* istanbul ignore next */
|
|
42
|
+
if (!dataTypeEncodingType) {
|
|
43
|
+
throw new Error("Cannot find DataTypeEncodingType");
|
|
44
|
+
}
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
if (!options.browseName.toString().match(/DataType$/)) {
|
|
47
|
+
throw new Error("DataType name must end up with DataType ! " + options.browseName.toString());
|
|
48
|
+
}
|
|
49
|
+
const baseSuperType = "Structure";
|
|
50
|
+
const subtypeOf = addressSpace.findDataType(options.subtypeOf ? options.subtypeOf : baseSuperType);
|
|
51
|
+
if (!subtypeOf) {
|
|
52
|
+
throw new Error("Cannot find base DataType ");
|
|
53
|
+
}
|
|
54
|
+
const structureDefinition = options.structureDefinition;
|
|
55
|
+
structureDefinition.baseDataType = (0, node_opcua_nodeid_1.resolveNodeId)(structureDefinition.baseDataType || "Structure");
|
|
56
|
+
const isAbstract = options.isAbstract || false;
|
|
57
|
+
const dataType = namespace.createDataType({
|
|
58
|
+
browseName: options.browseName,
|
|
59
|
+
description: options.description,
|
|
60
|
+
isAbstract,
|
|
61
|
+
subtypeOf
|
|
62
|
+
});
|
|
63
|
+
const defaultBinary = dataTypeEncodingType.instantiate({
|
|
64
|
+
browseName: (0, node_opcua_data_model_1.coerceQualifiedName)("0:Default Binary"),
|
|
65
|
+
encodingOf: dataType
|
|
66
|
+
// nodeId: defaultBinaryEncodingNode,
|
|
67
|
+
});
|
|
68
|
+
(0, node_opcua_assert_1.default)(defaultBinary.browseName.toString() === "Default Binary");
|
|
69
|
+
dataType.$fullDefinition = new node_opcua_types_1.StructureDefinition(structureDefinition);
|
|
70
|
+
const d = dataType.getStructureDefinition();
|
|
71
|
+
(0, node_opcua_assert_1.default)(!node_opcua_nodeid_1.NodeId.sameNodeId(d.baseDataType, node_opcua_nodeid_1.NodeId.nullNodeId));
|
|
72
|
+
/// --------------- Create constructor
|
|
73
|
+
const dataTypeManager = addressSpace.$$extraDataTypeManager;
|
|
74
|
+
const dataTypeFactory = dataTypeManager.getDataTypeFactory(namespace.index);
|
|
75
|
+
const session = new node_opcua_address_space_1.PseudoSession(addressSpace);
|
|
76
|
+
const className = dataType.browseName.name;
|
|
77
|
+
const cache = {};
|
|
78
|
+
const schema = yield (0, node_opcua_client_dynamic_extension_object_1.convertDataTypeDefinitionToStructureTypeSchema)(session, dataType.nodeId, className, dataType.getStructureDefinition(), dataTypeFactory, isAbstract, cache);
|
|
79
|
+
const Constructor = (0, node_opcua_schemas_1.createDynamicObjectConstructor)(schema, dataTypeFactory);
|
|
80
|
+
return dataType;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports.addExtensionObjectDataType = addExtensionObjectDataType;
|
|
84
|
+
function addVariableTypeForDataType(namespace, dataType) {
|
|
85
|
+
var _a;
|
|
86
|
+
const addressSpace = namespace.addressSpace;
|
|
87
|
+
// get Definition
|
|
88
|
+
const definition = dataType.getStructureDefinition();
|
|
89
|
+
// istanbul ignore next
|
|
90
|
+
if (!definition || !(definition instanceof node_opcua_types_1.StructureDefinition)) {
|
|
91
|
+
throw new Error("dataType is not a structure");
|
|
92
|
+
}
|
|
93
|
+
const variableTypeName = (_a = dataType.browseName.name) === null || _a === void 0 ? void 0 : _a.replace("DataType", "Type");
|
|
94
|
+
const variableType = namespace.addVariableType({
|
|
95
|
+
browseName: variableTypeName,
|
|
96
|
+
dataType: dataType.nodeId
|
|
97
|
+
});
|
|
98
|
+
const structure = addressSpace.findDataType("Structure");
|
|
99
|
+
for (const field of definition.fields || []) {
|
|
100
|
+
let typeDefinition = "BaseVariableType";
|
|
101
|
+
const fType = addressSpace.findDataType(field.dataType);
|
|
102
|
+
/* istanbul ignore next */
|
|
103
|
+
if (!fType) {
|
|
104
|
+
throw new Error("Cannot find dataType" + field.dataType.toString());
|
|
105
|
+
}
|
|
106
|
+
if (fType.isSubtypeOf(structure)) {
|
|
107
|
+
const name = fType.browseName.name.replace("DataType", "Type");
|
|
108
|
+
typeDefinition = addressSpace.findVariableType(name, field.dataType.namespace);
|
|
109
|
+
const comp = typeDefinition.instantiate({
|
|
110
|
+
browseName: field.name,
|
|
111
|
+
componentOf: variableType,
|
|
112
|
+
dataType: field.dataType,
|
|
113
|
+
description: field.description,
|
|
114
|
+
modellingRule: "Mandatory",
|
|
115
|
+
valueRank: field.valueRank === undefined ? -1 : field.valueRank
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const comp = namespace.addVariable({
|
|
120
|
+
browseName: field.name,
|
|
121
|
+
componentOf: variableType,
|
|
122
|
+
dataType: field.dataType,
|
|
123
|
+
description: field.description,
|
|
124
|
+
modellingRule: "Mandatory",
|
|
125
|
+
typeDefinition,
|
|
126
|
+
valueRank: field.valueRank === undefined ? -1 : field.valueRank
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return variableType;
|
|
131
|
+
}
|
|
132
|
+
exports.addVariableTypeForDataType = addVariableTypeForDataType;
|
|
133
133
|
//# sourceMappingURL=addExtensionObjectDataType.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AddressSpace, XmlLoaderAsyncFunc } from "node-opcua-address-space";
|
|
2
|
-
import { Symbols } from "./symbol";
|
|
3
|
-
export interface BuildModelOptionsBase {
|
|
4
|
-
version: string;
|
|
5
|
-
namespaceUri: string;
|
|
6
|
-
xmlFiles: string[];
|
|
7
|
-
createModel: (addressSpace: AddressSpace) => Promise<void>;
|
|
8
|
-
presetSymbols?: Symbols;
|
|
9
|
-
}
|
|
10
|
-
export interface BuildModelOptions extends BuildModelOptionsBase {
|
|
11
|
-
xmlLoader: XmlLoaderAsyncFunc;
|
|
12
|
-
}
|
|
13
|
-
export declare function buildModelInner(data: BuildModelOptions): Promise<{
|
|
14
|
-
markdown: string;
|
|
15
|
-
xmlModel: string;
|
|
16
|
-
symbols: Symbols;
|
|
17
|
-
}>;
|
|
1
|
+
import { AddressSpace, XmlLoaderAsyncFunc } from "node-opcua-address-space";
|
|
2
|
+
import { Symbols } from "./symbol";
|
|
3
|
+
export interface BuildModelOptionsBase {
|
|
4
|
+
version: string;
|
|
5
|
+
namespaceUri: string;
|
|
6
|
+
xmlFiles: string[];
|
|
7
|
+
createModel: (addressSpace: AddressSpace) => Promise<void>;
|
|
8
|
+
presetSymbols?: Symbols;
|
|
9
|
+
}
|
|
10
|
+
export interface BuildModelOptions extends BuildModelOptionsBase {
|
|
11
|
+
xmlLoader: XmlLoaderAsyncFunc;
|
|
12
|
+
}
|
|
13
|
+
export declare function buildModelInner(data: BuildModelOptions): Promise<{
|
|
14
|
+
markdown: string;
|
|
15
|
+
xmlModel: string;
|
|
16
|
+
symbols: Symbols;
|
|
17
|
+
}>;
|
|
@@ -1,43 +1,43 @@
|
|
|
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.buildModelInner = void 0;
|
|
13
|
-
const node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
14
|
-
const generate_markdown_doc_1 = require("./generate_markdown_doc");
|
|
15
|
-
function buildModelInner(data) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
try {
|
|
18
|
-
const addressSpace = node_opcua_address_space_1.AddressSpace.create();
|
|
19
|
-
// create own namespace (before loading other xml files)
|
|
20
|
-
const ns = addressSpace.registerNamespace(data.namespaceUri);
|
|
21
|
-
const nodeIdManager = ns._nodeIdManager;
|
|
22
|
-
if (data.presetSymbols) {
|
|
23
|
-
nodeIdManager.setSymbols(data.presetSymbols);
|
|
24
|
-
}
|
|
25
|
-
yield (0, node_opcua_address_space_1.generateAddressSpaceRaw)(addressSpace, data.xmlFiles, data.xmlLoader, {});
|
|
26
|
-
addressSpace.getOwnNamespace().registerSymbolicNames = true;
|
|
27
|
-
yield data.createModel(addressSpace);
|
|
28
|
-
addressSpace.getOwnNamespace().registerSymbolicNames = false;
|
|
29
|
-
const xmlModel = ns.toNodeset2XML();
|
|
30
|
-
const symbols = nodeIdManager.getSymbols();
|
|
31
|
-
const doc = yield (0, generate_markdown_doc_1.buildDocumentationToString)(ns, {});
|
|
32
|
-
addressSpace.dispose();
|
|
33
|
-
return { xmlModel, symbols, markdown: doc };
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
// tslint:disable-next-line: no-console
|
|
37
|
-
console.log("Error", err);
|
|
38
|
-
throw err;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
exports.buildModelInner = buildModelInner;
|
|
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.buildModelInner = void 0;
|
|
13
|
+
const node_opcua_address_space_1 = require("node-opcua-address-space");
|
|
14
|
+
const generate_markdown_doc_1 = require("./generate_markdown_doc");
|
|
15
|
+
function buildModelInner(data) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
const addressSpace = node_opcua_address_space_1.AddressSpace.create();
|
|
19
|
+
// create own namespace (before loading other xml files)
|
|
20
|
+
const ns = addressSpace.registerNamespace(data.namespaceUri);
|
|
21
|
+
const nodeIdManager = ns._nodeIdManager;
|
|
22
|
+
if (data.presetSymbols) {
|
|
23
|
+
nodeIdManager.setSymbols(data.presetSymbols);
|
|
24
|
+
}
|
|
25
|
+
yield (0, node_opcua_address_space_1.generateAddressSpaceRaw)(addressSpace, data.xmlFiles, data.xmlLoader, {});
|
|
26
|
+
addressSpace.getOwnNamespace().registerSymbolicNames = true;
|
|
27
|
+
yield data.createModel(addressSpace);
|
|
28
|
+
addressSpace.getOwnNamespace().registerSymbolicNames = false;
|
|
29
|
+
const xmlModel = ns.toNodeset2XML();
|
|
30
|
+
const symbols = nodeIdManager.getSymbols();
|
|
31
|
+
const doc = yield (0, generate_markdown_doc_1.buildDocumentationToString)(ns, {});
|
|
32
|
+
addressSpace.dispose();
|
|
33
|
+
return { xmlModel, symbols, markdown: doc };
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
// tslint:disable-next-line: no-console
|
|
37
|
+
console.log("Error", err);
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
exports.buildModelInner = buildModelInner;
|
|
43
43
|
//# sourceMappingURL=build_model_inner.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseNode } from "node-opcua-address-space";
|
|
2
|
-
export interface DisplayNodeOptions {
|
|
3
|
-
format?: "cli" | "markdown";
|
|
4
|
-
recursive?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare function displayNodeElement(node: BaseNode, options?: DisplayNodeOptions): string;
|
|
1
|
+
import { BaseNode } from "node-opcua-address-space";
|
|
2
|
+
export interface DisplayNodeOptions {
|
|
3
|
+
format?: "cli" | "markdown";
|
|
4
|
+
recursive?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function displayNodeElement(node: BaseNode, options?: DisplayNodeOptions): string;
|