node-opcua-server 2.64.0 → 2.64.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.
Files changed (57) hide show
  1. package/dist/I_register_server_manager.d.ts +15 -0
  2. package/dist/I_register_server_manager.js +3 -0
  3. package/dist/I_register_server_manager.js.map +1 -0
  4. package/dist/base_server.d.ts +110 -110
  5. package/dist/base_server.js +473 -473
  6. package/dist/continuation_point_manager.d.ts +18 -0
  7. package/dist/continuation_point_manager.js +84 -0
  8. package/dist/continuation_point_manager.js.map +1 -0
  9. package/dist/factory.d.ts +12 -12
  10. package/dist/factory.js +23 -23
  11. package/dist/history_server_capabilities.d.ts +35 -35
  12. package/dist/history_server_capabilities.js +43 -43
  13. package/dist/i_channel_data.d.ts +13 -13
  14. package/dist/i_channel_data.js +2 -2
  15. package/dist/i_register_server_manager.d.ts +16 -16
  16. package/dist/i_register_server_manager.js +2 -2
  17. package/dist/i_server_side_publish_engine.d.ts +36 -36
  18. package/dist/i_server_side_publish_engine.js +49 -49
  19. package/dist/i_socket_data.d.ts +11 -11
  20. package/dist/i_socket_data.js +2 -2
  21. package/dist/index.d.ts +14 -14
  22. package/dist/index.js +26 -26
  23. package/dist/monitored_item.d.ts +176 -176
  24. package/dist/monitored_item.js +998 -998
  25. package/dist/node_sampler.d.ts +3 -3
  26. package/dist/node_sampler.js +75 -75
  27. package/dist/opcua_server.d.ts +654 -653
  28. package/dist/opcua_server.js +2389 -2366
  29. package/dist/opcua_server.js.map +1 -1
  30. package/dist/queue.d.ts +11 -11
  31. package/dist/queue.js +71 -71
  32. package/dist/register_server_manager.d.ts +95 -95
  33. package/dist/register_server_manager.js +584 -584
  34. package/dist/register_server_manager_hidden.d.ts +17 -17
  35. package/dist/register_server_manager_hidden.js +27 -27
  36. package/dist/register_server_manager_mdns_only.d.ts +22 -22
  37. package/dist/register_server_manager_mdns_only.js +57 -57
  38. package/dist/server_capabilities.d.ts +61 -61
  39. package/dist/server_capabilities.js +108 -108
  40. package/dist/server_end_point.d.ts +183 -183
  41. package/dist/server_end_point.js +816 -816
  42. package/dist/server_engine.d.ts +315 -315
  43. package/dist/server_engine.js +1678 -1678
  44. package/dist/server_publish_engine.d.ts +112 -112
  45. package/dist/server_publish_engine.js +530 -530
  46. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
  47. package/dist/server_publish_engine_for_orphan_subscriptions.js +49 -49
  48. package/dist/server_session.d.ts +180 -180
  49. package/dist/server_session.js +737 -737
  50. package/dist/server_subscription.d.ts +395 -395
  51. package/dist/server_subscription.js +1316 -1316
  52. package/dist/sessions_compatible_for_transfer.d.ts +2 -2
  53. package/dist/sessions_compatible_for_transfer.js +36 -36
  54. package/dist/validate_filter.d.ts +5 -5
  55. package/dist/validate_filter.js +60 -60
  56. package/package.json +87 -87
  57. package/source/opcua_server.ts +28 -1
