@uipath/packager-tool-datafabric 1.201.1-preview.220 → 1.201.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/init.js +448 -14
- package/package.json +2 -2
package/dist/init.js
CHANGED
|
@@ -9672,7 +9672,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
9672
9672
|
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).";
|
|
9673
9673
|
}
|
|
9674
9674
|
}
|
|
9675
|
-
function
|
|
9675
|
+
function countRecords(data) {
|
|
9676
|
+
if (Array.isArray(data))
|
|
9677
|
+
return data.length;
|
|
9678
|
+
return data == null ? 0 : 1;
|
|
9679
|
+
}
|
|
9680
|
+
function availableFields(data) {
|
|
9681
|
+
const records = Array.isArray(data) ? data : [data];
|
|
9682
|
+
const keys = new Set;
|
|
9683
|
+
for (const record of records) {
|
|
9684
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
9685
|
+
for (const key of Object.keys(record))
|
|
9686
|
+
keys.add(key);
|
|
9687
|
+
}
|
|
9688
|
+
}
|
|
9689
|
+
return [...keys];
|
|
9690
|
+
}
|
|
9691
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
9692
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
9693
|
+
if (!error && typeof decoded === "string")
|
|
9694
|
+
return decoded;
|
|
9695
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
9696
|
+
}
|
|
9697
|
+
function referencedFields(filter) {
|
|
9698
|
+
const top = new Set;
|
|
9699
|
+
const nested = new Set;
|
|
9700
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
9701
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
9702
|
+
const quoted = [];
|
|
9703
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
9704
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
9705
|
+
if (!isAlias) {
|
|
9706
|
+
quoted.push({
|
|
9707
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
9708
|
+
index,
|
|
9709
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
9710
|
+
});
|
|
9711
|
+
}
|
|
9712
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
9713
|
+
});
|
|
9714
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
9715
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
9716
|
+
const place = (name, index, tail) => {
|
|
9717
|
+
if (tail || index >= rootEnd)
|
|
9718
|
+
nested.add(name);
|
|
9719
|
+
else
|
|
9720
|
+
top.add(name);
|
|
9721
|
+
};
|
|
9722
|
+
for (const entry of quoted)
|
|
9723
|
+
place(entry.name, entry.index, entry.tail);
|
|
9724
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
9725
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
9726
|
+
for (const match of identifiers) {
|
|
9727
|
+
const [, name, trailing] = match;
|
|
9728
|
+
if (trailing || reserved.has(name))
|
|
9729
|
+
continue;
|
|
9730
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
9731
|
+
}
|
|
9732
|
+
return {
|
|
9733
|
+
top: [...top],
|
|
9734
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
9735
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
9736
|
+
};
|
|
9737
|
+
}
|
|
9738
|
+
function appearsBelowTopLevel(data, name) {
|
|
9739
|
+
let budget = 2000;
|
|
9740
|
+
const visit = (value, depth) => {
|
|
9741
|
+
if (budget-- <= 0 || depth > 4)
|
|
9742
|
+
return false;
|
|
9743
|
+
if (value === null || typeof value !== "object")
|
|
9744
|
+
return false;
|
|
9745
|
+
if (Array.isArray(value))
|
|
9746
|
+
return value.some((entry) => visit(entry, depth));
|
|
9747
|
+
const record = value;
|
|
9748
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
9749
|
+
return true;
|
|
9750
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
9751
|
+
};
|
|
9752
|
+
return visit(data, 0);
|
|
9753
|
+
}
|
|
9754
|
+
function alwaysNullKeys(records) {
|
|
9755
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
9756
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
9757
|
+
return [];
|
|
9758
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
9759
|
+
if (keys.length === 0)
|
|
9760
|
+
return [];
|
|
9761
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
9762
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
9763
|
+
}
|
|
9764
|
+
function carriesOnlyNulls(value) {
|
|
9765
|
+
if (value === null)
|
|
9766
|
+
return true;
|
|
9767
|
+
if (Array.isArray(value)) {
|
|
9768
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
9769
|
+
}
|
|
9770
|
+
if (typeof value === "object" && value !== undefined) {
|
|
9771
|
+
const values = Object.values(value);
|
|
9772
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
9773
|
+
}
|
|
9774
|
+
return false;
|
|
9775
|
+
}
|
|
9776
|
+
function nameList(names, cap2 = 12) {
|
|
9777
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
9778
|
+
const rest = names.length - shown.length;
|
|
9779
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
9780
|
+
}
|
|
9781
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
9782
|
+
const present = availableFields(data);
|
|
9783
|
+
const refs = referencedFields(filter);
|
|
9784
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
9785
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
9786
|
+
const count = countRecords(data);
|
|
9787
|
+
const scope = `${count} record(s)`;
|
|
9788
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
9789
|
+
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" : "";
|
|
9790
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
9791
|
+
let detail;
|
|
9792
|
+
let lede;
|
|
9793
|
+
if (outcome.kind === "null-elements") {
|
|
9794
|
+
lede = "returned only null values";
|
|
9795
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
9796
|
+
if (unknown.length > 0) {
|
|
9797
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
9798
|
+
} else if (unchecked.length > 0) {
|
|
9799
|
+
detail = withSoundness(projected);
|
|
9800
|
+
} else {
|
|
9801
|
+
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`;
|
|
9802
|
+
}
|
|
9803
|
+
} else if (outcome.kind === "null-rows") {
|
|
9804
|
+
lede = "returned only null values";
|
|
9805
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
9806
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
9807
|
+
} else if (outcome.kind === "null-values") {
|
|
9808
|
+
lede = "returned only null values";
|
|
9809
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
9810
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
9811
|
+
if (sameSet) {
|
|
9812
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
9813
|
+
} else if (unknown.length > 0) {
|
|
9814
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
9815
|
+
} else {
|
|
9816
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
9817
|
+
}
|
|
9818
|
+
} else {
|
|
9819
|
+
lede = "returned nothing";
|
|
9820
|
+
if (unknown.length > 0) {
|
|
9821
|
+
detail = isNotAField(unknown);
|
|
9822
|
+
} else {
|
|
9823
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
9824
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
9825
|
+
}
|
|
9826
|
+
}
|
|
9827
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
9828
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
9829
|
+
}
|
|
9830
|
+
function appendWarning(existing, note) {
|
|
9831
|
+
return existing ? `${existing} ${note}` : note;
|
|
9832
|
+
}
|
|
9833
|
+
function applyFilter(data, filter, onWarning) {
|
|
9676
9834
|
const codec = requireJmespath();
|
|
9677
9835
|
let result;
|
|
9678
9836
|
try {
|
|
@@ -9680,9 +9838,34 @@ function applyFilter(data, filter) {
|
|
|
9680
9838
|
} catch (err) {
|
|
9681
9839
|
throw new FilterEvaluationError(filter, err);
|
|
9682
9840
|
}
|
|
9683
|
-
|
|
9841
|
+
const inputCount = countRecords(data);
|
|
9842
|
+
const warn = (outcome) => {
|
|
9843
|
+
if (inputCount === 0)
|
|
9844
|
+
return;
|
|
9845
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
9846
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
9847
|
+
`);
|
|
9848
|
+
onWarning?.(note);
|
|
9849
|
+
};
|
|
9850
|
+
const warnIfAllNull = (records) => {
|
|
9851
|
+
const keys = alwaysNullKeys(records);
|
|
9852
|
+
if (keys.length > 0)
|
|
9853
|
+
warn({ kind: "null-values", keys });
|
|
9854
|
+
};
|
|
9855
|
+
if (result == null) {
|
|
9856
|
+
warn({ kind: "empty" });
|
|
9684
9857
|
return [];
|
|
9858
|
+
}
|
|
9685
9859
|
if (Array.isArray(result)) {
|
|
9860
|
+
if (result.length === 0) {
|
|
9861
|
+
warn({ kind: "empty" });
|
|
9862
|
+
} else if (result.every((entry) => entry === null)) {
|
|
9863
|
+
warn({ kind: "null-elements", count: result.length });
|
|
9864
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
9865
|
+
warn({ kind: "null-rows", count: result.length });
|
|
9866
|
+
} else {
|
|
9867
|
+
warnIfAllNull(result);
|
|
9868
|
+
}
|
|
9686
9869
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
9687
9870
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
9688
9871
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -9690,10 +9873,30 @@ function applyFilter(data, filter) {
|
|
|
9690
9873
|
}
|
|
9691
9874
|
return result;
|
|
9692
9875
|
}
|
|
9693
|
-
if (typeof result === "object")
|
|
9876
|
+
if (typeof result === "object") {
|
|
9877
|
+
warnIfAllNull([result]);
|
|
9694
9878
|
return result;
|
|
9879
|
+
}
|
|
9695
9880
|
return { Value: result };
|
|
9696
9881
|
}
|
|
9882
|
+
function filterFailureData(envelope) {
|
|
9883
|
+
const filter = getOutputFilter();
|
|
9884
|
+
const data = envelope.Data;
|
|
9885
|
+
if (!filter || data == null)
|
|
9886
|
+
return;
|
|
9887
|
+
let note;
|
|
9888
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
9889
|
+
note = n;
|
|
9890
|
+
}));
|
|
9891
|
+
if (filterError) {
|
|
9892
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
9893
|
+
return;
|
|
9894
|
+
}
|
|
9895
|
+
envelope.Data = filtered;
|
|
9896
|
+
if (note) {
|
|
9897
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
9898
|
+
}
|
|
9899
|
+
}
|
|
9697
9900
|
function defaultErrorCodeForResult(result) {
|
|
9698
9901
|
switch (result) {
|
|
9699
9902
|
case RESULTS.AuthenticationError:
|
|
@@ -9776,8 +9979,14 @@ var OutputFormatter;
|
|
|
9776
9979
|
}
|
|
9777
9980
|
const filter = getOutputFilter();
|
|
9778
9981
|
if (filter) {
|
|
9779
|
-
|
|
9982
|
+
let note;
|
|
9983
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
9984
|
+
note = n;
|
|
9985
|
+
});
|
|
9780
9986
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
9987
|
+
if (note) {
|
|
9988
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
9989
|
+
}
|
|
9781
9990
|
}
|
|
9782
9991
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
9783
9992
|
}
|
|
@@ -9805,6 +10014,7 @@ var OutputFormatter;
|
|
|
9805
10014
|
delete envelope.TelemetryErrorClass;
|
|
9806
10015
|
delete envelope.TelemetryTerminalOutcome;
|
|
9807
10016
|
delete envelope.TelemetryTerminalSignal;
|
|
10017
|
+
filterFailureData(envelope);
|
|
9808
10018
|
if (!suppressTelemetry) {
|
|
9809
10019
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
9810
10020
|
result: data.Result,
|
|
@@ -9853,13 +10063,20 @@ var OutputFormatter;
|
|
|
9853
10063
|
OutputFormatter2.log = log;
|
|
9854
10064
|
function formatToString(data) {
|
|
9855
10065
|
const filter = getOutputFilter();
|
|
10066
|
+
const envelope = data;
|
|
9856
10067
|
if ("Data" in data && data.Data != null) {
|
|
9857
10068
|
data.Data = normalizeDataKeys(data.Data);
|
|
9858
10069
|
if (filter) {
|
|
9859
|
-
|
|
10070
|
+
let note;
|
|
10071
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
10072
|
+
note = n;
|
|
10073
|
+
}));
|
|
10074
|
+
if (note) {
|
|
10075
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
10076
|
+
}
|
|
9860
10077
|
}
|
|
9861
10078
|
}
|
|
9862
|
-
const output = normalizeOutputKeys(
|
|
10079
|
+
const output = normalizeOutputKeys(envelope);
|
|
9863
10080
|
const lines = [];
|
|
9864
10081
|
const sink = getOutputSink();
|
|
9865
10082
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -19467,7 +19684,7 @@ function querystringSingleKey(key, value, keyPrefix = "") {
|
|
|
19467
19684
|
var package_default = {
|
|
19468
19685
|
name: "@uipath/solution-sdk",
|
|
19469
19686
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
19470
|
-
version: "1.202.1-preview.
|
|
19687
|
+
version: "1.202.1-preview.238",
|
|
19471
19688
|
repository: {
|
|
19472
19689
|
type: "git",
|
|
19473
19690
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -21727,7 +21944,165 @@ class FilterImplicitLimitError2 extends Error {
|
|
|
21727
21944
|
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).";
|
|
21728
21945
|
}
|
|
21729
21946
|
}
|
|
21730
|
-
function
|
|
21947
|
+
function countRecords2(data) {
|
|
21948
|
+
if (Array.isArray(data))
|
|
21949
|
+
return data.length;
|
|
21950
|
+
return data == null ? 0 : 1;
|
|
21951
|
+
}
|
|
21952
|
+
function availableFields2(data) {
|
|
21953
|
+
const records = Array.isArray(data) ? data : [data];
|
|
21954
|
+
const keys = new Set;
|
|
21955
|
+
for (const record of records) {
|
|
21956
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
21957
|
+
for (const key of Object.keys(record))
|
|
21958
|
+
keys.add(key);
|
|
21959
|
+
}
|
|
21960
|
+
}
|
|
21961
|
+
return [...keys];
|
|
21962
|
+
}
|
|
21963
|
+
function decodeQuotedIdentifier2(whole, inner) {
|
|
21964
|
+
const [error, decoded] = catchError2(() => JSON.parse(whole));
|
|
21965
|
+
if (!error && typeof decoded === "string")
|
|
21966
|
+
return decoded;
|
|
21967
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
21968
|
+
}
|
|
21969
|
+
function referencedFields2(filter) {
|
|
21970
|
+
const top = new Set;
|
|
21971
|
+
const nested = new Set;
|
|
21972
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
21973
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
21974
|
+
const quoted = [];
|
|
21975
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
21976
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
21977
|
+
if (!isAlias) {
|
|
21978
|
+
quoted.push({
|
|
21979
|
+
name: decodeQuotedIdentifier2(whole, name),
|
|
21980
|
+
index,
|
|
21981
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
21982
|
+
});
|
|
21983
|
+
}
|
|
21984
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
21985
|
+
});
|
|
21986
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
21987
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
21988
|
+
const place = (name, index, tail) => {
|
|
21989
|
+
if (tail || index >= rootEnd)
|
|
21990
|
+
nested.add(name);
|
|
21991
|
+
else
|
|
21992
|
+
top.add(name);
|
|
21993
|
+
};
|
|
21994
|
+
for (const entry of quoted)
|
|
21995
|
+
place(entry.name, entry.index, entry.tail);
|
|
21996
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
21997
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
21998
|
+
for (const match of identifiers) {
|
|
21999
|
+
const [, name, trailing] = match;
|
|
22000
|
+
if (trailing || reserved.has(name))
|
|
22001
|
+
continue;
|
|
22002
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
22003
|
+
}
|
|
22004
|
+
return {
|
|
22005
|
+
top: [...top],
|
|
22006
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
22007
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
22008
|
+
};
|
|
22009
|
+
}
|
|
22010
|
+
function appearsBelowTopLevel2(data, name) {
|
|
22011
|
+
let budget = 2000;
|
|
22012
|
+
const visit = (value, depth) => {
|
|
22013
|
+
if (budget-- <= 0 || depth > 4)
|
|
22014
|
+
return false;
|
|
22015
|
+
if (value === null || typeof value !== "object")
|
|
22016
|
+
return false;
|
|
22017
|
+
if (Array.isArray(value))
|
|
22018
|
+
return value.some((entry) => visit(entry, depth));
|
|
22019
|
+
const record = value;
|
|
22020
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
22021
|
+
return true;
|
|
22022
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
22023
|
+
};
|
|
22024
|
+
return visit(data, 0);
|
|
22025
|
+
}
|
|
22026
|
+
function alwaysNullKeys2(records) {
|
|
22027
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
22028
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
22029
|
+
return [];
|
|
22030
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
22031
|
+
if (keys.length === 0)
|
|
22032
|
+
return [];
|
|
22033
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
22034
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
22035
|
+
}
|
|
22036
|
+
function carriesOnlyNulls2(value) {
|
|
22037
|
+
if (value === null)
|
|
22038
|
+
return true;
|
|
22039
|
+
if (Array.isArray(value)) {
|
|
22040
|
+
return value.length > 0 && value.every(carriesOnlyNulls2);
|
|
22041
|
+
}
|
|
22042
|
+
if (typeof value === "object" && value !== undefined) {
|
|
22043
|
+
const values = Object.values(value);
|
|
22044
|
+
return values.length > 0 && values.every(carriesOnlyNulls2);
|
|
22045
|
+
}
|
|
22046
|
+
return false;
|
|
22047
|
+
}
|
|
22048
|
+
function nameList2(names, cap22 = 12) {
|
|
22049
|
+
const shown = names.slice(0, cap22).map((n) => `\`${n}\``);
|
|
22050
|
+
const rest = names.length - shown.length;
|
|
22051
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
22052
|
+
}
|
|
22053
|
+
function buildFilterWarning2(filter, data, outcome) {
|
|
22054
|
+
const present = availableFields2(data);
|
|
22055
|
+
const refs = referencedFields2(filter);
|
|
22056
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel2(data, name));
|
|
22057
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
22058
|
+
const count = countRecords2(data);
|
|
22059
|
+
const scope = `${count} record(s)`;
|
|
22060
|
+
const isNotAField = (names) => `${nameList2(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
22061
|
+
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" : "";
|
|
22062
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
22063
|
+
let detail;
|
|
22064
|
+
let lede;
|
|
22065
|
+
if (outcome.kind === "null-elements") {
|
|
22066
|
+
lede = "returned only null values";
|
|
22067
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
22068
|
+
if (unknown.length > 0) {
|
|
22069
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
22070
|
+
} else if (unchecked.length > 0) {
|
|
22071
|
+
detail = withSoundness(projected);
|
|
22072
|
+
} else {
|
|
22073
|
+
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`;
|
|
22074
|
+
}
|
|
22075
|
+
} else if (outcome.kind === "null-rows") {
|
|
22076
|
+
lede = "returned only null values";
|
|
22077
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
22078
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
22079
|
+
} else if (outcome.kind === "null-values") {
|
|
22080
|
+
lede = "returned only null values";
|
|
22081
|
+
const projected = `every key it projected (${nameList2(outcome.keys)}) is null`;
|
|
22082
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
22083
|
+
if (sameSet) {
|
|
22084
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
22085
|
+
} else if (unknown.length > 0) {
|
|
22086
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
22087
|
+
} else {
|
|
22088
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
22089
|
+
}
|
|
22090
|
+
} else {
|
|
22091
|
+
lede = "returned nothing";
|
|
22092
|
+
if (unknown.length > 0) {
|
|
22093
|
+
detail = isNotAField(unknown);
|
|
22094
|
+
} else {
|
|
22095
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
22096
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
22097
|
+
}
|
|
22098
|
+
}
|
|
22099
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList2(present)}.` : "";
|
|
22100
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
22101
|
+
}
|
|
22102
|
+
function appendWarning2(existing, note) {
|
|
22103
|
+
return existing ? `${existing} ${note}` : note;
|
|
22104
|
+
}
|
|
22105
|
+
function applyFilter2(data, filter, onWarning) {
|
|
21731
22106
|
const codec = requireJmespath2();
|
|
21732
22107
|
let result;
|
|
21733
22108
|
try {
|
|
@@ -21735,9 +22110,34 @@ function applyFilter2(data, filter) {
|
|
|
21735
22110
|
} catch (err) {
|
|
21736
22111
|
throw new FilterEvaluationError2(filter, err);
|
|
21737
22112
|
}
|
|
21738
|
-
|
|
22113
|
+
const inputCount = countRecords2(data);
|
|
22114
|
+
const warn = (outcome) => {
|
|
22115
|
+
if (inputCount === 0)
|
|
22116
|
+
return;
|
|
22117
|
+
const note = buildFilterWarning2(filter, data, outcome);
|
|
22118
|
+
getOutputSink2().writeErr(`[WARN] ${note}
|
|
22119
|
+
`);
|
|
22120
|
+
onWarning?.(note);
|
|
22121
|
+
};
|
|
22122
|
+
const warnIfAllNull = (records) => {
|
|
22123
|
+
const keys = alwaysNullKeys2(records);
|
|
22124
|
+
if (keys.length > 0)
|
|
22125
|
+
warn({ kind: "null-values", keys });
|
|
22126
|
+
};
|
|
22127
|
+
if (result == null) {
|
|
22128
|
+
warn({ kind: "empty" });
|
|
21739
22129
|
return [];
|
|
22130
|
+
}
|
|
21740
22131
|
if (Array.isArray(result)) {
|
|
22132
|
+
if (result.length === 0) {
|
|
22133
|
+
warn({ kind: "empty" });
|
|
22134
|
+
} else if (result.every((entry) => entry === null)) {
|
|
22135
|
+
warn({ kind: "null-elements", count: result.length });
|
|
22136
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls2(result)) {
|
|
22137
|
+
warn({ kind: "null-rows", count: result.length });
|
|
22138
|
+
} else {
|
|
22139
|
+
warnIfAllNull(result);
|
|
22140
|
+
}
|
|
21741
22141
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
21742
22142
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
21743
22143
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -21745,10 +22145,30 @@ function applyFilter2(data, filter) {
|
|
|
21745
22145
|
}
|
|
21746
22146
|
return result;
|
|
21747
22147
|
}
|
|
21748
|
-
if (typeof result === "object")
|
|
22148
|
+
if (typeof result === "object") {
|
|
22149
|
+
warnIfAllNull([result]);
|
|
21749
22150
|
return result;
|
|
22151
|
+
}
|
|
21750
22152
|
return { Value: result };
|
|
21751
22153
|
}
|
|
22154
|
+
function filterFailureData2(envelope) {
|
|
22155
|
+
const filter = getOutputFilter2();
|
|
22156
|
+
const data = envelope.Data;
|
|
22157
|
+
if (!filter || data == null)
|
|
22158
|
+
return;
|
|
22159
|
+
let note;
|
|
22160
|
+
const [filterError, filtered] = catchError2(() => applyFilter2(data, filter, (n) => {
|
|
22161
|
+
note = n;
|
|
22162
|
+
}));
|
|
22163
|
+
if (filterError) {
|
|
22164
|
+
envelope.Warning = appendWarning2(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
22165
|
+
return;
|
|
22166
|
+
}
|
|
22167
|
+
envelope.Data = filtered;
|
|
22168
|
+
if (note) {
|
|
22169
|
+
envelope.Warning = appendWarning2(envelope.Warning, note);
|
|
22170
|
+
}
|
|
22171
|
+
}
|
|
21752
22172
|
function defaultErrorCodeForResult2(result) {
|
|
21753
22173
|
switch (result) {
|
|
21754
22174
|
case RESULTS2.AuthenticationError:
|
|
@@ -21831,8 +22251,14 @@ var OutputFormatter2;
|
|
|
21831
22251
|
}
|
|
21832
22252
|
const filter = getOutputFilter2();
|
|
21833
22253
|
if (filter) {
|
|
21834
|
-
|
|
22254
|
+
let note;
|
|
22255
|
+
const filtered = applyFilter2(data.Data, filter, (n) => {
|
|
22256
|
+
note = n;
|
|
22257
|
+
});
|
|
21835
22258
|
data.Data = normalize ? normalizeDataKeys2(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
22259
|
+
if (note) {
|
|
22260
|
+
data.Warning = appendWarning2(data.Warning, note);
|
|
22261
|
+
}
|
|
21836
22262
|
}
|
|
21837
22263
|
logOutput2(normalizeOutputKeys2(data), getOutputFormat2(), options?.tableRowStyle);
|
|
21838
22264
|
}
|
|
@@ -21860,6 +22286,7 @@ var OutputFormatter2;
|
|
|
21860
22286
|
delete envelope.TelemetryErrorClass;
|
|
21861
22287
|
delete envelope.TelemetryTerminalOutcome;
|
|
21862
22288
|
delete envelope.TelemetryTerminalSignal;
|
|
22289
|
+
filterFailureData2(envelope);
|
|
21863
22290
|
if (!suppressTelemetry) {
|
|
21864
22291
|
telemetry2.trackEvent(CommonTelemetryEvents2.Error, {
|
|
21865
22292
|
result: data.Result,
|
|
@@ -21908,13 +22335,20 @@ var OutputFormatter2;
|
|
|
21908
22335
|
OutputFormatter3.log = log;
|
|
21909
22336
|
function formatToString(data) {
|
|
21910
22337
|
const filter = getOutputFilter2();
|
|
22338
|
+
const envelope = data;
|
|
21911
22339
|
if ("Data" in data && data.Data != null) {
|
|
21912
22340
|
data.Data = normalizeDataKeys2(data.Data);
|
|
21913
22341
|
if (filter) {
|
|
21914
|
-
|
|
22342
|
+
let note;
|
|
22343
|
+
data.Data = normalizeDataKeys2(applyFilter2(data.Data, filter, (n) => {
|
|
22344
|
+
note = n;
|
|
22345
|
+
}));
|
|
22346
|
+
if (note) {
|
|
22347
|
+
envelope.Warning = appendWarning2(envelope.Warning, note);
|
|
22348
|
+
}
|
|
21915
22349
|
}
|
|
21916
22350
|
}
|
|
21917
|
-
const output = normalizeOutputKeys2(
|
|
22351
|
+
const output = normalizeOutputKeys2(envelope);
|
|
21918
22352
|
const lines = [];
|
|
21919
22353
|
const sink = getOutputSink2();
|
|
21920
22354
|
printOutput2(output, getOutputFormat2(), (msg) => {
|
|
@@ -23304,4 +23738,4 @@ export {
|
|
|
23304
23738
|
entityInitAsync
|
|
23305
23739
|
};
|
|
23306
23740
|
|
|
23307
|
-
//# debugId=
|
|
23741
|
+
//# debugId=BCFBC3EB7C9AFF5164756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/packager-tool-datafabric",
|
|
3
|
-
"version": "1.201.1-preview.
|
|
3
|
+
"version": "1.201.1-preview.238",
|
|
4
4
|
"description": "UiPath Data Fabric entity schema, validation and packaging library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@uipath/solutionpackager-tool-core": "1.202.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
|
|
28
28
|
}
|