@uipath/oms-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
|
@@ -2127,12 +2127,26 @@ class NodeFileSystem {
|
|
|
2127
2127
|
throw error;
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
|
-
async writeFile(filePath, data) {
|
|
2130
|
+
async writeFile(filePath, data, options) {
|
|
2131
2131
|
const dir = path.dirname(filePath);
|
|
2132
2132
|
if (dir) {
|
|
2133
2133
|
await fs.mkdir(dir, { recursive: true });
|
|
2134
2134
|
}
|
|
2135
|
-
|
|
2135
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
2136
|
+
if (options?.exclusive) {
|
|
2137
|
+
await fs.writeFile(filePath, data, { flag: "wx" });
|
|
2138
|
+
} else {
|
|
2139
|
+
await fs.writeFile(filePath, data);
|
|
2140
|
+
}
|
|
2141
|
+
return;
|
|
2142
|
+
}
|
|
2143
|
+
const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
2144
|
+
try {
|
|
2145
|
+
await handle.chmod(options.mode);
|
|
2146
|
+
await handle.writeFile(data);
|
|
2147
|
+
} finally {
|
|
2148
|
+
await handle.close();
|
|
2149
|
+
}
|
|
2136
2150
|
}
|
|
2137
2151
|
async appendFile(filePath, data) {
|
|
2138
2152
|
const dir = path.dirname(filePath);
|
|
@@ -2167,7 +2181,8 @@ class NodeFileSystem {
|
|
|
2167
2181
|
isDirectory: () => stats.isDirectory(),
|
|
2168
2182
|
size: stats.size,
|
|
2169
2183
|
mtimeMs: stats.mtimeMs,
|
|
2170
|
-
ctimeMs: stats.ctimeMs
|
|
2184
|
+
ctimeMs: stats.ctimeMs,
|
|
2185
|
+
mode: stats.mode
|
|
2171
2186
|
};
|
|
2172
2187
|
} catch (error) {
|
|
2173
2188
|
if (this.isEnoent(error))
|
|
@@ -2178,8 +2193,13 @@ class NodeFileSystem {
|
|
|
2178
2193
|
async exists(filePath) {
|
|
2179
2194
|
return existsSync(filePath);
|
|
2180
2195
|
}
|
|
2181
|
-
async mkdir(dirPath) {
|
|
2182
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
2196
|
+
async mkdir(dirPath, options) {
|
|
2197
|
+
await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
2198
|
+
}
|
|
2199
|
+
async chmod(targetPath, mode) {
|
|
2200
|
+
if (process.platform === "win32")
|
|
2201
|
+
return;
|
|
2202
|
+
await fs.chmod(targetPath, mode);
|
|
2183
2203
|
}
|
|
2184
2204
|
async acquireLock(lockPath) {
|
|
2185
2205
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -9433,6 +9453,8 @@ function settlePromiseLike2(thenable) {
|
|
|
9433
9453
|
// ../../auth/src/constants.ts
|
|
9434
9454
|
var UIPATH_HOME_DIR = ".uipath";
|
|
9435
9455
|
var AUTH_FILENAME = ".auth";
|
|
9456
|
+
var AUTH_FILE_MODE = 384;
|
|
9457
|
+
var AUTH_DIR_MODE = 448;
|
|
9436
9458
|
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
9437
9459
|
var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
9438
9460
|
|
|
@@ -10256,6 +10278,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
10256
10278
|
}
|
|
10257
10279
|
return parseEnvContent(content);
|
|
10258
10280
|
};
|
|
10281
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
10282
|
+
let current = dir;
|
|
10283
|
+
for (;; ) {
|
|
10284
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR)
|
|
10285
|
+
return current;
|
|
10286
|
+
const parent = fs.path.dirname(current);
|
|
10287
|
+
if (parent === current)
|
|
10288
|
+
return;
|
|
10289
|
+
current = parent;
|
|
10290
|
+
}
|
|
10291
|
+
};
|
|
10292
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
10293
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
10294
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
10295
|
+
for (let attempt = 1;; attempt++) {
|
|
10296
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
10297
|
+
try {
|
|
10298
|
+
await fs.writeFile(tempPath, content, {
|
|
10299
|
+
mode: AUTH_FILE_MODE,
|
|
10300
|
+
exclusive: true
|
|
10301
|
+
});
|
|
10302
|
+
return tempPath;
|
|
10303
|
+
} catch (error) {
|
|
10304
|
+
if (!isFileExists(error)) {
|
|
10305
|
+
await fs.rm(tempPath).catch(() => {});
|
|
10306
|
+
throw error;
|
|
10307
|
+
}
|
|
10308
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
10309
|
+
throw error;
|
|
10310
|
+
}
|
|
10311
|
+
}
|
|
10312
|
+
};
|
|
10259
10313
|
var saveEnvFileAsync = async ({
|
|
10260
10314
|
envPath,
|
|
10261
10315
|
data,
|
|
@@ -10283,10 +10337,18 @@ var saveEnvFileAsync = async ({
|
|
|
10283
10337
|
`)}
|
|
10284
10338
|
`;
|
|
10285
10339
|
const dir = fs.path.dirname(absolutePath);
|
|
10286
|
-
await fs.mkdir(dir);
|
|
10287
|
-
const
|
|
10288
|
-
|
|
10289
|
-
|
|
10340
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
10341
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
10342
|
+
if (authHomeDir !== undefined) {
|
|
10343
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
10344
|
+
}
|
|
10345
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
10346
|
+
try {
|
|
10347
|
+
await fs.rename(tempPath, absolutePath);
|
|
10348
|
+
} catch (error) {
|
|
10349
|
+
await fs.rm(tempPath).catch(() => {});
|
|
10350
|
+
throw error;
|
|
10351
|
+
}
|
|
10290
10352
|
};
|
|
10291
10353
|
|
|
10292
10354
|
// ../../auth/src/loginStatus.ts
|
|
@@ -12116,4 +12178,4 @@ export {
|
|
|
12116
12178
|
registerCommands
|
|
12117
12179
|
};
|
|
12118
12180
|
|
|
12119
|
-
//# debugId=
|
|
12181
|
+
//# debugId=9D4245499797C3D364756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uipath/oms-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 Organization Management 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
|
}
|