@mablhq/mabl-cli 1.21.22 → 1.25.1
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/README.md +2 -2
- package/api/basicApiClient.js +4 -0
- package/api/mablApiClient.js +72 -53
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +91 -39
- package/commands/constants.js +3 -2
- package/commands/link-agents/link-agents_cmds/list.js +131 -0
- package/commands/link-agents/link-agents_cmds/terminate.js +31 -0
- package/commands/tests/testsUtil.js +25 -64
- package/commands/tests/tests_cmds/run.js +6 -6
- package/commands/tests/tests_cmds/trainerUtil.js +12 -0
- package/core/messaging/messaging.js +11 -1
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/execution/index.js.LICENSE.txt +0 -27
- package/mablApi/index.js +1 -1
- package/mablscript/steps/SyntheticStep.js +20 -0
- package/mablscriptFind/index.js +1 -1
- package/package.json +5 -5
- package/resources/mablFind.js +1 -1
- package/commands/tests/executionUtil.js +0 -36
- package/commands/tests/tests_cmds/run-alpha.js +0 -129
- package/commands/tests/tests_cmds/run-legacy.js +0 -109
- package/commands/tests/tests_cmds/trainer.js +0 -5
- package/commands/tests/tests_cmds/trainer_cmds/install.js +0 -14
- package/commands/tests/tests_cmds/trainer_cmds/trainerUtil.js +0 -169
- package/commands/tests/tests_cmds/trainer_cmds/update.js +0 -27
- package/commands/tests/tests_cmds/trainer_cmds/version.js +0 -22
package/README.md
CHANGED
|
@@ -345,10 +345,10 @@ mabl config delete http.sslVerify
|
|
|
345
345
|
|
|
346
346
|
## Installation Troubleshooting
|
|
347
347
|
|
|
348
|
-
If you receive the following error message, you need to ensure you have Node
|
|
348
|
+
If you receive the following error message, you need to ensure you have Node 14+
|
|
349
349
|
installed.
|
|
350
350
|
|
|
351
351
|
```bash
|
|
352
|
-
npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">=
|
|
352
|
+
npm WARN notsup Unsupported engine for @mablhq/mabl-cli@0.1.13: wanted: {"node":">= 14.0.0"} (current: {"node":"8.15.1","npm":"6.13.4"})
|
|
353
353
|
npm WARN notsup Not compatible with your version of node/npm: @mablhq/mabl-cli@0.1.13
|
|
354
354
|
```
|
package/api/basicApiClient.js
CHANGED
|
@@ -59,6 +59,9 @@ class BasicApiClient {
|
|
|
59
59
|
sslVerify: (_a = options.sslVerify) !== null && _a !== void 0 ? _a : DEFAULT_SSL_VERIFY,
|
|
60
60
|
proxyHost: options.proxyUrl,
|
|
61
61
|
});
|
|
62
|
+
if (!config.headers) {
|
|
63
|
+
config.headers = {};
|
|
64
|
+
}
|
|
62
65
|
config.timeout =
|
|
63
66
|
(_d = (_b = options.requestTimeoutMillis) !== null && _b !== void 0 ? _b : (_c = options.retryConfig) === null || _c === void 0 ? void 0 : _c.requestTimeoutMillis) !== null && _d !== void 0 ? _d : DEFAULT_RETRYABLE_REQUEST_TIMEOUT_MILLISECONDS;
|
|
64
67
|
switch (options.authType) {
|
|
@@ -87,6 +90,7 @@ class BasicApiClient {
|
|
|
87
90
|
}
|
|
88
91
|
this.httpRequestConfig = config;
|
|
89
92
|
this.httpClient = axios_1.default.create(config);
|
|
93
|
+
this.httpClient.defaults.headers.common = { ...config.headers };
|
|
90
94
|
this.retryConfig = options.retryConfig;
|
|
91
95
|
this.debugLogger = (_e = options.debugLogger) !== null && _e !== void 0 ? _e : logUtils_1.logInternal;
|
|
92
96
|
}
|
package/api/mablApiClient.js
CHANGED
|
@@ -37,11 +37,13 @@ const DEPLOYMENT_EVENT_RETRY_CONFIG = {
|
|
|
37
37
|
};
|
|
38
38
|
class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
39
39
|
constructor(options) {
|
|
40
|
+
var _a;
|
|
40
41
|
super(options);
|
|
42
|
+
this.baseApiUrl = (_a = options.apiUrl) !== null && _a !== void 0 ? _a : env_1.BASE_API_URL;
|
|
41
43
|
}
|
|
42
44
|
async getPlan(planId) {
|
|
43
45
|
try {
|
|
44
|
-
return await this.makeGetRequest(`${
|
|
46
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/schedule/runPolicy/${planId}`);
|
|
45
47
|
}
|
|
46
48
|
catch (error) {
|
|
47
49
|
throw toApiError(`Failed to get plan (${planId})`, error);
|
|
@@ -51,7 +53,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
51
53
|
var _a, _b;
|
|
52
54
|
try {
|
|
53
55
|
const queryArg = queryString.stringify(options);
|
|
54
|
-
const plans = await this.makeGetRequest(`${
|
|
56
|
+
const plans = await this.makeGetRequest(`${this.baseApiUrl}/schedule/runPolicy/?${queryArg}`);
|
|
55
57
|
sortTemporallyAscending((_a = plans.run_policies) !== null && _a !== void 0 ? _a : []);
|
|
56
58
|
return (_b = plans.run_policies) !== null && _b !== void 0 ? _b : [];
|
|
57
59
|
}
|
|
@@ -61,7 +63,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
61
63
|
}
|
|
62
64
|
async getApplication(applicationId) {
|
|
63
65
|
try {
|
|
64
|
-
return await this.makeGetRequest(`${
|
|
66
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/v1/applications/${applicationId}`);
|
|
65
67
|
}
|
|
66
68
|
catch (error) {
|
|
67
69
|
throw toApiError(`Failed to get application (${applicationId})`, error);
|
|
@@ -73,7 +75,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
73
75
|
organization_id: workspaceId,
|
|
74
76
|
limit,
|
|
75
77
|
});
|
|
76
|
-
const applications = await this.makeGetRequest(`${
|
|
78
|
+
const applications = await this.makeGetRequest(`${this.baseApiUrl}/applications?${applicationQueryString}`).then((result) => { var _a; return (_a = result.applications) !== null && _a !== void 0 ? _a : []; });
|
|
77
79
|
sortTemporallyAscending(applications);
|
|
78
80
|
return applications;
|
|
79
81
|
}
|
|
@@ -87,7 +89,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
87
89
|
decrypt: decryptVariables,
|
|
88
90
|
};
|
|
89
91
|
const envQueryString = queryString.stringify(queryStringArgs);
|
|
90
|
-
return await this.makeGetRequest(`${
|
|
92
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/v1/environments/${environmentId}?${envQueryString}`);
|
|
91
93
|
}
|
|
92
94
|
catch (error) {
|
|
93
95
|
throw toApiError(`Failed to get environment (${environmentId})`, error);
|
|
@@ -95,7 +97,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
95
97
|
}
|
|
96
98
|
async deleteEnvironment(id) {
|
|
97
99
|
try {
|
|
98
|
-
return await this.makeDeleteRequest(`${
|
|
100
|
+
return await this.makeDeleteRequest(`${this.baseApiUrl}/environments/${id}`);
|
|
99
101
|
}
|
|
100
102
|
catch (error) {
|
|
101
103
|
throw toApiError(`Failed to delete environment`, error);
|
|
@@ -103,7 +105,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
103
105
|
}
|
|
104
106
|
async createEnvironment(environment) {
|
|
105
107
|
try {
|
|
106
|
-
return await this.makePostRequest(`${
|
|
108
|
+
return await this.makePostRequest(`${this.baseApiUrl}/environments`, environment);
|
|
107
109
|
}
|
|
108
110
|
catch (error) {
|
|
109
111
|
throw toApiError(`Failed to create environment`, error);
|
|
@@ -111,7 +113,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
111
113
|
}
|
|
112
114
|
async updateEnvironment(id, environment) {
|
|
113
115
|
try {
|
|
114
|
-
return await this.makePatchRequest(`${
|
|
116
|
+
return await this.makePatchRequest(`${this.baseApiUrl}/environments/${id}`, environment);
|
|
115
117
|
}
|
|
116
118
|
catch (error) {
|
|
117
119
|
throw toApiError(`Failed to update environment`, error);
|
|
@@ -123,7 +125,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
123
125
|
organization_id: workspaceId,
|
|
124
126
|
limit,
|
|
125
127
|
});
|
|
126
|
-
const environments = await this.makeGetRequest(`${
|
|
128
|
+
const environments = await this.makeGetRequest(`${this.baseApiUrl}/v1/environments/?${environmentQueryString}`).then((result) => { var _a; return (_a = result.environments) !== null && _a !== void 0 ? _a : []; });
|
|
127
129
|
sortTemporallyAscending(environments);
|
|
128
130
|
return environments;
|
|
129
131
|
}
|
|
@@ -133,7 +135,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
133
135
|
}
|
|
134
136
|
async createDeployment(deployment) {
|
|
135
137
|
try {
|
|
136
|
-
return await this.makePostRequest(`${
|
|
138
|
+
return await this.makePostRequest(`${this.baseApiUrl}/deployments`, deployment);
|
|
137
139
|
}
|
|
138
140
|
catch (error) {
|
|
139
141
|
throw toApiError(`Failed to create deployment`, error);
|
|
@@ -145,7 +147,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
145
147
|
workspace_id: workspaceId,
|
|
146
148
|
label,
|
|
147
149
|
});
|
|
148
|
-
return await this.makeGetRequest(`${
|
|
150
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/link/servers/select?${queryParams}`);
|
|
149
151
|
}
|
|
150
152
|
catch (error) {
|
|
151
153
|
throw toApiError(`Failed to get selected link server`, error);
|
|
@@ -153,18 +155,35 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
153
155
|
}
|
|
154
156
|
async deleteLinkLabel(workspaceId, linkLabel) {
|
|
155
157
|
try {
|
|
156
|
-
return await this.makeDeleteRequest(`${
|
|
158
|
+
return await this.makeDeleteRequest(`${this.baseApiUrl}/link/${workspaceId}/label/${linkLabel}`);
|
|
157
159
|
}
|
|
158
160
|
catch (error) {
|
|
159
161
|
throw toApiError(`Failed to delete link label`, error);
|
|
160
162
|
}
|
|
161
163
|
}
|
|
164
|
+
async getLinkAgentsWithRecentHeartbeats(workspaceId, limit, maxHeartbeatAgeSeconds) {
|
|
165
|
+
var _a;
|
|
166
|
+
try {
|
|
167
|
+
return ((_a = (await this.makeGetRequest(`${env_1.BASE_API_URL}/link/agents?workspace_id=${workspaceId}&limit=${limit}&max_heartbeat_age_sec=${maxHeartbeatAgeSeconds}`)).link_agents) !== null && _a !== void 0 ? _a : []);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
throw toApiError(`Failed to get active link agents`, error);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async terminateLinkAgent(id) {
|
|
174
|
+
try {
|
|
175
|
+
await this.makePostRequest(`${env_1.BASE_API_URL}/link/agents/${id}/terminate`);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
throw toApiError(`Failed to terminate link agent`, error);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
162
181
|
async getExportRequest(id) {
|
|
163
182
|
return this.getEntity(id, 'exports', 'ExportRequest');
|
|
164
183
|
}
|
|
165
184
|
async getEntity(id, path, entityName = 'Entity') {
|
|
166
185
|
try {
|
|
167
|
-
return await this.makeGetRequest(`${
|
|
186
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/v1/${path}/${id}`);
|
|
168
187
|
}
|
|
169
188
|
catch (error) {
|
|
170
189
|
throw toApiError(`Failed to get ${entityName} (${id})`, error);
|
|
@@ -176,7 +195,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
176
195
|
organization_id: workspaceId,
|
|
177
196
|
limit,
|
|
178
197
|
});
|
|
179
|
-
return await this.makeGetRequest(`${
|
|
198
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/credentials?${credentialsQueryString}`).then((result) => { var _a; return (_a = result.credentials) !== null && _a !== void 0 ? _a : []; });
|
|
180
199
|
}
|
|
181
200
|
catch (error) {
|
|
182
201
|
throw toApiError(`Failed to get credentials`, error);
|
|
@@ -184,7 +203,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
184
203
|
}
|
|
185
204
|
async getCredential(credentialId) {
|
|
186
205
|
try {
|
|
187
|
-
return await this.makeGetRequest(`${
|
|
206
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/credentials/${credentialId}`);
|
|
188
207
|
}
|
|
189
208
|
catch (error) {
|
|
190
209
|
throw toApiError(`Failed to get credential`, error);
|
|
@@ -196,7 +215,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
196
215
|
workspace_id: workspaceId,
|
|
197
216
|
limit,
|
|
198
217
|
});
|
|
199
|
-
return await this.makeGetRequest(`${
|
|
218
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/events/deployment?${deploymentQueryString}`).then((result) => { var _a; return (_a = result.deployments) !== null && _a !== void 0 ? _a : []; });
|
|
200
219
|
}
|
|
201
220
|
catch (error) {
|
|
202
221
|
throw toApiError(`Failed to get deployment events`, error);
|
|
@@ -204,7 +223,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
204
223
|
}
|
|
205
224
|
async getDeploymentEvent(deploymentId) {
|
|
206
225
|
try {
|
|
207
|
-
return await this.makeGetRequest(`${
|
|
226
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/events/deployment/${deploymentId}`);
|
|
208
227
|
}
|
|
209
228
|
catch (error) {
|
|
210
229
|
throw toApiError(`Failed to get deployment event`, error);
|
|
@@ -212,7 +231,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
212
231
|
}
|
|
213
232
|
async getDeploymentEntity(deploymentId) {
|
|
214
233
|
try {
|
|
215
|
-
return await this.makeGetRequest(`${
|
|
234
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/deployments/${deploymentId}`);
|
|
216
235
|
}
|
|
217
236
|
catch (error) {
|
|
218
237
|
throw toApiError(`Failed to get deployment entity`, error);
|
|
@@ -226,7 +245,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
226
245
|
application_id: applicationId,
|
|
227
246
|
limit,
|
|
228
247
|
});
|
|
229
|
-
const query = `${
|
|
248
|
+
const query = `${this.baseApiUrl}/deployments?${queryStringParams}`;
|
|
230
249
|
return await this.makeGetRequest(query);
|
|
231
250
|
}
|
|
232
251
|
catch (error) {
|
|
@@ -235,7 +254,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
235
254
|
}
|
|
236
255
|
async getDeploymentResults(deploymentEventId) {
|
|
237
256
|
try {
|
|
238
|
-
return await this.makeGetRequest(`${
|
|
257
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/execution/result/event/${deploymentEventId}`, DEPLOYMENT_EVENT_RETRY_CONFIG);
|
|
239
258
|
}
|
|
240
259
|
catch (error) {
|
|
241
260
|
throw toApiError(`Failed to get deployment results`, error);
|
|
@@ -243,7 +262,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
243
262
|
}
|
|
244
263
|
async getTestFindSummaries(testId, environmentId) {
|
|
245
264
|
try {
|
|
246
|
-
return await this.makeGetRequest(`${
|
|
265
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/findSummary?journey_id=${testId}&environment_id=${environmentId}`).then((result) => { var _a; return (_a = result.findsummaries) !== null && _a !== void 0 ? _a : []; });
|
|
247
266
|
}
|
|
248
267
|
catch (error) {
|
|
249
268
|
throw toApiError(`Failed to get test find summaries results`, error);
|
|
@@ -251,7 +270,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
251
270
|
}
|
|
252
271
|
async getTestFindModels(testId, environmentId) {
|
|
253
272
|
try {
|
|
254
|
-
return await this.makeGetRequest(`${
|
|
273
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/findModel/test/${testId}?environment_id=${environmentId}`).then((result) => { var _a; return (_a = result.findModels) !== null && _a !== void 0 ? _a : []; });
|
|
255
274
|
}
|
|
256
275
|
catch (error) {
|
|
257
276
|
throw toApiError(`Failed to get test find model results`, error);
|
|
@@ -259,7 +278,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
259
278
|
}
|
|
260
279
|
async getTestOverrides(testId, environmentId, selectorOverrideLimit = 10) {
|
|
261
280
|
try {
|
|
262
|
-
return await this.makeGetRequest(`${
|
|
281
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/tests/testScripts/${testId}/overrides?environment_id=${environmentId}&selector_override_limit=${selectorOverrideLimit}`).then((result) => { var _a; return (_a = result.overrides) !== null && _a !== void 0 ? _a : []; });
|
|
263
282
|
}
|
|
264
283
|
catch (error) {
|
|
265
284
|
throw toApiError(`Failed to get selector overrides`, error);
|
|
@@ -267,7 +286,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
267
286
|
}
|
|
268
287
|
async getTestRun(testRunId) {
|
|
269
288
|
try {
|
|
270
|
-
return await this.makeGetRequest(`${
|
|
289
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/journeyRuns/${testRunId}`);
|
|
271
290
|
}
|
|
272
291
|
catch (error) {
|
|
273
292
|
throw toApiError(`Failed to get test run info`, error);
|
|
@@ -275,7 +294,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
275
294
|
}
|
|
276
295
|
async getPlanRun(planRunId) {
|
|
277
296
|
try {
|
|
278
|
-
return await this.makeGetRequest(`${
|
|
297
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/planRuns/${planRunId}`);
|
|
279
298
|
}
|
|
280
299
|
catch (error) {
|
|
281
300
|
throw toApiError(`Failed to get plan run info`, error);
|
|
@@ -296,7 +315,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
296
315
|
}
|
|
297
316
|
async getWorkspace(workspaceId) {
|
|
298
317
|
try {
|
|
299
|
-
return await this.makeGetRequest(`${
|
|
318
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/organizations/${workspaceId}`);
|
|
300
319
|
}
|
|
301
320
|
catch (error) {
|
|
302
321
|
throw toApiError(`Failed to get workspace`, error);
|
|
@@ -304,7 +323,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
304
323
|
}
|
|
305
324
|
async getAccount(accountId) {
|
|
306
325
|
try {
|
|
307
|
-
return await this.makeGetRequest(`${
|
|
326
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/accounts/${accountId}`);
|
|
308
327
|
}
|
|
309
328
|
catch (error) {
|
|
310
329
|
throw toApiError(`Failed to get account`, error);
|
|
@@ -312,7 +331,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
312
331
|
}
|
|
313
332
|
async getApiKeyDetails() {
|
|
314
333
|
try {
|
|
315
|
-
return await this.makeGetRequest(`${
|
|
334
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/apiKeys/self`);
|
|
316
335
|
}
|
|
317
336
|
catch (error) {
|
|
318
337
|
throw toApiError(`Failed to validate API Key`, error);
|
|
@@ -321,7 +340,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
321
340
|
async getSelf() {
|
|
322
341
|
var _a, _b;
|
|
323
342
|
try {
|
|
324
|
-
const selfInfo = await this.makeGetRequest(`${
|
|
343
|
+
const selfInfo = await this.makeGetRequest(`${this.baseApiUrl}/self`);
|
|
325
344
|
if (((_a = selfInfo.preferences) === null || _a === void 0 ? void 0 : _a.default_workspace_id) &&
|
|
326
345
|
!(await cliConfigProvider_1.CliConfigProvider.getWorkspace())) {
|
|
327
346
|
const workspace = await this.getWorkspace(selfInfo.preferences.default_workspace_id);
|
|
@@ -344,7 +363,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
344
363
|
sourceControlTag: branchName,
|
|
345
364
|
};
|
|
346
365
|
const journeyQueryString = queryString.stringify(queryStringArgs);
|
|
347
|
-
return await this.makeGetRequest(`${
|
|
366
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/test/journey/${journeyId}?${journeyQueryString}`);
|
|
348
367
|
}
|
|
349
368
|
catch (error) {
|
|
350
369
|
throw toApiError(`Failed to get Test [${journeyId}]`, error);
|
|
@@ -354,7 +373,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
354
373
|
var _a;
|
|
355
374
|
try {
|
|
356
375
|
const queryArg = queryString.stringify(options);
|
|
357
|
-
const journeys = (_a = (await this.makeGetRequest(`${
|
|
376
|
+
const journeys = (_a = (await this.makeGetRequest(`${this.baseApiUrl}/test/journeys?${queryArg}`)).journeys) !== null && _a !== void 0 ? _a : [];
|
|
358
377
|
sortTemporallyAscending(journeys);
|
|
359
378
|
return journeys;
|
|
360
379
|
}
|
|
@@ -368,7 +387,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
368
387
|
sourceControlTag: branchName,
|
|
369
388
|
};
|
|
370
389
|
const flowQueryString = queryString.stringify(queryStringArgs);
|
|
371
|
-
return await this.makeGetRequest(`${
|
|
390
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/flows/${flowId}?${flowQueryString}`);
|
|
372
391
|
}
|
|
373
392
|
catch (error) {
|
|
374
393
|
throw toApiError(`Failed to get Flow [${flowId}]`, error);
|
|
@@ -378,7 +397,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
378
397
|
var _a;
|
|
379
398
|
try {
|
|
380
399
|
const queryArg = queryString.stringify(options);
|
|
381
|
-
const flows = (_a = (await this.makeGetRequest(`${
|
|
400
|
+
const flows = (_a = (await this.makeGetRequest(`${this.baseApiUrl}/flows?${queryArg}`)).flows) !== null && _a !== void 0 ? _a : [];
|
|
382
401
|
sortTemporallyAscending(flows);
|
|
383
402
|
return flows;
|
|
384
403
|
}
|
|
@@ -391,7 +410,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
391
410
|
const queryParameter = typeof preferLatestIfReusable === 'boolean'
|
|
392
411
|
? `?=preferLatestIfReusable=${preferLatestIfReusable}`
|
|
393
412
|
: '';
|
|
394
|
-
return await this.makeGetRequest(`${
|
|
413
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/snippets/${snippetId}${queryParameter}`);
|
|
395
414
|
}
|
|
396
415
|
catch (error) {
|
|
397
416
|
throw toApiError(`Failed to get Snippet [${snippetId}]`, error);
|
|
@@ -399,7 +418,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
399
418
|
}
|
|
400
419
|
async getBranchById(branchId) {
|
|
401
420
|
try {
|
|
402
|
-
return await this.makeGetRequest(`${
|
|
421
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/branch/${branchId}`);
|
|
403
422
|
}
|
|
404
423
|
catch (error) {
|
|
405
424
|
throw toApiError(`Failed to get Branch [${branchId}] by id`, error);
|
|
@@ -407,7 +426,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
407
426
|
}
|
|
408
427
|
async getBranchByName(workspaceId, branchName) {
|
|
409
428
|
try {
|
|
410
|
-
return await this.makeGetRequest(`${
|
|
429
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/branch/${workspaceId}/${branchName}`);
|
|
411
430
|
}
|
|
412
431
|
catch (error) {
|
|
413
432
|
throw toApiError(`Failed to get Branch [${branchName}] by name`, error);
|
|
@@ -420,7 +439,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
420
439
|
limit,
|
|
421
440
|
status: statusFilter,
|
|
422
441
|
});
|
|
423
|
-
return await this.makeGetRequest(`${
|
|
442
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/branch?${branchQueryString}`).then((result) => { var _a; return (_a = result.branches) !== null && _a !== void 0 ? _a : []; });
|
|
424
443
|
}
|
|
425
444
|
catch (error) {
|
|
426
445
|
throw toApiError(`Failed to get Branches`, error);
|
|
@@ -428,7 +447,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
428
447
|
}
|
|
429
448
|
async getUploadFileUrl(fileId) {
|
|
430
449
|
try {
|
|
431
|
-
return await this.makeGetRequest(`${
|
|
450
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/files/fileUpload/url/${fileId}`);
|
|
432
451
|
}
|
|
433
452
|
catch (error) {
|
|
434
453
|
throw toApiError(`Failed to get File Upload URL`, error);
|
|
@@ -436,7 +455,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
436
455
|
}
|
|
437
456
|
async getDatatableRows(datatableId) {
|
|
438
457
|
try {
|
|
439
|
-
return await this.makeGetRequest(`${
|
|
458
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/variables/tables/${datatableId}/rows`).then((result) => { var _a; return (_a = result.variableRows) !== null && _a !== void 0 ? _a : []; });
|
|
440
459
|
}
|
|
441
460
|
catch (error) {
|
|
442
461
|
throw toApiError(`Failed to get datatable rows`, error);
|
|
@@ -445,7 +464,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
445
464
|
async getSessionEmails(sessionId) {
|
|
446
465
|
try {
|
|
447
466
|
const contextId = sessionId === null || sessionId === void 0 ? void 0 : sessionId.slice(0, 8);
|
|
448
|
-
return await this.makeGetRequest(`${
|
|
467
|
+
return await this.makeGetRequest(`${this.baseApiUrl}/execution/inputs?context_id=${contextId}&limit=20`);
|
|
449
468
|
}
|
|
450
469
|
catch (error) {
|
|
451
470
|
throw toApiError(`Failed to get emails for session ID ${sessionId} with error`, error);
|
|
@@ -458,7 +477,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
458
477
|
context_id: contextId,
|
|
459
478
|
workspace_id: workspaceId,
|
|
460
479
|
};
|
|
461
|
-
return await this.makePostRequestWithRetries(`${
|
|
480
|
+
return await this.makePostRequestWithRetries(`${this.baseApiUrl}/mailbox/address`, body);
|
|
462
481
|
}
|
|
463
482
|
catch (error) {
|
|
464
483
|
throw toApiError('Failed to create mailbox email address', error);
|
|
@@ -470,7 +489,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
470
489
|
workspace_id: workspaceId,
|
|
471
490
|
name: branchName,
|
|
472
491
|
};
|
|
473
|
-
return await this.makePostRequest(`${
|
|
492
|
+
return await this.makePostRequest(`${this.baseApiUrl}/branch`, body);
|
|
474
493
|
}
|
|
475
494
|
catch (error) {
|
|
476
495
|
throw toApiError(`Failed to create Branch [${branchName}]`, error);
|
|
@@ -483,7 +502,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
483
502
|
to: toBranchName,
|
|
484
503
|
};
|
|
485
504
|
const mergeQueryString = queryString.stringify(queryStringArgs);
|
|
486
|
-
const url = `${
|
|
505
|
+
const url = `${this.baseApiUrl}/branch/${workspaceId}/merge?${mergeQueryString}`;
|
|
487
506
|
return await this.makePostRequest(url, {});
|
|
488
507
|
}
|
|
489
508
|
catch (error) {
|
|
@@ -496,7 +515,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
496
515
|
target_content: targetContent,
|
|
497
516
|
target_entity_id: journeyRunId,
|
|
498
517
|
};
|
|
499
|
-
return await this.makePostRequest(`${
|
|
518
|
+
return await this.makePostRequest(`${this.baseApiUrl}/exports/journeyRuns/${journeyRunId}`, body);
|
|
500
519
|
}
|
|
501
520
|
catch (error) {
|
|
502
521
|
throw toApiError(`Failed to create export`, error);
|
|
@@ -505,7 +524,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
505
524
|
async postDeploymentEvent(options) {
|
|
506
525
|
try {
|
|
507
526
|
const requestBody = this.buildDeploymentRequestBody(options);
|
|
508
|
-
return await this.makePostRequestWithRetries(`${
|
|
527
|
+
return await this.makePostRequestWithRetries(`${this.baseApiUrl}/events/deployment/`, requestBody, DEPLOYMENT_EVENT_RETRY_CONFIG);
|
|
509
528
|
}
|
|
510
529
|
catch (error) {
|
|
511
530
|
throw toApiError(`Failed to create deployment`, error);
|
|
@@ -585,7 +604,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
585
604
|
async postPlanRun(organizationId, testId, branchName, browserTypes, appUrl, apiUrl, deploymentId, credentialsId, deploymentIds, basicAuthCredentialsId) {
|
|
586
605
|
try {
|
|
587
606
|
const requestBody = this.buildAdHocPlanRunRequestBody(organizationId, testId, browserTypes, branchName, appUrl, apiUrl, deploymentId, credentialsId, deploymentIds, basicAuthCredentialsId);
|
|
588
|
-
return await this.makePostRequest(`${
|
|
607
|
+
return await this.makePostRequest(`${this.baseApiUrl}/planRuns/`, requestBody);
|
|
589
608
|
}
|
|
590
609
|
catch (error) {
|
|
591
610
|
throw toApiError(`Failed to create planRun`, error);
|
|
@@ -645,7 +664,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
645
664
|
}
|
|
646
665
|
async createFlow(prototype) {
|
|
647
666
|
try {
|
|
648
|
-
return await this.makePostRequest(`${
|
|
667
|
+
return await this.makePostRequest(`${this.baseApiUrl}/flows`, prototype);
|
|
649
668
|
}
|
|
650
669
|
catch (error) {
|
|
651
670
|
throw toApiError(`Failed to create flow`, error);
|
|
@@ -653,7 +672,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
653
672
|
}
|
|
654
673
|
async createJourney(prototype) {
|
|
655
674
|
try {
|
|
656
|
-
return await this.makePostRequest(`${
|
|
675
|
+
return await this.makePostRequest(`${this.baseApiUrl}/test/journeys`, prototype);
|
|
657
676
|
}
|
|
658
677
|
catch (error) {
|
|
659
678
|
throw toApiError(`Failed to create journey`, error);
|
|
@@ -661,7 +680,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
661
680
|
}
|
|
662
681
|
async getJourneyRun(journeyRunId) {
|
|
663
682
|
try {
|
|
664
|
-
return await this.makeGetRequestWithETag(`${
|
|
683
|
+
return await this.makeGetRequestWithETag(`${this.baseApiUrl}/journeyRuns/${journeyRunId}`);
|
|
665
684
|
}
|
|
666
685
|
catch (error) {
|
|
667
686
|
throw toApiError(`Failed to get journey run info`, error);
|
|
@@ -669,7 +688,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
669
688
|
}
|
|
670
689
|
async updateJourneyRun(journeyRunId, journeyRunUpdate, ifMatch) {
|
|
671
690
|
try {
|
|
672
|
-
const response = await this.makePatchRequest(`${
|
|
691
|
+
const response = await this.makePatchRequest(`${this.baseApiUrl}/journeyRuns/${journeyRunId}`, journeyRunUpdate, ifMatch);
|
|
673
692
|
return response;
|
|
674
693
|
}
|
|
675
694
|
catch (error) {
|
|
@@ -678,7 +697,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
678
697
|
}
|
|
679
698
|
async failJourneyRun(journeyRunId, cause) {
|
|
680
699
|
try {
|
|
681
|
-
const response = await this.makePatchRequest(`${
|
|
700
|
+
const response = await this.makePatchRequest(`${this.baseApiUrl}/journeyRuns/${journeyRunId}`, {
|
|
682
701
|
status: mablApi_1.JourneyRun.StatusEnum.Failed,
|
|
683
702
|
status_cause: cause,
|
|
684
703
|
});
|
|
@@ -693,7 +712,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
693
712
|
terminationReason: terminationReason.toString(),
|
|
694
713
|
});
|
|
695
714
|
try {
|
|
696
|
-
const response = await this.makePostRequest(`${
|
|
715
|
+
const response = await this.makePostRequest(`${this.baseApiUrl}/journeyRun/${journeyRunId}/terminate?${terminateParams}`);
|
|
697
716
|
return response;
|
|
698
717
|
}
|
|
699
718
|
catch (error) {
|
|
@@ -701,7 +720,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
701
720
|
}
|
|
702
721
|
}
|
|
703
722
|
async copyWorkspace(sourceWorkspaceId, destinationWorkspaceId) {
|
|
704
|
-
return this.makePostRequest(`${
|
|
723
|
+
return this.makePostRequest(`${this.baseApiUrl}/copy/organizations?source_workspace_id=${sourceWorkspaceId}&destination_workspace_id=${destinationWorkspaceId}`, {}, {
|
|
705
724
|
timeout: 3600000,
|
|
706
725
|
});
|
|
707
726
|
}
|