@opentap/runner-client 2.33.0 → 2.34.0-alpha.1.1.15962948309

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.
@@ -1518,3 +1518,64 @@ export declare class AssetUpdatedEvent extends RunnerEvent implements IAssetUpda
1518
1518
  static fromJS(data: any): AssetUpdatedEvent;
1519
1519
  toJSON(data?: any): any;
1520
1520
  }
1521
+ export interface ISaveDefaultSettings {
1522
+ sessionId: string;
1523
+ repository: string;
1524
+ }
1525
+ export declare class SaveDefaultSettings implements ISaveDefaultSettings {
1526
+ sessionId: string;
1527
+ repository: string;
1528
+ constructor(data: ISaveDefaultSettings);
1529
+ static fromJS(data: any): SaveDefaultSettings;
1530
+ toJSON(data?: any): any;
1531
+ }
1532
+ export interface IRemoteConnection {
1533
+ endPoint: string;
1534
+ connected: boolean;
1535
+ rtt: string;
1536
+ }
1537
+ export declare class RemoteConnection implements IRemoteConnection {
1538
+ endPoint: string;
1539
+ connected: boolean;
1540
+ rtt: string;
1541
+ constructor(data?: IRemoteConnection);
1542
+ init(data?: any): void;
1543
+ static fromJS(data?: any): RemoteConnection;
1544
+ toJSON(data?: any): any;
1545
+ }
1546
+ export interface IStreamInfoStatus {
1547
+ runsMaxBytes: number;
1548
+ runsUsage: number;
1549
+ diskFree: number;
1550
+ }
1551
+ export declare class StreamInfoStatus implements IStreamInfoStatus {
1552
+ runsMaxBytes: number;
1553
+ runsUsage: number;
1554
+ diskFree: number;
1555
+ constructor(data?: IStreamInfoStatus);
1556
+ init(data?: any): void;
1557
+ static fromJS(data?: any): StreamInfoStatus;
1558
+ toJSON(data?: any): any;
1559
+ }
1560
+ export interface IRunnerStatus {
1561
+ version: string;
1562
+ runningAsService: boolean;
1563
+ runningInContainer: boolean;
1564
+ remoteConnection?: RemoteConnection;
1565
+ streamInfo?: StreamInfoStatus;
1566
+ ipAddress: string;
1567
+ hostame: string;
1568
+ }
1569
+ export declare class RunnerStatus implements IRunnerStatus {
1570
+ version: string;
1571
+ runningAsService: boolean;
1572
+ runningInContainer: boolean;
1573
+ remoteConnection?: RemoteConnection;
1574
+ streamInfo?: StreamInfoStatus;
1575
+ ipAddress: string;
1576
+ hostame: string;
1577
+ constructor(data?: IRunnerStatus);
1578
+ init(data?: any): void;
1579
+ static fromJS(data?: any): RunnerStatus;
1580
+ toJSON(data?: any): any;
1581
+ }
package/dist/cjs/DTOs.js CHANGED
@@ -17,7 +17,7 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.SessionStartInitiated = exports.SessionEventArgs = exports.SettingsTapPackage = exports.RepositorySettingsPackageDefinition = exports.RepositoryPackageDefinition = exports.RepositoryPackageReference = exports.ProfileGroup = exports.ListItemType = exports.ComponentSettings = 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.Session = exports.ImageResolveErrorResponse = exports.NoResponderError = exports.ErrorResponse = exports.PackageSpecifier = exports.Image = void 0;
19
19
  exports.TestPlanExecutionStateChangedEventArgs = exports.TestPlanChangeEventArgs = exports.StoppedEventArgs = exports.StoppingEventArgs = exports.StartedEventArgs = exports.StartingEventArgs = exports.SessionTimeoutEventArgs = exports.SessionEventType = exports.SessionEvent = exports.MetricValue = exports.MetricsConfiguration = exports.SessionMetricInfo = exports.MetricsPollRate = exports.SessionMetricType = exports.SessionMetricKind = exports.ResultColumn = exports.Result = exports.LogEvent = exports.TestStepRun = exports.TestRun = 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.ExecutionState = exports.Verdict = 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 = void 0;
