@opentap/runner-client 2.19.0-alpha.1.8.7873212134 → 2.19.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.
@@ -21,13 +21,9 @@ export declare class BaseClient {
21
21
  /** Set request access token */
22
22
  set accessToken(value: string);
23
23
  /** Get request headers */
24
- get headers(): {
25
- [key: string]: string;
26
- };
24
+ get headers(): Headers;
27
25
  /** Set request headers */
28
- set headers(value: {
29
- [key: string]: string;
30
- });
26
+ set headers(value: Headers);
31
27
  /** Get timeout */
32
28
  get timeout(): number;
33
29
  /** Set timeout in milliseconds. Default is 40000 milliseconds */
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __assign = (this && this.__assign) || function () {
3
2
  __assign = Object.assign || function(t) {
4
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -46,12 +45,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
46
  }
48
47
  };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.BaseClient = void 0;
51
- var DTOs_1 = require("./DTOs");
52
- var nats_ws_1 = require("nats.ws");
53
- var events_1 = require("events");
54
- var uuid_1 = require("uuid");
48
+ import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileDescriptor, ListItemType, ProfileGroup, } from './DTOs';
49
+ import { Empty, ErrorCode, JSONCodec, StringCodec, connect, headers, } from 'nats.ws';
50
+ import { EventEmitter } from 'events';
51
+ import { v4 as uuidv4 } from 'uuid';
55
52
  var DEFAULT_TIMEOUT = 40000; // default timeout of 40 seconds
56
53
  var Events;
