@uipath/authz-commands 1.202.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +286 -35
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -3095,16 +3095,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
3095
3095
  errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
3096
3096
  };
3097
3097
  };
3098
- var loadEnvFileAsync = async ({ envPath }) => {
3099
- const fs2 = getFileSystem();
3100
- const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
3101
- if (!await fs2.exists(absolutePath)) {
3102
- throw new Error(`Environment file not found: ${envPath}`);
3103
- }
3104
- const content = await fs2.readFile(absolutePath, "utf-8");
3105
- if (content === null) {
3106
- throw new Error(`Environment file not found: ${envPath}`);
3107
- }
3098
+ var parseEnvContent = (content) => {
3108
3099
  const env = {};
3109
3100
  for (const line of content.split(`
3110
3101
  `)) {
@@ -3125,6 +3116,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
3125
3116
  }
3126
3117
  return env;
3127
3118
  };
3119
+ var loadEnvFileAsync = async ({ envPath }) => {
3120
+ const fs2 = getFileSystem();
3121
+ const absolutePath = fs2.path.isAbsolute(envPath) ? envPath : fs2.path.join(fs2.env.cwd(), envPath);
3122
+ if (!await fs2.exists(absolutePath)) {
3123
+ throw new Error(`Environment file not found: ${envPath}`);
3124
+ }
3125
+ const content = await fs2.readFile(absolutePath, "utf-8");
3126
+ if (content === null) {
3127
+ throw new Error(`Environment file not found: ${envPath}`);
3128
+ }
3129
+ return parseEnvContent(content);
3130
+ };
3128
3131
  var saveEnvFileAsync = async ({
3129
3132
  envPath,
3130
3133
  data,
@@ -4038,8 +4041,9 @@ class VoidApiResponse {
4038
4041
  // ../authz-sdk/package.json
4039
4042
  var package_default = {
4040
4043
  name: "@uipath/authz-sdk",
4044
+ author: "UiPath",
4041
4045
  license: "SEE LICENSE IN LICENSE.txt",
4042
- version: "1.202.0",
4046
+ version: "1.203.0",
4043
4047
  description: "SDK for the UiPath Authorization Service API.",
4044
4048
  repository: {
4045
4049
  type: "git",
@@ -4888,7 +4892,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
4888
4892
  var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
4889
4893
  var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
4890
4894
  var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
4891
- var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
4895
+ var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
4892
4896
  var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
4893
4897
  var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
4894
4898
  var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
@@ -4935,7 +4939,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
4935
4939
  `(?<![A-Za-z0-9])"(?:[^\\
4936
4940
  ]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
4937
4941
  ].join("|"), "g");
4938
- var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
4942
+ var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
4939
4943
  var COLLAPSED_BODY = "{…}";
4940
4944
  var COLLAPSED_BODY_MARKER = "\x01body\x01";
4941
4945
  var MAX_BODY_NESTING = 8;
@@ -4950,10 +4954,13 @@ function collapseJsonBodies(text) {
4950
4954
  }
4951
4955
  return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
4952
4956
  }
4953
- var TRAILING_PROSE_PUNCT = /[.,;:!?)\]}>'"]+$/;
4957
+ var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
4954
4958
  function peelTrailingPunctuation(match) {
4955
- const trailing = match.match(TRAILING_PROSE_PUNCT)?.[0] ?? "";
4956
- return trailing ? [match.slice(0, -trailing.length), trailing] : [match, ""];
4959
+ let end = match.length;
4960
+ while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
4961
+ end -= 1;
4962
+ }
4963
+ return [match.slice(0, end), match.slice(end)];
4957
4964
  }
4958
4965
  function redactUrl(raw) {
4959
4966
  try {
@@ -5256,6 +5263,22 @@ function parseHttpStatusFromMessage(message) {
5256
5263
  const status = Number(match[1]);
5257
5264
  return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
5258
5265
  }
5266
+ function findHttpStatusInGraph(error) {
5267
+ for (const node of walkErrorGraph(error)) {
5268
+ const response = node.response;
5269
+ const explicit = typeof node.status === "number" ? node.status : response?.status;
5270
+ if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
5271
+ return explicit;
5272
+ }
5273
+ if (typeof node.message === "string") {
5274
+ const parsed = parseHttpStatusFromMessage(node.message);
5275
+ if (parsed !== undefined && parsed >= 400) {
5276
+ return parsed;
5277
+ }
5278
+ }
5279
+ }
5280
+ return;
5281
+ }
5259
5282
  function isHtmlDocument(body) {
5260
5283
  return /^\s*(<!doctype html|<html\b)/i.test(body);
5261
5284
  }
@@ -5369,7 +5392,8 @@ async function extractErrorDetails(error, options) {
5369
5392
  }
5370
5393
  let message;
5371
5394
  let result = "Failure";
5372
- const classification = classifyError(status, error);
5395
+ const classificationStatus = status ?? findHttpStatusInGraph(error);
5396
+ const classification = classifyError(classificationStatus, error);
5373
5397
  let retry = classification.retry;
5374
5398
  if (status === 401) {
5375
5399
  message = DEFAULT_401;
@@ -5445,8 +5469,8 @@ async function extractErrorDetails(error, options) {
5445
5469
  details = describeThrownValue(error);
5446
5470
  }
5447
5471
  const context = {};
5448
- if (status) {
5449
- context.httpStatus = status;
5472
+ if (classificationStatus) {
5473
+ context.httpStatus = classificationStatus;
5450
5474
  }
5451
5475
  if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
5452
5476
  context.errorCode = parsedBody.errorCode;
@@ -6008,7 +6032,8 @@ function readRegistryValue(keyPath, valueName) {
6008
6032
  }
6009
6033
  const [error, output] = catchError2(() => execFileSync("reg", ["query", keyPath, "/v", valueName], {
6010
6034
  encoding: "utf-8",
6011
- stdio: ["pipe", "pipe", "pipe"]
6035
+ stdio: ["pipe", "pipe", "pipe"],
6036
+ windowsHide: true
6012
6037
  }));
6013
6038
  if (error) {
6014
6039
  return "";
@@ -6684,28 +6709,32 @@ function isPlainRecord(value) {
6684
6709
  const prototype = Object.getPrototypeOf(value);
6685
6710
  return prototype === Object.prototype || prototype === null;
6686
6711
  }
6687
- function extractPagedRows(value) {
6712
+ function splitPagedEnvelope(value) {
6688
6713
  if (Array.isArray(value) || !isPlainRecord(value))
6689
6714
  return null;
6690
- const entries = Object.values(value);
6715
+ const entries = Object.entries(value);
6691
6716
  if (entries.length === 0)
6692
6717
  return null;
6693
- let rows = null;
6694
- let hasScalarSibling = false;
6695
- for (const entry of entries) {
6718
+ let found = null;
6719
+ const meta = Object.create(null);
6720
+ for (const [key, entry] of entries) {
6696
6721
  if (Array.isArray(entry)) {
6697
- if (rows !== null)
6722
+ if (found !== null)
6698
6723
  return null;
6699
- rows = entry;
6724
+ found = { key, rows: entry };
6700
6725
  } else if (entry !== null && typeof entry === "object") {
6701
6726
  return null;
6702
6727
  } else {
6703
- hasScalarSibling = true;
6728
+ meta[key] = entry;
6704
6729
  }
6705
6730
  }
6706
- if (rows === null || !hasScalarSibling)
6731
+ if (found === null || Object.keys(meta).length === 0)
6707
6732
  return null;
6708
- return rows;
6733
+ return { ...found, meta };
6734
+ }
6735
+ function extractPagedRows(value) {
6736
+ const paged = splitPagedEnvelope(value);
6737
+ return paged === null ? null : paged.rows;
6709
6738
  }
6710
6739
  function toLowerCamelCaseKey(key) {
6711
6740
  if (!key)
@@ -6809,6 +6838,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
6809
6838
  }
6810
6839
  break;
6811
6840
  }
6841
+ case "markdown":
6842
+ logFn(renderMarkdown(data));
6843
+ break;
6812
6844
  default: {
6813
6845
  const hasData = "Data" in data && data.Data != null;
6814
6846
  const pagedRows = hasData ? extractPagedRows(data.Data) : null;
@@ -6833,6 +6865,10 @@ function logOutput(data, format = "json", tableRowStyle) {
6833
6865
  printOutput(data, format, (msg) => sink.writeOut(`${msg}
6834
6866
  `), needsAsciiSafeJson(sink), styleFn);
6835
6867
  }
6868
+ var PLUMBING_KEYS = new Set(["code", "log"]);
6869
+ function isPlumbingKey(key) {
6870
+ return PLUMBING_KEYS.has(key.toLowerCase());
6871
+ }
6836
6872
  function cellToString(val) {
6837
6873
  return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
6838
6874
  }
@@ -6848,7 +6884,7 @@ function wrapText(text, width) {
6848
6884
  function printTable(data, logFn, externalLogValue, tableRowStyle) {
6849
6885
  if (data.length === 0)
6850
6886
  return;
6851
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
6887
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
6852
6888
  const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
6853
6889
  const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
6854
6890
  logFn(header);
@@ -6870,7 +6906,7 @@ function isNonEmptyPlainObject(value) {
6870
6906
  }
6871
6907
  var NESTED_INDENT = " ";
6872
6908
  function printVerticalTable(data, logFn = console.log, externalLogValue) {
6873
- const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
6909
+ const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
6874
6910
  if (keys.length === 0)
6875
6911
  return;
6876
6912
  const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
@@ -6901,7 +6937,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
6901
6937
  function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
6902
6938
  if (data.length === 0)
6903
6939
  return;
6904
- const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
6940
+ const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
6905
6941
  if (keys.length === 0)
6906
6942
  return;
6907
6943
  if (!process.stdout.isTTY) {
@@ -6975,6 +7011,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
6975
7011
  logFn(`Log: ${externalLogValue}`);
6976
7012
  }
6977
7013
  }
7014
+ var MARKDOWN_MAX_CELL = 200;
7015
+ var MARKDOWN_MAX_DEPTH = 3;
7016
+ function markdownHeading(depth) {
7017
+ return "#".repeat(Math.min(3 + depth, 6));
7018
+ }
7019
+ var BACKTICK_RUN = /`+/g;
7020
+ function fencedBlock(text) {
7021
+ const first = text.trimStart()[0];
7022
+ const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
7023
+ const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
7024
+ const fence = "`".repeat(Math.max(3, longestRun + 1));
7025
+ return `${fence}${language}
7026
+ ${text}
7027
+ ${fence}`;
7028
+ }
7029
+ function collapseNewlineRuns(text) {
7030
+ return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
7031
+ `) ? " " : part).join("");
7032
+ }
7033
+ function markdownCell(value) {
7034
+ const text = value instanceof Date ? value.toISOString() : cellToString(value);
7035
+ return collapseNewlineRuns(text).replace(/\|/g, "\\|");
7036
+ }
7037
+ function markdownLabel(key) {
7038
+ return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
7039
+ }
7040
+ function withoutPlumbing(record) {
7041
+ const kept = Object.create(null);
7042
+ for (const [key, value] of Object.entries(record)) {
7043
+ if (!isPlumbingKey(key))
7044
+ kept[key] = value;
7045
+ }
7046
+ return kept;
7047
+ }
7048
+ function rowsWithoutPlumbing(rows) {
7049
+ return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
7050
+ }
7051
+ function markdownTable(rows) {
7052
+ const columns = [];
7053
+ const seen = new Set;
7054
+ for (const row of rows) {
7055
+ for (const key of Object.keys(row)) {
7056
+ if (!seen.has(key)) {
7057
+ seen.add(key);
7058
+ columns.push(key);
7059
+ }
7060
+ }
7061
+ }
7062
+ if (columns.length === 0)
7063
+ return null;
7064
+ const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
7065
+ if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
7066
+ return null;
7067
+ }
7068
+ return [
7069
+ `| ${columns.map(markdownLabel).join(" | ")} |`,
7070
+ `| ${columns.map(() => "---").join(" | ")} |`,
7071
+ ...cells.map((row) => `| ${row.join(" | ")} |`)
7072
+ ].join(`
7073
+ `);
7074
+ }
7075
+ function extractMessageSequence(rows) {
7076
+ const messages = [];
7077
+ for (const row of rows) {
7078
+ const message = extractSingleMessage(row);
7079
+ if (message === null)
7080
+ return null;
7081
+ messages.push(message);
7082
+ }
7083
+ return messages.join(`
7084
+
7085
+ `);
7086
+ }
7087
+ function markdownRows(rows, depth) {
7088
+ if (rows.length === 0)
7089
+ return "(none)";
7090
+ if (!isPlainObjectArray(rows)) {
7091
+ return rows.map((item) => `- ${markdownCell(item)}`).join(`
7092
+ `);
7093
+ }
7094
+ const prose = extractMessageSequence(rows);
7095
+ if (prose !== null)
7096
+ return prose;
7097
+ const table = markdownTable(rows);
7098
+ if (table !== null)
7099
+ return table;
7100
+ if (depth >= MARKDOWN_MAX_DEPTH) {
7101
+ return fencedBlock(JSON.stringify(rows, null, 2));
7102
+ }
7103
+ return rows.map((row, index) => [
7104
+ `${markdownHeading(depth)} ${index + 1}`,
7105
+ markdownObject(row, depth + 1)
7106
+ ].join(`
7107
+
7108
+ `)).join(`
7109
+
7110
+ `);
7111
+ }
7112
+ function markdownObject(obj, depth) {
7113
+ const scalars = [];
7114
+ const blocks = [];
7115
+ for (const [key, value] of Object.entries(obj)) {
7116
+ if (value === undefined)
7117
+ continue;
7118
+ const label = markdownLabel(key);
7119
+ if (Array.isArray(value)) {
7120
+ blocks.push(`${markdownHeading(depth)} ${label}
7121
+
7122
+ ${markdownRows(value, depth + 1)}`);
7123
+ } else if (isNonEmptyPlainObject(value)) {
7124
+ const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
7125
+ if (nested !== "") {
7126
+ blocks.push(`${markdownHeading(depth)} ${label}
7127
+
7128
+ ${nested}`);
7129
+ }
7130
+ } else if (typeof value === "string" && value.includes(`
7131
+ `)) {
7132
+ blocks.push(`**${label}:**
7133
+
7134
+ ${fencedBlock(value)}`);
7135
+ } else {
7136
+ scalars.push(`**${label}:** ${markdownCell(value)}`);
7137
+ }
7138
+ }
7139
+ const sections = scalars.length > 0 ? [scalars.join(`
7140
+ `)] : [];
7141
+ sections.push(...blocks);
7142
+ return sections.join(`
7143
+
7144
+ `);
7145
+ }
7146
+ function extractSingleMessage(payload) {
7147
+ if (!isPlainRecord(payload))
7148
+ return null;
7149
+ const keys = Object.keys(payload);
7150
+ if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
7151
+ return null;
7152
+ const value = payload[keys[0]];
7153
+ return typeof value === "string" ? value : null;
7154
+ }
7155
+ function markdownPayload(payload) {
7156
+ const message = extractSingleMessage(payload);
7157
+ if (message !== null)
7158
+ return message;
7159
+ if (Array.isArray(payload)) {
7160
+ return markdownRows(rowsWithoutPlumbing(payload), 0);
7161
+ }
7162
+ const visible = withoutPlumbing(payload);
7163
+ const paged = splitPagedEnvelope(visible);
7164
+ if (paged !== null) {
7165
+ const meta = markdownObject(paged.meta, 0);
7166
+ const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
7167
+
7168
+ ${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
7169
+ return meta === "" ? rows : `${meta}
7170
+
7171
+ ${rows}`;
7172
+ }
7173
+ return markdownObject(visible, 0);
7174
+ }
7175
+ function isPaginationWorthShowing(value) {
7176
+ if (typeof value !== "object" || value === null)
7177
+ return false;
7178
+ const page = value;
7179
+ return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
7180
+ }
7181
+ function markdownEnvelopeNotes(data) {
7182
+ const envelope = data;
7183
+ const notes = [];
7184
+ const warning = envelope.Warning;
7185
+ if (typeof warning === "string" && warning !== "") {
7186
+ notes.push(`> **Warning:** ${warning}`);
7187
+ }
7188
+ const instructions = envelope.Instructions;
7189
+ if (typeof instructions === "string" && instructions !== "") {
7190
+ notes.push(`> ${instructions}`);
7191
+ }
7192
+ const pagination = envelope.Pagination;
7193
+ if (isPaginationWorthShowing(pagination)) {
7194
+ const body = markdownObject(pagination, 1);
7195
+ if (body !== "") {
7196
+ notes.push(`${markdownHeading(0)} Pagination
7197
+
7198
+ ${body}`);
7199
+ }
7200
+ }
7201
+ const log = envelope.Log;
7202
+ if (typeof log === "string" && log !== "") {
7203
+ notes.push(`**Log:** ${log}`);
7204
+ }
7205
+ return notes;
7206
+ }
7207
+ function renderMarkdown(data) {
7208
+ if (data.Result !== RESULTS.Success) {
7209
+ const failure = data;
7210
+ const sections = [`**Failed:** ${failure.Message}`];
7211
+ if (failure.Data != null) {
7212
+ sections.push(markdownPayload(failure.Data));
7213
+ }
7214
+ if (failure.Instructions) {
7215
+ sections.push(`> ${failure.Instructions}`);
7216
+ }
7217
+ return sections.filter((section) => section !== "").join(`
7218
+
7219
+ `);
7220
+ }
7221
+ if (!("Data" in data) || data.Data == null) {
7222
+ return markdownObject(withoutPlumbing(data), 0);
7223
+ }
7224
+ return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
7225
+
7226
+ `);
7227
+ }
6978
7228
  function toYaml(data) {
6979
7229
  const codec = getYamlCodec();
6980
7230
  if (!codec) {
@@ -8170,8 +8420,9 @@ class VoidApiResponse2 {
8170
8420
  // ../identity-sdk/package.json
8171
8421
  var package_default2 = {
8172
8422
  name: "@uipath/identity-sdk",
8423
+ author: "UiPath",
8173
8424
  license: "SEE LICENSE IN LICENSE.txt",
8174
- version: "1.202.0",
8425
+ version: "1.203.0",
8175
8426
  repository: {
8176
8427
  type: "git",
8177
8428
  url: "https://github.com/UiPath/cli.git",
@@ -10626,4 +10877,4 @@ export {
10626
10877
  registerCommands
10627
10878
  };
10628
10879
 
10629
- //# debugId=AD1E1BF252EF402064756E2164756E21
10880
+ //# debugId=6E2EC35A8728EE7964756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@uipath/authz-commands",
3
+ "author": "UiPath",
3
4
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.1",
5
+ "version": "1.203.0-preview.180",
5
6
  "description": "Admin CLI commands for the UiPath Authorization service. 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": "280b581b7893224d512dd194f47dd57243cc6a5c"
29
+ "gitHead": "4e0a51e3ab2c9d89afd3d35a7b087a7fa58133a0"
29
30
  }