node-opcua-address-space 2.77.0 → 2.78.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 (73) hide show
  1. package/dist/source/continuation_points/continuation_point_manager.d.ts +59 -0
  2. package/dist/source/continuation_points/continuation_point_manager.js +6 -6
  3. package/dist/source/continuation_points/continuation_point_manager.js.map +1 -1
  4. package/dist/source/index.d.ts +1 -0
  5. package/dist/source/index.js +1 -0
  6. package/dist/source/index.js.map +1 -1
  7. package/dist/source/loader/ensure_datatype_extracted.js +25 -0
  8. package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
  9. package/dist/source/loader/generateAddressSpaceRaw.d.ts +2 -1
  10. package/dist/source/loader/generateAddressSpaceRaw.js +2 -2
  11. package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
  12. package/dist/source/loader/load_nodeset2.d.ts +7 -3
  13. package/dist/source/loader/load_nodeset2.js +66 -31
  14. package/dist/source/loader/load_nodeset2.js.map +1 -1
  15. package/dist/source/xml_writer.d.ts +5 -0
  16. package/dist/src/base_node_private.js +5 -0
  17. package/dist/src/base_node_private.js.map +1 -1
  18. package/dist/src/index_current.d.ts +2 -1
  19. package/dist/src/index_current.js +3 -2
  20. package/dist/src/index_current.js.map +1 -1
  21. package/dist/src/namespace_impl.d.ts +2 -0
  22. package/dist/src/namespace_impl.js +11 -1
  23. package/dist/src/namespace_impl.js.map +1 -1
  24. package/dist/src/namespace_private.d.ts +1 -0
  25. package/dist/src/namespace_private.js.map +1 -1
  26. package/dist/src/nodeid_manager.d.ts +1 -0
  27. package/dist/src/nodeid_manager.js +14 -2
  28. package/dist/src/nodeid_manager.js.map +1 -1
  29. package/dist/src/nodeset_tools/dump_to_bsd.d.ts +2 -0
  30. package/dist/src/nodeset_tools/dump_to_bsd.js +164 -0
  31. package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -0
  32. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +9 -1
  33. package/dist/src/nodeset_tools/nodeset_to_xml.js +182 -87
  34. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  35. package/dist/src/tool_isSupertypeOf.js +12 -2
  36. package/dist/src/tool_isSupertypeOf.js.map +1 -1
  37. package/dist/src/ua_data_type_impl.js +10 -5
  38. package/dist/src/ua_data_type_impl.js.map +1 -1
  39. package/dist/src/ua_object_impl.js +8 -1
  40. package/dist/src/ua_object_impl.js.map +1 -1
  41. package/dist/src/ua_variable_impl.js +4 -0
  42. package/dist/src/ua_variable_impl.js.map +1 -1
  43. package/dist/src/ua_variable_impl_ext_obj.js +1 -1
  44. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  45. package/distHelpers/get_mini_address_space.js +1 -1
  46. package/distHelpers/get_mini_address_space.js.map +1 -1
  47. package/distNodeJS/generate_address_space.d.ts +3 -1
  48. package/distNodeJS/generate_address_space.js +13 -2
  49. package/distNodeJS/generate_address_space.js.map +1 -1
  50. package/package.json +22 -22
  51. package/source/continuation_points/continuation_point_manager.ts +13 -12
  52. package/source/index.ts +1 -0
  53. package/source/loader/ensure_datatype_extracted.ts +38 -3
  54. package/source/loader/generateAddressSpaceRaw.ts +4 -3
  55. package/source/loader/load_nodeset2.ts +86 -33
  56. package/source/xml_writer.ts +3 -0
  57. package/source_nodejs/generate_address_space.ts +27 -5
  58. package/src/base_node_private.ts +6 -0
  59. package/src/index_current.ts +3 -1
  60. package/src/namespace_impl.ts +24 -1
  61. package/src/namespace_private.ts +2 -0
  62. package/src/nodeid_manager.ts +14 -5
  63. package/src/nodeset_tools/{typedictionary_to_xml.ts → dump_to_bsd.ts} +24 -14
  64. package/src/nodeset_tools/nodeset_to_xml.ts +231 -74
  65. package/src/tool_isSupertypeOf.ts +14 -2
  66. package/src/ua_data_type_impl.ts +11 -7
  67. package/src/ua_object_impl.ts +12 -2
  68. package/src/ua_variable_impl.ts +6 -0
  69. package/src/ua_variable_impl_ext_obj.ts +1 -1
  70. package/test_helpers/get_mini_address_space.ts +1 -1
  71. package/test_helpers/test_fixtures/mini.Node.Set2.xml +29 -0
  72. package/test_helpers/test_fixtures/nodeset_no_aliases.xml +30 -0
  73. package/test_helpers/test_fixtures/nodeset_no_aliases_with_aliases.xml +31 -0
@@ -1,6 +1,65 @@
1
1
  import { ReferenceDescription } from "node-opcua-types";
2
2
  import { IContinuationPointManager, IContinuationPointInfo, ContinuationData } from "node-opcua-address-space-base";
3
3
  import { DataValue } from "node-opcua-data-value";
