@opentap/runner-client 2.2.1 → 2.2.2-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.
@@ -2,7 +2,7 @@ import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsLi
2
2
  import { ConnectionOptions, RequestOptions, Subscription, SubscriptionOptions } from 'nats.ws';
3
3
  export declare class BaseClient {
4
4
  private connection;
5
- private baseSubject;
5
+ protected baseSubject: string;
6
6
  private connectionOptions;
7
7
  private domainAccess;
8
8
  private eventEmitter;
@@ -19,7 +19,7 @@ export declare class BaseClient {
19
19
  set headers(value: Headers);
20
20
  /** Get timeout */
21
21
  get timeout(): number;
22
- /** Set timeout */
22
+ /** Set timeout in milliseconds. Default is 40000 milliseconds */
23
23
  set timeout(value: number);
24
24
  constructor(baseSubject: string, options: ConnectionOptions);
25
25
  /**
package/lib/BaseClient.js CHANGED
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileDescriptor, ListItemType, ProfileGroup, } from './DTOs';
58
58
  import { Empty, ErrorCode, JSONCodec, StringCodec, connect, headers, } from 'nats.ws';
59
59
  import { EventEmitter } from 'events';
60
- var DEFAULT_TIMEOUT = 6000;
60
+ var DEFAULT_TIMEOUT = 40000; // default timeout of 40 seconds
61
61
  var Events;
62
62
  (function (Events) {
63
63
  Events["ERROR"] = "error_event";
@@ -100,7 +100,7 @@ var BaseClient = /** @class */ (function () {
100
100
  get: function () {
101
101
  return this._timeout || DEFAULT_TIMEOUT;
102
102
  },
103
- /** Set timeout */
103
+ /** Set timeout in milliseconds. Default is 40000 milliseconds */
104
104
  set: function (value) {
105
105
  this._timeout = value;
106
106
  },
@@ -81,6 +81,7 @@ export declare class SessionClient extends BaseClient {
81
81
  * @return Test plan loaded. List of load errors is returned.
82
82
  */
83
83
  setTestPlanXML(xml: string): Promise<string[]>;
84
+ private getReplySubject;
84
85
  /**
85
86
  * Retrieve loaded test plan XML
86
87
  * @return Test plan retrieved
@@ -200,13 +200,16 @@ var SessionClient = /** @class */ (function (_super) {
200
200
  SessionClient.prototype.setTestPlanXML = function (xml) {
201
201
  return this.sendChunked('SetTestPlanXML', xml).then(this.success()).catch(this.error());
202
202
  };
203
+ SessionClient.prototype.getReplySubject = function () {
204
+ return "".concat(this.baseSubject, ".Chunks.").concat(uuidv4());
205
+ };
203
206
  /**
204
207
  * Retrieve loaded test plan XML
205
208
  * @return Test plan retrieved
206
209
  */
207
210
  SessionClient.prototype.getTestPlanXML = function () {
208
211
  // Generate a unique subject where the Runner will publish the chunks
209
- var replySubject = "_INBOX.".concat(uuidv4());
212
+ var replySubject = this.getReplySubject();
210
213
  return this.requestChunked('GetTestPlanXML', replySubject, replySubject).then(this.success()).catch(this.error());
211
214
  };
212
215
  /**
@@ -219,7 +222,7 @@ var SessionClient = /** @class */ (function (_super) {
219
222
  if (!((_a = resource.source) === null || _a === void 0 ? void 0 : _a.startsWith(runnerResourcePrefix))) {
220
223
  return Promise.reject('The source of the provided resource is not a nats subject.');
221
224
  }
222
- var replySubject = "_INBOX.".concat(uuidv4());
225
+ var replySubject = this.getReplySubject();
223
226
  var subject = resource.source.slice(runnerResourcePrefix.length);
224
227
  return this.requestChunked(subject, replySubject, replySubject, undefined, true, true)
225
228
  .then(this.success())
@@ -246,7 +249,7 @@ var SessionClient = /** @class */ (function (_super) {
246
249
  * @return Test plan resources opened.
247
250
  */
248
251
  SessionClient.prototype.resourcesOpen = function () {
249
- var replySubject = "_INBOX.".concat(uuidv4());
252
+ var replySubject = this.getReplySubject();
250
253
  return this.requestChunked('ResourcesOpen', replySubject, replySubject)
251
254
  .then(function (testPlanJs) { return TestPlan.fromJS(testPlanJs); })
252
255
  .then(this.success())
@@ -257,7 +260,7 @@ var SessionClient = /** @class */ (function (_super) {
257
260
  * @return Test plan resources closed.
258
261
  */
259
262
  SessionClient.prototype.resourcesClose = function () {
260
- var replySubject = "_INBOX.".concat(uuidv4());
263
+ var replySubject = this.getReplySubject();
261
264
  return this.requestChunked('ResourcesClose', replySubject, replySubject)
262
265
  .then(function (testPlanJs) { return TestPlan.fromJS(testPlanJs); })
263
266
  .then(this.success())
@@ -293,7 +296,7 @@ var SessionClient = /** @class */ (function (_super) {
293
296
  * @return Test plan retrieved
294
297
  */
295
298
  SessionClient.prototype.getTestPlan = function (properties) {
296
- var replySubject = "_INBOX.".concat(uuidv4());
299
+ var replySubject = this.getReplySubject();
297
300
  var payload = {
298
301
  subject: replySubject,
299
302
  properties: properties,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.2.1",
3
+ "version": "2.2.2-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",