node-opcua-address-space 2.181.0 → 2.182.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 (136) hide show
  1. package/api/helpers/ensure_secure_access.ts +53 -2
  2. package/api/index.ts +30 -1
  3. package/api/loader/generateAddressSpaceRaw.ts +44 -139
  4. package/api/loader/load_nodeset2.ts +5 -0
  5. package/api/loader/narrow_instance_datatypes.ts +264 -0
  6. package/api/loader/nodeset_builtin_formats.ts +143 -0
  7. package/api/loader/nodeset_format.ts +153 -0
  8. package/api/loader/nodeset_image.ts +37 -4
  9. package/api/loader/nodeset_image_codec.ts +153 -34
  10. package/api/loader/nodeset_record.ts +26 -2
  11. package/api/loader/nodeset_record_applier.ts +54 -3
  12. package/api/loader/nodeset_records_to_xml.ts +620 -0
  13. package/api/loader/nodeset_source.ts +185 -26
  14. package/api/loader/nodeset_to_image.ts +16 -5
  15. package/api/loader/nodeset_xml_header.ts +119 -0
  16. package/api/loader/nodeset_xml_primitives.ts +209 -0
  17. package/api/loader/nodeset_xml_producer.ts +61 -2
  18. package/api/loader/parsers/variant_parser.ts +9 -0
  19. package/bin/nodeset_equivalence.js +750 -0
  20. package/bin/nodeset_tool_common.js +72 -0
  21. package/bin/opcua-nodeset-image.js +93 -103
  22. package/bin/opcua-nodeset-live.js +139 -0
  23. package/dist/api/helpers/ensure_secure_access.d.ts +20 -0
  24. package/dist/api/helpers/ensure_secure_access.js +39 -0
  25. package/dist/api/helpers/ensure_secure_access.js.map +1 -1
  26. package/dist/api/index.d.ts +7 -2
  27. package/dist/api/index.js +21 -1
  28. package/dist/api/index.js.map +1 -1
  29. package/dist/api/loader/generateAddressSpaceRaw.d.ts +1 -7
  30. package/dist/api/loader/generateAddressSpaceRaw.js +32 -125
  31. package/dist/api/loader/generateAddressSpaceRaw.js.map +1 -1
  32. package/dist/api/loader/load_nodeset2.js +4 -0
  33. package/dist/api/loader/load_nodeset2.js.map +1 -1
  34. package/dist/api/loader/narrow_instance_datatypes.d.ts +30 -0
  35. package/dist/api/loader/narrow_instance_datatypes.js +217 -0
  36. package/dist/api/loader/narrow_instance_datatypes.js.map +1 -0
  37. package/dist/api/loader/nodeset_builtin_formats.d.ts +27 -0
  38. package/dist/api/loader/nodeset_builtin_formats.js +133 -0
  39. package/dist/api/loader/nodeset_builtin_formats.js.map +1 -0
  40. package/dist/api/loader/nodeset_format.d.ts +123 -0
  41. package/dist/api/loader/nodeset_format.js +63 -0
  42. package/dist/api/loader/nodeset_format.js.map +1 -0
  43. package/dist/api/loader/nodeset_image.d.ts +17 -1
  44. package/dist/api/loader/nodeset_image.js +32 -4
  45. package/dist/api/loader/nodeset_image.js.map +1 -1
  46. package/dist/api/loader/nodeset_image_codec.d.ts +4 -0
  47. package/dist/api/loader/nodeset_image_codec.js +142 -53
  48. package/dist/api/loader/nodeset_image_codec.js.map +1 -1
  49. package/dist/api/loader/nodeset_record.d.ts +26 -2
  50. package/dist/api/loader/nodeset_record.js +11 -2
  51. package/dist/api/loader/nodeset_record.js.map +1 -1
  52. package/dist/api/loader/nodeset_record_applier.js +52 -3
  53. package/dist/api/loader/nodeset_record_applier.js.map +1 -1
  54. package/dist/api/loader/nodeset_records_to_xml.d.ts +16 -0
  55. package/dist/api/loader/nodeset_records_to_xml.js +536 -0
  56. package/dist/api/loader/nodeset_records_to_xml.js.map +1 -0
  57. package/dist/api/loader/nodeset_source.d.ts +68 -7
  58. package/dist/api/loader/nodeset_source.js +157 -20
  59. package/dist/api/loader/nodeset_source.js.map +1 -1
  60. package/dist/api/loader/nodeset_to_image.d.ts +4 -4
  61. package/dist/api/loader/nodeset_to_image.js +14 -4
  62. package/dist/api/loader/nodeset_to_image.js.map +1 -1
  63. package/dist/api/loader/nodeset_xml_header.d.ts +22 -0
  64. package/dist/api/loader/nodeset_xml_header.js +113 -0
  65. package/dist/api/loader/nodeset_xml_header.js.map +1 -0
  66. package/dist/api/loader/nodeset_xml_primitives.d.ts +37 -0
  67. package/dist/api/loader/nodeset_xml_primitives.js +196 -0
  68. package/dist/api/loader/nodeset_xml_primitives.js.map +1 -0
  69. package/dist/api/loader/nodeset_xml_producer.js +56 -1
  70. package/dist/api/loader/nodeset_xml_producer.js.map +1 -1
  71. package/dist/api/loader/parsers/variant_parser.js +7 -0
  72. package/dist/api/loader/parsers/variant_parser.js.map +1 -1
  73. package/dist/impl/_instantiate_helpers.js +1 -0
  74. package/dist/impl/_instantiate_helpers.js.map +1 -1
  75. package/dist/impl/alarms_and_conditions/ua_alarm_condition_impl.js +4 -0
  76. package/dist/impl/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  77. package/dist/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +14 -0
  78. package/dist/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  79. package/dist/impl/base_node_impl.d.ts +9 -0
  80. package/dist/impl/base_node_impl.js +11 -0
  81. package/dist/impl/base_node_impl.js.map +1 -1
  82. package/dist/impl/base_node_private.js +67 -97
  83. package/dist/impl/base_node_private.js.map +1 -1
  84. package/dist/impl/nodeset_tools/construct_namespace_dependency.js +5 -1
  85. package/dist/impl/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  86. package/dist/impl/nodeset_tools/nodeset_to_records.js +61 -15
  87. package/dist/impl/nodeset_tools/nodeset_to_records.js.map +1 -1
  88. package/dist/impl/nodeset_tools/nodeset_to_xml.d.ts +1 -8
  89. package/dist/impl/nodeset_tools/nodeset_to_xml.js +174 -190
  90. package/dist/impl/nodeset_tools/nodeset_to_xml.js.map +1 -1
  91. package/dist/impl/ua_data_type_impl.d.ts +21 -0
  92. package/dist/impl/ua_data_type_impl.js +27 -2
  93. package/dist/impl/ua_data_type_impl.js.map +1 -1
  94. package/dist/impl/ua_object_type_impl.d.ts +9 -0
  95. package/dist/impl/ua_object_type_impl.js +12 -1
  96. package/dist/impl/ua_object_type_impl.js.map +1 -1
  97. package/dist/impl/ua_variable_impl.js +27 -10
  98. package/dist/impl/ua_variable_impl.js.map +1 -1
  99. package/dist/impl/ua_variable_impl_ext_obj.js +19 -2
  100. package/dist/impl/ua_variable_impl_ext_obj.js.map +1 -1
  101. package/dist/impl/ua_variable_type_impl.d.ts +8 -1
  102. package/dist/impl/ua_variable_type_impl.js +39 -2
  103. package/dist/impl/ua_variable_type_impl.js.map +1 -1
  104. package/dist/tsconfig_base.tsbuildinfo +1 -1
  105. package/distNodeJS/generate_address_space.js +4 -0
  106. package/distNodeJS/generate_address_space.js.map +1 -1
  107. package/impl/_instantiate_helpers.ts +3 -0
  108. package/impl/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +4 -4
  109. package/impl/alarms_and_conditions/ua_alarm_condition_impl.ts +19 -9
  110. package/impl/alarms_and_conditions/ua_base_event_impl.ts +9 -9
  111. package/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +17 -0
  112. package/impl/alarms_and_conditions/ua_condition_impl.ts +18 -18
  113. package/impl/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +2 -2
  114. package/impl/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +1 -1
  115. package/impl/alarms_and_conditions/ua_limit_alarm_impl.ts +16 -16
  116. package/impl/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +2 -2
  117. package/impl/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +4 -4
  118. package/impl/alarms_and_conditions/ua_off_normal_alarm_impl.ts +1 -1
  119. package/impl/base_node_impl.ts +15 -0
  120. package/impl/base_node_private.ts +97 -146
  121. package/impl/data_access/ua_multistate_discrete_impl.ts +1 -1
  122. package/impl/data_access/ua_multistate_value_discrete_impl.ts +2 -2
  123. package/impl/data_access/ua_two_state_discrete_impl.ts +2 -2
  124. package/impl/nodeset_tools/construct_namespace_dependency.ts +5 -1
  125. package/impl/nodeset_tools/nodeset_to_records.ts +66 -16
  126. package/impl/nodeset_tools/nodeset_to_xml.ts +127 -160
  127. package/impl/state_machine/finite_state_machine.ts +3 -3
  128. package/impl/state_machine/ua_shelving_state_machine_ex.ts +20 -20
  129. package/impl/ua_data_type_impl.ts +42 -4
  130. package/impl/ua_method_impl.ts +1 -1
  131. package/impl/ua_object_type_impl.ts +16 -3
  132. package/impl/ua_variable_impl.ts +27 -10
  133. package/impl/ua_variable_impl_ext_obj.ts +20 -2
  134. package/impl/ua_variable_type_impl.ts +49 -3
  135. package/package.json +29 -27
  136. package/source_nodejs/generate_address_space.ts +7 -1
