node-opcua-modeler 2.64.0 → 2.64.1

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.
Files changed (42) hide show
  1. package/MyModel.NodeSet2.xml +125 -0
  2. package/dist/addExtensionObjectDataType.d.ts +21 -21
  3. package/dist/addExtensionObjectDataType.js +130 -130
  4. package/dist/buildModel.d.ts +16 -0
  5. package/dist/buildModel.js +91 -0
  6. package/dist/buildModel.js.map +1 -0
  7. package/dist/build_model_inner.d.ts +17 -17
  8. package/dist/build_model_inner.js +40 -40
  9. package/dist/display.d.ts +2 -0
  10. package/dist/display.js +96 -0
  11. package/dist/display.js.map +1 -0
  12. package/dist/displayNodeElement.d.ts +5 -5
  13. package/dist/displayNodeElement.js +191 -191
  14. package/dist/dump_state_machine_to_graphviz.d.ts +6 -6
  15. package/dist/dump_state_machine_to_graphviz.js +119 -119
  16. package/dist/generate_markdown_doc.d.ts +6 -6
  17. package/dist/generate_markdown_doc.js +266 -266
  18. package/dist/index.d.ts +24 -24
  19. package/dist/index.js +48 -48
  20. package/dist/promoteToMandatory.d.ts +8 -8
  21. package/dist/promoteToMandatory.js +97 -97
  22. package/dist/setNamespaceMetaData.d.ts +1 -1
  23. package/dist/setNamespaceMetaData.js +5 -5
  24. package/dist/symbol.d.ts +1 -1
  25. package/dist/symbol.js +2 -2
  26. package/dist/tableHelper.d.ts +9 -9
  27. package/dist/tableHelper.js +60 -60
  28. package/dist/to_cvs.d.ts +2 -2
  29. package/dist/to_cvs.js +11 -11
  30. package/dist/to_graphivz.d.ts +14 -14
  31. package/dist/to_graphivz.js +294 -294
  32. package/dist/types.d.ts +1 -1
  33. package/dist/types.js +2 -2
  34. package/distNodeJS/build_documentation_to_file.d.ts +2 -2
  35. package/distNodeJS/build_documentation_to_file.js +26 -26
  36. package/distNodeJS/build_model.d.ts +7 -7
  37. package/distNodeJS/build_model.js +21 -21
  38. package/distNodeJS/index.d.ts +5 -5
  39. package/distNodeJS/index.js +19 -19
  40. package/distNodeJS/symbol_cvs.d.ts +3 -3
  41. package/distNodeJS/symbol_cvs.js +63 -63
  42. package/package.json +52 -53
