node-opcua-server 2.76.1 → 2.76.2

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 (59) hide show
  1. package/dist/base_server.d.ts +110 -110
  2. package/dist/base_server.js +473 -473
  3. package/dist/factory.d.ts +12 -12
  4. package/dist/factory.js +23 -23
  5. package/dist/filter/check_where_clause_on_address_space.d.ts +3 -3
  6. package/dist/filter/check_where_clause_on_address_space.js +22 -22
  7. package/dist/filter/extract_event_fields.d.ts +10 -10
  8. package/dist/filter/extract_event_fields.js +17 -17
  9. package/dist/helper.d.ts +10 -10
  10. package/dist/helper.js +75 -75
  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 +16 -16
  22. package/dist/index.js +32 -32
  23. package/dist/monitored_item.d.ts +177 -177
  24. package/dist/monitored_item.js +1001 -1001
  25. package/dist/node_sampler.d.ts +3 -3
  26. package/dist/node_sampler.js +75 -75
  27. package/dist/opcua_server.d.ts +747 -747
  28. package/dist/opcua_server.js +2431 -2431
  29. package/dist/queue.d.ts +11 -11
  30. package/dist/queue.js +71 -71
  31. package/dist/register_server_manager.d.ts +96 -96
  32. package/dist/register_server_manager.js +584 -584
  33. package/dist/register_server_manager_hidden.d.ts +17 -17
  34. package/dist/register_server_manager_hidden.js +27 -27
  35. package/dist/register_server_manager_mdns_only.d.ts +22 -22
  36. package/dist/register_server_manager_mdns_only.js +55 -55
  37. package/dist/server_capabilities.d.ts +148 -148
  38. package/dist/server_capabilities.js +92 -92
  39. package/dist/server_end_point.d.ts +183 -183
  40. package/dist/server_end_point.js +817 -817
  41. package/dist/server_engine.d.ts +317 -317
  42. package/dist/server_engine.js +1716 -1716
  43. package/dist/server_publish_engine.d.ts +113 -113
  44. package/dist/server_publish_engine.js +541 -541
  45. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
  46. package/dist/server_publish_engine_for_orphan_subscriptions.js +51 -51
  47. package/dist/server_session.d.ts +182 -182
  48. package/dist/server_session.js +739 -739
  49. package/dist/server_subscription.d.ts +421 -421
  50. package/dist/server_subscription.js +1346 -1346
  51. package/dist/sessions_compatible_for_transfer.d.ts +2 -2
  52. package/dist/sessions_compatible_for_transfer.js +39 -39
  53. package/dist/user_manager.d.ts +32 -32
  54. package/dist/user_manager.js +74 -74
  55. package/dist/user_manager_ua.d.ts +3 -3
  56. package/dist/user_manager_ua.js +39 -39
  57. package/dist/validate_filter.d.ts +5 -5
  58. package/dist/validate_filter.js +60 -60
  59. package/package.json +42 -41
