@opentap/runner-client 4.9.0-beta.1.40294477159 → 4.9.0-beta.3.41598982309

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.
@@ -107,6 +107,7 @@ export interface ISession {
107
107
  /**
108
108
  * Where a session's image comes from. The concrete type is named by the `ProvisionType` property on the wire.
109
109
  * Each type replaces one part of the session's image; the other parts stay what the session has.
110
+ * An image that is not the one the session has is installed into the session, which is restarted on it.
110
111
  */
111
112
  export declare abstract class SessionProvision {
112
113
  protected _discriminator: string;
@@ -115,7 +116,10 @@ export declare abstract class SessionProvision {
115
116
  static fromJS(data: any): SessionProvision;
116
117
  toJSON(data?: any): any;
117
118
  }
118
- /** Uses `image` on top of the Runner's default image. The session keeps its test plan and settings. */
119
+ /**
120
+ * Uses `image` on top of the Runner's default image. The session keeps its test plan and settings, but their
121
+ * dependencies are not added to the image.
122
+ */
119
123
  export declare class ExactProvision extends SessionProvision implements IExactProvision {
120
124
  /** Packages that replace the session's packages, combined with the Runner's default image. */
121
125
  image?: Image | undefined;
@@ -163,9 +167,22 @@ export declare class TestPlanReferenceProvision extends SessionProvision impleme
163
167
  export interface ITestPlanReferenceProvision {
164
168
  testPlanReference?: RepositoryPackageReference | undefined;
165
169
  }
170
+ /**
171
+ * Replaces the session's test plan with an empty one. The session has no test plan reference afterwards, and the
172
+ * dependencies of its previous test plan are no longer part of the image.
173
+ */
174
+ export declare class EmptyTestPlanProvision extends SessionProvision implements IEmptyTestPlanProvision {
175
+ constructor(data?: IEmptyTestPlanProvision);
176
+ static fromJS(data: any): EmptyTestPlanProvision;
177
+ }
178
+ export interface IEmptyTestPlanProvision {
179
+ }
166
180
  /** Configuration of an existing session, sent to ConfigureSession. A property that is undefined keeps the session's current value. */
167
181
  export declare class SessionConfiguration implements ISessionConfiguration {
168
- /** The image the session asks for. The session must be idle. */
182
+ /**
183
+ * The image the session asks for. The session must be idle. If it is not the image the session has, the Runner installs it
184
+ * into the session and restarts the session on it before it loads anything. That needs OpenTAP 9.31 or newer on the Runner.
185
+ */
169
186
  provision?: SessionProvision | undefined;
170
187
  /** An empty title removes the title. */
171
188
  title?: string | undefined;
@@ -188,30 +205,56 @@ export interface ISessionConfiguration {
188
205
  [key: string]: string;
189
206
  } | undefined;
190
207
  }
191
- /** Published by the Runner after every successful ConfigureSession request. */
192
- export declare class SessionConfigurationChangedEvent implements ISessionConfigurationChangedEvent {
208
+ /** Published by the Runner as a ConfigureSession request progresses. */
209
+ export declare class SessionConfigurationProgressEvent implements ISessionConfigurationProgressEvent {
210
+ sessionId?: string | undefined;
211
+ progress?: SessionConfigurationProgress | undefined;
212
+ constructor(data?: ISessionConfigurationProgressEvent);
213
+ init(_data?: any): void;
214
+ static fromJS(data: any): SessionConfigurationProgressEvent;
215
+ toJSON(data?: any): any;
216
+ }
217
+ export interface ISessionConfigurationProgressEvent {
218
+ sessionId?: string | undefined;
219
+ progress?: SessionConfigurationProgress | undefined;
220
+ }
221
+ /** What happened to a ConfigureSession request. The concrete type is named by the `ProgressType` property on the wire. */
222
+ export declare abstract class SessionConfigurationProgress {
223
+ protected _discriminator: string;
224
+ constructor();
225
+ init(_data?: any): void;
226
+ static fromJS(data: any): SessionConfigurationProgress;
227
+ toJSON(data?: any): any;
228
+ }
229
+ /** The Runner accepted the request and is applying it. */
230
+ export declare class SessionConfigurationStarted extends SessionConfigurationProgress implements ISessionConfigurationStarted {
231
+ constructor(data?: ISessionConfigurationStarted);
232
+ static fromJS(data: any): SessionConfigurationStarted;
233
+ }
234
+ export interface ISessionConfigurationStarted {
235
+ }
236
+ /** The session is configured. */
237
+ export declare class SessionConfigurationSucceeded extends SessionConfigurationProgress implements ISessionConfigurationSucceeded {
193
238
  /** The session after the change, as GetSessions reports it. */
194
239
  session?: Session | undefined;
195
- constructor(data?: ISessionConfigurationChangedEvent);
240
+ constructor(data?: ISessionConfigurationSucceeded);
196
241
  init(_data?: any): void;
197
- static fromJS(data: any): SessionConfigurationChangedEvent;
242
+ static fromJS(data: any): SessionConfigurationSucceeded;
198
243
  toJSON(data?: any): any;
199
244
  }
200
- export interface ISessionConfigurationChangedEvent {
245
+ export interface ISessionConfigurationSucceeded {
201
246
  session?: Session | undefined;
202
247
  }
203
- /** Published by the Runner when it accepted a ConfigureSession request with a `provision`, and could not complete it. */
204
- export declare class SessionConfigurationFailedEvent implements ISessionConfigurationFailedEvent {
205
- sessionId?: string | undefined;
248
+ /** The Runner accepted the request, and could not complete it. */
249
+ export declare class SessionConfigurationFailed extends SessionConfigurationProgress implements ISessionConfigurationFailed {
206
250
  /** Why the configuration failed. For people to read; do not parse it. */
207
251
  message?: string | undefined;
208
- constructor(data?: ISessionConfigurationFailedEvent);
252
+ constructor(data?: ISessionConfigurationFailed);
209
253
  init(_data?: any): void;
210
- static fromJS(data: any): SessionConfigurationFailedEvent;
254
+ static fromJS(data: any): SessionConfigurationFailed;
211
255
  toJSON(data?: any): any;
212
256
  }
213
- export interface ISessionConfigurationFailedEvent {
214
- sessionId?: string | undefined;
257
+ export interface ISessionConfigurationFailed {
215
258
  message?: string | undefined;
216
259
  }
217
260
  export declare class Links implements ILinks {
package/dist/cjs/DTOs.js CHANGED
@@ -26,9 +26,9 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  return t;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.FileDescriptor = exports.Resource = exports.PluginTypeSelectorControl = exports.PictureControl = exports.PasswordControl = exports.MultiSelectControl = exports.DropdownControl = exports.EnabledControl = exports.DirectoryPathControl = exports.FilePathControl = exports.ComboBoxControl = exports.TextBoxControl = exports.DataGridControl = exports.DataGridReferenceControl = exports.CheckBoxControl = exports.AvailableValue = exports.ButtonsControl = exports.ButtonControl = exports.ExternalParameter = exports.MetaData = exports.DisplayAttribute = exports.VisualStatus = exports.UnitAttribute = exports.Icon = exports.ColumnDisplayName = exports.LayoutMode = exports.Layout = exports.Setting = exports.ComponentSettingsListItem = exports.AnnotatedObject = exports.ComponentSettingsList = exports.DisplayMode = exports.ComponentSettingsIdentifier = exports.ComponentSettingsBase = exports.Links = exports.SessionConfigurationFailedEvent = exports.SessionConfigurationChangedEvent = exports.SessionConfiguration = exports.TestPlanReferenceProvision = exports.SettingsProvision = exports.AdditionalPackagesProvision = exports.ExactProvision = exports.SessionProvision = exports.Session = exports.LifecyclePolicy = exports.ImageResolveErrorResponse = exports.NoResponderError = exports.ErrorResponse = exports.PackageSpecifier = exports.Image = void 0;
30
- exports.SessionMetricInfo = exports.MetricsPollRate = exports.SessionMetricType = exports.SessionMetricKind = exports.ResultColumn = exports.Result = exports.LogEvent = exports.TestStepRun = exports.WatchDog = exports.Parameter = exports.BreakPoints = exports.InstalledFile = exports.Interaction = exports.CommonContext = exports.CommonSettings = exports.ValidationError = exports.TestStepValidationError = exports.TestStepCopy = exports.TestStepType = exports.TestStep = exports.TestPlan = exports.SessionState = exports.Verdict = exports.EditStatus = exports.RunStatus = exports.MissingLicenseResponse = exports.LogEntry = exports.LogList = exports.ApiException = exports.ImageCreationFailed = exports.ImageCreated = exports.ImageCreating = exports.ImageEventArgs = exports.SessionInactivityLimitHit = exports.SessionShutdownFailed = exports.SessionShutdown = exports.SessionShutdownInitiated = exports.SessionStartFailed = exports.SessionStarted = exports.SessionStartInitiated = exports.SessionEventArgs = exports.SettingsTapPackage = exports.SaveTestPlanToRepositoryResponse = exports.GetTestPlanReferenceResponse = exports.RepositorySettingsPackageDefinition = exports.RepositoryPackageDefinition = exports.RepositoryPackageReference = exports.ProfileGroup = exports.ListItemType = exports.ComponentSettings = void 0;
31
- exports.AssetDiscoveryResponse = exports.AssetDiscoveryResult = exports.DiscoveredAsset = exports.EnableMetricsPollingResponse = exports.GetLocalTestPlansResponse = exports.RunnerStatus = exports.StreamInfoStatus = exports.RemoteConnection = exports.SaveDefaultSettings = exports.AssetUpdatedEvent = exports.MetadataUpdatedEvent = exports.RunnerDeletedEvent = exports.RunnerUpdatedEvent = exports.RunnerRegisteredEvent = exports.RunnerEvent = exports.TestPlanRunCompletedEvent = exports.TestPlanRunStartEvent = exports.TestPlanRunEvent = exports.OnTestStepRun = exports.OnTestPlanRun = exports.RestartCompletedEvent = exports.RestartInitiatedEvent = exports.UserInputChangedEvent = exports.UserInputRequestCompletedEvent = exports.UserInputRequestedEvent = exports.BreakEvent = exports.TestStepChangedEvent = exports.SettingsChangedEvent = exports.HeartbeatEvent = exports.SessionStateChangedEvent = exports.TestPlanReferenceChangedEvent = exports.TestPlanChangedEvent = exports.StoppedEvent = exports.StoppingEvent = exports.StartedEvent = exports.StartingEvent = exports.SessionTimeoutEvent = exports.TestPlanSettingsChangedEvent = exports.TypeCacheInvalidatedEvent = exports.SessionEvent = exports.SessionEventName = exports.MetricValue = exports.MetricsConfiguration = void 0;
29
+ exports.PasswordControl = exports.MultiSelectControl = exports.DropdownControl = exports.EnabledControl = exports.DirectoryPathControl = exports.FilePathControl = exports.ComboBoxControl = exports.TextBoxControl = exports.DataGridControl = exports.DataGridReferenceControl = exports.CheckBoxControl = exports.AvailableValue = exports.ButtonsControl = exports.ButtonControl = exports.ExternalParameter = exports.MetaData = exports.DisplayAttribute = exports.VisualStatus = exports.UnitAttribute = exports.Icon = exports.ColumnDisplayName = exports.LayoutMode = exports.Layout = exports.Setting = exports.ComponentSettingsListItem = exports.AnnotatedObject = exports.ComponentSettingsList = exports.DisplayMode = exports.ComponentSettingsIdentifier = exports.ComponentSettingsBase = exports.Links = exports.SessionConfigurationFailed = exports.SessionConfigurationSucceeded = exports.SessionConfigurationStarted = exports.SessionConfigurationProgress = exports.SessionConfigurationProgressEvent = exports.SessionConfiguration = exports.EmptyTestPlanProvision = exports.TestPlanReferenceProvision = exports.SettingsProvision = exports.AdditionalPackagesProvision = exports.ExactProvision = exports.SessionProvision = exports.Session = exports.LifecyclePolicy = exports.ImageResolveErrorResponse = exports.NoResponderError = exports.ErrorResponse = exports.PackageSpecifier = exports.Image = void 0;
30
+ exports.ResultColumn = exports.Result = exports.LogEvent = exports.TestStepRun = exports.WatchDog = exports.Parameter = exports.BreakPoints = exports.InstalledFile = exports.Interaction = exports.CommonContext = exports.CommonSettings = exports.ValidationError = exports.TestStepValidationError = exports.TestStepCopy = exports.TestStepType = exports.TestStep = exports.TestPlan = exports.SessionState = exports.Verdict = exports.EditStatus = exports.RunStatus = exports.MissingLicenseResponse = exports.LogEntry = exports.LogList = exports.ApiException = exports.ImageCreationFailed = exports.ImageCreated = exports.ImageCreating = exports.ImageEventArgs = exports.SessionInactivityLimitHit = exports.SessionShutdownFailed = exports.SessionShutdown = exports.SessionShutdownInitiated = exports.SessionStartFailed = exports.SessionStarted = exports.SessionStartInitiated = exports.SessionEventArgs = exports.SettingsTapPackage = exports.SaveTestPlanToRepositoryResponse = exports.GetTestPlanReferenceResponse = exports.RepositorySettingsPackageDefinition = exports.RepositoryPackageDefinition = exports.RepositoryPackageReference = exports.ProfileGroup = exports.ListItemType = exports.ComponentSettings = exports.FileDescriptor = exports.Resource = exports.PluginTypeSelectorControl = exports.PictureControl = void 0;
31
+ exports.AssetDiscoveryResponse = exports.AssetDiscoveryResult = exports.DiscoveredAsset = exports.EnableMetricsPollingResponse = exports.GetLocalTestPlansResponse = exports.RunnerStatus = exports.StreamInfoStatus = exports.RemoteConnection = exports.SaveDefaultSettings = exports.AssetUpdatedEvent = exports.MetadataUpdatedEvent = exports.RunnerDeletedEvent = exports.RunnerUpdatedEvent = exports.RunnerRegisteredEvent = exports.RunnerEvent = exports.TestPlanRunCompletedEvent = exports.TestPlanRunStartEvent = exports.TestPlanRunEvent = exports.OnTestStepRun = exports.OnTestPlanRun = exports.RestartCompletedEvent = exports.RestartInitiatedEvent = exports.UserInputChangedEvent = exports.UserInputRequestCompletedEvent = exports.UserInputRequestedEvent = exports.BreakEvent = exports.TestStepChangedEvent = exports.SettingsChangedEvent = exports.HeartbeatEvent = exports.SessionStateChangedEvent = exports.TestPlanReferenceChangedEvent = exports.TestPlanChangedEvent = exports.StoppedEvent = exports.StoppingEvent = exports.StartedEvent = exports.StartingEvent = exports.SessionTimeoutEvent = exports.TestPlanSettingsChangedEvent = exports.TypeCacheInvalidatedEvent = exports.SessionEvent = exports.SessionEventName = exports.MetricValue = exports.MetricsConfiguration = exports.SessionMetricInfo = exports.MetricsPollRate = exports.SessionMetricType = exports.SessionMetricKind = void 0;
32
32
  var Image = /** @class */ (function () {
33
33
  function Image(data) {
34
34
  this.packages = [];
@@ -256,6 +256,7 @@ exports.Session = Session;
256
256
  /**
257
257
  * Where a session's image comes from. The concrete type is named by the `ProvisionType` property on the wire.
258
258
  * Each type replaces one part of the session's image; the other parts stay what the session has.
259
+ * An image that is not the one the session has is installed into the session, which is restarted on it.
259
260
  */
260
261
  var SessionProvision = /** @class */ (function () {
261
262
  function SessionProvision() {
@@ -285,6 +286,11 @@ var SessionProvision = /** @class */ (function () {
285
286
  result.init(data);
286
287
  return result;
287
288
  }
289
+ if (data['ProvisionType'] === 'EmptyTestPlanProvision') {
290
+ var result = new EmptyTestPlanProvision();
291
+ result.init(data);
292
+ return result;
293
+ }
288
294
  throw new Error("The abstract class 'SessionProvision' cannot be instantiated.");
289
295
  };
290
296
  SessionProvision.prototype.toJSON = function (data) {
@@ -295,7 +301,10 @@ var SessionProvision = /** @class */ (function () {
295
301
  return SessionProvision;
296
302
  }());
297
303
  exports.SessionProvision = SessionProvision;
298
- /** Uses `image` on top of the Runner's default image. The session keeps its test plan and settings. */
304
+ /**
305
+ * Uses `image` on top of the Runner's default image. The session keeps its test plan and settings, but their
306
+ * dependencies are not added to the image.
307
+ */
299
308
  var ExactProvision = /** @class */ (function (_super) {
300
309
  __extends(ExactProvision, _super);
301
310
  function ExactProvision(data) {
@@ -452,6 +461,32 @@ var TestPlanReferenceProvision = /** @class */ (function (_super) {
452
461
  return TestPlanReferenceProvision;
453
462
  }(SessionProvision));
454
463
  exports.TestPlanReferenceProvision = TestPlanReferenceProvision;
464
+ /**
465
+ * Replaces the session's test plan with an empty one. The session has no test plan reference afterwards, and the
466
+ * dependencies of its previous test plan are no longer part of the image.
467
+ */
468
+ var EmptyTestPlanProvision = /** @class */ (function (_super) {
469
+ __extends(EmptyTestPlanProvision, _super);
470
+ function EmptyTestPlanProvision(data) {
471
+ var _this = _super.call(this) || this;
472
+ if (data) {
473
+ for (var property in data) {
474
+ if (Object.prototype.hasOwnProperty.call(data, property))
475
+ _this[property] = data[property];
476
+ }
477
+ }
478
+ _this._discriminator = 'EmptyTestPlanProvision';
479
+ return _this;
480
+ }
481
+ EmptyTestPlanProvision.fromJS = function (data) {
482
+ data = typeof data === 'object' ? data : {};
483
+ var result = new EmptyTestPlanProvision();
484
+ result.init(data);
485
+ return result;
486
+ };
487
+ return EmptyTestPlanProvision;
488
+ }(SessionProvision));
489
+ exports.EmptyTestPlanProvision = EmptyTestPlanProvision;
455
490
  /** Configuration of an existing session, sent to ConfigureSession. A property that is undefined keeps the session's current value. */
456
491
  var SessionConfiguration = /** @class */ (function () {
457
492
  function SessionConfiguration(data) {
@@ -487,9 +522,9 @@ var SessionConfiguration = /** @class */ (function () {
487
522
  return SessionConfiguration;
488
523
  }());
489
524
  exports.SessionConfiguration = SessionConfiguration;
490
- /** Published by the Runner after every successful ConfigureSession request. */
491
- var SessionConfigurationChangedEvent = /** @class */ (function () {
492
- function SessionConfigurationChangedEvent(data) {
525
+ /** Published by the Runner as a ConfigureSession request progresses. */
526
+ var SessionConfigurationProgressEvent = /** @class */ (function () {
527
+ function SessionConfigurationProgressEvent(data) {
493
528
  if (data) {
494
529
  for (var property in data) {
495
530
  if (Object.prototype.hasOwnProperty.call(data, property))
@@ -497,56 +532,154 @@ var SessionConfigurationChangedEvent = /** @class */ (function () {
497
532
  }
498
533
  }
499
534
  }
500
- SessionConfigurationChangedEvent.prototype.init = function (_data) {
535
+ SessionConfigurationProgressEvent.prototype.init = function (_data) {
536
+ if (_data) {
537
+ this.sessionId = _data['SessionId'];
538
+ this.progress = _data['Progress'] ? SessionConfigurationProgress.fromJS(_data['Progress']) : undefined;
539
+ }
540
+ };
541
+ SessionConfigurationProgressEvent.fromJS = function (data) {
542
+ data = typeof data === 'object' ? data : {};
543
+ var result = new SessionConfigurationProgressEvent();
544
+ result.init(data);
545
+ return result;
546
+ };
547
+ SessionConfigurationProgressEvent.prototype.toJSON = function (data) {
548
+ data = typeof data === 'object' ? data : {};
549
+ data['SessionId'] = this.sessionId;
550
+ data['Progress'] = this.progress ? this.progress.toJSON() : undefined;
551
+ return data;
552
+ };
553
+ return SessionConfigurationProgressEvent;
554
+ }());
555
+ exports.SessionConfigurationProgressEvent = SessionConfigurationProgressEvent;
556
+ /** What happened to a ConfigureSession request. The concrete type is named by the `ProgressType` property on the wire. */
557
+ var SessionConfigurationProgress = /** @class */ (function () {
558
+ function SessionConfigurationProgress() {
559
+ this._discriminator = 'SessionConfigurationProgress';
560
+ }
561
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
562
+ SessionConfigurationProgress.prototype.init = function (_data) { };
563
+ SessionConfigurationProgress.fromJS = function (data) {
564
+ data = typeof data === 'object' ? data : {};
565
+ if (data['ProgressType'] === 'Started') {
566
+ var result = new SessionConfigurationStarted();
567
+ result.init(data);
568
+ return result;
569
+ }
570
+ if (data['ProgressType'] === 'Succeeded') {
571
+ var result = new SessionConfigurationSucceeded();
572
+ result.init(data);
573
+ return result;
574
+ }
575
+ if (data['ProgressType'] === 'Failed') {
576
+ var result = new SessionConfigurationFailed();
577
+ result.init(data);
578
+ return result;
579
+ }
580
+ throw new Error("The abstract class 'SessionConfigurationProgress' cannot be instantiated.");
581
+ };
582
+ SessionConfigurationProgress.prototype.toJSON = function (data) {
583
+ data = typeof data === 'object' ? data : {};
584
+ data['ProgressType'] = this._discriminator;
585
+ return data;
586
+ };
587
+ return SessionConfigurationProgress;
588
+ }());
589
+ exports.SessionConfigurationProgress = SessionConfigurationProgress;
590
+ /** The Runner accepted the request and is applying it. */
591
+ var SessionConfigurationStarted = /** @class */ (function (_super) {
592
+ __extends(SessionConfigurationStarted, _super);
593
+ function SessionConfigurationStarted(data) {
594
+ var _this = _super.call(this) || this;
595
+ if (data) {
596
+ for (var property in data) {
597
+ if (Object.prototype.hasOwnProperty.call(data, property))
598
+ _this[property] = data[property];
599
+ }
600
+ }
601
+ _this._discriminator = 'Started';
602
+ return _this;
603
+ }
604
+ SessionConfigurationStarted.fromJS = function (data) {
605
+ data = typeof data === 'object' ? data : {};
606
+ var result = new SessionConfigurationStarted();
607
+ result.init(data);
608
+ return result;
609
+ };
610
+ return SessionConfigurationStarted;
611
+ }(SessionConfigurationProgress));
612
+ exports.SessionConfigurationStarted = SessionConfigurationStarted;
613
+ /** The session is configured. */
614
+ var SessionConfigurationSucceeded = /** @class */ (function (_super) {
615
+ __extends(SessionConfigurationSucceeded, _super);
616
+ function SessionConfigurationSucceeded(data) {
617
+ var _this = _super.call(this) || this;
618
+ if (data) {
619
+ for (var property in data) {
620
+ if (Object.prototype.hasOwnProperty.call(data, property))
621
+ _this[property] = data[property];
622
+ }
623
+ }
624
+ _this._discriminator = 'Succeeded';
625
+ return _this;
626
+ }
627
+ SessionConfigurationSucceeded.prototype.init = function (_data) {
628
+ _super.prototype.init.call(this, _data);
501
629
  if (_data) {
502
630
  this.session = _data['Session'] ? Session.fromJS(_data['Session']) : undefined;
503
631
  }
504
632
  };
505
- SessionConfigurationChangedEvent.fromJS = function (data) {
633
+ SessionConfigurationSucceeded.fromJS = function (data) {
506
634
  data = typeof data === 'object' ? data : {};
507
- var result = new SessionConfigurationChangedEvent();
635
+ var result = new SessionConfigurationSucceeded();
508
636
  result.init(data);
509
637
  return result;
510
638
  };
511
- SessionConfigurationChangedEvent.prototype.toJSON = function (data) {
639
+ SessionConfigurationSucceeded.prototype.toJSON = function (data) {
512
640
  data = typeof data === 'object' ? data : {};
641
+ _super.prototype.toJSON.call(this, data);
513
642
  data['Session'] = this.session ? this.session.toJSON() : undefined;
514
643
  return data;
515
644
  };
516
- return SessionConfigurationChangedEvent;
517
- }());
518
- exports.SessionConfigurationChangedEvent = SessionConfigurationChangedEvent;
519
- /** Published by the Runner when it accepted a ConfigureSession request with a `provision`, and could not complete it. */
520
- var SessionConfigurationFailedEvent = /** @class */ (function () {
521
- function SessionConfigurationFailedEvent(data) {
645
+ return SessionConfigurationSucceeded;
646
+ }(SessionConfigurationProgress));
647
+ exports.SessionConfigurationSucceeded = SessionConfigurationSucceeded;
648
+ /** The Runner accepted the request, and could not complete it. */
649
+ var SessionConfigurationFailed = /** @class */ (function (_super) {
650
+ __extends(SessionConfigurationFailed, _super);
651
+ function SessionConfigurationFailed(data) {
652
+ var _this = _super.call(this) || this;
522
653
  if (data) {
523
654
  for (var property in data) {
524
655
  if (Object.prototype.hasOwnProperty.call(data, property))
525
- this[property] = data[property];
656
+ _this[property] = data[property];
526
657
  }
527
658
  }
659
+ _this._discriminator = 'Failed';
660
+ return _this;
528
661
  }
529
- SessionConfigurationFailedEvent.prototype.init = function (_data) {
662
+ SessionConfigurationFailed.prototype.init = function (_data) {
663
+ _super.prototype.init.call(this, _data);
530
664
  if (_data) {
531
- this.sessionId = _data['SessionId'];
532
665
  this.message = _data['Message'];
533
666
  }
534
667
  };
535
- SessionConfigurationFailedEvent.fromJS = function (data) {
668
+ SessionConfigurationFailed.fromJS = function (data) {
536
669
  data = typeof data === 'object' ? data : {};
537
- var result = new SessionConfigurationFailedEvent();
670
+ var result = new SessionConfigurationFailed();
538
671
  result.init(data);
539
672
  return result;
540
673
  };
541
- SessionConfigurationFailedEvent.prototype.toJSON = function (data) {
674
+ SessionConfigurationFailed.prototype.toJSON = function (data) {
542
675
  data = typeof data === 'object' ? data : {};
543
- data['SessionId'] = this.sessionId;
676
+ _super.prototype.toJSON.call(this, data);
544
677
  data['Message'] = this.message;
545
678
  return data;
546
679
  };
547
- return SessionConfigurationFailedEvent;
548
- }());
549
- exports.SessionConfigurationFailedEvent = SessionConfigurationFailedEvent;
680
+ return SessionConfigurationFailed;
681
+ }(SessionConfigurationProgress));
682
+ exports.SessionConfigurationFailed = SessionConfigurationFailed;
550
683
  var Links = /** @class */ (function () {
551
684
  function Links(data) {
552
685
  if (data) {
@@ -1,6 +1,6 @@
1
1
  import { ConnectionOptions, Consumer, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
2
2
  import { AddLocalTestPlanRequest, ConfigureSessionRequest, DeleteSessionRequest, NewSessionRequest, RemoveLocalTestPlanRequest, ResumeSessionRequest, RunnerUpdateRequest } from './requestDTOs';
3
- import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, SaveDefaultSettings, Session, SessionConfigurationChangedEvent, SessionConfigurationFailedEvent } from './DTOs';
3
+ import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, SaveDefaultSettings, Session, SessionConfigurationProgressEvent } from './DTOs';
4
4
  import { BaseClient } from './BaseClient';
5
5
  export declare class RunnerClient extends BaseClient {
6
6
  private runnerId;
@@ -44,12 +44,15 @@ export declare class RunnerClient extends BaseClient {
44
44
  /**
45
45
  * Changes the configuration of an existing session, running or stopped. A configuration property that is
46
46
  * undefined keeps the session's current value. Requires Runner v2.9 or later.
47
- * With a `provision`, the session must be idle and the Runner responds once it accepted the request. It then publishes
48
- * SessionConfigurationChanged or SessionConfigurationFailed; subscribe to both before sending the request.
47
+ * With a `provision`, the session must be idle and the Runner responds once it accepted the request. If the provision gives
48
+ * another image than the session has, the Runner installs it and restarts the session (OpenTAP 9.31 or newer on the Runner).
49
+ * The Runner reports what happened with SessionConfigurationProgress events: Started, then Succeeded or Failed, which for a
50
+ * provision can take minutes. Only a request for an unknown session, with an unknown value, or for a busy session gets an
51
+ * error response and no events. Subscribe before sending the request.
49
52
  * @param {ConfigureSessionRequest} configureSessionRequest
50
53
  * @returns {{Promise<void>}}
51
54
  */
52
- configureSession(configureSessionRequest: ConfigureSessionRequest): Promise<void>;
55
+ configureSession(configureSessionRequest: ConfigureSessionRequest, timeout?: number): Promise<void>;
53
56
  /**
54
57
  * Create a OpenTAP package configuration image from a list image inputs consisting of user specified packages and repositories.
55
58
  * @param {Image[]} images List of images
@@ -105,7 +108,7 @@ export declare class RunnerClient extends BaseClient {
105
108
  * @param {NewSessionRequest} sessionRequest
106
109
  * @returns {{Promise<Session>}}
107
110
  */
108
- newSession(sessionRequest?: NewSessionRequest): Promise<Session>;
111
+ newSession(sessionRequest?: NewSessionRequest, timeout?: number): Promise<Session>;
109
112
  /**
110
113
  * Resumes a stopped session as it is. A session that is not stopped is an error; change a session with {@link configureSession}.
111
114
  * @param {ResumeSessionRequest} resumeSessionRequest
@@ -116,7 +119,7 @@ export declare class RunnerClient extends BaseClient {
116
119
  * Start a session
117
120
  * @returns {{Promise<Session>}}
118
121
  */
119
- startSession(): Promise<Session>;
122
+ startSession(timeout?: number): Promise<Session>;
120
123
  /**
121
124
  * Get the session manager image.
122
125
  * @returns {{Promise<Image>}}
@@ -127,7 +130,7 @@ export declare class RunnerClient extends BaseClient {
127
130
  * @param imageId
128
131
  * @returns {{Promise<Session>}}
129
132
  */
130
- startImageSession(image: Image): Promise<Session>;
133
+ startImageSession(image: Image, timeout?: number): Promise<Session>;
131
134
  /**
132
135
  * Update the `Runner` plugin to the given version
133
136
  * @param runnerUpdateRequest
@@ -142,19 +145,13 @@ export declare class RunnerClient extends BaseClient {
142
145
  */
143
146
  connectMetadataUpdatedEvents(handler: (event: MetadataUpdatedEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
144
147
  /**
145
- * Subscribe to the SessionConfigurationChanged event, published after every successful ConfigureSession request
146
- * @param {(event:SessionConfigurationChangedEvent|undefined,err:NatsError|Error|null)=>void} handler
148
+ * Subscribe to the SessionConfigurationProgress event, published as a ConfigureSession request progresses:
149
+ * Started, then Succeeded with the session as it is after the change, or Failed with the reason
150
+ * @param {(event:SessionConfigurationProgressEvent|undefined,err:NatsError|Error|null)=>void} handler
147
151
  * @param {SubscriptionOptions} options?
148
152
  * @returns Subscription
149
153
  */
150
- connectSessionConfigurationChangedEvents(handler: (event: SessionConfigurationChangedEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
151
- /**
152
- * Subscribe to the SessionConfigurationFailed event, published when a ConfigureSession request with a `provision` was accepted but could not be completed
153
- * @param {(event:SessionConfigurationFailedEvent|undefined,err:NatsError|Error|null)=>void} handler
154
- * @param {SubscriptionOptions} options?
155
- * @returns Subscription
156
- */
157
- connectSessionConfigurationFailedEvents(handler: (event: SessionConfigurationFailedEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
154
+ connectSessionConfigurationProgressEvents(handler: (event: SessionConfigurationProgressEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
158
155
  /**
159
156
  * Connect to metrics published for the given SessionMetricInfo from the idle session
160
157
  * @param {ISessionMetricInfo} metricInfo
@@ -197,18 +197,21 @@ var RunnerClient = /** @class */ (function (_super) {
197
197
  /**
198
198
  * Changes the configuration of an existing session, running or stopped. A configuration property that is
199
199
  * undefined keeps the session's current value. Requires Runner v2.9 or later.
200
- * With a `provision`, the session must be idle and the Runner responds once it accepted the request. It then publishes
201
- * SessionConfigurationChanged or SessionConfigurationFailed; subscribe to both before sending the request.
200
+ * With a `provision`, the session must be idle and the Runner responds once it accepted the request. If the provision gives
201
+ * another image than the session has, the Runner installs it and restarts the session (OpenTAP 9.31 or newer on the Runner).
202
+ * The Runner reports what happened with SessionConfigurationProgress events: Started, then Succeeded or Failed, which for a
203
+ * provision can take minutes. Only a request for an unknown session, with an unknown value, or for a busy session gets an
204
+ * error response and no events. Subscribe before sending the request.
202
205
  * @param {ConfigureSessionRequest} configureSessionRequest
203
206
  * @returns {{Promise<void>}}
204
207
  */
205
- RunnerClient.prototype.configureSession = function (configureSessionRequest) {
208
+ RunnerClient.prototype.configureSession = function (configureSessionRequest, timeout) {
206
209
  var sessionId = configureSessionRequest.sessionId, sessionConfiguration = configureSessionRequest.sessionConfiguration;
207
210
  return (sessionId === null || sessionId === void 0 ? void 0 : sessionId.length) > 0
208
211
  ? this.request('ConfigureSession', {
209
212
  SessionId: sessionId,
210
213
  SessionConfiguration: sessionConfiguration ? new DTOs_1.SessionConfiguration(sessionConfiguration) : undefined,
211
- })
214
+ }, { timeout: timeout })
212
215
  .then(this.success())
213
216
  .catch(this.error())
214
217
  : Promise.reject('sessionId is not defined');
@@ -314,8 +317,8 @@ var RunnerClient = /** @class */ (function (_super) {
314
317
  * @param {NewSessionRequest} sessionRequest
315
318
  * @returns {{Promise<Session>}}
316
319
  */
317
- RunnerClient.prototype.newSession = function (sessionRequest) {
318
- return this.request('NewSession', sessionRequest)
320
+ RunnerClient.prototype.newSession = function (sessionRequest, timeout) {
321
+ return this.request('NewSession', sessionRequest, { timeout: timeout })
319
322
  .then(function (response) { return DTOs_1.Session.fromJS(response.Session); })
320
323
  .then(this.success())
321
324
  .catch(this.error());
@@ -338,8 +341,8 @@ var RunnerClient = /** @class */ (function (_super) {
338
341
  * Start a session
339
342
  * @returns {{Promise<Session>}}
340
343
  */
341
- RunnerClient.prototype.startSession = function () {
342
- return this.request('StartSession')
344
+ RunnerClient.prototype.startSession = function (timeout) {
345
+ return this.request('StartSession', undefined, { timeout: timeout })
343
346
  .then(function (sessionJs) { return DTOs_1.Session.fromJS(sessionJs); })
344
347
  .then(this.success())
345
348
  .catch(this.error());
@@ -359,9 +362,9 @@ var RunnerClient = /** @class */ (function (_super) {
359
362
  * @param imageId
360
363
  * @returns {{Promise<Session>}}
361
364
  */
362
- RunnerClient.prototype.startImageSession = function (image) {
365
+ RunnerClient.prototype.startImageSession = function (image, timeout) {
363
366
  return image
364
- ? this.request('StartImageSession', image)
367
+ ? this.request('StartImageSession', image, { timeout: timeout })
365
368
  .then(function (sessionJs) { return DTOs_1.Session.fromJS(sessionJs); })
366
369
  .then(this.success())
367
370
  .catch(this.error())
@@ -399,41 +402,21 @@ var RunnerClient = /** @class */ (function (_super) {
399
402
  } }));
400
403
  };
401
404
  /**
402
- * Subscribe to the SessionConfigurationChanged event, published after every successful ConfigureSession request
403
- * @param {(event:SessionConfigurationChangedEvent|undefined,err:NatsError|Error|null)=>void} handler
405
+ * Subscribe to the SessionConfigurationProgress event, published as a ConfigureSession request progresses:
406
+ * Started, then Succeeded with the session as it is after the change, or Failed with the reason
407
+ * @param {(event:SessionConfigurationProgressEvent|undefined,err:NatsError|Error|null)=>void} handler
404
408
  * @param {SubscriptionOptions} options?
405
409
  * @returns Subscription
406
410
  */
407
- RunnerClient.prototype.connectSessionConfigurationChangedEvents = function (handler, options) {
408
- return this.subscribe('Events.SessionConfigurationChanged', __assign(__assign({}, options), { callback: function (error, encodedMessage) {
411
+ RunnerClient.prototype.connectSessionConfigurationProgressEvents = function (handler, options) {
412
+ return this.subscribe('Events.SessionConfigurationProgress', __assign(__assign({}, options), { callback: function (error, encodedMessage) {
409
413
  if (error) {
410
414
  handler(undefined, error);
411
415
  return;
412
416
  }
413
417
  try {
414
418
  var eventJson = (0, nats_ws_1.JSONCodec)().decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
415
- handler(DTOs_1.SessionConfigurationChangedEvent.fromJS(eventJson), error);
416
- }
417
- catch (error) {
418
- handler(undefined, error);
419
- }
420
- } }));
421
- };
422
- /**
423
- * Subscribe to the SessionConfigurationFailed event, published when a ConfigureSession request with a `provision` was accepted but could not be completed
424
- * @param {(event:SessionConfigurationFailedEvent|undefined,err:NatsError|Error|null)=>void} handler
425
- * @param {SubscriptionOptions} options?
426
- * @returns Subscription
427
- */
428
- RunnerClient.prototype.connectSessionConfigurationFailedEvents = function (handler, options) {
429
- return this.subscribe('Events.SessionConfigurationFailed', __assign(__assign({}, options), { callback: function (error, encodedMessage) {
430
- if (error) {
431
- handler(undefined, error);
432
- return;
433
- }
434
- try {
435
- var eventJson = (0, nats_ws_1.JSONCodec)().decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
436
- handler(DTOs_1.SessionConfigurationFailedEvent.fromJS(eventJson), error);
419
+ handler(DTOs_1.SessionConfigurationProgressEvent.fromJS(eventJson), error);
437
420
  }
438
421
  catch (error) {
439
422
  handler(undefined, error);
@@ -107,6 +107,7 @@ export interface ISession {
107
107
  /**
108
108
  * Where a session's image comes from. The concrete type is named by the `ProvisionType` property on the wire.
109
109
  * Each type replaces one part of the session's image; the other parts stay what the session has.
110
+ * An image that is not the one the session has is installed into the session, which is restarted on it.
110
111
  */
111
112
  export declare abstract class SessionProvision {
112
113
  protected _discriminator: string;
@@ -115,7 +116,10 @@ export declare abstract class SessionProvision {
115
116
  static fromJS(data: any): SessionProvision;
116
117
  toJSON(data?: any): any;
117
118
  }
118
- /** Uses `image` on top of the Runner's default image. The session keeps its test plan and settings. */
119
+ /**
120
+ * Uses `image` on top of the Runner's default image. The session keeps its test plan and settings, but their
121
+ * dependencies are not added to the image.
122
+ */
119
123
  export declare class ExactProvision extends SessionProvision implements IExactProvision {
120
124
  /** Packages that replace the session's packages, combined with the Runner's default image. */
121
125
  image?: Image | undefined;
@@ -163,9 +167,22 @@ export declare class TestPlanReferenceProvision extends SessionProvision impleme
163
167
  export interface ITestPlanReferenceProvision {
164
168
  testPlanReference?: RepositoryPackageReference | undefined;
165
169
  }
170
+ /**
171
+ * Replaces the session's test plan with an empty one. The session has no test plan reference afterwards, and the
172
+ * dependencies of its previous test plan are no longer part of the image.
173
+ */
174
+ export declare class EmptyTestPlanProvision extends SessionProvision implements IEmptyTestPlanProvision {
175
+ constructor(data?: IEmptyTestPlanProvision);
176
+ static fromJS(data: any): EmptyTestPlanProvision;
177
+ }
178
+ export interface IEmptyTestPlanProvision {
179
+ }
166
180
  /** Configuration of an existing session, sent to ConfigureSession. A property that is undefined keeps the session's current value. */
167
181
  export declare class SessionConfiguration implements ISessionConfiguration {
168
- /** The image the session asks for. The session must be idle. */
182
+ /**
183
+ * The image the session asks for. The session must be idle. If it is not the image the session has, the Runner installs it
184
+ * into the session and restarts the session on it before it loads anything. That needs OpenTAP 9.31 or newer on the Runner.
185
+ */
169
186
  provision?: SessionProvision | undefined;
170
187
  /** An empty title removes the title. */
171
188
  title?: string | undefined;
@@ -188,30 +205,56 @@ export interface ISessionConfiguration {
188
205
  [key: string]: string;
189
206
  } | undefined;
190
207
  }
191
- /** Published by the Runner after every successful ConfigureSession request. */
192
- export declare class SessionConfigurationChangedEvent implements ISessionConfigurationChangedEvent {
208
+ /** Published by the Runner as a ConfigureSession request progresses. */
209
+ export declare class SessionConfigurationProgressEvent implements ISessionConfigurationProgressEvent {
210
+ sessionId?: string | undefined;
211
+ progress?: SessionConfigurationProgress | undefined;
212
+ constructor(data?: ISessionConfigurationProgressEvent);
213
+ init(_data?: any): void;
214
+ static fromJS(data: any): SessionConfigurationProgressEvent;
215
+ toJSON(data?: any): any;
216
+ }
217
+ export interface ISessionConfigurationProgressEvent {
218
+ sessionId?: string | undefined;
219
+ progress?: SessionConfigurationProgress | undefined;
220
+ }
221
+ /** What happened to a ConfigureSession request. The concrete type is named by the `ProgressType` property on the wire. */
222
+ export declare abstract class SessionConfigurationProgress {
223
+ protected _discriminator: string;
224
+ constructor();
225
+ init(_data?: any): void;
226
+ static fromJS(data: any): SessionConfigurationProgress;
227
+ toJSON(data?: any): any;
228
+ }
229
+ /** The Runner accepted the request and is applying it. */
230
+ export declare class SessionConfigurationStarted extends SessionConfigurationProgress implements ISessionConfigurationStarted {
231
+ constructor(data?: ISessionConfigurationStarted);
232
+ static fromJS(data: any): SessionConfigurationStarted;
233
+ }
234
+ export interface ISessionConfigurationStarted {
235
+ }
236
+ /** The session is configured. */
237
+ export declare class SessionConfigurationSucceeded extends SessionConfigurationProgress implements ISessionConfigurationSucceeded {
193
238
  /** The session after the change, as GetSessions reports it. */
194
239
  session?: Session | undefined;
195
- constructor(data?: ISessionConfigurationChangedEvent);
240
+ constructor(data?: ISessionConfigurationSucceeded);
196
241
  init(_data?: any): void;
197
- static fromJS(data: any): SessionConfigurationChangedEvent;
242
+ static fromJS(data: any): SessionConfigurationSucceeded;
198
243
  toJSON(data?: any): any;
199
244
  }
200
- export interface ISessionConfigurationChangedEvent {
245
+ export interface ISessionConfigurationSucceeded {
201
246
  session?: Session | undefined;
202
247
  }
203
- /** Published by the Runner when it accepted a ConfigureSession request with a `provision`, and could not complete it. */
204
- export declare class SessionConfigurationFailedEvent implements ISessionConfigurationFailedEvent {
205
- sessionId?: string | undefined;
248
+ /** The Runner accepted the request, and could not complete it. */
249
+ export declare class SessionConfigurationFailed extends SessionConfigurationProgress implements ISessionConfigurationFailed {
206
250
  /** Why the configuration failed. For people to read; do not parse it. */
207
251
  message?: string | undefined;
208
- constructor(data?: ISessionConfigurationFailedEvent);
252
+ constructor(data?: ISessionConfigurationFailed);
209
253
  init(_data?: any): void;
210
- static fromJS(data: any): SessionConfigurationFailedEvent;
254
+ static fromJS(data: any): SessionConfigurationFailed;
211
255
  toJSON(data?: any): any;
212
256
  }
213
- export interface ISessionConfigurationFailedEvent {
214
- sessionId?: string | undefined;
257
+ export interface ISessionConfigurationFailed {
215
258
  message?: string | undefined;
216
259
  }
217
260
  export declare class Links implements ILinks {
package/dist/mjs/DTOs.js CHANGED
@@ -214,6 +214,7 @@ export class Session {
214
214
  /**
215
215
  * Where a session's image comes from. The concrete type is named by the `ProvisionType` property on the wire.
216
216
  * Each type replaces one part of the session's image; the other parts stay what the session has.
217
+ * An image that is not the one the session has is installed into the session, which is restarted on it.
217
218
  */
218
219
  export class SessionProvision {
219
220
  constructor() {
@@ -243,6 +244,11 @@ export class SessionProvision {
243
244
  result.init(data);
244
245
  return result;
245
246
  }
247
+ if (data['ProvisionType'] === 'EmptyTestPlanProvision') {
248
+ const result = new EmptyTestPlanProvision();
249
+ result.init(data);
250
+ return result;
251
+ }
246
252
  throw new Error("The abstract class 'SessionProvision' cannot be instantiated.");
247
253
  }
248
254
  toJSON(data) {
@@ -251,7 +257,10 @@ export class SessionProvision {
251
257
  return data;
252
258
  }
253
259
  }
254
- /** Uses `image` on top of the Runner's default image. The session keeps its test plan and settings. */
260
+ /**
261
+ * Uses `image` on top of the Runner's default image. The session keeps its test plan and settings, but their
262
+ * dependencies are not added to the image.
263
+ */
255
264
  export class ExactProvision extends SessionProvision {
256
265
  constructor(data) {
257
266
  super();
@@ -388,6 +397,28 @@ export class TestPlanReferenceProvision extends SessionProvision {
388
397
  return data;
389
398
  }
390
399
  }
400
+ /**
401
+ * Replaces the session's test plan with an empty one. The session has no test plan reference afterwards, and the
402
+ * dependencies of its previous test plan are no longer part of the image.
403
+ */
404
+ export class EmptyTestPlanProvision extends SessionProvision {
405
+ constructor(data) {
406
+ super();
407
+ if (data) {
408
+ for (const property in data) {
409
+ if (Object.prototype.hasOwnProperty.call(data, property))
410
+ this[property] = data[property];
411
+ }
412
+ }
413
+ this._discriminator = 'EmptyTestPlanProvision';
414
+ }
415
+ static fromJS(data) {
416
+ data = typeof data === 'object' ? data : {};
417
+ const result = new EmptyTestPlanProvision();
418
+ result.init(data);
419
+ return result;
420
+ }
421
+ }
391
422
  /** Configuration of an existing session, sent to ConfigureSession. A property that is undefined keeps the session's current value. */
392
423
  export class SessionConfiguration {
393
424
  constructor(data) {
@@ -421,58 +452,144 @@ export class SessionConfiguration {
421
452
  return data;
422
453
  }
423
454
  }
424
- /** Published by the Runner after every successful ConfigureSession request. */
425
- export class SessionConfigurationChangedEvent {
455
+ /** Published by the Runner as a ConfigureSession request progresses. */
456
+ export class SessionConfigurationProgressEvent {
457
+ constructor(data) {
458
+ if (data) {
459
+ for (const property in data) {
460
+ if (Object.prototype.hasOwnProperty.call(data, property))
461
+ this[property] = data[property];
462
+ }
463
+ }
464
+ }
465
+ init(_data) {
466
+ if (_data) {
467
+ this.sessionId = _data['SessionId'];
468
+ this.progress = _data['Progress'] ? SessionConfigurationProgress.fromJS(_data['Progress']) : undefined;
469
+ }
470
+ }
471
+ static fromJS(data) {
472
+ data = typeof data === 'object' ? data : {};
473
+ const result = new SessionConfigurationProgressEvent();
474
+ result.init(data);
475
+ return result;
476
+ }
477
+ toJSON(data) {
478
+ data = typeof data === 'object' ? data : {};
479
+ data['SessionId'] = this.sessionId;
480
+ data['Progress'] = this.progress ? this.progress.toJSON() : undefined;
481
+ return data;
482
+ }
483
+ }
484
+ /** What happened to a ConfigureSession request. The concrete type is named by the `ProgressType` property on the wire. */
485
+ export class SessionConfigurationProgress {
486
+ constructor() {
487
+ this._discriminator = 'SessionConfigurationProgress';
488
+ }
489
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
490
+ init(_data) { }
491
+ static fromJS(data) {
492
+ data = typeof data === 'object' ? data : {};
493
+ if (data['ProgressType'] === 'Started') {
494
+ const result = new SessionConfigurationStarted();
495
+ result.init(data);
496
+ return result;
497
+ }
498
+ if (data['ProgressType'] === 'Succeeded') {
499
+ const result = new SessionConfigurationSucceeded();
500
+ result.init(data);
501
+ return result;
502
+ }
503
+ if (data['ProgressType'] === 'Failed') {
504
+ const result = new SessionConfigurationFailed();
505
+ result.init(data);
506
+ return result;
507
+ }
508
+ throw new Error("The abstract class 'SessionConfigurationProgress' cannot be instantiated.");
509
+ }
510
+ toJSON(data) {
511
+ data = typeof data === 'object' ? data : {};
512
+ data['ProgressType'] = this._discriminator;
513
+ return data;
514
+ }
515
+ }
516
+ /** The Runner accepted the request and is applying it. */
517
+ export class SessionConfigurationStarted extends SessionConfigurationProgress {
426
518
  constructor(data) {
519
+ super();
427
520
  if (data) {
428
521
  for (const property in data) {
429
522
  if (Object.prototype.hasOwnProperty.call(data, property))
430
523
  this[property] = data[property];
431
524
  }
432
525
  }
526
+ this._discriminator = 'Started';
527
+ }
528
+ static fromJS(data) {
529
+ data = typeof data === 'object' ? data : {};
530
+ const result = new SessionConfigurationStarted();
531
+ result.init(data);
532
+ return result;
533
+ }
534
+ }
535
+ /** The session is configured. */
536
+ export class SessionConfigurationSucceeded extends SessionConfigurationProgress {
537
+ constructor(data) {
538
+ super();
539
+ if (data) {
540
+ for (const property in data) {
541
+ if (Object.prototype.hasOwnProperty.call(data, property))
542
+ this[property] = data[property];
543
+ }
544
+ }
545
+ this._discriminator = 'Succeeded';
433
546
  }
434
547
  init(_data) {
548
+ super.init(_data);
435
549
  if (_data) {
436
550
  this.session = _data['Session'] ? Session.fromJS(_data['Session']) : undefined;
437
551
  }
438
552
  }
439
553
  static fromJS(data) {
440
554
  data = typeof data === 'object' ? data : {};
441
- const result = new SessionConfigurationChangedEvent();
555
+ const result = new SessionConfigurationSucceeded();
442
556
  result.init(data);
443
557
  return result;
444
558
  }
445
559
  toJSON(data) {
446
560
  data = typeof data === 'object' ? data : {};
561
+ super.toJSON(data);
447
562
  data['Session'] = this.session ? this.session.toJSON() : undefined;
448
563
  return data;
449
564
  }
450
565
  }
451
- /** Published by the Runner when it accepted a ConfigureSession request with a `provision`, and could not complete it. */
452
- export class SessionConfigurationFailedEvent {
566
+ /** The Runner accepted the request, and could not complete it. */
567
+ export class SessionConfigurationFailed extends SessionConfigurationProgress {
453
568
  constructor(data) {
569
+ super();
454
570
  if (data) {
455
571
  for (const property in data) {
456
572
  if (Object.prototype.hasOwnProperty.call(data, property))
457
573
  this[property] = data[property];
458
574
  }
459
575
  }
576
+ this._discriminator = 'Failed';
460
577
  }
461
578
  init(_data) {
579
+ super.init(_data);
462
580
  if (_data) {
463
- this.sessionId = _data['SessionId'];
464
581
  this.message = _data['Message'];
465
582
  }
466
583
  }
467
584
  static fromJS(data) {
468
585
  data = typeof data === 'object' ? data : {};
469
- const result = new SessionConfigurationFailedEvent();
586
+ const result = new SessionConfigurationFailed();
470
587
  result.init(data);
471
588
  return result;
472
589
  }
473
590
  toJSON(data) {
474
591
  data = typeof data === 'object' ? data : {};
475
- data['SessionId'] = this.sessionId;
592
+ super.toJSON(data);
476
593
  data['Message'] = this.message;
477
594
  return data;
478
595
  }
@@ -1,6 +1,6 @@
1
1
  import { ConnectionOptions, Consumer, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
2
2
  import { AddLocalTestPlanRequest, ConfigureSessionRequest, DeleteSessionRequest, NewSessionRequest, RemoveLocalTestPlanRequest, ResumeSessionRequest, RunnerUpdateRequest } from './requestDTOs';
3
- import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, SaveDefaultSettings, Session, SessionConfigurationChangedEvent, SessionConfigurationFailedEvent } from './DTOs';
3
+ import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, SaveDefaultSettings, Session, SessionConfigurationProgressEvent } from './DTOs';
4
4
  import { BaseClient } from './BaseClient';
5
5
  export declare class RunnerClient extends BaseClient {
6
6
  private runnerId;
@@ -44,12 +44,15 @@ export declare class RunnerClient extends BaseClient {
44
44
  /**
45
45
  * Changes the configuration of an existing session, running or stopped. A configuration property that is
46
46
  * undefined keeps the session's current value. Requires Runner v2.9 or later.
47
- * With a `provision`, the session must be idle and the Runner responds once it accepted the request. It then publishes
48
- * SessionConfigurationChanged or SessionConfigurationFailed; subscribe to both before sending the request.
47
+ * With a `provision`, the session must be idle and the Runner responds once it accepted the request. If the provision gives
48
+ * another image than the session has, the Runner installs it and restarts the session (OpenTAP 9.31 or newer on the Runner).
49
+ * The Runner reports what happened with SessionConfigurationProgress events: Started, then Succeeded or Failed, which for a
50
+ * provision can take minutes. Only a request for an unknown session, with an unknown value, or for a busy session gets an
51
+ * error response and no events. Subscribe before sending the request.
49
52
  * @param {ConfigureSessionRequest} configureSessionRequest
50
53
  * @returns {{Promise<void>}}
51
54
  */
52
- configureSession(configureSessionRequest: ConfigureSessionRequest): Promise<void>;
55
+ configureSession(configureSessionRequest: ConfigureSessionRequest, timeout?: number): Promise<void>;
53
56
  /**
54
57
  * Create a OpenTAP package configuration image from a list image inputs consisting of user specified packages and repositories.
55
58
  * @param {Image[]} images List of images
@@ -105,7 +108,7 @@ export declare class RunnerClient extends BaseClient {
105
108
  * @param {NewSessionRequest} sessionRequest
106
109
  * @returns {{Promise<Session>}}
107
110
  */
108
- newSession(sessionRequest?: NewSessionRequest): Promise<Session>;
111
+ newSession(sessionRequest?: NewSessionRequest, timeout?: number): Promise<Session>;
109
112
  /**
110
113
  * Resumes a stopped session as it is. A session that is not stopped is an error; change a session with {@link configureSession}.
111
114
  * @param {ResumeSessionRequest} resumeSessionRequest
@@ -116,7 +119,7 @@ export declare class RunnerClient extends BaseClient {
116
119
  * Start a session
117
120
  * @returns {{Promise<Session>}}
118
121
  */
119
- startSession(): Promise<Session>;
122
+ startSession(timeout?: number): Promise<Session>;
120
123
  /**
121
124
  * Get the session manager image.
122
125
  * @returns {{Promise<Image>}}
@@ -127,7 +130,7 @@ export declare class RunnerClient extends BaseClient {
127
130
  * @param imageId
128
131
  * @returns {{Promise<Session>}}
129
132
  */
130
- startImageSession(image: Image): Promise<Session>;
133
+ startImageSession(image: Image, timeout?: number): Promise<Session>;
131
134
  /**
132
135
  * Update the `Runner` plugin to the given version
133
136
  * @param runnerUpdateRequest
@@ -142,19 +145,13 @@ export declare class RunnerClient extends BaseClient {
142
145
  */
143
146
  connectMetadataUpdatedEvents(handler: (event: MetadataUpdatedEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
144
147
  /**
145
- * Subscribe to the SessionConfigurationChanged event, published after every successful ConfigureSession request
146
- * @param {(event:SessionConfigurationChangedEvent|undefined,err:NatsError|Error|null)=>void} handler
148
+ * Subscribe to the SessionConfigurationProgress event, published as a ConfigureSession request progresses:
149
+ * Started, then Succeeded with the session as it is after the change, or Failed with the reason
150
+ * @param {(event:SessionConfigurationProgressEvent|undefined,err:NatsError|Error|null)=>void} handler
147
151
  * @param {SubscriptionOptions} options?
148
152
  * @returns Subscription
149
153
  */
150
- connectSessionConfigurationChangedEvents(handler: (event: SessionConfigurationChangedEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
151
- /**
152
- * Subscribe to the SessionConfigurationFailed event, published when a ConfigureSession request with a `provision` was accepted but could not be completed
153
- * @param {(event:SessionConfigurationFailedEvent|undefined,err:NatsError|Error|null)=>void} handler
154
- * @param {SubscriptionOptions} options?
155
- * @returns Subscription
156
- */
157
- connectSessionConfigurationFailedEvents(handler: (event: SessionConfigurationFailedEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
154
+ connectSessionConfigurationProgressEvents(handler: (event: SessionConfigurationProgressEvent | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
158
155
  /**
159
156
  * Connect to metrics published for the given SessionMetricInfo from the idle session
160
157
  * @param {ISessionMetricInfo} metricInfo
@@ -15,7 +15,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
15
15
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
16
16
  };
17
17
  import { JSONCodec, nanos } from 'nats.ws';
18
- import { GetLocalTestPlansResponse, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, Session, SessionConfiguration, SessionConfigurationChangedEvent, SessionConfigurationFailedEvent, } from './DTOs';
18
+ import { GetLocalTestPlansResponse, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, Session, SessionConfiguration, SessionConfigurationProgressEvent, } from './DTOs';
19
19
  import { BaseClient } from './BaseClient';
20
20
  import { getSubjectParts } from './utils';
21
21
  export class RunnerClient extends BaseClient {
@@ -137,18 +137,21 @@ export class RunnerClient extends BaseClient {
137
137
  /**
138
138
  * Changes the configuration of an existing session, running or stopped. A configuration property that is
139
139
  * undefined keeps the session's current value. Requires Runner v2.9 or later.
140
- * With a `provision`, the session must be idle and the Runner responds once it accepted the request. It then publishes
141
- * SessionConfigurationChanged or SessionConfigurationFailed; subscribe to both before sending the request.
140
+ * With a `provision`, the session must be idle and the Runner responds once it accepted the request. If the provision gives
141
+ * another image than the session has, the Runner installs it and restarts the session (OpenTAP 9.31 or newer on the Runner).
142
+ * The Runner reports what happened with SessionConfigurationProgress events: Started, then Succeeded or Failed, which for a
143
+ * provision can take minutes. Only a request for an unknown session, with an unknown value, or for a busy session gets an
144
+ * error response and no events. Subscribe before sending the request.
142
145
  * @param {ConfigureSessionRequest} configureSessionRequest
143
146
  * @returns {{Promise<void>}}
144
147
  */
145
- configureSession(configureSessionRequest) {
148
+ configureSession(configureSessionRequest, timeout) {
146
149
  const { sessionId, sessionConfiguration } = configureSessionRequest;
147
150
  return (sessionId === null || sessionId === void 0 ? void 0 : sessionId.length) > 0
148
151
  ? this.request('ConfigureSession', {
149
152
  SessionId: sessionId,
150
153
  SessionConfiguration: sessionConfiguration ? new SessionConfiguration(sessionConfiguration) : undefined,
151
- })
154
+ }, { timeout })
152
155
  .then(this.success())
153
156
  .catch(this.error())
154
157
  : Promise.reject('sessionId is not defined');
@@ -175,7 +178,7 @@ export class RunnerClient extends BaseClient {
175
178
  */
176
179
  resolveImageDryRun(images, timeout) {
177
180
  return (images === null || images === void 0 ? void 0 : images.length) > 0
178
- ? this.request('ResolveImageDryRun', images, { timeout: timeout })
181
+ ? this.request('ResolveImageDryRun', images, { timeout })
179
182
  .then(imageJs => Image.fromJS(imageJs))
180
183
  .then(this.success())
181
184
  .catch(this.error())
@@ -253,8 +256,8 @@ export class RunnerClient extends BaseClient {
253
256
  * @param {NewSessionRequest} sessionRequest
254
257
  * @returns {{Promise<Session>}}
255
258
  */
256
- newSession(sessionRequest) {
257
- return this.request('NewSession', sessionRequest)
259
+ newSession(sessionRequest, timeout) {
260
+ return this.request('NewSession', sessionRequest, { timeout })
258
261
  .then(response => Session.fromJS(response.Session))
259
262
  .then(this.success())
260
263
  .catch(this.error());
@@ -277,8 +280,8 @@ export class RunnerClient extends BaseClient {
277
280
  * Start a session
278
281
  * @returns {{Promise<Session>}}
279
282
  */
280
- startSession() {
281
- return this.request('StartSession')
283
+ startSession(timeout) {
284
+ return this.request('StartSession', undefined, { timeout })
282
285
  .then(sessionJs => Session.fromJS(sessionJs))
283
286
  .then(this.success())
284
287
  .catch(this.error());
@@ -298,9 +301,9 @@ export class RunnerClient extends BaseClient {
298
301
  * @param imageId
299
302
  * @returns {{Promise<Session>}}
300
303
  */
301
- startImageSession(image) {
304
+ startImageSession(image, timeout) {
302
305
  return image
303
- ? this.request('StartImageSession', image)
306
+ ? this.request('StartImageSession', image, { timeout })
304
307
  .then(sessionJs => Session.fromJS(sessionJs))
305
308
  .then(this.success())
306
309
  .catch(this.error())
@@ -338,41 +341,21 @@ export class RunnerClient extends BaseClient {
338
341
  } }));
339
342
  }
340
343
  /**
341
- * Subscribe to the SessionConfigurationChanged event, published after every successful ConfigureSession request
342
- * @param {(event:SessionConfigurationChangedEvent|undefined,err:NatsError|Error|null)=>void} handler
344
+ * Subscribe to the SessionConfigurationProgress event, published as a ConfigureSession request progresses:
345
+ * Started, then Succeeded with the session as it is after the change, or Failed with the reason
346
+ * @param {(event:SessionConfigurationProgressEvent|undefined,err:NatsError|Error|null)=>void} handler
343
347
  * @param {SubscriptionOptions} options?
344
348
  * @returns Subscription
345
349
  */
346
- connectSessionConfigurationChangedEvents(handler, options) {
347
- return this.subscribe('Events.SessionConfigurationChanged', Object.assign(Object.assign({}, options), { callback(error, encodedMessage) {
350
+ connectSessionConfigurationProgressEvents(handler, options) {
351
+ return this.subscribe('Events.SessionConfigurationProgress', Object.assign(Object.assign({}, options), { callback(error, encodedMessage) {
348
352
  if (error) {
349
353
  handler(undefined, error);
350
354
  return;
351
355
  }
352
356
  try {
353
357
  const eventJson = JSONCodec().decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
354
- handler(SessionConfigurationChangedEvent.fromJS(eventJson), error);
355
- }
356
- catch (error) {
357
- handler(undefined, error);
358
- }
359
- } }));
360
- }
361
- /**
362
- * Subscribe to the SessionConfigurationFailed event, published when a ConfigureSession request with a `provision` was accepted but could not be completed
363
- * @param {(event:SessionConfigurationFailedEvent|undefined,err:NatsError|Error|null)=>void} handler
364
- * @param {SubscriptionOptions} options?
365
- * @returns Subscription
366
- */
367
- connectSessionConfigurationFailedEvents(handler, options) {
368
- return this.subscribe('Events.SessionConfigurationFailed', Object.assign(Object.assign({}, options), { callback(error, encodedMessage) {
369
- if (error) {
370
- handler(undefined, error);
371
- return;
372
- }
373
- try {
374
- const eventJson = JSONCodec().decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data);
375
- handler(SessionConfigurationFailedEvent.fromJS(eventJson), error);
358
+ handler(SessionConfigurationProgressEvent.fromJS(eventJson), error);
376
359
  }
377
360
  catch (error) {
378
361
  handler(undefined, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "4.9.0-beta.1.40294477159",
3
+ "version": "4.9.0-beta.3.41598982309",
4
4
  "description": "This is the web client for the OpenTAP Runner.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/mjs/index.js",