@uipath/auth 1.206.0-preview.312 → 1.206.0-preview.323
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/constants.d.ts +7 -0
- package/dist/index.browser.js +47 -5
- package/dist/index.js +71 -11
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
export declare const UIPATH_HOME_DIR = ".uipath";
|
|
3
3
|
/** Auth credentials filename within the UiPath home directory. */
|
|
4
4
|
export declare const AUTH_FILENAME = ".auth";
|
|
5
|
+
/**
|
|
6
|
+
* Permission bits for credential files (owner read/write) and for a
|
|
7
|
+
* directory created to hold them (owner only). Every write or mkdir of an
|
|
8
|
+
* auth path passes these, so tokens are never readable by other local users.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AUTH_FILE_MODE = 384;
|
|
11
|
+
export declare const AUTH_DIR_MODE = 448;
|
|
5
12
|
/** Default UiPath cloud base URL. */
|
|
6
13
|
export declare const DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
7
14
|
/** Auth callback server timeout (5 minutes). */
|
package/dist/index.browser.js
CHANGED
|
@@ -18180,6 +18180,8 @@ function settlePromiseLike(thenable) {
|
|
|
18180
18180
|
// src/constants.ts
|
|
18181
18181
|
var UIPATH_HOME_DIR = ".uipath";
|
|
18182
18182
|
var AUTH_FILENAME = ".auth";
|
|
18183
|
+
var AUTH_FILE_MODE = 384;
|
|
18184
|
+
var AUTH_DIR_MODE = 448;
|
|
18183
18185
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
18184
18186
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
18185
18187
|
var AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED";
|
|
@@ -19107,6 +19109,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
19107
19109
|
}
|
|
19108
19110
|
return parseEnvContent(content);
|
|
19109
19111
|
};
|
|
19112
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
19113
|
+
let current = dir;
|
|
19114
|
+
for (;; ) {
|
|
19115
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
19116
|
+
return current;
|
|
19117
|
+
const parent = fs.path.dirname(current);
|
|
19118
|
+
if (parent === current)
|
|
19119
|
+
return;
|
|
19120
|
+
current = parent;
|
|
19121
|
+
}
|
|
19122
|
+
};
|
|
19123
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
19124
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
19125
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
19126
|
+
for (let attempt = 1;; attempt++) {
|
|
19127
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
19128
|
+
try {
|
|
19129
|
+
await fs.writeFile(tempPath, content, {
|
|
19130
|
+
mode: AUTH_FILE_MODE,
|
|
19131
|
+
exclusive: true
|
|
19132
|
+
});
|
|
19133
|
+
return tempPath;
|
|
19134
|
+
} catch (error) {
|
|
19135
|
+
if (!isFileExists(error)) {
|
|
19136
|
+
await fs.rm(tempPath).catch(() => {});
|
|
19137
|
+
throw error;
|
|
19138
|
+
}
|
|
19139
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
19140
|
+
throw error;
|
|
19141
|
+
}
|
|
19142
|
+
}
|
|
19143
|
+
};
|
|
19110
19144
|
var saveEnvFileAsync = async ({
|
|
19111
19145
|
envPath,
|
|
19112
19146
|
data,
|
|
@@ -19134,10 +19168,18 @@ var saveEnvFileAsync = async ({
|
|
|
19134
19168
|
`)}
|
|
19135
19169
|
`;
|
|
19136
19170
|
const dir = fs.path.dirname(absolutePath);
|
|
19137
|
-
await fs.mkdir(dir);
|
|
19138
|
-
const
|
|
19139
|
-
|
|
19140
|
-
|
|
19171
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
19172
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
19173
|
+
if (authHomeDir !== undefined) {
|
|
19174
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
19175
|
+
}
|
|
19176
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
19177
|
+
try {
|
|
19178
|
+
await fs.rename(tempPath, absolutePath);
|
|
19179
|
+
} catch (error) {
|
|
19180
|
+
await fs.rm(tempPath).catch(() => {});
|
|
19181
|
+
throw error;
|
|
19182
|
+
}
|
|
19141
19183
|
};
|
|
19142
19184
|
|
|
19143
19185
|
// src/loginStatus.ts
|
|
@@ -20040,4 +20082,4 @@ export {
|
|
|
20040
20082
|
setAuthFileConfig
|
|
20041
20083
|
};
|
|
20042
20084
|
|
|
20043
|
-
//# debugId=
|
|
20085
|
+
//# debugId=B548355C4EE6D9CF64756E2164756E21
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ function settlePromiseLike(thenable) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// src/constants.ts
|
|
44
|
-
var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS, AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT", AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED", AUTH_RECLAIMED_ERROR_CODE = "EAUTHRECLAIMED", DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
|
|
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, AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT", AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED", AUTH_RECLAIMED_ERROR_CODE = "EAUTHRECLAIMED", DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
|
|
45
45
|
var init_constants = __esm(() => {
|
|
46
46
|
DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
47
47
|
});
|
|
@@ -733,12 +733,26 @@ class NodeFileSystem {
|
|
|
733
733
|
throw error;
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
async writeFile(filePath, data) {
|
|
736
|
+
async writeFile(filePath, data, options) {
|
|
737
737
|
const dir = path2.dirname(filePath);
|
|
738
738
|
if (dir) {
|
|
739
739
|
await fs6.mkdir(dir, { recursive: true });
|
|
740
740
|
}
|
|
741
|
-
|
|
741
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
742
|
+
if (options?.exclusive) {
|
|
743
|
+
await fs6.writeFile(filePath, data, { flag: "wx" });
|
|
744
|
+
} else {
|
|
745
|
+
await fs6.writeFile(filePath, data);
|
|
746
|
+
}
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
const handle = await fs6.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
750
|
+
try {
|
|
751
|
+
await handle.chmod(options.mode);
|
|
752
|
+
await handle.writeFile(data);
|
|
753
|
+
} finally {
|
|
754
|
+
await handle.close();
|
|
755
|
+
}
|
|
742
756
|
}
|
|
743
757
|
async appendFile(filePath, data) {
|
|
744
758
|
const dir = path2.dirname(filePath);
|
|
@@ -773,7 +787,8 @@ class NodeFileSystem {
|
|
|
773
787
|
isDirectory: () => stats.isDirectory(),
|
|
774
788
|
size: stats.size,
|
|
775
789
|
mtimeMs: stats.mtimeMs,
|
|
776
|
-
ctimeMs: stats.ctimeMs
|
|
790
|
+
ctimeMs: stats.ctimeMs,
|
|
791
|
+
mode: stats.mode
|
|
777
792
|
};
|
|
778
793
|
} catch (error) {
|
|
779
794
|
if (this.isEnoent(error))
|
|
@@ -784,8 +799,13 @@ class NodeFileSystem {
|
|
|
784
799
|
async exists(filePath) {
|
|
785
800
|
return existsSync(filePath);
|
|
786
801
|
}
|
|
787
|
-
async mkdir(dirPath) {
|
|
788
|
-
await fs6.mkdir(dirPath, { recursive: true });
|
|
802
|
+
async mkdir(dirPath, options) {
|
|
803
|
+
await fs6.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
804
|
+
}
|
|
805
|
+
async chmod(targetPath, mode) {
|
|
806
|
+
if (process.platform === "win32")
|
|
807
|
+
return;
|
|
808
|
+
await fs6.chmod(targetPath, mode);
|
|
789
809
|
}
|
|
790
810
|
async acquireLock(lockPath) {
|
|
791
811
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -2789,6 +2809,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
2789
2809
|
}
|
|
2790
2810
|
return parseEnvContent(content);
|
|
2791
2811
|
};
|
|
2812
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
2813
|
+
let current = dir;
|
|
2814
|
+
for (;; ) {
|
|
2815
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
2816
|
+
return current;
|
|
2817
|
+
const parent = fs.path.dirname(current);
|
|
2818
|
+
if (parent === current)
|
|
2819
|
+
return;
|
|
2820
|
+
current = parent;
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
2824
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
2825
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
2826
|
+
for (let attempt = 1;; attempt++) {
|
|
2827
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
2828
|
+
try {
|
|
2829
|
+
await fs.writeFile(tempPath, content, {
|
|
2830
|
+
mode: AUTH_FILE_MODE,
|
|
2831
|
+
exclusive: true
|
|
2832
|
+
});
|
|
2833
|
+
return tempPath;
|
|
2834
|
+
} catch (error) {
|
|
2835
|
+
if (!isFileExists(error)) {
|
|
2836
|
+
await fs.rm(tempPath).catch(() => {});
|
|
2837
|
+
throw error;
|
|
2838
|
+
}
|
|
2839
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
2840
|
+
throw error;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
};
|
|
2792
2844
|
var saveEnvFileAsync = async ({
|
|
2793
2845
|
envPath,
|
|
2794
2846
|
data,
|
|
@@ -2816,10 +2868,18 @@ var saveEnvFileAsync = async ({
|
|
|
2816
2868
|
`)}
|
|
2817
2869
|
`;
|
|
2818
2870
|
const dir = fs.path.dirname(absolutePath);
|
|
2819
|
-
await fs.mkdir(dir);
|
|
2820
|
-
const
|
|
2821
|
-
|
|
2822
|
-
|
|
2871
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
2872
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
2873
|
+
if (authHomeDir !== undefined) {
|
|
2874
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
2875
|
+
}
|
|
2876
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
2877
|
+
try {
|
|
2878
|
+
await fs.rename(tempPath, absolutePath);
|
|
2879
|
+
} catch (error) {
|
|
2880
|
+
await fs.rm(tempPath).catch(() => {});
|
|
2881
|
+
throw error;
|
|
2882
|
+
}
|
|
2823
2883
|
};
|
|
2824
2884
|
|
|
2825
2885
|
// src/loginStatus.ts
|
|
@@ -4134,4 +4194,4 @@ export {
|
|
|
4134
4194
|
setAuthFileConfig
|
|
4135
4195
|
};
|
|
4136
4196
|
|
|
4137
|
-
//# debugId=
|
|
4197
|
+
//# debugId=790B67740D1B17D864756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/auth",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.206.0-preview.
|
|
5
|
+
"version": "1.206.0-preview.323",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/UiPath/cli.git",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"mihaigirleanu",
|
|
39
39
|
"vlad-uipath"
|
|
40
40
|
],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a752d8a8d78de138e3be0a19642620fec7893d99"
|
|
42
42
|
}
|