node-opcua-convert-nodeset-to-javascript 2.63.1 → 2.64.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.
Files changed (38) hide show
  1. package/dist/cache.d.ts +62 -0
  2. package/dist/cache.js +273 -0
  3. package/dist/cache.js.map +1 -0
  4. package/dist/convert_namespace_to_typescript.d.ts +3 -3
  5. package/dist/convert_namespace_to_typescript.js +172 -163
  6. package/dist/convert_namespace_to_typescript.js.map +1 -1
  7. package/dist/convert_to_typescript.d.ts +109 -109
  8. package/dist/convert_to_typescript.js +884 -879
  9. package/dist/convert_to_typescript.js.map +1 -1
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +15 -15
  12. package/dist/main.d.ts +1 -1
  13. package/dist/main.js +74 -65
  14. package/dist/main.js.map +1 -1
  15. package/dist/official_namespaces.d.ts +23 -23
  16. package/dist/official_namespaces.js +35 -35
  17. package/dist/options.d.ts +5 -4
  18. package/dist/options.js +2 -2
  19. package/dist/private/cache.d.ts +58 -58
  20. package/dist/private/cache.js +212 -212
  21. package/dist/private/cache.js.map +1 -1
  22. package/dist/private/to_filename.d.ts +1 -1
  23. package/dist/private/to_filename.js +9 -9
  24. package/dist/private/utils.d.ts +24 -24
  25. package/dist/private/utils.js +260 -260
  26. package/dist/private-stuff.d.ts +4 -4
  27. package/dist/private-stuff.js +16 -16
  28. package/dist/utils.d.ts +20 -0
  29. package/dist/utils.js +221 -0
  30. package/dist/utils.js.map +1 -0
  31. package/dist/walk_through.d.ts +13 -13
  32. package/dist/walk_through.js +86 -86
  33. package/package.json +22 -22
  34. package/source/convert_namespace_to_typescript.ts +21 -10
  35. package/source/convert_to_typescript.ts +23 -17
  36. package/source/main.ts +23 -14
  37. package/source/options.ts +1 -0
  38. package/source/private/cache.ts +1 -1
