opcjs-client 0.1.34-alpha → 0.1.36-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.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISecureChannel, RequestHeader, NodeId, EndpointDescription, UserIdentityToken, Configuration, UserTokenTypeEnum, MessageSecurityModeEnum, ILoggerFactory, Encoder, Decoder, ExpandedNodeId, QualifiedName, LocalizedText, NodeClassEnum, UaPrimitive, XmlElement, ExtensionObject, DataValue, DiagnosticInfo
|
|
1
|
+
import { ISecureChannel, RequestHeader, NodeId, EndpointDescription, UserIdentityToken, Configuration, UserTokenTypeEnum, MessageSecurityModeEnum, ILoggerFactory, Encoder, Decoder, ExpandedNodeId, QualifiedName, LocalizedText, NodeClassEnum, UaPrimitive, XmlElement, ExtensionObject, DataValue, DiagnosticInfo } from 'opcjs-base';
|
|
2
2
|
|
|
3
3
|
declare abstract class ServiceBase {
|
|
4
4
|
private authToken;
|
|
@@ -108,6 +108,20 @@ declare class ReadValueResult {
|
|
|
108
108
|
constructor(value: unknown, statusCode: number);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/** Options for creating a subscription. All fields are optional; server will revise requested values. */
|
|
112
|
+
interface CreateSubscriptionOptions {
|
|
113
|
+
/** Requested publishing interval in milliseconds. Default: 2000. */
|
|
114
|
+
requestedPublishingInterval?: number;
|
|
115
|
+
/** Requested lifetime count (number of publishing intervals before subscription times out). Default: 360000. */
|
|
116
|
+
requestedLifetimeCount?: number;
|
|
117
|
+
/** Requested max keep-alive count. Default: 60000. */
|
|
118
|
+
requestedMaxKeepAliveCount?: number;
|
|
119
|
+
/** Maximum number of notifications per publish response. 0 = no limit. Default: 200. */
|
|
120
|
+
maxNotificationsPerPublish?: number;
|
|
121
|
+
/** Subscription priority relative to other subscriptions. Default: 1. */
|
|
122
|
+
priority?: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
/** URI for the SecurityPolicy None profile. */
|
|
112
126
|
declare const SECURITY_POLICY_NONE_URI = "http://opcfoundation.org/UA/SecurityPolicy#None";
|
|
113
127
|
/**
|
|
@@ -223,7 +237,23 @@ declare class BrowseNodeResult {
|
|
|
223
237
|
constructor(referenceTypeId: NodeId, isForward: boolean, nodeId: ExpandedNodeId, browseName: QualifiedName, displayName: LocalizedText, nodeClass: NodeClassEnum, typeDefinition: ExpandedNodeId);
|
|
224
238
|
}
|
|
225
239
|
|
|
226
|
-
|
|
240
|
+
/**
|
|
241
|
+
* A single (scalar) value that may be passed as a method argument.
|
|
242
|
+
* `Variant` is intentionally excluded — callers work with concrete OPC UA types;
|
|
243
|
+
* the conversion to `Variant` is done internally by `callMethod`.
|
|
244
|
+
*/
|
|
245
|
+
type ScalarCallMethodArgument = UaPrimitive | NodeId | ExpandedNodeId | QualifiedName | LocalizedText | XmlElement | ExtensionObject | DataValue | DiagnosticInfo;
|
|
246
|
+
/**
|
|
247
|
+
* A value (or homogeneous array of values) that may be passed as a method argument
|
|
248
|
+
* to {@link Client.callMethod}.
|
|
249
|
+
*
|
|
250
|
+
* Pass a plain array to create an array-rank Variant input argument, e.g.:
|
|
251
|
+
* ```ts
|
|
252
|
+
* client.callMethod(objId, methodId, [[uaDouble(1.0), uaDouble(2.0)]])
|
|
253
|
+
* ```
|
|
254
|
+
* Arrays must be homogeneous — all elements must be of the same OPC UA type.
|
|
255
|
+
*/
|
|
256
|
+
type CallMethodArgument = ScalarCallMethodArgument | ScalarCallMethodArgument[];
|
|
227
257
|
|
|
228
258
|
declare class Client {
|
|
229
259
|
private configuration;
|
|
@@ -322,7 +352,7 @@ declare class Client {
|
|
|
322
352
|
subscribe(ids: NodeId[], callback: (data: {
|
|
323
353
|
id: NodeId;
|
|
324
354
|
value: unknown;
|
|
325
|
-
}[]) => void): Promise<void>;
|
|
355
|
+
}[]) => void, options?: CreateSubscriptionOptions): Promise<void>;
|
|
326
356
|
constructor(endpointUrl: string, configuration: ConfigurationClient, identity: UserIdentity);
|
|
327
357
|
}
|
|
328
358
|
|
|
@@ -342,4 +372,4 @@ declare class SessionInvalidError extends Error {
|
|
|
342
372
|
constructor(statusCode: number);
|
|
343
373
|
}
|
|
344
374
|
|
|
345
|
-
export { BrowseNodeResult, type CallMethodArgument, CallMethodResult, Client, ConfigurationClient, SECURITY_POLICY_NONE_URI, type SecurityConfiguration, SessionInvalidError, type UnknownCertificatePolicy, UserIdentity };
|
|
375
|
+
export { BrowseNodeResult, type CallMethodArgument, CallMethodResult, Client, ConfigurationClient, type CreateSubscriptionOptions, SECURITY_POLICY_NONE_URI, type ScalarCallMethodArgument, type SecurityConfiguration, SessionInvalidError, type UnknownCertificatePolicy, UserIdentity };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISecureChannel, RequestHeader, NodeId, EndpointDescription, UserIdentityToken, Configuration, UserTokenTypeEnum, MessageSecurityModeEnum, ILoggerFactory, Encoder, Decoder, ExpandedNodeId, QualifiedName, LocalizedText, NodeClassEnum, UaPrimitive, XmlElement, ExtensionObject, DataValue, DiagnosticInfo
|
|
1
|
+
import { ISecureChannel, RequestHeader, NodeId, EndpointDescription, UserIdentityToken, Configuration, UserTokenTypeEnum, MessageSecurityModeEnum, ILoggerFactory, Encoder, Decoder, ExpandedNodeId, QualifiedName, LocalizedText, NodeClassEnum, UaPrimitive, XmlElement, ExtensionObject, DataValue, DiagnosticInfo } from 'opcjs-base';
|
|
2
2
|
|
|
3
3
|
declare abstract class ServiceBase {
|
|
4
4
|
private authToken;
|
|
@@ -108,6 +108,20 @@ declare class ReadValueResult {
|
|
|
108
108
|
constructor(value: unknown, statusCode: number);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/** Options for creating a subscription. All fields are optional; server will revise requested values. */
|
|
112
|
+
interface CreateSubscriptionOptions {
|
|
113
|
+
/** Requested publishing interval in milliseconds. Default: 2000. */
|
|
114
|
+
requestedPublishingInterval?: number;
|
|
115
|
+
/** Requested lifetime count (number of publishing intervals before subscription times out). Default: 360000. */
|
|
116
|
+
requestedLifetimeCount?: number;
|
|
117
|
+
/** Requested max keep-alive count. Default: 60000. */
|
|
118
|
+
requestedMaxKeepAliveCount?: number;
|
|
119
|
+
/** Maximum number of notifications per publish response. 0 = no limit. Default: 200. */
|
|
120
|
+
maxNotificationsPerPublish?: number;
|
|
121
|
+
/** Subscription priority relative to other subscriptions. Default: 1. */
|
|
122
|
+
priority?: number;
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
/** URI for the SecurityPolicy None profile. */
|
|
112
126
|
declare const SECURITY_POLICY_NONE_URI = "http://opcfoundation.org/UA/SecurityPolicy#None";
|
|
113
127
|
/**
|
|
@@ -223,7 +237,23 @@ declare class BrowseNodeResult {
|
|
|
223
237
|
constructor(referenceTypeId: NodeId, isForward: boolean, nodeId: ExpandedNodeId, browseName: QualifiedName, displayName: LocalizedText, nodeClass: NodeClassEnum, typeDefinition: ExpandedNodeId);
|
|
224
238
|
}
|
|
225
239
|
|
|
226
|
-
|
|
240
|
+
/**
|
|
241
|
+
* A single (scalar) value that may be passed as a method argument.
|
|
242
|
+
* `Variant` is intentionally excluded — callers work with concrete OPC UA types;
|
|
243
|
+
* the conversion to `Variant` is done internally by `callMethod`.
|
|
244
|
+
*/
|
|
245
|
+
type ScalarCallMethodArgument = UaPrimitive | NodeId | ExpandedNodeId | QualifiedName | LocalizedText | XmlElement | ExtensionObject | DataValue | DiagnosticInfo;
|
|
246
|
+
/**
|
|
247
|
+
* A value (or homogeneous array of values) that may be passed as a method argument
|
|
248
|
+
* to {@link Client.callMethod}.
|
|
249
|
+
*
|
|
250
|
+
* Pass a plain array to create an array-rank Variant input argument, e.g.:
|
|
251
|
+
* ```ts
|
|
252
|
+
* client.callMethod(objId, methodId, [[uaDouble(1.0), uaDouble(2.0)]])
|
|
253
|
+
* ```
|
|
254
|
+
* Arrays must be homogeneous — all elements must be of the same OPC UA type.
|
|
255
|
+
*/
|
|
256
|
+
type CallMethodArgument = ScalarCallMethodArgument | ScalarCallMethodArgument[];
|
|
227
257
|
|
|
228
258
|
declare class Client {
|
|
229
259
|
private configuration;
|
|
@@ -322,7 +352,7 @@ declare class Client {
|
|
|
322
352
|
subscribe(ids: NodeId[], callback: (data: {
|
|
323
353
|
id: NodeId;
|
|
324
354
|
value: unknown;
|
|
325
|
-
}[]) => void): Promise<void>;
|
|
355
|
+
}[]) => void, options?: CreateSubscriptionOptions): Promise<void>;
|
|
326
356
|
constructor(endpointUrl: string, configuration: ConfigurationClient, identity: UserIdentity);
|
|
327
357
|
}
|
|
328
358
|
|
|
@@ -342,4 +372,4 @@ declare class SessionInvalidError extends Error {
|
|
|
342
372
|
constructor(statusCode: number);
|
|
343
373
|
}
|
|
344
374
|
|
|
345
|
-
export { BrowseNodeResult, type CallMethodArgument, CallMethodResult, Client, ConfigurationClient, SECURITY_POLICY_NONE_URI, type SecurityConfiguration, SessionInvalidError, type UnknownCertificatePolicy, UserIdentity };
|
|
375
|
+
export { BrowseNodeResult, type CallMethodArgument, CallMethodResult, Client, ConfigurationClient, type CreateSubscriptionOptions, SECURITY_POLICY_NONE_URI, type ScalarCallMethodArgument, type SecurityConfiguration, SessionInvalidError, type UnknownCertificatePolicy, UserIdentity };
|
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ var SessionService = class _SessionService extends ServiceBase {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
// src/issuerConfiguration.ts
|
|
163
|
+
// src/configuration/issuerConfiguration.ts
|
|
164
164
|
var IssuerConfiguration = class _IssuerConfiguration {
|
|
165
165
|
constructor(resourceId, authorityUrl, authorityProfileUri, tokenEndpoint, authorizationEndpoint, requestTypes, scopes) {
|
|
166
166
|
this.resourceId = resourceId;
|
|
@@ -359,7 +359,7 @@ var ReadValueResult = class {
|
|
|
359
359
|
}
|
|
360
360
|
};
|
|
361
361
|
|
|
362
|
-
// src/subscriptionHandlerEntry.ts
|
|
362
|
+
// src/subscription/subscriptionHandlerEntry.ts
|
|
363
363
|
var SubscriptionHandlerEntry = class {
|
|
364
364
|
constructor(subscriptionId, handle, id, callback) {
|
|
365
365
|
this.subscriptionId = subscriptionId;
|
|
@@ -369,7 +369,7 @@ var SubscriptionHandlerEntry = class {
|
|
|
369
369
|
}
|
|
370
370
|
};
|
|
371
371
|
|
|
372
|
-
// src/subscriptionHandler.ts
|
|
372
|
+
// src/subscription/subscriptionHandler.ts
|
|
373
373
|
var NODE_ID_DATA_CHANGE_NOTIFICATION = 811;
|
|
374
374
|
var NODE_ID_STATUS_CHANGE_NOTIFICATION = 818;
|
|
375
375
|
var SubscriptionHandler = class {
|
|
@@ -385,11 +385,11 @@ var SubscriptionHandler = class {
|
|
|
385
385
|
hasActiveSubscription() {
|
|
386
386
|
return this.isRunning && this.entries.length > 0;
|
|
387
387
|
}
|
|
388
|
-
async subscribe(ids, callback) {
|
|
388
|
+
async subscribe(ids, callback, options) {
|
|
389
389
|
if (this.entries.length > 0) {
|
|
390
390
|
throw new Error("Subscribing more than once is not implemented");
|
|
391
391
|
}
|
|
392
|
-
const subscriptionId = await this.subscriptionService.createSubscription();
|
|
392
|
+
const subscriptionId = await this.subscriptionService.createSubscription(options);
|
|
393
393
|
const items = [];
|
|
394
394
|
for (const id of ids) {
|
|
395
395
|
const entry = new SubscriptionHandlerEntry(subscriptionId, this.nextHandle++, id, callback);
|
|
@@ -577,7 +577,7 @@ var MethodService = class extends ServiceBase {
|
|
|
577
577
|
}
|
|
578
578
|
};
|
|
579
579
|
|
|
580
|
-
// src/callMethodResult.ts
|
|
580
|
+
// src/method/callMethodResult.ts
|
|
581
581
|
var CallMethodResult = class {
|
|
582
582
|
constructor(values, statusCode) {
|
|
583
583
|
this.values = values;
|
|
@@ -986,8 +986,8 @@ var Client = class {
|
|
|
986
986
|
}
|
|
987
987
|
return results;
|
|
988
988
|
}
|
|
989
|
-
async subscribe(ids, callback) {
|
|
990
|
-
this.subscriptionHandler?.subscribe(ids, callback);
|
|
989
|
+
async subscribe(ids, callback, options) {
|
|
990
|
+
this.subscriptionHandler?.subscribe(ids, callback, options);
|
|
991
991
|
}
|
|
992
992
|
};
|
|
993
993
|
var ConfigurationClient = class _ConfigurationClient extends Configuration {
|