@opentap/runner-client 2.5.0-alpha.1.8 → 2.5.0-alpha.1.9
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 +0 -8
- package/lib/SystemClient.js +75 -30
- package/package.json +1 -1
package/lib/SystemClient.d.ts
CHANGED
|
@@ -51,12 +51,4 @@ export declare class SystemClient extends BaseClient {
|
|
|
51
51
|
* @param {SubscriptionOptions} options?
|
|
52
52
|
*/
|
|
53
53
|
subscribeTestPlanRunCompletedEventListener(runnerId: string, runId: string, listener: (error: ErrorResponse | null, message: TestPlanRunCompletedEventArgs | null) => void, options?: SubscriptionOptions): Subscription;
|
|
54
|
-
/**
|
|
55
|
-
* Parses the NATS message to the given template. If the NATS sends an error, it parses the error
|
|
56
|
-
* in the generic NATS error handler.
|
|
57
|
-
* @param {string} subject
|
|
58
|
-
* @param {NatsError|null} error
|
|
59
|
-
* @param {Msg} message
|
|
60
|
-
*/
|
|
61
|
-
private parseCallbackArguments;
|
|
62
54
|
}
|
package/lib/SystemClient.js
CHANGED
|
@@ -26,6 +26,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
26
26
|
};
|
|
27
27
|
import { BaseClient } from './BaseClient';
|
|
28
28
|
import { JSONCodec } from 'nats.ws';
|
|
29
|
+
import { TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs, } from './DTOs';
|
|
29
30
|
var SystemClient = /** @class */ (function (_super) {
|
|
30
31
|
__extends(SystemClient, _super);
|
|
31
32
|
function SystemClient(baseSubject, options) {
|
|
@@ -39,8 +40,20 @@ var SystemClient = /** @class */ (function (_super) {
|
|
|
39
40
|
*/
|
|
40
41
|
SystemClient.prototype.subscribeLifetimeEventListener = function (listener, options) {
|
|
41
42
|
var _this = this;
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
var subject = '*.Events.Lifetime';
|
|
44
|
+
return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
|
|
45
|
+
if (error) {
|
|
46
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
var jsonCodec = JSONCodec();
|
|
51
|
+
var data = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
52
|
+
listener(null, data);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
56
|
+
}
|
|
44
57
|
} }));
|
|
45
58
|
};
|
|
46
59
|
/**
|
|
@@ -53,8 +66,21 @@ var SystemClient = /** @class */ (function (_super) {
|
|
|
53
66
|
*/
|
|
54
67
|
SystemClient.prototype.subscribeTestStepRunStartEventListener = function (runnerId, runId, listener, options) {
|
|
55
68
|
var _this = this;
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestStepRunStart");
|
|
70
|
+
return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
|
|
71
|
+
if (error) {
|
|
72
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
var jsonCodec = JSONCodec();
|
|
77
|
+
var testStepRunStartEventArgsJs = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
78
|
+
var testStepRunStartEventArgs = TestStepRunStartEventArgs.fromJS(testStepRunStartEventArgsJs);
|
|
79
|
+
listener(null, testStepRunStartEventArgs);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
83
|
+
}
|
|
58
84
|
} }));
|
|
59
85
|
};
|
|
60
86
|
/**
|
|
@@ -67,8 +93,21 @@ var SystemClient = /** @class */ (function (_super) {
|
|
|
67
93
|
*/
|
|
68
94
|
SystemClient.prototype.subscribeTestStepRunCompletedEventListener = function (runnerId, runId, listener, options) {
|
|
69
95
|
var _this = this;
|
|
70
|
-
|
|
71
|
-
|
|
96
|
+
var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestStepRunCompleted");
|
|
97
|
+
return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
|
|
98
|
+
if (error) {
|
|
99
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
var jsonCodec = JSONCodec();
|
|
104
|
+
var testStepRunCompletedEventArgsJs = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
105
|
+
var testStepRunCompletedEventArgs = TestStepRunCompletedEventArgs.fromJS(testStepRunCompletedEventArgsJs);
|
|
106
|
+
listener(null, testStepRunCompletedEventArgs);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
110
|
+
}
|
|
72
111
|
} }));
|
|
73
112
|
};
|
|
74
113
|
/**
|
|
@@ -81,8 +120,21 @@ var SystemClient = /** @class */ (function (_super) {
|
|
|
81
120
|
*/
|
|
82
121
|
SystemClient.prototype.subscribeTestPlanRunStartEventListener = function (runnerId, runId, listener, options) {
|
|
83
122
|
var _this = this;
|
|
84
|
-
|
|
85
|
-
|
|
123
|
+
var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestPlanRunStart");
|
|
124
|
+
return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
|
|
125
|
+
if (error) {
|
|
126
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
var jsonCodec = JSONCodec();
|
|
131
|
+
var testPlanRunStartEventArgsJs = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
132
|
+
var testPlanRunStartEventArgs = TestPlanRunStartEventArgs.fromJS(testPlanRunStartEventArgsJs);
|
|
133
|
+
listener(null, testPlanRunStartEventArgs);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
137
|
+
}
|
|
86
138
|
} }));
|
|
87
139
|
};
|
|
88
140
|
/**
|
|
@@ -95,30 +147,23 @@ var SystemClient = /** @class */ (function (_super) {
|
|
|
95
147
|
*/
|
|
96
148
|
SystemClient.prototype.subscribeTestPlanRunCompletedEventListener = function (runnerId, runId, listener, options) {
|
|
97
149
|
var _this = this;
|
|
98
|
-
|
|
99
|
-
|
|
150
|
+
var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestPlanRunCompleted");
|
|
151
|
+
return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
|
|
152
|
+
if (error) {
|
|
153
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
var jsonCodec = JSONCodec();
|
|
158
|
+
var testPlanRunCompletedEventArgsJs = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
159
|
+
var testPlanRunCompletedEventArgs = TestPlanRunCompletedEventArgs.fromJS(testPlanRunCompletedEventArgsJs);
|
|
160
|
+
listener(null, testPlanRunCompletedEventArgs);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
listener(_this.natsErrorHandler(error, subject), null);
|
|
164
|
+
}
|
|
100
165
|
} }));
|
|
101
166
|
};
|
|
102
|
-
/**
|
|
103
|
-
* Parses the NATS message to the given template. If the NATS sends an error, it parses the error
|
|
104
|
-
* in the generic NATS error handler.
|
|
105
|
-
* @param {string} subject
|
|
106
|
-
* @param {NatsError|null} error
|
|
107
|
-
* @param {Msg} message
|
|
108
|
-
*/
|
|
109
|
-
SystemClient.prototype.parseCallbackArguments = function (subject, error, message) {
|
|
110
|
-
if (error) {
|
|
111
|
-
return [this.natsErrorHandler(error, subject), null];
|
|
112
|
-
}
|
|
113
|
-
try {
|
|
114
|
-
var jsonCodec = JSONCodec();
|
|
115
|
-
var data = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
|
|
116
|
-
return [null, data];
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
return [this.natsErrorHandler(error, subject), null];
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
167
|
return SystemClient;
|
|
123
168
|
}(BaseClient));
|
|
124
169
|
export { SystemClient };
|