@@ -283,8 +283,19 @@ export class UAVariableImpl<T extends UAVariableEvents & ListenerSignature<T> =
283
283
 
284
284
  this.historizing = !!options.historizing; // coerced to boolean"
285
285
 
286
- // a Variant built from null takes the constructor's short path; the options form costs twice as much
287
- this.$dataValue = new DataValue({ statusCode: StatusCodes.UncertainInitialValue, value: new Variant(null) });
286
+ // a Variant built from null takes the constructor's short path; the options form costs twice as much.
287
+ // Stamped with the clock of the construction: a variable nobody gives a value to (a nodeset
288
+ // Variable of an abstract data type has no default to make up) is read as it is, and the
289
+ // requested timestamps are expected on that Uncertain result too (FEAT-34)
290
+ const now = getCurrentClock();
291
+ this.$dataValue = new DataValue({
292
+ statusCode: StatusCodes.UncertainInitialValue,
293
+ value: new Variant(null),
294
+ sourceTimestamp: now.timestamp,
295
+ sourcePicoseconds: now.picoseconds,
296
+ serverTimestamp: now.timestamp,
297
+ serverPicoseconds: now.picoseconds
298
+ });
288
299
 
289
300
  if (options.value) {
290
301
  this.bindVariable(options.value);
@@ -405,23 +416,27 @@ export class UAVariableImpl<T extends UAVariableEvents & ListenerSignature<T> =
405
416
  context = SessionContext.defaultContext;
406
417
  }
