node-opcua-convert-nodeset-to-javascript 2.73.1 → 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/LICENSE +3 -1
- 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 +19 -22
- package/source/convert_namespace_to_typescript.ts +18 -8
- package/source/convert_to_typescript.ts +141 -66
package/LICENSE
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2022 Sterfive SAS - 833264583 RCS ORLEANS - France (https://www.sterfive.com)
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2014-2022 Etienne Rossignon
|
|
4
6
|
|
|
5
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
8
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
-
import { Options } from "./options";
|
|
3
|
-
export declare function convertNamespaceTypeToTypescript(session: IBasicSession, namespaceIndex: number, options: Options): Promise<void>;
|
|
1
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
+
import { Options } from "./options";
|
|
3
|
+
export declare function convertNamespaceTypeToTypescript(session: IBasicSession, namespaceIndex: number, options: Options): Promise<void>;
|
|
@@ -1,173 +1,183 @@
|
|
|
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.convertNamespaceTypeToTypescript = void 0;
|
|
13
|
-
const path = require("path");
|
|
14
|
-
const fs = require("fs");
|
|
15
|
-
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
16
|
-
const walk_through_1 = require("./walk_through");
|
|
17
|
-
const convert_to_typescript_1 = require("./convert_to_typescript");
|
|
18
|
-
const cache_1 = require("./private/cache");
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!fs.existsSync(
|
|
63
|
-
fs.mkdirSync(
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
fs.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
yield
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (file.match(/^
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
content2
|
|
108
|
-
content2.push(`
|
|
109
|
-
content2.push(` "
|
|
110
|
-
content2.push(` "
|
|
111
|
-
content2.push(` "
|
|
112
|
-
content2.push(`
|
|
113
|
-
content2.push(`
|
|
114
|
-
content2.push(` "
|
|
115
|
-
content2.push(`
|
|
116
|
-
content2.push(`
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
content3
|
|
140
|
-
content3.push(`
|
|
141
|
-
content3.push(`
|
|
142
|
-
content3.push(`
|
|
143
|
-
content3.push(`
|
|
144
|
-
content3.push(`
|
|
145
|
-
content3.push(` "
|
|
146
|
-
content3.push(`
|
|
147
|
-
content3.push(` "
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
content3.push(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
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.convertNamespaceTypeToTypescript = void 0;
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
16
|
+
const walk_through_1 = require("./walk_through");
|
|
17
|
+
const convert_to_typescript_1 = require("./convert_to_typescript");
|
|
18
|
+
const cache_1 = require("./private/cache");
|
|
19
|
+
function getPackageFolder(dependency, options) {
|
|
20
|
+
const l = [...(options.lookupFolders || [])];
|
|
21
|
+
l.push(path.join(__dirname, "../../"));
|
|
22
|
+
for (const folder of l) {
|
|
23
|
+
const d = path.join(folder, dependency + "/package.json");
|
|
24
|
+
if (!fs.existsSync(d)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
return d;
|
|
28
|
+
}
|
|
29
|
+
throw new Error("cannot find package.json for " + dependency);
|
|
30
|
+
}
|
|
31
|
+
function getPackageInfo(dependency, options) {
|
|
32
|
+
const d = getPackageFolder(dependency, options);
|
|
33
|
+
const p = JSON.parse(fs.readFileSync(d, "utf8"));
|
|
34
|
+
return p;
|
|
35
|
+
}
|
|
36
|
+
function convertNamespaceTypeToTypescript(session, namespaceIndex, options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (namespaceIndex < 0) {
|
|
39
|
+
throw new Error("namespaceIndex cannot be negative");
|
|
40
|
+
}
|
|
41
|
+
const cache = yield (0, cache_1.constructCache)(session, options);
|
|
42
|
+
if (!fs.existsSync(options.baseFolder)) {
|
|
43
|
+
fs.mkdirSync(options.baseFolder);
|
|
44
|
+
}
|
|
45
|
+
const infos = {};
|
|
46
|
+
// walk through all Types:
|
|
47
|
+
const nodeVisitor = {
|
|
48
|
+
visit(reference, level) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (reference.nodeId.namespace !== namespaceIndex) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
cache.resetRequire();
|
|
54
|
+
if (reference.nodeId.namespace === 0 && reference.nodeId.value === node_opcua_constants_1.DataTypeIds.Enumeration) {
|
|
55
|
+
return; // ignore enumeration
|
|
56
|
+
}
|
|
57
|
+
const { type, content, folder, module, filename, dependencies } = yield (0, convert_to_typescript_1.convertTypeToTypescript)(session, reference.nodeId, options, cache);
|
|
58
|
+
if (type === "basic") {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const _f = path.dirname(folder);
|
|
62
|
+
if (!fs.existsSync(_f)) {
|
|
63
|
+
fs.mkdirSync(_f);
|
|
64
|
+
}
|
|
65
|
+
if (!fs.existsSync(folder)) {
|
|
66
|
+
fs.mkdirSync(folder);
|
|
67
|
+
}
|
|
68
|
+
const sourceFolder = path.join(folder, "source");
|
|
69
|
+
if (!fs.existsSync(sourceFolder)) {
|
|
70
|
+
fs.mkdirSync(sourceFolder);
|
|
71
|
+
}
|
|
72
|
+
fs.writeFileSync(path.join(sourceFolder, filename + ".ts"), content);
|
|
73
|
+
infos[module] = infos[module] || { folder, dependencies: [], module, files: [] };
|
|
74
|
+
infos[module].files.push(filename + ".ts");
|
|
75
|
+
infos[module].dependencies = [...new Set([...infos[module].dependencies, ...dependencies])];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
yield (0, walk_through_1.walkThroughObjectTypes)(session, nodeVisitor);
|
|
80
|
+
yield (0, walk_through_1.walkThroughVariableTypes)(session, nodeVisitor);
|
|
81
|
+
yield (0, walk_through_1.walkThroughDataTypes)(session, nodeVisitor);
|
|
82
|
+
yield outputFiles(infos, options);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exports.convertNamespaceTypeToTypescript = convertNamespaceTypeToTypescript;
|
|
86
|
+
function _output_index_ts_file(info) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const index = path.join(info.folder, "source/index.ts");
|
|
89
|
+
const content = [];
|
|
90
|
+
for (const file of info.files.sort()) {
|
|
91
|
+
if (file.match(/^ua_property/)) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (file.match(/^enum_eration/)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
content.push(`export * from "./${file.replace(".ts", "")}";`);
|
|
98
|
+
}
|
|
99
|
+
fs.writeFileSync(index, content.join("\n"));
|
|
100
|
+
// create package.json
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function _output_package_json(info, options) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const packagejson = path.join(info.folder, "package.json");
|
|
106
|
+
const version = getPackageInfo("node-opcua-address-space-base", options).version;
|
|
107
|
+
const content2 = [];
|
|
108
|
+
content2.push(`{`);
|
|
109
|
+
content2.push(` "name": "${info.module}",`);
|
|
110
|
+
content2.push(` "version": "${version}",`);
|
|
111
|
+
content2.push(` "description": "",`);
|
|
112
|
+
content2.push(` "main": "dist/index.js",`);
|
|
113
|
+
content2.push(` "types": "dist/index.d.ts",`);
|
|
114
|
+
content2.push(` "scripts": {`);
|
|
115
|
+
content2.push(` "build": "tsc -b"`);
|
|
116
|
+
content2.push(` },`);
|
|
117
|
+
content2.push(` "author": "etienne.rossignon@sterfive.com",`);
|
|
118
|
+
content2.push(` "license": "MIT",`);
|
|
119
|
+
content2.push(` "dependencies": {`);
|
|
120
|
+
// find versions
|
|
121
|
+
const versions = {};
|
|
122
|
+
for (const dependency of info.dependencies) {
|
|
123
|
+
const p = yield getPackageInfo(dependency, options);
|
|
124
|
+
versions[dependency] = p.version;
|
|
125
|
+
}
|
|
126
|
+
content2.push(info.dependencies
|
|
127
|
+
.sort()
|
|
128
|
+
.map((d) => ` "${d}": "${versions[d]}"`)
|
|
129
|
+
.join(",\n"));
|
|
130
|
+
content2.push(` }`);
|
|
131
|
+
content2.push(`}`);
|
|
132
|
+
content2.push(``);
|
|
133
|
+
fs.writeFileSync(packagejson, content2.join("\n"));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function _output_tsconfig_json(info, options) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const tsconfig = path.join(info.folder, "tsconfig.json");
|
|
139
|
+
const content3 = [];
|
|
140
|
+
content3.push(`{`);
|
|
141
|
+
content3.push(` "extends": "../tsconfig.json",`);
|
|
142
|
+
content3.push(` "compilerOptions": {`);
|
|
143
|
+
content3.push(` "rootDir": "source",`);
|
|
144
|
+
content3.push(` "outDir": "dist",`);
|
|
145
|
+
content3.push(` "composite": true`);
|
|
146
|
+
content3.push(` },`);
|
|
147
|
+
content3.push(` "include": [`);
|
|
148
|
+
content3.push(` "source/*.ts",`);
|
|
149
|
+
content3.push(` ],`);
|
|
150
|
+
content3.push(` "references": [`);
|
|
151
|
+
// content3.push(` { "path": "../node-opcua-address-space-base" }`);
|
|
152
|
+
const l = [];
|
|
153
|
+
for (const dep of info.dependencies) {
|
|
154
|
+
// only add in dep if not found in node_module
|
|
155
|
+
if (!isIn_node_modules_Folder(dep)) {
|
|
156
|
+
l.push(` { "path": "../${dep}" }`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
content3.push(l.join(",\n"));
|
|
160
|
+
content3.push(` ],`);
|
|
161
|
+
content3.push(` "exclude": [`);
|
|
162
|
+
content3.push(` "node_modules",`);
|
|
163
|
+
content3.push(` "dist"`);
|
|
164
|
+
content3.push(` ]`);
|
|
165
|
+
content3.push(`}`);
|
|
166
|
+
fs.writeFileSync(tsconfig, content3.join("\n"));
|
|
167
|
+
function isIn_node_modules_Folder(dep) {
|
|
168
|
+
const c = getPackageFolder(dep, options);
|
|
169
|
+
return !!c.match(/node_modules/);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function outputFiles(infos, options) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
for (const info of Object.values(infos)) {
|
|
176
|
+
// create indexes
|
|
177
|
+
yield _output_index_ts_file(info);
|
|
178
|
+
yield _output_package_json(info, options);
|
|
179
|
+
yield _output_tsconfig_json(info, options);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
173
183
|
//# sourceMappingURL=convert_namespace_to_typescript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert_namespace_to_typescript.js","sourceRoot":"","sources":["../source/convert_namespace_to_typescript.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA6B;AAC7B,yBAAyB;AAGzB,+DAAmD;AACnD,iDAAgI;AAChI,mEAAkE;AAClE,2CAAiD;AAGjD,SAAS,
|
|
1
|
+
{"version":3,"file":"convert_namespace_to_typescript.js","sourceRoot":"","sources":["../source/convert_namespace_to_typescript.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA6B;AAC7B,yBAAyB;AAGzB,+DAAmD;AACnD,iDAAgI;AAChI,mEAAkE;AAClE,2CAAiD;AAGjD,SAAS,gBAAgB,CAAC,UAAkB,EAAE,OAAgB;IAC1D,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvC,KAAK,MAAM,MAAM,IAAI,CAAC,EAAE;QACpB,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE;YACnB,SAAS;SACZ;QACD,OAAO,CAAC,CAAC;KACZ;IACD,MAAM,IAAI,KAAK,CAAC,+BAA+B,GAAG,UAAU,CAAC,CAAC;AAClE,CAAC;AACD,SAAS,cAAc,CAAC,UAAkB,EAAE,OAAgB;IACxD,MAAM,CAAC,GAAG,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,CAAC;AACb,CAAC;AAQD,SAAsB,gCAAgC,CAClD,OAAsB,EACtB,cAAsB,EACtB,OAAgB;;QAEhB,IA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C;QACrC,CAAC;IACL,CAAC;CAAA;AACD,SAAe,WAAW,CAAC,KAA8B,EAAE,OAAgB;;QACvE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAW,EAAE;YAC/C,iBAAiB;YACjB,MAAM,qBAAqB,CAAC,IAAI,CAAC,CAAC;YAElC,MAAM,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAE1C,MAAM,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAC9C;IACL,CAAC;CAAA"}
|
|
@@ -1,110 +1,110 @@
|
|
|
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 { ReferenceDescription } from "node-opcua-types";
|
|
5
|
-
import { LineFile } from "node-opcua-utils";
|
|
6
|
-
import { DataType } from "node-opcua-variant";
|
|
7
|
-
import { ModellingRuleType } from "node-opcua-address-space-base";
|
|
8
|
-
import { Cache, Import } from "./private/cache";
|
|
9
|
-
import { Options } from "./options";
|
|
10
|
-
export declare function convertDataTypeToTypescript(session: IBasicSession, dataTypeId: NodeId): Promise<void>;
|
|
11
|
-
interface ClassDefinition {
|
|
12
|
-
nodeClass: NodeClass.VariableType | NodeClass.ObjectType;
|
|
13
|
-
browseName: QualifiedName;
|
|
14
|
-
isAbstract: boolean;
|
|
15
|
-
description: LocalizedText;
|
|
16
|
-
superType?: ReferenceDescription;
|
|
17
|
-
baseClassDef?: ClassDefinition | null;
|
|
18
|
-
children: ReferenceDescription[];
|
|
19
|
-
members: ClassMember[];
|
|
20
|
-
interfaceName: Import;
|
|
21
|
-
baseInterfaceName: Import | null;
|
|
22
|
-
dataTypeNodeId: NodeId | null;
|
|
23
|
-
dataType: DataType;
|
|
24
|
-
dataTypeName: string;
|
|
25
|
-
dataTypeImport?: Import[];
|
|
26
|
-
}
|
|
27
|
-
export declare function makeTypeName2(nodeClass: NodeClass, browseName: QualifiedName, suffix?: string): Import;
|
|
28
|
-
export declare function extractClassDefinition(session: IBasicSession, nodeId: NodeId, cache: Cache): Promise<ClassDefinition>;
|
|
29
|
-
interface ClassMemberBasic {
|
|
30
|
-
name: string;
|
|
31
|
-
childType: Import;
|
|
32
|
-
isOptional: boolean;
|
|
33
|
-
modellingRule: ModellingRuleType | null;
|
|
34
|
-
description: LocalizedText;
|
|
35
|
-
suffix?: string;
|
|
36
|
-
suffixInstantiate?: string;
|
|
37
|
-
chevrons: any;
|
|
38
|
-
typeToReference: Import[];
|
|
39
|
-
}
|
|
40
|
-
interface ClassMember extends ClassMemberBasic {
|
|
41
|
-
/**
|
|
42
|
-
* the OPCUA name of the class member
|
|
43
|
-
*/
|
|
44
|
-
browseName: QualifiedName;
|
|
45
|
-
nodeClass: NodeClass.Object | NodeClass.Method | NodeClass.Variable;
|
|
46
|
-
/**
|
|
47
|
-
* the Typescript name of the class Member
|
|
48
|
-
*/
|
|
49
|
-
name: string;
|
|
50
|
-
modellingRule: ModellingRuleType | null;
|
|
51
|
-
isOptional: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* class Def
|
|
54
|
-
*/
|
|
55
|
-
classDef: ClassDefinition | null;
|
|
56
|
-
description: LocalizedText;
|
|
57
|
-
typeDefinition: ReferenceDescription;
|
|
58
|
-
childType: Import;
|
|
59
|
-
children: ReferenceDescription[];
|
|
60
|
-
children2: ClassMemberBasic[];
|
|
61
|
-
dataTypeNodeId?: NodeId | null;
|
|
62
|
-
dataType?: DataType;
|
|
63
|
-
jtype?: string;
|
|
64
|
-
suffix?: string;
|
|
65
|
-
suffix2?: string;
|
|
66
|
-
suffix3?: string;
|
|
67
|
-
innerClass?: Import | null;
|
|
68
|
-
childBase?: Import | null;
|
|
69
|
-
}
|
|
70
|
-
interface ClassifiedReferenceDescriptions {
|
|
71
|
-
Mandatory: ReferenceDescription[];
|
|
72
|
-
Optional: ReferenceDescription[];
|
|
73
|
-
MandatoryPlaceholder: ReferenceDescription[];
|
|
74
|
-
OptionalPlaceholder: ReferenceDescription[];
|
|
75
|
-
ExposesItsArray: ReferenceDescription[];
|
|
76
|
-
}
|
|
77
|
-
export declare function findClassMember(session: IBasicSession, browseName: QualifiedName, baseParentDef: ClassDefinition, cache: Cache): Promise<ClassMember | null>;
|
|
78
|
-
export declare function checkIfShouldExposeInnerDefinition(main: ClassifiedReferenceDescriptions, instance: ClassifiedReferenceDescriptions): boolean;
|
|
79
|
-
interface ClassDefinitionB {
|
|
80
|
-
superType?: {
|
|
81
|
-
nodeId: NodeId;
|
|
82
|
-
};
|
|
83
|
-
interfaceName: Import;
|
|
84
|
-
baseClassDef?: ClassDefinition | null;
|
|
85
|
-
}
|
|
86
|
-
export declare function extractClassMemberDef(session: IBasicSession, nodeId: NodeId, parentDef: ClassDefinitionB, cache: Cache): Promise<ClassMember>;
|
|
87
|
-
export declare function findUsedImport(namespaceIndex: number, cache: Cache): string[];
|
|
88
|
-
export declare type Type = "enum" | "basic" | "structure" | "ua";
|
|
89
|
-
export declare function _exportDataTypeToTypescript(session: IBasicSession, nodeId: NodeId, cache: Cache, f?: LineFile): Promise<{
|
|
90
|
-
type: Type;
|
|
91
|
-
content: string;
|
|
92
|
-
typeName: string;
|
|
93
|
-
}>;
|
|
94
|
-
/**
|
|
95
|
-
* nodeId : a DataType, ReferenceType,AObjectType, VariableType node
|
|
96
|
-
*/
|
|
97
|
-
export declare function _convertTypeToTypescript(session: IBasicSession, nodeId: NodeId, cache: Cache, f?: LineFile): Promise<{
|
|
98
|
-
type: Type;
|
|
99
|
-
content: string;
|
|
100
|
-
typeName: string;
|
|
101
|
-
}>;
|
|
102
|
-
export declare function convertTypeToTypescript(session: IBasicSession, nodeId: NodeId, options: Options, cache?: Cache, f?: LineFile): Promise<{
|
|
103
|
-
type: Type;
|
|
104
|
-
content: string;
|
|
105
|
-
module: string;
|
|
106
|
-
folder: string;
|
|
107
|
-
filename: string;
|
|
108
|
-
dependencies: string[];
|
|
109
|
-
}>;
|
|
110
|
-
export {};
|
|
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 { ReferenceDescription } from "node-opcua-types";
|
|
5
|
+
import { LineFile } from "node-opcua-utils";
|
|
6
|
+
import { DataType } from "node-opcua-variant";
|
|
7
|
+
import { ModellingRuleType } from "node-opcua-address-space-base";
|
|
8
|
+
import { Cache, Import } from "./private/cache";
|
|
9
|
+
import { Options } from "./options";
|
|
10
|
+
export declare function convertDataTypeToTypescript(session: IBasicSession, dataTypeId: NodeId): Promise<void>;
|
|
11
|
+
interface ClassDefinition {
|
|
12
|
+
nodeClass: NodeClass.VariableType | NodeClass.ObjectType;
|
|
13
|
+
browseName: QualifiedName;
|
|
14
|
+
isAbstract: boolean;
|
|
15
|
+
description: LocalizedText;
|
|
16
|
+
superType?: ReferenceDescription;
|
|
17
|
+
baseClassDef?: ClassDefinition | null;
|
|
18
|
+
children: ReferenceDescription[];
|
|
19
|
+
members: ClassMember[];
|
|
20
|
+
interfaceName: Import;
|
|
21
|
+
baseInterfaceName: Import | null;
|
|
22
|
+
dataTypeNodeId: NodeId | null;
|
|
23
|
+
dataType: DataType;
|
|
24
|
+
dataTypeName: string;
|
|
25
|
+
dataTypeImport?: Import[];
|
|
26
|
+
}
|
|
27
|
+
export declare function makeTypeName2(nodeClass: NodeClass, browseName: QualifiedName, suffix?: string): Import;
|
|
28
|
+
export declare function extractClassDefinition(session: IBasicSession, nodeId: NodeId, cache: Cache): Promise<ClassDefinition>;
|
|
29
|
+
interface ClassMemberBasic {
|
|
30
|
+
name: string;
|
|
31
|
+
childType: Import;
|
|
32
|
+
isOptional: boolean;
|
|
33
|
+
modellingRule: ModellingRuleType | null;
|
|
34
|
+
description: LocalizedText;
|
|
35
|
+
suffix?: string;
|
|
36
|
+
suffixInstantiate?: string;
|
|
37
|
+
chevrons: any;
|
|
38
|
+
typeToReference: Import[];
|
|
39
|
+
}
|
|
40
|
+
interface ClassMember extends ClassMemberBasic {
|
|
41
|
+
/**
|
|
42
|
+
* the OPCUA name of the class member
|
|
43
|
+
*/
|
|
44
|
+
browseName: QualifiedName;
|
|
45
|
+
nodeClass: NodeClass.Object | NodeClass.Method | NodeClass.Variable;
|
|
46
|
+
/**
|
|
47
|
+
* the Typescript name of the class Member
|
|
48
|
+
*/
|
|
49
|
+
name: string;
|
|
50
|
+
modellingRule: ModellingRuleType | null;
|
|
51
|
+
isOptional: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* class Def
|
|
54
|
+
*/
|
|
55
|
+
classDef: ClassDefinition | null;
|
|
56
|
+
description: LocalizedText;
|
|
57
|
+
typeDefinition: ReferenceDescription;
|
|
58
|
+
childType: Import;
|
|
59
|
+
children: ReferenceDescription[];
|
|
60
|
+
children2: ClassMemberBasic[];
|
|
61
|
+
dataTypeNodeId?: NodeId | null;
|
|
62
|
+
dataType?: DataType;
|
|
63
|
+
jtype?: string;
|
|
64
|
+
suffix?: string;
|
|
65
|
+
suffix2?: string;
|
|
66
|
+
suffix3?: string;
|
|
67
|
+
innerClass?: Import | null;
|
|
68
|
+
childBase?: Import | null;
|
|
69
|
+
}
|
|
70
|
+
interface ClassifiedReferenceDescriptions {
|
|
71
|
+
Mandatory: ReferenceDescription[];
|
|
72
|
+
Optional: ReferenceDescription[];
|
|
73
|
+
MandatoryPlaceholder: ReferenceDescription[];
|
|
74
|
+
OptionalPlaceholder: ReferenceDescription[];
|
|
75
|
+
ExposesItsArray: ReferenceDescription[];
|
|
76
|
+
}
|
|
77
|
+
export declare function findClassMember(session: IBasicSession, browseName: QualifiedName, baseParentDef: ClassDefinition, cache: Cache): Promise<ClassMember | null>;
|
|
78
|
+
export declare function checkIfShouldExposeInnerDefinition(main: ClassifiedReferenceDescriptions, instance: ClassifiedReferenceDescriptions): boolean;
|
|
79
|
+
interface ClassDefinitionB {
|
|
80
|
+
superType?: {
|
|
81
|
+
nodeId: NodeId;
|
|
82
|
+
};
|
|
83
|
+
interfaceName: Import;
|
|
84
|
+
baseClassDef?: ClassDefinition | null;
|
|
85
|
+
}
|
|
86
|
+
export declare function extractClassMemberDef(session: IBasicSession, nodeId: NodeId, parentDef: ClassDefinitionB, cache: Cache): Promise<ClassMember>;
|
|
87
|
+
export declare function findUsedImport(namespaceIndex: number, cache: Cache): string[];
|
|
88
|
+
export declare type Type = "enum" | "basic" | "structure" | "ua";
|
|
89
|
+
export declare function _exportDataTypeToTypescript(session: IBasicSession, nodeId: NodeId, cache: Cache, f?: LineFile): Promise<{
|
|
90
|
+
type: Type;
|
|
91
|
+
content: string;
|
|
92
|
+
typeName: string;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* nodeId : a DataType, ReferenceType,AObjectType, VariableType node
|
|
96
|
+
*/
|
|
97
|
+
export declare function _convertTypeToTypescript(session: IBasicSession, nodeId: NodeId, cache: Cache, f?: LineFile): Promise<{
|
|
98
|
+
type: Type;
|
|
99
|
+
content: string;
|
|
100
|
+
typeName: string;
|
|
101
|
+
}>;
|
|
102
|
+
export declare function convertTypeToTypescript(session: IBasicSession, nodeId: NodeId, options: Options, cache?: Cache, f?: LineFile): Promise<{
|
|
103
|
+
type: Type;
|
|
104
|
+
content: string;
|
|
105
|
+
module: string;
|
|
106
|
+
folder: string;
|
|
107
|
+
filename: string;
|
|
108
|
+
dependencies: string[];
|
|
109
|
+
}>;
|
|
110
|
+
export {};
|