node-opcua-server 2.64.1 → 2.65.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 (57) 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/history_server_capabilities.d.ts +35 -35
  6. package/dist/history_server_capabilities.js +43 -43
  7. package/dist/i_channel_data.d.ts +13 -13
  8. package/dist/i_channel_data.js +2 -2
  9. package/dist/i_register_server_manager.d.ts +16 -16
  10. package/dist/i_register_server_manager.js +2 -2
  11. package/dist/i_server_side_publish_engine.d.ts +36 -36
  12. package/dist/i_server_side_publish_engine.js +49 -49
  13. package/dist/i_socket_data.d.ts +11 -11
  14. package/dist/i_socket_data.js +2 -2
  15. package/dist/index.d.ts +14 -14
  16. package/dist/index.js +26 -26
  17. package/dist/monitored_item.d.ts +176 -176
  18. package/dist/monitored_item.js +998 -998
  19. package/dist/node_sampler.d.ts +3 -3
  20. package/dist/node_sampler.js +75 -75
  21. package/dist/opcua_server.d.ts +654 -654
  22. package/dist/opcua_server.js +2389 -2389
  23. package/dist/opcua_server.js.map +1 -1
  24. package/dist/queue.d.ts +11 -11
  25. package/dist/queue.js +71 -71
  26. package/dist/register_server_manager.d.ts +95 -95
  27. package/dist/register_server_manager.js +584 -584
  28. package/dist/register_server_manager_hidden.d.ts +17 -17
  29. package/dist/register_server_manager_hidden.js +27 -27
  30. package/dist/register_server_manager_mdns_only.d.ts +22 -22
  31. package/dist/register_server_manager_mdns_only.js +57 -57
  32. package/dist/server_capabilities.d.ts +61 -61
  33. package/dist/server_capabilities.js +108 -108
  34. package/dist/server_end_point.d.ts +183 -183
  35. package/dist/server_end_point.js +816 -816
  36. package/dist/server_engine.d.ts +315 -315
  37. package/dist/server_engine.js +1678 -1678
  38. package/dist/server_publish_engine.d.ts +112 -112
  39. package/dist/server_publish_engine.js +530 -530
  40. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +16 -16
  41. package/dist/server_publish_engine_for_orphan_subscriptions.js +49 -49
  42. package/dist/server_session.d.ts +180 -180
  43. package/dist/server_session.js +737 -737
  44. package/dist/server_subscription.d.ts +395 -395
  45. package/dist/server_subscription.js +1316 -1316
  46. package/dist/sessions_compatible_for_transfer.d.ts +2 -2
  47. package/dist/sessions_compatible_for_transfer.js +36 -36
  48. package/dist/validate_filter.d.ts +5 -5
  49. package/dist/validate_filter.js +60 -60
  50. package/package.json +27 -27
  51. package/source/opcua_server.ts +1 -1
  52. package/dist/I_register_server_manager.d.ts +0 -15
  53. package/dist/I_register_server_manager.js +0 -3
  54. package/dist/I_register_server_manager.js.map +0 -1
  55. package/dist/continuation_point_manager.d.ts +0 -18
  56. package/dist/continuation_point_manager.js +0 -84
  57. package/dist/continuation_point_manager.js.map +0 -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,6 +1,6 @@
1
1
  {
2
2
  "name": "node-opcua-server",
3
- "version": "2.64.1",
3
+ "version": "2.65.0",
4
4
  "description": "pure nodejs OPCUA SDK - module -server",
5
5
  "scripts": {
6
6
  "build": "tsc -b",
@@ -18,13 +18,13 @@
18
18
  "bonjour": "^3.5.0",
19
19
  "dequeue": "^1.0.5",
20
20
  "lodash": "4.17.21",
21
- "node-opcua-address-space": "2.64.1",
21
+ "node-opcua-address-space": "2.65.0",
22
22
  "node-opcua-assert": "2.64.1",
23
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",
24
+ "node-opcua-certificate-manager": "2.65.0",
25
+ "node-opcua-client": "2.65.0",
26
+ "node-opcua-client-dynamic-extension-object": "2.65.0",
27
+ "node-opcua-common": "2.65.0",
28
28
  "node-opcua-constants": "2.64.1",
29
29
  "node-opcua-crypto": "^1.9.0",
30
30
  "node-opcua-data-model": "2.64.1",
@@ -39,33 +39,33 @@
39
39
  "node-opcua-nodesets": "2.64.1",
40
40
  "node-opcua-numeric-range": "2.64.1",
41
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",
42
+ "node-opcua-pki": "^2.14.1",
43
+ "node-opcua-secure-channel": "2.65.0",
44
+ "node-opcua-service-browse": "2.65.0",
45
+ "node-opcua-service-call": "2.65.0",
46
+ "node-opcua-service-discovery": "2.65.0",
47
+ "node-opcua-service-endpoints": "2.65.0",
48
+ "node-opcua-service-filter": "2.65.0",
49
+ "node-opcua-service-history": "2.65.0",
50
+ "node-opcua-service-node-management": "2.65.0",
51
+ "node-opcua-service-query": "2.65.0",
52
+ "node-opcua-service-read": "2.65.0",
53
+ "node-opcua-service-register-node": "2.65.0",
54
+ "node-opcua-service-secure-channel": "2.65.0",
55
+ "node-opcua-service-session": "2.65.0",
56
+ "node-opcua-service-subscription": "2.65.0",
57
+ "node-opcua-service-translate-browse-path": "2.65.0",
58
+ "node-opcua-service-write": "2.65.0",
59
59
  "node-opcua-status-code": "2.64.1",
60
- "node-opcua-types": "2.64.1",
60
+ "node-opcua-types": "2.65.0",
61
61
  "node-opcua-utils": "2.64.1",
62
62
  "node-opcua-variant": "2.64.1"
63
63
  },
64
64
  "devDependencies": {
65
- "node-opcua-data-access": "2.64.1",
65
+ "node-opcua-data-access": "2.65.0",
66
66
  "node-opcua-leak-detector": "2.64.1",
67
67
  "node-opcua-test-helpers": "2.64.1",
68
- "node-opcua-transport": "2.64.1",
68
+ "node-opcua-transport": "2.65.0",
69
69
  "should": "^13.2.3",
70
70
  "sinon": "^13.0.1"
71
71
  },
@@ -84,5 +84,5 @@
84
84
  "internet of things"
85
85
  ],
