@uipath/project-packager 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/browser.js CHANGED
@@ -25662,7 +25662,7 @@ var package_default = {
25662
25662
  name: "@uipath/project-packager",
25663
25663
  author: "UiPath",
25664
25664
  license: "SEE LICENSE IN LICENSE.txt",
25665
- version: "1.203.0-preview.233",
25665
+ version: "1.203.0-preview.237",
25666
25666
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
25667
25667
  type: "module",
25668
25668
  main: "./dist/index.js",
@@ -26643,4 +26643,4 @@ export {
26643
26643
  createBrowserProjectPackager
26644
26644
  };
26645
26645
 
26646
- //# debugId=A022AA9EB873D69C64756E2164756E21
26646
+ //# debugId=3FEB568D4484FDB964756E2164756E21
package/dist/index.js CHANGED
@@ -25901,7 +25901,7 @@ var package_default = {
25901
25901
  name: "@uipath/project-packager",
25902
25902
  author: "UiPath",
25903
25903
  license: "SEE LICENSE IN LICENSE.txt",
25904
- version: "1.203.0-preview.233",
25904
+ version: "1.203.0-preview.237",
25905
25905
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
25906
25906
  type: "module",
25907
25907
  main: "./dist/index.js",
@@ -27249,4 +27249,4 @@ export {
27249
27249
  signNupkgsAsync
27250
27250
  };
27251
27251
 
27252
- //# debugId=CC299E37F17843CA64756E2164756E21
27252
+ //# debugId=D495419468886B4A64756E2164756E21
package/dist/node.js CHANGED
@@ -11317,7 +11317,165 @@ class FilterImplicitLimitError extends Error {
11317
11317
  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).";
11318
11318
  }
11319
11319
  }
