@uipath/platform-tool 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/index.js +1 -1
- package/dist/{tool-6x9ne1hy.js → tool-1wxhk8ng.js} +225 -8
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27337,7 +27337,7 @@ var package_default = {
|
|
|
27337
27337
|
name: "@uipath/platform-tool",
|
|
27338
27338
|
author: "UiPath",
|
|
27339
27339
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
27340
|
-
version: "1.203.0-preview.
|
|
27340
|
+
version: "1.203.0-preview.237",
|
|
27341
27341
|
description: "Manage UiPath platform-level resources such as tenant licensing.",
|
|
27342
27342
|
publishConfig: {
|
|
27343
27343
|
registry: "https://npm.pkg.github.com/"
|
|
@@ -31685,7 +31685,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
31685
31685
|
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).";
|
|
31686
31686
|
}
|
|
31687
31687
|
}
|
|
31688
|
-
function
|
|
31688
|
+
function countRecords(data) {
|
|
31689
|
+
if (Array.isArray(data))
|
|
31690
|
+
return data.length;
|
|
31691
|
+
return data == null ? 0 : 1;
|
|
31692
|
+
}
|
|
31693
|
+
function availableFields(data) {
|
|
31694
|
+
const records = Array.isArray(data) ? data : [data];
|
|
31695
|
+
const keys = new Set;
|
|
31696
|
+
for (const record of records) {
|
|
31697
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
31698
|
+
for (const key of Object.keys(record))
|
|
31699
|
+
keys.add(key);
|
|
31700
|
+
}
|
|
31701
|
+
}
|
|
31702
|
+
return [...keys];
|
|
31703
|
+
}
|
|
31704
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
31705
|
+
const [error, decoded] = catchError2(() => JSON.parse(whole));
|
|
31706
|
+
if (!error && typeof decoded === "string")
|
|
31707
|
+
return decoded;
|
|
31708
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
31709
|
+
}
|
|
31710
|
+
function referencedFields(filter) {
|
|
31711
|
+
const top = new Set;
|
|
31712
|
+
const nested = new Set;
|
|
31713
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
31714
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
31715
|
+
const quoted = [];
|
|
31716
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
31717
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
31718
|
+
if (!isAlias) {
|
|
31719
|
+
quoted.push({
|
|
31720
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
31721
|
+
index,
|
|
31722
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
31723
|
+
});
|
|
31724
|
+
}
|
|
31725
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
31726
|
+
});
|
|
31727
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
31728
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
31729
|
+
const place = (name, index, tail) => {
|
|
31730
|
+
if (tail || index >= rootEnd)
|
|
31731
|
+
nested.add(name);
|
|
31732
|
+
else
|
|
31733
|
+
top.add(name);
|
|
31734
|
+
};
|
|
31735
|
+
for (const entry of quoted)
|
|
31736
|
+
place(entry.name, entry.index, entry.tail);
|
|
31737
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
31738
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
31739
|
+
for (const match of identifiers) {
|
|
31740
|
+
const [, name, trailing] = match;
|
|
31741
|
+
if (trailing || reserved.has(name))
|
|
31742
|
+
continue;
|
|
31743
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
31744
|
+
}
|
|
31745
|
+
return {
|
|
31746
|
+
top: [...top],
|
|
31747
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
31748
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
31749
|
+
};
|
|
31750
|
+
}
|
|
31751
|
+
function appearsBelowTopLevel(data, name) {
|
|
31752
|
+
let budget = 2000;
|
|
31753
|
+
const visit = (value, depth) => {
|
|
31754
|
+
if (budget-- <= 0 || depth > 4)
|
|
31755
|
+
return false;
|
|
31756
|
+
if (value === null || typeof value !== "object")
|
|
31757
|
+
return false;
|
|
31758
|
+
if (Array.isArray(value))
|
|
31759
|
+
return value.some((entry) => visit(entry, depth));
|
|
31760
|
+
const record = value;
|
|
31761
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
31762
|
+
return true;
|
|
31763
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
31764
|
+
};
|
|
31765
|
+
return visit(data, 0);
|
|
31766
|
+
}
|
|
31767
|
+
function alwaysNullKeys(records) {
|
|
31768
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
31769
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
31770
|
+
return [];
|
|
31771
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
31772
|
+
if (keys.length === 0)
|
|
31773
|
+
return [];
|
|
31774
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
31775
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
31776
|
+
}
|
|
31777
|
+
function carriesOnlyNulls(value) {
|
|
31778
|
+
if (value === null)
|
|
31779
|
+
return true;
|
|
31780
|
+
if (Array.isArray(value)) {
|
|
31781
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
31782
|
+
}
|
|
31783
|
+
if (typeof value === "object" && value !== undefined) {
|
|
31784
|
+
const values = Object.values(value);
|
|
31785
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
31786
|
+
}
|
|
31787
|
+
return false;
|
|
31788
|
+
}
|
|
31789
|
+
function nameList(names, cap2 = 12) {
|
|
31790
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
31791
|
+
const rest = names.length - shown.length;
|
|
31792
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
31793
|
+
}
|
|
31794
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
31795
|
+
const present = availableFields(data);
|
|
31796
|
+
const refs = referencedFields(filter);
|
|
31797
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
31798
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
31799
|
+
const count = countRecords(data);
|
|
31800
|
+
const scope = `${count} record(s)`;
|
|
31801
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
31802
|
+
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" : "";
|
|
31803
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
31804
|
+
let detail;
|
|
31805
|
+
let lede;
|
|
31806
|
+
if (outcome.kind === "null-elements") {
|
|
31807
|
+
lede = "returned only null values";
|
|
31808
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
31809
|
+
if (unknown.length > 0) {
|
|
31810
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
31811
|
+
} else if (unchecked.length > 0) {
|
|
31812
|
+
detail = withSoundness(projected);
|
|
31813
|
+
} else {
|
|
31814
|
+
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`;
|
|
31815
|
+
}
|
|
31816
|
+
} else if (outcome.kind === "null-rows") {
|
|
31817
|
+
lede = "returned only null values";
|
|
31818
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
31819
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
31820
|
+
} else if (outcome.kind === "null-values") {
|
|
31821
|
+
lede = "returned only null values";
|
|
31822
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
31823
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
31824
|
+
if (sameSet) {
|
|
31825
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
31826
|
+
} else if (unknown.length > 0) {
|
|
31827
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
31828
|
+
} else {
|
|
31829
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
31830
|
+
}
|
|
31831
|
+
} else {
|
|
31832
|
+
lede = "returned nothing";
|
|
31833
|
+
if (unknown.length > 0) {
|
|
31834
|
+
detail = isNotAField(unknown);
|
|
31835
|
+
} else {
|
|
31836
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
31837
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
31838
|
+
}
|
|
31839
|
+
}
|
|
31840
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
31841
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
31842
|
+
}
|
|
31843
|
+
function appendWarning(existing, note) {
|
|
31844
|
+
return existing ? `${existing} ${note}` : note;
|
|
31845
|
+
}
|
|
31846
|
+
function applyFilter(data, filter, onWarning) {
|
|
31689
31847
|
const codec = requireJmespath();
|
|
31690
31848
|
let result;
|
|
31691
31849
|
try {
|
|
@@ -31693,9 +31851,34 @@ function applyFilter(data, filter) {
|
|
|
31693
31851
|
} catch (err) {
|
|
31694
31852
|
throw new FilterEvaluationError(filter, err);
|
|
31695
31853
|
}
|
|
31696
|
-
|
|
31854
|
+
const inputCount = countRecords(data);
|
|
31855
|
+
const warn = (outcome) => {
|
|
31856
|
+
if (inputCount === 0)
|
|
31857
|
+
return;
|
|
31858
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
31859
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
31860
|
+
`);
|
|
31861
|
+
onWarning?.(note);
|
|
31862
|
+
};
|
|
31863
|
+
const warnIfAllNull = (records) => {
|
|
31864
|
+
const keys = alwaysNullKeys(records);
|
|
31865
|
+
if (keys.length > 0)
|
|
31866
|
+
warn({ kind: "null-values", keys });
|
|
31867
|
+
};
|
|
31868
|
+
if (result == null) {
|
|
31869
|
+
warn({ kind: "empty" });
|
|
31697
31870
|
return [];
|
|
31871
|
+
}
|
|
31698
31872
|
if (Array.isArray(result)) {
|
|
31873
|
+
if (result.length === 0) {
|
|
31874
|
+
warn({ kind: "empty" });
|
|
31875
|
+
} else if (result.every((entry) => entry === null)) {
|
|
31876
|
+
warn({ kind: "null-elements", count: result.length });
|
|
31877
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
31878
|
+
warn({ kind: "null-rows", count: result.length });
|
|
31879
|
+
} else {
|
|
31880
|
+
warnIfAllNull(result);
|
|
31881
|
+
}
|
|
31699
31882
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
31700
31883
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
31701
31884
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -31703,10 +31886,30 @@ function applyFilter(data, filter) {
|
|
|
31703
31886
|
}
|
|
31704
31887
|
return result;
|
|
31705
31888
|
}
|
|
31706
|
-
if (typeof result === "object")
|
|
31889
|
+
if (typeof result === "object") {
|
|
31890
|
+
warnIfAllNull([result]);
|
|
31707
31891
|
return result;
|
|
31892
|
+
}
|
|
31708
31893
|
return { Value: result };
|
|
31709
31894
|
}
|
|
31895
|
+
function filterFailureData(envelope) {
|
|
31896
|
+
const filter = getOutputFilter();
|
|
31897
|
+
const data = envelope.Data;
|
|
31898
|
+
if (!filter || data == null)
|
|
31899
|
+
return;
|
|
31900
|
+
let note;
|
|
31901
|
+
const [filterError, filtered] = catchError2(() => applyFilter(data, filter, (n) => {
|
|
31902
|
+
note = n;
|
|
31903
|
+
}));
|
|
31904
|
+
if (filterError) {
|
|
31905
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
31906
|
+
return;
|
|
31907
|
+
}
|
|
31908
|
+
envelope.Data = filtered;
|
|
31909
|
+
if (note) {
|
|
31910
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
31911
|
+
}
|
|
31912
|
+
}
|
|
31710
31913
|
function defaultErrorCodeForResult(result) {
|
|
31711
31914
|
switch (result) {
|
|
31712
31915
|
case RESULTS.AuthenticationError:
|
|
@@ -31789,8 +31992,14 @@ var OutputFormatter;
|
|
|
31789
31992
|
}
|
|
31790
31993
|
const filter = getOutputFilter();
|
|
31791
31994
|
if (filter) {
|
|
31792
|
-
|
|
31995
|
+
let note;
|
|
31996
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
31997
|
+
note = n;
|
|
31998
|
+
});
|
|
31793
31999
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
32000
|
+
if (note) {
|
|
32001
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
32002
|
+
}
|
|
31794
32003
|
}
|
|
31795
32004
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
31796
32005
|
}
|
|
@@ -31818,6 +32027,7 @@ var OutputFormatter;
|
|
|
31818
32027
|
delete envelope.TelemetryErrorClass;
|
|
31819
32028
|
delete envelope.TelemetryTerminalOutcome;
|
|
31820
32029
|
delete envelope.TelemetryTerminalSignal;
|
|
32030
|
+
filterFailureData(envelope);
|
|
31821
32031
|
if (!suppressTelemetry) {
|
|
31822
32032
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
31823
32033
|
result: data.Result,
|
|
@@ -31866,13 +32076,20 @@ var OutputFormatter;
|
|
|
31866
32076
|
OutputFormatter.log = log;
|
|
31867
32077
|
function formatToString(data) {
|
|
31868
32078
|
const filter = getOutputFilter();
|
|
32079
|
+
const envelope = data;
|
|
31869
32080
|
if ("Data" in data && data.Data != null) {
|
|
31870
32081
|
data.Data = normalizeDataKeys(data.Data);
|
|
31871
32082
|
if (filter) {
|
|
31872
|
-
|
|
32083
|
+
let note;
|
|
32084
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
32085
|
+
note = n;
|
|
32086
|
+
}));
|
|
32087
|
+
if (note) {
|
|
32088
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
32089
|
+
}
|
|
31873
32090
|
}
|
|
31874
32091
|
}
|
|
31875
|
-
const output = normalizeOutputKeys(
|
|
32092
|
+
const output = normalizeOutputKeys(envelope);
|
|
31876
32093
|
const lines = [];
|
|
31877
32094
|
const sink = getOutputSink();
|
|
31878
32095
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -36655,4 +36872,4 @@ var registerCommands = async (program2) => {
|
|
|
36655
36872
|
|
|
36656
36873
|
export { Command, metadata, registerCommands };
|
|
36657
36874
|
|
|
36658
|
-
//# debugId=
|
|
36875
|
+
//# debugId=D61741171547A27E64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/platform-tool",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.203.0-preview.
|
|
5
|
+
"version": "1.203.0-preview.237",
|
|
6
6
|
"description": "Manage UiPath platform-level resources such as tenant licensing.",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"keywords": [
|
|
22
22
|
"cli-tool"
|
|
23
23
|
],
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
|
|
25
25
|
}
|