@uipath/identity-commands 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.
Files changed (2) hide show
  1. package/dist/index.js +284 -34
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -2609,7 +2609,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
2609
2609
  var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
2610
2610
  var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
2611
2611
  var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
2612
- var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2612
+ var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
2613
2613
  var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
2614
2614
  var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
2615
2615
  var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
@@ -2656,7 +2656,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
2656
2656
  `(?<![A-Za-z0-9])"(?:[^\\
2657
2657
  ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
2658
2658
  ].join("|"), "g");
2659
- var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
2659
+ var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
2660
2660
  var COLLAPSED_BODY = "{…}";
2661
2661
  var COLLAPSED_BODY_MARKER = "\x01body\x01";
2662
2662
  var MAX_BODY_NESTING = 8;
@@ -2671,10 +2671,13 @@ function collapseJsonBodies(text) {
2671
2671
  }
2672
2672
  return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
2673
2673
  }
2674
- var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
2674
+ var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
2675
2675
  function peelTrailingPunctuation(match) {
2676
- const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
2677
- return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
2676
+ let end = match.length;
2677
+ while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
2678
+ end -= 1;
2679
+ }
2680
+ return [match.slice(0, end), match.slice(end)];
2678
2681
  }
2679
2682
  function redactUrl(raw) {
2680
2683
  try {
@@ -2977,6 +2980,22 @@ function parseHttpStatusFromMessage(message) {
2977
2980
  const status = Number(match[1]);
2978
2981
  return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
2979
2982
  }
2983
+ function findHttpStatusInGraph(error) {
2984
+ for (const node of walkErrorGraph(error)) {
2985
+ const response = node.response;
2986
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
2987
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
2988
+ return explicit;
2989
+ }
2990
+ if (typeof node.message === "string") {
2991
+ const parsed = parseHttpStatusFromMessage(node.message);
2992
+ if (parsed !== undefined && parsed >= 400) {
2993
+ return parsed;
2994
+ }
2995
+ }
2996
+ }
2997
+ return;
2998
+ }
2980
2999
  function isHtmlDocument(body) {
2981
3000
  return /^\s*(<!doctype html|<html\b)/i.test(body);
2982
3001
  }
@@ -3090,7 +3109,8 @@ async function extractErrorDetails(error, options) {
3090
3109
  }
3091
3110
  let message;
3092
3111
  let result = "Failure";
3093
- const classification = classifyError(status, error);
3112
+ const classificationStatus = status ?? findHttpStatusInGraph(error);
3113
+ const classification = classifyError(classificationStatus, error);
3094
3114
  let retry = classification.retry;
3095
3115
  if (status === 401) {
3096
3116
  message = DEFAULT_401;
@@ -3166,8 +3186,8 @@ async function extractErrorDetails(error, options) {
3166
3186
  details = describeThrownValue(error);
3167
3187
  }
3168
3188
  const context = {};
3169
- if (status) {
3170
- context.httpStatus = status;
3189
+ if (classificationStatus) {
3190
+ context.httpStatus = classificationStatus;
3171
3191
  }
3172
3192
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
3173
3193
  context.errorCode = parsedBody.errorCode;
@@ -3729,7 +3749,8 @@ function readRegistryValue(keyPath, valueName) {
3729
3749
  }
3730
3750
  const [error, output] = catchError(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
3731
3751
  encoding: "utf-8",
3732
- stdio: ["pipe", "pipe", "pipe"]
3752
+ stdio: ["pipe", "pipe", "pipe"],
3753
+ windowsHide: true
3733
3754
  }));
3734
3755
  if (error) {
3735
3756
  return "";
@@ -4411,28 +4432,32 @@ function isPlainRecord(value) {
4411
4432
  const prototype = Object.getPrototypeOf(value);
4412
4433
  return prototype === Object.prototype || prototype === null;
4413
4434
  }
4414
- function extractPagedRows(value) {
4435
+ function splitPagedEnvelope(value) {
4415
4436
  if (Array.isArray(value) || !isPlainRecord(value))
4416
4437
  return null;
4417
- const entries = Object.values(value);
4438
+ const entries = Object.entries(value);
4418
4439
  if (entries.length === 0)
4419
4440
  return null;
4420
- let rows = null;
4421
- let hasScalarSibling = false;
4422
- for (const entry of entries) {
4441
+ let found = null;
4442
+ const meta = Object.create(null);
4443
+ for (const [key, entry] of entries) {
4423
4444
  if (Array.isArray(entry)) {
4424
- if (rows !== null)
4445
+ if (found !== null)
4425
4446
  return null;
4426
- rows = entry;
4447
+ found = { key, rows: entry };
4427
4448
  } else if (entry !== null && typeof entry === "object") {
4428
4449
  return null;
4429
4450
  } else {
4430
- hasScalarSibling = true;
4451
+ meta[key] = entry;
4431
4452
  }
4432
4453
  }
4433
- if (rows === null || !hasScalarSibling)
4454
+ if (found === null || Object.keys(meta).length === 0)
4434
4455
  return null;
4435
- return rows;
4456
+ return { ...found, meta };
4457
+ }
4458
+ function extractPagedRows(value) {
4459
+ const paged = splitPagedEnvelope(value);
4460
+ return paged === null ? null : paged.rows;
4436
4461
  }
4437
4462
  function toLowerCamelCaseKey(key) {
4438
4463
  if (!key)
@@ -4536,6 +4561,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
4536
4561
  }
4537
4562
  break;
4538
4563
  }
4564
+ case "markdown":
4565
+ logFn(renderMarkdown(data));
4566
+ break;
4539
4567
  default: {
4540
4568
  const hasData = "Data" in data && data.Data != null;
4541
4569
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
@@ -4560,6 +4588,10 @@ function logOutput(data, format = "json", tableRowStyle) {
4560
4588
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
4561
4589
  `), needsAsciiSafeJson(sink), styleFn);
