@opentap/runner-client 1.2.3 → 2.0.0-alpha.1.1

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/README.md CHANGED
@@ -11,6 +11,9 @@ This is the web client for the OpenTAP Runner.
11
11
 
12
12
  ## How to install the client
13
13
 
14
+ - For Angular < 11 or webpack < 5, use version < 2
15
+ - For Angular >= 11 or webpack >= 5, use version >= 2.x.x
16
+
14
17
  Install with npm
15
18
 
16
19
  ```bash
@@ -1,5 +1,5 @@
1
1
  import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileParameter, FileResponse, ListItemType, ProfileGroup, RepositoryPackageReference, RepositorySettingsPackageDefinition, SettingsTapPackage } from './DTOs';
2
- import { ConnectionOptions, RequestOptions, Subscription, SubscriptionOptions } from 'nats.ws/cjs/nats.js';
2
+ import { ConnectionOptions, RequestOptions, Subscription, SubscriptionOptions } from 'nats.ws';
3
3
  export declare class BaseClient {
4
4
  private connection;
5
5
  private baseSubject;
@@ -26,9 +26,11 @@ export declare class BaseClient {
26
26
  * @param subject The subject to request
27
27
  * @param payload (optional)
28
28
  * @param options (optional)
29
+ * @param isFullSubject (optional) If true, use the subject as request subject
30
+ * without appending it to the baseSubject
29
31
  * @returns Promise of an object
30
32
  */
31
- protected request<T>(subject: string, payload?: any, options?: RequestOptions): Promise<T>;
33
+ protected request<T>(subject: string, payload?: any, options?: RequestOptions, isFullSubject?: boolean): Promise<T>;
32
34
  /**
33
35
  * Handle the error
34
36
  * @param error
@@ -48,6 +50,22 @@ export declare class BaseClient {
48
50
  * @returns Subscription object
49
51
  */
50
52
  protected subscribe(subject: string, options: SubscriptionOptions): Subscription;
53
+ /**
54
+ * Send an object to the nats server with chunks.
55
+ * @param subject The subject to request
56
+ * @param payload (optional)
57
+ * @param options (optional)
58
+ * @returns Promise of an object
59
+ */
60
+ protected sendChunked<T>(subject: string, payload?: any, options?: RequestOptions): Promise<T>;
61
+ /**
62
+ * Request an object to the nats server with chunks.
63
+ * @param subject The subject to request
64
+ * @param payload (optional)
65
+ * @param options (optional)
66
+ * @returns Promise of an object
67
+ */
68
+ protected requestChunked<T>(subject: string, replySubject: string, payload: any, options?: RequestOptions, isFullSubject?: boolean): Promise<T>;
51
69
  /**
52
70
  * Check if the the response is an error from the server.
53
71
  * @param {any} response
package/lib/BaseClient.js CHANGED
@@ -45,8 +45,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, ListItemType, ProfileGroup, } from './DTOs';
49
- import { Empty, ErrorCode, JSONCodec, StringCodec, connect, headers, } from 'nats.ws/cjs/nats.js';
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
57
+ import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileDescriptor, ListItemType, ProfileGroup, } from './DTOs';
58
+ import { Empty, ErrorCode, JSONCodec, StringCodec, connect, headers, } from 'nats.ws';
50
59
  var DEFAULT_TIMEOUT = 6000;
51
60
  var BaseClient = /** @class */ (function () {
52
61
  function BaseClient(baseSubject, options) {
@@ -97,16 +106,18 @@ var BaseClient = /** @class */ (function () {
97
106
  * @param subject The subject to request
98
107
  * @param payload (optional)
99
108
  * @param options (optional)
109
+ * @param isFullSubject (optional) If true, use the subject as request subject
110
+ * without appending it to the baseSubject
100
111
  * @returns Promise of an object
101
112
  */
102
- BaseClient.prototype.request = function (subject, payload, options) {
113
+ BaseClient.prototype.request = function (subject, payload, options, isFullSubject) {
103
114
  return __awaiter(this, void 0, void 0, function () {
104
115
  var stringCodec, data, headers, opts;
105
116
  var _this = this;
106
117
  return __generator(this, function (_a) {
107
118
  switch (_a.label) {
108
119
  case 0:
109
- subject = "".concat(this.baseSubject, ".Request.").concat(subject);
120
+ subject = isFullSubject ? subject : "".concat(this.baseSubject, ".Request.").concat(subject);
110
121
  if (!this.connection)
111
122
  return [2 /*return*/, Promise.reject("".concat(subject, ": Connection is down! Please try again!"))];
112
123
  if (this.connection.isClosed())
@@ -178,6 +189,132 @@ var BaseClient = /** @class */ (function () {
178
189
  var natsSubject = "".concat(this.baseSubject, ".").concat(subject);
179
190
  return this.connection.subscribe(natsSubject, options);
180
191
  };
192
+ /**
193
+ * Send an object to the nats server with chunks.
194
+ * @param subject The subject to request
195
+ * @param payload (optional)
196
+ * @param options (optional)
197
+ * @returns Promise of an object
198
+ */
199
+ BaseClient.prototype.sendChunked = function (subject, payload, options) {
200
+ return __awaiter(this, void 0, void 0, function () {
201
+ var stringCodec, data, headers, opts, fileDescriptor, getChunk, dataSubject, i;
202
+ var _this = this;
203
+ return __generator(this, function (_a) {
204
+ switch (_a.label) {
205
+ case 0:
206
+ if (!this.connection)
207
+ return [2 /*return*/, Promise.reject("".concat(subject, ": Connection is down! Please try again!"))];
208
+ if (this.connection.isClosed())
209
+ return [2 /*return*/, Promise.reject("".concat(subject, ": Connection has been closed! Please reconnect!"))];
210
+ stringCodec = StringCodec();
211
+ data = payload ? stringCodec.encode(JSON.stringify(payload)) : Empty;
212
+ headers = this.buildHeaders();
213
+ opts = __assign(__assign({}, options), { timeout: this.timeout, headers: headers });
214
+ fileDescriptor = new FileDescriptor(data.length);
215
+ if (!fileDescriptor.numberOfChunks)
216
+ return [2 /*return*/, Promise.reject("".concat(subject, ": File is empty!"))];
217
+ getChunk = function (chunk) {
218
+ var offset = chunk * fileDescriptor.chunkSize;
219
+ return data.slice(offset, offset + fileDescriptor.chunkSize);
220
+ };
221
+ return [4 /*yield*/, this.request(subject, fileDescriptor, opts)];
222
+ case 1:
223
+ dataSubject = _a.sent();
224
+ for (i = 0; i < fileDescriptor.numberOfChunks; i++) {
225
+ this.connection.publish(dataSubject, getChunk(i), opts);
226
+ }
227
+ return [2 /*return*/, new Promise(function (resolve, reject) {
228
+ if (!_this.connection) {
229
+ return Promise.reject('No nats connection.');
230
+ }
231
+ var combinedResult = new Uint8Array([]);
232
+ // Subscribe to dataSubject before sending the terminating message to ensure we are listening before the server starts responding
233
+ var subscription = _this.connection.subscribe(dataSubject);
234
+ // Publish an empty message to indicate that we are ready to listen
235
+ _this.connection.publish(dataSubject, Empty, opts);
236
+ var first = true;
237
+ subscription.callback = function (error, message) {
238
+ // The first message is the empty message we published above.
239
+ // We should discard this message before we proceed
240
+ if (first === true) {
241
+ first = false;
242
+ return;
243
+ }
244
+ if (error) {
245
+ reject(error);
246
+ }
247
+ combinedResult = new Uint8Array(__spreadArray(__spreadArray([], Array.from(combinedResult), true), Array.from(message === null || message === void 0 ? void 0 : message.data), true));
248
+ if ((message === null || message === void 0 ? void 0 : message.data.length) === 0) {
249
+ resolve(combinedResult);
250
+ }
251
+ };
252
+ }).then(function (byteArray) {
253
+ var jsonCodec = JSONCodec();
254
+ var response = jsonCodec.decode(byteArray);
255
+ return _this.isErrorResponse(response) ? Promise.reject(ErrorResponse.fromJS(response)) : Promise.resolve(response);
256
+ })];
257
+ }
258
+ });
259
+ });
260
+ };
261
+ /**
262
+ * Request an object to the nats server with chunks.
263
+ * @param subject The subject to request
264
+ * @param payload (optional)
265
+ * @param options (optional)
266
+ * @returns Promise of an object
267
+ */
268
+ BaseClient.prototype.requestChunked = function (subject, replySubject, payload, options, isFullSubject) {
269
+ return __awaiter(this, void 0, void 0, function () {
270
+ var fileSize;
271
+ var _this = this;
272
+ return __generator(this, function (_a) {
273
+ if (!this.connection)
274
+ return [2 /*return*/, Promise.reject("".concat(subject, ": Connection is down! Please try again!"))];
275
+ if (this.connection.isClosed())
276
+ return [2 /*return*/, Promise.reject("".concat(subject, ": Connection has been closed! Please reconnect!"))];
277
+ fileSize = -1;
278
+ return [2 /*return*/, new Promise(function (resolve, reject) {
279
+ var combinedResult = new Uint8Array([]);
280
+ // Subscribe to the subject before starting the process
281
+ var subscription = _this.connection.subscribe(replySubject);
282
+ var resolveIfCompleted = function () {
283
+ if (combinedResult.length === fileSize) {
284
+ subscription.unsubscribe();
285
+ resolve(combinedResult);
286
+ }
287
+ };
288
+ subscription.callback = function (error, message) {
289
+ if (error) {
290
+ reject(error);
291
+ }
292
+ combinedResult = new Uint8Array(__spreadArray(__spreadArray([], Array.from(combinedResult), true), Array.from(message === null || message === void 0 ? void 0 : message.data), true));
293
+ resolveIfCompleted();
294
+ };
295
+ var headers = _this.buildHeaders();
296
+ var opts = __assign(__assign({}, options), { timeout: _this.timeout, headers: headers });
297
+ // Request the file descriptor from the runner by posting the reply subject
298
+ return _this.request(subject, payload, opts, isFullSubject)
299
+ .then(function (fileDescriptor) { return FileDescriptor.fromJS(fileDescriptor); })
300
+ .then(function (fileDescriptor) {
301
+ fileSize = fileDescriptor.fileSize;
302
+ resolveIfCompleted();
303
+ })
304
+ .catch(function (error) {
305
+ subscription.unsubscribe();
306
+ throw error;
307
+ });
308
+ }).then(function (byteArray) {
309
+ if (byteArray.length !== fileSize)
310
+ return Promise.reject("Unexpected response size. Expected ".concat(fileSize, " bytes, but got ").concat(byteArray.length, "."));
311
+ var jsonCodec = JSONCodec();
312
+ var response = jsonCodec.decode(byteArray);
313
+ return _this.isErrorResponse(response) ? Promise.reject(ErrorResponse.fromJS(response)) : Promise.resolve(response);
314
+ })];
315
+ });
316
+ });
317
+ };
181
318
  /**
182
319
  * Check if the the response is an error from the server.
183
320
  * @param {any} response
package/lib/DTOs.d.ts CHANGED
@@ -151,6 +151,7 @@ export declare class Setting extends AnnotatedObject implements ISetting {
151
151
  valueDescription?: string | undefined;
152
152
  propertyName?: string | undefined;
153
153
  icons?: Icon[] | undefined;
154
+ submit?: boolean | undefined;
154
155
  protected _discriminator: string;
155
156
  constructor(data?: ISetting);
156
157
  init(_data?: any): void;
@@ -164,6 +165,7 @@ export interface ISetting extends IAnnotatedObject {
164
165
  valueDescription?: string | undefined;
165
166
  propertyName?: string | undefined;
166
167
  icons?: Icon[] | undefined;
168
+ submit?: boolean | undefined;
167
169
  }
168
170
  export declare class Layout implements ILayout {
169
171
  mode?: LayoutMode;
@@ -416,6 +418,29 @@ export declare class PasswordControl extends Setting implements IPasswordControl
416
418
  export interface IPasswordControl extends ISetting {
417
419
  password?: string | undefined;
418
420
  }
421
+ export declare class TestPlanRequest implements ITestPlanRequest {
422
+ properties?: string[] | null | undefined;
423
+ subject?: string | undefined;
424
+ }
425
+ export interface ITestPlanRequest {
426
+ properties?: string[] | null | undefined;
427
+ subject?: string | undefined;
428
+ }
429
+ export declare class FileDescriptor implements IFileDescriptor {
430
+ numberOfChunks: number;
431
+ fileSize: number;
432
+ chunkSize: number;
433
+ private readonly defaultChunkSize;
434
+ constructor(fileSize: number, chunkSize?: number);
435
+ init(_data?: any): void;
436
+ static fromJS(data: any): FileDescriptor;
437
+ toJSON(data?: any): any;
438
+ }
439
+ export interface IFileDescriptor {
440
+ numberOfChunks: number;
441
+ fileSize: number;
442
+ chunkSize: number;
443
+ }
419
444
  export declare class ComponentSettings extends ComponentSettingsBase implements IComponentSettings {
420
445
  settings?: Setting[] | undefined;
421
446
  constructor(data?: IComponentSettings);
@@ -831,6 +856,7 @@ export interface ICommonContext {
831
856
  export declare class Interaction implements IInteraction {
832
857
  timeout?: string | undefined;
833
858
  title?: string | undefined;
859
+ modal?: boolean | undefined;
834
860
  settings?: Setting[] | undefined;
835
861
  id?: string;
836
862
  constructor(data?: IInteraction);
@@ -841,6 +867,7 @@ export declare class Interaction implements IInteraction {
841
867
  export interface IInteraction {
842
868
  timeout?: string | undefined;
843
869
  title?: string | undefined;
870
+ modal?: boolean | undefined;
844
871
  settings?: Setting[] | undefined;
845
872
  id?: string;
846
873
  }
package/lib/DTOs.js CHANGED
@@ -434,6 +434,7 @@ var Setting = /** @class */ (function (_super) {
434
434
  this.columnDisplayName = _data['ColumnDisplayName'] ? ColumnDisplayName.fromJS(_data['ColumnDisplayName']) : undefined;
435
435
  this.valueDescription = _data['ValueDescription'];
436
436
  this.propertyName = _data['PropertyName'];
437
+ this.submit = _data['Submit'];
437
438
  if (Array.isArray(_data['Icons'])) {
438
439
  this.icons = [];
439
440
  for (var _b = 0, _c = _data['Icons']; _b < _c.length; _b++) {
@@ -523,6 +524,7 @@ var Setting = /** @class */ (function (_super) {
523
524
  data['ColumnDisplayName'] = this.columnDisplayName ? this.columnDisplayName.toJSON() : undefined;
524
525
  data['ValueDescription'] = this.valueDescription;
525
526
  data['PropertyName'] = this.propertyName;
527
+ data['Submit'] = this.submit;
526
528
  if (Array.isArray(this.icons)) {
527
529
  data['Icons'] = [];
528
530
  for (var _b = 0, _c = this.icons; _b < _c.length; _b++) {
@@ -1236,6 +1238,46 @@ var PasswordControl = /** @class */ (function (_super) {
1236
1238
  return PasswordControl;
1237
1239
  }(Setting));
1238
1240
  export { PasswordControl };
1241
+ var TestPlanRequest = /** @class */ (function () {
1242
+ function TestPlanRequest() {
1243
+ }
1244
+ return TestPlanRequest;
1245
+ }());
1246
+ export { TestPlanRequest };
1247
+ var FileDescriptor = /** @class */ (function () {
1248
+ function FileDescriptor(fileSize, chunkSize) {
1249
+ var _a;
1250
+ this.defaultChunkSize = 512000;
1251
+ if (chunkSize === 0) {
1252
+ throw Error('chunkSize cannot set to 0');
1253
+ }
1254
+ this.fileSize = fileSize;
1255
+ this.chunkSize = chunkSize !== null && chunkSize !== void 0 ? chunkSize : this.defaultChunkSize;
1256
+ this.numberOfChunks = Math.floor((((_a = this.fileSize) !== null && _a !== void 0 ? _a : 0) + this.chunkSize - 1) / this.chunkSize);
1257
+ }
1258
+ FileDescriptor.prototype.init = function (_data) {
1259
+ if (_data) {
1260
+ this.numberOfChunks = _data['NumberOfChunks'];
1261
+ this.fileSize = _data['FileSize'];
1262
+ this.chunkSize = _data['ChunkSize'];
1263
+ }
1264
+ };
1265
+ FileDescriptor.fromJS = function (data) {
1266
+ data = typeof data === 'object' ? data : {};
1267
+ var result = new FileDescriptor(0);
1268
+ result.init(data);
1269
+ return result;
1270
+ };
1271
+ FileDescriptor.prototype.toJSON = function (data) {
1272
+ data = typeof data === 'object' ? data : {};
1273
+ data['NumberOfChunks'] = this.numberOfChunks;
1274
+ data['FileSize'] = this.fileSize;
1275
+ data['ChunkSize'] = this.chunkSize;
1276
+ return data;
1277
+ };
1278
+ return FileDescriptor;
1279
+ }());
1280
+ export { FileDescriptor };
1239
1281
  var ComponentSettings = /** @class */ (function (_super) {
1240
1282
  __extends(ComponentSettings, _super);
1241
1283
  function ComponentSettings(data) {
@@ -2455,6 +2497,7 @@ var Interaction = /** @class */ (function () {
2455
2497
  if (_data) {
2456
2498
  this.timeout = _data['Timeout'];
2457
2499
  this.title = _data['Title'];
2500
+ this.modal = _data['Modal'];
2458
2501
  if (Array.isArray(_data['Settings'])) {
2459
2502
  this.settings = [];
2460
2503
  for (var _i = 0, _a = _data['Settings']; _i < _a.length; _i++) {
@@ -2475,6 +2518,7 @@ var Interaction = /** @class */ (function () {
2475
2518
  data = typeof data === 'object' ? data : {};
2476
2519
  data['Timeout'] = this.timeout;
2477
2520
  data['Title'] = this.title;
2521
+ data['Modal'] = this.modal;
2478
2522
  if (Array.isArray(this.settings)) {
2479
2523
  data['Settings'] = [];
2480
2524
  for (var _i = 0, _a = this.settings; _i < _a.length; _i++) {
@@ -2,9 +2,6 @@ import { Image, Session } from './DTOs';
2
2
  import { BaseClient } from './BaseClient';
3
3
  import { ConnectionOptions } from 'nats.ws';
4
4
  export declare class RunnerClient extends BaseClient {
5
- private http;
6
- private baseUrl;
7
- protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
8
5
  constructor(baseSubject: string, options: ConnectionOptions);
9
6
  /**
10
7
  * Get the created image with the specified ID.
@@ -18,9 +18,7 @@ import { BaseClient } from './BaseClient';
18
18
  var RunnerClient = /** @class */ (function (_super) {
19
19
  __extends(RunnerClient, _super);
20
20
  function RunnerClient(baseSubject, options) {
21
- var _this = _super.call(this, baseSubject, options) || this;
22
- _this.jsonParseReviver = undefined;
23
- return _this;
21
+ return _super.call(this, baseSubject, options) || this;
24
22
  }
25
23
  /**
26
24
  * Get the created image with the specified ID.
@@ -1,9 +1,8 @@
1
1
  import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
2
- import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws/cjs/nats.js';
2
+ import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
3
3
  import { BaseClient } from './BaseClient';
4
4
  export declare class SessionClient extends BaseClient {
5
- private eventsSubscription;
6
- private eventsWildcardSubscription;
5
+ private subscriptions;
7
6
  constructor(baseSubject: string, options: ConnectionOptions);
8
7
  /**
9
8
  * @param sessionLogsHandler Function to be called when log list or error is received
@@ -25,12 +25,15 @@ var __assign = (this && this.__assign) || function () {
25
25
  return __assign.apply(this, arguments);
26
26
  };
27
27
  import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog, } from './DTOs';
28
- import { JSONCodec } from 'nats.ws/cjs/nats.js';
28
+ import { JSONCodec } from 'nats.ws';
29
29
  import { BaseClient } from './BaseClient';
30
+ import { v4 as uuidv4 } from 'uuid';
30
31
  var SessionClient = /** @class */ (function (_super) {
31
32
  __extends(SessionClient, _super);
32
33
  function SessionClient(baseSubject, options) {
33
- return _super.call(this, baseSubject, options) || this;
34
+ var _this = _super.call(this, baseSubject, options) || this;
35
+ _this.subscriptions = [];
36
+ return _this;
34
37
  }
35
38
  /**
36
39
  * @param sessionLogsHandler Function to be called when log list or error is received
@@ -75,8 +78,8 @@ var SessionClient = /** @class */ (function (_super) {
75
78
  eventHandler(undefined, error);
76
79
  }
77
80
  };
78
- this.eventsSubscription = this.subscribe('Events', __assign(__assign({}, options), { callback: callback }));
79
- this.eventsWildcardSubscription = this.subscribe('Events.*', __assign(__assign({}, options), { callback: callback }));
81
+ this.subscriptions.push(this.subscribe('Events', __assign(__assign({}, options), { callback: callback })));
82
+ this.subscriptions.push(this.subscribe('Events.*', __assign(__assign({}, options), { callback: callback })));
80
83
  };
81
84
  /**
82
85
  * @param resultHandler Function to be called when result or error is received
@@ -122,12 +125,8 @@ var SessionClient = /** @class */ (function (_super) {
122
125
  * Unsubscibe from session events
123
126
  */
124
127
  SessionClient.prototype.unsubscribeSessionEvents = function () {
125
- if (this.eventsSubscription) {
126
- this.eventsSubscription.unsubscribe();
127
- }
128
- if (this.eventsWildcardSubscription) {
129
- this.eventsWildcardSubscription.unsubscribe();
130
- }
128
+ var _a;
129
+ (_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.forEach(function (subscription) { return subscription.unsubscribe(); });
131
130
  };
132
131
  /**
133
132
  * Retrieve session logs
@@ -199,14 +198,16 @@ var SessionClient = /** @class */ (function (_super) {
199
198
  * @return Test plan loaded. List of load errors is returned.
200
199
  */
201
200
  SessionClient.prototype.setTestPlanXML = function (xml) {
202
- return this.request('SetTestPlanXML', xml).then(this.success()).catch(this.error());
201
+ return this.sendChunked('SetTestPlanXML', xml).then(this.success()).catch(this.error());
203
202
  };
204
203
  /**
205
204
  * Retrieve loaded test plan XML
206
205
  * @return Test plan retrieved
207
206
  */
208
207
  SessionClient.prototype.getTestPlanXML = function () {
209
- return this.request('GetTestPlanXML').then(this.success()).catch(this.error());
208
+ // Generate a unique subject where the Runner will publish the chunks
209
+ var replySubject = "_INBOX.".concat(uuidv4());
210
+ return this.requestChunked('GetTestPlanXML', replySubject, replySubject).then(this.success()).catch(this.error());
210
211
  };
211
212
  /**
212
213
  * Load test plan using a test plan TapPackage from a repository
@@ -229,7 +230,8 @@ var SessionClient = /** @class */ (function (_super) {
229
230
  * @return Test plan resources opened.
230
231
  */
231
232
  SessionClient.prototype.resourcesOpen = function () {
232
- return this.request('ResourcesOpen')
233
+ var replySubject = "_INBOX.".concat(uuidv4());
234
+ return this.requestChunked('ResourcesOpen', replySubject, replySubject)
233
235
  .then(function (testPlanJs) { return TestPlan.fromJS(testPlanJs); })
234
236
  .then(this.success())
235
237
  .catch(this.error());
@@ -239,7 +241,8 @@ var SessionClient = /** @class */ (function (_super) {
239
241
  * @return Test plan resources closed.
240
242
  */
241
243
  SessionClient.prototype.resourcesClose = function () {
242
- return this.request('ResourcesClose')
244
+ var replySubject = "_INBOX.".concat(uuidv4());
245
+ return this.requestChunked('ResourcesClose', replySubject, replySubject)
243
246
  .then(function (testPlanJs) { return TestPlan.fromJS(testPlanJs); })
244
247
  .then(this.success())
245
248
  .catch(this.error());
@@ -274,7 +277,12 @@ var SessionClient = /** @class */ (function (_super) {
274
277
  * @return Test plan retrieved
275
278
  */
276
279
  SessionClient.prototype.getTestPlan = function (properties) {
277
- return this.request('GetTestPlan', properties)
280
+ var replySubject = "_INBOX.".concat(uuidv4());
281
+ var payload = {
282
+ subject: replySubject,
283
+ properties: properties,
284
+ };
285
+ return this.requestChunked('GetTestPlan', replySubject, payload)
278
286
  .then(function (testPlanJs) { return TestPlan.fromJS(testPlanJs); })
279
287
  .then(this.success())
280
288
  .catch(this.error());
@@ -285,7 +293,7 @@ var SessionClient = /** @class */ (function (_super) {
285
293
  * @return Test plan changed
286
294
  */
287
295
  SessionClient.prototype.setTestPlan = function (plan) {
288
- return this.request('SetTestPlan', plan)
296
+ return this.sendChunked('SetTestPlan', plan)
289
297
  .then(function (testPlanJs) { return TestPlan.fromJS(testPlanJs); })
290
298
  .then(this.success())
291
299
  .catch(this.error());
package/lib/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  export { RunnerClient } from './RunnerClient';
2
2
  export { SessionClient } from './SessionClient';
3
3
  export * from './DTOs';
4
- export * from 'nats.ws/lib/nats-base-client/types';
5
- export * from 'nats.ws/lib/nats-base-client/authenticator';
6
- export * from 'nats.ws/lib/nats-base-client/error';
4
+ export * from 'nats.ws';
package/lib/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  export { RunnerClient } from './RunnerClient';
2
2
  export { SessionClient } from './SessionClient';
3
3
  export * from './DTOs';
4
- export * from 'nats.ws/lib/nats-base-client/types'; // TODO: Delete this line if you are consuming this library in angular > v11. The types export will be done automatically.
5
- export * from 'nats.ws/lib/nats-base-client/authenticator';
6
- export * from 'nats.ws/lib/nats-base-client/error';
4
+ export * from 'nats.ws';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "1.2.3",
3
+ "version": "2.0.0-alpha.1.1",
4
4
  "description": "This is the web client for the OpenTAP Runner.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  "test": "echo \"Error: no test specified\" && exit 1"
13
13
  },
14
14
  "author": "OpenTap.io",
15
- "license": "ISC",
15
+ "license": "MIT",
16
16
  "files": [
17
17
  "lib/**/*"
18
18
  ],
@@ -26,6 +26,7 @@
26
26
  "url": "git://github.com/opentap/runner-client-web.git"
27
27
  },
28
28
  "devDependencies": {
29
+ "@types/uuid": "^8.3.4",
29
30
  "@typescript-eslint/eslint-plugin": "^5.36.1",
30
31
  "@typescript-eslint/parser": "^5.36.1",
31
32
  "eslint": "^8.23.0",
@@ -38,7 +39,8 @@
38
39
  "typescript": "^4.8.2"
39
40
  },
40
41
  "dependencies": {
41
- "nats.ws": "^1.9.0"
42
+ "nats.ws": "^1.9.0",
43
+ "uuid": "^9.0.0"
42
44
  },
43
45
  "lint-staged": {
44
46
  "*.{ts,js,html}": [