@uipath/integrationservice-sdk 1.202.1-preview.220 → 1.202.1-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.
Files changed (2) hide show
  1. package/dist/index.js +225 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -65336,7 +65336,7 @@ class TextApiResponse2 {
65336
65336
  var package_default = {
65337
65337
  name: "@uipath/integrationservice-sdk",
65338
65338
  license: "SEE LICENSE IN LICENSE.txt",
65339
- version: "1.202.1-preview.220",
65339
+ version: "1.202.1-preview.239",
65340
65340
  repository: {
65341
65341
  type: "git",
65342
65342
  url: "https://github.com/UiPath/cli.git",
@@ -88808,7 +88808,165 @@ class FilterImplicitLimitError extends Error {
88808
88808
  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).";
88809
88809
  }
88810
88810
  }
88811
- function applyFilter(data, filter) {
88811
+ function countRecords(data) {
88812
+ if (Array.isArray(data))
88813
+ return data.length;
88814
+ return data == null ? 0 : 1;
88815
+ }
88816
+ function availableFields(data) {
88817
+ const records = Array.isArray(data) ? data : [data];
88818
+ const keys2 = new Set;
88819
+ for (const record2 of records) {
88820
+ if (record2 && typeof record2 === "object" && !Array.isArray(record2)) {
88821
+ for (const key of Object.keys(record2))
88822
+ keys2.add(key);
88823
+ }
88824
+ }
88825
+ return [...keys2];
88826
+ }
88827
+ function decodeQuotedIdentifier(whole, inner) {
88828
+ const [error46, decoded] = catchError3(() => JSON.parse(whole));
88829
+ if (!error46 && typeof decoded === "string")
88830
+ return decoded;
88831
+ return inner.replace(/\\(.)/g, "$1");
88832
+ }
88833
+ function referencedFields(filter) {
88834
+ const top = new Set;
88835
+ const nested = new Set;
88836
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
88837
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
88838
+ const quoted = [];
88839
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
88840
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
88841
+ if (!isAlias) {
88842
+ quoted.push({
88843
+ name: decodeQuotedIdentifier(whole, name),
88844
+ index,
88845
+ tail: isPathTail(withoutValueLiterals, index)
88846
+ });
88847
+ }
88848
+ return `"${" ".repeat(whole.length - 2)}"`;
88849
+ });
88850
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
88851
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
88852
+ const place = (name, index, tail) => {
88853
+ if (tail || index >= rootEnd)
88854
+ nested.add(name);
88855
+ else
88856
+ top.add(name);
88857
+ };
88858
+ for (const entry of quoted)
88859
+ place(entry.name, entry.index, entry.tail);
88860
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
88861
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
88862
+ for (const match2 of identifiers) {
88863
+ const [, name, trailing] = match2;
88864
+ if (trailing || reserved.has(name))
88865
+ continue;
88866
+ place(name, match2.index, isPathTail(withoutLiterals, match2.index));
88867
+ }
88868
+ return {
88869
+ top: [...top],
88870
+ nested: [...nested].filter((name) => !top.has(name)),
88871
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
88872
+ };
88873
+ }
88874
+ function appearsBelowTopLevel(data, name) {
88875
+ let budget = 2000;
88876
+ const visit = (value, depth) => {
88877
+ if (budget-- <= 0 || depth > 4)
88878
+ return false;
88879
+ if (value === null || typeof value !== "object")
88880
+ return false;
88881
+ if (Array.isArray(value))
88882
+ return value.some((entry) => visit(entry, depth));
88883
+ const record2 = value;
88884
+ if (depth > 0 && Object.hasOwn(record2, name))
88885
+ return true;
88886
+ return Object.values(record2).some((entry) => visit(entry, depth + 1));
88887
+ };
88888
+ return visit(data, 0);
88889
+ }
88890
+ function alwaysNullKeys(records) {
88891
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
88892
+ if (objects.length === 0 || objects.length !== records.length)
88893
+ return [];
88894
+ const keys2 = [...new Set(objects.flatMap((o) => Object.keys(o)))];
88895
+ if (keys2.length === 0)
88896
+ return [];
88897
+ const nullKeys = keys2.filter((key) => objects.every((record2) => record2[key] === null));
88898
+ return nullKeys.length === keys2.length ? nullKeys : [];
88899
+ }
88900
+ function carriesOnlyNulls(value) {
88901
+ if (value === null)
88902
+ return true;
88903
+ if (Array.isArray(value)) {
88904
+ return value.length > 0 && value.every(carriesOnlyNulls);
88905
+ }
88906
+ if (typeof value === "object" && value !== undefined) {
88907
+ const values = Object.values(value);
88908
+ return values.length > 0 && values.every(carriesOnlyNulls);
88909
+ }
88910
+ return false;
88911
+ }
88912
+ function nameList(names, cap2 = 12) {
88913
+ const shown = names.slice(0, cap2).map((n2) => `\`${n2}\``);
88914
+ const rest = names.length - shown.length;
88915
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
88916
+ }
88917
+ function buildFilterWarning(filter, data, outcome) {
88918
+ const present = availableFields(data);
88919
+ const refs = referencedFields(filter);
88920
+ const unknown2 = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
88921
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
88922
+ const count = countRecords(data);
88923
+ const scope = `${count} record(s)`;
88924
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
88925
+ 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" : "";
88926
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
88927
+ let detail;
88928
+ let lede;
88929
+ if (outcome.kind === "null-elements") {
88930
+ lede = "returned only null values";
88931
+ const projected = `all ${outcome.count} of the elements it projected are null`;
88932
+ if (unknown2.length > 0) {
88933
+ detail = `${projected}, because ${isNotAField(unknown2)}`;
88934
+ } else if (unchecked.length > 0) {
88935
+ detail = withSoundness(projected);
88936
+ } else {
88937
+ 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`;
88938
+ }
88939
+ } else if (outcome.kind === "null-rows") {
88940
+ lede = "returned only null values";
88941
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
88942
+ detail = unknown2.length > 0 ? `${projected}, because ${isNotAField(unknown2)}` : withSoundness(projected);
88943
+ } else if (outcome.kind === "null-values") {
88944
+ lede = "returned only null values";
88945
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
88946
+ const sameSet = unknown2.length === outcome.keys.length && outcome.keys.every((k) => unknown2.includes(k));
88947
+ if (sameSet) {
88948
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
88949
+ } else if (unknown2.length > 0) {
88950
+ detail = `${projected}, because ${isNotAField(unknown2)}`;
88951
+ } else {
88952
+ detail = withSoundness(`${projected} on all ${scope}`);
88953
+ }
88954
+ } else {
88955
+ lede = "returned nothing";
88956
+ if (unknown2.length > 0) {
88957
+ detail = isNotAField(unknown2);
88958
+ } else {
88959
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
88960
+ detail = withSoundness(`${selection} — it read ${scope}`);
88961
+ }
88962
+ }
88963
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
88964
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
88965
+ }
88966
+ function appendWarning(existing, note) {
88967
+ return existing ? `${existing} ${note}` : note;
88968
+ }
88969
+ function applyFilter(data, filter, onWarning) {
88812
88970
  const codec2 = requireJmespath();
88813
88971
  let result;
88814
88972
  try {
@@ -88816,9 +88974,34 @@ function applyFilter(data, filter) {
88816
88974
  } catch (err) {
88817
88975
  throw new FilterEvaluationError(filter, err);
88818
88976
  }
88819
- if (result == null)
88977
+ const inputCount = countRecords(data);
88978
+ const warn = (outcome) => {
88979
+ if (inputCount === 0)
88980
+ return;
88981
+ const note = buildFilterWarning(filter, data, outcome);
88982
+ getOutputSink().writeErr(`[WARN] ${note}
88983
+ `);
88984
+ onWarning?.(note);
88985
+ };
88986
+ const warnIfAllNull = (records) => {
88987
+ const keys2 = alwaysNullKeys(records);
88988
+ if (keys2.length > 0)
88989
+ warn({ kind: "null-values", keys: keys2 });
88990
+ };
88991
+ if (result == null) {
88992
+ warn({ kind: "empty" });
88820
88993
  return [];
88994
+ }
88821
88995
  if (Array.isArray(result)) {
88996
+ if (result.length === 0) {
88997
+ warn({ kind: "empty" });
88998
+ } else if (result.every((entry) => entry === null)) {
88999
+ warn({ kind: "null-elements", count: result.length });
89000
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
89001
+ warn({ kind: "null-rows", count: result.length });
89002
+ } else {
89003
+ warnIfAllNull(result);
89004
+ }
88822
89005
  if (result.length > 0 && typeof result[0] !== "object") {
88823
89006
  const fieldMatch = filter.match(/\.(\w+)$/);
88824
89007
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -88826,10 +89009,30 @@ function applyFilter(data, filter) {
88826
89009
  }
88827
89010
  return result;
88828
89011
  }
88829
- if (typeof result === "object")
89012
+ if (typeof result === "object") {
89013
+ warnIfAllNull([result]);
88830
89014
  return result;
89015
+ }
88831
89016
  return { Value: result };
88832
89017
  }
89018
+ function filterFailureData(envelope) {
89019
+ const filter = getOutputFilter();
89020
+ const data = envelope.Data;
89021
+ if (!filter || data == null)
89022
+ return;
89023
+ let note;
89024
+ const [filterError, filtered] = catchError3(() => applyFilter(data, filter, (n2) => {
89025
+ note = n2;
89026
+ }));
89027
+ if (filterError) {
89028
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
89029
+ return;
89030
+ }
89031
+ envelope.Data = filtered;
89032
+ if (note) {
89033
+ envelope.Warning = appendWarning(envelope.Warning, note);
89034
+ }
89035
+ }
88833
89036
  function defaultErrorCodeForResult(result) {
88834
89037
  switch (result) {
88835
89038
  case RESULTS.AuthenticationError:
@@ -88912,8 +89115,14 @@ var OutputFormatter;
88912
89115
  }
88913
89116
  const filter = getOutputFilter();
88914
89117
  if (filter) {
88915
- const filtered = applyFilter(data.Data, filter);
89118
+ let note;
89119
+ const filtered = applyFilter(data.Data, filter, (n2) => {
89120
+ note = n2;
89121
+ });
88916
89122
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
89123
+ if (note) {
89124
+ data.Warning = appendWarning(data.Warning, note);
89125
+ }
88917
89126
  }
88918
89127
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
88919
89128
  }
@@ -88941,6 +89150,7 @@ var OutputFormatter;
88941
89150
  delete envelope.TelemetryErrorClass;
88942
89151
  delete envelope.TelemetryTerminalOutcome;
88943
89152
  delete envelope.TelemetryTerminalSignal;
89153
+ filterFailureData(envelope);
88944
89154
  if (!suppressTelemetry) {
88945
89155
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
88946
89156
  result: data.Result,
@@ -88989,13 +89199,20 @@ var OutputFormatter;
88989
89199
  OutputFormatter.log = log;
88990
89200
  function formatToString(data) {
88991
89201
  const filter = getOutputFilter();
89202
+ const envelope = data;
88992
89203
  if ("Data" in data && data.Data != null) {
88993
89204
  data.Data = normalizeDataKeys(data.Data);
88994
89205
  if (filter) {
88995
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
89206
+ let note;
89207
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n2) => {
89208
+ note = n2;
89209
+ }));
89210
+ if (note) {
89211
+ envelope.Warning = appendWarning(envelope.Warning, note);
89212
+ }
88996
89213
  }
88997
89214
  }
88998
- const output = normalizeOutputKeys(data);
89215
+ const output = normalizeOutputKeys(envelope);
88999
89216
  const lines = [];
89000
89217
  const sink = getOutputSink();
89001
89218
  printOutput(output, getOutputFormat(), (msg) => {
@@ -91418,4 +91635,4 @@ export {
91418
91635
  validateRequiredParameters
91419
91636
  };
91420
91637
 
91421
- //# debugId=5B7E3F9F1BBA5AE264756E2164756E21
91638
+ //# debugId=81CBF529A5C26F7864756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/integrationservice-sdk",
3
3
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.1-preview.220",
4
+ "version": "1.202.1-preview.239",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/UiPath/cli.git",
@@ -30,5 +30,5 @@
30
30
  "dependencies": {
31
31
  "@uipath/integration-service-design-time": "0.25.2"
32
32
  },
33
- "gitHead": "a09041733b628c3f6b658a1f58349ea0f40bb492"
33
+ "gitHead": "97545a7857bdff7e6db62bbe13c6097607cf38f1"
34
34
  }