@uipath/integrationservice-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 CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-dx3z8fea.js";
6
+ } from "./tool-gapfjp00.js";
7
7
  import"./tool-1de529jm.js";
8
8
 
9
9
  // src/index.ts
@@ -2101,7 +2101,7 @@ var package_default = {
2101
2101
  name: "@uipath/integrationservice-tool",
2102
2102
  author: "UiPath",
2103
2103
  license: "SEE LICENSE IN LICENSE.txt",
2104
- version: "1.203.0-preview.233",
2104
+ version: "1.203.0-preview.237",
2105
2105
  description: "Manage Integration Service connectors, connections, and triggers.",
2106
2106
  private: false,
2107
2107
  repository: {
@@ -5040,7 +5040,165 @@ class FilterImplicitLimitError extends Error {
5040
5040
  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).";
5041
5041
  }
5042
5042
  }
5043
- function applyFilter(data, filter) {
5043
+ function countRecords(data) {
5044
+ if (Array.isArray(data))
5045
+ return data.length;
5046
+ return data == null ? 0 : 1;
5047
+ }
5048
+ function availableFields(data) {
5049
+ const records = Array.isArray(data) ? data : [data];
5050
+ const keys = new Set;
5051
+ for (const record of records) {
5052
+ if (record && typeof record === "object" && !Array.isArray(record)) {
5053
+ for (const key of Object.keys(record))
5054
+ keys.add(key);
5055
+ }
5056
+ }
5057
+ return [...keys];
5058
+ }
5059
+ function decodeQuotedIdentifier(whole, inner) {
5060
+ const [error, decoded] = catchError(() => JSON.parse(whole));
5061
+ if (!error && typeof decoded === "string")
5062
+ return decoded;
5063
+ return inner.replace(/\\(.)/g, "$1");
5064
+ }
5065
+ function referencedFields(filter) {
5066
+ const top = new Set;
5067
+ const nested = new Set;
5068
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
5069
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
5070
+ const quoted = [];
5071
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
5072
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
5073
+ if (!isAlias) {
5074
+ quoted.push({
5075
+ name: decodeQuotedIdentifier(whole, name),
5076
+ index,
5077
+ tail: isPathTail(withoutValueLiterals, index)
5078
+ });
5079
+ }
5080
+ return `"${" ".repeat(whole.length - 2)}"`;
5081
+ });
5082
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
5083
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
5084
+ const place = (name, index, tail) => {
5085
+ if (tail || index >= rootEnd)
5086
+ nested.add(name);
5087
+ else
5088
+ top.add(name);
5089
+ };
5090
+ for (const entry of quoted)
5091
+ place(entry.name, entry.index, entry.tail);
5092
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
5093
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
5094
+ for (const match of identifiers) {
5095
+ const [, name, trailing] = match;
5096
+ if (trailing || reserved.has(name))
5097
+ continue;
5098
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
5099
+ }
5100
+ return {
5101
+ top: [...top],
5102
+ nested: [...nested].filter((name) => !top.has(name)),
5103
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
5104
+ };
5105
+ }
5106
+ function appearsBelowTopLevel(data, name) {
5107
+ let budget = 2000;
5108
+ const visit = (value, depth) => {
5109
+ if (budget-- <= 0 || depth > 4)
5110
+ return false;
5111
+ if (value === null || typeof value !== "object")
5112
+ return false;
5113
+ if (Array.isArray(value))
5114
+ return value.some((entry) => visit(entry, depth));
5115
+ const record = value;
5116
+ if (depth > 0 && Object.hasOwn(record, name))
5117
+ return true;
5118
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
5119
+ };
5120
+ return visit(data, 0);
5121
+ }
5122
+ function alwaysNullKeys(records) {
5123
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
5124
+ if (objects.length === 0 || objects.length !== records.length)
5125
+ return [];
5126
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
5127
+ if (keys.length === 0)
5128
+ return [];
5129
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
5130
+ return nullKeys.length === keys.length ? nullKeys : [];
5131
+ }
5132
+ function carriesOnlyNulls(value) {
5133
+ if (value === null)
5134
+ return true;
5135
+ if (Array.isArray(value)) {
5136
+ return value.length > 0 && value.every(carriesOnlyNulls);
5137
+ }
5138
+ if (typeof value === "object" && value !== undefined) {
5139
+ const values = Object.values(value);
5140
+ return values.length > 0 && values.every(carriesOnlyNulls);
5141
+ }
5142
+ return false;
5143
+ }
5144
+ function nameList(names, cap2 = 12) {
5145
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5146
+ const rest = names.length - shown.length;
5147
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5148
+ }
5149
+ function buildFilterWarning(filter, data, outcome) {
5150
+ const present = availableFields(data);
5151
+ const refs = referencedFields(filter);
5152
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
5153
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
5154
+ const count = countRecords(data);
5155
+ const scope = `${count} record(s)`;
5156
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5157
+ 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" : "";
5158
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5159
+ let detail;
5160
+ let lede;
5161
+ if (outcome.kind === "null-elements") {
5162
+ lede = "returned only null values";
5163
+ const projected = `all ${outcome.count} of the elements it projected are null`;
5164
+ if (unknown.length > 0) {
5165
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5166
+ } else if (unchecked.length > 0) {
5167
+ detail = withSoundness(projected);
5168
+ } else {
5169
+ 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`;
5170
+ }
5171
+ } else if (outcome.kind === "null-rows") {
5172
+ lede = "returned only null values";
5173
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
5174
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
5175
+ } else if (outcome.kind === "null-values") {
5176
+ lede = "returned only null values";
5177
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
5178
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
5179
+ if (sameSet) {
5180
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
5181
+ } else if (unknown.length > 0) {
5182
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5183
+ } else {
5184
+ detail = withSoundness(`${projected} on all ${scope}`);
5185
+ }
5186
+ } else {
5187
+ lede = "returned nothing";
5188
+ if (unknown.length > 0) {
5189
+ detail = isNotAField(unknown);
5190
+ } else {
5191
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
5192
+ detail = withSoundness(`${selection} — it read ${scope}`);
5193
+ }
5194
+ }
5195
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
5196
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
5197
+ }
5198
+ function appendWarning(existing, note) {
5199
+ return existing ? `${existing} ${note}` : note;
5200
+ }
5201
+ function applyFilter(data, filter, onWarning) {
5044
5202
  const codec = requireJmespath();
5045
5203
  let result;
5046
5204
  try {
@@ -5048,9 +5206,34 @@ function applyFilter(data, filter) {
5048
5206
  } catch (err) {
5049
5207
  throw new FilterEvaluationError(filter, err);
5050
5208
  }
5051
- if (result == null)
5209
+ const inputCount = countRecords(data);
5210
+ const warn = (outcome) => {
5211
+ if (inputCount === 0)
5212
+ return;
5213
+ const note = buildFilterWarning(filter, data, outcome);
5214
+ getOutputSink().writeErr(`[WARN] ${note}
5215
+ `);
5216
+ onWarning?.(note);
5217
+ };
5218
+ const warnIfAllNull = (records) => {
5219
+ const keys = alwaysNullKeys(records);
5220
+ if (keys.length > 0)
5221
+ warn({ kind: "null-values", keys });
5222
+ };
5223
+ if (result == null) {
5224
+ warn({ kind: "empty" });
5052
5225
  return [];
5226
+ }
5053
5227
  if (Array.isArray(result)) {
5228
+ if (result.length === 0) {
5229
+ warn({ kind: "empty" });
5230
+ } else if (result.every((entry) => entry === null)) {
5231
+ warn({ kind: "null-elements", count: result.length });
5232
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
5233
+ warn({ kind: "null-rows", count: result.length });
5234
+ } else {
5235
+ warnIfAllNull(result);
5236
+ }
5054
5237
  if (result.length > 0 && typeof result[0] !== "object") {
5055
5238
  const fieldMatch = filter.match(/\.(\w+)$/);
5056
5239
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -5058,10 +5241,30 @@ function applyFilter(data, filter) {
5058
5241
  }
5059
5242
  return result;
5060
5243
  }
5061
- if (typeof result === "object")
5244
+ if (typeof result === "object") {
5245
+ warnIfAllNull([result]);
5062
5246
  return result;
5247
+ }
5063
5248
  return { Value: result };
5064
5249
  }
5250
+ function filterFailureData(envelope) {
5251
+ const filter = getOutputFilter();
5252
+ const data = envelope.Data;
5253
+ if (!filter || data == null)
5254
+ return;
5255
+ let note;
5256
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
5257
+ note = n;
5258
+ }));
5259
+ if (filterError) {
5260
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
5261
+ return;
5262
+ }
5263
+ envelope.Data = filtered;
5264
+ if (note) {
5265
+ envelope.Warning = appendWarning(envelope.Warning, note);
5266
+ }
5267
+ }
5065
5268
  function defaultErrorCodeForResult(result) {
5066
5269
  switch (result) {
5067
5270
  case RESULTS.AuthenticationError:
@@ -5144,8 +5347,14 @@ var OutputFormatter;
5144
5347
  }
5145
5348
  const filter = getOutputFilter();
5146
5349
  if (filter) {
5147
- const filtered = applyFilter(data.Data, filter);
5350
+ let note;
5351
+ const filtered = applyFilter(data.Data, filter, (n) => {
5352
+ note = n;
5353
+ });
5148
5354
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
5355
+ if (note) {
5356
+ data.Warning = appendWarning(data.Warning, note);
5357
+ }
5149
5358
  }
5150
5359
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
5151
5360
  }
@@ -5173,6 +5382,7 @@ var OutputFormatter;
5173
5382
  delete envelope.TelemetryErrorClass;
5174
5383
  delete envelope.TelemetryTerminalOutcome;
5175
5384
  delete envelope.TelemetryTerminalSignal;
5385
+ filterFailureData(envelope);
5176
5386
  if (!suppressTelemetry) {
5177
5387
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
5178
5388
  result: data.Result,
@@ -5221,13 +5431,20 @@ var OutputFormatter;
5221
5431
  OutputFormatter.log = log;
5222
5432
  function formatToString(data) {
5223
5433
  const filter = getOutputFilter();
5434
+ const envelope = data;
5224
5435
  if ("Data" in data && data.Data != null) {
5225
5436
  data.Data = normalizeDataKeys(data.Data);
5226
5437
  if (filter) {
5227
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5438
+ let note;
5439
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5440
+ note = n;
5441
+ }));
5442
+ if (note) {
5443
+ envelope.Warning = appendWarning(envelope.Warning, note);
5444
+ }
5228
5445
  }
5229
5446
  }
5230
- const output = normalizeOutputKeys(data);
5447
+ const output = normalizeOutputKeys(envelope);
5231
5448
  const lines = [];
5232
5449
  const sink = getOutputSink();
5233
5450
  printOutput(output, getOutputFormat(), (msg) => {
@@ -7022,7 +7239,7 @@ var package_default2 = {
7022
7239
  name: "@uipath/integrationservice-sdk",
7023
7240
  author: "UiPath",
7024
7241
  license: "SEE LICENSE IN LICENSE.txt",
7025
- version: "1.203.0-preview.233",
7242
+ version: "1.203.0-preview.237",
7026
7243
  repository: {
7027
7244
  type: "git",
7028
7245
  url: "https://github.com/UiPath/cli.git",
@@ -31125,4 +31342,4 @@ var registerCommands = async (program2) => {
31125
31342
 
31126
31343
  export { Command, metadata, registerCommands };
31127
31344
 
31128
- //# debugId=BC7B2107C0CCC68164756E2164756E21
31345
+ //# debugId=C977D92E04583F7D64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-dx3z8fea.js";
4
+ } from "./tool-gapfjp00.js";
5
5
  import"./tool-1de529jm.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/integrationservice-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.233",
5
+ "version": "1.203.0-preview.237",
6
6
  "description": "Manage Integration Service connectors, connections, and triggers.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "641614a6f9817662baaf51dabdebbfa2a9334b1b"
30
+ "gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
31
31
  }