@mablhq/mabl-cli 2.99.12 → 2.100.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/api/mablApiClient.js +19 -3
- package/browserLauncher/index.js +2 -2
- package/commands/datatables/datatables_cmds/update.js +39 -69
- package/commands/datatables/utils.js +0 -27
- package/commands/tests/tests_cmds/create.js +58 -0
- package/core/execution/ApiTestUtils.js +1 -3
- package/core/execution/PostmanUtils.js +2 -1
- package/core/execution/VariableUtils.js +10 -14
- package/execution/index.js +1 -1
- package/package.json +1 -1
- package/trainer/generation/saveGeneratedTest.js +3 -1
- package/trainer/generation/test-save/saveTest.js +9 -1
- package/trainer/generation/toolExecutors/CreateMablMailboxExecutor.js +3 -3
- package/trainer/generation/toolExecutors/RecordSnippetExecutor.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/AccessibilityCheckStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/AssertStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/AssertVariableStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/AwaitTabStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/AwaitUploadStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/ClearCookiesStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/ClickAndHoldStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/ClickStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/CreateVariableStep.js +8 -6
- package/trainer/sharedUtils/mablscript/canonical/DatabaseQueryStep.js +4 -4
- package/trainer/sharedUtils/mablscript/canonical/DoubleClickStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/DownloadBaseStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/DownloadPdfStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/EchoStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/ElseStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/EndStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/EnterAuthCodeStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/EnterTextStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/EvaluateJSStep.js +3 -3
- package/trainer/sharedUtils/mablscript/canonical/HoverStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/KeyPressStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/MablStepAdapter.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/NavigationStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/OpenEmailStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/ReleaseStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/RemoveCookieStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/RightClickStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/SelectStep.js +4 -2
- package/trainer/sharedUtils/mablscript/canonical/SendHttpRequestStep.js +4 -4
- package/trainer/sharedUtils/mablscript/canonical/SetCookieStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/SetFilesStep.js +2 -1
- package/trainer/sharedUtils/mablscript/canonical/StepWithFind.js +1 -3
- package/trainer/sharedUtils/mablscript/canonical/SwitchContextToStep.js +3 -2
- package/trainer/sharedUtils/mablscript/canonical/ViewportStep.js +2 -2
- package/trainer/sharedUtils/mablscript/canonical/VisitUrlStep.js +3 -3
- package/trainer/sharedUtils/mablscript/canonical/WaitStep.js +2 -2
- package/trainer/sharedUtils/mablscript/extended/ExecuteFlowStep.js +3 -3
- package/trainer/sharedUtils/mablscript/extended/ExecuteStepGroupStep.js +2 -2
- package/trainer/sharedUtils/variable-utils.js +1 -3
- package/upload/index.js +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateScenarios = validateScenarios;
|
|
4
4
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
5
5
|
const util_1 = require("../../commandUtil/util");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
7
|
-
const pureUtil_1 = require("../../../util/pureUtil");
|
|
8
7
|
const utils_1 = require("../utils");
|
|
9
8
|
const domUtil_1 = require("../../../domUtil");
|
|
9
|
+
const logUtils_1 = require("../../../util/logUtils");
|
|
10
|
+
const pureUtil_1 = require("../../../util/pureUtil");
|
|
10
11
|
exports.command = `update <${constants_1.CommandArgId}> <${constants_1.CommandArgInput}>`;
|
|
11
12
|
exports.describe = 'Update a mabl DataTable';
|
|
12
13
|
exports.builder = (yargs) => {
|
|
@@ -32,27 +33,8 @@ exports.builder = (yargs) => {
|
|
|
32
33
|
});
|
|
33
34
|
};
|
|
34
35
|
exports.handler = (0, util_1.failWrapper)(updateDataTable);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const format = parsed.format ?? (0, utils_1.inferFileFormat)(input);
|
|
38
|
-
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
39
|
-
const dataTable = await apiClient.getDataTable(dataTableId);
|
|
40
|
-
let scenarios;
|
|
41
|
-
switch (format) {
|
|
42
|
-
case constants_1.OutputFormats.Json:
|
|
43
|
-
scenarios = (0, utils_1.parseJsonScenarios)(input);
|
|
44
|
-
break;
|
|
45
|
-
case constants_1.OutputFormats.Csv:
|
|
46
|
-
scenarios = await (0, utils_1.parseCsvScenarios)(input);
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
throw Error(`${format} is not a valid option.`);
|
|
50
|
-
}
|
|
51
|
-
const request = buildUpdateRequest(scenarios, dataTable);
|
|
52
|
-
await apiClient.updateDataTable(dataTableId, request);
|
|
53
|
-
}
|
|
54
|
-
function buildUpdateRequest(scenarios, dataTable) {
|
|
55
|
-
if (scenarios.length === 0 || !scenarios) {
|
|
36
|
+
function validateScenarios(scenarios, dataTable) {
|
|
37
|
+
if (!scenarios || scenarios.length === 0) {
|
|
56
38
|
throw Error('Must have at least 1 scenario in DataTable.');
|
|
57
39
|
}
|
|
58
40
|
const validationVariables = scenarios[0].variables;
|
|
@@ -60,7 +42,7 @@ function buildUpdateRequest(scenarios, dataTable) {
|
|
|
60
42
|
if (scenario.id && !dataTable.scenario_ids?.includes(scenario.id)) {
|
|
61
43
|
throw Error(`Scenario in input with ID ${scenario.id} does not exist in DataTable scenario_ids.`);
|
|
62
44
|
}
|
|
63
|
-
if (scenario.variables
|
|
45
|
+
if (!scenario.variables || scenario.variables.length === 0) {
|
|
64
46
|
throw Error('Must have at least 1 variable in a scenario.');
|
|
65
47
|
}
|
|
66
48
|
if (scenario.variables.length !== validationVariables?.length) {
|
|
@@ -75,49 +57,37 @@ function buildUpdateRequest(scenarios, dataTable) {
|
|
|
75
57
|
}
|
|
76
58
|
});
|
|
77
59
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
112
|
-
const deletedRowIds = dataTable.scenario_ids?.filter((id) => !updatedRowIds.includes(id)) ?? [];
|
|
113
|
-
const prototype = {
|
|
114
|
-
...(0, utils_1.dataTableAsVariableTable)(dataTable),
|
|
115
|
-
row_ids: updatedRows.map((row) => row.id).filter(pureUtil_1.isDefined),
|
|
116
|
-
};
|
|
117
|
-
return {
|
|
118
|
-
prototype,
|
|
119
|
-
updatedRows,
|
|
120
|
-
deletedRowIds,
|
|
121
|
-
addedRows,
|
|
122
|
-
};
|
|
60
|
+
}
|
|
61
|
+
async function updateDataTable(parsed) {
|
|
62
|
+
const { id: dataTableId, input } = parsed;
|
|
63
|
+
const format = parsed.format ?? (0, utils_1.inferFileFormat)(input);
|
|
64
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
65
|
+
const dataTable = await apiClient.getDataTable(dataTableId);
|
|
66
|
+
let scenarios;
|
|
67
|
+
switch (format) {
|
|
68
|
+
case constants_1.OutputFormats.Json:
|
|
69
|
+
scenarios = (0, utils_1.parseJsonScenarios)(input);
|
|
70
|
+
break;
|
|
71
|
+
case constants_1.OutputFormats.Csv:
|
|
72
|
+
scenarios = await (0, utils_1.parseCsvScenarios)(input);
|
|
73
|
+
break;
|
|
74
|
+
default:
|
|
75
|
+
throw Error(`${format} is not a valid option.`);
|
|
76
|
+
}
|
|
77
|
+
validateScenarios(scenarios, dataTable);
|
|
78
|
+
const scenariosToUpdate = scenarios.filter((scenario) => scenario.id !== undefined);
|
|
79
|
+
const scenariosToCreate = scenarios.filter((scenario) => scenario.id === undefined);
|
|
80
|
+
const inputScenarioIds = new Set(scenariosToUpdate.map((scenario) => scenario.id));
|
|
81
|
+
const scenarioIdsToRemove = (dataTable.scenario_ids ?? []).filter((id) => !inputScenarioIds.has(id));
|
|
82
|
+
const updateResults = await Promise.allSettled(scenariosToUpdate.map((scenario) => apiClient.putScenario(scenario.id, scenario)));
|
|
83
|
+
(0, logUtils_1.logPromiseSettledRejections)(updateResults);
|
|
84
|
+
const createResults = await Promise.allSettled(scenariosToCreate.map((scenario) => apiClient.createScenario(dataTableId, scenario)));
|
|
85
|
+
(0, logUtils_1.logPromiseSettledRejections)(createResults);
|
|
86
|
+
const removeResults = await Promise.allSettled(scenarioIdsToRemove.map((scenarioId) => apiClient.removeScenario(scenarioId)));
|
|
87
|
+
(0, logUtils_1.logPromiseSettledRejections)(removeResults);
|
|
88
|
+
if (updateResults.some(pureUtil_1.isRejectedPromise) ||
|
|
89
|
+
createResults.some(pureUtil_1.isRejectedPromise) ||
|
|
90
|
+
removeResults.some(pureUtil_1.isRejectedPromise)) {
|
|
91
|
+
throw new Error('Some DataTable operations failed. See above for details.');
|
|
92
|
+
}
|
|
123
93
|
}
|
|
@@ -11,8 +11,6 @@ exports.parseJsonScenarios = parseJsonScenarios;
|
|
|
11
11
|
exports.jsonToScenarios = jsonToScenarios;
|
|
12
12
|
exports.inferFileFormat = inferFileFormat;
|
|
13
13
|
exports.isScenarioArray = isScenarioArray;
|
|
14
|
-
exports.dataTableAsVariableTable = dataTableAsVariableTable;
|
|
15
|
-
exports.scenarioAsVariableRow = scenarioAsVariableRow;
|
|
16
14
|
exports.variableRowAsScenario = variableRowAsScenario;
|
|
17
15
|
const constants_1 = require("../constants");
|
|
18
16
|
const path_1 = require("path");
|
|
@@ -101,31 +99,6 @@ function isScenario(arg) {
|
|
|
101
99
|
function isScenarioArray(arg) {
|
|
102
100
|
return Array.isArray(arg) && arg.every((scenario) => isScenario(scenario));
|
|
103
101
|
}
|
|
104
|
-
function dataTableAsVariableTable(dataTable) {
|
|
105
|
-
return {
|
|
106
|
-
id: dataTable.id,
|
|
107
|
-
organization_id: dataTable.workspace_id,
|
|
108
|
-
name: dataTable.name,
|
|
109
|
-
created_time: dataTable.created_time,
|
|
110
|
-
created_by_id: dataTable.created_by_id,
|
|
111
|
-
last_updated_time: dataTable.last_updated_time,
|
|
112
|
-
last_updated_by_id: dataTable.last_updated_by_id,
|
|
113
|
-
row_ids: dataTable.scenario_ids,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function scenarioAsVariableRow(scenario) {
|
|
117
|
-
return {
|
|
118
|
-
id: scenario?.id,
|
|
119
|
-
table_id: scenario?.table_id,
|
|
120
|
-
created_time: scenario?.created_time,
|
|
121
|
-
created_by_id: scenario?.created_by_id,
|
|
122
|
-
last_updated_time: scenario?.last_updated_time,
|
|
123
|
-
last_updated_by_id: scenario?.last_updated_by_id,
|
|
124
|
-
organization_id: scenario?.workspace_id,
|
|
125
|
-
scenario_id: scenario?.name,
|
|
126
|
-
row: scenario?.variables,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
102
|
function variableRowAsScenario(variableRow) {
|
|
130
103
|
if (isScenario(variableRow)) {
|
|
131
104
|
return variableRow;
|
|
@@ -41,9 +41,13 @@ const runAgenticGeneration_1 = require("../../../trainer/cli/runAgenticGeneratio
|
|
|
41
41
|
const mablApiClientFactory_1 = require("../../../api/mablApiClientFactory");
|
|
42
42
|
const pureUtil_1 = require("../../../util/pureUtil");
|
|
43
43
|
const saveGeneratedTest_1 = require("../../../trainer/generation/saveGeneratedTest");
|
|
44
|
+
const ViewportStep_1 = __importStar(require("../../../trainer/sharedUtils/mablscript/canonical/ViewportStep"));
|
|
45
|
+
const VisitUrlStep_1 = __importStar(require("../../../trainer/sharedUtils/mablscript/canonical/VisitUrlStep"));
|
|
44
46
|
const inquirer = __importStar(require("inquirer"));
|
|
45
47
|
const chalk = require('chalk');
|
|
46
48
|
const CommandArgAutoSave = 'save';
|
|
49
|
+
const CommandArgDisabled = 'disabled';
|
|
50
|
+
const CommandArgEmpty = 'empty';
|
|
47
51
|
var PostGenerationActions;
|
|
48
52
|
(function (PostGenerationActions) {
|
|
49
53
|
PostGenerationActions["Save"] = "Save the test";
|
|
@@ -136,6 +140,16 @@ exports.builder = (yargs) => {
|
|
|
136
140
|
describe: 'Intent for the test, e.g. "smoke", "regression"',
|
|
137
141
|
nargs: 1,
|
|
138
142
|
type: 'string',
|
|
143
|
+
})
|
|
144
|
+
.option(CommandArgDisabled, {
|
|
145
|
+
describe: 'Create the test in a disabled state',
|
|
146
|
+
type: 'boolean',
|
|
147
|
+
default: false,
|
|
148
|
+
})
|
|
149
|
+
.option(CommandArgEmpty, {
|
|
150
|
+
describe: 'Create a minimal test with only viewport and visit-URL steps',
|
|
151
|
+
type: 'boolean',
|
|
152
|
+
default: false,
|
|
139
153
|
})
|
|
140
154
|
.option(constants_1.CommandArgTestIntent, {
|
|
141
155
|
hidden: true,
|
|
@@ -186,7 +200,48 @@ async function launchTrainingSession(parsed) {
|
|
|
186
200
|
const labels = parsed[constants_1.CommandArgLabels];
|
|
187
201
|
const dataTableIds = parsed[constants_1.CommandArgDataTables];
|
|
188
202
|
const intent = parsed[constants_1.CommandArgIntent];
|
|
203
|
+
const disabled = parsed[CommandArgDisabled];
|
|
204
|
+
const enabled = disabled ? false : undefined;
|
|
189
205
|
const testIntent = parsed[constants_1.CommandArgTestIntent];
|
|
206
|
+
if (parsed[CommandArgEmpty]) {
|
|
207
|
+
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
208
|
+
const viewportStep = new ViewportStep_1.default({ width, height });
|
|
209
|
+
const visitUrlStep = new VisitUrlStep_1.default(url);
|
|
210
|
+
const rawSteps = [viewportStep, visitUrlStep];
|
|
211
|
+
const stepDescriptions = [
|
|
212
|
+
(0, ViewportStep_1.humanizeViewportStep)(viewportStep),
|
|
213
|
+
(0, VisitUrlStep_1.humanizeVisitUrlStep)(visitUrlStep),
|
|
214
|
+
];
|
|
215
|
+
console.log(chalk.cyan('Creating empty test...'));
|
|
216
|
+
const result = await (0, saveGeneratedTest_1.saveGeneratedTest)({
|
|
217
|
+
apiClient,
|
|
218
|
+
workspaceId,
|
|
219
|
+
applicationId,
|
|
220
|
+
url,
|
|
221
|
+
testName,
|
|
222
|
+
testDescription,
|
|
223
|
+
labels,
|
|
224
|
+
rawSteps,
|
|
225
|
+
stepDescriptions,
|
|
226
|
+
credentialsId,
|
|
227
|
+
enabled,
|
|
228
|
+
testIntent,
|
|
229
|
+
});
|
|
230
|
+
if (result.success) {
|
|
231
|
+
console.log(chalk.green('\nTest saved successfully!'));
|
|
232
|
+
if (result.testId) {
|
|
233
|
+
console.log(chalk.gray(' Test ID:'), chalk.white(result.testId));
|
|
234
|
+
}
|
|
235
|
+
if (result.testUrl) {
|
|
236
|
+
console.log(chalk.gray(' View:'), chalk.cyan(result.testUrl));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
console.error(chalk.red('Failed to save test:'), result.error);
|
|
241
|
+
throw new Error(result.error);
|
|
242
|
+
}
|
|
243
|
+
return 'done';
|
|
244
|
+
}
|
|
190
245
|
const headless = parsed[constants_1.CommandArgHeadless];
|
|
191
246
|
const verbose = parsed[constants_1.CommandArgVerbose];
|
|
192
247
|
const outputScreenshots = parsed[constants_1.CommandArgOutputScreenshots];
|
|
@@ -229,6 +284,7 @@ async function launchTrainingSession(parsed) {
|
|
|
229
284
|
apiClient,
|
|
230
285
|
result,
|
|
231
286
|
autoSave: false,
|
|
287
|
+
enabled,
|
|
232
288
|
});
|
|
233
289
|
}
|
|
234
290
|
else {
|
|
@@ -241,6 +297,7 @@ async function launchTrainingSession(parsed) {
|
|
|
241
297
|
apiClient,
|
|
242
298
|
result,
|
|
243
299
|
autoSave: false,
|
|
300
|
+
enabled,
|
|
244
301
|
});
|
|
245
302
|
}
|
|
246
303
|
return 'done';
|
|
@@ -305,6 +362,7 @@ async function saveTestFromContext(context) {
|
|
|
305
362
|
testDescription: context.testIntent,
|
|
306
363
|
rawSteps: context.result.rawSteps,
|
|
307
364
|
stepDescriptions: context.result.steps,
|
|
365
|
+
enabled: context.enabled,
|
|
308
366
|
});
|
|
309
367
|
if (result.success) {
|
|
310
368
|
console.log(chalk.green('✓ Test saved successfully!'));
|
|
@@ -3,7 +3,7 @@ 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.uuid = exports.createEmptyRequest = exports.PRE_REQUEST_LISTEN = exports.
|
|
6
|
+
exports.uuid = exports.createEmptyRequest = exports.PRE_REQUEST_LISTEN = exports.ASSERT_TYPES = exports.ASSERT_TARGETS = exports.COLLECTION_WITH_FOLDERS_ERROR = exports.DEFAULT_OAUTH2_GRANT_TYPE = exports.DEFAULT_OAUTH2_CLIENT_CREDENTIALS_LOCATION = exports.HMAC_SHA1_SIGNATURE = exports.DEFAULT_ADD_OAUTH1_TO_HEADER_VALUE = exports.DEFAULT_OAUTH1_VERSION = exports.OAUTH2_AUTH = exports.OAUTH1_AUTH = exports.NO_AUTH = exports.BEARER_TOKEN_AUTH = exports.BASIC_AUTH = exports.API_KEY_AUTH = exports.INHERIT_AUTH_FROM_PARENT_VALUE = exports.MABL_GENERATED_COMMENT = exports.MABL_GENERATED_ASSERTION_TOKEN = exports.TEST_LISTEN = void 0;
|
|
7
7
|
exports.compareStringsCaseInsensitive = compareStringsCaseInsensitive;
|
|
8
8
|
exports.caseInsensitiveEquals = caseInsensitiveEquals;
|
|
9
9
|
exports.getAssertionTypesForTarget = getAssertionTypesForTarget;
|
|
@@ -244,8 +244,6 @@ function createEmptyVariable(contentType) {
|
|
|
244
244
|
description: '',
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
var api_test_dedup_1 = require("./api-test-dedup");
|
|
248
|
-
Object.defineProperty(exports, "deduplicateApiTestExecutionResults", { enumerable: true, get: function () { return api_test_dedup_1.deduplicateApiTestExecutionResults; } });
|
|
249
247
|
function restoreCustomRequestFields(postmanResult, collection) {
|
|
250
248
|
const requestItemsById = collection.item.reduce((collectionSet, itemDefinition) => {
|
|
251
249
|
collectionSet[itemDefinition.id] = itemDefinition;
|
|
@@ -4,6 +4,7 @@ exports.convertVariablesSummaryToPostmanFormat = convertVariablesSummaryToPostma
|
|
|
4
4
|
exports.exportVariables = exportVariables;
|
|
5
5
|
exports.sanitizeExportedVariables = sanitizeExportedVariables;
|
|
6
6
|
const VariableUtils_1 = require("./VariableUtils");
|
|
7
|
+
const variable_constants_1 = require("./variable-constants");
|
|
7
8
|
const domUtil_1 = require("../../domUtil");
|
|
8
9
|
function convertVariablesSummaryToPostmanFormat(summary) {
|
|
9
10
|
const effectiveVariables = { ...summary.effective };
|
|
@@ -24,7 +25,7 @@ function exportVariables(postmanResult) {
|
|
|
24
25
|
const exportedVariables = {};
|
|
25
26
|
variablePrecedence
|
|
26
27
|
.flatMap((variableList) => variableList.all())
|
|
27
|
-
.filter((variable) => Boolean(variable.key) && !variable.key?.startsWith(
|
|
28
|
+
.filter((variable) => Boolean(variable.key) && !variable.key?.startsWith(variable_constants_1.FLOW_NAMESPACE))
|
|
28
29
|
.forEach((variable) => (exportedVariables[variable.key] = variable.value));
|
|
29
30
|
return exportedVariables;
|
|
30
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.API_CREDENTIALS_PASSWORD_VARIABLE_NAME = exports.API_CREDENTIALS_USERNAME_VARIABLE_NAME = exports.API_CREDENTIALS_NAMESPACE = exports.API_URL_VARIABLE_NAME =
|
|
3
|
+
exports.API_CREDENTIALS_PASSWORD_VARIABLE_NAME = exports.API_CREDENTIALS_USERNAME_VARIABLE_NAME = exports.API_CREDENTIALS_NAMESPACE = exports.API_URL_VARIABLE_NAME = void 0;
|
|
4
4
|
exports.convertVariablesToPostmanFormat = convertVariablesToPostmanFormat;
|
|
5
5
|
exports.generateVariablesSummaryForImport = generateVariablesSummaryForImport;
|
|
6
6
|
exports.generateVariablesSummaryForExport = generateVariablesSummaryForExport;
|
|
@@ -8,13 +8,9 @@ exports.addFlowNamespace = addFlowNamespace;
|
|
|
8
8
|
exports.addUserNamespace = addUserNamespace;
|
|
9
9
|
exports.findUsedVariables = findUsedVariables;
|
|
10
10
|
const domUtil_1 = require("../../domUtil");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(exports, "API_NAMESPACE", { enumerable: true, get: function () { return variable_constants_1.API_NAMESPACE; } });
|
|
15
|
-
const variable_constants_2 = require("./variable-constants");
|
|
16
|
-
exports.API_URL_VARIABLE_NAME = `${variable_constants_2.API_NAMESPACE}url`;
|
|
17
|
-
exports.API_CREDENTIALS_NAMESPACE = `${variable_constants_2.API_NAMESPACE}credentials.`;
|
|
11
|
+
const variable_constants_1 = require("./variable-constants");
|
|
12
|
+
exports.API_URL_VARIABLE_NAME = `${variable_constants_1.API_NAMESPACE}url`;
|
|
13
|
+
exports.API_CREDENTIALS_NAMESPACE = `${variable_constants_1.API_NAMESPACE}credentials.`;
|
|
18
14
|
exports.API_CREDENTIALS_USERNAME_VARIABLE_NAME = `${exports.API_CREDENTIALS_NAMESPACE}username`;
|
|
19
15
|
exports.API_CREDENTIALS_PASSWORD_VARIABLE_NAME = `${exports.API_CREDENTIALS_NAMESPACE}password`;
|
|
20
16
|
function convertVariablesToPostmanFormat(value) {
|
|
@@ -128,10 +124,10 @@ function sanitizeVariables(variables) {
|
|
|
128
124
|
return sanitizedVariables;
|
|
129
125
|
}
|
|
130
126
|
function addFlowNamespaceToVariableNames(variables) {
|
|
131
|
-
return addPrefixToVariableNames(variables,
|
|
127
|
+
return addPrefixToVariableNames(variables, variable_constants_1.FLOW_NAMESPACE);
|
|
132
128
|
}
|
|
133
129
|
function addUserNamespaceToVariableNames(variables) {
|
|
134
|
-
return addPrefixToVariableNames(variables,
|
|
130
|
+
return addPrefixToVariableNames(variables, variable_constants_1.USER_NAMESPACE);
|
|
135
131
|
}
|
|
136
132
|
function addPrefixToVariableNames(variables, prefix) {
|
|
137
133
|
return mapVariables(variables, (variable) => ({
|
|
@@ -153,10 +149,10 @@ function extractValueParameters(parameters) {
|
|
|
153
149
|
return parameters.filter((parameter) => parameter.type?.toString() === 'value');
|
|
154
150
|
}
|
|
155
151
|
function removeFlowNamespace(variableName) {
|
|
156
|
-
return removePrefix(variableName,
|
|
152
|
+
return removePrefix(variableName, variable_constants_1.FLOW_NAMESPACE);
|
|
157
153
|
}
|
|
158
154
|
function removeUserNamespace(variableName) {
|
|
159
|
-
return removePrefix(variableName,
|
|
155
|
+
return removePrefix(variableName, variable_constants_1.USER_NAMESPACE);
|
|
160
156
|
}
|
|
161
157
|
function removePrefix(variableName, prefix) {
|
|
162
158
|
if (variableName.startsWith(prefix)) {
|
|
@@ -165,10 +161,10 @@ function removePrefix(variableName, prefix) {
|
|
|
165
161
|
return variableName;
|
|
166
162
|
}
|
|
167
163
|
function addFlowNamespace(variableName) {
|
|
168
|
-
return addPrefix(variableName,
|
|
164
|
+
return addPrefix(variableName, variable_constants_1.FLOW_NAMESPACE);
|
|
169
165
|
}
|
|
170
166
|
function addUserNamespace(variableName) {
|
|
171
|
-
return addPrefix(variableName,
|
|
167
|
+
return addPrefix(variableName, variable_constants_1.USER_NAMESPACE);
|
|
172
168
|
}
|
|
173
169
|
function addPrefix(variableName, prefix) {
|
|
174
170
|
if (variableName.startsWith(prefix)) {
|