@@ -1,2 +1,2 @@
1
- import { ServerSession } from "./server_session";
2
- export declare function sessionsCompatibleForTransfer(sessionSrc: ServerSession | undefined, sessionDest: ServerSession): boolean;
1
+ import { ServerSession } from "./server_session";
2
+ export declare function sessionsCompatibleForTransfer(sessionSrc: ServerSession | undefined, sessionDest: ServerSession): boolean;
@@ -1,40 +1,40 @@
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
- if (!sessionSrc) {
8
- return true;
9
- }
10
- (0, node_opcua_assert_1.assert)(sessionDest);
11
- (0, node_opcua_assert_1.assert)(sessionSrc);
12
- if (!sessionSrc.userIdentityToken && !sessionDest.userIdentityToken) {
13
- return true;
14
- }
15
- if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken) {
16
- if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken)) {
17
- return false;
18
- }
19
- return true;
20
- }
21
- else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken) {
22
- if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken)) {
23
- return false;
24
- }
25
- return sessionSrc.userIdentityToken.userName === sessionDest.userIdentityToken.userName;
26
- }
27
- // istanbul ignore else
28
- else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken) {
29
- if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken)) {
30
- return false;
31
- }
32
- return (sessionSrc.userIdentityToken.certificateData.toString("hex") ===
33
- sessionDest.userIdentityToken.certificateData.toString("hex"));
34
- }
35
- else {
36
- throw new Error("Unsupported Identity token");
37
- }
38
- }
39
- 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
+ if (!sessionSrc) {
8
+ return true;
9
+ }
10
+ (0, node_opcua_assert_1.assert)(sessionDest);
11
+ (0, node_opcua_assert_1.assert)(sessionSrc);
12
+ if (!sessionSrc.userIdentityToken && !sessionDest.userIdentityToken) {
13
+ return true;
14
+ }
15
+ if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken) {
16
+ if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.AnonymousIdentityToken)) {
17
+ return false;
18
+ }
19
+ return true;
20
+ }
21
+ else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken) {
22
+ if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.UserNameIdentityToken)) {
23
+ return false;
24
+ }
25
+ return sessionSrc.userIdentityToken.userName === sessionDest.userIdentityToken.userName;
26
+ }
27
+ // istanbul ignore else
28
+ else if (sessionSrc.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken) {
29
+ if (!(sessionDest.userIdentityToken instanceof node_opcua_types_1.X509IdentityToken)) {
30
+ return false;
31
+ }
32
+ return (sessionSrc.userIdentityToken.certificateData.toString("hex") ===
33
+ sessionDest.userIdentityToken.certificateData.toString("hex"));
34
+ }
35
+ else {
36
+ throw new Error("Unsupported Identity token");
37
+ }
38
+ }
39
+ exports.sessionsCompatibleForTransfer = sessionsCompatibleForTransfer;
40
40
  //# sourceMappingURL=sessions_compatible_for_transfer.js.map
