@uipath/integrationservice-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 CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-t2zgpjmy.js";
6
+ } from "./tool-ghazfxkk.js";
7
7
  import"./tool-1de529jm.js";
8
8
 
9
9
  // src/index.ts
@@ -2100,7 +2100,7 @@ var require_commander = __commonJS(function(exports) {
2100
2100
  var package_default = {
2101
2101
  name: "@uipath/integrationservice-tool",
2102
2102
  license: "SEE LICENSE IN LICENSE.txt",
2103
- version: "1.202.1-preview.217",
2103
+ version: "1.202.1-preview.238",
2104
2104
  description: "Manage Integration Service connectors, connections, and triggers.",
2105
2105
  private: false,
2106
2106
  repository: {
@@ -4794,7 +4794,165 @@ class FilterImplicitLimitError extends Error {
4794
4794
  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).";
4795
4795
  }
4796
4796
  }
4797
- function applyFilter(data, filter) {
4797
+ function countRecords(data) {
4798
+ if (Array.isArray(data))
4799
+ return data.length;
4800
+ return data == null ? 0 : 1;
4801
+ }
4802
+ function availableFields(data) {
4803
+ const records = Array.isArray(data) ? data : [data];
4804
+ const keys = new Set;
4805
+ for (const record of records) {
4806
+ if (record && typeof record === "object" && !Array.isArray(record)) {
4807
+ for (const key of Object.keys(record))
4808
+ keys.add(key);
4809
+ }
4810
+ }
4811
+ return [...keys];
4812
+ }
4813
+ function decodeQuotedIdentifier(whole, inner) {
4814
+ const [error, decoded] = catchError(() => JSON.parse(whole));
4815
+ if (!error && typeof decoded === "string")
4816
+ return decoded;
4817
+ return inner.replace(/\\(.)/g, "$1");
4818
+ }
4819
+ function referencedFields(filter) {
4820
+ const top = new Set;
4821
+ const nested = new Set;
4822
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
4823
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
4824
+ const quoted = [];
4825
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
4826
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
4827
+ if (!isAlias) {
4828
+ quoted.push({
4829
+ name: decodeQuotedIdentifier(whole, name),
4830
+ index,
4831
+ tail: isPathTail(withoutValueLiterals, index)
4832
+ });
4833
+ }
4834
+ return `"${" ".repeat(whole.length - 2)}"`;
4835
+ });
4836
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
4837
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
4838
+ const place = (name, index, tail) => {
4839
+ if (tail || index >= rootEnd)
4840
+ nested.add(name);
4841
+ else
4842
+ top.add(name);
4843
+ };
4844
+ for (const entry of quoted)
4845
+ place(entry.name, entry.index, entry.tail);
4846
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
4847
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
4848
+ for (const match of identifiers) {
4849
+ const [, name, trailing] = match;
4850
+ if (trailing || reserved.has(name))
4851
+ continue;
4852
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
4853
+ }
4854
+ return {
4855
+ top: [...top],
4856
+ nested: [...nested].filter((name) => !top.has(name)),
4857
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
4858
+ };
4859
+ }
4860
+ function appearsBelowTopLevel(data, name) {
4861
+ let budget = 2000;
4862
+ const visit = (value, depth) => {
4863
+ if (budget-- <= 0 || depth > 4)
4864
+ return false;
4865
+ if (value === null || typeof value !== "object")
4866
+ return false;
4867
+ if (Array.isArray(value))
4868
+ return value.some((entry) => visit(entry, depth));
4869
+ const record = value;
4870
+ if (depth > 0 && Object.hasOwn(record, name))
4871
+ return true;
4872
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
4873
+ };
4874
+ return visit(data, 0);
4875
+ }
4876
+ function alwaysNullKeys(records) {
4877
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
4878
+ if (objects.length === 0 || objects.length !== records.length)
4879
+ return [];
4880
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
4881
+ if (keys.length === 0)
4882
+ return [];
4883
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
4884
+ return nullKeys.length === keys.length ? nullKeys : [];
4885
+ }
4886
+ function carriesOnlyNulls(value) {
4887
+ if (value === null)
4888
+ return true;
4889
+ if (Array.isArray(value)) {
4890
+ return value.length > 0 && value.every(carriesOnlyNulls);
4891
+ }
4892
+ if (typeof value === "object" && value !== undefined) {
4893
+ const values = Object.values(value);
4894
+ return values.length > 0 && values.every(carriesOnlyNulls);
4895
+ }
4896
+ return false;
4897
+ }
4898
+ function nameList(names, cap2 = 12) {
4899
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
4900
+ const rest = names.length - shown.length;
4901
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
4902
+ }
4903
+ function buildFilterWarning(filter, data, outcome) {
4904
+ const present = availableFields(data);
4905
+ const refs = referencedFields(filter);
4906
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
4907
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
4908
+ const count = countRecords(data);
4909
+ const scope = `${count} record(s)`;
4910
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
4911
+ 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" : "";
4912
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
4913
+ let detail;
4914
+ let lede;
4915
+ if (outcome.kind === "null-elements") {
4916
+ lede = "returned only null values";
4917
+ const projected = `all ${outcome.count} of the elements it projected are null`;
4918
+ if (unknown.length > 0) {
4919
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4920
+ } else if (unchecked.length > 0) {
4921
+ detail = withSoundness(projected);
4922
+ } else {
4923
+ 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`;
4924
+ }
4925
+ } else if (outcome.kind === "null-rows") {
4926
+ lede = "returned only null values";
4927
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
4928
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
4929
+ } else if (outcome.kind === "null-values") {
4930
+ lede = "returned only null values";
4931
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
4932
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
4933
+ if (sameSet) {
4934
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
4935
+ } else if (unknown.length > 0) {
4936
+ detail = `${projected}, because ${isNotAField(unknown)}`;
4937
+ } else {
4938
+ detail = withSoundness(`${projected} on all ${scope}`);
4939
+ }
4940
+ } else {
4941
+ lede = "returned nothing";
4942
+ if (unknown.length > 0) {
4943
+ detail = isNotAField(unknown);
4944
+ } else {
4945
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
4946
+ detail = withSoundness(`${selection} — it read ${scope}`);
4947
+ }
4948
+ }
4949
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
4950
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
4951
+ }
4952
+ function appendWarning(existing, note) {
4953
+ return existing ? `${existing} ${note}` : note;
4954
+ }
4955
+ function applyFilter(data, filter, onWarning) {
4798
4956
  const codec = requireJmespath();
4799
4957
  let result;
4800
4958
  try {
@@ -4802,9 +4960,34 @@ function applyFilter(data, filter) {
4802
4960
  } catch (err) {
4803
4961
  throw new FilterEvaluationError(filter, err);
4804
4962
  }
4805
- if (result == null)
4963
+ const inputCount = countRecords(data);
4964
+ const warn = (outcome) => {
4965
+ if (inputCount === 0)
4966
+ return;
4967
+ const note = buildFilterWarning(filter, data, outcome);
4968
+ getOutputSink().writeErr(`[WARN] ${note}
4969
+ `);
4970
+ onWarning?.(note);
4971
+ };
4972
+ const warnIfAllNull = (records) => {
4973
+ const keys = alwaysNullKeys(records);
4974
+ if (keys.length > 0)
4975
+ warn({ kind: "null-values", keys });
4976
+ };
4977
+ if (result == null) {
4978
+ warn({ kind: "empty" });
4806
4979
  return [];
4980
+ }
4807
4981
  if (Array.isArray(result)) {
4982
+ if (result.length === 0) {
4983
+ warn({ kind: "empty" });
4984
+ } else if (result.every((entry) => entry === null)) {
4985
+ warn({ kind: "null-elements", count: result.length });
4986
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
4987
+ warn({ kind: "null-rows", count: result.length });
4988
+ } else {
4989
+ warnIfAllNull(result);
4990
+ }
4808
4991
  if (result.length > 0 && typeof result[0] !== "object") {
4809
4992
  const fieldMatch = filter.match(/\.(\w+)$/);
4810
4993
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -4812,10 +4995,30 @@ function applyFilter(data, filter) {
4812
4995
  }
4813
4996
  return result;
4814
4997
  }
4815
- if (typeof result === "object")
4998
+ if (typeof result === "object") {
4999
+ warnIfAllNull([result]);
4816
5000
  return result;
5001
+ }
4817
5002
  return { Value: result };
4818
5003
  }
5004
+ function filterFailureData(envelope) {
5005
+ const filter = getOutputFilter();
5006
+ const data = envelope.Data;
5007
+ if (!filter || data == null)
5008
+ return;
5009
+ let note;
5010
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
5011
+ note = n;
5012
+ }));
5013
+ if (filterError) {
5014
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
5015
+ return;
5016
+ }
5017
+ envelope.Data = filtered;
5018
+ if (note) {
5019
+ envelope.Warning = appendWarning(envelope.Warning, note);
5020
+ }
5021
+ }
4819
5022
  function defaultErrorCodeForResult(result) {
4820
5023
  switch (result) {
4821
5024
  case RESULTS.AuthenticationError:
@@ -4898,8 +5101,14 @@ var OutputFormatter;
4898
5101
  }
4899
5102
  const filter = getOutputFilter();
4900
5103
  if (filter) {
4901
- const filtered = applyFilter(data.Data, filter);
5104
+ let note;
5105
+ const filtered = applyFilter(data.Data, filter, (n) => {
5106
+ note = n;
5107
+ });
4902
5108
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
5109
+ if (note) {
5110
+ data.Warning = appendWarning(data.Warning, note);
5111
+ }
4903
5112
  }
4904
5113
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
4905
5114
  }
@@ -4927,6 +5136,7 @@ var OutputFormatter;
4927
5136
  delete envelope.TelemetryErrorClass;
4928
5137
  delete envelope.TelemetryTerminalOutcome;
4929
5138
  delete envelope.TelemetryTerminalSignal;
5139
+ filterFailureData(envelope);
4930
5140
  if (!suppressTelemetry) {
4931
5141
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
4932
5142
  result: data.Result,
@@ -4975,13 +5185,20 @@ var OutputFormatter;
4975
5185
  OutputFormatter.log = log;
4976
5186
  function formatToString(data) {
4977
5187
  const filter = getOutputFilter();
5188
+ const envelope = data;
4978
5189
  if ("Data" in data && data.Data != null) {
4979
5190
  data.Data = normalizeDataKeys(data.Data);
4980
5191
  if (filter) {
4981
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5192
+ let note;
5193
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5194
+ note = n;
5195
+ }));
5196
+ if (note) {
5197
+ envelope.Warning = appendWarning(envelope.Warning, note);
5198
+ }
4982
5199
  }
4983
5200
  }
4984
- const output = normalizeOutputKeys(data);
5201
+ const output = normalizeOutputKeys(envelope);
4985
5202
  const lines = [];
4986
5203
  const sink = getOutputSink();
4987
5204
  printOutput(output, getOutputFormat(), (msg) => {
@@ -6775,7 +6992,7 @@ class TextApiResponse {
6775
6992
  var package_default2 = {
6776
6993
  name: "@uipath/integrationservice-sdk",
6777
6994
  license: "SEE LICENSE IN LICENSE.txt",
6778
- version: "1.202.1-preview.217",
6995
+ version: "1.202.1-preview.238",
6779
6996
  repository: {
6780
6997
  type: "git",
6781
6998
  url: "https://github.com/UiPath/cli.git",
@@ -30639,4 +30856,4 @@ var registerCommands = async (program2) => {
30639
30856
 
30640
30857
  export { Command, metadata, registerCommands };
30641
30858
 
30642
- //# debugId=781E312AAF19809E64756E2164756E21
30859
+ //# debugId=1E79C83029ED343C64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-t2zgpjmy.js";
4
+ } from "./tool-ghazfxkk.js";
5
5
  import"./tool-1de529jm.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/integrationservice-tool",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.1-preview.217",
4
+ "version": "1.202.1-preview.238",
5
5
  "description": "Manage Integration Service connectors, connections, and triggers.",
6
6
  "private": false,
7
7
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "files": [
27
27
  "dist"
28
28
  ],
29
- "gitHead": "bd513110d03342230901ece289a303e5a0009404"
29
+ "gitHead": "537e43df1d3583633cfd3a0b88634f9ce3ba9d6b"
30
30
  }