@uipath/maestro-sdk 1.203.0-preview.235 → 1.203.0-preview.237
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
|
@@ -8271,7 +8271,165 @@ function requireJmespath() {
|
|
|
8271
8271
|
}
|
|
8272
8272
|
return codec;
|
|
8273
8273
|
}
|
|
8274
|
-
function
|
|
8274
|
+
function countRecords(data) {
|
|
8275
|
+
if (Array.isArray(data))
|
|
8276
|
+
return data.length;
|
|
8277
|
+
return data == null ? 0 : 1;
|
|
8278
|
+
}
|
|
8279
|
+
function availableFields(data) {
|
|
8280
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8281
|
+
const keys = new Set;
|
|
8282
|
+
for (const record of records) {
|
|
8283
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
8284
|
+
for (const key of Object.keys(record))
|
|
8285
|
+
keys.add(key);
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
return [...keys];
|
|
8289
|
+
}
|
|
8290
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
8291
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
8292
|
+
if (!error && typeof decoded === "string")
|
|
8293
|
+
return decoded;
|
|
8294
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
8295
|
+
}
|
|
8296
|
+
function referencedFields(filter) {
|
|
8297
|
+
const top = new Set;
|
|
8298
|
+
const nested = new Set;
|
|
8299
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
8300
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
8301
|
+
const quoted = [];
|
|
8302
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
8303
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
8304
|
+
if (!isAlias) {
|
|
8305
|
+
quoted.push({
|
|
8306
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
8307
|
+
index,
|
|
8308
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
8309
|
+
});
|
|
8310
|
+
}
|
|
8311
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
8312
|
+
});
|
|
8313
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
8314
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
8315
|
+
const place = (name, index, tail) => {
|
|
8316
|
+
if (tail || index >= rootEnd)
|
|
8317
|
+
nested.add(name);
|
|
8318
|
+
else
|
|
8319
|
+
top.add(name);
|
|
8320
|
+
};
|
|
8321
|
+
for (const entry of quoted)
|
|
8322
|
+
place(entry.name, entry.index, entry.tail);
|
|
8323
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
8324
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
8325
|
+
for (const match of identifiers) {
|
|
8326
|
+
const [, name, trailing] = match;
|
|
8327
|
+
if (trailing || reserved.has(name))
|
|
8328
|
+
continue;
|
|
8329
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
8330
|
+
}
|
|
8331
|
+
return {
|
|
8332
|
+
top: [...top],
|
|
8333
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
8334
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
8335
|
+
};
|
|
8336
|
+
}
|
|
8337
|
+
function appearsBelowTopLevel(data, name) {
|
|
8338
|
+
let budget = 2000;
|
|
8339
|
+
const visit = (value, depth) => {
|
|
8340
|
+
if (budget-- <= 0 || depth > 4)
|
|
8341
|
+
return false;
|
|
8342
|
+
if (value === null || typeof value !== "object")
|
|
8343
|
+
return false;
|
|
8344
|
+
if (Array.isArray(value))
|
|
8345
|
+
return value.some((entry) => visit(entry, depth));
|
|
8346
|
+
const record = value;
|
|
8347
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
8348
|
+
return true;
|
|
8349
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
8350
|
+
};
|
|
8351
|
+
return visit(data, 0);
|
|
8352
|
+
}
|
|
8353
|
+
function alwaysNullKeys(records) {
|
|
8354
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
8355
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
8356
|
+
return [];
|
|
8357
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
8358
|
+
if (keys.length === 0)
|
|
8359
|
+
return [];
|
|
8360
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
8361
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
8362
|
+
}
|
|
8363
|
+
function carriesOnlyNulls(value) {
|
|
8364
|
+
if (value === null)
|
|
8365
|
+
return true;
|
|
8366
|
+
if (Array.isArray(value)) {
|
|
8367
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
8368
|
+
}
|
|
8369
|
+
if (typeof value === "object" && value !== undefined) {
|
|
8370
|
+
const values = Object.values(value);
|
|
8371
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
8372
|
+
}
|
|
8373
|
+
return false;
|
|
8374
|
+
}
|
|
8375
|
+
function nameList(names, cap2 = 12) {
|
|
8376
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
8377
|
+
const rest = names.length - shown.length;
|
|
8378
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8379
|
+
}
|
|
8380
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
8381
|
+
const present = availableFields(data);
|
|
8382
|
+
const refs = referencedFields(filter);
|
|
8383
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
8384
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
8385
|
+
const count = countRecords(data);
|
|
8386
|
+
const scope = `${count} record(s)`;
|
|
8387
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8388
|
+
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" : "";
|
|
8389
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
8390
|
+
let detail;
|
|
8391
|
+
let lede;
|
|
8392
|
+
if (outcome.kind === "null-elements") {
|
|
8393
|
+
lede = "returned only null values";
|
|
8394
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
8395
|
+
if (unknown.length > 0) {
|
|
8396
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8397
|
+
} else if (unchecked.length > 0) {
|
|
8398
|
+
detail = withSoundness(projected);
|
|
8399
|
+
} else {
|
|
8400
|
+
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`;
|
|
8401
|
+
}
|
|
8402
|
+
} else if (outcome.kind === "null-rows") {
|
|
8403
|
+
lede = "returned only null values";
|
|
8404
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
8405
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
8406
|
+
} else if (outcome.kind === "null-values") {
|
|
8407
|
+
lede = "returned only null values";
|
|
8408
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
8409
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
8410
|
+
if (sameSet) {
|
|
8411
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
8412
|
+
} else if (unknown.length > 0) {
|
|
8413
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8414
|
+
} else {
|
|
8415
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
8416
|
+
}
|
|
8417
|
+
} else {
|
|
8418
|
+
lede = "returned nothing";
|
|
8419
|
+
if (unknown.length > 0) {
|
|
8420
|
+
detail = isNotAField(unknown);
|
|
8421
|
+
} else {
|
|
8422
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
8423
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
8424
|
+
}
|
|
8425
|
+
}
|
|
8426
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
8427
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
8428
|
+
}
|
|
8429
|
+
function appendWarning(existing, note) {
|
|
8430
|
+
return existing ? `${existing} ${note}` : note;
|
|
8431
|
+
}
|
|
8432
|
+
function applyFilter(data, filter, onWarning) {
|
|
8275
8433
|
const codec = requireJmespath();
|
|
8276
8434
|
let result;
|
|
8277
8435
|
try {
|
|
@@ -8279,9 +8437,34 @@ function applyFilter(data, filter) {
|
|
|
8279
8437
|
} catch (err) {
|
|
8280
8438
|
throw new FilterEvaluationError(filter, err);
|
|
8281
8439
|
}
|
|
8282
|
-
|
|
8440
|
+
const inputCount = countRecords(data);
|
|
8441
|
+
const warn = (outcome) => {
|
|
8442
|
+
if (inputCount === 0)
|
|
8443
|
+
return;
|
|
8444
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
8445
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
8446
|
+
`);
|
|
8447
|
+
onWarning?.(note);
|
|
8448
|
+
};
|
|
8449
|
+
const warnIfAllNull = (records) => {
|
|
8450
|
+
const keys = alwaysNullKeys(records);
|
|
8451
|
+
if (keys.length > 0)
|
|
8452
|
+
warn({ kind: "null-values", keys });
|
|
8453
|
+
};
|
|
8454
|
+
if (result == null) {
|
|
8455
|
+
warn({ kind: "empty" });
|
|
8283
8456
|
return [];
|
|
8457
|
+
}
|
|
8284
8458
|
if (Array.isArray(result)) {
|
|
8459
|
+
if (result.length === 0) {
|
|
8460
|
+
warn({ kind: "empty" });
|
|
8461
|
+
} else if (result.every((entry) => entry === null)) {
|
|
8462
|
+
warn({ kind: "null-elements", count: result.length });
|
|
8463
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
8464
|
+
warn({ kind: "null-rows", count: result.length });
|
|
8465
|
+
} else {
|
|
8466
|
+
warnIfAllNull(result);
|
|
8467
|
+
}
|
|
8285
8468
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
8286
8469
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
8287
8470
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -8289,10 +8472,30 @@ function applyFilter(data, filter) {
|
|
|
8289
8472
|
}
|
|
8290
8473
|
return result;
|
|
8291
8474
|
}
|
|
8292
|
-
if (typeof result === "object")
|
|
8475
|
+
if (typeof result === "object") {
|
|
8476
|
+
warnIfAllNull([result]);
|
|
8293
8477
|
return result;
|
|
8478
|
+
}
|
|
8294
8479
|
return { Value: result };
|
|
8295
8480
|
}
|
|
8481
|
+
function filterFailureData(envelope) {
|
|
8482
|
+
const filter = getOutputFilter();
|
|
8483
|
+
const data = envelope.Data;
|
|
8484
|
+
if (!filter || data == null)
|
|
8485
|
+
return;
|
|
8486
|
+
let note;
|
|
8487
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
8488
|
+
note = n;
|
|
8489
|
+
}));
|
|
8490
|
+
if (filterError) {
|
|
8491
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
8492
|
+
return;
|
|
8493
|
+
}
|
|
8494
|
+
envelope.Data = filtered;
|
|
8495
|
+
if (note) {
|
|
8496
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8296
8499
|
function defaultErrorCodeForResult(result) {
|
|
8297
8500
|
switch (result) {
|
|
8298
8501
|
case RESULTS.AuthenticationError:
|
|
@@ -8361,6 +8564,7 @@ function defaultRetryForErrorCode(errorCode) {
|
|
|
8361
8564
|
}
|
|
8362
8565
|
var ANSI_STYLES, ANSI_RESET = "\x1B[0m", CLI_ERROR_CODES, RETRY_HINTS, CLI_ERROR_CODE_VALUES, RETRY_HINT_VALUES, RESULTS, EXIT_CODES, PLUMBING_KEYS, NESTED_INDENT = " ", MARKDOWN_MAX_CELL = 200, MARKDOWN_MAX_DEPTH = 3, BACKTICK_RUN, FilterEvaluationError, FilterImplicitLimitError, LOCAL_PERMISSION_TEXT_PATTERN, OutputFormatter;
|
|
8363
8566
|
var init_formatter = __esm(() => {
|
|
8567
|
+
init_catch_error();
|
|
8364
8568
|
init_logger();
|
|
8365
8569
|
init_output_codecs();
|
|
8366
8570
|
init_output_context();
|
|
@@ -8457,8 +8661,14 @@ var init_formatter = __esm(() => {
|
|
|
8457
8661
|
}
|
|
8458
8662
|
const filter = getOutputFilter();
|
|
8459
8663
|
if (filter) {
|
|
8460
|
-
|
|
8664
|
+
let note;
|
|
8665
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
8666
|
+
note = n;
|
|
8667
|
+
});
|
|
8461
8668
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
8669
|
+
if (note) {
|
|
8670
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
8671
|
+
}
|
|
8462
8672
|
}
|
|
8463
8673
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
8464
8674
|
}
|
|
@@ -8486,6 +8696,7 @@ var init_formatter = __esm(() => {
|
|
|
8486
8696
|
delete envelope.TelemetryErrorClass;
|
|
8487
8697
|
delete envelope.TelemetryTerminalOutcome;
|
|
8488
8698
|
delete envelope.TelemetryTerminalSignal;
|
|
8699
|
+
filterFailureData(envelope);
|
|
8489
8700
|
if (!suppressTelemetry) {
|
|
8490
8701
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
8491
8702
|
result: data.Result,
|
|
@@ -8534,13 +8745,20 @@ var init_formatter = __esm(() => {
|
|
|
8534
8745
|
OutputFormatter.log = log;
|
|
8535
8746
|
function formatToString(data) {
|
|
8536
8747
|
const filter = getOutputFilter();
|
|
8748
|
+
const envelope = data;
|
|
8537
8749
|
if ("Data" in data && data.Data != null) {
|
|
8538
8750
|
data.Data = normalizeDataKeys(data.Data);
|
|
8539
8751
|
if (filter) {
|
|
8540
|
-
|
|
8752
|
+
let note;
|
|
8753
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
8754
|
+
note = n;
|
|
8755
|
+
}));
|
|
8756
|
+
if (note) {
|
|
8757
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8758
|
+
}
|
|
8541
8759
|
}
|
|
8542
8760
|
}
|
|
8543
|
-
const output = normalizeOutputKeys(
|
|
8761
|
+
const output = normalizeOutputKeys(envelope);
|
|
8544
8762
|
const lines = [];
|
|
8545
8763
|
const sink = getOutputSink();
|
|
8546
8764
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -11998,4 +12216,4 @@ export {
|
|
|
11998
12216
|
studioWebPost
|
|
11999
12217
|
};
|
|
12000
12218
|
|
|
12001
|
-
//# debugId=
|
|
12219
|
+
//# debugId=737C24908C9CB20F64756E2164756E21
|
package/dist/debug-service.js
CHANGED
|
@@ -8271,7 +8271,165 @@ function requireJmespath() {
|
|
|
8271
8271
|
}
|
|
8272
8272
|
return codec;
|
|
8273
8273
|
}
|
|
8274
|
-
function
|
|
8274
|
+
function countRecords(data) {
|
|
8275
|
+
if (Array.isArray(data))
|
|
8276
|
+
return data.length;
|
|
8277
|
+
return data == null ? 0 : 1;
|
|
8278
|
+
}
|
|
8279
|
+
function availableFields(data) {
|
|
8280
|
+
const records = Array.isArray(data) ? data : [data];
|
|
8281
|
+
const keys = new Set;
|
|
8282
|
+
for (const record of records) {
|
|
8283
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
8284
|
+
for (const key of Object.keys(record))
|
|
8285
|
+
keys.add(key);
|
|
8286
|
+
}
|
|
8287
|
+
}
|
|
8288
|
+
return [...keys];
|
|
8289
|
+
}
|
|
8290
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
8291
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
8292
|
+
if (!error && typeof decoded === "string")
|
|
8293
|
+
return decoded;
|
|
8294
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
8295
|
+
}
|
|
8296
|
+
function referencedFields(filter) {
|
|
8297
|
+
const top = new Set;
|
|
8298
|
+
const nested = new Set;
|
|
8299
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
8300
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
8301
|
+
const quoted = [];
|
|
8302
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
8303
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
8304
|
+
if (!isAlias) {
|
|
8305
|
+
quoted.push({
|
|
8306
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
8307
|
+
index,
|
|
8308
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
8309
|
+
});
|
|
8310
|
+
}
|
|
8311
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
8312
|
+
});
|
|
8313
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
8314
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
8315
|
+
const place = (name, index, tail) => {
|
|
8316
|
+
if (tail || index >= rootEnd)
|
|
8317
|
+
nested.add(name);
|
|
8318
|
+
else
|
|
8319
|
+
top.add(name);
|
|
8320
|
+
};
|
|
8321
|
+
for (const entry of quoted)
|
|
8322
|
+
place(entry.name, entry.index, entry.tail);
|
|
8323
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
8324
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
8325
|
+
for (const match of identifiers) {
|
|
8326
|
+
const [, name, trailing] = match;
|
|
8327
|
+
if (trailing || reserved.has(name))
|
|
8328
|
+
continue;
|
|
8329
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
8330
|
+
}
|
|
8331
|
+
return {
|
|
8332
|
+
top: [...top],
|
|
8333
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
8334
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
8335
|
+
};
|
|
8336
|
+
}
|
|
8337
|
+
function appearsBelowTopLevel(data, name) {
|
|
8338
|
+
let budget = 2000;
|
|
8339
|
+
const visit = (value, depth) => {
|
|
8340
|
+
if (budget-- <= 0 || depth > 4)
|
|
8341
|
+
return false;
|
|
8342
|
+
if (value === null || typeof value !== "object")
|
|
8343
|
+
return false;
|
|
8344
|
+
if (Array.isArray(value))
|
|
8345
|
+
return value.some((entry) => visit(entry, depth));
|
|
8346
|
+
const record = value;
|
|
8347
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
8348
|
+
return true;
|
|
8349
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
8350
|
+
};
|
|
8351
|
+
return visit(data, 0);
|
|
8352
|
+
}
|
|
8353
|
+
function alwaysNullKeys(records) {
|
|
8354
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
8355
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
8356
|
+
return [];
|
|
8357
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
8358
|
+
if (keys.length === 0)
|
|
8359
|
+
return [];
|
|
8360
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
8361
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
8362
|
+
}
|
|
8363
|
+
function carriesOnlyNulls(value) {
|
|
8364
|
+
if (value === null)
|
|
8365
|
+
return true;
|
|
8366
|
+
if (Array.isArray(value)) {
|
|
8367
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
8368
|
+
}
|
|
8369
|
+
if (typeof value === "object" && value !== undefined) {
|
|
8370
|
+
const values = Object.values(value);
|
|
8371
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
8372
|
+
}
|
|
8373
|
+
return false;
|
|
8374
|
+
}
|
|
8375
|
+
function nameList(names, cap2 = 12) {
|
|
8376
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
8377
|
+
const rest = names.length - shown.length;
|
|
8378
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
8379
|
+
}
|
|
8380
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
8381
|
+
const present = availableFields(data);
|
|
8382
|
+
const refs = referencedFields(filter);
|
|
8383
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
8384
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
8385
|
+
const count = countRecords(data);
|
|
8386
|
+
const scope = `${count} record(s)`;
|
|
8387
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
8388
|
+
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" : "";
|
|
8389
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
8390
|
+
let detail;
|
|
8391
|
+
let lede;
|
|
8392
|
+
if (outcome.kind === "null-elements") {
|
|
8393
|
+
lede = "returned only null values";
|
|
8394
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
8395
|
+
if (unknown.length > 0) {
|
|
8396
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8397
|
+
} else if (unchecked.length > 0) {
|
|
8398
|
+
detail = withSoundness(projected);
|
|
8399
|
+
} else {
|
|
8400
|
+
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`;
|
|
8401
|
+
}
|
|
8402
|
+
} else if (outcome.kind === "null-rows") {
|
|
8403
|
+
lede = "returned only null values";
|
|
8404
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
8405
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
8406
|
+
} else if (outcome.kind === "null-values") {
|
|
8407
|
+
lede = "returned only null values";
|
|
8408
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
8409
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
8410
|
+
if (sameSet) {
|
|
8411
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
8412
|
+
} else if (unknown.length > 0) {
|
|
8413
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
8414
|
+
} else {
|
|
8415
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
8416
|
+
}
|
|
8417
|
+
} else {
|
|
8418
|
+
lede = "returned nothing";
|
|
8419
|
+
if (unknown.length > 0) {
|
|
8420
|
+
detail = isNotAField(unknown);
|
|
8421
|
+
} else {
|
|
8422
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
8423
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
8424
|
+
}
|
|
8425
|
+
}
|
|
8426
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
8427
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
8428
|
+
}
|
|
8429
|
+
function appendWarning(existing, note) {
|
|
8430
|
+
return existing ? `${existing} ${note}` : note;
|
|
8431
|
+
}
|
|
8432
|
+
function applyFilter(data, filter, onWarning) {
|
|
8275
8433
|
const codec = requireJmespath();
|
|
8276
8434
|
let result;
|
|
8277
8435
|
try {
|
|
@@ -8279,9 +8437,34 @@ function applyFilter(data, filter) {
|
|
|
8279
8437
|
} catch (err) {
|
|
8280
8438
|
throw new FilterEvaluationError(filter, err);
|
|
8281
8439
|
}
|
|
8282
|
-
|
|
8440
|
+
const inputCount = countRecords(data);
|
|
8441
|
+
const warn = (outcome) => {
|
|
8442
|
+
if (inputCount === 0)
|
|
8443
|
+
return;
|
|
8444
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
8445
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
8446
|
+
`);
|
|
8447
|
+
onWarning?.(note);
|
|
8448
|
+
};
|
|
8449
|
+
const warnIfAllNull = (records) => {
|
|
8450
|
+
const keys = alwaysNullKeys(records);
|
|
8451
|
+
if (keys.length > 0)
|
|
8452
|
+
warn({ kind: "null-values", keys });
|
|
8453
|
+
};
|
|
8454
|
+
if (result == null) {
|
|
8455
|
+
warn({ kind: "empty" });
|
|
8283
8456
|
return [];
|
|
8457
|
+
}
|
|
8284
8458
|
if (Array.isArray(result)) {
|
|
8459
|
+
if (result.length === 0) {
|
|
8460
|
+
warn({ kind: "empty" });
|
|
8461
|
+
} else if (result.every((entry) => entry === null)) {
|
|
8462
|
+
warn({ kind: "null-elements", count: result.length });
|
|
8463
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
8464
|
+
warn({ kind: "null-rows", count: result.length });
|
|
8465
|
+
} else {
|
|
8466
|
+
warnIfAllNull(result);
|
|
8467
|
+
}
|
|
8285
8468
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
8286
8469
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
8287
8470
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -8289,10 +8472,30 @@ function applyFilter(data, filter) {
|
|
|
8289
8472
|
}
|
|
8290
8473
|
return result;
|
|
8291
8474
|
}
|
|
8292
|
-
if (typeof result === "object")
|
|
8475
|
+
if (typeof result === "object") {
|
|
8476
|
+
warnIfAllNull([result]);
|
|
8293
8477
|
return result;
|
|
8478
|
+
}
|
|
8294
8479
|
return { Value: result };
|
|
8295
8480
|
}
|
|
8481
|
+
function filterFailureData(envelope) {
|
|
8482
|
+
const filter = getOutputFilter();
|
|
8483
|
+
const data = envelope.Data;
|
|
8484
|
+
if (!filter || data == null)
|
|
8485
|
+
return;
|
|
8486
|
+
let note;
|
|
8487
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
8488
|
+
note = n;
|
|
8489
|
+
}));
|
|
8490
|
+
if (filterError) {
|
|
8491
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
8492
|
+
return;
|
|
8493
|
+
}
|
|
8494
|
+
envelope.Data = filtered;
|
|
8495
|
+
if (note) {
|
|
8496
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8296
8499
|
function defaultErrorCodeForResult(result) {
|
|
8297
8500
|
switch (result) {
|
|
8298
8501
|
case RESULTS.AuthenticationError:
|
|
@@ -8361,6 +8564,7 @@ function defaultRetryForErrorCode(errorCode) {
|
|
|
8361
8564
|
}
|
|
8362
8565
|
var ANSI_STYLES, ANSI_RESET = "\x1B[0m", CLI_ERROR_CODES, RETRY_HINTS, CLI_ERROR_CODE_VALUES, RETRY_HINT_VALUES, RESULTS, EXIT_CODES, PLUMBING_KEYS, NESTED_INDENT = " ", MARKDOWN_MAX_CELL = 200, MARKDOWN_MAX_DEPTH = 3, BACKTICK_RUN, FilterEvaluationError, FilterImplicitLimitError, LOCAL_PERMISSION_TEXT_PATTERN, OutputFormatter;
|
|
8363
8566
|
var init_formatter = __esm(() => {
|
|
8567
|
+
init_catch_error();
|
|
8364
8568
|
init_logger();
|
|
8365
8569
|
init_output_codecs();
|
|
8366
8570
|
init_output_context();
|
|
@@ -8457,8 +8661,14 @@ var init_formatter = __esm(() => {
|
|
|
8457
8661
|
}
|
|
8458
8662
|
const filter = getOutputFilter();
|
|
8459
8663
|
if (filter) {
|
|
8460
|
-
|
|
8664
|
+
let note;
|
|
8665
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
8666
|
+
note = n;
|
|
8667
|
+
});
|
|
8461
8668
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
8669
|
+
if (note) {
|
|
8670
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
8671
|
+
}
|
|
8462
8672
|
}
|
|
8463
8673
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
8464
8674
|
}
|
|
@@ -8486,6 +8696,7 @@ var init_formatter = __esm(() => {
|
|
|
8486
8696
|
delete envelope.TelemetryErrorClass;
|
|
8487
8697
|
delete envelope.TelemetryTerminalOutcome;
|
|
8488
8698
|
delete envelope.TelemetryTerminalSignal;
|
|
8699
|
+
filterFailureData(envelope);
|
|
8489
8700
|
if (!suppressTelemetry) {
|
|
8490
8701
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
8491
8702
|
result: data.Result,
|
|
@@ -8534,13 +8745,20 @@ var init_formatter = __esm(() => {
|
|
|
8534
8745
|
OutputFormatter.log = log;
|
|
8535
8746
|
function formatToString(data) {
|
|
8536
8747
|
const filter = getOutputFilter();
|
|
8748
|
+
const envelope = data;
|
|
8537
8749
|
if ("Data" in data && data.Data != null) {
|
|
8538
8750
|
data.Data = normalizeDataKeys(data.Data);
|
|
8539
8751
|
if (filter) {
|
|
8540
|
-
|
|
8752
|
+
let note;
|
|
8753
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
8754
|
+
note = n;
|
|
8755
|
+
}));
|
|
8756
|
+
if (note) {
|
|
8757
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
8758
|
+
}
|
|
8541
8759
|
}
|
|
8542
8760
|
}
|
|
8543
|
-
const output = normalizeOutputKeys(
|
|
8761
|
+
const output = normalizeOutputKeys(envelope);
|
|
8544
8762
|
const lines = [];
|
|
8545
8763
|
const sink = getOutputSink();
|
|
8546
8764
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -12606,4 +12824,4 @@ export {
|
|
|
12606
12824
|
uploadAndDebugSolution
|
|
12607
12825
|
};
|
|
12608
12826
|
|
|
12609
|
-
//# debugId=
|
|
12827
|
+
//# debugId=933A9F33810F3F4D64756E2164756E21
|