node-opcua-convert-nodeset-to-javascript 2.64.1 → 2.66.0

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.
@@ -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,42 +1,42 @@
1
1
  {
2
2
  "name": "node-opcua-convert-nodeset-to-javascript",
3
- "version": "2.64.1",
3
+ "version": "2.66.0",
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",
7
7
  "bin": "dist/main.js",
8
8
  "scripts": {
9
9
  "build": "tsc -b",
10
- "generate": "pnpm run build && ts-node source/main.ts",
11
- "test": "mocha && pnpm run test-generated",
10
+ "generate": "tsc -b && ts-node source/main.ts",
11
+ "test": "mocha && npm run test-generated",
12
12
  "test-generated": "tsc --build tsconfig-generated.json"
13
13
  },
14
14
  "dependencies": {
15
15
  "@types/wordwrap": "^1.0.1",
16
16
  "case-anything": "1.1.3",
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",
17
+ "node-opcua-address-space": "2.66.0",
18
+ "node-opcua-address-space-base": "2.66.0",
19
+ "node-opcua-assert": "2.66.0",
20
+ "node-opcua-basic-types": "2.66.0",
21
+ "node-opcua-constants": "2.66.0",
22
+ "node-opcua-data-access": "2.66.0",
23
+ "node-opcua-data-model": "2.66.0",
24
+ "node-opcua-data-value": "2.66.0",
25
+ "node-opcua-debug": "2.66.0",
26
+ "node-opcua-factory": "2.66.0",
27
+ "node-opcua-nodeid": "2.66.0",
28
+ "node-opcua-pseudo-session": "2.66.0",
29
+ "node-opcua-service-translate-browse-path": "2.66.0",
30
+ "node-opcua-status-code": "2.66.0",
31
+ "node-opcua-types": "2.66.0",
32
+ "node-opcua-utils": "2.66.0",
33
33
  "wordwrap": "^1.0.0"
34
34
  },
35
35
  "devDependencies": {
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",
36
+ "node-opcua-leak-detector": "2.66.0",
37
+ "node-opcua-nodesets": "2.66.0",
38
+ "node-opcua-packet-analyzer": "2.66.0",
39
+ "node-opcua-variant": "2.66.0",
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": "b65b8738603cd475d7d99a2b20b0ae9d32b4110c"
57
+ "gitHead": "97f47e2e242a1fd737495fd64cb65e8fb7a9964b"
58
58
  }
package/dist/cache.d.ts DELETED
@@ -1,62 +0,0 @@
1
- import { NodeClass, QualifiedName } from "node-opcua-data-model";
2
- import { NodeId } from "node-opcua-nodeid";
3
- import { IBasicSession } from "node-opcua-pseudo-session";
4
- import { DataTypeDefinition } from "node-opcua-types";
5
- export interface Import {
6
- name: string;
7
- module: string;
8
- namespace: number;
9
- }
10
- interface CacheInterface {
11
- namespace: {
12
- namespaceUri: string;
13
- filename: string;
14
- symbols: {
15
- [key: string]: number;
16
- };
17
- }[];
18
- requestedSymbols: RequestedSymbol;
19
- }
20
- export interface RequestedSubSymbol {
21
- subSymbols: {
22
- [key: string]: number;
23
- };
24
- }
25
- interface RequestedSymbol {
26
- namespace: {
27
- symbols: {
28
- [key: string]: RequestedSubSymbol;
29
- };
30
- }[];
31
- }
32
- export declare class Cache implements CacheInterface {
33
- namespace: {
34
- namespaceUri: string;
35
- filename: string;
36
- symbols: {
37
- [key: string]: number;
38
- };
39
- }[];
40
- requestedSymbols: RequestedSymbol;
41
- requestedBasicTypes: {
42
- [key: string]: number;
43
- };
44
- imports: {
45
- [key: string]: {
46
- [key: string]: number;
47
- };
48
- };
49
- constructor();
50
- resetRequire(): void;
51
- referenceBasicType(basicType: string): string;
52
- _reference(namespaceIndex: number, typeName: string, mainTypeName?: string): void;
53
- ensureImported(i: Import): void;
54
- }
55
- export declare function referenceExtensionObject(session: IBasicSession, extensionObjectDataType: NodeId): Promise<Import>;
56
- export declare class Cache2 extends Cache {
57
- outputFolder: string;
58
- namespaceArray: string[];
59
- }
60
- export declare function constructCache(session: IBasicSession): Promise<Cache2>;
61
- export declare function makeTypeNameNew(nodeClass: NodeClass, definition: DataTypeDefinition | null, browseName: QualifiedName): Import;
62
- export {};
package/dist/cache.js DELETED
@@ -1,273 +0,0 @@
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.makeTypeNameNew = exports.constructCache = exports.Cache2 = exports.referenceExtensionObject = exports.Cache = void 0;
13
- const node_opcua_assert_1 = require("node-opcua-assert");
14
- const node_opcua_data_model_1 = require("node-opcua-data-model");
15
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
16
- const node_opcua_types_1 = require("node-opcua-types");
17
- const utils_1 = require("./utils");
18
- class Cache {
19
- constructor() {
20
- this.namespace = [];
21
- this.requestedSymbols = { namespace: [] };
22
- this.requestedBasicTypes = {};
23
- this.imports = {};
24
- this.imports = {
25
- "node-opcua-address-space": {
26
- UAObject: 1,
27
- UAVariable: 1,
28
- UAVariableT: 1,
29
- UAMethod: 1,
30
- UADataType: 1,
31
- // UAProperty: 1,
32
- },
33
- "node-opcua-variant": {
34
- DataType: 1,
35
- Variant: 1
36
- },
37
- "node-opcua-data-model": {
38
- LocalizedText: 1,
39
- QualifiedName: 1,
40
- DiagnosticInfo: 1,
41
- },
42
- "node-opcua-data-access": {
43
- EUInformation: 1,
44
- },
45
- "node-opcua-nodeid": {
46
- NodeId: 1,
47
- ExpandedNodeId: 1
48
- },
49
- "node-opcua-status-code": {
50
- StatusCode: 1,
51
- StatusCodes: 1
52
- },
53
- "node-opcua-basic-types": {
54
- Int64: 1,
55
- UInt64: 1,
56
- UInt32: 1,
57
- Int32: 1,
58
- UInt16: 1,
59
- Int16: 1,
60
- Byte: 1,
61
- SByte: 1,
62
- UAString: 1,
63
- DateTime: 1,
64
- Guid: 1,
65
- },
66
- "node-opcua-data-value": {
67
- DataValue: 1,
68
- }
69
- };
70
- }
71
- resetRequire() {
72
- this.requestedSymbols = { namespace: [] };
73
- this.requestedBasicTypes = {};
74
- }
75
- referenceBasicType(basicType) {
76
- this.requestedBasicTypes[basicType] = (this.requestedBasicTypes[basicType] || 0) + 1;
77
- return basicType;
78
- }
79
- _reference(namespaceIndex, typeName, mainTypeName) {
80
- var _a;
81
- if (namespaceIndex <= 0 && this.imports["node-opcua-address-space"][typeName]) {
82
- this.referenceBasicType(typeName);
83
- return;
84
- }
85
- const filename = (_a = this.namespace[namespaceIndex]) === null || _a === void 0 ? void 0 : _a.filename;
86
- if (!filename) {
87
- throw new Error("Cannot find namespace " + namespaceIndex);
88
- }
89
- const symbols = this.namespace[namespaceIndex].symbols = this.namespace[namespaceIndex].symbols || {};
90
- symbols[typeName] = (symbols[typeName] || 0) + 1;
91
- const ns = this.requestedSymbols.namespace[namespaceIndex] = this.requestedSymbols.namespace[namespaceIndex] || { namespace: [] };
92
- ns.symbols = ns.symbols || {};
93
- if (!mainTypeName) {
94
- mainTypeName = typeName;
95
- }
96
- ;
97
- const subs = ns.symbols[mainTypeName] = ns.symbols[mainTypeName] || { subSymbols: {} };
98
- subs.subSymbols[typeName] = (subs.subSymbols[typeName] || 0) + 1;
99
- }
100
- ensureImported(i) {
101
- if (i.namespace < 0) {
102
- this.referenceBasicType(i.name);
103
- }
104
- else {
105
- this._reference(i.namespace, i.name, i.module);
106
- }
107
- }
108
- }
109
- exports.Cache = Cache;
110
- function getTypescriptFile(browseName, cache) {
111
- const ns = browseName.namespaceIndex;
112
- const n = cache.namespaceArray[ns].split("/").filter((s) => s.length !== 0);
113
- const nn = n[n.length - 1];
114
- return "_type-" + nn;
115
- }
116
- function referenceExtensionObject(session, extensionObjectDataType) {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- const browseName = yield utils_1.getBrowseName(session, extensionObjectDataType);
119
- const definition = yield utils_1.getDefinition(session, extensionObjectDataType);
120
- const dataTypeNameImport = makeTypeNameNew(node_opcua_data_model_1.NodeClass.DataType, definition, browseName);
121
- return dataTypeNameImport;
122
- });
123
- }
124
- exports.referenceExtensionObject = referenceExtensionObject;
125
- class Cache2 extends Cache {
126
- constructor() {
127
- super(...arguments);
128
- this.outputFolder = "../tmp/";
129
- this.namespaceArray = [];
130
- }
131
- }
132
- exports.Cache2 = Cache2;
133
- function constructCache(session) {
134
- return __awaiter(this, void 0, void 0, function* () {
135
- const cache = new Cache2();
136
- cache.namespaceArray = cache.namespaceArray.length
137
- ? cache.namespaceArray
138
- : (yield session.read({
139
- nodeId: node_opcua_nodeid_1.resolveNodeId("Server_NamespaceArray"),
140
- attributeId: node_opcua_data_model_1.AttributeIds.Value
141
- })).value.value;
142
- for (let namespaceIndex = 0; namespaceIndex < cache.namespaceArray.length; namespaceIndex++) {
143
- const namespaceUri = cache.namespaceArray[namespaceIndex];
144
- const filename = getTypescriptFile(new node_opcua_data_model_1.QualifiedName({ name: namespaceUri, namespaceIndex }), cache);
145
- cache.namespace.push({
146
- namespaceUri,
147
- filename,
148
- symbols: {}
149
- });
150
- }
151
- return cache;
152
- });
153
- }
154
- exports.constructCache = constructCache;
155
- function makeBasicTypeImport(name) {
156
- return { name, module: "BasicType", namespace: -1 };
157
- }
158
- function makeTypeNameNew(nodeClass, definition, browseName) {
159
- node_opcua_assert_1.default(!!browseName.name);
160
- let typeName = browseName.name.toString();
161
- if (typeName === "EUInformation") {
162
- return makeBasicTypeImport("EUInformation");
163
- }
164
- else if (typeName === "Enumeration") {
165
- return makeBasicTypeImport("Enumeration");
166
- }
167
- else if (typeName === "BaseObjectType") {
168
- return makeBasicTypeImport("UAObject");
169
- }
170
- else if (typeName === "BaseVariableType") {
171
- return makeBasicTypeImport("UAVariableT");
172
- }
173
- else if (typeName === "BaseDataType") {
174
- return makeBasicTypeImport("UADataType");
175
- }
176
- else {
177
- let name = "";
178
- switch (nodeClass) {
179
- case node_opcua_data_model_1.NodeClass.Method:
180
- return makeBasicTypeImport("UAMethod");
181
- case node_opcua_data_model_1.NodeClass.Variable:
182
- case node_opcua_data_model_1.NodeClass.Object:
183
- case node_opcua_data_model_1.NodeClass.VariableType:
184
- case node_opcua_data_model_1.NodeClass.ObjectType:
185
- name = `UA${typeName.replace(/Type$/, "")}`;
186
- break;
187
- case node_opcua_data_model_1.NodeClass.DataType:
188
- if (definition instanceof node_opcua_types_1.EnumDefinition) {
189
- name = `${typeName.replace(/(DataType|Enumeration|Type)$/, "")}`;
190
- }
191
- else {
192
- name = `DT${typeName.replace(/(DataType|Enumeration|Type)$/, "")}`;
193
- }
194
- break;
195
- }
196
- if (name === "") {
197
- throw new Error("Internal Error " + node_opcua_data_model_1.NodeClass[nodeClass] + " " + typeName + "browseName = " + browseName.toString());
198
- }
199
- return { name, module: name, namespace: browseName.namespaceIndex };
200
- }
201
- }
202
- exports.makeTypeNameNew = makeTypeNameNew;
203
- // function makeTypeNameDeprecated(
204
- // nodeClass: NodeClass,
205
- // definition: DataTypeDefinition | null,
206
- // browseName: QualifiedName,
207
- // doDeclare: boolean,
208
- // cache?: Cache
209
- // ): string {
210
- // const i = makeTypeNameNew(nodeClass, definition, browseName);
211
- // return i.name;
212
- // }
213
- // export function makeTypeNameOld(
214
- // nodeClass: NodeClass,
215
- // definition: DataTypeDefinition | null,
216
- // browseName: QualifiedName,
217
- // doDeclare: boolean,
218
- // cache?: Cache
219
- // ): string {
220
- // if (!browseName.name) {
221
- // return "";
222
- // }
223
- // let typeName = browseName.name!.toString();
224
- // if (typeName == "EUInformation") {
225
- // typeName = "EUInformation";
226
- // cache && cache.referenceUA("EUInformation");
227
- // return "EUInformation";
228
- // }
229
- // if (typeName === "Enumeration") {
230
- // typeName = "Enumeration";
231
- // cache && cache.referenceUA("Enumeration");
232
- // return "Enumeration";
233
- // } else if (typeName === "BaseObjectType") {
234
- // typeName = "Object";
235
- // cache && cache.referenceUA("UAObject");
236
- // return "UAObject";
237
- // } else if (typeName === "BaseVariableType") {
238
- // typeName = "VariableT";
239
- // cache && cache.referenceUA("UAVariableT");
240
- // return "UAVariableT";
241
- // } else if (typeName === "BaseDataType") {
242
- // typeName = "Data";
243
- // cache && cache.referenceUA("UADataType");
244
- // return "UADataType";
245
- // } else {
246
- // let name = "";
247
- // switch (nodeClass) {
248
- // case NodeClass.Method:
249
- // return "UAMethod";
250
- // case NodeClass.Variable:
251
- // case NodeClass.Object:
252
- // case NodeClass.VariableType:
253
- // case NodeClass.ObjectType:
254
- // name = `UA${typeName.replace(/Type$/, "")}`;
255
- // break;
256
- // case NodeClass.DataType:
257
- // if (definition instanceof EnumDefinition) {
258
- // name = `${typeName.replace(/(DataType|Enumeration|Type)$/, "")}`;
259
- // } else {
260
- // name = `DT${typeName.replace(/(DataType|Enumeration|Type)$/, "")}`;
261
- // }
262
- // break;
263
- // }
264
- // if (doDeclare) {
265
- // cache && cache.importType(browseName.namespaceIndex, name);
266
- // }
267
- // if (name === "") {
268
- // throw new Error("Internal Error " + NodeClass[nodeClass] + " " + typeName + "browseName = " + browseName.toString());
269
- // }
270
- // return name;
271
- // }
272
- // }
273
- //# sourceMappingURL=cache.js.map
package/dist/cache.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../source/cache.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,iEAA+E;AAC/E,yDAA0D;AAE1D,uDAA2F;AAC3F,mCAAuE;AA0BvE,MAAa,KAAK;IASd;QARA,cAAS,GAIH,EAAE,CAAC;QACT,qBAAgB,GAAoB,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACtD,wBAAmB,GAA8B,EAAE,CAAC;QACpD,YAAO,GAAiD,EAAE,CAAC;QAEvD,IAAI,CAAC,OAAO,GAAG;YACX,0BAA0B,EAAE;gBACxB,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,CAAC;gBACb,WAAW,EAAE,CAAC;gBACd,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,CAAC;gBACb,kBAAkB;aACrB;YACD,oBAAoB,EAAE;gBAClB,QAAQ,EAAE,CAAC;gBACX,OAAO,EAAE,CAAC;aACb;YACD,uBAAuB,EAAE;gBACrB,aAAa,EAAE,CAAC;gBAChB,aAAa,EAAE,CAAC;gBAChB,cAAc,EAAE,CAAC;aACpB;YACD,wBAAwB,EAAE;gBACtB,aAAa,EAAE,CAAC;aACnB;YACD,mBAAmB,EAAE;gBACjB,MAAM,EAAE,CAAC;gBACT,cAAc,EAAE,CAAC;aACpB;YACD,wBAAwB,EAAE;gBACtB,UAAU,EAAE,CAAC;gBACb,WAAW,EAAE,CAAC;aACjB;YACD,wBAAwB,EAAE;gBACtB,KAAK,EAAE,CAAC;gBACR,MAAM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,kDAAkD;AAClD,6BAA6B;AAC7B,oDAAoD;AACpD,kCAAkC;AAClC,qDAAqD;AACrD,gCAAgC;AAChC,gDAAgD;AAChD,6BAA6B;AAC7B,oDAAoD;AACpD,+BAA+B;AAC/B,eAAe;AACf,yBAAyB;AACzB,+BAA+B;AAC/B,qCAAqC;AACrC,qCAAqC;AACrC,uCAAuC;AACvC,qCAAqC;AACrC,2CAA2C;AAC3C,yCAAyC;AACzC,+DAA+D;AAC/D,yBAAyB;AACzB,uCAAuC;AACvC,8DAA8D;AAC9D,wFAAwF;AACxF,2BAA2B;AAC3B,0FAA0F;AAC1F,oBAAoB;AACpB,yBAAyB;AACzB,YAAY;AACZ,2BAA2B;AAC3B,0EAA0E;AAC1E,YAAY;AACZ,6BAA6B;AAC7B,oIAAoI;AACpI,YAAY;AACZ,uBAAuB;AACvB,QAAQ;AACR,IAAI"}
package/dist/utils.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { LocalizedText, NodeClass, QualifiedName } from "node-opcua-data-model";
2
- import { NodeId } from "node-opcua-nodeid";
3
- import { IBasicSession } from "node-opcua-pseudo-session";
4
- import { DataTypeDefinition, ReferenceDescription } from "node-opcua-types";
5
- import { ModellingRuleType } from "node-opcua-address-space";
6
- import { DataType } from "node-opcua-variant";
7
- export declare function getDefinition(session: IBasicSession, nodeId: NodeId): Promise<DataTypeDefinition | null>;
8
- export declare function getBrowseName(session: IBasicSession, nodeId: NodeId): Promise<QualifiedName>;
9
- export declare function getIsAbstract(session: IBasicSession, nodeId: NodeId): Promise<boolean>;
10
- export declare function getDescription(session: IBasicSession, nodeId: NodeId): Promise<LocalizedText>;
11
- export declare function getNodeClass(session: IBasicSession, nodeId: NodeId): Promise<NodeClass>;
12
- export declare function getChildren(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription[]>;
13
- export declare function getFolderElements(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription[]>;
14
- export declare function getModellingRule(session: IBasicSession, nodeId: NodeId): Promise<ModellingRuleType | null>;
15
- export declare function getSubtypeNodeIdIfAny(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription | null>;
16
- export declare function getSubtypeNodeId(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription>;
17
- export declare function getTypeDefOrBaseType(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription>;
18
- export declare function getTypeDefinition(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription>;
19
- export declare function convertNodeIdToDataTypeAsync(session: IBasicSession, dataTypeId: NodeId): Promise<DataType>;
20
- export declare function getChildrenOrFolderElements(session: IBasicSession, nodeId: NodeId): Promise<ReferenceDescription[]>;