@uipath/traces-tool 1.1.0 → 1.195.0
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/tool.js +679 -119
- package/package.json +23 -30
package/dist/tool.js
CHANGED
|
@@ -667,6 +667,7 @@ var init_open = __esm(() => {
|
|
|
667
667
|
});
|
|
668
668
|
|
|
669
669
|
// ../filesystem/src/node.ts
|
|
670
|
+
import { randomUUID } from "node:crypto";
|
|
670
671
|
import { existsSync } from "node:fs";
|
|
671
672
|
import * as fs6 from "node:fs/promises";
|
|
672
673
|
import * as os2 from "node:os";
|
|
@@ -748,6 +749,90 @@ class NodeFileSystem {
|
|
|
748
749
|
async mkdir(dirPath) {
|
|
749
750
|
await fs6.mkdir(dirPath, { recursive: true });
|
|
750
751
|
}
|
|
752
|
+
async acquireLock(lockPath) {
|
|
753
|
+
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
754
|
+
const lockFile = `${canonicalPath}.lock`;
|
|
755
|
+
const ownerId = randomUUID();
|
|
756
|
+
const start = Date.now();
|
|
757
|
+
while (true) {
|
|
758
|
+
try {
|
|
759
|
+
await fs6.writeFile(lockFile, ownerId, { flag: "wx" });
|
|
760
|
+
return this.createLockRelease(lockFile, ownerId);
|
|
761
|
+
} catch (error) {
|
|
762
|
+
if (!this.hasErrnoCode(error, "EEXIST")) {
|
|
763
|
+
throw error;
|
|
764
|
+
}
|
|
765
|
+
const stats = await fs6.stat(lockFile).catch(() => null);
|
|
766
|
+
if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
|
|
767
|
+
const reclaimed = await fs6.rm(lockFile, { force: true }).then(() => true).catch(() => false);
|
|
768
|
+
if (reclaimed)
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
if (Date.now() - start > LOCK_MAX_WAIT_MS) {
|
|
772
|
+
throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
|
|
773
|
+
}
|
|
774
|
+
await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
async canonicalizeLockTarget(lockPath) {
|
|
779
|
+
const absolute = path2.resolve(lockPath);
|
|
780
|
+
const fullReal = await fs6.realpath(absolute).catch(() => null);
|
|
781
|
+
if (fullReal)
|
|
782
|
+
return fullReal;
|
|
783
|
+
const parent = path2.dirname(absolute);
|
|
784
|
+
const base = path2.basename(absolute);
|
|
785
|
+
const canonicalParent = await fs6.realpath(parent).catch(() => parent);
|
|
786
|
+
return path2.join(canonicalParent, base);
|
|
787
|
+
}
|
|
788
|
+
createLockRelease(lockFile, ownerId) {
|
|
789
|
+
const heartbeatStart = Date.now();
|
|
790
|
+
let heartbeatTimer;
|
|
791
|
+
let stopped = false;
|
|
792
|
+
const stopHeartbeat = () => {
|
|
793
|
+
stopped = true;
|
|
794
|
+
if (heartbeatTimer)
|
|
795
|
+
clearTimeout(heartbeatTimer);
|
|
796
|
+
};
|
|
797
|
+
const scheduleNextHeartbeat = () => {
|
|
798
|
+
if (stopped)
|
|
799
|
+
return;
|
|
800
|
+
if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
|
|
801
|
+
stopped = true;
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
heartbeatTimer = setTimeout(() => {
|
|
805
|
+
runHeartbeat();
|
|
806
|
+
}, LOCK_HEARTBEAT_MS);
|
|
807
|
+
heartbeatTimer.unref?.();
|
|
808
|
+
};
|
|
809
|
+
const runHeartbeat = async () => {
|
|
810
|
+
if (stopped)
|
|
811
|
+
return;
|
|
812
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
813
|
+
if (stopped)
|
|
814
|
+
return;
|
|
815
|
+
if (current !== ownerId) {
|
|
816
|
+
stopped = true;
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const now = Date.now() / 1000;
|
|
820
|
+
await fs6.utimes(lockFile, now, now).catch(() => {});
|
|
821
|
+
scheduleNextHeartbeat();
|
|
822
|
+
};
|
|
823
|
+
scheduleNextHeartbeat();
|
|
824
|
+
let released = false;
|
|
825
|
+
return async () => {
|
|
826
|
+
if (released)
|
|
827
|
+
return;
|
|
828
|
+
released = true;
|
|
829
|
+
stopHeartbeat();
|
|
830
|
+
const current = await fs6.readFile(lockFile, "utf-8").catch(() => null);
|
|
831
|
+
if (current === ownerId) {
|
|
832
|
+
await fs6.rm(lockFile, { force: true });
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
751
836
|
async rm(filePath) {
|
|
752
837
|
await fs6.rm(filePath, { recursive: true, force: true });
|
|
753
838
|
}
|
|
@@ -793,9 +878,13 @@ class NodeFileSystem {
|
|
|
793
878
|
}
|
|
794
879
|
}
|
|
795
880
|
isEnoent(error) {
|
|
796
|
-
return
|
|
881
|
+
return this.hasErrnoCode(error, "ENOENT");
|
|
882
|
+
}
|
|
883
|
+
hasErrnoCode(error, code) {
|
|
884
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
797
885
|
}
|
|
798
886
|
}
|
|
887
|
+
var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
|
|
799
888
|
var init_node = __esm(() => {
|
|
800
889
|
init_open();
|
|
801
890
|
});
|
|
@@ -2941,7 +3030,7 @@ function isBrowser() {
|
|
|
2941
3030
|
|
|
2942
3031
|
// ../../node_modules/@uipath/coreipc/index.js
|
|
2943
3032
|
var require_coreipc = __commonJS((exports, module) => {
|
|
2944
|
-
var __dirname = "/
|
|
3033
|
+
var __dirname = "/home/runner/work/cli/cli/node_modules/@uipath/coreipc";
|
|
2945
3034
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2946
3035
|
(function(e, t) {
|
|
2947
3036
|
typeof exports == "object" && typeof module == "object" ? module.exports = t() : typeof define == "function" && define.amd ? define([], t) : typeof exports == "object" ? exports.ipc = t() : e.ipc = t();
|
|
@@ -21133,10 +21222,15 @@ var require_dist = __commonJS((exports) => {
|
|
|
21133
21222
|
exports.RobotProxyConstructor = RobotProxyConstructor;
|
|
21134
21223
|
__exportStar(require_agent(), exports);
|
|
21135
21224
|
});
|
|
21225
|
+
// ../auth/src/server.ts
|
|
21226
|
+
var init_server = __esm(() => {
|
|
21227
|
+
init_constants();
|
|
21228
|
+
});
|
|
21136
21229
|
// package.json
|
|
21137
21230
|
var package_default = {
|
|
21138
21231
|
name: "@uipath/traces-tool",
|
|
21139
|
-
|
|
21232
|
+
license: "MIT",
|
|
21233
|
+
version: "1.195.0",
|
|
21140
21234
|
description: "Query execution traces for UiPath jobs",
|
|
21141
21235
|
private: false,
|
|
21142
21236
|
keywords: [
|
|
@@ -21308,10 +21402,15 @@ async function extractErrorDetails(error, options) {
|
|
|
21308
21402
|
}
|
|
21309
21403
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
21310
21404
|
context.errorCode = parsedBody.errorCode;
|
|
21405
|
+
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
21406
|
+
context.errorCode = parsedBody.code;
|
|
21311
21407
|
}
|
|
21312
21408
|
if (parsedBody?.requestId && typeof parsedBody.requestId === "string") {
|
|
21313
21409
|
context.requestId = parsedBody.requestId;
|
|
21314
21410
|
}
|
|
21411
|
+
if (parsedBody?.traceId && typeof parsedBody.traceId === "string") {
|
|
21412
|
+
context.traceId = parsedBody.traceId;
|
|
21413
|
+
}
|
|
21315
21414
|
if (status === 429) {
|
|
21316
21415
|
const resp = response;
|
|
21317
21416
|
const headersObj = resp?.headers;
|
|
@@ -21331,7 +21430,35 @@ async function extractErrorDetails(error, options) {
|
|
|
21331
21430
|
}
|
|
21332
21431
|
}
|
|
21333
21432
|
const hasContext = Object.keys(context).length > 0;
|
|
21334
|
-
|
|
21433
|
+
let parsedErrors;
|
|
21434
|
+
if (parsedBody?.errors && typeof parsedBody.errors === "object") {
|
|
21435
|
+
const errors = {};
|
|
21436
|
+
for (const [field, raw] of Object.entries(parsedBody.errors)) {
|
|
21437
|
+
if (Array.isArray(raw)) {
|
|
21438
|
+
const messages = raw.map((entry) => {
|
|
21439
|
+
if (typeof entry === "string")
|
|
21440
|
+
return entry;
|
|
21441
|
+
if (entry && typeof entry === "object" && typeof entry.message === "string") {
|
|
21442
|
+
return entry.message;
|
|
21443
|
+
}
|
|
21444
|
+
return String(entry);
|
|
21445
|
+
}).filter(Boolean);
|
|
21446
|
+
if (messages.length > 0)
|
|
21447
|
+
errors[field] = messages;
|
|
21448
|
+
} else if (typeof raw === "string") {
|
|
21449
|
+
errors[field] = [raw];
|
|
21450
|
+
}
|
|
21451
|
+
}
|
|
21452
|
+
if (Object.keys(errors).length > 0)
|
|
21453
|
+
parsedErrors = errors;
|
|
21454
|
+
}
|
|
21455
|
+
return {
|
|
21456
|
+
result,
|
|
21457
|
+
message,
|
|
21458
|
+
details,
|
|
21459
|
+
...hasContext ? { context } : {},
|
|
21460
|
+
...parsedErrors ? { parsedErrors } : {}
|
|
21461
|
+
};
|
|
21335
21462
|
}
|
|
21336
21463
|
async function extractErrorMessage(error, options) {
|
|
21337
21464
|
const { message } = await extractErrorDetails(error, options);
|
|
@@ -26478,6 +26605,60 @@ function escapeNonAscii(jsonText) {
|
|
|
26478
26605
|
function needsAsciiSafeJson(sink) {
|
|
26479
26606
|
return process.platform === "win32" && !sink.capabilities.isInteractive;
|
|
26480
26607
|
}
|
|
26608
|
+
function isPlainRecord(value) {
|
|
26609
|
+
if (value === null || typeof value !== "object")
|
|
26610
|
+
return false;
|
|
26611
|
+
const prototype = Object.getPrototypeOf(value);
|
|
26612
|
+
return prototype === Object.prototype || prototype === null;
|
|
26613
|
+
}
|
|
26614
|
+
function toLowerCamelCaseKey(key) {
|
|
26615
|
+
if (!key)
|
|
26616
|
+
return key;
|
|
26617
|
+
if (/[_\-\s]/.test(key)) {
|
|
26618
|
+
const [firstPart, ...restParts] = key.split(/[_\-\s]+/).filter(Boolean);
|
|
26619
|
+
if (!firstPart)
|
|
26620
|
+
return key;
|
|
26621
|
+
return [
|
|
26622
|
+
toLowerCamelCaseSimpleKey(firstPart),
|
|
26623
|
+
...restParts.map((part) => {
|
|
26624
|
+
const normalized = toLowerCamelCaseSimpleKey(part);
|
|
26625
|
+
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
|
26626
|
+
})
|
|
26627
|
+
].join("");
|
|
26628
|
+
}
|
|
26629
|
+
return toLowerCamelCaseSimpleKey(key);
|
|
26630
|
+
}
|
|
26631
|
+
function toLowerCamelCaseSimpleKey(key) {
|
|
26632
|
+
if (/^[A-Z0-9]+$/.test(key))
|
|
26633
|
+
return key.toLowerCase();
|
|
26634
|
+
return key.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/, (match) => match.toLowerCase());
|
|
26635
|
+
}
|
|
26636
|
+
function toPascalCaseKey(key) {
|
|
26637
|
+
const lowerCamelKey = toLowerCamelCaseKey(key);
|
|
26638
|
+
return lowerCamelKey ? lowerCamelKey.charAt(0).toUpperCase() + lowerCamelKey.slice(1) : lowerCamelKey;
|
|
26639
|
+
}
|
|
26640
|
+
function toPascalCaseData(value) {
|
|
26641
|
+
if (Array.isArray(value))
|
|
26642
|
+
return value.map(toPascalCaseData);
|
|
26643
|
+
if (!isPlainRecord(value))
|
|
26644
|
+
return value;
|
|
26645
|
+
const result = {};
|
|
26646
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
26647
|
+
result[toPascalCaseKey(key)] = toPascalCaseData(nestedValue);
|
|
26648
|
+
}
|
|
26649
|
+
return result;
|
|
26650
|
+
}
|
|
26651
|
+
function normalizeDataKeys(data) {
|
|
26652
|
+
return toPascalCaseData(data);
|
|
26653
|
+
}
|
|
26654
|
+
function normalizeOutputKeys(data) {
|
|
26655
|
+
const result = {};
|
|
26656
|
+
for (const [key, value] of Object.entries(data)) {
|
|
26657
|
+
const pascalKey = toPascalCaseKey(key);
|
|
26658
|
+
result[pascalKey] = pascalKey === "Data" ? value : toPascalCaseData(value);
|
|
26659
|
+
}
|
|
26660
|
+
return result;
|
|
26661
|
+
}
|
|
26481
26662
|
function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
26482
26663
|
if (!data) {
|
|
26483
26664
|
logFn("Empty response object. No data to display.");
|
|
@@ -26540,7 +26721,7 @@ function wrapText(text, width) {
|
|
|
26540
26721
|
function printTable(data, logFn, externalLogValue) {
|
|
26541
26722
|
if (data.length === 0)
|
|
26542
26723
|
return;
|
|
26543
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
26724
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
26544
26725
|
const maxWidths = keys.map((key) => Math.max(key.length, ...data.map((item) => cellToString(item[key]).length)));
|
|
26545
26726
|
const header = keys.map((key, i2) => key.padEnd(maxWidths[i2])).join(" | ");
|
|
26546
26727
|
logFn(header);
|
|
@@ -26555,7 +26736,7 @@ function printTable(data, logFn, externalLogValue) {
|
|
|
26555
26736
|
}
|
|
26556
26737
|
}
|
|
26557
26738
|
function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
26558
|
-
const keys = Object.keys(data).filter((key) =>
|
|
26739
|
+
const keys = Object.keys(data).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
26559
26740
|
if (keys.length === 0)
|
|
26560
26741
|
return;
|
|
26561
26742
|
const maxKeyWidth = Math.max(...keys.map((key) => key.length));
|
|
@@ -26571,7 +26752,7 @@ function printVerticalTable(data, logFn = console.log, externalLogValue) {
|
|
|
26571
26752
|
function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
26572
26753
|
if (data.length === 0)
|
|
26573
26754
|
return;
|
|
26574
|
-
const keys = Object.keys(data[0]).filter((key) =>
|
|
26755
|
+
const keys = Object.keys(data[0]).filter((key) => !["code", "log"].includes(key.toLowerCase()));
|
|
26575
26756
|
if (keys.length === 0)
|
|
26576
26757
|
return;
|
|
26577
26758
|
if (!process.stdout.isTTY) {
|
|
@@ -26647,8 +26828,26 @@ function printResizableTable(data, logFn = console.log, externalLogValue) {
|
|
|
26647
26828
|
function toYaml(data) {
|
|
26648
26829
|
return dump(data);
|
|
26649
26830
|
}
|
|
26831
|
+
class FilterEvaluationError extends Error {
|
|
26832
|
+
__brand = "FilterEvaluationError";
|
|
26833
|
+
filter;
|
|
26834
|
+
instructions;
|
|
26835
|
+
result = RESULTS.ValidationError;
|
|
26836
|
+
constructor(filter, cause) {
|
|
26837
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
26838
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
26839
|
+
this.name = "FilterEvaluationError";
|
|
26840
|
+
this.filter = filter;
|
|
26841
|
+
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
26842
|
+
}
|
|
26843
|
+
}
|
|
26650
26844
|
function applyFilter(data, filter) {
|
|
26651
|
-
|
|
26845
|
+
let result;
|
|
26846
|
+
try {
|
|
26847
|
+
result = search(data, filter);
|
|
26848
|
+
} catch (err) {
|
|
26849
|
+
throw new FilterEvaluationError(filter, err);
|
|
26850
|
+
}
|
|
26652
26851
|
if (result == null)
|
|
26653
26852
|
return [];
|
|
26654
26853
|
if (Array.isArray(result)) {
|
|
@@ -26665,13 +26864,18 @@ function applyFilter(data, filter) {
|
|
|
26665
26864
|
}
|
|
26666
26865
|
var OutputFormatter;
|
|
26667
26866
|
((OutputFormatter) => {
|
|
26668
|
-
function success(data) {
|
|
26867
|
+
function success(data, options) {
|
|
26669
26868
|
data.Log ??= getLogFilePath() || undefined;
|
|
26869
|
+
const normalize = !options?.preserveDataKeys;
|
|
26870
|
+
if (normalize) {
|
|
26871
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
26872
|
+
}
|
|
26670
26873
|
const filter = getOutputFilter();
|
|
26671
26874
|
if (filter) {
|
|
26672
|
-
|
|
26875
|
+
const filtered = applyFilter(data.Data, filter);
|
|
26876
|
+
data.Data = normalize ? normalizeDataKeys(filtered) : filtered;
|
|
26673
26877
|
}
|
|
26674
|
-
logOutput(data, getOutputFormat());
|
|
26878
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
26675
26879
|
}
|
|
26676
26880
|
OutputFormatter.success = success;
|
|
26677
26881
|
function error(data) {
|
|
@@ -26681,7 +26885,7 @@ var OutputFormatter;
|
|
|
26681
26885
|
result: data.Result,
|
|
26682
26886
|
message: data.Message
|
|
26683
26887
|
});
|
|
26684
|
-
logOutput(data, getOutputFormat());
|
|
26888
|
+
logOutput(normalizeOutputKeys(data), getOutputFormat());
|
|
26685
26889
|
}
|
|
26686
26890
|
OutputFormatter.error = error;
|
|
26687
26891
|
function emitList(code, items, opts) {
|
|
@@ -26702,13 +26906,14 @@ var OutputFormatter;
|
|
|
26702
26906
|
function log(data) {
|
|
26703
26907
|
const format = getOutputFormat();
|
|
26704
26908
|
const sink = getOutputSink();
|
|
26909
|
+
const normalized = toPascalCaseData(data);
|
|
26705
26910
|
if (format === "json") {
|
|
26706
|
-
const json2 = JSON.stringify(
|
|
26911
|
+
const json2 = JSON.stringify(normalized);
|
|
26707
26912
|
const safe = needsAsciiSafeJson(sink) ? escapeNonAscii(json2) : json2;
|
|
26708
26913
|
sink.writeErr(`${safe}
|
|
26709
26914
|
`);
|
|
26710
26915
|
} else {
|
|
26711
|
-
for (const [key, value] of Object.entries(
|
|
26916
|
+
for (const [key, value] of Object.entries(normalized)) {
|
|
26712
26917
|
sink.writeErr(`${key}: ${value}
|
|
26713
26918
|
`);
|
|
26714
26919
|
}
|
|
@@ -26717,12 +26922,16 @@ var OutputFormatter;
|
|
|
26717
26922
|
OutputFormatter.log = log;
|
|
26718
26923
|
function formatToString(data) {
|
|
26719
26924
|
const filter = getOutputFilter();
|
|
26720
|
-
if (
|
|
26721
|
-
data.Data =
|
|
26925
|
+
if ("Data" in data && data.Data != null) {
|
|
26926
|
+
data.Data = normalizeDataKeys(data.Data);
|
|
26927
|
+
if (filter) {
|
|
26928
|
+
data.Data = normalizeDataKeys(applyFilter(data.Data, filter));
|
|
26929
|
+
}
|
|
26722
26930
|
}
|
|
26931
|
+
const output = normalizeOutputKeys(data);
|
|
26723
26932
|
const lines = [];
|
|
26724
26933
|
const sink = getOutputSink();
|
|
26725
|
-
printOutput(
|
|
26934
|
+
printOutput(output, getOutputFormat(), (msg) => {
|
|
26726
26935
|
lines.push(msg);
|
|
26727
26936
|
}, needsAsciiSafeJson(sink));
|
|
26728
26937
|
return lines.join(`
|
|
@@ -28173,6 +28382,22 @@ function warnDeprecatedTenantOption(tenant) {
|
|
|
28173
28382
|
return;
|
|
28174
28383
|
warnDeprecatedOptionAlias("--tenant", TENANT_SWITCH_COMMAND);
|
|
28175
28384
|
}
|
|
28385
|
+
// ../common/src/polling/types.ts
|
|
28386
|
+
var PollOutcome = {
|
|
28387
|
+
Completed: "completed",
|
|
28388
|
+
Timeout: "timeout",
|
|
28389
|
+
Interrupted: "interrupted",
|
|
28390
|
+
Aborted: "aborted",
|
|
28391
|
+
Failed: "failed"
|
|
28392
|
+
};
|
|
28393
|
+
|
|
28394
|
+
// ../common/src/polling/poll-failure-mapping.ts
|
|
28395
|
+
var REASON_BY_OUTCOME = {
|
|
28396
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
28397
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
28398
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
28399
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
28400
|
+
};
|
|
28176
28401
|
// ../common/src/polling/terminal-statuses.ts
|
|
28177
28402
|
var TERMINAL_STATUSES = new Set([
|
|
28178
28403
|
"completed",
|
|
@@ -28200,6 +28425,105 @@ var ScreenLogger;
|
|
|
28200
28425
|
}
|
|
28201
28426
|
ScreenLogger.progress = progress;
|
|
28202
28427
|
})(ScreenLogger ||= {});
|
|
28428
|
+
// ../common/src/sdk-user-agent.ts
|
|
28429
|
+
var USER_AGENT_HEADER = "User-Agent";
|
|
28430
|
+
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
28431
|
+
function userAgentPatchKey(userAgent) {
|
|
28432
|
+
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
28433
|
+
}
|
|
28434
|
+
function splitUserAgentTokens(value) {
|
|
28435
|
+
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
28436
|
+
}
|
|
28437
|
+
function appendUserAgentToken(value, userAgent) {
|
|
28438
|
+
const tokens = splitUserAgentTokens(value);
|
|
28439
|
+
const seen = new Set(tokens);
|
|
28440
|
+
for (const token of splitUserAgentTokens(userAgent)) {
|
|
28441
|
+
if (!seen.has(token)) {
|
|
28442
|
+
tokens.push(token);
|
|
28443
|
+
seen.add(token);
|
|
28444
|
+
}
|
|
28445
|
+
}
|
|
28446
|
+
return tokens.join(" ");
|
|
28447
|
+
}
|
|
28448
|
+
function getEffectiveUserAgent(userAgent) {
|
|
28449
|
+
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
28450
|
+
}
|
|
28451
|
+
function isHeadersLike(headers) {
|
|
28452
|
+
return typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function" && "set" in headers && typeof headers.set === "function";
|
|
28453
|
+
}
|
|
28454
|
+
function getSdkUserAgentToken(pkg) {
|
|
28455
|
+
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
28456
|
+
return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
|
|
28457
|
+
}
|
|
28458
|
+
function addSdkUserAgentHeader(headers, userAgent) {
|
|
28459
|
+
const result = { ...headers ?? {} };
|
|
28460
|
+
const effectiveUserAgent = getEffectiveUserAgent(userAgent);
|
|
28461
|
+
const headerName = Object.keys(result).find((key) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
28462
|
+
if (headerName) {
|
|
28463
|
+
result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
|
|
28464
|
+
} else {
|
|
28465
|
+
result[USER_AGENT_HEADER] = effectiveUserAgent;
|
|
28466
|
+
}
|
|
28467
|
+
return result;
|
|
28468
|
+
}
|
|
28469
|
+
function withSdkUserAgentHeader(headers, userAgent) {
|
|
28470
|
+
const effectiveUserAgent = getEffectiveUserAgent(userAgent);
|
|
28471
|
+
if (isHeadersLike(headers)) {
|
|
28472
|
+
headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
|
|
28473
|
+
return headers;
|
|
28474
|
+
}
|
|
28475
|
+
if (Array.isArray(headers)) {
|
|
28476
|
+
const result = headers.map((entry) => {
|
|
28477
|
+
const [key, value] = entry;
|
|
28478
|
+
return [key, value];
|
|
28479
|
+
});
|
|
28480
|
+
const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
28481
|
+
if (headerIndex >= 0) {
|
|
28482
|
+
const [key, value] = result[headerIndex];
|
|
28483
|
+
result[headerIndex] = [
|
|
28484
|
+
key,
|
|
28485
|
+
appendUserAgentToken(value, effectiveUserAgent)
|
|
28486
|
+
];
|
|
28487
|
+
} else {
|
|
28488
|
+
result.push([USER_AGENT_HEADER, effectiveUserAgent]);
|
|
28489
|
+
}
|
|
28490
|
+
return result;
|
|
28491
|
+
}
|
|
28492
|
+
return addSdkUserAgentHeader(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
|
|
28493
|
+
}
|
|
28494
|
+
function withUserAgentInitOverride(initOverrides, userAgent) {
|
|
28495
|
+
return async (requestContext) => {
|
|
28496
|
+
const initWithUserAgent = {
|
|
28497
|
+
...requestContext.init,
|
|
28498
|
+
headers: withSdkUserAgentHeader(requestContext.init.headers, userAgent)
|
|
28499
|
+
};
|
|
28500
|
+
const override = typeof initOverrides === "function" ? await initOverrides({
|
|
28501
|
+
...requestContext,
|
|
28502
|
+
init: initWithUserAgent
|
|
28503
|
+
}) : initOverrides;
|
|
28504
|
+
return {
|
|
28505
|
+
...override ?? {},
|
|
28506
|
+
headers: withSdkUserAgentHeader(override?.headers ?? initWithUserAgent.headers, userAgent)
|
|
28507
|
+
};
|
|
28508
|
+
};
|
|
28509
|
+
}
|
|
28510
|
+
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
28511
|
+
const prototype = BaseApiClass.prototype;
|
|
28512
|
+
const patchKey = userAgentPatchKey(userAgent);
|
|
28513
|
+
if (prototype[patchKey]) {
|
|
28514
|
+
return;
|
|
28515
|
+
}
|
|
28516
|
+
if (typeof prototype.request !== "function") {
|
|
28517
|
+
throw new Error("Generated BaseAPI request function not found.");
|
|
28518
|
+
}
|
|
28519
|
+
const originalRequest = prototype.request;
|
|
28520
|
+
prototype.request = function requestWithUserAgent(context, initOverrides) {
|
|
28521
|
+
return originalRequest.call(this, context, withUserAgentInitOverride(initOverrides, userAgent));
|
|
28522
|
+
};
|
|
28523
|
+
Object.defineProperty(prototype, patchKey, {
|
|
28524
|
+
value: true
|
|
28525
|
+
});
|
|
28526
|
+
}
|
|
28203
28527
|
// ../common/src/tool-provider.ts
|
|
28204
28528
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
28205
28529
|
// ../common/src/telemetry/pii-redactor.ts
|
|
@@ -28382,13 +28706,17 @@ Command.prototype.trackedAction = function(context, fn, properties) {
|
|
|
28382
28706
|
const [error] = await catchError(fn(...args));
|
|
28383
28707
|
if (error) {
|
|
28384
28708
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
28385
|
-
logger.
|
|
28709
|
+
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
28710
|
+
const typed = error;
|
|
28711
|
+
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
28712
|
+
const customResult = typeof typed.result === "string" && typed.result !== RESULTS.Success && Object.values(RESULTS).includes(typed.result) ? typed.result : undefined;
|
|
28713
|
+
const finalResult = customResult ?? RESULTS.Failure;
|
|
28386
28714
|
OutputFormatter.error({
|
|
28387
|
-
Result:
|
|
28715
|
+
Result: finalResult,
|
|
28388
28716
|
Message: errorMessage,
|
|
28389
|
-
Instructions: "An unexpected error occurred. Run with --log-level debug for details."
|
|
28717
|
+
Instructions: customInstructions ?? "An unexpected error occurred. Run with --log-level debug for details."
|
|
28390
28718
|
});
|
|
28391
|
-
context.exit(
|
|
28719
|
+
context.exit(EXIT_CODES[finalResult]);
|
|
28392
28720
|
}
|
|
28393
28721
|
const durationMs = performance.now() - startTime;
|
|
28394
28722
|
const success = !error && (process.exitCode === undefined || process.exitCode === 0);
|
|
@@ -28425,32 +28753,7 @@ class InvalidBaseUrlError extends Error {
|
|
|
28425
28753
|
this.name = "InvalidBaseUrlError";
|
|
28426
28754
|
}
|
|
28427
28755
|
}
|
|
28428
|
-
var DEFAULT_SCOPES = [
|
|
28429
|
-
"offline_access",
|
|
28430
|
-
"ProcessMining",
|
|
28431
|
-
"OrchestratorApiUserAccess",
|
|
28432
|
-
"StudioWebBackend",
|
|
28433
|
-
"IdentityServerApi",
|
|
28434
|
-
"ConnectionService",
|
|
28435
|
-
"DataService",
|
|
28436
|
-
"DataServiceApiUserAccess",
|
|
28437
|
-
"DocumentUnderstanding",
|
|
28438
|
-
"EnterpriseContextService",
|
|
28439
|
-
"Directory",
|
|
28440
|
-
"JamJamApi",
|
|
28441
|
-
"LLMGateway",
|
|
28442
|
-
"LLMOps",
|
|
28443
|
-
"OMS",
|
|
28444
|
-
"RCS.FolderAuthorization",
|
|
28445
|
-
"RCS.TagsManagement",
|
|
28446
|
-
"TestmanagerApiUserAccess",
|
|
28447
|
-
"AutomationSolutions",
|
|
28448
|
-
"StudioWebTypeCacheService",
|
|
28449
|
-
"Docs.GPT.Search",
|
|
28450
|
-
"Insights",
|
|
28451
|
-
"ReferenceToken",
|
|
28452
|
-
"Audit.Read"
|
|
28453
|
-
];
|
|
28756
|
+
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
28454
28757
|
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
28455
28758
|
let baseUrl = rawUrl;
|
|
28456
28759
|
if (baseUrl.endsWith("/identity_/")) {
|
|
@@ -28500,7 +28803,8 @@ var resolveConfigAsync = async ({
|
|
|
28500
28803
|
if (!clientSecret && fileAuth.clientSecret) {
|
|
28501
28804
|
clientSecret = fileAuth.clientSecret;
|
|
28502
28805
|
}
|
|
28503
|
-
const
|
|
28806
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
28807
|
+
const scopes = customScopes && customScopes.length > 0 ? customScopes : fileAuth.scopes && fileAuth.scopes.length > 0 ? fileAuth.scopes : isExternalAppAuth ? [] : DEFAULT_SCOPES;
|
|
28504
28808
|
return {
|
|
28505
28809
|
clientId,
|
|
28506
28810
|
clientSecret,
|
|
@@ -29000,6 +29304,129 @@ function normalizeTokenRefreshFailure() {
|
|
|
29000
29304
|
function normalizeTokenRefreshUnavailableFailure() {
|
|
29001
29305
|
return "token refresh failed before authentication completed";
|
|
29002
29306
|
}
|
|
29307
|
+
function errorMessage(error) {
|
|
29308
|
+
return error instanceof Error ? error.message : String(error);
|
|
29309
|
+
}
|
|
29310
|
+
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
29311
|
+
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
29312
|
+
}
|
|
29313
|
+
async function runRefreshLocked(inputs) {
|
|
29314
|
+
const {
|
|
29315
|
+
absolutePath,
|
|
29316
|
+
refreshToken: callerRefreshToken,
|
|
29317
|
+
customAuthority,
|
|
29318
|
+
ensureTokenValidityMinutes,
|
|
29319
|
+
loadEnvFile,
|
|
29320
|
+
saveEnvFile,
|
|
29321
|
+
refreshFn,
|
|
29322
|
+
resolveConfig
|
|
29323
|
+
} = inputs;
|
|
29324
|
+
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
29325
|
+
let fresh;
|
|
29326
|
+
try {
|
|
29327
|
+
fresh = await loadEnvFile({ envPath: absolutePath });
|
|
29328
|
+
} catch (error) {
|
|
29329
|
+
return {
|
|
29330
|
+
kind: "fail",
|
|
29331
|
+
status: {
|
|
29332
|
+
loginStatus: "Refresh Failed",
|
|
29333
|
+
hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
|
|
29334
|
+
tokenRefresh: {
|
|
29335
|
+
attempted: false,
|
|
29336
|
+
success: false,
|
|
29337
|
+
errorMessage: `auth file read failed: ${errorMessage(error)}`
|
|
29338
|
+
}
|
|
29339
|
+
}
|
|
29340
|
+
};
|
|
29341
|
+
}
|
|
29342
|
+
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
29343
|
+
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
29344
|
+
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
29345
|
+
return {
|
|
29346
|
+
kind: "ok",
|
|
29347
|
+
accessToken: freshAccess,
|
|
29348
|
+
refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
|
|
29349
|
+
expiration: freshExp,
|
|
29350
|
+
tokenRefresh: { attempted: false, success: true }
|
|
29351
|
+
};
|
|
29352
|
+
}
|
|
29353
|
+
const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
|
|
29354
|
+
let refreshedAccess;
|
|
29355
|
+
let refreshedRefresh;
|
|
29356
|
+
try {
|
|
29357
|
+
const config = await resolveConfig({ customAuthority });
|
|
29358
|
+
const refreshed = await refreshFn({
|
|
29359
|
+
refreshToken: tokenForIdP,
|
|
29360
|
+
tokenEndpoint: config.tokenEndpoint,
|
|
29361
|
+
clientId: config.clientId,
|
|
29362
|
+
expectedAuthority: customAuthority
|
|
29363
|
+
});
|
|
29364
|
+
refreshedAccess = refreshed.accessToken;
|
|
29365
|
+
refreshedRefresh = refreshed.refreshToken;
|
|
29366
|
+
} catch (error) {
|
|
29367
|
+
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
29368
|
+
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
29369
|
+
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
29370
|
+
return {
|
|
29371
|
+
kind: "fail",
|
|
29372
|
+
status: {
|
|
29373
|
+
loginStatus: "Refresh Failed",
|
|
29374
|
+
hint,
|
|
29375
|
+
tokenRefresh: {
|
|
29376
|
+
attempted: true,
|
|
29377
|
+
success: false,
|
|
29378
|
+
errorMessage: message
|
|
29379
|
+
}
|
|
29380
|
+
}
|
|
29381
|
+
};
|
|
29382
|
+
}
|
|
29383
|
+
const refreshedExp = getTokenExpiration(refreshedAccess);
|
|
29384
|
+
if (!refreshedExp || refreshedExp <= new Date) {
|
|
29385
|
+
return {
|
|
29386
|
+
kind: "fail",
|
|
29387
|
+
status: {
|
|
29388
|
+
loginStatus: "Refresh Failed",
|
|
29389
|
+
hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
|
|
29390
|
+
tokenRefresh: {
|
|
29391
|
+
attempted: true,
|
|
29392
|
+
success: false,
|
|
29393
|
+
errorMessage: "refreshed token has no valid expiration claim"
|
|
29394
|
+
}
|
|
29395
|
+
}
|
|
29396
|
+
};
|
|
29397
|
+
}
|
|
29398
|
+
try {
|
|
29399
|
+
await saveEnvFile({
|
|
29400
|
+
envPath: absolutePath,
|
|
29401
|
+
data: {
|
|
29402
|
+
UIPATH_ACCESS_TOKEN: refreshedAccess,
|
|
29403
|
+
UIPATH_REFRESH_TOKEN: refreshedRefresh
|
|
29404
|
+
},
|
|
29405
|
+
merge: true
|
|
29406
|
+
});
|
|
29407
|
+
return {
|
|
29408
|
+
kind: "ok",
|
|
29409
|
+
accessToken: refreshedAccess,
|
|
29410
|
+
refreshToken: refreshedRefresh,
|
|
29411
|
+
expiration: refreshedExp,
|
|
29412
|
+
tokenRefresh: { attempted: true, success: true }
|
|
29413
|
+
};
|
|
29414
|
+
} catch (error) {
|
|
29415
|
+
const msg = errorMessage(error);
|
|
29416
|
+
return {
|
|
29417
|
+
kind: "ok",
|
|
29418
|
+
accessToken: refreshedAccess,
|
|
29419
|
+
refreshToken: refreshedRefresh,
|
|
29420
|
+
expiration: refreshedExp,
|
|
29421
|
+
persistenceWarning: `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,
|
|
29422
|
+
tokenRefresh: {
|
|
29423
|
+
attempted: true,
|
|
29424
|
+
success: true,
|
|
29425
|
+
errorMessage: `persistence failed: ${msg}`
|
|
29426
|
+
}
|
|
29427
|
+
};
|
|
29428
|
+
}
|
|
29429
|
+
}
|
|
29003
29430
|
var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
29004
29431
|
const {
|
|
29005
29432
|
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
@@ -29074,73 +29501,103 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
29074
29501
|
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
29075
29502
|
let expiration = getTokenExpiration(accessToken);
|
|
29076
29503
|
let persistenceWarning;
|
|
29504
|
+
let lockReleaseFailed = false;
|
|
29077
29505
|
let tokenRefresh;
|
|
29078
|
-
const
|
|
29079
|
-
|
|
29080
|
-
|
|
29081
|
-
|
|
29506
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
29507
|
+
const tryGlobalCredsHint = async () => {
|
|
29508
|
+
const fs7 = getFs();
|
|
29509
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
29510
|
+
if (absolutePath === globalPath)
|
|
29511
|
+
return;
|
|
29512
|
+
if (!await fs7.exists(globalPath))
|
|
29513
|
+
return;
|
|
29082
29514
|
try {
|
|
29083
|
-
const
|
|
29084
|
-
|
|
29085
|
-
|
|
29086
|
-
const
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
refreshedAccess = refreshed.accessToken;
|
|
29093
|
-
refreshedRefresh = refreshed.refreshToken;
|
|
29094
|
-
} catch (error) {
|
|
29095
|
-
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
29096
|
-
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
29097
|
-
const errorMessage = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
29098
|
-
return {
|
|
29099
|
-
loginStatus: "Refresh Failed",
|
|
29100
|
-
hint,
|
|
29101
|
-
tokenRefresh: {
|
|
29102
|
-
attempted: true,
|
|
29103
|
-
success: false,
|
|
29104
|
-
errorMessage
|
|
29105
|
-
}
|
|
29106
|
-
};
|
|
29515
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
29516
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
29517
|
+
return;
|
|
29518
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
29519
|
+
if (globalExp && globalExp <= new Date)
|
|
29520
|
+
return;
|
|
29521
|
+
return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
29522
|
+
} catch {
|
|
29523
|
+
return;
|
|
29107
29524
|
}
|
|
29108
|
-
|
|
29109
|
-
|
|
29525
|
+
};
|
|
29526
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
29527
|
+
let release;
|
|
29528
|
+
try {
|
|
29529
|
+
release = await getFs().acquireLock(absolutePath);
|
|
29530
|
+
} catch (error) {
|
|
29531
|
+
const msg = errorMessage(error);
|
|
29532
|
+
const globalHint = await tryGlobalCredsHint();
|
|
29533
|
+
if (globalHint) {
|
|
29534
|
+
return {
|
|
29535
|
+
loginStatus: "Expired",
|
|
29536
|
+
accessToken,
|
|
29537
|
+
refreshToken,
|
|
29538
|
+
baseUrl: credentials.UIPATH_URL,
|
|
29539
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
29540
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
29541
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
29542
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
29543
|
+
expiration,
|
|
29544
|
+
source: "file" /* File */,
|
|
29545
|
+
hint: globalHint,
|
|
29546
|
+
tokenRefresh: {
|
|
29547
|
+
attempted: false,
|
|
29548
|
+
success: false,
|
|
29549
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
29550
|
+
}
|
|
29551
|
+
};
|
|
29552
|
+
}
|
|
29110
29553
|
return {
|
|
29111
29554
|
loginStatus: "Refresh Failed",
|
|
29112
|
-
hint: "
|
|
29555
|
+
hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
|
|
29113
29556
|
tokenRefresh: {
|
|
29114
|
-
attempted:
|
|
29557
|
+
attempted: false,
|
|
29115
29558
|
success: false,
|
|
29116
|
-
errorMessage:
|
|
29559
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
29117
29560
|
}
|
|
29118
29561
|
};
|
|
29119
29562
|
}
|
|
29120
|
-
|
|
29121
|
-
refreshToken = refreshedRefresh;
|
|
29122
|
-
expiration = refreshedExp;
|
|
29563
|
+
let lockedFailure;
|
|
29123
29564
|
try {
|
|
29124
|
-
await
|
|
29125
|
-
|
|
29126
|
-
|
|
29127
|
-
|
|
29128
|
-
|
|
29129
|
-
|
|
29130
|
-
|
|
29565
|
+
const outcome = await runRefreshLocked({
|
|
29566
|
+
absolutePath,
|
|
29567
|
+
refreshToken,
|
|
29568
|
+
customAuthority: credentials.UIPATH_URL,
|
|
29569
|
+
ensureTokenValidityMinutes,
|
|
29570
|
+
loadEnvFile,
|
|
29571
|
+
saveEnvFile,
|
|
29572
|
+
refreshFn: refreshTokenFn,
|
|
29573
|
+
resolveConfig
|
|
29131
29574
|
});
|
|
29132
|
-
|
|
29133
|
-
|
|
29134
|
-
|
|
29135
|
-
|
|
29136
|
-
|
|
29137
|
-
|
|
29138
|
-
|
|
29139
|
-
|
|
29140
|
-
|
|
29141
|
-
|
|
29142
|
-
|
|
29143
|
-
|
|
29575
|
+
if (outcome.kind === "fail") {
|
|
29576
|
+
lockedFailure = outcome.status;
|
|
29577
|
+
} else {
|
|
29578
|
+
accessToken = outcome.accessToken;
|
|
29579
|
+
refreshToken = outcome.refreshToken;
|
|
29580
|
+
expiration = outcome.expiration;
|
|
29581
|
+
tokenRefresh = outcome.tokenRefresh;
|
|
29582
|
+
if (outcome.persistenceWarning) {
|
|
29583
|
+
persistenceWarning = outcome.persistenceWarning;
|
|
29584
|
+
}
|
|
29585
|
+
}
|
|
29586
|
+
} finally {
|
|
29587
|
+
try {
|
|
29588
|
+
await release();
|
|
29589
|
+
} catch {
|
|
29590
|
+
lockReleaseFailed = true;
|
|
29591
|
+
}
|
|
29592
|
+
}
|
|
29593
|
+
if (lockedFailure) {
|
|
29594
|
+
const globalHint = await tryGlobalCredsHint();
|
|
29595
|
+
const base = globalHint ? {
|
|
29596
|
+
...lockedFailure,
|
|
29597
|
+
loginStatus: "Expired",
|
|
29598
|
+
hint: globalHint
|
|
29599
|
+
} : lockedFailure;
|
|
29600
|
+
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
29144
29601
|
}
|
|
29145
29602
|
}
|
|
29146
29603
|
const result = {
|
|
@@ -29155,23 +29612,13 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
|
29155
29612
|
expiration,
|
|
29156
29613
|
source: "file" /* File */,
|
|
29157
29614
|
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
29615
|
+
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
29158
29616
|
...tokenRefresh ? { tokenRefresh } : {}
|
|
29159
29617
|
};
|
|
29160
29618
|
if (result.loginStatus === "Expired") {
|
|
29161
|
-
const
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
try {
|
|
29165
|
-
const globalCreds = await loadEnvFile({
|
|
29166
|
-
envPath: globalPath
|
|
29167
|
-
});
|
|
29168
|
-
if (globalCreds.UIPATH_ACCESS_TOKEN) {
|
|
29169
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
29170
|
-
if (!globalExp || globalExp > new Date) {
|
|
29171
|
-
result.hint = `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
29172
|
-
}
|
|
29173
|
-
}
|
|
29174
|
-
} catch {}
|
|
29619
|
+
const globalHint = await tryGlobalCredsHint();
|
|
29620
|
+
if (globalHint) {
|
|
29621
|
+
result.hint = globalHint;
|
|
29175
29622
|
}
|
|
29176
29623
|
}
|
|
29177
29624
|
return result;
|
|
@@ -29219,6 +29666,10 @@ var getAuthContext = async (options = {}) => {
|
|
|
29219
29666
|
init_src();
|
|
29220
29667
|
// ../auth/src/logout.ts
|
|
29221
29668
|
init_src();
|
|
29669
|
+
|
|
29670
|
+
// ../auth/src/index.ts
|
|
29671
|
+
init_server();
|
|
29672
|
+
|
|
29222
29673
|
// src/services/feedback-service.ts
|
|
29223
29674
|
var GUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
29224
29675
|
var ZERO_GUID = "00000000-0000-0000-0000-000000000000";
|
|
@@ -30189,6 +30640,62 @@ class TextApiResponse {
|
|
|
30189
30640
|
return await this.raw.text();
|
|
30190
30641
|
}
|
|
30191
30642
|
}
|
|
30643
|
+
// ../orchestrator-sdk/package.json
|
|
30644
|
+
var package_default2 = {
|
|
30645
|
+
name: "@uipath/orchestrator-sdk",
|
|
30646
|
+
license: "MIT",
|
|
30647
|
+
version: "1.2.0",
|
|
30648
|
+
repository: {
|
|
30649
|
+
type: "git",
|
|
30650
|
+
url: "https://github.com/UiPath/cli.git",
|
|
30651
|
+
directory: "packages/orchestrator-sdk"
|
|
30652
|
+
},
|
|
30653
|
+
publishConfig: {
|
|
30654
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
30655
|
+
},
|
|
30656
|
+
keywords: [
|
|
30657
|
+
"uipath",
|
|
30658
|
+
"orchestrator",
|
|
30659
|
+
"sdk"
|
|
30660
|
+
],
|
|
30661
|
+
type: "module",
|
|
30662
|
+
main: "./dist/index.js",
|
|
30663
|
+
types: "./dist/src/index.d.ts",
|
|
30664
|
+
exports: {
|
|
30665
|
+
".": {
|
|
30666
|
+
browser: {
|
|
30667
|
+
types: "./dist/src/index.browser.d.ts",
|
|
30668
|
+
default: "./dist/index.browser.js"
|
|
30669
|
+
},
|
|
30670
|
+
default: {
|
|
30671
|
+
types: "./dist/src/index.d.ts",
|
|
30672
|
+
default: "./dist/index.js"
|
|
30673
|
+
}
|
|
30674
|
+
}
|
|
30675
|
+
},
|
|
30676
|
+
files: [
|
|
30677
|
+
"dist"
|
|
30678
|
+
],
|
|
30679
|
+
private: true,
|
|
30680
|
+
scripts: {
|
|
30681
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node && bun build ./src/index.browser.ts --outdir dist --format esm --target browser --external @uipath/auth --external @uipath/common && tsc -p tsconfig.build.json --noCheck",
|
|
30682
|
+
generate: "bun run src/scripts/generate-sdk.ts",
|
|
30683
|
+
lint: "biome check .",
|
|
30684
|
+
test: "vitest run",
|
|
30685
|
+
"test:coverage": "vitest run --coverage"
|
|
30686
|
+
},
|
|
30687
|
+
devDependencies: {
|
|
30688
|
+
"@uipath/auth": "workspace:*",
|
|
30689
|
+
"@uipath/common": "workspace:*",
|
|
30690
|
+
"@openapitools/openapi-generator-cli": "^2.31.1",
|
|
30691
|
+
"@types/node": "^25.5.2",
|
|
30692
|
+
typescript: "^6.0.2"
|
|
30693
|
+
}
|
|
30694
|
+
};
|
|
30695
|
+
|
|
30696
|
+
// ../orchestrator-sdk/src/user-agent.ts
|
|
30697
|
+
var SDK_USER_AGENT = getSdkUserAgentToken(package_default2);
|
|
30698
|
+
installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
|
|
30192
30699
|
// ../orchestrator-sdk/generated/src/models/SimpleFolderDto.ts
|
|
30193
30700
|
function SimpleFolderDtoFromJSON(json2) {
|
|
30194
30701
|
return SimpleFolderDtoFromJSONTyped(json2, false);
|
|
@@ -31735,6 +32242,20 @@ function PageResultDtoOfCurrentUserFolderDtoFromJSONTyped(json2, ignoreDiscrimin
|
|
|
31735
32242
|
count: json2["Count"] == null ? undefined : json2["Count"]
|
|
31736
32243
|
};
|
|
31737
32244
|
}
|
|
32245
|
+
// ../orchestrator-sdk/generated/src/models/PersonalWorkspaceFolder.ts
|
|
32246
|
+
function PersonalWorkspaceFolderFromJSON(json2) {
|
|
32247
|
+
return PersonalWorkspaceFolderFromJSONTyped(json2, false);
|
|
32248
|
+
}
|
|
32249
|
+
function PersonalWorkspaceFolderFromJSONTyped(json2, ignoreDiscriminator) {
|
|
32250
|
+
if (json2 == null) {
|
|
32251
|
+
return json2;
|
|
32252
|
+
}
|
|
32253
|
+
return {
|
|
32254
|
+
id: json2["id"] == null ? undefined : json2["id"],
|
|
32255
|
+
key: json2["key"] == null ? undefined : json2["key"],
|
|
32256
|
+
fullyQualifiedName: json2["fullyQualifiedName"] == null ? undefined : json2["fullyQualifiedName"]
|
|
32257
|
+
};
|
|
32258
|
+
}
|
|
31738
32259
|
// ../orchestrator-sdk/generated/src/models/RemoveMachinesFromFolderRequest.ts
|
|
31739
32260
|
function RemoveMachinesFromFolderRequestToJSON(json2) {
|
|
31740
32261
|
return RemoveMachinesFromFolderRequestToJSONTyped(json2, false);
|
|
@@ -31785,6 +32306,20 @@ function ResourcePaginationResultOfFolderFromJSONTyped(json2, ignoreDiscriminato
|
|
|
31785
32306
|
cursor: json2["cursor"] == null ? undefined : json2["cursor"]
|
|
31786
32307
|
};
|
|
31787
32308
|
}
|
|
32309
|
+
// ../orchestrator-sdk/generated/src/models/ResourcePaginationResultOfPersonalWorkspaceFolder.ts
|
|
32310
|
+
function ResourcePaginationResultOfPersonalWorkspaceFolderFromJSON(json2) {
|
|
32311
|
+
return ResourcePaginationResultOfPersonalWorkspaceFolderFromJSONTyped(json2, false);
|
|
32312
|
+
}
|
|
32313
|
+
function ResourcePaginationResultOfPersonalWorkspaceFolderFromJSONTyped(json2, ignoreDiscriminator) {
|
|
32314
|
+
if (json2 == null) {
|
|
32315
|
+
return json2;
|
|
32316
|
+
}
|
|
32317
|
+
return {
|
|
32318
|
+
count: json2["count"] == null ? undefined : json2["count"],
|
|
32319
|
+
data: json2["data"] == null ? undefined : json2["data"].map(PersonalWorkspaceFolderFromJSON),
|
|
32320
|
+
cursor: json2["cursor"] == null ? undefined : json2["cursor"]
|
|
32321
|
+
};
|
|
32322
|
+
}
|
|
31788
32323
|
// ../orchestrator-sdk/generated/src/models/RestartJobRequest.ts
|
|
31789
32324
|
function RestartJobRequestToJSON(json2) {
|
|
31790
32325
|
return RestartJobRequestToJSONTyped(json2, false);
|
|
@@ -32204,6 +32739,31 @@ class FoldersApi extends BaseAPI {
|
|
|
32204
32739
|
const response = await this.foldersGetAllForCurrentUserRaw(requestParameters, initOverrides);
|
|
32205
32740
|
return await response.value();
|
|
32206
32741
|
}
|
|
32742
|
+
async foldersGetAllPersonalWorkspaceFoldersRaw(requestParameters, initOverrides) {
|
|
32743
|
+
const queryParameters = {};
|
|
32744
|
+
if (requestParameters["limit"] != null) {
|
|
32745
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
32746
|
+
}
|
|
32747
|
+
if (requestParameters["cursor"] != null) {
|
|
32748
|
+
queryParameters["cursor"] = requestParameters["cursor"];
|
|
32749
|
+
}
|
|
32750
|
+
const headerParameters = {};
|
|
32751
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
32752
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
|
|
32753
|
+
}
|
|
32754
|
+
let urlPath = `/api/Folders/GetAllPersonalWorkspaceFolders`;
|
|
32755
|
+
const response = await this.request({
|
|
32756
|
+
path: urlPath,
|
|
32757
|
+
method: "GET",
|
|
32758
|
+
headers: headerParameters,
|
|
32759
|
+
query: queryParameters
|
|
32760
|
+
}, initOverrides);
|
|
32761
|
+
return new JSONApiResponse(response, (jsonValue) => ResourcePaginationResultOfPersonalWorkspaceFolderFromJSON(jsonValue));
|
|
32762
|
+
}
|
|
32763
|
+
async foldersGetAllPersonalWorkspaceFolders(requestParameters = {}, initOverrides) {
|
|
32764
|
+
const response = await this.foldersGetAllPersonalWorkspaceFoldersRaw(requestParameters, initOverrides);
|
|
32765
|
+
return await response.value();
|
|
32766
|
+
}
|
|
32207
32767
|
async foldersGetAllRolesForUserByUsernameAndSkipAndTakeRaw(requestParameters, initOverrides) {
|
|
32208
32768
|
if (requestParameters["username"] == null) {
|
|
32209
32769
|
throw new RequiredError("username", 'Required parameter "username" was null or undefined when calling foldersGetAllRolesForUserByUsernameAndSkipAndTake().');
|
|
@@ -33836,9 +34396,9 @@ async function createOrchestratorConfig(options) {
|
|
|
33836
34396
|
requireTenantName: true
|
|
33837
34397
|
});
|
|
33838
34398
|
const orchestratorBasePath = `${ctx.baseUrl}/${ctx.organizationId}/${ctx.tenantName}/orchestrator_`;
|
|
33839
|
-
const headers = {
|
|
34399
|
+
const headers = addSdkUserAgentHeader({
|
|
33840
34400
|
Authorization: `Bearer ${ctx.accessToken}`
|
|
33841
|
-
};
|
|
34401
|
+
}, SDK_USER_AGENT);
|
|
33842
34402
|
if (options?.folderId) {
|
|
33843
34403
|
headers["X-UIPATH-OrganizationUnitId"] = options.folderId;
|
|
33844
34404
|
} else if (options?.folderKey && options?.folderPath) {
|
package/package.json
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"commander": "^14.0.3",
|
|
26
|
-
"typescript": "^6.0.2"
|
|
27
|
-
},
|
|
28
|
-
"publishConfig": {
|
|
29
|
-
"registry": "https://registry.npmjs.org/"
|
|
30
|
-
},
|
|
31
|
-
"gitHead": "06e8c8f566df4b87da4a008635483c62f64f33f0"
|
|
2
|
+
"name": "@uipath/traces-tool",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "1.195.0",
|
|
5
|
+
"description": "Query execution traces for UiPath jobs",
|
|
6
|
+
"private": false,
|
|
7
|
+
"keywords": [
|
|
8
|
+
"cli-tool"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/tool.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/tool.js"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"traces-tool": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"registry": "https://registry.npmjs.org/"
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "65fabb84552758b2710d8ca68470e70a9b1d19bc"
|
|
32
25
|
}
|