@uipath/ixp-sdk 1.206.0-preview.306 → 1.207.0-preview.307
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 +121 -16
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ function settlePromiseLike(thenable) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// ../auth/src/constants.ts
|
|
44
|
-
var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS;
|
|
44
|
+
var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", AUTH_FILE_MODE = 384, AUTH_DIR_MODE = 448, DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS;
|
|
45
45
|
var init_constants = __esm(() => {
|
|
46
46
|
DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
47
47
|
});
|
|
@@ -724,12 +724,26 @@ class NodeFileSystem {
|
|
|
724
724
|
throw error;
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
|
-
async writeFile(filePath, data) {
|
|
727
|
+
async writeFile(filePath, data, options) {
|
|
728
728
|
const dir = path2.dirname(filePath);
|
|
729
729
|
if (dir) {
|
|
730
730
|
await fs6.mkdir(dir, { recursive: true });
|
|
731
731
|
}
|
|
732
|
-
|
|
732
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
733
|
+
if (options?.exclusive) {
|
|
734
|
+
await fs6.writeFile(filePath, data, { flag: "wx" });
|
|
735
|
+
} else {
|
|
736
|
+
await fs6.writeFile(filePath, data);
|
|
737
|
+
}
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
const handle = await fs6.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
741
|
+
try {
|
|
742
|
+
await handle.chmod(options.mode);
|
|
743
|
+
await handle.writeFile(data);
|
|
744
|
+
} finally {
|
|
745
|
+
await handle.close();
|
|
746
|
+
}
|
|
733
747
|
}
|
|
734
748
|
async appendFile(filePath, data) {
|
|
735
749
|
const dir = path2.dirname(filePath);
|
|
@@ -764,7 +778,8 @@ class NodeFileSystem {
|
|
|
764
778
|
isDirectory: () => stats.isDirectory(),
|
|
765
779
|
size: stats.size,
|
|
766
780
|
mtimeMs: stats.mtimeMs,
|
|
767
|
-
ctimeMs: stats.ctimeMs
|
|
781
|
+
ctimeMs: stats.ctimeMs,
|
|
782
|
+
mode: stats.mode
|
|
768
783
|
};
|
|
769
784
|
} catch (error) {
|
|
770
785
|
if (this.isEnoent(error))
|
|
@@ -775,8 +790,13 @@ class NodeFileSystem {
|
|
|
775
790
|
async exists(filePath) {
|
|
776
791
|
return existsSync(filePath);
|
|
777
792
|
}
|
|
778
|
-
async mkdir(dirPath) {
|
|
779
|
-
await fs6.mkdir(dirPath, { recursive: true });
|
|
793
|
+
async mkdir(dirPath, options) {
|
|
794
|
+
await fs6.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
795
|
+
}
|
|
796
|
+
async chmod(targetPath, mode) {
|
|
797
|
+
if (process.platform === "win32")
|
|
798
|
+
return;
|
|
799
|
+
await fs6.chmod(targetPath, mode);
|
|
780
800
|
}
|
|
781
801
|
async acquireLock(lockPath) {
|
|
782
802
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -926,7 +946,7 @@ class NodeFileSystem {
|
|
|
926
946
|
async getTempDir() {
|
|
927
947
|
return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
|
|
928
948
|
}
|
|
929
|
-
async copyDirectory(sourcePath, destPath) {
|
|
949
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
930
950
|
const sourceStats = await this.stat(sourcePath);
|
|
931
951
|
if (!sourceStats) {
|
|
932
952
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -943,7 +963,9 @@ class NodeFileSystem {
|
|
|
943
963
|
if (!entryStats)
|
|
944
964
|
continue;
|
|
945
965
|
if (entryStats.isDirectory()) {
|
|
946
|
-
|
|
966
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
967
|
+
continue;
|
|
968
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
947
969
|
} else if (entryStats.isFile()) {
|
|
948
970
|
const content = await this.readFile(srcEntry);
|
|
949
971
|
if (content !== null) {
|
|
@@ -1798,6 +1820,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
1798
1820
|
}
|
|
1799
1821
|
return parseEnvContent(content);
|
|
1800
1822
|
};
|
|
1823
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
1824
|
+
let current = dir;
|
|
1825
|
+
for (;; ) {
|
|
1826
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
1827
|
+
return current;
|
|
1828
|
+
const parent = fs.path.dirname(current);
|
|
1829
|
+
if (parent === current)
|
|
1830
|
+
return;
|
|
1831
|
+
current = parent;
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
1835
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
1836
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
1837
|
+
for (let attempt = 1;; attempt++) {
|
|
1838
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
1839
|
+
try {
|
|
1840
|
+
await fs.writeFile(tempPath, content, {
|
|
1841
|
+
mode: AUTH_FILE_MODE,
|
|
1842
|
+
exclusive: true
|
|
1843
|
+
});
|
|
1844
|
+
return tempPath;
|
|
1845
|
+
} catch (error) {
|
|
1846
|
+
if (!isFileExists(error)) {
|
|
1847
|
+
await fs.rm(tempPath).catch(() => {});
|
|
1848
|
+
throw error;
|
|
1849
|
+
}
|
|
1850
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
1851
|
+
throw error;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1801
1855
|
var saveEnvFileAsync = async ({
|
|
1802
1856
|
envPath,
|
|
1803
1857
|
data,
|
|
@@ -1825,10 +1879,18 @@ var saveEnvFileAsync = async ({
|
|
|
1825
1879
|
`)}
|
|
1826
1880
|
`;
|
|
1827
1881
|
const dir = fs.path.dirname(absolutePath);
|
|
1828
|
-
await fs.mkdir(dir);
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
|
|
1882
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
1883
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
1884
|
+
if (authHomeDir !== undefined) {
|
|
1885
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
1886
|
+
}
|
|
1887
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
1888
|
+
try {
|
|
1889
|
+
await fs.rename(tempPath, absolutePath);
|
|
1890
|
+
} catch (error) {
|
|
1891
|
+
await fs.rm(tempPath).catch(() => {});
|
|
1892
|
+
throw error;
|
|
1893
|
+
}
|
|
1832
1894
|
};
|
|
1833
1895
|
|
|
1834
1896
|
// ../auth/src/loginStatus.ts
|
|
@@ -2434,6 +2496,8 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
2434
2496
|
]);
|
|
2435
2497
|
// ../auth/src/logout.ts
|
|
2436
2498
|
init_src();
|
|
2499
|
+
// ../auth/src/utils/lockedEnvFile.ts
|
|
2500
|
+
init_src();
|
|
2437
2501
|
// ../common/src/singleton.ts
|
|
2438
2502
|
var PREFIX = "@uipath/common/";
|
|
2439
2503
|
var _g = globalThis;
|
|
@@ -2518,13 +2582,15 @@ var ProjectDimensions = {
|
|
|
2518
2582
|
SolutionKey: "SolutionKey",
|
|
2519
2583
|
SolutionProjectKey: "SolutionProjectKey",
|
|
2520
2584
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
2521
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
2585
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
2586
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
2522
2587
|
};
|
|
2523
2588
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
2524
2589
|
ProjectDimensions.ProjectKey,
|
|
2525
2590
|
ProjectDimensions.SolutionKey,
|
|
2526
2591
|
ProjectDimensions.SolutionProjectKey,
|
|
2527
|
-
ProjectDimensions.PreviousSolutionKey
|
|
2592
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
2593
|
+
ProjectDimensions.PreviousProjectKey
|
|
2528
2594
|
]);
|
|
2529
2595
|
var ShipDimensions = {
|
|
2530
2596
|
ShipKind: "ShipKind",
|
|
@@ -2675,7 +2741,7 @@ var package_default = {
|
|
|
2675
2741
|
name: "@uipath/ixp-sdk",
|
|
2676
2742
|
author: "UiPath",
|
|
2677
2743
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
2678
|
-
version: "1.
|
|
2744
|
+
version: "1.207.0-preview.307",
|
|
2679
2745
|
description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
|
|
2680
2746
|
repository: {
|
|
2681
2747
|
type: "git",
|
|
@@ -2781,12 +2847,49 @@ class IxpHttpError extends Error {
|
|
|
2781
2847
|
};
|
|
2782
2848
|
}
|
|
2783
2849
|
}
|
|
2850
|
+
|
|
2851
|
+
class IxpServiceNotEnabledError extends Error {
|
|
2852
|
+
status;
|
|
2853
|
+
constructor(status, url) {
|
|
2854
|
+
super(`IXP service is not enabled: ${status} response - URL: ${url}`);
|
|
2855
|
+
this.name = "IxpServiceNotEnabledError";
|
|
2856
|
+
this.status = status;
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
var GATEWAY_SERVICE_NOT_FOUND = /^Service: \S+ not found in Organization: /;
|
|
2860
|
+
var SERVICE_NOT_INSTALLED_CODE = "[ServiceNotInstalledError]";
|
|
2861
|
+
function hasServiceNotInstalledCode(body) {
|
|
2862
|
+
try {
|
|
2863
|
+
const parsed = JSON.parse(body);
|
|
2864
|
+
if (parsed === null || typeof parsed !== "object")
|
|
2865
|
+
return false;
|
|
2866
|
+
const { Code, code } = parsed;
|
|
2867
|
+
return (Code ?? code) === SERVICE_NOT_INSTALLED_CODE;
|
|
2868
|
+
} catch {
|
|
2869
|
+
return false;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
async function assertServiceEnabled(response, url) {
|
|
2873
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
2874
|
+
const isHtml = contentType.toLowerCase().startsWith("text/html");
|
|
2875
|
+
if (isHtml && (response.ok || response.status === 404)) {
|
|
2876
|
+
throw new IxpServiceNotEnabledError(response.status, url);
|
|
2877
|
+
}
|
|
2878
|
+
if (response.status !== 404)
|
|
2879
|
+
return;
|
|
2880
|
+
const body = (await response.clone().text()).trim();
|
|
2881
|
+
const notEnabled = contentType.includes("json") ? hasServiceNotInstalledCode(body) : GATEWAY_SERVICE_NOT_FOUND.test(body);
|
|
2882
|
+
if (notEnabled) {
|
|
2883
|
+
throw new IxpServiceNotEnabledError(response.status, url);
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2784
2886
|
async function request(config, url, init, errorMessage) {
|
|
2785
2887
|
const response = await fetch(url, {
|
|
2786
2888
|
method: init.method,
|
|
2787
2889
|
body: init.body,
|
|
2788
2890
|
headers: { ...baseHeaders(config), ...JSON_CONTENT_HEADERS }
|
|
2789
2891
|
});
|
|
2892
|
+
await assertServiceEnabled(response, url);
|
|
2790
2893
|
if (!response.ok) {
|
|
2791
2894
|
const errorText = await response.text();
|
|
2792
2895
|
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
@@ -2825,6 +2928,7 @@ async function designtimeUploadMultipart(config, path, formData, errorMessage) {
|
|
|
2825
2928
|
headers: baseHeaders(config),
|
|
2826
2929
|
body: formData
|
|
2827
2930
|
});
|
|
2931
|
+
await assertServiceEnabled(response, url);
|
|
2828
2932
|
if (!response.ok) {
|
|
2829
2933
|
const errorText = await response.text();
|
|
2830
2934
|
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
@@ -2837,6 +2941,7 @@ async function designtimeDownloadBinary(config, path, errorMessage) {
|
|
|
2837
2941
|
method: "GET",
|
|
2838
2942
|
headers: baseHeaders(config)
|
|
2839
2943
|
});
|
|
2944
|
+
await assertServiceEnabled(response, url);
|
|
2840
2945
|
if (!response.ok) {
|
|
2841
2946
|
const errorText = await response.text();
|
|
2842
2947
|
throw new IxpHttpError(errorMessage, response.status, response.statusText, url, errorText);
|
|
@@ -3102,4 +3207,4 @@ export {
|
|
|
3102
3207
|
uploadDocument
|
|
3103
3208
|
};
|
|
3104
3209
|
|
|
3105
|
-
//# debugId=
|
|
3210
|
+
//# debugId=2F055F9F052B666B64756E2164756E21
|
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.207.0-preview.307",
|
|
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": "a625ed8ac421089170db3cb8b95c497f3c7b0d62"
|
|
29
29
|
}
|