@uipath/llmgw-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-sghjyf66.js";
6
+ } from "./tool-72dp1ajv.js";
7
7
 
8
8
  // src/index.ts
9
9
  var program = new Command;
@@ -2082,7 +2082,7 @@ var package_default = {
2082
2082
  name: "@uipath/llmgw-tool",
2083
2083
  author: "UiPath",
2084
2084
  license: "SEE LICENSE IN LICENSE.txt",
2085
- version: "1.206.0-preview.311",
2085
+ version: "1.206.0-preview.323",
2086
2086
  description: "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
2087
2087
  private: false,
2088
2088
  repository: {
@@ -2171,12 +2171,26 @@ class NodeFileSystem {
2171
2171
  throw error;
2172
2172
  }
2173
2173
  }
2174
- async writeFile(filePath, data) {
2174
+ async writeFile(filePath, data, options) {
2175
2175
  const dir = path.dirname(filePath);
2176
2176
  if (dir) {
2177
2177
  await fs.mkdir(dir, { recursive: true });
2178
2178
  }
2179
- await fs.writeFile(filePath, data);
2179
+ if (options?.mode === undefined || process.platform === "win32") {
2180
+ if (options?.exclusive) {
2181
+ await fs.writeFile(filePath, data, { flag: "wx" });
2182
+ } else {
2183
+ await fs.writeFile(filePath, data);
2184
+ }
2185
+ return;
2186
+ }
2187
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
2188
+ try {
2189
+ await handle.chmod(options.mode);
2190
+ await handle.writeFile(data);
2191
+ } finally {
2192
+ await handle.close();
2193
+ }
2180
2194
  }
2181
2195
  async appendFile(filePath, data) {
2182
2196
  const dir = path.dirname(filePath);
@@ -2211,7 +2225,8 @@ class NodeFileSystem {
2211
2225
  isDirectory: () => stats.isDirectory(),
2212
2226
  size: stats.size,
2213
2227
  mtimeMs: stats.mtimeMs,
2214
- ctimeMs: stats.ctimeMs
2228
+ ctimeMs: stats.ctimeMs,
2229
+ mode: stats.mode
2215
2230
  };
2216
2231
  } catch (error) {
2217
2232
  if (this.isEnoent(error))
@@ -2222,8 +2237,13 @@ class NodeFileSystem {
2222
2237
  async exists(filePath) {
2223
2238
  return existsSync(filePath);
2224
2239
  }
2225
- async mkdir(dirPath) {
2226
- await fs.mkdir(dirPath, { recursive: true });
2240
+ async mkdir(dirPath, options) {
2241
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
2242
+ }
2243
+ async chmod(targetPath, mode) {
2244
+ if (process.platform === "win32")
2245
+ return;
2246
+ await fs.chmod(targetPath, mode);
2227
2247
  }
2228
2248
  async acquireLock(lockPath) {
2229
2249
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -6935,6 +6955,8 @@ function settlePromiseLike2(thenable) {
6935
6955
  // ../../auth/src/constants.ts
6936
6956
  var UIPATH_HOME_DIR = ".uipath";
6937
6957
  var AUTH_FILENAME = ".auth";
6958
+ var AUTH_FILE_MODE = 384;
6959
+ var AUTH_DIR_MODE = 448;
6938
6960
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
6939
6961
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
6940
6962
 
@@ -7758,6 +7780,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
7758
7780
  }
7759
7781
  return parseEnvContent(content);
7760
7782
  };
7783
+ var findAuthHomeDir = (fs, dir) => {
7784
+ let current = dir;
7785
+ for (;; ) {
7786
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
7787
+ return current;
7788
+ const parent = fs.path.dirname(current);
7789
+ if (parent === current)
7790
+ return;
7791
+ current = parent;
7792
+ }
7793
+ };
7794
+ var TEMP_FILE_ATTEMPTS = 5;
7795
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
7796
+ var writeTempFile = async (fs, targetPath, content) => {
7797
+ for (let attempt = 1;; attempt++) {
7798
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
7799
+ try {
7800
+ await fs.writeFile(tempPath, content, {
7801
+ mode: AUTH_FILE_MODE,
7802
+ exclusive: true
7803
+ });
7804
+ return tempPath;
7805
+ } catch (error) {
7806
+ if (!isFileExists(error)) {
7807
+ await fs.rm(tempPath).catch(() => {});
7808
+ throw error;
7809
+ }
7810
+ if (attempt === TEMP_FILE_ATTEMPTS)
7811
+ throw error;
7812
+ }
7813
+ }
7814
+ };
7761
7815
  var saveEnvFileAsync = async ({
7762
7816
  envPath,
7763
7817
  data,
@@ -7785,10 +7839,18 @@ var saveEnvFileAsync = async ({
7785
7839
  `)}
7786
7840
  `;
7787
7841
  const dir = fs.path.dirname(absolutePath);
7788
- await fs.mkdir(dir);
7789
- const tempPath = `${absolutePath}.tmp`;
7790
- await fs.writeFile(tempPath, content);
7791
- await fs.rename(tempPath, absolutePath);
7842
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
7843
+ const authHomeDir = findAuthHomeDir(fs, dir);
7844
+ if (authHomeDir !== undefined) {
7845
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
7846
+ }
7847
+ const tempPath = await writeTempFile(fs, absolutePath, content);
7848
+ try {
7849
+ await fs.rename(tempPath, absolutePath);
7850
+ } catch (error) {
7851
+ await fs.rm(tempPath).catch(() => {});
7852
+ throw error;
7853
+ }
7792
7854
  };
7793
7855
 
7794
7856
  // ../../auth/src/loginStatus.ts
@@ -9751,4 +9813,4 @@ var registerCommands2 = async (program) => {
9751
9813
 
9752
9814
  export { Command, metadata2, registerCommands2 };
9753
9815
 
9754
- //# debugId=E7A25DA56B4AD47B64756E2164756E21
9816
+ //# debugId=B69867ED1110373A64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-sghjyf66.js";
4
+ } from "./tool-72dp1ajv.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/llmgw-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": "CLI plugin for UiPath AI Trust Layer Bring-Your-Own LLM connections.",
7
7
  "private": false,
8
8
  "repository": {
@@ -24,5 +24,5 @@
24
24
  "files": [
25
25
  "dist"
26
26
  ],
27
- "gitHead": "562a7f94aae12bb340f2b18932e8809c3d76a3e0"
27
+ "gitHead": "a752d8a8d78de138e3be0a19642620fec7893d99"
28
28
  }