@uipath/pm-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-e5pbrbz2.js";
6
+ } from "./tool-twhgpjtk.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/pm-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: "Process Mining — process apps, transformations, and data ingestion.",
2087
2087
  private: false,
2088
2088
  repository: {
@@ -2174,12 +2174,26 @@ class NodeFileSystem {
2174
2174
  throw error;
2175
2175
  }
2176
2176
  }
2177
- async writeFile(filePath, data) {
2177
+ async writeFile(filePath, data, options) {
2178
2178
  const dir = path.dirname(filePath);
2179
2179
  if (dir) {
2180
2180
  await fs.mkdir(dir, { recursive: true });
2181
2181
  }
2182
- await fs.writeFile(filePath, data);
2182
+ if (options?.mode === undefined || process.platform === "win32") {
2183
+ if (options?.exclusive) {
2184
+ await fs.writeFile(filePath, data, { flag: "wx" });
2185
+ } else {
2186
+ await fs.writeFile(filePath, data);
2187
+ }
2188
+ return;
2189
+ }
2190
+ const handle = await fs.open(filePath, options.exclusive ? "wx" : "w", options.mode);
2191
+ try {
2192
+ await handle.chmod(options.mode);
2193
+ await handle.writeFile(data);
2194
+ } finally {
2195
+ await handle.close();
2196
+ }
2183
2197
  }
2184
2198
  async appendFile(filePath, data) {
2185
2199
  const dir = path.dirname(filePath);
@@ -2214,7 +2228,8 @@ class NodeFileSystem {
2214
2228
  isDirectory: () => stats.isDirectory(),
2215
2229
  size: stats.size,
2216
2230
  mtimeMs: stats.mtimeMs,
2217
- ctimeMs: stats.ctimeMs
2231
+ ctimeMs: stats.ctimeMs,
2232
+ mode: stats.mode
2218
2233
  };
2219
2234
  } catch (error) {
2220
2235
  if (this.isEnoent(error))
@@ -2225,8 +2240,13 @@ class NodeFileSystem {
2225
2240
  async exists(filePath) {
2226
2241
  return existsSync(filePath);
2227
2242
  }
2228
- async mkdir(dirPath) {
2229
- await fs.mkdir(dirPath, { recursive: true });
2243
+ async mkdir(dirPath, options) {
2244
+ await fs.mkdir(dirPath, { recursive: true, mode: options?.mode });
2245
+ }
2246
+ async chmod(targetPath, mode) {
2247
+ if (process.platform === "win32")
2248
+ return;
2249
+ await fs.chmod(targetPath, mode);
2230
2250
  }
2231
2251
  async acquireLock(lockPath) {
2232
2252
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -6947,6 +6967,8 @@ function settlePromiseLike2(thenable) {
6947
6967
  // ../auth/src/constants.ts
6948
6968
  var UIPATH_HOME_DIR = ".uipath";
6949
6969
  var AUTH_FILENAME = ".auth";
6970
+ var AUTH_FILE_MODE = 384;
6971
+ var AUTH_DIR_MODE = 448;
6950
6972
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
6951
6973
  var DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
6952
6974
 
@@ -7770,6 +7792,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
7770
7792
  }
7771
7793
  return parseEnvContent(content);
7772
7794
  };
7795
+ var findAuthHomeDir = (fs, dir) => {
7796
+ let current = dir;
7797
+ for (;; ) {
7798
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
7799
+ return current;
7800
+ const parent = fs.path.dirname(current);
7801
+ if (parent === current)
7802
+ return;
7803
+ current = parent;
7804
+ }
7805
+ };
7806
+ var TEMP_FILE_ATTEMPTS = 5;
7807
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
7808
+ var writeTempFile = async (fs, targetPath, content) => {
7809
+ for (let attempt = 1;; attempt++) {
7810
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
7811
+ try {
7812
+ await fs.writeFile(tempPath, content, {
7813
+ mode: AUTH_FILE_MODE,
7814
+ exclusive: true
7815
+ });
7816
+ return tempPath;
7817
+ } catch (error) {
7818
+ if (!isFileExists(error)) {
7819
+ await fs.rm(tempPath).catch(() => {});
7820
+ throw error;
7821
+ }
7822
+ if (attempt === TEMP_FILE_ATTEMPTS)
7823
+ throw error;
7824
+ }
7825
+ }
7826
+ };
7773
7827
  var saveEnvFileAsync = async ({
7774
7828
  envPath,
7775
7829
  data,
@@ -7797,10 +7851,18 @@ var saveEnvFileAsync = async ({
7797
7851
  `)}
7798
7852
  `;
7799
7853
  const dir = fs.path.dirname(absolutePath);
7800
- await fs.mkdir(dir);
7801
- const tempPath = `${absolutePath}.tmp`;
7802
- await fs.writeFile(tempPath, content);
7803
- await fs.rename(tempPath, absolutePath);
7854
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
7855
+ const authHomeDir = findAuthHomeDir(fs, dir);
7856
+ if (authHomeDir !== undefined) {
7857
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
7858
+ }
7859
+ const tempPath = await writeTempFile(fs, absolutePath, content);
7860
+ try {
7861
+ await fs.rename(tempPath, absolutePath);
7862
+ } catch (error) {
7863
+ await fs.rm(tempPath).catch(() => {});
7864
+ throw error;
7865
+ }
7804
7866
  };
7805
7867
 
7806
7868
  // ../auth/src/loginStatus.ts
@@ -10459,9 +10521,20 @@ async function uploadParts(config, bytes, parts) {
10459
10521
  await Promise.all(Array.from({ length: Math.min(MAX_CONCURRENT_UPLOADS, parts.length) }, () => worker()));
10460
10522
  return completed;
10461
10523
  }
10524
+ function isPmServiceUri(config, uri) {
10525
+ let target;
10526
+ let service;
10527
+ try {
10528
+ target = new URL(uri);
10529
+ service = new URL(`${config.baseUrl.replace(/\/+$/, "")}/${encodeURIComponent(config.organizationName)}/${encodeURIComponent(config.tenantName)}/processmining_/`);
10530
+ } catch {
10531
+ return false;
10532
+ }
10533
+ return target.origin === service.origin && target.username === "" && target.password === "" && target.pathname.startsWith(service.pathname);
10534
+ }
10462
10535
  async function uploadPart(config, part, content) {
10463
10536
  const headers = { "Content-Type": "text/csv" };
10464
- if (part.uri.startsWith(config.baseUrl)) {
10537
+ if (isPmServiceUri(config, part.uri)) {
10465
10538
  headers.Authorization = `Bearer ${config.authToken}`;
10466
10539
  }
10467
10540
  const response = await fetch(part.uri, {
@@ -11284,4 +11357,4 @@ var registerCommands2 = async (program) => {
11284
11357
 
11285
11358
  export { Command, metadata2, registerCommands2 };
11286
11359
 
11287
- //# debugId=271579DC43DE2D0E64756E2164756E21
11360
+ //# debugId=2D535A145F9F649664756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-e5pbrbz2.js";
4
+ } from "./tool-twhgpjtk.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/pm-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": "Process Mining — process apps, transformations, and data ingestion.",
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
  }