@uipath/eval-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.
@@ -4,7 +4,7 @@ import {
4
4
  getAuthContext,
5
5
  getSdkUserAgentToken,
6
6
  installSdkUserAgentHeader
7
- } from "./tool-q9tp0v6c.js";
7
+ } from "./tool-rqdmfvjs.js";
8
8
  import"./tool-1de529jm.js";
9
9
 
10
10
  // ../orchestrator-sdk/generated/src/runtime.ts
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  metadata,
4
4
  registerCommands
5
- } from "./tool-8ajx677h.js";
5
+ } from "./tool-3vn511td.js";
6
6
  import {
7
7
  Command
8
- } from "./tool-q9tp0v6c.js";
8
+ } from "./tool-rqdmfvjs.js";
9
9
  import"./tool-1de529jm.js";
10
10
 
11
11
  // src/index.ts
@@ -6,7 +6,7 @@ import {
6
6
  extractErrorMessage,
7
7
  getAuthContext,
8
8
  processContext
9
- } from "./tool-q9tp0v6c.js";
9
+ } from "./tool-rqdmfvjs.js";
10
10
  import {
11
11
  __require
12
12
  } from "./tool-1de529jm.js";
@@ -15,7 +15,7 @@ var package_default = {
15
15
  name: "@uipath/eval-tool",
16
16
  author: "UiPath",
17
17
  license: "SEE LICENSE IN LICENSE.txt",
18
- version: "1.203.0-preview.235",
18
+ version: "1.203.0-preview.237",
19
19
  description: "Manage runtime evaluations, evaluators, eval sets, evaluations, and schedules.",
20
20
  private: false,
21
21
  repository: {
@@ -1023,7 +1023,7 @@ async function resolveInline(options) {
1023
1023
  folderKey = options.folderKey;
1024
1024
  folderLabel = folderKey;
1025
1025
  } else {
1026
- const { createApiClient, PersonalWorkspacesApi } = await import("./index-cr9dpxy8.js");
1026
+ const { createApiClient, PersonalWorkspacesApi } = await import("./index-9p8s7anq.js");
1027
1027
  const [wsApiErr, wsApi] = await catchError(createApiClient(PersonalWorkspacesApi, {
1028
1028
  tenant: options.tenant
1029
1029
  }));
@@ -1593,4 +1593,4 @@ var registerCommands = async (program) => {
1593
1593
 
1594
1594
  export { metadata, registerCommands };
1595
1595
 
1596
- //# debugId=9E873D7A447610C764756E2164756E21
1596
+ //# debugId=DB62F51468C789AD64756E2164756E21
@@ -5115,7 +5115,165 @@ class FilterImplicitLimitError extends Error {
5115
5115
  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).";
5116
5116
  }
5117
5117
  }
5118
- function applyFilter(data, filter) {
5118
+ function countRecords(data) {
5119
+ if (Array.isArray(data))
5120
+ return data.length;
5121
+ return data == null ? 0 : 1;
5122
+ }
5123
+ function availableFields(data) {
5124
+ const records = Array.isArray(data) ? data : [data];
5125
+ const keys = new Set;
5126
+ for (const record of records) {
5127
+ if (record && typeof record === "object" && !Array.isArray(record)) {
5128
+ for (const key of Object.keys(record))
5129
+ keys.add(key);
5130
+ }
5131
+ }
5132
+ return [...keys];
5133
+ }
5134
+ function decodeQuotedIdentifier(whole, inner) {
5135
+ const [error, decoded] = catchError(() => JSON.parse(whole));
5136
+ if (!error && typeof decoded === "string")
5137
+ return decoded;
5138
+ return inner.replace(/\\(.)/g, "$1");
5139
+ }
5140
+ function referencedFields(filter) {
5141
+ const top = new Set;
5142
+ const nested = new Set;
5143
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
5144
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
5145
+ const quoted = [];
5146
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
5147
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
5148
+ if (!isAlias) {
5149
+ quoted.push({
5150
+ name: decodeQuotedIdentifier(whole, name),
5151
+ index,
5152
+ tail: isPathTail(withoutValueLiterals, index)
5153
+ });
5154
+ }
5155
+ return `"${" ".repeat(whole.length - 2)}"`;
5156
+ });
5157
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
5158
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
5159
+ const place = (name, index, tail) => {
5160
+ if (tail || index >= rootEnd)
5161
+ nested.add(name);
5162
+ else
5163
+ top.add(name);
5164
+ };
5165
+ for (const entry of quoted)
5166
+ place(entry.name, entry.index, entry.tail);
5167
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
5168
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
5169
+ for (const match of identifiers) {
5170
+ const [, name, trailing] = match;
5171
+ if (trailing || reserved.has(name))
5172
+ continue;
5173
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
5174
+ }
5175
+ return {
5176
+ top: [...top],
5177
+ nested: [...nested].filter((name) => !top.has(name)),
5178
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
5179
+ };
5180
+ }
5181
+ function appearsBelowTopLevel(data, name) {
5182
+ let budget = 2000;
5183
+ const visit = (value, depth) => {
5184
+ if (budget-- <= 0 || depth > 4)
5185
+ return false;
5186
+ if (value === null || typeof value !== "object")
5187
+ return false;
5188
+ if (Array.isArray(value))
5189
+ return value.some((entry) => visit(entry, depth));
5190
+ const record = value;
5191
+ if (depth > 0 && Object.hasOwn(record, name))
5192
+ return true;
5193
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
5194
+ };
5195
+ return visit(data, 0);
5196
+ }
5197
+ function alwaysNullKeys(records) {
5198
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
5199
+ if (objects.length === 0 || objects.length !== records.length)
5200
+ return [];
5201
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
5202
+ if (keys.length === 0)
5203
+ return [];
5204
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
5205
+ return nullKeys.length === keys.length ? nullKeys : [];
5206
+ }
5207
+ function carriesOnlyNulls(value) {
5208
+ if (value === null)
5209
+ return true;
5210
+ if (Array.isArray(value)) {
5211
+ return value.length > 0 && value.every(carriesOnlyNulls);
5212
+ }
5213
+ if (typeof value === "object" && value !== undefined) {
5214
+ const values = Object.values(value);
5215
+ return values.length > 0 && values.every(carriesOnlyNulls);
5216
+ }
5217
+ return false;
5218
+ }
5219
+ function nameList(names, cap2 = 12) {
5220
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
5221
+ const rest = names.length - shown.length;
5222
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
5223
+ }
5224
+ function buildFilterWarning(filter, data, outcome) {
5225
+ const present = availableFields(data);
5226
+ const refs = referencedFields(filter);
5227
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
5228
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
5229
+ const count = countRecords(data);
5230
+ const scope = `${count} record(s)`;
5231
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
5232
+ 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" : "";
5233
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
5234
+ let detail;
5235
+ let lede;
5236
+ if (outcome.kind === "null-elements") {
5237
+ lede = "returned only null values";
5238
+ const projected = `all ${outcome.count} of the elements it projected are null`;
5239
+ if (unknown.length > 0) {
5240
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5241
+ } else if (unchecked.length > 0) {
5242
+ detail = withSoundness(projected);
5243
+ } else {
5244
+ 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`;
5245
+ }
5246
+ } else if (outcome.kind === "null-rows") {
5247
+ lede = "returned only null values";
5248
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
5249
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
5250
+ } else if (outcome.kind === "null-values") {
5251
+ lede = "returned only null values";
5252
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
5253
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
5254
+ if (sameSet) {
5255
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
5256
+ } else if (unknown.length > 0) {
5257
+ detail = `${projected}, because ${isNotAField(unknown)}`;
5258
+ } else {
5259
+ detail = withSoundness(`${projected} on all ${scope}`);
5260
+ }
5261
+ } else {
5262
+ lede = "returned nothing";
5263
+ if (unknown.length > 0) {
5264
+ detail = isNotAField(unknown);
5265
+ } else {
5266
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
5267
+ detail = withSoundness(`${selection} — it read ${scope}`);
5268
+ }
5269
+ }
5270
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
5271
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
5272
+ }
5273
+ function appendWarning(existing, note) {
5274
+ return existing ? `${existing} ${note}` : note;
5275
+ }
5276
+ function applyFilter(data, filter, onWarning) {
5119
5277
  const codec = requireJmespath();
5120
5278
  let result;
5121
5279
  try {
@@ -5123,9 +5281,34 @@ function applyFilter(data, filter) {
5123
5281
  } catch (err) {
5124
5282
  throw new FilterEvaluationError(filter, err);
5125
5283
  }
5126
- if (result == null)
5284
+ const inputCount = countRecords(data);
5285
+ const warn = (outcome) => {
5286
+ if (inputCount === 0)
5287
+ return;
5288
+ const note = buildFilterWarning(filter, data, outcome);
5289
+ getOutputSink().writeErr(`[WARN] ${note}
5290
+ `);
5291
+ onWarning?.(note);
5292
+ };
5293
+ const warnIfAllNull = (records) => {
5294
+ const keys = alwaysNullKeys(records);
5295
+ if (keys.length > 0)
5296
+ warn({ kind: "null-values", keys });
5297
+ };
5298
+ if (result == null) {
5299
+ warn({ kind: "empty" });
5127
5300
  return [];
5301
+ }
5128
5302
  if (Array.isArray(result)) {
5303
+ if (result.length === 0) {
5304
+ warn({ kind: "empty" });
5305
+ } else if (result.every((entry) => entry === null)) {
5306
+ warn({ kind: "null-elements", count: result.length });
5307
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
5308
+ warn({ kind: "null-rows", count: result.length });
5309
+ } else {
5310
+ warnIfAllNull(result);
5311
+ }
5129
5312
  if (result.length > 0 && typeof result[0] !== "object") {
5130
5313
  const fieldMatch = filter.match(/\.(\w+)$/);
5131
5314
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -5133,10 +5316,30 @@ function applyFilter(data, filter) {
5133
5316
  }
5134
5317
  return result;
5135
5318
  }
5136
- if (typeof result === "object")
5319
+ if (typeof result === "object") {
5320
+ warnIfAllNull([result]);
5137
5321
  return result;
5322
+ }
5138
5323
  return { Value: result };
5139
5324
  }
5325
+ function filterFailureData(envelope) {
5326
+ const filter = getOutputFilter();
5327
+ const data = envelope.Data;
5328
+ if (!filter || data == null)
5329
+ return;
5330
+ let note;
5331
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
5332
+ note = n;
5333
+ }));
5334
+ if (filterError) {
5335
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
5336
+ return;
5337
+ }
5338
+ envelope.Data = filtered;
5339
+ if (note) {
5340
+ envelope.Warning = appendWarning(envelope.Warning, note);
5341
+ }
5342
+ }
5140
5343
  function defaultErrorCodeForResult(result) {
5141
5344
  switch (result) {
5142
5345
  case RESULTS.AuthenticationError:
@@ -5219,8 +5422,14 @@ var OutputFormatter;
5219
5422
  }
5220
5423
  const filter = getOutputFilter();
5221
5424
  if (filter) {
5222
- const filtered = applyFilter(data.Data, filter);
5425
+ let note;
5426
+ const filtered = applyFilter(data.Data, filter, (n) => {
5427
+ note = n;
5428
+ });
5223
5429
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
5430
+ if (note) {
5431
+ data.Warning = appendWarning(data.Warning, note);
5432
+ }
5224
5433
  }
5225
5434
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
5226
5435
  }
@@ -5248,6 +5457,7 @@ var OutputFormatter;
5248
5457
  delete envelope.TelemetryErrorClass;
5249
5458
  delete envelope.TelemetryTerminalOutcome;
5250
5459
  delete envelope.TelemetryTerminalSignal;
5460
+ filterFailureData(envelope);
5251
5461
  if (!suppressTelemetry) {
5252
5462
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
5253
5463
  result: data.Result,
@@ -5296,13 +5506,20 @@ var OutputFormatter;
5296
5506
  OutputFormatter.log = log;
5297
5507
  function formatToString(data) {
5298
5508
  const filter = getOutputFilter();
5509
+ const envelope = data;
5299
5510
  if ("Data" in data && data.Data != null) {
5300
5511
  data.Data = normalizeDataKeys(data.Data);
5301
5512
  if (filter) {
5302
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
5513
+ let note;
5514
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
5515
+ note = n;
5516
+ }));
5517
+ if (note) {
5518
+ envelope.Warning = appendWarning(envelope.Warning, note);
5519
+ }
5303
5520
  }
5304
5521
  }
5305
- const output = normalizeOutputKeys(data);
5522
+ const output = normalizeOutputKeys(envelope);
5306
5523
  const lines = [];
5307
5524
  const sink = getOutputSink();
5308
5525
  printOutput(output, getOutputFormat(), (msg) => {
@@ -7352,4 +7569,4 @@ var TENANT_SELECTION_CODES = new Set([
7352
7569
  ]);
7353
7570
  export { catchError, extractErrorMessage, RESULTS, Pagination, OutputFormatter, Command, processContext, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, getAuthContext };
7354
7571
 
7355
- //# debugId=35F0ED7278AEFC7264756E2164756E21
7572
+ //# debugId=4AC062CC9EFBD19D64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-8ajx677h.js";
5
- import"./tool-q9tp0v6c.js";
4
+ } from "./tool-3vn511td.js";
5
+ import"./tool-rqdmfvjs.js";
6
6
  import"./tool-1de529jm.js";
7
7
  export {
8
8
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/eval-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 runtime evaluations, evaluators, eval sets, evaluations, and schedules.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "4788b04c17a4429e5a994af2c3eba3898d1c4b13"
30
+ "gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
31
31
  }