opcjs-client 0.1.18-alpha → 0.1.20-alpha

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ISecureChannel, RequestHeader, NodeId, EndpointDescription, UserIdentityToken, Configuration, UserTokenTypeEnum, ILoggerFactory, Encoder, Decoder, ExpandedNodeId, QualifiedName, LocalizedText, NodeClassEnum } from 'opcjs-base';
1
+ import { ISecureChannel, RequestHeader, NodeId, EndpointDescription, UserIdentityToken, Configuration, UserTokenTypeEnum, ILoggerFactory, Encoder, Decoder, ExpandedNodeId, QualifiedName, LocalizedText, NodeClassEnum, UaPrimitive } from 'opcjs-base';
2
2
 
3
3
  declare abstract class ServiceBase {
4
4
  private authToken;
@@ -10,11 +10,19 @@ declare abstract class ServiceBase {
10
10
  declare class SessionService extends ServiceBase {
11
11
  private configuration;
12
12
  private logger;
13
+ /**
14
+ * Creates a new session on the server (OPC UA Part 4, Section 5.7.2).
15
+ * @returns The session ID, authentication token, and selected server endpoint.
16
+ */
13
17
  createSession(): Promise<{
14
18
  sessionId: number;
15
19
  authToken: NodeId;
16
20
  endpoint: EndpointDescription;
17
21
  }>;
22
+ /**
23
+ * Activates an existing session using the supplied identity token (OPC UA Part 4, Section 5.7.3).
24
+ * @param identityToken - User identity token (anonymous, username/password, certificate, or issued token).
25
+ */
18
26
  activateSession(identityToken: UserIdentityToken): Promise<void>;
19
27
  recreate(authToken: NodeId): SessionService;
20
28
  constructor(authToken: NodeId, secureChannel: ISecureChannel, configuration: Configuration);
@@ -70,8 +78,8 @@ declare class Session {
70
78
 
71
79
  declare class ReadValueResult {
72
80
  value: unknown;
73
- status: string;
74
- constructor(value: unknown, status: string);
81
+ statusCode: number;
82
+ constructor(value: unknown, statusCode: number);
75
83
  }
76
84
 
77
85
  declare class ConfigurationClient extends Configuration {
@@ -81,8 +89,8 @@ declare class ConfigurationClient extends Configuration {
81
89
 
82
90
  declare class CallMethodResult {
83
91
  values: unknown[];
84
- status: string;
85
- constructor(values: unknown[], status: string);
92
+ statusCode: number;
93
+ constructor(values: unknown[], statusCode: number);
86
94
  }
87
95
 
88
96
  declare class BrowseNodeResult {
@@ -96,116 +104,6 @@ declare class BrowseNodeResult {
96
104
  constructor(referenceTypeId: NodeId, isForward: boolean, nodeId: ExpandedNodeId, browseName: QualifiedName, displayName: LocalizedText, nodeClass: NodeClassEnum, typeDefinition: ExpandedNodeId);
97
105
  }
98
106
 
99
- /**
100
- * Enumeration of variant types based on BuiltinType NodeIds.
101
- */
102
- declare enum BuiltInType {
103
- Null = 0,
104
- Boolean = 1,
105
- SByte = 2,
106
- Byte = 3,
107
- Int16 = 4,
108
- UInt16 = 5,
109
- Int32 = 6,
110
- UInt32 = 7,
111
- Int64 = 8,
112
- UInt64 = 9,
113
- Float = 10,
114
- Double = 11,
115
- String = 12,
116
- DateTime = 13,
117
- Guid = 14,
118
- ByteString = 15,
119
- XmlElement = 16,
120
- NodeId = 17,
121
- ExpandedNodeId = 18,
122
- StatusCode = 19,
123
- QualifiedName = 20,
124
- LocalizedText = 21,
125
- ExtensionObject = 22,
126
- DataValue = 23,
127
- Variant = 24,
128
- DiagnosticInfo = 25
129
- }
130
-
131
- /**
132
- * OPC UA Primitive Type Mappings
133
- *
134
- * We try to use the JS built in types wherever we can. But sometimes, often in the context
135
- * where Variant is involved, we need to have a wrapper type that includes the BuiltInType
136
- * for type checking and encoding purposes. In those cases, we define a wrapper type with a
137
- * value and a type field. For simple cases like boolean, we can just use the native boolean
138
- * type directly as UaBoolean.
139
- * @module primitives
140
- */
141
-
142
- type UaBoolean = boolean;
143
- /**
144
- * OPC UA Builtin Type Numeric IDs
145
- *
146
- * These correspond to the NodeId numeric identifiers defined in OPC UA Part 6, Table 1.
147
- */
148
- type UaSbyte = {
149
- value: number;
150
- readonly type: BuiltInType.SByte;
151
- };
152
- type UaByte = {
153
- value: number;
154
- readonly type: BuiltInType.Byte;
155
- };
156
- type UaInt16 = {
157
- value: number;
158
- readonly type: BuiltInType.Int16;
159
- };
160
- type UaUint16 = {
161
- value: number;
162
- readonly type: BuiltInType.UInt16;
163
- };
164
- type UaInt32 = {
165
- value: number;
166
- readonly type: BuiltInType.Int32;
167
- };
168
- type UaUint32 = {
169
- value: number;
170
- readonly type: BuiltInType.UInt32;
171
- };
172
- type UaInt64 = {
173
- value: bigint;
174
- readonly type: BuiltInType.Int64;
175
- };
176
- type UaUint64 = {
177
- value: bigint;
178
- readonly type: BuiltInType.UInt64;
179
- };
180
- type UaFloat = {
181
- value: number;
182
- readonly type: BuiltInType.Float;
183
- };
184
- type UaDouble = {
185
- value: number;
186
- readonly type: BuiltInType.Double;
187
- };
188
- /**
189
- * OPC UA String primitive type.
190
- *
191
- * A String in OPC UA can be null (encoded as length -1 in binary).
192
- * Using `string | null` instead of `string | undefined` aligns with the
193
- * OPC UA specification where null is an explicit, valid value distinct
194
- * from an empty string. Same is true for ByteString which can be null (length -1)
195
- * or a Uint8Array.
196
- */
197
- type UaString = string | null;
198
- type UaByteString = Uint8Array | null;
199
- type UaGuid = {
200
- value: string;
201
- readonly type: BuiltInType.Guid;
202
- };
203
- type UaDateTime = Date;
204
- /**
205
- * Union of all OPC UA primitive types accepted by {@link Variant.newFrom}.
206
- */
207
- type UaPrimitive = UaBoolean | UaSbyte | UaByte | UaInt16 | UaUint16 | UaInt32 | UaUint32 | UaInt64 | UaUint64 | UaFloat | UaDouble | UaString | UaDateTime | UaGuid | UaByteString;
208
-
209
107
  declare class Client {
210
108
  private configuration;
211
109
  private identity;