node-opcua-address-space-base 2.173.0 → 2.174.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/proofOfConcept.d.ts +72 -0
- package/dist/proofOfConcept.js +69 -0
- package/dist/proofOfConcept.js.map +1 -0
- package/dist/session_context.d.ts +4 -0
- package/package.json +13 -13
- package/source/proofOfConcept.ts +156 -0
- package/source/session_context.ts +5 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { NodeClass } from "node-opcua-data-model";
|
|
2
|
+
interface IEventData {
|
|
3
|
+
source: string;
|
|
4
|
+
}
|
|
5
|
+
interface DataValue {
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
interface NumericRange {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
}
|
|
12
|
+
export interface BaseNodeEvents {
|
|
13
|
+
dispose: () => void;
|
|
14
|
+
event: (attribute: IEventData) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface UAObjectEvents extends BaseNodeEvents {
|
|
17
|
+
Value_changed: (attribute: DataValue) => void;
|
|
18
|
+
DisplayName_changed: (attribute: DataValue) => void;
|
|
19
|
+
Description_changed: (attribute: DataValue) => void;
|
|
20
|
+
BrowseName_changed: (attribute: DataValue) => void;
|
|
21
|
+
RolePermissions_changed: (attribute: DataValue) => void;
|
|
22
|
+
AccessRestrictions_changed: (attribute: DataValue) => void;
|
|
23
|
+
}
|
|
24
|
+
export type ListenerSignature<L> = {
|
|
25
|
+
[E in keyof L]: (...args: any[]) => any;
|
|
26
|
+
};
|
|
27
|
+
export interface ITypedEventEmitter<T extends ListenerSignature<T>> {
|
|
28
|
+
on<K extends keyof T>(event: K, listener: T[K]): this;
|
|
29
|
+
once<K extends keyof T>(event: K, listener: T[K]): this;
|
|
30
|
+
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): this;
|
|
31
|
+
off<K extends keyof T>(event: K, listener: T[K]): this;
|
|
32
|
+
}
|
|
33
|
+
export declare class TypedEventEmitter<T extends ListenerSignature<T>> implements ITypedEventEmitter<T> {
|
|
34
|
+
private emitter;
|
|
35
|
+
on<K extends keyof T>(event: K, listener: T[K]): this;
|
|
36
|
+
once<K extends keyof T>(event: K, listener: T[K]): this;
|
|
37
|
+
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): this;
|
|
38
|
+
off<K extends keyof T>(event: K, listener: T[K]): this;
|
|
39
|
+
}
|
|
40
|
+
interface IAddressSpace {
|
|
41
|
+
str: string;
|
|
42
|
+
}
|
|
43
|
+
export interface BaseNode<T extends BaseNodeEvents & ListenerSignature<T> = BaseNodeEvents> extends ITypedEventEmitter<T> {
|
|
44
|
+
readonly nodeClass?: NodeClass;
|
|
45
|
+
get addressSpace(): IAddressSpace;
|
|
46
|
+
}
|
|
47
|
+
export declare abstract class BaseNodeImpl<T extends BaseNodeEvents & ListenerSignature<T> = BaseNodeEvents> extends TypedEventEmitter<T> implements BaseNode<T> {
|
|
48
|
+
get addressSpace(): IAddressSpace;
|
|
49
|
+
private _addressSpace;
|
|
50
|
+
}
|
|
51
|
+
export interface UAObject<T extends UAObjectEvents & ListenerSignature<T> = UAObjectEvents> extends BaseNode<T> {
|
|
52
|
+
nodeClass: NodeClass.Object;
|
|
53
|
+
someUAObjectMethod(): void;
|
|
54
|
+
}
|
|
55
|
+
export declare class UAObjectImpl<T extends UAObjectEvents & ListenerSignature<T> = UAObjectEvents> extends BaseNodeImpl<T> implements UAObject<T> {
|
|
56
|
+
nodeClass: NodeClass.Object;
|
|
57
|
+
someUAObjectMethod(): void;
|
|
58
|
+
}
|
|
59
|
+
export interface UAVariableEvents extends BaseNodeEvents {
|
|
60
|
+
value_changed: (newDataValue: DataValue, index_range?: NumericRange | null) => void;
|
|
61
|
+
semantic_changed: () => void;
|
|
62
|
+
trucmuch: (newDataValue: DataValue, index_range?: NumericRange | null) => void;
|
|
63
|
+
}
|
|
64
|
+
export interface UAVariable<T extends UAVariableEvents & ListenerSignature<T> = UAVariableEvents> extends BaseNode<T> {
|
|
65
|
+
nodeClass: NodeClass.Variable;
|
|
66
|
+
someUAVariableMethod(): void;
|
|
67
|
+
}
|
|
68
|
+
export declare class UAVariableImpl<T extends UAVariableEvents & ListenerSignature<T> = UAVariableEvents> extends BaseNodeImpl<T> implements UAVariable<T> {
|
|
69
|
+
nodeClass: NodeClass.Variable;
|
|
70
|
+
someUAVariableMethod(): void;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UAVariableImpl = exports.UAObjectImpl = exports.BaseNodeImpl = exports.TypedEventEmitter = void 0;
|
|
4
|
+
const node_events_1 = require("node:events");
|
|
5
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
6
|
+
class TypedEventEmitter {
|
|
7
|
+
emitter = new node_events_1.EventEmitter();
|
|
8
|
+
on(event, listener) {
|
|
9
|
+
this.emitter.on(event, listener);
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
once(event, listener) {
|
|
13
|
+
this.emitter.once(event, listener);
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
emit(event, ...args) {
|
|
17
|
+
this.emitter.emit(event, ...args);
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
off(event, listener) {
|
|
21
|
+
this.emitter.off(event, listener);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TypedEventEmitter = TypedEventEmitter;
|
|
26
|
+
class BaseNodeImpl extends TypedEventEmitter {
|
|
27
|
+
get addressSpace() {
|
|
28
|
+
return this._addressSpace;
|
|
29
|
+
}
|
|
30
|
+
_addressSpace = { str: "example" };
|
|
31
|
+
}
|
|
32
|
+
exports.BaseNodeImpl = BaseNodeImpl;
|
|
33
|
+
class UAObjectImpl extends BaseNodeImpl {
|
|
34
|
+
nodeClass = node_opcua_data_model_1.NodeClass.Object;
|
|
35
|
+
someUAObjectMethod() {
|
|
36
|
+
// ...
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.UAObjectImpl = UAObjectImpl;
|
|
40
|
+
class UAVariableImpl extends BaseNodeImpl {
|
|
41
|
+
nodeClass = node_opcua_data_model_1.NodeClass.Variable;
|
|
42
|
+
someUAVariableMethod() {
|
|
43
|
+
// ...
|
|
44
|
+
this.emit("trucmuch", { value: 42 });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.UAVariableImpl = UAVariableImpl;
|
|
48
|
+
const a = new UAVariableImpl();
|
|
49
|
+
a.on("trucmuch", (dataValue) => {
|
|
50
|
+
console.log("trucmuch changed", dataValue.value);
|
|
51
|
+
});
|
|
52
|
+
a.emit("trucmuch", { value: 42 });
|
|
53
|
+
function onNodeFunc(node) {
|
|
54
|
+
node.on("event", () => { });
|
|
55
|
+
}
|
|
56
|
+
function main() {
|
|
57
|
+
const uaObject = new UAObjectImpl();
|
|
58
|
+
uaObject.on("RolePermissions_changed", (dataValue) => {
|
|
59
|
+
console.log("RolePermissions changed", dataValue.value);
|
|
60
|
+
});
|
|
61
|
+
const uaVariable = new UAVariableImpl();
|
|
62
|
+
uaVariable.on("trucmuch", (dataValue, _indexRange) => {
|
|
63
|
+
console.log("trucmuch changed", dataValue.value);
|
|
64
|
+
});
|
|
65
|
+
onNodeFunc(uaObject);
|
|
66
|
+
onNodeFunc(uaVariable);
|
|
67
|
+
}
|
|
68
|
+
main();
|
|
69
|
+
//# sourceMappingURL=proofOfConcept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proofOfConcept.js","sourceRoot":"","sources":["../source/proofOfConcept.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,iEAAkD;AAyClD,MAAa,iBAAiB;IAClB,OAAO,GAAG,IAAI,0BAAY,EAAE,CAAC;IAErC,EAAE,CAAoB,KAAQ,EAAE,QAAc;QAC1C,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAe,EAAE,QAAiB,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAoB,KAAQ,EAAE,QAAc;QAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAe,EAAE,QAAiB,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAoB,KAAQ,EAAE,GAAG,IAAsB;QACvD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAe,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,GAAG,CAAoB,KAAQ,EAAE,QAAc;QAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAe,EAAE,QAAiB,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAtBD,8CAsBC;AAYD,MAAsB,YAClB,SAAQ,iBAAoB;IAG5B,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAEO,aAAa,GAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;CAC7D;AATD,oCASC;AAYD,MAAa,YACT,SAAQ,YAAe;IAGvB,SAAS,GAAqB,iCAAS,CAAC,MAAM,CAAC;IAE/C,kBAAkB;QACd,MAAM;IACV,CAAC;CACJ;AATD,oCASC;AAYD,MAAa,cACT,SAAQ,YAAe;IAGvB,SAAS,GAAuB,iCAAS,CAAC,QAAQ,CAAC;IACnD,oBAAoB;QAChB,MAAM;QACL,IAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;CACJ;AATD,wCASC;AAED,MAAM,CAAC,GAAG,IAAI,cAAc,EAAE,CAAC;AAC/B,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE;IAC3B,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AACH,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AAElC,SAAS,UAAU,CAAC,IAAc;IAC9B,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,IAAI;IACT,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IAEpC,QAAQ,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,SAAS,EAAE,EAAE;QACjD,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAe,IAAI,cAAc,EAAE,CAAC;IAEpD,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,EAAE;QACjD,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrB,UAAU,CAAC,UAAU,CAAC,CAAC;AAC3B,CAAC;AACD,IAAI,EAAE,CAAC"}
|
|
@@ -39,6 +39,8 @@ export interface ISessionBase {
|
|
|
39
39
|
channel?: IChannelBase;
|
|
40
40
|
getSessionId(): NodeId;
|
|
41
41
|
continuationPointManager: IContinuationPointManager;
|
|
42
|
+
/** The URL of the Endpoint the Session was created on, if known. */
|
|
43
|
+
getEndpointUrl?(): string | undefined;
|
|
42
44
|
}
|
|
43
45
|
export interface ContinuationPointData {
|
|
44
46
|
dataValues: DataValue[];
|
|
@@ -73,6 +75,8 @@ export interface ISessionContext {
|
|
|
73
75
|
* unavailable.
|
|
74
76
|
*/
|
|
75
77
|
readonly clientApplicationUri: string | null;
|
|
78
|
+
/** The URL of the Endpoint the Session was created on, or `null` if unknown. */
|
|
79
|
+
readonly endpointUrl: string | null;
|
|
76
80
|
/**
|
|
77
81
|
* Returns a JSON representation of the context
|
|
78
82
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-address-space-base",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.174.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module address-space-base",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"node-opcua-assert": "2.164.0",
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
-
"node-opcua-constants": "2.
|
|
21
|
+
"node-opcua-basic-types": "2.174.0",
|
|
22
|
+
"node-opcua-constants": "2.174.0",
|
|
23
23
|
"node-opcua-crypto": "5.3.6",
|
|
24
|
-
"node-opcua-data-model": "2.
|
|
25
|
-
"node-opcua-data-value": "2.
|
|
26
|
-
"node-opcua-date-time": "2.
|
|
24
|
+
"node-opcua-data-model": "2.174.0",
|
|
25
|
+
"node-opcua-data-value": "2.174.0",
|
|
26
|
+
"node-opcua-date-time": "2.174.0",
|
|
27
27
|
"node-opcua-debug": "2.172.0",
|
|
28
|
-
"node-opcua-extension-object": "2.
|
|
29
|
-
"node-opcua-nodeid": "2.
|
|
30
|
-
"node-opcua-numeric-range": "2.
|
|
31
|
-
"node-opcua-schemas": "2.
|
|
28
|
+
"node-opcua-extension-object": "2.174.0",
|
|
29
|
+
"node-opcua-nodeid": "2.174.0",
|
|
30
|
+
"node-opcua-numeric-range": "2.174.0",
|
|
31
|
+
"node-opcua-schemas": "2.174.0",
|
|
32
32
|
"node-opcua-status-code": "2.173.0",
|
|
33
|
-
"node-opcua-types": "2.
|
|
34
|
-
"node-opcua-variant": "2.
|
|
33
|
+
"node-opcua-types": "2.174.0",
|
|
34
|
+
"node-opcua-variant": "2.174.0"
|
|
35
35
|
},
|
|
36
36
|
"author": "Etienne Rossignon",
|
|
37
37
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"internet of things"
|
|
49
49
|
],
|
|
50
50
|
"homepage": "http://node-opcua.github.io/",
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "011657a3a4805ad106df7381c24ed84e2a18d8f1",
|
|
52
52
|
"files": [
|
|
53
53
|
"dist",
|
|
54
54
|
"source"
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { NodeClass } from "node-opcua-data-model";
|
|
3
|
+
|
|
4
|
+
interface IEventData {
|
|
5
|
+
source: string;
|
|
6
|
+
}
|
|
7
|
+
interface DataValue {
|
|
8
|
+
value: number;
|
|
9
|
+
}
|
|
10
|
+
interface NumericRange {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
}
|
|
14
|
+
export interface BaseNodeEvents {
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
event: (attribute: IEventData) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UAObjectEvents extends BaseNodeEvents {
|
|
20
|
+
Value_changed: (attribute: DataValue) => void;
|
|
21
|
+
DisplayName_changed: (attribute: DataValue) => void;
|
|
22
|
+
Description_changed: (attribute: DataValue) => void;
|
|
23
|
+
BrowseName_changed: (attribute: DataValue) => void;
|
|
24
|
+
RolePermissions_changed: (attribute: DataValue) => void;
|
|
25
|
+
AccessRestrictions_changed: (attribute: DataValue) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Self-referential constraint: every property of L must be a function.
|
|
29
|
+
// Lets us drop the broken `T[K] extends (...) => ...` conditionals while
|
|
30
|
+
// preserving exact callback signatures (named params, optional args) for IntelliSense.
|
|
31
|
+
export type ListenerSignature<L> = {
|
|
32
|
+
// biome-ignore lint/suspicious/noExplicitAny: any is required to bypass function-parameter contravariance; using unknown breaks T[K] assignability
|
|
33
|
+
[E in keyof L]: (...args: any[]) => any;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export interface ITypedEventEmitter<T extends ListenerSignature<T>> {
|
|
37
|
+
on<K extends keyof T>(event: K, listener: T[K]): this;
|
|
38
|
+
once<K extends keyof T>(event: K, listener: T[K]): this;
|
|
39
|
+
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): this;
|
|
40
|
+
off<K extends keyof T>(event: K, listener: T[K]): this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class TypedEventEmitter<T extends ListenerSignature<T>> implements ITypedEventEmitter<T> {
|
|
44
|
+
private emitter = new EventEmitter();
|
|
45
|
+
|
|
46
|
+
on<K extends keyof T>(event: K, listener: T[K]): this {
|
|
47
|
+
this.emitter.on(event as string, listener as never);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
once<K extends keyof T>(event: K, listener: T[K]): this {
|
|
52
|
+
this.emitter.once(event as string, listener as never);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): this {
|
|
57
|
+
this.emitter.emit(event as string, ...args);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
off<K extends keyof T>(event: K, listener: T[K]): this {
|
|
62
|
+
this.emitter.off(event as string, listener as never);
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// import { BaseNodeEvents } from './BaseNodeEvents';
|
|
68
|
+
// import { ITypedEventEmitter, TypedEventEmitter } from './TypedEventEmitter';
|
|
69
|
+
interface IAddressSpace {
|
|
70
|
+
str: string;
|
|
71
|
+
}
|
|
72
|
+
export interface BaseNode<T extends BaseNodeEvents & ListenerSignature<T> = BaseNodeEvents> extends ITypedEventEmitter<T> {
|
|
73
|
+
readonly nodeClass?: NodeClass;
|
|
74
|
+
get addressSpace(): IAddressSpace;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export abstract class BaseNodeImpl<T extends BaseNodeEvents & ListenerSignature<T> = BaseNodeEvents>
|
|
78
|
+
extends TypedEventEmitter<T>
|
|
79
|
+
implements BaseNode<T>
|
|
80
|
+
{
|
|
81
|
+
get addressSpace(): IAddressSpace {
|
|
82
|
+
return this._addressSpace;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private _addressSpace: IAddressSpace = { str: "example" };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//
|
|
89
|
+
|
|
90
|
+
// import { BaseNode, IBaseNode } from "./BaseNode";
|
|
91
|
+
// import { BaseNodeEvents, UAObjectEvents } from "./BaseNodeEvents";
|
|
92
|
+
|
|
93
|
+
export interface UAObject<T extends UAObjectEvents & ListenerSignature<T> = UAObjectEvents> extends BaseNode<T> {
|
|
94
|
+
nodeClass: NodeClass.Object;
|
|
95
|
+
someUAObjectMethod(): void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export class UAObjectImpl<T extends UAObjectEvents & ListenerSignature<T> = UAObjectEvents>
|
|
99
|
+
extends BaseNodeImpl<T>
|
|
100
|
+
implements UAObject<T>
|
|
101
|
+
{
|
|
102
|
+
nodeClass: NodeClass.Object = NodeClass.Object;
|
|
103
|
+
|
|
104
|
+
someUAObjectMethod(): void {
|
|
105
|
+
// ...
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface UAVariableEvents extends BaseNodeEvents {
|
|
110
|
+
value_changed: (newDataValue: DataValue, index_range?: NumericRange | null) => void;
|
|
111
|
+
semantic_changed: () => void;
|
|
112
|
+
trucmuch: (newDataValue: DataValue, index_range?: NumericRange | null) => void;
|
|
113
|
+
}
|
|
114
|
+
export interface UAVariable<T extends UAVariableEvents & ListenerSignature<T> = UAVariableEvents> extends BaseNode<T> {
|
|
115
|
+
nodeClass: NodeClass.Variable;
|
|
116
|
+
someUAVariableMethod(): void;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export class UAVariableImpl<T extends UAVariableEvents & ListenerSignature<T> = UAVariableEvents>
|
|
120
|
+
extends BaseNodeImpl<T>
|
|
121
|
+
implements UAVariable<T>
|
|
122
|
+
{
|
|
123
|
+
nodeClass: NodeClass.Variable = NodeClass.Variable;
|
|
124
|
+
someUAVariableMethod(): void {
|
|
125
|
+
// ...
|
|
126
|
+
(this as UAVariableImpl).emit("trucmuch", { value: 42 });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const a = new UAVariableImpl();
|
|
131
|
+
a.on("trucmuch", (dataValue) => {
|
|
132
|
+
console.log("trucmuch changed", dataValue.value);
|
|
133
|
+
});
|
|
134
|
+
a.emit("trucmuch", { value: 42 });
|
|
135
|
+
|
|
136
|
+
function onNodeFunc(node: BaseNode) {
|
|
137
|
+
node.on("event", () => {});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function main() {
|
|
141
|
+
const uaObject = new UAObjectImpl();
|
|
142
|
+
|
|
143
|
+
uaObject.on("RolePermissions_changed", (dataValue) => {
|
|
144
|
+
console.log("RolePermissions changed", dataValue.value);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const uaVariable: UAVariable = new UAVariableImpl();
|
|
148
|
+
|
|
149
|
+
uaVariable.on("trucmuch", (dataValue, _indexRange) => {
|
|
150
|
+
console.log("trucmuch changed", dataValue.value);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
onNodeFunc(uaObject);
|
|
154
|
+
onNodeFunc(uaVariable);
|
|
155
|
+
}
|
|
156
|
+
main();
|
|
@@ -58,6 +58,8 @@ export interface ISessionBase {
|
|
|
58
58
|
channel?: IChannelBase;
|
|
59
59
|
getSessionId(): NodeId; // session NodeID
|
|
60
60
|
continuationPointManager: IContinuationPointManager;
|
|
61
|
+
/** The URL of the Endpoint the Session was created on, if known. */
|
|
62
|
+
getEndpointUrl?(): string | undefined;
|
|
61
63
|
}
|
|
62
64
|
export interface ContinuationPointData {
|
|
63
65
|
dataValues: DataValue[];
|
|
@@ -103,6 +105,9 @@ export interface ISessionContext {
|
|
|
103
105
|
*/
|
|
104
106
|
readonly clientApplicationUri: string | null;
|
|
105
107
|
|
|
108
|
+
/** The URL of the Endpoint the Session was created on, or `null` if unknown. */
|
|
109
|
+
readonly endpointUrl: string | null;
|
|
110
|
+
|
|
106
111
|
/**
|
|
107
112
|
* Returns a JSON representation of the context
|
|
108
113
|
*/
|