node-opcua-client-proxy 2.97.0 → 2.98.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.
package/dist/proxy.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { NodeId } from "node-opcua-nodeid";
2
- export declare function makeRefId(referenceTypeName: string): NodeId;
1
+ import { NodeId } from "node-opcua-nodeid";
2
+ export declare function makeRefId(referenceTypeName: string): NodeId;
package/dist/proxy.js CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeRefId = void 0;
4
- /**
5
- * @module node-opcua-client-proxy
6
- */
7
- // tslint:disable:no-shadowed-variable
8
- const node_opcua_constants_1 = require("node-opcua-constants");
9
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
10
- function makeRefId(referenceTypeName) {
11
- const nodeId = (0, node_opcua_nodeid_1.makeNodeId)(node_opcua_constants_1.ReferenceTypeIds[referenceTypeName] || node_opcua_constants_1.ObjectTypeIds[referenceTypeName]);
12
- // istanbul ignore next
13
- if (nodeId.isEmpty()) {
14
- throw new Error("makeRefId: cannot find ReferenceTypeName + " + referenceTypeName);
15
- }
16
- return nodeId;
17
- }
18
- exports.makeRefId = makeRefId;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeRefId = void 0;
4
+ /**
5
+ * @module node-opcua-client-proxy
6
+ */
7
+ // tslint:disable:no-shadowed-variable
8
+ const node_opcua_constants_1 = require("node-opcua-constants");
9
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
10
+ function makeRefId(referenceTypeName) {
11
+ const nodeId = (0, node_opcua_nodeid_1.makeNodeId)(node_opcua_constants_1.ReferenceTypeIds[referenceTypeName] || node_opcua_constants_1.ObjectTypeIds[referenceTypeName]);
12
+ // istanbul ignore next
13
+ if (nodeId.isEmpty()) {
14
+ throw new Error("makeRefId: cannot find ReferenceTypeName + " + referenceTypeName);
15
+ }
16
+ return nodeId;
17
+ }
18
+ exports.makeRefId = makeRefId;
19
19
  //# sourceMappingURL=proxy.js.map