4562
4590
  }
4591
+ var PLUMBING_KEYS = new Set(["code", "log"]);
4592
+ function isPlumbingKey(key) {
4593
+ return PLUMBING_KEYS.has(key.toLowerCase());
4594
+ }
4563
4595
  function cellToString(val) {
4564
4596
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
4565
4597
  }
@@ -4575,7 +4607,7 @@ function wrapText(text, width) {
4575
4607
  function printTable(data, logFn, externalLogValue, tableRowStyle) {
4576
4608
  if (data.length === 0)
4577
4609
  return;
4578
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4610
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4579
4611
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
4580
4612
  const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
4581
4613
  logFn(header);
@@ -4597,7 +4629,7 @@ function isNonEmptyPlainObject(value) {
4597
4629
  }
4598
4630
  var NESTED_INDENT = " ";
4599
4631
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
4600
- const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4632
+ const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
4601
4633
  if (keys.length === 0)
4602
4634
  return;
4603
4635
  const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
@@ -4628,7 +4660,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
4628
4660
  function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
4629
4661
  if (data.length === 0)
4630
4662
  return;
4631
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
4663
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
4632
4664
  if (keys.length === 0)
4633
4665
  return;
4634
4666
  if (!process.stdout.isTTY) {
@@ -4702,6 +4734,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
4702
4734
  logFn(`Log: ${externalLogValue}`);
4703
4735
  }
4704
4736
  }
4737
+ var MARKDOWN_MAX_CELL = 200;
4738
+ var MARKDOWN_MAX_DEPTH = 3;
4739
+ function markdownHeading(depth) {
4740
+ return "#".repeat(Math.min(3 + depth, 6));
4741
+ }
4742
+ var BACKTICK_RUN = /`+/g;
4743
+ function fencedBlock(text) {
4744
+ const first = text.trimStart()[0];
4745
+ const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
4746
+ const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
4747
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
4748
+ return `${fence}${language}
4749
+ ${text}
4750
+ ${fence}`;
4751
+ }
4752
+ function collapseNewlineRuns(text) {
4753
+ return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
4754
+ `) ? " " : part).join("");
4755
+ }
4756
+ function markdownCell(value) {
4757
+ const text = value instanceof Date ? value.toISOString() : cellToString(value);
4758
+ return collapseNewlineRuns(text).replace(/\|/g, "\\|");
4759
+ }
4760
+ function markdownLabel(key) {
4761
+ return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
4762
+ }
4763
+ function withoutPlumbing(record) {
4764
+ const kept = Object.create(null);
4765
+ for (const [key, value] of Object.entries(record)) {
4766
+ if (!isPlumbingKey(key))
4767
+ kept[key] = value;
4768
+ }
4769
+ return kept;
4770
+ }
4771
+ function rowsWithoutPlumbing(rows) {
4772
+ return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
4773
+ }
4774
+ function markdownTable(rows) {
4775
+ const columns = [];
4776
+ const seen = new Set;
4777
+ for (const row of rows) {
4778
+ for (const key of Object.keys(row)) {
4779
+ if (!seen.has(key)) {
4780
+ seen.add(key);
4781
+ columns.push(key);
4782
+ }
4783
+ }
4784
+ }
4785
+ if (columns.length === 0)
4786
+ return null;
4787
+ const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
4788
+ if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
4789
+ return null;
4790
+ }
4791
+ return [
4792
+ `| ${columns.map(markdownLabel).join(" | ")} |`,
4793
+ `| ${columns.map(() => "---").join(" | ")} |`,
4794
+ ...cells.map((row) => `| ${row.join(" | ")} |`)
4795
+ ].join(`
4796
+ `);
4797
+ }
4798
+ function extractMessageSequence(rows) {
4799
+ const messages = [];
4800
+ for (const row of rows) {
4801
+ const message = extractSingleMessage(row);
4802
+ if (message === null)
4803
+ return null;
4804
+ messages.push(message);
4805
+ }
4806
+ return messages.join(`
4807
+
4808
+ `);
4809
+ }
4810
+ function markdownRows(rows, depth) {
4811
+ if (rows.length === 0)
4812
+ return "(none)";
4813
+ if (!isPlainObjectArray(rows)) {
4814
+ return rows.map((item) => `- ${markdownCell(item)}`).join(`
4815
+ `);
4816
+ }
4817
+ const prose = extractMessageSequence(rows);
4818
+ if (prose !== null)
4819
+ return prose;
4820
+ const table = markdownTable(rows);
4821
+ if (table !== null)
4822
+ return table;
4823
+ if (depth >= MARKDOWN_MAX_DEPTH) {
4824
+ return fencedBlock(JSON.stringify(rows, null, 2));
4825
+ }
4826
+ return rows.map((row, index) => [
4827
+ `${markdownHeading(depth)} ${index + 1}`,
4828
+ markdownObject(row, depth + 1)
4829
+ ].join(`
4830
+
4831
+ `)).join(`
4832
+
4833
+ `);
4834
+ }
4835
+ function markdownObject(obj, depth) {
4836
+ const scalars = [];
4837
+ const blocks = [];
4838
+ for (const [key, value] of Object.entries(obj)) {
4839
+ if (value === undefined)
4840
+ continue;
4841
+ const label = markdownLabel(key);
4842
+ if (Array.isArray(value)) {
4843
+ blocks.push(`${markdownHeading(depth)} ${label}
4844
+
4845
+ ${markdownRows(value, depth + 1)}`);
4846
+ } else if (isNonEmptyPlainObject(value)) {
4847
+ const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
4848
+ if (nested !== "") {
4849
+ blocks.push(`${markdownHeading(depth)} ${label}
4850
+
4851
+ ${nested}`);
4852
+ }
4853
+ } else if (typeof value === "string" && value.includes(`
4854
+ `)) {
4855
+ blocks.push(`**${label}:**
4856
+
4857
+ ${fencedBlock(value)}`);
4858
+ } else {
4859
+ scalars.push(`**${label}:** ${markdownCell(value)}`);
4860
+ }
4861
+ }
4862
+ const sections = scalars.length > 0 ? [scalars.join(`
4863
+ `)] : [];
4864
+ sections.push(...blocks);
4865
+ return sections.join(`
4866
+
4867
+ `);
4868
+ }
4869
+ function extractSingleMessage(payload) {
4870
+ if (!isPlainRecord(payload))
4871
+ return null;
4872
+ const keys = Object.keys(payload);
4873
+ if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
4874
+ return null;
4875
+ const value = payload[keys[0]];
4876
+ return typeof value === "string" ? value : null;
4877
+ }
4878
+ function markdownPayload(payload) {
4879
+ const message = extractSingleMessage(payload);
4880
+ if (message !== null)
4881
+ return message;
4882
+ if (Array.isArray(payload)) {
4883
+ return markdownRows(rowsWithoutPlumbing(payload), 0);
4884
+ }
4885
+ const visible = withoutPlumbing(payload);
4886
+ const paged = splitPagedEnvelope(visible);
4887
+ if (paged !== null) {
4888
+ const meta = markdownObject(paged.meta, 0);
4889
+ const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
4890
+
4891
+ ${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
4892
+ return meta === "" ? rows : `${meta}
4893
+
4894
+ ${rows}`;
4895
+ }
4896
+ return markdownObject(visible, 0);
4897
+ }
4898
+ function isPaginationWorthShowing(value) {
4899
+ if (typeof value !== "object" || value === null)
4900
+ return false;
4901
+ const page = value;
4902
+ return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
4903
+ }
4904
+ function markdownEnvelopeNotes(data) {
4905
+ const envelope = data;
4906
+ const notes = [];
4907
+ const warning = envelope.Warning;
4908
+ if (typeof warning === "string" && warning !== "") {
4909
+ notes.push(`> **Warning:** ${warning}`);
4910
+ }
4911
+ const instructions = envelope.Instructions;
4912
+ if (typeof instructions === "string" && instructions !== "") {
4913
+ notes.push(`> ${instructions}`);
4914
+ }
4915
+ const pagination = envelope.Pagination;
4916
+ if (isPaginationWorthShowing(pagination)) {
4917
+ const body = markdownObject(pagination, 1);
4918
+ if (body !== "") {
4919
+ notes.push(`${markdownHeading(0)} Pagination
4920
+
4921
+ ${body}`);
4922
+ }
4923
+ }
4924
+ const log = envelope.Log;
4925
+ if (typeof log === "string" && log !== "") {
4926
+ notes.push(`**Log:** ${log}`);
4927
+ }
4928
+ return notes;
4929
+ }
4930
+ function renderMarkdown(data) {
4931
+ if (data.Result !== RESULTS.Success) {
4932
+ const failure = data;
4933
+ const sections = [`**Failed:** ${failure.Message}`];
4934
+ if (failure.Data != null) {
4935
+ sections.push(markdownPayload(failure.Data));
4936
+ }
4937
+ if (failure.Instructions) {
4938
+ sections.push(`> ${failure.Instructions}`);
4939
+ }
4940
+ return sections.filter((section) => section !== "").join(`
4941
+
4942
+ `);
4943
+ }
4944
+ if (!("Data" in data) || data.Data == null) {
4945
+ return markdownObject(withoutPlumbing(data), 0);
4946
+ }
4947
+ return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
4948
+
4949
+ `);
4950
+ }
4705
4951
  function toYaml(data) {
4706
4952
  const codec = getYamlCodec();
4707
4953
  if (!codec) {
@@ -5987,8 +6233,9 @@ class TextApiResponse {
5987
6233
  // ../identity-sdk/package.json
5988
6234
  var package_default = {
5989
6235
  name: "@uipath/identity-sdk",
6236
+ author: "UiPath",
5990
6237
  license: "SEE LICENSE IN LICENSE.txt",
5991
- version: "1.202.0",
6238
+ version: "1.203.0",
5992
6239
  repository: {
5993
6240
  type: "git",
5994
6241
  url: "https://github.com/UiPath/cli.git",
@@ -9311,16 +9558,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
9311
9558
  errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
9312
9559
  };
9313
9560
  };
9314
- var loadEnvFileAsync = async ({ envPath }) => {
9315
- const fs2 = getFileSystem();
9316
- const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
9317
- if (!await fs2.exists(absolutePath)) {
9318
- throw new Error(`Environment file not found: ${envPath}`);
9319
- }
9320
- const content = await fs2.readFile(absolutePath, "utf-8");
9321
- if (content === null) {
9322
- throw new Error(`Environment file not found: ${envPath}`);
9323
- }
9561
+ var parseEnvContent = (content) => {
9324
9562
  const env = {};
9325
9563
  for (const line of content.split(`
9326
9564
  `)) {
@@ -9341,6 +9579,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
9341
9579
  }
9342
9580
  return env;
9343
9581
  };
9582
+ var loadEnvFileAsync = async ({ envPath }) => {
9583
+ const fs2 = getFileSystem();
9584
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
9585
+ if (!await fs2.exists(absolutePath)) {
9586
+ throw new Error(`Environment file not found: ${envPath}`);
9587
+ }
9588
+ const content = await fs2.readFile(absolutePath, "utf-8");
9589
+ if (content === null) {
9590
+ throw new Error(`Environment file not found: ${envPath}`);
9591
+ }
9592
+ return parseEnvContent(content);
9593
+ };
9344
9594
  var saveEnvFileAsync = async ({
9345
9595
  envPath,
9346
9596
  data,
@@ -12267,4 +12517,4 @@ export {
12267
12517
  registerCommands
12268
12518
  };
12269
12519
 
12270
- //# debugId=3A225098B04A058A64756E2164756E21
12520
+ //# debugId=3920CFCAD024B24E64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@uipath/identity-commands",
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": "Admin CLI commands for Identity Server users, groups, robot accounts, and external apps. Library composed by admin-tool, not a standalone CLI tool.",
6
7
  "private": false,
7
8
  "repository": {
@@ -25,5 +26,5 @@
25
26
  "files": [
26
27
  "dist"
27
28
  ],
28
- "gitHead": "23b5a7038ead7264439af18f8b807c7cc99a29d5"
29
+ "gitHead": "3a42062ba731afca4595ba9aa8a80afc9667528d"
29
30
  }