@@ -1,2 +1,2 @@
1
- import { ServerSession } from "./server_session";
2
- export declare function sessionsCompatibleForTransfer(sessionSrc: ServerSession, sessionDest: ServerSession): boolean;
1
+ import { ServerSession } from "./server_session";
2
+ export declare function sessionsCompatibleForTransfer(sessionSrc: ServerSession, sessionDest: ServerSession): boolean;
@@ -1,37 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sessionsCompatibleForTransfer = void 0;
4
- const node_opcua_assert_1 = require("node-opcua-assert");
5
- const node_opcua_types_1 = require("node-opcua-types");
6
- function sessionsCompatibleForTransfer(sessionSrc, sessionDest) {
7
- (0, node_opcua_assert_1.assert)(sessionDest);
8
- (0, node_opcua_assert_1.assert)(sessionSrc);
9
- if (!sessionSrc.userIdentityToken && !sessionDest.userIdentityToken) {
10
- return true;
11
- }
12
- if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken) {
13
- if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken)) {
14
- return false;
15
- }
16
- return true;
17
- }
18
- else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken) {
19
- if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken)) {
20
- return false;
21
- }
22
- return sessionSrc.userIdentityToken.userName === sessionDest.userIdentityToken.userName;
23
- }
24
- // istanbul ignore else
25
- else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken) {
26
- if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken)) {
27
- return false;
28
- }
29
- return (sessionSrc.userIdentityToken.certificateData.toString("hex") ===
30
- sessionDest.userIdentityToken.certificateData.toString("hex"));
31
- }
32
- else {
33
- throw new Error("Unsupported Identity token");
34
- }
35
- }
36
- exports.sessionsCompatibleForTransfer = sessionsCompatibleForTransfer;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sessionsCompatibleForTransfer = void 0;
4
+ const node_opcua_assert_1 = require("node-opcua-assert");
5
+ const node_opcua_types_1 = require("node-opcua-types");
6
+ function sessionsCompatibleForTransfer(sessionSrc, sessionDest) {
7
+ (0, node_opcua_assert_1.assert)(sessionDest);
8
+ (0, node_opcua_assert_1.assert)(sessionSrc);
9
+ if (!sessionSrc.userIdentityToken && !sessionDest.userIdentityToken) {
10
+ return true;
11
+ }
12
+ if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken) {
13
+ if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken)) {
14
+ return false;
15
+ }
16
+ return true;
17
+ }
18
+ else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken) {
19
+ if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken)) {
20
+ return false;
21
+ }
22
+ return sessionSrc.userIdentityToken.userName === sessionDest.userIdentityToken.userName;
23
+ }
24
+ // istanbul ignore else
25
+ else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken) {
26
+ if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken)) {
27
+ return false;
28
+ }
29
+ return (sessionSrc.userIdentityToken.certificateData.toString("hex") ===
30
+ sessionDest.userIdentityToken.certificateData.toString("hex"));
31
+ }
32
+ else {
33
+ throw new Error("Unsupported Identity token");
34
+ }
35
+ }
36
+ exports.sessionsCompatibleForTransfer = sessionsCompatibleForTransfer;
37
37
  //# sourceMappingURL=sessions_compatible_for_transfer.js.map
