node-opcua-address-space-base 2.170.1 → 2.172.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 (52) hide show
  1. package/dist/address_space.d.ts +20 -20
  2. package/dist/base_node.d.ts +61 -23
  3. package/dist/base_node.js +3 -0
  4. package/dist/base_node.js.map +1 -1
  5. package/dist/bind_variable.d.ts +8 -8
  6. package/dist/clone_helper.js +5 -2
  7. package/dist/clone_helper.js.map +1 -1
  8. package/dist/clone_options.d.ts +10 -10
  9. package/dist/clone_options.js +2 -2
  10. package/dist/clone_options.js.map +1 -1
  11. package/dist/continuation_point.d.ts +1 -1
  12. package/dist/index.d.ts +3 -3
  13. package/dist/index.js +3 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/instantiate_options.d.ts +5 -5
  16. package/dist/ua_data_type.d.ts +6 -6
  17. package/dist/ua_dynamic_variable_array.d.ts +6 -6
  18. package/dist/ua_event_type.d.ts +1 -1
  19. package/dist/ua_method.d.ts +16 -12
  20. package/dist/ua_object.d.ts +16 -18
  21. package/dist/ua_object_type.d.ts +9 -9
  22. package/dist/ua_property.d.ts +3 -3
  23. package/dist/ua_reference.d.ts +3 -3
  24. package/dist/ua_reference_type.d.ts +5 -5
  25. package/dist/ua_variable.d.ts +19 -19
  26. package/dist/ua_variable_t.d.ts +7 -7
  27. package/dist/ua_variable_type.d.ts +14 -14
  28. package/dist/ua_view.d.ts +3 -3
  29. package/package.json +15 -15
  30. package/source/address_space.ts +20 -20
  31. package/source/base_node.ts +128 -80
  32. package/source/bind_variable.ts +8 -9
  33. package/source/clone_helper.ts +14 -7
  34. package/source/clone_options.ts +13 -14
  35. package/source/continuation_point.ts +1 -2
  36. package/source/i_event_data.ts +0 -1
  37. package/source/index.ts +3 -3
  38. package/source/instantiate_options.ts +5 -6
  39. package/source/namespace.ts +1 -1
  40. package/source/ua_data_type.ts +6 -7
  41. package/source/ua_dynamic_variable_array.ts +6 -6
  42. package/source/ua_event_type.ts +1 -1
  43. package/source/ua_method.ts +33 -29
  44. package/source/ua_object.ts +22 -21
  45. package/source/ua_object_type.ts +9 -10
  46. package/source/ua_property.ts +5 -3
  47. package/source/ua_reference.ts +3 -3
  48. package/source/ua_reference_type.ts +14 -14
  49. package/source/ua_variable.ts +35 -30
  50. package/source/ua_variable_t.ts +7 -7
  51. package/source/ua_variable_type.ts +27 -28
  52. package/source/ua_view.ts +3 -3
@@ -1,15 +1,14 @@
1
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
2
- import { LocalizedText, NodeClass, QualifiedName } from "node-opcua-data-model";
3
-
4
- import { BaseNode } from "./base_node";
5
- import { ModellingRuleType } from "./modelling_rule_type";
6
- import { INamespace } from "./namespace";
7
- import { UAMethod } from "./ua_method";
8
- import { UAObject } from "./ua_object";
9
- import { UAObjectType } from "./ua_object_type";
10
- import { UAReference } from "./ua_reference";
11
- import { UAVariable } from "./ua_variable";
1
+ import type { LocalizedText, NodeClass, QualifiedName } from "node-opcua-data-model";
2
+ import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
3
+ import type { BaseNode } from "./base_node";
12
4
  import { CloneHelper } from "./clone_helper";
5
+ import type { ModellingRuleType } from "./modelling_rule_type";
6
+ import type { INamespace } from "./namespace";
7
+ import type { UAMethod } from "./ua_method";
8
+ import type { UAObject } from "./ua_object";
9
+ import type { UAObjectType } from "./ua_object_type";
10
+ import type { UAReference } from "./ua_reference";
11
+ import type { UAVariable } from "./ua_variable";
13
12
 
14
13
  export interface CloneFilter {
15
14
  shouldKeep(node: BaseNode): boolean;
@@ -22,8 +21,8 @@ export const defaultCloneFilter: CloneFilter = {
22
21
  }
23
22
  return true;
24
23
  },