@@ -1,32 +1,32 @@
1
- import { IUserManager, UARoleSet } from "node-opcua-address-space";
2
- import { NodeId } from "node-opcua-nodeid";
3
- import { IdentityMappingRuleType } from "node-opcua-types";
4
- import { ServerSession } from "./server_session";
5
- export declare type ValidUserFunc = (this: ServerSession, username: string, password: string) => boolean;
6
- export declare type ValidUserAsyncFunc = (this: ServerSession, username: string, password: string, callback: (err: Error | null, isAuthorized?: boolean) => void) => void;
7
- export interface IUserManagerEx extends IUserManager {
8
- /** synchronous function to check the credentials - can be overruled by isValidUserAsync */
9
- isValidUser?: ValidUserFunc;
10
- /** asynchronous function to check if the credentials - overrules isValidUser */
11
- isValidUserAsync?: ValidUserAsyncFunc;
12
- }
13
- export declare type UserManagerOptions = IUserManagerEx | UAUserManagerBase;
14
- export interface IUAUserManager extends IUserManager {
15
- getUserRoles(user: string): NodeId[];
16
- isValidUser(session: ServerSession, username: string, password: string): Promise<boolean>;
17
- getIdentitiesForRole(role: NodeId): IdentityMappingRuleType[];
18
- }
19
- export declare abstract class UAUserManagerBase implements IUAUserManager {
20
- getUserRoles(user: string): NodeId[];
21
- isValidUser(session: ServerSession, username: string, password: string): Promise<boolean>;
22
- getIdentitiesForRole(role: NodeId): IdentityMappingRuleType[];
23
- bind(roleSet: UARoleSet): void;
24
- }
25
- export declare class UAUserManager1 extends UAUserManagerBase {
26
- private options;
27
- constructor(options: IUserManagerEx);
28
- getUserRoles(user: string): NodeId[];
29
- isValidUser(session: ServerSession, username: string, password: string): Promise<boolean>;
30
- getIdentitiesForRole(role: NodeId): IdentityMappingRuleType[];
31
- }
32
- export declare function makeUserManager(options?: UserManagerOptions): UAUserManagerBase;
1
+ import { IUserManager, UARoleSet } from "node-opcua-address-space";
2
+ import { NodeId } from "node-opcua-nodeid";
3
+ import { IdentityMappingRuleType } from "node-opcua-types";
4
+ import { ServerSession } from "./server_session";
5
+ export declare type ValidUserFunc = (this: ServerSession, username: string, password: string) => boolean;
6
+ export declare type ValidUserAsyncFunc = (this: ServerSession, username: string, password: string, callback: (err: Error | null, isAuthorized?: boolean) => void) => void;
7
+ export interface IUserManagerEx extends IUserManager {
8
+ /** synchronous function to check the credentials - can be overruled by isValidUserAsync */
9
+ isValidUser?: ValidUserFunc;
10
+ /** asynchronous function to check if the credentials - overrules isValidUser */
11
+ isValidUserAsync?: ValidUserAsyncFunc;
12
+ }
13
+ export declare type UserManagerOptions = IUserManagerEx | UAUserManagerBase;
14
+ export interface IUAUserManager extends IUserManager {
15
+ getUserRoles(user: string): NodeId[];
16
+ isValidUser(session: ServerSession, username: string, password: string): Promise<boolean>;
17
+ getIdentitiesForRole(role: NodeId): IdentityMappingRuleType[];
18
+ }
19
+ export declare abstract class UAUserManagerBase implements IUAUserManager {
20
+ getUserRoles(user: string): NodeId[];
21
+ isValidUser(session: ServerSession, username: string, password: string): Promise<boolean>;
22
+ getIdentitiesForRole(role: NodeId): IdentityMappingRuleType[];
23
+ bind(roleSet: UARoleSet): void;
24
+ }
25
+ export declare class UAUserManager1 extends UAUserManagerBase {
26
+ private options;
27
+ constructor(options: IUserManagerEx);
28
+ getUserRoles(user: string): NodeId[];
29
+ isValidUser(session: ServerSession, username: string, password: string): Promise<boolean>;
30
+ getIdentitiesForRole(role: NodeId): IdentityMappingRuleType[];
31
+ }
32
+ export declare function makeUserManager(options?: UserManagerOptions): UAUserManagerBase;
@@ -1,75 +1,75 @@
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.makeUserManager = exports.UAUserManager1 = exports.UAUserManagerBase = void 0;
13
- class UAUserManagerBase {
14
- getUserRoles(user) {
15
- throw new Error("Method not implemented.");
16
- }
17
- isValidUser(session, username, password) {
18
- throw new Error("Method not implemented.");
19
- }
20
- getIdentitiesForRole(role) {
21
- return [];
22
- }
23
- bind(roleSet) {
24
- /** */
25
- }
26
- }
27
- exports.UAUserManagerBase = UAUserManagerBase;
28
- class UAUserManager1 extends UAUserManagerBase {
29
- constructor(options) {
30
- super();
31
- this.options = options;
32
- }
33
- getUserRoles(user) {
34
- return this.options.getUserRoles != null ? this.options.getUserRoles(user) : [];
35
- }
36
- isValidUser(session, username, password) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- if (typeof this.options.isValidUserAsync === "function") {
39
- return new Promise((resolve, reject) => {
40
- var _a;
41
- (_a = this.options.isValidUserAsync) === null || _a === void 0 ? void 0 : _a.call(session, username, password, (err, isAuthorized) => {
42
- if (err)
43
- return reject();
44
- resolve(isAuthorized);
45
- });
46
- });
47
- }
48
- else if (typeof this.options.isValidUser === "function") {
49
- const authorized = this.options.isValidUser.call(session, username, password);
50
- return authorized;
51
- }
52
- else {
53
- return false;
54
- }
55
- });
56
- }
57
- getIdentitiesForRole(role) {
58
- return [];
59
- }
60
- }
61
- exports.UAUserManager1 = UAUserManager1;
62
- function makeUserManager(options) {
63
- if (options instanceof UAUserManagerBase) {
64
- return options;
65
- }
66
- options = options || {};
67
- if (typeof options.isValidUser !== "function") {
68
- options.isValidUser = ( /*userName,password*/) => {
69
- return false;
70
- };
71
- }
72
- return new UAUserManager1(options);
73
- }
74
- exports.makeUserManager = makeUserManager;
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.makeUserManager = exports.UAUserManager1 = exports.UAUserManagerBase = void 0;
13
+ class UAUserManagerBase {
14
+ getUserRoles(user) {
15
+ throw new Error("Method not implemented.");
16
+ }
17
+ isValidUser(session, username, password) {
18
+ throw new Error("Method not implemented.");
19
+ }
20
+ getIdentitiesForRole(role) {
21
+ return [];
22
+ }
23
+ bind(roleSet) {
24
+ /** */
25
+ }
26
+ }
27
+ exports.UAUserManagerBase = UAUserManagerBase;
28
+ class UAUserManager1 extends UAUserManagerBase {
29
+ constructor(options) {
30
+ super();
31
+ this.options = options;
32
+ }
33
+ getUserRoles(user) {
34
+ return this.options.getUserRoles != null ? this.options.getUserRoles(user) : [];
35
+ }
36
+ isValidUser(session, username, password) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (typeof this.options.isValidUserAsync === "function") {
39
+ return new Promise((resolve, reject) => {
40
+ var _a;
41
+ (_a = this.options.isValidUserAsync) === null || _a === void 0 ? void 0 : _a.call(session, username, password, (err, isAuthorized) => {
42
+ if (err)
43
+ return reject();
44
+ resolve(isAuthorized);
45
+ });
46
+ });
47
+ }
48
+ else if (typeof this.options.isValidUser === "function") {
49
+ const authorized = this.options.isValidUser.call(session, username, password);
50
+ return authorized;
51
+ }
52
+ else {
53
+ return false;
54
+ }
55
+ });
56
+ }
57
+ getIdentitiesForRole(role) {
58
+ return [];
59
+ }
60
+ }
61
+ exports.UAUserManager1 = UAUserManager1;
62
+ function makeUserManager(options) {
63
+ if (options instanceof UAUserManagerBase) {
64
+ return options;
65
+ }
66
+ options = options || {};
67
+ if (typeof options.isValidUser !== "function") {
68
+ options.isValidUser = ( /*userName,password*/) => {
69
+ return false;
70
+ };
71
+ }
72
+ return new UAUserManager1(options);
73
+ }
74
+ exports.makeUserManager = makeUserManager;
75
75
  //# sourceMappingURL=user_manager.js.map
