node-opcua-convert-nodeset-to-javascript 2.76.0 → 2.77.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/_dataType.d.ts +10 -0
- package/dist/_dataType.js +153 -0
- package/dist/_dataType.js.map +1 -0
- package/dist/convert_namespace_to_typescript.d.ts +3 -3
- package/dist/convert_namespace_to_typescript.js +182 -182
- package/dist/convert_to_typescript.d.ts +105 -110
- package/dist/convert_to_typescript.js +753 -987
- 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 +77 -74
- package/dist/main.js.map +1 -1
- package/dist/official_namespaces.d.ts +23 -23
- package/dist/official_namespaces.js +35 -35
- package/dist/official_namespaces.js.map +1 -1
- package/dist/options.d.ts +5 -5
- package/dist/options.js +2 -2
- package/dist/private/cache.d.ts +61 -59
- package/dist/private/cache.js +236 -221
- package/dist/private/cache.js.map +1 -1
- package/dist/private/get_corresponding_data_type.d.ts +14 -0
- package/dist/private/get_corresponding_data_type.js +104 -0
- package/dist/private/get_corresponding_data_type.js.map +1 -0
- 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/utils2.d.ts +7 -0
- package/dist/utils2.js +58 -0
- package/dist/utils2.js.map +1 -0
- package/dist/walk_through.d.ts +13 -13
- package/dist/walk_through.js +86 -86
- package/package.json +19 -18
- package/source/_dataType.ts +164 -0
- package/source/convert_to_typescript.ts +4 -252
- package/source/main.ts +5 -2
- package/source/official_namespaces.ts +0 -1
- package/source/private/cache.ts +24 -7
- package/source/private/get_corresponding_data_type.ts +104 -0
- package/source/utils2.ts +55 -0
- package/tsconfig-generated.json +4 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
2
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
3
|
+
import { LineFile } from "node-opcua-utils";
|
|
4
|
+
import { Type } from "./convert_to_typescript";
|
|
5
|
+
import { Cache } from "./private/cache";
|
|
6
|
+
export declare function _exportDataTypeToTypescript(session: IBasicSession, nodeId: NodeId, cache: Cache, f?: LineFile): Promise<{
|
|
7
|
+
type: Type;
|
|
8
|
+
content: string;
|
|
9
|
+
typeName: string;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,153 @@
|
|
|
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._exportDataTypeToTypescript = void 0;
|
|
13
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
14
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
15
|
+
const node_opcua_utils_1 = require("node-opcua-utils");
|
|
16
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
17
|
+
const private_stuff_1 = require("./private-stuff");
|
|
18
|
+
const cache_1 = require("./private/cache");
|
|
19
|
+
const get_corresponding_data_type_1 = require("./private/get_corresponding_data_type");
|
|
20
|
+
const utils2_1 = require("./utils2");
|
|
21
|
+
// eslint-disable-next-line max-statements, complexity
|
|
22
|
+
function _exportDataTypeToTypescript(session, nodeId, cache, f) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const importCollect = undefined;
|
|
25
|
+
const referenceBasicType = (name) => {
|
|
26
|
+
const t = { name, namespace: -1, module: "BasicType" };
|
|
27
|
+
importCollect && importCollect(t);
|
|
28
|
+
cache.ensureImported(t);
|
|
29
|
+
return t.name;
|
|
30
|
+
};
|
|
31
|
+
f = f || new node_opcua_utils_1.LineFile();
|
|
32
|
+
const importCollector = (i) => {
|
|
33
|
+
cache.ensureImported(i);
|
|
34
|
+
};
|
|
35
|
+
const nodeClass = node_opcua_data_model_1.NodeClass.DataType;
|
|
36
|
+
const description = yield (0, private_stuff_1.getDescription)(session, nodeId);
|
|
37
|
+
const definition = yield (0, private_stuff_1.getDefinition)(session, nodeId);
|
|
38
|
+
const browseName = yield (0, private_stuff_1.getBrowseName)(session, nodeId);
|
|
39
|
+
const isAbstract = yield (0, private_stuff_1.getIsAbstract)(session, nodeId);
|
|
40
|
+
const interfaceImport = (0, private_stuff_1.makeTypeNameNew)(nodeClass, definition, browseName);
|
|
41
|
+
const interfaceName = interfaceImport.name;
|
|
42
|
+
const superType = yield (0, private_stuff_1.getSubtypeNodeId)(session, nodeId);
|
|
43
|
+
const baseInterfaceImport = (0, private_stuff_1.makeTypeNameNew)(nodeClass, definition, superType.browseName);
|
|
44
|
+
cache.ensureImported(baseInterfaceImport);
|
|
45
|
+
const baseInterfaceName = baseInterfaceImport.name;
|
|
46
|
+
// f.write(superType.toString());
|
|
47
|
+
f.write(`/**`);
|
|
48
|
+
if (description.text) {
|
|
49
|
+
f.write((0, utils2_1.toComment)(" * ", description.text || ""));
|
|
50
|
+
f.write(` *`);
|
|
51
|
+
}
|
|
52
|
+
f.write(` * | |${(0, utils2_1.f1)(" ")}|`);
|
|
53
|
+
f.write(` * |-----------|${(0, utils2_1.f2)("-")}|`);
|
|
54
|
+
f.write(` * | namespace |${(0, utils2_1.f1)(cache.namespace[nodeId.namespace].namespaceUri)}|`);
|
|
55
|
+
f.write(` * | nodeClass |${(0, utils2_1.f1)(node_opcua_data_model_1.NodeClass[nodeClass])}|`);
|
|
56
|
+
f.write(` * | name |${(0, utils2_1.f1)(browseName.toString())}|`);
|
|
57
|
+
f.write(` * | isAbstract|${(0, utils2_1.f1)(isAbstract.toString())}|`);
|
|
58
|
+
f.write(` */`);
|
|
59
|
+
let type = "basic";
|
|
60
|
+
if (definition instanceof node_opcua_types_1.EnumDefinition) {
|
|
61
|
+
type = "enum";
|
|
62
|
+
f.write(`export enum ${interfaceName} {`);
|
|
63
|
+
for (const field of definition.fields) {
|
|
64
|
+
if (field.description.text) {
|
|
65
|
+
f.write(` /**`);
|
|
66
|
+
f.write((0, utils2_1.toComment)(" * ", field.description.text || ""));
|
|
67
|
+
f.write(` */`);
|
|
68
|
+
}
|
|
69
|
+
f.write(` ${(0, utils2_1.quotifyIfNecessary)(field.name)} = ${field.value[1]},`);
|
|
70
|
+
}
|
|
71
|
+
f.write(`}`);
|
|
72
|
+
}
|
|
73
|
+
else if (definition instanceof node_opcua_types_1.StructureDefinition) {
|
|
74
|
+
if (baseInterfaceName === "DTUnion") {
|
|
75
|
+
type = "structure";
|
|
76
|
+
for (let i = 0; i < definition.fields.length; i++) {
|
|
77
|
+
f.write(`export interface ${interfaceName}_${i} extends ${baseInterfaceName} {`);
|
|
78
|
+
for (let j = 0; j < definition.fields.length; j++) {
|
|
79
|
+
const field = definition.fields[j];
|
|
80
|
+
const fieldName = (0, utils2_1.toJavascritPropertyName)(field.name, { ignoreConflictingName: false });
|
|
81
|
+
if (j === i) {
|
|
82
|
+
yield outputStructureField(f, field);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
f.write(` ${(0, utils2_1.quotifyIfNecessary)(fieldName)}?: never`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
f.write(`}`);
|
|
89
|
+
}
|
|
90
|
+
f.write(`export type ${interfaceName} = `);
|
|
91
|
+
for (let i = 0; i < definition.fields.length; i++) {
|
|
92
|
+
f.write(` | ${interfaceName}_${i}`);
|
|
93
|
+
}
|
|
94
|
+
f.write(` ;`);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
type = "structure";
|
|
98
|
+
if (!definition.fields.length && interfaceName !== "DTStructure") {
|
|
99
|
+
f.write(`export type ${interfaceName} = ${baseInterfaceName};`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (interfaceName === "DTStructure") {
|
|
103
|
+
f.write(`export interface ${interfaceName} {`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
f.write(`export interface ${interfaceName} extends ${baseInterfaceName} {`);
|
|
107
|
+
}
|
|
108
|
+
for (const field of definition.fields) {
|
|
109
|
+
yield outputStructureField(f, field);
|
|
110
|
+
}
|
|
111
|
+
f.write(`}`);
|
|
112
|
+
//
|
|
113
|
+
referenceBasicType("ExtensionObject");
|
|
114
|
+
// ache.ensureImported({ module: "BasicType", name: "ExtensionObject", namespace: 0 });
|
|
115
|
+
// interface TighteningResultOptions extends Partial<DTTighteningResult> {}
|
|
116
|
+
// interface TighteningResult extends ExtensionObject, DTTighteningResult {}
|
|
117
|
+
const full = (0, cache_1.makeName2)(interfaceName);
|
|
118
|
+
// filter issue with UDTOpticalVerifierScanResult that has a decode:Uint32 conflicting with the ExtensionObject decode method
|
|
119
|
+
const toAvoid = ["decode", "encode"];
|
|
120
|
+
const collidingNames = definition
|
|
121
|
+
.fields.map((a) => (0, utils2_1.toJavascritPropertyName)(a.name, { ignoreConflictingName: false }))
|
|
122
|
+
.filter((d) => toAvoid.indexOf(d.toLowerCase()) !== -1);
|
|
123
|
+
const adpatedIntefaceName = collidingNames.length === 0
|
|
124
|
+
? interfaceName
|
|
125
|
+
: `Omit<${interfaceName},${collidingNames.map((a) => `"${a}"`).join(",")}>`;
|
|
126
|
+
f.write(`export interface ${full} extends ExtensionObject, ${adpatedIntefaceName} {};`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
type = "basic";
|
|
132
|
+
f.write(`// NO DEFINITION`);
|
|
133
|
+
f.write(`export type ${interfaceName} = ${baseInterfaceName};`);
|
|
134
|
+
// throw new Error("Invalid " + definition?.constructor.name);
|
|
135
|
+
}
|
|
136
|
+
return { type, content: f.toString(), typeName: interfaceName };
|
|
137
|
+
function outputStructureField(f, field) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
const fieldName = (0, utils2_1.toJavascritPropertyName)(field.name, { ignoreConflictingName: false });
|
|
140
|
+
// special case ! fieldName=
|
|
141
|
+
if (field.description.text) {
|
|
142
|
+
f.write(` /** ${field.description.text}*/`);
|
|
143
|
+
}
|
|
144
|
+
const opt = field.isOptional ? "?" : "";
|
|
145
|
+
const arrayMarker = field.valueRank >= 1 ? "[]" : "";
|
|
146
|
+
const { dataType, jtype } = yield (0, get_corresponding_data_type_1.getCorrepondingJavascriptType)(session, field.dataType, cache, importCollector);
|
|
147
|
+
f.write(` ${(0, utils2_1.quotifyIfNecessary)(fieldName)}${opt}: ${jtype}${arrayMarker}; // ${node_opcua_variant_1.DataType[dataType]} ${field.dataType.toString()}`);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
exports._exportDataTypeToTypescript = _exportDataTypeToTypescript;
|
|
153
|
+
//# sourceMappingURL=_dataType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dataType.js","sourceRoot":"","sources":["../source/_dataType.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAkD;AAGlD,uDAAuF;AACvF,uDAA4C;AAC5C,2DAA8C;AAE9C,mDAQyB;AACzB,2CAAmD;AACnD,uFAAsF;AACtF,qCAA0F;AAE1F,sDAAsD;AACtD,SAAsB,2BAA2B,CAC7C,OAAsB,EACtB,MAAc,EACd,KAAY,EACZ,CAAY;;QAEZ,MAAM,aAAa,GAA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AAC,CAAC;iBAChD;gBACD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxC,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrD,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,2DAA6B,EAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;gBACjH,CAAC,CAAC,KAAK,CACH,KAAK,IAAA,2BAAkB,EAAC,SAAS,CAAC,GAAG,GAAG,KAAK,KAAK,GAAG,WAAW,QAC5D,6BAAQ,CAAC,QAAQ,CACrB,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAClC,CAAC;YACN,CAAC;SAAA;IACL,CAAC;CAAA;AA9ID,kEA8IC"}
|
|
@@ -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,183 +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 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
|
-
}
|
|
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
|
+
}
|
|
183
183
|
//# sourceMappingURL=convert_namespace_to_typescript.js.map
|