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.
Files changed (54) hide show
  1. package/dist/addExtensionObjectDataType.d.ts +21 -21
  2. package/dist/addExtensionObjectDataType.js +130 -130
  3. package/dist/build_model_inner.d.ts +17 -17
  4. package/dist/build_model_inner.js +40 -40
  5. package/dist/build_model_inner.js.map +1 -1
  6. package/dist/displayNodeElement.d.ts +5 -5
  7. package/dist/displayNodeElement.js +192 -191
  8. package/dist/displayNodeElement.js.map +1 -1
  9. package/dist/dump_state_machine_to_graphviz.d.ts +6 -6
  10. package/dist/dump_state_machine_to_graphviz.js +119 -119
  11. package/dist/generate_markdown_doc.d.ts +41 -6
  12. package/dist/generate_markdown_doc.js +314 -266
  13. package/dist/generate_markdown_doc.js.map +1 -1
  14. package/dist/index.d.ts +24 -24
  15. package/dist/index.js +48 -48
  16. package/dist/index.js.map +1 -1
  17. package/dist/promoteToMandatory.d.ts +8 -8
  18. package/dist/promoteToMandatory.js +97 -97
  19. package/dist/setNamespaceMetaData.d.ts +1 -1
  20. package/dist/setNamespaceMetaData.js +5 -5
  21. package/dist/symbol.d.ts +1 -1
  22. package/dist/symbol.js +2 -2
  23. package/dist/tableHelper.d.ts +9 -9
  24. package/dist/tableHelper.js +60 -60
  25. package/dist/to_cvs.d.ts +2 -2
  26. package/dist/to_cvs.js +11 -11
  27. package/dist/to_graphivz.d.ts +14 -14
  28. package/dist/to_graphivz.js +294 -294
  29. package/dist/types.d.ts +1 -1
  30. package/dist/types.js +2 -2
  31. package/distNodeJS/build_documentation_to_file.d.ts +3 -2
  32. package/distNodeJS/build_documentation_to_file.js +26 -26
  33. package/distNodeJS/build_documentation_to_file.js.map +1 -1
  34. package/distNodeJS/build_model.d.ts +7 -7
  35. package/distNodeJS/build_model.js +21 -21
  36. package/distNodeJS/index.d.ts +5 -5
  37. package/distNodeJS/index.js +19 -19
  38. package/distNodeJS/symbol_cvs.d.ts +3 -3
  39. package/distNodeJS/symbol_cvs.js +63 -63
  40. package/package.json +6 -6
  41. package/source/build_model_inner.ts +3 -5
  42. package/source/displayNodeElement.ts +3 -3
  43. package/source/generate_markdown_doc.ts +88 -33
  44. package/source/index.ts +2 -1
  45. package/source_nodejs/build_documentation_to_file.ts +3 -3
  46. package/MyModel.NodeSet2.xml +0 -125
  47. package/dist/buildModel.d.ts +0 -16
  48. package/dist/buildModel.js +0 -91
  49. package/dist/buildModel.js.map +0 -1
  50. package/dist/display.d.ts +0 -2
  51. package/dist/display.js +0 -96
  52. package/dist/display.js.map +0 -1
  53. package/source/dump_state_machine_to_graphviz.ts +0 -164
  54. package/source/to_graphivz.ts +0 -351
