@mablhq/mabl-cli 2.19.13 → 2.20.10
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/mablApiClient.js +2 -2
- package/commands/tests/tests_cmds/run-cloud.js +1 -1
- package/core/execution/PostmanUtils.js +53 -0
- package/core/execution/VariableUtils.js +144 -0
- package/execution/index.js +1 -1
- package/mablscript/steps/IfConditionStep.js +3 -1
- package/package.json +1 -1
- package/util/TestOutputWriter.js +8 -2
- package/util/pureUtil.js +30 -1
|
@@ -56,7 +56,9 @@ class IfConditionStep extends MablStep_1.MablStep {
|
|
|
56
56
|
return result;
|
|
57
57
|
}
|
|
58
58
|
toYamlConditionDetails() {
|
|
59
|
-
const details = {
|
|
59
|
+
const details = {
|
|
60
|
+
...super.annotationsAsYml(),
|
|
61
|
+
};
|
|
60
62
|
if (this.conditionAction) {
|
|
61
63
|
details.condition =
|
|
62
64
|
AssertStep_1.fieldToAssertionStep[this.conditionAction.conditionAttribute];
|
package/package.json
CHANGED
package/util/TestOutputWriter.js
CHANGED
|
@@ -44,9 +44,12 @@ class LocalTestOutputWriter {
|
|
|
44
44
|
fs.writeFileSync(localPath, data);
|
|
45
45
|
return Promise.resolve(localPath);
|
|
46
46
|
}
|
|
47
|
-
writeObjectAsJson(name, data) {
|
|
47
|
+
writeObjectAsJson(name, data, replacer, reviver) {
|
|
48
48
|
const localPath = `${this.outputDir}/${name}`;
|
|
49
49
|
this.maybeCreateDirectory(localPath);
|
|
50
|
+
if (replacer || reviver) {
|
|
51
|
+
data = JSON.parse(JSON.stringify(data, replacer), reviver);
|
|
52
|
+
}
|
|
50
53
|
fs.writeFileSync(localPath, JSON.stringify(data));
|
|
51
54
|
return Promise.resolve(localPath);
|
|
52
55
|
}
|
|
@@ -66,7 +69,10 @@ class CloudOutputWriter {
|
|
|
66
69
|
this.planRunId = planRunId;
|
|
67
70
|
this.testRunId = testRunId;
|
|
68
71
|
}
|
|
69
|
-
async writeObjectAsJson(name, data) {
|
|
72
|
+
async writeObjectAsJson(name, data, replacer, reviver) {
|
|
73
|
+
if (replacer || reviver) {
|
|
74
|
+
data = JSON.parse(JSON.stringify(data, replacer), reviver);
|
|
75
|
+
}
|
|
70
76
|
return this.write(name, 'application/json', Buffer.from(JSON.stringify(data)));
|
|
71
77
|
}
|
|
72
78
|
async write(name, contentType, data) {
|
package/util/pureUtil.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getCaseInsensitiveProperty = exports.extractKeyCountsFromArgs = exports.getCliName = exports.getCliVersion = exports.stringifyIfPresent = exports.stringify = exports.isRejectedPromise = exports.isFulfilledPromise = exports.isWholeNumber = exports.isString = exports.isNullish = exports.isDefined = void 0;
|
|
26
|
+
exports.traverseAndReplaceStrings = exports.createStringAndBufferReplacer = exports.getCaseInsensitiveProperty = exports.extractKeyCountsFromArgs = exports.getCliName = exports.getCliVersion = exports.stringifyIfPresent = exports.stringify = exports.isRejectedPromise = exports.isFulfilledPromise = exports.isWholeNumber = exports.isString = exports.isNullish = exports.isDefined = void 0;
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
29
|
const possibleCliPackagePaths = Object.freeze([
|
|
@@ -144,3 +144,32 @@ function getCaseInsensitiveProperty(obj, key) {
|
|
|
144
144
|
return undefined;
|
|
145
145
|
}
|
|
146
146
|
exports.getCaseInsensitiveProperty = getCaseInsensitiveProperty;
|
|
147
|
+
function createStringAndBufferReplacer(textReplacer) {
|
|
148
|
+
return (key, value) => {
|
|
149
|
+
if (key === 'type' && value === 'Buffer') {
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
if (typeof value === 'string') {
|
|
153
|
+
return textReplacer(value);
|
|
154
|
+
}
|
|
155
|
+
if (typeof value === 'object' && value instanceof Buffer) {
|
|
156
|
+
return Buffer.from(textReplacer(value.toString()));
|
|
157
|
+
}
|
|
158
|
+
if (typeof value === 'object' &&
|
|
159
|
+
value !== null &&
|
|
160
|
+
value.type === 'Buffer' &&
|
|
161
|
+
Array.isArray(value.data)) {
|
|
162
|
+
const dataAsString = Buffer.from(value.data).toString();
|
|
163
|
+
const maskedData = textReplacer(dataAsString);
|
|
164
|
+
const newBuffer = Buffer.from(maskedData);
|
|
165
|
+
return newBuffer.toJSON();
|
|
166
|
+
}
|
|
167
|
+
return value;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
exports.createStringAndBufferReplacer = createStringAndBufferReplacer;
|
|
171
|
+
function traverseAndReplaceStrings(obj, replace) {
|
|
172
|
+
const replacer = createStringAndBufferReplacer(replace);
|
|
173
|
+
return JSON.parse(JSON.stringify(obj, replacer));
|
|
174
|
+
}
|
|
175
|
+
exports.traverseAndReplaceStrings = traverseAndReplaceStrings;
|