@opentap/runner-client 2.11.0-alpha.1.1 → 2.11.0-alpha.1.2

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,14 +1,11 @@
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, RunnerDeletedEvent, RunnerRegisteredEvent, RunnerUpdatedEvent, TestPlanRunCompletedEventArgs, TestPlanRunStartEventArgs, TestStepRunCompletedEventArgs, TestStepRunStartEventArgs } from './DTOs';
3
+ import { BaseClient } from './BaseClient';
4
4
  export interface RunnerLifetimeEvent {
5
5
  RunnerId: string;
6
6
  Subject: string;
7
7
  Discriminator: string;
8
8
  }
9
- export interface RunnerUpdatedEvent {
10
- RunnerId: string;
11
- }
12
9
  export declare class SystemClient extends BaseClient {
13
10
  constructor(baseSubject: string, options: ConnectionOptions);
14
11
  /**
@@ -18,6 +15,14 @@ export declare class SystemClient extends BaseClient {
18
15
  * @returns {Subscription}
19
16
  */
20
17
  subscribeLifetimeEventListener(listener: (error: ErrorResponse | null, message: RunnerLifetimeEvent | null) => void, options?: SubscriptionOptions): Subscription;
18
+ /**
19
+ * Subscribe to the runner registered events for the given Runner ID.
20
+ * Wildcard can be used to receive all runner registered events.
21
+ * @param {string} runnerId
22
+ * @param {(error:ErrorResponse|null,message:RunnerRegisteredEvent|null)=>void} listener
23
+ * @param {SubscriptionOptions} options?
24
+ */
25
+ subscribeRunnerRegisteredEvents(runnerId: string, listener: (error: ErrorResponse | null, message: RunnerRegisteredEvent | null) => void, options?: SubscriptionOptions): Subscription;
21
26
  /**
22
27
  * Subscribe to the runner updated events for the given Runner ID.
23
28
  * Wildcard can be used to receive all runner updated events.
@@ -26,6 +31,14 @@ export declare class SystemClient extends BaseClient {
26
31
  * @param {SubscriptionOptions} options?
27
32
  */
28
33
  subscribeRunnerUpdatedEvents(runnerId: string, listener: (error: ErrorResponse | null, message: RunnerUpdatedEvent | null) => void, options?: SubscriptionOptions): Subscription;
34
+ /**
35
+ * Subscribe to the runner deleted events for the given Runner ID.
36
+ * Wildcard can be used to receive all runner deleted events.
37
+ * @param {string} runnerId
38
+ * @param {(error:ErrorResponse|null,message:RunnerDeletedEvent|null)=>void} listener
39
+ * @param {SubscriptionOptions} options?
40
+ */
41
+ subscribeRunnerDeletedEvents(runnerId: string, listener: (error: ErrorResponse | null, message: RunnerDeletedEvent | null) => void, options?: SubscriptionOptions): Subscription;
29
42
  /**
30
43
  * Subscribe to the test step run start events for the given Runner and Run ID.
31
44
  * 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
28
  import { 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) {
@@ -56,6 +56,31 @@ var SystemClient = /** @class */ (function (_super) {
56
56
  }
57
57
  } }));
58
58
  };
59
+ /**
60
+ * Subscribe to the runner registered events for the given Runner ID.
61
+ * Wildcard can be used to receive all runner registered events.
62
+ * @param {string} runnerId
63
+ * @param {(error:ErrorResponse|null,message:RunnerRegisteredEvent|null)=>void} listener
64
+ * @param {SubscriptionOptions} options?
65
+ */
66
+ SystemClient.prototype.subscribeRunnerRegisteredEvents = function (runnerId, listener, options) {
67
+ var _this = this;
68
+ var subject = "RunnerRegistry.".concat(runnerId, ".Events.Registered");
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 = 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 runner updated events for the given Runner ID.
61
86
  * Wildcard can be used to receive all runner updated events.
@@ -81,6 +106,31 @@ var SystemClient = /** @class */ (function (_super) {
81
106
  }
82
107
  } }));
83
108
  };
109
+ /**
110
+ * Subscribe to the runner deleted events for the given Runner ID.
111
+ * Wildcard can be used to receive all runner deleted events.
112
+ * @param {string} runnerId
113
+ * @param {(error:ErrorResponse|null,message:RunnerDeletedEvent|null)=>void} listener
114
+ * @param {SubscriptionOptions} options?
115
+ */
116
+ SystemClient.prototype.subscribeRunnerDeletedEvents = function (runnerId, listener, options) {
117
+ var _this = this;
118
+ var subject = "RunnerRegistry.".concat(runnerId, ".Events.Deleted");
119
+ return this.subscribe(subject, __assign(__assign({}, options), { callback: function (error, message) {
120
+ if (error) {
121
+ listener(_this.natsErrorHandler(error, subject), null);
122
+ return;
123
+ }
124
+ try {
125
+ var jsonCodec = JSONCodec();
126
+ var data = jsonCodec.decode(message === null || message === void 0 ? void 0 : message.data);
127
+ listener(null, data);
128
+ }
129
+ catch (error) {
130
+ listener(_this.natsErrorHandler(error, subject), null);
131
+ }
132
+ } }));
133
+ };
84
134
  /**
85
135
  * Subscribe to the test step run start events for the given Runner and Run ID.
86
136
  * Wildcard can be used for the Runner or Run ID to receive all test step run start events.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.11.0-alpha.1.1",
3
+ "version": "2.11.0-alpha.1.2",
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",