@@ -1,3 +1,3 @@
1
- import { IAddressSpace } from "node-opcua-address-space";
2
- import { UAUserManagerBase } from "./user_manager";
3
- export declare function bindRoleSet(userManager: UAUserManagerBase, addressSpace: IAddressSpace): void;
1
+ import { IAddressSpace } from "node-opcua-address-space";
2
+ import { UAUserManagerBase } from "./user_manager";
3
+ export declare function bindRoleSet(userManager: UAUserManagerBase, addressSpace: IAddressSpace): void;
@@ -1,40 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bindRoleSet = void 0;
4
- const node_opcua_constants_1 = require("node-opcua-constants");
5
- const node_opcua_address_space_1 = require("node-opcua-address-space");
6
- const node_opcua_variant_1 = require("node-opcua-variant");
7
- const node_opcua_data_model_1 = require("node-opcua-data-model");
8
- function bindRoleSet(userManager, addressSpace) {
9
- var _a;
10
- const roleSet = addressSpace.findNode(node_opcua_constants_1.ObjectIds.Server_ServerCapabilities_RoleSet);
11
- if (!roleSet)
12
- return;
13
- const components = roleSet.getComponents();
14
- for (const component of components) {
15
- (0, node_opcua_address_space_1.ensureObjectIsSecure)(component);
16
- if (component.nodeClass !== node_opcua_data_model_1.NodeClass.Object) {
17
- continue;
18
- }
19
- const o = component;
20
- if (o.typeDefinitionObj.browseName.name !== "RoleType") {
21
- continue;
22
- }
23
- const roleType = o;
24
- const roleTypeProperties = roleType.findReferencesAsObject("HasChild", false);
25
- for (const roleTypeProp of roleTypeProperties) {
26
- (0, node_opcua_address_space_1.ensureObjectIsSecure)(roleTypeProp);
27
- }
28
- roleType.identities.setValueFromSource({ dataType: node_opcua_variant_1.DataType.ExtensionObject, value: [] });
29
- (_a = roleType.endpoints) === null || _a === void 0 ? void 0 : _a.setValueFromSource({ dataType: node_opcua_variant_1.DataType.ExtensionObject, value: [] });
30
- roleType.identities.bindVariable({
31
- get: () => {
32
- const identities = userManager.getIdentitiesForRole(roleType.nodeId);
33
- return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.ExtensionObject, value: identities });
34
- }
35
- }, true);
36
- }
37
- userManager.bind(roleSet);
38
- }
39
- exports.bindRoleSet = bindRoleSet;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bindRoleSet = void 0;
4
+ const node_opcua_constants_1 = require("node-opcua-constants");
5
+ const node_opcua_address_space_1 = require("node-opcua-address-space");
6
+ const node_opcua_variant_1 = require("node-opcua-variant");
7
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
8
+ function bindRoleSet(userManager, addressSpace) {
9
+ var _a;
10
+ const roleSet = addressSpace.findNode(node_opcua_constants_1.ObjectIds.Server_ServerCapabilities_RoleSet);
11
+ if (!roleSet)
12
+ return;
13
+ const components = roleSet.getComponents();
14
+ for (const component of components) {
15
+ (0, node_opcua_address_space_1.ensureObjectIsSecure)(component);
16
+ if (component.nodeClass !== node_opcua_data_model_1.NodeClass.Object) {
17
+ continue;
18
+ }
19
+ const o = component;
20
+ if (o.typeDefinitionObj.browseName.name !== "RoleType") {
21
+ continue;
22
+ }
23
+ const roleType = o;
24
+ const roleTypeProperties = roleType.findReferencesAsObject("HasChild", false);
25
+ for (const roleTypeProp of roleTypeProperties) {
26
+ (0, node_opcua_address_space_1.ensureObjectIsSecure)(roleTypeProp);
27
+ }
28
+ roleType.identities.setValueFromSource({ dataType: node_opcua_variant_1.DataType.ExtensionObject, value: [] });
29
+ (_a = roleType.endpoints) === null || _a === void 0 ? void 0 : _a.setValueFromSource({ dataType: node_opcua_variant_1.DataType.ExtensionObject, value: [] });
30
+ roleType.identities.bindVariable({
31
+ get: () => {
32
+ const identities = userManager.getIdentitiesForRole(roleType.nodeId);
33
+ return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.ExtensionObject, value: identities });
34
+ }
35
+ }, true);
36
+ }
37
+ userManager.bind(roleSet);
38
+ }
39
+ exports.bindRoleSet = bindRoleSet;
40
40
  //# sourceMappingURL=user_manager_ua.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,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-server",
