@opentap/runner-client 1.0.0-beta.81 → 1.1.0-beta.10

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/lib/BaseClient.js CHANGED
@@ -81,21 +81,22 @@ var BaseClient = /** @class */ (function () {
81
81
  return __generator(this, function (_a) {
82
82
  switch (_a.label) {
83
83
  case 0:
84
- if (!subject)
85
- return [2 /*return*/, Promise.reject('Subject is not defined!')];
84
+ subject = "".concat(this.baseSubject, ".Request.").concat(subject);
86
85
  if (!this.connection)
87
- return [2 /*return*/, Promise.reject('Connection is not up yet! Please try again later!')];
86
+ return [2 /*return*/, Promise.reject("".concat(subject, ": Connection is down! Please try again!"))];
88
87
  if (this.connection.isClosed())
89
- return [2 /*return*/, Promise.reject('Connection has been closed! Please reconnect!')];
90
- subject = "".concat(this.baseSubject, ".Request.").concat(subject);
88
+ return [2 /*return*/, Promise.reject("".concat(subject, ": Connection has been closed! Please reconnect!"))];
91
89
  stringCodec = StringCodec();
92
90
  data = payload ? stringCodec.encode(JSON.stringify(payload)) : Empty;
93
91
  opts = __assign(__assign({}, options), { timeout: this.timeout });
94
92
  return [4 /*yield*/, this.connection
95
93
  .request(subject, data, opts)
96
94
  .then(function (message) {
97
- var jsonCodec = JSONCodec();
98
- var response = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
95
+ var response;
96
+ if ((message === null || message === void 0 ? void 0 : message.data.length) !== 0) {
97
+ var jsonCodec = JSONCodec();
98
+ response = jsonCodec.decode(message.data);
99
+ }
99
100
  return _this.isErrorResponse(response)
100
101
  ? Promise.reject("".concat(JSON.stringify(ErrorResponse.fromJS(response))))
101
102
  : Promise.resolve(response);
@@ -103,11 +104,11 @@ var BaseClient = /** @class */ (function () {
103
104
  .catch(function (error) {
104
105
  switch (error === null || error === void 0 ? void 0 : error.code) {
105
106
  case ErrorCode.NoResponders:
106
- return Promise.reject("no responders to ".concat(subject));
107
+ return Promise.reject("No responders to ".concat(subject));
107
108
  case ErrorCode.Timeout:
108
- return Promise.reject('request timed out');
109
+ return Promise.reject("".concat(subject, " timed out"));
109
110
  default:
110
- return Promise.reject(error);
111
+ return Promise.reject("".concat(subject, ": ").concat(error));
111
112
  }
112
113
  })];
113
114
  case 1: return [2 /*return*/, _a.sent()];
@@ -178,11 +179,14 @@ var BaseClient = /** @class */ (function () {
178
179
  BaseClient.prototype.close = function () {
179
180
  var _a;
180
181
  return __awaiter(this, void 0, void 0, function () {
182
+ var _this = this;
181
183
  return __generator(this, function (_b) {
182
184
  switch (_b.label) {
183
185
  case 0:
184
186
  if (!this.connection) return [3 /*break*/, 2];
185
- return [4 /*yield*/, ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.close().catch(function (error) {
187
+ return [4 /*yield*/, ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.close().then(function () {
188
+ _this.connection = null;
189
+ }).catch(function (error) {
186
190
  throw new Error("failed to close connection: ".concat(error));
187
191
  }))];
188
192
  case 1:
@@ -131,8 +131,9 @@ export declare class SessionClient extends BaseClient {
131
131
  /**
132
132
  * Set the name of the test plan
133
133
  * @param {string} testPlanName
134
+ * @return {Promise<void>}
134
135
  */
135
- SetTestPlanName(testPlanName: string): Promise<void>;
136
+ setTestPlanName(testPlanName: string): Promise<void>;
136
137
  /**
137
138
  * Retrieve all validation errors present in the test plan
138
139
  * @return Retrieved validation errors for loaded TestPlan
@@ -246,7 +247,7 @@ export declare class SessionClient extends BaseClient {
246
247
  * @param {Parameter[]} parameters
247
248
  * @return RunStatus retrieved
248
249
  */
249
- runTestPlanMetadata(parameters: Parameter[]): Promise<RunStatus>;
250
+ runTestPlan(parameters: Parameter[]): Promise<RunStatus>;
250
251
  /**
251
252
  * Abort test plan execution
252
253
  */
@@ -280,8 +280,9 @@ var SessionClient = /** @class */ (function (_super) {
280
280
  /**
281
281
  * Set the name of the test plan
282
282
  * @param {string} testPlanName
283
+ * @return {Promise<void>}
283
284
  */
284
- SessionClient.prototype.SetTestPlanName = function (testPlanName) {
285
+ SessionClient.prototype.setTestPlanName = function (testPlanName) {
285
286
  return this.request('SetTestPlanName', testPlanName).then(this.success()).catch(this.error());
286
287
  };
287
288
  /**
@@ -480,7 +481,7 @@ var SessionClient = /** @class */ (function (_super) {
480
481
  * Retrieve breakpoints set in test plan
481
482
  */
482
483
  SessionClient.prototype.getBreakpoints = function () {
483
- return this.request('SetPauseNext')
484
+ return this.request('GetBreakpoints')
484
485
  .then(function (breakPointsJs) { return BreakPoints.fromJS(breakPointsJs); })
485
486
  .then(this.success())
486
487
  .catch(this.error());
@@ -508,8 +509,8 @@ var SessionClient = /** @class */ (function (_super) {
508
509
  * @param {Parameter[]} parameters
509
510
  * @return RunStatus retrieved
510
511
  */
511
- SessionClient.prototype.runTestPlanMetadata = function (parameters) {
512
- return this.request('RunTestPlanMetadata', parameters)
512
+ SessionClient.prototype.runTestPlan = function (parameters) {
513
+ return this.request('RunTestPlan', parameters)
513
514
  .then(function (runStatusJs) { return RunStatus.fromJS(runStatusJs); })
514
515
  .then(this.success())
515
516
  .catch(this.error());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "1.0.0-beta.81",
3
+ "version": "1.1.0-beta.10",
4
4
  "description": "This is the TypeScript Client for the OpenTAP Runner Plugin.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",