@opentap/runner-client 2.10.0 → 2.11.0-alpha.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/DTOs.d.ts CHANGED
@@ -1260,3 +1260,36 @@ export declare class TestPlanRunCompletedEventArgs extends TestPlanRunEvent impl
1260
1260
  static fromJS(data: any): TestPlanRunCompletedEventArgs;
1261
1261
  toJSON(data?: any): any;
1262
1262
  }
1263
+ export interface IRunnerEvent {
1264
+ runnerId?: string;
1265
+ type?: string;
1266
+ }
1267
+ export declare class RunnerEvent implements IRunnerEvent {
1268
+ runnerId?: string;
1269
+ type?: string;
1270
+ constructor(data?: IRunnerEvent);
1271
+ init(_data?: any): void;
1272
+ static fromJS(data: any): RunnerEvent;
1273
+ toJSON(data?: any): any;
1274
+ }
1275
+ export declare type IRunnerRegisteredEvent = IRunnerEvent;
1276
+ export declare class RunnerRegisteredEvent extends RunnerEvent implements IRunnerRegisteredEvent {
1277
+ constructor(data?: IRunnerRegisteredEvent);
1278
+ init(_data?: any): void;
1279
+ static fromJS(data: any): RunnerRegisteredEvent;
1280
+ toJSON(data?: any): any;
1281
+ }
1282
+ export declare type IRunnerUpdatedEvent = IRunnerEvent;
1283
+ export declare class RunnerUpdatedEvent extends RunnerEvent implements IRunnerUpdatedEvent {
1284
+ constructor(data?: IRunnerUpdatedEvent);
1285
+ init(_data?: any): void;
1286
+ static fromJS(data: any): RunnerUpdatedEvent;
1287
+ toJSON(data?: any): any;
1288
+ }
1289
+ export declare type IRunnerDeletedEvent = IRunnerEvent;
1290
+ export declare class RunnerDeletedEvent extends RunnerEvent implements IRunnerDeletedEvent {
1291
+ constructor(data?: IRunnerDeletedEvent);
1292
+ init(_data?: any): void;
1293
+ static fromJS(data: any): RunnerDeletedEvent;
1294
+ toJSON(data?: any): any;
1295
+ }
package/lib/DTOs.js CHANGED
@@ -3637,3 +3637,119 @@ var TestPlanRunCompletedEventArgs = /** @class */ (function (_super) {
3637
3637
  return TestPlanRunCompletedEventArgs;
3638
3638
  }(TestPlanRunEvent));
3639
3639
  export { TestPlanRunCompletedEventArgs };