11320
- function applyFilter(data, filter) {
11320
+ function countRecords(data) {
11321
+ if (Array.isArray(data))
11322
+ return data.length;
11323
+ return data == null ? 0 : 1;
11324
+ }
11325
+ function availableFields(data) {
11326
+ const records = Array.isArray(data) ? data : [data];
11327
+ const keys = new Set;
11328
+ for (const record of records) {
11329
+ if (record && typeof record === "object" && !Array.isArray(record)) {
11330
+ for (const key of Object.keys(record))
11331
+ keys.add(key);
11332
+ }
11333
+ }
11334
+ return [...keys];
11335
+ }
11336
+ function decodeQuotedIdentifier(whole, inner) {
11337
+ const [error, decoded] = catchError(() => JSON.parse(whole));
11338
+ if (!error && typeof decoded === "string")
11339
+ return decoded;
11340
+ return inner.replace(/\\(.)/g, "$1");
11341
+ }
11342
+ function referencedFields(filter) {
11343
+ const top = new Set;
11344
+ const nested = new Set;
11345
+ const withoutValueLiterals = filter.replace(/'(?:\\.|[^'\\])*'/g, " ").replace(/`(?:\\.|[^`\\])*`/g, " ");
11346
+ const isPathTail = (text, index) => text[index - 1] === "." && /[A-Za-z0-9_"]/.test(text[index - 2] ?? "");
11347
+ const quoted = [];
11348
+ const withoutLiterals = withoutValueLiterals.replace(/"((?:\\.|[^"\\])*)"/g, (whole, name, index) => {
11349
+ const isAlias = /^\s*:/.test(withoutValueLiterals.slice(index + whole.length));
11350
+ if (!isAlias) {
11351
+ quoted.push({
11352
+ name: decodeQuotedIdentifier(whole, name),
11353
+ index,
11354
+ tail: isPathTail(withoutValueLiterals, index)
11355
+ });
11356
+ }
11357
+ return `"${" ".repeat(whole.length - 2)}"`;
11358
+ });
11359
+ const descent = /[A-Za-z0-9_"]\s*[.[]/.exec(withoutLiterals);
11360
+ const rootEnd = descent ? descent.index + 1 : Number.POSITIVE_INFINITY;
11361
+ const place = (name, index, tail) => {
11362
+ if (tail || index >= rootEnd)
11363
+ nested.add(name);
11364
+ else
11365
+ top.add(name);
11366
+ };
11367
+ for (const entry of quoted)
11368
+ place(entry.name, entry.index, entry.tail);
11369
+ const identifiers = withoutLiterals.matchAll(/([A-Za-z_][A-Za-z0-9_]*)(\s*[:(])?/g);
11370
+ const reserved = new Set(["true", "false", "null", "and", "or", "not"]);
11371
+ for (const match of identifiers) {
11372
+ const [, name, trailing] = match;
11373
+ if (trailing || reserved.has(name))
11374
+ continue;
11375
+ place(name, match.index, isPathTail(withoutLiterals, match.index));
11376
+ }
11377
+ return {
11378
+ top: [...top],
11379
+ nested: [...nested].filter((name) => !top.has(name)),
11380
+ hasPredicate: /\[\s*\?/.test(withoutValueLiterals)
11381
+ };
11382
+ }
11383
+ function appearsBelowTopLevel(data, name) {
11384
+ let budget = 2000;
11385
+ const visit = (value, depth) => {
11386
+ if (budget-- <= 0 || depth > 4)
11387
+ return false;
11388
+ if (value === null || typeof value !== "object")
11389
+ return false;
11390
+ if (Array.isArray(value))
11391
+ return value.some((entry) => visit(entry, depth));
11392
+ const record = value;
11393
+ if (depth > 0 && Object.hasOwn(record, name))
11394
+ return true;
11395
+ return Object.values(record).some((entry) => visit(entry, depth + 1));
11396
+ };
11397
+ return visit(data, 0);
11398
+ }
11399
+ function alwaysNullKeys(records) {
11400
+ const objects = records.filter((r) => r != null && typeof r === "object" && !Array.isArray(r));
11401
+ if (objects.length === 0 || objects.length !== records.length)
11402
+ return [];
11403
+ const keys = [...new Set(objects.flatMap((o) => Object.keys(o)))];
11404
+ if (keys.length === 0)
11405
+ return [];
11406
+ const nullKeys = keys.filter((key) => objects.every((record) => record[key] === null));
11407
+ return nullKeys.length === keys.length ? nullKeys : [];
11408
+ }
11409
+ function carriesOnlyNulls(value) {
11410
+ if (value === null)
11411
+ return true;
11412
+ if (Array.isArray(value)) {
11413
+ return value.length > 0 && value.every(carriesOnlyNulls);
11414
+ }
11415
+ if (typeof value === "object" && value !== undefined) {
11416
+ const values = Object.values(value);
11417
+ return values.length > 0 && values.every(carriesOnlyNulls);
11418
+ }
11419
+ return false;
11420
+ }
11421
+ function nameList(names, cap2 = 12) {
11422
+ const shown = names.slice(0, cap2).map((n) => `\`${n}\``);
11423
+ const rest = names.length - shown.length;
11424
+ return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
11425
+ }
11426
+ function buildFilterWarning(filter, data, outcome) {
11427
+ const present = availableFields(data);
11428
+ const refs = referencedFields(filter);
11429
+ const unknown = refs.top.filter((name) => !present.includes(name) && !appearsBelowTopLevel(data, name));
11430
+ const unchecked = refs.nested.filter((name) => !present.includes(name));
11431
+ const count = countRecords(data);
11432
+ const scope = `${count} record(s)`;
11433
+ const isNotAField = (names) => `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
11434
+ 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" : "";
11435
+ const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
11436
+ let detail;
11437
+ let lede;
11438
+ if (outcome.kind === "null-elements") {
11439
+ lede = "returned only null values";
11440
+ const projected = `all ${outcome.count} of the elements it projected are null`;
11441
+ if (unknown.length > 0) {
11442
+ detail = `${projected}, because ${isNotAField(unknown)}`;
11443
+ } else if (unchecked.length > 0) {
11444
+ detail = withSoundness(projected);
11445
+ } else {
11446
+ 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`;
11447
+ }
11448
+ } else if (outcome.kind === "null-rows") {
11449
+ lede = "returned only null values";
11450
+ const projected = `every value it projected is null on all ${outcome.count} row(s)`;
11451
+ detail = unknown.length > 0 ? `${projected}, because ${isNotAField(unknown)}` : withSoundness(projected);
11452
+ } else if (outcome.kind === "null-values") {
11453
+ lede = "returned only null values";
11454
+ const projected = `every key it projected (${nameList(outcome.keys)}) is null`;
11455
+ const sameSet = unknown.length === outcome.keys.length && outcome.keys.every((k) => unknown.includes(k));
11456
+ if (sameSet) {
11457
+ detail = `${isNotAField(outcome.keys)}, so every key it projected is null`;
11458
+ } else if (unknown.length > 0) {
11459
+ detail = `${projected}, because ${isNotAField(unknown)}`;
11460
+ } else {
11461
+ detail = withSoundness(`${projected} on all ${scope}`);
11462
+ }
11463
+ } else {
11464
+ lede = "returned nothing";
11465
+ if (unknown.length > 0) {
11466
+ detail = isNotAField(unknown);
11467
+ } else {
11468
+ const selection = refs.hasPredicate ? "no record matched" : "the expression resolved to no value";
11469
+ detail = withSoundness(`${selection} — it read ${scope}`);
11470
+ }
11471
+ }
11472
+ const fields = present.length > 0 ? ` Available fields: ${nameList(present)}.` : "";
11473
+ return `--output-filter ${JSON.stringify(filter)} ${lede}: ${detail}.${fields}`;
11474
+ }
11475
+ function appendWarning(existing, note) {
11476
+ return existing ? `${existing} ${note}` : note;
11477
+ }
11478
+ function applyFilter(data, filter, onWarning) {
11321
11479
  const codec = requireJmespath();
11322
11480
  let result;
11323
11481
  try {
@@ -11325,9 +11483,34 @@ function applyFilter(data, filter) {
11325
11483
  } catch (err) {
11326
11484
  throw new FilterEvaluationError(filter, err);
11327
11485
  }
11328
- if (result == null)
11486
+ const inputCount = countRecords(data);
11487
+ const warn = (outcome) => {
11488
+ if (inputCount === 0)
11489
+ return;
11490
+ const note = buildFilterWarning(filter, data, outcome);
11491
+ getOutputSink().writeErr(`[WARN] ${note}
11492
+ `);
11493
+ onWarning?.(note);
11494
+ };
11495
+ const warnIfAllNull = (records) => {
11496
+ const keys = alwaysNullKeys(records);
11497
+ if (keys.length > 0)
11498
+ warn({ kind: "null-values", keys });
11499
+ };
11500
+ if (result == null) {
11501
+ warn({ kind: "empty" });
11329
11502
  return [];
11503
+ }
11330
11504
  if (Array.isArray(result)) {
11505
+ if (result.length === 0) {
11506
+ warn({ kind: "empty" });
11507
+ } else if (result.every((entry) => entry === null)) {
11508
+ warn({ kind: "null-elements", count: result.length });
11509
+ } else if (result.every((entry) => Array.isArray(entry)) && carriesOnlyNulls(result)) {
11510
+ warn({ kind: "null-rows", count: result.length });
11511
+ } else {
11512
+ warnIfAllNull(result);
11513
+ }
11331
11514
  if (result.length > 0 && typeof result[0] !== "object") {
11332
11515
  const fieldMatch = filter.match(/\.(\w+)$/);
11333
11516
  const key = fieldMatch ? fieldMatch[1] : "Value";
@@ -11335,10 +11518,30 @@ function applyFilter(data, filter) {
11335
11518
  }
11336
11519
  return result;
11337
11520
  }
11338
- if (typeof result === "object")
11521
+ if (typeof result === "object") {
11522
+ warnIfAllNull([result]);
11339
11523
  return result;
11524
+ }
11340
11525
  return { Value: result };
11341
11526
  }
11527
+ function filterFailureData(envelope) {
11528
+ const filter = getOutputFilter();
11529
+ const data = envelope.Data;
11530
+ if (!filter || data == null)
11531
+ return;
11532
+ let note;
11533
+ const [filterError, filtered] = catchError(() => applyFilter(data, filter, (n) => {
11534
+ note = n;
11535
+ }));
11536
+ if (filterError) {
11537
+ envelope.Warning = appendWarning(envelope.Warning, `--output-filter was not applied, so Data is shown in full: ${filterError.message}`);
11538
+ return;
11539
+ }
11540
+ envelope.Data = filtered;
11541
+ if (note) {
11542
+ envelope.Warning = appendWarning(envelope.Warning, note);
11543
+ }
11544
+ }
11342
11545
  function defaultErrorCodeForResult(result) {
11343
11546
  switch (result) {
11344
11547
  case RESULTS.AuthenticationError:
@@ -11421,8 +11624,14 @@ var OutputFormatter;
11421
11624
  }
11422
11625
  const filter = getOutputFilter();
11423
11626
  if (filter) {
11424
- const filtered = applyFilter(data.Data, filter);
11627
+ let note;
11628
+ const filtered = applyFilter(data.Data, filter, (n) => {
11629
+ note = n;
11630
+ });
11425
11631
  data.Data = normalize ? normalizeDataKeys(filtered, verbatim, subtrees && { refs: subtrees.refs, mode: "skip" }) : filtered;
11632
+ if (note) {
11633
+ data.Warning = appendWarning(data.Warning, note);
11634
+ }
11426
11635
  }
11427
11636
  logOutput(normalizeOutputKeys(data), getOutputFormat(), options?.tableRowStyle);
11428
11637
  }
@@ -11450,6 +11659,7 @@ var OutputFormatter;
11450
11659
  delete envelope.TelemetryErrorClass;
11451
11660
  delete envelope.TelemetryTerminalOutcome;
11452
11661
  delete envelope.TelemetryTerminalSignal;
11662
+ filterFailureData(envelope);
11453
11663
  if (!suppressTelemetry) {
11454
11664
  telemetry.trackEvent(CommonTelemetryEvents.Error, {
11455
11665
  result: data.Result,
@@ -11498,13 +11708,20 @@ var OutputFormatter;
11498
11708
  OutputFormatter2.log = log;
11499
11709
  function formatToString(data) {
11500
11710
  const filter = getOutputFilter();
11711
+ const envelope = data;
11501
11712
  if ("Data" in data && data.Data != null) {
11502
11713
  data.Data = normalizeDataKeys(data.Data);
11503
11714
  if (filter) {
11504
- data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
11715
+ let note;
11716
+ data.Data = normalizeDataKeys(applyFilter(data.Data, filter, (n) => {
11717
+ note = n;
11718
+ }));
11719
+ if (note) {
11720
+ envelope.Warning = appendWarning(envelope.Warning, note);
11721
+ }
11505
11722
  }
11506
11723
  }
11507
- const output = normalizeOutputKeys(data);
11724
+ const output = normalizeOutputKeys(envelope);
11508
11725
  const lines = [];
11509
11726
  const sink = getOutputSink();
11510
11727
  printOutput(output, getOutputFormat(), (msg) => {
@@ -14093,7 +14310,7 @@ var package_default = {
14093
14310
  name: "@uipath/project-packager",
14094
14311
  author: "UiPath",
14095
14312
  license: "SEE LICENSE IN LICENSE.txt",
14096
- version: "1.203.0-preview.233",
14313
+ version: "1.203.0-preview.237",
14097
14314
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
14098
14315
  type: "module",
14099
14316
  main: "./dist/index.js",
@@ -15714,4 +15931,4 @@ export {
15714
15931
  signNupkgsAsync
15715
15932
  };
15716
15933
 
15717
- //# debugId=DC4A6AC40EACED1E64756E2164756E21
15934
+ //# debugId=AB4538EE9563529164756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/project-packager",
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": "UiPath Project Packager - core library for packing individual UiPath projects",
7
7
  "type": "module",
8
8
  "main": "./dist/index.js",
@@ -41,5 +41,5 @@
41
41
  "peerDependencies": {
42
42
  "fflate": "^0.8.2"
43
43
  },
44
- "gitHead": "641614a6f9817662baaf51dabdebbfa2a9334b1b"
44
+ "gitHead": "4ad3e17a66f2c7fb7fe1f0e3e04a5b6175a0a9a3"
45
45
  }