@opentap/runner-client 2.20.0-alpha.1.7.7789778780 → 2.20.0
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 → dist/cjs}/DTOs.js +68 -2
- package/{lib → dist/cjs}/SessionClient.js +172 -0
- package/dist/cjs/package.json +3 -0
- package/dist/mjs/BaseClient.js +595 -0
- package/{lib → dist/mjs}/DTOs.d.ts +31 -0
- package/dist/mjs/DTOs.js +3431 -0
- package/dist/mjs/RunnerClient.js +175 -0
- package/{lib → dist/mjs}/SessionClient.d.ts +59 -1
- package/dist/mjs/SessionClient.js +739 -0
- package/dist/mjs/SystemClient.js +159 -0
- package/dist/mjs/index.js +5 -0
- package/dist/mjs/package.json +3 -0
- package/dist/mjs/requestDTOs.js +1 -0
- package/package.json +10 -5
- /package/{lib → dist/cjs}/BaseClient.js +0 -0
- /package/{lib → dist/cjs}/RunnerClient.js +0 -0
- /package/{lib → dist/cjs}/SystemClient.js +0 -0
- /package/{lib → dist/cjs}/index.js +0 -0
- /package/{lib → dist/cjs}/requestDTOs.js +0 -0
- /package/{lib → dist/mjs}/BaseClient.d.ts +0 -0
- /package/{lib → dist/mjs}/RunnerClient.d.ts +0 -0
- /package/{lib → dist/mjs}/SystemClient.d.ts +0 -0
- /package/{lib → dist/mjs}/index.d.ts +0 -0
- /package/{lib → dist/mjs}/requestDTOs.d.ts +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Image, RepositoryPackageReference, Session } from './DTOs';
|
|
2
|
+
import { BaseClient } from './BaseClient';
|
|
3
|
+
export class RunnerClient extends BaseClient {
|
|
4
|
+
constructor(baseSubject, options) {
|
|
5
|
+
super(baseSubject, options);
|
|
6
|
+
// Contains the endpoints for Defaults in the runner plugin.
|
|
7
|
+
this.default = {
|
|
8
|
+
/* Create a Session based on the dependencies of a TestPlan. Returned
|
|
9
|
+
Session will have referenced TestPlan pre-loaded. The Session will be
|
|
10
|
+
created with the base image and base settings. */
|
|
11
|
+
startSession: (testPlanRepositoryReference, timeout) => {
|
|
12
|
+
return this.request('StartDefaultSession', testPlanRepositoryReference !== null && testPlanRepositoryReference !== void 0 ? testPlanRepositoryReference : null, { timeout })
|
|
13
|
+
.then(sessionJs => Session.fromJS(sessionJs))
|
|
14
|
+
.then(this.success())
|
|
15
|
+
.catch(this.error());
|
|
16
|
+
},
|
|
17
|
+
/* Create a Session based on the dependencies of a TestPlan, but with
|
|
18
|
+
an image which packages overrides the default and testplan dependencies.
|
|
19
|
+
Returned Session will have referenced TestPlan pre-loaded. The Session
|
|
20
|
+
will be created with the base image and base settings.
|
|
21
|
+
*/
|
|
22
|
+
startSessionWithOverriddenImage: (testPlanReference, imageOverride, timeout) => {
|
|
23
|
+
const defaultSessionRequest = {
|
|
24
|
+
testPlanReference: testPlanReference !== null && testPlanReference !== void 0 ? testPlanReference : null,
|
|
25
|
+
imageOverride: imageOverride !== null && imageOverride !== void 0 ? imageOverride : null,
|
|
26
|
+
};
|
|
27
|
+
return this.request('StartDefaultSessionOverrideImage', defaultSessionRequest, { timeout })
|
|
28
|
+
.then(sessionJs => Session.fromJS(sessionJs))
|
|
29
|
+
.then(this.success())
|
|
30
|
+
.catch(this.error());
|
|
31
|
+
},
|
|
32
|
+
/* Gets the base image. The base image is always included in the image
|
|
33
|
+
creation process */
|
|
34
|
+
getImage: () => {
|
|
35
|
+
return this.request('GetDefaultImage')
|
|
36
|
+
.then(imageJs => Image.fromJS(imageJs))
|
|
37
|
+
.then(this.success())
|
|
38
|
+
.catch(this.error());
|
|
39
|
+
},
|
|
40
|
+
/* Sets the base image. The specified image is resolved and set as the
|
|
41
|
+
base image */
|
|
42
|
+
setImage: (image) => {
|
|
43
|
+
return this.request('SetDefaultImage', image)
|
|
44
|
+
.then(imageJs => Image.fromJS(imageJs))
|
|
45
|
+
.then(this.success())
|
|
46
|
+
.catch(this.error());
|
|
47
|
+
},
|
|
48
|
+
/* Gets the base settings package. The base settings is always included
|
|
49
|
+
in the image creation process and loaded into the created session */
|
|
50
|
+
getSettings: () => {
|
|
51
|
+
return this.request('GetDefaultSettings')
|
|
52
|
+
.then(repositoryPackageReferenceJs => repositoryPackageReferenceJs ? RepositoryPackageReference.fromJS(repositoryPackageReferenceJs) : undefined)
|
|
53
|
+
.then(this.success())
|
|
54
|
+
.catch(this.error());
|
|
55
|
+
},
|
|
56
|
+
/* Sets the base settings package. The base settings is always included
|
|
57
|
+
in the image creation process and loaded into the created session */
|
|
58
|
+
setSettings: (repositoryPackageReference) => {
|
|
59
|
+
return this.request('SetDefaultSettings', repositoryPackageReference).then(this.success()).catch(this.error());
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the created image with the specified ID.
|
|
65
|
+
* @param imageId
|
|
66
|
+
* @returns {{Promise<Image>}}
|
|
67
|
+
*/
|
|
68
|
+
getImage(imageId) {
|
|
69
|
+
return (imageId === null || imageId === void 0 ? void 0 : imageId.length) > 0
|
|
70
|
+
? this.request('GetImage', imageId)
|
|
71
|
+
.then(imageJs => Image.fromJS(imageJs))
|
|
72
|
+
.then(this.success())
|
|
73
|
+
.catch(this.error())
|
|
74
|
+
: Promise.reject('imageId is not defined');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get all created images
|
|
78
|
+
* @returns {{Promise<Image[]>}}
|
|
79
|
+
*/
|
|
80
|
+
getImages() {
|
|
81
|
+
return this.request('GetImages')
|
|
82
|
+
.then(imageArrayJs => imageArrayJs.map(imageJs => Image.fromJS(imageJs)))
|
|
83
|
+
.then(this.success())
|
|
84
|
+
.catch(this.error());
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get all sessions
|
|
88
|
+
* @returns {{Promise<Session[]>}}
|
|
89
|
+
*/
|
|
90
|
+
getSessions() {
|
|
91
|
+
return this.request('GetSessions')
|
|
92
|
+
.then(sessionArrayJs => sessionArrayJs.map(sessionJs => Session.fromJS(sessionJs)))
|
|
93
|
+
.then(this.success())
|
|
94
|
+
.catch(this.error());
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Create a OpenTAP package configuration image from a list image inputs consisting of user specified packages and repositories.
|
|
98
|
+
* @param {Image[]} images List of images
|
|
99
|
+
* @param {number} timeout Optional timeout in milliseconds
|
|
100
|
+
* @returns {{Promise<Image>}}
|
|
101
|
+
*/
|
|
102
|
+
resolveImage(images, timeout) {
|
|
103
|
+
return (images === null || images === void 0 ? void 0 : images.length) > 0
|
|
104
|
+
? this.request('ResolveImage', images, { timeout })
|
|
105
|
+
.then(imageJs => Image.fromJS(imageJs))
|
|
106
|
+
.then(this.success())
|
|
107
|
+
.catch(this.error())
|
|
108
|
+
: Promise.reject('images list is not defined or is empty');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Dry runs to resolve an image from a list of images. Dry run means that no packages will be downloaded.
|
|
112
|
+
* @param {Image[]} images List of images
|
|
113
|
+
* @param {number} timeout Optional timeout in milliseconds
|
|
114
|
+
* @returns {{Promise<Image>}}
|
|
115
|
+
*/
|
|
116
|
+
resolveImageDryRun(images, timeout) {
|
|
117
|
+
return (images === null || images === void 0 ? void 0 : images.length) > 0
|
|
118
|
+
? this.request('ResolveImageDryRun', images, { timeout: timeout })
|
|
119
|
+
.then(imageJs => Image.fromJS(imageJs))
|
|
120
|
+
.then(this.success())
|
|
121
|
+
.catch(this.error())
|
|
122
|
+
: Promise.reject('images list is not defined or is empty');
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Shut down a session
|
|
126
|
+
* @param sessionId the ID of the session to shut down
|
|
127
|
+
* @returns {{Promise<void>}}
|
|
128
|
+
*/
|
|
129
|
+
shutdownSession(sessionId) {
|
|
130
|
+
return (sessionId === null || sessionId === void 0 ? void 0 : sessionId.length) > 0
|
|
131
|
+
? this.request('ShutdownSession', sessionId).then(this.success()).catch(this.error())
|
|
132
|
+
: Promise.reject('sessionId is not defined');
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Start a session
|
|
136
|
+
* @returns {{Promise<Session>}}
|
|
137
|
+
*/
|
|
138
|
+
startSession() {
|
|
139
|
+
return this.request('StartSession')
|
|
140
|
+
.then(sessionJs => Session.fromJS(sessionJs))
|
|
141
|
+
.then(this.success())
|
|
142
|
+
.catch(this.error());
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get the session manager image.
|
|
146
|
+
* @returns {{Promise<Image>}}
|
|
147
|
+
*/
|
|
148
|
+
getSessionManagerImage() {
|
|
149
|
+
return this.request('GetSessionManagerImage')
|
|
150
|
+
.then(imageJs => Image.fromJS(imageJs))
|
|
151
|
+
.then(this.success())
|
|
152
|
+
.catch(this.error());
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Start a session based on an image.
|
|
156
|
+
* @param imageId
|
|
157
|
+
* @returns {{Promise<Session>}}
|
|
158
|
+
*/
|
|
159
|
+
startImageSession(image) {
|
|
160
|
+
return image
|
|
161
|
+
? this.request('StartImageSession', image)
|
|
162
|
+
.then(sessionJs => Session.fromJS(sessionJs))
|
|
163
|
+
.then(this.success())
|
|
164
|
+
.catch(this.error())
|
|
165
|
+
: Promise.reject('image is not defined');
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Update the `Runner` plugin to the given version
|
|
169
|
+
* @param runnerUpdateRequest
|
|
170
|
+
* @returns {{Promise<void>}}
|
|
171
|
+
*/
|
|
172
|
+
updateRunner(runnerUpdateRequest) {
|
|
173
|
+
return this.request('UpdateRunner', runnerUpdateRequest).then(this.success()).catch(this.error());
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, Parameter, RepositoryPackageDefinition, RepositoryPackageReference,
|
|
1
|
+
import { BreakPoints, CommonContext, CommonSettings, DataGridControl, Image, Interaction, ListItemType, LogList, OnTestPlanRun, OnTestStepRun, Parameter, RepositoryPackageDefinition, RepositoryPackageReference, Resource, Result, RunStatus, SessionEvent, Setting, TestPlan, TestRun, TestStepType, TestStepValidationError, WatchDog } from './DTOs';
|
|
2
2
|
import { ConnectionOptions, NatsError, Subscription, SubscriptionOptions } from 'nats.ws';
|
|
3
3
|
import { BaseClient } from './BaseClient';
|
|
4
4
|
export declare class SessionClient extends BaseClient {
|
|
@@ -23,6 +23,64 @@ export declare class SessionClient extends BaseClient {
|
|
|
23
23
|
* @returns Subscription array: Result and Test Run subscriptions
|
|
24
24
|
*/
|
|
25
25
|
connectSessionResults(resultHandler: (result: Result | undefined, err: NatsError | Error | null) => void, testRunHandler: (testRun: TestRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): [Subscription, Subscription];
|
|
26
|
+
/**
|
|
27
|
+
* @param testRunHandler Function to be called when test run or error is received
|
|
28
|
+
* @param options (optional) Subscription options
|
|
29
|
+
* @returns Subscription array: Result and Test Run subscriptions
|
|
30
|
+
*/
|
|
31
|
+
connectTestRunEvents(testRunHandler: (testRun: TestRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
32
|
+
/**
|
|
33
|
+
* Connect to listen to the TestPlanRun events for the given test plan run ID.
|
|
34
|
+
* @param {string} testPlanRunId
|
|
35
|
+
* @param {(event:OnTestPlanRun|undefined,err:NatsError|Error|null)=>void} handler
|
|
36
|
+
* @param {SubscriptionOptions} options?
|
|
37
|
+
* @returns Subscription
|
|
38
|
+
*/
|
|
39
|
+
connectTestPlanRunEvents(testPlanRunId: string, handler: (event: OnTestPlanRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
40
|
+
/**
|
|
41
|
+
* Connect to listen to the test plan run logs for the given test plan run ID
|
|
42
|
+
* @param {string} testPlanRunId
|
|
43
|
+
* @param {(logList:LogList|undefined,err:NatsError|Error|null)=>void} handler
|
|
44
|
+
* @param {SubscriptionOptions} options?
|
|
45
|
+
* @returns Subscription
|
|
46
|
+
*/
|
|
47
|
+
connectTestPlanRunLogs(testPlanRunId: string, handler: (logList: LogList | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
48
|
+
/**
|
|
49
|
+
* Connect to listen to the test plan run parameter events for the given test plan run ID
|
|
50
|
+
* @param {string} testPlanRunId
|
|
51
|
+
* @param {(event:Parameter[]|undefined,err:NatsError|Error|null)=>void} handler
|
|
52
|
+
* @param {SubscriptionOptions} options?
|
|
53
|
+
* @returns Subscription
|
|
54
|
+
*/
|
|
55
|
+
connectTestPlanRunParameterEvents(testPlanRunId: string, handler: (event: Parameter[] | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
56
|
+
/**
|
|
57
|
+
* Connect to listen to the test step run events for the given test step and test plan run ID
|
|
58
|
+
* @param {string} testPlanRunId
|
|
59
|
+
* @param {string} testStepRunId
|
|
60
|
+
* @param {(testRun:OnTestStepRun|undefined,err:NatsError|Error|null)=>void} handler
|
|
61
|
+
* @param {SubscriptionOptions} options?
|
|
62
|
+
* @returns Subscription
|
|
63
|
+
*/
|
|
64
|
+
connectTestStepRunEvents(testPlanRunId: string, testStepRunId: string, handler: (testStepRunId: string | undefined, testRun: OnTestStepRun | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
65
|
+
/**
|
|
66
|
+
* Connect to listen to the test step run parameters for the given test step and test plan run ID
|
|
67
|
+
* @param {string} testPlanRunId
|
|
68
|
+
* @param {string} testStepRunId
|
|
69
|
+
* @param {(event:Parameter[]|undefined,err:NatsError|Error|null)=>void} handler
|
|
70
|
+
* @param {SubscriptionOptions} options?
|
|
71
|
+
* @returns Subscription
|
|
72
|
+
*/
|
|
73
|
+
connectTestStepRunParameterEvents(testPlanRunId: string, testStepRunId: string, handler: (event: Parameter[] | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
74
|
+
/**
|
|
75
|
+
* Connect to listen to the test step run results for the given test step and test plan run ID
|
|
76
|
+
* @param {string} testPlanRunId
|
|
77
|
+
* @param {string} testStepRunId
|
|
78
|
+
* @param {string} resultName
|
|
79
|
+
* @param {(result:Result|undefined,err:NatsError|Error|null)=>void} handler
|
|
80
|
+
* @param {SubscriptionOptions} options?
|
|
81
|
+
* @returns Subscription
|
|
82
|
+
*/
|
|
83
|
+
connectTestStepRunResults(testPlanRunId: string, testStepRunId: string, resultName: string, handler: (result: Result | undefined, err: NatsError | Error | null) => void, options?: SubscriptionOptions): Subscription;
|
|
26
84
|
/**
|
|
27
85
|
* Unsubscibe from session events
|
|
28
86
|
*/
|