3640
+ var RunnerEvent = /** @class */ (function () {
3641
+ function RunnerEvent(data) {
3642
+ if (data) {
3643
+ for (var property in data) {
3644
+ if (Object.prototype.hasOwnProperty.call(data, property))
3645
+ this[property] = data[property];
3646
+ }
3647
+ }
3648
+ this.type = 'RunnerEvent';
3649
+ }
3650
+ RunnerEvent.prototype.init = function (_data) {
3651
+ if (_data) {
3652
+ this.runnerId = _data['RunnerId'];
3653
+ }
3654
+ };
3655
+ RunnerEvent.fromJS = function (data) {
3656
+ data = typeof data === 'object' ? data : {};
3657
+ if (data['type'] === 'RunnerRegisteredEvent') {
3658
+ var result_43 = new RunnerRegisteredEvent();
3659
+ result_43.init(data);
3660
+ return result_43;
3661
+ }
3662
+ if (data['type'] === 'RunnerUpdatedEvent') {
3663
+ var result_44 = new RunnerUpdatedEvent();
3664
+ result_44.init(data);
3665
+ return result_44;
3666
+ }
3667
+ if (data['type'] === 'RunnerDeletedEvent') {
3668
+ var result_45 = new RunnerDeletedEvent();
3669
+ result_45.init(data);
3670
+ return result_45;
3671
+ }
3672
+ var result = new RunnerEvent();
3673
+ result.init(data);
3674
+ return result;
3675
+ };
3676
+ RunnerEvent.prototype.toJSON = function (data) {
3677
+ data = typeof data === 'object' ? data : {};
3678
+ data['RunnerId'] = this.runnerId;
3679
+ return data;
3680
+ };
3681
+ return RunnerEvent;
3682
+ }());
3683
+ export { RunnerEvent };
3684
+ var RunnerRegisteredEvent = /** @class */ (function (_super) {
3685
+ __extends(RunnerRegisteredEvent, _super);
3686
+ function RunnerRegisteredEvent(data) {
3687
+ var _this = _super.call(this, data) || this;
3688
+ _this.type = 'RunnerRegisteredEvent';
3689
+ return _this;
3690
+ }
3691
+ RunnerRegisteredEvent.prototype.init = function (_data) {
3692
+ _super.prototype.init.call(this, _data);
3693
+ };
3694
+ RunnerRegisteredEvent.fromJS = function (data) {
3695
+ data = typeof data === 'object' ? data : {};
3696
+ var result = new RunnerRegisteredEvent();
3697
+ result.init(data);
3698
+ return result;
3699
+ };
3700
+ RunnerRegisteredEvent.prototype.toJSON = function (data) {
3701
+ data = typeof data === 'object' ? data : {};
3702
+ _super.prototype.toJSON.call(this, data);
3703
+ return data;
3704
+ };
3705
+ return RunnerRegisteredEvent;
3706
+ }(RunnerEvent));
3707
+ export { RunnerRegisteredEvent };
3708
+ var RunnerUpdatedEvent = /** @class */ (function (_super) {
3709
+ __extends(RunnerUpdatedEvent, _super);
3710
+ function RunnerUpdatedEvent(data) {
3711
+ var _this = _super.call(this, data) || this;
3712
+ _this.type = 'RunnerUpdatedEvent';
3713
+ return _this;
3714
+ }
3715
+ RunnerUpdatedEvent.prototype.init = function (_data) {
3716
+ _super.prototype.init.call(this, _data);
3717
+ };
3718
+ RunnerUpdatedEvent.fromJS = function (data) {
3719
+ data = typeof data === 'object' ? data : {};
3720
+ var result = new RunnerUpdatedEvent();
3721
+ result.init(data);
3722
+ return result;
3723
+ };
3724
+ RunnerUpdatedEvent.prototype.toJSON = function (data) {
3725
+ data = typeof data === 'object' ? data : {};
3726
+ _super.prototype.toJSON.call(this, data);
3727
+ return data;
3728
+ };
3729
+ return RunnerUpdatedEvent;
3730
+ }(RunnerEvent));
3731
+ export { RunnerUpdatedEvent };
3732
+ var RunnerDeletedEvent = /** @class */ (function (_super) {
3733
+ __extends(RunnerDeletedEvent, _super);
3734
+ function RunnerDeletedEvent(data) {
3735
+ var _this = _super.call(this, data) || this;
3736
+ _this.type = 'RunnerDeletedEvent';
3737
+ return _this;
3738
+ }
3739
+ RunnerDeletedEvent.prototype.init = function (_data) {
3740
+ _super.prototype.init.call(this, _data);
3741
+ };
3742
+ RunnerDeletedEvent.fromJS = function (data) {
3743
+ data = typeof data === 'object' ? data : {};
3744
+ var result = new RunnerDeletedEvent();
3745
+ result.init(data);
3746
+ return result;
3747
+ };
3748
+ RunnerDeletedEvent.prototype.toJSON = function (data) {
3749
+ data = typeof data === 'object' ? data : {};
3750
+ _super.prototype.toJSON.call(this, data);
3751
+ return data;
3752
+ };
3753
+ return RunnerDeletedEvent;
3754
+ }(RunnerEvent));
3755
+ export { RunnerDeletedEvent };
@@ -1,6 +1,6 @@
1
- import { BaseClient } from './BaseClient';
2
1
  import { ConnectionOptions, Subscription, SubscriptionOptions } from 'nats.ws';
