@uipath/pm-tool 1.202.0 → 1.203.0-preview.160

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-1cwdvx7c.js";
6
+ } from "./tool-2jy2c0j7.js";
7
7
  import"./tool-1de529jm.js";
8
8
 
9
9
  // src/index.ts
@@ -2099,8 +2099,9 @@ var require_commander = __commonJS(function(exports) {
2099
2099
  // package.json
2100
2100
  var package_default = {
2101
2101
  name: "@uipath/pm-tool",
2102
+ author: "UiPath",
2102
2103
  license: "SEE LICENSE IN LICENSE.txt",
2103
- version: "1.202.0",
2104
+ version: "1.203.0-preview.160",
2104
2105
  description: "Process Mining — process apps, transformations, and data ingestion.",
2105
2106
  private: false,
2106
2107
  repository: {
@@ -2654,7 +2655,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
2654
2655
  var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
2655
2656
  var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
2656
2657
  var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
2657
- var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2658
+ var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2658
2659
  var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
2659
2660
  var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
2660
2661
  var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
@@ -2701,7 +2702,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
2701
2702
  `(?<![A-Za-z0-9])"(?:[^\\
2702
2703
  ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
2703
2704
  ].join("|"), "g");
2704
- var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
2705
+ var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
2705
2706
  var COLLAPSED_BODY = "{…}";
2706
2707
  var COLLAPSED_BODY_MARKER = "\x01body\x01";
2707
2708
  var MAX_BODY_NESTING = 8;
@@ -2716,10 +2717,13 @@ function collapseJsonBodies(text) {
2716
2717
  }
2717
2718
  return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
2718
2719
  }
2719
- var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
2720
+ var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
2720
2721
  function peelTrailingPunctuation(match) {
2721
- const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
2722
- return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
2722
+ let end = match.length;
2723
+ while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
2724
+ end -= 1;
2725
+ }
2726
+ return [match.slice(0, end), match.slice(end)];
2723
2727
  }
2724
2728
  function redactUrl(raw) {
2725
2729
  try {
@@ -3421,7 +3425,8 @@ function readRegistryValue(keyPath, valueName) {
3421
3425
  }
3422
3426
  const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3423
3427
  encoding: "utf-8",
3424
- stdio: ["pipe", "pipe", "pipe"]
3428
+ stdio: ["pipe", "pipe", "pipe"],
3429
+ windowsHide: true
3425
3430
  }));
3426
3431
  if (error) {
3427
3432
  return "";
@@ -4103,28 +4108,32 @@ function isPlainRecord(value) {
4103
4108
  const prototype = Object.getPrototypeOf(value);
4104
4109
  return prototype === Object.prototype || prototype === null;
4105
4110
  }
4106
- function extractPagedRows(value) {
4111
+ function splitPagedEnvelope(value) {
4107
4112
  if (Array.isArray(value) || !isPlainRecord(value))
4108
4113
  return null;
4109
- const entries = Object.values(value);
4114
+ const entries = Object.entries(value);
4110
4115
  if (entries.length === 0)
4111
4116
  return null;
4112
- let rows = null;
4113
- let hasScalarSibling = false;
4114
- for (const entry of entries) {
4117
+ let found = null;
4118
+ const meta = Object.create(null);
4119
+ for (const [key, entry] of entries) {
4115
4120
  if (Array.isArray(entry)) {
4116
- if (rows !== null)
4121
+ if (found !== null)
4117
4122
  return null;
4118
- rows = entry;
4123
+ found = { key, rows: entry };
4119
4124
  } else if (entry !== null && typeof entry === "object") {
4120
4125
  return null;
4121
4126
  } else {
4122
- hasScalarSibling = true;
4127
+ meta[key] = entry;
4123
4128
  }
4124
4129
  }
4125
- if (rows === null || !hasScalarSibling)
4130
+ if (found === null || Object.keys(meta).length === 0)
4126
4131
  return null;
4127
- return rows;
4132
+ return { ...found, meta };
4133
+ }
4134
+ function extractPagedRows(value) {
4135
+ const paged = splitPagedEnvelope(value);
4136
+ return paged === null ? null : paged.rows;
4128
4137
  }
4129
4138
  function toLowerCamelCaseKey(key) {
4130
4139
  if (!key)
@@ -4228,6 +4237,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
4228
4237
  }
4229
4238
  break;
4230
4239
  }
4240
+ case "markdown":
4241
+ logFn(renderMarkdown(data));
4242
+ break;
4231
4243
  default: {
4232
4244
  const hasData = "Data" in data && data.Data != null;
4233
4245
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
@@ -4252,6 +4264,10 @@ function logOutput(data, format = "json", tableRowStyle) {
4252
4264
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
4253
4265
  `), needsAsciiSafeJson(sink), styleFn);
4254
4266
  }
4267
+ var PLUMBING_KEYS = new Set(["code", "log"]);
4268
+ function isPlumbingKey(key) {
4269
+ return PLUMBING_KEYS.has(key.toLowerCase());
4270
+ }
4255
4271
  function cellToString(val) {
4256
4272
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
4257
4273
  }
@@ -4267,7 +4283,7 @@ function wrapText(text, width) {
4267
4283
  function printTable(data, logFn, externalLogValue, tableRowStyle) {
4268
4284
  if (data.length === 0)
4269
4285
  return;
4270
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4286
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4271
4287
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
4272
4288
  const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
4273
4289
  logFn(header);
@@ -4289,7 +4305,7 @@ function isNonEmptyPlainObject(value) {
4289
4305
  }
4290
4306
  var NESTED_INDENT = " ";
4291
4307
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
4292
- const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4308
+ const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
4293
4309
  if (keys.length === 0)
4294
4310
  return;
4295
4311
  const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
@@ -4320,7 +4336,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
4320
4336
  function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
4321
4337
  if (data.length === 0)
4322
4338
  return;
4323
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4339
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4324
4340
  if (keys.length === 0)
4325
4341
  return;
4326
4342
  if (!process.stdout.isTTY) {
@@ -4394,6 +4410,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4394
4410
  logFn(`Log: ${externalLogValue}`);
4395
4411
  }
4396
4412
  }
4413
+ var MARKDOWN_MAX_CELL = 200;
4414
+ var MARKDOWN_MAX_DEPTH = 3;
4415
+ function markdownHeading(depth) {
4416
+ return "#".repeat(Math.min(3 + depth, 6));
4417
+ }
4418
+ var BACKTICK_RUN = /`+/g;
4419
+ function fencedBlock(text) {
4420
+ const first = text.trimStart()[0];
4421
+ const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
4422
+ const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
4423
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
4424
+ return `${fence}${language}
4425
+ ${text}
4426
+ ${fence}`;
4427
+ }
4428
+ function collapseNewlineRuns(text) {
4429
+ return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
4430
+ `) ? " " : part).join("");
4431
+ }
4432
+ function markdownCell(value) {
4433
+ const text = value instanceof Date ? value.toISOString() : cellToString(value);
4434
+ return collapseNewlineRuns(text).replace(/\|/g, "\\|");
4435
+ }
4436
+ function markdownLabel(key) {
4437
+ return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
4438
+ }
4439
+ function withoutPlumbing(record) {
4440
+ const kept = Object.create(null);
4441
+ for (const [key, value] of Object.entries(record)) {
4442
+ if (!isPlumbingKey(key))
4443
+ kept[key] = value;
4444
+ }
4445
+ return kept;
4446
+ }
4447
+ function rowsWithoutPlumbing(rows) {
4448
+ return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
4449
+ }
4450
+ function markdownTable(rows) {
4451
+ const columns = [];
4452
+ const seen = new Set;
4453
+ for (const row of rows) {
4454
+ for (const key of Object.keys(row)) {
4455
+ if (!seen.has(key)) {
4456
+ seen.add(key);
4457
+ columns.push(key);
4458
+ }
4459
+ }
4460
+ }
4461
+ if (columns.length === 0)
4462
+ return null;
4463
+ const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
4464
+ if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
4465
+ return null;
4466
+ }
4467
+ return [
4468
+ `| ${columns.map(markdownLabel).join(" | ")} |`,
4469
+ `| ${columns.map(() => "---").join(" | ")} |`,
4470
+ ...cells.map((row) => `| ${row.join(" | ")} |`)
4471
+ ].join(`
4472
+ `);
4473
+ }
4474
+ function extractMessageSequence(rows) {
4475
+ const messages = [];
4476
+ for (const row of rows) {
4477
+ const message = extractSingleMessage(row);
4478
+ if (message === null)
4479
+ return null;
4480
+ messages.push(message);
4481
+ }
4482
+ return messages.join(`
4483
+
4484
+ `);
4485
+ }
4486
+ function markdownRows(rows, depth) {
4487
+ if (rows.length === 0)
4488
+ return "(none)";
4489
+ if (!isPlainObjectArray(rows)) {
4490
+ return rows.map((item) => `- ${markdownCell(item)}`).join(`
4491
+ `);
4492
+ }
4493
+ const prose = extractMessageSequence(rows);
4494
+ if (prose !== null)
4495
+ return prose;
4496
+ const table = markdownTable(rows);
4497
+ if (table !== null)
4498
+ return table;
4499
+ if (depth >= MARKDOWN_MAX_DEPTH) {
4500
+ return fencedBlock(JSON.stringify(rows, null, 2));
4501
+ }
4502
+ return rows.map((row, index) => [
4503
+ `${markdownHeading(depth)} ${index + 1}`,
4504
+ markdownObject(row, depth + 1)
4505
+ ].join(`
4506
+
4507
+ `)).join(`
4508
+
4509
+ `);
4510
+ }
4511
+ function markdownObject(obj, depth) {
4512
+ const scalars = [];
4513
+ const blocks = [];
4514
+ for (const [key, value] of Object.entries(obj)) {
4515
+ if (value === undefined)
4516
+ continue;
4517
+ const label = markdownLabel(key);
4518
+ if (Array.isArray(value)) {
4519
+ blocks.push(`${markdownHeading(depth)} ${label}
4520
+
4521
+ ${markdownRows(value, depth + 1)}`);
4522
+ } else if (isNonEmptyPlainObject(value)) {
4523
+ const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
4524
+ if (nested !== "") {
4525
+ blocks.push(`${markdownHeading(depth)} ${label}
4526
+
4527
+ ${nested}`);
4528
+ }
4529
+ } else if (typeof value === "string" && value.includes(`
4530
+ `)) {
4531
+ blocks.push(`**${label}:**
4532
+
4533
+ ${fencedBlock(value)}`);
4534
+ } else {
4535
+ scalars.push(`**${label}:** ${markdownCell(value)}`);
4536
+ }
4537
+ }
4538
+ const sections = scalars.length > 0 ? [scalars.join(`
4539
+ `)] : [];
4540
+ sections.push(...blocks);
4541
+ return sections.join(`
4542
+
4543
+ `);
4544
+ }
4545
+ function extractSingleMessage(payload) {
4546
+ if (!isPlainRecord(payload))
4547
+ return null;
4548
+ const keys = Object.keys(payload);
4549
+ if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
4550
+ return null;
4551
+ const value = payload[keys[0]];
4552
+ return typeof value === "string" ? value : null;
4553
+ }
4554
+ function markdownPayload(payload) {
4555
+ const message = extractSingleMessage(payload);
4556
+ if (message !== null)
4557
+ return message;
4558
+ if (Array.isArray(payload)) {
4559
+ return markdownRows(rowsWithoutPlumbing(payload), 0);
4560
+ }
4561
+ const visible = withoutPlumbing(payload);
4562
+ const paged = splitPagedEnvelope(visible);
4563
+ if (paged !== null) {
4564
+ const meta = markdownObject(paged.meta, 0);
4565
+ const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
4566
+
4567
+ ${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
4568
+ return meta === "" ? rows : `${meta}
4569
+
4570
+ ${rows}`;
4571
+ }
4572
+ return markdownObject(visible, 0);
4573
+ }
4574
+ function isPaginationWorthShowing(value) {
4575
+ if (typeof value !== "object" || value === null)
4576
+ return false;
4577
+ const page = value;
4578
+ return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
4579
+ }
4580
+ function markdownEnvelopeNotes(data) {
4581
+ const envelope = data;
4582
+ const notes = [];
4583
+ const warning = envelope.Warning;
4584
+ if (typeof warning === "string" && warning !== "") {
4585
+ notes.push(`> **Warning:** ${warning}`);
4586
+ }
4587
+ const instructions = envelope.Instructions;
4588
+ if (typeof instructions === "string" && instructions !== "") {
4589
+ notes.push(`> ${instructions}`);
4590
+ }
4591
+ const pagination = envelope.Pagination;
4592
+ if (isPaginationWorthShowing(pagination)) {
4593
+ const body = markdownObject(pagination, 1);
4594
+ if (body !== "") {
4595
+ notes.push(`${markdownHeading(0)} Pagination
4596
+
4597
+ ${body}`);
4598
+ }
4599
+ }
4600
+ const log = envelope.Log;
4601
+ if (typeof log === "string" && log !== "") {
4602
+ notes.push(`**Log:** ${log}`);
4603
+ }
4604
+ return notes;
4605
+ }
4606
+ function renderMarkdown(data) {
4607
+ if (data.Result !== RESULTS.Success) {
4608
+ const failure = data;
4609
+ const sections = [`**Failed:** ${failure.Message}`];
4610
+ if (failure.Data != null) {
4611
+ sections.push(markdownPayload(failure.Data));
4612
+ }
4613
+ if (failure.Instructions) {
4614
+ sections.push(`> ${failure.Instructions}`);
4615
+ }
4616
+ return sections.filter((section) => section !== "").join(`
4617
+
4618
+ `);
4619
+ }
4620
+ if (!("Data" in data) || data.Data == null) {
4621
+ return markdownObject(withoutPlumbing(data), 0);
4622
+ }
4623
+ return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
4624
+
4625
+ `);
4626
+ }
4397
4627
  function toYaml(data) {
4398
4628
  const codec = getYamlCodec();
4399
4629
  if (!codec) {
@@ -6120,16 +6350,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
6120
6350
  errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
6121
6351
  };
6122
6352
  };
6123
- var loadEnvFileAsync = async ({ envPath }) => {
6124
- const fs2 = getFileSystem();
6125
- const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
6126
- if (!await fs2.exists(absolutePath)) {
6127
- throw new Error(`Environment file not found: ${envPath}`);
6128
- }
6129
- const content = await fs2.readFile(absolutePath, "utf-8");
6130
- if (content === null) {
6131
- throw new Error(`Environment file not found: ${envPath}`);
6132
- }
6353
+ var parseEnvContent = (content) => {
6133
6354
  const env = {};
6134
6355
  for (const line of content.split(`
6135
6356
  `)) {
@@ -6150,6 +6371,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
6150
6371
  }
6151
6372
  return env;
6152
6373
  };
6374
+ var loadEnvFileAsync = async ({ envPath }) => {
6375
+ const fs2 = getFileSystem();
6376
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
6377
+ if (!await fs2.exists(absolutePath)) {
6378
+ throw new Error(`Environment file not found: ${envPath}`);
6379
+ }
6380
+ const content = await fs2.readFile(absolutePath, "utf-8");
6381
+ if (content === null) {
6382
+ throw new Error(`Environment file not found: ${envPath}`);
6383
+ }
6384
+ return parseEnvContent(content);
6385
+ };
6153
6386
  var saveEnvFileAsync = async ({
6154
6387
  envPath,
6155
6388
  data,
@@ -9538,4 +9771,4 @@ var registerCommands = async (program2) => {
9538
9771
 
9539
9772
  export { Command, metadata, registerCommands };
9540
9773
 
9541
- //# debugId=4A3656693114ACC864756E2164756E21
9774
+ //# debugId=CBF51CC17E5C96EE64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-1cwdvx7c.js";
4
+ } from "./tool-2jy2c0j7.js";
5
5
  import"./tool-1de529jm.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@uipath/pm-tool",
3
+ "author": "UiPath",
3
4
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.0",
5
+ "version": "1.203.0-preview.160",
5
6
  "description": "Process Mining — process apps, transformations, and data ingestion.",
6
7
  "private": false,
7
8
  "repository": {
@@ -26,5 +27,5 @@
26
27
  "files": [
27
28
  "dist"
28
29
  ],
29
- "gitHead": "23b5a7038ead7264439af18f8b807c7cc99a29d5"
30
+ "gitHead": "3a42062ba731afca4595ba9aa8a80afc9667528d"
30
31
  }