@opentap/runner-client 2.14.0 → 2.15.0-alpha.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/DTOs.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export declare class Image implements IImage {
2
2
  name?: string | undefined;
3
- packages?: PackageSpecifier[] | undefined;
4
- repositories?: string[] | undefined;
3
+ packages?: PackageSpecifier[];
4
+ repositories?: string[];
5
5
  id?: string | undefined;
6
6
  constructor(data?: IImage);
7
7
  init(_data?: any): void;
package/lib/DTOs.js CHANGED
@@ -15,6 +15,8 @@ var __extends = (this && this.__extends) || (function () {
15
15
  })();
16
16
  var Image = /** @class */ (function () {
17
17
  function Image(data) {
18
+ this.packages = [];
19
+ this.repositories = [];
18
20
  if (data) {
19
21
  for (var property in data) {
20
22
  if (Object.prototype.hasOwnProperty.call(data, property))
@@ -1,7 +1,14 @@
1
- import { Image, Session } from './DTOs';
1
+ import { Image, RepositoryPackageReference, Session } from './DTOs';
2
2
  import { BaseClient } from './BaseClient';
3
3
  import { ConnectionOptions } from 'nats.ws';
4
4
  export declare class RunnerClient extends BaseClient {
5
+ default: {
6
+ startSession: (testPlanRepositoryReference?: RepositoryPackageReference, timeout?: number) => Promise<Session>;
7
+ getImage: () => Promise<Image>;
8
+ setImage: (image: Image) => Promise<Image>;
9
+ getSettings: () => Promise<RepositoryPackageReference | undefined>;
10
+ setSettings: (repositoryPackageReference: RepositoryPackageReference) => Promise<void>;
11
+ };
5
12
  constructor(baseSubject: string, options: ConnectionOptions);
6
13
  /**
7
14
  * Get the created image with the specified ID.
@@ -26,6 +33,13 @@ export declare class RunnerClient extends BaseClient {
26
33
  * @returns {{Promise<Image>}}
27
34
  */
28
35
  resolveImage(images: Image[], timeout?: number): Promise<Image>;
36
+ /**
37
+ * Dry runs to resolve an image from a list of images. Dry run means that no packages will be downloaded.
38
+ * @param {Image[]} images List of images
39
+ * @param {number} timeout Optional timeout in milliseconds
40
+ * @returns {{Promise<Image>}}
41
+ */
42
+ resolveImageDryRun(images: Image[], timeout?: number): Promise<Image>;
29
43
  /**
30
44
  * Shut down a session
31
45
  * @param sessionId the ID of the session to shut down
@@ -13,12 +13,56 @@ var __extends = (this && this.__extends) || (function () {
13
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
14
  };
15
15
  })();
16
- import { Image, Session } from './DTOs';
16
+ import { Image, RepositoryPackageReference, Session } from './DTOs';
17
17
  import { BaseClient } from './BaseClient';
18
18
  var RunnerClient = /** @class */ (function (_super) {
19
19
  __extends(RunnerClient, _super);
20
20
  function RunnerClient(baseSubject, options) {
21
- return _super.call(this, baseSubject, options) || this;
21
+ var _this = _super.call(this, baseSubject, options) || this;
22
+ // Contains the endpoints for Defaults in the runner plugin.
23
+ _this.default = {
24
+ /* Create a Session based on the dependencies of a TestPlan. Returned
25
+ Session will have referenced TestPlan pre-loaded. The Session will be
26
+ created with the base image and base settings. */
27
+ startSession: function (testPlanRepositoryReference, timeout) {
28
+ return _this.request('StartDefaultSession', testPlanRepositoryReference !== null && testPlanRepositoryReference !== void 0 ? testPlanRepositoryReference : null, { timeout: timeout })
29
+ .then(function (sessionJs) { return Session.fromJS(sessionJs); })
30
+ .then(_this.success())
31
+ .catch(_this.error());
32
+ },
33
+ /* Gets the base image. The base image is always included in the image
34
+ creation process */
35
+ getImage: function () {
36
+ return _this.request('GetDefaultImage')
37
+ .then(function (imageJs) { return Image.fromJS(imageJs); })
38
+ .then(_this.success())
39
+ .catch(_this.error());
40
+ },
41
+ /* Sets the base image. The specified image is resolved and set as the
42
+ base image */
43
+ setImage: function (image) {
44
+ return _this.request('SetDefaultImage', image)
45
+ .then(function (imageJs) { return Image.fromJS(imageJs); })
46
+ .then(_this.success())
47
+ .catch(_this.error());
48
+ },
49
+ /* Gets the base settings package. The base settings is always included
50
+ in the image creation process and loaded into the created session */
51
+ getSettings: function () {
52
+ return _this.request('GetDefaultSettings')
53
+ .then(function (repositoryPackageReferenceJs) {
54
+ return repositoryPackageReferenceJs ? RepositoryPackageReference.fromJS(repositoryPackageReferenceJs) : undefined;
55
+ })
56
+ .then(_this.success())
57
+ .catch(_this.error());
58
+ },
59
+ /* Sets the base settings package. The base settings is always included
60
+ in the image creation process and loaded into the created session */
61
+ setSettings: function (repositoryPackageReference) {
62
+ return _this.request('SetDefaultSettings', repositoryPackageReference).then(_this.success()).catch(_this.error());
63
+ },
64
+ };
65
+ return _this;
22
66
  }
23
67
  /**
24
68
  * Get the created image with the specified ID.
@@ -67,6 +111,20 @@ var RunnerClient = /** @class */ (function (_super) {
67
111
  .catch(this.error())
68
112
  : Promise.reject('images list is not defined or is empty');
69
113
  };
114
+ /**
115
+ * Dry runs to resolve an image from a list of images. Dry run means that no packages will be downloaded.
116
+ * @param {Image[]} images List of images
117
+ * @param {number} timeout Optional timeout in milliseconds
118
+ * @returns {{Promise<Image>}}
119
+ */
120
+ RunnerClient.prototype.resolveImageDryRun = function (images, timeout) {
121
+ return (images === null || images === void 0 ? void 0 : images.length) > 0
122
+ ? this.request('ResolveImageDryRun', images, { timeout: timeout })
123
+ .then(function (imageJs) { return Image.fromJS(imageJs); })
124
+ .then(this.success())
125
+ .catch(this.error())
126
+ : Promise.reject('images list is not defined or is empty');
127
+ };
70
128
  /**
71
129
  * Shut down a session
72
130
  * @param sessionId the ID of the session to shut down
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentap/runner-client",
3
- "version": "2.14.0",
3
+ "version": "2.15.0-alpha.1.3",
4
4
  "description": "This is the web client for the OpenTAP Runner.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",