checkly 6.3.2 → 6.4.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/dist/commands/deploy.js +2 -6
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/destroy.js +2 -6
- package/dist/commands/destroy.js.map +1 -1
- package/dist/commands/env/add.js +5 -7
- package/dist/commands/env/add.js.map +1 -1
- package/dist/commands/env/rm.js +3 -8
- package/dist/commands/env/rm.js.map +1 -1
- package/dist/commands/env/update.js +5 -10
- package/dist/commands/env/update.js.map +1 -1
- package/dist/commands/import/plan.js +13 -27
- package/dist/commands/import/plan.js.map +1 -1
- package/dist/commands/trigger.js +3 -2
- package/dist/commands/trigger.js.map +1 -1
- package/dist/helpers/command-style.d.ts +3 -2
- package/dist/helpers/command-style.js +17 -6
- package/dist/helpers/command-style.js.map +1 -1
- package/dist/rest/api.js +4 -13
- package/dist/rest/api.js.map +1 -1
- package/dist/rest/environment-variables.d.ts +27 -1
- package/dist/rest/environment-variables.js +78 -8
- package/dist/rest/environment-variables.js.map +1 -1
- package/dist/rest/errors.d.ts +84 -0
- package/dist/rest/errors.js +232 -0
- package/dist/rest/errors.js.map +1 -0
- package/dist/rest/projects.d.ts +43 -0
- package/dist/rest/projects.js +138 -28
- package/dist/rest/projects.js.map +1 -1
- package/dist/rest/test-sessions.d.ts +15 -2
- package/dist/rest/test-sessions.js +30 -4
- package/dist/rest/test-sessions.js.map +1 -1
- package/dist/rules/checkly.rules.md +1 -1
- package/dist/services/test-runner.js +17 -22
- package/dist/services/test-runner.js.map +1 -1
- package/dist/services/trigger-runner.d.ts +0 -2
- package/dist/services/trigger-runner.js +17 -34
- package/dist/services/trigger-runner.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/dist/rest/projects.js
CHANGED
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectNotFoundError = void 0;
|
|
4
|
-
const axios_1 = require("axios");
|
|
3
|
+
exports.InvalidImportPlanStateError = exports.ImportPlanNotFoundError = exports.NoImportableResourcesFoundError = exports.ProjectAlreadyExistsError = exports.ProjectNotFoundError = void 0;
|
|
5
4
|
const util_1 = require("./util");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
6
|
class ProjectNotFoundError extends Error {
|
|
7
|
+
logicalId;
|
|
8
|
+
constructor(logicalId, options) {
|
|
9
|
+
super(`Project "${logicalId}" does not exist.`, options);
|
|
10
|
+
this.name = 'ProjectNotFoundError';
|
|
11
|
+
this.logicalId = logicalId;
|
|
12
|
+
}
|
|
7
13
|
}
|
|
8
14
|
exports.ProjectNotFoundError = ProjectNotFoundError;
|
|
15
|
+
class ProjectAlreadyExistsError extends Error {
|
|
16
|
+
logicalId;
|
|
17
|
+
constructor(logicalId, options) {
|
|
18
|
+
super(`You are already using the logicalId "${logicalId}" for a different project.`, options);
|
|
19
|
+
this.name = 'ProjectAlreadyExistsError';
|
|
20
|
+
this.logicalId = logicalId;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ProjectAlreadyExistsError = ProjectAlreadyExistsError;
|
|
24
|
+
class NoImportableResourcesFoundError extends Error {
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super(`No importable resources were found.`, options);
|
|
27
|
+
this.name = 'NoImportableResourcesFoundError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.NoImportableResourcesFoundError = NoImportableResourcesFoundError;
|
|
31
|
+
class ImportPlanNotFoundError extends Error {
|
|
32
|
+
constructor(options) {
|
|
33
|
+
super(`Import plan does not exist.`, options);
|
|
34
|
+
this.name = 'ImportPlanNotFoundError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.ImportPlanNotFoundError = ImportPlanNotFoundError;
|
|
38
|
+
class InvalidImportPlanStateError extends Error {
|
|
39
|
+
constructor(options) {
|
|
40
|
+
super(`Invalid state for import plan.`, options);
|
|
41
|
+
this.name = 'InvalidImportPlanStateError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.InvalidImportPlanStateError = InvalidImportPlanStateError;
|
|
9
45
|
class Projects {
|
|
10
46
|
api;
|
|
11
47
|
constructor(api) {
|
|
@@ -14,33 +50,46 @@ class Projects {
|
|
|
14
50
|
getAll() {
|
|
15
51
|
return this.api.get('/next/projects');
|
|
16
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @throws {ProjectNotFoundError} If the project does not exist.
|
|
55
|
+
*/
|
|
17
56
|
async get(logicalId) {
|
|
18
57
|
try {
|
|
19
58
|
const logicalIdParam = encodeURIComponent(logicalId);
|
|
20
59
|
return await this.api.get(`/next/projects/${logicalIdParam}`);
|
|
21
60
|
}
|
|
22
61
|
catch (err) {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
throw new ProjectNotFoundError();
|
|
26
|
-
}
|
|
62
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
63
|
+
throw new ProjectNotFoundError(logicalId);
|
|
27
64
|
}
|
|
28
65
|
throw err;
|
|
29
66
|
}
|
|
30
67
|
}
|
|
31
|
-
|
|
32
|
-
|
|
68
|
+
/**
|
|
69
|
+
* @throws {ProjectAlreadyExistsError} If the project already exists.
|
|
70
|
+
*/
|
|
71
|
+
async create(project) {
|
|
72
|
+
try {
|
|
73
|
+
return await this.api.post('/next/projects', project);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
if (err instanceof errors_1.ConflictError) {
|
|
77
|
+
throw new ProjectAlreadyExistsError(project.logicalId);
|
|
78
|
+
}
|
|
79
|
+
throw err;
|
|
80
|
+
}
|
|
33
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* @throws {ProjectNotFoundError} If the project does not exist.
|
|
84
|
+
*/
|
|
34
85
|
async deleteProject(logicalId) {
|
|
35
86
|
try {
|
|
36
87
|
const logicalIdParam = encodeURIComponent(logicalId);
|
|
37
88
|
return await this.api.delete(`/next/projects/${logicalIdParam}`);
|
|
38
89
|
}
|
|
39
90
|
catch (err) {
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
throw new ProjectNotFoundError();
|
|
43
|
-
}
|
|
91
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
92
|
+
throw new ProjectNotFoundError(logicalId);
|
|
44
93
|
}
|
|
45
94
|
throw err;
|
|
46
95
|
}
|
|
@@ -48,18 +97,36 @@ class Projects {
|
|
|
48
97
|
deploy(resources, { dryRun = false, scheduleOnDeploy = true } = {}) {
|
|
49
98
|
return this.api.post(`/next-v2/projects/deploy?dryRun=${dryRun}&scheduleOnDeploy=${scheduleOnDeploy}`, resources, { transformRequest: util_1.compressJSONPayload });
|
|
50
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* @throws {ProjectNotFoundError} If the project does not exist.
|
|
102
|
+
* @throws {NoImportableResourcesFoundError} If no importable resources were found.
|
|
103
|
+
*/
|
|
51
104
|
async createImportPlan(logicalId, options) {
|
|
52
105
|
const payload = {
|
|
53
106
|
filters: options?.filters,
|
|
54
107
|
friends: options?.friends,
|
|
55
108
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
109
|
+
try {
|
|
110
|
+
const logicalIdParam = encodeURIComponent(logicalId);
|
|
111
|
+
return await this.api.post(`/next/projects/${logicalIdParam}/imports`, payload, {
|
|
112
|
+
params: {
|
|
113
|
+
preview: options?.preview ?? false,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
119
|
+
if (/No importable resources were found/i.test(err.data.message)) {
|
|
120
|
+
throw new NoImportableResourcesFoundError();
|
|
121
|
+
}
|
|
122
|
+
throw new ProjectNotFoundError(logicalId);
|
|
123
|
+
}
|
|
124
|
+
throw err;
|
|
125
|
+
}
|
|
62
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* @throws {ProjectNotFoundError} If the project does not exist.
|
|
129
|
+
*/
|
|
63
130
|
async findImportPlans(logicalId, { onlyUnapplied = false, onlyUncommitted = false } = {}) {
|
|
64
131
|
try {
|
|
65
132
|
const logicalIdParam = encodeURIComponent(logicalId);
|
|
@@ -71,10 +138,8 @@ class Projects {
|
|
|
71
138
|
});
|
|
72
139
|
}
|
|
73
140
|
catch (err) {
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
throw new ProjectNotFoundError();
|
|
77
|
-
}
|
|
141
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
142
|
+
throw new ProjectNotFoundError(logicalId);
|
|
78
143
|
}
|
|
79
144
|
throw err;
|
|
80
145
|
}
|
|
@@ -87,14 +152,59 @@ class Projects {
|
|
|
87
152
|
},
|
|
88
153
|
});
|
|
89
154
|
}
|
|
90
|
-
|
|
91
|
-
|
|
155
|
+
/**
|
|
156
|
+
* @throws {ImportPlanNotFoundError} If the import plan does not exist.
|
|
157
|
+
* @throws {InvalidImportPlanStateError} If the operation is performed out of order.
|
|
158
|
+
*/
|
|
159
|
+
async cancelImportPlan(importPlanId) {
|
|
160
|
+
try {
|
|
161
|
+
return await this.api.delete(`/next/projects/imports/${importPlanId}`);
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
if (err instanceof errors_1.ForbiddenError) {
|
|
165
|
+
throw new InvalidImportPlanStateError();
|
|
166
|
+
}
|
|
167
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
168
|
+
throw new ImportPlanNotFoundError();
|
|
169
|
+
}
|
|
170
|
+
throw err;
|
|
171
|
+
}
|
|
92
172
|
}
|
|
93
|
-
|
|
94
|
-
|
|
173
|
+
/**
|
|
174
|
+
* @throws {ImportPlanNotFoundError} If the import plan does not exist.
|
|
175
|
+
* @throws {InvalidImportPlanStateError} If the operation is performed out of order.
|
|
176
|
+
*/
|
|
177
|
+
async applyImportPlan(importPlanId) {
|
|
178
|
+
try {
|
|
179
|
+
return await this.api.post(`/next/projects/imports/${importPlanId}/apply`);
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
if (err instanceof errors_1.ForbiddenError) {
|
|
183
|
+
throw new InvalidImportPlanStateError();
|
|
184
|
+
}
|
|
185
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
186
|
+
throw new ImportPlanNotFoundError();
|
|
187
|
+
}
|
|
188
|
+
throw err;
|
|
189
|
+
}
|
|
95
190
|
}
|
|
96
|
-
|
|
97
|
-
|
|
191
|
+
/**
|
|
192
|
+
* @throws {ImportPlanNotFoundError} If the import plan does not exist.
|
|
193
|
+
* @throws {InvalidImportPlanStateError} If the operation is performed out of order.
|
|
194
|
+
*/
|
|
195
|
+
async commitImportPlan(importPlanId) {
|
|
196
|
+
try {
|
|
197
|
+
return await this.api.post(`/next/projects/imports/${importPlanId}/commit`);
|
|
198
|
+
}
|
|
199
|
+
catch (err) {
|
|
200
|
+
if (err instanceof errors_1.ForbiddenError) {
|
|
201
|
+
throw new InvalidImportPlanStateError();
|
|
202
|
+
}
|
|
203
|
+
if (err instanceof errors_1.NotFoundError) {
|
|
204
|
+
throw new ImportPlanNotFoundError();
|
|
205
|
+
}
|
|
206
|
+
throw err;
|
|
207
|
+
}
|
|
98
208
|
}
|
|
99
209
|
}
|
|
100
210
|
exports.default = Projects;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/rest/projects.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/rest/projects.ts"],"names":[],"mappings":";;;AAEA,iCAA4C;AAE5C,qCAAuE;AA0GvE,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,SAAS,CAAQ;IAEjB,YAAa,SAAiB,EAAE,OAAsB;QACpD,KAAK,CAAC,YAAY,SAAS,mBAAmB,EAAE,OAAO,CAAC,CAAA;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C;IAED;;;OAGG;IACH,KAAK,CAAC,gBAAgB,CAAE,YAAoB;QAC1C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAO,0BAA0B,YAAY,SAAS,CAAC,CAAA;QACnF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,uBAAc,EAAE,CAAC;gBAClC,MAAM,IAAI,2BAA2B,EAAE,CAAA;YACzC,CAAC;YAED,IAAI,GAAG,YAAY,sBAAa,EAAE,CAAC;gBACjC,MAAM,IAAI,uBAAuB,EAAE,CAAA;YACrC,CAAC;YAED,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;CACF;AAED,kBAAe,QAAQ,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AxiosInstance } from 'axios';
|
|
2
2
|
import { GitInformation } from '../services/util';
|
|
3
3
|
import { RetryStrategy, SharedFile } from '../constructs';
|
|
4
|
+
import { SequenceId } from '../services/abstract-check-runner';
|
|
4
5
|
type RunTestSessionRequest = {
|
|
5
6
|
name: string;
|
|
6
7
|
checkRunJobs: any[];
|
|
@@ -47,11 +48,23 @@ export type TestResultsShortLinks = {
|
|
|
47
48
|
videoLinks: string[];
|
|
48
49
|
screenshotLinks: string[];
|
|
49
50
|
};
|
|
51
|
+
export type TriggerTestSessionResponse = {
|
|
52
|
+
checks: Array<any>;
|
|
53
|
+
testSessionId: string;
|
|
54
|
+
testResultIds: Record<string, string>;
|
|
55
|
+
sequenceIds: Record<string, SequenceId>;
|
|
56
|
+
};
|
|
57
|
+
export declare class NoMatchingChecksError extends Error {
|
|
58
|
+
constructor(options?: ErrorOptions);
|
|
59
|
+
}
|
|
50
60
|
declare class TestSessions {
|
|
51
61
|
api: AxiosInstance;
|
|
52
62
|
constructor(api: AxiosInstance);
|
|
53
63
|
run(payload: RunTestSessionRequest): Promise<import("axios").AxiosResponse<any, any>>;
|
|
54
|
-
|
|
64
|
+
/**
|
|
65
|
+
* @throws {NoMatchingChecksError} If no checks matched the request.
|
|
66
|
+
*/
|
|
67
|
+
trigger(payload: TriggerTestSessionRequest): Promise<import("axios").AxiosResponse<TriggerTestSessionResponse, any>>;
|
|
55
68
|
getShortLink(id: string): Promise<import("axios").AxiosResponse<{
|
|
56
69
|
link: string;
|
|
57
70
|
}, any>>;
|
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoMatchingChecksError = void 0;
|
|
3
4
|
const util_1 = require("./util");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
class NoMatchingChecksError extends Error {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super(`No matching checks found.`, options);
|
|
9
|
+
this.name = 'NoMatchingChecksError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.NoMatchingChecksError = NoMatchingChecksError;
|
|
4
13
|
class TestSessions {
|
|
5
14
|
api;
|
|
6
15
|
constructor(api) {
|
|
7
16
|
this.api = api;
|
|
8
17
|
}
|
|
9
|
-
run(payload) {
|
|
10
|
-
return this.api.post('/next/test-sessions/run', payload, {
|
|
18
|
+
async run(payload) {
|
|
19
|
+
return await this.api.post('/next/test-sessions/run', payload, {
|
|
11
20
|
transformRequest: util_1.compressJSONPayload,
|
|
12
21
|
});
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @throws {NoMatchingChecksError} If no checks matched the request.
|
|
25
|
+
*/
|
|
26
|
+
async trigger(payload) {
|
|
27
|
+
try {
|
|
28
|
+
const resp = await this.api.post('/next/test-sessions/trigger', payload);
|
|
29
|
+
if (resp.data.checks.length === 0) {
|
|
30
|
+
// Currently the BE will never return an empty `checks` array, it returns a 403 instead.
|
|
31
|
+
// This is added to make the old CLI versions compatible if we ever change this, though.
|
|
32
|
+
throw new NoMatchingChecksError();
|
|
33
|
+
}
|
|
34
|
+
return resp;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
if (err instanceof errors_1.ForbiddenError && err.data.errorCode === 'ERR_NO_MATCHING_CHECKS') {
|
|
38
|
+
throw new NoMatchingChecksError();
|
|
39
|
+
}
|
|
40
|
+
throw err;
|
|
41
|
+
}
|
|
16
42
|
}
|
|
17
43
|
getShortLink(id) {
|
|
18
44
|
return this.api.get(`/next/test-sessions/${id}/link`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-sessions.js","sourceRoot":"","sources":["../../src/rest/test-sessions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-sessions.js","sourceRoot":"","sources":["../../src/rest/test-sessions.ts"],"names":[],"mappings":";;;AAGA,iCAA4C;AAE5C,qCAAyC;AAuCzC,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAa,OAAsB;QACjC,KAAK,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAA;QAC3C,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF;AALD,sDAKC;AAED,MAAM,YAAY;IAChB,GAAG,CAAe;IAClB,YAAa,GAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,GAAG,CAAE,OAA8B;QACvC,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,EAAE;YAC7D,gBAAgB,EAAE,0BAAmB;SACtC,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAE,OAAkC;QAC/C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAA6B,6BAA6B,EAAE,OAAO,CAAC,CAAA;YAEpG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClC,wFAAwF;gBACxF,wFAAwF;gBACxF,MAAM,IAAI,qBAAqB,EAAE,CAAA;YACnC,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,uBAAc,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,wBAAwB,EAAE,CAAC;gBACrF,MAAM,IAAI,qBAAqB,EAAE,CAAA;YACnC,CAAC;YAED,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IAED,YAAY,CAAE,EAAU;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAmB,uBAAuB,EAAE,OAAO,CAAC,CAAA;IACzE,CAAC;IAED,mBAAmB,CAAE,aAAqB,EAAE,YAAoB;QAC9D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAwB,uBAAuB,aAAa,YAAY,YAAY,QAAQ,CAAC,CAAA;IAClH,CAAC;CACF;AAED,kBAAe,YAAY,CAAA"}
|
|
@@ -226,7 +226,7 @@ new TcpMonitor('example-tcp-monitor', {
|
|
|
226
226
|
|
|
227
227
|
- Import the `UrlMonitor` construct from `checkly/constructs`.
|
|
228
228
|
- Reference [the docs for URL monitors](https://www.checklyhq.com/docs/cli/constructs-reference/#urlmonitor) before generating any code.
|
|
229
|
-
- When adding `assertions`, always use `
|
|
229
|
+
- When adding `assertions`, always use `UrlAssertionBuilder` class which is [documented here](https://www.checklyhq.com/docs/cli/constructs-reference/#urlassertionbuilder)
|
|
230
230
|
|
|
231
231
|
```typescript
|
|
232
232
|
import { AlertEscalationBuilder, Frequency, RetryStrategyBuilder, UrlAssertionBuilder, UrlMonitor } from 'checkly/constructs'
|
|
@@ -76,29 +76,24 @@ class TestRunner extends abstract_check_runner_1.default {
|
|
|
76
76
|
filePath: check.getSourceFile(),
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
throw new Error('Unable to find checks to run.');
|
|
82
|
-
}
|
|
83
|
-
const { data } = await api_1.testSessions.run({
|
|
84
|
-
name: this.projectBundle.project.name,
|
|
85
|
-
checkRunJobs,
|
|
86
|
-
project: { logicalId: this.projectBundle.project.logicalId },
|
|
87
|
-
sharedFiles: this.sharedFiles,
|
|
88
|
-
runLocation: this.location,
|
|
89
|
-
repoInfo: this.repoInfo,
|
|
90
|
-
environment: this.environment,
|
|
91
|
-
shouldRecord: this.shouldRecord,
|
|
92
|
-
});
|
|
93
|
-
const { testSessionId, sequenceIds } = data;
|
|
94
|
-
const checks = this.checkBundles.map(({ construct: check }) => {
|
|
95
|
-
return { check, sequenceId: sequenceIds?.[check.logicalId] };
|
|
96
|
-
});
|
|
97
|
-
return { testSessionId, checks };
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
throw new Error(err.response?.data?.message ?? err.response?.data?.error ?? err.message);
|
|
79
|
+
if (!checkRunJobs.length) {
|
|
80
|
+
throw new Error('Unable to find checks to run.');
|
|
101
81
|
}
|
|
82
|
+
const { data } = await api_1.testSessions.run({
|
|
83
|
+
name: this.projectBundle.project.name,
|
|
84
|
+
checkRunJobs,
|
|
85
|
+
project: { logicalId: this.projectBundle.project.logicalId },
|
|
86
|
+
sharedFiles: this.sharedFiles,
|
|
87
|
+
runLocation: this.location,
|
|
88
|
+
repoInfo: this.repoInfo,
|
|
89
|
+
environment: this.environment,
|
|
90
|
+
shouldRecord: this.shouldRecord,
|
|
91
|
+
});
|
|
92
|
+
const { testSessionId, sequenceIds } = data;
|
|
93
|
+
const checks = this.checkBundles.map(({ construct: check }) => {
|
|
94
|
+
return { check, sequenceId: sequenceIds?.[check.logicalId] };
|
|
95
|
+
});
|
|
96
|
+
return { testSessionId, checks };
|
|
102
97
|
}
|
|
103
98
|
async processCheckResult(result) {
|
|
104
99
|
await super.processCheckResult(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-runner.js","sourceRoot":"","sources":["../../src/services/test-runner.ts"],"names":[],"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,MAAM,EAAE,SAAS,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;CACF;AA5FD,6BA4FC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { RetryStrategy } from '../constructs';
|
|
2
2
|
import AbstractCheckRunner, { RunLocation, SequenceId } from './abstract-check-runner';
|
|
3
3
|
import { GitInformation } from './util';
|
|
4
|
-
export declare class NoMatchingChecksError extends Error {
|
|
5
|
-
}
|
|
6
4
|
export default class TriggerRunner extends AbstractCheckRunner {
|
|
7
5
|
shouldRecord: boolean;
|
|
8
6
|
location: RunLocation;
|
|
@@ -3,12 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NoMatchingChecksError = void 0;
|
|
7
6
|
const api_1 = require("../rest/api");
|
|
8
7
|
const abstract_check_runner_1 = __importDefault(require("./abstract-check-runner"));
|
|
9
|
-
class NoMatchingChecksError extends Error {
|
|
10
|
-
}
|
|
11
|
-
exports.NoMatchingChecksError = NoMatchingChecksError;
|
|
12
8
|
class TriggerRunner extends abstract_check_runner_1.default {
|
|
13
9
|
shouldRecord;
|
|
14
10
|
location;
|
|
@@ -30,36 +26,23 @@ class TriggerRunner extends abstract_check_runner_1.default {
|
|
|
30
26
|
this.testRetryStrategy = testRetryStrategy;
|
|
31
27
|
}
|
|
32
28
|
async scheduleChecks(checkRunSuiteId) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
const augmentedChecks = checks.map(check => ({
|
|
52
|
-
check,
|
|
53
|
-
sequenceId: sequenceIds?.[check.id],
|
|
54
|
-
}));
|
|
55
|
-
return { checks: augmentedChecks, testSessionId };
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
if (err.response?.data?.errorCode === 'ERR_NO_MATCHING_CHECKS') {
|
|
59
|
-
throw new NoMatchingChecksError();
|
|
60
|
-
}
|
|
61
|
-
throw new Error(err.response?.data?.message ?? err.message);
|
|
62
|
-
}
|
|
29
|
+
const { data } = await api_1.testSessions.trigger({
|
|
30
|
+
name: this.testSessionName ?? 'Triggered Session',
|
|
31
|
+
shouldRecord: this.shouldRecord,
|
|
32
|
+
runLocation: this.location,
|
|
33
|
+
checkRunSuiteId,
|
|
34
|
+
targetTags: this.targetTags,
|
|
35
|
+
environmentVariables: this.envVars,
|
|
36
|
+
repoInfo: this.repoInfo,
|
|
37
|
+
environment: this.environment,
|
|
38
|
+
testRetryStrategy: this.testRetryStrategy,
|
|
39
|
+
});
|
|
40
|
+
const { checks, testSessionId, sequenceIds, } = data;
|
|
41
|
+
const augmentedChecks = checks.map(check => ({
|
|
42
|
+
check,
|
|
43
|
+
sequenceId: sequenceIds?.[check.id],
|
|
44
|
+
}));
|
|
45
|
+
return { checks: augmentedChecks, testSessionId };
|
|
63
46
|
}
|
|
64
47
|
}
|
|
65
48
|
exports.default = TriggerRunner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger-runner.js","sourceRoot":"","sources":["../../src/services/trigger-runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger-runner.js","sourceRoot":"","sources":["../../src/services/trigger-runner.ts"],"names":[],"mappings":";;;;;AACA,qCAA0C;AAC1C,oFAAsF;AAGtF,MAAqB,aAAc,SAAQ,+BAAmB;IAC5D,YAAY,CAAS;IACrB,QAAQ,CAAa;IACrB,UAAU,CAAY;IACtB,OAAO,CAAuC;IAC9C,QAAQ,CAAuB;IAC/B,WAAW,CAAe;IAC1B,eAAe,CAAoB;IACnC,iBAAiB,C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