@@ -1,125 +0,0 @@
1
- <?xml version="1.0"?>
2
- <UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
3
- <NamespaceUris>
4
- <Uri>http://acme.com/Boiler/V0</Uri>
5
- <Uri>http://opcfoundation.org/UA/DI/</Uri>
6
- </NamespaceUris>
7
- <Models/>
8
- <Aliases>
9
- <Alias Alias="2:DeviceHealthEnumeration">ns=2;i=6244</Alias>
10
- <Alias Alias="Boolean">i=1</Alias>
11
- <Alias Alias="DateTime">i=13</Alias>
12
- <Alias Alias="HasComponent">i=47</Alias>
13
- <Alias Alias="HasModellingRule">i=37</Alias>
14
- <Alias Alias="HasProperty">i=46</Alias>
15
- <Alias Alias="HasSubtype">i=45</Alias>
16
- <Alias Alias="HasTypeDefinition">i=40</Alias>
17
- <Alias Alias="IdType">i=256</Alias>
18
- <Alias Alias="NumericRange">i=291</Alias>
19
- <Alias Alias="Organizes">i=35</Alias>
20
- <Alias Alias="String">i=12</Alias>
21
- </Aliases>
22
- <!--ReferenceTypes-->
23
- <!--ObjectTypes-->
24
- <!--ObjectType - 1:BoilerType {{{{ -->
25
- <UAObjectType NodeId="ns=1;i=1008" BrowseName="1:BoilerType">
26
- <DisplayName>BoilerType</DisplayName>
27
- <References>
28
- <Reference ReferenceType="HasSubtype" IsForward="false">ns=2;i=1002</Reference>
29
- <Reference ReferenceType="HasComponent">ns=1;i=1009</Reference>
30
- </References>
31
- </UAObjectType>
32
- <UAVariable NodeId="ns=1;i=1009" BrowseName="2:DeviceHealth" DataType="2:DeviceHealthEnumeration">
33
- <DisplayName>DeviceHealth</DisplayName>
34
- <References>
35
- <Reference ReferenceType="HasTypeDefinition">i=63</Reference>
36
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
37
- </References>
38
- </UAVariable>
39
- <!--ObjectType - 1:BoilerType }}}}-->
40
- <!--VariableTypes-->
41
- <!--Other Nodes-->
42
- <!-- StaticStringNodeIdPattern StaticNumericNodeIdRange StaticNodeIdTypes NamespaceVersion NamespaceUri NamespacePublicationDate IsNamespaceSubset http://acme.com/Boiler/V0 BoilerType DeviceHealth-->
43
- <UAVariable NodeId="ns=1;i=1007" BrowseName="StaticStringNodeIdPattern" DataType="String">
44
- <DisplayName>StaticStringNodeIdPattern</DisplayName>
45
- <Description>A regular expression which matches string node ids are the same in every server that exposes them.</Description>
46
- <References>
47
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
48
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
49
- </References>
50
- </UAVariable>
51
- <UAVariable NodeId="ns=1;i=1006" BrowseName="StaticNumericNodeIdRange" ValueRank="1" DataType="NumericRange">
52
- <DisplayName>StaticNumericNodeIdRange</DisplayName>
53
- <Description>A list of ranges for numeric node ids which are the same in every server that exposes them.</Description>
54
- <References>
55
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
56
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
57
- </References>
58
- </UAVariable>
59
- <UAVariable NodeId="ns=1;i=1005" BrowseName="StaticNodeIdTypes" ValueRank="1" DataType="IdType">
60
- <DisplayName>StaticNodeIdTypes</DisplayName>
61
- <Description>A list of IdTypes for nodes which are the same in every server that exposes them.</Description>
62
- <References>
63
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
64
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
65
- </References>
66
- </UAVariable>
67
- <UAVariable NodeId="ns=1;i=1002" BrowseName="NamespaceVersion" DataType="String">
68
- <DisplayName>NamespaceVersion</DisplayName>
69
- <Description>The human readable string representing version of the namespace.</Description>
70
- <References>
71
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
72
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
73
- </References>
74
- <Value>
75
- <String>1.0.0</String>
76
- </Value>
77
- </UAVariable>
78
- <UAVariable NodeId="ns=1;i=1001" BrowseName="NamespaceUri" DataType="String">
79
- <DisplayName>NamespaceUri</DisplayName>
80
- <Description>The URI of the namespace.</Description>
81
- <References>
82
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
83
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
84
- </References>
85
- <Value>
86
- <String>http://acme.com/Boiler/V0</String>
87
- </Value>
88
- </UAVariable>
89
- <UAVariable NodeId="ns=1;i=1003" BrowseName="NamespacePublicationDate" DataType="DateTime">
90
- <DisplayName>NamespacePublicationDate</DisplayName>
91
- <Description>The publication date for the namespace.</Description>
92
- <References>
93
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
94
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
95
- </References>
96
- <Value>
97
- <DateTime>2020-01-16T10:11:59.351Z</DateTime>
98
- </Value>
99
- </UAVariable>
100
- <UAVariable NodeId="ns=1;i=1004" BrowseName="IsNamespaceSubset" DataType="Boolean">
101
- <DisplayName>IsNamespaceSubset</DisplayName>
102
- <Description>If TRUE then the server only supports a subset of the namespace.</Description>
103
- <References>
104
- <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
105
- <Reference ReferenceType="HasModellingRule">i=78</Reference>
106
- </References>
107
- </UAVariable>
108
- <!--Object - 1:http://acme.com/Boiler/V0 {{{{ -->
109
- <UAObject NodeId="ns=1;i=1000" BrowseName="1:http://acme.com/Boiler/V0">
110
- <DisplayName>http://acme.com/Boiler/V0</DisplayName>
111
- <Description>Provides the metadata for a namespace used by the server.</Description>
112
- <References>
113
- <Reference ReferenceType="HasTypeDefinition">i=11616</Reference>
114
- <Reference ReferenceType="Organizes" IsForward="false">i=11715</Reference>
115
- <Reference ReferenceType="HasProperty">ns=1;i=1001</Reference>
116
- <Reference ReferenceType="HasProperty">ns=1;i=1002</Reference>
117
- <Reference ReferenceType="HasProperty">ns=1;i=1003</Reference>
118
- <Reference ReferenceType="HasProperty">ns=1;i=1004</Reference>
119
- <Reference ReferenceType="HasProperty">ns=1;i=1005</Reference>
120
- <Reference ReferenceType="HasProperty">ns=1;i=1006</Reference>
121
- <Reference ReferenceType="HasProperty">ns=1;i=1007</Reference>
122
- </References>
123
- </UAObject>
124
- <!--Object - 1:http://acme.com/Boiler/V0 }}}} -->
125
- </UANodeSet>
@@ -1,16 +0,0 @@
1
- import { AddressSpace } from "node-opcua-address-space";
2
- export declare type Symbols = Array<[string, number, string]>;
3
- export interface BuildModelOptions {
4
- version: string;
5
- namespaceUri: string;
6
- xmlFiles: string[];
7
- createModel: (addressSpace: AddressSpace) => Promise<void>;
8
- presetSymbols?: Symbols;
9
- }
10
- export declare function buildModel(data: BuildModelOptions): Promise<{
11
- markdown: string;
12
- xmlModel: string;
13
- symbols: Symbols;
14
- }>;
15
- export declare function saveSymbolsToCSV(csvFilename: string, symbols: Symbols): Promise<void>;
16
- export declare function getPresetSymbolsFromCSV(csvFilename: string): Promise<Symbols>;
@@ -1,91 +0,0 @@
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
- const fs = require("fs");
13
- const node_opcua_address_space_1 = require("node-opcua-address-space");
14
- const util_1 = require("util");
15
- const writeFile = util_1.promisify(fs.writeFile);
16
- const readFile = util_1.promisify(fs.readFile);
17
- function buildModel(data) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- try {
20
- const addressSpace = node_opcua_address_space_1.AddressSpace.create();
21
- // create own namespace (before loading other xml files)
22
- const ns = addressSpace.registerNamespace(data.namespaceUri);
23
- const nodeIdManager = (ns._nodeIdManager);
24
- if (data.presetSymbols) {
25
- nodeIdManager.setSymbols(data.presetSymbols);
26
- }
27
- yield node_opcua_address_space_1.generateAddressSpace(addressSpace, data.xmlFiles);
28
- yield data.createModel(addressSpace);
29
- const xmlModel = ns.toNodeset2XML();
30
- const symbols = nodeIdManager.getSymbols();
31
- const doc = yield generate_markdown_doc_1.buildDocumentationToString(ns);
32
- addressSpace.dispose();
33
- return { xmlModel, symbols, markdown: doc };
34
- }
35
- catch (err) {
36
- // tslint:disable-next-line: no-console
37
- console.log("Error", err);
38
- throw err;
39
- }
40
- });
41
- }
42
- exports.buildModel = buildModel;
43
- const parse = require("csv-parse");
44
- const generate_markdown_doc_1 = require("./generate_markdown_doc");
45
- function toCSV(arr) {
46
- const line = [];
47
- for (const [name, value, nodeClass] of arr) {
48
- line.push([name, value, nodeClass].join(","));
49
- }
50
- return line.join("\n");
51
- }
52
- function saveSymbolsToCSV(csvFilename, symbols) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- yield writeFile(csvFilename, toCSV(symbols), "utf-8");
55
- });
56
- }
57
- exports.saveSymbolsToCSV = saveSymbolsToCSV;
58
- function getPresetSymbolsFromCSV(csvFilename) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- try {
61
- const data = yield readFile(csvFilename, "utf-8");
62
- const records = yield new Promise((resolve) => {
63
- const output = [];
64
- parse(data, {
65
- cast: (value, context) => {
66
- if (context.index === 1) {
67
- return parseInt(value, 10);
68
- }
69
- return value;
70
- }
71
- }).on("readable", function () {
72
- let record = this.read();
73
- while (record) {
74
- output.push(record);
75
- record = this.read();
76
- }
77
- }).on("end", () => {
78
- resolve(output);
79
- });
80
- });
81
- return records;
82
- }
83
- catch (err) {
84
- // tslint:disable-next-line: no-console
85
- console.log("getPresetSymbols err = ", err.message);
86
- return [];
87
- }
88
- });
89
- }
90
- exports.getPresetSymbolsFromCSV = getPresetSymbolsFromCSV;
91
- //# sourceMappingURL=buildModel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildModel.js","sourceRoot":"","sources":["../source/buildModel.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,yBAAyB;AACzB,uEAKkC;AAElC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,gBAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;AAC1C,MAAM,QAAQ,GAAG,gBAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAYxC,SAAsB,UAAU,CAAC,IAAuB;;QACpD,IAAI;YACA,MAAM,YAAY,GAAG,uCAAY,CAAC,MAAM,EAAE,CAAC;YAE3C,wDAAwD;YACxD,MAAM,EAAE,GAAG,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE7D,MAAM,aAAa,GAAG,CAAE,EAAU,CAAC,cAAc,CAAkB,CAAC;YACpE,IAAI,IAAI,CAAC,aAAa,EAAE;gBACpB,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAChD;YAED,MAAM,+CAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAExD,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAErC,MAAM,QAAQ,GAAG,EAAE,CAAC,a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EAAE,OAAO,EAAE,EAAE;wBACrB,IAAI,OAAO,CAAC,KAAK,KAAK,CAAC,EAAE;4BACrB,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;yBAC9B;wBACD,OAAO,KAAK,CAAC;oBACjB,CAAC;iBACJ,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE;oBACd,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;oBACzB,OAAO,MAAM,EAAE;wBACX,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;wBACpB,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;qBACxB;gBACL,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBACd,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YACH,OAAO,OAAkB,CAAC;SAC7B;QAAC,OAAO,GAAG,EAAE;YACV,uCAAuC;YACvC,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACpD,OAAO,EAAE,CAAC;SACb;IACL,CAAC;CAAA;AA7BD,0DA6BC"}
package/dist/display.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { BaseNode } from "node-opcua-address-space";
2
- export declare function displayNodeElement(node: BaseNode): void;
package/dist/display.js DELETED
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_opcua_variant_1 = require("node-opcua-variant");
4
- const node_opcua_data_model_1 = require("node-opcua-data-model");
5
- const Table = require("cli-table");
6
- const a = 'ⓂⓄⓋⓥⓇ❗⟵ ⟶⟷';
7
- function symbol(nodeClass) {
8
- switch (nodeClass) {
9
- case node_opcua_data_model_1.NodeClass.DataType: return "Ⓓ";
10
- case node_opcua_data_model_1.NodeClass.ObjectType: return "<Ⓞ>";
11
- case node_opcua_data_model_1.NodeClass.VariableType: return "<Ⓥ>";
12
- case node_opcua_data_model_1.NodeClass.Method: return "Ⓜ";
13
- case node_opcua_data_model_1.NodeClass.Object: return "Ⓞ";
14
- case node_opcua_data_model_1.NodeClass.Variable: return "Ⓥ";
15
- case node_opcua_data_model_1.NodeClass.View: return "⦖";
16
- default: return "?";
17
- }
18
- }
19
- function displayNodeElement(node) {
20
- // instantiate
21
- var table = new Table({
22
- head: [
23
- 'ReferenceType', 'NodeId', 'BrowseName', 'ModellingRule', "TypeDefinition", "DataType", "Value"
24
- ],
25
- });
26
- table.push([
27
- "BrowseName: ",
28
- { colSpan: 6, content: node.browseName.toString() },
29
- ]);
30
- if (node.description) {
31
- table.push([
32
- "Description: ",
33
- node.description.toString(),
34
- ]);
35
- }
36
- const alreadyDumped = {};
37
- function dumpRefe(ref) {
38
- if (!ref.isForward) {
39
- return;
40
- }
41
- if (!ref.node) {
42
- console.log(" Halt ", ref.toString());
43
- return;
44
- }
45
- const dir = ref.isForward ? "⟶" : "⟵";
46
- const refNode = ref.node;
47
- const refType = ref._referenceType;
48
- // xx const r = refNode.findReferencesAsObject("HasModellingRule", true);
49
- const modelingRule = refNode.modellingRule || ""; // r[0] ? r[0].browseName.toString() : "/";
50
- let value = "";
51
- let dataType = "";
52
- if (refNode.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
53
- const v = refNode;
54
- const val = v.readValue().value.value;
55
- if (v.isEnumeration() && val !== null) {
56
- const a = v.readEnumValue();
57
- value = a.value + " (" + a.name + ")";
58
- }
59
- else {
60
- value = val ? val.toString() : "null";
61
- }
62
- const actualDataType = node_opcua_variant_1.DataType[v.readValue().value.dataType];
63
- dataType = v.dataTypeObj.browseName.toString();
64
- //findBasicDataType(v.dataTypeObj);
65
- }
66
- table.push([
67
- refType.browseName.toString() + dir + symbol(refNode.nodeClass),
68
- refNode.nodeId.toString(),
69
- refNode.browseName.toString(),
70
- modelingRule,
71
- refNode.typeDefinitionObj ? refNode.typeDefinitionObj.browseName.toString() : "",
72
- dataType, value
73
- ]);
74
- alreadyDumped[refNode.browseName.toString()] = 1;
75
- }
76
- const references = node.allReferences();
77
- for (const ref of references) {
78
- dumpRefe(ref);
79
- }
80
- // add property from derived type
81
- if (node.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType || node.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
82
- const curNode = node;
83
- let superType = curNode.subtypeOfObj;
84
- while (superType) {
85
- table.push([superType.browseName.toString() + ":", "--", "--", "--"]);
86
- const references = superType.allReferences();
87
- for (const ref of references) {
88
- dumpRefe(ref);
89
- }
90
- superType = superType.subtypeOfObj;
91
- }
92
- }
93
- console.log(table.toString());
94
- }
95
- exports.displayNodeElement = displayNodeElement;
96
- //# sourceMappingURL=display.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"display.js","sourceRoot":"","sources":["../source/display.ts"],"names":[],"mappings":";;AAIA,2DAA8C;AAC9C,iEAAkD;AAClD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAGnC,MAAM,CAAC,GAAG,YAAY,CAAA;AACtB,SAAS,MAAM,CAAC,SAAoB;IAChC,QAAQ,SAAS,EAAE;QACf,KAAK,iCAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC;QACpC,KAAK,iCAAS,CAAC,UAAU,CAAC,CAAC,OAAO,KAAK,CAAC;QACxC,KAAK,iCAAS,CAAC,YAAY,CAAC,CAAC,OAAO,KAAK,CAAC;QAC1C,KAAK,iCAAS,CAAC,MAAM,CAAC,CAAC,OAAO,GAAG,CAAC;QAClC,KAAK,iCAAS,CAAC,MAAM,CAAC,CAAC,OAAO,GAAG,CAAC;QAClC,KAAK,iCAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC;QACpC,KAAK,iCAAS,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC;QAChC,OAAO,CAAC,CAAC,OAAO,GAAG,CAAA;KACtB;AACL,CAAC;AACD,SAAgB,kBAAkB,CAAC,IA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AS,KAAK,iCAAS,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,KAAK,iCAAS,CAAC,YAAY,EAAE;QAEtF,MAAM,OAAO,GAAG,IAAI,CAAC;QAErB,IAAI,SAAS,GAAI,OAAwB,CAAC,YAAY,CAAC;QACvD,OAAO,SAAS,EAAE;YACd,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YACtE,MAAM,UAAU,GAAG,SAAS,CAAC,aAAa,EAAE,CAAC;YAC7C,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;gBAC1B,QAAQ,CAAC,GAAG,CAAC,CAAC;aACjB;YACD,SAAS,GAAI,SAA0B,CAAC,YAAY,CAAC;SACxD;KACJ;IACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AAClC,CAAC;AAhGD,gDAgGC"}
@@ -1,164 +0,0 @@
1
- /**
2
- * @module node-opcua-address-space
3
- */
4
- // tslint:disable:no-console
5
- /*
6
- * class Node {
7
- * { browseName: "string", nodeId: NodeId}
8
- * }
9
- * Transition {
10
- * browseName: "String"
11
- * fromState: Node
12
- * toState: Node
13
- * }
14
- * class SateMachineType {
15
- * initialState: Node
16
- * states: [ Node,Node, ...]
17
- * transitions: [Transition]
18
- * }
19
- * @param stateMachineType
20
- */
21
- import { BaseNode, UAState, UAStateMachineEx, UATransition, UAObject, UATransitionEx } from "node-opcua-address-space";
22
-
23
-
24
- export function dumpStateMachineToPlantUML(stateMachineType: UAStateMachineEx): string {
25
-
26
- const lines: string[] = [];
27
- function w(str: string) {
28
- lines.push(str);
29
- }
30
-
31
- function s(state: BaseNode) {
32
- return state? state.nodeId.value.toString() : "";
33
- }
34
-
35
- function n(state: BaseNode) {
36
- return state ? state.browseName.name!.toString() : "";
37
- }
38
-
39
- //w("@startuml "); // + stateMachineType.browseName.toString() + ".png");
40
- // initial state if any
41
-
42
- if (stateMachineType.initialState) {
43
- w(" [*] --> " + s(stateMachineType.initialState));
44
- w(" " + s(stateMachineType.initialState) + ":" + n(stateMachineType.initialState));
45
- } else {
46
- w("[*] --> [*]");
47
- }
48
-
49
- function t(transition: BaseNode) {
50
- let name = n(transition);
51
- name = name.replace(":", "");
52
- name = name.replace("To", "\\nTo\\n");
53
- name = name.replace("Transition", "\\nTransition");
54
- return name;
55
- }
56
-
57
- stateMachineType.states && stateMachineType.states.forEach((state: UAObject) => w(" " + s(state) + ": " + n(state)));
58
-
59
- stateMachineType.transitions && stateMachineType.transitions.forEach((transition: UATransitionEx) =>
60
- w(" " + s(transition.fromStateNode!) + " --> " + s(transition.toStateNode!) + " : " + t(transition))
61
- );
62
-
63
- // w("@enduml");
64
- return lines.join("\n");
65
-
66
- }
67
-
68
- /*
69
- @startuml
70
-
71
- 2930: Unshelved
72
-
73
- 2932: TimedShelved
74
-
75
- 2933: OneShotShelved
76
-
77
- 2930 --> 2932 : "2935\nUnshelvedToTimedShelved"
78
-
79
- 2930 --> 2933 : "2936\nUnshelvedToOneShotShelved"
80
-
81
- 2932 --> 2930 : "2940\nTimedShelvedToUnshelved"
82
-
83
- 2932 --> 2933 : "2942\nTimedShelvedToOneShotShelved"
84
-
85
- 2933 --> 2930 : "2943\nOneShotShelvedToUnshelved"
86
-
87
- 2933 --> 2932 : "2945\nOneShotShelvedToTimedShelved"
88
-
89
- @enduml
90
-
91
- */
92
-
93
- /*
94
- digraph finite_state_machine {
95
- rankdir=LR;
96
- size="8,5"
97
- node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
98
- node [shape = circle];
99
- LR_0 -> LR_2 [ label = "SS(B)" ];
100
- LR_0 -> LR_1 [ label = "SS(S)" ];
101
- LR_1 -> LR_3 [ label = "S($end)" ];
102
- LR_2 -> LR_6 [ label = "SS(b)" ];
103
- LR_2 -> LR_5 [ label = "SS(a)" ];
104
- LR_2 -> LR_4 [ label = "S(A)" ];
105
- LR_5 -> LR_7 [ label = "S(b)" ];
106
- LR_5 -> LR_5 [ label = "S(a)" ];
107
- LR_6 -> LR_6 [ label = "S(b)" ];
108
- LR_6 -> LR_5 [ label = "S(a)" ];
109
- LR_7 -> LR_8 [ label = "S(b)" ];
110
- LR_7 -> LR_5 [ label = "S(a)" ];
111
- LR_8 -> LR_6 [ label = "S(b)" ];
112
- LR_8 -> LR_5 [ label = "S(a)" ];
113
- }
114
- */
115
- export function dumpStateMachineToGraphViz(
116
- /*StateMachineProxy*/
117
- stateMachineType: UAStateMachineEx
118
- ): string {
119
- const lines: string[] = [];
120
- function w(str: string) {
121
- lines.push(str)
122
- }
123
-
124
- function s(state: BaseNode) {
125
- return state.nodeId.value.toString();
126
- }
127
-
128
- function n(state: BaseNode) {
129
- return state.browseName.name!.toString();
130
- }
131
-
132
- function s_full(state: BaseNode) {
133
- return s(state) + ' [ label = "' + n(state) + '" ]';
134
- }
135
-
136
- w("digraph finite_state_machine {");
137
- // initial state if any
138
-
139
- if (stateMachineType.initialState) {
140
- w("node [ shape = doublecircle];");
141
- w(" _" + s_full(stateMachineType.initialState!) + " ;");
142
- }
143
- w("node [ shape = circle];");
144
- stateMachineType.states.forEach((state: UAState) => w(" _" + s_full(state)));
145
-
146
- stateMachineType.transitions.forEach((transition) =>
147
- w(
148
- " _" +
149
- s(transition.fromStateNode!) +
150
- " -> _" +
151
- s(transition.toStateNode!) +
152
- " [ " +
153
- // " labeltooltip = \"" + i(transition) + "\" " +
154
- ', label = "' +
155
- n(transition) +
156
- '" ];'
157
- )
158
- );
159
-
160
- w("}");
161
-
162
- return lines.join("\n");
163
-
164
- }