@uipath/platform-tool 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/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata2,
5
5
  registerCommands2
6
- } from "./tool-wjvq7gmz.js";
6
+ } from "./tool-79bpj1mz.js";
7
7
 
8
8
  // src/index.ts
9
9
  var program = new Command;
@@ -28120,7 +28120,7 @@ var package_default = {
28120
28120
  name: "@uipath/platform-tool",
28121
28121
  author: "UiPath",
28122
28122
  license: "SEE LICENSE IN LICENSE.txt",
28123
- version: "1.206.0-preview.312",
28123
+ version: "1.206.0-preview.323",
28124
28124
  description: "Manage UiPath platform-level resources such as tenant licensing.",
28125
28125
  publishConfig: {
28126
28126
  registry: "https://npm.pkg.github.com/"
@@ -28192,6 +28192,8 @@ function settlePromiseLike(thenable) {
28192
28192
  // ../auth/src/constants.ts
28193
28193
  var UIPATH_HOME_DIR = ".uipath";
28194
28194
  var AUTH_FILENAME = ".auth";
28195
+ var AUTH_FILE_MODE = 384;
28196
+ var AUTH_DIR_MODE = 448;
28195
28197
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
28196
28198
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
28197
28199
 
@@ -28337,12 +28339,26 @@ class NodeFileSystem {
28337
28339
  throw error;
28338
28340
  }
28339
28341
  }
28340
- async writeFile(filePath, data) {
28342
+ async writeFile(filePath, data, options) {
28341
28343
  const dir = path.dirname(filePath);
28342
28344
  if (dir) {
28343
28345
  await fs.mkdir(dir, { recursive: true });
28344
28346
  }
28345
- await fs.writeFile(filePath, data);
28347
+ if (options?.mode === undefined || process.platform === "win32") {
28348
+ if (options?.exclusive) {
28349
+ await fs.writeFile(filePath, data, { flag: "wx" });
28350
+ } else {
28351
+ await fs.writeFile(filePath, data);
28352
+ }
28353
+ return;
28354
+ }
28355
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
28356
+ try {
28357
+ await handle.chmod(options.mode);
28358
+ await handle.writeFile(data);
28359
+ } finally {
28360
+ await handle.close();
28361
+ }
28346
28362
  }
28347
28363
  async appendFile(filePath, data) {
28348
28364
  const dir = path.dirname(filePath);
@@ -28377,7 +28393,8 @@ class NodeFileSystem {
28377
28393
  isDirectory: () => stats.isDirectory(),
28378
28394
  size: stats.size,
28379
28395
  mtimeMs: stats.mtimeMs,
28380
- ctimeMs: stats.ctimeMs
28396
+ ctimeMs: stats.ctimeMs,
28397
+ mode: stats.mode
28381
28398
  };
28382
28399
  } catch (error) {
28383
28400
  if (this.isEnoent(error))
@@ -28388,8 +28405,13 @@ class NodeFileSystem {
28388
28405
  async exists(filePath) {
28389
28406
  return existsSync(filePath);
28390
28407
  }
28391
- async mkdir(dirPath) {
28392
- await fs.mkdir(dirPath, { recursive: true });
28408
+ async mkdir(dirPath, options) {
28409
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
28410
+ }
28411
+ async chmod(targetPath, mode) {
28412
+ if (process.platform === "win32")
28413
+ return;
28414
+ await fs.chmod(targetPath, mode);
28393
28415
  }
28394
28416
  async acquireLock(lockPath) {
28395
28417
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -29304,6 +29326,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
29304
29326
  }
29305
29327
  return parseEnvContent(content);
29306
29328
  };
29329
+ var findAuthHomeDir = (fs, dir) => {
29330
+ let current = dir;
29331
+ for (;; ) {
29332
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
29333
+ return current;
29334
+ const parent = fs.path.dirname(current);
29335
+ if (parent === current)
29336
+ return;
29337
+ current = parent;
29338
+ }
29339
+ };
29340
+ var TEMP_FILE_ATTEMPTS = 5;
29341
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
29342
+ var writeTempFile = async (fs, targetPath, content) => {
29343
+ for (let attempt = 1;; attempt++) {
29344
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
29345
+ try {
29346
+ await fs.writeFile(tempPath, content, {
29347
+ mode: AUTH_FILE_MODE,
29348
+ exclusive: true
29349
+ });
29350
+ return tempPath;
29351
+ } catch (error) {
29352
+ if (!isFileExists(error)) {
29353
+ await fs.rm(tempPath).catch(() => {});
29354
+ throw error;
29355
+ }
29356
+ if (attempt === TEMP_FILE_ATTEMPTS)
29357
+ throw error;
29358
+ }
29359
+ }
29360
+ };
29307
29361
  var saveEnvFileAsync = async ({
29308
29362
  envPath,
29309
29363
  data,
@@ -29331,10 +29385,18 @@ var saveEnvFileAsync = async ({
29331
29385
  `)}
29332
29386
  `;
29333
29387
  const dir = fs.path.dirname(absolutePath);
29334
- await fs.mkdir(dir);
29335
- const tempPath = `${absolutePath}.tmp`;
29336
- await fs.writeFile(tempPath, content);
29337
- await fs.rename(tempPath, absolutePath);
29388
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
29389
+ const authHomeDir = findAuthHomeDir(fs, dir);
29390
+ if (authHomeDir !== undefined) {
29391
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
29392
+ }
29393
+ const tempPath = await writeTempFile(fs, absolutePath, content);
29394
+ try {
29395
+ await fs.rename(tempPath, absolutePath);
29396
+ } catch (error) {
29397
+ await fs.rm(tempPath).catch(() => {});
29398
+ throw error;
29399
+ }
29338
29400
  };
29339
29401
 
29340
29402
  // ../auth/src/loginStatus.ts
@@ -38640,4 +38702,4 @@ var registerCommands2 = async (program) => {
38640
38702
 
38641
38703
  export { Command, metadata2, registerCommands2 };
38642
38704
 
38643
- //# debugId=31E579BC5C0536FA64756E2164756E21
38705
+ //# debugId=0472F524359A5E2064756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-wjvq7gmz.js";
4
+ } from "./tool-79bpj1mz.js";
5
5
  export {
6
6
  metadata2 as metadata,
7
7
  registerCommands2 as registerCommands
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/platform-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.206.0-preview.312",
5
+ "version": "1.206.0-preview.323",
6
6
  "description": "Manage UiPath platform-level resources such as tenant licensing.",
7
7
  "publishConfig": {
8
8
  "registry": "https://registry.npmjs.org/"
@@ -21,5 +21,5 @@
21
21
  "keywords": [
22
22
  "cli-tool"
23
23
  ],
24
- "gitHead": "ee91749054ba110153977dd920a4c84761ce82cd"
24
+ "gitHead": "a752d8a8d78de138e3be0a19642620fec7893d99"
25
25
  }