@@ -1,83 +1,83 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-client-proxy
4
- */
5
- import { EventEmitter } from "events";
6
- import { NodeClass } from "node-opcua-data-model";
7
- import { DataValue } from "node-opcua-data-value";
8
- import { NodeId } from "node-opcua-nodeid";
9
- import { Argument } from "node-opcua-service-call";
10
- import { DataType, Variant } from "node-opcua-variant";
11
- import { UAProxyManager } from "./proxy_manager";
12
- export interface ArgumentEx extends Argument {
13
- _basicDataType: DataType;
14
- }
15
- export interface MethodDescription {
16
- browseName: string;
17
- executableFlag: boolean;
18
- func: (input: Record<string, unknown>, callback: (err: Error | null, output?: Record<string, unknown>) => void) => void;
19
- nodeId: NodeId;
20
- inputArguments: ArgumentEx[];
21
- outputArguments: ArgumentEx[];
22
- }
23
- export declare class ProxyBaseNode extends EventEmitter {
24
- /**
25
- * the object nodeId
26
- * @property nodeId
27
- * @type {NodeId}
28
- */
29
- readonly nodeId: NodeId;
30
- /**
31
- * the object's components
32
- * @property $components
33
- * @type {Array<ProxyBaseNode>}
34
- */
35
- readonly $components: any[];
36
- /**
37
- * the object's properties
38
- * @property $properties
39
- * @type {Array<ProxyBaseNode>}
40
- */
41
- $properties: any[];
42
- /**
43
- * the object's properties
44
- * @property $methods
45
- * @type {Array<ProxyBaseNode>}
46
- */
47
- $methods: MethodDescription[];
48
- /**
49
- * the Folder's elements
50
- * @property $organizes
51
- * @type {Array<ProxyBaseNode>}
52
- */
53
- $organizes: any[];
54
- /**
55
- * the object's description
56
- * @property description
57
- * @type {String}
58
- */
59
- description: string;
60
- /**
61
- * the object's browseName
62
- * @property browseName
63
- * @type {String}
64
- */
65
- browseName: string;
66
- /**
67
- * the object's NodeClass
68
- * @property nodeClass
69
- * @type {NodeClass}
70
- */
71
- readonly nodeClass: NodeClass;
72
- private readonly proxyManager;
73
- constructor(proxyManager: UAProxyManager, nodeId: NodeId, nodeClass: NodeClass);
74
- /**
75
- * get a updated Value of the Variable , by using a ReadRequest
76
- */
77
- readValue(callback: (err: Error | null, variant?: Variant) => void): void;
78
- /**
79
- * set the Value of the Variable, by using a WriteRequest
80
- */
81
- writeValue(dataValue: DataValue, callback: (err?: Error) => void): void;
82
- toString(): string;
83
- }
1
+ /// <reference types="node" />
2
+ /**
3
+ * @module node-opcua-client-proxy
4
+ */
5
+ import { EventEmitter } from "events";
6
+ import { NodeClass } from "node-opcua-data-model";
7
+ import { DataValue } from "node-opcua-data-value";
8
+ import { NodeId } from "node-opcua-nodeid";
9
+ import { Argument } from "node-opcua-service-call";
10
+ import { DataType, Variant } from "node-opcua-variant";
11
+ import { UAProxyManager } from "./proxy_manager";
12
+ export interface ArgumentEx extends Argument {
13
+ _basicDataType: DataType;
14
+ }
15
+ export interface MethodDescription {
16
+ browseName: string;
17
+ executableFlag: boolean;
18
+ func: (input: Record<string, unknown>, callback: (err: Error | null, output?: Record<string, unknown>) => void) => void;
19
+ nodeId: NodeId;
20
+ inputArguments: ArgumentEx[];
21
+ outputArguments: ArgumentEx[];
22
+ }
23
+ export declare class ProxyBaseNode extends EventEmitter {
24
+ /**
25
+ * the object nodeId
26
+ * @property nodeId
27
+ * @type {NodeId}
28
+ */
29
+ readonly nodeId: NodeId;
30
+ /**
31
+ * the object's components
32
+ * @property $components
33
+ * @type {Array<ProxyBaseNode>}
34
+ */
35
+ readonly $components: any[];
36
+ /**
37
+ * the object's properties
38
+ * @property $properties
39
+ * @type {Array<ProxyBaseNode>}
40
+ */
41
+ $properties: any[];
42
+ /**
43
+ * the object's properties
44
+ * @property $methods
45
+ * @type {Array<ProxyBaseNode>}
46
+ */
47
+ $methods: MethodDescription[];
48
+ /**
49
+ * the Folder's elements
50
+ * @property $organizes
51
+ * @type {Array<ProxyBaseNode>}
52
+ */
53
+ $organizes: any[];
54
+ /**
55
+ * the object's description
56
+ * @property description
57
+ * @type {String}
58
+ */
59
+ description: string;
60
+ /**
61
+ * the object's browseName
62
+ * @property browseName
63
+ * @type {String}
64
+ */
65
+ browseName: string;
66
+ /**
67
+ * the object's NodeClass
68
+ * @property nodeClass
69
+ * @type {NodeClass}
70
+ */
71
+ readonly nodeClass: NodeClass;
72
+ private readonly proxyManager;
73
+ constructor(proxyManager: UAProxyManager, nodeId: NodeId, nodeClass: NodeClass);
74
+ /**
75
+ * get a updated Value of the Variable , by using a ReadRequest
76
+ */
77
+ readValue(callback: (err: Error | null, variant?: Variant) => void): void;
78
+ /**
79
+ * set the Value of the Variable, by using a WriteRequest
80
+ */
81
+ writeValue(dataValue: DataValue, callback: (err?: Error) => void): void;
82
+ toString(): string;
83
+ }
@@ -1,88 +1,88 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProxyBaseNode = void 0;
4
- /**
5
- * @module node-opcua-client-proxy
6
- */
7
- const events_1 = require("events");
8
- const node_opcua_assert_1 = require("node-opcua-assert");
9
- const node_opcua_data_model_1 = require("node-opcua-data-model");
10
- class ProxyBaseNode extends events_1.EventEmitter {
11
- constructor(proxyManager, nodeId, nodeClass) {
12
- super();
13
- this.nodeId = nodeId;
14
- this.proxyManager = proxyManager;
15
- (0, node_opcua_assert_1.assert)(this.proxyManager.session, "expecting valid session");
16
- Object.defineProperty(this, "proxyManager", {
17
- enumerable: false,
18
- writable: true
19
- });
20
- this.$components = [];
21
- this.$properties = [];
22
- this.$methods = [];
23
- this.$organizes = [];
24
- this.description = "";
25
- this.browseName = "";
26
- this.nodeClass = nodeClass;
27
- }
28
- /**
29
- * get a updated Value of the Variable , by using a ReadRequest
30
- */
31
- readValue(callback) {
32
- (0, node_opcua_assert_1.assert)(this.proxyManager);
33
- const session = this.proxyManager.session;
34
- (0, node_opcua_assert_1.assert)(session);
35
- const nodeToRead = {
36
- attributeId: node_opcua_data_model_1.AttributeIds.Value,
37
- nodeId: this.nodeId
38
- };
39
- this.proxyManager.session.read(nodeToRead, (err, dataValue) => {
40
- // istanbul ignore next
41
- if (err) {
42
- return callback(err);
43
- }
44
- const data = dataValue.value;
45
- callback(null, data);
46
- });
47
- }
48
- /**
49
- * set the Value of the Variable, by using a WriteRequest
50
- */
51
- writeValue(dataValue, callback) {
52
- (0, node_opcua_assert_1.assert)(this.proxyManager);
53
- const session = this.proxyManager.session;
54
- (0, node_opcua_assert_1.assert)(session);
55
- const nodeToWrite = {
56
- attributeId: node_opcua_data_model_1.AttributeIds.Value,
57
- nodeId: this.nodeId,
58
- value: dataValue
59
- };
60
- this.proxyManager.session.write(nodeToWrite, (err, statusCode) => {
61
- // istanbul ignore next
62
- if (err) {
63
- return callback(err);
64
- }
65
- if (statusCode && statusCode.isNotGood()) {
66
- callback(new Error(statusCode.toString()));
67
- }
68
- else {
69
- callback();
70
- }
71
- });
72
- }
73
- toString() {
74
- const str = [];
75
- str.push(" ProxyObject ");
76
- str.push(" browseName : " + this.browseName.toString());
77
- // str.push(" typeDefinition : " + this.typeDefinition.toString());
78
- str.push(" $components# : " + this.$components.length.toString());
79
- str.push(" $properties# : " + this.$properties.length.toString());
80
- return str.join("\n");
81
- }
82
- }
83
- exports.ProxyBaseNode = ProxyBaseNode;
84
- // tslint:disable:no-var-requires
85
- const thenify = require("thenify");
86
- ProxyBaseNode.prototype.readValue = thenify.withCallback(ProxyBaseNode.prototype.readValue);
87
- ProxyBaseNode.prototype.writeValue = thenify.withCallback(ProxyBaseNode.prototype.writeValue);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProxyBaseNode = void 0;
4
+ /**
5
+ * @module node-opcua-client-proxy
6
+ */
7
+ const events_1 = require("events");
8
+ const node_opcua_assert_1 = require("node-opcua-assert");
9
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
10
+ class ProxyBaseNode extends events_1.EventEmitter {
11
+ constructor(proxyManager, nodeId, nodeClass) {
12
+ super();
13
+ this.nodeId = nodeId;
14
+ this.proxyManager = proxyManager;
15
+ (0, node_opcua_assert_1.assert)(this.proxyManager.session, "expecting valid session");
16
+ Object.defineProperty(this, "proxyManager", {
17
+ enumerable: false,
18
+ writable: true
19
+ });
20
+ this.$components = [];
21
+ this.$properties = [];
22
+ this.$methods = [];
23
+ this.$organizes = [];
24
+ this.description = "";
25
+ this.browseName = "";
26
+ this.nodeClass = nodeClass;
27
+ }
28
+ /**
29
+ * get a updated Value of the Variable , by using a ReadRequest
30
+ */
31
+ readValue(callback) {
32
+ (0, node_opcua_assert_1.assert)(this.proxyManager);
33
+ const session = this.proxyManager.session;
34
+ (0, node_opcua_assert_1.assert)(session);
35
+ const nodeToRead = {
36
+ attributeId: node_opcua_data_model_1.AttributeIds.Value,
37
+ nodeId: this.nodeId
38
+ };
39
+ this.proxyManager.session.read(nodeToRead, (err, dataValue) => {
40
+ // istanbul ignore next
41
+ if (err) {
42
+ return callback(err);
43
+ }
44
+ const data = dataValue.value;
45
+ callback(null, data);
46
+ });
47
+ }
48
+ /**
49
+ * set the Value of the Variable, by using a WriteRequest
50
+ */
51
+ writeValue(dataValue, callback) {
52
+ (0, node_opcua_assert_1.assert)(this.proxyManager);
53
+ const session = this.proxyManager.session;
54
+ (0, node_opcua_assert_1.assert)(session);
55
+ const nodeToWrite = {
56
+ attributeId: node_opcua_data_model_1.AttributeIds.Value,
57
+ nodeId: this.nodeId,
58
+ value: dataValue
59
+ };
60
+ this.proxyManager.session.write(nodeToWrite, (err, statusCode) => {
61
+ // istanbul ignore next
62
+ if (err) {
63
+ return callback(err);
64
+ }
65
+ if (statusCode && statusCode.isNotGood()) {
66
+ callback(new Error(statusCode.toString()));
67
+ }
68
+ else {
69
+ callback();
70
+ }
71
+ });
72
+ }
73
+ toString() {
74
+ const str = [];
75
+ str.push(" ProxyObject ");
76
+ str.push(" browseName : " + this.browseName.toString());
77
+ // str.push(" typeDefinition : " + this.typeDefinition.toString());
78
+ str.push(" $components# : " + this.$components.length.toString());
79
+ str.push(" $properties# : " + this.$properties.length.toString());
80
+ return str.join("\n");
81
+ }
82
+ }
83
+ exports.ProxyBaseNode = ProxyBaseNode;
84
+ // tslint:disable:no-var-requires
85
+ const thenify = require("thenify");
86
+ ProxyBaseNode.prototype.readValue = thenify.withCallback(ProxyBaseNode.prototype.readValue);
87
+ ProxyBaseNode.prototype.writeValue = thenify.withCallback(ProxyBaseNode.prototype.writeValue);
88
88
  //# sourceMappingURL=proxy_base_node.js.map
