@uipath/pm-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-5jf4xyq1.js → tool-vrtqggsn.js} +225 -8
- 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/pm-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: "Process Mining — process apps, transformations, and data ingestion.",
|
|
2105
2105
|
private: false,
|
|
2106
2106
|
repository: {
|
|
@@ -4437,7 +4437,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
4437
4437
|
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).";
|
|
4438
4438
|
}
|
|
4439
4439
|
}
|
|
4440
|
-
function
|
|
4440
|
+
function countRecords(data) {
|
|
4441
|
+
if (Array.isArray(data))
|
|
4442
|
+
return data.length;
|
|
4443
|
+
return data == null ? 0 : 1;
|
|
4444
|
+
}
|
|
4445
|
+
function availableFields(data) {
|
|
4446
|
+
const records = Array.isArray(data) ? data : [data];
|
|
4447
|
+
const keys = new Set;
|
|
4448
|
+
for (const record of records) {
|
|
4449
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
4450
|
+
for (const key of Object.keys(record))
|
|
4451
|
+
keys.add(key);
|
|
4452
|
+
}
|
|
4453
|
+
}
|
|
4454
|
+
return [...keys];
|
|
4455
|
+
}
|
|
4456
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
4457
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
4458
|
+
if (!error && typeof decoded === "string")
|
|
4459
|
+
return decoded;
|
|
4460
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
4461
|
+
}
|
|
4462
|
+
function referencedFields(filter) {
|
|
4463
|
+
const top = new Set;
|
|
4464
|
+
const nested = new Set;
|
|
4465
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
4466
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
4467
|
+
const quoted = [];
|
|
4468
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
4469
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
4470
|
+
if (!isAlias) {
|
|
4471
|
+
quoted.push({
|
|
4472
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
4473
|
+
index,
|
|
4474
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
4475
|
+
});
|
|
4476
|
+
}
|
|
4477
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
4478
|
+
});
|
|
4479
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
4480
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
4481
|
+
const place = (name, index, tail) => {
|
|
4482
|
+
if (tail || index >= rootEnd)
|
|
4483
|
+
nested.add(name);
|
|
4484
|
+
else
|
|
4485
|
+
top.add(name);
|
|
4486
|
+
};
|
|
4487
|
+
for (const entry of quoted)
|
|
4488
|
+
place(entry.name, entry.index, entry.tail);
|
|
4489
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
4490
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
4491
|
+
for (const match of identifiers) {
|
|
4492
|
+
const [, name, trailing] = match;
|
|
4493
|
+
if (trailing || reserved.has(name))
|
|
4494
|
+
continue;
|
|
4495
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
4496
|
+
}
|
|
4497
|
+
return {
|
|
4498
|
+
top: [...top],
|
|
4499
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
4500
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
4501
|
+
};
|
|
4502
|
+
}
|
|
4503
|
+
function appearsBelowTopLevel(data, name) {
|
|
4504
|
+
let budget = 2000;
|
|
4505
|
+
const visit = (value, depth) => {
|
|
4506
|
+
if (budget-- <= 0 || depth > 4)
|
|
4507
|
+
return false;
|
|
4508
|
+
if (value === null || typeof value !== "object")
|
|
4509
|
+
return false;
|
|
4510
|
+
if (Array.isArray(value))
|
|
4511
|
+
return value.some((entry) => visit(entry, depth));
|
|
4512
|
+
const record = value;
|
|
4513
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
4514
|
+
return true;
|
|
4515
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
4516
|
+
};
|
|
4517
|
+
return visit(data, 0);
|
|
4518
|
+
}
|
|
4519
|
+
function alwaysNullKeys(records) {
|
|
4520
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
4521
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
4522
|
+
return [];
|
|
4523
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
4524
|
+
if (keys.length === 0)
|
|
4525
|
+
return [];
|
|
4526
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
4527
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
4528
|
+
}
|
|
4529
|
+
function carriesOnlyNulls(value) {
|
|
4530
|
+
if (value === null)
|
|
4531
|
+
return true;
|
|
4532
|
+
if (Array.isArray(value)) {
|
|
4533
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
4534
|
+
}
|
|
4535
|
+
if (typeof value === "object" && value !== undefined) {
|
|
4536
|
+
const values = Object.values(value);
|
|
4537
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
4538
|
+
}
|
|
4539
|
+
return false;
|
|
4540
|
+
}
|
|
4541
|
+
function nameList(names, cap2 = 12) {
|
|
4542
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
4543
|
+
const rest = names.length - shown.length;
|
|
4544
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
4545
|
+
}
|
|
4546
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
4547
|
+
const present = availableFields(data);
|
|
4548
|
+
const refs = referencedFields(filter);
|
|
4549
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
4550
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
4551
|
+
const count = countRecords(data);
|
|
4552
|
+
const scope = `${count} record(s)`;
|
|
4553
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
4554
|
+
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" : "";
|
|
4555
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
4556
|
+
let detail;
|
|
4557
|
+
let lede;
|
|
4558
|
+
if (outcome.kind === "null-elements") {
|
|
4559
|
+
lede = "returned only null values";
|
|
4560
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
4561
|
+
if (unknown.length > 0) {
|
|
4562
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4563
|
+
} else if (unchecked.length > 0) {
|
|
4564
|
+
detail = withSoundness(projected);
|
|
4565
|
+
} else {
|
|
4566
|
+
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`;
|
|
4567
|
+
}
|
|
4568
|
+
} else if (outcome.kind === "null-rows") {
|
|
4569
|
+
lede = "returned only null values";
|
|
4570
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
4571
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
4572
|
+
} else if (outcome.kind === "null-values") {
|
|
4573
|
+
lede = "returned only null values";
|
|
4574
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
4575
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
4576
|
+
if (sameSet) {
|
|
4577
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
4578
|
+
} else if (unknown.length > 0) {
|
|
4579
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
4580
|
+
} else {
|
|
4581
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
4582
|
+
}
|
|
4583
|
+
} else {
|
|
4584
|
+
lede = "returned nothing";
|
|
4585
|
+
if (unknown.length > 0) {
|
|
4586
|
+
detail = isNotAField(unknown);
|
|
4587
|
+
} else {
|
|
4588
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
4589
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
4593
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
4594
|
+
}
|
|
4595
|
+
function appendWarning(existing, note) {
|
|
4596
|
+
return existing ? `${existing} ${note}` : note;
|
|
4597
|
+
}
|
|
4598
|
+
function applyFilter(data, filter, onWarning) {
|
|
4441
4599
|
const codec = requireJmespath();
|
|
4442
4600
|
let result;
|
|
4443
4601
|
try {
|
|
@@ -4445,9 +4603,34 @@ function applyFilter(data, filter) {
|
|
|
4445
4603
|
} catch (err) {
|
|
4446
4604
|
throw new FilterEvaluationError(filter, err);
|
|
4447
4605
|
}
|
|
4448
|
-
|
|
4606
|
+
const inputCount = countRecords(data);
|
|
4607
|
+
const warn = (outcome) => {
|
|
4608
|
+
if (inputCount === 0)
|
|
4609
|
+
return;
|
|
4610
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
4611
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
4612
|
+
`);
|
|
4613
|
+
onWarning?.(note);
|
|
4614
|
+
};
|
|
4615
|
+
const warnIfAllNull = (records) => {
|
|
4616
|
+
const keys = alwaysNullKeys(records);
|
|
4617
|
+
if (keys.length > 0)
|
|
4618
|
+
warn({ kind: "null-values", keys });
|
|
4619
|
+
};
|
|
4620
|
+
if (result == null) {
|
|
4621
|
+
warn({ kind: "empty" });
|
|
4449
4622
|
return [];
|
|
4623
|
+
}
|
|
4450
4624
|
if (Array.isArray(result)) {
|
|
4625
|
+
if (result.length === 0) {
|
|
4626
|
+
warn({ kind: "empty" });
|
|
4627
|
+
} else if (result.every((entry) => entry === null)) {
|
|
4628
|
+
warn({ kind: "null-elements", count: result.length });
|
|
4629
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
4630
|
+
warn({ kind: "null-rows", count: result.length });
|
|
4631
|
+
} else {
|
|
4632
|
+
warnIfAllNull(result);
|
|
4633
|
+
}
|
|
4451
4634
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
4452
4635
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
4453
4636
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -4455,10 +4638,30 @@ function applyFilter(data, filter) {
|
|
|
4455
4638
|
}
|
|
4456
4639
|
return result;
|
|
4457
4640
|
}
|
|
4458
|
-
if (typeof result === "object")
|
|
4641
|
+
if (typeof result === "object") {
|
|
4642
|
+
warnIfAllNull([result]);
|
|
4459
4643
|
return result;
|
|
4644
|
+
}
|
|
4460
4645
|
return { Value: result };
|
|
4461
4646
|
}
|
|
4647
|
+
function filterFailureData(envelope) {
|
|
4648
|
+
const filter = getOutputFilter();
|
|
4649
|
+
const data = envelope.Data;
|
|
4650
|
+
if (!filter || data == null)
|
|
4651
|
+
return;
|
|
4652
|
+
let note;
|
|
4653
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
4654
|
+
note = n;
|
|
4655
|
+
}));
|
|
4656
|
+
if (filterError) {
|
|
4657
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
4658
|
+
return;
|
|
4659
|
+
}
|
|
4660
|
+
envelope.Data = filtered;
|
|
4661
|
+
if (note) {
|
|
4662
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4663
|
+
}
|
|
4664
|
+
}
|
|
4462
4665
|
function defaultErrorCodeForResult(result) {
|
|
4463
4666
|
switch (result) {
|
|
4464
4667
|
case RESULTS.AuthenticationError:
|
|
@@ -4541,8 +4744,14 @@ var OutputFormatter;
|
|
|
4541
4744
|
}
|
|
4542
4745
|
const filter = getOutputFilter();
|
|
4543
4746
|
if (filter) {
|
|
4544
|
-
|
|
4747
|
+
let note;
|
|
4748
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
4749
|
+
note = n;
|
|
4750
|
+
});
|
|
4545
4751
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
4752
|
+
if (note) {
|
|
4753
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
4754
|
+
}
|
|
4546
4755
|
}
|
|
4547
4756
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
4548
4757
|
}
|
|
@@ -4570,6 +4779,7 @@ var OutputFormatter;
|
|
|
4570
4779
|
delete envelope.TelemetryErrorClass;
|
|
4571
4780
|
delete envelope.TelemetryTerminalOutcome;
|
|
4572
4781
|
delete envelope.TelemetryTerminalSignal;
|
|
4782
|
+
filterFailureData(envelope);
|
|
4573
4783
|
if (!suppressTelemetry) {
|
|
4574
4784
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
4575
4785
|
result: data.Result,
|
|
@@ -4618,13 +4828,20 @@ var OutputFormatter;
|
|
|
4618
4828
|
OutputFormatter.log = log;
|
|
4619
4829
|
function formatToString(data) {
|
|
4620
4830
|
const filter = getOutputFilter();
|
|
4831
|
+
const envelope = data;
|
|
4621
4832
|
if ("Data" in data && data.Data != null) {
|
|
4622
4833
|
data.Data = normalizeDataKeys(data.Data);
|
|
4623
4834
|
if (filter) {
|
|
4624
|
-
|
|
4835
|
+
let note;
|
|
4836
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
4837
|
+
note = n;
|
|
4838
|
+
}));
|
|
4839
|
+
if (note) {
|
|
4840
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
4841
|
+
}
|
|
4625
4842
|
}
|
|
4626
4843
|
}
|
|
4627
|
-
const output = normalizeOutputKeys(
|
|
4844
|
+
const output = normalizeOutputKeys(envelope);
|
|
4628
4845
|
const lines = [];
|
|
4629
4846
|
const sink = getOutputSink();
|
|
4630
4847
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -9538,4 +9755,4 @@ var registerCommands = async (program2) => {
|
|
|
9538
9755
|
|
|
9539
9756
|
export { Command, metadata, registerCommands };
|
|
9540
9757
|
|
|
9541
|
-
//# debugId=
|
|
9758
|
+
//# debugId=A2D944080621C33764756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/pm-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": "Process Mining — process apps, transformations, and data ingestion.",
|
|
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
|
}
|