@uipath/pm-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-b0vbr018.js → tool-a80ranh2.js} +225 -8
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2101,7 +2101,7 @@ var package_default = {
|
|
|
2101
2101
|
name: "@uipath/pm-tool",
|
|
2102
2102
|
author: "UiPath",
|
|
2103
2103
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2104
|
-
version: "1.203.0-preview.
|
|
2104
|
+
version: "1.203.0-preview.237",
|
|
2105
2105
|
description: "Process Mining — process apps, transformations, and data ingestion.",
|
|
2106
2106
|
private: false,
|
|
2107
2107
|
repository: {
|
|
@@ -4667,7 +4667,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4667
4667
|
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).";
|
|
4668
4668
|
}
|
|
4669
4669
|
}
|
|
4670
|
-
function
|
|
4670
|
+
function countRecords(data) {
|
|
4671
|
+
if (Array.isArray(data))
|
|
4672
|
+
return data.length;
|
|
4673
|
+
return data == null ? 0 : 1;
|
|
4674
|
+
}
|
|
4675
|
+
function availableFields(data) {
|
|
4676
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4677
|
+
const keys = new Set;
|
|
4678
|
+
for (const record of records) {
|
|
4679
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4680
|
+
for (const key of Object.keys(record))
|
|
4681
|
+
keys.add(key);
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
return [...keys];
|
|
4685
|
+
}
|
|
4686
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4687
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4688
|
+
if (!error && typeof decoded === "string")
|
|
4689
|
+
return decoded;
|
|
4690
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4691
|
+
}
|
|
4692
|
+
function referencedFields(filter) {
|
|
4693
|
+
const top = new Set;
|
|
4694
|
+
const nested = new Set;
|
|
4695
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4696
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4697
|
+
const quoted = [];
|
|
4698
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4699
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4700
|
+
if (!isAlias) {
|
|
4701
|
+
quoted.push({
|
|
4702
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4703
|
+
index,
|
|
4704
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4705
|
+
});
|
|
4706
|
+
}
|
|
4707
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4708
|
+
});
|
|
4709
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4710
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4711
|
+
const place = (name, index, tail) => {
|
|
4712
|
+
if (tail || index >= rootEnd)
|
|
4713
|
+
nested.add(name);
|
|
4714
|
+
else
|
|
4715
|
+
top.add(name);
|
|
4716
|
+
};
|
|
4717
|
+
for (const entry of quoted)
|
|
4718
|
+
place(entry.name, entry.index, entry.tail);
|
|
4719
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4720
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4721
|
+
for (const match of identifiers) {
|
|
4722
|
+
const [, name, trailing] = match;
|
|
4723
|
+
if (trailing || reserved.has(name))
|
|
4724
|
+
continue;
|
|
4725
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4726
|
+
}
|
|
4727
|
+
return {
|
|
4728
|
+
top: [...top],
|
|
4729
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4730
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4733
|
+
function appearsBelowTopLevel(data, name) {
|
|
4734
|
+
let budget = 2000;
|
|
4735
|
+
const visit = (value, depth) => {
|
|
4736
|
+
if (budget-- <= 0 || depth > 4)
|
|
4737
|
+
return false;
|
|
4738
|
+
if (value === null || typeof value !== "object")
|
|
4739
|
+
return false;
|
|
4740
|
+
if (Array.isArray(value))
|
|
4741
|
+
return value.some((entry) => visit(entry, depth));
|
|
4742
|
+
const record = value;
|
|
4743
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4744
|
+
return true;
|
|
4745
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4746
|
+
};
|
|
4747
|
+
return visit(data, 0);
|
|
4748
|
+
}
|
|
4749
|
+
function alwaysNullKeys(records) {
|
|
4750
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4751
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4752
|
+
return [];
|
|
4753
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4754
|
+
if (keys.length === 0)
|
|
4755
|
+
return [];
|
|
4756
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4757
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4758
|
+
}
|
|
4759
|
+
function carriesOnlyNulls(value) {
|
|
4760
|
+
if (value === null)
|
|
4761
|
+
return true;
|
|
4762
|
+
if (Array.isArray(value)) {
|
|
4763
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4764
|
+
}
|
|
4765
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4766
|
+
const values = Object.values(value);
|
|
4767
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4768
|
+
}
|
|
4769
|
+
return false;
|
|
4770
|
+
}
|
|
4771
|
+
function nameList(names, cap2 = 12) {
|
|
4772
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
4773
|
+
const rest = names.length - shown.length;
|
|
4774
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4775
|
+
}
|
|
4776
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
4777
|
+
const present = availableFields(data);
|
|
4778
|
+
const refs = referencedFields(filter);
|
|
4779
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
4780
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
4781
|
+
const count = countRecords(data);
|
|
4782
|
+
const scope = `${count} record(s)`;
|
|
4783
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
4784
|
+
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" : "";
|
|
4785
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
4786
|
+
let detail;
|
|
4787
|
+
let lede;
|
|
4788
|
+
if (outcome.kind === "null-elements") {
|
|
4789
|
+
lede = "returned only null values";
|
|
4790
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
4791
|
+
if (unknown.length > 0) {
|
|
4792
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4793
|
+
} else if (unchecked.length > 0) {
|
|
4794
|
+
detail = withSoundness(projected);
|
|
4795
|
+
} else {
|
|
4796
|
+
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`;
|
|
4797
|
+
}
|
|
4798
|
+
} else if (outcome.kind === "null-rows") {
|
|
4799
|
+
lede = "returned only null values";
|
|
4800
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
4801
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
4802
|
+
} else if (outcome.kind === "null-values") {
|
|
4803
|
+
lede = "returned only null values";
|
|
4804
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
4805
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
4806
|
+
if (sameSet) {
|
|
4807
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
4808
|
+
} else if (unknown.length > 0) {
|
|
4809
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4810
|
+
} else {
|
|
4811
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
4812
|
+
}
|
|
4813
|
+
} else {
|
|
4814
|
+
lede = "returned nothing";
|
|
4815
|
+
if (unknown.length > 0) {
|
|
4816
|
+
detail = isNotAField(unknown);
|
|
4817
|
+
} else {
|
|
4818
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
4819
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
4820
|
+
}
|
|
4821
|
+
}
|
|
4822
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
4823
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
4824
|
+
}
|
|
4825
|
+
function appendWarning(existing, note) {
|
|
4826
|
+
return existing ? `${existing} ${note}` : note;
|
|
4827
|
+
}
|
|
4828
|
+
function applyFilter(data, filter, onWarning) {
|
|
4671
4829
|
const codec = requireJmespath();
|
|
4672
4830
|
let result;
|
|
4673
4831
|
try {
|
|
@@ -4675,9 +4833,34 @@ function applyFilter(data, filter) {
|
|
|
4675
4833
|
} catch (err) {
|
|
4676
4834
|
throw new FilterEvaluationError(filter, err);
|
|
4677
4835
|
}
|
|
4678
|
-
|
|
4836
|
+
const inputCount = countRecords(data);
|
|
4837
|
+
const warn = (outcome) => {
|
|
4838
|
+
if (inputCount === 0)
|
|
4839
|
+
return;
|
|
4840
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
4841
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
4842
|
+
`);
|
|
4843
|
+
onWarning?.(note);
|
|
4844
|
+
};
|
|
4845
|
+
const warnIfAllNull = (records) => {
|
|
4846
|
+
const keys = alwaysNullKeys(records);
|
|
4847
|
+
if (keys.length > 0)
|
|
4848
|
+
warn({ kind: "null-values", keys });
|
|
4849
|
+
};
|
|
4850
|
+
if (result == null) {
|
|
4851
|
+
warn({ kind: "empty" });
|
|
4679
4852
|
return [];
|
|
4853
|
+
}
|
|
4680
4854
|
if (Array.isArray(result)) {
|
|
4855
|
+
if (result.length === 0) {
|
|
4856
|
+
warn({ kind: "empty" });
|
|
4857
|
+
} else if (result.every((entry) => entry === null)) {
|
|
4858
|
+
warn({ kind: "null-elements", count: result.length });
|
|
4859
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
4860
|
+
warn({ kind: "null-rows", count: result.length });
|
|
4861
|
+
} else {
|
|
4862
|
+
warnIfAllNull(result);
|
|
4863
|
+
}
|
|
4681
4864
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4682
4865
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4683
4866
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4685,10 +4868,30 @@ function applyFilter(data, filter) {
|
|
|
4685
4868
|
}
|
|
4686
4869
|
return result;
|
|
4687
4870
|
}
|
|
4688
|
-
if (typeof result === "object")
|
|
4871
|
+
if (typeof result === "object") {
|
|
4872
|
+
warnIfAllNull([result]);
|
|
4689
4873
|
return result;
|
|
4874
|
+
}
|
|
4690
4875
|
return { Value: result };
|
|
4691
4876
|
}
|
|
4877
|
+
function filterFailureData(envelope) {
|
|
4878
|
+
const filter = getOutputFilter();
|
|
4879
|
+
const data = envelope.Data;
|
|
4880
|
+
if (!filter || data == null)
|
|
4881
|
+
return;
|
|
4882
|
+
let note;
|
|
4883
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
4884
|
+
note = n;
|
|
4885
|
+
}));
|
|
4886
|
+
if (filterError) {
|
|
4887
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
4888
|
+
return;
|
|
4889
|
+
}
|
|
4890
|
+
envelope.Data = filtered;
|
|
4891
|
+
if (note) {
|
|
4892
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4893
|
+
}
|
|
4894
|
+
}
|
|
4692
4895
|
function defaultErrorCodeForResult(result) {
|
|
4693
4896
|
switch (result) {
|
|
4694
4897
|
case RESULTS.AuthenticationError:
|
|
@@ -4771,8 +4974,14 @@ var OutputFormatter;
|
|
|
4771
4974
|
}
|
|
4772
4975
|
const filter = getOutputFilter();
|
|
4773
4976
|
if (filter) {
|
|
4774
|
-
|
|
4977
|
+
let note;
|
|
4978
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
4979
|
+
note = n;
|
|
4980
|
+
});
|
|
4775
4981
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
4982
|
+
if (note) {
|
|
4983
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
4984
|
+
}
|
|
4776
4985
|
}
|
|
4777
4986
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4778
4987
|
}
|
|
@@ -4800,6 +5009,7 @@ var OutputFormatter;
|
|
|
4800
5009
|
delete envelope.TelemetryErrorClass;
|
|
4801
5010
|
delete envelope.TelemetryTerminalOutcome;
|
|
4802
5011
|
delete envelope.TelemetryTerminalSignal;
|
|
5012
|
+
filterFailureData(envelope);
|
|
4803
5013
|
if (!suppressTelemetry) {
|
|
4804
5014
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4805
5015
|
result: data.Result,
|
|
@@ -4848,13 +5058,20 @@ var OutputFormatter;
|
|
|
4848
5058
|
OutputFormatter.log = log;
|
|
4849
5059
|
function formatToString(data) {
|
|
4850
5060
|
const filter = getOutputFilter();
|
|
5061
|
+
const envelope = data;
|
|
4851
5062
|
if ("Data" in data && data.Data != null) {
|
|
4852
5063
|
data.Data = normalizeDataKeys(data.Data);
|
|
4853
5064
|
if (filter) {
|
|
4854
|
-
|
|
5065
|
+
let note;
|
|
5066
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
5067
|
+
note = n;
|
|
5068
|
+
}));
|
|
5069
|
+
if (note) {
|
|
5070
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
5071
|
+
}
|
|
4855
5072
|
}
|
|
4856
5073
|
}
|
|
4857
|
-
const output = normalizeOutputKeys(
|
|
5074
|
+
const output = normalizeOutputKeys(envelope);
|
|
4858
5075
|
const lines = [];
|
|
4859
5076
|
const sink = getOutputSink();
|
|
4860
5077
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -9771,4 +9988,4 @@ var registerCommands = async (program2) => {
|
|
|
9771
9988
|
|
|
9772
9989
|
export { Command, metadata, registerCommands };
|
|
9773
9990
|
|
|
9774
|
-
//# debugId=
|
|
9991
|
+
//# debugId=6B23A510F42F41B764756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/pm-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": "Process Mining — process apps, transformations, and data ingestion.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
|
|
31
31
|
}
|