25
- filterFor(node: BaseNode) {
26
- return this;
24
+ filterFor(_childInstance: UAVariable | UAObject | UAMethod): CloneFilter {
25
+ return defaultCloneFilter;
27
26
  }
28
27
  };
29
28
 
@@ -46,7 +45,7 @@ export interface CloneExtraInfo {
46
45
  export const makeDefaultCloneExtraInfo = (node: UAVariable | UAMethod | UAObject): CloneExtraInfo => {
47
46
  const extraInfo = new CloneHelper();
48
47
  extraInfo.pushContext({ originalParent: node, clonedParent: node });
49
- return extraInfo;
48
+ return extraInfo as CloneExtraInfo;
50
49
  };
51
50
 
52
51
  export interface CloneOptions /* extends ConstructNodeIdOptions */ {
@@ -1,3 +1,2 @@
1
- import { ByteString } from "node-opcua-basic-types";
2
-
1
+ import type { ByteString } from "node-opcua-basic-types";
3
2
  export type ContinuationPoint = ByteString;
@@ -14,5 +14,4 @@ export interface IEventData {
14
14
  _createValue(fullBrowsePath: string, node: BaseNode, variant: VariantLike): void;
15
15
  _readValue(nodeId: NodeId): Variant | null;
16
16
  _browse(browsePath: BrowsePath): BrowsePathResult | null;
17
-
18
17
  }
package/source/index.ts CHANGED
@@ -13,12 +13,12 @@ export * from "./ua_data_type";
13
13
  export * from "./ua_dynamic_variable_array";
14
14
  export * from "./ua_event_type";
15
15
  export * from "./ua_method";
16
- export * from "./ua_object_type";
17
16
  export * from "./ua_object";
17
+ export * from "./ua_object_type";
18
18
  export * from "./ua_property";
19
- export * from "./ua_reference_type";
20
19
  export * from "./ua_reference";
20
+ export * from "./ua_reference_type";
21
+ export * from "./ua_variable";
21
22
  export * from "./ua_variable_t";
22
23
  export * from "./ua_variable_type";
23
- export * from "./ua_variable";
24
24
  export * from "./ua_view";
@@ -1,9 +1,8 @@
1
- import { QualifiedNameLike, LocalizedTextLike } from "node-opcua-data-model";
2
- import { NodeIdLike } from "node-opcua-nodeid";
3
-
4
- import { BaseNode } from "./base_node";
5
- import { ModellingRuleType } from "./modelling_rule_type";
6
- import { INamespace } from "./namespace";
1
+ import type { LocalizedTextLike, QualifiedNameLike } from "node-opcua-data-model";
2
+ import type { NodeIdLike } from "node-opcua-nodeid";
3
+ import type { BaseNode } from "./base_node";
4
+ import type { ModellingRuleType } from "./modelling_rule_type";
5
+ import type { INamespace } from "./namespace";
7
6
 
8
7
  export interface InstantiateOptions {
9
8
  /**
@@ -229,7 +229,7 @@ export interface VariableStuff {
229
229
  dataValue?: DataValueOptions;
230
230
  }
231
231
 
232
- export interface AddVariableOptionsWithoutValue extends AddBaseNodeOptions, VariableStuff { }
232
+ export interface AddVariableOptionsWithoutValue extends AddBaseNodeOptions, VariableStuff {}
233
233
  export interface AddVariableOptions extends AddVariableOptionsWithoutValue {
234
234
  // default value is "BaseVariableType";
235
235
  typeDefinition?: string | NodeId | UAVariableType;
@@ -1,11 +1,10 @@
1
- import { NodeClass } from "node-opcua-data-model";
2
- import { ExpandedNodeId, NodeId, NodeIdLike } from "node-opcua-nodeid";
3
- import { DataType } from "node-opcua-variant";
4
- import { DataTypeDefinition, EnumDefinition, StructureDefinition } from "node-opcua-types";
1
+ import type { NodeClass } from "node-opcua-data-model";
2
+ import type { ExpandedNodeId, NodeId, NodeIdLike } from "node-opcua-nodeid";
3
+ import type { DataTypeDefinition, EnumDefinition, StructureDefinition } from "node-opcua-types";
4
+ import type { DataType } from "node-opcua-variant";
5
+ import type { BaseNode, BaseNodeEvents } from "./base_node";
5
6
 
6
- import { BaseNode } from "./base_node";
7
-
8
- export interface UADataType extends BaseNode {
7
+ export interface UADataType extends BaseNode<BaseNodeEvents> {
9
8
  readonly nodeClass: NodeClass.DataType;
10
9
 
11
10
  readonly subtypeOfObj: UADataType | null;
@@ -1,9 +1,9 @@
1
- import { QualifiedName } from "node-opcua-data-model";
2
- import { DataValue } from "node-opcua-data-value";
3
- import { ExtensionObject } from "node-opcua-extension-object";
4
- import { UADataType } from "./ua_data_type";
5
- import { UAVariable } from "./ua_variable";
6
- import { UAVariableType } from "./ua_variable_type";
1
+ import type { QualifiedName } from "node-opcua-data-model";
2
+ import type { DataValue } from "node-opcua-data-value";
3
+ import type { ExtensionObject } from "node-opcua-extension-object";
4
+ import type { UADataType } from "./ua_data_type";
5
+ import type { UAVariable } from "./ua_variable";
6
+ import type { UAVariableType } from "./ua_variable_type";
7
7
 
8
8
  // {{ Dynamic Array Variable
9
9
  export interface UADynamicVariableArray<T extends ExtensionObject = ExtensionObject> extends UAVariable {
@@ -1,3 +1,3 @@
1
- import { UAObjectType } from "./ua_object_type";
1
+ import type { UAObjectType } from "./ua_object_type";
2
2
  // tslint:disable:no-empty-interface
3
3
  export interface UAEventType extends UAObjectType {}
@@ -1,15 +1,14 @@
1
- import { NodeClass } from "node-opcua-data-model";
2
- import { NodeId } from "node-opcua-nodeid";
3
- import { Argument, CallMethodResultOptions } from "node-opcua-types";
4
- import { Variant, VariantLike } from "node-opcua-variant";
5
- import { CallbackT } from "node-opcua-status-code";
6
- //
7
- import { BaseNode } from "./base_node";
8
- import { ISessionContext } from "./session_context";
9
- import { UAObject } from "./ua_object";
10
- import { UAObjectType } from "./ua_object_type";
11
- import { UAVariable } from "./ua_variable";
12
- import { CloneExtraInfo, CloneFilter, CloneOptions } from "./clone_options";
1
+ import type { NodeClass } from "node-opcua-data-model";
2
+ import type { NodeId } from "node-opcua-nodeid";
3
+ import type { CallbackT } from "node-opcua-status-code";
4
+ import type { Argument, CallMethodResultOptions } from "node-opcua-types";
5
+ import type { Variant, VariantLike } from "node-opcua-variant";
6
+ import type { BaseNode, BaseNodeEvents, ListenerSignature } from "./base_node";
7
+ import type { CloneExtraInfo, CloneFilter, CloneOptions } from "./clone_options";
8
+ import type { ISessionContext } from "./session_context";
9
+ import type { UAObject } from "./ua_object";
10
+ import type { UAObjectType } from "./ua_object_type";
11
+ import type { UAVariable } from "./ua_variable";
13
12
 
14
13
  export declare type MethodFunctorC = (
15
14
  this: UAMethod,
@@ -25,46 +24,51 @@ export declare type MethodFunctorA = (
25
24
 
26
25
  export type MethodFunctor = MethodFunctorC | MethodFunctorA;
27
26
 
28
- export declare class UAMethod extends BaseNode {
29
- public readonly nodeClass: NodeClass.Method;
30
- public readonly typeDefinition: NodeId;
31
- public readonly typeDefinitionObj: UAObjectType;
32
27
 
33
- public readonly parent: UAObject | null;
28
+ export interface UAMethodEvents extends BaseNodeEvents {
29
+ "method_executed": (inputArguments: Variant[], context: ISessionContext, callMethodResult: CallMethodResultOptions) => void;
30
+ "afterCall": (context: ISessionContext,inputArguments: Variant[], callMethodResult: CallMethodResultOptions) => void;
31
+ }
32
+ export interface UAMethod<T extends UAMethodEvents & ListenerSignature<T> = UAMethodEvents> extends BaseNode<T> {
33
+ readonly nodeClass: NodeClass.Method;
34
+ readonly typeDefinition: NodeId;
35
+ readonly typeDefinitionObj: UAObjectType;
36
+
37
+ readonly parent: UAObject | null;
34
38
 
35
- public readonly inputArguments?: UAVariable;
36
- public readonly outputArguments?: UAVariable;
39
+ readonly inputArguments?: UAVariable;
40
+ readonly outputArguments?: UAVariable;
37
41
 
38
- public readonly methodDeclarationId: NodeId;
42
+ readonly methodDeclarationId: NodeId;
39
43
 
40
44
  /**
41
45
  *
42
46
  */
43
- public _getExecutableFlag?: (sessionContext: ISessionContext | null) => boolean;
47
+ _getExecutableFlag?: (sessionContext: ISessionContext | null) => boolean;
44
48
 
45
- public bindMethod(methodFunction: MethodFunctor): void;
49
+ bindMethod(methodFunction: MethodFunctor): void;
46
50
 
47
- public getExecutableFlag(context: ISessionContext): boolean;
51
+ getExecutableFlag(context: ISessionContext): boolean;
48
52
 
49
- public getInputArguments(): Argument[];
53
+ getInputArguments(): Argument[];
50
54
 
51
- public getOutputArguments(): Argument[];
55
+ getOutputArguments(): Argument[];
52
56
 
53
57
  /**
54
58
  */
55
- public execute(
59
+ execute(
56
60
  object: UAObject | UAObjectType | null,
57
61
  inputArguments: VariantLike[] | null,
58
62
  context: ISessionContext,
59
63
  callback: CallbackT<CallMethodResultOptions>
60
64
  ): void;
61
- public execute(
65
+ execute(
62
66
  object: UAObject | UAObjectType | null,
63
67
  inputArguments: null | VariantLike[],
64
68
  context: ISessionContext
65
69
  ): Promise<CallMethodResultOptions>;
66
70
 
67
- public clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAMethod;
71
+ clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAMethod;
68
72
 
69
- public isBound(): boolean;
73
+ isBound(): boolean;
70
74
  }
@@ -1,17 +1,15 @@
1
- import { NodeId } from "node-opcua-nodeid";
2
- import { DataType, Variant, VariantArrayType } from "node-opcua-variant";
3
- import { Byte, DateTime, Int16, Int32, SByte, UAString, UInt16, UInt32 } from "node-opcua-basic-types";
4
- import { StatusCode } from "node-opcua-status-code";
5
- import { LocalizedTextLike, NodeClass, QualifiedNameOptions } from "node-opcua-data-model";
6
-
7
- import { ExtensionObject } from "node-opcua-extension-object";
8
- import { CloneOptions, CloneFilter, CloneExtraInfo } from "./clone_options";
9
- import { BaseNode, IPropertyAndComponentHolder } from "./base_node";
10
- import { UAObjectType } from "./ua_object_type";
11
- import { IEventData } from "./i_event_data";
12
- import { UAEventType } from "./ua_event_type";
13
- import { UAMethod } from "./ua_method";
14
- import { EventNotifierFlags } from "./event_notifier_flags";
1
+ import type { Byte, DateTime, Int16, Int32, SByte, UAString, UInt16, UInt32 } from "node-opcua-basic-types";
2
+ import type { LocalizedTextLike, NodeClass, QualifiedNameOptions } from "node-opcua-data-model";
3
+ import type { ExtensionObject } from "node-opcua-extension-object";
4
+ import type { NodeId } from "node-opcua-nodeid";
5
+ import type { StatusCode } from "node-opcua-status-code";
6
+ import type { DataType, Variant, VariantArrayType } from "node-opcua-variant";
7
+ import type { BaseNode, BaseNodeEvents, IPropertyAndComponentHolder, ListenerSignature } from "./base_node";
8
+ import type { CloneExtraInfo, CloneFilter, CloneOptions } from "./clone_options";
9
+ import type { EventNotifierFlags } from "./event_notifier_flags";
10
+ import type { UAEventType } from "./ua_event_type";
11
+ import type { UAMethod } from "./ua_method";
12
+ import type { UAObjectType } from "./ua_object_type";
15
13
 
16
14
  export type EventTypeLike = string | NodeId | UAEventType;
17
15
 
@@ -144,7 +142,7 @@ export type PseudoVariant =
144
142
  | PseudoVariantExtensionObjectArray
145
143
  | PseudoVariantVariant
146
144
  | PseudoVariantVariantArray;
147
-
145
+
148
146
  export interface RaiseEventData {
149
147
  $eventDataSource?: UAEventType;
150
148
 
@@ -156,10 +154,18 @@ export interface EventRaiser {
156
154
  raiseEvent(eventType: EventTypeLike, eventData: RaiseEventData): void;
157
155
  }
158
156
 
157
+ export interface UAObjectEvents extends BaseNodeEvents {
158
+
159
+ "event_raised":()=>void;
160
+ }
161
+
159
162
  /**
160
163
  * @interface UAObject
161
164
  */
162
- export interface UAObject extends BaseNode, EventRaiser, IPropertyAndComponentHolder {
165
+ export interface UAObject<T extends UAObjectEvents & ListenerSignature<T> = UAObjectEvents>
166
+ extends BaseNode<T>,
167
+ EventRaiser,
168
+ IPropertyAndComponentHolder {
163
169
  readonly nodeClass: NodeClass.Object;
164
170
  get parent(): BaseNode | null;
165
171
  get typeDefinitionObj(): UAObjectType;
@@ -181,11 +187,6 @@ export interface UAObject extends BaseNode, EventRaiser, IPropertyAndComponentHo
181
187
 
182
188
  raiseEvent(eventType: EventTypeLike | BaseNode, eventData: RaiseEventData): void;
183
189
 
184
- on(eventName: "event", eventHandler: (eventData: IEventData) => void): this;
185
- on(eventName: "dispose", eventHandler: () => void): this;
186
- once(eventName: "event", eventHandler: (eventData: IEventData) => void): this;
187
- once(eventName: "dispose", eventHandler: () => void): this;
188
-
189
190
  setEventNotifier(eventNotifierFlags: EventNotifierFlags): void;
190
191
 
191
192
  clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAObject;
@@ -1,12 +1,11 @@
1
- import { QualifiedNameLike, QualifiedNameOptions } from "node-opcua-data-model";
2
- import { NodeClass } from "node-opcua-types";
3
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
4
-
5
- import { InstantiateOptions } from "./instantiate_options";
6
- import { BaseNode, IPropertyAndComponentHolder } from "./base_node";
7
- import { UAObject } from "./ua_object";
8
- import { UAMethod } from "./ua_method";
9
- import { EventNotifierFlags } from "./event_notifier_flags";
1
+ import type { QualifiedNameLike, QualifiedNameOptions } from "node-opcua-data-model";
2
+ import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
3
+ import type { NodeClass } from "node-opcua-types";
4
+ import type { BaseNode, BaseNodeEvents, IPropertyAndComponentHolder } from "./base_node";
5
+ import type { EventNotifierFlags } from "./event_notifier_flags";
6
+ import type { InstantiateOptions } from "./instantiate_options";
7
+ import type { UAMethod } from "./ua_method";
8
+ import type { UAObject } from "./ua_object";
10
9
 
11
10
  export interface InstantiateObjectOptions extends InstantiateOptions {
12
11
  //
@@ -22,7 +21,7 @@ export interface InstantiateObjectOptions extends InstantiateOptions {
22
21
  addInOf?: NodeId | BaseNode;
23
22
  }
24
23
 
25
- export declare interface UAObjectType extends BaseNode, IPropertyAndComponentHolder {
24
+ export declare interface UAObjectType extends BaseNode<BaseNodeEvents>, IPropertyAndComponentHolder {
26
25
  readonly nodeClass: NodeClass.ObjectType;
27
26
  readonly subtypeOf: NodeId | null;
28
27
  readonly subtypeOfObj: UAObjectType | null;
@@ -1,5 +1,5 @@
1
- import { DataType } from "node-opcua-variant";
2
- import { UAVariableT } from "./ua_variable_t";
1
+ import type { DataType } from "node-opcua-variant";
2
+ import type { UAVariableT } from "./ua_variable_t";
3
3
  /**
4
4
  * | | |
5
5
  * |----------------|--------------------------------------------------|
@@ -10,5 +10,7 @@ import { UAVariableT } from "./ua_variable_t";
10
10
  * |dataType Name |undefined ns=0;i=0 |
11
11
  * |isAbstract |false |
12
12
  */
13
- export interface UAProperty_Base<T, DT extends DataType> {}
13
+ export interface UAProperty_Base<T, DT extends DataType> extends UAVariableT<T, DT> {
14
+ /** A property is a variable that describes an attribute of another variable or object. */
15
+ }
14
16
  export interface UAProperty<T, DT extends DataType> extends UAVariableT<T, /*m*/ DT>, UAProperty_Base<T, DT /*A*/> {}
@@ -1,6 +1,6 @@
1
- import { NodeId } from "node-opcua-nodeid";
2
- import { IAddressSpace } from "./address_space";
3
- import { BaseNode } from "./base_node";
1
+ import type { NodeId } from "node-opcua-nodeid";
2
+ import type { IAddressSpace } from "./address_space";
3
+ import type { BaseNode } from "./base_node";
4
4
 
5
5
  export interface UAReference {
6
6
  readonly nodeId: NodeId;
@@ -1,25 +1,25 @@
1
- import { LocalizedText, NodeClass } from "node-opcua-data-model";
2
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
3
- import { BaseNode } from "./base_node";
4
- import { UAReference } from "./ua_reference";
1
+ import type { LocalizedText, NodeClass } from "node-opcua-data-model";
2
+ import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
3
+ import type { BaseNode } from "./base_node";
4
+ import type { UAReference } from "./ua_reference";
5
5
 
6
- export declare class UAReferenceType extends BaseNode {
7
- public readonly nodeClass: NodeClass.ReferenceType;
8
- public readonly subtypeOfObj: UAReferenceType | null;
9
- public readonly subtypeOf: NodeId | null;
10
- public readonly isAbstract: boolean;
11
- public readonly inverseName: LocalizedText;
6
+ export interface UAReferenceType extends BaseNode {
7
+ readonly nodeClass: NodeClass.ReferenceType;
8
+ readonly subtypeOfObj: UAReferenceType | null;
9
+ readonly subtypeOf: NodeId | null;
10
+ readonly isAbstract: boolean;
11
+ readonly inverseName: LocalizedText;
12
12
 
13
- public isSubtypeOf(baseType: UAReferenceType | NodeIdLike): boolean;
13
+ isSubtypeOf(baseType: UAReferenceType | NodeIdLike): boolean;
14
14
 
15
15
  /** @deprecated - use isSubtypeOf instead */
16
- public isSupertypeOf(baseType: UAReferenceType | NodeIdLike): boolean;
16
+ isSupertypeOf(baseType: UAReferenceType | NodeIdLike): boolean;
17
17
 
18
- public getAllSubtypes(): UAReferenceType[];
18
+ getAllSubtypes(): UAReferenceType[];
19
19
 
20
20
  /**
21
21
  *
22
22
  * @param reference
23
23
  */
24
- public checkHasSubtype(referenceType: NodeId | UAReference): boolean;
24
+ checkHasSubtype(referenceType: NodeId | UAReference): boolean;
25
25
  }
@@ -1,28 +1,35 @@
1
- import { AttributeIds, CallbackT, DataType, PreciseClock, StatusCode, StatusCodeCallback, UInt32 } from "node-opcua-basic-types";
2
- import { NodeClass, QualifiedNameLike } from "node-opcua-data-model";
3
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
4
- import { DataValue } from "node-opcua-data-value";
5
- import { ExtensionObject } from "node-opcua-extension-object";
6
- import { NumericRange } from "node-opcua-numeric-range";
7
-
8
- import {
9
- WriteValueOptions,
1
+ import type {
2
+ AttributeIds,
3
+ CallbackT,
4
+ DataType,
5
+ PreciseClock,
6
+ StatusCode,
7
+ StatusCodeCallback,
8
+ UInt32
9
+ } from "node-opcua-basic-types";
10
+ import type { NodeClass, QualifiedNameLike } from "node-opcua-data-model";
11
+ import type { DataValue } from "node-opcua-data-value";
12
+ import type { ExtensionObject } from "node-opcua-extension-object";
13
+ import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
14
+ import type { NumericRange } from "node-opcua-numeric-range";
15
+
16
+ import type {
10
17
  HistoryReadDetails,
11
18
  HistoryReadResult,
12
- ReadRawModifiedDetails,
19
+ ReadAtTimeDetails,
13
20
  ReadEventDetails,
14
21
  ReadProcessedDetails,
15
- ReadAtTimeDetails
22
+ ReadRawModifiedDetails,
23
+ WriteValueOptions
16
24
  } from "node-opcua-types";
17
- import { Variant, VariantLike } from "node-opcua-variant";
18
-
25
+ import type { VariantLike } from "node-opcua-variant";
26
+ import type { BaseNode, BaseNodeEvents, IPropertyAndComponentHolder, ListenerSignature } from "./base_node";
27
+ import type { BindVariableOptions } from "./bind_variable";
19
28
  //
20
- import { CloneOptions, CloneFilter, CloneExtraInfo } from "./clone_options";
21
- import { BaseNode, IPropertyAndComponentHolder } from "./base_node";
22
- import { ISessionContext, ContinuationData } from "./session_context";
23
- import { UADataType } from "./ua_data_type";
24
- import { UAVariableType } from "./ua_variable_type";
25
- import { BindVariableOptions } from "./bind_variable";
29
+ import type { CloneExtraInfo, CloneFilter, CloneOptions } from "./clone_options";
30
+ import type { ContinuationData, ISessionContext } from "./session_context";
31
+ import type { UADataType } from "./ua_data_type";
32
+ import type { UAVariableType } from "./ua_variable_type";
26
33
 
27
34
  export interface IVariableHistorian {
28
35
  /**
@@ -81,7 +88,15 @@ export interface BindExtensionObjectOptions {
81
88
  export interface IVariableDataTypeChange {
82
89
  changeDataType(newDataType: NodeIdLike, newValue?: VariantLike): void;
83
90
  }
84
- export interface UAVariable extends BaseNode, VariableAttributes, IVariableDataTypeChange, IPropertyAndComponentHolder {
91
+ export interface UAVariableEvents extends BaseNodeEvents {
92
+ value_changed: (newDataValue: DataValue, index_range?: NumericRange |null) => void;
93
+ semantic_changed: () => void;
94
+ }
95
+ export interface UAVariable<T extends UAVariableEvents & ListenerSignature<T> = UAVariableEvents>
96
+ extends BaseNode<T>,
97
+ VariableAttributes,
98
+ IVariableDataTypeChange,
99
+ IPropertyAndComponentHolder {
85
100
  readonly nodeClass: NodeClass.Variable;
86
101
  readonly parent: BaseNode | null;
87
102
  readonly dataTypeObj: UADataType;
@@ -395,14 +410,4 @@ export interface UAVariable extends BaseNode, VariableAttributes, IVariableDataT
395
410
  ): void;
396
411
 
397
412
  clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAVariable;
398
-
399
- // ----------------- Event handlers
400
-
401
- on(eventName: "semantic_changed", eventHandler: () => void): this;
402
-
403
- on(eventName: "value_changed", eventHandler: (dataValue: DataValue) => void): this;
404
-
405
- once(eventName: "semantic_changed", eventHandler: () => void): this;
406
-
407
- once(eventName: "value_changed", eventHandler: (dataValue: DataValue) => void): this;
408
413
  }
@@ -1,10 +1,10 @@
1
- import { QualifiedNameLike } from "node-opcua-data-model";
2
- import { DataValueOptionsT, DataValueT } from "node-opcua-data-value";
3
- import { NumericRange } from "node-opcua-numeric-range";
4
- import { CallbackT, StatusCode, StatusCodeCallback } from "node-opcua-status-code";
5
- import { DataType } from "node-opcua-variant";
6
- import { ISessionContext } from "./session_context";
7
- import { UAVariable } from "./ua_variable";
1
+ import type { QualifiedNameLike } from "node-opcua-data-model";
2
+ import type { DataValueT } from "node-opcua-data-value";
3
+ import type { NumericRange } from "node-opcua-numeric-range";
4
+ import type { CallbackT, StatusCode, StatusCodeCallback } from "node-opcua-status-code";
5
+ import type { DataType } from "node-opcua-variant";
6
+ import type { ISessionContext } from "./session_context";
7
+ import type { UAVariable } from "./ua_variable";
8
8
 
9
9
  export interface UAVariableT<T, DT extends DataType> extends UAVariable {
10
10
  readValue(
@@ -1,17 +1,16 @@
1
- import { NodeClass } from "node-opcua-data-model";
2
- import { NodeId, NodeIdLike } from "node-opcua-nodeid";
3
- import { UInt32 } from "node-opcua-basic-types";
4
- import { DataType } from "node-opcua-variant";
5
- import { ExtensionObject } from "node-opcua-extension-object";
6
-
7
- import { BaseNode } from "./base_node";
8
- import { InstantiateOptions } from "./instantiate_options";
9
- import { UAObject } from "./ua_object";
10
- import { UAObjectType } from "./ua_object_type";
11
- import { UAVariable, VariableAttributes } from "./ua_variable";
12
- import { UAVariableT } from "./ua_variable_t";
13
- import { BindVariableOptions } from "./bind_variable";
14
- import { UAMethod } from "./ua_method";
1
+ import type { UInt32 } from "node-opcua-basic-types";
2
+ import type { NodeClass } from "node-opcua-data-model";
3
+ import type { ExtensionObject } from "node-opcua-extension-object";
4
+ import type { NodeId, NodeIdLike } from "node-opcua-nodeid";
5
+ import type { DataType } from "node-opcua-variant";
6
+ import type { BaseNode } from "./base_node";
7
+ import type { BindVariableOptions } from "./bind_variable";
8
+ import type { InstantiateOptions } from "./instantiate_options";
9
+ import type { UAMethod } from "./ua_method";
10
+ import type { UAObject } from "./ua_object";
11
+ import type { UAObjectType } from "./ua_object_type";
12
+ import type { UAVariable, VariableAttributes } from "./ua_variable";
13
+ import type { UAVariableT } from "./ua_variable_t";
15
14
 
16
15
  export interface InstantiateVariableOptions extends InstantiateOptions {
17
16
  arrayDimensions?: number[] | null;
@@ -37,26 +36,26 @@ export interface InstantiateVariableOptions extends InstantiateOptions {
37
36
  */
38
37
  valueRank?: number;
39
38
  }
40
- export declare class UAVariableType extends BaseNode implements VariableAttributes {
41
- public readonly nodeClass: NodeClass.VariableType;
42
- public readonly subtypeOfObj: UAVariableType | null;
43
- public readonly subtypeOf: NodeId | null;
39
+ export interface UAVariableType extends BaseNode, VariableAttributes {
40
+ readonly nodeClass: NodeClass.VariableType;
41
+ readonly subtypeOfObj: UAVariableType | null;
42
+ readonly subtypeOf: NodeId | null;
44
43
 
45
- public dataType: NodeId;
46
- public valueRank: number;
47
- public minimumSamplingInterval: number;
48
- public arrayDimensions: UInt32[] | null;
49
- public historizing: boolean;
44
+ dataType: NodeId;
45
+ valueRank: number;
46
+ minimumSamplingInterval: number;
47
+ arrayDimensions: UInt32[] | null;
48
+ historizing: boolean;
50
49
 
51
- public isAbstract: boolean;
50
+ isAbstract: boolean;
52
51
 
53
- public isSubtypeOf(type: UAVariableType | NodeIdLike): boolean;
52
+ isSubtypeOf(type: UAVariableType | NodeIdLike): boolean;
54
53
 
55
54
  /** @deprecated - use isSubtypeOf instead */
56
- public isSupertypeOf(type: UAVariableType | NodeIdLike): boolean;
55
+ isSupertypeOf(type: UAVariableType | NodeIdLike): boolean;
57
56
 
58
- public instantiate(options: InstantiateVariableOptions): UAVariable;
59
- public getBasicDataType(): DataType;
57
+ instantiate(options: InstantiateVariableOptions): UAVariable;
58
+ getBasicDataType(): DataType;
60
59
  }
61
60
 
62
61
  export interface UAVariableTypeT<T, DT extends DataType> extends UAVariableType {
package/source/ua_view.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { NodeClass } from "node-opcua-data-model";
2
- import { BaseNode } from "./base_node";
3
- import { EventNotifierFlags } from "./event_notifier_flags";
1
+ import type { NodeClass } from "node-opcua-data-model";
2
+ import type { BaseNode } from "./base_node";
3
+ import type { EventNotifierFlags } from "./event_notifier_flags";
4
4
 
5
5
  export interface UAView extends BaseNode {
6
6
  readonly nodeClass: NodeClass.View;