node-opcua-modeler 2.164.2 → 2.165.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.
package/dist/index.js CHANGED
@@ -14,40 +14,40 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.StructureDefinition = exports.EnumDefinition = exports.DataTypeDefinition = exports.ObjectIds = exports.ObjectTypeIds = exports.VariableTypeIds = exports.VariableIds = exports.ReferenceTypeIds = exports.DataTypeIds = exports.MethodIds = void 0;
18
- __exportStar(require("./types"), exports);
19
- __exportStar(require("./displayNodeElement"), exports);
20
- __exportStar(require("./promoteToMandatory"), exports);
21
- __exportStar(require("./setNamespaceMetaData"), exports);
22
- __exportStar(require("./build_model_inner"), exports);
23
- __exportStar(require("./addExtensionObjectDataType"), exports);
24
- __exportStar(require("./symbol"), exports);
25
- __exportStar(require("./to_cvs"), exports);
26
- __exportStar(require("./generate_markdown_doc"), exports);
27
- __exportStar(require("./tableHelper"), exports);
17
+ exports.StructureDefinition = exports.EnumDefinition = exports.DataTypeDefinition = exports.VariableTypeIds = exports.VariableIds = exports.ReferenceTypeIds = exports.ObjectTypeIds = exports.ObjectIds = exports.MethodIds = exports.DataTypeIds = void 0;
28
18
  //
29
19
  __exportStar(require("node-opcua-address-space"), exports);
30
- __exportStar(require("node-opcua-nodesets"), exports);
31
- __exportStar(require("node-opcua-variant"), exports);
32
20
  __exportStar(require("node-opcua-assert"), exports);
33
- __exportStar(require("node-opcua-data-model"), exports);
34
- __exportStar(require("node-opcua-nodeid"), exports);
35
- __exportStar(require("node-opcua-numeric-range"), exports);
36
- __exportStar(require("node-opcua-status-code"), exports);
21
+ __exportStar(require("node-opcua-assert"), exports);
37
22
  __exportStar(require("node-opcua-basic-types"), exports);
38
23
  __exportStar(require("node-opcua-constants"), exports);
39
- __exportStar(require("node-opcua-assert"), exports);
40
- __exportStar(require("node-opcua-service-translate-browse-path"), exports);
41
24
  var node_opcua_constants_1 = require("node-opcua-constants");