407
418
 
419
+ // A Bad result the variable makes up here carries the requested timestamps: a
420
+ // DataValue may carry them whatever its status, and the CTT expects them on every
421
+ // result of a Read with TimestampsToReturn Source or Both (Attribute Read 037 for
422
+ // the encoding, Base Info Core Structure 2 001 for the arguments of a method the
423
+ // nodeset reserves to a role nobody holds, FEAT-34). The clock of the denial is
424
+ // the honest source timestamp: the value behind it stays undisclosed.
408
425
  if (context.isAccessRestricted(this)) {
409
- return new DataValue({ statusCode: StatusCodes.BadSecurityModeInsufficient });
426
+ return makeNowDataValue({ statusCode: StatusCodes.BadSecurityModeInsufficient });
410
427
  }
411
428
 
412
429
  if (!this.isReadable(context)) {
413
- return new DataValue({ statusCode: StatusCodes.BadNotReadable });
430
+ return makeNowDataValue({ statusCode: StatusCodes.BadNotReadable });
414
431
  }
415
432
  if (!this.checkPermissionPrivate(context, PermissionType.Read)) {
416
- return new DataValue({ statusCode: StatusCodes.BadUserAccessDenied });
433
+ return makeNowDataValue({ statusCode: StatusCodes.BadUserAccessDenied });
417
434
  }