86
86
  "homepage": "http://node-opcua.github.io/",
87
- "gitHead": "b65b8738603cd475d7d99a2b20b0ae9d32b4110c"
87
+ "gitHead": "59b9cae30fb45633ad501f9cf3b74fb9d05e8960"
88
88
  }
@@ -2185,7 +2185,7 @@ export class OPCUAServer extends OPCUABaseServer {
2185
2185
  // --- check that provided session matches session attached to channel
2186
2186
  if (channel.channelId !== session.channelId) {
2187
2187
  if (!(request instanceof ActivateSessionRequest)) {
2188
- errorLog(chalk.red.bgWhite("ERROR: channel.channelId !== session.channelId"), channel.channelId, session.channelId);
2188
+ errorLog(chalk.red.bgWhite("ERROR: channel.channelId !== session.channelId on processing request " + request.constructor.name), channel.channelId, session.channelId);
2189
2189
  }
2190
2190
  message.session_statusCode = StatusCodes.BadSecureChannelIdInvalid;
2191
2191
  } else if (channel_has_session(channel, session)) {
@@ -1,15 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-server
4
- */
5
- import { EventEmitter } from "events";
6
- export interface IRegisterServerManager extends EventEmitter {
7
- discoveryServerEndpointUrl: string;
8
- start(callback: (err?: Error) => void): void;
9
- stop(callback: (err?: Error) => void): void;
10
- dispose(): void;
11
- on(eventName: "serverRegistrationPending", eventHandler: () => void): this;
12
- on(eventName: "serverRegistered", eventHandler: () => void): this;
13
- on(eventName: "serverRegistrationRenewed", eventHandler: () => void): this;
14
- on(eventName: "serverUnregistered", eventHandler: () => void): this;
15
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=I_register_server_manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"I_register_server_manager.js","sourceRoot":"","sources":["../source/I_register_server_manager.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- import { ContinuationPoint } from "node-opcua-address-space";
5
- import { StatusCode } from "node-opcua-status-code";
6
- import { BrowseResultOptions, ReferenceDescription } from "node-opcua-types";
7
- export interface ContinuationPointInfo extends BrowseResultOptions {
8
- continuationPoint?: ContinuationPoint;
9
- references?: ReferenceDescription[];
10
- statusCode: StatusCode;
11
- }
12
- export declare class ContinuationPointManager {
13
- private readonly _map;
14
- constructor();
15
- register(maxElements: number, values: ReferenceDescription[]): ContinuationPointInfo;
16
- getNext(continuationPoint: ContinuationPoint): ContinuationPointInfo;
17
- cancel(continuationPoint: ContinuationPoint): ContinuationPointInfo;
18
- }
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_opcua_assert_1 = require("node-opcua-assert");
4
- const node_opcua_status_code_1 = require("node-opcua-status-code");
5
- let counter = 0;
6
- function make_key() {
7
- // return crypto.randomBytes(32);
8
- counter += 1;
9
- return Buffer.from(counter.toString(), "ascii");
10
- }
11
- class ContinuationPointManager {
12
- constructor() {
13
- this._map = {};
14
- }
15
- register(maxElements, values) {
16
- maxElements = maxElements || values.length;
17
- if (maxElements >= values.length) {
18
- return {
19
- continuationPoint: undefined,
20
- references: values,
21
- statusCode: node_opcua_status_code_1.StatusCodes.Good
22
- };
23
- }
24
- const key = make_key();
25
- const keyHash = key.toString("ascii");
26
- // split the array in two ( values)
27
- const current_block = values.splice(0, maxElements);
28
- const result = {
29
- continuationPoint: key,
30
- references: current_block,
31
- statusCode: node_opcua_status_code_1.StatusCodes.Good
32
- };
33
- // create
34
- const data = {
35
- maxElements,
36
- remainingElements: values
37
- };
38
- this._map[keyHash] = data;
39
- return result;
40
- }
41
- getNext(continuationPoint) {
42
- if (!continuationPoint) {
43
- return { statusCode: node_opcua_status_code_1.StatusCodes.BadContinuationPointInvalid };
44
- }
45
- const keyHash = continuationPoint.toString("ascii");
46
- const data = this._map[keyHash];
47
- if (!data) {
48
- return { statusCode: node_opcua_status_code_1.StatusCodes.BadContinuationPointInvalid };
49
- }
50
- node_opcua_assert_1.assert(data.maxElements > 0);
51
- // split the array in two ( values)
52
- const current_block = data.remainingElements.splice(0, data.maxElements);
53
- const result = {
54
- continuationPoint: data.remainingElements.length ? continuationPoint : undefined,
55
- references: current_block,
56
- statusCode: node_opcua_status_code_1.StatusCodes.Good
57
- };
58
- if (data.remainingElements.length === 0) {
59
- // we are done
60
- delete this._map[keyHash];
61
- }
62
- return result;
63
- }
64
- cancel(continuationPoint) {
65
- if (!continuationPoint) {
66
- return { statusCode: node_opcua_status_code_1.StatusCodes.BadContinuationPointInvalid };
67
- }
68
- const keyHash = continuationPoint.toString("ascii");
69
- const data = this._map[keyHash];
70
- if (!data) {
71
- return {
72
- continuationPoint: undefined,
73
- references: [],
74
- statusCode: node_opcua_status_code_1.StatusCodes.BadContinuationPointInvalid
75
- };
76
- }
77
- delete this._map[keyHash];
78
- return {
79
- statusCode: node_opcua_status_code_1.StatusCodes.Good
80
- };
81
- }
82
- }
83
- exports.ContinuationPointManager = ContinuationPointManager;
84
- //# sourceMappingURL=continuation_point_manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"continuation_point_manager.js","sourceRoot":"","sources":["../source/continuation_point_manager.ts"],"names":[],"mappings":";;AAIA,yDAA2C;AAC3C,mEAAiE;AAMjE,IAAI,OAAO,GAAG,CAAC,CAAC;AAEhB,SAAS,QAAQ;IACb,iCAAiC;IACjC,OAAO,IAAI,CAAC,CAAC;IACb,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAQD,MAAa,wBAAwB;IAIjC;QACI,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;IAEM,QAAQ,CAAC,WAAmB,EAAE,MAA8B;QAE/D,WAAW,GAAG,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC;QAC3C,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE;YAC9B,OAAO;gBACH,iBAAiB,EAAE,SAAS;gBAC5B,UAAU,EAAE,MAAM;gBAClB,UAAU,EAAE,oCAAW,CAAC,IAAI;aAC/B,CAAC;SACL;QAED,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEtC,mCAAmC;QACnC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;QAEpD,MAAM,MAAM,GAAG;YACX,iBAAiB,EAAE,GAAG;YACtB,UAAU,EAAE,aAAa;YACzB,UAAU,EAAE,oCAAW,CAAC,IAAI;SAC/B,CAAC;QAEF,SAAS;QACT,MAAM,IAAI,GAAG;YACT,WAAW;YACX,iBAAiB,EAAE,MAAM;SAC5B,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QAE1B,OAAO,MAAM,CAAC;IAElB,CAAC;IAEM,OAAO,CAAC,iBAAoC;QAE/C,IAAI,CAAC,iBAAiB,EAAE;YACpB,OAAO,EAAE,UAAU,EAAE,oCAAW,CAAC,2BAA2B,EAAE,CAAC;SAClE;QACD,MAAM,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE;YACP,OAAO,EAAE,UAAU,EAAE,oCAAW,CAAC,2BAA2B,EAAE,CAAC;SAClE;QACD,0BAAM,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;QAC7B,mCAAmC;QACnC,MAAM,aAAa,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEzE,MAAM,MAAM,GAAG;YACX,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;YAChF,UAAU,EAAE,aAAa;YACzB,UAAU,EAAE,oCAAW,CAAC,IAAI;SAC/B,CAAC;QACF,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YACrC,cAAc;YACd,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEM,MAAM,CAAC,iBAAoC;QAE9C,IAAI,CAAC,iBAAiB,EAAE;YACpB,OAAO,EAAE,UAAU,EAAE,oCAAW,CAAC,2BAA2B,EAAE,CAAC;SAClE;QAED,MAAM,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEpD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE;YACP,OAAO;gBACH,iBAAiB,EAAE,SAAS;gBAC5B,UAAU,EAAE,EAAE;gBACd,UAAU,EAAE,oCAAW,CAAC,2BAA2B;aACtD,CAAC;SACL;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO;YACH,UAAU,EAAE,oCAAW,CAAC,IAAI;SAC/B,CAAC;IACN,CAAC;CACJ;AA1FD,4DA0FC"}