@uipath/insights-sdk 1.206.0-preview.306 → 1.207.0-preview.307

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.
@@ -40,13 +40,15 @@ var ProjectDimensions = {
40
40
  SolutionKey: "SolutionKey",
41
41
  SolutionProjectKey: "SolutionProjectKey",
42
42
  SolutionIdentityStatus: "SolutionIdentityStatus",
43
- PreviousSolutionKey: "PreviousSolutionKey"
43
+ PreviousSolutionKey: "PreviousSolutionKey",
44
+ PreviousProjectKey: "PreviousProjectKey"
44
45
  };
45
46
  var GUID_KEY_DIMENSIONS = new Set([
46
47
  ProjectDimensions.ProjectKey,
47
48
  ProjectDimensions.SolutionKey,
48
49
  ProjectDimensions.SolutionProjectKey,
49
- ProjectDimensions.PreviousSolutionKey
50
+ ProjectDimensions.PreviousSolutionKey,
51
+ ProjectDimensions.PreviousProjectKey
50
52
  ]);
51
53
  var ShipDimensions = {
52
54
  ShipKind: "ShipKind",
@@ -145,7 +147,7 @@ var CURATED_DIMENSIONS = new Set([
145
147
  ...Object.values(ProjectDimensions)
146
148
  ]);
147
149
 
148
- // ../common/src/telemetry/pseudonymize.ts
150
+ // ../common/src/sha256.ts
149
151
  var SHA256_K = new Uint32Array([
150
152
  1116352408,
151
153
  1899447441,
@@ -521,7 +523,7 @@ var package_default = {
521
523
  name: "@uipath/insights-sdk",
522
524
  author: "UiPath",
523
525
  license: "SEE LICENSE IN LICENSE.txt",
524
- version: "1.206.0-preview.306",
526
+ version: "1.207.0-preview.307",
525
527
  description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
526
528
  repository: {
527
529
  type: "git",
@@ -1969,4 +1971,4 @@ export {
1969
1971
  verifyExportDestination
1970
1972
  };
1971
1973
 
1972
- //# debugId=413E5A06C0DC71D664756E2164756E21
1974
+ //# debugId=FF7FE39EE429D8A064756E2164756E21
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ function settlePromiseLike2(thenable) {
41
41
  }
42
42
 
43
43
  // ../auth/src/constants.ts
44
- var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS;
44
+ var UIPATH_HOME_DIR = ".uipath", AUTH_FILENAME = ".auth", AUTH_FILE_MODE = 384, AUTH_DIR_MODE = 448, DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS;
45
45
  var init_constants = __esm(() => {
46
46
  DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
47
47
  });
@@ -724,12 +724,26 @@ class NodeFileSystem {
724
724
  throw error;
725
725
  }
726
726
  }
727
- async writeFile(filePath, data) {
727
+ async writeFile(filePath, data, options) {
728
728
  const dir = path2.dirname(filePath);
729
729
  if (dir) {
730
730
  await fs6.mkdir(dir, { recursive: true });
731
731
  }
732
- await fs6.writeFile(filePath, data);
732
+ if (options?.mode === undefined || process.platform === "win32") {
733
+ if (options?.exclusive) {
734
+ await fs6.writeFile(filePath, data, { flag: "wx" });
735
+ } else {
736
+ await fs6.writeFile(filePath, data);
737
+ }
738
+ return;
739
+ }
740
+ const handle = await fs6.open(filePath, options.exclusive ? "wx" : "w", options.mode);
741
+ try {
742
+ await handle.chmod(options.mode);
743
+ await handle.writeFile(data);
744
+ } finally {
745
+ await handle.close();
746
+ }
733
747
  }
734
748
  async appendFile(filePath, data) {
735
749
  const dir = path2.dirname(filePath);
@@ -764,7 +778,8 @@ class NodeFileSystem {
764
778
  isDirectory: () => stats.isDirectory(),
765
779
  size: stats.size,
766
780
  mtimeMs: stats.mtimeMs,
767
- ctimeMs: stats.ctimeMs
781
+ ctimeMs: stats.ctimeMs,
782
+ mode: stats.mode
768
783
  };
769
784
  } catch (error) {
770
785
  if (this.isEnoent(error))
@@ -775,8 +790,13 @@ class NodeFileSystem {
775
790
  async exists(filePath) {
776
791
  return existsSync(filePath);
777
792
  }
778
- async mkdir(dirPath) {
779
- await fs6.mkdir(dirPath, { recursive: true });
793
+ async mkdir(dirPath, options) {
794
+ await fs6.mkdir(dirPath, { recursive: true, mode: options?.mode });
795
+ }
796
+ async chmod(targetPath, mode) {
797
+ if (process.platform === "win32")
798
+ return;
799
+ await fs6.chmod(targetPath, mode);
780
800
  }
781
801
  async acquireLock(lockPath) {
782
802
  const canonicalPath = await this.canonicalizeLockTarget(lockPath);
@@ -926,7 +946,7 @@ class NodeFileSystem {
926
946
  async getTempDir() {
927
947
  return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
928
948
  }
929
- async copyDirectory(sourcePath, destPath) {
949
+ async copyDirectory(sourcePath, destPath, options) {
930
950
  const sourceStats = await this.stat(sourcePath);
931
951
  if (!sourceStats) {
932
952
  throw new Error(`Source directory does not exist: ${sourcePath}`);
@@ -943,7 +963,9 @@ class NodeFileSystem {
943
963
  if (!entryStats)
944
964
  continue;
945
965
  if (entryStats.isDirectory()) {
946
- await this.copyDirectory(srcEntry, destEntry);
966
+ if (options?.skipDirectoryNames?.includes(entry))
967
+ continue;
968
+ await this.copyDirectory(srcEntry, destEntry, options);
947
969
  } else if (entryStats.isFile()) {
948
970
  const content = await this.readFile(srcEntry);
949
971
  if (content !== null) {
@@ -1014,13 +1036,15 @@ var ProjectDimensions = {
1014
1036
  SolutionKey: "SolutionKey",
1015
1037
  SolutionProjectKey: "SolutionProjectKey",
1016
1038
  SolutionIdentityStatus: "SolutionIdentityStatus",
1017
- PreviousSolutionKey: "PreviousSolutionKey"
1039
+ PreviousSolutionKey: "PreviousSolutionKey",
1040
+ PreviousProjectKey: "PreviousProjectKey"
1018
1041
  };
1019
1042
  var GUID_KEY_DIMENSIONS = new Set([
1020
1043
  ProjectDimensions.ProjectKey,
1021
1044
  ProjectDimensions.SolutionKey,
1022
1045
  ProjectDimensions.SolutionProjectKey,
1023
- ProjectDimensions.PreviousSolutionKey
1046
+ ProjectDimensions.PreviousSolutionKey,
1047
+ ProjectDimensions.PreviousProjectKey
1024
1048
  ]);
1025
1049
  var ShipDimensions = {
1026
1050
  ShipKind: "ShipKind",
@@ -1119,7 +1143,7 @@ var CURATED_DIMENSIONS = new Set([
1119
1143
  ...Object.values(ProjectDimensions)
1120
1144
  ]);
1121
1145
 
1122
- // ../common/src/telemetry/pseudonymize.ts
1146
+ // ../common/src/sha256.ts
1123
1147
  var SHA256_K = new Uint32Array([
1124
1148
  1116352408,
1125
1149
  1899447441,
@@ -1495,7 +1519,7 @@ var package_default = {
1495
1519
  name: "@uipath/insights-sdk",
1496
1520
  author: "UiPath",
1497
1521
  license: "SEE LICENSE IN LICENSE.txt",
1498
- version: "1.206.0-preview.306",
1522
+ version: "1.207.0-preview.307",
1499
1523
  description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
1500
1524
  repository: {
1501
1525
  type: "git",
@@ -2887,6 +2911,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
2887
2911
  }
2888
2912
  return parseEnvContent(content);
2889
2913
  };
2914
+ var findAuthHomeDir = (fs, dir) => {
2915
+ let current = dir;
2916
+ for (;; ) {
2917
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
2918
+ return current;
2919
+ const parent = fs.path.dirname(current);
2920
+ if (parent === current)
2921
+ return;
2922
+ current = parent;
2923
+ }
2924
+ };
2925
+ var TEMP_FILE_ATTEMPTS = 5;
2926
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
2927
+ var writeTempFile = async (fs, targetPath, content) => {
2928
+ for (let attempt = 1;; attempt++) {
2929
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
2930
+ try {
2931
+ await fs.writeFile(tempPath, content, {
2932
+ mode: AUTH_FILE_MODE,
2933
+ exclusive: true
2934
+ });
2935
+ return tempPath;
2936
+ } catch (error) {
2937
+ if (!isFileExists(error)) {
2938
+ await fs.rm(tempPath).catch(() => {});
2939
+ throw error;
2940
+ }
2941
+ if (attempt === TEMP_FILE_ATTEMPTS)
2942
+ throw error;
2943
+ }
2944
+ }
2945
+ };
2890
2946
  var saveEnvFileAsync = async ({
2891
2947
  envPath,
2892
2948
  data,
@@ -2914,10 +2970,18 @@ var saveEnvFileAsync = async ({
2914
2970
  `)}
2915
2971
  `;
2916
2972
  const dir = fs.path.dirname(absolutePath);
2917
- await fs.mkdir(dir);
2918
- const tempPath = `${absolutePath}.tmp`;
2919
- await fs.writeFile(tempPath, content);
2920
- await fs.rename(tempPath, absolutePath);
2973
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
2974
+ const authHomeDir = findAuthHomeDir(fs, dir);
2975
+ if (authHomeDir !== undefined) {
2976
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
2977
+ }
2978
+ const tempPath = await writeTempFile(fs, absolutePath, content);
2979
+ try {
2980
+ await fs.rename(tempPath, absolutePath);
2981
+ } catch (error) {
2982
+ await fs.rm(tempPath).catch(() => {});
2983
+ throw error;
2984
+ }
2921
2985
  };
2922
2986
 
2923
2987
  // ../auth/src/loginStatus.ts
@@ -3523,6 +3587,8 @@ var TENANT_SELECTION_CODES = new Set([
3523
3587
  ]);
3524
3588
  // ../auth/src/logout.ts
3525
3589
  init_src();
3590
+ // ../auth/src/utils/lockedEnvFile.ts
3591
+ init_src();
3526
3592
  // src/client-factory.ts
3527
3593
  async function createInsightsConfig(tenantOverride) {
3528
3594
  const ctx = await getAuthContext({
@@ -4404,4 +4470,4 @@ export {
4404
4470
  verifyExportDestination
4405
4471
  };
4406
4472
 
4407
- //# debugId=EAC4184FF849AF5C64756E2164756E21
4473
+ //# debugId=393A85700DA6202A64756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/insights-sdk",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.206.0-preview.306",
5
+ "version": "1.207.0-preview.307",
6
6
  "description": "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -35,5 +35,5 @@
35
35
  "files": [
36
36
  "dist"
37
37
  ],
38
- "gitHead": "0b8843ae9b6d2f69a0203f96ab91e5d55e416383"
38
+ "gitHead": "a625ed8ac421089170db3cb8b95c497f3c7b0d62"
39
39
  }