@uipath/orchestrator-tool 1.202.2-preview.220 → 1.202.2-preview.239

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 CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-hn5atrw1.js";
6
+ } from "./tool-aj4608my.js";
7
7
  import"./tool-ayyhwvs8.js";
8
8
  import"./tool-1de529jm.js";
9
9
 
@@ -2103,7 +2103,7 @@ var require_commander = __commonJS(function(exports) {
2103
2103
  var package_default = {
2104
2104
  name: "@uipath/orchestrator-tool",
2105
2105
  license: "SEE LICENSE IN LICENSE.txt",
2106
- version: "1.202.2-preview.220",
2106
+ version: "1.202.2-preview.239",
2107
2107
  description: "Manage Orchestrator folders, jobs, processes, and releases.",
2108
2108
  private: false,
2109
2109
  repository: {
@@ -4613,7 +4613,165 @@ class FilterImplicitLimitError extends Error {
4613
4613
  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).";
4614
4614
  }
4615
4615
  }
4616
- function applyFilter(data, filter) {
4616
+ function countRecords(data) {
4617
+ if (Array.isArray(data))
4618
+ return data.length;
4619
+ return data == null ? 0 : 1;
4620
+ }
4621
+ function availableFields(data) {
4622
+ const records = Array.isArray(data) ? data : [data];
4623
+ const keys = new Set;
4624
+ for (const record of records) {
4625
+ if (record && typeof record === "object" && !Array.isArray(record)) {
4626
+ for (const key of Object.keys(record))
4627
+ keys.add(key);
4628
+ }
4629
+ }
4630
+ return [...keys];
4631
+ }
4632
+ function decodeQuotedIdentifier(whole, inner) {
4633
+ const [error, decoded] = catchError(() => JSON.parse(whole));
4634
+ if (!error && typeof decoded === "string")
4635
+ return decoded;
4636
+ return inner.replace(/\\(.)/g, "$1");
4637
+ }
4638
+ function referencedFields(filter) {
4639
+ const top = new Set;
4640
+ const nested = new Set;
4641
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
4642
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
4643
+ const quoted = [];
4644
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
4645
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
4646
+ if (!isAlias) {
4647
+ quoted.push({
4648
+ name: decodeQuotedIdentifier(whole, name),
4649
+ index,
4650
+ tail: isPathTail(withoutValueLiterals, index)
4651
+ });
4652
+ }
4653
+ return `"${" ".repeat(whole.length - 2)}"`;
4654
+ });
4655
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
4656
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
4657
+ const place = (name, index, tail) => {
4658
+ if (tail || index >= rootEnd)
4659
+ nested.add(name);
4660
+ else
4661
+ top.add(name);
4662
+ };
4663
+ for (const entry of quoted)
4664
+ place(entry.name, entry.index, entry.tail);
4665
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
4666
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
4667
+ for (const match of identifiers) {
4668
+ const [, name, trailing] = match;
4669
+ if (trailing || reserved.has(name))
4670
+ continue;
4671
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
4672
+ }
4673
+ return {
4674
+ top: [...top],
4675
+ nested: [...nested].filter((name) => !top.has(name)),
4676
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
4677
+ };
4678
+ }
4679
+ function appearsBelowTopLevel(data, name) {
4680
+ let budget = 2000;
4681
+ const visit = (value, depth) => {
4682
+ if (budget-- <= 0 || depth > 4)
4683
+ return false;
4684
+ if (value === null || typeof value !== "object")
4685
+ return false;
4686
+ if (Array.isArray(value))
4687
+ return value.some((entry) => visit(entry, depth));
4688
+ const record = value;
4689
+ if (depth > 0 && Object.hasOwn(record, name))
4690
+ return true;
4691
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
4692
+ };
4693
+ return visit(data, 0);
4694
+ }
4695
+ function alwaysNullKeys(records) {
4696
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
4697
+ if (objects.length === 0 || objects.length !== records.length)
4698
+ return [];
4699
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
4700
+ if (keys.length === 0)
4701
+ return [];
4702
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
4703
+ return nullKeys.length === keys.length ? nullKeys : [];
4704
+ }
4705
+ function carriesOnlyNulls(value) {
4706
+ if (value === null)
4707
+ return true;
4708
+ if (Array.isArray(value)) {
4709
+ return value.length > 0 && value.every(carriesOnlyNulls);
4710
+ }
4711
+ if (typeof value === "object" && value !== undefined) {
4712
+ const values = Object.values(value);
4713
+ return values.length > 0 && values.every(carriesOnlyNulls);
4714
+ }
4715
+ return false;
4716
+ }
4717
+ function nameList(names, cap2 = 12) {
4718
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
4719
+ const rest = names.length - shown.length;
4720
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
4721
+ }
4722
+ function buildFilterWarning(filter, data, outcome) {
4723
+ const present = availableFields(data);
4724
+ const refs = referencedFields(filter);
4725
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
4726
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
4727
+ const count = countRecords(data);
4728
+ const scope = `${count} record(s)`;
4729
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
4730
+ 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" : "";
4731
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
4732
+ let detail;
4733
+ let lede;
4734
+ if (outcome.kind === "null-elements") {
4735
+ lede = "returned only null values";
4736
+ const projected = `all ${outcome.count} of the elements it projected are null`;
4737
+ if (unknown.length > 0) {
4738
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4739
+ } else if (unchecked.length > 0) {
4740
+ detail = withSoundness(projected);
4741
+ } else {
4742
+ 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`;
4743
+ }
4744
+ } else if (outcome.kind === "null-rows") {
4745
+ lede = "returned only null values";
4746
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
4747
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
4748
+ } else if (outcome.kind === "null-values") {
4749
+ lede = "returned only null values";
4750
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
4751
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
4752
+ if (sameSet) {
4753
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
4754
+ } else if (unknown.length > 0) {
4755
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4756
+ } else {
4757
+ detail = withSoundness(`${projected} on all ${scope}`);
4758
+ }
4759
+ } else {
4760
+ lede = "returned nothing";
4761
+ if (unknown.length > 0) {
4762
+ detail = isNotAField(unknown);
4763
+ } else {
4764
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
4765
+ detail = withSoundness(`${selection} — it read ${scope}`);
4766
+ }
4767
+ }
4768
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
4769
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
4770
+ }
4771
+ function appendWarning(existing, note) {
4772
+ return existing ? `${existing} ${note}` : note;
4773
+ }
4774
+ function applyFilter(data, filter, onWarning) {
4617
4775
  const codec = requireJmespath();
4618
4776
  let result;
4619
4777
  try {
@@ -4621,9 +4779,34 @@ function applyFilter(data, filter) {
4621
4779
  } catch (err) {
4622
4780
  throw new FilterEvaluationError(filter, err);
4623
4781
  }
4624
- if (result == null)
4782
+ const inputCount = countRecords(data);
4783
+ const warn = (outcome) => {
4784
+ if (inputCount === 0)
4785
+ return;
4786
+ const note = buildFilterWarning(filter, data, outcome);
4787
+ getOutputSink().writeErr(`[WARN] ${note}
4788
+ `);
4789
+ onWarning?.(note);
4790
+ };
4791
+ const warnIfAllNull = (records) => {
4792
+ const keys = alwaysNullKeys(records);
4793
+ if (keys.length > 0)
4794
+ warn({ kind: "null-values", keys });
4795
+ };
4796
+ if (result == null) {
4797
+ warn({ kind: "empty" });
4625
4798
  return [];
4799
+ }
4626
4800
  if (Array.isArray(result)) {
4801
+ if (result.length === 0) {
4802
+ warn({ kind: "empty" });
4803
+ } else if (result.every((entry) => entry === null)) {
4804
+ warn({ kind: "null-elements", count: result.length });
4805
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
4806
+ warn({ kind: "null-rows", count: result.length });
4807
+ } else {
4808
+ warnIfAllNull(result);
4809
+ }
4627
4810
  if (result.length > 0 && typeof result[0] !== "object") {
4628
4811
  const fieldMatch = filter.match(/\.(\w+)$/);
4629
4812
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -4631,10 +4814,30 @@ function applyFilter(data, filter) {
4631
4814
  }
4632
4815
  return result;
4633
4816
  }
4634
- if (typeof result === "object")
4817
+ if (typeof result === "object") {
4818
+ warnIfAllNull([result]);
4635
4819
  return result;
4820
+ }
4636
4821
  return { Value: result };
4637
4822
  }
4823
+ function filterFailureData(envelope) {
4824
+ const filter = getOutputFilter();
4825
+ const data = envelope.Data;
4826
+ if (!filter || data == null)
4827
+ return;
4828
+ let note;
4829
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
4830
+ note = n;
4831
+ }));
4832
+ if (filterError) {
4833
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
4834
+ return;
4835
+ }
4836
+ envelope.Data = filtered;
4837
+ if (note) {
4838
+ envelope.Warning = appendWarning(envelope.Warning, note);
4839
+ }
4840
+ }
4638
4841
  function defaultErrorCodeForResult(result) {
4639
4842
  switch (result) {
4640
4843
  case RESULTS.AuthenticationError:
@@ -4717,8 +4920,14 @@ var OutputFormatter;
4717
4920
  }
4718
4921
  const filter = getOutputFilter();
4719
4922
  if (filter) {
4720
- const filtered = applyFilter(data.Data, filter);
4923
+ let note;
4924
+ const filtered = applyFilter(data.Data, filter, (n) => {
4925
+ note = n;
4926
+ });
4721
4927
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
4928
+ if (note) {
4929
+ data.Warning = appendWarning(data.Warning, note);
4930
+ }
4722
4931
  }
4723
4932
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4724
4933
  }
@@ -4746,6 +4955,7 @@ var OutputFormatter;
4746
4955
  delete envelope.TelemetryErrorClass;
4747
4956
  delete envelope.TelemetryTerminalOutcome;
4748
4957
  delete envelope.TelemetryTerminalSignal;
4958
+ filterFailureData(envelope);
4749
4959
  if (!suppressTelemetry) {
4750
4960
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
4751
4961
  result: data.Result,
@@ -4794,13 +5004,20 @@ var OutputFormatter;
4794
5004
  OutputFormatter.log = log;
4795
5005
  function formatToString(data) {
4796
5006
  const filter = getOutputFilter();
5007
+ const envelope = data;
4797
5008
  if ("Data" in data && data.Data != null) {
4798
5009
  data.Data = normalizeDataKeys(data.Data);
4799
5010
  if (filter) {
4800
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5011
+ let note;
5012
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5013
+ note = n;
5014
+ }));
5015
+ if (note) {
5016
+ envelope.Warning = appendWarning(envelope.Warning, note);
5017
+ }
4801
5018
  }
4802
5019
  }
4803
- const output = normalizeOutputKeys(data);
5020
+ const output = normalizeOutputKeys(envelope);
4804
5021
  const lines = [];
4805
5022
  const sink = getOutputSink();
4806
5023
  printOutput(output, getOutputFormat(), (msg) => {
@@ -46091,4 +46308,4 @@ var registerCommands = async (program2) => {
46091
46308
 
46092
46309
  export { Command, metadata, registerCommands };
46093
46310
 
46094
- //# debugId=5B89FBDC03F4BE1164756E2164756E21
46311
+ //# debugId=973A3ACBACD235CA64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-hn5atrw1.js";
4
+ } from "./tool-aj4608my.js";
5
5
  import"./tool-ayyhwvs8.js";
6
6
  import"./tool-1de529jm.js";
7
7
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/orchestrator-tool",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.2-preview.220",
4
+ "version": "1.202.2-preview.239",
5
5
  "description": "Manage Orchestrator folders, jobs, processes, and releases.",
6
6
  "private": false,
7
7
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "a09041733b628c3f6b658a1f58349ea0f40bb492"
29
+ "gitHead": "97545a7857bdff7e6db62bbe13c6097607cf38f1"
30
30
  }