@opentap/runner-client 1.2.1-beta.4 → 1.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,8 +2,6 @@ import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Int
2
2
  import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws/cjs/nats.js';
3
3
  import { BaseClient } from './BaseClient';
4
4
  export declare class SessionClient extends BaseClient {
5
- private eventsSubscription;
6
- private eventsWildcardSubscription;
7
5
  constructor(baseSubject: string, options: ConnectionOptions);
8
6
  /**
9
7
  * @param sessionLogsHandler Function to be called when log list or error is received
@@ -16,7 +14,7 @@ export declare class SessionClient extends BaseClient {
16
14
  * @param options (optional) Subscription options
17
15
  * @returns Subscription object
18
16
  */
19
- connectSessionEvents(eventHandler: (sessionEvent: SessionEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): void;
17
+ connectSessionEvents(eventHandler: (sessionEvent: SessionEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
20
18
  /**
21
19
  * @param resultHandler Function to be called when result or error is received
22
20
  * @param testRunHandler Function to be called when test run or error is received
@@ -24,10 +22,6 @@ export declare class SessionClient extends BaseClient {
24
22
  * @returns Subscription array: Result and Test Run subscriptions
25
23
  */
26
24
  connectSessionResults(resultHandler: (result: Result | undefined, err: NatsError | Error | null) => void, testRunHandler: (testRun: TestRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): [Subscription, Subscription];
27
- /**
28
- * Unsubscibe from session events
29
- */
30
- unsubscribeSessionEvents(): void;
31
25
  /**
32
26
  * Retrieve session logs
33
27
  * @param id (optional)
@@ -60,23 +60,21 @@ var SessionClient = /** @class */ (function (_super) {
60
60
  * @returns Subscription object
61
61
  */
62
62
  SessionClient.prototype.connectSessionEvents = function (eventHandler, options) {
63
- var callback = function (error, encodedMessage) {
64
- if (error) {
65
- eventHandler(undefined, error);
66
- return;
67
- }
68
- try {
69
- var jsonCodec = JSONCodec();
70
- var sessionEventJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
71
- var sessionEvent = SessionEvent.fromJS(sessionEventJs);
72
- eventHandler(sessionEvent, error);
73
- }
74
- catch (error) {
75
- eventHandler(undefined, error);
76
- }
77
- };
78
- this.eventsSubscription = this.subscribe('Events', __assign(__assign({}, options), { callback: callback }));
79
- this.eventsWildcardSubscription = this.subscribe('Events.*', __assign(__assign({}, options), { callback: callback }));
63
+ return this.subscribe('Events.*', __assign(__assign({}, options), { callback: function (error, encodedMessage) {
64
+ if (error) {
65
+ eventHandler(undefined, error);
66
+ return;
67
+ }
68
+ try {
69
+ var jsonCodec = JSONCodec();
70
+ var sessionEventJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
71
+ var sessionEvent = SessionEvent.fromJS(sessionEventJs);
72
+ eventHandler(sessionEvent, error);
73
+ }
74
+ catch (error) {
75
+ eventHandler(undefined, error);
76
+ }
77
+ } }));
80
78
  };
81
79
  /**
82
80
  * @param resultHandler Function to be called when result or error is received
@@ -118,17 +116,6 @@ var SessionClient = /** @class */ (function (_super) {
118
116
  } })),
119
117
  ];
120
118
  };
121
- /**
122
- * Unsubscibe from session events
123
- */
124
- SessionClient.prototype.unsubscribeSessionEvents = function () {
125
- if (this.eventsSubscription) {
126
- this.eventsSubscription.unsubscribe();
127
- }
128
- if (this.eventsWildcardSubscription) {
129
- this.eventsWildcardSubscription.unsubscribe();
130
- }
131
- };
132
119
  /**
133
120
  * Retrieve session logs
134
121
  * @param id (optional)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "1.2.1-beta.4",
3
+ "version": "1.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",