@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.
- package/{dist/mjs → lib}/BaseClient.d.ts +2 -6
- package/{dist/cjs → lib}/BaseClient.js +37 -43
- package/{dist/mjs → lib}/DTOs.d.ts +30 -1
- package/{dist/cjs → lib}/DTOs.js +177 -116
- package/{dist/cjs → lib}/RunnerClient.js +17 -20
- package/{dist/mjs → lib}/SessionClient.d.ts +59 -1
- package/{dist/cjs → lib}/SessionClient.js +212 -43
- package/{dist/cjs → lib}/SystemClient.js +16 -19
- package/package.json +5 -10
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/requestDTOs.js +0 -2
- package/dist/mjs/BaseClient.js +0 -595
- package/dist/mjs/DTOs.js +0 -3369
- package/dist/mjs/RunnerClient.js +0 -175
- package/dist/mjs/SessionClient.js +0 -567
- package/dist/mjs/SystemClient.js +0 -159
- package/dist/mjs/package.json +0 -3
- /package/{dist/mjs → lib}/RunnerClient.d.ts +0 -0
- /package/{dist/mjs → lib}/SystemClient.d.ts +0 -0
- /package/{dist/mjs → lib}/index.d.ts +0 -0
- /package/{dist/mjs → lib}/index.js +0 -0
- /package/{dist/mjs → lib}/requestDTOs.d.ts +0 -0
- /package/{dist/mjs → lib}/requestDTOs.js +0 -0
|
@@ -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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
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(
|
|
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((
|
|
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 = (
|
|
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
|
|
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 =
|
|
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(
|
|
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,
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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
|
|
274
|
+
return Empty;
|
|
281
275
|
}
|
|
282
276
|
if (payload instanceof Uint8Array) {
|
|
283
277
|
return payload;
|
|
284
278
|
}
|
|
285
|
-
return
|
|
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*/,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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;
|