node-opcua-client-dynamic-extension-object 2.67.1 → 2.69.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.
package/dist/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export * from "./get_extension_object_constructor";
9
9
  export * from "./get_extra_data_type_manager";
10
10
  export * from "./resolve_dynamic_extension_object";
11
11
  export * from "./convert_data_type_definition_to_structuretype_schema";
12
+ export * from "./promote_opaque_structure_in_notification_data";
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -21,4 +25,5 @@ __exportStar(require("./get_extension_object_constructor"), exports);
21
25
  __exportStar(require("./get_extra_data_type_manager"), exports);
22
26
  __exportStar(require("./resolve_dynamic_extension_object"), exports);
23
27
  __exportStar(require("./convert_data_type_definition_to_structuretype_schema"), exports);
28
+ __exportStar(require("./promote_opaque_structure_in_notification_data"), exports);
24
29
  //# 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;;GAEG;AACH,+DAA6C;AAC7C,4DAA0C;AAC1C,qEAAmD;AACnD,6DAA2C;AAC3C,qEAAmD;AACnD,gEAA8C;AAC9C,qEAAmD;AACnD,yFAAuE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,+DAA6C;AAC7C,4DAA0C;AAC1C,qEAAmD;AACnD,6DAA2C;AAC3C,qEAAmD;AACnD,gEAA8C;AAC9C,qEAAmD;AACnD,yFAAuE;AACvE,kFAAgE"}
