@opentap/runner-client 2.22.1 → 2.23.0-alpha.1.2.10769060909
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/cjs/DTOs.js +60 -10
- package/dist/cjs/SessionClient.js +47 -37
- package/dist/mjs/BaseClient.d.ts +2 -2
- package/dist/mjs/DTOs.d.ts +28 -5
- package/dist/mjs/DTOs.js +44 -2
- package/dist/mjs/SessionClient.d.ts +6 -6
- package/dist/mjs/SessionClient.js +48 -39
- package/package.json +2 -2
package/dist/cjs/DTOs.js
CHANGED
|
@@ -16,8 +16,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.SessionShutdownInitiated = exports.SessionStartFailed = exports.SessionStarted = exports.SessionStartInitiated = exports.SessionEventArgs = exports.SettingsTapPackage = exports.RepositorySettingsPackageDefinition = exports.RepositoryPackageDefinition = exports.RepositoryPackageReference = exports.ProfileGroup = exports.ListItemType = exports.ComponentSettings = exports.FileDescriptor = exports.Resource = exports.PluginTypeSelectorControl = exports.PictureControl = exports.PasswordControl = exports.MultiSelectControl = exports.DropdownControl = exports.EnabledControl = exports.DirectoryPathControl = exports.FilePathControl = exports.ComboBoxControl = exports.TextBoxControl = exports.DataGridControl = exports.DataGridReferenceControl = exports.CheckBoxControl = exports.AvailableValue = exports.ButtonsControl = exports.ButtonControl = exports.ExternalParameter = exports.MetaData = exports.DisplayAttribute = exports.VisualStatus = exports.Icon = exports.ColumnDisplayName = exports.LayoutMode = exports.Layout = exports.Setting = exports.ComponentSettingsListItem = exports.AnnotatedObject = exports.ComponentSettingsList = exports.ComponentSettingsIdentifier = exports.ComponentSettingsBase = exports.Links = exports.Session = exports.ImageResolveErrorResponse = exports.ErrorResponse = exports.PackageSpecifier = exports.Image = void 0;
|
|
19
|
-
exports.BreakEventArgs = exports.TestStepChangeEventArgs = exports.SettingsChangedEventArgs = exports.TestPlanExecutionStateChangedEventArgs = exports.TestPlanChangeEventArgs = exports.StoppedEventArgs = exports.StoppingEventArgs = exports.StartedEventArgs = exports.StartingEventArgs = exports.SessionTimeoutEventArgs = exports.SessionEventType = exports.SessionEvent = exports.MetricValue = exports.
|
|
20
|
-
exports.RunnerDeletedEvent = exports.RunnerUpdatedEvent = exports.RunnerRegisteredEvent = exports.RunnerEvent = exports.TestPlanRunCompletedEventArgs = exports.TestPlanRunStartEventArgs = exports.TestPlanRunEvent = exports.TestStepRunCompletedEventArgs = exports.TestStepRunStartEventArgs = exports.TestStepRunEvent = exports.OnTestStepRun = exports.OnTestPlanRun = exports.TestPlanSettingsChangedEventArgs = exports.UserInputRequestCompletedEventArgs = exports.UserInputRequestEventArgs = void 0;
|
|
19
|
+
exports.BreakEventArgs = exports.TestStepChangeEventArgs = exports.SettingsChangedEventArgs = exports.TestPlanExecutionStateChangedEventArgs = exports.TestPlanChangeEventArgs = exports.StoppedEventArgs = exports.StoppingEventArgs = exports.StartedEventArgs = exports.StartingEventArgs = exports.SessionTimeoutEventArgs = exports.SessionEventType = exports.SessionEvent = exports.MetricValue = exports.MetricsConfiguration = exports.SessionMetricInfo = exports.MetricsPollRate = exports.SessionMetricType = exports.SessionMetricKind = exports.ResultColumn = exports.Result = exports.LogEvent = exports.TestStepRun = exports.TestRun = exports.WatchDog = exports.Parameter = exports.BreakPoints = exports.InstalledFile = exports.Interaction = exports.CommonContext = exports.CommonSettings = exports.ValidationError = exports.TestStepValidationError = exports.TestStepCopy = exports.TestStepType = exports.TestStep = exports.TestPlan = exports.ExecutionState = exports.Verdict = exports.RunStatus = exports.MissingLicenseResponse = exports.LogEntry = exports.LogList = exports.ApiException = exports.ImageCreationFailed = exports.ImageCreated = exports.ImageCreating = exports.ImageEventArgs = exports.SessionInactivityLimitHit = exports.SessionShutdownFailed = exports.SessionShutdown = void 0;
|
|
20
|
+
exports.RunnerDeletedEvent = exports.RunnerUpdatedEvent = exports.RunnerRegisteredEvent = exports.RunnerEvent = exports.TestPlanRunCompletedEventArgs = exports.TestPlanRunStartEventArgs = exports.TestPlanRunEvent = exports.TestStepRunCompletedEventArgs = exports.TestStepRunStartEventArgs = exports.TestStepRunEvent = exports.OnTestStepRun = exports.OnTestPlanRun = exports.MetricsConfigurationChangedEventArgs = exports.HeartbeatEventArgs = exports.TestPlanSettingsChangedEventArgs = exports.UserInputRequestCompletedEventArgs = exports.UserInputRequestEventArgs = void 0;
|
|
21
21
|
var Image = /** @class */ (function () {
|
|
22
22
|
function Image(data) {
|
|
23
23
|
this.packages = [];
|
|
@@ -3136,8 +3136,8 @@ var SessionMetricInfo = /** @class */ (function () {
|
|
|
3136
3136
|
return SessionMetricInfo;
|
|
3137
3137
|
}());
|
|
3138
3138
|
exports.SessionMetricInfo = SessionMetricInfo;
|
|
3139
|
-
var
|
|
3140
|
-
function
|
|
3139
|
+
var MetricsConfiguration = /** @class */ (function () {
|
|
3140
|
+
function MetricsConfiguration(data) {
|
|
3141
3141
|
this.metrics = [];
|
|
3142
3142
|
if (data) {
|
|
3143
3143
|
for (var property in data) {
|
|
@@ -3146,20 +3146,20 @@ var MetricsRequest = /** @class */ (function () {
|
|
|
3146
3146
|
}
|
|
3147
3147
|
}
|
|
3148
3148
|
}
|
|
3149
|
-
|
|
3149
|
+
MetricsConfiguration.prototype.init = function (_data) {
|
|
3150
3150
|
if (_data) {
|
|
3151
3151
|
this.publishRate = _data['PublishRate'];
|
|
3152
3152
|
if (Array.isArray(_data['Metrics']))
|
|
3153
3153
|
this.metrics = _data['Metrics'].map(function (item) { return SessionMetricInfo.fromJS(item); });
|
|
3154
3154
|
}
|
|
3155
3155
|
};
|
|
3156
|
-
|
|
3156
|
+
MetricsConfiguration.fromJS = function (data) {
|
|
3157
3157
|
data = typeof data === 'object' ? data : {};
|
|
3158
|
-
var result = new
|
|
3158
|
+
var result = new MetricsConfiguration();
|
|
3159
3159
|
result.init(data);
|
|
3160
3160
|
return result;
|
|
3161
3161
|
};
|
|
3162
|
-
|
|
3162
|
+
MetricsConfiguration.prototype.toJSON = function (data) {
|
|
3163
3163
|
data = typeof data === 'object' ? data : {};
|
|
3164
3164
|
data['PublishRate'] = this.publishRate;
|
|
3165
3165
|
if (Array.isArray(this.metrics)) {
|
|
@@ -3167,9 +3167,9 @@ var MetricsRequest = /** @class */ (function () {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
return data;
|
|
3169
3169
|
};
|
|
3170
|
-
return
|
|
3170
|
+
return MetricsConfiguration;
|
|
3171
3171
|
}());
|
|
3172
|
-
exports.
|
|
3172
|
+
exports.MetricsConfiguration = MetricsConfiguration;
|
|
3173
3173
|
var MetricValue = /** @class */ (function () {
|
|
3174
3174
|
function MetricValue(data) {
|
|
3175
3175
|
if (data) {
|
|
@@ -3313,6 +3313,8 @@ var SessionEventType;
|
|
|
3313
3313
|
SessionEventType["SessionTimeoutHit"] = "SessionTimeoutHit";
|
|
3314
3314
|
SessionEventType["TestPlanSettingsChanged"] = "TestPlanSettingsChanged";
|
|
3315
3315
|
SessionEventType["TypeCacheInvalidated"] = "TypeCacheInvalidated";
|
|
3316
|
+
SessionEventType["Heartbeat"] = "Heartbeat";
|
|
3317
|
+
SessionEventType["MetricsConfigurationChanged"] = "MetricsConfigurationChanged";
|
|
3316
3318
|
})(SessionEventType = exports.SessionEventType || (exports.SessionEventType = {}));
|
|
3317
3319
|
var SessionTimeoutEventArgs = /** @class */ (function (_super) {
|
|
3318
3320
|
__extends(SessionTimeoutEventArgs, _super);
|
|
@@ -3650,6 +3652,54 @@ var TestPlanSettingsChangedEventArgs = /** @class */ (function (_super) {
|
|
|
3650
3652
|
return TestPlanSettingsChangedEventArgs;
|
|
3651
3653
|
}(SessionEvent));
|
|
3652
3654
|
exports.TestPlanSettingsChangedEventArgs = TestPlanSettingsChangedEventArgs;
|
|
3655
|
+
var HeartbeatEventArgs = /** @class */ (function (_super) {
|
|
3656
|
+
__extends(HeartbeatEventArgs, _super);
|
|
3657
|
+
function HeartbeatEventArgs(data) {
|
|
3658
|
+
var _this = _super.call(this, data) || this;
|
|
3659
|
+
_this._discriminator = 'HeartbeatEventArgs';
|
|
3660
|
+
return _this;
|
|
3661
|
+
}
|
|
3662
|
+
HeartbeatEventArgs.prototype.init = function (_data) {
|
|
3663
|
+
_super.prototype.init.call(this, _data);
|
|
3664
|
+
};
|
|
3665
|
+
HeartbeatEventArgs.fromJS = function (data) {
|
|
3666
|
+
data = typeof data === 'object' ? data : {};
|
|
3667
|
+
var result = new HeartbeatEventArgs();
|
|
3668
|
+
result.init(data);
|
|
3669
|
+
return result;
|
|
3670
|
+
};
|
|
3671
|
+
HeartbeatEventArgs.prototype.toJSON = function (data) {
|
|
3672
|
+
data = typeof data === 'object' ? data : {};
|
|
3673
|
+
_super.prototype.toJSON.call(this, data);
|
|
3674
|
+
return data;
|
|
3675
|
+
};
|
|
3676
|
+
return HeartbeatEventArgs;
|
|
3677
|
+
}(SessionEvent));
|
|
3678
|
+
exports.HeartbeatEventArgs = HeartbeatEventArgs;
|
|
3679
|
+
var MetricsConfigurationChangedEventArgs = /** @class */ (function (_super) {
|
|
3680
|
+
__extends(MetricsConfigurationChangedEventArgs, _super);
|
|
3681
|
+
function MetricsConfigurationChangedEventArgs(data) {
|
|
3682
|
+
var _this = _super.call(this, data) || this;
|
|
3683
|
+
_this._discriminator = 'MetricsConfigurationChangedEventArgs';
|
|
3684
|
+
return _this;
|
|
3685
|
+
}
|
|
3686
|
+
MetricsConfigurationChangedEventArgs.prototype.init = function (_data) {
|
|
3687
|
+
_super.prototype.init.call(this, _data);
|
|
3688
|
+
};
|
|
3689
|
+
MetricsConfigurationChangedEventArgs.fromJS = function (data) {
|
|
3690
|
+
data = typeof data === 'object' ? data : {};
|
|
3691
|
+
var result = new MetricsConfigurationChangedEventArgs();
|
|
3692
|
+
result.init(data);
|
|
3693
|
+
return result;
|
|
3694
|
+
};
|
|
3695
|
+
MetricsConfigurationChangedEventArgs.prototype.toJSON = function (data) {
|
|
3696
|
+
data = typeof data === 'object' ? data : {};
|
|
3697
|
+
_super.prototype.toJSON.call(this, data);
|
|
3698
|
+
return data;
|
|
3699
|
+
};
|
|
3700
|
+
return MetricsConfigurationChangedEventArgs;
|
|
3701
|
+
}(SessionEvent));
|
|
3702
|
+
exports.MetricsConfigurationChangedEventArgs = MetricsConfigurationChangedEventArgs;
|
|
3653
3703
|
var OnTestPlanRun = /** @class */ (function () {
|
|
3654
3704
|
function OnTestPlanRun(data) {
|
|
3655
3705
|
if (data) {
|
|
@@ -303,37 +303,47 @@ var SessionClient = /** @class */ (function (_super) {
|
|
|
303
303
|
* @param {SubscriptionOptions} options?
|
|
304
304
|
* @returns Subscription
|
|
305
305
|
*/
|
|
306
|
-
SessionClient.prototype.connectMetric = function (metricInfo, handler
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
value
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
306
|
+
SessionClient.prototype.connectMetric = function (metricInfo, handler) {
|
|
307
|
+
var _this = this;
|
|
308
|
+
return this.connection.jetstreamManager({ checkAPI: false }).then(function (jetStreamManager) {
|
|
309
|
+
var stream = "".concat(_this.baseSubject, ".Events.Metrics.").concat(metricInfo.subjectPostfix);
|
|
310
|
+
return jetStreamManager.consumers
|
|
311
|
+
.add(stream, {
|
|
312
|
+
name: "runner-web-client-metric-consumer-".concat(nats_ws_1.nuid.next()),
|
|
313
|
+
})
|
|
314
|
+
.then(function (consumerInfo) { var _a; return (_a = _this.connection) === null || _a === void 0 ? void 0 : _a.jetstream().consumers.get(consumerInfo.stream_name, consumerInfo.name); })
|
|
315
|
+
.then(function (consumer) {
|
|
316
|
+
consumer === null || consumer === void 0 ? void 0 : consumer.consume({
|
|
317
|
+
callback: function (encodedMessage) {
|
|
318
|
+
var _a, _b;
|
|
319
|
+
try {
|
|
320
|
+
var time = Number.parseInt((_b = (_a = encodedMessage.headers) === null || _a === void 0 ? void 0 : _a.get('timestamp')) !== null && _b !== void 0 ? _b : '');
|
|
321
|
+
var value = void 0;
|
|
322
|
+
// Decode the value based on the metric value type given in the metric info
|
|
323
|
+
switch (metricInfo.type) {
|
|
324
|
+
case DTOs_1.SessionMetricType.Boolean:
|
|
325
|
+
value = encoders_1.booleanCodec.decode(encodedMessage.data);
|
|
326
|
+
break;
|
|
327
|
+
case DTOs_1.SessionMetricType.Double:
|
|
328
|
+
value = encoders_1.numberCodec.decode(encodedMessage.data);
|
|
329
|
+
break;
|
|
330
|
+
case DTOs_1.SessionMetricType.String:
|
|
331
|
+
value = encoders_1.stringCodec.decode(encodedMessage.data);
|
|
332
|
+
break;
|
|
333
|
+
default:
|
|
334
|
+
value = encoders_1.jsonCodec.decode(encodedMessage.data);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
handler(new DTOs_1.MetricValue({ value: value, time: time }), null);
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
handler(undefined, error);
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
return consumer;
|
|
345
|
+
});
|
|
346
|
+
});
|
|
337
347
|
};
|
|
338
348
|
/**
|
|
339
349
|
* Unsubscibe from session events
|
|
@@ -813,19 +823,19 @@ var SessionClient = /** @class */ (function (_super) {
|
|
|
813
823
|
* Get the metric information
|
|
814
824
|
* @returns Promise
|
|
815
825
|
*/
|
|
816
|
-
SessionClient.prototype.
|
|
817
|
-
return this.request('
|
|
818
|
-
.then(function (metricsRequestJs) { return DTOs_1.
|
|
826
|
+
SessionClient.prototype.getMetricsConfiguration = function () {
|
|
827
|
+
return this.request('GetMetricsConfiguration')
|
|
828
|
+
.then(function (metricsRequestJs) { return DTOs_1.MetricsConfiguration.fromJS(metricsRequestJs); })
|
|
819
829
|
.then(this.success())
|
|
820
830
|
.catch(this.error());
|
|
821
831
|
};
|
|
822
832
|
/**
|
|
823
833
|
* Set the metric information. Used for setting up which metrics should be published for polling.
|
|
824
|
-
* @param {
|
|
834
|
+
* @param {IMetricsConfiguration} metricsRequest
|
|
825
835
|
* @returns Promise
|
|
826
836
|
*/
|
|
827
|
-
SessionClient.prototype.
|
|
828
|
-
return this.request('
|
|
837
|
+
SessionClient.prototype.setMetricsConfiguration = function (metricsRequest) {
|
|
838
|
+
return this.request('SetMetricsConfiguration', metricsRequest).then(this.success()).catch(this.error());
|
|
829
839
|
};
|
|
830
840
|
return SessionClient;
|
|
831
841
|
}(BaseClient_1.BaseClient));
|
package/dist/mjs/BaseClient.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DownloadTapSettingsRequest } from './requestDTOs';
|
|
2
2
|
import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileParameter, ListItemType, ProfileGroup, RepositoryPackageReference, RepositorySettingsPackageDefinition } from './DTOs';
|
|
3
|
-
import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions, PublishOptions } from 'nats.ws';
|
|
3
|
+
import { ConnectionOptions, NatsConnection, NatsError, Subscription, SubscriptionOptions, PublishOptions } from 'nats.ws';
|
|
4
4
|
interface BaseClientRequestOptions {
|
|
5
5
|
publishOptions?: PublishOptions;
|
|
6
6
|
rawResponse?: boolean;
|
|
@@ -9,7 +9,7 @@ interface BaseClientRequestOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class BaseClient {
|
|
11
11
|
readonly baseSubject: string;
|
|
12
|
-
|
|
12
|
+
protected connection: NatsConnection | null;
|
|
13
13
|
private connectionOptions;
|
|
14
14
|
private domainAccess;
|
|
15
15
|
private eventEmitter;
|
package/dist/mjs/DTOs.d.ts
CHANGED
|
@@ -1115,15 +1115,15 @@ export interface ISessionMetricInfo {
|
|
|
1115
1115
|
metricFullName: string;
|
|
1116
1116
|
subjectPostfix: string;
|
|
1117
1117
|
}
|
|
1118
|
-
export declare class
|
|
1118
|
+
export declare class MetricsConfiguration implements IMetricsConfiguration {
|
|
1119
1119
|
publishRate: MetricsPollRate;
|
|
1120
1120
|
metrics: SessionMetricInfo[];
|
|
1121
|
-
constructor(data?:
|
|
1121
|
+
constructor(data?: IMetricsConfiguration);
|
|
1122
1122
|
init(_data?: any): void;
|
|
1123
|
-
static fromJS(data: any):
|
|
1123
|
+
static fromJS(data: any): MetricsConfiguration;
|
|
1124
1124
|
toJSON(data?: any): any;
|
|
1125
1125
|
}
|
|
1126
|
-
export interface
|
|
1126
|
+
export interface IMetricsConfiguration {
|
|
1127
1127
|
publishRate: MetricsPollRate;
|
|
1128
1128
|
metrics: ISessionMetricInfo[];
|
|
1129
1129
|
}
|
|
@@ -1166,7 +1166,9 @@ export declare enum SessionEventType {
|
|
|
1166
1166
|
UserInputCompleted = "UserInputCompleted",
|
|
1167
1167
|
SessionTimeoutHit = "SessionTimeoutHit",
|
|
1168
1168
|
TestPlanSettingsChanged = "TestPlanSettingsChanged",
|
|
1169
|
-
TypeCacheInvalidated = "TypeCacheInvalidated"
|
|
1169
|
+
TypeCacheInvalidated = "TypeCacheInvalidated",
|
|
1170
|
+
Heartbeat = "Heartbeat",
|
|
1171
|
+
MetricsConfigurationChanged = "MetricsConfigurationChanged"
|
|
1170
1172
|
}
|
|
1171
1173
|
export declare class SessionTimeoutEventArgs extends SessionEvent implements ISessionTimeoutEventArgs {
|
|
1172
1174
|
constructor(data?: ISessionTimeoutEventArgs);
|
|
@@ -1278,6 +1280,27 @@ export declare class TestPlanSettingsChangedEventArgs extends SessionEvent imple
|
|
|
1278
1280
|
toJSON(data?: any): any;
|
|
1279
1281
|
}
|
|
1280
1282
|
export declare type ITestPlanSettingsChangedEventArgs = ISessionEvent;
|
|
1283
|
+
export declare class HeartbeatEventArgs extends SessionEvent implements IHeartbeatEventArgs {
|
|
1284
|
+
constructor(data?: IHeartbeatEventArgs);
|
|
1285
|
+
init(_data?: any): void;
|
|
1286
|
+
static fromJS(data: any): HeartbeatEventArgs;
|
|
1287
|
+
toJSON(data?: any): any;
|
|
1288
|
+
}
|
|
1289
|
+
export interface IHeartbeatEventArgs extends ISessionEvent {
|
|
1290
|
+
timestamp?: number;
|
|
1291
|
+
watchDog?: IWatchDog;
|
|
1292
|
+
state?: ExecutionState;
|
|
1293
|
+
testPlanRunID?: string;
|
|
1294
|
+
}
|
|
1295
|
+
export declare class MetricsConfigurationChangedEventArgs extends SessionEvent implements IMetricsConfigurationChangedEventArgs {
|
|
1296
|
+
constructor(data?: IMetricsConfigurationChangedEventArgs);
|
|
1297
|
+
init(_data?: any): void;
|
|
1298
|
+
static fromJS(data: any): MetricsConfigurationChangedEventArgs;
|
|
1299
|
+
toJSON(data?: any): any;
|
|
1300
|
+
}
|
|
1301
|
+
export interface IMetricsConfigurationChangedEventArgs extends ISessionEvent {
|
|
1302
|
+
metricsConfiguration?: IMetricsConfiguration;
|
|
1303
|
+
}
|
|
1281
1304
|
export interface IOnTestPlanRun {
|
|
1282
1305
|
status?: string;
|
|
1283
1306
|
userId?: string;
|
package/dist/mjs/DTOs.js
CHANGED
|
@@ -2744,7 +2744,7 @@ export class SessionMetricInfo {
|
|
|
2744
2744
|
return data;
|
|
2745
2745
|
}
|
|
2746
2746
|
}
|
|
2747
|
-
export class
|
|
2747
|
+
export class MetricsConfiguration {
|
|
2748
2748
|
constructor(data) {
|
|
2749
2749
|
this.metrics = [];
|
|
2750
2750
|
if (data) {
|
|
@@ -2763,7 +2763,7 @@ export class MetricsRequest {
|
|
|
2763
2763
|
}
|
|
2764
2764
|
static fromJS(data) {
|
|
2765
2765
|
data = typeof data === 'object' ? data : {};
|
|
2766
|
-
const result = new
|
|
2766
|
+
const result = new MetricsConfiguration();
|
|
2767
2767
|
result.init(data);
|
|
2768
2768
|
return result;
|
|
2769
2769
|
}
|
|
@@ -2915,6 +2915,8 @@ export var SessionEventType;
|
|
|
2915
2915
|
SessionEventType["SessionTimeoutHit"] = "SessionTimeoutHit";
|
|
2916
2916
|
SessionEventType["TestPlanSettingsChanged"] = "TestPlanSettingsChanged";
|
|
2917
2917
|
SessionEventType["TypeCacheInvalidated"] = "TypeCacheInvalidated";
|
|
2918
|
+
SessionEventType["Heartbeat"] = "Heartbeat";
|
|
2919
|
+
SessionEventType["MetricsConfigurationChanged"] = "MetricsConfigurationChanged";
|
|
2918
2920
|
})(SessionEventType || (SessionEventType = {}));
|
|
2919
2921
|
export class SessionTimeoutEventArgs extends SessionEvent {
|
|
2920
2922
|
constructor(data) {
|
|
@@ -3200,6 +3202,46 @@ export class TestPlanSettingsChangedEventArgs extends SessionEvent {
|
|
|
3200
3202
|
return data;
|
|
3201
3203
|
}
|
|
3202
3204
|
}
|
|
3205
|
+
export class HeartbeatEventArgs extends SessionEvent {
|
|
3206
|
+
constructor(data) {
|
|
3207
|
+
super(data);
|
|
3208
|
+
this._discriminator = 'HeartbeatEventArgs';
|
|
3209
|
+
}
|
|
3210
|
+
init(_data) {
|
|
3211
|
+
super.init(_data);
|
|
3212
|
+
}
|
|
3213
|
+
static fromJS(data) {
|
|
3214
|
+
data = typeof data === 'object' ? data : {};
|
|
3215
|
+
const result = new HeartbeatEventArgs();
|
|
3216
|
+
result.init(data);
|
|
3217
|
+
return result;
|
|
3218
|
+
}
|
|
3219
|
+
toJSON(data) {
|
|
3220
|
+
data = typeof data === 'object' ? data : {};
|
|
3221
|
+
super.toJSON(data);
|
|
3222
|
+
return data;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
export class MetricsConfigurationChangedEventArgs extends SessionEvent {
|
|
3226
|
+
constructor(data) {
|
|
3227
|
+
super(data);
|
|
3228
|
+
this._discriminator = 'MetricsConfigurationChangedEventArgs';
|
|
3229
|
+
}
|
|
3230
|
+
init(_data) {
|
|
3231
|
+
super.init(_data);
|
|
3232
|
+
}
|
|
3233
|
+
static fromJS(data) {
|
|
3234
|
+
data = typeof data === 'object' ? data : {};
|
|
3235
|
+
const result = new MetricsConfigurationChangedEventArgs();
|
|
3236
|
+
result.init(data);
|
|
3237
|
+
return result;
|
|
3238
|
+
}
|
|
3239
|
+
toJSON(data) {
|
|
3240
|
+
data = typeof data === 'object' ? data : {};
|
|
3241
|
+
super.toJSON(data);
|
|
3242
|
+
return data;
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3203
3245
|
export class OnTestPlanRun {
|
|
3204
3246
|
constructor(data) {
|
|
3205
3247
|
if (data) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, IMetricValue,
|
|
2
|
-
import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
|
|
1
|
+
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, IMetricValue, IMetricsConfiguration, ISessionMetricInfo, Image, Interaction, ListItemType, LogList, MetricsConfiguration, OnTestPlanRun, OnTestStepRun, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, Resource, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
|
|
2
|
+
import { ConnectionOptions, Consumer, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
|
|
3
3
|
import { BaseClient } from './BaseClient';
|
|
4
4
|
export declare class SessionClient extends BaseClient {
|
|
5
5
|
private subscriptions;
|
|
@@ -88,7 +88,7 @@ export declare class SessionClient extends BaseClient {
|
|
|
88
88
|
* @param {SubscriptionOptions} options?
|
|
89
89
|
* @returns Subscription
|
|
90
90
|
*/
|
|
91
|
-
connectMetric(metricInfo: ISessionMetricInfo, handler: (result: IMetricValue | undefined, err: NatsError | Error | null) => void
|
|
91
|
+
connectMetric(metricInfo: ISessionMetricInfo, handler: (result: IMetricValue | undefined, err: NatsError | Error | null) => void): Promise<Consumer | undefined>;
|
|
92
92
|
/**
|
|
93
93
|
* Unsubscibe from session events
|
|
94
94
|
*/
|
|
@@ -357,11 +357,11 @@ export declare class SessionClient extends BaseClient {
|
|
|
357
357
|
* Get the metric information
|
|
358
358
|
* @returns Promise
|
|
359
359
|
*/
|
|
360
|
-
|
|
360
|
+
getMetricsConfiguration(): Promise<MetricsConfiguration>;
|
|
361
361
|
/**
|
|
362
362
|
* Set the metric information. Used for setting up which metrics should be published for polling.
|
|
363
|
-
* @param {
|
|
363
|
+
* @param {IMetricsConfiguration} metricsRequest
|
|
364
364
|
* @returns Promise
|
|
365
365
|
*/
|
|
366
|
-
|
|
366
|
+
setMetricsConfiguration(metricsRequest: IMetricsConfiguration): Promise<void>;
|
|
367
367
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, MetricValue,
|
|
2
|
-
import { JSONCodec } from 'nats.ws';
|
|
1
|
+
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, MetricValue, MetricsConfiguration, OnTestPlanRun, OnTestStepRun, Parameter, Result, RunStatus, SessionEvent, SessionMetricType, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog, } from './DTOs';
|
|
2
|
+
import { JSONCodec, nuid } from 'nats.ws';
|
|
3
3
|
import { booleanCodec, jsonCodec, numberCodec, stringCodec } from './encoders';
|
|
4
4
|
import { BaseClient } from './BaseClient';
|
|
5
5
|
export class SessionClient extends BaseClient {
|
|
@@ -272,37 +272,46 @@ export class SessionClient extends BaseClient {
|
|
|
272
272
|
* @param {SubscriptionOptions} options?
|
|
273
273
|
* @returns Subscription
|
|
274
274
|
*/
|
|
275
|
-
connectMetric(metricInfo, handler
|
|
276
|
-
return this.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
275
|
+
connectMetric(metricInfo, handler) {
|
|
276
|
+
return this.connection.jetstreamManager({ checkAPI: false }).then(jetStreamManager => {
|
|
277
|
+
const stream = `${this.baseSubject}.Events.Metrics.${metricInfo.subjectPostfix}`;
|
|
278
|
+
return jetStreamManager.consumers
|
|
279
|
+
.add(stream, {
|
|
280
|
+
name: `runner-web-client-metric-consumer-${nuid.next()}`,
|
|
281
|
+
})
|
|
282
|
+
.then(consumerInfo => { var _a; return (_a = this.connection) === null || _a === void 0 ? void 0 : _a.jetstream().consumers.get(consumerInfo.stream_name, consumerInfo.name); })
|
|
283
|
+
.then(consumer => {
|
|
284
|
+
consumer === null || consumer === void 0 ? void 0 : consumer.consume({
|
|
285
|
+
callback(encodedMessage) {
|
|
286
|
+
var _a, _b;
|
|
287
|
+
try {
|
|
288
|
+
const time = Number.parseInt((_b = (_a = encodedMessage.headers) === null || _a === void 0 ? void 0 : _a.get('timestamp')) !== null && _b !== void 0 ? _b : '');
|
|
289
|
+
let value;
|
|
290
|
+
// Decode the value based on the metric value type given in the metric info
|
|
291
|
+
switch (metricInfo.type) {
|
|
292
|
+
case SessionMetricType.Boolean:
|
|
293
|
+
value = booleanCodec.decode(encodedMessage.data);
|
|
294
|
+
break;
|
|
295
|
+
case SessionMetricType.Double:
|
|
296
|
+
value = numberCodec.decode(encodedMessage.data);
|
|
297
|
+
break;
|
|
298
|
+
case SessionMetricType.String:
|
|
299
|
+
value = stringCodec.decode(encodedMessage.data);
|
|
300
|
+
break;
|
|
301
|
+
default:
|
|
302
|
+
value = jsonCodec.decode(encodedMessage.data);
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
handler(new MetricValue({ value, time }), null);
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
handler(undefined, error);
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
return consumer;
|
|
313
|
+
});
|
|
314
|
+
});
|
|
306
315
|
}
|
|
307
316
|
/**
|
|
308
317
|
* Unsubscibe from session events
|
|
@@ -780,18 +789,18 @@ export class SessionClient extends BaseClient {
|
|
|
780
789
|
* Get the metric information
|
|
781
790
|
* @returns Promise
|
|
782
791
|
*/
|
|
783
|
-
|
|
784
|
-
return this.request('
|
|
785
|
-
.then(metricsRequestJs =>
|
|
792
|
+
getMetricsConfiguration() {
|
|
793
|
+
return this.request('GetMetricsConfiguration')
|
|
794
|
+
.then(metricsRequestJs => MetricsConfiguration.fromJS(metricsRequestJs))
|
|
786
795
|
.then(this.success())
|
|
787
796
|
.catch(this.error());
|
|
788
797
|
}
|
|
789
798
|
/**
|
|
790
799
|
* Set the metric information. Used for setting up which metrics should be published for polling.
|
|
791
|
-
* @param {
|
|
800
|
+
* @param {IMetricsConfiguration} metricsRequest
|
|
792
801
|
* @returns Promise
|
|
793
802
|
*/
|
|
794
|
-
|
|
795
|
-
return this.request('
|
|
803
|
+
setMetricsConfiguration(metricsRequest) {
|
|
804
|
+
return this.request('SetMetricsConfiguration', metricsRequest).then(this.success()).catch(this.error());
|
|
796
805
|
}
|
|
797
806
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentap/runner-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0-alpha.1.2.10769060909",
|
|
4
4
|
"description": "This is the web client for the OpenTAP Runner.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/mjs/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typescript": "^4.8.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"nats.ws": "^1.
|
|
48
|
+
"nats.ws": "^1.29.0",
|
|
49
49
|
"uuid": "^9.0.0",
|
|
50
50
|
"events": "^3.3.0"
|
|
51
51
|
},
|