@opentap/runner-client 2.1.3-alpha.1.5 → 2.1.3-alpha.1.6

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.
@@ -1,7 +1,5 @@
1
- /// <reference types="node" />
2
1
  import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsListItem, DataGridControl, ErrorResponse, FileParameter, FileResponse, ListItemType, ProfileGroup, RepositoryPackageReference, RepositorySettingsPackageDefinition, SettingsTapPackage } from './DTOs';
3
2
  import { ConnectionOptions, RequestOptions, Subscription, SubscriptionOptions } from 'nats.ws';
4
- import { EventEmitter } from 'events';
5
3
  export declare class BaseClient {
6
4
  private connection;
7
5
  private baseSubject;
@@ -105,12 +103,12 @@ export declare class BaseClient {
105
103
  * @param listener
106
104
  * @returns {EventEmitter}
107
105
  */
108
- addErrorEventListener(listener: (...args: any[]) => void): EventEmitter;
106
+ addErrorEventListener(listener: (...args: any[]) => void): void;
109
107
  /**
110
108
  * Remove an error-event listener.
111
109
  * @param listener
112
110
  */
113
- removeAllErrorEventListener(): void;
111
+ removeErrorEventListener(listener: (...args: any[]) => void): void;
114
112
  /**
115
113
  * Retrieve component settings overview
116
114
  * @returns {{Promise<ComponentSettingsIdentifier[]>}}
package/lib/BaseClient.js CHANGED
@@ -58,6 +58,10 @@ import { ComponentSettingsBase, ComponentSettingsIdentifier, ComponentSettingsLi
58
58
  import { Empty, ErrorCode, JSONCodec, StringCodec, connect, headers, } from 'nats.ws';
59
59
  import { EventEmitter } from 'events';
60
60
  var DEFAULT_TIMEOUT = 6000;
61
+ var Events;
62
+ (function (Events) {
63
+ Events["ERROR"] = "error_event";
64
+ })(Events || (Events = {}));
61
65
  var BaseClient = /** @class */ (function () {
62
66
  function BaseClient(baseSubject, options) {
63
67
  this.domainAccess = new Map();
@@ -167,7 +171,7 @@ var BaseClient = /** @class */ (function () {
167
171
  default:
168
172
  errorResponse.message = error.message;
169
173
  }
170
- this.eventEmitter.emit('errorEvent', errorResponse);
174
+ this.eventEmitter.emit(Events.ERROR, errorResponse);
171
175
  return errorResponse;
172
176
  };
173
177
  /**
@@ -385,7 +389,7 @@ var BaseClient = /** @class */ (function () {
385
389
  _this.connection = null;
386
390
  }).catch(function (error) {
387
391
  throw new Error("failed to close connection: ".concat(error));
388
- }).finally(function () { return _this === null || _this === void 0 ? void 0 : _this.removeAllErrorEventListener(); }))];
392
+ }))];
389
393
  case 1:
390
394
  _b.sent();
391
395
  _b.label = 2;
@@ -427,15 +431,15 @@ var BaseClient = /** @class */ (function () {
427
431
  */
428
432
  BaseClient.prototype.addErrorEventListener = function (listener) {
429
433
  var _a;
430
- return (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.addListener('errorEvent', listener);
434
+ (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.addListener(Events.ERROR, listener);
431
435
  };
432
436
  /**
433
437
  * Remove an error-event listener.
434
438
  * @param listener
435
439
  */
436
- BaseClient.prototype.removeAllErrorEventListener = function () {
440
+ BaseClient.prototype.removeErrorEventListener = function (listener) {
437
441
  var _a;
438
- (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.removeAllListeners('errorEvent');
442
+ (_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.removeListener(Events.ERROR, listener);
439
443
  };
440
444
  /**
441
445
  * Retrieve component settings overview
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.1.3-alpha.1.5",
3
+ "version": "2.1.3-alpha.1.6",
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",