@uipath/docsai-tool 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 CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata2,
5
5
  registerCommands2
6
- } from "./tool-bnw04w9x.js";
6
+ } from "./tool-70673m1v.js";
7
7
 
8
8
  // src/index.ts
9
9
  var program = new Command;
@@ -9023,7 +9023,7 @@ var package_default = {
9023
9023
  name: "@uipath/docsai-tool",
9024
9024
  author: "UiPath",
9025
9025
  license: "SEE LICENSE IN LICENSE.txt",
9026
- version: "1.206.0-preview.311",
9026
+ version: "1.206.0-preview.323",
9027
9027
  description: "Search UiPath documentation with AI-powered answers.",
9028
9028
  private: false,
9029
9029
  repository: {
@@ -9116,12 +9116,26 @@ class NodeFileSystem {
9116
9116
  throw error;
9117
9117
  }
9118
9118
  }
9119
- async writeFile(filePath, data) {
9119
+ async writeFile(filePath, data, options) {
9120
9120
  const dir = path.dirname(filePath);
9121
9121
  if (dir) {
9122
9122
  await fs.mkdir(dir, { recursive: true });
9123
9123
  }
9124
- await fs.writeFile(filePath, data);
9124
+ if (options?.mode === undefined || process.platform === "win32") {
9125
+ if (options?.exclusive) {
9126
+ await fs.writeFile(filePath, data, { flag: "wx" });
9127
+ } else {
9128
+ await fs.writeFile(filePath, data);
9129
+ }
9130
+ return;
9131
+ }
9132
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
9133
+ try {
9134
+ await handle.chmod(options.mode);
9135
+ await handle.writeFile(data);
9136
+ } finally {
9137
+ await handle.close();
9138
+ }
9125
9139
  }
9126
9140
  async appendFile(filePath, data) {
9127
9141
  const dir = path.dirname(filePath);
@@ -9156,7 +9170,8 @@ class NodeFileSystem {
9156
9170
  isDirectory: () => stats.isDirectory(),
9157
9171
  size: stats.size,
9158
9172
  mtimeMs: stats.mtimeMs,
9159
- ctimeMs: stats.ctimeMs
9173
+ ctimeMs: stats.ctimeMs,
9174
+ mode: stats.mode
9160
9175
  };
9161
9176
  } catch (error) {
9162
9177
  if (this.isEnoent(error))
@@ -9167,8 +9182,13 @@ class NodeFileSystem {
9167
9182
  async exists(filePath) {
9168
9183
  return existsSync(filePath);
9169
9184
  }
9170
- async mkdir(dirPath) {
9171
- await fs.mkdir(dirPath, { recursive: true });
9185
+ async mkdir(dirPath, options) {
9186
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
9187
+ }
9188
+ async chmod(targetPath, mode) {
9189
+ if (process.platform === "win32")
9190
+ return;
9191
+ await fs.chmod(targetPath, mode);
9172
9192
  }
9173
9193
  async acquireLock(lockPath) {
9174
9194
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -13893,6 +13913,8 @@ function settlePromiseLike2(thenable) {
13893
13913
  // ../auth/src/constants.ts
13894
13914
  var UIPATH_HOME_DIR = ".uipath";
13895
13915
  var AUTH_FILENAME = ".auth";
13916
+ var AUTH_FILE_MODE = 384;
13917
+ var AUTH_DIR_MODE = 448;
13896
13918
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
13897
13919
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
13898
13920
 
@@ -14716,6 +14738,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
14716
14738
  }
14717
14739
  return parseEnvContent(content);
14718
14740
  };
14741
+ var findAuthHomeDir = (fs, dir) => {
14742
+ let current = dir;
14743
+ for (;; ) {
14744
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
14745
+ return current;
14746
+ const parent = fs.path.dirname(current);
14747
+ if (parent === current)
14748
+ return;
14749
+ current = parent;
14750
+ }
14751
+ };
14752
+ var TEMP_FILE_ATTEMPTS = 5;
14753
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
14754
+ var writeTempFile = async (fs, targetPath, content) => {
14755
+ for (let attempt = 1;; attempt++) {
14756
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
14757
+ try {
14758
+ await fs.writeFile(tempPath, content, {
14759
+ mode: AUTH_FILE_MODE,
14760
+ exclusive: true
14761
+ });
14762
+ return tempPath;
14763
+ } catch (error) {
14764
+ if (!isFileExists(error)) {
14765
+ await fs.rm(tempPath).catch(() => {});
14766
+ throw error;
14767
+ }
14768
+ if (attempt === TEMP_FILE_ATTEMPTS)
14769
+ throw error;
14770
+ }
14771
+ }
14772
+ };
14719
14773
  var saveEnvFileAsync = async ({
14720
14774
  envPath,
14721
14775
  data,
@@ -14743,10 +14797,18 @@ var saveEnvFileAsync = async ({
14743
14797
  `)}
14744
14798
  `;
14745
14799
  const dir = fs.path.dirname(absolutePath);
14746
- await fs.mkdir(dir);
14747
- const tempPath = `${absolutePath}.tmp`;
14748
- await fs.writeFile(tempPath, content);
14749
- await fs.rename(tempPath, absolutePath);
14800
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
14801
+ const authHomeDir = findAuthHomeDir(fs, dir);
14802
+ if (authHomeDir !== undefined) {
14803
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
14804
+ }
14805
+ const tempPath = await writeTempFile(fs, absolutePath, content);
14806
+ try {
14807
+ await fs.rename(tempPath, absolutePath);
14808
+ } catch (error) {
14809
+ await fs.rm(tempPath).catch(() => {});
14810
+ throw error;
14811
+ }
14750
14812
  };
14751
14813
 
14752
14814
  // ../auth/src/loginStatus.ts
@@ -25562,4 +25624,4 @@ var registerCommands2 = async (program) => {
25562
25624
 
25563
25625
  export { Command, metadata2, registerCommands2 };
25564
25626
 
25565
- //# debugId=A27D913F9D9A7FFF64756E2164756E21
25627
+ //# debugId=BF9C6902E0C01E5C64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-bnw04w9x.js";
4
+ } from "./tool-70673m1v.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/docsai-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.206.0-preview.311",
5
+ "version": "1.206.0-preview.323",
6
6
  "description": "Search UiPath documentation with AI-powered answers.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "562a7f94aae12bb340f2b18932e8809c3d76a3e0"
30
+ "gitHead": "a752d8a8d78de138e3be0a19642620fec7893d99"
31
31
  }