@uipath/codedapp-tool 1.202.2 → 1.203.0-preview.180

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.
@@ -2398,7 +2398,7 @@ var UUID_PATTERN = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{1
2398
2398
  var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
2399
2399
  var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
2400
2400
  var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
2401
- var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2401
+ var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2402
2402
  var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
2403
2403
  var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
2404
2404
  var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
@@ -2445,7 +2445,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
2445
2445
  `(?<![A-Za-z0-9])"(?:[^\\
2446
2446
  ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
2447
2447
  ].join("|"), "g");
2448
- var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
2448
+ var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
2449
2449
  var COLLAPSED_BODY = "{…}";
2450
2450
  var COLLAPSED_BODY_MARKER = "\x01body\x01";
2451
2451
  var MAX_BODY_NESTING = 8;
@@ -2460,10 +2460,13 @@ function collapseJsonBodies(text) {
2460
2460
  }
2461
2461
  return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
2462
2462
  }
2463
- var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
2463
+ var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
2464
2464
  function peelTrailingPunctuation(match) {
2465
- const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
2466
- return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
2465
+ let end = match.length;
2466
+ while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
2467
+ end -= 1;
2468
+ }
2469
+ return [match.slice(0, end), match.slice(end)];
2467
2470
  }
2468
2471
  function redactUrl(raw) {
2469
2472
  try {
@@ -2766,6 +2769,22 @@ function parseHttpStatusFromMessage(message) {
2766
2769
  const status = Number(match[1]);
2767
2770
  return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2768
2771
  }
2772
+ function findHttpStatusInGraph(error) {
2773
+ for (const node of walkErrorGraph(error)) {
2774
+ const response = node.response;
2775
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
2776
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2777
+ return explicit;
2778
+ }
2779
+ if (typeof node.message === "string") {
2780
+ const parsed = parseHttpStatusFromMessage(node.message);
2781
+ if (parsed !== undefined && parsed >= 400) {
2782
+ return parsed;
2783
+ }
2784
+ }
2785
+ }
2786
+ return;
2787
+ }
2769
2788
  function isHtmlDocument(body) {
2770
2789
  return /^\s*(<!doctype html|<html\b)/i.test(body);
2771
2790
  }
@@ -2879,7 +2898,8 @@ async function extractErrorDetails(error, options) {
2879
2898
  }
2880
2899
  let message;
2881
2900
  let result = "Failure";
2882
- const classification = classifyError(status, error);
2901
+ const classificationStatus = status ?? findHttpStatusInGraph(error);
2902
+ const classification = classifyError(classificationStatus, error);
2883
2903
  let retry = classification.retry;
2884
2904
  if (status === 401) {
2885
2905
  message = DEFAULT_401;
@@ -2955,8 +2975,8 @@ async function extractErrorDetails(error, options) {
2955
2975
  details = describeThrownValue(error);
2956
2976
  }
2957
2977
  const context = {};
2958
- if (status) {
2959
- context.httpStatus = status;
2978
+ if (classificationStatus) {
2979
+ context.httpStatus = classificationStatus;
2960
2980
  }
2961
2981
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
2962
2982
  context.errorCode = parsedBody.errorCode;
@@ -3519,7 +3539,8 @@ function readRegistryValue(keyPath, valueName) {
3519
3539
  }
3520
3540
  const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3521
3541
  encoding: "utf-8",
3522
- stdio: ["pipe", "pipe", "pipe"]
3542
+ stdio: ["pipe", "pipe", "pipe"],
3543
+ windowsHide: true
3523
3544
  }));
3524
3545
  if (error) {
3525
3546
  return "";
@@ -4201,28 +4222,32 @@ function isPlainRecord(value) {
4201
4222
  const prototype = Object.getPrototypeOf(value);
4202
4223
  return prototype === Object.prototype || prototype === null;
4203
4224
  }
4204
- function extractPagedRows(value) {
4225
+ function splitPagedEnvelope(value) {
4205
4226
  if (Array.isArray(value) || !isPlainRecord(value))
4206
4227
  return null;
4207
- const entries = Object.values(value);
4228
+ const entries = Object.entries(value);
4208
4229
  if (entries.length === 0)
4209
4230
  return null;
4210
- let rows = null;
4211
- let hasScalarSibling = false;
4212
- for (const entry of entries) {
4231
+ let found = null;
4232
+ const meta = Object.create(null);
4233
+ for (const [key, entry] of entries) {
4213
4234
  if (Array.isArray(entry)) {
4214
- if (rows !== null)
4235
+ if (found !== null)
4215
4236
  return null;
4216
- rows = entry;
4237
+ found = { key, rows: entry };
4217
4238
  } else if (entry !== null && typeof entry === "object") {
4218
4239
  return null;
4219
4240
  } else {
4220
- hasScalarSibling = true;
4241
+ meta[key] = entry;
4221
4242
  }
4222
4243
  }
4223
- if (rows === null || !hasScalarSibling)
4244
+ if (found === null || Object.keys(meta).length === 0)
4224
4245
  return null;
4225
- return rows;
4246
+ return { ...found, meta };
4247
+ }
4248
+ function extractPagedRows(value) {
4249
+ const paged = splitPagedEnvelope(value);
4250
+ return paged === null ? null : paged.rows;
4226
4251
  }
4227
4252
  function toLowerCamelCaseKey(key) {
4228
4253
  if (!key)
@@ -4326,6 +4351,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
4326
4351
  }
4327
4352
  break;
4328
4353
  }
4354
+ case "markdown":
4355
+ logFn(renderMarkdown(data));
4356
+ break;
4329
4357
  default: {
4330
4358
  const hasData = "Data" in data && data.Data != null;
4331
4359
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
@@ -4350,6 +4378,10 @@ function logOutput(data, format = "json", tableRowStyle) {
4350
4378
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
4351
4379
  `), needsAsciiSafeJson(sink), styleFn);
