@mablhq/mabl-cli 2.46.4 → 2.46.12
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/api/mablApiClient.js +19 -7
- package/core/entityValidation/stepValidation.js +15 -0
- package/core/execution/ApiTestUtils.js +3 -1
- package/execution/index.js +2 -2
- package/index.d.ts +5 -1
- package/mablApi/index.js +1 -1
- package/mablscript/types/ConditionDescriptor.js +2 -0
- package/package.json +1 -1
- package/upload/index.js +1 -1
- package/util/analytics-events.js +1 -0
package/api/mablApiClient.js
CHANGED
|
@@ -11,6 +11,12 @@ const cliConfigProvider_1 = require("../providers/cliConfigProvider");
|
|
|
11
11
|
const basicApiClient_1 = require("./basicApiClient");
|
|
12
12
|
const query_string_1 = __importDefault(require("query-string"));
|
|
13
13
|
const featureSet_1 = require("./featureSet");
|
|
14
|
+
const GENAI_RETRY_OPTIONS = {
|
|
15
|
+
retryCount: 10,
|
|
16
|
+
minRetryIntervalMillis: 10000,
|
|
17
|
+
maxRetryIntervalMillis: 60000,
|
|
18
|
+
maxRetryTimeMillis: 180000,
|
|
19
|
+
};
|
|
14
20
|
class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
15
21
|
constructor(options) {
|
|
16
22
|
var _a, _b;
|
|
@@ -580,6 +586,18 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
580
586
|
throw toApiError(`Failed to update mailbox ${mailboxId} with error`, error);
|
|
581
587
|
}
|
|
582
588
|
}
|
|
589
|
+
async generateSteps(workspaceId, intent, context) {
|
|
590
|
+
const body = {
|
|
591
|
+
intent,
|
|
592
|
+
context,
|
|
593
|
+
};
|
|
594
|
+
try {
|
|
595
|
+
return await this.makePostRequestWithRetries(`${this.baseApiUrl}/generate/steps?workspaceId=${workspaceId}`, body, GENAI_RETRY_OPTIONS);
|
|
596
|
+
}
|
|
597
|
+
catch (error) {
|
|
598
|
+
throw toApiError('Failed to generate steps', error);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
583
601
|
async evaluateAiAssertion(workspaceId, testRunId, screenshot, userPrompt, metaPrompt, criteria, test) {
|
|
584
602
|
try {
|
|
585
603
|
const body = {
|
|
@@ -595,13 +613,7 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
|
|
|
595
613
|
meta_prompt: metaPrompt,
|
|
596
614
|
};
|
|
597
615
|
}
|
|
598
|
-
|
|
599
|
-
retryCount: 10,
|
|
600
|
-
minRetryIntervalMillis: 10000,
|
|
601
|
-
maxRetryIntervalMillis: 60000,
|
|
602
|
-
maxRetryTimeMillis: 180000,
|
|
603
|
-
};
|
|
604
|
-
return await this.makePostRequestWithRetries(`${this.baseApiUrl}/analysis/${workspaceId}/assertion/evaluate`, body, retryOptions);
|
|
616
|
+
return await this.makePostRequestWithRetries(`${this.baseApiUrl}/analysis/${workspaceId}/assertion/evaluate`, body, GENAI_RETRY_OPTIONS);
|
|
605
617
|
}
|
|
606
618
|
catch (error) {
|
|
607
619
|
throw toApiError('Failed to evaluate the AI prompt assertion', error);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractFromRegexLiteral = exports.REGEXP_LITERAL_PATTERN = void 0;
|
|
4
|
+
exports.REGEXP_LITERAL_PATTERN = /^\/(.*)\/([dgimsuvy]*)$/;
|
|
5
|
+
function extractFromRegexLiteral(regexString) {
|
|
6
|
+
const matches = regexString.match(exports.REGEXP_LITERAL_PATTERN);
|
|
7
|
+
if (!matches) {
|
|
8
|
+
throw new Error(`Invalid regex format. Expected format: /pattern/flags. Received: ${regexString}`);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
pattern: matches[1],
|
|
12
|
+
flags: matches[2],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.extractFromRegexLiteral = extractFromRegexLiteral;
|
|
@@ -9,6 +9,7 @@ const newman_types_1 = require("./newman-types");
|
|
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
10
|
const uuid_1 = require("uuid");
|
|
11
11
|
const encodingUtil_1 = require("../../util/encodingUtil");
|
|
12
|
+
const stepValidation_1 = require("../entityValidation/stepValidation");
|
|
12
13
|
exports.TEST_LISTEN = 'test';
|
|
13
14
|
exports.MABL_GENERATED_ASSERTION_TOKEN = '__MABL_GENERATED__';
|
|
14
15
|
exports.MABL_GENERATED_COMMENT = `// ${exports.MABL_GENERATED_ASSERTION_TOKEN} Do not edit below this line`;
|
|
@@ -215,6 +216,7 @@ exports.findFirstMatchingEvent = findFirstMatchingEvent;
|
|
|
215
216
|
function createEmptyRequestEvent() {
|
|
216
217
|
return {
|
|
217
218
|
listen: exports.TEST_LISTEN,
|
|
219
|
+
id: (0, exports.uuid)(),
|
|
218
220
|
script: {
|
|
219
221
|
exec: [],
|
|
220
222
|
raw: '',
|
|
@@ -295,7 +297,7 @@ function normalizeRegExpExpectedValue(value) {
|
|
|
295
297
|
return;
|
|
296
298
|
}
|
|
297
299
|
value = value.trim();
|
|
298
|
-
if (value.match(
|
|
300
|
+
if (value.match(stepValidation_1.REGEXP_LITERAL_PATTERN)) {
|
|
299
301
|
return value;
|
|
300
302
|
}
|
|
301
303
|
return `new RegExp(${JSON.stringify(value)})`;
|