@uipath/admin-tool 1.203.0-preview.235 → 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.
Files changed (2) hide show
  1. package/dist/tool.js +450 -16
  2. package/package.json +2 -2
package/dist/tool.js CHANGED
@@ -21097,7 +21097,165 @@ class FilterImplicitLimitError extends Error {
21097
21097
  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).";
21098
21098
  }
21099
21099
  }
21100
- function applyFilter(data, filter) {
21100
+ function countRecords(data) {
21101
+ if (Array.isArray(data))
21102
+ return data.length;
21103
+ return data == null ? 0 : 1;
21104
+ }
21105
+ function availableFields(data) {
21106
+ const records = Array.isArray(data) ? data : [data];
21107
+ const keys = new Set;
21108
+ for (const record of records) {
21109
+ if (record && typeof record === "object" && !Array.isArray(record)) {
21110
+ for (const key of Object.keys(record))
21111
+ keys.add(key);
21112
+ }
21113
+ }
21114
+ return [...keys];
21115
+ }
21116
+ function decodeQuotedIdentifier(whole, inner) {
21117
+ const [error, decoded] = catchError2(() => JSON.parse(whole));
21118
+ if (!error && typeof decoded === "string")
21119
+ return decoded;
21120
+ return inner.replace(/\\(.)/g, "$1");
21121
+ }
21122
+ function referencedFields(filter) {
21123
+ const top = new Set;
21124
+ const nested = new Set;
21125
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
21126
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
21127
+ const quoted = [];
21128
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
21129
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
21130
+ if (!isAlias) {
21131
+ quoted.push({
21132
+ name: decodeQuotedIdentifier(whole, name),
21133
+ index,
21134
+ tail: isPathTail(withoutValueLiterals, index)
21135
+ });
21136
+ }
21137
+ return `"${" ".repeat(whole.length - 2)}"`;
21138
+ });
21139
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
21140
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
21141
+ const place = (name, index, tail) => {
21142
+ if (tail || index >= rootEnd)
21143
+ nested.add(name);
21144
+ else
21145
+ top.add(name);
21146
+ };
21147
+ for (const entry of quoted)
21148
+ place(entry.name, entry.index, entry.tail);
21149
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
21150
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
21151
+ for (const match of identifiers) {
21152
+ const [, name, trailing] = match;
21153
+ if (trailing || reserved.has(name))
21154
+ continue;
21155
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
21156
+ }
21157
+ return {
21158
+ top: [...top],
21159
+ nested: [...nested].filter((name) => !top.has(name)),
21160
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
21161
+ };
21162
+ }
21163
+ function appearsBelowTopLevel(data, name) {
21164
+ let budget = 2000;
21165
+ const visit = (value, depth) => {
21166
+ if (budget-- <= 0 || depth > 4)
21167
+ return false;
21168
+ if (value === null || typeof value !== "object")
21169
+ return false;
21170
+ if (Array.isArray(value))
21171
+ return value.some((entry) => visit(entry, depth));
21172
+ const record = value;
21173
+ if (depth > 0 && Object.hasOwn(record, name))
21174
+ return true;
21175
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
21176
+ };
21177
+ return visit(data, 0);
21178
+ }
21179
+ function alwaysNullKeys(records) {
21180
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
21181
+ if (objects.length === 0 || objects.length !== records.length)
21182
+ return [];
21183
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
21184
+ if (keys.length === 0)
21185
+ return [];
21186
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
21187
+ return nullKeys.length === keys.length ? nullKeys : [];
21188
+ }
21189
+ function carriesOnlyNulls(value) {
21190
+ if (value === null)
21191
+ return true;
21192
+ if (Array.isArray(value)) {
21193
+ return value.length > 0 && value.every(carriesOnlyNulls);
21194
+ }
21195
+ if (typeof value === "object" && value !== undefined) {
21196
+ const values = Object.values(value);
21197
+ return values.length > 0 && values.every(carriesOnlyNulls);
21198
+ }
21199
+ return false;
21200
+ }
21201
+ function nameList(names, cap2 = 12) {
21202
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
21203
+ const rest = names.length - shown.length;
21204
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
21205
+ }
21206
+ function buildFilterWarning(filter, data, outcome) {
21207
+ const present = availableFields(data);
21208
+ const refs = referencedFields(filter);
21209
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
21210
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
21211
+ const count = countRecords(data);
21212
+ const scope = `${count} record(s)`;
21213
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
21214
+ 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" : "";
21215
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
21216
+ let detail;
21217
+ let lede;
21218
+ if (outcome.kind === "null-elements") {
21219
+ lede = "returned only null values";
21220
+ const projected = `all ${outcome.count} of the elements it projected are null`;
21221
+ if (unknown.length > 0) {
21222
+ detail = `${projected}, because ${isNotAField(unknown)}`;
21223
+ } else if (unchecked.length > 0) {
21224
+ detail = withSoundness(projected);
21225
+ } else {
21226
+ 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`;
21227
+ }
21228
+ } else if (outcome.kind === "null-rows") {
21229
+ lede = "returned only null values";
21230
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
21231
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
21232
+ } else if (outcome.kind === "null-values") {
21233
+ lede = "returned only null values";
21234
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
21235
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
21236
+ if (sameSet) {
21237
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
21238
+ } else if (unknown.length > 0) {
21239
+ detail = `${projected}, because ${isNotAField(unknown)}`;
21240
+ } else {
21241
+ detail = withSoundness(`${projected} on all ${scope}`);
21242
+ }
21243
+ } else {
21244
+ lede = "returned nothing";
21245
+ if (unknown.length > 0) {
21246
+ detail = isNotAField(unknown);
21247
+ } else {
21248
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
21249
+ detail = withSoundness(`${selection} — it read ${scope}`);
21250
+ }
21251
+ }
21252
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
21253
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
21254
+ }
21255
+ function appendWarning(existing, note) {
21256
+ return existing ? `${existing} ${note}` : note;
21257
+ }
21258
+ function applyFilter(data, filter, onWarning) {
21101
21259
  const codec = requireJmespath();
21102
21260
  let result;
21103
21261
  try {
@@ -21105,9 +21263,34 @@ function applyFilter(data, filter) {
21105
21263
  } catch (err) {
21106
21264
  throw new FilterEvaluationError(filter, err);
21107
21265
  }
21108
- if (result == null)
21266
+ const inputCount = countRecords(data);
21267
+ const warn = (outcome) => {
21268
+ if (inputCount === 0)
21269
+ return;
21270
+ const note = buildFilterWarning(filter, data, outcome);
21271
+ getOutputSink().writeErr(`[WARN] ${note}
21272
+ `);
21273
+ onWarning?.(note);
21274
+ };
21275
+ const warnIfAllNull = (records) => {
21276
+ const keys = alwaysNullKeys(records);
21277
+ if (keys.length > 0)
21278
+ warn({ kind: "null-values", keys });
21279
+ };
21280
+ if (result == null) {
21281
+ warn({ kind: "empty" });
21109
21282
  return [];
21283
+ }
21110
21284
  if (Array.isArray(result)) {
21285
+ if (result.length === 0) {
21286
+ warn({ kind: "empty" });
21287
+ } else if (result.every((entry) => entry === null)) {
21288
+ warn({ kind: "null-elements", count: result.length });
21289
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
21290
+ warn({ kind: "null-rows", count: result.length });
21291
+ } else {
21292
+ warnIfAllNull(result);
21293
+ }
21111
21294
  if (result.length > 0 && typeof result[0] !== "object") {
21112
21295
  const fieldMatch = filter.match(/\.(\w+)$/);
21113
21296
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -21115,10 +21298,30 @@ function applyFilter(data, filter) {
21115
21298
  }
21116
21299
  return result;
21117
21300
  }
21118
- if (typeof result === "object")
21301
+ if (typeof result === "object") {
21302
+ warnIfAllNull([result]);
21119
21303
  return result;
21304
+ }
21120
21305
  return { Value: result };
21121
21306
  }
21307
+ function filterFailureData(envelope) {
21308
+ const filter = getOutputFilter();
21309
+ const data = envelope.Data;
21310
+ if (!filter || data == null)
21311
+ return;
21312
+ let note;
21313
+ const [filterError, filtered] = catchError2(() => applyFilter(data, filter, (n) => {
21314
+ note = n;
21315
+ }));
21316
+ if (filterError) {
21317
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
21318
+ return;
21319
+ }
21320
+ envelope.Data = filtered;
21321
+ if (note) {
21322
+ envelope.Warning = appendWarning(envelope.Warning, note);
21323
+ }
21324
+ }
21122
21325
  function defaultErrorCodeForResult(result) {
21123
21326
  switch (result) {
21124
21327
  case RESULTS.AuthenticationError:
@@ -21201,8 +21404,14 @@ var OutputFormatter;
21201
21404
  }
21202
21405
  const filter = getOutputFilter();
21203
21406
  if (filter) {
21204
- const filtered = applyFilter(data.Data, filter);
21407
+ let note;
21408
+ const filtered = applyFilter(data.Data, filter, (n) => {
21409
+ note = n;
21410
+ });
21205
21411
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
21412
+ if (note) {
21413
+ data.Warning = appendWarning(data.Warning, note);
21414
+ }
21206
21415
  }
21207
21416
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
21208
21417
  }
@@ -21230,6 +21439,7 @@ var OutputFormatter;
21230
21439
  delete envelope.TelemetryErrorClass;
21231
21440
  delete envelope.TelemetryTerminalOutcome;
21232
21441
  delete envelope.TelemetryTerminalSignal;
21442
+ filterFailureData(envelope);
21233
21443
  if (!suppressTelemetry) {
21234
21444
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
21235
21445
  result: data.Result,
@@ -21278,13 +21488,20 @@ var OutputFormatter;
21278
21488
  OutputFormatter2.log = log;
21279
21489
  function formatToString(data) {
21280
21490
  const filter = getOutputFilter();
21491
+ const envelope = data;
21281
21492
  if ("Data" in data && data.Data != null) {
21282
21493
  data.Data = normalizeDataKeys(data.Data);
21283
21494
  if (filter) {
21284
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
21495
+ let note;
21496
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
21497
+ note = n;
21498
+ }));
21499
+ if (note) {
21500
+ envelope.Warning = appendWarning(envelope.Warning, note);
21501
+ }
21285
21502
  }
21286
21503
  }
21287
- const output = normalizeOutputKeys(data);
21504
+ const output = normalizeOutputKeys(envelope);
21288
21505
  const lines = [];
21289
21506
  const sink = getOutputSink();
21290
21507
  printOutput(output, getOutputFormat(), (msg) => {
@@ -23222,7 +23439,7 @@ var package_default2 = {
23222
23439
  name: "@uipath/apms-tool",
23223
23440
  author: "UiPath",
23224
23441
  license: "SEE LICENSE IN LICENSE.txt",
23225
- version: "1.203.0-preview.235",
23442
+ version: "1.203.0-preview.237",
23226
23443
  description: "CLI plugin for the UiPath Access Policy Management Service.",
23227
23444
  private: false,
23228
23445
  repository: {
@@ -28672,7 +28889,165 @@ class FilterImplicitLimitError2 extends Error {
28672
28889
  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).";
28673
28890
  }
28674
28891
  }
28675
- function applyFilter2(data, filter) {
28892
+ function countRecords2(data) {
28893
+ if (Array.isArray(data))
28894
+ return data.length;
28895
+ return data == null ? 0 : 1;
28896
+ }
28897
+ function availableFields2(data) {
28898
+ const records = Array.isArray(data) ? data : [data];
28899
+ const keys = new Set;
28900
+ for (const record of records) {
28901
+ if (record && typeof record === "object" && !Array.isArray(record)) {
28902
+ for (const key of Object.keys(record))
28903
+ keys.add(key);
28904
+ }
28905
+ }
28906
+ return [...keys];
28907
+ }
28908
+ function decodeQuotedIdentifier2(whole, inner) {
28909
+ const [error, decoded] = catchError5(() => JSON.parse(whole));
28910
+ if (!error && typeof decoded === "string")
28911
+ return decoded;
28912
+ return inner.replace(/\\(.)/g, "$1");
28913
+ }
28914
+ function referencedFields2(filter) {
28915
+ const top = new Set;
28916
+ const nested = new Set;
28917
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
28918
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
28919
+ const quoted = [];
28920
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
28921
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
28922
+ if (!isAlias) {
28923
+ quoted.push({
28924
+ name: decodeQuotedIdentifier2(whole, name),
28925
+ index,
28926
+ tail: isPathTail(withoutValueLiterals, index)
28927
+ });
28928
+ }
28929
+ return `"${" ".repeat(whole.length - 2)}"`;
28930
+ });
28931
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
28932
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
28933
+ const place = (name, index, tail) => {
28934
+ if (tail || index >= rootEnd)
28935
+ nested.add(name);
28936
+ else
28937
+ top.add(name);
28938
+ };
28939
+ for (const entry of quoted)
28940
+ place(entry.name, entry.index, entry.tail);
28941
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
28942
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
28943
+ for (const match of identifiers) {
28944
+ const [, name, trailing] = match;
28945
+ if (trailing || reserved.has(name))
28946
+ continue;
28947
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
28948
+ }
28949
+ return {
28950
+ top: [...top],
28951
+ nested: [...nested].filter((name) => !top.has(name)),
28952
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
28953
+ };
28954
+ }
28955
+ function appearsBelowTopLevel2(data, name) {
28956
+ let budget = 2000;
28957
+ const visit = (value, depth) => {
28958
+ if (budget-- <= 0 || depth > 4)
28959
+ return false;
28960
+ if (value === null || typeof value !== "object")
28961
+ return false;
28962
+ if (Array.isArray(value))
28963
+ return value.some((entry) => visit(entry, depth));
28964
+ const record = value;
28965
+ if (depth > 0 && Object.hasOwn(record, name))
28966
+ return true;
28967
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
28968
+ };
28969
+ return visit(data, 0);
28970
+ }
28971
+ function alwaysNullKeys2(records) {
28972
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
28973
+ if (objects.length === 0 || objects.length !== records.length)
28974
+ return [];
28975
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
28976
+ if (keys.length === 0)
28977
+ return [];
28978
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
28979
+ return nullKeys.length === keys.length ? nullKeys : [];
28980
+ }
28981
+ function carriesOnlyNulls2(value) {
28982
+ if (value === null)
28983
+ return true;
28984
+ if (Array.isArray(value)) {
28985
+ return value.length > 0 && value.every(carriesOnlyNulls2);
28986
+ }
28987
+ if (typeof value === "object" && value !== undefined) {
28988
+ const values = Object.values(value);
28989
+ return values.length > 0 && values.every(carriesOnlyNulls2);
28990
+ }
28991
+ return false;
28992
+ }
28993
+ function nameList2(names, cap3 = 12) {
28994
+ const shown = names.slice(0, cap3).map((n) => `\`${n}\``);
28995
+ const rest = names.length - shown.length;
28996
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
28997
+ }
28998
+ function buildFilterWarning2(filter, data, outcome) {
28999
+ const present = availableFields2(data);
29000
+ const refs = referencedFields2(filter);
29001
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel2(data, name));
29002
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
29003
+ const count = countRecords2(data);
29004
+ const scope = `${count} record(s)`;
29005
+ const isNotAField = (names) => `${nameList2(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
29006
+ const soundness = unchecked.length > 0 ? `${nameList2(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" : "";
29007
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
29008
+ let detail;
29009
+ let lede;
29010
+ if (outcome.kind === "null-elements") {
29011
+ lede = "returned only null values";
29012
+ const projected = `all ${outcome.count} of the elements it projected are null`;
29013
+ if (unknown.length > 0) {
29014
+ detail = `${projected}, because ${isNotAField(unknown)}`;
29015
+ } else if (unchecked.length > 0) {
29016
+ detail = withSoundness(projected);
29017
+ } else {
29018
+ 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`;
29019
+ }
29020
+ } else if (outcome.kind === "null-rows") {
29021
+ lede = "returned only null values";
29022
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
29023
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
29024
+ } else if (outcome.kind === "null-values") {
29025
+ lede = "returned only null values";
29026
+ const projected = `every key it projected (${nameList2(outcome.keys)}) is null`;
29027
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
29028
+ if (sameSet) {
29029
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
29030
+ } else if (unknown.length > 0) {
29031
+ detail = `${projected}, because ${isNotAField(unknown)}`;
29032
+ } else {
29033
+ detail = withSoundness(`${projected} on all ${scope}`);
29034
+ }
29035
+ } else {
29036
+ lede = "returned nothing";
29037
+ if (unknown.length > 0) {
29038
+ detail = isNotAField(unknown);
29039
+ } else {
29040
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
29041
+ detail = withSoundness(`${selection} — it read ${scope}`);
29042
+ }
29043
+ }
29044
+ const fields = present.length > 0 ? ` Available fields: ${nameList2(present)}.` : "";
29045
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
29046
+ }
29047
+ function appendWarning2(existing, note) {
29048
+ return existing ? `${existing} ${note}` : note;
29049
+ }
29050
+ function applyFilter2(data, filter, onWarning) {
28676
29051
  const codec = requireJmespath2();
28677
29052
  let result;
28678
29053
  try {
@@ -28680,9 +29055,34 @@ function applyFilter2(data, filter) {
28680
29055
  } catch (err) {
28681
29056
  throw new FilterEvaluationError2(filter, err);
28682
29057
  }
28683
- if (result == null)
29058
+ const inputCount = countRecords2(data);
29059
+ const warn = (outcome) => {
29060
+ if (inputCount === 0)
29061
+ return;
29062
+ const note = buildFilterWarning2(filter, data, outcome);
29063
+ getOutputSink2().writeErr(`[WARN] ${note}
29064
+ `);
29065
+ onWarning?.(note);
29066
+ };
29067
+ const warnIfAllNull = (records) => {
29068
+ const keys = alwaysNullKeys2(records);
29069
+ if (keys.length > 0)
29070
+ warn({ kind: "null-values", keys });
29071
+ };
29072
+ if (result == null) {
29073
+ warn({ kind: "empty" });
28684
29074
  return [];
29075
+ }
28685
29076
  if (Array.isArray(result)) {
29077
+ if (result.length === 0) {
29078
+ warn({ kind: "empty" });
29079
+ } else if (result.every((entry) => entry === null)) {
29080
+ warn({ kind: "null-elements", count: result.length });
29081
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls2(result)) {
29082
+ warn({ kind: "null-rows", count: result.length });
29083
+ } else {
29084
+ warnIfAllNull(result);
29085
+ }
28686
29086
  if (result.length > 0 && typeof result[0] !== "object") {
28687
29087
  const fieldMatch = filter.match(/\.(\w+)$/);
28688
29088
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -28690,10 +29090,30 @@ function applyFilter2(data, filter) {
28690
29090
  }
28691
29091
  return result;
28692
29092
  }
28693
- if (typeof result === "object")
29093
+ if (typeof result === "object") {
29094
+ warnIfAllNull([result]);
28694
29095
  return result;
29096
+ }
28695
29097
  return { Value: result };
28696
29098
  }
29099
+ function filterFailureData2(envelope) {
29100
+ const filter = getOutputFilter2();
29101
+ const data = envelope.Data;
29102
+ if (!filter || data == null)
29103
+ return;
29104
+ let note;
29105
+ const [filterError, filtered] = catchError5(() => applyFilter2(data, filter, (n) => {
29106
+ note = n;
29107
+ }));
29108
+ if (filterError) {
29109
+ envelope.Warning = appendWarning2(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
29110
+ return;
29111
+ }
29112
+ envelope.Data = filtered;
29113
+ if (note) {
29114
+ envelope.Warning = appendWarning2(envelope.Warning, note);
29115
+ }
29116
+ }
28697
29117
  function defaultErrorCodeForResult2(result) {
28698
29118
  switch (result) {
28699
29119
  case RESULTS2.AuthenticationError:
@@ -28776,8 +29196,14 @@ var OutputFormatter2;
28776
29196
  }
28777
29197
  const filter = getOutputFilter2();
28778
29198
  if (filter) {
28779
- const filtered = applyFilter2(data.Data, filter);
29199
+ let note;
29200
+ const filtered = applyFilter2(data.Data, filter, (n) => {
29201
+ note = n;
29202
+ });
28780
29203
  data.Data = normalize ? normalizeDataKeys2(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
29204
+ if (note) {
29205
+ data.Warning = appendWarning2(data.Warning, note);
29206
+ }
28781
29207
  }
28782
29208
  logOutput2(normalizeOutputKeys2(data), getOutputFormat2(), options?.tableRowStyle);
28783
29209
  }
@@ -28805,6 +29231,7 @@ var OutputFormatter2;
28805
29231
  delete envelope.TelemetryErrorClass;
28806
29232
  delete envelope.TelemetryTerminalOutcome;
28807
29233
  delete envelope.TelemetryTerminalSignal;
29234
+ filterFailureData2(envelope);
28808
29235
  if (!suppressTelemetry) {
28809
29236
  telemetry2.trackEvent(CommonTelemetryEvents2.Error, {
28810
29237
  result: data.Result,
@@ -28853,13 +29280,20 @@ var OutputFormatter2;
28853
29280
  OutputFormatter.log = log;
28854
29281
  function formatToString(data) {
28855
29282
  const filter = getOutputFilter2();
29283
+ const envelope = data;
28856
29284
  if ("Data" in data && data.Data != null) {
28857
29285
  data.Data = normalizeDataKeys2(data.Data);
28858
29286
  if (filter) {
28859
- data.Data = normalizeDataKeys2(applyFilter2(data.Data, filter));
29287
+ let note;
29288
+ data.Data = normalizeDataKeys2(applyFilter2(data.Data, filter, (n) => {
29289
+ note = n;
29290
+ }));
29291
+ if (note) {
29292
+ envelope.Warning = appendWarning2(envelope.Warning, note);
29293
+ }
28860
29294
  }
28861
29295
  }
28862
- const output = normalizeOutputKeys2(data);
29296
+ const output = normalizeOutputKeys2(envelope);
28863
29297
  const lines = [];
28864
29298
  const sink = getOutputSink2();
28865
29299
  printOutput2(output, getOutputFormat2(), (msg) => {
@@ -46775,7 +47209,7 @@ var package_default8 = {
46775
47209
  name: "@uipath/resourcecatalog-tool",
46776
47210
  author: "UiPath",
46777
47211
  license: "SEE LICENSE IN LICENSE.txt",
46778
- version: "1.203.0-preview.235",
47212
+ version: "1.203.0-preview.237",
46779
47213
  description: "CLI plugin for the UiPath Resource Catalog Service.",
46780
47214
  private: false,
46781
47215
  repository: {
@@ -48725,7 +49159,7 @@ var package_default10 = {
48725
49159
  name: "@uipath/admin-tool",
48726
49160
  author: "UiPath",
48727
49161
  license: "SEE LICENSE IN LICENSE.txt",
48728
- version: "1.203.0-preview.235",
49162
+ version: "1.203.0-preview.237",
48729
49163
  description: "Manage UiPath admin resources — Identity Server, Resource Catalog Service, Audit Service, VPN Gateway.",
48730
49164
  private: false,
48731
49165
  repository: {
@@ -48790,4 +49224,4 @@ export {
48790
49224
  registerCommands8 as registerCommands
48791
49225
  };
48792
49226
 
48793
- //# debugId=398E688EB8E6ED8064756E2164756E21
49227
+ //# debugId=96523BD14D0434A864756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/admin-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.235",
5
+ "version": "1.203.0-preview.237",
6
6
  "description": "Manage UiPath admin resources — Identity Server, Resource Catalog Service, Audit Service, VPN Gateway.",
7
7
  "private": false,
8
8
  "repository": {
@@ -24,5 +24,5 @@
24
24
  "files": [
25
25
  "dist"
26
26
  ],
27
- "gitHead": "4788b04c17a4429e5a994af2c3eba3898d1c4b13"
27
+ "gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
28
28
  }