418
435
  if (!this.isUserReadable(context)) {
419
- return new DataValue({ statusCode: StatusCodes.BadNotReadable });
436
+ return makeNowDataValue({ statusCode: StatusCodes.BadNotReadable });
420
437
  }
421
438
  if (!isValidDataEncoding(dataEncoding)) {
422
- // Table 51: no encoding can be applied to a non-Structure value. The CTT
423
- // (Attribute Read 037) still expects the requested timestamps on this Bad
424
- // result, and a DataValue may carry them whatever its status.
439
+ // Table 51: no encoding can be applied to a non-Structure value
425
440
  return makeNowDataValue({ statusCode: StatusCodes.BadDataEncodingInvalid });
426
441
  }
427
442
 
@@ -1307,8 +1322,10 @@ export class UAVariableImpl<T extends UAVariableEvents & ListenerSignature<T> =
1307
1322
 
1308
1323
  let func: (innerCallback: (err: Error | null, dataValue: DataValue) => void) => void;
1309
1324
 
1325
+ // stamped like the same gates of readValue(): the requested timestamps are expected
1326
+ // on a Bad result too (FEAT-34)
1310
1327
  const answerStatusOnly = (statusCode: StatusCode) => (innerCallback: (err: Error | null, dataValue: DataValue) => void) =>
1311
- innerCallback(null, new DataValue({ statusCode }));
1328
+ innerCallback(null, makeNowDataValue({ statusCode }));
1312
1329
 
1313
1330
  if (context.isAccessRestricted(this)) {
1314
1331
  // same gate as readValue(): a variable bound with a simple get()
@@ -484,6 +484,20 @@ function isVariableContainingExtensionObject(uaVariable: UAVariableImpl): boolea
484
484
  return true;
485
485
  }
486
486
 