@@ -1,5 +1,5 @@
1
- import { BaseNode } from "node-opcua-address-space";
2
- import { ExtensionObject } from "node-opcua-extension-object";
3
- import { StatusCode } from "node-opcua-status-code";
4
- import { ReadValueIdOptions } from "node-opcua-types";
5
- export declare function validateFilter(filter: ExtensionObject | null, itemToMonitor: ReadValueIdOptions, node: BaseNode): StatusCode;
1
+ import { BaseNode } from "node-opcua-address-space";
2
+ import { ExtensionObject } from "node-opcua-extension-object";
3
+ import { StatusCode } from "node-opcua-status-code";
4
+ import { ReadValueIdOptions } from "node-opcua-types";
5
+ export declare function validateFilter(filter: ExtensionObject | null, itemToMonitor: ReadValueIdOptions, node: BaseNode): StatusCode;
@@ -1,61 +1,61 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateFilter = void 0;
4
- /**
5
- * @module node-opcua-server
6
- */
7
- const node_opcua_assert_1 = require("node-opcua-assert");
8
- const node_opcua_data_model_1 = require("node-opcua-data-model");
9
- const node_opcua_data_model_2 = require("node-opcua-data-model");
10
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
11
- const node_opcua_service_filter_1 = require("node-opcua-service-filter");
12
- const node_opcua_service_subscription_1 = require("node-opcua-service-subscription");
13
- const node_opcua_status_code_1 = require("node-opcua-status-code");
14
- function __validateDataChangeFilter(filter, itemToMonitor, node) {
15
- (0, node_opcua_assert_1.assert)(itemToMonitor.attributeId === node_opcua_data_model_1.AttributeIds.Value);
16
- if (node.nodeClass !== node_opcua_data_model_2.NodeClass.Variable) {
17
- return node_opcua_status_code_1.StatusCodes.BadNodeIdInvalid;
18
- }
19
- (0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_2.NodeClass.Variable);
20
- // if node is not Numerical=> DataChangeFilter
21
- (0, node_opcua_assert_1.assert)(node.dataType instanceof node_opcua_nodeid_1.NodeId);
22
- const dataType = node.addressSpace.findDataType(node.dataType);
23
- const dataTypeNumber = node.addressSpace.findDataType("Number");
24
- if (filter.deadbandType !== node_opcua_service_subscription_1.DeadbandType.None) {
25
- if (!dataType.isSupertypeOf(dataTypeNumber)) {
26
- return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
27
- }
28
- }
29
- if (filter.deadbandType === node_opcua_service_subscription_1.DeadbandType.Percent) {
30
- if (filter.deadbandValue < 0 || filter.deadbandValue > 100) {
31
- return node_opcua_status_code_1.StatusCodes.BadDeadbandFilterInvalid;
32
- }
33
- // node must also have a valid euRange
34
- if (!node.euRange) {
35
- // tslint:disable:no-console
36
- console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
37
- return node_opcua_status_code_1.StatusCodes.BadMonitoredItemFilterUnsupported;
38
- }
39
- }
40
- return node_opcua_status_code_1.StatusCodes.Good;
41
- }
42
- function validateFilter(filter, itemToMonitor, node) {
43
- // handle filter information
44
- if (filter && filter instanceof node_opcua_service_filter_1.EventFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier) {
45
- // invalid filter on Event
46
- return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
47
- }
48
- if (filter && filter instanceof node_opcua_service_filter_1.DataChangeFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
49
- // invalid DataChange filter on non Value Attribute
50
- return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
51
- }
52
- if (filter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
53
- return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
54
- }
55
- if (filter instanceof node_opcua_service_filter_1.DataChangeFilter) {
56
- return __validateDataChangeFilter(filter, itemToMonitor, node);
57
- }
58
- return node_opcua_status_code_1.StatusCodes.Good;
59
- }
60
- exports.validateFilter = validateFilter;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateFilter = void 0;
4
+ /**
5
+ * @module node-opcua-server
6
+ */
7
+ const node_opcua_assert_1 = require("node-opcua-assert");
8
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
9
+ const node_opcua_data_model_2 = require("node-opcua-data-model");
10
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
11
+ const node_opcua_service_filter_1 = require("node-opcua-service-filter");
12
+ const node_opcua_service_subscription_1 = require("node-opcua-service-subscription");
13
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
14
+ function __validateDataChangeFilter(filter, itemToMonitor, node) {
15
+ (0, node_opcua_assert_1.assert)(itemToMonitor.attributeId === node_opcua_data_model_1.AttributeIds.Value);
16
+ if (node.nodeClass !== node_opcua_data_model_2.NodeClass.Variable) {
17
+ return node_opcua_status_code_1.StatusCodes.BadNodeIdInvalid;
18
+ }
19
+ (0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_2.NodeClass.Variable);
20
+ // if node is not Numerical=> DataChangeFilter
21
+ (0, node_opcua_assert_1.assert)(node.dataType instanceof node_opcua_nodeid_1.NodeId);
22
+ const dataType = node.addressSpace.findDataType(node.dataType);
23
+ const dataTypeNumber = node.addressSpace.findDataType("Number");
24
+ if (filter.deadbandType !== node_opcua_service_subscription_1.DeadbandType.None) {
25
+ if (!dataType.isSupertypeOf(dataTypeNumber)) {
26
+ return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
27
+ }
28
+ }
29
+ if (filter.deadbandType === node_opcua_service_subscription_1.DeadbandType.Percent) {
30
+ if (filter.deadbandValue < 0 || filter.deadbandValue > 100) {
31
+ return node_opcua_status_code_1.StatusCodes.BadDeadbandFilterInvalid;
32
+ }
33
+ // node must also have a valid euRange
34
+ if (!node.euRange) {
35
+ // tslint:disable:no-console
36
+ console.log(" node has no euRange ! Dead band Percent cannot be used on node " + node.nodeId.toString());
37
+ return node_opcua_status_code_1.StatusCodes.BadMonitoredItemFilterUnsupported;
38
+ }
39
+ }
40
+ return node_opcua_status_code_1.StatusCodes.Good;
41
+ }
42
+ function validateFilter(filter, itemToMonitor, node) {
43
+ // handle filter information
44
+ if (filter && filter instanceof node_opcua_service_filter_1.EventFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier) {
45
+ // invalid filter on Event
46
+ return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
47
+ }
48
+ if (filter && filter instanceof node_opcua_service_filter_1.DataChangeFilter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
49
+ // invalid DataChange filter on non Value Attribute
50
+ return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
51
+ }
52
+ if (filter && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.EventNotifier && itemToMonitor.attributeId !== node_opcua_data_model_1.AttributeIds.Value) {
53
+ return node_opcua_status_code_1.StatusCodes.BadFilterNotAllowed;
54
+ }
55
+ if (filter instanceof node_opcua_service_filter_1.DataChangeFilter) {
56
+ return __validateDataChangeFilter(filter, itemToMonitor, node);
57
+ }
58
+ return node_opcua_status_code_1.StatusCodes.Good;
59
+ }
60
+ exports.validateFilter = validateFilter;
61
61
  //# sourceMappingURL=validate_filter.js.map
