node-opcua-modeler 2.64.1 → 2.65.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/addExtensionObjectDataType.d.ts +21 -21
- package/dist/addExtensionObjectDataType.js +130 -130
- package/dist/build_model_inner.d.ts +17 -17
- package/dist/build_model_inner.js +40 -40
- package/dist/build_model_inner.js.map +1 -1
- package/dist/displayNodeElement.d.ts +5 -5
- package/dist/displayNodeElement.js +192 -191
- package/dist/displayNodeElement.js.map +1 -1
- package/dist/dump_state_machine_to_graphviz.d.ts +6 -6
- package/dist/dump_state_machine_to_graphviz.js +119 -119
- package/dist/generate_markdown_doc.d.ts +41 -6
- package/dist/generate_markdown_doc.js +314 -266
- package/dist/generate_markdown_doc.js.map +1 -1
- package/dist/index.d.ts +24 -24
- package/dist/index.js +48 -48
- package/dist/index.js.map +1 -1
- package/dist/promoteToMandatory.d.ts +8 -8
- package/dist/promoteToMandatory.js +97 -97
- package/dist/setNamespaceMetaData.d.ts +1 -1
- package/dist/setNamespaceMetaData.js +5 -5
- package/dist/symbol.d.ts +1 -1
- package/dist/symbol.js +2 -2
- package/dist/tableHelper.d.ts +9 -9
- package/dist/tableHelper.js +60 -60
- package/dist/to_cvs.d.ts +2 -2
- package/dist/to_cvs.js +11 -11
- package/dist/to_graphivz.d.ts +14 -14
- package/dist/to_graphivz.js +294 -294
- package/dist/types.d.ts +1 -1
- package/dist/types.js +2 -2
- package/distNodeJS/build_documentation_to_file.d.ts +3 -2
- package/distNodeJS/build_documentation_to_file.js +26 -26
- package/distNodeJS/build_documentation_to_file.js.map +1 -1
- package/distNodeJS/build_model.d.ts +7 -7
- package/distNodeJS/build_model.js +21 -21
- package/distNodeJS/index.d.ts +5 -5
- package/distNodeJS/index.js +19 -19
- package/distNodeJS/symbol_cvs.d.ts +3 -3
- package/distNodeJS/symbol_cvs.js +63 -63
- package/package.json +6 -6
- package/source/build_model_inner.ts +3 -5
- package/source/displayNodeElement.ts +3 -3
- package/source/generate_markdown_doc.ts +88 -33
- package/source/index.ts +2 -1
- package/source_nodejs/build_documentation_to_file.ts +3 -3
- package/MyModel.NodeSet2.xml +0 -125
- package/dist/buildModel.d.ts +0 -16
- package/dist/buildModel.js +0 -91
- package/dist/buildModel.js.map +0 -1
- package/dist/display.d.ts +0 -2
- package/dist/display.js +0 -96
- package/dist/display.js.map +0 -1
- package/source/dump_state_machine_to_graphviz.ts +0 -164
- package/source/to_graphivz.ts +0 -351
|
@@ -1,27 +1,27 @@
|
|
|
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.buildDocumentationToFile = void 0;
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const __1 = require("..");
|
|
15
|
-
function buildDocumentationToFile(namespace, filename) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const str = yield (0, __1.buildDocumentationToString)(namespace);
|
|
18
|
-
const stream = fs.createWriteStream("documentation.md");
|
|
19
|
-
stream.write(str);
|
|
20
|
-
yield new Promise((resolve) => {
|
|
21
|
-
stream.on("finish", resolve);
|
|
22
|
-
stream.end();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
exports.buildDocumentationToFile = buildDocumentationToFile;
|
|
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.buildDocumentationToFile = void 0;
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const __1 = require("..");
|
|
15
|
+
function buildDocumentationToFile(namespace, filename, options) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const str = yield (0, __1.buildDocumentationToString)(namespace, options);
|
|
18
|
+
const stream = fs.createWriteStream("documentation.md");
|
|
19
|
+
stream.write(str);
|
|
20
|
+
yield new Promise((resolve) => {
|
|
21
|
+
stream.on("finish", resolve);
|
|
22
|
+
stream.end();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
exports.buildDocumentationToFile = buildDocumentationToFile;
|
|
27
27
|
//# sourceMappingURL=build_documentation_to_file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_documentation_to_file.js","sourceRoot":"","sources":["../source_nodejs/build_documentation_to_file.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAyB;AAEzB,
|
|
1
|
+
{"version":3,"file":"build_documentation_to_file.js","sourceRoot":"","sources":["../source_nodejs/build_documentation_to_file.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yBAAyB;AAEzB,0BAA2E;AAE3E,SAAsB,wBAAwB,CAAC,SAAoB,EAAE,QAAgB,EAAE,OAAmC;;QACtH,MAAM,GAAG,GAAG,MAAM,IAAA,8BAA0B,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1B,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,GAAG,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACP,CAAC;CAAA;AARD,4DAQC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuildModelOptionsBase } from "..";
|
|
2
|
-
import { Symbols } from "..";
|
|
3
|
-
export declare function buildModel(data: BuildModelOptionsBase): Promise<{
|
|
4
|
-
markdown: string;
|
|
5
|
-
xmlModel: string;
|
|
6
|
-
symbols: Symbols;
|
|
7
|
-
}>;
|
|
1
|
+
import { BuildModelOptionsBase } from "..";
|
|
2
|
+
import { Symbols } from "..";
|
|
3
|
+
export declare function buildModel(data: BuildModelOptionsBase): Promise<{
|
|
4
|
+
markdown: string;
|
|
5
|
+
xmlModel: string;
|
|
6
|
+
symbols: Symbols;
|
|
7
|
+
}>;
|
|
@@ -1,22 +1,22 @@
|
|
|
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.buildModel = void 0;
|
|
13
|
-
const nodeJS_1 = require("node-opcua-address-space/nodeJS");
|
|
14
|
-
const __1 = require("..");
|
|
15
|
-
function buildModel(data) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const option1 = Object.assign(Object.assign({}, data), { xmlLoader: nodeJS_1.readNodeSet2XmlFile });
|
|
18
|
-
return (0, __1.buildModelInner)(option1);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
exports.buildModel = buildModel;
|
|
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.buildModel = void 0;
|
|
13
|
+
const nodeJS_1 = require("node-opcua-address-space/nodeJS");
|
|
14
|
+
const __1 = require("..");
|
|
15
|
+
function buildModel(data) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const option1 = Object.assign(Object.assign({}, data), { xmlLoader: nodeJS_1.readNodeSet2XmlFile });
|
|
18
|
+
return (0, __1.buildModelInner)(option1);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.buildModel = buildModel;
|
|
22
22
|
//# sourceMappingURL=build_model.js.map
|
package/distNodeJS/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./symbol_cvs";
|
|
2
|
-
export * from "./build_model";
|
|
3
|
-
export * from "./build_documentation_to_file";
|
|
4
|
-
export * from "..";
|
|
5
|
-
export { generateAddressSpace } from "node-opcua-address-space/nodeJS";
|
|
1
|
+
export * from "./symbol_cvs";
|
|
2
|
+
export * from "./build_model";
|
|
3
|
+
export * from "./build_documentation_to_file";
|
|
4
|
+
export * from "..";
|
|
5
|
+
export { generateAddressSpace } from "node-opcua-address-space/nodeJS";
|
package/distNodeJS/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.generateAddressSpace = void 0;
|
|
14
|
-
__exportStar(require("./symbol_cvs"), exports);
|
|
15
|
-
__exportStar(require("./build_model"), exports);
|
|
16
|
-
__exportStar(require("./build_documentation_to_file"), exports);
|
|
17
|
-
__exportStar(require(".."), exports);
|
|
18
|
-
var nodeJS_1 = require("node-opcua-address-space/nodeJS");
|
|
19
|
-
Object.defineProperty(exports, "generateAddressSpace", { enumerable: true, get: function () { return nodeJS_1.generateAddressSpace; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.generateAddressSpace = void 0;
|
|
14
|
+
__exportStar(require("./symbol_cvs"), exports);
|
|
15
|
+
__exportStar(require("./build_model"), exports);
|
|
16
|
+
__exportStar(require("./build_documentation_to_file"), exports);
|
|
17
|
+
__exportStar(require(".."), exports);
|
|
18
|
+
var nodeJS_1 = require("node-opcua-address-space/nodeJS");
|
|
19
|
+
Object.defineProperty(exports, "generateAddressSpace", { enumerable: true, get: function () { return nodeJS_1.generateAddressSpace; } });
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Symbols } from "..";
|
|
2
|
-
export declare function saveSymbolsToCSV(csvFilename: string, symbols: Symbols): Promise<void>;
|
|
3
|
-
export declare function getPresetSymbolsFromCSV(csvFilename: string): Promise<Symbols>;
|
|
1
|
+
import { Symbols } from "..";
|
|
2
|
+
export declare function saveSymbolsToCSV(csvFilename: string, symbols: Symbols): Promise<void>;
|
|
3
|
+
export declare function getPresetSymbolsFromCSV(csvFilename: string): Promise<Symbols>;
|
package/distNodeJS/symbol_cvs.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
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.getPresetSymbolsFromCSV = exports.saveSymbolsToCSV = void 0;
|
|
13
|
-
const fs = require("fs");
|
|
14
|
-
const csv_parse_1 = require("csv-parse");
|
|
15
|
-
const __1 = require("..");
|
|
16
|
-
// node 14 onward : import { readFile, writeFile } from "fs/promises";
|
|
17
|
-
const { readFile, writeFile } = fs.promises;
|
|
18
|
-
function saveSymbolsToCSV(csvFilename, symbols) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
yield writeFile(csvFilename, (0, __1.toCSV)(symbols), "utf-8");
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
exports.saveSymbolsToCSV = saveSymbolsToCSV;
|
|
24
|
-
function getPresetSymbolsFromCSV(csvFilename) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
if (!fs.existsSync(csvFilename)) {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const data = yield readFile(csvFilename, "utf-8");
|
|
31
|
-
const records = yield new Promise((resolve) => {
|
|
32
|
-
const output = [];
|
|
33
|
-
(0, csv_parse_1.parse)(data, {
|
|
34
|
-
cast: (value, context) => {
|
|
35
|
-
if (context.index === 1) {
|
|
36
|
-
return parseInt(value, 10);
|
|
37
|
-
}
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
.on("readable", function () {
|
|
42
|
-
let record = this.read();
|
|
43
|
-
while (record) {
|
|
44
|
-
output.push(record);
|
|
45
|
-
record = this.read();
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
.on("end", () => {
|
|
49
|
-
resolve(output);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
return records;
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
if (err instanceof Error) {
|
|
56
|
-
// tslint:disable-next-line: no-console
|
|
57
|
-
console.log("getPresetSymbols err = ", err.message);
|
|
58
|
-
}
|
|
59
|
-
return [];
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
exports.getPresetSymbolsFromCSV = getPresetSymbolsFromCSV;
|
|
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.getPresetSymbolsFromCSV = exports.saveSymbolsToCSV = void 0;
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
const csv_parse_1 = require("csv-parse");
|
|
15
|
+
const __1 = require("..");
|
|
16
|
+
// node 14 onward : import { readFile, writeFile } from "fs/promises";
|
|
17
|
+
const { readFile, writeFile } = fs.promises;
|
|
18
|
+
function saveSymbolsToCSV(csvFilename, symbols) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield writeFile(csvFilename, (0, __1.toCSV)(symbols), "utf-8");
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.saveSymbolsToCSV = saveSymbolsToCSV;
|
|
24
|
+
function getPresetSymbolsFromCSV(csvFilename) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (!fs.existsSync(csvFilename)) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const data = yield readFile(csvFilename, "utf-8");
|
|
31
|
+
const records = yield new Promise((resolve) => {
|
|
32
|
+
const output = [];
|
|
33
|
+
(0, csv_parse_1.parse)(data, {
|
|
34
|
+
cast: (value, context) => {
|
|
35
|
+
if (context.index === 1) {
|
|
36
|
+
return parseInt(value, 10);
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
.on("readable", function () {
|
|
42
|
+
let record = this.read();
|
|
43
|
+
while (record) {
|
|
44
|
+
output.push(record);
|
|
45
|
+
record = this.read();
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
.on("end", () => {
|
|
49
|
+
resolve(output);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return records;
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
if (err instanceof Error) {
|
|
56
|
+
// tslint:disable-next-line: no-console
|
|
57
|
+
console.log("getPresetSymbols err = ", err.message);
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.getPresetSymbolsFromCSV = getPresetSymbolsFromCSV;
|
|
64
64
|
//# sourceMappingURL=symbol_cvs.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-modeler",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.65.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module - model",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"chalk": "4.1.2",
|
|
16
16
|
"cli-table3": "^0.6.1",
|
|
17
17
|
"csv-parse": "5.0.4",
|
|
18
|
-
"node-opcua-address-space": "2.
|
|
18
|
+
"node-opcua-address-space": "2.65.0",
|
|
19
19
|
"node-opcua-assert": "2.64.1",
|
|
20
20
|
"node-opcua-basic-types": "2.64.1",
|
|
21
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
21
|
+
"node-opcua-client-dynamic-extension-object": "2.65.0",
|
|
22
22
|
"node-opcua-constants": "2.64.1",
|
|
23
23
|
"node-opcua-data-model": "2.64.1",
|
|
24
24
|
"node-opcua-factory": "2.64.1",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"node-opcua-nodesets": "2.64.1",
|
|
27
27
|
"node-opcua-numeric-range": "2.64.1",
|
|
28
28
|
"node-opcua-schemas": "2.64.1",
|
|
29
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
29
|
+
"node-opcua-service-translate-browse-path": "2.65.0",
|
|
30
30
|
"node-opcua-status-code": "2.64.1",
|
|
31
|
-
"node-opcua-types": "2.
|
|
31
|
+
"node-opcua-types": "2.65.0",
|
|
32
32
|
"node-opcua-variant": "2.64.1",
|
|
33
33
|
"node-opcua-xml2json": "2.64.1"
|
|
34
34
|
},
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"internet of things"
|
|
50
50
|
],
|
|
51
51
|
"homepage": "http://node-opcua.github.io/",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "59b9cae30fb45633ad501f9cf3b74fb9d05e8960"
|
|
53
53
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AddressSpace,
|
|
3
|
-
Namespace, NodeIdManager, XmlLoaderFunc, generateAddressSpaceRaw } from "node-opcua-address-space";
|
|
1
|
+
import { AddressSpace, NodeIdManager, XmlLoaderAsyncFunc, generateAddressSpaceRaw } from "node-opcua-address-space";
|
|
4
2
|
import { buildDocumentationToString } from "./generate_markdown_doc";
|
|
5
3
|
import { Symbols } from "./symbol";
|
|
6
4
|
|
|
@@ -12,7 +10,7 @@ export interface BuildModelOptionsBase {
|
|
|
12
10
|
presetSymbols?: Symbols;
|
|
13
11
|
}
|
|
14
12
|
export interface BuildModelOptions extends BuildModelOptionsBase {
|
|
15
|
-
xmlLoader:
|
|
13
|
+
xmlLoader: XmlLoaderAsyncFunc;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
export async function buildModelInner(data: BuildModelOptions): Promise<{ markdown: string; xmlModel: string; symbols: Symbols }> {
|
|
@@ -33,7 +31,7 @@ export async function buildModelInner(data: BuildModelOptions): Promise<{ markdo
|
|
|
33
31
|
|
|
34
32
|
const xmlModel = ns.toNodeset2XML();
|
|
35
33
|
const symbols = nodeIdManager.getSymbols();
|
|
36
|
-
const doc = await buildDocumentationToString(ns);
|
|
34
|
+
const doc = await buildDocumentationToString(ns, {});
|
|
37
35
|
addressSpace.dispose();
|
|
38
36
|
|
|
39
37
|
return { xmlModel, symbols, markdown: doc };
|
|
@@ -147,7 +147,9 @@ function dumpReferences(data: Data, _references: UAReference[]) {
|
|
|
147
147
|
dumpReference(data, ref, "Organizes");
|
|
148
148
|
}
|
|
149
149
|
for (const ref of _references) {
|
|
150
|
-
|
|
150
|
+
dumpReference(data, ref, "HasInterface");
|
|
151
|
+
}
|
|
152
|
+
for (const ref of _references) {
|
|
151
153
|
dumpReference(data, ref, undefined);
|
|
152
154
|
}
|
|
153
155
|
}
|
|
@@ -181,8 +183,6 @@ export function displayNodeElement(node: BaseNode, options?: DisplayNodeOptions)
|
|
|
181
183
|
|
|
182
184
|
const references = node.allReferences();
|
|
183
185
|
|
|
184
|
-
const m = {};
|
|
185
|
-
|
|
186
186
|
const data = { table, node, alreadyDumped, descriptions };
|
|
187
187
|
dumpReferences(data, references);
|
|
188
188
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
2
|
import {
|
|
3
3
|
BaseNode,
|
|
4
|
-
|
|
5
|
-
Namespace,
|
|
4
|
+
INamespace,
|
|
6
5
|
UADataType,
|
|
7
6
|
UAObject,
|
|
8
7
|
UAObjectType,
|
|
@@ -12,15 +11,13 @@ import {
|
|
|
12
11
|
} from "node-opcua-address-space";
|
|
13
12
|
import { coerceUInt32 } from "node-opcua-basic-types";
|
|
14
13
|
import { NodeClass } from "node-opcua-data-model";
|
|
15
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
16
14
|
import { StructureField } from "node-opcua-types";
|
|
17
15
|
import { DataType } from "node-opcua-variant";
|
|
18
16
|
|
|
19
17
|
import { displayNodeElement } from "./displayNodeElement";
|
|
20
18
|
import { TableHelper } from "./tableHelper";
|
|
21
|
-
import { dumpClassHierachry, graphVizToPlantUml, opcuaToDot } from "./to_graphivz";
|
|
22
19
|
|
|
23
|
-
interface NamespacePriv2 {
|
|
20
|
+
interface NamespacePriv2 extends INamespace {
|
|
24
21
|
nodeIterator(): IterableIterator<BaseNode>;
|
|
25
22
|
_objectTypeIterator(): IterableIterator<UAObjectType>;
|
|
26
23
|
_objectTypeCount(): number;
|
|
@@ -33,14 +30,16 @@ interface NamespacePriv2 {
|
|
|
33
30
|
_aliasCount(): number;
|
|
34
31
|
}
|
|
35
32
|
export interface IWriter {
|
|
36
|
-
|
|
33
|
+
// eslint-disable-next-line no-unused-vars
|
|
34
|
+
writeLine(_str: string): void;
|
|
37
35
|
}
|
|
38
|
-
|
|
36
|
+
|
|
37
|
+
export class Writer implements IWriter {
|
|
39
38
|
private readonly stream: string[] = [];
|
|
40
39
|
constructor() {
|
|
41
40
|
/* empty */
|
|
42
41
|
}
|
|
43
|
-
public writeLine(str: string) {
|
|
42
|
+
public writeLine(str: string): void {
|
|
44
43
|
this.stream.push(str);
|
|
45
44
|
}
|
|
46
45
|
public toString(): string {
|
|
@@ -48,17 +47,18 @@ class Writer implements IWriter {
|
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
export
|
|
50
|
+
export interface BuildDocumentationOptions {
|
|
51
|
+
node?: BaseNode;
|
|
52
|
+
|
|
53
|
+
dumpGraphics? :(writer: IWriter, type: UAObjectType | UAVariableType)=>void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function buildDocumentationToString(namespace: INamespace, options?: BuildDocumentationOptions): Promise<string> {
|
|
52
57
|
const writer = new Writer();
|
|
53
|
-
await buildDocumentation(namespace, writer);
|
|
58
|
+
await buildDocumentation(namespace, writer, options);
|
|
54
59
|
return writer.toString();
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
interface V {
|
|
58
|
-
valueRank?: number;
|
|
59
|
-
arrayDimensions?: number[];
|
|
60
|
-
dataType: NodeId;
|
|
61
|
-
}
|
|
62
62
|
const toDataTypeStr = (p: BaseNode): string => {
|
|
63
63
|
if (p.nodeClass === NodeClass.Variable) {
|
|
64
64
|
const v = p as UAVariable;
|
|
@@ -74,7 +74,6 @@ const toDataTypeStr = (p: BaseNode): string => {
|
|
|
74
74
|
return "";
|
|
75
75
|
};
|
|
76
76
|
function dataTypeEnumerationToMarkdown(dataType: UADataType): string {
|
|
77
|
-
const addressSpace = dataType.addressSpace;
|
|
78
77
|
const writer = new Writer();
|
|
79
78
|
|
|
80
79
|
writer.writeLine("");
|
|
@@ -217,19 +216,73 @@ function dumpReferenceType(referenceType: UAReferenceType): string {
|
|
|
217
216
|
writer.writeLine(str);
|
|
218
217
|
return writer.toString();
|
|
219
218
|
}
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
|
|
220
|
+
export function extractTypes(namespace: INamespace, options?: BuildDocumentationOptions) {
|
|
221
|
+
const namespacePriv = namespace as unknown as NamespacePriv2;
|
|
222
|
+
if (!options || !options.node) {
|
|
223
|
+
const dataTypes = [...namespacePriv._dataTypeIterator()];
|
|
224
|
+
const objectTypes = [...namespacePriv._objectTypeIterator()];
|
|
225
|
+
const variableTypes = [...namespacePriv._variableTypeIterator()];
|
|
226
|
+
const referenceTypes = [...namespacePriv._referenceTypeIterator()];
|
|
227
|
+
return { dataTypes, variableTypes, objectTypes, referenceTypes };
|
|
228
|
+
}
|
|
229
|
+
const node = options.node;
|
|
230
|
+
|
|
231
|
+
if (node.nodeClass === NodeClass.DataType) {
|
|
232
|
+
const dataTypes: UADataType[] = [];
|
|
233
|
+
let dataType = node as UADataType;
|
|
234
|
+
dataTypes.push(dataType);
|
|
235
|
+
while (dataType.subtypeOfObj && dataType.subtypeOfObj.nodeId.namespace === namespace.index) {
|
|
236
|
+
dataType = dataType.subtypeOfObj;
|
|
237
|
+
dataTypes.push(dataType);
|
|
238
|
+
}
|
|
239
|
+
return { dataTypes, variableTypes: [], objectTypes: [], dataTypeNode: [], referenceTypes: [] };
|
|
240
|
+
} else if (node.nodeClass === NodeClass.ObjectType) {
|
|
241
|
+
const objectTypes: UAObjectType[] = [];
|
|
242
|
+
let objectType = node as UAObjectType;
|
|
243
|
+
objectTypes.push(objectType);
|
|
244
|
+
while (objectType.subtypeOfObj && objectType.subtypeOfObj.nodeId.namespace === namespace.index) {
|
|
245
|
+
objectType = objectType.subtypeOfObj;
|
|
246
|
+
objectTypes.push(objectType);
|
|
247
|
+
}
|
|
248
|
+
return { dataTypes: [], variableTypes: [], objectTypes, dataTypeNode: [], referenceTypes: [] };
|
|
249
|
+
} else if (node.nodeClass === NodeClass.VariableType) {
|
|
250
|
+
const variableTypes: UAVariableType[] = [];
|
|
251
|
+
let variableType = node as UAVariableType;
|
|
252
|
+
variableTypes.push(variableType);
|
|
253
|
+
while (variableType.subtypeOfObj && variableType.subtypeOfObj.nodeId.namespace === namespace.index) {
|
|
254
|
+
variableType = variableType.subtypeOfObj;
|
|
255
|
+
variableTypes.push(variableType);
|
|
256
|
+
}
|
|
257
|
+
return { dataTypes: [], variableTypes, objectTypes: [], dataTypeNode: [], referenceTypes: [] };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const dataTypes = [...namespacePriv._dataTypeIterator()];
|
|
261
|
+
const objectTypes = [...namespacePriv._objectTypeIterator()];
|
|
262
|
+
const variableTypes = [...namespacePriv._variableTypeIterator()];
|
|
263
|
+
const referenceTypes = [...namespacePriv._referenceTypeIterator()];
|
|
264
|
+
return { dataTypes, variableTypes, objectTypes, referenceTypes };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export async function buildDocumentation(
|
|
268
|
+
namespace: INamespace,
|
|
269
|
+
writer: IWriter,
|
|
270
|
+
options?: BuildDocumentationOptions
|
|
271
|
+
): Promise<void> {
|
|
272
|
+
|
|
273
|
+
options = options || {};
|
|
274
|
+
|
|
275
|
+
const namespacePriv = namespace as unknown as NamespacePriv2;
|
|
222
276
|
|
|
223
277
|
const namespaceUri = namespace.namespaceUri;
|
|
224
278
|
// -------- Documentation
|
|
225
279
|
|
|
226
|
-
const
|
|
280
|
+
const { dataTypes, objectTypes, variableTypes } = extractTypes(namespace, options);
|
|
227
281
|
|
|
228
282
|
writer.writeLine("");
|
|
229
283
|
writer.writeLine("# Namespace " + namespaceUri);
|
|
230
284
|
writer.writeLine("");
|
|
231
285
|
|
|
232
|
-
const namespacePriv = namespace as unknown as NamespacePriv2;
|
|
233
286
|
// -------------- writeReferences
|
|
234
287
|
if (namespacePriv._referenceTypeCount() > 0) {
|
|
235
288
|
writer.writeLine("");
|
|
@@ -240,32 +293,34 @@ export async function buildDocumentation(namespace: Namespace, writer: IWriter):
|
|
|
240
293
|
dumpReferenceType(referenceType);
|
|
241
294
|
}
|
|
242
295
|
}
|
|
296
|
+
|
|
243
297
|
function d(node: BaseNode): string {
|
|
244
298
|
return node.description ? node.description!.text!.toString() : "";
|
|
245
299
|
}
|
|
300
|
+
|
|
246
301
|
// -------------- writeDataType
|
|
247
|
-
if (
|
|
302
|
+
if (dataTypes.length > 0) {
|
|
248
303
|
writer.writeLine("");
|
|
249
304
|
writer.writeLine("## DataTypes");
|
|
250
305
|
writer.writeLine("");
|
|
251
|
-
for (const dataType of
|
|
306
|
+
for (const dataType of dataTypes) {
|
|
252
307
|
writer.writeLine("\n\n### " + dataType.browseName.name!.toString());
|
|
253
308
|
writer.writeLine("");
|
|
254
309
|
writer.writeLine(dataTypeToMarkdown(dataType));
|
|
255
310
|
}
|
|
256
311
|
}
|
|
257
312
|
// -------------- writeObjectType
|
|
258
|
-
if (
|
|
313
|
+
if (objectTypes.length > 0) {
|
|
259
314
|
writer.writeLine("");
|
|
260
315
|
writer.writeLine("## ObjectTypes");
|
|
261
316
|
writer.writeLine("");
|
|
262
|
-
for (const objectType of
|
|
317
|
+
for (const objectType of objectTypes) {
|
|
263
318
|
writer.writeLine("\n\n### " + objectType.browseName.name!.toString());
|
|
264
319
|
writer.writeLine(d(objectType));
|
|
265
320
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
321
|
+
if (options.dumpGraphics) {
|
|
322
|
+
await options.dumpGraphics(writer, objectType);
|
|
323
|
+
}
|
|
269
324
|
|
|
270
325
|
// enumerate components
|
|
271
326
|
writer.writeLine(displayNodeElement(objectType, { format: "markdown" }));
|
|
@@ -283,19 +338,18 @@ export async function buildDocumentation(namespace: Namespace, writer: IWriter):
|
|
|
283
338
|
}
|
|
284
339
|
}
|
|
285
340
|
// -------------- writeVariableType
|
|
286
|
-
if (
|
|
341
|
+
if (variableTypes.length > 0) {
|
|
287
342
|
writer.writeLine("");
|
|
288
343
|
writer.writeLine("## VariableTypes");
|
|
289
344
|
writer.writeLine("");
|
|
290
|
-
for (const variableType of
|
|
345
|
+
for (const variableType of variableTypes) {
|
|
291
346
|
writer.writeLine("\n\n### " + variableType.browseName.name!.toString());
|
|
292
347
|
writer.writeLine(d(variableType));
|
|
293
348
|
writer.writeLine("");
|
|
294
349
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
350
|
+
if (options.dumpGraphics) {
|
|
351
|
+
await options.dumpGraphics(writer, variableType);
|
|
352
|
+
}
|
|
299
353
|
// enumerate components
|
|
300
354
|
writer.writeLine(displayNodeElement(variableType, { format: "markdown" }));
|
|
301
355
|
for (const reference of variableType.allReferences()) {
|
|
@@ -307,3 +361,4 @@ export async function buildDocumentation(namespace: Namespace, writer: IWriter):
|
|
|
307
361
|
}
|
|
308
362
|
}
|
|
309
363
|
}
|
|
364
|
+
|
package/source/index.ts
CHANGED
|
@@ -6,8 +6,9 @@ export * from "./build_model_inner";
|
|
|
6
6
|
export * from "./addExtensionObjectDataType";
|
|
7
7
|
export * from "./symbol";
|
|
8
8
|
export * from "./to_cvs";
|
|
9
|
-
export * from "./to_graphivz";
|
|
10
9
|
export * from "./generate_markdown_doc";
|
|
10
|
+
export * from "./tableHelper";
|
|
11
|
+
|
|
11
12
|
//
|
|
12
13
|
export * from "node-opcua-address-space";
|
|
13
14
|
export * from "node-opcua-nodesets";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import { Namespace } from "node-opcua-address-space";
|
|
3
|
-
import { buildDocumentationToString } from "..";
|
|
3
|
+
import { BuildDocumentationOptions, buildDocumentationToString } from "..";
|
|
4
4
|
|
|
5
|
-
export async function buildDocumentationToFile(namespace: Namespace, filename: string) {
|
|
6
|
-
const str = await buildDocumentationToString(namespace);
|
|
5
|
+
export async function buildDocumentationToFile(namespace: Namespace, filename: string, options?: BuildDocumentationOptions) {
|
|
6
|
+
const str = await buildDocumentationToString(namespace, options);
|
|
7
7
|
const stream = fs.createWriteStream("documentation.md");
|
|
8
8
|
stream.write(str);
|
|
9
9
|
await new Promise((resolve) => {
|