487
+ /**
488
+ * the dimensions to iterate an extension object array over. "ArrayDimensions=0" and an absent
489
+ * ArrayDimensions both mean "one dimension, length unknown", so the length has to come from the
490
+ * array itself -- but that is a fact about this iteration, not a correction to the node: the
491
+ * ArrayDimensions attribute is what the nodeset declared and stays that way.
492
+ */
493
+ function effectiveArrayDimensions(declared: number[] | null | undefined, totalLength: number): number[] {
494
+ const dimensions = declared ?? [];
495
+ if (dimensions.length === 0 || dimensions.every((d) => d === 0)) {
496
+ return [totalLength];
497
+ }
498
+ return dimensions;
499
+ }
500
+
487
501
  function _innerBindExtensionObjectScalar(
488
502
  uaVariable: UAVariableImpl,
489
503
  {
@@ -696,7 +710,11 @@ export function _bindExtensionObjectArrayOrMatrix(
696
710
  if (uaVariable.valueRank < 1) {
697
711
  throw new Error("Variable must be a MultiDimensional array");
698
712
  }
699
- const arrayDimensions = uaVariable.arrayDimensions || [];
713
+ // a copy: the ArrayDimensions attribute of the node is not this function's to change, and the
714
+ // fallback below writes into this array. Taken by reference, that write rewrote what the
715
+ // nodeset declared -- a variable that said ArrayDimensions="0" came back saying "1", on the
716
+ // server as well as in any export
717
+ const arrayDimensions = [...(uaVariable.arrayDimensions || [])];
700
718
  // c8 ignore next
701
719
  if (!isVariableContainingExtensionObject(uaVariable)) {
702
720
  return [];
@@ -887,8 +905,8 @@ export function extractPartialData(path: string | string[], extensionObject: Ext
887
905
 
888
906
  export function propagateTouchValueDownwardArray(uaVariable: UAVariableImpl, now: PreciseClock, cache: Set<UAVariable>) {
889
907
  if (!uaVariable.$$extensionObjectArray) return;
890
- const arrayDimensions = uaVariable.arrayDimensions || [];
891
908
  const totalLength = uaVariable.$$extensionObjectArray.length;
909
+ const arrayDimensions = effectiveArrayDimensions(uaVariable.arrayDimensions, totalLength);
892
910
 
893
911
  const indexIterator = new IndexIterator(arrayDimensions);
894
912
  for (let i = 0; i < totalLength; i++) {
@@ -2,6 +2,7 @@
2
2
  * @module node-opcua-address-space
3
3
  */
4
4
  import type {
5
+ AddReferenceOpts,
5
6
  AddVariableOptions,
6
7
  BaseNode,
7
8
  BaseNodeEvents,
@@ -12,6 +13,7 @@ import type {
12
13
  UAMethod,
13
14
  UAObject,
14
15
  UAObjectType,
16
+ UAReferenceType,
15
17
  UAVariable,
16
18
  UAVariableType
17
19
  } from "node-opcua-address-space-base";
@@ -48,10 +50,47 @@ const errorLog = make_errorLog("ua_variable_type_impl");
48
50
  interface InstantiateS {
49
51
  propertyOf?: NodeIdLike | UAObject | UAObjectType | UAVariable | UAVariableType | UAMethod;
50
52
  componentOf?: NodeIdLike | BaseNode;
53
+ references?: AddReferenceOpts[];
51
54
  modellingRule?: ModellingRuleType;
52
55
  copyAlsoModellingRules?: boolean;
53
56
  copyAlsoAllOptionals?: boolean;
54
57
  }
58
+
59
+ /**
60
+ * the parent given through `options.references` as an inverse aggregate
61
+ * reference (HasOrderedComponent, HasPhysicalComponent ...), if any.
62
+ * See InstantiateOptions.references.
63
+ */
64
+ export function findAggregateParentInReferences(
65
+ addressSpace: AddressSpacePrivate,
66
+ references: AddReferenceOpts[] | undefined
67
+ ): BaseNode | null {
68
+ if (!references || references.length === 0) {
69
+ return null;
70
+ }
71
+ const aggregates = addressSpace.findReferenceType("Aggregates");
72
+ if (!aggregates) {
73
+ return null;
74
+ }
75
+ for (const ref of references) {
76
+ if (ref.isForward !== false) {
77
+ continue;
78
+ }
79
+ const referenceType =
80
+ typeof ref.referenceType === "object" && "nodeClass" in (ref.referenceType as object)
81
+ ? (ref.referenceType as UAReferenceType)
82
+ : addressSpace.findReferenceType(ref.referenceType as NodeIdLike);
83
+ if (!referenceType?.isSubtypeOf(aggregates)) {
84
+ continue;
85
+ }
86
+ const parent = addressSpace._coerceNode(ref.nodeId as BaseNode | NodeIdLike);
87
+ if (parent) {
88
+ return parent;
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+
55
94
  export function topMostParentIsObjectTypeOrVariableType(addressSpace: AddressSpacePrivate, options: InstantiateS): boolean {
56
95
  if (options.copyAlsoModellingRules) {
57
96
  return true;
@@ -60,7 +99,7 @@ export function topMostParentIsObjectTypeOrVariableType(addressSpace: AddressSpa
60
99
  return true;
61
100
  }
62
101
 
63
- const parent = options.propertyOf || options.componentOf;
102
+ const parent = options.propertyOf || options.componentOf || findAggregateParentInReferences(addressSpace, options.references);
64
103
  if (!parent) {
65
104
  return false;
66
105
  }
@@ -127,7 +166,7 @@ export class UAVariableTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements
127
166
  public arrayDimensions: UInt32[] | null;
128
167
  public readonly minimumSamplingInterval: number;
129
168
  // declare-only: an emitted field would hide, on a type without a default value, a child named Value
130
- public declare readonly value: unknown;
169
+ declare public readonly value: unknown;
131
170
  public historizing: boolean;
132
171
 
133
172
  constructor(options: UAVariableTypeOptions) {
@@ -292,6 +331,9 @@ export class UAVariableTypeImpl extends BaseNodeImpl<BaseNodeEvents> implements
292
331
  nodeId: options.nodeId,
293
332
  notifierOf: options.notifierOf,
294
333
  organizedBy: options.organizedBy,
334
+ // see InstantiateOptions.references: created with the node so the
335
+ // NodeIdManager derives the symbolic name from that parent
336
+ references: options.references,
295
337
  typeDefinition: this.nodeId,
296
338
  value: options.value || defaultValue,
297
339
  valueRank
@@ -353,7 +395,11 @@ function hasChildWithBrowseName(parent: BaseNode, childBrowseName: QualifiedName
353
395
  }
354
396
 
355
397
  function getParent(addressSpace: IAddressSpace, options: InstantiateVariableOptions) {
356
- const parent = options.componentOf || options.organizedBy;
398
+ const parent =
399
+ options.componentOf ||
400
+ options.organizedBy ||
401
+ findAggregateParentInReferences(addressSpace as AddressSpacePrivate, options.references) ||
402
+ undefined;
357
403
  if (parent instanceof NodeId) {
358
404
  return addressSpace.findNode(parent as NodeId);
359
405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
- "version": "2.181.0",
3
+ "version": "2.182.0",
4
4
  "description": "pure nodejs OPCUA SDK - module address-space",
5
5
  "main": "./dist/api/index.js",
6
6
  "types": "./dist/api/index.d.ts",
@@ -10,6 +10,7 @@
10
10
  "scripts": {
11
11
  "build": "tsc -b",
12
12
  "test": "mocha",
13
+ "test:long": "mocha --spec \"test_long/**/*.ts\" --timeout 900000",
13
14
  "test:check": "tsc --noEmit -p test/tsconfig.json",
14
15
  "lint": "biome check --no-errors-on-unmatched .",
15
16
  "format": "biome check --write --no-errors-on-unmatched .",
@@ -21,36 +22,36 @@
21
22
  "@types/semver": "7.8.0",
22
23
  "chalk": "4.1.2",
23
24
  "dequeue": "^1.0.5",
24
- "node-opcua-address-space-base": "2.181.0",
25
+ "node-opcua-address-space-base": "2.182.0",
25
26
  "node-opcua-assert": "2.179.0",
26
- "node-opcua-basic-types": "2.181.0",
27
+ "node-opcua-basic-types": "2.182.0",
27
28
  "node-opcua-binary-stream": "2.181.0",
28
- "node-opcua-client-dynamic-extension-object": "2.181.0",
29
+ "node-opcua-client-dynamic-extension-object": "2.182.0",
29
30
  "node-opcua-constants": "2.181.0",
30
31
  "node-opcua-crypto": "5.10.1",
31
- "node-opcua-data-access": "2.181.0",
32
- "node-opcua-data-model": "2.181.0",
33
- "node-opcua-data-value": "2.181.0",
32
+ "node-opcua-data-access": "2.182.0",
33
+ "node-opcua-data-model": "2.182.0",
34
+ "node-opcua-data-value": "2.182.0",
34
35
  "node-opcua-date-time": "2.181.0",
35
36
  "node-opcua-debug": "2.181.0",
36
37
  "node-opcua-enum": "2.181.0",
37
- "node-opcua-extension-object": "2.181.0",
38
- "node-opcua-factory": "2.181.0",
39
- "node-opcua-nodeid": "2.181.0",
40
- "node-opcua-nodeset-ua": "2.181.0",
41
- "node-opcua-numeric-range": "2.181.0",
38
+ "node-opcua-extension-object": "2.182.0",
39
+ "node-opcua-factory": "2.182.0",
40
+ "node-opcua-nodeid": "2.182.0",
41
+ "node-opcua-nodeset-ua": "2.182.0",
42
+ "node-opcua-numeric-range": "2.182.0",
42
43
  "node-opcua-object-registry": "2.181.0",
43
- "node-opcua-pseudo-session": "2.181.0",
44
- "node-opcua-service-browse": "2.181.0",
45
- "node-opcua-service-call": "2.181.0",
46
- "node-opcua-service-history": "2.181.0",
47
- "node-opcua-service-translate-browse-path": "2.181.0",
48
- "node-opcua-service-write": "2.181.0",
44
+ "node-opcua-pseudo-session": "2.182.0",
45
+ "node-opcua-service-browse": "2.182.0",
46
+ "node-opcua-service-call": "2.182.0",
47
+ "node-opcua-service-history": "2.182.0",
48
+ "node-opcua-service-translate-browse-path": "2.182.0",
49
+ "node-opcua-service-write": "2.182.0",
49
50
  "node-opcua-status-code": "2.181.0",
50
- "node-opcua-types": "2.181.0",
51
+ "node-opcua-types": "2.182.0",
51
52
  "node-opcua-utils": "2.181.0",
52
- "node-opcua-variant": "2.181.0",
53
- "node-opcua-xml2json": "2.181.0",
53
+ "node-opcua-variant": "2.182.0",
54
+ "node-opcua-xml2json": "2.182.0",
54
55
  "semver": "^7.8.5",
55
56
  "thenify-ex": "4.4.0",
56
57
  "xml-writer": "^1.7.0"
@@ -59,10 +60,10 @@
59
60
  "humanize": "0.0.9",
60
61
  "node-opcua-benchmarker": "2.181.0",
61
62
  "node-opcua-leak-detector": "2.181.0",
62
- "node-opcua-nodesets": "2.181.0",
63
- "node-opcua-packet-analyzer": "2.181.0",
64
- "node-opcua-schemas": "2.181.0",
65
- "node-opcua-service-filter": "2.181.0",
63
+ "node-opcua-nodesets": "2.182.0",
64
+ "node-opcua-packet-analyzer": "2.182.0",
65
+ "node-opcua-schemas": "2.182.0",
66
+ "node-opcua-service-filter": "2.182.0",
66
67
  "node-opcua-test-fixtures": "2.181.0",
67
68
  "node-opcua-test-helpers": "2.181.0"
68
69
  },
@@ -81,7 +82,7 @@
81
82
  "internet of things"
82
83
  ],
83
84
  "homepage": "http://node-opcua.github.io/",
84
- "gitHead": "f8f472c59e681b2aa18ae1533c3d1e5f17614c5c",
85
+ "gitHead": "7172ac8333d34505a72221e8f56e8708c2c96bd7",
85
86
  "files": [
86
87
  "dist",
87
88
  "distHelpers",
@@ -97,6 +98,7 @@
97
98
  "bin"
98
99
  ],
99
100
  "bin": {
100
- "opcua-nodeset-image": "bin/opcua-nodeset-image.js"
101
+ "opcua-nodeset-image": "bin/opcua-nodeset-image.js",
102
+ "opcua-nodeset-live": "bin/opcua-nodeset-live.js"
101
103
  }
102
104
  }
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { promisify } from "node:util";
4
- import zlib, { gunzip } from "node:zlib";
4
+ import zlib, { gunzip, gzip as gzipCb } from "node:zlib";
5
5
  import type { IAddressSpace } from "node-opcua-address-space-base";
6
6
  import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
7
7
  import {
@@ -13,6 +13,7 @@ import {
13
13
  nodesetImageProblem,
14
14
  nodesetToImage as nodesetToImageRaw,
15
15
  readNodesetImageInfo,
16
+ setImageDeflater,
16
17
  setImageInflater,
17
18
  sha256Hex
18
19
  } from "../dist/api/index.js";
@@ -23,6 +24,11 @@ import { FileNodesetImageStore } from "./nodeset_image_file_store.js";
23
24
  const gunzipAsync = promisify(gunzip);
24
25
  setImageInflater(async (image) => (await gunzipAsync(image)).toString("utf8"));
25
26
 
27
+ // and out through zlib at level 9: CompressionStream has no level to ask for, and an image is
28
+ // written once and read many times, so the extra work at build time is free at load time
29
+ const gzipAsync = promisify(gzipCb);
30
+ setImageDeflater(async (text) => new Uint8Array(await gzipAsync(Buffer.from(text, "utf8"), { level: 9 })));
31
+
26
32
  const _doDebug = checkDebugFlag("generate_address_space");
27
33
  const debugLog = make_debugLog("generate_address_space");
28
34
  const errorLog = make_errorLog("generate_address_space");