@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
package/dist/index.js
CHANGED
|
@@ -8035,7 +8035,165 @@ function requireJmespath() {
|
|
|
8035
8035
|
}
|
|
8036
8036
|
return codec;
|
|
8037
8037
|
}
|
|
8038
|
-
function
|
|
8038
|
+
function countRecords(data) {
|
|
8039
|
+
if (Array.isArray(data))
|
|
8040
|
+
return data.length;
|
|
8041
|
+
return data == null ? 0 : 1;
|
|
8042
|
+
}
|
|
8043
|
+
function availableFields(data) {
|
|
8044
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8045
|
+
const keys = new Set;
|
|
8046
|
+
for (const record of records) {
|
|
8047
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
8048
|
+
for (const key of Object.keys(record))
|
|
8049
|
+
keys.add(key);
|
|
8050
|
+
}
|
|
8051
|
+
}
|
|
8052
|
+
return [...keys];
|
|
8053
|
+
}
|
|
8054
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
8055
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
8056
|
+
if (!error && typeof decoded === "string")
|
|
8057
|
+
return decoded;
|
|
8058
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
8059
|
+
}
|
|
8060
|
+
function referencedFields(filter) {
|
|
8061
|
+
const top = new Set;
|
|
8062
|
+
const nested = new Set;
|
|
8063
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
8064
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
8065
|
+
const quoted = [];
|
|
8066
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
8067
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
8068
|
+
if (!isAlias) {
|
|
8069
|
+
quoted.push({
|
|
8070
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
8071
|
+
index,
|
|
8072
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
8073
|
+
});
|
|
8074
|
+
}
|
|
8075
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
8076
|
+
});
|
|
8077
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
8078
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
8079
|
+
const place = (name, index, tail) => {
|
|
8080
|
+
if (tail || index >= rootEnd)
|
|
8081
|
+
nested.add(name);
|
|
8082
|
+
else
|
|
8083
|
+
top.add(name);
|
|
8084
|
+
};
|
|
8085
|
+
for (const entry of quoted)
|
|
8086
|
+
place(entry.name, entry.index, entry.tail);
|
|
8087
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
8088
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
8089
|
+
for (const match of identifiers) {
|
|
8090
|
+
const [, name, trailing] = match;
|
|
8091
|
+
if (trailing || reserved.has(name))
|
|
8092
|
+
continue;
|
|
8093
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
8094
|
+
}
|
|
8095
|
+
return {
|
|
8096
|
+
top: [...top],
|
|
8097
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
8098
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
8099
|
+
};
|
|
8100
|
+
}
|
|
8101
|
+
function appearsBelowTopLevel(data, name) {
|
|
8102
|
+
let budget = 2000;
|
|
8103
|
+
const visit = (value, depth) => {
|
|
8104
|
+
if (budget-- <= 0 || depth > 4)
|
|
8105
|
+
return false;
|
|
8106
|
+
if (value === null || typeof value !== "object")
|
|
8107
|
+
return false;
|
|
8108
|
+
if (Array.isArray(value))
|
|
8109
|
+
return value.some((entry) => visit(entry, depth));
|
|
8110
|
+
const record = value;
|
|
8111
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
8112
|
+
return true;
|
|
8113
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
8114
|
+
};
|
|
8115
|
+
return visit(data, 0);
|
|
8116
|
+
}
|
|
8117
|
+
function alwaysNullKeys(records) {
|
|
8118
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
8119
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
8120
|
+
return [];
|
|
8121
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
8122
|
+
if (keys.length === 0)
|
|
8123
|
+
return [];
|
|
8124
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
8125
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
8126
|
+
}
|
|
8127
|
+
function carriesOnlyNulls(value) {
|
|
8128
|
+
if (value === null)
|
|
8129
|
+
return true;
|
|
8130
|
+
if (Array.isArray(value)) {
|
|
8131
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
8132
|
+
}
|
|
8133
|
+
if (typeof value === "object" && value !== undefined) {
|
|
8134
|
+
const values = Object.values(value);
|
|
8135
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
8136
|
+
}
|
|
8137
|
+
return false;
|
|
8138
|
+
}
|
|
8139
|
+
function nameList(names, cap2 = 12) {
|
|
8140
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
8141
|
+
const rest = names.length - shown.length;
|
|
8142
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8143
|
+
}
|
|
8144
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
8145
|
+
const present = availableFields(data);
|
|
8146
|
+
const refs = referencedFields(filter);
|
|
8147
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
8148
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
8149
|
+
const count = countRecords(data);
|
|
8150
|
+
const scope = `${count} record(s)`;
|
|
8151
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8152
|
+
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" : "";
|
|
8153
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
8154
|
+
let detail;
|
|
8155
|
+
let lede;
|
|
8156
|
+
if (outcome.kind === "null-elements") {
|
|
8157
|
+
lede = "returned only null values";
|
|
8158
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
8159
|
+
if (unknown.length > 0) {
|
|
8160
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8161
|
+
} else if (unchecked.length > 0) {
|
|
8162
|
+
detail = withSoundness(projected);
|
|
8163
|
+
} else {
|
|
8164
|
+
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`;
|
|
8165
|
+
}
|
|
8166
|
+
} else if (outcome.kind === "null-rows") {
|
|
8167
|
+
lede = "returned only null values";
|
|
8168
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
8169
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
8170
|
+
} else if (outcome.kind === "null-values") {
|
|
8171
|
+
lede = "returned only null values";
|
|
8172
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
8173
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
8174
|
+
if (sameSet) {
|
|
8175
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
8176
|
+
} else if (unknown.length > 0) {
|
|
8177
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8178
|
+
} else {
|
|
8179
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
8180
|
+
}
|
|
8181
|
+
} else {
|
|
8182
|
+
lede = "returned nothing";
|
|
8183
|
+
if (unknown.length > 0) {
|
|
8184
|
+
detail = isNotAField(unknown);
|
|
8185
|
+
} else {
|
|
8186
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
8187
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
8188
|
+
}
|
|
8189
|
+
}
|
|
8190
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
8191
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
8192
|
+
}
|
|
8193
|
+
function appendWarning(existing, note) {
|
|
8194
|
+
return existing ? `${existing} ${note}` : note;
|
|
8195
|
+
}
|
|
8196
|
+
function applyFilter(data, filter, onWarning) {
|
|
8039
8197
|
const codec = requireJmespath();
|
|
8040
8198
|
let result;
|
|
8041
8199
|
try {
|
|
@@ -8043,9 +8201,34 @@ function applyFilter(data, filter) {
|
|
|
8043
8201
|
} catch (err) {
|
|
8044
8202
|
throw new FilterEvaluationError(filter, err);
|
|
8045
8203
|
}
|
|
8046
|
-
|
|
8204
|
+
const inputCount = countRecords(data);
|
|
8205
|
+
const warn = (outcome) => {
|
|
8206
|
+
if (inputCount === 0)
|
|
8207
|
+
return;
|
|
8208
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
8209
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
8210
|
+
`);
|
|
8211
|
+
onWarning?.(note);
|
|
8212
|
+
};
|
|
8213
|
+
const warnIfAllNull = (records) => {
|
|
8214
|
+
const keys = alwaysNullKeys(records);
|
|
8215
|
+
if (keys.length > 0)
|
|
8216
|
+
warn({ kind: "null-values", keys });
|
|
8217
|
+
};
|
|
8218
|
+
if (result == null) {
|
|
8219
|
+
warn({ kind: "empty" });
|
|
8047
8220
|
return [];
|
|
8221
|
+
}
|
|
8048
8222
|
if (Array.isArray(result)) {
|
|
8223
|
+
if (result.length === 0) {
|
|
8224
|
+
warn({ kind: "empty" });
|
|
8225
|
+
} else if (result.every((entry) => entry === null)) {
|
|
8226
|
+
warn({ kind: "null-elements", count: result.length });
|
|
8227
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
8228
|
+
warn({ kind: "null-rows", count: result.length });
|
|
8229
|
+
} else {
|
|
8230
|
+
warnIfAllNull(result);
|
|
8231
|
+
}
|
|
8049
8232
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
8050
8233
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
8051
8234
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -8053,10 +8236,30 @@ function applyFilter(data, filter) {
|
|
|
8053
8236
|
}
|
|
8054
8237
|
return result;
|
|
8055
8238
|
}
|
|
8056
|
-
if (typeof result === "object")
|
|
8239
|
+
if (typeof result === "object") {
|
|
8240
|
+
warnIfAllNull([result]);
|
|
8057
8241
|
return result;
|
|
8242
|
+
}
|
|
8058
8243
|
return { Value: result };
|
|
8059
8244
|
}
|
|
8245
|
+
function filterFailureData(envelope) {
|
|
8246
|
+
const filter = getOutputFilter();
|
|
8247
|
+
const data = envelope.Data;
|
|
8248
|
+
if (!filter || data == null)
|
|
8249
|
+
return;
|
|
8250
|
+
let note;
|
|
8251
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
8252
|
+
note = n;
|
|
8253
|
+
}));
|
|
8254
|
+
if (filterError) {
|
|
8255
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
8256
|
+
return;
|
|
8257
|
+
}
|
|
8258
|
+
envelope.Data = filtered;
|
|
8259
|
+
if (note) {
|
|
8260
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8261
|
+
}
|
|
8262
|
+
}
|
|
8060
8263
|
function defaultErrorCodeForResult(result) {
|
|
8061
8264
|
switch (result) {
|
|
8062
8265
|
case RESULTS.AuthenticationError:
|
|
@@ -8125,6 +8328,7 @@ function defaultRetryForErrorCode(errorCode) {
|
|
|
8125
8328
|
}
|
|
8126
8329
|
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;
|
|
8127
8330
|
var init_formatter = __esm(() => {
|
|
8331
|
+
init_catch_error();
|
|
8128
8332
|
init_logger();
|
|
8129
8333
|
init_output_codecs();
|
|
8130
8334
|
init_output_context();
|
|
@@ -8218,8 +8422,14 @@ var init_formatter = __esm(() => {
|
|
|
8218
8422
|
}
|
|
8219
8423
|
const filter = getOutputFilter();
|
|
8220
8424
|
if (filter) {
|
|
8221
|
-
|
|
8425
|
+
let note;
|
|
8426
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
8427
|
+
note = n;
|
|
8428
|
+
});
|
|
8222
8429
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
8430
|
+
if (note) {
|
|
8431
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
8432
|
+
}
|
|
8223
8433
|
}
|
|
8224
8434
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
8225
8435
|
}
|
|
@@ -8247,6 +8457,7 @@ var init_formatter = __esm(() => {
|
|
|
8247
8457
|
delete envelope.TelemetryErrorClass;
|
|
8248
8458
|
delete envelope.TelemetryTerminalOutcome;
|
|
8249
8459
|
delete envelope.TelemetryTerminalSignal;
|
|
8460
|
+
filterFailureData(envelope);
|
|
8250
8461
|
if (!suppressTelemetry) {
|
|
8251
8462
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
8252
8463
|
result: data.Result,
|
|
@@ -8295,13 +8506,20 @@ var init_formatter = __esm(() => {
|
|
|
8295
8506
|
OutputFormatter.log = log;
|
|
8296
8507
|
function formatToString(data) {
|
|
8297
8508
|
const filter = getOutputFilter();
|
|
8509
|
+
const envelope = data;
|
|
8298
8510
|
if ("Data" in data && data.Data != null) {
|
|
8299
8511
|
data.Data = normalizeDataKeys(data.Data);
|
|
8300
8512
|
if (filter) {
|
|
8301
|
-
|
|
8513
|
+
let note;
|
|
8514
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
8515
|
+
note = n;
|
|
8516
|
+
}));
|
|
8517
|
+
if (note) {
|
|
8518
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8519
|
+
}
|
|
8302
8520
|
}
|
|
8303
8521
|
}
|
|
8304
|
-
const output = normalizeOutputKeys(
|
|
8522
|
+
const output = normalizeOutputKeys(envelope);
|
|
8305
8523
|
const lines = [];
|
|
8306
8524
|
const sink = getOutputSink();
|
|
8307
8525
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -129434,7 +129652,7 @@ var init_package = __esm(() => {
|
|
|
129434
129652
|
package_default = {
|
|
129435
129653
|
name: "@uipath/integrationservice-sdk",
|
|
129436
129654
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
129437
|
-
version: "1.202.1-preview.
|
|
129655
|
+
version: "1.202.1-preview.239",
|
|
129438
129656
|
repository: {
|
|
129439
129657
|
type: "git",
|
|
129440
129658
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -205685,4 +205903,4 @@ export {
|
|
|
205685
205903
|
withPimsCall
|
|
205686
205904
|
};
|
|
205687
205905
|
|
|
205688
|
-
//# debugId=
|
|
205906
|
+
//# debugId=A09A3819DE8E626564756E2164756E21
|
package/dist/json-input.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) => {
|
|
@@ -11524,4 +11742,4 @@ export {
|
|
|
11524
11742
|
resolveJsonInput
|
|
11525
11743
|
};
|
|
11526
11744
|
|
|
11527
|
-
//# debugId=
|
|
11745
|
+
//# debugId=CB8DA9BF076EA54864756E2164756E21
|