@uipath/ixp-sdk 1.205.0-preview.281 → 1.206.0-preview.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +235 -149
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
2
|
+
var __esm = (fn, res, err) => () => {
|
|
3
|
+
if (fn)
|
|
4
|
+
try {
|
|
5
|
+
res = fn(fn = 0);
|
|
6
|
+
} catch (e) {
|
|
7
|
+
err = [e];
|
|
8
|
+
}
|
|
9
|
+
if (err)
|
|
10
|
+
throw err[0];
|
|
11
|
+
return res;
|
|
15
12
|
};
|
|
16
|
-
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
17
13
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
18
14
|
|
|
19
15
|
// ../auth/src/catch-error.ts
|
|
@@ -400,12 +396,6 @@ var init_is_in_ssh = __esm(() => {
|
|
|
400
396
|
});
|
|
401
397
|
|
|
402
398
|
// ../../node_modules/open/index.js
|
|
403
|
-
var exports_open = {};
|
|
404
|
-
__export(exports_open, {
|
|
405
|
-
apps: () => apps,
|
|
406
|
-
default: () => open_default,
|
|
407
|
-
openApp: () => openApp
|
|
408
|
-
});
|
|
409
399
|
import process8 from "node:process";
|
|
410
400
|
import path from "node:path";
|
|
411
401
|
import { fileURLToPath } from "node:url";
|
|
@@ -639,21 +629,6 @@ var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform, arch, tryEach
|
|
|
639
629
|
...options,
|
|
640
630
|
target
|
|
641
631
|
});
|
|
642
|
-
}, openApp = (name, options) => {
|
|
643
|
-
if (typeof name !== "string" && !Array.isArray(name)) {
|
|
644
|
-
throw new TypeError("Expected a valid `name`");
|
|
645
|
-
}
|
|
646
|
-
const { arguments: appArguments = [] } = options ?? {};
|
|
647
|
-
if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
|
|
648
|
-
throw new TypeError("Expected `appArguments` as Array type");
|
|
649
|
-
}
|
|
650
|
-
return baseOpen({
|
|
651
|
-
...options,
|
|
652
|
-
app: {
|
|
653
|
-
name,
|
|
654
|
-
arguments: appArguments
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
632
|
}, apps, open_default;
|
|
658
633
|
var init_open = __esm(() => {
|
|
659
634
|
init_wsl_utils();
|
|
@@ -710,7 +685,7 @@ var init_open = __esm(() => {
|
|
|
710
685
|
});
|
|
711
686
|
|
|
712
687
|
// ../filesystem/src/node.ts
|
|
713
|
-
import { randomUUID } from "node:crypto";
|
|
688
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
714
689
|
import { existsSync } from "node:fs";
|
|
715
690
|
import * as fs6 from "node:fs/promises";
|
|
716
691
|
import * as os2 from "node:os";
|
|
@@ -733,16 +708,16 @@ class NodeFileSystem {
|
|
|
733
708
|
};
|
|
734
709
|
utils = {
|
|
735
710
|
open: async (url) => {
|
|
736
|
-
|
|
737
|
-
await
|
|
711
|
+
await Promise.resolve().then(() => init_open());
|
|
712
|
+
await open_default(url);
|
|
738
713
|
}
|
|
739
714
|
};
|
|
740
|
-
async readFile(
|
|
715
|
+
async readFile(path, options) {
|
|
741
716
|
try {
|
|
742
717
|
if (options) {
|
|
743
|
-
return await fs6.readFile(
|
|
718
|
+
return await fs6.readFile(path, "utf-8");
|
|
744
719
|
}
|
|
745
|
-
return await fs6.readFile(
|
|
720
|
+
return await fs6.readFile(path);
|
|
746
721
|
} catch (error) {
|
|
747
722
|
if (this.isEnoent(error))
|
|
748
723
|
return null;
|
|
@@ -772,6 +747,15 @@ class NodeFileSystem {
|
|
|
772
747
|
throw error;
|
|
773
748
|
}
|
|
774
749
|
}
|
|
750
|
+
async readdirEntries(dirPath) {
|
|
751
|
+
try {
|
|
752
|
+
return await fs6.readdir(dirPath, { withFileTypes: true });
|
|
753
|
+
} catch (error) {
|
|
754
|
+
if (this.isEnoent(error))
|
|
755
|
+
return [];
|
|
756
|
+
throw error;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
775
759
|
async stat(filePath) {
|
|
776
760
|
try {
|
|
777
761
|
const stats = await fs6.stat(filePath);
|
|
@@ -779,7 +763,8 @@ class NodeFileSystem {
|
|
|
779
763
|
isFile: () => stats.isFile(),
|
|
780
764
|
isDirectory: () => stats.isDirectory(),
|
|
781
765
|
size: stats.size,
|
|
782
|
-
mtimeMs: stats.mtimeMs
|
|
766
|
+
mtimeMs: stats.mtimeMs,
|
|
767
|
+
ctimeMs: stats.ctimeMs
|
|
783
768
|
};
|
|
784
769
|
} catch (error) {
|
|
785
770
|
if (this.isEnoent(error))
|
|
@@ -893,6 +878,42 @@ class NodeFileSystem {
|
|
|
893
878
|
throw error;
|
|
894
879
|
}
|
|
895
880
|
}
|
|
881
|
+
async hashFile(filePath) {
|
|
882
|
+
let handle;
|
|
883
|
+
try {
|
|
884
|
+
handle = await fs6.open(filePath, "r");
|
|
885
|
+
} catch (error) {
|
|
886
|
+
if (this.isEnoent(error))
|
|
887
|
+
return null;
|
|
888
|
+
throw error;
|
|
889
|
+
}
|
|
890
|
+
const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
|
|
891
|
+
try {
|
|
892
|
+
const opened = await handle.stat();
|
|
893
|
+
const stats = {
|
|
894
|
+
isFile: () => opened.isFile(),
|
|
895
|
+
isDirectory: () => opened.isDirectory(),
|
|
896
|
+
size: opened.size,
|
|
897
|
+
mtimeMs: opened.mtimeMs,
|
|
898
|
+
ctimeMs: opened.ctimeMs
|
|
899
|
+
};
|
|
900
|
+
const hash = createHash("sha256");
|
|
901
|
+
let size = 0;
|
|
902
|
+
for (;; ) {
|
|
903
|
+
const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
|
|
904
|
+
if (bytesRead === 0)
|
|
905
|
+
break;
|
|
906
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
907
|
+
size += bytesRead;
|
|
908
|
+
}
|
|
909
|
+
return { sha256: hash.digest("hex"), size, stats };
|
|
910
|
+
} finally {
|
|
911
|
+
if (hashBuffers.length < HASH_BUFFERS_KEPT) {
|
|
912
|
+
hashBuffers.push(buffer);
|
|
913
|
+
}
|
|
914
|
+
await handle.close();
|
|
915
|
+
}
|
|
916
|
+
}
|
|
896
917
|
async realpath(filePath) {
|
|
897
918
|
try {
|
|
898
919
|
return await fs6.realpath(filePath);
|
|
@@ -938,8 +959,11 @@ class NodeFileSystem {
|
|
|
938
959
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
939
960
|
}
|
|
940
961
|
}
|
|
941
|
-
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;
|
|
942
|
-
var init_node = () => {
|
|
962
|
+
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, HASH_CHUNK_BYTES, hashBuffers, HASH_BUFFERS_KEPT = 64;
|
|
963
|
+
var init_node = __esm(() => {
|
|
964
|
+
HASH_CHUNK_BYTES = 256 * 1024;
|
|
965
|
+
hashBuffers = [];
|
|
966
|
+
});
|
|
943
967
|
// ../filesystem/src/index.ts
|
|
944
968
|
var fsInstance, getFileSystem = () => fsInstance;
|
|
945
969
|
var init_src = __esm(() => {
|
|
@@ -1104,8 +1128,8 @@ function resolveAuthProfileFilePath(profile) {
|
|
|
1104
1128
|
if (normalized === undefined) {
|
|
1105
1129
|
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
1106
1130
|
}
|
|
1107
|
-
const
|
|
1108
|
-
return
|
|
1131
|
+
const fs = getFileSystem();
|
|
1132
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
1109
1133
|
}
|
|
1110
1134
|
function getActiveAuthProfileFilePath() {
|
|
1111
1135
|
const profile = getActiveAuthProfile();
|
|
@@ -1277,6 +1301,8 @@ var ENV_AUTH_VARS = {
|
|
|
1277
1301
|
};
|
|
1278
1302
|
|
|
1279
1303
|
class EnvAuthConfigError extends Error {
|
|
1304
|
+
errorCode = "configuration_error";
|
|
1305
|
+
retry = "RetryWillNotFix";
|
|
1280
1306
|
constructor(message) {
|
|
1281
1307
|
super(message);
|
|
1282
1308
|
this.name = "EnvAuthConfigError";
|
|
@@ -1315,11 +1341,11 @@ var readAuthFromEnv = () => {
|
|
|
1315
1341
|
if (!rawUrl) {
|
|
1316
1342
|
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
|
|
1317
1343
|
}
|
|
1318
|
-
const
|
|
1344
|
+
const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
1319
1345
|
return {
|
|
1320
1346
|
loginStatus: "Logged in",
|
|
1321
1347
|
accessToken,
|
|
1322
|
-
baseUrl
|
|
1348
|
+
baseUrl,
|
|
1323
1349
|
organizationName,
|
|
1324
1350
|
organizationId,
|
|
1325
1351
|
tenantName,
|
|
@@ -1371,9 +1397,9 @@ function breakerPathFor(authPath) {
|
|
|
1371
1397
|
return `${authPath}${BREAKER_SUFFIX}`;
|
|
1372
1398
|
}
|
|
1373
1399
|
async function loadRefreshBreaker(authPath) {
|
|
1374
|
-
const
|
|
1400
|
+
const fs = getFileSystem();
|
|
1375
1401
|
try {
|
|
1376
|
-
const content = await
|
|
1402
|
+
const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
|
|
1377
1403
|
if (!content)
|
|
1378
1404
|
return {};
|
|
1379
1405
|
const parsed = JSON.parse(content);
|
|
@@ -1384,20 +1410,20 @@ async function loadRefreshBreaker(authPath) {
|
|
|
1384
1410
|
}
|
|
1385
1411
|
async function saveRefreshBreaker(authPath, state) {
|
|
1386
1412
|
try {
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1389
|
-
await
|
|
1390
|
-
const tempPath = `${
|
|
1391
|
-
await
|
|
1392
|
-
await
|
|
1413
|
+
const fs = getFileSystem();
|
|
1414
|
+
const path = breakerPathFor(authPath);
|
|
1415
|
+
await fs.mkdir(fs.path.dirname(path));
|
|
1416
|
+
const tempPath = `${path}.tmp`;
|
|
1417
|
+
await fs.writeFile(tempPath, JSON.stringify(state));
|
|
1418
|
+
await fs.rename(tempPath, path);
|
|
1393
1419
|
} catch {}
|
|
1394
1420
|
}
|
|
1395
1421
|
async function clearRefreshBreaker(authPath) {
|
|
1396
|
-
const
|
|
1397
|
-
const
|
|
1422
|
+
const fs = getFileSystem();
|
|
1423
|
+
const path = breakerPathFor(authPath);
|
|
1398
1424
|
try {
|
|
1399
|
-
if (await
|
|
1400
|
-
await
|
|
1425
|
+
if (await fs.exists(path)) {
|
|
1426
|
+
await fs.rm(path);
|
|
1401
1427
|
}
|
|
1402
1428
|
} catch {}
|
|
1403
1429
|
}
|
|
@@ -1419,13 +1445,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
|
1419
1445
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
1420
1446
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
1421
1447
|
var getRobotIpcPipeNames = async () => {
|
|
1422
|
-
const
|
|
1423
|
-
const username =
|
|
1448
|
+
const fs = getFileSystem();
|
|
1449
|
+
const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
|
|
1424
1450
|
if (!username) {
|
|
1425
1451
|
throw new Error("Unable to determine current username");
|
|
1426
1452
|
}
|
|
1427
|
-
const tempPath =
|
|
1428
|
-
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) =>
|
|
1453
|
+
const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
|
|
1454
|
+
return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
|
|
1429
1455
|
};
|
|
1430
1456
|
var defaultIsRobotIpcAvailable = async () => {
|
|
1431
1457
|
if (process.platform === "win32") {
|
|
@@ -1435,20 +1461,20 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
1435
1461
|
if (pipeNamesError || !pipeNames) {
|
|
1436
1462
|
return false;
|
|
1437
1463
|
}
|
|
1438
|
-
const
|
|
1464
|
+
const fs = getFileSystem();
|
|
1439
1465
|
for (const pipeName of pipeNames) {
|
|
1440
|
-
const [existsError, exists] = await catchError(
|
|
1466
|
+
const [existsError, exists] = await catchError(fs.exists(pipeName));
|
|
1441
1467
|
if (!existsError && exists === true) {
|
|
1442
1468
|
return true;
|
|
1443
1469
|
}
|
|
1444
1470
|
}
|
|
1445
1471
|
return false;
|
|
1446
1472
|
};
|
|
1447
|
-
var withTimeout = (promise, timeoutMs) => new Promise((
|
|
1473
|
+
var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
1448
1474
|
const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
1449
1475
|
promise.then((value) => {
|
|
1450
1476
|
clearTimeout(timer);
|
|
1451
|
-
|
|
1477
|
+
resolve(value);
|
|
1452
1478
|
}, (error) => {
|
|
1453
1479
|
clearTimeout(timer);
|
|
1454
1480
|
reject(error);
|
|
@@ -1621,9 +1647,12 @@ var refreshAccessToken = async ({
|
|
|
1621
1647
|
body: tokenParams
|
|
1622
1648
|
});
|
|
1623
1649
|
const tokenData = await tokenResponse.json();
|
|
1624
|
-
if (
|
|
1650
|
+
if (tokenResponse.status === 400 || tokenResponse.status === 401) {
|
|
1625
1651
|
throw new TokenRefreshOAuthError;
|
|
1626
1652
|
}
|
|
1653
|
+
if (!tokenResponse.ok) {
|
|
1654
|
+
throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
|
|
1655
|
+
}
|
|
1627
1656
|
const newAccessToken = tokenData.access_token;
|
|
1628
1657
|
const newRefreshToken = tokenData.refresh_token;
|
|
1629
1658
|
if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
|
|
@@ -1657,9 +1686,9 @@ var errorCode = (err) => {
|
|
|
1657
1686
|
}
|
|
1658
1687
|
return "EUNKNOWN";
|
|
1659
1688
|
};
|
|
1660
|
-
var probeAsync = async (
|
|
1689
|
+
var probeAsync = async (fs, candidate) => {
|
|
1661
1690
|
try {
|
|
1662
|
-
const stats = await
|
|
1691
|
+
const stats = await fs.stat(candidate);
|
|
1663
1692
|
if (stats === null) {
|
|
1664
1693
|
return { exists: false };
|
|
1665
1694
|
}
|
|
@@ -1686,36 +1715,36 @@ var probeAsync = async (fs7, candidate) => {
|
|
|
1686
1715
|
}
|
|
1687
1716
|
};
|
|
1688
1717
|
var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1691
|
-
const
|
|
1692
|
-
return
|
|
1718
|
+
const fs = getFileSystem();
|
|
1719
|
+
if (fs.path.isAbsolute(envFilePath)) {
|
|
1720
|
+
const probe = await probeAsync(fs, envFilePath);
|
|
1721
|
+
return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
|
|
1693
1722
|
exists: false,
|
|
1694
1723
|
absolutePath: envFilePath,
|
|
1695
1724
|
source: "absolute",
|
|
1696
|
-
...
|
|
1725
|
+
...probe.unusable ? { unusable: probe.unusable } : {}
|
|
1697
1726
|
};
|
|
1698
1727
|
}
|
|
1699
|
-
const cwd = opts?.cwd ??
|
|
1728
|
+
const cwd = opts?.cwd ?? fs.env.cwd();
|
|
1700
1729
|
let searchDir = cwd;
|
|
1701
1730
|
while (true) {
|
|
1702
|
-
const candidate =
|
|
1703
|
-
const
|
|
1704
|
-
if (
|
|
1731
|
+
const candidate = fs.path.join(searchDir, envFilePath);
|
|
1732
|
+
const probe = await probeAsync(fs, candidate);
|
|
1733
|
+
if (probe.exists) {
|
|
1705
1734
|
return {
|
|
1706
1735
|
exists: true,
|
|
1707
1736
|
absolutePath: candidate,
|
|
1708
1737
|
source: searchDir === cwd ? "cwd" : "ancestor"
|
|
1709
1738
|
};
|
|
1710
1739
|
}
|
|
1711
|
-
const parentDir =
|
|
1740
|
+
const parentDir = fs.path.dirname(searchDir);
|
|
1712
1741
|
if (parentDir === searchDir) {
|
|
1713
1742
|
break;
|
|
1714
1743
|
}
|
|
1715
1744
|
searchDir = parentDir;
|
|
1716
1745
|
}
|
|
1717
|
-
const homePath =
|
|
1718
|
-
const probe = await probeAsync(
|
|
1746
|
+
const homePath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
1747
|
+
const probe = await probeAsync(fs, homePath);
|
|
1719
1748
|
if (probe.exists) {
|
|
1720
1749
|
return { exists: true, absolutePath: homePath, source: "home" };
|
|
1721
1750
|
}
|
|
@@ -1758,12 +1787,12 @@ var parseEnvContent = (content) => {
|
|
|
1758
1787
|
return env;
|
|
1759
1788
|
};
|
|
1760
1789
|
var loadEnvFileAsync = async ({ envPath }) => {
|
|
1761
|
-
const
|
|
1762
|
-
const absolutePath =
|
|
1763
|
-
if (!await
|
|
1790
|
+
const fs = getFileSystem();
|
|
1791
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
|
|
1792
|
+
if (!await fs.exists(absolutePath)) {
|
|
1764
1793
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
1765
1794
|
}
|
|
1766
|
-
const content = await
|
|
1795
|
+
const content = await fs.readFile(absolutePath, "utf-8");
|
|
1767
1796
|
if (content === null) {
|
|
1768
1797
|
throw new Error(`Environment file not found: ${envPath}`);
|
|
1769
1798
|
}
|
|
@@ -1774,10 +1803,10 @@ var saveEnvFileAsync = async ({
|
|
|
1774
1803
|
data,
|
|
1775
1804
|
merge = true
|
|
1776
1805
|
}) => {
|
|
1777
|
-
const
|
|
1778
|
-
const absolutePath =
|
|
1806
|
+
const fs = getFileSystem();
|
|
1807
|
+
const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
|
|
1779
1808
|
let existingData = {};
|
|
1780
|
-
if (merge && await
|
|
1809
|
+
if (merge && await fs.exists(absolutePath)) {
|
|
1781
1810
|
try {
|
|
1782
1811
|
existingData = await loadEnvFileAsync({ envPath: absolutePath });
|
|
1783
1812
|
} catch {}
|
|
@@ -1795,11 +1824,11 @@ var saveEnvFileAsync = async ({
|
|
|
1795
1824
|
const content = `${lines.join(`
|
|
1796
1825
|
`)}
|
|
1797
1826
|
`;
|
|
1798
|
-
const dir =
|
|
1799
|
-
await
|
|
1827
|
+
const dir = fs.path.dirname(absolutePath);
|
|
1828
|
+
await fs.mkdir(dir);
|
|
1800
1829
|
const tempPath = `${absolutePath}.tmp`;
|
|
1801
|
-
await
|
|
1802
|
-
await
|
|
1830
|
+
await fs.writeFile(tempPath, content);
|
|
1831
|
+
await fs.rename(tempPath, absolutePath);
|
|
1803
1832
|
};
|
|
1804
1833
|
|
|
1805
1834
|
// ../auth/src/loginStatus.ts
|
|
@@ -1923,11 +1952,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
|
1923
1952
|
return { credentials };
|
|
1924
1953
|
}
|
|
1925
1954
|
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
1926
|
-
const
|
|
1927
|
-
const globalPath =
|
|
1955
|
+
const fs = getFs();
|
|
1956
|
+
const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
|
|
1928
1957
|
if (absolutePath === globalPath)
|
|
1929
1958
|
return;
|
|
1930
|
-
if (!await
|
|
1959
|
+
if (!await fs.exists(globalPath))
|
|
1931
1960
|
return;
|
|
1932
1961
|
try {
|
|
1933
1962
|
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
@@ -2342,6 +2371,51 @@ function normalizeTokenRefreshUnavailableFailure() {
|
|
|
2342
2371
|
function errorMessage(error) {
|
|
2343
2372
|
return error instanceof Error ? error.message : String(error);
|
|
2344
2373
|
}
|
|
2374
|
+
|
|
2375
|
+
// ../auth/src/authContext.ts
|
|
2376
|
+
class AuthContextUnavailableError extends Error {
|
|
2377
|
+
instructionContext;
|
|
2378
|
+
sessionHint;
|
|
2379
|
+
errorCode = "authentication_required";
|
|
2380
|
+
retry = "RetryWillNotFix";
|
|
2381
|
+
constructor(message, instructionContext = "auth", sessionHint) {
|
|
2382
|
+
super(message);
|
|
2383
|
+
this.instructionContext = instructionContext;
|
|
2384
|
+
this.sessionHint = sessionHint;
|
|
2385
|
+
this.name = "AuthContextUnavailableError";
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
var getAuthContext = async (options = {}) => {
|
|
2389
|
+
const status = await getLoginStatusAsync({
|
|
2390
|
+
ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
|
|
2391
|
+
envFilePath: options.envFilePath
|
|
2392
|
+
});
|
|
2393
|
+
if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
|
|
2394
|
+
throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
|
|
2395
|
+
}
|
|
2396
|
+
const tenantName = options.tenant || status.tenantName;
|
|
2397
|
+
if (options.requireOrganizationId && !status.organizationId) {
|
|
2398
|
+
throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
|
|
2399
|
+
}
|
|
2400
|
+
if (options.requireOrganizationName && !status.organizationName) {
|
|
2401
|
+
throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
|
|
2402
|
+
}
|
|
2403
|
+
if (options.requireTenantId && !status.tenantId) {
|
|
2404
|
+
throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
|
|
2405
|
+
}
|
|
2406
|
+
if (options.requireTenantName && !tenantName) {
|
|
2407
|
+
throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
|
|
2408
|
+
}
|
|
2409
|
+
return {
|
|
2410
|
+
baseUrl: status.baseUrl,
|
|
2411
|
+
accessToken: status.accessToken,
|
|
2412
|
+
organizationId: status.organizationId,
|
|
2413
|
+
organizationName: status.organizationName,
|
|
2414
|
+
tenantId: status.tenantId,
|
|
2415
|
+
tenantName,
|
|
2416
|
+
identity: status.identity
|
|
2417
|
+
};
|
|
2418
|
+
};
|
|
2345
2419
|
// ../auth/src/authProfileDetails.ts
|
|
2346
2420
|
init_src();
|
|
2347
2421
|
// ../auth/src/index.ts
|
|
@@ -2437,6 +2511,21 @@ var CommandDimensions = {
|
|
|
2437
2511
|
ProductArea: "ProductArea",
|
|
2438
2512
|
Mode: "Mode"
|
|
2439
2513
|
};
|
|
2514
|
+
var ProjectDimensions = {
|
|
2515
|
+
ProjectKey: "ProjectKey",
|
|
2516
|
+
ProjectType: "ProjectType",
|
|
2517
|
+
ProjectIdentityStatus: "ProjectIdentityStatus",
|
|
2518
|
+
SolutionKey: "SolutionKey",
|
|
2519
|
+
SolutionProjectKey: "SolutionProjectKey",
|
|
2520
|
+
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2521
|
+
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2522
|
+
};
|
|
2523
|
+
var GUID_KEY_DIMENSIONS = new Set([
|
|
2524
|
+
ProjectDimensions.ProjectKey,
|
|
2525
|
+
ProjectDimensions.SolutionKey,
|
|
2526
|
+
ProjectDimensions.SolutionProjectKey,
|
|
2527
|
+
ProjectDimensions.PreviousSolutionKey
|
|
2528
|
+
]);
|
|
2440
2529
|
var ShipDimensions = {
|
|
2441
2530
|
ShipKind: "ShipKind",
|
|
2442
2531
|
Target: "Target",
|
|
@@ -2504,6 +2593,7 @@ var RESERVED_DIMENSION_NAMES = new Set([
|
|
|
2504
2593
|
...Object.values(BaseDimensions),
|
|
2505
2594
|
...Object.values(CommandDimensions),
|
|
2506
2595
|
...Object.values(ShipDimensions),
|
|
2596
|
+
...Object.values(ProjectDimensions),
|
|
2507
2597
|
...Object.values(ErrorDimensions),
|
|
2508
2598
|
...Object.values(AuthDimensions),
|
|
2509
2599
|
...Object.values(SkillsDimensions),
|
|
@@ -2529,7 +2619,8 @@ var CURATED_DIMENSIONS = new Set([
|
|
|
2529
2619
|
BaseDimensions.SessionIdSource,
|
|
2530
2620
|
BaseDimensions.SessionId,
|
|
2531
2621
|
...Object.values(CommandDimensions),
|
|
2532
|
-
...Object.values(ShipDimensions)
|
|
2622
|
+
...Object.values(ShipDimensions),
|
|
2623
|
+
...Object.values(ProjectDimensions)
|
|
2533
2624
|
]);
|
|
2534
2625
|
|
|
2535
2626
|
// ../common/src/sdk-user-agent.ts
|
|
@@ -2584,7 +2675,7 @@ var package_default = {
|
|
|
2584
2675
|
name: "@uipath/ixp-sdk",
|
|
2585
2676
|
author: "UiPath",
|
|
2586
2677
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2587
|
-
version: "1.
|
|
2678
|
+
version: "1.206.0-preview.282",
|
|
2588
2679
|
description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
|
|
2589
2680
|
repository: {
|
|
2590
2681
|
type: "git",
|
|
@@ -2642,22 +2733,17 @@ function buildIxpUserAgent() {
|
|
|
2642
2733
|
|
|
2643
2734
|
// src/client-factory.ts
|
|
2644
2735
|
async function createIxpConfig(options) {
|
|
2645
|
-
const
|
|
2646
|
-
|
|
2736
|
+
const auth = await getAuthContext({
|
|
2737
|
+
tenant: options?.tenant,
|
|
2738
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
2739
|
+
requireOrganizationId: true,
|
|
2740
|
+
requireTenantName: true
|
|
2647
2741
|
});
|
|
2648
|
-
if (status.loginStatus !== "Logged in" || !status.accessToken || !status.baseUrl || !status.organizationId) {
|
|
2649
|
-
const message = status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.";
|
|
2650
|
-
throw new Error(message);
|
|
2651
|
-
}
|
|
2652
|
-
const tenantName = options?.tenant ?? status.tenantName;
|
|
2653
|
-
if (!tenantName) {
|
|
2654
|
-
throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
|
|
2655
|
-
}
|
|
2656
2742
|
return {
|
|
2657
|
-
baseUrl:
|
|
2658
|
-
accessToken:
|
|
2659
|
-
organizationId:
|
|
2660
|
-
tenantName,
|
|
2743
|
+
baseUrl: auth.baseUrl,
|
|
2744
|
+
accessToken: auth.accessToken,
|
|
2745
|
+
organizationId: auth.organizationId,
|
|
2746
|
+
tenantName: auth.tenantName,
|
|
2661
2747
|
userAgent: buildIxpUserAgent()
|
|
2662
2748
|
};
|
|
2663
2749
|
}
|
|
@@ -2684,8 +2770,8 @@ var JSON_CONTENT_HEADERS = {
|
|
|
2684
2770
|
class IxpHttpError extends Error {
|
|
2685
2771
|
status;
|
|
2686
2772
|
response;
|
|
2687
|
-
constructor(
|
|
2688
|
-
super(`${
|
|
2773
|
+
constructor(errorMessage, status, statusText, url, body) {
|
|
2774
|
+
super(`${errorMessage}: ${status} ${statusText} - URL: ${url} - ${body}`);
|
|
2689
2775
|
this.name = "IxpHttpError";
|
|
2690
2776
|
this.status = status;
|
|
2691
2777
|
this.response = {
|
|
@@ -2695,7 +2781,7 @@ class IxpHttpError extends Error {
|
|
|
2695
2781
|
};
|
|
2696
2782
|
}
|
|
2697
2783
|
}
|
|
2698
|
-
async function request(config, url, init,
|
|
2784
|
+
async function request(config, url, init, errorMessage) {
|
|
2699
2785
|
const response = await fetch(url, {
|
|
2700
2786
|
method: init.method,
|
|
2701
2787
|
body: init.body,
|
|
@@ -2703,7 +2789,7 @@ async function request(config, url, init, errorMessage2) {
|
|
|
2703
2789
|
});
|
|
2704
2790
|
if (!response.ok) {
|
|
2705
2791
|
const errorText = await response.text();
|
|
2706
|
-
throw new IxpHttpError(
|
|
2792
|
+
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
2707
2793
|
}
|
|
2708
2794
|
return await response.json();
|
|
2709
2795
|
}
|
|
@@ -2713,27 +2799,27 @@ var DESIGNTIME_API_VERSION = "1.0";
|
|
|
2713
2799
|
function designtimeBasePath(config) {
|
|
2714
2800
|
return platformBasePath(config, "du_/api/designtimeapi");
|
|
2715
2801
|
}
|
|
2716
|
-
function designtimeUrl(config,
|
|
2717
|
-
const separator =
|
|
2718
|
-
return `${designtimeBasePath(config)}${
|
|
2802
|
+
function designtimeUrl(config, path) {
|
|
2803
|
+
const separator = path.includes("?") ? "&" : "?";
|
|
2804
|
+
return `${designtimeBasePath(config)}${path}${separator}api-version=${DESIGNTIME_API_VERSION}`;
|
|
2719
2805
|
}
|
|
2720
|
-
async function designtimeGet(config,
|
|
2721
|
-
return request(config, designtimeUrl(config,
|
|
2806
|
+
async function designtimeGet(config, path, errorMessage) {
|
|
2807
|
+
return request(config, designtimeUrl(config, path), { method: "GET" }, errorMessage);
|
|
2722
2808
|
}
|
|
2723
|
-
async function designtimePost(config,
|
|
2724
|
-
return request(config, designtimeUrl(config,
|
|
2809
|
+
async function designtimePost(config, path, body, errorMessage) {
|
|
2810
|
+
return request(config, designtimeUrl(config, path), { method: "POST", body: JSON.stringify(body ?? {}) }, errorMessage);
|
|
2725
2811
|
}
|
|
2726
|
-
async function designtimePut(config,
|
|
2727
|
-
return request(config, designtimeUrl(config,
|
|
2812
|
+
async function designtimePut(config, path, body, errorMessage) {
|
|
2813
|
+
return request(config, designtimeUrl(config, path), { method: "PUT", body: JSON.stringify(body ?? {}) }, errorMessage);
|
|
2728
2814
|
}
|
|
2729
|
-
async function designtimePatch(config,
|
|
2730
|
-
return request(config, designtimeUrl(config,
|
|
2815
|
+
async function designtimePatch(config, path, body, errorMessage) {
|
|
2816
|
+
return request(config, designtimeUrl(config, path), { method: "PATCH", body: JSON.stringify(body ?? {}) }, errorMessage);
|
|
2731
2817
|
}
|
|
2732
|
-
async function designtimeDelete(config,
|
|
2733
|
-
return request(config, designtimeUrl(config,
|
|
2818
|
+
async function designtimeDelete(config, path, errorMessage) {
|
|
2819
|
+
return request(config, designtimeUrl(config, path), { method: "DELETE" }, errorMessage);
|
|
2734
2820
|
}
|
|
2735
|
-
async function designtimeUploadMultipart(config,
|
|
2736
|
-
const url = designtimeUrl(config,
|
|
2821
|
+
async function designtimeUploadMultipart(config, path, formData, errorMessage) {
|
|
2822
|
+
const url = designtimeUrl(config, path);
|
|
2737
2823
|
const response = await fetch(url, {
|
|
2738
2824
|
method: "POST",
|
|
2739
2825
|
headers: baseHeaders(config),
|
|
@@ -2741,19 +2827,19 @@ async function designtimeUploadMultipart(config, path3, formData, errorMessage2)
|
|
|
2741
2827
|
});
|
|
2742
2828
|
if (!response.ok) {
|
|
2743
2829
|
const errorText = await response.text();
|
|
2744
|
-
throw new IxpHttpError(
|
|
2830
|
+
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
2745
2831
|
}
|
|
2746
2832
|
return await response.json();
|
|
2747
2833
|
}
|
|
2748
|
-
async function designtimeDownloadBinary(config,
|
|
2749
|
-
const url = designtimeUrl(config,
|
|
2834
|
+
async function designtimeDownloadBinary(config, path, errorMessage) {
|
|
2835
|
+
const url = designtimeUrl(config, path);
|
|
2750
2836
|
const response = await fetch(url, {
|
|
2751
2837
|
method: "GET",
|
|
2752
2838
|
headers: baseHeaders(config)
|
|
2753
2839
|
});
|
|
2754
2840
|
if (!response.ok) {
|
|
2755
2841
|
const errorText = await response.text();
|
|
2756
|
-
throw new IxpHttpError(
|
|
2842
|
+
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
2757
2843
|
}
|
|
2758
2844
|
const contentType = response.headers.get("content-type") || "application/octet-stream";
|
|
2759
2845
|
return { buffer: await response.arrayBuffer(), contentType };
|
|
@@ -2916,14 +3002,14 @@ async function configureModel(config, projectName, options) {
|
|
|
2916
3002
|
function dataTypesPath(projectName) {
|
|
2917
3003
|
return `/api/projects/${encodeURIComponent(projectName)}/data-types`;
|
|
2918
3004
|
}
|
|
2919
|
-
async function createDataType(config, projectName,
|
|
2920
|
-
return designtimePost(config, dataTypesPath(projectName),
|
|
3005
|
+
async function createDataType(config, projectName, request) {
|
|
3006
|
+
return designtimePost(config, dataTypesPath(projectName), request, "Failed to add data type");
|
|
2921
3007
|
}
|
|
2922
|
-
async function renameDataType(config, projectName, dataTypeName,
|
|
2923
|
-
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/rename`,
|
|
3008
|
+
async function renameDataType(config, projectName, dataTypeName, request) {
|
|
3009
|
+
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/rename`, request, "Failed to rename data type");
|
|
2924
3010
|
}
|
|
2925
|
-
async function updateDataTypeInstructions(config, projectName, dataTypeName,
|
|
2926
|
-
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/update-instructions`,
|
|
3011
|
+
async function updateDataTypeInstructions(config, projectName, dataTypeName, request) {
|
|
3012
|
+
return designtimePost(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}/update-instructions`, request, "Failed to update data type instructions");
|
|
2927
3013
|
}
|
|
2928
3014
|
async function deleteDataType(config, projectName, dataTypeName) {
|
|
2929
3015
|
return designtimeDelete(config, `${dataTypesPath(projectName)}/${encodeURIComponent(dataTypeName)}`, "Failed to delete data type");
|
|
@@ -2931,17 +3017,17 @@ async function deleteDataType(config, projectName, dataTypeName) {
|
|
|
2931
3017
|
function groupsPath(projectName) {
|
|
2932
3018
|
return `/api/projects/${encodeURIComponent(projectName)}/groups`;
|
|
2933
3019
|
}
|
|
2934
|
-
async function createGroup(config, projectName,
|
|
2935
|
-
return designtimePost(config, groupsPath(projectName),
|
|
3020
|
+
async function createGroup(config, projectName, request) {
|
|
3021
|
+
return designtimePost(config, groupsPath(projectName), request, "Failed to add field group");
|
|
2936
3022
|
}
|
|
2937
3023
|
async function deleteGroup(config, projectName, groupName) {
|
|
2938
3024
|
return designtimeDelete(config, `${groupsPath(projectName)}/${encodeURIComponent(groupName)}`, "Failed to delete field group");
|
|
2939
3025
|
}
|
|
2940
|
-
async function renameGroup(config, projectName, groupName,
|
|
2941
|
-
return designtimePost(config, `${groupsPath(projectName)}/${encodeURIComponent(groupName)}/rename`,
|
|
3026
|
+
async function renameGroup(config, projectName, groupName, request) {
|
|
3027
|
+
return designtimePost(config, `${groupsPath(projectName)}/${encodeURIComponent(groupName)}/rename`, request, "Failed to rename field group");
|
|
2942
3028
|
}
|
|
2943
|
-
async function updateGroupPrompts(config, projectName,
|
|
2944
|
-
return designtimePost(config, `${groupsPath(projectName)}/update-prompts`,
|
|
3029
|
+
async function updateGroupPrompts(config, projectName, request) {
|
|
3030
|
+
return designtimePost(config, `${groupsPath(projectName)}/update-prompts`, request, "Failed to update group prompts");
|
|
2945
3031
|
}
|
|
2946
3032
|
function fieldsBasePath(projectName, groupName) {
|
|
2947
3033
|
return `/api/projects/${encodeURIComponent(projectName)}/groups/${encodeURIComponent(groupName)}/fields`;
|
|
@@ -3016,4 +3102,4 @@ export {
|
|
|
3016
3102
|
uploadDocument
|
|
3017
3103
|
};
|
|
3018
3104
|
|
|
3019
|
-
//# debugId=
|
|
3105
|
+
//# debugId=AAB3DE41E5B5628F64756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/ixp-sdk",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.206.0-preview.282",
|
|
6
6
|
"description": "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "9f18b69f2307838e3ce650b91de76cf6c9a23c13"
|
|
29
29
|
}
|