@opentap/runner-client 2.4.6-alpha.1.1 → 2.5.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/lib/SystemClient.d.ts +15 -1
- package/lib/SystemClient.js +26 -12
- package/lib/index.d.ts +1 -1
- package/package.json +1 -1
package/lib/SystemClient.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { BaseClient } from './BaseClient';
|
|
2
2
|
import { ConnectionOptions, Subscription, SubscriptionOptions } from 'nats.ws';
|
|
3
|
+
import { ErrorResponse, ISessionEvent } from './DTOs';
|
|
4
|
+
export interface RunnerLifetimeEvent {
|
|
5
|
+
RunnerId: string;
|
|
6
|
+
Subject: string;
|
|
7
|
+
Discriminator: string;
|
|
8
|
+
}
|
|
3
9
|
export declare class SystemClient extends BaseClient {
|
|
4
10
|
constructor(baseSubject: string, options: ConnectionOptions);
|
|
5
11
|
/**
|
|
@@ -8,5 +14,13 @@ export declare class SystemClient extends BaseClient {
|
|
|
8
14
|
* @param {SubscriptionOptions} options
|
|
9
15
|
* @returns {Subscription}
|
|
10
16
|
*/
|
|
11
|
-
subscribeLifetimeEventListener(listener: (
|
|
17
|
+
subscribeLifetimeEventListener(listener: (error: ErrorResponse | null, message: RunnerLifetimeEvent | null) => void, options?: SubscriptionOptions): Subscription;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribe to the lifetime event.
|
|
20
|
+
* @param listener
|
|
21
|
+
* @param {SubscriptionOptions} options
|
|
22
|
+
* @returns {Subscription}
|
|
23
|
+
*/
|
|
24
|
+
subscribeTestPlanRunStartedEventListener(runnerId: string, runId: string, listener: (error: ErrorResponse | null, message: ISessionEvent | null) => void, options?: SubscriptionOptions): Subscription;
|
|
25
|
+
private parseCallbackArguments;
|
|
12
26
|
}
|
package/lib/SystemClient.js
CHANGED
|
@@ -40,20 +40,34 @@ var SystemClient = /** @class */ (function (_super) {
|
|
|
40
40
|
SystemClient.prototype.subscribeLifetimeEventListener = function (listener, options) {
|
|
41
41
|
var _this = this;
|
|
42
42
|
return this.subscribe('*.Events.Lifetime', __assign(__assign({}, options), { callback: function (error, message) {
|
|
43
|
-
|
|
44
|
-
listener(_this.natsErrorHandler(error, '*.Events.Lifetime'));
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
var jsonCodec = JSONCodec();
|
|
49
|
-
var data = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
50
|
-
listener(data);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
listener(_this.natsErrorHandler(error, '*.Events.Lifetime'));
|
|
54
|
-
}
|
|
43
|
+
listener.apply(void 0, _this.parseCallbackArguments('*.Events.Lifetime', error, message));
|
|
55
44
|
} }));
|
|
56
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Subscribe to the lifetime event.
|
|
48
|
+
* @param listener
|
|
49
|
+
* @param {SubscriptionOptions} options
|
|
50
|
+
* @returns {Subscription}
|
|
51
|
+
*/
|
|
52
|
+
SystemClient.prototype.subscribeTestPlanRunStartedEventListener = function (runnerId, runId, listener, options) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
return this.subscribe("".concat(runnerId, ".Runs.").concat(runId, ".Events.*"), __assign(__assign({}, options), { callback: function (error, message) {
|
|
55
|
+
listener.apply(void 0, _this.parseCallbackArguments('*.Events.Lifetime', error, message));
|
|
56
|
+
} }));
|
|
57
|
+
};
|
|
58
|
+
SystemClient.prototype.parseCallbackArguments = function (subject, error, message) {
|
|
59
|
+
if (error) {
|
|
60
|
+
return [this.natsErrorHandler(error, subject), null];
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
var jsonCodec = JSONCodec();
|
|
64
|
+
var data = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
65
|
+
return [null, data];
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return [this.natsErrorHandler(error, subject), null];
|
|
69
|
+
}
|
|
70
|
+
};
|
|
57
71
|
return SystemClient;
|
|
58
72
|
}(BaseClient));
|
|
59
73
|
export { SystemClient };
|
package/lib/index.d.ts
CHANGED