@@ -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) {
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;
27
27
  //# sourceMappingURL=build_documentation_to_file.js.map
@@ -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
@@ -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";
@@ -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>;
@@ -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,54 +1,53 @@
1
1
  {
2
- "name": "node-opcua-modeler",
3
- "version": "2.64.0",
4
- "description": "pure nodejs OPCUA SDK - module - model",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "author": "Etienne Rossignon",
8
- "license": "MIT",
9
- "dependencies": {
10
- "chalk": "4.1.2",
11
- "cli-table3": "^0.6.1",
12
- "csv-parse": "5.0.4",
13
- "node-opcua-address-space": "2.64.0",
14
- "node-opcua-assert": "2.64.0",
15
- "node-opcua-basic-types": "2.64.0",
16
- "node-opcua-client-dynamic-extension-object": "2.64.0",
17
- "node-opcua-constants": "2.64.0",
18
- "node-opcua-data-model": "2.64.0",
19
- "node-opcua-factory": "2.64.0",
20
- "node-opcua-nodeid": "2.64.0",
21
- "node-opcua-nodesets": "2.64.0",
22
- "node-opcua-numeric-range": "2.64.0",
23
- "node-opcua-schemas": "2.64.0",
24
- "node-opcua-service-translate-browse-path": "2.64.0",
25
- "node-opcua-status-code": "2.64.0",
26
- "node-opcua-types": "2.64.0",
27
- "node-opcua-variant": "2.64.0",
28
- "node-opcua-xml2json": "2.64.0"
29
- },
30
- "devDependencies": {
31
- "node-opcua-leak-detector": "2.64.0",
32
- "should": "^13.2.3"
33
- },
34
- "repository": {
35
- "type": "git",
36
- "url": "git://github.com/node-opcua/node-opcua.git"
37
- },
38
- "keywords": [
39
- "OPCUA",
40
- "opcua",
41
- "m2m",
42
- "iot",
43
- "opc ua",
44
- "internet of things"
45
- ],
46
- "homepage": "http://node-opcua.github.io/",
47
- "gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c",
48
- "scripts": {
49
- "build": "tsc -b",
50
- "clean": "node -e \"require('rimraf').sync('dist');\"",
51
- "test": "mocha"
52
- },
53
- "readme": "## Node-OPCUA Modeler\n\nNode-opcua-modeler provides a programatic way to conveniently create OPCUA model and nodeset files.\n\n```typescript\nimport {\n AddressSpace,\n buildModel,\n nodesets\n} from \"node-opcua-modeler\";\nimport * as fs from \"fs\";\n\n// the namespaceUri\nconst namespaceUri = \"http://acme.com/Boiler/V0\";\nconst version= \"1.0.0\";\n\n// the nodeset file required by your model\nconst xmlFiles: string[] = [\n nodesets.standard,\n nodesets.di\n];\n \nasync function createModel(addressSpace: AddressSpace): Promise<void> {\n // create your model here !\n}\n\n(async () => {\n try {\n const { markdown, xmlModel, symbols } = await buildModel({\n namespaceUri,\n version,\n xmlFiles,\n createModel\n });\n // save model to a file\n const nodesetFiename = \"./MyModel.NodeSet2.xml\";\n await fs.promises.writeFile(nodesetFiename, xmlModel, \"utf-8\");\n\n } catch (err) {\n console.log(\"Error\", err);\n }\n})();\n```\n"
54
- }
2
+ "name": "node-opcua-modeler",
3
+ "version": "2.64.1",
4
+ "description": "pure nodejs OPCUA SDK - module - model",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -b",
9
+ "clean": "node -e \"require('rimraf').sync('dist');\"",
10
+ "test": "mocha"
11
+ },
12
+ "author": "Etienne Rossignon",
13
+ "license": "MIT",
14
+ "dependencies": {
15
+ "chalk": "4.1.2",
16
+ "cli-table3": "^0.6.1",
17
+ "csv-parse": "5.0.4",
18
+ "node-opcua-address-space": "2.64.1",
19
+ "node-opcua-assert": "2.64.1",
20
+ "node-opcua-basic-types": "2.64.1",
21
+ "node-opcua-client-dynamic-extension-object": "2.64.1",
22
+ "node-opcua-constants": "2.64.1",
23
+ "node-opcua-data-model": "2.64.1",
24
+ "node-opcua-factory": "2.64.1",
25
+ "node-opcua-nodeid": "2.64.1",
26
+ "node-opcua-nodesets": "2.64.1",
27
+ "node-opcua-numeric-range": "2.64.1",
28
+ "node-opcua-schemas": "2.64.1",
29
+ "node-opcua-service-translate-browse-path": "2.64.1",
30
+ "node-opcua-status-code": "2.64.1",
31
+ "node-opcua-types": "2.64.1",
32
+ "node-opcua-variant": "2.64.1",
33
+ "node-opcua-xml2json": "2.64.1"
34
+ },
35
+ "devDependencies": {
36
+ "node-opcua-leak-detector": "2.64.1",
37
+ "should": "^13.2.3"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git://github.com/node-opcua/node-opcua.git"
42
+ },
43
+ "keywords": [
44
+ "OPCUA",
45
+ "opcua",
46
+ "m2m",
47
+ "iot",
48
+ "opc ua",
49
+ "internet of things"
50
+ ],
51
+ "homepage": "http://node-opcua.github.io/",
52
+ "gitHead": "b65b8738603cd475d7d99a2b20b0ae9d32b4110c"
53
+ }