package/dist/utils.js ADDED
@@ -0,0 +1,221 @@
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.getChildrenOrFolderElements = exports.convertNodeIdToDataTypeAsync = exports.getTypeDefinition = exports.getTypeDefOrBaseType = exports.getSubtypeNodeId = exports.getSubtypeNodeIdIfAny = exports.getModellingRule = exports.getFolderElements = exports.getChildren = exports.getNodeClass = exports.getDescription = exports.getIsAbstract = exports.getBrowseName = exports.getDefinition = void 0;
13
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
14
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
15
+ const node_opcua_types_1 = require("node-opcua-types");
16
+ const node_opcua_variant_1 = require("node-opcua-variant");
17
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
18
+ function getDefinition(session, nodeId) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const dataValue = yield session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.DataTypeDefinition });
21
+ return dataValue.value.value || null;
22
+ });
23
+ }
24
+ exports.getDefinition = getDefinition;
25
+ function getBrowseName(session, nodeId) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const dataValue = yield session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.BrowseName });
28
+ return dataValue.value.value;
29
+ });
30
+ }
31
+ exports.getBrowseName = getBrowseName;
32
+ function getIsAbstract(session, nodeId) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const dataValue = yield session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.IsAbstract });
35
+ return dataValue.value.value;
36
+ });
37
+ }
38
+ exports.getIsAbstract = getIsAbstract;
39
+ function getDescription(session, nodeId) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const dataValue = yield session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.Description });
42
+ return dataValue.value.value;
43
+ });
44
+ }
45
+ exports.getDescription = getDescription;
46
+ function getNodeClass(session, nodeId) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const dataValue = yield session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.NodeClass });
49
+ return dataValue.value.value;
50
+ });
51
+ }
52
+ exports.getNodeClass = getNodeClass;
53
+ function getChildren(session, nodeId) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const browseResult = yield session.browse({
56
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
57
+ includeSubtypes: true,
58
+ nodeClassMask: node_opcua_data_model_1.NodeClassMask.Method | node_opcua_data_model_1.NodeClassMask.Object | node_opcua_data_model_1.NodeClass.Variable,
59
+ nodeId,
60
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasChild"),
61
+ resultMask: 0xffff
62
+ });
63
+ return browseResult.references || [];
64
+ });
65
+ }
66
+ exports.getChildren = getChildren;
67
+ function getFolderElements(session, nodeId) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const browseResult = yield session.browse({
70
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
71
+ includeSubtypes: true,
72
+ nodeClassMask: node_opcua_data_model_1.NodeClassMask.Method | node_opcua_data_model_1.NodeClassMask.Object | node_opcua_data_model_1.NodeClass.Variable,
73
+ nodeId,
74
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("Organizes"),
75
+ resultMask: 0xffff
76
+ });
77
+ return browseResult.references || [];
78
+ });
79
+ }
80
+ exports.getFolderElements = getFolderElements;
81
+ function getModellingRule(session, nodeId) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const browseResult = yield session.browse({
84
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
85
+ includeSubtypes: true,
86
+ nodeClassMask: node_opcua_data_model_1.NodeClassMask.Method | node_opcua_data_model_1.NodeClassMask.Object | node_opcua_data_model_1.NodeClass.Variable,
87
+ nodeId,
88
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasModellingRule"),
89
+ resultMask: 0xffff
90
+ });
91
+ if (!browseResult.references || browseResult.references.length === 0) {
92
+ return null;
93
+ console.log(nodeId.toString());
94
+ const browseName = yield getBrowseName(session, nodeId);
95
+ throw new Error("No modelling rule for " + nodeId.toString() + " " + browseName.toString());
96
+ }
97
+ return browseResult.references[0].browseName.name;
98
+ });
99
+ }
100
+ exports.getModellingRule = getModellingRule;
101
+ function getSubtypeNodeIdIfAny(session, nodeId) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ if (nodeId.isEmpty()) {
104
+ return null;
105
+ }
106
+ const browseResult = yield session.browse({
107
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Inverse,
108
+ includeSubtypes: true,
109
+ nodeClassMask: 0,
110
+ nodeId,
111
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasSubtype"),
112
+ resultMask: 0xffff
113
+ });
114
+ if (!browseResult.references || browseResult.references.length === 0) {
115
+ return null;
116
+ }
117
+ return browseResult.references[0];
118
+ });
119
+ }
120
+ exports.getSubtypeNodeIdIfAny = getSubtypeNodeIdIfAny;
121
+ function getSubtypeNodeId(session, nodeId) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ const r = yield getSubtypeNodeIdIfAny(session, nodeId);
124
+ if (!r) {
125
+ throw new Error("No Subtype");
126
+ }
127
+ return r;
128
+ });
129
+ }
130
+ exports.getSubtypeNodeId = getSubtypeNodeId;
131
+ function getTypeDefOrBaseType(session, nodeId) {
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ let browseResult = yield session.browse({
134
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
135
+ includeSubtypes: true,
136
+ nodeClassMask: 0,
137
+ nodeId,
138
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasTypeDefinition"),
139
+ resultMask: 0xffff
140
+ });
141
+ if (!browseResult.references || browseResult.references.length === 0) {
142
+ browseResult = yield session.browse({
143
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Inverse,
144
+ includeSubtypes: true,
145
+ nodeClassMask: 0,
146
+ nodeId,
147
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasSubtype"),
148
+ resultMask: 0xffff
149
+ });
150
+ }
151
+ if (!browseResult.references || browseResult.references.length === 0) {
152
+ return new node_opcua_types_1.ReferenceDescription({});
153
+ }
154
+ return browseResult.references[0];
155
+ });
156
+ }
157
+ exports.getTypeDefOrBaseType = getTypeDefOrBaseType;
158
+ function getTypeDefinition(session, nodeId) {
159
+ return __awaiter(this, void 0, void 0, function* () {
160
+ const browseResult = yield session.browse({
161
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
162
+ includeSubtypes: true,
163
+ nodeClassMask: 0,
164
+ nodeId,
165
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasTypeDefinition"),
166
+ resultMask: 0xffff
167
+ });
168
+ if (!browseResult.references || browseResult.references.length === 0) {
169
+ console.log(nodeId.toString());
170
+ throw new Error("No subtype");
171
+ }
172
+ return browseResult.references[0];
173
+ });
174
+ }
175
+ exports.getTypeDefinition = getTypeDefinition;
176
+ // see also client-proxy
177
+ function convertNodeIdToDataTypeAsync(session, dataTypeId) {
178
+ return __awaiter(this, void 0, void 0, function* () {
179
+ const nodeToRead = {
180
+ attributeId: node_opcua_data_model_1.AttributeIds.BrowseName,
181
+ nodeId: dataTypeId
182
+ };
183
+ const dataValue = yield session.read(nodeToRead);
184
+ let dataType;
185
+ // istanbul ignore next
186
+ if (dataValue.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
187
+ return (dataType = node_opcua_variant_1.DataType.Null);
188
+ }
189
+ const dataTypeName = dataValue.value.value;
190
+ if (dataTypeId.namespace === 0 && node_opcua_variant_1.DataType[dataTypeId.value]) {
191
+ dataType = dataTypeId.value;
192
+ return dataType;
193
+ }
194
+ /// example => Duration (i=290) => Double (i=11)
195
+ // read subTypeOf
196
+ const nodeToBrowse = {
197
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Inverse,
198
+ nodeId: dataTypeId,
199
+ referenceTypeId: node_opcua_nodeid_1.resolveNodeId("HasSubtype"),
200
+ resultMask: 0xff
201
+ };
202
+ // tslint:disable:no-shadowed-variable
203
+ const browseResult = yield session.browse(nodeToBrowse);
204
+ const references = browseResult.references;
205
+ if (!references || references.length !== 1) {
206
+ throw new Error("cannot find SuperType of " + dataTypeName.toString());
207
+ }
208
+ const nodeId = references[0].nodeId;
209
+ return convertNodeIdToDataTypeAsync(session, nodeId);
210
+ });
211
+ }
212
+ exports.convertNodeIdToDataTypeAsync = convertNodeIdToDataTypeAsync;
213
+ function getChildrenOrFolderElements(session, nodeId) {
214
+ return __awaiter(this, void 0, void 0, function* () {
215
+ const c1 = yield getChildren(session, nodeId);
216
+ const c2 = yield getFolderElements(session, nodeId);
217
+ return [].concat(c1, c2);
218
+ });
219
+ }
220
+ exports.getChildrenOrFolderElements = getChildrenOrFolderElements;
221
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../source/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAA8H;AAC9H,yDAA0D;AAE1D,uDAA+G;AAE/G,2DAA8C;AAC9C,mEAAqD;AAErD,SAAsB,aAAa,CAAC,OAAsB,EAAE,MAAc;;QACtE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,oCAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAC/F,OAAQ,SAAS,CAAC,KAAK,CAAC,KAA4B,IAAI,IAAI,CAAC;IACjE,CAAC;CAAA;AAHD,sCAGC;AACD,SAAs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AAM,CAAC,CAAC;IACzD,CAAC;CAAA;AAvCD,oEAuCC;AAGD,SAAsB,2BAA2B,CAC7C,OAAsB,EACtB,MAAc;;QAGd,MAAM,EAAE,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpD,OAAgC,EAAG,CAAC,MAAM,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;IACtD,CAAC;CAAA;AARD,kEAQC"}
@@ -1,13 +1,13 @@
1
- import { IBasicSession } from "node-opcua-pseudo-session";
2
- import { ReferenceDescription } from "node-opcua-types";
3
- export interface ReferenceDescriptionEx extends ReferenceDescription {
4
- parent: ReferenceDescriptionEx;
5
- }
6
- export interface NodeVisitor {
7
- visit(reference: ReferenceDescriptionEx, level: number): Promise<void>;
8
- }
9
- export declare function walkThroughReferenceTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
10
- export declare function walkThroughDataTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
11
- export declare function walkThroughInterfaceTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
12
- export declare function walkThroughObjectTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
13
- export declare function walkThroughVariableTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
1
+ import { IBasicSession } from "node-opcua-pseudo-session";
2
+ import { ReferenceDescription } from "node-opcua-types";
3
+ export interface ReferenceDescriptionEx extends ReferenceDescription {
4
+ parent: ReferenceDescriptionEx;
5
+ }
6
+ export interface NodeVisitor {
7
+ visit(reference: ReferenceDescriptionEx, level: number): Promise<void>;
8
+ }
9
+ export declare function walkThroughReferenceTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
10
+ export declare function walkThroughDataTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
11
+ export declare function walkThroughInterfaceTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
12
+ export declare function walkThroughObjectTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
13
+ export declare function walkThroughVariableTypes(session: IBasicSession, nodeVisitor?: NodeVisitor): Promise<void>;
@@ -1,87 +1,87 @@
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.walkThroughVariableTypes = exports.walkThroughObjectTypes = exports.walkThroughInterfaceTypes = exports.walkThroughDataTypes = exports.walkThroughReferenceTypes = void 0;
13
- const node_opcua_data_model_1 = require("node-opcua-data-model");
14
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
15
- const node_opcua_types_1 = require("node-opcua-types");
16
- function _walkThroughTypes(session, nodeId, visitor, level, parent) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- level = level || 0;
19
- if (!parent) {
20
- const dataValues = yield session.read([
21
- { nodeId, attributeId: node_opcua_data_model_1.AttributeIds.BrowseName },
22
- { nodeId, attributeId: node_opcua_data_model_1.AttributeIds.NodeClass }
23
- ]);
24
- const browseName = dataValues[0].value.value;
25
- const nodeClass = dataValues[1].value.value;
26
- parent = new node_opcua_types_1.ReferenceDescription({
27
- isForward: true,
28
- nodeId: nodeId,
29
- browseName,
30
- nodeClass,
31
- referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype")
32
- // typeDefinition,
33
- });
34
- }
35
- const browseResult = yield session.browse({
36
- browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
37
- nodeId,
38
- includeSubtypes: true,
39
- referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
40
- resultMask: 0xff
41
- });
42
- for (const reference of browseResult.references || []) {
43
- if (visitor) {
44
- const r = reference;
45
- r.parent = parent;
46
- yield visitor.visit(r, level);
47
- }
48
- yield _walkThroughTypes(session, reference.nodeId, visitor, level + 1, reference);
49
- }
50
- });
51
- }
52
- function walkThroughReferenceTypes(session, nodeVisitor) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- const baseReferenceTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("References");
55
- yield _walkThroughTypes(session, baseReferenceTypeNodeId, nodeVisitor);
56
- });
57
- }
58
- exports.walkThroughReferenceTypes = walkThroughReferenceTypes;
59
- function walkThroughDataTypes(session, nodeVisitor) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- const baseDataTypeTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("BaseDataType");
62
- yield _walkThroughTypes(session, baseDataTypeTypeNodeId, nodeVisitor);
63
- });
64
- }
65
- exports.walkThroughDataTypes = walkThroughDataTypes;
66
- function walkThroughInterfaceTypes(session, nodeVisitor) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- const baseInterfaceTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("BaseInterfaceType");
69
- yield _walkThroughTypes(session, baseInterfaceTypeNodeId, nodeVisitor);
70
- });
71
- }
72
- exports.walkThroughInterfaceTypes = walkThroughInterfaceTypes;
73
- function walkThroughObjectTypes(session, nodeVisitor) {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- const baseObjectType = (0, node_opcua_nodeid_1.resolveNodeId)("BaseObjectType");
76
- yield _walkThroughTypes(session, baseObjectType, nodeVisitor);
77
- });
78
- }
79
- exports.walkThroughObjectTypes = walkThroughObjectTypes;
80
- function walkThroughVariableTypes(session, nodeVisitor) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- const baseObjectType = (0, node_opcua_nodeid_1.resolveNodeId)("BaseVariableType");
83
- yield _walkThroughTypes(session, baseObjectType, nodeVisitor);
84
- });
85
- }
86
- exports.walkThroughVariableTypes = walkThroughVariableTypes;
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.walkThroughVariableTypes = exports.walkThroughObjectTypes = exports.walkThroughInterfaceTypes = exports.walkThroughDataTypes = exports.walkThroughReferenceTypes = void 0;
13
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
14
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
15
+ const node_opcua_types_1 = require("node-opcua-types");
16
+ function _walkThroughTypes(session, nodeId, visitor, level, parent) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ level = level || 0;
19
+ if (!parent) {
20
+ const dataValues = yield session.read([
21
+ { nodeId, attributeId: node_opcua_data_model_1.AttributeIds.BrowseName },
22
+ { nodeId, attributeId: node_opcua_data_model_1.AttributeIds.NodeClass }
23
+ ]);
24
+ const browseName = dataValues[0].value.value;
25
+ const nodeClass = dataValues[1].value.value;
26
+ parent = new node_opcua_types_1.ReferenceDescription({
27
+ isForward: true,
28
+ nodeId: nodeId,
29
+ browseName,
30
+ nodeClass,
31
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype")
32
+ // typeDefinition,
33
+ });
34
+ }
35
+ const browseResult = yield session.browse({
36
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
37
+ nodeId,
38
+ includeSubtypes: true,
39
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
40
+ resultMask: 0xff
41
+ });
42
+ for (const reference of browseResult.references || []) {
43
+ if (visitor) {
44
+ const r = reference;
45
+ r.parent = parent;
46
+ yield visitor.visit(r, level);
47
+ }
48
+ yield _walkThroughTypes(session, reference.nodeId, visitor, level + 1, reference);
49
+ }
50
+ });
51
+ }
52
+ function walkThroughReferenceTypes(session, nodeVisitor) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const baseReferenceTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("References");
55
+ yield _walkThroughTypes(session, baseReferenceTypeNodeId, nodeVisitor);
56
+ });
57
+ }
58
+ exports.walkThroughReferenceTypes = walkThroughReferenceTypes;
59
+ function walkThroughDataTypes(session, nodeVisitor) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const baseDataTypeTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("BaseDataType");
62
+ yield _walkThroughTypes(session, baseDataTypeTypeNodeId, nodeVisitor);
63
+ });
64
+ }
65
+ exports.walkThroughDataTypes = walkThroughDataTypes;
66
+ function walkThroughInterfaceTypes(session, nodeVisitor) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ const baseInterfaceTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("BaseInterfaceType");
69
+ yield _walkThroughTypes(session, baseInterfaceTypeNodeId, nodeVisitor);
70
+ });
71
+ }
72
+ exports.walkThroughInterfaceTypes = walkThroughInterfaceTypes;
73
+ function walkThroughObjectTypes(session, nodeVisitor) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const baseObjectType = (0, node_opcua_nodeid_1.resolveNodeId)("BaseObjectType");
76
+ yield _walkThroughTypes(session, baseObjectType, nodeVisitor);
77
+ });
78
+ }
79
+ exports.walkThroughObjectTypes = walkThroughObjectTypes;
80
+ function walkThroughVariableTypes(session, nodeVisitor) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const baseObjectType = (0, node_opcua_nodeid_1.resolveNodeId)("BaseVariableType");
83
+ yield _walkThroughTypes(session, baseObjectType, nodeVisitor);
84
+ });
85
+ }
86
+ exports.walkThroughVariableTypes = walkThroughVariableTypes;
87
87
  //# sourceMappingURL=walk_through.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-convert-nodeset-to-javascript",
