@uipath/authz-commands 1.206.0-preview.311 → 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/index.js +72 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2109,6 +2109,8 @@ function settlePromiseLike(thenable) {
|
|
|
2109
2109
|
// ../../auth/src/constants.ts
|
|
2110
2110
|
var UIPATH_HOME_DIR = ".uipath";
|
|
2111
2111
|
var AUTH_FILENAME = ".auth";
|
|
2112
|
+
var AUTH_FILE_MODE = 384;
|
|
2113
|
+
var AUTH_DIR_MODE = 448;
|
|
2112
2114
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
2113
2115
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
2114
2116
|
|
|
@@ -2254,12 +2256,26 @@ class NodeFileSystem {
|
|
|
2254
2256
|
throw error;
|
|
2255
2257
|
}
|
|
2256
2258
|
}
|
|
2257
|
-
async writeFile(filePath, data) {
|
|
2259
|
+
async writeFile(filePath, data, options) {
|
|
2258
2260
|
const dir = path.dirname(filePath);
|
|
2259
2261
|
if (dir) {
|
|
2260
2262
|
await fs.mkdir(dir, { recursive: true });
|
|
2261
2263
|
}
|
|
2262
|
-
|
|
2264
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
2265
|
+
if (options?.exclusive) {
|
|
2266
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
2267
|
+
} else {
|
|
2268
|
+
await fs.writeFile(filePath, data);
|
|
2269
|
+
}
|
|
2270
|
+
return;
|
|
2271
|
+
}
|
|
2272
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
2273
|
+
try {
|
|
2274
|
+
await handle.chmod(options.mode);
|
|
2275
|
+
await handle.writeFile(data);
|
|
2276
|
+
} finally {
|
|
2277
|
+
await handle.close();
|
|
2278
|
+
}
|
|
2263
2279
|
}
|
|
2264
2280
|
async appendFile(filePath, data) {
|
|
2265
2281
|
const dir = path.dirname(filePath);
|
|
@@ -2294,7 +2310,8 @@ class NodeFileSystem {
|
|
|
2294
2310
|
isDirectory: () => stats.isDirectory(),
|
|
2295
2311
|
size: stats.size,
|
|
2296
2312
|
mtimeMs: stats.mtimeMs,
|
|
2297
|
-
ctimeMs: stats.ctimeMs
|
|
2313
|
+
ctimeMs: stats.ctimeMs,
|
|
2314
|
+
mode: stats.mode
|
|
2298
2315
|
};
|
|
2299
2316
|
} catch (error) {
|
|
2300
2317
|
if (this.isEnoent(error))
|
|
@@ -2305,8 +2322,13 @@ class NodeFileSystem {
|
|
|
2305
2322
|
async exists(filePath) {
|
|
2306
2323
|
return existsSync(filePath);
|
|
2307
2324
|
}
|
|
2308
|
-
async mkdir(dirPath) {
|
|
2309
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
2325
|
+
async mkdir(dirPath, options) {
|
|
2326
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
2327
|
+
}
|
|
2328
|
+
async chmod(targetPath, mode) {
|
|
2329
|
+
if (process.platform === "win32")
|
|
2330
|
+
return;
|
|
2331
|
+
await fs.chmod(targetPath, mode);
|
|
2310
2332
|
}
|
|
2311
2333
|
async acquireLock(lockPath) {
|
|
2312
2334
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -3221,6 +3243,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
3221
3243
|
}
|
|
3222
3244
|
return parseEnvContent(content);
|
|
3223
3245
|
};
|
|
3246
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
3247
|
+
let current = dir;
|
|
3248
|
+
for (;; ) {
|
|
3249
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
3250
|
+
return current;
|
|
3251
|
+
const parent = fs.path.dirname(current);
|
|
3252
|
+
if (parent === current)
|
|
3253
|
+
return;
|
|
3254
|
+
current = parent;
|
|
3255
|
+
}
|
|
3256
|
+
};
|
|
3257
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
3258
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
3259
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
3260
|
+
for (let attempt = 1;; attempt++) {
|
|
3261
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
3262
|
+
try {
|
|
3263
|
+
await fs.writeFile(tempPath, content, {
|
|
3264
|
+
mode: AUTH_FILE_MODE,
|
|
3265
|
+
exclusive: true
|
|
3266
|
+
});
|
|
3267
|
+
return tempPath;
|
|
3268
|
+
} catch (error) {
|
|
3269
|
+
if (!isFileExists(error)) {
|
|
3270
|
+
await fs.rm(tempPath).catch(() => {});
|
|
3271
|
+
throw error;
|
|
3272
|
+
}
|
|
3273
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
3274
|
+
throw error;
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3224
3278
|
var saveEnvFileAsync = async ({
|
|
3225
3279
|
envPath,
|
|
3226
3280
|
data,
|
|
@@ -3248,10 +3302,18 @@ var saveEnvFileAsync = async ({
|
|
|
3248
3302
|
`)}
|
|
3249
3303
|
`;
|
|
3250
3304
|
const dir = fs.path.dirname(absolutePath);
|
|
3251
|
-
await fs.mkdir(dir);
|
|
3252
|
-
const
|
|
3253
|
-
|
|
3254
|
-
|
|
3305
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
3306
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
3307
|
+
if (authHomeDir !== undefined) {
|
|
3308
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
3309
|
+
}
|
|
3310
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
3311
|
+
try {
|
|
3312
|
+
await fs.rename(tempPath, absolutePath);
|
|
3313
|
+
} catch (error) {
|
|
3314
|
+
await fs.rm(tempPath).catch(() => {});
|
|
3315
|
+
throw error;
|
|
3316
|
+
}
|
|
3255
3317
|
};
|
|
3256
3318
|
|
|
3257
3319
|
// ../../auth/src/loginStatus.ts
|
|
@@ -12059,4 +12121,4 @@ export {
|
|
|
12059
12121
|
registerCommands
|
|
12060
12122
|
};
|
|
12061
12123
|
|
|
12062
|
-
//# debugId=
|
|
12124
|
+
//# debugId=2DEA520D6FE6DA3964756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/authz-commands",
|
|
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
|
"description": "Admin CLI commands for the UiPath Authorization service. Library composed by admin-tool, not a standalone CLI tool.",
|
|
7
7
|
"private": false,
|
|
8
8
|
"repository": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a752d8a8d78de138e3be0a19642620fec7893d99"
|
|
30
30
|
}
|