3
- import { ErrorResponse, TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs } from './DTOs';
2
+ import { ErrorResponse, RunnerEvent, TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs } from './DTOs';
3
+ import { BaseClient } from './BaseClient';
4
4
  export interface RunnerLifetimeEvent {
5
5
  RunnerId: string;
6
6
  Subject: string;
@@ -15,6 +15,14 @@ export declare class SystemClient extends BaseClient {
15
15
  * @returns {Subscription}
16
16
  */
17
17
  subscribeLifetimeEventListener(listener: (error: ErrorResponse | null, message: RunnerLifetimeEvent | null) => void, options?: SubscriptionOptions): Subscription;
18
+ /**
19
+ * Subscribe to the runner updated events for the given Runner ID.
20
+ * Wildcard can be used to receive all runner updated events.
21
+ * @param {string} runnerId
22
+ * @param {(error:ErrorResponse|null,message:RunnerEvent|null)=>void} listener
23
+ * @param {SubscriptionOptions} options?
24
+ */
25
+ subscribeRunnerUpdatedEvents(runnerId: string, listener: (error: ErrorResponse | null, message: RunnerEvent | null) => void, options?: SubscriptionOptions): Subscription;
18
26
  /**
19
27
  * Subscribe to the test step run start events for the given Runner and Run ID.
20
28
  * Wildcard can be used for the Runner or Run ID to receive all test step run start events.
@@ -24,9 +24,9 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  return __assign.apply(this, arguments);
26
26
  };
27
- import { BaseClient } from './BaseClient';
28
27
  import { JSONCodec } from 'nats.ws';
29
- import { TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs, } from './DTOs';
28
+ import { RunnerEvent, TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs, } from './DTOs';
29
+ import { BaseClient } from './BaseClient';
30
30
  var SystemClient = /** @class */ (function (_super) {
31
31
  __extends(SystemClient, _super);
32
32
  function SystemClient(baseSubject, options) {
@@ -40,7 +40,7 @@ var SystemClient = /** @class */ (function (_super) {
40
40
  */
41
41
  SystemClient.prototype.subscribeLifetimeEventListener = function (listener, options) {
42
42
  var _this = this;
43
- var subject = '*.Events.Lifetime';
43
+ var subject = 'Runner.*.Events.Lifetime';
44
44
  return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
45
45
  if (error) {
46
46
  listener(_this.natsErrorHandler(error, subject), null);
@@ -56,6 +56,31 @@ var SystemClient = /** @class */ (function (_super) {
56
56
  }
57
57
  } }));
58
58
  };
59
+ /**
60
+ * Subscribe to the runner updated events for the given Runner ID.
61
+ * Wildcard can be used to receive all runner updated events.
62
+ * @param {string} runnerId
63
+ * @param {(error:ErrorResponse|null,message:RunnerEvent|null)=>void} listener
64
+ * @param {SubscriptionOptions} options?
65
+ */
66
+ SystemClient.prototype.subscribeRunnerUpdatedEvents = function (runnerId, listener, options) {
67
+ var _this = this;
68
+ var subject = "RunnerRegistry.".concat(runnerId, ".Events.Updated");
69
+ return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
70
+ if (error) {
71
+ listener(_this.natsErrorHandler(error, subject), null);
72
+ return;
73
+ }
74
+ try {
75
+ var jsonCodec = JSONCodec();
76
+ var data = RunnerEvent.fromJS(jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data));
77
+ listener(null, data);
78
+ }
79
+ catch (error) {
80
+ listener(_this.natsErrorHandler(error, subject), null);
81
+ }
82
+ } }));
83
+ };
59
84
  /**
60
85
  * Subscribe to the test step run start events for the given Runner and Run ID.
61
86
  * Wildcard can be used for the Runner or Run ID to receive all test step run start events.
@@ -66,7 +91,7 @@ var SystemClient = /** @class */ (function (_super) {
66
91
  */
67
92
  SystemClient.prototype.subscribeTestStepRunStartEventListener = function (runnerId, runId, listener, options) {
68
93
  var _this = this;
69
- var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestStepRunStart");
94
+ var subject = "Runner.".concat(runnerId, ".Runs.").concat(runId, ".Events.TestStepRunStart");
70
95
  return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
71
96
  if (error) {
72
97
  listener(_this.natsErrorHandler(error, subject), null);
@@ -93,7 +118,7 @@ var SystemClient = /** @class */ (function (_super) {
93
118
  */
94
119
  SystemClient.prototype.subscribeTestStepRunCompletedEventListener = function (runnerId, runId, listener, options) {
95
120
  var _this = this;
96
- var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestStepRunCompleted");
121
+ var subject = "Runner.".concat(runnerId, ".Runs.").concat(runId, ".Events.TestStepRunCompleted");
97
122
  return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
98
123
  if (error) {
99
124
  listener(_this.natsErrorHandler(error, subject), null);
@@ -120,7 +145,7 @@ var SystemClient = /** @class */ (function (_super) {
120
145
  */
121
146
  SystemClient.prototype.subscribeTestPlanRunStartEventListener = function (runnerId, runId, listener, options) {
122
147
  var _this = this;
123
- var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestPlanRunStart");
148
+ var subject = "Runner.".concat(runnerId, ".Runs.").concat(runId, ".Events.TestPlanRunStart");
124
149
  return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
125
150
  if (error) {
126
151
  listener(_this.natsErrorHandler(error, subject), null);
@@ -147,7 +172,7 @@ var SystemClient = /** @class */ (function (_super) {
147
172
  */
148
173
  SystemClient.prototype.subscribeTestPlanRunCompletedEventListener = function (runnerId, runId, listener, options) {
149
174
  var _this = this;
150
- var subject = "".concat(runnerId, ".Runs.").concat(runId, ".Events.TestPlanRunCompleted");
175
+ var subject = "Runner.".concat(runnerId, ".Runs.").concat(runId, ".Events.TestPlanRunCompleted");
151
176
  return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
152
177
  if (error) {
153
178
  listener(_this.natsErrorHandler(error, subject), null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.10.0",
3
+ "version": "2.11.0-alpha.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",