20
- exports.AssetUpdatedEvent = exports.MetadataUpdatedEvent = exports.RunnerDeletedEvent = exports.RunnerUpdatedEvent = exports.RunnerRegisteredEvent = exports.RunnerEvent = exports.TestPlanRunCompletedEventArgs = exports.TestPlanRunStartEventArgs = exports.TestPlanRunEvent = exports.TestStepRunCompletedEventArgs = exports.TestStepRunStartEventArgs = exports.TestStepRunEvent = exports.OnTestStepRun = exports.OnTestPlanRun = exports.MetricsConfigurationChangedEventArgs = exports.HeartbeatEventArgs = exports.TestPlanSettingsChangedEventArgs = exports.UserInputRequestCompletedEventArgs = exports.UserInputRequestEventArgs = exports.BreakEventArgs = exports.TestStepChangeEventArgs = exports.SettingsChangedEventArgs = void 0;
20
+ exports.RunnerStatus = exports.StreamInfoStatus = exports.RemoteConnection = exports.SaveDefaultSettings = exports.AssetUpdatedEvent = exports.MetadataUpdatedEvent = exports.RunnerDeletedEvent = exports.RunnerUpdatedEvent = exports.RunnerRegisteredEvent = exports.RunnerEvent = exports.TestPlanRunCompletedEventArgs = exports.TestPlanRunStartEventArgs = exports.TestPlanRunEvent = exports.TestStepRunCompletedEventArgs = exports.TestStepRunStartEventArgs = exports.TestStepRunEvent = exports.OnTestStepRun = exports.OnTestPlanRun = exports.MetricsConfigurationChangedEventArgs = exports.HeartbeatEventArgs = exports.TestPlanSettingsChangedEventArgs = exports.UserInputRequestCompletedEventArgs = exports.UserInputRequestEventArgs = exports.BreakEventArgs = exports.TestStepChangeEventArgs = exports.SettingsChangedEventArgs = void 0;
21
21
  var Image = /** @class */ (function () {
22
22
  function Image(data) {
23
23
  this.packages = [];
@@ -4237,3 +4237,142 @@ var AssetUpdatedEvent = /** @class */ (function (_super) {
4237
4237
  return AssetUpdatedEvent;
4238
4238
  }(RunnerEvent));
4239
4239
  exports.AssetUpdatedEvent = AssetUpdatedEvent;
4240
+ var SaveDefaultSettings = /** @class */ (function () {
4241
+ function SaveDefaultSettings(data) {
4242
+ this.sessionId = data.sessionId;
4243
+ this.repository = data.repository;
4244
+ }
4245
+ SaveDefaultSettings.fromJS = function (data) {
4246
+ data = typeof data === 'object' ? data : {};
4247
+ var result = new SaveDefaultSettings({
4248
+ sessionId: data['SessionId'],
4249
+ repository: data['Repository'],
4250
+ });
4251
+ return result;
4252
+ };
4253
+ SaveDefaultSettings.prototype.toJSON = function (data) {
4254
+ data = typeof data === 'object' ? data : {};
4255
+ data['SessionId'] = this.sessionId;
4256
+ data['Repository'] = this.repository;
4257
+ return data;
4258
+ };
4259
+ return SaveDefaultSettings;
4260
+ }());
4261
+ exports.SaveDefaultSettings = SaveDefaultSettings;
4262
+ var RemoteConnection = /** @class */ (function () {
4263
+ function RemoteConnection(data) {
4264
+ this.endPoint = '';
4265
+ this.connected = false;
4266
+ this.rtt = '';
4267
+ if (data) {
4268
+ for (var property in data) {
4269
+ if (Object.prototype.hasOwnProperty.call(data, property))
4270
+ this[property] = data[property];
4271
+ }
4272
+ }
4273
+ }
4274
+ RemoteConnection.prototype.init = function (data) {
4275
+ var _a, _b, _c;
4276
+ if (data) {
4277
+ this.endPoint = (_a = data['EndPoint']) !== null && _a !== void 0 ? _a : '';
4278
+ this.connected = (_b = data['Connected']) !== null && _b !== void 0 ? _b : false;
4279
+ this.rtt = (_c = data['Rtt']) !== null && _c !== void 0 ? _c : '';
4280
+ }
4281
+ };
4282
+ RemoteConnection.fromJS = function (data) {
4283
+ data = typeof data === 'object' ? data : {};
4284
+ var result = new RemoteConnection();
4285
+ result.init(data);
4286
+ return result;
4287
+ };
4288
+ RemoteConnection.prototype.toJSON = function (data) {
4289
+ data = typeof data === 'object' ? data : {};
4290
+ data['EndPoint'] = this.endPoint;
4291
+ data['Connected'] = this.connected;
4292
+ data['Rtt'] = this.rtt;
4293
+ return data;
4294
+ };
4295
+ return RemoteConnection;
4296
+ }());
4297
+ exports.RemoteConnection = RemoteConnection;
4298
+ var StreamInfoStatus = /** @class */ (function () {
4299
+ function StreamInfoStatus(data) {
4300
+ this.runsMaxBytes = 0;
4301
+ this.runsUsage = 0;
4302
+ this.diskFree = 0;
4303
+ if (data) {
4304
+ for (var property in data) {
4305
+ if (Object.prototype.hasOwnProperty.call(data, property))
4306
+ this[property] = data[property];
4307
+ }
4308
+ }
4309
+ }
4310
+ StreamInfoStatus.prototype.init = function (data) {
4311
+ var _a, _b, _c;
4312
+ if (data) {
4313
+ this.runsMaxBytes = (_a = data['RunsMaxBytes']) !== null && _a !== void 0 ? _a : 0;
4314
+ this.runsUsage = (_b = data['RunsUsage']) !== null && _b !== void 0 ? _b : 0;
4315
+ this.diskFree = (_c = data['DiskFree']) !== null && _c !== void 0 ? _c : 0;
4316
+ }
4317
+ };
4318
+ StreamInfoStatus.fromJS = function (data) {
4319
+ data = typeof data === 'object' ? data : {};
4320
+ var result = new StreamInfoStatus();
4321
+ result.init(data);
4322
+ return result;
4323
+ };
4324
+ StreamInfoStatus.prototype.toJSON = function (data) {
4325
+ data = typeof data === 'object' ? data : {};
4326
+ data['RunsMaxBytes'] = this.runsMaxBytes;
4327
+ data['RunsUsage'] = this.runsUsage;
4328
+ data['DiskFree'] = this.diskFree;
4329
+ return data;
4330
+ };
4331
+ return StreamInfoStatus;
4332
+ }());
4333
+ exports.StreamInfoStatus = StreamInfoStatus;
4334
+ var RunnerStatus = /** @class */ (function () {
4335
+ function RunnerStatus(data) {
4336
+ this.version = '';
4337
+ this.runningAsService = false;
4338
+ this.runningInContainer = false;
4339
+ this.ipAddress = '';
4340
+ this.hostame = '';
4341
+ if (data) {
4342
+ for (var property in data) {
4343
+ if (Object.prototype.hasOwnProperty.call(data, property))
4344
+ this[property] = data[property];
4345
+ }
4346
+ }
4347
+ }
4348
+ RunnerStatus.prototype.init = function (data) {
4349
+ var _a, _b, _c, _d, _e;
4350
+ if (data) {
4351
+ this.version = (_a = data['Version']) !== null && _a !== void 0 ? _a : '';
4352
+ this.runningAsService = (_b = data['RunningAsService']) !== null && _b !== void 0 ? _b : false;
4353
+ this.runningInContainer = (_c = data['RunningInContainer']) !== null && _c !== void 0 ? _c : false;
4354
+ this.remoteConnection = data['RemoteConnection'] ? RemoteConnection.fromJS(data['RemoteConnection']) : undefined;
4355
+ this.streamInfo = data['StreamInfo'] ? StreamInfoStatus.fromJS(data['StreamInfo']) : undefined;
4356
+ this.ipAddress = (_d = data['IpAddress']) !== null && _d !== void 0 ? _d : '';
4357
+ this.hostame = (_e = data['Hostname']) !== null && _e !== void 0 ? _e : '';
4358
+ }
4359
+ };
4360
+ RunnerStatus.fromJS = function (data) {
4361
+ data = typeof data === 'object' ? data : {};
4362
+ var result = new RunnerStatus();
4363
+ result.init(data);
4364
+ return result;
4365
+ };
4366
+ RunnerStatus.prototype.toJSON = function (data) {
4367
+ data = typeof data === 'object' ? data : {};
4368
+ data['Version'] = this.version;
4369
+ data['RunningAsService'] = this.runningAsService;
4370
+ data['RunningInContainer'] = this.runningInContainer;
4371
+ data['RemoteConnection'] = this.remoteConnection ? this.remoteConnection.toJSON() : undefined;
4372
+ data['StreamInfo'] = this.streamInfo ? this.streamInfo.toJSON() : undefined;
4373
+ data['IpAddress'] = this.ipAddress;
4374
+ data['Hostname'] = this.hostame;
4375
+ };
4376
+ return RunnerStatus;
4377
+ }());
4378
+ exports.RunnerStatus = RunnerStatus;
@@ -1,6 +1,6 @@
1
1
  import { ConnectionOptions, Consumer, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
2
2
  import { RunnerUpdateRequest } from './requestDTOs';
3
- import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, Session } from './DTOs';
3
+ import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, SaveDefaultSettings, Session } from './DTOs';
4
4
  import { BaseClient } from './BaseClient';
5
5
  export declare class RunnerClient extends BaseClient {
6
6
  private runnerId;
@@ -10,7 +10,7 @@ export declare class RunnerClient extends BaseClient {
10
10
  getImage: () => Promise<Image>;
11
11
  setImage: (image: Image) => Promise<Image>;
12
12
  getSettings: () => Promise<RepositoryPackageReference | undefined>;
13
- setSettings: (repositoryPackageReference: RepositoryPackageReference) => Promise<void>;
13
+ saveDefaultSettings: (defaultSettings: SaveDefaultSettings) => Promise<void>;
14
14
  };
15
15
  constructor(baseSubject: string, options: ConnectionOptions);
16
16
  /**
@@ -96,4 +96,9 @@ export declare class RunnerClient extends BaseClient {
96
96
  encodedMetrics: Uint8Array[];
97
97
  timestamps: number[];
98
98
  }) => void): Promise<Consumer>;
99
+ /**
100
+ * Gets the runner status
101
+ * @return Promise
102
+ */
103
+ getStatus(): Promise<RunnerStatus>;
99
104
  }
@@ -130,10 +130,9 @@ var RunnerClient = /** @class */ (function (_super) {
130
130
  .then(_this.success())
131
131
  .catch(_this.error());
132
132
  },
133
- /* Sets the base settings package. The base settings is always included
134
- in the image creation process and loaded into the created session */
135
- setSettings: function (repositoryPackageReference) {
136
- return _this.request('SetDefaultSettings', repositoryPackageReference).then(_this.success()).catch(_this.error());
133
+ /* Saves the default settings in the repository. */
134
+ saveDefaultSettings: function (defaultSettings) {
135
+ return _this.request('SaveDefaultSettingsInRepository', defaultSettings).then(_this.success()).catch(_this.error());
137
136
  },
138
137
  };
139
138
  _this.runnerId = (0, utils_1.getSubjectParts)(baseSubject).runnerId;
@@ -398,6 +397,16 @@ var RunnerClient = /** @class */ (function (_super) {
398
397
  return consumer;
399
398
  });
400
399
  };
400
+ /**
401
+ * Gets the runner status
402
+ * @return Promise
403
+ */
404
+ RunnerClient.prototype.getStatus = function () {
405
+ return this.request('Status')
406
+ .then(function (status) { return DTOs_1.RunnerStatus.fromJS(status); })
407
+ .then(this.success())
408
+ .catch(this.error());
409
+ };
401
410
  return RunnerClient;
402
411
  }(BaseClient_1.BaseClient));