3
- "version": "2.63.1",
3
+ "version": "2.64.1",
4
4
  "description": "pure nodejs OPCUA SDK - module -convert-nodeset-to-javascript",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
@@ -14,29 +14,29 @@
14
14
  "dependencies": {
15
15
  "@types/wordwrap": "^1.0.1",
16
16
  "case-anything": "1.1.3",
17
- "node-opcua-address-space": "2.63.1",
18
- "node-opcua-address-space-base": "2.63.1",
19
- "node-opcua-assert": "2.63.0",
20
- "node-opcua-basic-types": "2.63.1",
21
- "node-opcua-constants": "2.62.7",
22
- "node-opcua-data-access": "2.63.1",
23
- "node-opcua-data-model": "2.63.1",
24
- "node-opcua-data-value": "2.63.1",
25
- "node-opcua-debug": "2.63.1",
26
- "node-opcua-factory": "2.63.1",
27
- "node-opcua-nodeid": "2.63.1",
28
- "node-opcua-pseudo-session": "2.63.1",
29
- "node-opcua-service-translate-browse-path": "2.63.1",
30
- "node-opcua-status-code": "2.63.1",
31
- "node-opcua-types": "2.63.1",
32
- "node-opcua-utils": "2.63.1",
17
+ "node-opcua-address-space": "2.64.1",
18
+ "node-opcua-address-space-base": "2.64.1",
19
+ "node-opcua-assert": "2.64.1",
20
+ "node-opcua-basic-types": "2.64.1",
21
+ "node-opcua-constants": "2.64.1",
22
+ "node-opcua-data-access": "2.64.1",
23
+ "node-opcua-data-model": "2.64.1",
24
+ "node-opcua-data-value": "2.64.1",
25
+ "node-opcua-debug": "2.64.1",
26
+ "node-opcua-factory": "2.64.1",
27
+ "node-opcua-nodeid": "2.64.1",
28
+ "node-opcua-pseudo-session": "2.64.1",
29
+ "node-opcua-service-translate-browse-path": "2.64.1",
30
+ "node-opcua-status-code": "2.64.1",
31
+ "node-opcua-types": "2.64.1",
32
+ "node-opcua-utils": "2.64.1",
33
33
  "wordwrap": "^1.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "node-opcua-leak-detector": "2.63.1",
37
- "node-opcua-nodesets": "2.63.0",
38
- "node-opcua-packet-analyzer": "2.63.1",
39
- "node-opcua-variant": "2.63.1",
36
+ "node-opcua-leak-detector": "2.64.1",
37
+ "node-opcua-nodesets": "2.64.1",
38
+ "node-opcua-packet-analyzer": "2.64.1",
39
+ "node-opcua-variant": "2.64.1",
40
40
  "should": "^13.2.3"
41
41
  },