@@ -0,0 +1,3 @@
1
+ import { NotificationData } from "node-opcua-types";
2
+ import { IBasicSession } from "node-opcua-pseudo-session/source/basic_session_interface";
3
+ export declare function promoteOpaqueStructureInNotificationData(session: IBasicSession, notificationData: NotificationData[]): Promise<void>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.promoteOpaqueStructureInNotificationData = void 0;
13
+ const node_opcua_types_1 = require("node-opcua-types");
14
+ const node_opcua_variant_1 = require("node-opcua-variant");
15
+ const promote_opaque_structure_1 = require("./promote_opaque_structure");
16
+ function promoteOpaqueStructureInNotificationData(session, notificationData) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ const dataValuesToPromote = [];
19
+ for (const notification of notificationData) {
20
+ if (!notification) {
21
+ continue;
22
+ }
23
+ if (notification instanceof node_opcua_types_1.DataChangeNotification) {
24
+ if (notification.monitoredItems) {
25
+ for (const monitoredItem of notification.monitoredItems) {
26
+ if (monitoredItem.value.value && monitoredItem.value.value.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
27
+ dataValuesToPromote.push(monitoredItem.value);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ else if (notification instanceof node_opcua_types_1.EventNotificationList) {
33
+ if (notification.events) {
34
+ for (const events of notification.events) {
35
+ if (events.eventFields) {
36
+ // eslint-disable-next-line max-depth
37
+ for (const eventField of events.eventFields) {
38
+ // eslint-disable-next-line max-depth
39
+ if (eventField.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
40
+ dataValuesToPromote.push({ value: eventField });
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
48
+ yield (0, promote_opaque_structure_1.promoteOpaqueStructure)(session, dataValuesToPromote);
49
+ });
50
+ }
51
+ exports.promoteOpaqueStructureInNotificationData = promoteOpaqueStructureInNotificationData;
52
+ //# sourceMappingURL=promote_opaque_structure_in_notification_data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promote_opaque_structure_in_notification_data.js","sourceRoot":"","sources":["../source/promote_opaque_structure_in_notification_data.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAmG;AACnG,2DAAuD;AAEvD,yEAAoE;AAEpE,SAAsB,wCAAwC,CAC1D,OAAsB,EACtB,gBAAoC;;QAEpC,MAAM,mBAAmB,GAAyB,EAAE,CAAC;QACrD,KAAK,MAAM,YAAY,IAAI,gBAAgB,EAAE;YACzC,IAAI,CAAC,YAAY,EAAE;gBACf,SAAS;aACZ;YACD,IAAI,YAAY,YAAY,yCAAsB,EAAE;gBAChD,IAAI,YAAY,CAAC,cAAc,EAAE;oBAC7B,KAAK,MAAM,aAAa,IAAI,YAAY,CAAC,cAAc,EAAE;wBACrD,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,KAAK,6BAAQ,CAAC,eAAe,EAAE;4BAC9F,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;yBACjD;qBACJ;iBACJ;aACJ;iBAAM,IAAI,YAAY,YAAY,wCAAqB,EAAE;gBACtD,IAAI,YAAY,CAAC,MAAM,EAAE;oBACrB,KAAK,MAAM,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE;wBACtC,IAAI,MAAM,CAAC,WAAW,EAAE;4BACpB,qCAAqC;4BACrC,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE;gCACzC,qCAAqC;gCACrC,IAAI,UAAU,CAAC,QAAQ,KAAK,6BAAQ,CAAC,eAAe,EAAE;oCAClD,mBAAmB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;iCACnD;6BACJ;yBACJ;qBACJ;iBACJ;aACJ;SACJ;QACD,MAAM,IAAA,iDAAsB,EAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAC/D,CAAC;CAAA;AAlCD,4FAkCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-client-dynamic-extension-object",
3
- "version": "2.67.1",
3
+ "version": "2.69.0",
4
4
  "description": "pure nodejs OPCUA SDK - module client-dynamic-extension-object",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,21 +12,21 @@
12
12
  "dependencies": {
13
13
  "chalk": "4.1.2",
14
14
  "node-opcua-assert": "2.66.0",
15
- "node-opcua-binary-stream": "2.67.0",
15
+ "node-opcua-binary-stream": "2.69.0",
16
16
  "node-opcua-constants": "2.67.0",
17
- "node-opcua-data-model": "2.67.0",
18
- "node-opcua-data-value": "2.67.0",
19
- "node-opcua-debug": "2.67.0",
20
- "node-opcua-extension-object": "2.67.0",
21
- "node-opcua-factory": "2.67.0",
22
- "node-opcua-nodeid": "2.67.0",
23
- "node-opcua-pseudo-session": "2.67.1",
24
- "node-opcua-schemas": "2.67.0",
25
- "node-opcua-service-browse": "2.67.0",
26
- "node-opcua-service-translate-browse-path": "2.67.0",
27
- "node-opcua-status-code": "2.67.0",
28
- "node-opcua-types": "2.67.0",
29
- "node-opcua-variant": "2.67.0"
17
+ "node-opcua-data-model": "2.69.0",
18
+ "node-opcua-data-value": "2.69.0",
19
+ "node-opcua-debug": "2.69.0",
20
+ "node-opcua-extension-object": "2.69.0",
21
+ "node-opcua-factory": "2.69.0",
22
+ "node-opcua-nodeid": "2.69.0",
23
+ "node-opcua-pseudo-session": "2.69.0",
24
+ "node-opcua-schemas": "2.69.0",
25
+ "node-opcua-service-browse": "2.69.0",
26
+ "node-opcua-service-translate-browse-path": "2.69.0",
27
+ "node-opcua-status-code": "2.69.0",
28
+ "node-opcua-types": "2.69.0",
29
+ "node-opcua-variant": "2.69.0"
30
30
  },
31
31
  "author": "Etienne Rossignon",
32
32
  "license": "MIT",
@@ -43,5 +43,5 @@
43
43
  "internet of things"
44
44
  ],
45
45
  "homepage": "http://node-opcua.github.io/",
46
- "gitHead": "e6ea08f7a92fdf27240c5ed1bb567c6630eaf863"
46
+ "gitHead": "6c88d05e8c82ce4bc9c8af9f0a8eb6136f31d2ce"
47
47
  }
package/source/index.ts CHANGED
@@ -8,4 +8,5 @@ export * from "./promote_opaque_structure";
8
8
  export * from "./get_extension_object_constructor";
9
9
  export * from "./get_extra_data_type_manager";
10
10
  export * from "./resolve_dynamic_extension_object";
11
- export * from "./convert_data_type_definition_to_structuretype_schema";
11
+ export * from "./convert_data_type_definition_to_structuretype_schema";
12
+ export * from "./promote_opaque_structure_in_notification_data";
@@ -0,0 +1,40 @@
1
+ import { NotificationData, DataChangeNotification, EventNotificationList } from "node-opcua-types";
2
+ import { Variant, DataType } from "node-opcua-variant";
3
+ import { IBasicSession } from "node-opcua-pseudo-session/source/basic_session_interface";
4
+ import { promoteOpaqueStructure } from "./promote_opaque_structure";
5
+
6
+ export async function promoteOpaqueStructureInNotificationData(
7
+ session: IBasicSession,
8
+ notificationData: NotificationData[]
9
+ ): Promise<void> {
10
+ const dataValuesToPromote: { value: Variant }[] = [];
11
+ for (const notification of notificationData) {
12
+ if (!notification) {
13
+ continue;
14
+ }
15
+ if (notification instanceof DataChangeNotification) {
16
+ if (notification.monitoredItems) {
17
+ for (const monitoredItem of notification.monitoredItems) {
18
+ if (monitoredItem.value.value && monitoredItem.value.value.dataType === DataType.ExtensionObject) {
19
+ dataValuesToPromote.push(monitoredItem.value);
20
+ }
21
+ }
22
+ }
23
+ } else if (notification instanceof EventNotificationList) {
24
+ if (notification.events) {
25
+ for (const events of notification.events) {
26
+ if (events.eventFields) {
27
+ // eslint-disable-next-line max-depth
28
+ for (const eventField of events.eventFields) {
29
+ // eslint-disable-next-line max-depth
30
+ if (eventField.dataType === DataType.ExtensionObject) {
31
+ dataValuesToPromote.push({ value: eventField });
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ await promoteOpaqueStructure(session, dataValuesToPromote);
40
+ }