node-opcua-address-space 2.184.1 → 2.184.3

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.
@@ -6,6 +6,7 @@ import chalk from "chalk";
6
6
  import type {
7
7
  AddReferenceOpts,
8
8
  BaseNode,
9
+ ConditionRefreshScope,
9
10
  IEventData,
10
11
  IHistoricalDataNodeOptions,
11
12
  ISessionContext,
@@ -226,6 +227,11 @@ export class AddressSpaceImpl implements AddressSpacePrivate {
226
227
  }
227
228
  public historizingNodes: Set<UAVariable> = new Set();
228
229
  public _condition_refresh_in_progress = false;
230
+ /**
231
+ * the Subscription (and, for ConditionRefresh2, the MonitoredItem) the refresh in progress
232
+ * was asked for; `null` outside a refresh. See ConditionRefreshScope.
233
+ */
234
+ public _condition_refresh_scope: ConditionRefreshScope | null = null;
229
235
 
230
236
  public readonly isNodeIdString = isNodeIdString;
231
237
  private readonly _private_namespaceIndex: number;
@@ -5,6 +5,7 @@
5
5
  import type {
6
6
  AddReferenceOpts,
7
7
  BaseNode,
8
+ ConditionRefreshScope,
8
9
  IAddressSpace,
9
10
  MethodCallInterceptor,
10
11
  UADataType,
@@ -36,6 +37,9 @@ export interface AddressSpacePrivate extends IAddressSpace {
36
37
 
37
38
  _condition_refresh_in_progress: boolean;
38
39
 
40
+ /** what the refresh in progress was asked for; `null` outside a refresh */
41
+ _condition_refresh_scope: ConditionRefreshScope | null;
42
+
39
43
  $$extraDataTypeManager?: ExtraDataTypeManager;
40
44
 
41
45
  _coerceNode(node: string | BaseNode | NodeIdLike): BaseNode | null;
@@ -4,6 +4,7 @@
4
4
  import chalk from "chalk";
5
5
  import {
6
6
  type BaseNode,
7
+ type ConditionRefreshScope,
7
8
  fullPath2,
8
9
  type INamespace,
9
10
  type ISessionContext,
@@ -1122,7 +1123,35 @@ function _condition_refresh_method(
1122
1123
  });
1123
1124
  }
1124
1125
 
1125
- function _perform_condition_refresh(addressSpace: AddressSpacePrivate, _inputArguments: VariantLike[], context: ISessionContext) {
1126
+ /**
1127
+ * Who the refresh in progress is for.
1128
+ *
1129
+ * OPC 10000-9 5.5.7: the SubscriptionId argument says "which Client Subscription shall be
1130
+ * refreshed", and both halves of the bracket and the Retained Conditions replayed in between go to
1131
+ * that Subscription's Notifier MonitoredItems; 5.5.8 narrows all of it to the one MonitoredItem
1132
+ * ConditionRefresh2 names. But the bracket is raised on the Server Object and the Conditions on
1133
+ * their own nodes, and from there every Event bubbles to every event MonitoredItem of the whole
1134
+ * Server - the address space knows nothing of Subscriptions. So it publishes what the call named
1135
+ * and the MonitoredItem drops a refresh addressed elsewhere.
1136
+ *
1137
+ * The same scope carries 4.5's other half: the RefreshStart/RefreshEnd bracket "ignore[s] the
1138
+ * Event content filtering associated with a Subscription", which the MonitoredItem applies for
1139
+ * the named Subscription only.
1140
+ *
1141
+ * `null` when there is no Session behind the call (a PseudoSession, an in-process caller, a unit
1142
+ * test): nothing is named, so nothing is narrowed and nothing is bypassed.
1143
+ */
1144
+ function _refresh_scope(inputArguments: VariantLike[], context: ISessionContext): ConditionRefreshScope | null {
1145
+ const subscription = context.session?.getSubscription?.(inputArguments[0]?.value);
1146
+ if (!subscription) {
1147
+ return null;
1148
+ }
1149
+ // ConditionRefresh2 names one MonitoredItem (5.5.8); ConditionRefresh names none (5.5.7)
1150
+ const monitoredItemId = inputArguments.length > 1 ? (inputArguments[1]?.value as number) : undefined;
1151
+ return { subscription, monitoredItemId };
1152
+ }
1153
+
1154
+ function _perform_condition_refresh(addressSpace: AddressSpacePrivate, inputArguments: VariantLike[], context: ISessionContext) {
1126
1155
  // --- possible StatusCodes:
1127
1156
  //
1128
1157
  // Bad_SubscriptionIdInvalid See Part 4 for the description of this result code
@@ -1149,6 +1178,7 @@ function _perform_condition_refresh(addressSpace: AddressSpacePrivate, _inputArg
1149
1178
  }
1150
1179
 
1151
1180
  addressSpace._condition_refresh_in_progress = true;
1181
+ addressSpace._condition_refresh_scope = _refresh_scope(inputArguments, context);
1152
1182
  try {
1153
1183
  server?.raiseEvent(refreshStartEventType, {});
1154
1184
 
@@ -1160,8 +1190,10 @@ function _perform_condition_refresh(addressSpace: AddressSpacePrivate, _inputArg
1160
1190
  server?.raiseEvent(refreshEndEventType, {});
1161
1191
  } finally {
1162
1192
  // whatever a condition's event handler throws, the next refresh must not be
1163
- // answered Bad_RefreshInProgress for ever
1193
+ // answered Bad_RefreshInProgress for ever, and no later event must be taken
1194
+ // for part of a refresh
1164
1195
  addressSpace._condition_refresh_in_progress = false;
1196
+ addressSpace._condition_refresh_scope = null;
1165
1197
  }
1166
1198
 
1167
1199
  return StatusCodes.Good;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
3
  "type": "module",
4
- "version": "2.184.1",
4
+ "version": "2.184.3",
5
5
  "description": "pure nodejs OPCUA SDK - module address-space",
6
6
  "main": "./dist/api/index.js",
7
7
  "types": "./dist/api/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "@types/semver": "7.8.0",
24
24
  "chalk": "4.1.2",
25
25
  "dequeue": "^1.0.5",
26
- "node-opcua-address-space-base": "2.184.1",
26
+ "node-opcua-address-space-base": "2.184.3",
27
27
  "node-opcua-assert": "2.184.0",
28
28
  "node-opcua-basic-types": "2.184.1",
29
29
  "node-opcua-binary-stream": "2.184.1",
@@ -39,7 +39,7 @@
39
39
  "node-opcua-extension-object": "2.184.1",
40
40
  "node-opcua-factory": "2.184.1",
41
41
  "node-opcua-nodeid": "2.184.1",
42
- "node-opcua-nodeset-ua": "2.184.1",
42
+ "node-opcua-nodeset-ua": "2.184.3",
43
43
  "node-opcua-numeric-range": "2.184.1",
44
44
  "node-opcua-object-registry": "2.184.0",
45
45
  "node-opcua-pseudo-session": "2.184.1",
@@ -64,7 +64,7 @@
64
64
  "node-opcua-nodesets": "2.184.0",
65
65
  "node-opcua-packet-analyzer": "2.184.1",
66
66
  "node-opcua-schemas": "2.184.1",
67
- "node-opcua-service-filter": "2.184.1",
67
+ "node-opcua-service-filter": "2.184.3",
68
68
  "node-opcua-test-fixtures": "2.184.0",
69
69
  "node-opcua-test-helpers": "2.184.0"
70
70
  },
@@ -83,7 +83,7 @@
83
83
  "internet of things"
84
84
  ],
85
85
  "homepage": "http://node-opcua.github.io/",
86
- "gitHead": "29af4e8ac45f585e7b0d8cff9c799b4f0f2f0985",
86
+ "gitHead": "44adf973a0d633ecdfde62b13d87c2622642b23f",
87
87
  "files": [
88
88
  "dist",
89
89
  "distHelpers",