@uipath/maestro-sdk 1.202.1-preview.220 → 1.202.1-preview.239
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/dist/debug-http-client.js +225 -7
- package/dist/debug-service.js +225 -7
- package/dist/index.js +226 -8
- package/dist/json-input.js +225 -7
- package/dist/registry/command.js +226 -8
- package/dist/registry/snapshot.js +225 -7
- package/dist/shared-commands/index.js +225 -7
- package/dist/shared-utils.js +225 -7
- package/dist/with-pims-call.js +225 -7
- package/package.json +2 -2
|
@@ -8026,7 +8026,165 @@ function requireJmespath() {
|
|
|
8026
8026
|
}
|
|
8027
8027
|
return codec;
|
|
8028
8028
|
}
|
|
8029
|
-
function
|
|
8029
|
+
function countRecords(data) {
|
|
8030
|
+
if (Array.isArray(data))
|
|
8031
|
+
return data.length;
|
|
8032
|
+
return data == null ? 0 : 1;
|
|
8033
|
+
}
|
|
8034
|
+
function availableFields(data) {
|
|
8035
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8036
|
+
const keys = new Set;
|
|
8037
|
+
for (const record of records) {
|
|
8038
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
8039
|
+
for (const key of Object.keys(record))
|
|
8040
|
+
keys.add(key);
|
|
8041
|
+
}
|
|
8042
|
+
}
|
|
8043
|
+
return [...keys];
|
|
8044
|
+
}
|
|
8045
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
8046
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
8047
|
+
if (!error && typeof decoded === "string")
|
|
8048
|
+
return decoded;
|
|
8049
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
8050
|
+
}
|
|
8051
|
+
function referencedFields(filter) {
|
|
8052
|
+
const top = new Set;
|
|
8053
|
+
const nested = new Set;
|
|
8054
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
8055
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
8056
|
+
const quoted = [];
|
|
8057
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
8058
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
8059
|
+
if (!isAlias) {
|
|
8060
|
+
quoted.push({
|
|
8061
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
8062
|
+
index,
|
|
8063
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
8064
|
+
});
|
|
8065
|
+
}
|
|
8066
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
8067
|
+
});
|
|
8068
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
8069
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
8070
|
+
const place = (name, index, tail) => {
|
|
8071
|
+
if (tail || index >= rootEnd)
|
|
8072
|
+
nested.add(name);
|
|
8073
|
+
else
|
|
8074
|
+
top.add(name);
|
|
8075
|
+
};
|
|
8076
|
+
for (const entry of quoted)
|
|
8077
|
+
place(entry.name, entry.index, entry.tail);
|
|
8078
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
8079
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
8080
|
+
for (const match of identifiers) {
|
|
8081
|
+
const [, name, trailing] = match;
|
|
8082
|
+
if (trailing || reserved.has(name))
|
|
8083
|
+
continue;
|
|
8084
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
8085
|
+
}
|
|
8086
|
+
return {
|
|
8087
|
+
top: [...top],
|
|
8088
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
8089
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
8090
|
+
};
|
|
8091
|
+
}
|
|
8092
|
+
function appearsBelowTopLevel(data, name) {
|
|
8093
|
+
let budget = 2000;
|
|
8094
|
+
const visit = (value, depth) => {
|
|
8095
|
+
if (budget-- <= 0 || depth > 4)
|
|
8096
|
+
return false;
|
|
8097
|
+
if (value === null || typeof value !== "object")
|
|
8098
|
+
return false;
|
|
8099
|
+
if (Array.isArray(value))
|
|
8100
|
+
return value.some((entry) => visit(entry, depth));
|
|
8101
|
+
const record = value;
|
|
8102
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
8103
|
+
return true;
|
|
8104
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
8105
|
+
};
|
|
8106
|
+
return visit(data, 0);
|
|
8107
|
+
}
|
|
8108
|
+
function alwaysNullKeys(records) {
|
|
8109
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
8110
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
8111
|
+
return [];
|
|
8112
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
8113
|
+
if (keys.length === 0)
|
|
8114
|
+
return [];
|
|
8115
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
8116
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
8117
|
+
}
|
|
8118
|
+
function carriesOnlyNulls(value) {
|
|
8119
|
+
if (value === null)
|
|
8120
|
+
return true;
|
|
8121
|
+
if (Array.isArray(value)) {
|
|
8122
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
8123
|
+
}
|
|
8124
|
+
if (typeof value === "object" && value !== undefined) {
|
|
8125
|
+
const values = Object.values(value);
|
|
8126
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
8127
|
+
}
|
|
8128
|
+
return false;
|
|
8129
|
+
}
|
|
8130
|
+
function nameList(names, cap2 = 12) {
|
|
8131
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
8132
|
+
const rest = names.length - shown.length;
|
|
8133
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8134
|
+
}
|
|
8135
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
8136
|
+
const present = availableFields(data);
|
|
8137
|
+
const refs = referencedFields(filter);
|
|
8138
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
8139
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
8140
|
+
const count = countRecords(data);
|
|
8141
|
+
const scope = `${count} record(s)`;
|
|
8142
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8143
|
+
const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
|
|
8144
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
8145
|
+
let detail;
|
|
8146
|
+
let lede;
|
|
8147
|
+
if (outcome.kind === "null-elements") {
|
|
8148
|
+
lede = "returned only null values";
|
|
8149
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
8150
|
+
if (unknown.length > 0) {
|
|
8151
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8152
|
+
} else if (unchecked.length > 0) {
|
|
8153
|
+
detail = withSoundness(projected);
|
|
8154
|
+
} else {
|
|
8155
|
+
detail = `${projected}, and every field it names exists — a multi-select list ` + `(\`[A, B]\`) reads each entry against \`Data\` itself, so on a list ` + `result use \`[].[A, B]\` or \`[].{a: A, b: B}\` to read the records`;
|
|
8156
|
+
}
|
|
8157
|
+
} else if (outcome.kind === "null-rows") {
|
|
8158
|
+
lede = "returned only null values";
|
|
8159
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
8160
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
8161
|
+
} else if (outcome.kind === "null-values") {
|
|
8162
|
+
lede = "returned only null values";
|
|
8163
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
8164
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
8165
|
+
if (sameSet) {
|
|
8166
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
8167
|
+
} else if (unknown.length > 0) {
|
|
8168
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8169
|
+
} else {
|
|
8170
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
8171
|
+
}
|
|
8172
|
+
} else {
|
|
8173
|
+
lede = "returned nothing";
|
|
8174
|
+
if (unknown.length > 0) {
|
|
8175
|
+
detail = isNotAField(unknown);
|
|
8176
|
+
} else {
|
|
8177
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
8178
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
8179
|
+
}
|
|
8180
|
+
}
|
|
8181
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
8182
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
8183
|
+
}
|
|
8184
|
+
function appendWarning(existing, note) {
|
|
8185
|
+
return existing ? `${existing} ${note}` : note;
|
|
8186
|
+
}
|
|
8187
|
+
function applyFilter(data, filter, onWarning) {
|
|
8030
8188
|
const codec = requireJmespath();
|
|
8031
8189
|
let result;
|
|
8032
8190
|
try {
|
|
@@ -8034,9 +8192,34 @@ function applyFilter(data, filter) {
|
|
|
8034
8192
|
} catch (err) {
|
|
8035
8193
|
throw new FilterEvaluationError(filter, err);
|
|
8036
8194
|
}
|
|
8037
|
-
|
|
8195
|
+
const inputCount = countRecords(data);
|
|
8196
|
+
const warn = (outcome) => {
|
|
8197
|
+
if (inputCount === 0)
|
|
8198
|
+
return;
|
|
8199
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
8200
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
8201
|
+
`);
|
|
8202
|
+
onWarning?.(note);
|
|
8203
|
+
};
|
|
8204
|
+
const warnIfAllNull = (records) => {
|
|
8205
|
+
const keys = alwaysNullKeys(records);
|
|
8206
|
+
if (keys.length > 0)
|
|
8207
|
+
warn({ kind: "null-values", keys });
|
|
8208
|
+
};
|
|
8209
|
+
if (result == null) {
|
|
8210
|
+
warn({ kind: "empty" });
|
|
8038
8211
|
return [];
|
|
8212
|
+
}
|
|
8039
8213
|
if (Array.isArray(result)) {
|
|
8214
|
+
if (result.length === 0) {
|
|
8215
|
+
warn({ kind: "empty" });
|
|
8216
|
+
} else if (result.every((entry) => entry === null)) {
|
|
8217
|
+
warn({ kind: "null-elements", count: result.length });
|
|
8218
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
8219
|
+
warn({ kind: "null-rows", count: result.length });
|
|
8220
|
+
} else {
|
|
8221
|
+
warnIfAllNull(result);
|
|
8222
|
+
}
|
|
8040
8223
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
8041
8224
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
8042
8225
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -8044,10 +8227,30 @@ function applyFilter(data, filter) {
|
|
|
8044
8227
|
}
|
|
8045
8228
|
return result;
|
|
8046
8229
|
}
|
|
8047
|
-
if (typeof result === "object")
|
|
8230
|
+
if (typeof result === "object") {
|
|
8231
|
+
warnIfAllNull([result]);
|
|
8048
8232
|
return result;
|
|
8233
|
+
}
|
|
8049
8234
|
return { Value: result };
|
|
8050
8235
|
}
|
|
8236
|
+
function filterFailureData(envelope) {
|
|
8237
|
+
const filter = getOutputFilter();
|
|
8238
|
+
const data = envelope.Data;
|
|
8239
|
+
if (!filter || data == null)
|
|
8240
|
+
return;
|
|
8241
|
+
let note;
|
|
8242
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
8243
|
+
note = n;
|
|
8244
|
+
}));
|
|
8245
|
+
if (filterError) {
|
|
8246
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
8247
|
+
return;
|
|
8248
|
+
}
|
|
8249
|
+
envelope.Data = filtered;
|
|
8250
|
+
if (note) {
|
|
8251
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8252
|
+
}
|
|
8253
|
+
}
|
|
8051
8254
|
function defaultErrorCodeForResult(result) {
|
|
8052
8255
|
switch (result) {
|
|
8053
8256
|
case RESULTS.AuthenticationError:
|
|
@@ -8116,6 +8319,7 @@ function defaultRetryForErrorCode(errorCode) {
|
|
|
8116
8319
|
}
|
|
8117
8320
|
var ANSI_STYLES, ANSI_RESET = "\x1B[0m", CLI_ERROR_CODES, RETRY_HINTS, CLI_ERROR_CODE_VALUES, RETRY_HINT_VALUES, RESULTS, EXIT_CODES, NESTED_INDENT = " ", FilterEvaluationError, FilterImplicitLimitError, LOCAL_PERMISSION_TEXT_PATTERN, OutputFormatter;
|
|
8118
8321
|
var init_formatter = __esm(() => {
|
|
8322
|
+
init_catch_error();
|
|
8119
8323
|
init_logger();
|
|
8120
8324
|
init_output_codecs();
|
|
8121
8325
|
init_output_context();
|
|
@@ -8209,8 +8413,14 @@ var init_formatter = __esm(() => {
|
|
|
8209
8413
|
}
|
|
8210
8414
|
const filter = getOutputFilter();
|
|
8211
8415
|
if (filter) {
|
|
8212
|
-
|
|
8416
|
+
let note;
|
|
8417
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
8418
|
+
note = n;
|
|
8419
|
+
});
|
|
8213
8420
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
8421
|
+
if (note) {
|
|
8422
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
8423
|
+
}
|
|
8214
8424
|
}
|
|
8215
8425
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
8216
8426
|
}
|
|
@@ -8238,6 +8448,7 @@ var init_formatter = __esm(() => {
|
|
|
8238
8448
|
delete envelope.TelemetryErrorClass;
|
|
8239
8449
|
delete envelope.TelemetryTerminalOutcome;
|
|
8240
8450
|
delete envelope.TelemetryTerminalSignal;
|
|
8451
|
+
filterFailureData(envelope);
|
|
8241
8452
|
if (!suppressTelemetry) {
|
|
8242
8453
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
8243
8454
|
result: data.Result,
|
|
@@ -8286,13 +8497,20 @@ var init_formatter = __esm(() => {
|
|
|
8286
8497
|
OutputFormatter.log = log;
|
|
8287
8498
|
function formatToString(data) {
|
|
8288
8499
|
const filter = getOutputFilter();
|
|
8500
|
+
const envelope = data;
|
|
8289
8501
|
if ("Data" in data && data.Data != null) {
|
|
8290
8502
|
data.Data = normalizeDataKeys(data.Data);
|
|
8291
8503
|
if (filter) {
|
|
8292
|
-
|
|
8504
|
+
let note;
|
|
8505
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
8506
|
+
note = n;
|
|
8507
|
+
}));
|
|
8508
|
+
if (note) {
|
|
8509
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8510
|
+
}
|
|
8293
8511
|
}
|
|
8294
8512
|
}
|
|
8295
|
-
const output = normalizeOutputKeys(
|
|
8513
|
+
const output = normalizeOutputKeys(envelope);
|
|
8296
8514
|
const lines = [];
|
|
8297
8515
|
const sink = getOutputSink();
|
|
8298
8516
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -11749,4 +11967,4 @@ export {
|
|
|
11749
11967
|
studioWebPost
|
|
11750
11968
|
};
|
|
11751
11969
|
|
|
11752
|
-
//# debugId=
|
|
11970
|
+
//# debugId=2BA96E8162B43F5164756E2164756E21
|
package/dist/debug-service.js
CHANGED
|
@@ -8026,7 +8026,165 @@ function requireJmespath() {
|
|
|
8026
8026
|
}
|
|
8027
8027
|
return codec;
|
|
8028
8028
|
}
|
|
8029
|
-
function
|
|
8029
|
+
function countRecords(data) {
|
|
8030
|
+
if (Array.isArray(data))
|
|
8031
|
+
return data.length;
|
|
8032
|
+
return data == null ? 0 : 1;
|
|
8033
|
+
}
|
|
8034
|
+
function availableFields(data) {
|
|
8035
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8036
|
+
const keys = new Set;
|
|
8037
|
+
for (const record of records) {
|
|
8038
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
8039
|
+
for (const key of Object.keys(record))
|
|
8040
|
+
keys.add(key);
|
|
8041
|
+
}
|
|
8042
|
+
}
|
|
8043
|
+
return [...keys];
|
|
8044
|
+
}
|
|
8045
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
8046
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
8047
|
+
if (!error && typeof decoded === "string")
|
|
8048
|
+
return decoded;
|
|
8049
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
8050
|
+
}
|
|
8051
|
+
function referencedFields(filter) {
|
|
8052
|
+
const top = new Set;
|
|
8053
|
+
const nested = new Set;
|
|
8054
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
8055
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
8056
|
+
const quoted = [];
|
|
8057
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
8058
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
8059
|
+
if (!isAlias) {
|
|
8060
|
+
quoted.push({
|
|
8061
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
8062
|
+
index,
|
|
8063
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
8064
|
+
});
|
|
8065
|
+
}
|
|
8066
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
8067
|
+
});
|
|
8068
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
8069
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
8070
|
+
const place = (name, index, tail) => {
|
|
8071
|
+
if (tail || index >= rootEnd)
|
|
8072
|
+
nested.add(name);
|
|
8073
|
+
else
|
|
8074
|
+
top.add(name);
|
|
8075
|
+
};
|
|
8076
|
+
for (const entry of quoted)
|
|
8077
|
+
place(entry.name, entry.index, entry.tail);
|
|
8078
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
8079
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
8080
|
+
for (const match of identifiers) {
|
|
8081
|
+
const [, name, trailing] = match;
|
|
8082
|
+
if (trailing || reserved.has(name))
|
|
8083
|
+
continue;
|
|
8084
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
8085
|
+
}
|
|
8086
|
+
return {
|
|
8087
|
+
top: [...top],
|
|
8088
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
8089
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
8090
|
+
};
|
|
8091
|
+
}
|
|
8092
|
+
function appearsBelowTopLevel(data, name) {
|
|
8093
|
+
let budget = 2000;
|
|
8094
|
+
const visit = (value, depth) => {
|
|
8095
|
+
if (budget-- <= 0 || depth > 4)
|
|
8096
|
+
return false;
|
|
8097
|
+
if (value === null || typeof value !== "object")
|
|
8098
|
+
return false;
|
|
8099
|
+
if (Array.isArray(value))
|
|
8100
|
+
return value.some((entry) => visit(entry, depth));
|
|
8101
|
+
const record = value;
|
|
8102
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
8103
|
+
return true;
|
|
8104
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
8105
|
+
};
|
|
8106
|
+
return visit(data, 0);
|
|
8107
|
+
}
|
|
8108
|
+
function alwaysNullKeys(records) {
|
|
8109
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
8110
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
8111
|
+
return [];
|
|
8112
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
8113
|
+
if (keys.length === 0)
|
|
8114
|
+
return [];
|
|
8115
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
8116
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
8117
|
+
}
|
|
8118
|
+
function carriesOnlyNulls(value) {
|
|
8119
|
+
if (value === null)
|
|
8120
|
+
return true;
|
|
8121
|
+
if (Array.isArray(value)) {
|
|
8122
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
8123
|
+
}
|
|
8124
|
+
if (typeof value === "object" && value !== undefined) {
|
|
8125
|
+
const values = Object.values(value);
|
|
8126
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
8127
|
+
}
|
|
8128
|
+
return false;
|
|
8129
|
+
}
|
|
8130
|
+
function nameList(names, cap2 = 12) {
|
|
8131
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
8132
|
+
const rest = names.length - shown.length;
|
|
8133
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8134
|
+
}
|
|
8135
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
8136
|
+
const present = availableFields(data);
|
|
8137
|
+
const refs = referencedFields(filter);
|
|
8138
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
8139
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
8140
|
+
const count = countRecords(data);
|
|
8141
|
+
const scope = `${count} record(s)`;
|
|
8142
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8143
|
+
const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
|
|
8144
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
8145
|
+
let detail;
|
|
8146
|
+
let lede;
|
|
8147
|
+
if (outcome.kind === "null-elements") {
|
|
8148
|
+
lede = "returned only null values";
|
|
8149
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
8150
|
+
if (unknown.length > 0) {
|
|
8151
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8152
|
+
} else if (unchecked.length > 0) {
|
|
8153
|
+
detail = withSoundness(projected);
|
|
8154
|
+
} else {
|
|
8155
|
+
detail = `${projected}, and every field it names exists — a multi-select list ` + `(\`[A, B]\`) reads each entry against \`Data\` itself, so on a list ` + `result use \`[].[A, B]\` or \`[].{a: A, b: B}\` to read the records`;
|
|
8156
|
+
}
|
|
8157
|
+
} else if (outcome.kind === "null-rows") {
|
|
8158
|
+
lede = "returned only null values";
|
|
8159
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
8160
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
8161
|
+
} else if (outcome.kind === "null-values") {
|
|
8162
|
+
lede = "returned only null values";
|
|
8163
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
8164
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
8165
|
+
if (sameSet) {
|
|
8166
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
8167
|
+
} else if (unknown.length > 0) {
|
|
8168
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8169
|
+
} else {
|
|
8170
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
8171
|
+
}
|
|
8172
|
+
} else {
|
|
8173
|
+
lede = "returned nothing";
|
|
8174
|
+
if (unknown.length > 0) {
|
|
8175
|
+
detail = isNotAField(unknown);
|
|
8176
|
+
} else {
|
|
8177
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
8178
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
8179
|
+
}
|
|
8180
|
+
}
|
|
8181
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
8182
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
8183
|
+
}
|
|
8184
|
+
function appendWarning(existing, note) {
|
|
8185
|
+
return existing ? `${existing} ${note}` : note;
|
|
8186
|
+
}
|
|
8187
|
+
function applyFilter(data, filter, onWarning) {
|
|
8030
8188
|
const codec = requireJmespath();
|
|
8031
8189
|
let result;
|
|
8032
8190
|
try {
|
|
@@ -8034,9 +8192,34 @@ function applyFilter(data, filter) {
|
|
|
8034
8192
|
} catch (err) {
|
|
8035
8193
|
throw new FilterEvaluationError(filter, err);
|
|
8036
8194
|
}
|
|
8037
|
-
|
|
8195
|
+
const inputCount = countRecords(data);
|
|
8196
|
+
const warn = (outcome) => {
|
|
8197
|
+
if (inputCount === 0)
|
|
8198
|
+
return;
|
|
8199
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
8200
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
8201
|
+
`);
|
|
8202
|
+
onWarning?.(note);
|
|
8203
|
+
};
|
|
8204
|
+
const warnIfAllNull = (records) => {
|
|
8205
|
+
const keys = alwaysNullKeys(records);
|
|
8206
|
+
if (keys.length > 0)
|
|
8207
|
+
warn({ kind: "null-values", keys });
|
|
8208
|
+
};
|
|
8209
|
+
if (result == null) {
|
|
8210
|
+
warn({ kind: "empty" });
|
|
8038
8211
|
return [];
|
|
8212
|
+
}
|
|
8039
8213
|
if (Array.isArray(result)) {
|
|
8214
|
+
if (result.length === 0) {
|
|
8215
|
+
warn({ kind: "empty" });
|
|
8216
|
+
} else if (result.every((entry) => entry === null)) {
|
|
8217
|
+
warn({ kind: "null-elements", count: result.length });
|
|
8218
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
8219
|
+
warn({ kind: "null-rows", count: result.length });
|
|
8220
|
+
} else {
|
|
8221
|
+
warnIfAllNull(result);
|
|
8222
|
+
}
|
|
8040
8223
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
8041
8224
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
8042
8225
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -8044,10 +8227,30 @@ function applyFilter(data, filter) {
|
|
|
8044
8227
|
}
|
|
8045
8228
|
return result;
|
|
8046
8229
|
}
|
|
8047
|
-
if (typeof result === "object")
|
|
8230
|
+
if (typeof result === "object") {
|
|
8231
|
+
warnIfAllNull([result]);
|
|
8048
8232
|
return result;
|
|
8233
|
+
}
|
|
8049
8234
|
return { Value: result };
|
|
8050
8235
|
}
|
|
8236
|
+
function filterFailureData(envelope) {
|
|
8237
|
+
const filter = getOutputFilter();
|
|
8238
|
+
const data = envelope.Data;
|
|
8239
|
+
if (!filter || data == null)
|
|
8240
|
+
return;
|
|
8241
|
+
let note;
|
|
8242
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
8243
|
+
note = n;
|
|
8244
|
+
}));
|
|
8245
|
+
if (filterError) {
|
|
8246
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
8247
|
+
return;
|
|
8248
|
+
}
|
|
8249
|
+
envelope.Data = filtered;
|
|
8250
|
+
if (note) {
|
|
8251
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8252
|
+
}
|
|
8253
|
+
}
|
|
8051
8254
|
function defaultErrorCodeForResult(result) {
|
|
8052
8255
|
switch (result) {
|
|
8053
8256
|
case RESULTS.AuthenticationError:
|
|
@@ -8116,6 +8319,7 @@ function defaultRetryForErrorCode(errorCode) {
|
|
|
8116
8319
|
}
|
|
8117
8320
|
var ANSI_STYLES, ANSI_RESET = "\x1B[0m", CLI_ERROR_CODES, RETRY_HINTS, CLI_ERROR_CODE_VALUES, RETRY_HINT_VALUES, RESULTS, EXIT_CODES, NESTED_INDENT = " ", FilterEvaluationError, FilterImplicitLimitError, LOCAL_PERMISSION_TEXT_PATTERN, OutputFormatter;
|
|
8118
8321
|
var init_formatter = __esm(() => {
|
|
8322
|
+
init_catch_error();
|
|
8119
8323
|
init_logger();
|
|
8120
8324
|
init_output_codecs();
|
|
8121
8325
|
init_output_context();
|
|
@@ -8209,8 +8413,14 @@ var init_formatter = __esm(() => {
|
|
|
8209
8413
|
}
|
|
8210
8414
|
const filter = getOutputFilter();
|
|
8211
8415
|
if (filter) {
|
|
8212
|
-
|
|
8416
|
+
let note;
|
|
8417
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
8418
|
+
note = n;
|
|
8419
|
+
});
|
|
8213
8420
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
8421
|
+
if (note) {
|
|
8422
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
8423
|
+
}
|
|
8214
8424
|
}
|
|
8215
8425
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
8216
8426
|
}
|
|
@@ -8238,6 +8448,7 @@ var init_formatter = __esm(() => {
|
|
|
8238
8448
|
delete envelope.TelemetryErrorClass;
|
|
8239
8449
|
delete envelope.TelemetryTerminalOutcome;
|
|
8240
8450
|
delete envelope.TelemetryTerminalSignal;
|
|
8451
|
+
filterFailureData(envelope);
|
|
8241
8452
|
if (!suppressTelemetry) {
|
|
8242
8453
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
8243
8454
|
result: data.Result,
|
|
@@ -8286,13 +8497,20 @@ var init_formatter = __esm(() => {
|
|
|
8286
8497
|
OutputFormatter.log = log;
|
|
8287
8498
|
function formatToString(data) {
|
|
8288
8499
|
const filter = getOutputFilter();
|
|
8500
|
+
const envelope = data;
|
|
8289
8501
|
if ("Data" in data && data.Data != null) {
|
|
8290
8502
|
data.Data = normalizeDataKeys(data.Data);
|
|
8291
8503
|
if (filter) {
|
|
8292
|
-
|
|
8504
|
+
let note;
|
|
8505
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
8506
|
+
note = n;
|
|
8507
|
+
}));
|
|
8508
|
+
if (note) {
|
|
8509
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8510
|
+
}
|
|
8293
8511
|
}
|
|
8294
8512
|
}
|
|
8295
|
-
const output = normalizeOutputKeys(
|
|
8513
|
+
const output = normalizeOutputKeys(envelope);
|
|
8296
8514
|
const lines = [];
|
|
8297
8515
|
const sink = getOutputSink();
|
|
8298
8516
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -12347,4 +12565,4 @@ export {
|
|
|
12347
12565
|
uploadAndDebugSolution
|
|
12348
12566
|
};
|
|
12349
12567
|
|
|
12350
|
-
//# debugId=
|
|
12568
|
+
//# debugId=E9E96F15308FC5D464756E2164756E21
|