@uipath/admin-tool 1.202.1-preview.217 → 1.202.1-preview.238
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/tool.js +450 -16
- package/package.json +2 -2
package/dist/tool.js
CHANGED
|
@@ -23332,7 +23332,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
23332
23332
|
this.instructions = "Pass --limit <n> to choose how many records the filter applies to. To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
|
|
23333
23333
|
}
|
|
23334
23334
|
}
|
|
23335
|
-
function
|
|
23335
|
+
function countRecords(data) {
|
|
23336
|
+
if (Array.isArray(data))
|
|
23337
|
+
return data.length;
|
|
23338
|
+
return data == null ? 0 : 1;
|
|
23339
|
+
}
|
|
23340
|
+
function availableFields(data) {
|
|
23341
|
+
const records = Array.isArray(data) ? data : [data];
|
|
23342
|
+
const keys = new Set;
|
|
23343
|
+
for (const record of records) {
|
|
23344
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
23345
|
+
for (const key of Object.keys(record))
|
|
23346
|
+
keys.add(key);
|
|
23347
|
+
}
|
|
23348
|
+
}
|
|
23349
|
+
return [...keys];
|
|
23350
|
+
}
|
|
23351
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
23352
|
+
const [error, decoded] = catchError2(() => JSON.parse(whole));
|
|
23353
|
+
if (!error && typeof decoded === "string")
|
|
23354
|
+
return decoded;
|
|
23355
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
23356
|
+
}
|
|
23357
|
+
function referencedFields(filter) {
|
|
23358
|
+
const top = new Set;
|
|
23359
|
+
const nested = new Set;
|
|
23360
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
23361
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
23362
|
+
const quoted = [];
|
|
23363
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
23364
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
23365
|
+
if (!isAlias) {
|
|
23366
|
+
quoted.push({
|
|
23367
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
23368
|
+
index,
|
|
23369
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
23370
|
+
});
|
|
23371
|
+
}
|
|
23372
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
23373
|
+
});
|
|
23374
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
23375
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
23376
|
+
const place = (name, index, tail) => {
|
|
23377
|
+
if (tail || index >= rootEnd)
|
|
23378
|
+
nested.add(name);
|
|
23379
|
+
else
|
|
23380
|
+
top.add(name);
|
|
23381
|
+
};
|
|
23382
|
+
for (const entry of quoted)
|
|
23383
|
+
place(entry.name, entry.index, entry.tail);
|
|
23384
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
23385
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
23386
|
+
for (const match of identifiers) {
|
|
23387
|
+
const [, name, trailing] = match;
|
|
23388
|
+
if (trailing || reserved.has(name))
|
|
23389
|
+
continue;
|
|
23390
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
23391
|
+
}
|
|
23392
|
+
return {
|
|
23393
|
+
top: [...top],
|
|
23394
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
23395
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
23396
|
+
};
|
|
23397
|
+
}
|
|
23398
|
+
function appearsBelowTopLevel(data, name) {
|
|
23399
|
+
let budget = 2000;
|
|
23400
|
+
const visit = (value, depth) => {
|
|
23401
|
+
if (budget-- <= 0 || depth > 4)
|
|
23402
|
+
return false;
|
|
23403
|
+
if (value === null || typeof value !== "object")
|
|
23404
|
+
return false;
|
|
23405
|
+
if (Array.isArray(value))
|
|
23406
|
+
return value.some((entry) => visit(entry, depth));
|
|
23407
|
+
const record = value;
|
|
23408
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
23409
|
+
return true;
|
|
23410
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
23411
|
+
};
|
|
23412
|
+
return visit(data, 0);
|
|
23413
|
+
}
|
|
23414
|
+
function alwaysNullKeys(records) {
|
|
23415
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
23416
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
23417
|
+
return [];
|
|
23418
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
23419
|
+
if (keys.length === 0)
|
|
23420
|
+
return [];
|
|
23421
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
23422
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
23423
|
+
}
|
|
23424
|
+
function carriesOnlyNulls(value) {
|
|
23425
|
+
if (value === null)
|
|
23426
|
+
return true;
|
|
23427
|
+
if (Array.isArray(value)) {
|
|
23428
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
23429
|
+
}
|
|
23430
|
+
if (typeof value === "object" && value !== undefined) {
|
|
23431
|
+
const values = Object.values(value);
|
|
23432
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
23433
|
+
}
|
|
23434
|
+
return false;
|
|
23435
|
+
}
|
|
23436
|
+
function nameList(names, cap2 = 12) {
|
|
23437
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
23438
|
+
const rest = names.length - shown.length;
|
|
23439
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
23440
|
+
}
|
|
23441
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
23442
|
+
const present = availableFields(data);
|
|
23443
|
+
const refs = referencedFields(filter);
|
|
23444
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
23445
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
23446
|
+
const count = countRecords(data);
|
|
23447
|
+
const scope = `${count} record(s)`;
|
|
23448
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
23449
|
+
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" : "";
|
|
23450
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
23451
|
+
let detail;
|
|
23452
|
+
let lede;
|
|
23453
|
+
if (outcome.kind === "null-elements") {
|
|
23454
|
+
lede = "returned only null values";
|
|
23455
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
23456
|
+
if (unknown.length > 0) {
|
|
23457
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
23458
|
+
} else if (unchecked.length > 0) {
|
|
23459
|
+
detail = withSoundness(projected);
|
|
23460
|
+
} else {
|
|
23461
|
+
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`;
|
|
23462
|
+
}
|
|
23463
|
+
} else if (outcome.kind === "null-rows") {
|
|
23464
|
+
lede = "returned only null values";
|
|
23465
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
23466
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
23467
|
+
} else if (outcome.kind === "null-values") {
|
|
23468
|
+
lede = "returned only null values";
|
|
23469
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
23470
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
23471
|
+
if (sameSet) {
|
|
23472
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
23473
|
+
} else if (unknown.length > 0) {
|
|
23474
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
23475
|
+
} else {
|
|
23476
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
23477
|
+
}
|
|
23478
|
+
} else {
|
|
23479
|
+
lede = "returned nothing";
|
|
23480
|
+
if (unknown.length > 0) {
|
|
23481
|
+
detail = isNotAField(unknown);
|
|
23482
|
+
} else {
|
|
23483
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
23484
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
23485
|
+
}
|
|
23486
|
+
}
|
|
23487
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
23488
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
23489
|
+
}
|
|
23490
|
+
function appendWarning(existing, note) {
|
|
23491
|
+
return existing ? `${existing} ${note}` : note;
|
|
23492
|
+
}
|
|
23493
|
+
function applyFilter(data, filter, onWarning) {
|
|
23336
23494
|
const codec = requireJmespath();
|
|
23337
23495
|
let result;
|
|
23338
23496
|
try {
|
|
@@ -23340,9 +23498,34 @@ function applyFilter(data, filter) {
|
|
|
23340
23498
|
} catch (err) {
|
|
23341
23499
|
throw new FilterEvaluationError(filter, err);
|
|
23342
23500
|
}
|
|
23343
|
-
|
|
23501
|
+
const inputCount = countRecords(data);
|
|
23502
|
+
const warn = (outcome) => {
|
|
23503
|
+
if (inputCount === 0)
|
|
23504
|
+
return;
|
|
23505
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
23506
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
23507
|
+
`);
|
|
23508
|
+
onWarning?.(note);
|
|
23509
|
+
};
|
|
23510
|
+
const warnIfAllNull = (records) => {
|
|
23511
|
+
const keys = alwaysNullKeys(records);
|
|
23512
|
+
if (keys.length > 0)
|
|
23513
|
+
warn({ kind: "null-values", keys });
|
|
23514
|
+
};
|
|
23515
|
+
if (result == null) {
|
|
23516
|
+
warn({ kind: "empty" });
|
|
23344
23517
|
return [];
|
|
23518
|
+
}
|
|
23345
23519
|
if (Array.isArray(result)) {
|
|
23520
|
+
if (result.length === 0) {
|
|
23521
|
+
warn({ kind: "empty" });
|
|
23522
|
+
} else if (result.every((entry) => entry === null)) {
|
|
23523
|
+
warn({ kind: "null-elements", count: result.length });
|
|
23524
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
23525
|
+
warn({ kind: "null-rows", count: result.length });
|
|
23526
|
+
} else {
|
|
23527
|
+
warnIfAllNull(result);
|
|
23528
|
+
}
|
|
23346
23529
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
23347
23530
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
23348
23531
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -23350,10 +23533,30 @@ function applyFilter(data, filter) {
|
|
|
23350
23533
|
}
|
|
23351
23534
|
return result;
|
|
23352
23535
|
}
|
|
23353
|
-
if (typeof result === "object")
|
|
23536
|
+
if (typeof result === "object") {
|
|
23537
|
+
warnIfAllNull([result]);
|
|
23354
23538
|
return result;
|
|
23539
|
+
}
|
|
23355
23540
|
return { Value: result };
|
|
23356
23541
|
}
|
|
23542
|
+
function filterFailureData(envelope) {
|
|
23543
|
+
const filter = getOutputFilter();
|
|
23544
|
+
const data = envelope.Data;
|
|
23545
|
+
if (!filter || data == null)
|
|
23546
|
+
return;
|
|
23547
|
+
let note;
|
|
23548
|
+
const [filterError, filtered] = catchError2(() => applyFilter(data, filter, (n) => {
|
|
23549
|
+
note = n;
|
|
23550
|
+
}));
|
|
23551
|
+
if (filterError) {
|
|
23552
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
23553
|
+
return;
|
|
23554
|
+
}
|
|
23555
|
+
envelope.Data = filtered;
|
|
23556
|
+
if (note) {
|
|
23557
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
23558
|
+
}
|
|
23559
|
+
}
|
|
23357
23560
|
function defaultErrorCodeForResult(result) {
|
|
23358
23561
|
switch (result) {
|
|
23359
23562
|
case RESULTS.AuthenticationError:
|
|
@@ -23436,8 +23639,14 @@ var OutputFormatter;
|
|
|
23436
23639
|
}
|
|
23437
23640
|
const filter = getOutputFilter();
|
|
23438
23641
|
if (filter) {
|
|
23439
|
-
|
|
23642
|
+
let note;
|
|
23643
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
23644
|
+
note = n;
|
|
23645
|
+
});
|
|
23440
23646
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
23647
|
+
if (note) {
|
|
23648
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
23649
|
+
}
|
|
23441
23650
|
}
|
|
23442
23651
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
23443
23652
|
}
|
|
@@ -23465,6 +23674,7 @@ var OutputFormatter;
|
|
|
23465
23674
|
delete envelope.TelemetryErrorClass;
|
|
23466
23675
|
delete envelope.TelemetryTerminalOutcome;
|
|
23467
23676
|
delete envelope.TelemetryTerminalSignal;
|
|
23677
|
+
filterFailureData(envelope);
|
|
23468
23678
|
if (!suppressTelemetry) {
|
|
23469
23679
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
23470
23680
|
result: data.Result,
|
|
@@ -23513,13 +23723,20 @@ var OutputFormatter;
|
|
|
23513
23723
|
OutputFormatter2.log = log;
|
|
23514
23724
|
function formatToString(data) {
|
|
23515
23725
|
const filter = getOutputFilter();
|
|
23726
|
+
const envelope = data;
|
|
23516
23727
|
if ("Data" in data && data.Data != null) {
|
|
23517
23728
|
data.Data = normalizeDataKeys(data.Data);
|
|
23518
23729
|
if (filter) {
|
|
23519
|
-
|
|
23730
|
+
let note;
|
|
23731
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
23732
|
+
note = n;
|
|
23733
|
+
}));
|
|
23734
|
+
if (note) {
|
|
23735
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
23736
|
+
}
|
|
23520
23737
|
}
|
|
23521
23738
|
}
|
|
23522
|
-
const output = normalizeOutputKeys(
|
|
23739
|
+
const output = normalizeOutputKeys(envelope);
|
|
23523
23740
|
const lines = [];
|
|
23524
23741
|
const sink = getOutputSink();
|
|
23525
23742
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -25456,7 +25673,7 @@ var registerCommands = async (program2) => {
|
|
|
25456
25673
|
var package_default2 = {
|
|
25457
25674
|
name: "@uipath/apms-tool",
|
|
25458
25675
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
25459
|
-
version: "1.202.1-preview.
|
|
25676
|
+
version: "1.202.1-preview.238",
|
|
25460
25677
|
description: "CLI plugin for the UiPath Access Policy Management Service.",
|
|
25461
25678
|
private: false,
|
|
25462
25679
|
repository: {
|
|
@@ -30653,7 +30870,165 @@ class FilterImplicitLimitError2 extends Error {
|
|
|
30653
30870
|
this.instructions = "Pass --limit <n> to choose how many records the filter applies to. " + "To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
|
|
30654
30871
|
}
|
|
30655
30872
|
}
|
|
30656
|
-
function
|
|
30873
|
+
function countRecords2(data) {
|
|
30874
|
+
if (Array.isArray(data))
|
|
30875
|
+
return data.length;
|
|
30876
|
+
return data == null ? 0 : 1;
|
|
30877
|
+
}
|
|
30878
|
+
function availableFields2(data) {
|
|
30879
|
+
const records = Array.isArray(data) ? data : [data];
|
|
30880
|
+
const keys = new Set;
|
|
30881
|
+
for (const record of records) {
|
|
30882
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
30883
|
+
for (const key of Object.keys(record))
|
|
30884
|
+
keys.add(key);
|
|
30885
|
+
}
|
|
30886
|
+
}
|
|
30887
|
+
return [...keys];
|
|
30888
|
+
}
|
|
30889
|
+
function decodeQuotedIdentifier2(whole, inner) {
|
|
30890
|
+
const [error, decoded] = catchError5(() => JSON.parse(whole));
|
|
30891
|
+
if (!error && typeof decoded === "string")
|
|
30892
|
+
return decoded;
|
|
30893
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
30894
|
+
}
|
|
30895
|
+
function referencedFields2(filter) {
|
|
30896
|
+
const top = new Set;
|
|
30897
|
+
const nested = new Set;
|
|
30898
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
30899
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
30900
|
+
const quoted = [];
|
|
30901
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
30902
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
30903
|
+
if (!isAlias) {
|
|
30904
|
+
quoted.push({
|
|
30905
|
+
name: decodeQuotedIdentifier2(whole, name),
|
|
30906
|
+
index,
|
|
30907
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
30908
|
+
});
|
|
30909
|
+
}
|
|
30910
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
30911
|
+
});
|
|
30912
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
30913
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
30914
|
+
const place = (name, index, tail) => {
|
|
30915
|
+
if (tail || index >= rootEnd)
|
|
30916
|
+
nested.add(name);
|
|
30917
|
+
else
|
|
30918
|
+
top.add(name);
|
|
30919
|
+
};
|
|
30920
|
+
for (const entry of quoted)
|
|
30921
|
+
place(entry.name, entry.index, entry.tail);
|
|
30922
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
30923
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
30924
|
+
for (const match of identifiers) {
|
|
30925
|
+
const [, name, trailing] = match;
|
|
30926
|
+
if (trailing || reserved.has(name))
|
|
30927
|
+
continue;
|
|
30928
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
30929
|
+
}
|
|
30930
|
+
return {
|
|
30931
|
+
top: [...top],
|
|
30932
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
30933
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
30934
|
+
};
|
|
30935
|
+
}
|
|
30936
|
+
function appearsBelowTopLevel2(data, name) {
|
|
30937
|
+
let budget = 2000;
|
|
30938
|
+
const visit = (value, depth) => {
|
|
30939
|
+
if (budget-- <= 0 || depth > 4)
|
|
30940
|
+
return false;
|
|
30941
|
+
if (value === null || typeof value !== "object")
|
|
30942
|
+
return false;
|
|
30943
|
+
if (Array.isArray(value))
|
|
30944
|
+
return value.some((entry) => visit(entry, depth));
|
|
30945
|
+
const record = value;
|
|
30946
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
30947
|
+
return true;
|
|
30948
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
30949
|
+
};
|
|
30950
|
+
return visit(data, 0);
|
|
30951
|
+
}
|
|
30952
|
+
function alwaysNullKeys2(records) {
|
|
30953
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
30954
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
30955
|
+
return [];
|
|
30956
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
30957
|
+
if (keys.length === 0)
|
|
30958
|
+
return [];
|
|
30959
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
30960
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
30961
|
+
}
|
|
30962
|
+
function carriesOnlyNulls2(value) {
|
|
30963
|
+
if (value === null)
|
|
30964
|
+
return true;
|
|
30965
|
+
if (Array.isArray(value)) {
|
|
30966
|
+
return value.length > 0 && value.every(carriesOnlyNulls2);
|
|
30967
|
+
}
|
|
30968
|
+
if (typeof value === "object" && value !== undefined) {
|
|
30969
|
+
const values = Object.values(value);
|
|
30970
|
+
return values.length > 0 && values.every(carriesOnlyNulls2);
|
|
30971
|
+
}
|
|
30972
|
+
return false;
|
|
30973
|
+
}
|
|
30974
|
+
function nameList2(names, cap3 = 12) {
|
|
30975
|
+
const shown = names.slice(0, cap3).map((n) => `\`${n}\``);
|
|
30976
|
+
const rest = names.length - shown.length;
|
|
30977
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
30978
|
+
}
|
|
30979
|
+
function buildFilterWarning2(filter, data, outcome) {
|
|
30980
|
+
const present = availableFields2(data);
|
|
30981
|
+
const refs = referencedFields2(filter);
|
|
30982
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel2(data, name));
|
|
30983
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
30984
|
+
const count = countRecords2(data);
|
|
30985
|
+
const scope = `${count} record(s)`;
|
|
30986
|
+
const isNotAField = (names) => `${nameList2(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
30987
|
+
const soundness = unchecked.length > 0 ? `${nameList2(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" : "";
|
|
30988
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
30989
|
+
let detail;
|
|
30990
|
+
let lede;
|
|
30991
|
+
if (outcome.kind === "null-elements") {
|
|
30992
|
+
lede = "returned only null values";
|
|
30993
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
30994
|
+
if (unknown.length > 0) {
|
|
30995
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
30996
|
+
} else if (unchecked.length > 0) {
|
|
30997
|
+
detail = withSoundness(projected);
|
|
30998
|
+
} else {
|
|
30999
|
+
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`;
|
|
31000
|
+
}
|
|
31001
|
+
} else if (outcome.kind === "null-rows") {
|
|
31002
|
+
lede = "returned only null values";
|
|
31003
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
31004
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
31005
|
+
} else if (outcome.kind === "null-values") {
|
|
31006
|
+
lede = "returned only null values";
|
|
31007
|
+
const projected = `every key it projected (${nameList2(outcome.keys)}) is null`;
|
|
31008
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
31009
|
+
if (sameSet) {
|
|
31010
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
31011
|
+
} else if (unknown.length > 0) {
|
|
31012
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
31013
|
+
} else {
|
|
31014
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
31015
|
+
}
|
|
31016
|
+
} else {
|
|
31017
|
+
lede = "returned nothing";
|
|
31018
|
+
if (unknown.length > 0) {
|
|
31019
|
+
detail = isNotAField(unknown);
|
|
31020
|
+
} else {
|
|
31021
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
31022
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
31023
|
+
}
|
|
31024
|
+
}
|
|
31025
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList2(present)}.` : "";
|
|
31026
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
31027
|
+
}
|
|
31028
|
+
function appendWarning2(existing, note) {
|
|
31029
|
+
return existing ? `${existing} ${note}` : note;
|
|
31030
|
+
}
|
|
31031
|
+
function applyFilter2(data, filter, onWarning) {
|
|
30657
31032
|
const codec = requireJmespath2();
|
|
30658
31033
|
let result;
|
|
30659
31034
|
try {
|
|
@@ -30661,9 +31036,34 @@ function applyFilter2(data, filter) {
|
|
|
30661
31036
|
} catch (err) {
|
|
30662
31037
|
throw new FilterEvaluationError2(filter, err);
|
|
30663
31038
|
}
|
|
30664
|
-
|
|
31039
|
+
const inputCount = countRecords2(data);
|
|
31040
|
+
const warn = (outcome) => {
|
|
31041
|
+
if (inputCount === 0)
|
|
31042
|
+
return;
|
|
31043
|
+
const note = buildFilterWarning2(filter, data, outcome);
|
|
31044
|
+
getOutputSink2().writeErr(`[WARN] ${note}
|
|
31045
|
+
`);
|
|
31046
|
+
onWarning?.(note);
|
|
31047
|
+
};
|
|
31048
|
+
const warnIfAllNull = (records) => {
|
|
31049
|
+
const keys = alwaysNullKeys2(records);
|
|
31050
|
+
if (keys.length > 0)
|
|
31051
|
+
warn({ kind: "null-values", keys });
|
|
31052
|
+
};
|
|
31053
|
+
if (result == null) {
|
|
31054
|
+
warn({ kind: "empty" });
|
|
30665
31055
|
return [];
|
|
31056
|
+
}
|
|
30666
31057
|
if (Array.isArray(result)) {
|
|
31058
|
+
if (result.length === 0) {
|
|
31059
|
+
warn({ kind: "empty" });
|
|
31060
|
+
} else if (result.every((entry) => entry === null)) {
|
|
31061
|
+
warn({ kind: "null-elements", count: result.length });
|
|
31062
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls2(result)) {
|
|
31063
|
+
warn({ kind: "null-rows", count: result.length });
|
|
31064
|
+
} else {
|
|
31065
|
+
warnIfAllNull(result);
|
|
31066
|
+
}
|
|
30667
31067
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
30668
31068
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
30669
31069
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -30671,10 +31071,30 @@ function applyFilter2(data, filter) {
|
|
|
30671
31071
|
}
|
|
30672
31072
|
return result;
|
|
30673
31073
|
}
|
|
30674
|
-
if (typeof result === "object")
|
|
31074
|
+
if (typeof result === "object") {
|
|
31075
|
+
warnIfAllNull([result]);
|
|
30675
31076
|
return result;
|
|
31077
|
+
}
|
|
30676
31078
|
return { Value: result };
|
|
30677
31079
|
}
|
|
31080
|
+
function filterFailureData2(envelope) {
|
|
31081
|
+
const filter = getOutputFilter2();
|
|
31082
|
+
const data = envelope.Data;
|
|
31083
|
+
if (!filter || data == null)
|
|
31084
|
+
return;
|
|
31085
|
+
let note;
|
|
31086
|
+
const [filterError, filtered] = catchError5(() => applyFilter2(data, filter, (n) => {
|
|
31087
|
+
note = n;
|
|
31088
|
+
}));
|
|
31089
|
+
if (filterError) {
|
|
31090
|
+
envelope.Warning = appendWarning2(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
31091
|
+
return;
|
|
31092
|
+
}
|
|
31093
|
+
envelope.Data = filtered;
|
|
31094
|
+
if (note) {
|
|
31095
|
+
envelope.Warning = appendWarning2(envelope.Warning, note);
|
|
31096
|
+
}
|
|
31097
|
+
}
|
|
30678
31098
|
function defaultErrorCodeForResult2(result) {
|
|
30679
31099
|
switch (result) {
|
|
30680
31100
|
case RESULTS2.AuthenticationError:
|
|
@@ -30757,8 +31177,14 @@ var OutputFormatter2;
|
|
|
30757
31177
|
}
|
|
30758
31178
|
const filter = getOutputFilter2();
|
|
30759
31179
|
if (filter) {
|
|
30760
|
-
|
|
31180
|
+
let note;
|
|
31181
|
+
const filtered = applyFilter2(data.Data, filter, (n) => {
|
|
31182
|
+
note = n;
|
|
31183
|
+
});
|
|
30761
31184
|
data.Data = normalize ? normalizeDataKeys2(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
31185
|
+
if (note) {
|
|
31186
|
+
data.Warning = appendWarning2(data.Warning, note);
|
|
31187
|
+
}
|
|
30762
31188
|
}
|
|
30763
31189
|
logOutput2(normalizeOutputKeys2(data), getOutputFormat2(), options?.tableRowStyle);
|
|
30764
31190
|
}
|
|
@@ -30786,6 +31212,7 @@ var OutputFormatter2;
|
|
|
30786
31212
|
delete envelope.TelemetryErrorClass;
|
|
30787
31213
|
delete envelope.TelemetryTerminalOutcome;
|
|
30788
31214
|
delete envelope.TelemetryTerminalSignal;
|
|
31215
|
+
filterFailureData2(envelope);
|
|
30789
31216
|
if (!suppressTelemetry) {
|
|
30790
31217
|
telemetry2.trackEvent(CommonTelemetryEvents2.Error, {
|
|
30791
31218
|
result: data.Result,
|
|
@@ -30834,13 +31261,20 @@ var OutputFormatter2;
|
|
|
30834
31261
|
OutputFormatter.log = log;
|
|
30835
31262
|
function formatToString(data) {
|
|
30836
31263
|
const filter = getOutputFilter2();
|
|
31264
|
+
const envelope = data;
|
|
30837
31265
|
if ("Data" in data && data.Data != null) {
|
|
30838
31266
|
data.Data = normalizeDataKeys2(data.Data);
|
|
30839
31267
|
if (filter) {
|
|
30840
|
-
|
|
31268
|
+
let note;
|
|
31269
|
+
data.Data = normalizeDataKeys2(applyFilter2(data.Data, filter, (n) => {
|
|
31270
|
+
note = n;
|
|
31271
|
+
}));
|
|
31272
|
+
if (note) {
|
|
31273
|
+
envelope.Warning = appendWarning2(envelope.Warning, note);
|
|
31274
|
+
}
|
|
30841
31275
|
}
|
|
30842
31276
|
}
|
|
30843
|
-
const output = normalizeOutputKeys2(
|
|
31277
|
+
const output = normalizeOutputKeys2(envelope);
|
|
30844
31278
|
const lines = [];
|
|
30845
31279
|
const sink = getOutputSink2();
|
|
30846
31280
|
printOutput2(output, getOutputFormat2(), (msg) => {
|
|
@@ -48344,7 +48778,7 @@ var registerCommands6 = async (program3) => {
|
|
|
48344
48778
|
var package_default8 = {
|
|
48345
48779
|
name: "@uipath/resourcecatalog-tool",
|
|
48346
48780
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
48347
|
-
version: "1.202.1-preview.
|
|
48781
|
+
version: "1.202.1-preview.238",
|
|
48348
48782
|
description: "CLI plugin for the UiPath Resource Catalog Service.",
|
|
48349
48783
|
private: false,
|
|
48350
48784
|
repository: {
|
|
@@ -50292,7 +50726,7 @@ var registerCommands7 = async (program3) => {
|
|
|
50292
50726
|
var package_default10 = {
|
|
50293
50727
|
name: "@uipath/admin-tool",
|
|
50294
50728
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
50295
|
-
version: "1.202.1-preview.
|
|
50729
|
+
version: "1.202.1-preview.238",
|
|
50296
50730
|
description: "Manage UiPath admin resources — Identity Server, Resource Catalog Service, Audit Service, VPN Gateway.",
|
|
50297
50731
|
private: false,
|
|
50298
50732
|
repository: {
|
|
@@ -50357,4 +50791,4 @@ export {
|
|
|
50357
50791
|
registerCommands8 as registerCommands
|
|
50358
50792
|
};
|
|
50359
50793
|
|
|
50360
|
-
//# debugId=
|
|
50794
|
+
//# debugId=929C87CFB512923164756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/admin-tool",
|
|
3
3
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
4
|
-
"version": "1.202.1-preview.
|
|
4
|
+
"version": "1.202.1-preview.238",
|
|
5
5
|
"description": "Manage UiPath admin resources — Identity Server, Resource Catalog Service, Audit Service, VPN Gateway.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"files": [
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
|
|
27
27
|
}
|