node-opcua-convert-nodeset-to-javascript 2.75.0 → 2.76.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.
- package/dist/convert_namespace_to_typescript.d.ts +3 -3
- package/dist/convert_namespace_to_typescript.js +182 -172
- package/dist/convert_namespace_to_typescript.js.map +1 -1
- package/dist/convert_to_typescript.d.ts +110 -110
- package/dist/convert_to_typescript.js +987 -912
- package/dist/convert_to_typescript.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -19
- package/dist/main.d.ts +1 -1
- package/dist/main.js +74 -74
- package/dist/official_namespaces.d.ts +23 -23
- package/dist/official_namespaces.js +35 -35
- package/dist/options.d.ts +5 -5
- package/dist/options.js +2 -2
- package/dist/private/cache.d.ts +59 -59
- package/dist/private/cache.js +221 -221
- package/dist/private/to_filename.d.ts +1 -1
- package/dist/private/to_filename.js +9 -9
- package/dist/private/utils.d.ts +31 -31
- package/dist/private/utils.js +289 -289
- package/dist/private-stuff.d.ts +4 -4
- package/dist/private-stuff.js +20 -20
- package/dist/walk_through.d.ts +13 -13
- package/dist/walk_through.js +86 -86
- package/package.json +18 -21
- package/source/convert_namespace_to_typescript.ts +18 -8
- package/source/convert_to_typescript.ts +141 -66
package/dist/walk_through.d.ts
CHANGED
|
@@ -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>;
|
package/dist/walk_through.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "2.76.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",
|
|
@@ -14,29 +14,26 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@types/wordwrap": "^1.0.1",
|
|
16
16
|
"case-anything": "1.1.5",
|
|
17
|
-
"
|
|
18
|
-
"node-opcua-address-space
|
|
19
|
-
"node-opcua-
|
|
20
|
-
"node-opcua-
|
|
17
|
+
"chalk": "4.1.2",
|
|
18
|
+
"node-opcua-address-space": "2.76.0",
|
|
19
|
+
"node-opcua-address-space-base": "2.76.0",
|
|
20
|
+
"node-opcua-assert": "2.76.0",
|
|
21
21
|
"node-opcua-constants": "2.74.0",
|
|
22
|
-
"node-opcua-data-
|
|
23
|
-
"node-opcua-
|
|
24
|
-
"node-opcua-
|
|
25
|
-
"node-opcua-
|
|
26
|
-
"node-opcua-
|
|
27
|
-
"node-opcua-
|
|
28
|
-
"node-opcua-
|
|
29
|
-
"node-opcua-
|
|
30
|
-
"node-opcua-
|
|
31
|
-
"node-opcua-types": "2.75.0",
|
|
32
|
-
"node-opcua-utils": "2.74.0",
|
|
22
|
+
"node-opcua-data-model": "2.76.0",
|
|
23
|
+
"node-opcua-debug": "2.76.0",
|
|
24
|
+
"node-opcua-nodeid": "2.76.0",
|
|
25
|
+
"node-opcua-nodesets": "2.74.0",
|
|
26
|
+
"node-opcua-pseudo-session": "2.76.0",
|
|
27
|
+
"node-opcua-status-code": "2.76.0",
|
|
28
|
+
"node-opcua-types": "2.76.0",
|
|
29
|
+
"node-opcua-utils": "2.76.0",
|
|
30
|
+
"node-opcua-variant": "2.76.0",
|
|
33
31
|
"wordwrap": "^1.0.0"
|
|
34
32
|
},
|
|
35
33
|
"devDependencies": {
|
|
36
|
-
"node-opcua-leak-detector": "2.
|
|
37
|
-
"node-opcua-
|
|
38
|
-
"node-opcua-
|
|
39
|
-
"node-opcua-variant": "2.75.0",
|
|
34
|
+
"node-opcua-leak-detector": "2.76.0",
|
|
35
|
+
"node-opcua-packet-analyzer": "2.76.0",
|
|
36
|
+
"node-opcua-service-translate-browse-path": "2.76.0",
|
|
40
37
|
"should": "^13.2.3"
|
|
41
38
|
},
|
|
42
39
|
"author": "Etienne Rossignon",
|
|
@@ -54,5 +51,5 @@
|
|
|
54
51
|
"internet of things"
|
|
55
52
|
],
|
|
56
53
|
"homepage": "http://node-opcua.github.io/",
|
|
57
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "75d9b8cf894c8fbadf77d2c4a48a730d055465e7"
|
|
58
55
|
}
|
|
@@ -8,9 +8,7 @@ import { convertTypeToTypescript } from "./convert_to_typescript";
|
|
|
8
8
|
import { constructCache } from "./private/cache";
|
|
9
9
|
import { Options } from "./options";
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
//xx console.log("getPackageInfo", dependency);
|
|
13
|
-
|
|
11
|
+
function getPackageFolder(dependency: string, options: Options) {
|
|
14
12
|
const l = [...(options.lookupFolders || [])];
|
|
15
13
|
l.push(path.join(__dirname, "../../"));
|
|
16
14
|
for (const folder of l) {
|
|
@@ -18,11 +16,15 @@ function getPackageInfo(dependency: string, options: Options) {
|
|
|
18
16
|
if (!fs.existsSync(d)) {
|
|
19
17
|
continue;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
return p;
|
|
19
|
+
return d;
|
|
23
20
|
}
|
|
24
21
|
throw new Error("cannot find package.json for " + dependency);
|
|
25
22
|
}
|
|
23
|
+
function getPackageInfo(dependency: string, options: Options) {
|
|
24
|
+
const d = getPackageFolder(dependency, options);
|
|
25
|
+
const p = JSON.parse(fs.readFileSync(d, "utf8"));
|
|
26
|
+
return p;
|
|
27
|
+
}
|
|
26
28
|
|
|
27
29
|
interface Info {
|
|
28
30
|
files: string[];
|
|
@@ -146,7 +148,7 @@ async function _output_package_json(info: Info, options: Options): Promise<void>
|
|
|
146
148
|
|
|
147
149
|
fs.writeFileSync(packagejson, content2.join("\n"));
|
|
148
150
|
}
|
|
149
|
-
async function _output_tsconfig_json(info: Info): Promise<void> {
|
|
151
|
+
async function _output_tsconfig_json(info: Info, options: Options): Promise<void> {
|
|
150
152
|
const tsconfig = path.join(info.folder, "tsconfig.json");
|
|
151
153
|
const content3: string[] = [];
|
|
152
154
|
content3.push(`{`);
|
|
@@ -164,7 +166,10 @@ async function _output_tsconfig_json(info: Info): Promise<void> {
|
|
|
164
166
|
// content3.push(` { "path": "../node-opcua-address-space-base" }`);
|
|
165
167
|
const l = [] as string[];
|
|
166
168
|
for (const dep of info.dependencies) {
|
|
167
|
-
|
|
169
|
+
// only add in dep if not found in node_module
|
|
170
|
+
if (!isIn_node_modules_Folder(dep)) {
|
|
171
|
+
l.push(` { "path": "../${dep}" }`);
|
|
172
|
+
}
|
|
168
173
|
}
|
|
169
174
|
content3.push(l.join(",\n"));
|
|
170
175
|
content3.push(` ],`);
|
|
@@ -175,6 +180,11 @@ async function _output_tsconfig_json(info: Info): Promise<void> {
|
|
|
175
180
|
content3.push(`}`);
|
|
176
181
|
|
|
177
182
|
fs.writeFileSync(tsconfig, content3.join("\n"));
|
|
183
|
+
|
|
184
|
+
function isIn_node_modules_Folder(dep: string) {
|
|
185
|
+
const c = getPackageFolder(dep, options);
|
|
186
|
+
return !!c.match(/node_modules/);
|
|
187
|
+
}
|
|
178
188
|
}
|
|
179
189
|
async function outputFiles(infos: { [key: string]: Info }, options: Options) {
|
|
180
190
|
for (const info of Object.values(infos) as Info[]) {
|
|
@@ -183,6 +193,6 @@ async function outputFiles(infos: { [key: string]: Info }, options: Options) {
|
|
|
183
193
|
|
|
184
194
|
await _output_package_json(info, options);
|
|
185
195
|
|
|
186
|
-
await _output_tsconfig_json(info);
|
|
196
|
+
await _output_tsconfig_json(info, options);
|
|
187
197
|
}
|
|
188
198
|
}
|