42
- Object.defineProperty(exports, "MethodIds", { enumerable: true, get: function () { return node_opcua_constants_1.MethodIds; } });
43
25
  Object.defineProperty(exports, "DataTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.DataTypeIds; } });
26
+ Object.defineProperty(exports, "MethodIds", { enumerable: true, get: function () { return node_opcua_constants_1.MethodIds; } });
27
+ Object.defineProperty(exports, "ObjectIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectIds; } });
28
+ Object.defineProperty(exports, "ObjectTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectTypeIds; } });
44
29
  Object.defineProperty(exports, "ReferenceTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ReferenceTypeIds; } });
45
30
  Object.defineProperty(exports, "VariableIds", { enumerable: true, get: function () { return node_opcua_constants_1.VariableIds; } });
46
31
  Object.defineProperty(exports, "VariableTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.VariableTypeIds; } });
47
- Object.defineProperty(exports, "ObjectTypeIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectTypeIds; } });
48
- Object.defineProperty(exports, "ObjectIds", { enumerable: true, get: function () { return node_opcua_constants_1.ObjectIds; } });
32
+ __exportStar(require("node-opcua-data-model"), exports);
33
+ __exportStar(require("node-opcua-nodeid"), exports);
34
+ __exportStar(require("node-opcua-nodesets"), exports);
35
+ __exportStar(require("node-opcua-numeric-range"), exports);
36
+ __exportStar(require("node-opcua-service-translate-browse-path"), exports);
37
+ __exportStar(require("node-opcua-status-code"), exports);
49
38
  var node_opcua_types_1 = require("node-opcua-types");
50
39
  Object.defineProperty(exports, "DataTypeDefinition", { enumerable: true, get: function () { return node_opcua_types_1.DataTypeDefinition; } });
51
40
  Object.defineProperty(exports, "EnumDefinition", { enumerable: true, get: function () { return node_opcua_types_1.EnumDefinition; } });
52
41
  Object.defineProperty(exports, "StructureDefinition", { enumerable: true, get: function () { return node_opcua_types_1.StructureDefinition; } });
42
+ __exportStar(require("node-opcua-variant"), exports);
43
+ __exportStar(require("./addExtensionObjectDataType"), exports);
44
+ __exportStar(require("./build_model_inner"), exports);
45
+ __exportStar(require("./displayNodeElement"), exports);
46
+ __exportStar(require("./generate_markdown_doc"), exports);
47
+ __exportStar(require("./promoteToMandatory"), exports);
48
+ __exportStar(require("./setNamespaceMetaData"), exports);
49
+ __exportStar(require("./symbol"), exports);
50
+ __exportStar(require("./tableHelper"), exports);
51
+ __exportStar(require("./to_cvs"), exports);
52
+ __exportStar(require("./types"), exports);
53
53
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uDAAqC;AACrC,uDAAqC;AACrC,yDAAuC;AACvC,sDAAoC;AACpC,+DAA6C;AAC7C,2CAAyB;AACzB,2CAAyB;AACzB,0DAAwC;AACxC,gDAA8B;AAE9B,EAAE;AACF,2DAAyC;AACzC,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC;AAClC,wDAAsC;AACtC,oDAAkC;AAClC,2DAAyC;AACzC,yDAAuC;AACvC,yDAAuC;AACvC,uDAAqC;AACrC,oDAAkC;AAClC,2EAAyD;AAEzD,6DAAwI;AAA/H,iHAAA,SAAS,OAAA;AAAE,mHAAA,WAAW,OAAA;AAAE,wHAAA,gBAAgB,OAAA;AAAE,mHAAA,WAAW,OAAA;AAAE,uHAAA,eAAe,OAAA;AAAE,qHAAA,aAAa,OAAA;AAAE,iHAAA,SAAS,OAAA;AAEzG,qDAM0B;AALtB,sHAAA,kBAAkB,OAAA;AAClB,kHAAA,cAAc,OAAA;AAEd,uHAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,EAAE;AACF,2DAAyC;AACzC,oDAAkC;AAClC,oDAAkC;AAClC,yDAAuC;AACvC,uDAAqC;AACrC,6DAQ8B;AAP1B,mHAAA,WAAW,OAAA;AACX,iHAAA,SAAS,OAAA;AACT,iHAAA,SAAS,OAAA;AACT,qHAAA,aAAa,OAAA;AACb,wHAAA,gBAAgB,OAAA;AAChB,mHAAA,WAAW,OAAA;AACX,uHAAA,eAAe,OAAA;AAEnB,wDAAsC;AACtC,oDAAkC;AAClC,sDAAoC;AACpC,2DAAyC;AACzC,2EAAyD;AACzD,yDAAuC;AACvC,qDAM0B;AALtB,sHAAA,kBAAkB,OAAA;AAClB,kHAAA,cAAc,OAAA;AAEd,uHAAA,mBAAmB,OAAA;AAGvB,qDAAmC;AACnC,+DAA6C;AAC7C,sDAAoC;AACpC,uDAAqC;AACrC,0DAAwC;AACxC,uDAAqC;AACrC,yDAAuC;AACvC,2CAAyB;AACzB,gDAA8B;AAC9B,2CAAyB;AACzB,0CAAwB"}
@@ -1,4 +1,4 @@
1
- import { UAMethod, UAObject, UAObjectType, UAReference, UAVariable, UAVariableType, ModellingRuleType } from "node-opcua-address-space";
1
+ import type { ModellingRuleType, UAMethod, UAObject, UAObjectType, UAReference, UAVariable, UAVariableType } from "node-opcua-address-space";
2
2
  export type UAConcrete = UAVariable | UAObject | UAMethod;
3
3
  export declare function getChildInTypeOrBaseType(node: UAObjectType | UAVariableType, propertyName: string, namespaceIndex: number): {
4
4
  propInSuperType: UAConcrete;
@@ -4,8 +4,8 @@ exports.getChildInTypeOrBaseType = getChildInTypeOrBaseType;
4
4
  exports.promoteToMandatory = promoteToMandatory;
5
5
  exports.promoteChild = promoteChild;
6
6
  const node_opcua_data_model_1 = require("node-opcua-data-model");
7
- const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
8
7
  const node_opcua_debug_1 = require("node-opcua-debug");
8
+ const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
9
9
  const displayNodeElement_1 = require("./displayNodeElement");
10
10
  const warningLog = (0, node_opcua_debug_1.make_warningLog)("promoteToMandatory");
11
11
  // find the reference that links node1 to node2
@@ -26,7 +26,7 @@ function findReferenceToNode(node1, node2) {
26
26
  return findReferenceToNode(uaType.subtypeOfObj, node2);
27
27
  }
28
28
  }
29
- throw new Error("Internal Error cannot find ref from node " + node1.nodeId.toString() + " " + node2.nodeId.toString());
29
+ throw new Error(`Internal Error cannot find ref from node ${node1.nodeId.toString()} ${node2.nodeId.toString()}`);
30
30
  }
31
31
  return ref;
32
32
  }
@@ -42,12 +42,12 @@ function getChildInTypeOrBaseType(node, propertyName, namespaceIndex) {
42
42
  /* c8 ignore next */
43
43
  if (!propNodeId) {
44
44
  (0, displayNodeElement_1.displayNodeElement)(subtypeOf);
45
- throw new Error("property " + propertyName + " do not exists on " + subtypeOf.browseName.toString() + " or any superType");
45
+ throw new Error(`property ${propertyName} do not exists on ${subtypeOf.browseName.toString()} or any superType`);
46
46
  }
47
47
  const propInSuperType = addressSpace.findNode(propNodeId);
48
48
  /* c8 ignore next */
49
49
  if (!propInSuperType) {
50
- throw new Error("cannot find " + propNodeId.toString());
50
+ throw new Error(`cannot find ${propNodeId.toString()}`);
51
51
  }
52
52
  // replicate property
53
53
  const reference = findReferenceToNode(subtypeOf, propInSuperType);
@@ -63,7 +63,7 @@ function promoteToMandatory(node, propertyName, namespaceIndex) {
63
63
  // check mandatory
64
64
  /* c8 ignore next */
65
65
  if (propInSuperType.modellingRule === "Mandatory") {
66
- warningLog("property " + propertyName + " is already Mandatory in super type");
66
+ warningLog(`property ${propertyName} is already Mandatory in super type`);
67
67
  }
68
68
  return promoteChild(node, propertyName, namespaceIndex, "Mandatory");
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"promoteToMandatory.js","sourceRoot":"","sources":["../source/promoteToMandatory.ts"],"names":[],"mappings":";;AAkDA,4DAoCC;AAED,gDAaC;AAED,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AAM,EAAE,eAAe,EAAE,GAAG,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IAEzF,kBAAkB;IAClB,oBAAoB;IACpB,IAAI,eAAe,CAAC,aAAa,KAAK,WAAW,EAAE,CAAC;QAChD,UAAU,CAAC,YAAY,YAAY,qCAAqC,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,YAAY,CACxB,IAAmC,EACnC,YAAoB,EACpB,cAAsB,EACtB,aAAiC;IAEjC,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IAEpG,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,aAAa,GAAG,eAAe,CAAC,aAAa,IAAI,IAAI,CAAC;IAC1D,CAAC;IAED,MAAM,MAAM,GAAgB;QACxB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,aAAa,EAAE,SAAS,CAAC,aAAa;KACzC,CAAC;IAEF,MAAM,OAAO,GAAI,eAA8B,CAAC,KAAK,CAAC;QAClD,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,aAAa;QACb,UAAU,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;QAC3B,sBAAsB,EAAE,IAAI;QAC5B,cAAc,EAAE,KAAK;KACxB,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACnB,CAAC"}
@@ -1,41 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TableHelper = void 0;
4
- // tslint:disable-next-line: no-var-requires
5
4
  const Table = require("cli-table3");
6
- const chars1 = {
7
- // tslint:disable-next-line: object-literal-sort-keys
8
- "top": "-", "top-mid": "+", "top-left": "+", "top-right": "+",
9
- "bottom": "-", "bottom-mid": "+", "bottom-left": "+", "bottom-right": "+",
10
- "left": "|", "left-mid": "+", "mid": "-", "mid-mid": "+",
11
- "right": "|", "right-mid": "+", "middle": "|"
12
- };
13
- const chars2 = {
14
- // tslint:disable-next-line: object-literal-sort-keys
15
- "top": " ", "top-mid": " ", "top-left": " ", "top-right": " ",
16
- "bottom": " ", "bottom-mid": " ", "bottom-left": " ", "bottom-right": " ",
17
- "left": "| ", "left-mid": "| ", "mid": "-", "mid-mid": " | ",
18
- "right": " |", "right-mid": "| ", "middle": " | "
19
- };
20
- const chars3 = {
21
- // tslint:disable-next-line: object-literal-sort-keys
22
- "top": "", "top-mid": "", "top-left": "", "top-right": "",
23
- "bottom": "", "bottom-mid": "", "bottom-left": "", "bottom-right": "",
24
- "left": "| ", "left-mid": "", "mid": "-", "mid-mid": " | ",
25
- "right": " |", "right-mid": "", "middle": " | "
26
- };
27
- chars1;
28
- chars2;
29
- chars3;
30
5
  function toMarkdownTable(table) {
31
6
  const t = [];
32
- t.push("| " + table.head.join(" | ") + " |");
33
- t.push("| " + table.head.map(() => "---").join(" | ") + " |");
7
+ t.push(`| ${table.head.join(" | ")} |`);
8
+ t.push(`| ${table.head.map(() => "---").join(" | ")} |`);
34
9
  for (const r of table.rows) {
35
- t.push("| " + r.join(" | ") + " |");
10
+ t.push(`| ${r.join(" | ")} |`);
36
11
  }
37
12
  return t.join("\n");
38
13
  }
14
+ function extractContent(c) {
15
+ if (typeof c === "object" && c !== null && "content" in c) {
16
+ return c.content;
17
+ }
18
+ return String(c);
19
+ }
39
20
  class TableHelper {
40
21
  rows = [];
41
22
  table;
@@ -44,15 +25,13 @@ class TableHelper {
44
25
  this.rows = [];
45
26
  // instantiate
46
27
  this.table = new Table({
47
- // chars,
48
- head,
49
- // colWidths: [100, 200, 50, 50,]
28
+ head
50
29
  });
51
30
  this.head = head;
52
31
  }
53
32
  push(row) {
54
33
  this.table.push(row);
55
- const row2 = row.map((c) => (c.content) ? c.content : c);
34
+ const row2 = row.map(extractContent);
56
35
  this.rows.push(row2);
57
36
  }
58
37
  toString() {
@@ -1 +1 @@
1
- {"version":3,"file":"tableHelper.js","sourceRoot":"","sources":["../source/tableHelper.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAEpC,MAAM,MAAM,GAAG;IACX,qDAAqD;IACrD,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG;IAC3D,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG;IACzE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG;IACxD,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;CAClD,CAAC;AAEF,MAAM,MAAM,GAAG;IACX,qDAAqD;IACrD,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI;IAC/D,QAAQ,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG;IAC5E,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK;IAC5D,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK;CACtD,CAAC;AACF,MAAM,MAAM,GAAG;IACX,qDAAqD;IACrD,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE;IACvD,QAAQ,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,aAA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OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QACxD,OAAQ,CAAqB,CAAC,OAAO,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,MAAa,WAAW;IACH,IAAI,GAAe,EAAE,CAAC;IACtB,KAAK,CAAe;IACpB,IAAI,CAAW;IAChC,YAAY,IAAc;QACtB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,cAAc;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC;YACnB,IAAI;SACP,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACM,IAAI,CAAC,GAAc;QACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrB,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACM,QAAQ;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IACM,eAAe;QAClB,OAAO,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;CACJ;AAvBD,kCAuBC"}
package/dist/to_cvs.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Symbols } from "./symbol";
1
+ import type { Symbols } from "./symbol";
2
2
  export declare function toCSV(arr: Symbols): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-modeler",
3
- "version": "2.164.2",
3
+ "version": "2.165.1",
4
4
  "description": "pure nodejs OPCUA SDK - module modeler",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,27 +13,27 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "cli-table3": "0.6.5",
16
- "csv-parse": "6.1.0",
17
- "node-opcua-address-space": "2.164.2",
16
+ "csv-parse": "6.2.0",
17
+ "node-opcua-address-space": "2.165.1",
18
18
  "node-opcua-assert": "2.164.0",
19
- "node-opcua-basic-types": "2.164.0",
20
- "node-opcua-client-dynamic-extension-object": "2.164.2",
19
+ "node-opcua-basic-types": "2.165.0",
20
+ "node-opcua-client-dynamic-extension-object": "2.165.1",
21
21
  "node-opcua-constants": "2.157.0",
22
- "node-opcua-data-model": "2.164.0",
23
- "node-opcua-debug": "2.164.0",
24
- "node-opcua-factory": "2.164.0",
25
- "node-opcua-nodeid": "2.164.0",
22
+ "node-opcua-data-model": "2.165.0",
23
+ "node-opcua-debug": "2.165.0",
24
+ "node-opcua-factory": "2.165.0",
25
+ "node-opcua-nodeid": "2.165.0",
26
26
  "node-opcua-nodesets": "2.163.1",
27
- "node-opcua-numeric-range": "2.164.0",
28
- "node-opcua-schemas": "2.164.0",
29
- "node-opcua-service-translate-browse-path": "2.164.0",
30
- "node-opcua-status-code": "2.164.0",
31
- "node-opcua-types": "2.164.0",
32
- "node-opcua-variant": "2.164.0"
27
+ "node-opcua-numeric-range": "2.165.0",
28
+ "node-opcua-schemas": "2.165.0",
29
+ "node-opcua-service-translate-browse-path": "2.165.0",
30
+ "node-opcua-status-code": "2.165.0",
31
+ "node-opcua-types": "2.165.0",
32
+ "node-opcua-variant": "2.165.0"
33
33
  },
34
34
  "devDependencies": {
35
- "node-opcua-address-space-base": "2.164.0",
36
- "node-opcua-leak-detector": "2.164.0"
35
+ "node-opcua-address-space-base": "2.165.0",
36
+ "node-opcua-leak-detector": "2.165.0"
37
37
  },
38
38
  "repository": {
39
39
  "type": "git",
@@ -48,7 +48,7 @@
48
48
  "internet of things"
49
49
  ],
50
50
  "homepage": "http://node-opcua.github.io/",
51
- "gitHead": "eb76d34b885c7584785d8eff69ada66f95b55c2e",
51
+ "gitHead": "e7c895840ea19bce7b376925f023324a69191707",
52
52
  "files": [
53
53
  "dist",
54
54
  "distNodeJS",
@@ -1,11 +1,19 @@
1
- import { Namespace as INamespace, PseudoSession, UADataType, UAObject, UAVariableType } from "node-opcua-address-space";
1
+ import {
2
+ type Namespace as INamespace,
3
+ PseudoSession,
4
+ type UADataType,
5
+ type UAObject,
6
+ type UAVariableType
7
+ } from "node-opcua-address-space";
2
8
  import assert from "node-opcua-assert";
3
- import { convertDataTypeDefinitionToStructureTypeSchema, ExtraDataTypeManager } from "node-opcua-client-dynamic-extension-object";
4
- import { coerceQualifiedName, LocalizedTextLike, QualifiedNameLike } from "node-opcua-data-model";
5
- import { ConstructorFuncWithSchema } from "node-opcua-factory";
9
+ import {
10
+ convertDataTypeDefinitionToStructureTypeSchema,
11
+ type ExtraDataTypeManager
12
+ } from "node-opcua-client-dynamic-extension-object";
13
+ import { coerceQualifiedName, type LocalizedTextLike, type QualifiedNameLike } from "node-opcua-data-model";
6
14
  import { NodeId, resolveNodeId } from "node-opcua-nodeid";
7
15
  import { createDynamicObjectConstructor } from "node-opcua-schemas";
8
- import { StructureDefinition, StructureDefinitionOptions } from "node-opcua-types";
16
+ import { StructureDefinition, type StructureDefinitionOptions } from "node-opcua-types";
9
17
 
10
18
  /**
11
19
  * create the deprecated DataTypeDictionary node that was
@@ -46,17 +54,34 @@ export async function addExtensionObjectDataType(namespace: INamespace, options:
46
54
 
47
55
  /* c8 ignore next */
48
56
  if (!options.browseName.toString().match(/DataType$/)) {
49
- throw new Error("DataType name must end up with DataType ! " + options.browseName.toString());
57
+ throw new Error(`DataType name must end up with DataType ! ${options.browseName.toString()}`);
50
58
  }
51
59
 
52
60
  const baseSuperType = "Structure";
53
- const subtypeOf = addressSpace.findDataType(options.subtypeOf ? options.subtypeOf : baseSuperType)!;
61
+ const subtypeOf = addressSpace.findDataType(options.subtypeOf ? options.subtypeOf : baseSuperType);
54
62
  if (!subtypeOf) {
55
63
  throw new Error("Cannot find base DataType ");
56
64
  }
57
65
  const structureDefinition = options.structureDefinition;
58
66
  structureDefinition.baseDataType = resolveNodeId(structureDefinition.baseDataType || "Structure");
59
-
67
+
68
+ // Resolve string/enum dataType names (e.g. "Double", DataType.Float)
69
+ // to proper NodeIds before constructing StructureDefinition, because
70
+ // the StructureField constructor calls coerceNodeId() which cannot
71
+ // handle plain DataType names like "Double".
72
+ if (structureDefinition.fields) {
73
+ for (const field of structureDefinition.fields) {
74
+ if (field.dataType !== undefined && field.dataType !== null && !(field.dataType instanceof NodeId)) {
75
+ const dt = addressSpace.findDataType(field.dataType as string | number);
76
+ if (dt) {
77
+ field.dataType = dt.nodeId;
78
+ } else if (typeof field.dataType === "string" || typeof field.dataType === "number") {
79
+ field.dataType = resolveNodeId(field.dataType);
80
+ }
81
+ }
82
+ }
83
+ }
84
+
60
85
  const isAbstract = options.isAbstract || false;
61
86
 
62
87
  const dataType = namespace.createDataType({
@@ -69,30 +94,31 @@ export async function addExtensionObjectDataType(namespace: INamespace, options:
69
94
  const defaultBinary = dataTypeEncodingType.instantiate({
70
95
  browseName: coerceQualifiedName("0:Default Binary"),
71
96
  encodingOf: dataType
72
- // nodeId: defaultBinaryEncodingNode,
73
- })!;
97
+ });
98
+ assert(defaultBinary);
74
99
  assert(defaultBinary.browseName.toString() === "Default Binary");
75
100
 
76
101
  const defaultXml = dataTypeEncodingType.instantiate({
77
102
  browseName: coerceQualifiedName("0:Default XML"),
78
103
  encodingOf: dataType
79
- // nodeId: defaultXmlEncodingNode,
80
- })!;
104
+ });
105
+ assert(defaultXml);
81
106
  assert(defaultXml.browseName.toString() === "Default XML");
82
107
 
83
-
84
- (dataType as any).$fullDefinition = new StructureDefinition(structureDefinition);
108
+ (dataType as unknown as { $fullDefinition?: StructureDefinition }).$fullDefinition = new StructureDefinition(
109
+ structureDefinition
110
+ );
85
111
 
86
112
  const d = dataType.getStructureDefinition();
87
113
  assert(!NodeId.sameNodeId(d.baseDataType, NodeId.nullNodeId));
88
114
 
89
115
  /// --------------- Create constructor
90
- const dataTypeManager = (addressSpace as any).$$extraDataTypeManager as ExtraDataTypeManager;
116
+ const dataTypeManager = (addressSpace as unknown as { $$extraDataTypeManager: ExtraDataTypeManager }).$$extraDataTypeManager;
91
117
  const dataTypeFactory = dataTypeManager.getDataTypeFactory(namespace.index);
92
118
  const session = new PseudoSession(addressSpace);
93
119
 
94
- const className = dataType.browseName.name!;
95
- const cache: any = {};
120
+ const className = dataType.browseName.name ?? "";
121
+ const cache: Record<string, unknown> = {};
96
122
  const schema = await convertDataTypeDefinitionToStructureTypeSchema(
97
123
  session,
98
124
  dataType.nodeId,
@@ -103,8 +129,7 @@ export async function addExtensionObjectDataType(namespace: INamespace, options:
103
129
  isAbstract,
104
130
  cache
105
131
  );
106
- const Constructor = createDynamicObjectConstructor(schema, dataTypeFactory) as ConstructorFuncWithSchema;
107
- Constructor;
132
+ createDynamicObjectConstructor(schema, dataTypeFactory);
108
133
  return dataType;
109
134
  }
110
135
 
@@ -120,39 +145,51 @@ export function addVariableTypeForDataType(namespace: INamespace, dataType: UADa
120
145
 
121
146
  const variableTypeName = dataType.browseName.name?.replace("DataType", "Type");
122
147
  const variableType = namespace.addVariableType({
123
- browseName: variableTypeName!,
148
+ browseName: variableTypeName || "",
124
149
  dataType: dataType.nodeId
125
150
  });
126
151
 
127
- const structure = addressSpace.findDataType("Structure")!;
152
+ const structure = addressSpace.findDataType("Structure");
153
+ /* c8 ignore next */
154
+ if (!structure) {
155
+ throw new Error("Cannot find Structure");
156
+ }
128
157
  for (const field of definition.fields || []) {
129
158
  let typeDefinition: UAVariableType | string = "BaseVariableType";
130
159
  const fType = addressSpace.findDataType(field.dataType);
131
160
  /* c8 ignore next */
132
161
  if (!fType) {
133
- throw new Error("Cannot find dataType" + field.dataType.toString());
162
+ throw new Error(`Cannot find dataType${field.dataType.toString()}`);
134
163
  }
135
164
  if (fType.isSubtypeOf(structure)) {
136
- const name = fType.browseName.name!.replace("DataType", "Type");
137
- typeDefinition = addressSpace.findVariableType(name, field.dataType.namespace)!;
138
- const comp = typeDefinition.instantiate({
139
- browseName: field.name!,
165
+ const name = fType.browseName.name?.replace("DataType", "Type");
166
+ /* c8 ignore next */
167
+ if (!name) {
168
+ throw new Error(`Cannot find name for dataType${field.dataType.toString()}`);
169
+ }
170
+ typeDefinition = addressSpace.findVariableType(name, field.dataType.namespace) as UAVariableType;
171
+ /* c8 ignore next */
172
+ if (!typeDefinition) {
173
+ throw new Error(`Cannot find typeDefinition for dataType${field.dataType.toString()}`);
174
+ }
175
+ typeDefinition.instantiate({
176
+ browseName: field.name || "",
140
177
  componentOf: variableType,
141
178
  dataType: field.dataType,
142
179
  description: field.description,
143
180
  modellingRule: "Mandatory",
144
181
  valueRank: field.valueRank === undefined ? -1 : field.valueRank
145
- }); comp;
182
+ });
146
183
  } else {
147
- const comp = namespace.addVariable({
148
- browseName: field.name!,
184
+ namespace.addVariable({
185
+ browseName: field.name || "",
149
186
  componentOf: variableType,
150
187
  dataType: field.dataType,
151
188
  description: field.description,
152
189
  modellingRule: "Mandatory",
153
190
  typeDefinition,
154
191
  valueRank: field.valueRank === undefined ? -1 : field.valueRank
155
- }); comp;
192
+ });
156
193
  }
157
194
  }
158
195
  return variableType;
@@ -1,6 +1,6 @@
1
- import { AddressSpace, NodeIdManager, XmlLoaderAsyncFunc, generateAddressSpaceRaw } from "node-opcua-address-space";
1
+ import { AddressSpace, generateAddressSpaceRaw, type NodeIdManager, type XmlLoaderAsyncFunc } from "node-opcua-address-space";
2
2
  import { buildDocumentationToString } from "./generate_markdown_doc";
3
- import { Symbols } from "./symbol";
3
+ import type { Symbols } from "./symbol";
4
4
 
5
5
  export interface BuildModelOptionsBase {
6
6
  version: string;
@@ -20,17 +20,17 @@ export async function buildModelInner(data: BuildModelOptions): Promise<{ markdo
20
20
  // create own namespace (before loading other xml files)
21
21
  const ns = addressSpace.registerNamespace(data.namespaceUri);
22
22
 
23
- const nodeIdManager = (ns as any)._nodeIdManager as NodeIdManager;
23
+ const nodeIdManager = (ns as unknown as { _nodeIdManager: NodeIdManager })._nodeIdManager;
24
24
  if (data.presetSymbols) {
25
25
  nodeIdManager.setSymbols(data.presetSymbols);
26
26
  }
27
27
 
28
28
  await generateAddressSpaceRaw(addressSpace, data.xmlFiles, data.xmlLoader, {});
29
29
 
30
- (addressSpace.getOwnNamespace() as any).registerSymbolicNames = true;
30
+ (addressSpace.getOwnNamespace() as unknown as { registerSymbolicNames: boolean }).registerSymbolicNames = true;
31
31
  await data.createModel(addressSpace);
32
- (addressSpace.getOwnNamespace() as any).registerSymbolicNames = false;
33
-
32
+ (addressSpace.getOwnNamespace() as unknown as { registerSymbolicNames: boolean }).registerSymbolicNames = false;
33
+
34
34
  const xmlModel = ns.toNodeset2XML();
35
35
  const symbols = nodeIdManager.getSymbols();
36
36
  const doc = await buildDocumentationToString(ns, {});
@@ -38,7 +38,6 @@ export async function buildModelInner(data: BuildModelOptions): Promise<{ markdo
38
38
 
39
39
  return { xmlModel, symbols, markdown: doc };
40
40
  } catch (err) {
41
- // tslint:disable-next-line: no-console
42
41
  console.log("Error", err);
43
42
  throw err;
44
43
  }