@@ -1,50 +1,50 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-client-proxy
4
- */
5
- import { EventEmitter } from "stream";
6
- import { NodeId } from "node-opcua-nodeid";
7
- import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
8
- import { NodeIdLike } from "node-opcua-nodeid";
9
- import { CreateSubscriptionRequestOptions, MonitoringParametersOptions } from "node-opcua-service-subscription";
10
- import { CallbackT } from "node-opcua-status-code";
11
- import { ErrorCallback } from "node-opcua-status-code";
12
- import { IBasicSession } from "node-opcua-pseudo-session";
13
- import { ReadValueIdOptions } from "node-opcua-service-read";
14
- import { Variant } from "node-opcua-variant";
15
- import { ProxyStateMachineType } from "./state_machine_proxy";
16
- export interface IProxy1 {
17
- nodeId: NodeId;
18
- executableFlag?: boolean;
19
- __monitoredItem_execution_flag?: EventEmitter;
20
- __monitoredItem?: EventEmitter;
21
- }
22
- export interface IProxy extends EventEmitter, IProxy1 {
23
- dataValue: DataValue;
24
- }
25
- export interface IClientSubscription {
26
- monitor(itemToMonitor: ReadValueIdOptions, monitoringParameters: MonitoringParametersOptions, timestampToReturn: TimestampsToReturn, callback: CallbackT<IClientMonitoredItemBase>): void;
27
- terminate(callback: () => void): void;
28
- on(eventName: "terminated", eventHandler: () => void): void;
29
- }
30
- export interface IClientMonitoredItemBase {
31
- on(eventName: "changed", eventHandler: (data: DataValue | Variant[]) => void): void;
32
- }
33
- export interface IBasicSessionWithSubscription extends IBasicSession {
34
- createSubscription2(options: CreateSubscriptionRequestOptions, callback: CallbackT<IClientSubscription>): void;
35
- }
36
- export declare class UAProxyManager {
37
- readonly session: IBasicSessionWithSubscription;
38
- subscription?: IClientSubscription;
39
- private _map;
40
- constructor(session: IBasicSessionWithSubscription);
41
- start(): Promise<void>;
42
- start(callback: (err?: Error) => void): void;
43
- stop(): Promise<void>;
44
- stop(callback: (err?: Error) => void): void;
45
- getObject(nodeId: NodeIdLike): Promise<any>;
46
- getObject(nodeId: NodeIdLike, callback: (err: Error | null, object?: any) => void): void;
47
- _monitor_value(proxyObject: IProxy, callback: ErrorCallback): void;
48
- _monitor_execution_flag(proxyObject: IProxy1, callback: (err?: Error) => void): void;
49
- getStateMachineType(nodeId: NodeIdLike, callback: (err: Error | null, stateMachineType?: ProxyStateMachineType) => void): void;
50
- }
1
+ /// <reference types="node" />
2
+ /**
3
+ * @module node-opcua-client-proxy
4
+ */
5
+ import { EventEmitter } from "stream";
6
+ import { NodeId } from "node-opcua-nodeid";
7
+ import { DataValue, TimestampsToReturn } from "node-opcua-data-value";
8
+ import { NodeIdLike } from "node-opcua-nodeid";
9
+ import { CreateSubscriptionRequestOptions, MonitoringParametersOptions } from "node-opcua-service-subscription";
10
+ import { CallbackT } from "node-opcua-status-code";
11
+ import { ErrorCallback } from "node-opcua-status-code";
12
+ import { IBasicSession } from "node-opcua-pseudo-session";
13
+ import { ReadValueIdOptions } from "node-opcua-service-read";
14
+ import { Variant } from "node-opcua-variant";
15
+ import { ProxyStateMachineType } from "./state_machine_proxy";
16
+ export interface IProxy1 {
17
+ nodeId: NodeId;
18
+ executableFlag?: boolean;
19
+ __monitoredItem_execution_flag?: EventEmitter;
20
+ __monitoredItem?: EventEmitter;
21
+ }
22
+ export interface IProxy extends EventEmitter, IProxy1 {
23
+ dataValue: DataValue;
24
+ }
25
+ export interface IClientSubscription {
26
+ monitor(itemToMonitor: ReadValueIdOptions, monitoringParameters: MonitoringParametersOptions, timestampToReturn: TimestampsToReturn, callback: CallbackT<IClientMonitoredItemBase>): void;
27
+ terminate(callback: () => void): void;
28
+ on(eventName: "terminated", eventHandler: () => void): void;
29
+ }
30
+ export interface IClientMonitoredItemBase {
31
+ on(eventName: "changed", eventHandler: (data: DataValue | Variant[]) => void): void;
32
+ }
33
+ export interface IBasicSessionWithSubscription extends IBasicSession {
34
+ createSubscription2(options: CreateSubscriptionRequestOptions, callback: CallbackT<IClientSubscription>): void;
35
+ }
36
+ export declare class UAProxyManager {
37
+ readonly session: IBasicSessionWithSubscription;
38
+ subscription?: IClientSubscription;
39
+ private _map;
40
+ constructor(session: IBasicSessionWithSubscription);
41
+ start(): Promise<void>;
42
+ start(callback: (err?: Error) => void): void;
43
+ stop(): Promise<void>;
44
+ stop(callback: (err?: Error) => void): void;
45
+ getObject(nodeId: NodeIdLike): Promise<any>;
46
+ getObject(nodeId: NodeIdLike, callback: (err: Error | null, object?: any) => void): void;
47
+ _monitor_value(proxyObject: IProxy, callback: ErrorCallback): void;
48
+ _monitor_execution_flag(proxyObject: IProxy1, callback: (err?: Error) => void): void;
49
+ getStateMachineType(nodeId: NodeIdLike, callback: (err: Error | null, stateMachineType?: ProxyStateMachineType) => void): void;
50
+ }