@mablhq/mabl-cli 2.20.7 → 2.21.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/core/execution/VariableUtils.js +11 -1
- package/domUtil/index.js +1 -1
- package/execution/index.js +2 -2
- package/mablApi/index.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +1 -1
- package/resources/mablFind.js +1 -1
- package/upload/index.js +1 -1
- package/util/TestOutputWriter.js +8 -2
- package/util/pureUtil.js +25 -5
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.traverseAndReplaceStrings = 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,12 +144,32 @@ function getCaseInsensitiveProperty(obj, key) {
|
|
|
144
144
|
return undefined;
|
|
145
145
|
}
|
|
146
146
|
exports.getCaseInsensitiveProperty = getCaseInsensitiveProperty;
|
|
147
|
-
function
|
|
148
|
-
return
|
|
147
|
+
function createStringAndBufferReplacer(textReplacer) {
|
|
148
|
+
return (key, value) => {
|
|
149
|
+
if (key === 'type' && value === 'Buffer') {
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
149
152
|
if (typeof value === 'string') {
|
|
150
|
-
return
|
|
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();
|
|
151
166
|
}
|
|
152
167
|
return value;
|
|
153
|
-
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
exports.createStringAndBufferReplacer = createStringAndBufferReplacer;
|
|
171
|
+
function traverseAndReplaceStrings(obj, replace) {
|
|
172
|
+
const replacer = createStringAndBufferReplacer(replace);
|
|
173
|
+
return JSON.parse(JSON.stringify(obj, replacer));
|
|
154
174
|
}
|
|
155
175
|
exports.traverseAndReplaceStrings = traverseAndReplaceStrings;
|