57
54
  (function (Events) {
@@ -60,11 +57,11 @@ var Events;
60
57
  var BaseClient = /** @class */ (function () {
61
58
  function BaseClient(baseSubject, options) {
62
59
  this.domainAccess = new Map();
63
- this._headers = {};
60
+ this._headers = new Headers();
64
61
  this.baseSubject = baseSubject;
65
62
  this.connectionOptions = __assign({}, options) || {};
66
63
  this.connectionOptions.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || DEFAULT_TIMEOUT;
67
- this.eventEmitter = new events_1.EventEmitter();
64
+ this.eventEmitter = new EventEmitter();
68
65
  }
69
66
  Object.defineProperty(BaseClient.prototype, "accessToken", {
70
67
  /** Get request access token */
@@ -103,7 +100,7 @@ var BaseClient = /** @class */ (function () {
103
100
  configurable: true
104
101
  });
105
102
  BaseClient.prototype.withTimeout = function (promise, timeout) {
106
- return Promise.race([promise, new Promise(function (_, reject) { return setTimeout(function () { return reject(new Error(nats_ws_1.ErrorCode.Timeout)); }, timeout); })]);
103
+ return Promise.race([promise, new Promise(function (_, reject) { return setTimeout(function () { return reject(new Error(ErrorCode.Timeout)); }, timeout); })]);
107
104
  };
108
105
  /**
109
106
  * Send a request to the nats server.
@@ -129,15 +126,15 @@ var BaseClient = /** @class */ (function () {
129
126
  data = this.encode(payload);
130
127
  headers = this.buildHeaders();
131
128
  timeout = (options === null || options === void 0 ? void 0 : options.timeout) || this.timeout;
132
- replySubject = "".concat(subject, ".Reply.").concat((0, uuid_1.v4)());
129
+ replySubject = "".concat(subject, ".Reply.").concat(uuidv4());
133
130
  serverMaxPayload = (_b = (_a = this.connection) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.max_payload;
134
131
  chunkSize = serverMaxPayload ? serverMaxPayload - 50000 : 512000;
135
132
  // The Session and the Client need to agree on the chunk size. Put it in a header.
136
133
  headers.append('ChunkSize', chunkSize.toString());
137
- requestId = (0, uuid_1.v4)();
134
+ requestId = uuidv4();
138
135
  headers.append('RequestId', requestId);
139
136
  opts = __assign(__assign({}, options === null || options === void 0 ? void 0 : options.publishOptions), { headers: headers, reply: replySubject });
140
- fileDescriptor = new DTOs_1.FileDescriptor(data.length, chunkSize);
137
+ fileDescriptor = new FileDescriptor(data.length, chunkSize);
141
138
  chunkNumber = 1;
142
139
  headers.set('ChunkNumber', chunkNumber.toString());
143
140
  getChunk = function (chunk) {
@@ -196,10 +193,10 @@ var BaseClient = /** @class */ (function () {
196
193
  if (byteArray.length === 0) {
197
194
  return Promise.resolve(undefined);
198
195
  }
199
- var jsonCodec = (0, nats_ws_1.JSONCodec)();
196
+ var jsonCodec = JSONCodec();
200
197
  // If a raw response is requested, we should avoid decoding the bytes.
201
198
  var response = (options === null || options === void 0 ? void 0 : options.rawResponse) ? byteArray : jsonCodec.decode(byteArray);
202
- return isErrorResponse ? Promise.reject(DTOs_1.ErrorResponse.fromJS(response)) : Promise.resolve(response);
199
+ return isErrorResponse ? Promise.reject(ErrorResponse.fromJS(response)) : Promise.resolve(response);
203
200
  });
204
201
  chunk = getChunk(0);
205
202
  this.connection.publish(subject, chunk, opts);
@@ -214,7 +211,7 @@ var BaseClient = /** @class */ (function () {
214
211
  // an empty message
215
212
  if (data.length > 0 && data.length % fileDescriptor.chunkSize === 0) {
216
213
  headers.set('ChunkNumber', chunkNumber.toString());
217
- this.connection.publish(subject, nats_ws_1.Empty, opts);
214
+ this.connection.publish(subject, Empty, opts);
218
215
  }
219
216
  // Now that we have sent the terminating chunk, the result should arrive on our promise.
220
217
  return [2 /*return*/, this.withTimeout(responsePromise, timeout).catch(function (err) {
@@ -231,11 +228,11 @@ var BaseClient = /** @class */ (function () {
231
228
  * @returns
232
229
  */
233
230
  BaseClient.prototype.natsErrorHandler = function (error, subject) {
234
- var errorResponse = new DTOs_1.ErrorResponse(error);
231
+ var errorResponse = new ErrorResponse(error);
235
232
  errorResponse.subject = subject;
236
233
  errorResponse.stackTrace = error === null || error === void 0 ? void 0 : error.stack;
237
234
  switch (error === null || error === void 0 ? void 0 : error.code) {
238
- case nats_ws_1.ErrorCode.NoResponders:
235
+ case ErrorCode.NoResponders:
239
236
  errorResponse.message = 'No Responders';
240
237
  break;
241
238
  default:
@@ -249,14 +246,11 @@ var BaseClient = /** @class */ (function () {
249
246
  * @returns {MsgHdrs} Header object
250
247
  */
251
248
  BaseClient.prototype.buildHeaders = function () {
252
- var _a;
253
- var _headers = (0, nats_ws_1.headers)();
249
+ var _a, _b;
250
+ var _headers = headers();
254
251
  this._accessToken && _headers.set('Authorization', this._accessToken);
255
252
  (_a = this.domainAccess) === null || _a === void 0 ? void 0 : _a.forEach(function (value, key) { return _headers.append('DomainAuthorization', "".concat(key, "|").concat(value)); });
256
- Object.entries(this._headers).forEach(function (_a) {
257
- var key = _a[0], value = _a[1];
258
- return _headers.append(key, value);
259
- });
253
+ (_b = this._headers) === null || _b === void 0 ? void 0 : _b.forEach(function (value, key) { return _headers.append(key, value); });
260
254
  return _headers;
261
255
  };
262
256
  /**
@@ -277,12 +271,12 @@ var BaseClient = /** @class */ (function () {
277
271
  };
278
272
  BaseClient.prototype.encode = function (payload) {
279
273
  if (!payload) {
280
- return nats_ws_1.Empty;
274
+ return Empty;
281
275
  }
282
276
  if (payload instanceof Uint8Array) {
283
277
  return payload;
284
278
  }
285
- return (0, nats_ws_1.StringCodec)().encode(JSON.stringify(payload));
279
+ return StringCodec().encode(JSON.stringify(payload));
286
280
  };
287
281
  /**
288
282
  * Create a connection to the nats server.
@@ -302,7 +296,7 @@ var BaseClient = /** @class */ (function () {
302
296
  _a.label = 1;
303
297
  case 1:
304
298
  _a.trys.push([1, 3, , 4]);
305
- return [4 /*yield*/, (0, nats_ws_1.connect)(this.connectionOptions)
299
+ return [4 /*yield*/, connect(this.connectionOptions)
306
300
  .then(function (connection) {
307
301
  _this.connection = connection;
308
302
  return Promise.resolve();
@@ -392,7 +386,7 @@ var BaseClient = /** @class */ (function () {
392
386
  return this.request('GetComponentSettingsOverview')
393
387
  .then(function (componentSettingsIdentifiers) {
394
388
  return componentSettingsIdentifiers.map(function (componentSettingsIdentifier) {
395
- return DTOs_1.ComponentSettingsIdentifier.fromJS(componentSettingsIdentifier);
389
+ return ComponentSettingsIdentifier.fromJS(componentSettingsIdentifier);
396
390
  });
397
391
  })
398
392
  .then(this.success())
@@ -408,7 +402,7 @@ var BaseClient = /** @class */ (function () {
408
402
  BaseClient.prototype.setComponentSettings = function (groupName, name, returnedSettings) {
409
403
  var setComponentSettingsRequest = { groupName: groupName, name: name, returnedSettings: returnedSettings };
410
404
  return this.request('SetComponentSettings', setComponentSettingsRequest)
411
- .then(function (componentSettingsBase) { return DTOs_1.ComponentSettingsBase.fromJS(componentSettingsBase); })
405
+ .then(function (componentSettingsBase) { return ComponentSettingsBase.fromJS(componentSettingsBase); })
412
406
  .then(this.success())
413
407
  .catch(this.error());
414
408
  };
@@ -421,7 +415,7 @@ var BaseClient = /** @class */ (function () {
421
415
  BaseClient.prototype.getComponentSettings = function (groupName, name) {
422
416
  var getComponentSettingsRequest = { groupName: groupName, name: name };
423
417
  return this.request('GetComponentSettings', getComponentSettingsRequest)
424
- .then(function (componentSettingsBase) { return DTOs_1.ComponentSettingsBase.fromJS(componentSettingsBase); })
418
+ .then(function (componentSettingsBase) { return ComponentSettingsBase.fromJS(componentSettingsBase); })
425
419
  .then(this.success())
426
420
  .catch(this.error());
427
421
  };
@@ -435,7 +429,7 @@ var BaseClient = /** @class */ (function () {
435
429
  BaseClient.prototype.getComponentSettingsListItem = function (groupName, name, index) {
436
430
  var getComponentSettingsListItemRequest = { groupName: groupName, name: name, index: index };
437
431
  return this.request('GetComponentSettingsListItem', getComponentSettingsListItemRequest)
438
- .then(function (componentSettingsListItem) { return DTOs_1.ComponentSettingsListItem.fromJS(componentSettingsListItem); })
432
+ .then(function (componentSettingsListItem) { return ComponentSettingsListItem.fromJS(componentSettingsListItem); })
439
433
  .then(this.success())
440
434
  .catch(this.error());
441
435
  };
@@ -450,7 +444,7 @@ var BaseClient = /** @class */ (function () {
450
444
  BaseClient.prototype.setComponentSettingsListItem = function (groupName, name, index, item) {
451
445
  var setComponentSettingsListItemRequest = { groupName: groupName, name: name, index: index, item: item };
452
446
  return this.request('SetComponentSettingsListItem', setComponentSettingsListItemRequest)
453
- .then(function (componentSettingsListItem) { return DTOs_1.ComponentSettingsListItem.fromJS(componentSettingsListItem); })
447
+ .then(function (componentSettingsListItem) { return ComponentSettingsListItem.fromJS(componentSettingsListItem); })
454
448
  .then(this.success())
455
449
  .catch(this.error());
456
450
  };
@@ -470,7 +464,7 @@ var BaseClient = /** @class */ (function () {
470
464
  propertyName: propertyName,
471
465
  };
472
466
  return this.request('GetComponentSettingDataGrid', getComponentSettingDataGridRequest)
473
- .then(function (dataGridControl) { return DTOs_1.DataGridControl.fromJS(dataGridControl); })
467
+ .then(function (dataGridControl) { return DataGridControl.fromJS(dataGridControl); })
474
468
  .then(this.success())
475
469
  .catch(this.error());
476
470
  };
@@ -492,7 +486,7 @@ var BaseClient = /** @class */ (function () {
492
486
  dataGridControl: dataGridControl,
493
487
  };
494
488
  return this.request('SetComponentSettingDataGrid', setComponentSettingDataGridRequest)
495
- .then(function (dataGridControl) { return DTOs_1.DataGridControl.fromJS(dataGridControl); })
489
+ .then(function (dataGridControl) { return DataGridControl.fromJS(dataGridControl); })
496
490
  .then(this.success())
497
491
  .catch(this.error());
498
492
  };
@@ -514,7 +508,7 @@ var BaseClient = /** @class */ (function () {
514
508
  typeName: typeName,
515
509
  };
516
510
  return this.request('AddComponentSettingDataGridItemType', addComponentSettingDataGridItemTypeRequest)
517
- .then(function (dataGridControl) { return DTOs_1.DataGridControl.fromJS(dataGridControl); })
511
+ .then(function (dataGridControl) { return DataGridControl.fromJS(dataGridControl); })
518
512
  .then(this.success())
519
513
  .catch(this.error());
520
514
  };
@@ -534,7 +528,7 @@ var BaseClient = /** @class */ (function () {
534
528
  propertyName: propertyName,
535
529
  };
536
530
  return this.request('AddComponentSettingDataGridItem', getComponentSettingDataGridRequest)
537
- .then(function (dataGridControl) { return DTOs_1.DataGridControl.fromJS(dataGridControl); })
531
+ .then(function (dataGridControl) { return DataGridControl.fromJS(dataGridControl); })
538
532
  .then(this.success())
539
533
  .catch(this.error());
540
534
  };
@@ -554,7 +548,7 @@ var BaseClient = /** @class */ (function () {
554
548
  propertyName: propertyName,
555
549
  };
556
550
  return this.request('GetComponentSettingDataGridTypes', getComponentSettingDataGridRequest)
557
- .then(function (listItemTypes) { return listItemTypes.map(function (listItemType) { return DTOs_1.ListItemType.fromJS(listItemType); }); })
551
+ .then(function (listItemTypes) { return listItemTypes.map(function (listItemType) { return ListItemType.fromJS(listItemType); }); })
558
552
  .then(this.success())
559
553
  .catch(this.error());
560
554
  };
@@ -565,7 +559,7 @@ var BaseClient = /** @class */ (function () {
565
559
  */
566
560
  BaseClient.prototype.setComponentSettingsProfiles = function (returnedSettings) {
567
561
  return this.request('SetComponentSettingsProfiles', returnedSettings)
568
- .then(function (profileGroups) { return profileGroups.map(function (profileGroup) { return DTOs_1.ProfileGroup.fromJS(profileGroup); }); })
562
+ .then(function (profileGroups) { return profileGroups.map(function (profileGroup) { return ProfileGroup.fromJS(profileGroup); }); })
569
563
  .then(this.success())
570
564
  .catch(this.error());
571
565
  };
@@ -575,7 +569,7 @@ var BaseClient = /** @class */ (function () {
575
569
  */
576
570
  BaseClient.prototype.getComponentSettingsProfiles = function () {
577
571
  return this.request('GetComponentSettingsProfiles')
578
- .then(function (profileGroups) { return profileGroups.map(function (profileGroup) { return DTOs_1.ProfileGroup.fromJS(profileGroup); }); })
572
+ .then(function (profileGroups) { return profileGroups.map(function (profileGroup) { return ProfileGroup.fromJS(profileGroup); }); })
579
573
  .then(this.success())
580
574
  .catch(this.error());
581
575
  };
@@ -606,7 +600,7 @@ var BaseClient = /** @class */ (function () {
606
600
  */
607
601
  BaseClient.prototype.loadComponentSettingsFromRepository = function (packageReference) {
608
602
  return this.request('LoadComponentSettingsFromRepository', packageReference)
609
- .then(function (errorResponses) { return errorResponses.map(function (errorResponse) { return DTOs_1.ErrorResponse.fromJS(errorResponse); }); })
603
+ .then(function (errorResponses) { return errorResponses.map(function (errorResponse) { return ErrorResponse.fromJS(errorResponse); }); })
610
604
  .then(this.success())
611
605
  .catch(this.error());
612
606
  };
@@ -629,7 +623,7 @@ var BaseClient = /** @class */ (function () {
629
623
  BaseClient.prototype.getComponentSettingsListAvailableTypes = function (groupName, name) {
630
624
  var getComponentSettingsRequest = { groupName: groupName, name: name };
631
625
  return this.request('GetComponentSettingsListAvailableTypes', getComponentSettingsRequest)
632
- .then(function (listItemTypes) { return listItemTypes.map(function (listItemType) { return DTOs_1.ListItemType.fromJS(listItemType); }); })
626
+ .then(function (listItemTypes) { return listItemTypes.map(function (listItemType) { return ListItemType.fromJS(listItemType); }); })
633
627
  .then(this.success())
634
628
  .catch(this.error());
635
629
  };
@@ -643,7 +637,7 @@ var BaseClient = /** @class */ (function () {
643
637
  BaseClient.prototype.addComponentSettingsListItem = function (groupName, name, typeName) {
644
638
  var addComponentSettingsListItemRequest = { groupName: groupName, name: name, typeName: typeName };
645
639
  return this.request('AddComponentSettingsListItem', addComponentSettingsListItemRequest)
646
- .then(function (componentSettingsBase) { return DTOs_1.ComponentSettingsBase.fromJS(componentSettingsBase); })
640
+ .then(function (componentSettingsBase) { return ComponentSettingsBase.fromJS(componentSettingsBase); })
647
641
  .then(this.success())
648
642
  .catch(this.error());
649
643
  };
@@ -663,4 +657,4 @@ var BaseClient = /** @class */ (function () {
663
657
  };
664
658
  return BaseClient;
665
659
  }());
666
- exports.BaseClient = BaseClient;
660
+ export { BaseClient };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export declare class Image implements IImage {
3
2
  name?: string | undefined;
4
3
  packages?: PackageSpecifier[];
@@ -1206,6 +1205,36 @@ export declare class TestPlanSettingsChangedEventArgs extends SessionEvent imple
1206
1205
  toJSON(data?: any): any;
1207
1206
  }
1208
1207
  export declare type ITestPlanSettingsChangedEventArgs = ISessionEvent;
1208
+ export interface IOnTestPlanRun {
1209
+ status?: string;
1210
+ userId?: string;
1211
+ }
1212
+ export declare class OnTestPlanRun implements IOnTestPlanRun {
1213
+ status?: string;
1214
+ userId?: string;
1215
+ constructor(data?: IOnTestPlanRun);
1216
+ init(_data?: any): void;
1217
+ static fromJS(data: any): OnTestPlanRun;
1218
+ toJSON(data?: any): any;
1219
+ }
1220
+ export interface IOnTestStepRun {
1221
+ status?: string;
1222
+ stepId?: string;
1223
+ parentRunId?: string;
1224
+ verdict?: string;
1225
+ duration?: string;
1226
+ }
1227
+ export declare class OnTestStepRun implements IOnTestStepRun {
1228
+ status?: string;
1229
+ stepId?: string;
1230
+ parentRunId?: string;
1231
+ verdict?: string;
1232
+ duration?: string;
1233
+ constructor(data?: IOnTestStepRun);
1234
+ init(_data?: any): void;
1235
+ static fromJS(data: any): OnTestStepRun;
1236
+ toJSON(data?: any): any;
1237
+ }
1209
1238
  export interface ITestStepRunEvent {
1210
1239
  parent?: string;
1211
1240
  testStepId?: string;