@uipath/vertical-solutions-tool 1.203.0-preview.233 → 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-83e3ejxk.js → tool-8jbvs5dw.js} +225 -8
- package/dist/tool.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6865,7 +6865,7 @@ var package_default = {
|
|
|
6865
6865
|
name: "@uipath/vertical-solutions-tool",
|
|
6866
6866
|
author: "UiPath",
|
|
6867
6867
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
6868
|
-
version: "1.203.0-preview.
|
|
6868
|
+
version: "1.203.0-preview.237",
|
|
6869
6869
|
description: "Scaffold and generate Vertical Solution projects.",
|
|
6870
6870
|
private: false,
|
|
6871
6871
|
repository: {
|
|
@@ -9444,7 +9444,165 @@ class FilterImplicitLimitError extends Error {
|
|
|
9444
9444
|
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).";
|
|
9445
9445
|
}
|
|
9446
9446
|
}
|
|
9447
|
-
function
|
|
9447
|
+
function countRecords(data) {
|
|
9448
|
+
if (Array.isArray(data))
|
|
9449
|
+
return data.length;
|
|
9450
|
+
return data == null ? 0 : 1;
|
|
9451
|
+
}
|
|
9452
|
+
function availableFields(data) {
|
|
9453
|
+
const records = Array.isArray(data) ? data : [data];
|
|
9454
|
+
const keys = new Set;
|
|
9455
|
+
for (const record of records) {
|
|
9456
|
+
if (record && typeof record === "object" && !Array.isArray(record)) {
|
|
9457
|
+
for (const key of Object.keys(record))
|
|
9458
|
+
keys.add(key);
|
|
9459
|
+
}
|
|
9460
|
+
}
|
|
9461
|
+
return [...keys];
|
|
9462
|
+
}
|
|
9463
|
+
function decodeQuotedIdentifier(whole, inner) {
|
|
9464
|
+
const [error, decoded] = catchError(() => JSON.parse(whole));
|
|
9465
|
+
if (!error && typeof decoded === "string")
|
|
9466
|
+
return decoded;
|
|
9467
|
+
return inner.replace(/\\(.)/g, "$1");
|
|
9468
|
+
}
|
|
9469
|
+
function referencedFields(filter) {
|
|
9470
|
+
const top = new Set;
|
|
9471
|
+
const nested = new Set;
|
|
9472
|
+
const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
|
|
9473
|
+
const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
|
|
9474
|
+
const quoted = [];
|
|
9475
|
+
const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
|
|
9476
|
+
const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
|
|
9477
|
+
if (!isAlias) {
|
|
9478
|
+
quoted.push({
|
|
9479
|
+
name: decodeQuotedIdentifier(whole, name),
|
|
9480
|
+
index,
|
|
9481
|
+
tail: isPathTail(withoutValueLiterals, index)
|
|
9482
|
+
});
|
|
9483
|
+
}
|
|
9484
|
+
return `"${" ".repeat(whole.length - 2)}"`;
|
|
9485
|
+
});
|
|
9486
|
+
const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
|
|
9487
|
+
const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
|
|
9488
|
+
const place = (name, index, tail) => {
|
|
9489
|
+
if (tail || index >= rootEnd)
|
|
9490
|
+
nested.add(name);
|
|
9491
|
+
else
|
|
9492
|
+
top.add(name);
|
|
9493
|
+
};
|
|
9494
|
+
for (const entry of quoted)
|
|
9495
|
+
place(entry.name, entry.index, entry.tail);
|
|
9496
|
+
const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
|
|
9497
|
+
const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
|
|
9498
|
+
for (const match of identifiers) {
|
|
9499
|
+
const [, name, trailing] = match;
|
|
9500
|
+
if (trailing || reserved.has(name))
|
|
9501
|
+
continue;
|
|
9502
|
+
place(name, match.index, isPathTail(withoutLiterals, match.index));
|
|
9503
|
+
}
|
|
9504
|
+
return {
|
|
9505
|
+
top: [...top],
|
|
9506
|
+
nested: [...nested].filter((name) => !top.has(name)),
|
|
9507
|
+
hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
|
|
9508
|
+
};
|
|
9509
|
+
}
|
|
9510
|
+
function appearsBelowTopLevel(data, name) {
|
|
9511
|
+
let budget = 2000;
|
|
9512
|
+
const visit = (value, depth) => {
|
|
9513
|
+
if (budget-- <= 0 || depth > 4)
|
|
9514
|
+
return false;
|
|
9515
|
+
if (value === null || typeof value !== "object")
|
|
9516
|
+
return false;
|
|
9517
|
+
if (Array.isArray(value))
|
|
9518
|
+
return value.some((entry) => visit(entry, depth));
|
|
9519
|
+
const record = value;
|
|
9520
|
+
if (depth > 0 && Object.hasOwn(record, name))
|
|
9521
|
+
return true;
|
|
9522
|
+
return Object.values(record).some((entry) => visit(entry, depth + 1));
|
|
9523
|
+
};
|
|
9524
|
+
return visit(data, 0);
|
|
9525
|
+
}
|
|
9526
|
+
function alwaysNullKeys(records) {
|
|
9527
|
+
const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
|
|
9528
|
+
if (objects.length === 0 || objects.length !== records.length)
|
|
9529
|
+
return [];
|
|
9530
|
+
const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
|
|
9531
|
+
if (keys.length === 0)
|
|
9532
|
+
return [];
|
|
9533
|
+
const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
|
|
9534
|
+
return nullKeys.length === keys.length ? nullKeys : [];
|
|
9535
|
+
}
|
|
9536
|
+
function carriesOnlyNulls(value) {
|
|
9537
|
+
if (value === null)
|
|
9538
|
+
return true;
|
|
9539
|
+
if (Array.isArray(value)) {
|
|
9540
|
+
return value.length > 0 && value.every(carriesOnlyNulls);
|
|
9541
|
+
}
|
|
9542
|
+
if (typeof value === "object" && value !== undefined) {
|
|
9543
|
+
const values = Object.values(value);
|
|
9544
|
+
return values.length > 0 && values.every(carriesOnlyNulls);
|
|
9545
|
+
}
|
|
9546
|
+
return false;
|
|
9547
|
+
}
|
|
9548
|
+
function nameList(names, cap2 = 12) {
|
|
9549
|
+
const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
|
|
9550
|
+
const rest = names.length - shown.length;
|
|
9551
|
+
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
9552
|
+
}
|
|
9553
|
+
function buildFilterWarning(filter, data, outcome) {
|
|
9554
|
+
const present = availableFields(data);
|
|
9555
|
+
const refs = referencedFields(filter);
|
|
9556
|
+
const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
|
|
9557
|
+
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
9558
|
+
const count = countRecords(data);
|
|
9559
|
+
const scope = `${count} record(s)`;
|
|
9560
|
+
const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
9561
|
+
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" : "";
|
|
9562
|
+
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
9563
|
+
let detail;
|
|
9564
|
+
let lede;
|
|
9565
|
+
if (outcome.kind === "null-elements") {
|
|
9566
|
+
lede = "returned only null values";
|
|
9567
|
+
const projected = `all ${outcome.count} of the elements it projected are null`;
|
|
9568
|
+
if (unknown.length > 0) {
|
|
9569
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
9570
|
+
} else if (unchecked.length > 0) {
|
|
9571
|
+
detail = withSoundness(projected);
|
|
9572
|
+
} else {
|
|
9573
|
+
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`;
|
|
9574
|
+
}
|
|
9575
|
+
} else if (outcome.kind === "null-rows") {
|
|
9576
|
+
lede = "returned only null values";
|
|
9577
|
+
const projected = `every value it projected is null on all ${outcome.count} row(s)`;
|
|
9578
|
+
detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
|
|
9579
|
+
} else if (outcome.kind === "null-values") {
|
|
9580
|
+
lede = "returned only null values";
|
|
9581
|
+
const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
|
|
9582
|
+
const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
|
|
9583
|
+
if (sameSet) {
|
|
9584
|
+
detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
|
|
9585
|
+
} else if (unknown.length > 0) {
|
|
9586
|
+
detail = `${projected}, because ${isNotAField(unknown)}`;
|
|
9587
|
+
} else {
|
|
9588
|
+
detail = withSoundness(`${projected} on all ${scope}`);
|
|
9589
|
+
}
|
|
9590
|
+
} else {
|
|
9591
|
+
lede = "returned nothing";
|
|
9592
|
+
if (unknown.length > 0) {
|
|
9593
|
+
detail = isNotAField(unknown);
|
|
9594
|
+
} else {
|
|
9595
|
+
const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
|
|
9596
|
+
detail = withSoundness(`${selection} — it read ${scope}`);
|
|
9597
|
+
}
|
|
9598
|
+
}
|
|
9599
|
+
const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
|
|
9600
|
+
return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
|
|
9601
|
+
}
|
|
9602
|
+
function appendWarning(existing, note) {
|
|
9603
|
+
return existing ? `${existing} ${note}` : note;
|
|
9604
|
+
}
|
|
9605
|
+
function applyFilter(data, filter, onWarning) {
|
|
9448
9606
|
const codec = requireJmespath();
|
|
9449
9607
|
let result;
|
|
9450
9608
|
try {
|
|
@@ -9452,9 +9610,34 @@ function applyFilter(data, filter) {
|
|
|
9452
9610
|
} catch (err) {
|
|
9453
9611
|
throw new FilterEvaluationError(filter, err);
|
|
9454
9612
|
}
|
|
9455
|
-
|
|
9613
|
+
const inputCount = countRecords(data);
|
|
9614
|
+
const warn = (outcome) => {
|
|
9615
|
+
if (inputCount === 0)
|
|
9616
|
+
return;
|
|
9617
|
+
const note = buildFilterWarning(filter, data, outcome);
|
|
9618
|
+
getOutputSink().writeErr(`[WARN] ${note}
|
|
9619
|
+
`);
|
|
9620
|
+
onWarning?.(note);
|
|
9621
|
+
};
|
|
9622
|
+
const warnIfAllNull = (records) => {
|
|
9623
|
+
const keys = alwaysNullKeys(records);
|
|
9624
|
+
if (keys.length > 0)
|
|
9625
|
+
warn({ kind: "null-values", keys });
|
|
9626
|
+
};
|
|
9627
|
+
if (result == null) {
|
|
9628
|
+
warn({ kind: "empty" });
|
|
9456
9629
|
return [];
|
|
9630
|
+
}
|
|
9457
9631
|
if (Array.isArray(result)) {
|
|
9632
|
+
if (result.length === 0) {
|
|
9633
|
+
warn({ kind: "empty" });
|
|
9634
|
+
} else if (result.every((entry) => entry === null)) {
|
|
9635
|
+
warn({ kind: "null-elements", count: result.length });
|
|
9636
|
+
} else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
|
|
9637
|
+
warn({ kind: "null-rows", count: result.length });
|
|
9638
|
+
} else {
|
|
9639
|
+
warnIfAllNull(result);
|
|
9640
|
+
}
|
|
9458
9641
|
if (result.length > 0 && typeof result[0] !== "object") {
|
|
9459
9642
|
const fieldMatch = filter.match(/\.(\w+)$/);
|
|
9460
9643
|
const key = fieldMatch ? fieldMatch[1] : "Value";
|
|
@@ -9462,10 +9645,30 @@ function applyFilter(data, filter) {
|
|
|
9462
9645
|
}
|
|
9463
9646
|
return result;
|
|
9464
9647
|
}
|
|
9465
|
-
if (typeof result === "object")
|
|
9648
|
+
if (typeof result === "object") {
|
|
9649
|
+
warnIfAllNull([result]);
|
|
9466
9650
|
return result;
|
|
9651
|
+
}
|
|
9467
9652
|
return { Value: result };
|
|
9468
9653
|
}
|
|
9654
|
+
function filterFailureData(envelope) {
|
|
9655
|
+
const filter = getOutputFilter();
|
|
9656
|
+
const data = envelope.Data;
|
|
9657
|
+
if (!filter || data == null)
|
|
9658
|
+
return;
|
|
9659
|
+
let note;
|
|
9660
|
+
const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
|
|
9661
|
+
note = n;
|
|
9662
|
+
}));
|
|
9663
|
+
if (filterError) {
|
|
9664
|
+
envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
|
|
9665
|
+
return;
|
|
9666
|
+
}
|
|
9667
|
+
envelope.Data = filtered;
|
|
9668
|
+
if (note) {
|
|
9669
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
9670
|
+
}
|
|
9671
|
+
}
|
|
9469
9672
|
function defaultErrorCodeForResult(result) {
|
|
9470
9673
|
switch (result) {
|
|
9471
9674
|
case RESULTS.AuthenticationError:
|
|
@@ -9548,8 +9751,14 @@ var OutputFormatter;
|
|
|
9548
9751
|
}
|
|
9549
9752
|
const filter = getOutputFilter();
|
|
9550
9753
|
if (filter) {
|
|
9551
|
-
|
|
9754
|
+
let note;
|
|
9755
|
+
const filtered = applyFilter(data.Data, filter, (n) => {
|
|
9756
|
+
note = n;
|
|
9757
|
+
});
|
|
9552
9758
|
data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
|
|
9759
|
+
if (note) {
|
|
9760
|
+
data.Warning = appendWarning(data.Warning, note);
|
|
9761
|
+
}
|
|
9553
9762
|
}
|
|
9554
9763
|
logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
|
|
9555
9764
|
}
|
|
@@ -9577,6 +9786,7 @@ var OutputFormatter;
|
|
|
9577
9786
|
delete envelope.TelemetryErrorClass;
|
|
9578
9787
|
delete envelope.TelemetryTerminalOutcome;
|
|
9579
9788
|
delete envelope.TelemetryTerminalSignal;
|
|
9789
|
+
filterFailureData(envelope);
|
|
9580
9790
|
if (!suppressTelemetry) {
|
|
9581
9791
|
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
9582
9792
|
result: data.Result,
|
|
@@ -9625,13 +9835,20 @@ var OutputFormatter;
|
|
|
9625
9835
|
OutputFormatter.log = log;
|
|
9626
9836
|
function formatToString(data) {
|
|
9627
9837
|
const filter = getOutputFilter();
|
|
9838
|
+
const envelope = data;
|
|
9628
9839
|
if ("Data" in data && data.Data != null) {
|
|
9629
9840
|
data.Data = normalizeDataKeys(data.Data);
|
|
9630
9841
|
if (filter) {
|
|
9631
|
-
|
|
9842
|
+
let note;
|
|
9843
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
|
|
9844
|
+
note = n;
|
|
9845
|
+
}));
|
|
9846
|
+
if (note) {
|
|
9847
|
+
envelope.Warning = appendWarning(envelope.Warning, note);
|
|
9848
|
+
}
|
|
9632
9849
|
}
|
|
9633
9850
|
}
|
|
9634
|
-
const output = normalizeOutputKeys(
|
|
9851
|
+
const output = normalizeOutputKeys(envelope);
|
|
9635
9852
|
const lines = [];
|
|
9636
9853
|
const sink = getOutputSink();
|
|
9637
9854
|
printOutput(output, getOutputFormat(), (msg) => {
|
|
@@ -44550,4 +44767,4 @@ var registerCommands = async (program2) => {
|
|
|
44550
44767
|
|
|
44551
44768
|
export { Command, metadata, registerCommands };
|
|
44552
44769
|
|
|
44553
|
-
//# debugId=
|
|
44770
|
+
//# debugId=3C47CB53B92B31C964756E2164756E21
|
package/dist/tool.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/vertical-solutions-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": "Scaffold and generate Vertical Solution projects.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
|
|
39
39
|
}
|