42
42
  "author": "Etienne Rossignon",
@@ -54,5 +54,5 @@
54
54
  "internet of things"
55
55
  ],
56
56
  "homepage": "http://node-opcua.github.io/",
57
- "gitHead": "d37385314fce703c1cc197104c592df03b2663fb"
57
+ "gitHead": "b65b8738603cd475d7d99a2b20b0ae9d32b4110c"
58
58
  }
@@ -8,11 +8,22 @@ import { convertTypeToTypescript } from "./convert_to_typescript";
8
8
  import { constructCache } from "./private/cache";
9
9
  import { Options } from "./options";
10
10
 
11
- function getPackageInfo(dependency: string) {
12
- const d = path.join(__dirname, "../../" + dependency + "/package.json");
13
- const p = JSON.parse(fs.readFileSync(d, "utf8"));
14
- return p;
11
+ function getPackageInfo(dependency: string, options: Options) {
12
+ console.log("getPackageInfo", dependency);
13
+
14
+ const l = [...(options.lookupFolders || [])];
15
+ l.push(path.join(__dirname, "../../"));
16
+ for (const folder of l) {
17
+ const d = path.join(folder, dependency + "/package.json");
18
+ if (!fs.existsSync(d)) {
19
+ continue;
20
+ }
21
+ const p = JSON.parse(fs.readFileSync(d, "utf8"));
22
+ return p;
23
+ }
24
+ throw new Error("cannot find package.json for " + dependency);
15
25
  }
26
+
16
27
  interface Info {
17
28
  files: string[];
18
29
  folder: string;
@@ -79,7 +90,7 @@ export async function convertNamespaceTypeToTypescript(
79
90
  await walkThroughVariableTypes(session, nodeVisitor);
80
91
  await walkThroughDataTypes(session, nodeVisitor);
81
92
 
82
- await outputFiles(infos);
93
+ await outputFiles(infos, options);
83
94
  }
84
95
 
85
96
  async function _output_index_ts_file(info: Info): Promise<void> {
@@ -97,9 +108,9 @@ async function _output_index_ts_file(info: Info): Promise<void> {
97
108
  fs.writeFileSync(index, content.join("\n"));
98
109
  // create package.json
99
110
  }
100
- async function _output_package_json(info: Info): Promise<void> {
111
+ async function _output_package_json(info: Info, options: Options): Promise<void> {
101
112
  const packagejson = path.join(info.folder, "package.json");
102
- const version = getPackageInfo("node-opcua-address-space-base").version;
113
+ const version = getPackageInfo("node-opcua-address-space-base", options).version;
103
114
 
104
115
  const content2: string[] = [];
105
116
  content2.push(`{`);
@@ -118,7 +129,7 @@ async function _output_package_json(info: Info): Promise<void> {
118
129
  // find versions
119
130
  const versions: { [key: string]: string } = {};
120
131
  for (const dependency of info.dependencies) {
121
- const p = await getPackageInfo(dependency);
132
+ const p = await getPackageInfo(dependency, options);
122
133
  versions[dependency] = p.version;
123
134
  }
124
135
  content2.push(
@@ -165,12 +176,12 @@ async function _output_tsconfig_json(info: Info): Promise<void> {
165
176
 
166
177
  fs.writeFileSync(tsconfig, content3.join("\n"));
167
178
  }
168
- async function outputFiles(infos: { [key: string]: Info }) {
179
+ async function outputFiles(infos: { [key: string]: Info }, options: Options) {
169
180
  for (const info of Object.values(infos) as Info[]) {
170
181
  // create indexes
171
182
  await _output_index_ts_file(info);
172
183
 
173
- await _output_package_json(info);
184
+ await _output_package_json(info, options);
174
185
 
175
186
  await _output_tsconfig_json(info);
176
187
  }
@@ -52,19 +52,25 @@ export async function convertDataTypeToTypescript(session: IBasicSession, dataTy
52
52
  }
53
53
 
54
54
  // to avoid clashes
55
- function toJavascritPropertyName(childName: string): string {
55
+ function toJavascritPropertyName(childName: string, { ignoreConflictingName }: { ignoreConflictingName: boolean }): string {
56
56
  childName = lowerFirstLetter(childName);
57
- if (childName === "namespaceUri") {
58
- childName = "$namespaceUri";
59
- }
60
- if (childName === "rolePermissions") {
61
- childName = "$rolePermissions";
62
- }
63
- if (childName === "displayName") {
64
- childName = "$displayName";
65
- }
66
- if (childName === "eventNotifier") {
67
- childName = "$eventNotifier";
57
+
58
+ if (ignoreConflictingName) {
59
+ if (childName === "namespaceUri") {
60
+ childName = "$namespaceUri";
61
+ }
62
+ if (childName === "rolePermissions") {
63
+ childName = "$rolePermissions";
64
+ }
65
+ if (childName === "displayName") {
66
+ childName = "$displayName";
67
+ }
68
+ if (childName === "eventNotifier") {
69
+ childName = "$eventNotifier";
70
+ }
71
+ if (childName === "description") {
72
+ childName = "$description";
73
+ }
68
74
  }
69
75
  return childName.replace(/</g, "$").replace(/>/g, "$").replace(/ |\./g, "_").replace(/#/g, "_");
70
76
  }
@@ -432,7 +438,7 @@ async function _extractLocalMembers(session: IBasicSession, classMember: ClassMe
432
438
  for (const child of classMember.children) {
433
439
  const nodeId = child.nodeId;
434
440
  const browseName = await getBrowseName(session, nodeId);
435
- const name = toJavascritPropertyName(browseName.name!);
441
+ const name = toJavascritPropertyName(browseName.name!, { ignoreConflictingName: true });
436
442
 
437
443
  const description = await getDescription(session, nodeId);
438
444
  const modellingRule = await getModellingRule(session, nodeId);
@@ -545,7 +551,7 @@ export async function extractClassMemberDef(
545
551
  ): Promise<ClassMember> {
546
552
  const nodeClass = await getNodeClass(session, nodeId);
547
553
  const browseName = await getBrowseName(session, nodeId);
548
- const name = toJavascritPropertyName(browseName.name!);
554
+ const name = toJavascritPropertyName(browseName.name!, { ignoreConflictingName: true });
549
555
 
550
556
  if (nodeClass !== NodeClass.Method && nodeClass !== NodeClass.Object && nodeClass !== NodeClass.Variable) {
551
557
  throw new Error("Invalid property " + NodeClass[nodeClass] + " " + browseName?.toString() + " " + nodeId.toString());
@@ -559,7 +565,7 @@ export async function extractClassMemberDef(
559
565
 
560
566
  const typeDefinition = await getTypeDefOrBaseType(session, nodeId);
561
567
 
562
- if (nodeClass!== NodeClass.Method && (!typeDefinition.browseName || !typeDefinition.browseName.name)) {
568
+ if (nodeClass !== NodeClass.Method && (!typeDefinition.browseName || !typeDefinition.browseName.name)) {
563
569
  warningLog(typeDefinition.toString());
564
570
  warningLog("cannot find typeDefinition for ", browseName.toString(), "( is the namespace loaded ?)");
565
571
  }
@@ -691,7 +697,7 @@ function dumpChildren(session: IBasicSession, padding: string, children: ClassMe
691
697
 
692
698
  if (modellingRule === "MandatoryPlaceholder" || modellingRule === "OptionalPlaceholder") continue;
693
699
  cache.ensureImported(childType);
694
- const adjustedName = toJavascritPropertyName(name);
700
+ const adjustedName = toJavascritPropertyName(name, { ignoreConflictingName: true });
695
701
  if (description.text) {
696
702
  f.write(`${padding}/**`);
697
703
  f.write(`${padding} * ${name || ""}`);
@@ -846,7 +852,7 @@ export async function _exportDataTypeToTypescript(
846
852
  f.write(`export interface ${interfaceName} extends ${baseInterfaceName} {`);
847
853
  }
848
854
  for (const field of definition.fields!) {
849
- const fieldName = toJavascritPropertyName(field.name!);
855
+ const fieldName = toJavascritPropertyName(field.name!, { ignoreConflictingName: false });
850
856
  // special case ! fieldName=
851
857
  if (field.description.text) {
852
858
  f.write(`/** ${field.description.text}*/`);