package/package.json CHANGED
@@ -1,88 +1,88 @@
1
1
  {
2
- "name": "node-opcua-server",
3
- "version": "2.64.0",
4
- "description": "pure nodejs OPCUA SDK - module -server",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "dependencies": {
8
- "@ster5/global-mutex": "^1.2.0",
9
- "@types/underscore": "^1.11.4",
10
- "async": "^3.2.3",
11
- "bonjour": "^3.5.0",
12
- "dequeue": "^1.0.5",
13
- "lodash": "4.17.21",
14
- "node-opcua-address-space": "2.64.0",
15
- "node-opcua-assert": "2.64.0",
16
- "node-opcua-basic-types": "2.64.0",
17
- "node-opcua-certificate-manager": "2.64.0",
18
- "node-opcua-client": "2.64.0",
19
- "node-opcua-client-dynamic-extension-object": "2.64.0",
20
- "node-opcua-common": "2.64.0",
21
- "node-opcua-constants": "2.64.0",
22
- "node-opcua-crypto": "^1.7.5",
23
- "node-opcua-data-model": "2.64.0",
24
- "node-opcua-data-value": "2.64.0",
25
- "node-opcua-date-time": "2.64.0",
26
- "node-opcua-debug": "2.64.0",
27
- "node-opcua-enum": "2.64.0",
28
- "node-opcua-extension-object": "2.64.0",
29
- "node-opcua-factory": "2.64.0",
30
- "node-opcua-hostname": "2.64.0",
31
- "node-opcua-nodeid": "2.64.0",
32
- "node-opcua-nodesets": "2.64.0",
33
- "node-opcua-numeric-range": "2.64.0",
34
- "node-opcua-object-registry": "2.64.0",
35
- "node-opcua-pki": "^2.13.0",
36
- "node-opcua-secure-channel": "2.64.0",
37
- "node-opcua-service-browse": "2.64.0",
38
- "node-opcua-service-call": "2.64.0",
39
- "node-opcua-service-discovery": "2.64.0",
40
- "node-opcua-service-endpoints": "2.64.0",
41
- "node-opcua-service-filter": "2.64.0",
42
- "node-opcua-service-history": "2.64.0",
43
- "node-opcua-service-node-management": "2.64.0",
44
- "node-opcua-service-query": "2.64.0",
45
- "node-opcua-service-read": "2.64.0",
46
- "node-opcua-service-register-node": "2.64.0",
47
- "node-opcua-service-secure-channel": "2.64.0",
48
- "node-opcua-service-session": "2.64.0",
49
- "node-opcua-service-subscription": "2.64.0",
50
- "node-opcua-service-translate-browse-path": "2.64.0",
51
- "node-opcua-service-write": "2.64.0",
52
- "node-opcua-status-code": "2.64.0",
53
- "node-opcua-types": "2.64.0",
54
- "node-opcua-utils": "2.64.0",
55
- "node-opcua-variant": "2.64.0"
56
- },
57
- "devDependencies": {
58
- "node-opcua-data-access": "2.64.0",
59
- "node-opcua-leak-detector": "2.64.0",
60
- "node-opcua-test-helpers": "2.64.0",
61
- "node-opcua-transport": "2.64.0",
62
- "should": "^13.2.3",
63
- "sinon": "^13.0.1"
64
- },
65
- "author": "Etienne Rossignon",
66
- "license": "MIT",
67
- "repository": {
68
- "type": "git",
69
- "url": "git://github.com/node-opcua/node-opcua.git"
70
- },
71
- "keywords": [
72
- "OPCUA",
73
- "opcua",
74
- "m2m",
75
- "iot",
76
- "opc ua",
77
- "internet of things"
78
- ],
79
- "homepage": "http://node-opcua.github.io/",
80
- "gitHead": "07dcdd8e8c7f2b55544c6e23023093e35674829c",
81
- "scripts": {
82
- "build": "tsc -b",
83
- "lint": "eslint source test",
84
- "format": "prettier --write source test",
85
- "clean": "node -e \"require('rimraf').sync('certificates');\" && node -e \"require('rimraf').sync('dist');\"",
86
- "test": "mocha"
87
- }
88
- }
2
+ "name": "node-opcua-server",
3
+ "version": "2.64.1",
4
+ "description": "pure nodejs OPCUA SDK - module -server",
5
+ "scripts": {
6
+ "build": "tsc -b",
7
+ "lint": "eslint source test",
8
+ "format": "prettier --write source test",
9
+ "clean": "node -e \"require('rimraf').sync('certificates');\" && node -e \"require('rimraf').sync('dist');\"",
10
+ "test": "mocha"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "dependencies": {
15
+ "@ster5/global-mutex": "^1.2.0",
16
+ "@types/underscore": "^1.11.4",
17
+ "async": "^3.2.3",
18
+ "bonjour": "^3.5.0",
19
+ "dequeue": "^1.0.5",
20
+ "lodash": "4.17.21",
21
+ "node-opcua-address-space": "2.64.1",
22
+ "node-opcua-assert": "2.64.1",
23
+ "node-opcua-basic-types": "2.64.1",
24
+ "node-opcua-certificate-manager": "2.64.1",
25
+ "node-opcua-client": "2.64.1",
26
+ "node-opcua-client-dynamic-extension-object": "2.64.1",
27
+ "node-opcua-common": "2.64.1",
28
+ "node-opcua-constants": "2.64.1",
29
+ "node-opcua-crypto": "^1.9.0",
30
+ "node-opcua-data-model": "2.64.1",
31
+ "node-opcua-data-value": "2.64.1",
32
+ "node-opcua-date-time": "2.64.1",
33
+ "node-opcua-debug": "2.64.1",
34
+ "node-opcua-enum": "2.64.1",
35
+ "node-opcua-extension-object": "2.64.1",
36
+ "node-opcua-factory": "2.64.1",
37
+ "node-opcua-hostname": "2.64.1",
38
+ "node-opcua-nodeid": "2.64.1",
39
+ "node-opcua-nodesets": "2.64.1",
40
+ "node-opcua-numeric-range": "2.64.1",
41
+ "node-opcua-object-registry": "2.64.1",
42
+ "node-opcua-pki": "^2.14.0",
43
+ "node-opcua-secure-channel": "2.64.1",
44
+ "node-opcua-service-browse": "2.64.1",
45
+ "node-opcua-service-call": "2.64.1",
46
+ "node-opcua-service-discovery": "2.64.1",
47
+ "node-opcua-service-endpoints": "2.64.1",
48
+ "node-opcua-service-filter": "2.64.1",
49
+ "node-opcua-service-history": "2.64.1",
50
+ "node-opcua-service-node-management": "2.64.1",
51
+ "node-opcua-service-query": "2.64.1",
52
+ "node-opcua-service-read": "2.64.1",
53
+ "node-opcua-service-register-node": "2.64.1",
54
+ "node-opcua-service-secure-channel": "2.64.1",
55
+ "node-opcua-service-session": "2.64.1",
56
+ "node-opcua-service-subscription": "2.64.1",
57
+ "node-opcua-service-translate-browse-path": "2.64.1",
58
+ "node-opcua-service-write": "2.64.1",
59
+ "node-opcua-status-code": "2.64.1",
60
+ "node-opcua-types": "2.64.1",
61
+ "node-opcua-utils": "2.64.1",
62
+ "node-opcua-variant": "2.64.1"
63
+ },
64
+ "devDependencies": {
65
+ "node-opcua-data-access": "2.64.1",
66
+ "node-opcua-leak-detector": "2.64.1",
67
+ "node-opcua-test-helpers": "2.64.1",
68
+ "node-opcua-transport": "2.64.1",
69
+ "should": "^13.2.3",
70
+ "sinon": "^13.0.1"
71
+ },
72
+ "author": "Etienne Rossignon",
73
+ "license": "MIT",
74
+ "repository": {
75
+ "type": "git",
76
+ "url": "git://github.com/node-opcua/node-opcua.git"
77
+ },
78
+ "keywords": [
79
+ "OPCUA",
80
+ "opcua",
81
+ "m2m",
82
+ "iot",
83
+ "opc ua",
84
+ "internet of things"
85
+ ],
86
+ "homepage": "http://node-opcua.github.io/",
87
+ "gitHead": "b65b8738603cd475d7d99a2b20b0ae9d32b4110c"
88
+ }
@@ -43,7 +43,9 @@ import {
43
43
  import { getDefaultCertificateManager, OPCUACertificateManager } from "node-opcua-certificate-manager";
44
44
  import { ServerState } from "node-opcua-common";
45
45
  import { Certificate, exploreCertificate, makeSHA1Thumbprint, Nonce, toPem } from "node-opcua-crypto";
46
- import { AttributeIds, LocalizedText, NodeClass } from "node-opcua-data-model";
46
+ import {
47
+ AttributeIds, DiagnosticInfo, filterDiagnosticInfoLevel, filterDiagnosticOperationLevel, filterDiagnosticServiceLevel, LocalizedText, NodeClass, RESPONSE_DIAGNOSTICS_MASK_ALL
48
+ } from "node-opcua-data-model";
47
49
  import { DataValue } from "node-opcua-data-value";
48
50
  import { dump, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
49
51
  import { NodeId } from "node-opcua-nodeid";
@@ -677,6 +679,30 @@ function validate_security_endpoint(
677
679
  return { errCode: StatusCodes.Good, endpoint: endpoints_matching_security_policy[0] };
678
680
  }
679
681
 
682
+ export function filterDiagnosticInfo(returnDiagnostics: number, response: CallResponse): void {
683
+ if (RESPONSE_DIAGNOSTICS_MASK_ALL & returnDiagnostics) {
684
+ response.responseHeader.serviceDiagnostics = filterDiagnosticServiceLevel(returnDiagnostics, response.responseHeader.serviceDiagnostics);
685
+
686
+ if (response.diagnosticInfos && response.diagnosticInfos.length > 0) {
687
+ response.diagnosticInfos = response.diagnosticInfos.map((d) => filterDiagnosticOperationLevel(returnDiagnostics, d));
688
+ } else {
689
+ response.diagnosticInfos = [];
690
+ }
691
+
692
+ if (response.results) {
693
+ for (const entry of response.results) {
694
+ if (entry.inputArgumentDiagnosticInfos && entry.inputArgumentDiagnosticInfos.length > 0) {
695
+ entry.inputArgumentDiagnosticInfos = entry.inputArgumentDiagnosticInfos.map(
696
+ (d) => filterDiagnosticOperationLevel(returnDiagnostics, d)
697
+ );
698
+ } else {
699
+ entry.inputArgumentDiagnosticInfos = [];
700
+ }
701
+ }
702
+ }
703
+ }
704
+ }
705
+
680
706
  export enum RegisterServerMethod {
681
707
  HIDDEN = 1, // the server doesn't expose itself to the external world
682
708
  MDNS = 2, // the server publish itself to the mDNS Multicast network directly
@@ -3339,6 +3365,7 @@ export class OPCUAServer extends OPCUABaseServer {
3339
3365
  response = new CallResponse({
3340
3366
  results: results as CallMethodResultOptions[]
3341
3367
  });
3368
+ filterDiagnosticInfo(request.requestHeader.returnDiagnostics, response);
3342
3369
  sendResponse(response);
3343
3370
  }
3344
3371
  );