@uipath/insights-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/index.js +1 -1
- package/dist/{tool-vcy08v33.js → tool-y98s9s1v.js} +226 -9
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2100,7 +2100,7 @@ var require_commander = __commonJS(function(exports) {
|
|
|
2100
2100
|
var package_default = {
|
|
2101
2101
|
name: "@uipath/insights-tool",
|
|
2102
2102
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2103
|
-
version: "1.202.1-preview.
|
|
2103
|
+
version: "1.202.1-preview.238",
|
|
2104
2104
|
description: "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
2105
2105
|
private: false,
|
|
2106
2106
|
repository: {
|
|
@@ -4511,7 +4511,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4511
4511
|
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).";
|
|
4512
4512
|
}
|
|
4513
4513
|
}
|
|
4514
|
-
function
|
|
4514
|
+
function countRecords(data) {
|
|
4515
|
+
if (Array.isArray(data))
|
|
4516
|
+
return data.length;
|
|
4517
|
+
return data == null ? 0 : 1;
|
|
4518
|
+
}
|
|
4519
|
+
function availableFields(data) {
|
|
4520
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4521
|
+
const keys = new Set;
|
|
4522
|
+
for (const record of records) {
|
|
4523
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4524
|
+
for (const key of Object.keys(record))
|
|
4525
|
+
keys.add(key);
|
|
4526
|
+
}
|
|
4527
|
+
}
|
|
4528
|
+
return [...keys];
|
|
4529
|
+
}
|
|
4530
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4531
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4532
|
+
if (!error && typeof decoded === "string")
|
|
4533
|
+
return decoded;
|
|
4534
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4535
|
+
}
|
|
4536
|
+
function referencedFields(filter) {
|
|
4537
|
+
const top = new Set;
|
|
4538
|
+
const nested = new Set;
|
|
4539
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4540
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4541
|
+
const quoted = [];
|
|
4542
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4543
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4544
|
+
if (!isAlias) {
|
|
4545
|
+
quoted.push({
|
|
4546
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4547
|
+
index,
|
|
4548
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4549
|
+
});
|
|
4550
|
+
}
|
|
4551
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4552
|
+
});
|
|
4553
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4554
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4555
|
+
const place = (name, index, tail) => {
|
|
4556
|
+
if (tail || index >= rootEnd)
|
|
4557
|
+
nested.add(name);
|
|
4558
|
+
else
|
|
4559
|
+
top.add(name);
|
|
4560
|
+
};
|
|
4561
|
+
for (const entry of quoted)
|
|
4562
|
+
place(entry.name, entry.index, entry.tail);
|
|
4563
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4564
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4565
|
+
for (const match of identifiers) {
|
|
4566
|
+
const [, name, trailing] = match;
|
|
4567
|
+
if (trailing || reserved.has(name))
|
|
4568
|
+
continue;
|
|
4569
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4570
|
+
}
|
|
4571
|
+
return {
|
|
4572
|
+
top: [...top],
|
|
4573
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4574
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4577
|
+
function appearsBelowTopLevel(data, name) {
|
|
4578
|
+
let budget = 2000;
|
|
4579
|
+
const visit = (value, depth) => {
|
|
4580
|
+
if (budget-- <= 0 || depth > 4)
|
|
4581
|
+
return false;
|
|
4582
|
+
if (value === null || typeof value !== "object")
|
|
4583
|
+
return false;
|
|
4584
|
+
if (Array.isArray(value))
|
|
4585
|
+
return value.some((entry) => visit(entry, depth));
|
|
4586
|
+
const record = value;
|
|
4587
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4588
|
+
return true;
|
|
4589
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4590
|
+
};
|
|
4591
|
+
return visit(data, 0);
|
|
4592
|
+
}
|
|
4593
|
+
function alwaysNullKeys(records) {
|
|
4594
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4595
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4596
|
+
return [];
|
|
4597
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4598
|
+
if (keys.length === 0)
|
|
4599
|
+
return [];
|
|
4600
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4601
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4602
|
+
}
|
|
4603
|
+
function carriesOnlyNulls(value) {
|
|
4604
|
+
if (value === null)
|
|
4605
|
+
return true;
|
|
4606
|
+
if (Array.isArray(value)) {
|
|
4607
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4608
|
+
}
|
|
4609
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4610
|
+
const values = Object.values(value);
|
|
4611
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4612
|
+
}
|
|
4613
|
+
return false;
|
|
4614
|
+
}
|
|
4615
|
+
function nameList(names, cap2 = 12) {
|
|
4616
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
4617
|
+
const rest = names.length - shown.length;
|
|
4618
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4619
|
+
}
|
|
4620
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
4621
|
+
const present = availableFields(data);
|
|
4622
|
+
const refs = referencedFields(filter);
|
|
4623
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
4624
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
4625
|
+
const count = countRecords(data);
|
|
4626
|
+
const scope = `${count} record(s)`;
|
|
4627
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
4628
|
+
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" : "";
|
|
4629
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
4630
|
+
let detail;
|
|
4631
|
+
let lede;
|
|
4632
|
+
if (outcome.kind === "null-elements") {
|
|
4633
|
+
lede = "returned only null values";
|
|
4634
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
4635
|
+
if (unknown.length > 0) {
|
|
4636
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4637
|
+
} else if (unchecked.length > 0) {
|
|
4638
|
+
detail = withSoundness(projected);
|
|
4639
|
+
} else {
|
|
4640
|
+
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`;
|
|
4641
|
+
}
|
|
4642
|
+
} else if (outcome.kind === "null-rows") {
|
|
4643
|
+
lede = "returned only null values";
|
|
4644
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
4645
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
4646
|
+
} else if (outcome.kind === "null-values") {
|
|
4647
|
+
lede = "returned only null values";
|
|
4648
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
4649
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
4650
|
+
if (sameSet) {
|
|
4651
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
4652
|
+
} else if (unknown.length > 0) {
|
|
4653
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4654
|
+
} else {
|
|
4655
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
4656
|
+
}
|
|
4657
|
+
} else {
|
|
4658
|
+
lede = "returned nothing";
|
|
4659
|
+
if (unknown.length > 0) {
|
|
4660
|
+
detail = isNotAField(unknown);
|
|
4661
|
+
} else {
|
|
4662
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
4663
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
4667
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
4668
|
+
}
|
|
4669
|
+
function appendWarning(existing, note) {
|
|
4670
|
+
return existing ? `${existing} ${note}` : note;
|
|
4671
|
+
}
|
|
4672
|
+
function applyFilter(data, filter, onWarning) {
|
|
4515
4673
|
const codec = requireJmespath();
|
|
4516
4674
|
let result;
|
|
4517
4675
|
try {
|
|
@@ -4519,9 +4677,34 @@ function applyFilter(data, filter) {
|
|
|
4519
4677
|
} catch (err) {
|
|
4520
4678
|
throw new FilterEvaluationError(filter, err);
|
|
4521
4679
|
}
|
|
4522
|
-
|
|
4680
|
+
const inputCount = countRecords(data);
|
|
4681
|
+
const warn = (outcome) => {
|
|
4682
|
+
if (inputCount === 0)
|
|
4683
|
+
return;
|
|
4684
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
4685
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
4686
|
+
`);
|
|
4687
|
+
onWarning?.(note);
|
|
4688
|
+
};
|
|
4689
|
+
const warnIfAllNull = (records) => {
|
|
4690
|
+
const keys = alwaysNullKeys(records);
|
|
4691
|
+
if (keys.length > 0)
|
|
4692
|
+
warn({ kind: "null-values", keys });
|
|
4693
|
+
};
|
|
4694
|
+
if (result == null) {
|
|
4695
|
+
warn({ kind: "empty" });
|
|
4523
4696
|
return [];
|
|
4697
|
+
}
|
|
4524
4698
|
if (Array.isArray(result)) {
|
|
4699
|
+
if (result.length === 0) {
|
|
4700
|
+
warn({ kind: "empty" });
|
|
4701
|
+
} else if (result.every((entry) => entry === null)) {
|
|
4702
|
+
warn({ kind: "null-elements", count: result.length });
|
|
4703
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
4704
|
+
warn({ kind: "null-rows", count: result.length });
|
|
4705
|
+
} else {
|
|
4706
|
+
warnIfAllNull(result);
|
|
4707
|
+
}
|
|
4525
4708
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4526
4709
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4527
4710
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4529,10 +4712,30 @@ function applyFilter(data, filter) {
|
|
|
4529
4712
|
}
|
|
4530
4713
|
return result;
|
|
4531
4714
|
}
|
|
4532
|
-
if (typeof result === "object")
|
|
4715
|
+
if (typeof result === "object") {
|
|
4716
|
+
warnIfAllNull([result]);
|
|
4533
4717
|
return result;
|
|
4718
|
+
}
|
|
4534
4719
|
return { Value: result };
|
|
4535
4720
|
}
|
|
4721
|
+
function filterFailureData(envelope) {
|
|
4722
|
+
const filter = getOutputFilter();
|
|
4723
|
+
const data = envelope.Data;
|
|
4724
|
+
if (!filter || data == null)
|
|
4725
|
+
return;
|
|
4726
|
+
let note;
|
|
4727
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
4728
|
+
note = n;
|
|
4729
|
+
}));
|
|
4730
|
+
if (filterError) {
|
|
4731
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
4732
|
+
return;
|
|
4733
|
+
}
|
|
4734
|
+
envelope.Data = filtered;
|
|
4735
|
+
if (note) {
|
|
4736
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4536
4739
|
function defaultErrorCodeForResult(result) {
|
|
4537
4740
|
switch (result) {
|
|
4538
4741
|
case RESULTS.AuthenticationError:
|
|
@@ -4615,8 +4818,14 @@ var OutputFormatter;
|
|
|
4615
4818
|
}
|
|
4616
4819
|
const filter = getOutputFilter();
|
|
4617
4820
|
if (filter) {
|
|
4618
|
-
|
|
4821
|
+
let note;
|
|
4822
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
4823
|
+
note = n;
|
|
4824
|
+
});
|
|
4619
4825
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
4826
|
+
if (note) {
|
|
4827
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
4828
|
+
}
|
|
4620
4829
|
}
|
|
4621
4830
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4622
4831
|
}
|
|
@@ -4644,6 +4853,7 @@ var OutputFormatter;
|
|
|
4644
4853
|
delete envelope.TelemetryErrorClass;
|
|
4645
4854
|
delete envelope.TelemetryTerminalOutcome;
|
|
4646
4855
|
delete envelope.TelemetryTerminalSignal;
|
|
4856
|
+
filterFailureData(envelope);
|
|
4647
4857
|
if (!suppressTelemetry) {
|
|
4648
4858
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4649
4859
|
result: data.Result,
|
|
@@ -4692,13 +4902,20 @@ var OutputFormatter;
|
|
|
4692
4902
|
OutputFormatter.log = log;
|
|
4693
4903
|
function formatToString(data) {
|
|
4694
4904
|
const filter = getOutputFilter();
|
|
4905
|
+
const envelope = data;
|
|
4695
4906
|
if ("Data" in data && data.Data != null) {
|
|
4696
4907
|
data.Data = normalizeDataKeys(data.Data);
|
|
4697
4908
|
if (filter) {
|
|
4698
|
-
|
|
4909
|
+
let note;
|
|
4910
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
4911
|
+
note = n;
|
|
4912
|
+
}));
|
|
4913
|
+
if (note) {
|
|
4914
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4915
|
+
}
|
|
4699
4916
|
}
|
|
4700
4917
|
}
|
|
4701
|
-
const output = normalizeOutputKeys(
|
|
4918
|
+
const output = normalizeOutputKeys(envelope);
|
|
4702
4919
|
const lines = [];
|
|
4703
4920
|
const sink = getOutputSink();
|
|
4704
4921
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -5513,7 +5730,7 @@ class InsightsProtocolError extends Error {
|
|
|
5513
5730
|
var package_default2 = {
|
|
5514
5731
|
name: "@uipath/insights-sdk",
|
|
5515
5732
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
5516
|
-
version: "1.202.1-preview.
|
|
5733
|
+
version: "1.202.1-preview.238",
|
|
5517
5734
|
description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
|
|
5518
5735
|
repository: {
|
|
5519
5736
|
type: "git",
|
|
@@ -8547,4 +8764,4 @@ var registerCommands = async (program2) => {
|
|
|
8547
8764
|
|
|
8548
8765
|
export { Command, metadata, registerCommands };
|
|
8549
8766
|
|
|
8550
|
-
//# debugId=
|
|
8767
|
+
//# debugId=61554607EE83390B64756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/insights-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": "Query UiPath Insights data — jobs, failures, and performance metrics.",
|
|
6
6
|
"private": false,
|
|
7
7
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
|
|
30
30
|
}
|