4
+ /**
5
+ * from https://reference.opcfoundation.org/v104/Core/docs/Part4/7.6/
6
+ *
7
+ * A ContinuationPoint is used to pause a Browse, QueryFirst or HistoryRead operation and allow it to be restarted later by calling BrowseNext,
8
+ * QueryNext or HistoryRead.
9
+ * - Operations are paused when the number of results found exceeds the limits set by either the Client or the Server.
10
+ * - The Client specifies the maximum number of results per operation in the request message.
11
+ * - A Server shall not return more than this number of results but it may return fewer results.
12
+ * - The Server allocates a ContinuationPoint if there are more results to return.
13
+ * - Servers shall support at least one ContinuationPoint per Session.
14
+ * - Servers specify a maximum number of ContinuationPoints per Session in the ServerCapabilities Object defined in OPC 10000-5.
15
+ * - ContinuationPoints remain active until
16
+ * a/ the Client retrieves the remaining results,
17
+ * b/ or, the Client releases the ContinuationPoint
18
+ * c/ or the Session is closed.
19
+ * - A Server shall automatically free ContinuationPoints from prior requests from a Session if they are needed to process a new request
20
+ * from this Session.
21
+ * - The Server returns a Bad_ContinuationPointInvalid error if a Client tries to use a ContinuationPoint that has been released.
22
+ * - A Client can avoid this situation by completing paused operations before starting new operations.
23
+ * For Session-less Service invocations, the ContinuationPoints are shared across all Session-less Service invocations from all Clients.
24
+ * The Server shall support at least the maximum number of ContinuationPoints it would allow for one Session.
25
+ *
26
+ * - Requests will often specify multiple operations that may or may not require a ContinuationPoint.
27
+ * - A Server shall process the operations until it uses the maximum number of continuation points in this response.
28
+ * Once that happens the Server shall return a Bad_NoContinuationPoints error for any remaining operations. A Client can avoid
29
+ * this situation by sending requests with a number of operations that do not exceed the maximum number of ContinuationPoints
30
+ * per Session defined for the Service in the ServerCapabilities Object defined in OPC 10000-5.
31
+ * A Client restarts an operation by passing the ContinuationPoint back to the Server. Server should always be able to reuse the ContinuationPoint
32
+ * provided so Servers shall never return Bad_NoContinuationPoints error when continuing a previously halted operation.
33
+ * A ContinuationPoint is a subtype of the ByteString data type.
34
+ *
35
+ *
36
+ * for historical access: https://reference.opcfoundation.org/v104/Core/docs/Part11/6.3/
37
+ *
38
+ * The continuationPoint parameter in the HistoryRead Service is used to mark a point from which to continue
39
+ * the read if not all values could be returned in one response. The value is opaque for the Client and is
40
+ * only used to maintain the state information for the Server to continue from. *
41
+ *
42
+ * For HistoricalDataNode requests, a Server may use the timestamp of the last returned data item if the timestamp
43
+ * is unique. This can reduce the need in the Server to store state information for the continuation point.
44
+ * The Client specifies the maximum number of results per operation in the request Message. A Server shall
45
+ * not return more than this number of results but it may return fewer results. The Server allocates a
46
+ * ContinuationPoint if there are more results to return. The Server may return fewer results due to buffer issues
47
+ * or other internal constraints. It may also be required to return a continuationPoint due to HistoryRead
48
+ * parameter constraints. If a request is taking a long time to calculate and is approaching the timeout time, the
49
+ * Server may return partial results with a continuation point. This may be done if the calculation is going to
50
+ * take more time than the Client timeout. In some cases it may take longer than the Client timeout to calculate
51
+ * even one result. Then the Server may return zero results with a continuation point that allows the Server to
52
+ * resume the calculation on the next Client read call. For additional discussions regarding ContinuationPoints
53
+ * and HistoryRead please see the individual extensible HistoryReadDetails parameter in 6.4.
54
+ * If the Client specifies a ContinuationPoint, then the HistoryReadDetails parameter and the TimestampsToReturn
55
+ * parameter are ignored, because it does not make sense to request different parameters when continuing from a
56
+ * previous call. It is permissible to change the dataEncoding parameter with each request.
57
+ * If the Client specifies a ContinuationPoint that is no longer valid, then the Server shall return a
58
+ * Bad_ContinuationPointInvalid error.
59
+ * If the releaseContinuationPoints parameter is set in the request the Server shall not return any data and shall
60
+ * release all ContinuationPoints passed in the request. If the ContinuationPoint for an operation is missing or
61
+ * invalid then the StatusCode for the operation shall be Bad_ContinuationPointInvalid.
62
+ */
4
63
  export declare class ContinuationPointManager implements IContinuationPointManager {
5
64
  private _map;
6
65
  constructor();
@@ -5,6 +5,12 @@ exports.ContinuationPointManager = void 0;
5
5
  * @module node-opcua-server
6
6
  */
7
7
  const node_opcua_status_code_1 = require("node-opcua-status-code");
8
+ let counter = 0;
9
+ function make_key() {
10
+ // return crypto.randomBytes(32);
11
+ counter += 1;
12
+ return Buffer.from(counter.toString(), "utf-8");
13
+ }
8
14
  /**
9
15
  * from https://reference.opcfoundation.org/v104/Core/docs/Part4/7.6/
10
16
  *
@@ -64,12 +70,6 @@ const node_opcua_status_code_1 = require("node-opcua-status-code");
64
70
  * release all ContinuationPoints passed in the request. If the ContinuationPoint for an operation is missing or
65
71
  * invalid then the StatusCode for the operation shall be Bad_ContinuationPointInvalid.
66
72
  */
67
- let counter = 0;
68
- function make_key() {
69
- // return crypto.randomBytes(32);
70
- counter += 1;
71
- return Buffer.from(counter.toString(), "utf-8");
72
- }
73
73
  class ContinuationPointManager {
74
74
  constructor() {
75
75
  this._map = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"continuation_point_manager.js","sourceRoot":"","sources":["../../../source/continuation_points/continuation_point_manager.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAAqD;AAUrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,SAAS,QAAQ;IACb,iCAAiC;IACjC,OAAO,IAAI,CAAC,CAAC;IACb,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAMD,MAAa,wBAAwB;IAGjC;QACI,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,oBAA4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OAAO,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,EAAE;YACP,OAAO;gBACH,iBAAiB,EAAE,SAAS;gBAC5B,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE,oCAAW,CAAC,2BAA2B;aACtD,CAAC;SACL;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,WAAW,CAAQ,CAAC;QAE3E,IAAI,iBAAiB,GAAkC,gBAAgB,CAAC,iBAAiB,CAAC;QAC1F,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,yBAAyB,EAAE;YACxE,uCAAuC;YACvC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC1B,iBAAiB,GAAG,SAAS,CAAC;SACjC;QACD,OAAO;YACH,iBAAiB;YACjB,MAAM;YACN,UAAU,EAAE,oCAAW,CAAC,IAAI;SAC/B,CAAC;IACN,CAAC;CACJ;AAxJD,4DAwJC"}
1
+ {"version":3,"file":"continuation_point_manager.js","sourceRoot":"","sources":["../../../source/continuation_points/continuation_point_manager.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAAqD;AAWrD,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,SAAS,QAAQ;IACb,iCAAiC;IACjC,OAAO,IAAI,CAAC,CAAC;IACb,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAa,wBAAwB;IAGjC;QACI,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IAC1B,CAAC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BAAgB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,EAAE;YACP,OAAO;gBACH,iBAAiB,EAAE,SAAS;gBAC5B,MAAM,EAAE,IAAI;gBACZ,UAAU,EAAE,oCAAW,CAAC,2BAA2B;aACtD,CAAC;SACL;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,WAAW,CAAQ,CAAC;QAE3E,IAAI,iBAAiB,GAAkC,gBAAgB,CAAC,iBAAiB,CAAC;QAC1F,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,yBAAyB,EAAE;YACxE,uCAAuC;YACvC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC1B,iBAAiB,GAAG,SAAS,CAAC;SACjC;QACD,OAAO;YACH,iBAAiB;YACjB,MAAM;YACN,UAAU,EAAE,oCAAW,CAAC,IAAI;SAC/B,CAAC;IACN,CAAC;CACJ;AAxJD,4DAwJC"}
@@ -54,3 +54,4 @@ export * from "../src/event_data";
54
54
  export * from "./set_namespace_meta_data";
55
55
  export * from "node-opcua-address-space-base";
56
56
  export * from "node-opcua-nodeset-ua";
57
+ export * from "../src/nodeset_tools/construct_namespace_dependency";
@@ -81,4 +81,5 @@ __exportStar(require("../src/event_data"), exports);
81
81
  __exportStar(require("./set_namespace_meta_data"), exports);
82
82
  __exportStar(require("node-opcua-address-space-base"), exports);
83
83
  __exportStar(require("node-opcua-nodeset-ua"), exports);
84
+ __exportStar(require("../src/nodeset_tools/construct_namespace_dependency"), exports);
84
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAAmC;AAEnC,mFAAiE;AACjE,sGAAoF;AACpF,0FAAwE;AACxE,2FAAyE;AACzE,yFAAuE;AAEvE,8EAA4D;AAE5D,uFAAqE;AAErE,qFAAmE;AACnE,2FAAyE;AACzE,oFAAkE;AAClE,8EAA4D;AAG5D,sFAAoE;AACpE,wFAAsE;AACtE,yGAAuF;AACvF,mGAAiF;AACjF,+GAA6F;AAC7F,qGAAmF;AACnF,0GAAwF;AACxF,qGAAmF;AACnF,2FAAyE;AACzE,wGAAsF;AACtF,qFAAmE;AACnE,0FAAwE;AACxE,qGAAmF;AACnF,iGAA+E;AAC/E,uFAAqE;AACrE,yGAAuF;AACvF,qGAAmF;AAEnF,8FAA6F;AAApF,0IAAA,2BAA2B,OAAA;AACpC,0GAAwG;AAA/F,qJAAA,gCAAgC,OAAA;AACzC,4FAA0F;AAAjF,uIAAA,yBAAyB,OAAA;AAGlC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AAEjC,uDAAqC;AACrC,+DAA6C;AAC7C,0DAAwC;AACxC,yDAAuC;AACvC,iEAA+C;AAC/C,6EAA0E;AAAjE,gIAAA,qBAAqB,OAAA;AAC9B,6FAAwF;AAA/E,8IAAA,2BAA2B,OAAA;AAEpC,+FAA4F;AAAnF,sIAAA,wBAAwB,OAAA;AACjC,gFAAkH;AAAzG,oIAAA,uBAAuB,OAAA;AAAE,gJAAA,mCAAmC,OAAA;AAErE,mEAAiD;AACjD,8CAA4B;AAC5B,0DAAwC;AAExC,0HAA0H;AAAjH,6JAAA,qCAAqC,OAAA;AAE9C,wDAA8E;AAArE,+GAAA,aAAa,OAAA;AACtB,oDAAkC;AAClC,4DAA0C;AAE1C,gEAA8C;AAC9C,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,qDAAmC;AAEnC,mFAAiE;AACjE,sGAAoF;AACpF,0FAAwE;AACxE,2FAAyE;AACzE,yFAAuE;AAEvE,8EAA4D;AAE5D,uFAAqE;AAErE,qFAAmE;AACnE,2FAAyE;AACzE,oFAAkE;AAClE,8EAA4D;AAG5D,sFAAoE;AACpE,wFAAsE;AACtE,yGAAuF;AACvF,mGAAiF;AACjF,+GAA6F;AAC7F,qGAAmF;AACnF,0GAAwF;AACxF,qGAAmF;AACnF,2FAAyE;AACzE,wGAAsF;AACtF,qFAAmE;AACnE,0FAAwE;AACxE,qGAAmF;AACnF,iGAA+E;AAC/E,uFAAqE;AACrE,yGAAuF;AACvF,qGAAmF;AAEnF,8FAA6F;AAApF,0IAAA,2BAA2B,OAAA;AACpC,0GAAwG;AAA/F,qJAAA,gCAAgC,OAAA;AACzC,4FAA0F;AAAjF,uIAAA,yBAAyB,OAAA;AAGlC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AAEjC,uDAAqC;AACrC,+DAA6C;AAC7C,0DAAwC;AACxC,yDAAuC;AACvC,iEAA+C;AAC/C,6EAA0E;AAAjE,gIAAA,qBAAqB,OAAA;AAC9B,6FAAwF;AAA/E,8IAAA,2BAA2B,OAAA;AAEpC,+FAA4F;AAAnF,sIAAA,wBAAwB,OAAA;AACjC,gFAAkH;AAAzG,oIAAA,uBAAuB,OAAA;AAAE,gJAAA,mCAAmC,OAAA;AAErE,mEAAiD;AACjD,8CAA4B;AAC5B,0DAAwC;AAExC,0HAA0H;AAAjH,6JAAA,qCAAqC,OAAA;AAE9C,wDAA8E;AAArE,+GAAA,aAAa,OAAA;AACtB,oDAAkC;AAClC,4DAA0C;AAE1C,gEAA8C;AAC9C,wDAAsC;AACtC,sFAAoE"}
@@ -15,6 +15,29 @@ const node_opcua_debug_1 = require("node-opcua-debug");
15
15
  const node_opcua_factory_1 = require("node-opcua-factory");
16
16
  const pseudo_session_1 = require("../pseudo_session");
17
17
  const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
18
+ function fixDefinition103(addressSpace, namespaceArray, dataTypeManager) {
19
+ // fix datatype _getDefinition();
20
+ for (let namespaceIndex = 1; namespaceIndex < namespaceArray.length; namespaceIndex++) {
21
+ const df = dataTypeManager.getDataTypeFactory(namespaceIndex);
22
+ for (const s of df.getStructureIterator()) {
23
+ const dataType = addressSpace.findDataType(s.schema.dataTypeNodeId);
24
+ if (!s.constructor) {
25
+ continue;
26
+ }
27
+ if (!dataType) {
28
+ continue;
29
+ }
30
+ if (dataType.$partialDefinition && dataType.$partialDefinition.length) {
31
+ continue;
32
+ }
33
+ // debugLog(" Explorartion", dataType.browseName.toString());
34
+ if (!dataType.$partialDefinition || (dataType.$partialDefinition.length === 0 && s.schema.fields.length > 0)) {
35
+ const sd = (0, node_opcua_client_dynamic_extension_object_1.convertStructureTypeSchemaToStructureDefinition)(s.schema);
36
+ dataType.$partialDefinition = sd.fields || undefined;
37
+ }
38
+ }
39
+ }
40
+ }
18
41
  function ensureDatatypeExtracted(addressSpace) {
19
42
  return __awaiter(this, void 0, void 0, function* () {
20
43
  const addressSpacePriv = addressSpace;
@@ -32,6 +55,8 @@ function ensureDatatypeExtracted(addressSpace) {
32
55
  // now extract structure and enumeration from old form if
33
56
  const session = new pseudo_session_1.PseudoSession(addressSpace);
34
57
  yield (0, node_opcua_client_dynamic_extension_object_1.populateDataTypeManager)(session, dataTypeManager, true);
58
+ // turn old <=103 structure to have valid DataTypeDefinition
59
+ fixDefinition103(addressSpace, namespaceArray, dataTypeManager);
35
60
  }
36
61
  return addressSpacePriv.$$extraDataTypeManager;
37
62
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ensure_datatype_extracted.js","sourceRoot":"","sources":["../../../source/loader/ensure_datatype_extracted.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2GAA2G;AAC3G,uDAAiD;AACjD,2DAAiF;AAGjF,sDAAkD;AAGlD,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAE3C,SAAsB,uBAAuB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AC;SAC9D,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAJD,kFAIC"}
@@ -1,10 +1,11 @@
1
1
  import { CallbackT } from "node-opcua-status-code";
2
2
  import { IAddressSpace } from "node-opcua-address-space-base";
3
+ import { NodeSetLoaderOptions } from "./load_nodeset2";
3
4
  /**
4
5
  * @param addressSpace the addressSpace to populate
5
6
  * @xmlFiles: a lis of xml files
6
7
  * @param xmlLoader - a helper function to return the content of the xml file
7
8
  */
8
- export declare function generateAddressSpaceRaw(addressSpace: IAddressSpace, xmlFiles: string | string[], xmlLoader: (nodeset2xmlUri: string) => Promise<string>): Promise<void>;
9
+ export declare function generateAddressSpaceRaw(addressSpace: IAddressSpace, xmlFiles: string | string[], xmlLoader: (nodeset2xmlUri: string) => Promise<string>, options: NodeSetLoaderOptions): Promise<void>;
9
10
  export declare type XmlLoaderFunc = (nodeset2xmlUri: string, callback: CallbackT<string>) => void;
10
11
  export declare type XmlLoaderAsyncFunc = (nodeset2xmlUri: string) => Promise<string>;
@@ -21,9 +21,9 @@ const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
21
21
  * @xmlFiles: a lis of xml files
22
22
  * @param xmlLoader - a helper function to return the content of the xml file
23
23
  */
24
- function generateAddressSpaceRaw(addressSpace, xmlFiles, xmlLoader) {
24
+ function generateAddressSpaceRaw(addressSpace, xmlFiles, xmlLoader, options) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
- const nodesetLoader = new load_nodeset2_1.NodeSetLoader(addressSpace);
26
+ const nodesetLoader = new load_nodeset2_1.NodeSetLoader(addressSpace, options);
27
27
  if (!Array.isArray(xmlFiles)) {
28
28
  xmlFiles = [xmlFiles];
29
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generateAddressSpaceRaw.js","sourceRoot":"","sources":["../../../source/loader/generateAddressSpaceRaw.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,u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C,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAE3C;;;;GAIG;AACH,SAAsB,uBAAuB,CACzC,YAA2B,EAC3B,QAA2B,EAC3B,SAAsD,EACtD,OAA6B;;QAE7B,MAAM,aAAa,GAAG,IAAI,6BAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAE/D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC1B,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC;SACzB;QACD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAClD,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACjD,IAAI;gBACA,MAAM,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;aAChD;YAAC,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,0CAA0C,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,qBAAqB,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;gBACrH,MAAM,GAAG,CAAC;aACb;SACJ;QACD,MAAM,aAAa,CAAC,cAAc,EAAE,CAAC;QACrC,IAAA,6CAAoB,EAAC,YAAY,CAAC,CAAC;QACnC,iCAAiC;IACrC,CAAC;CAAA;AAvBD,0DAuBC"}
@@ -5,10 +5,14 @@ export interface NodeSet2ParserEngine {
5
5
  addNodeSet: (xmlData: string, callback1: SimpleCallback) => void;
6
6
  terminate: (callback: SimpleCallback) => void;
7
7
  }
8
- export declare function makeNodeSetParserEngine(addressSpace: IAddressSpace): NodeSet2ParserEngine;
8
+ export interface NodeSetLoaderOptions {
9
+ loadDraftNodes?: boolean;
10
+ loadDeprecatedNodes?: boolean;
11
+ }
9
12
  export declare class NodeSetLoader {
10
- _s: any;
11
- constructor(addressSpace: IAddressSpace);
13
+ private options?;
14
+ _s: NodeSet2ParserEngine;
15
+ constructor(addressSpace: IAddressSpace, options?: NodeSetLoaderOptions | undefined);
12
16
  addNodeSet(xmlData: string, callback: ErrorCallback): void;
13
17
  addNodeSetAsync(xmlData: string): Promise<void>;
14
18
  terminate(callback: ErrorCallback): void;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.NodeSetLoader = exports.makeNodeSetParserEngine = void 0;
12
+ exports.NodeSetLoader = void 0;
13
13
  /* eslint-disable max-statements */
14
14
  /**
15
15
  * @module node-opcua-address-space
@@ -107,10 +107,13 @@ function makeDefaultVariant(addressSpace, dataTypeNode, valueRank) {
107
107
  }
108
108
  return variant;
109
109
  }
110
- function makeNodeSetParserEngine(addressSpace) {
110
+ function makeNodeSetParserEngine(addressSpace, options) {
111
111
  const addressSpace1 = addressSpace;
112
112
  addressSpace1.suspendBackReference = true;
113
+ options.loadDeprecatedNodes = options.loadDeprecatedNodes === undefined ? true : options.loadDeprecatedNodes;
114
+ options.loadDraftNodes = options.loadDraftNodes || false;
113
115
  const postTasks = [];
116
+ const postTasks0_InitializeVariable = [];
114
117
  const postTasks0_DecodePojoString = [];
115
118
  const postTasks1_InitializeVariable = [];
116
119
  const postTasks2_AssignedExtensionObjectToDataValue = [];
@@ -129,6 +132,7 @@ function makeNodeSetParserEngine(addressSpace) {
129
132
  let namespaceCounter = 0;
130
133
  let found_namespace_in_uri = {};
131
134
  let models = [];
135
+ let performedCalled = false;
132
136
  function _reset_namespace_translation() {
133
137
  debugLog("_reset_namespace_translation");
134
138
  namespace_uri_translation = {};
@@ -136,14 +140,15 @@ function makeNodeSetParserEngine(addressSpace) {
136
140
  namespaceCounter = 0;
137
141
  alias_map = {};
138
142
  models = [];
143
+ performedCalled = false;
139
144
  }
140
145
  function _translateNamespaceIndex(innerIndex) {
141
146
  const namespaceIndex = namespace_uri_translation[innerIndex];
142
147
  // istanbul ignore next
143
148
  if (namespaceIndex === undefined) {
144
- // tslint:disable-next-line: no-console
145
149
  debugLog("Warning: namespace_uri_translation = ", namespace_uri_translation);
146
- throw new Error("_translateNamespaceIndex! Cannot find namespace definition for index " + innerIndex);
150
+ errorLog("namespace_uri_translation", namespace_uri_translation);
151
+ throw new Error("_translateNamespaceIndex() ! Cannot find namespace definition for index " + innerIndex);
147
152
  }
148
153
  return namespaceIndex;
149
154
  }
@@ -165,7 +170,7 @@ function makeNodeSetParserEngine(addressSpace) {
165
170
  }
166
171
  function _register_namespace_uri_in_translation_table(namespaceUri) {
167
172
  if (found_namespace_in_uri[namespaceUri]) {
168
- return found_namespace_in_uri[namespaceUri];
173
+ return;
169
174
  }
170
175
  const namespace = addressSpace1.getNamespace(namespaceUri);
171
176
  if (!namespace) {
@@ -179,7 +184,6 @@ function makeNodeSetParserEngine(addressSpace) {
179
184
  namespace_uri_translation[index_in_xml] = namespace.index;
180
185
  doDebug &&
181
186
  debugLog(" _register_namespace_uri = ", namespaceUri, "index in Xml=", index_in_xml, " index in addressSpace", namespace.index);
182
- return namespace;
183
187
  }
184
188
  function _add_namespace(model) {
185
189
  if (model.requiredModels.length > 0) {
@@ -295,6 +299,7 @@ function makeNodeSetParserEngine(addressSpace) {
295
299
  };
296
300
  const state_UAObject = {
297
301
  init(name, attrs) {
302
+ _perform();
298
303
  this.obj = {};
299
304
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.Object;
300
305
  this.obj.isAbstract = ec.coerceBoolean(attrs.IsAbstract);
@@ -303,12 +308,10 @@ function makeNodeSetParserEngine(addressSpace) {
303
308
  this.obj.eventNotifier = ec.coerceByte(attrs.EventNotifier) || 0;
304
309
  this.obj.symbolicName = attrs.SymbolicName || null;
305
310
  this.isDraft = attrs.ReleaseStatus === "Draft";
306
- this.obj.isDeprecated = attrs.ReleaseStatus === "Deprecated";
311
+ this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
307
312
  },
308
313
  finish() {
309
- if (this.isDraft || this.isDeprecated) {
310
- // ignore Draft or Deprecated element
311
- debugLog("Ignoring Draft/Deprecated UAObject =", this.obj.browseName.toString());
314
+ if (canIngore({ isDraft: this.isDraft, isDeprecated: this.isDeprecated }, this.obj)) {
312
315
  return;
313
316
  }
314
317
  _internal_createNode(this.obj);
@@ -329,6 +332,7 @@ function makeNodeSetParserEngine(addressSpace) {
329
332
  };
330
333
  const state_UAObjectType = {
331
334
  init(name, attrs) {
335
+ _perform();
332
336
  this.obj = {};
333
337
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.ObjectType;
334
338
  this.obj.isAbstract = ec.coerceBoolean(attrs.IsAbstract);
@@ -355,6 +359,7 @@ function makeNodeSetParserEngine(addressSpace) {
355
359
  };
356
360
  const state_UAReferenceType = {
357
361
  init(name, attrs) {
362
+ _perform();
358
363
  this.obj = {};
359
364
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.ReferenceType;
360
365
  this.obj.isAbstract = ec.coerceBoolean(attrs.IsAbstract);
@@ -386,6 +391,7 @@ function makeNodeSetParserEngine(addressSpace) {
386
391
  const pendingSimpleTypeToRegister = [];
387
392
  const state_UADataType = {
388
393
  init(name, attrs) {
394
+ _perform();
389
395
  this.obj = {};
390
396
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.DataType;
391
397
  this.obj.isAbstract = ec.coerceBoolean(attrs.IsAbstract) || false;
@@ -399,9 +405,7 @@ function makeNodeSetParserEngine(addressSpace) {
399
405
  this.definitionFields = [];
400
406
  },
401
407
  finish() {
402
- if (this.isDraft || this.isDeprecated) {
403
- // ignore Draft or Deprecated element
404
- debugLog("Ignoring Draft/Deprecated dataType =", this.obj.browseName.toString());
408
+ if (canIngore({ isDraft: this.isDraft, isDeprecated: this.isDeprecated }, this.obj)) {
405
409
  return;
406
410
  }
407
411
  /*
@@ -720,6 +724,14 @@ function makeNodeSetParserEngine(addressSpace) {
720
724
  (0, node_opcua_assert_1.assert)(self.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject);
721
725
  break;
722
726
  default: {
727
+ // istanbul ignore next
728
+ if (!this._cloneFragment) {
729
+ // the XML file is probably not exposing standard UA extension object correctly.
730
+ // this has been seen in some generated xml files using the dataType nodeId instead of the default encoding
731
+ // nodeid
732
+ errorLog("[NODE-OPCUA-E12] standard OPCUA Extension object from (namespace=0) has a invalid TypeId", self.typeDefinitionId.toString());
733
+ break;
734
+ }
723
735
  this.bodyXML = this._cloneFragment.value;
724
736
  this._cloneFragment.value = null;
725
737
  // the "Default Xml" encoding nodeId
@@ -1087,8 +1099,20 @@ function makeNodeSetParserEngine(addressSpace) {
1087
1099
  });
1088
1100
  postTasks2_AssignedExtensionObjectToDataValue.push(task);
1089
1101
  }
1102
+ const canIngore = ({ isDraft, isDeprecated }, node) => {
1103
+ if (isDraft && !options.loadDraftNodes) {
1104
+ debugLog("Ignoring Draft =", node_opcua_data_model_1.NodeClass[node.nodeClass], node.browseName.toString());
1105
+ return true;
1106
+ }
1107
+ if (isDeprecated && !options.loadDeprecatedNodes) {
1108
+ debugLog("Ignoring Deprecate =", node_opcua_data_model_1.NodeClass[node.nodeClass], node.browseName.toString());
1109
+ return true;
1110
+ }
1111
+ return false;
1112
+ };
1090
1113
  const state_UAVariable = {
1091
1114
  init(name, attrs) {
1115
+ _perform();
1092
1116
  this.obj = {};
1093
1117
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.Variable;
1094
1118
  this.obj.browseName = convertQualifiedName(attrs.BrowseName);
@@ -1106,8 +1130,7 @@ function makeNodeSetParserEngine(addressSpace) {
1106
1130
  this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
1107
1131
  },
1108
1132
  finish() {
1109
- if (this.isDraft || this.isDeprecated) {
1110
- debugLog("Ignoring Draft/Deprecated UAVariable =", this.obj.browseName.toString());
1133
+ if (canIngore({ isDraft: this.isDraft, isDeprecated: this.isDeprecated }, this.obj)) {
1111
1134
  return;
1112
1135
  }
1113
1136
  /*
@@ -1130,7 +1153,13 @@ function makeNodeSetParserEngine(addressSpace) {
1130
1153
  capturedValue = undefined;
1131
1154
  capturedVariable = undefined;
1132
1155
  });
1133
- postTasks1_InitializeVariable.push(task);
1156
+ if (capturedValue.dataType !== node_opcua_variant_1.DataType.ExtensionObject) {
1157
+ postTasks0_InitializeVariable.push(task);
1158
+ }
1159
+ else {
1160
+ // do them later
1161
+ postTasks1_InitializeVariable.push(task);
1162
+ }
1134
1163
  }
1135
1164
  else {
1136
1165
  const task = (addressSpace2) => __awaiter(this, void 0, void 0, function* () {
@@ -1150,7 +1179,7 @@ function makeNodeSetParserEngine(addressSpace) {
1150
1179
  }
1151
1180
  capturedVariable = undefined;
1152
1181
  });
1153
- postTasks1_InitializeVariable.push(task);
1182
+ postTasks0_InitializeVariable.push(task);
1154
1183
  }
1155
1184
  this.obj.value = undefined;
1156
1185
  capturedVariable = _internal_createNode(this.obj);
@@ -1172,6 +1201,7 @@ function makeNodeSetParserEngine(addressSpace) {
1172
1201
  };
1173
1202
  const state_UAVariableType = {
1174
1203
  init(name, attrs) {
1204
+ _perform();
1175
1205
  this.obj = {};
1176
1206
  this.obj.isAbstract = ec.coerceBoolean(attrs.IsAbstract);
1177
1207
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.VariableType;
@@ -1187,8 +1217,7 @@ function makeNodeSetParserEngine(addressSpace) {
1187
1217
  this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
1188
1218
  },
1189
1219
  finish() {
1190
- if (this.isDraft || this.isDeprecated) {
1191
- debugLog("Ignoring Draft/Deprecated UAVariableType =", this.obj.browseName.toString());
1220
+ if (canIngore({ isDraft: this.isDraft, isDeprecated: this.isDeprecated }, this.obj)) {
1192
1221
  return;
1193
1222
  }
1194
1223
  try {
@@ -1218,6 +1247,7 @@ function makeNodeSetParserEngine(addressSpace) {
1218
1247
  };
1219
1248
  const state_UAMethod = {
1220
1249
  init(name, attrs) {
1250
+ _perform();
1221
1251
  this.obj = {};
1222
1252
  this.obj.nodeClass = node_opcua_data_model_1.NodeClass.Method;
1223
1253
  // MethodDeclarationId
@@ -1230,8 +1260,7 @@ function makeNodeSetParserEngine(addressSpace) {
1230
1260
  this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
1231
1261
  },
1232
1262
  finish() {
1233
- if (this.isDraft || this.isDeprecated) {
1234
- debugLog("Ignoring Draft/Deprecated UAMethod =", this.obj.browseName.toString());
1263
+ if (canIngore({ isDraft: this.isDraft, isDeprecated: this.isDeprecated }, this.obj)) {
1235
1264
  return;
1236
1265
  }
1237
1266
  _internal_createNode(this.obj);
@@ -1282,7 +1311,16 @@ function makeNodeSetParserEngine(addressSpace) {
1282
1311
  models.push(model);
1283
1312
  }
1284
1313
  });
1314
+ function _updateTranslationTable() {
1315
+ _register_namespace_uri_in_translation_table("http://opcfoundation.org/UA/");
1316
+ for (const namespaceUri of _namespaceUris) {
1317
+ _register_namespace_uri_in_translation_table(namespaceUri);
1318
+ }
1319
+ }
1285
1320
  function _perform() {
1321
+ if (performedCalled)
1322
+ return;
1323
+ performedCalled = true;
1286
1324
  /**special case for old nodeset file version 1.02 where no models exists */
1287
1325
  if (models.length === 0) {
1288
1326
  for (const namespaceuri of _namespaceUris) {
@@ -1297,12 +1335,7 @@ function makeNodeSetParserEngine(addressSpace) {
1297
1335
  });
1298
1336
  }
1299
1337
  }
1300
- doDebug && debugLog("xxx models =", JSON.stringify(models, null, " "));
1301
- doDebug && debugLog("xxx _namespaceUris =", _namespaceUris);
1302
- _register_namespace_uri_in_translation_table("http://opcfoundation.org/UA/");
1303
- for (const namespaceUri of _namespaceUris) {
1304
- _register_namespace_uri_in_translation_table(namespaceUri);
1305
- }
1338
+ _updateTranslationTable();
1306
1339
  }
1307
1340
  // state_ModelTableEntry.parser["RequiredModel"] = state_ModelTableEntry;
1308
1341
  let _namespaceUris = [];
@@ -1394,6 +1427,8 @@ function makeNodeSetParserEngine(addressSpace) {
1394
1427
  // perform post task
1395
1428
  doDebug && debugLog(chalk.bgGreenBright("Performing post loading tasks -------------------------------------------"));
1396
1429
  yield performPostLoadingTasks(postTasks);
1430
+ doDebug && debugLog(chalk.bgGreenBright("Performing post loading task: Initializing Simple Variables ---------------------"));
1431
+ yield performPostLoadingTasks(postTasks0_InitializeVariable);
1397
1432
  doDebug && debugLog(chalk.bgGreenBright("Performing DataType extraction -------------------------------------------"));
1398
1433
  (0, node_opcua_assert_1.assert)(!addressSpace1.suspendBackReference);
1399
1434
  yield (0, ensure_datatype_extracted_1.ensureDatatypeExtracted)(addressSpace);
@@ -1409,7 +1444,7 @@ function makeNodeSetParserEngine(addressSpace) {
1409
1444
  pendingSimpleTypeToRegister.splice(0);
1410
1445
  doDebug && debugLog(chalk.bgGreenBright("Performing post loading task: Decoding Pojo String (parsing XML objects) -"));
1411
1446
  yield performPostLoadingTasks(postTasks0_DecodePojoString);
1412
- doDebug && debugLog(chalk.bgGreenBright("Performing post loading task: Initializing Variables ---------------------"));
1447
+ doDebug && debugLog(chalk.bgGreenBright("Performing post loading task: Initializing Complex Variables ---------------------"));
1413
1448
  yield performPostLoadingTasks(postTasks1_InitializeVariable);
1414
1449
  doDebug && debugLog(chalk.bgGreenBright("Performing post loading tasks: (assigning Extension Object to Variables) -"));
1415
1450
  yield performPostLoadingTasks(postTasks2_AssignedExtensionObjectToDataValue);
@@ -1433,10 +1468,10 @@ function makeNodeSetParserEngine(addressSpace) {
1433
1468
  terminate
1434
1469
  };
1435
1470
  }
1436
- exports.makeNodeSetParserEngine = makeNodeSetParserEngine;
1437
1471
  class NodeSetLoader {
1438
- constructor(addressSpace) {
1439
- this._s = makeNodeSetParserEngine(addressSpace);
1472
+ constructor(addressSpace, options) {
1473
+ this.options = options;
1474
+ this._s = makeNodeSetParserEngine(addressSpace, options || {});
1440
1475
  }
1441
1476
  addNodeSet(xmlData, callback) {
1442
1477
  if (!callback) {