403
412
  exports.RunnerClient = RunnerClient;
@@ -2,8 +2,16 @@ import { BreakPoints, CommonContext, CommonSettings, DataGridControl, IMetricsCo
2
2
  import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
3
3
  import { BaseClient } from './BaseClient';
4
4
  export declare class SessionClient extends BaseClient {
5
+ private _sessionId;
5
6
  private subscriptions;
7
+ get sessionId(): string | undefined;
6
8
  constructor(baseSubject: string, options: ConnectionOptions);
9
+ /**
10
+ * Extracts the sessionId from the subject.
11
+ * @param subject //OpenTap.Runner.<runnerId>.Session.<sessionId>
12
+ * @returns sessionId or undefined if not found
13
+ */
14
+ private getSessionIdFromSubject;
7
15
  /**
8
16
  * @param sessionLogsHandler Function to be called when log list or error is received
9
17
  * @param options (optional) Subscription options
@@ -35,8 +35,28 @@ var SessionClient = /** @class */ (function (_super) {
35
35
  function SessionClient(baseSubject, options) {
36
36
  var _this = _super.call(this, baseSubject, options) || this;
37
37
  _this.subscriptions = [];
38
+ _this._sessionId = _this.getSessionIdFromSubject(baseSubject);
38
39
  return _this;
39
40
  }
41
+ Object.defineProperty(SessionClient.prototype, "sessionId", {
42
+ get: function () {
43
+ return this._sessionId;
44
+ },
45
+ enumerable: false,
46
+ configurable: true
47
+ });
48
+ /**
49
+ * Extracts the sessionId from the subject.
50
+ * @param subject //OpenTap.Runner.<runnerId>.Session.<sessionId>
51
+ * @returns sessionId or undefined if not found
52
+ */
53
+ SessionClient.prototype.getSessionIdFromSubject = function (subject) {
54
+ var match = subject.match(/Session\.(.+)$/);
55
+ if (match && match[1]) {
56
+ return match[1];
57
+ }
58
+ return undefined;
59
+ };
40
60
  /**
41
61
  * @param sessionLogsHandler Function to be called when log list or error is received
42
62
  * @param options (optional) Subscription options
@@ -1518,3 +1518,64 @@ export declare class AssetUpdatedEvent extends RunnerEvent implements IAssetUpda
1518
1518
  static fromJS(data: any): AssetUpdatedEvent;
1519
1519
  toJSON(data?: any): any;
1520
1520
  }
1521
+ export interface ISaveDefaultSettings {
1522
+ sessionId: string;
1523
+ repository: string;
1524
+ }
1525
+ export declare class SaveDefaultSettings implements ISaveDefaultSettings {
1526
+ sessionId: string;
1527
+ repository: string;
1528
+ constructor(data: ISaveDefaultSettings);
1529
+ static fromJS(data: any): SaveDefaultSettings;
1530
+ toJSON(data?: any): any;
1531
+ }
1532
+ export interface IRemoteConnection {
1533
+ endPoint: string;
1534
+ connected: boolean;
1535
+ rtt: string;
1536
+ }
1537
+ export declare class RemoteConnection implements IRemoteConnection {
1538
+ endPoint: string;
1539
+ connected: boolean;
1540
+ rtt: string;
1541
+ constructor(data?: IRemoteConnection);
1542
+ init(data?: any): void;
1543
+ static fromJS(data?: any): RemoteConnection;
1544
+ toJSON(data?: any): any;
1545
+ }
1546
+ export interface IStreamInfoStatus {
1547
+ runsMaxBytes: number;
1548
+ runsUsage: number;
1549
+ diskFree: number;
1550
+ }
1551
+ export declare class StreamInfoStatus implements IStreamInfoStatus {
1552
+ runsMaxBytes: number;
1553
+ runsUsage: number;
1554
+ diskFree: number;
1555
+ constructor(data?: IStreamInfoStatus);
1556
+ init(data?: any): void;
1557
+ static fromJS(data?: any): StreamInfoStatus;
1558
+ toJSON(data?: any): any;
1559
+ }
1560
+ export interface IRunnerStatus {
1561
+ version: string;
1562
+ runningAsService: boolean;
1563
+ runningInContainer: boolean;
1564
+ remoteConnection?: RemoteConnection;
1565
+ streamInfo?: StreamInfoStatus;
1566
+ ipAddress: string;
1567
+ hostame: string;
1568
+ }
1569
+ export declare class RunnerStatus implements IRunnerStatus {
1570
+ version: string;
1571
+ runningAsService: boolean;
1572
+ runningInContainer: boolean;
1573
+ remoteConnection?: RemoteConnection;
1574
+ streamInfo?: StreamInfoStatus;
1575
+ ipAddress: string;
1576
+ hostame: string;
1577
+ constructor(data?: IRunnerStatus);
1578
+ init(data?: any): void;
1579
+ static fromJS(data?: any): RunnerStatus;
1580
+ toJSON(data?: any): any;
1581
+ }
package/dist/mjs/DTOs.js CHANGED
@@ -3722,3 +3722,134 @@ export class AssetUpdatedEvent extends RunnerEvent {
3722
3722
  return data;
3723
3723
  }
3724
3724
  }
3725
+ export class SaveDefaultSettings {
3726
+ constructor(data) {
3727
+ this.sessionId = data.sessionId;
3728
+ this.repository = data.repository;
3729
+ }
3730
+ static fromJS(data) {
3731
+ data = typeof data === 'object' ? data : {};
3732
+ const result = new SaveDefaultSettings({
3733
+ sessionId: data['SessionId'],
3734
+ repository: data['Repository'],
3735
+ });
3736
+ return result;
3737
+ }
3738
+ toJSON(data) {
3739
+ data = typeof data === 'object' ? data : {};
3740
+ data['SessionId'] = this.sessionId;
3741
+ data['Repository'] = this.repository;
3742
+ return data;
3743
+ }
3744
+ }
3745
+ export class RemoteConnection {
3746
+ constructor(data) {
3747
+ this.endPoint = '';
3748
+ this.connected = false;
3749
+ this.rtt = '';
3750
+ if (data) {
3751
+ for (const property in data) {
3752
+ if (Object.prototype.hasOwnProperty.call(data, property))
3753
+ this[property] = data[property];
3754
+ }
3755
+ }
3756
+ }
3757
+ init(data) {
3758
+ var _a, _b, _c;
3759
+ if (data) {
3760
+ this.endPoint = (_a = data['EndPoint']) !== null && _a !== void 0 ? _a : '';
3761
+ this.connected = (_b = data['Connected']) !== null && _b !== void 0 ? _b : false;
3762
+ this.rtt = (_c = data['Rtt']) !== null && _c !== void 0 ? _c : '';
3763
+ }
3764
+ }
3765
+ static fromJS(data) {
3766
+ data = typeof data === 'object' ? data : {};
3767
+ const result = new RemoteConnection();
3768
+ result.init(data);
3769
+ return result;
3770
+ }
3771
+ toJSON(data) {
3772
+ data = typeof data === 'object' ? data : {};
3773
+ data['EndPoint'] = this.endPoint;
3774
+ data['Connected'] = this.connected;
3775
+ data['Rtt'] = this.rtt;
3776
+ return data;
3777
+ }
3778
+ }
3779
+ export class StreamInfoStatus {
3780
+ constructor(data) {
3781
+ this.runsMaxBytes = 0;
3782
+ this.runsUsage = 0;
3783
+ this.diskFree = 0;
3784
+ if (data) {
3785
+ for (const property in data) {
3786
+ if (Object.prototype.hasOwnProperty.call(data, property))
3787
+ this[property] = data[property];
3788
+ }
3789
+ }
3790
+ }
3791
+ init(data) {
3792
+ var _a, _b, _c;
3793
+ if (data) {
3794
+ this.runsMaxBytes = (_a = data['RunsMaxBytes']) !== null && _a !== void 0 ? _a : 0;
3795
+ this.runsUsage = (_b = data['RunsUsage']) !== null && _b !== void 0 ? _b : 0;
3796
+ this.diskFree = (_c = data['DiskFree']) !== null && _c !== void 0 ? _c : 0;
3797
+ }
3798
+ }
3799
+ static fromJS(data) {
3800
+ data = typeof data === 'object' ? data : {};
3801
+ const result = new StreamInfoStatus();
3802
+ result.init(data);
3803
+ return result;
3804
+ }
3805
+ toJSON(data) {
3806
+ data = typeof data === 'object' ? data : {};
3807
+ data['RunsMaxBytes'] = this.runsMaxBytes;
3808
+ data['RunsUsage'] = this.runsUsage;
3809
+ data['DiskFree'] = this.diskFree;
3810
+ return data;
3811
+ }
3812
+ }
3813
+ export class RunnerStatus {
3814
+ constructor(data) {
3815
+ this.version = '';
3816
+ this.runningAsService = false;
3817
+ this.runningInContainer = false;
3818
+ this.ipAddress = '';
3819
+ this.hostame = '';
3820
+ if (data) {
3821
+ for (const property in data) {
3822
+ if (Object.prototype.hasOwnProperty.call(data, property))
3823
+ this[property] = data[property];
3824
+ }
3825
+ }
3826
+ }
3827
+ init(data) {
3828
+ var _a, _b, _c, _d, _e;
3829
+ if (data) {
3830
+ this.version = (_a = data['Version']) !== null && _a !== void 0 ? _a : '';
3831
+ this.runningAsService = (_b = data['RunningAsService']) !== null && _b !== void 0 ? _b : false;
3832
+ this.runningInContainer = (_c = data['RunningInContainer']) !== null && _c !== void 0 ? _c : false;
3833
+ this.remoteConnection = data['RemoteConnection'] ? RemoteConnection.fromJS(data['RemoteConnection']) : undefined;
3834
+ this.streamInfo = data['StreamInfo'] ? StreamInfoStatus.fromJS(data['StreamInfo']) : undefined;
3835
+ this.ipAddress = (_d = data['IpAddress']) !== null && _d !== void 0 ? _d : '';
3836
+ this.hostame = (_e = data['Hostname']) !== null && _e !== void 0 ? _e : '';
3837
+ }
3838
+ }
3839
+ static fromJS(data) {
3840
+ data = typeof data === 'object' ? data : {};
3841
+ const result = new RunnerStatus();
3842
+ result.init(data);
3843
+ return result;
3844
+ }
3845
+ toJSON(data) {
3846
+ data = typeof data === 'object' ? data : {};
3847
+ data['Version'] = this.version;
3848
+ data['RunningAsService'] = this.runningAsService;
3849
+ data['RunningInContainer'] = this.runningInContainer;
3850
+ data['RemoteConnection'] = this.remoteConnection ? this.remoteConnection.toJSON() : undefined;
3851
+ data['StreamInfo'] = this.streamInfo ? this.streamInfo.toJSON() : undefined;
3852
+ data['IpAddress'] = this.ipAddress;
3853
+ data['Hostname'] = this.hostame;
3854
+ }
3855
+ }
@@ -1,6 +1,6 @@
1
1
  import { ConnectionOptions, Consumer, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
2
2
  import { RunnerUpdateRequest } from './requestDTOs';
3
- import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, Session } from './DTOs';
3
+ import { ISession, ISessionMetricInfo, Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, SaveDefaultSettings, Session } from './DTOs';
4
4
  import { BaseClient } from './BaseClient';
5
5
  export declare class RunnerClient extends BaseClient {
6
6
  private runnerId;
@@ -10,7 +10,7 @@ export declare class RunnerClient extends BaseClient {
10
10
  getImage: () => Promise<Image>;
11
11
  setImage: (image: Image) => Promise<Image>;
12
12
  getSettings: () => Promise<RepositoryPackageReference | undefined>;
13
- setSettings: (repositoryPackageReference: RepositoryPackageReference) => Promise<void>;
13
+ saveDefaultSettings: (defaultSettings: SaveDefaultSettings) => Promise<void>;
14
14
  };
15
15
  constructor(baseSubject: string, options: ConnectionOptions);
16
16
  /**
@@ -96,4 +96,9 @@ export declare class RunnerClient extends BaseClient {
96
96
  encodedMetrics: Uint8Array[];
97
97
  timestamps: number[];
98
98
  }) => void): Promise<Consumer>;
99
+ /**
100
+ * Gets the runner status
101
+ * @return Promise
102
+ */
103
+ getStatus(): Promise<RunnerStatus>;
99
104
  }
@@ -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 { Image, MetadataUpdatedEvent, RepositoryPackageReference, Session, } from './DTOs';
18
+ import { Image, MetadataUpdatedEvent, RepositoryPackageReference, RunnerStatus, Session, } from './DTOs';
19
19
  import { BaseClient } from './BaseClient';
20
20
  import { getSubjectParts } from './utils';
21
21
  export class RunnerClient extends BaseClient {
@@ -71,10 +71,9 @@ export class RunnerClient extends BaseClient {
71
71
  .then(this.success())
72
72
  .catch(this.error());
73
73
  },
74
- /* Sets the base settings package. The base settings is always included
75
- in the image creation process and loaded into the created session */
76
- setSettings: (repositoryPackageReference) => {
77
- return this.request('SetDefaultSettings', repositoryPackageReference).then(this.success()).catch(this.error());
74
+ /* Saves the default settings in the repository. */
75
+ saveDefaultSettings: (defaultSettings) => {
76
+ return this.request('SaveDefaultSettingsInRepository', defaultSettings).then(this.success()).catch(this.error());
78
77
  },
79
78
  };
80
79
  this.runnerId = getSubjectParts(baseSubject).runnerId;
@@ -296,4 +295,14 @@ export class RunnerClient extends BaseClient {
296
295
  return consumer;
297
296
  });
298
297
  }
298
+ /**
299
+ * Gets the runner status
300
+ * @return Promise
301
+ */
302
+ getStatus() {
303
+ return this.request('Status')
304
+ .then(status => RunnerStatus.fromJS(status))
305
+ .then(this.success())
306
+ .catch(this.error());
307
+ }
299
308
  }
@@ -2,8 +2,16 @@ import { BreakPoints, CommonContext, CommonSettings, DataGridControl, IMetricsCo
2
2
  import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
3
3
  import { BaseClient } from './BaseClient';
4
4
  export declare class SessionClient extends BaseClient {
5
+ private _sessionId;
5
6
  private subscriptions;
7
+ get sessionId(): string | undefined;
6
8
  constructor(baseSubject: string, options: ConnectionOptions);
9
+ /**
10
+ * Extracts the sessionId from the subject.
11
+ * @param subject //OpenTap.Runner.<runnerId>.Session.<sessionId>
12
+ * @returns sessionId or undefined if not found
13
+ */
14
+ private getSessionIdFromSubject;
7
15
  /**
8
16
  * @param sessionLogsHandler Function to be called when log list or error is received
9
17
  * @param options (optional) Subscription options
@@ -5,6 +5,22 @@ export class SessionClient extends BaseClient {
5
5
  constructor(baseSubject, options) {
6
6
  super(baseSubject, options);
7
7
  this.subscriptions = [];
8
+ this._sessionId = this.getSessionIdFromSubject(baseSubject);
9
+ }
10
+ get sessionId() {
11
+ return this._sessionId;
12
+ }
13
+ /**
14
+ * Extracts the sessionId from the subject.
15
+ * @param subject //OpenTap.Runner.<runnerId>.Session.<sessionId>
16
+ * @returns sessionId or undefined if not found
17
+ */
18
+ getSessionIdFromSubject(subject) {
19
+ const match = subject.match(/Session\.(.+)$/);
20
+ if (match && match[1]) {
21
+ return match[1];
22
+ }
23
+ return undefined;
8
24
  }
9
25
  /**
10
26
  * @param sessionLogsHandler Function to be called when log list or error is received
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.33.0",
3
+ "version": "2.34.0-alpha.1.1.15962948309",
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",