4352
4380
  }
4381
+ var PLUMBING_KEYS = new Set(["code", "log"]);
4382
+ function isPlumbingKey(key) {
4383
+ return PLUMBING_KEYS.has(key.toLowerCase());
4384
+ }
4353
4385
  function cellToString(val) {
4354
4386
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
4355
4387
  }
@@ -4365,7 +4397,7 @@ function wrapText(text, width) {
4365
4397
  function printTable(data, logFn, externalLogValue, tableRowStyle) {
4366
4398
  if (data.length === 0)
4367
4399
  return;
4368
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4400
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4369
4401
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
4370
4402
  const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
4371
4403
  logFn(header);
@@ -4387,7 +4419,7 @@ function isNonEmptyPlainObject(value) {
4387
4419
  }
4388
4420
  var NESTED_INDENT = " ";
4389
4421
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
4390
- const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4422
+ const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
4391
4423
  if (keys.length === 0)
4392
4424
  return;
4393
4425
  const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
@@ -4418,7 +4450,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
4418
4450
  function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
4419
4451
  if (data.length === 0)
4420
4452
  return;
4421
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4453
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4422
4454
  if (keys.length === 0)
4423
4455
  return;
4424
4456
  if (!process.stdout.isTTY) {
@@ -4492,6 +4524,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4492
4524
  logFn(`Log: ${externalLogValue}`);
4493
4525
  }
4494
4526
  }
4527
+ var MARKDOWN_MAX_CELL = 200;
4528
+ var MARKDOWN_MAX_DEPTH = 3;
4529
+ function markdownHeading(depth) {
4530
+ return "#".repeat(Math.min(3 + depth, 6));
4531
+ }
4532
+ var BACKTICK_RUN = /`+/g;
4533
+ function fencedBlock(text) {
4534
+ const first = text.trimStart()[0];
4535
+ const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
4536
+ const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
4537
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
4538
+ return `${fence}${language}
4539
+ ${text}
4540
+ ${fence}`;
4541
+ }
4542
+ function collapseNewlineRuns(text) {
4543
+ return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
4544
+ `) ? " " : part).join("");
4545
+ }
4546
+ function markdownCell(value) {
4547
+ const text = value instanceof Date ? value.toISOString() : cellToString(value);
4548
+ return collapseNewlineRuns(text).replace(/\|/g, "\\|");
4549
+ }
4550
+ function markdownLabel(key) {
4551
+ return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
4552
+ }
4553
+ function withoutPlumbing(record) {
4554
+ const kept = Object.create(null);
4555
+ for (const [key, value] of Object.entries(record)) {
4556
+ if (!isPlumbingKey(key))
4557
+ kept[key] = value;
4558
+ }
4559
+ return kept;
4560
+ }
4561
+ function rowsWithoutPlumbing(rows) {
4562
+ return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
4563
+ }
4564
+ function markdownTable(rows) {
4565
+ const columns = [];
4566
+ const seen = new Set;
4567
+ for (const row of rows) {
4568
+ for (const key of Object.keys(row)) {
4569
+ if (!seen.has(key)) {
4570
+ seen.add(key);
4571
+ columns.push(key);
4572
+ }
4573
+ }
4574
+ }
4575
+ if (columns.length === 0)
4576
+ return null;
4577
+ const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
4578
+ if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
4579
+ return null;
4580
+ }
4581
+ return [
4582
+ `| ${columns.map(markdownLabel).join(" | ")} |`,
4583
+ `| ${columns.map(() => "---").join(" | ")} |`,
4584
+ ...cells.map((row) => `| ${row.join(" | ")} |`)
4585
+ ].join(`
4586
+ `);
4587
+ }
4588
+ function extractMessageSequence(rows) {
4589
+ const messages = [];
4590
+ for (const row of rows) {
4591
+ const message = extractSingleMessage(row);
4592
+ if (message === null)
4593
+ return null;
4594
+ messages.push(message);
4595
+ }
4596
+ return messages.join(`
4597
+
4598
+ `);
4599
+ }
4600
+ function markdownRows(rows, depth) {
4601
+ if (rows.length === 0)
4602
+ return "(none)";
4603
+ if (!isPlainObjectArray(rows)) {
4604
+ return rows.map((item) => `- ${markdownCell(item)}`).join(`
4605
+ `);
4606
+ }
4607
+ const prose = extractMessageSequence(rows);
4608
+ if (prose !== null)
4609
+ return prose;
4610
+ const table = markdownTable(rows);
4611
+ if (table !== null)
4612
+ return table;
4613
+ if (depth >= MARKDOWN_MAX_DEPTH) {
4614
+ return fencedBlock(JSON.stringify(rows, null, 2));
4615
+ }
4616
+ return rows.map((row, index) => [
4617
+ `${markdownHeading(depth)} ${index + 1}`,
4618
+ markdownObject(row, depth + 1)
4619
+ ].join(`
4620
+
4621
+ `)).join(`
4622
+
4623
+ `);
4624
+ }
4625
+ function markdownObject(obj, depth) {
4626
+ const scalars = [];
4627
+ const blocks = [];
4628
+ for (const [key, value] of Object.entries(obj)) {
4629
+ if (value === undefined)
4630
+ continue;
4631
+ const label = markdownLabel(key);
4632
+ if (Array.isArray(value)) {
4633
+ blocks.push(`${markdownHeading(depth)} ${label}
4634
+
4635
+ ${markdownRows(value, depth + 1)}`);
4636
+ } else if (isNonEmptyPlainObject(value)) {
4637
+ const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
4638
+ if (nested !== "") {
4639
+ blocks.push(`${markdownHeading(depth)} ${label}
4640
+
4641
+ ${nested}`);
4642
+ }
4643
+ } else if (typeof value === "string" && value.includes(`
4644
+ `)) {
4645
+ blocks.push(`**${label}:**
4646
+
4647
+ ${fencedBlock(value)}`);
4648
+ } else {
4649
+ scalars.push(`**${label}:** ${markdownCell(value)}`);
4650
+ }
4651
+ }
4652
+ const sections = scalars.length > 0 ? [scalars.join(`
4653
+ `)] : [];
4654
+ sections.push(...blocks);
4655
+ return sections.join(`
4656
+
4657
+ `);
4658
+ }
4659
+ function extractSingleMessage(payload) {
4660
+ if (!isPlainRecord(payload))
4661
+ return null;
4662
+ const keys = Object.keys(payload);
4663
+ if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
4664
+ return null;
4665
+ const value = payload[keys[0]];
4666
+ return typeof value === "string" ? value : null;
4667
+ }
4668
+ function markdownPayload(payload) {
4669
+ const message = extractSingleMessage(payload);
4670
+ if (message !== null)
4671
+ return message;
4672
+ if (Array.isArray(payload)) {
4673
+ return markdownRows(rowsWithoutPlumbing(payload), 0);
4674
+ }
4675
+ const visible = withoutPlumbing(payload);
4676
+ const paged = splitPagedEnvelope(visible);
4677
+ if (paged !== null) {
4678
+ const meta = markdownObject(paged.meta, 0);
4679
+ const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
4680
+
4681
+ ${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
4682
+ return meta === "" ? rows : `${meta}
4683
+
4684
+ ${rows}`;
4685
+ }
4686
+ return markdownObject(visible, 0);
4687
+ }
4688
+ function isPaginationWorthShowing(value) {
4689
+ if (typeof value !== "object" || value === null)
4690
+ return false;
4691
+ const page = value;
4692
+ return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
4693
+ }
4694
+ function markdownEnvelopeNotes(data) {
4695
+ const envelope = data;
4696
+ const notes = [];
4697
+ const warning = envelope.Warning;
4698
+ if (typeof warning === "string" && warning !== "") {
4699
+ notes.push(`> **Warning:** ${warning}`);
4700
+ }
4701
+ const instructions = envelope.Instructions;
4702
+ if (typeof instructions === "string" && instructions !== "") {
4703
+ notes.push(`> ${instructions}`);
4704
+ }
4705
+ const pagination = envelope.Pagination;
4706
+ if (isPaginationWorthShowing(pagination)) {
4707
+ const body = markdownObject(pagination, 1);
4708
+ if (body !== "") {
4709
+ notes.push(`${markdownHeading(0)} Pagination
4710
+
4711
+ ${body}`);
4712
+ }
4713
+ }
4714
+ const log = envelope.Log;
4715
+ if (typeof log === "string" && log !== "") {
4716
+ notes.push(`**Log:** ${log}`);
4717
+ }
4718
+ return notes;
4719
+ }
4720
+ function renderMarkdown(data) {
4721
+ if (data.Result !== RESULTS.Success) {
4722
+ const failure = data;
4723
+ const sections = [`**Failed:** ${failure.Message}`];
4724
+ if (failure.Data != null) {
4725
+ sections.push(markdownPayload(failure.Data));
4726
+ }
4727
+ if (failure.Instructions) {
4728
+ sections.push(`> ${failure.Instructions}`);
4729
+ }
4730
+ return sections.filter((section) => section !== "").join(`
4731
+
4732
+ `);
4733
+ }
4734
+ if (!("Data" in data) || data.Data == null) {
4735
+ return markdownObject(withoutPlumbing(data), 0);
4736
+ }
4737
+ return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
4738
+
4739
+ `);
4740
+ }
4495
4741
  function toYaml(data) {
4496
4742
  const codec = getYamlCodec();
4497
4743
  if (!codec) {
@@ -5948,6 +6194,6 @@ async function findSolutionFileUpward(fs, startDir) {
5948
6194
  }
5949
6195
  }
5950
6196
 
5951
- export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, RESULTS, EXIT_CODES, ConfigurationError, isConfigurationError, OutputFormatter, InvalidArgumentError, Command, Option, processContext, requireConfirmation, isGuid, canPrompt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, trackShipSucceeded, normalizeProjectType, tryRegisterProjectInParentSolution, findNearestParentUipxFile, findSolutionFileUpward };
6197
+ export { catchError, describeConnectivityError, extractErrorDetails, extractErrorMessage, getOutputSink, logger, RESULTS, EXIT_CODES, ConfigurationError, isConfigurationError, OutputFormatter, InvalidArgumentError, Command, Option, processContext, requireConfirmation, isGuid, canPrompt, registerPackageMetadataOptions, mapPackageMetadataOptions, getSdkUserAgentToken, addSdkUserAgentHeader, installSdkUserAgentHeader, trackShipSucceeded, normalizeProjectType, toPortableRelativePath, tryRegisterProjectInParentSolution, findNearestParentUipxFile, findSolutionFileUpward };
5952
6198
 
5953
- //# debugId=221D447EF9BC866A64756E2164756E21
6199
+ //# debugId=401ACF1EEAAA614364756E2164756E21