3
- "version": "2.76.1",
3
+ "version": "2.76.2",
4
4
  "description": "pure nodejs OPCUA SDK - module -server",
5
5
  "scripts": {
6
6
  "build": "tsc -b",
@@ -17,53 +17,54 @@
17
17
  "chalk": "4.1.2",
18
18
  "dequeue": "^1.0.5",
19
19
  "lodash": "4.17.21",
20
- "node-opcua-address-space": "2.76.1",
21
- "node-opcua-address-space-base": "2.76.0",
20
+ "node-opcua-address-space": "2.76.2",
21
+ "node-opcua-address-space-base": "2.76.2",
22
22
  "node-opcua-assert": "2.76.0",
23
- "node-opcua-basic-types": "2.76.0",
24
- "node-opcua-binary-stream": "2.76.0",
25
- "node-opcua-certificate-manager": "2.76.0",
26
- "node-opcua-client": "2.76.1",
27
- "node-opcua-client-dynamic-extension-object": "2.76.0",
28
- "node-opcua-common": "2.76.0",
23
+ "node-opcua-basic-types": "2.76.2",
24
+ "node-opcua-binary-stream": "2.76.2",
25
+ "node-opcua-certificate-manager": "2.76.2",
26
+ "node-opcua-client": "2.76.2",
27
+ "node-opcua-client-dynamic-extension-object": "2.76.2",
28
+ "node-opcua-common": "2.76.2",
29
29
  "node-opcua-constants": "2.74.0",
30
30
  "node-opcua-crypto": "^1.11.0",
31
- "node-opcua-data-access": "2.76.0",
32
- "node-opcua-data-model": "2.76.0",
33
- "node-opcua-data-value": "2.76.0",
34
- "node-opcua-date-time": "2.76.0",
35
- "node-opcua-debug": "2.76.0",
36
- "node-opcua-extension-object": "2.76.0",
37
- "node-opcua-factory": "2.76.0",
38
- "node-opcua-hostname": "2.76.0",
39
- "node-opcua-nodeid": "2.76.0",
31
+ "node-opcua-data-model": "2.76.2",
32
+ "node-opcua-data-value": "2.76.2",
33
+ "node-opcua-date-time": "2.76.2",
34
+ "node-opcua-debug": "2.76.2",
35
+ "node-opcua-extension-object": "2.76.2",
36
+ "node-opcua-factory": "2.76.2",
37
+ "node-opcua-hostname": "2.76.2",
38
+ "node-opcua-nodeid": "2.76.2",
40
39
  "node-opcua-nodesets": "2.74.0",
41
- "node-opcua-numeric-range": "2.76.0",
42
- "node-opcua-object-registry": "2.76.0",
43
- "node-opcua-secure-channel": "2.76.0",
44
- "node-opcua-service-browse": "2.76.0",
45
- "node-opcua-service-call": "2.76.0",
46
- "node-opcua-service-discovery": "2.76.0",
47
- "node-opcua-service-endpoints": "2.76.0",
48
- "node-opcua-service-filter": "2.76.0",
49
- "node-opcua-service-history": "2.76.0",
50
- "node-opcua-service-node-management": "2.76.0",
51
- "node-opcua-service-query": "2.76.0",
52
- "node-opcua-service-read": "2.76.0",
53
- "node-opcua-service-register-node": "2.76.0",
54
- "node-opcua-service-secure-channel": "2.76.0",
55
- "node-opcua-service-session": "2.76.0",
56
- "node-opcua-service-subscription": "2.76.0",
57
- "node-opcua-service-translate-browse-path": "2.76.0",
58
- "node-opcua-service-write": "2.76.0",
59
- "node-opcua-status-code": "2.76.0",
60
- "node-opcua-types": "2.76.0",
40
+ "node-opcua-numeric-range": "2.76.2",
41
+ "node-opcua-object-registry": "2.76.2",
42
+ "node-opcua-secure-channel": "2.76.2",
43
+ "node-opcua-service-browse": "2.76.2",
44
+ "node-opcua-service-call": "2.76.2",
45
+ "node-opcua-service-discovery": "2.76.2",
46
+ "node-opcua-service-endpoints": "2.76.2",
47
+ "node-opcua-service-filter": "2.76.2",
48
+ "node-opcua-service-history": "2.76.2",
49
+ "node-opcua-service-node-management": "2.76.2",
50
+ "node-opcua-service-query": "2.76.2",
51
+ "node-opcua-service-read": "2.76.2",
52
+ "node-opcua-service-register-node": "2.76.2",
53
+ "node-opcua-service-secure-channel": "2.76.2",
54
+ "node-opcua-service-session": "2.76.2",
55
+ "node-opcua-service-subscription": "2.76.2",
56
+ "node-opcua-service-translate-browse-path": "2.76.2",
57
+ "node-opcua-service-write": "2.76.2",
58
+ "node-opcua-status-code": "2.76.2",
59
+ "node-opcua-types": "2.76.2",
61
60
  "node-opcua-utils": "2.76.0",
62
- "node-opcua-variant": "2.76.0",
61
+ "node-opcua-variant": "2.76.2",
63
62
  "thenify": "^3.3.1"
64
63
  },
65
64
  "devDependencies": {
66
- "node-opcua-leak-detector": "2.76.0",
65
+ "node-opcua-data-access": "2.76.2",
66
+ "node-opcua-leak-detector": "2.76.2",
67
+ "node-opcua-pki": "^2.17.0",
67
68
  "node-opcua-test-helpers": "2.74.0",
68
69
  "should": "^13.2.3",
69
70
  "sinon": "^14.0.0",
@@ -84,5 +85,5 @@
84
85
  "internet of things"
85
86
  ],
86
87
  "homepage": "http://node-opcua.github.io/",
87
- "gitHead": "d87d1dc4ab8f153a442f83552e3264621f0a409b"
88
+ "gitHead": "acb5ecaf1e1c71af3b63e80909d58447f3f298e7"
88
89
  }