@opentap/runner-client 2.5.0-alpha.1.7 → 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/DTOs.d.ts CHANGED
@@ -1168,6 +1168,45 @@ export declare class TestPlanSettingsChangedEventArgs extends SessionEvent imple
1168
1168
  toJSON(data?: any): any;
1169
1169
  }
1170
1170
  export declare type ITestPlanSettingsChangedEventArgs = ISessionEvent;
1171
+ export interface ITestStepRunEvent {
1172
+ parent?: string;
1173
+ testStepId?: string;
1174
+ testStepName?: string;
1175
+ testStepTypeName?: string;
1176
+ id?: string;
1177
+ verdict?: number;
1178
+ startTime?: string;
1179
+ parameters?: Parameter[];
1180
+ }
1181
+ export declare class TestStepRunEvent implements ITestStepRunEvent {
1182
+ parent?: string;
1183
+ testStepId?: string;
1184
+ testStepName?: string;
1185
+ testStepTypeName?: string;
1186
+ id?: string;
1187
+ verdict?: number;
1188
+ startTime?: string;
1189
+ parameters?: Parameter[];
1190
+ protected _discriminator: string;
1191
+ constructor(data?: ITestStepRunEvent);
1192
+ init(_data?: any): void;
1193
+ static fromJS(data: any): TestStepRunEvent;
1194
+ toJSON(data?: any): any;
1195
+ }
1196
+ export declare type ITestStepRunStartEventArgs = ITestStepRunEvent;
1197
+ export declare class TestStepRunStartEventArgs extends TestStepRunEvent implements ITestStepRunStartEventArgs {
1198
+ constructor(data?: ITestStepRunStartEventArgs);
1199
+ init(_data?: any): void;
1200
+ static fromJS(data: any): TestStepRunStartEventArgs;
1201
+ toJSON(data?: any): any;
1202
+ }
1203
+ export declare type ITestStepRunCompletedEventArgs = ITestStepRunEvent;
1204
+ export declare class TestStepRunCompletedEventArgs extends TestStepRunEvent implements ITestStepRunCompletedEventArgs {
1205
+ constructor(data?: ITestStepRunCompletedEventArgs);
1206
+ init(_data?: any): void;
1207
+ static fromJS(data: any): TestStepRunCompletedEventArgs;
1208
+ toJSON(data?: any): any;
1209
+ }
1171
1210
  export interface ITestPlanRunEvent {
1172
1211
  testPlanRunId?: number;
1173
1212
  testPlanRunGuid?: string;
package/lib/DTOs.js CHANGED
@@ -3392,6 +3392,118 @@ var TestPlanSettingsChangedEventArgs = /** @class */ (function (_super) {
3392
3392
  return TestPlanSettingsChangedEventArgs;
3393
3393
  }(SessionEvent));
3394
3394
  export { TestPlanSettingsChangedEventArgs };
3395
+ var TestStepRunEvent = /** @class */ (function () {
3396
+ function TestStepRunEvent(data) {
3397
+ if (data) {
3398
+ for (var property in data) {
3399
+ if (Object.prototype.hasOwnProperty.call(data, property))
3400
+ this[property] = data[property];
3401
+ }
3402
+ }
3403
+ this._discriminator = 'TestStepRunEvent';
3404
+ }
3405
+ TestStepRunEvent.prototype.init = function (_data) {
3406
+ if (_data) {
3407
+ this.parent = _data['Parent'];
3408
+ this.testStepId = _data['TestStepId'];
3409
+ this.testStepName = _data['TestStepName'];
3410
+ this.testStepTypeName = _data['TestStepTypeName'];
3411
+ this.id = _data['Id'];
3412
+ this.verdict = _data['Verdict'];
3413
+ this.startTime = _data['StartTime'];
3414
+ if (Array.isArray(_data['Parameters'])) {
3415
+ this.parameters = [];
3416
+ for (var _i = 0, _a = _data['Parameters']; _i < _a.length; _i++) {
3417
+ var item = _a[_i];
3418
+ this.parameters.push(Parameter.fromJS(item));
3419
+ }
3420
+ }
3421
+ }
3422
+ };
3423
+ TestStepRunEvent.fromJS = function (data) {
3424
+ data = typeof data === 'object' ? data : {};
3425
+ if (data['discriminator'] === 'TestStepRunStartEventArgs') {
3426
+ var result_39 = new TestStepRunStartEventArgs();
3427
+ result_39.init(data);
3428
+ return result_39;
3429
+ }
3430
+ if (data['discriminator'] === 'TestStepRunCompletedEventArgs') {
3431
+ var result_40 = new TestStepRunCompletedEventArgs();
3432
+ result_40.init(data);
3433
+ return result_40;
3434
+ }
3435
+ var result = new TestStepRunEvent();
3436
+ result.init(data);
3437
+ return result;
3438
+ };
3439
+ TestStepRunEvent.prototype.toJSON = function (data) {
3440
+ data['Parent'] = this.parent;
3441
+ data['TestStepId'] = this.testStepId;
3442
+ data['TestStepName'] = this.testStepName;
3443
+ data['TestStepTypeName'] = this.testStepTypeName;
3444
+ data['Id'] = this.id;
3445
+ data['Verdict'] = this.verdict;
3446
+ data['StartTime'] = this.startTime;
3447
+ if (Array.isArray(this.parameters)) {
3448
+ data['Parameters'] = [];
3449
+ for (var _i = 0, _a = this.parameters; _i < _a.length; _i++) {
3450
+ var item = _a[_i];
3451
+ data['Parameters'].push(item.toJSON());
3452
+ }
3453
+ }
3454
+ return data;
3455
+ };
3456
+ return TestStepRunEvent;
3457
+ }());
3458
+ export { TestStepRunEvent };
3459
+ var TestStepRunStartEventArgs = /** @class */ (function (_super) {
3460
+ __extends(TestStepRunStartEventArgs, _super);
3461
+ function TestStepRunStartEventArgs(data) {
3462
+ var _this = _super.call(this, data) || this;
3463
+ _this._discriminator = 'TestStepRunStartEventArgs';
3464
+ return _this;
3465
+ }
3466
+ TestStepRunStartEventArgs.prototype.init = function (_data) {
3467
+ _super.prototype.init.call(this, _data);
3468
+ };
3469
+ TestStepRunStartEventArgs.fromJS = function (data) {
3470
+ data = typeof data === 'object' ? data : {};
3471
+ var result = new TestStepRunStartEventArgs();
3472
+ result.init(data);
3473
+ return result;
3474
+ };
3475
+ TestStepRunStartEventArgs.prototype.toJSON = function (data) {
3476
+ data = typeof data === 'object' ? data : {};
3477
+ _super.prototype.toJSON.call(this, data);
3478
+ return data;
3479
+ };
3480
+ return TestStepRunStartEventArgs;
3481
+ }(TestStepRunEvent));
3482
+ export { TestStepRunStartEventArgs };
3483
+ var TestStepRunCompletedEventArgs = /** @class */ (function (_super) {
3484
+ __extends(TestStepRunCompletedEventArgs, _super);
3485
+ function TestStepRunCompletedEventArgs(data) {
3486
+ var _this = _super.call(this, data) || this;
3487
+ _this._discriminator = 'TestStepRunCompletedEventArgs';
3488
+ return _this;
3489
+ }
3490
+ TestStepRunCompletedEventArgs.prototype.init = function (_data) {
3491
+ _super.prototype.init.call(this, _data);
3492
+ };
3493
+ TestStepRunCompletedEventArgs.fromJS = function (data) {
3494
+ data = typeof data === 'object' ? data : {};
3495
+ var result = new TestStepRunCompletedEventArgs();
3496
+ result.init(data);
3497
+ return result;
3498
+ };
3499
+ TestStepRunCompletedEventArgs.prototype.toJSON = function (data) {
3500
+ data = typeof data === 'object' ? data : {};
3501
+ _super.prototype.toJSON.call(this, data);
3502
+ return data;
3503
+ };
3504
+ return TestStepRunCompletedEventArgs;
3505
+ }(TestStepRunEvent));
3506
+ export { TestStepRunCompletedEventArgs };
3395
3507
  var TestPlanRunEvent = /** @class */ (function () {
3396
3508
  function TestPlanRunEvent(data) {
3397
3509
  if (data) {
@@ -3419,14 +3531,14 @@ var TestPlanRunEvent = /** @class */ (function () {
3419
3531
  TestPlanRunEvent.fromJS = function (data) {
3420
3532
  data = typeof data === 'object' ? data : {};
3421
3533
  if (data['discriminator'] === 'TestPlanRunStartEventArgs') {
3422
- var result_39 = new TestPlanRunStartEventArgs();
3423
- result_39.init(data);
3424
- return result_39;
3534
+ var result_41 = new TestPlanRunStartEventArgs();
3535
+ result_41.init(data);
3536
+ return result_41;
3425
3537
  }
3426
3538
  if (data['discriminator'] === 'TestPlanRunCompletedEventArgs') {
3427
- var result_40 = new TestPlanRunCompletedEventArgs();
3428
- result_40.init(data);
3429
- return result_40;
3539
+ var result_42 = new TestPlanRunCompletedEventArgs();
3540
+ result_42.init(data);
3541
+ return result_42;
3430
3542
  }
3431
3543
  var result = new TestPlanRunEvent();
3432
3544
  result.init(data);
@@ -1,6 +1,6 @@
1
1
  import { BaseClient } from './BaseClient';
2
2
  import { ConnectionOptions, Subscription, SubscriptionOptions } from 'nats.ws';
3
- import { ErrorResponse, ISessionEvent } from './DTOs';
3
+ import { ErrorResponse, TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs } from './DTOs';
4
4
  export interface RunnerLifetimeEvent {
5
5
  RunnerId: string;
6
6
  Subject: string;
@@ -16,11 +16,39 @@ export declare class SystemClient extends BaseClient {
16
16
  */
17
17
  subscribeLifetimeEventListener(listener: (error: ErrorResponse | null, message: RunnerLifetimeEvent | null) => void, options?: SubscriptionOptions): Subscription;
18
18
  /**
19
- * Subscribe to the lifetime event.
20
- * @param listener
21
- * @param {SubscriptionOptions} options
22
- * @returns {Subscription}
19
+ * Subscribe to the test step run start events for the given Runner and Run ID.
20
+ * Wildcard can be used for the Runner or Run ID to receive all test step run start events.
21
+ * @param {string} runnerId
22
+ * @param {string} runId
23
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
24
+ * @param {SubscriptionOptions} options?
25
+ */
26
+ subscribeTestStepRunStartEventListener(runnerId: string, runId: string, listener: (error: ErrorResponse | null, message: TestStepRunStartEventArgs | null) => void, options?: SubscriptionOptions): Subscription;
27
+ /**
28
+ * Subscribe to the test step run completed events for the given Runner and Run ID.
29
+ * Wildcard can be used for the Runner or Run ID to receive all test step run completed events.
30
+ * @param {string} runnerId
31
+ * @param {string} runId
32
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
33
+ * @param {SubscriptionOptions} options?
34
+ */
35
+ subscribeTestStepRunCompletedEventListener(runnerId: string, runId: string, listener: (error: ErrorResponse | null, message: TestStepRunCompletedEventArgs | null) => void, options?: SubscriptionOptions): Subscription;
36
+ /**
37
+ * Subscribe to the test plan run start events for the given Runner and Run ID.
38
+ * Wildcard can be used for the Runner or Run ID to receive all test plan run start events.
39
+ * @param {string} runnerId
40
+ * @param {string} runId
41
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
42
+ * @param {SubscriptionOptions} options?
43
+ */
44
+ subscribeTestPlanRunStartEventListener(runnerId: string, runId: string, listener: (error: ErrorResponse | null, message: TestPlanRunStartEventArgs | null) => void, options?: SubscriptionOptions): Subscription;
45
+ /**
46
+ * Subscribe to the test plan run completed events for the given Runner and Run ID.
47
+ * Wildcard can be used for the Runner or Run ID to receive all test plan run completed events.
48
+ * @param {string} runnerId
49
+ * @param {string} runId
50
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
51
+ * @param {SubscriptionOptions} options?
23
52
  */
24
- subscribeTestPlanRunStartedEventListener(runnerId: string, runId: string, eventName: string, listener: (error: ErrorResponse | null, message: ISessionEvent | null) => void, options?: SubscriptionOptions): Subscription;
25
- private parseCallbackArguments;
53
+ subscribeTestPlanRunCompletedEventListener(runnerId: string, runId: string, listener: (error: ErrorResponse | null, message: TestPlanRunCompletedEventArgs | null) => void, options?: SubscriptionOptions): Subscription;
26
54
  }
@@ -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,34 +40,129 @@ var SystemClient = /** @class */ (function (_super) {
39
40
  */
40
41
  SystemClient.prototype.subscribeLifetimeEventListener = function (listener, options) {
41
42
  var _this = this;
42
- return this.subscribe('*.Events.Lifetime', __assign(__assign({}, options), { callback: function (error, message) {
43
- listener.apply(void 0, _this.parseCallbackArguments('*.Events.Lifetime', error, message));
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
  /**
47
- * Subscribe to the lifetime event.
48
- * @param listener
49
- * @param {SubscriptionOptions} options
50
- * @returns {Subscription}
60
+ * Subscribe to the test step run start events for the given Runner and Run ID.
61
+ * Wildcard can be used for the Runner or Run ID to receive all test step run start events.
62
+ * @param {string} runnerId
63
+ * @param {string} runId
64
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
65
+ * @param {SubscriptionOptions} options?
51
66
  */
52
- SystemClient.prototype.subscribeTestPlanRunStartedEventListener = function (runnerId, runId, eventName, listener, options) {
67
+ SystemClient.prototype.subscribeTestStepRunStartEventListener = function (runnerId, runId, listener, options) {
53
68
  var _this = this;
54
- return this.subscribe("".concat(runnerId, ".Runs.").concat(runId, ".Events.").concat(eventName), __assign(__assign({}, options), { callback: function (error, message) {
55
- listener.apply(void 0, _this.parseCallbackArguments('*.Events.Lifetime', error, message));
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
+ }
56
84
  } }));
57
85
  };
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
- }
86
+ /**
87
+ * Subscribe to the test step run completed events for the given Runner and Run ID.
88
+ * Wildcard can be used for the Runner or Run ID to receive all test step run completed events.
89
+ * @param {string} runnerId
90
+ * @param {string} runId
91
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
92
+ * @param {SubscriptionOptions} options?
93
+ */
94
+ SystemClient.prototype.subscribeTestStepRunCompletedEventListener = function (runnerId, runId, listener, options) {
95
+ var _this = this;
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
+ }
111
+ } }));
112
+ };
113
+ /**
114
+ * Subscribe to the test plan run start events for the given Runner and Run ID.
115
+ * Wildcard can be used for the Runner or Run ID to receive all test plan run start events.
116
+ * @param {string} runnerId
117
+ * @param {string} runId
118
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
119
+ * @param {SubscriptionOptions} options?
120
+ */
121
+ SystemClient.prototype.subscribeTestPlanRunStartEventListener = function (runnerId, runId, listener, options) {
122
+ var _this = this;
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
+ }
138
+ } }));
139
+ };
140
+ /**
141
+ * Subscribe to the test plan run completed events for the given Runner and Run ID.
142
+ * Wildcard can be used for the Runner or Run ID to receive all test plan run completed events.
143
+ * @param {string} runnerId
144
+ * @param {string} runId
145
+ * @param {(error:ErrorResponse|null,message:TestStepRunStartEventArgs|null)=>void} listener
146
+ * @param {SubscriptionOptions} options?
147
+ */
148
+ SystemClient.prototype.subscribeTestPlanRunCompletedEventListener = function (runnerId, runId, listener, options) {
149
+ var _this = this;
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
+ }
165
+ } }));
70
166
  };
71
167
  return SystemClient;
72
168
  }(BaseClient));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.5.0-alpha.1.7",
3
+ "version": "2.5.0-alpha.1.9",
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",