@uipath/common 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/THIRD-PARTY-NOTICES.md +32 -1
- package/dist/catch-error.js +17 -1
- package/dist/command-help.d.ts +1 -1
- package/dist/entity-name-rules.js +17 -1
- package/dist/formatter.d.ts +50 -1
- package/dist/guid.js +17 -1
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +70 -16
- package/dist/index.js +384 -36
- package/dist/logger.d.ts +1 -1
- package/dist/output-format-context.d.ts +1 -1
- package/dist/output-formats.d.ts +34 -0
- package/dist/registry.d.ts +5 -0
- package/dist/telemetry/index.js +9 -6
- package/dist/telemetry/telemetry-init.d.ts +1 -1
- package/dist/timings.d.ts +19 -0
- package/dist/zip.d.ts +14 -0
- package/dist/zip.js +1380 -0
- package/package.json +7 -2
package/dist/index.js
CHANGED
|
@@ -7897,7 +7897,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
|
|
|
7897
7897
|
var EMAIL_PATTERN = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
|
|
7898
7898
|
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
|
|
7899
7899
|
var LONG_TOKEN_PATTERN = /\b[A-Za-z0-9_-]{40,}\b/g;
|
|
7900
|
-
var PADDED_BASE64_PATTERN = /[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
7900
|
+
var PADDED_BASE64_PATTERN = /(?<![A-Za-z0-9+/])[A-Za-z0-9+/]{16,}={1,2}(?![A-Za-z0-9+/=])/g;
|
|
7901
7901
|
var BASE64_WITH_PLUS_PATTERN = /[A-Za-z0-9+/]{40,}/g;
|
|
7902
7902
|
var USER_HOME_PATTERN = /(?<![A-Za-z0-9._-])([/\\])(Users|home|Profiles)([/\\])([^/\\]+)/gi;
|
|
7903
7903
|
var UNC_PATH_PATTERN = /(^|[\s"'<>|=,;([{])(\\\\[^\s"'<>|]+)/g;
|
|
@@ -7944,7 +7944,7 @@ var QUOTED_LITERAL_PATTERN = new RegExp([
|
|
|
7944
7944
|
`(?<![A-Za-z0-9])"(?:[^\\
|
|
7945
7945
|
]|\\.){2,${QUOTED_LITERAL_MAX_SPAN}}?"(?![A-Za-z0-9])`
|
|
7946
7946
|
].join("|"), "g");
|
|
7947
|
-
var JSON_BODY_PATTERN = /[{[][^{}[\]]*[:,][^{}[\]]*[\]}]/g;
|
|
7947
|
+
var JSON_BODY_PATTERN = /[{[][^{}[\]:,]*[:,][^{}[\]]*[\]}]/g;
|
|
7948
7948
|
var COLLAPSED_BODY = "{…}";
|
|
7949
7949
|
var COLLAPSED_BODY_MARKER = "\x01body\x01";
|
|
7950
7950
|
var MAX_BODY_NESTING = 8;
|
|
@@ -7959,10 +7959,13 @@ function collapseJsonBodies(text) {
|
|
|
7959
7959
|
}
|
|
7960
7960
|
return out.split(COLLAPSED_BODY_MARKER).join(COLLAPSED_BODY);
|
|
7961
7961
|
}
|
|
7962
|
-
var TRAILING_PROSE_PUNCT =
|
|
7962
|
+
var TRAILING_PROSE_PUNCT = `.,;:!?)]}>'"`;
|
|
7963
7963
|
function peelTrailingPunctuation(match) {
|
|
7964
|
-
|
|
7965
|
-
|
|
7964
|
+
let end = match.length;
|
|
7965
|
+
while (end > 0 && TRAILING_PROSE_PUNCT.includes(match[end - 1])) {
|
|
7966
|
+
end -= 1;
|
|
7967
|
+
}
|
|
7968
|
+
return [match.slice(0, end), match.slice(end)];
|
|
7966
7969
|
}
|
|
7967
7970
|
function redactUrl(raw) {
|
|
7968
7971
|
try {
|
|
@@ -8302,6 +8305,22 @@ function parseHttpStatusFromMessage(message) {
|
|
|
8302
8305
|
const status = Number(match[1]);
|
|
8303
8306
|
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
8304
8307
|
}
|
|
8308
|
+
function findHttpStatusInGraph(error) {
|
|
8309
|
+
for (const node of walkErrorGraph(error)) {
|
|
8310
|
+
const response = node.response;
|
|
8311
|
+
const explicit = typeof node.status === "number" ? node.status : response?.status;
|
|
8312
|
+
if (typeof explicit === "number" && explicit >= 400 && explicit <= 599) {
|
|
8313
|
+
return explicit;
|
|
8314
|
+
}
|
|
8315
|
+
if (typeof node.message === "string") {
|
|
8316
|
+
const parsed = parseHttpStatusFromMessage(node.message);
|
|
8317
|
+
if (parsed !== undefined && parsed >= 400) {
|
|
8318
|
+
return parsed;
|
|
8319
|
+
}
|
|
8320
|
+
}
|
|
8321
|
+
}
|
|
8322
|
+
return;
|
|
8323
|
+
}
|
|
8305
8324
|
function isHtmlDocument(body) {
|
|
8306
8325
|
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
8307
8326
|
}
|
|
@@ -8415,7 +8434,8 @@ async function extractErrorDetails(error, options) {
|
|
|
8415
8434
|
}
|
|
8416
8435
|
let message;
|
|
8417
8436
|
let result = "Failure";
|
|
8418
|
-
const
|
|
8437
|
+
const classificationStatus = status ?? findHttpStatusInGraph(error);
|
|
8438
|
+
const classification = classifyError(classificationStatus, error);
|
|
8419
8439
|
let retry = classification.retry;
|
|
8420
8440
|
if (status === 401) {
|
|
8421
8441
|
message = DEFAULT_401;
|
|
@@ -8491,8 +8511,8 @@ async function extractErrorDetails(error, options) {
|
|
|
8491
8511
|
details = describeThrownValue(error);
|
|
8492
8512
|
}
|
|
8493
8513
|
const context = {};
|
|
8494
|
-
if (
|
|
8495
|
-
context.httpStatus =
|
|
8514
|
+
if (classificationStatus) {
|
|
8515
|
+
context.httpStatus = classificationStatus;
|
|
8496
8516
|
}
|
|
8497
8517
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
8498
8518
|
context.errorCode = parsedBody.errorCode;
|
|
@@ -8953,6 +8973,18 @@ function getOutputFilter() {
|
|
|
8953
8973
|
return filterSlot.get();
|
|
8954
8974
|
}
|
|
8955
8975
|
|
|
8976
|
+
// src/output-formats.ts
|
|
8977
|
+
var OUTPUT_FORMATS = [
|
|
8978
|
+
"table",
|
|
8979
|
+
"json",
|
|
8980
|
+
"yaml",
|
|
8981
|
+
"plain",
|
|
8982
|
+
"markdown"
|
|
8983
|
+
];
|
|
8984
|
+
function isOutputFormat(value) {
|
|
8985
|
+
return OUTPUT_FORMATS.includes(value);
|
|
8986
|
+
}
|
|
8987
|
+
|
|
8956
8988
|
// src/telemetry/command-terminal.ts
|
|
8957
8989
|
var recordedFailureSlot = singleton("CommandTelemetryFailure");
|
|
8958
8990
|
var AUTH_ERROR_CODES = new Set([
|
|
@@ -9191,7 +9223,8 @@ function readRegistryValue(keyPath, valueName) {
|
|
|
9191
9223
|
}
|
|
9192
9224
|
const [error, output] = catchError(() => execFileSync2("reg", ["query", keyPath, "/v", valueName], {
|
|
9193
9225
|
encoding: "utf-8",
|
|
9194
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
9226
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
9227
|
+
windowsHide: true
|
|
9195
9228
|
}));
|
|
9196
9229
|
if (error) {
|
|
9197
9230
|
return "";
|
|
@@ -9800,6 +9833,7 @@ class TelemetryService {
|
|
|
9800
9833
|
}
|
|
9801
9834
|
// src/timings.ts
|
|
9802
9835
|
var TIMINGS_ENV_VAR = "UIP_TIMINGS";
|
|
9836
|
+
var TIMINGS_FILE_ENV_VAR = "UIP_TIMINGS_FILE";
|
|
9803
9837
|
var TIMINGS_LINE_PREFIX = "[timing]";
|
|
9804
9838
|
function createStorage2() {
|
|
9805
9839
|
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
@@ -9866,7 +9900,7 @@ async function runWithTimings(fallbackCommand, fn) {
|
|
|
9866
9900
|
}
|
|
9867
9901
|
}
|
|
9868
9902
|
if (timingsEnabled()) {
|
|
9869
|
-
emitTimingReport(state, fallbackCommand);
|
|
9903
|
+
await emitTimingReport(state, fallbackCommand);
|
|
9870
9904
|
}
|
|
9871
9905
|
}
|
|
9872
9906
|
});
|
|
@@ -9882,6 +9916,13 @@ function timingsEnabled() {
|
|
|
9882
9916
|
const normalized = value.trim().toLowerCase();
|
|
9883
9917
|
return normalized === "1" || normalized === "true";
|
|
9884
9918
|
}
|
|
9919
|
+
function timingsFile() {
|
|
9920
|
+
if (typeof process === "undefined") {
|
|
9921
|
+
return;
|
|
9922
|
+
}
|
|
9923
|
+
const value = process.env?.[TIMINGS_FILE_ENV_VAR]?.trim();
|
|
9924
|
+
return value === undefined || value === "" ? undefined : value;
|
|
9925
|
+
}
|
|
9885
9926
|
function setTimingCommand(command) {
|
|
9886
9927
|
if (!timingsEnabled()) {
|
|
9887
9928
|
return;
|
|
@@ -9968,12 +10009,12 @@ function formatTimingReport(args) {
|
|
|
9968
10009
|
parts.push(`flush=${total - startup - command}ms`);
|
|
9969
10010
|
return parts.join(" ");
|
|
9970
10011
|
}
|
|
9971
|
-
function emitTimingReport(state, fallbackCommand) {
|
|
10012
|
+
async function emitTimingReport(state, fallbackCommand) {
|
|
9972
10013
|
if (state.suppressed) {
|
|
9973
10014
|
return;
|
|
9974
10015
|
}
|
|
9975
10016
|
const now = performance.now();
|
|
9976
|
-
|
|
10017
|
+
const line = formatTimingReport({
|
|
9977
10018
|
command: state.command ?? fallbackCommand,
|
|
9978
10019
|
exitCode: state.exitCode ?? 0,
|
|
9979
10020
|
totalMs: now - state.baseline,
|
|
@@ -9985,7 +10026,17 @@ function emitTimingReport(state, fallbackCommand) {
|
|
|
9985
10026
|
},
|
|
9986
10027
|
httpMs: state.httpMs,
|
|
9987
10028
|
httpCalls: state.httpCalls
|
|
9988
|
-
})
|
|
10029
|
+
});
|
|
10030
|
+
const file = timingsFile();
|
|
10031
|
+
if (file === undefined) {
|
|
10032
|
+
logger.report(line);
|
|
10033
|
+
return;
|
|
10034
|
+
}
|
|
10035
|
+
const [error] = await catchError(() => getFileSystem().appendFile(file, `${line}
|
|
10036
|
+
`));
|
|
10037
|
+
if (error) {
|
|
10038
|
+
logger.report(line);
|
|
10039
|
+
}
|
|
9989
10040
|
}
|
|
9990
10041
|
|
|
9991
10042
|
// src/telemetry/tracked-fetch.ts
|
|
@@ -10662,18 +10713,56 @@ function isSyncFlushForced() {
|
|
|
10662
10713
|
function isDrainableTelemetryProvider(provider) {
|
|
10663
10714
|
return "drainPendingEnvelopes" in provider && typeof provider.drainPendingEnvelopes === "function";
|
|
10664
10715
|
}
|
|
10665
|
-
function spawnTelemetrySidecar(entryPath) {
|
|
10666
|
-
const
|
|
10667
|
-
|
|
10668
|
-
|
|
10716
|
+
async function spawnTelemetrySidecar(entryPath) {
|
|
10717
|
+
const cwd = getFileSystem().env.tmpdir();
|
|
10718
|
+
const isWindows = process.platform === "win32";
|
|
10719
|
+
const child = isWindows ? spawn(windowsShell(), windowsLauncherArgs(entryPath), {
|
|
10720
|
+
cwd,
|
|
10669
10721
|
stdio: "ignore",
|
|
10670
|
-
windowsHide: true
|
|
10722
|
+
windowsHide: true,
|
|
10723
|
+
windowsVerbatimArguments: true
|
|
10724
|
+
}) : spawn(process.execPath, [entryPath, TELEMETRY_DRAIN_ARGV], {
|
|
10725
|
+
cwd,
|
|
10726
|
+
detached: true,
|
|
10727
|
+
stdio: "ignore"
|
|
10671
10728
|
});
|
|
10672
10729
|
child.on("error", (error) => {
|
|
10673
10730
|
logger.debug(`[Telemetry] sidecar spawn failed (spool kept for a later run): ${error.message}`);
|
|
10674
10731
|
});
|
|
10732
|
+
if (isWindows) {
|
|
10733
|
+
await waitForWindowsLauncher(child);
|
|
10734
|
+
}
|
|
10675
10735
|
child.unref();
|
|
10676
10736
|
}
|
|
10737
|
+
var WINDOWS_LAUNCHER_TIMEOUT_MS = 3000;
|
|
10738
|
+
function waitForWindowsLauncher(child) {
|
|
10739
|
+
return new Promise((resolve2) => {
|
|
10740
|
+
const timer = setTimeout(resolve2, WINDOWS_LAUNCHER_TIMEOUT_MS);
|
|
10741
|
+
timer.unref();
|
|
10742
|
+
const settle = () => {
|
|
10743
|
+
clearTimeout(timer);
|
|
10744
|
+
resolve2();
|
|
10745
|
+
};
|
|
10746
|
+
child.on("exit", settle);
|
|
10747
|
+
child.on("error", settle);
|
|
10748
|
+
});
|
|
10749
|
+
}
|
|
10750
|
+
function windowsShell() {
|
|
10751
|
+
return process.env.ComSpec ?? "cmd.exe";
|
|
10752
|
+
}
|
|
10753
|
+
function windowsLauncherArgs(entryPath) {
|
|
10754
|
+
return [
|
|
10755
|
+
"/d",
|
|
10756
|
+
"/s",
|
|
10757
|
+
"/c",
|
|
10758
|
+
"start",
|
|
10759
|
+
'""',
|
|
10760
|
+
"/b",
|
|
10761
|
+
`"${process.execPath}"`,
|
|
10762
|
+
`"${entryPath}"`,
|
|
10763
|
+
TELEMETRY_DRAIN_ARGV
|
|
10764
|
+
];
|
|
10765
|
+
}
|
|
10677
10766
|
async function trySidecarHandoff(provider) {
|
|
10678
10767
|
const entryPath = getTelemetrySidecarEntry();
|
|
10679
10768
|
if (entryPath === undefined || isSyncFlushForced() || !isDrainableTelemetryProvider(provider)) {
|
|
@@ -10688,7 +10777,7 @@ async function trySidecarHandoff(provider) {
|
|
|
10688
10777
|
if (spoolError) {
|
|
10689
10778
|
logger.debug(`[Telemetry] spool write failed; dropping ${pending.envelopes.length} pending envelope(s): ${spoolError.message}`);
|
|
10690
10779
|
} else {
|
|
10691
|
-
const [spawnError] = catchError(
|
|
10780
|
+
const [spawnError] = await catchError(spawnTelemetrySidecar(entryPath));
|
|
10692
10781
|
if (spawnError) {
|
|
10693
10782
|
logger.debug(`[Telemetry] sidecar spawn failed; spool will be sent by a future run: ${spawnError.message}`);
|
|
10694
10783
|
}
|
|
@@ -10765,6 +10854,18 @@ function isCliErrorCode(value) {
|
|
|
10765
10854
|
function isRetryHint(value) {
|
|
10766
10855
|
return typeof value === "string" && RETRY_HINT_VALUES.has(value);
|
|
10767
10856
|
}
|
|
10857
|
+
function carriedErrorCode(error) {
|
|
10858
|
+
if (!error || typeof error !== "object")
|
|
10859
|
+
return;
|
|
10860
|
+
const code = error.errorCode;
|
|
10861
|
+
return isCliErrorCode(code) ? code : undefined;
|
|
10862
|
+
}
|
|
10863
|
+
function carriedRetry(error) {
|
|
10864
|
+
if (!error || typeof error !== "object")
|
|
10865
|
+
return;
|
|
10866
|
+
const retry = error.retry;
|
|
10867
|
+
return isRetryHint(retry) ? retry : undefined;
|
|
10868
|
+
}
|
|
10768
10869
|
var RESULTS = {
|
|
10769
10870
|
Success: "Success",
|
|
10770
10871
|
Failure: "Failure",
|
|
@@ -10880,28 +10981,32 @@ function isPlainRecord(value) {
|
|
|
10880
10981
|
const prototype = Object.getPrototypeOf(value);
|
|
10881
10982
|
return prototype === Object.prototype || prototype === null;
|
|
10882
10983
|
}
|
|
10883
|
-
function
|
|
10984
|
+
function splitPagedEnvelope(value) {
|
|
10884
10985
|
if (Array.isArray(value) || !isPlainRecord(value))
|
|
10885
10986
|
return null;
|
|
10886
|
-
const entries = Object.
|
|
10987
|
+
const entries = Object.entries(value);
|
|
10887
10988
|
if (entries.length === 0)
|
|
10888
10989
|
return null;
|
|
10889
|
-
let
|
|
10890
|
-
|
|
10891
|
-
for (const entry of entries) {
|
|
10990
|
+
let found = null;
|
|
10991
|
+
const meta = Object.create(null);
|
|
10992
|
+
for (const [key, entry] of entries) {
|
|
10892
10993
|
if (Array.isArray(entry)) {
|
|
10893
|
-
if (
|
|
10994
|
+
if (found !== null)
|
|
10894
10995
|
return null;
|
|
10895
|
-
|
|
10996
|
+
found = { key, rows: entry };
|
|
10896
10997
|
} else if (entry !== null && typeof entry === "object") {
|
|
10897
10998
|
return null;
|
|
10898
10999
|
} else {
|
|
10899
|
-
|
|
11000
|
+
meta[key] = entry;
|
|
10900
11001
|
}
|
|
10901
11002
|
}
|
|
10902
|
-
if (
|
|
11003
|
+
if (found === null || Object.keys(meta).length === 0)
|
|
10903
11004
|
return null;
|
|
10904
|
-
return
|
|
11005
|
+
return { ...found, meta };
|
|
11006
|
+
}
|
|
11007
|
+
function extractPagedRows(value) {
|
|
11008
|
+
const paged = splitPagedEnvelope(value);
|
|
11009
|
+
return paged === null ? null : paged.rows;
|
|
10905
11010
|
}
|
|
10906
11011
|
function toLowerCamelCaseKey(key) {
|
|
10907
11012
|
if (!key)
|
|
@@ -11005,6 +11110,9 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
11005
11110
|
}
|
|
11006
11111
|
break;
|
|
11007
11112
|
}
|
|
11113
|
+
case "markdown":
|
|
11114
|
+
logFn(renderMarkdown(data));
|
|
11115
|
+
break;
|
|
11008
11116
|
default: {
|
|
11009
11117
|
const hasData = "Data" in data && data.Data != null;
|
|
11010
11118
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
@@ -11029,6 +11137,10 @@ function logOutput(data, format = "json", tableRowStyle) {
|
|
|
11029
11137
|
printOutput(data, format, (msg) => sink.writeOut(`${msg}
|
|
11030
11138
|
`), needsAsciiSafeJson(sink), styleFn);
|
|
11031
11139
|
}
|
|
11140
|
+
var PLUMBING_KEYS = new Set(["code", "log"]);
|
|
11141
|
+
function isPlumbingKey(key) {
|
|
11142
|
+
return PLUMBING_KEYS.has(key.toLowerCase());
|
|
11143
|
+
}
|
|
11032
11144
|
function cellToString(val) {
|
|
11033
11145
|
return val != null && typeof val === "object" ? JSON.stringify(val) : String(val ?? "");
|
|
11034
11146
|
}
|
|
@@ -11044,7 +11156,7 @@ function wrapText(text, width) {
|
|
|
11044
11156
|
function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
11045
11157
|
if (data.length === 0)
|
|
11046
11158
|
return;
|
|
11047
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
11159
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
11048
11160
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
11049
11161
|
const header = keys.map((key, i) => key.padEnd(maxWidths[i])).join(" | ");
|
|
11050
11162
|
logFn(header);
|
|
@@ -11066,7 +11178,7 @@ function isNonEmptyPlainObject(value) {
|
|
|
11066
11178
|
}
|
|
11067
11179
|
var NESTED_INDENT = " ";
|
|
11068
11180
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
11069
|
-
const keys = Object.keys(data).filter((key) => !
|
|
11181
|
+
const keys = Object.keys(data).filter((key) => !isPlumbingKey(key));
|
|
11070
11182
|
if (keys.length === 0)
|
|
11071
11183
|
return;
|
|
11072
11184
|
const isBlockValue = (value) => isPlainObjectArray(value) || isNonEmptyPlainObject(value);
|
|
@@ -11097,7 +11209,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
11097
11209
|
function printResizableTable(data, logFn = console.log, externalLogValue, availableWidth, tableRowStyle) {
|
|
11098
11210
|
if (data.length === 0)
|
|
11099
11211
|
return;
|
|
11100
|
-
const keys = Object.keys(data[0]).filter((key) => !
|
|
11212
|
+
const keys = Object.keys(data[0]).filter((key) => !isPlumbingKey(key));
|
|
11101
11213
|
if (keys.length === 0)
|
|
11102
11214
|
return;
|
|
11103
11215
|
if (!process.stdout.isTTY) {
|
|
@@ -11171,6 +11283,220 @@ function printResizableTable(data, logFn = console.log, externalLogValue, availa
|
|
|
11171
11283
|
logFn(`Log: ${externalLogValue}`);
|
|
11172
11284
|
}
|
|
11173
11285
|
}
|
|
11286
|
+
var MARKDOWN_MAX_CELL = 200;
|
|
11287
|
+
var MARKDOWN_MAX_DEPTH = 3;
|
|
11288
|
+
function markdownHeading(depth) {
|
|
11289
|
+
return "#".repeat(Math.min(3 + depth, 6));
|
|
11290
|
+
}
|
|
11291
|
+
var BACKTICK_RUN = /`+/g;
|
|
11292
|
+
function fencedBlock(text) {
|
|
11293
|
+
const first = text.trimStart()[0];
|
|
11294
|
+
const language = first === "<" ? "xml" : first === "{" || first === "[" ? "json" : "";
|
|
11295
|
+
const longestRun = Math.max(0, ...Array.from(text.matchAll(BACKTICK_RUN), (match) => match[0].length));
|
|
11296
|
+
const fence = "`".repeat(Math.max(3, longestRun + 1));
|
|
11297
|
+
return `${fence}${language}
|
|
11298
|
+
${text}
|
|
11299
|
+
${fence}`;
|
|
11300
|
+
}
|
|
11301
|
+
function collapseNewlineRuns(text) {
|
|
11302
|
+
return text.split(/(\s+)/).map((part, index) => index % 2 === 1 && part.includes(`
|
|
11303
|
+
`) ? " " : part).join("");
|
|
11304
|
+
}
|
|
11305
|
+
function markdownCell(value) {
|
|
11306
|
+
const text = value instanceof Date ? value.toISOString() : cellToString(value);
|
|
11307
|
+
return collapseNewlineRuns(text).replace(/\|/g, "\\|");
|
|
11308
|
+
}
|
|
11309
|
+
function markdownLabel(key) {
|
|
11310
|
+
return collapseNewlineRuns(key).replace(/[\\`*|]/g, "\\$&");
|
|
11311
|
+
}
|
|
11312
|
+
function withoutPlumbing(record) {
|
|
11313
|
+
const kept = Object.create(null);
|
|
11314
|
+
for (const [key, value] of Object.entries(record)) {
|
|
11315
|
+
if (!isPlumbingKey(key))
|
|
11316
|
+
kept[key] = value;
|
|
11317
|
+
}
|
|
11318
|
+
return kept;
|
|
11319
|
+
}
|
|
11320
|
+
function rowsWithoutPlumbing(rows) {
|
|
11321
|
+
return rows.map((row) => isPlainRecord(row) ? withoutPlumbing(row) : row);
|
|
11322
|
+
}
|
|
11323
|
+
function markdownTable(rows) {
|
|
11324
|
+
const columns = [];
|
|
11325
|
+
const seen = new Set;
|
|
11326
|
+
for (const row of rows) {
|
|
11327
|
+
for (const key of Object.keys(row)) {
|
|
11328
|
+
if (!seen.has(key)) {
|
|
11329
|
+
seen.add(key);
|
|
11330
|
+
columns.push(key);
|
|
11331
|
+
}
|
|
11332
|
+
}
|
|
11333
|
+
}
|
|
11334
|
+
if (columns.length === 0)
|
|
11335
|
+
return null;
|
|
11336
|
+
const cells = rows.map((row) => columns.map((key) => markdownCell(row[key])));
|
|
11337
|
+
if (cells.some((row) => row.some((c) => c.length > MARKDOWN_MAX_CELL))) {
|
|
11338
|
+
return null;
|
|
11339
|
+
}
|
|
11340
|
+
return [
|
|
11341
|
+
`| ${columns.map(markdownLabel).join(" | ")} |`,
|
|
11342
|
+
`| ${columns.map(() => "---").join(" | ")} |`,
|
|
11343
|
+
...cells.map((row) => `| ${row.join(" | ")} |`)
|
|
11344
|
+
].join(`
|
|
11345
|
+
`);
|
|
11346
|
+
}
|
|
11347
|
+
function extractMessageSequence(rows) {
|
|
11348
|
+
const messages = [];
|
|
11349
|
+
for (const row of rows) {
|
|
11350
|
+
const message = extractSingleMessage(row);
|
|
11351
|
+
if (message === null)
|
|
11352
|
+
return null;
|
|
11353
|
+
messages.push(message);
|
|
11354
|
+
}
|
|
11355
|
+
return messages.join(`
|
|
11356
|
+
|
|
11357
|
+
`);
|
|
11358
|
+
}
|
|
11359
|
+
function markdownRows(rows, depth) {
|
|
11360
|
+
if (rows.length === 0)
|
|
11361
|
+
return "(none)";
|
|
11362
|
+
if (!isPlainObjectArray(rows)) {
|
|
11363
|
+
return rows.map((item) => `- ${markdownCell(item)}`).join(`
|
|
11364
|
+
`);
|
|
11365
|
+
}
|
|
11366
|
+
const prose = extractMessageSequence(rows);
|
|
11367
|
+
if (prose !== null)
|
|
11368
|
+
return prose;
|
|
11369
|
+
const table = markdownTable(rows);
|
|
11370
|
+
if (table !== null)
|
|
11371
|
+
return table;
|
|
11372
|
+
if (depth >= MARKDOWN_MAX_DEPTH) {
|
|
11373
|
+
return fencedBlock(JSON.stringify(rows, null, 2));
|
|
11374
|
+
}
|
|
11375
|
+
return rows.map((row, index) => [
|
|
11376
|
+
`${markdownHeading(depth)} ${index + 1}`,
|
|
11377
|
+
markdownObject(row, depth + 1)
|
|
11378
|
+
].join(`
|
|
11379
|
+
|
|
11380
|
+
`)).join(`
|
|
11381
|
+
|
|
11382
|
+
`);
|
|
11383
|
+
}
|
|
11384
|
+
function markdownObject(obj, depth) {
|
|
11385
|
+
const scalars = [];
|
|
11386
|
+
const blocks = [];
|
|
11387
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
11388
|
+
if (value === undefined)
|
|
11389
|
+
continue;
|
|
11390
|
+
const label = markdownLabel(key);
|
|
11391
|
+
if (Array.isArray(value)) {
|
|
11392
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
11393
|
+
|
|
11394
|
+
${markdownRows(value, depth + 1)}`);
|
|
11395
|
+
} else if (isNonEmptyPlainObject(value)) {
|
|
11396
|
+
const nested = depth < MARKDOWN_MAX_DEPTH ? markdownObject(value, depth + 1) : fencedBlock(JSON.stringify(value, null, 2));
|
|
11397
|
+
if (nested !== "") {
|
|
11398
|
+
blocks.push(`${markdownHeading(depth)} ${label}
|
|
11399
|
+
|
|
11400
|
+
${nested}`);
|
|
11401
|
+
}
|
|
11402
|
+
} else if (typeof value === "string" && value.includes(`
|
|
11403
|
+
`)) {
|
|
11404
|
+
blocks.push(`**${label}:**
|
|
11405
|
+
|
|
11406
|
+
${fencedBlock(value)}`);
|
|
11407
|
+
} else {
|
|
11408
|
+
scalars.push(`**${label}:** ${markdownCell(value)}`);
|
|
11409
|
+
}
|
|
11410
|
+
}
|
|
11411
|
+
const sections = scalars.length > 0 ? [scalars.join(`
|
|
11412
|
+
`)] : [];
|
|
11413
|
+
sections.push(...blocks);
|
|
11414
|
+
return sections.join(`
|
|
11415
|
+
|
|
11416
|
+
`);
|
|
11417
|
+
}
|
|
11418
|
+
function extractSingleMessage(payload) {
|
|
11419
|
+
if (!isPlainRecord(payload))
|
|
11420
|
+
return null;
|
|
11421
|
+
const keys = Object.keys(payload);
|
|
11422
|
+
if (keys.length !== 1 || keys[0].toLowerCase() !== "message")
|
|
11423
|
+
return null;
|
|
11424
|
+
const value = payload[keys[0]];
|
|
11425
|
+
return typeof value === "string" ? value : null;
|
|
11426
|
+
}
|
|
11427
|
+
function markdownPayload(payload) {
|
|
11428
|
+
const message = extractSingleMessage(payload);
|
|
11429
|
+
if (message !== null)
|
|
11430
|
+
return message;
|
|
11431
|
+
if (Array.isArray(payload)) {
|
|
11432
|
+
return markdownRows(rowsWithoutPlumbing(payload), 0);
|
|
11433
|
+
}
|
|
11434
|
+
const visible = withoutPlumbing(payload);
|
|
11435
|
+
const paged = splitPagedEnvelope(visible);
|
|
11436
|
+
if (paged !== null) {
|
|
11437
|
+
const meta = markdownObject(paged.meta, 0);
|
|
11438
|
+
const rows = `${markdownHeading(0)} ${markdownLabel(paged.key)}
|
|
11439
|
+
|
|
11440
|
+
${markdownRows(rowsWithoutPlumbing(paged.rows), 1)}`;
|
|
11441
|
+
return meta === "" ? rows : `${meta}
|
|
11442
|
+
|
|
11443
|
+
${rows}`;
|
|
11444
|
+
}
|
|
11445
|
+
return markdownObject(visible, 0);
|
|
11446
|
+
}
|
|
11447
|
+
function isPaginationWorthShowing(value) {
|
|
11448
|
+
if (typeof value !== "object" || value === null)
|
|
11449
|
+
return false;
|
|
11450
|
+
const page = value;
|
|
11451
|
+
return page.HasMore === true || typeof page.Offset === "number" && page.Offset > 0;
|
|
11452
|
+
}
|
|
11453
|
+
function markdownEnvelopeNotes(data) {
|
|
11454
|
+
const envelope = data;
|
|
11455
|
+
const notes = [];
|
|
11456
|
+
const warning = envelope.Warning;
|
|
11457
|
+
if (typeof warning === "string" && warning !== "") {
|
|
11458
|
+
notes.push(`> **Warning:** ${warning}`);
|
|
11459
|
+
}
|
|
11460
|
+
const instructions = envelope.Instructions;
|
|
11461
|
+
if (typeof instructions === "string" && instructions !== "") {
|
|
11462
|
+
notes.push(`> ${instructions}`);
|
|
11463
|
+
}
|
|
11464
|
+
const pagination = envelope.Pagination;
|
|
11465
|
+
if (isPaginationWorthShowing(pagination)) {
|
|
11466
|
+
const body = markdownObject(pagination, 1);
|
|
11467
|
+
if (body !== "") {
|
|
11468
|
+
notes.push(`${markdownHeading(0)} Pagination
|
|
11469
|
+
|
|
11470
|
+
${body}`);
|
|
11471
|
+
}
|
|
11472
|
+
}
|
|
11473
|
+
const log = envelope.Log;
|
|
11474
|
+
if (typeof log === "string" && log !== "") {
|
|
11475
|
+
notes.push(`**Log:** ${log}`);
|
|
11476
|
+
}
|
|
11477
|
+
return notes;
|
|
11478
|
+
}
|
|
11479
|
+
function renderMarkdown(data) {
|
|
11480
|
+
if (data.Result !== RESULTS.Success) {
|
|
11481
|
+
const failure = data;
|
|
11482
|
+
const sections = [`**Failed:** ${failure.Message}`];
|
|
11483
|
+
if (failure.Data != null) {
|
|
11484
|
+
sections.push(markdownPayload(failure.Data));
|
|
11485
|
+
}
|
|
11486
|
+
if (failure.Instructions) {
|
|
11487
|
+
sections.push(`> ${failure.Instructions}`);
|
|
11488
|
+
}
|
|
11489
|
+
return sections.filter((section) => section !== "").join(`
|
|
11490
|
+
|
|
11491
|
+
`);
|
|
11492
|
+
}
|
|
11493
|
+
if (!("Data" in data) || data.Data == null) {
|
|
11494
|
+
return markdownObject(withoutPlumbing(data), 0);
|
|
11495
|
+
}
|
|
11496
|
+
return [markdownPayload(data.Data), ...markdownEnvelopeNotes(data)].filter((section) => section !== "").join(`
|
|
11497
|
+
|
|
11498
|
+
`);
|
|
11499
|
+
}
|
|
11174
11500
|
function toYaml(data) {
|
|
11175
11501
|
const codec = getYamlCodec();
|
|
11176
11502
|
if (!codec) {
|
|
@@ -11223,6 +11549,20 @@ class FilterImplicitLimitError extends Error {
|
|
|
11223
11549
|
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).";
|
|
11224
11550
|
}
|
|
11225
11551
|
}
|
|
11552
|
+
|
|
11553
|
+
class ConfigurationError extends Error {
|
|
11554
|
+
__brand = "ConfigurationError";
|
|
11555
|
+
errorCode = "configuration_error";
|
|
11556
|
+
retry = "RetryWillNotFix";
|
|
11557
|
+
result = RESULTS.ConfigError;
|
|
11558
|
+
constructor(message) {
|
|
11559
|
+
super(message);
|
|
11560
|
+
this.name = "ConfigurationError";
|
|
11561
|
+
}
|
|
11562
|
+
}
|
|
11563
|
+
function isConfigurationError(error) {
|
|
11564
|
+
return typeof error === "object" && error !== null && "__brand" in error && error.__brand === "ConfigurationError";
|
|
11565
|
+
}
|
|
11226
11566
|
function applyFilter(data, filter) {
|
|
11227
11567
|
const codec = requireJmespath();
|
|
11228
11568
|
let result;
|
|
@@ -11949,18 +12289,17 @@ function extractCommandHelp(cmd, helper) {
|
|
|
11949
12289
|
}
|
|
11950
12290
|
return result;
|
|
11951
12291
|
}
|
|
11952
|
-
var VALID_FORMATS = ["table", "json", "yaml", "plain"];
|
|
11953
12292
|
function extractFormatFromArgs(args) {
|
|
11954
12293
|
for (let i = 0;i < args.length; i++) {
|
|
11955
12294
|
if (args[i] === "--output" && i + 1 < args.length) {
|
|
11956
12295
|
const value = args[i + 1];
|
|
11957
|
-
if (
|
|
12296
|
+
if (isOutputFormat(value)) {
|
|
11958
12297
|
return value;
|
|
11959
12298
|
}
|
|
11960
12299
|
}
|
|
11961
12300
|
if (args[i]?.startsWith("--output=")) {
|
|
11962
12301
|
const value = args[i].substring("--output=".length);
|
|
11963
|
-
if (
|
|
12302
|
+
if (isOutputFormat(value)) {
|
|
11964
12303
|
return value;
|
|
11965
12304
|
}
|
|
11966
12305
|
}
|
|
@@ -13459,6 +13798,7 @@ export {
|
|
|
13459
13798
|
CLI_ERROR_CODES,
|
|
13460
13799
|
CONFIG_FILENAME,
|
|
13461
13800
|
CommonTelemetryEvents,
|
|
13801
|
+
ConfigurationError,
|
|
13462
13802
|
ConsoleTelemetryProvider,
|
|
13463
13803
|
DEFAULT_AUTH_TIMEOUT_MS,
|
|
13464
13804
|
DEFAULT_BASE_URL,
|
|
@@ -13480,6 +13820,7 @@ export {
|
|
|
13480
13820
|
MAX_SPOOL_FILES,
|
|
13481
13821
|
MIN_INTERVAL_MS,
|
|
13482
13822
|
NodeContextStorage,
|
|
13823
|
+
OUTPUT_FORMATS,
|
|
13483
13824
|
OutputFormatter,
|
|
13484
13825
|
POLL_DEFAULTS,
|
|
13485
13826
|
Pagination,
|
|
@@ -13498,6 +13839,7 @@ export {
|
|
|
13498
13839
|
TELEMETRY_SESSION_SOURCE_PROPERTY,
|
|
13499
13840
|
TELEMETRY_TRACEPARENT_ENV,
|
|
13500
13841
|
TIMINGS_ENV_VAR,
|
|
13842
|
+
TIMINGS_FILE_ENV_VAR,
|
|
13501
13843
|
TIMINGS_LINE_PREFIX,
|
|
13502
13844
|
TelemetryService,
|
|
13503
13845
|
UIPATH_HOME_DIR,
|
|
@@ -13513,7 +13855,9 @@ export {
|
|
|
13513
13855
|
buildOrchestratorUrl,
|
|
13514
13856
|
buildSkillEventTelemetryAttribution,
|
|
13515
13857
|
canPrompt,
|
|
13858
|
+
carriedErrorCode,
|
|
13516
13859
|
carriedInstructions,
|
|
13860
|
+
carriedRetry,
|
|
13517
13861
|
catchError,
|
|
13518
13862
|
claimPendingSpoolFiles,
|
|
13519
13863
|
classifiedFailure,
|
|
@@ -13543,6 +13887,7 @@ export {
|
|
|
13543
13887
|
extractErrorMessage,
|
|
13544
13888
|
extractErrorMessageSync,
|
|
13545
13889
|
extractFormatFromArgs,
|
|
13890
|
+
extractSingleMessage,
|
|
13546
13891
|
findReservedNameError,
|
|
13547
13892
|
formatErrorChain,
|
|
13548
13893
|
formatTimingReport,
|
|
@@ -13581,9 +13926,11 @@ export {
|
|
|
13581
13926
|
invocationElapsedMs,
|
|
13582
13927
|
invocationStartedAt,
|
|
13583
13928
|
isCliErrorCode,
|
|
13929
|
+
isConfigurationError,
|
|
13584
13930
|
isFailureStatus,
|
|
13585
13931
|
isGuid,
|
|
13586
13932
|
isHtmlDocument,
|
|
13933
|
+
isOutputFormat,
|
|
13587
13934
|
isPreviewBuild,
|
|
13588
13935
|
isRetryHint,
|
|
13589
13936
|
isSuccessStatus,
|
|
@@ -13673,6 +14020,7 @@ export {
|
|
|
13673
14020
|
telemetryInit,
|
|
13674
14021
|
telemetryShutdownWithoutFlush,
|
|
13675
14022
|
timingsEnabled,
|
|
14023
|
+
timingsFile,
|
|
13676
14024
|
trackShipSucceeded,
|
|
13677
14025
|
unsupportedSolutionProjectType,
|
|
13678
14026
|
validateName,
|
|
@@ -13684,4 +14032,4 @@ export {
|
|
|
13684
14032
|
writeTelemetrySpoolFile
|
|
13685
14033
|
};
|
|
13686
14034
|
|
|
13687
|
-
//# debugId=
|
|
14035
|
+
//# debugId=1C8485A93560E50864756E2164756E21
|
package/dist/logger.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export declare function getLogFilePath(): string;
|
|
|
121
121
|
* // CLI entry point
|
|
122
122
|
* configureLogger({ sink: new TerminalSink() });
|
|
123
123
|
*
|
|
124
|
-
* // Browser entry point
|
|
124
|
+
* // Browser entry point (BrowserSink lives in packages/cli-browser)
|
|
125
125
|
* configureLogger({ sink: new BrowserSink() });
|
|
126
126
|
*
|
|
127
127
|
* // MCP — errors still surface via writeErr
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* OutputFormatter functions can apply them automatically without every
|
|
6
6
|
* command having to thread these values through.
|
|
7
7
|
*/
|
|
8
|
-
import type { OutputFormat } from "./
|
|
8
|
+
import type { OutputFormat } from "./output-formats";
|
|
9
9
|
/**
|
|
10
10
|
* Set the process-wide output format.
|
|
11
11
|
* Called once at CLI startup (from extractFormatFromArgs for early use via --output)
|