@uipath/insights-sdk 1.205.0-preview.276 → 1.206.0-preview.279

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.
@@ -1,3 +1,150 @@
1
+ // ../common/src/telemetry/telemetry-dimensions.ts
2
+ var BaseDimensions = {
3
+ ApplicationName: "ApplicationName",
4
+ ProductVersion: "ProductVersion",
5
+ InstallationId: "InstallationId",
6
+ CloudUserId: "CloudUserId",
7
+ CloudTenantId: "CloudTenantId",
8
+ CloudOrganizationId: "CloudOrganizationId",
9
+ IsInternalUser: "IsInternalUser",
10
+ Environment: "Environment",
11
+ BaseUrl: "BaseUrl",
12
+ Region: "Region",
13
+ Agent: "Agent",
14
+ AgentVersion: "AgentVersion",
15
+ AgentModel: "AgentModel",
16
+ ToolName: "ToolName",
17
+ ToolVersion: "ToolVersion",
18
+ ExecutionContext: "ExecutionContext",
19
+ CiProvider: "CiProvider",
20
+ SessionIdSource: "SessionIdSource",
21
+ SessionId: "SessionId"
22
+ };
23
+ var CommandDimensions = {
24
+ IsCommand: "IsCommand",
25
+ IsReexec: "IsReexec",
26
+ CommandName: "CommandName",
27
+ ExitCode: "ExitCode",
28
+ TerminalOutcome: "TerminalOutcome",
29
+ ErrorClass: "ErrorClass",
30
+ TerminalSignal: "TerminalSignal",
31
+ ErrorMessage: "ErrorMessage",
32
+ SkillName: "SkillName",
33
+ ProductArea: "ProductArea",
34
+ Mode: "Mode"
35
+ };
36
+ var ProjectDimensions = {
37
+ ProjectKey: "ProjectKey",
38
+ ProjectType: "ProjectType",
39
+ ProjectIdentityStatus: "ProjectIdentityStatus",
40
+ SolutionKey: "SolutionKey",
41
+ SolutionProjectKey: "SolutionProjectKey",
42
+ SolutionIdentityStatus: "SolutionIdentityStatus",
43
+ PreviousSolutionKey: "PreviousSolutionKey"
44
+ };
45
+ var GUID_KEY_DIMENSIONS = new Set([
46
+ ProjectDimensions.ProjectKey,
47
+ ProjectDimensions.SolutionKey,
48
+ ProjectDimensions.SolutionProjectKey,
49
+ ProjectDimensions.PreviousSolutionKey
50
+ ]);
51
+ var ShipDimensions = {
52
+ ShipKind: "ShipKind",
53
+ Target: "Target",
54
+ ProjectType: "ProjectType",
55
+ ProjectTypes: "ProjectTypes",
56
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
57
+ PackageName: "PackageName",
58
+ PackageVersion: "PackageVersion",
59
+ PackageVersionKey: "PackageVersionKey",
60
+ DeploymentKey: "DeploymentKey",
61
+ SolutionId: "SolutionId",
62
+ FolderKey: "FolderKey",
63
+ FeedId: "FeedId"
64
+ };
65
+ var ErrorDimensions = {
66
+ Result: "Result",
67
+ ErrorCode: "ErrorCode",
68
+ Retry: "Retry",
69
+ ErrorMessage: "ErrorMessage",
70
+ HttpStatus: "HttpStatus",
71
+ UpstreamErrorCode: "UpstreamErrorCode"
72
+ };
73
+ var AuthDimensions = {
74
+ AuthenticationMethod: "AuthenticationMethod",
75
+ Success: "Success",
76
+ Reason: "Reason"
77
+ };
78
+ var SkillsDimensions = {
79
+ SchemaVersion: "SchemaVersion",
80
+ AgentType: "AgentType",
81
+ SkillsVersion: "SkillsVersion",
82
+ UipSubcommand: "UipSubcommand",
83
+ FileExtension: "FileExtension",
84
+ SubagentModel: "SubagentModel",
85
+ SubagentType: "SubagentType",
86
+ PermissionMode: "PermissionMode",
87
+ EffortLevel: "EffortLevel",
88
+ SessionSource: "SessionSource",
89
+ Outcome: "Outcome",
90
+ DurationMs: "DurationMs",
91
+ Source: "Source"
92
+ };
93
+ var PackagerDimensions = {
94
+ ProjectId: "ProjectId",
95
+ ProjectType: "ProjectType",
96
+ SolutionId: "SolutionId"
97
+ };
98
+ var ScopeDimensions = {
99
+ FolderId: "FolderId"
100
+ };
101
+ var ID_DIMENSIONS = new Set([
102
+ BaseDimensions.CloudUserId,
103
+ BaseDimensions.CloudTenantId,
104
+ BaseDimensions.CloudOrganizationId,
105
+ BaseDimensions.InstallationId,
106
+ ShipDimensions.ArtifactCorrelationKey,
107
+ ShipDimensions.PackageVersionKey,
108
+ ShipDimensions.DeploymentKey,
109
+ ShipDimensions.SolutionId,
110
+ ShipDimensions.FolderKey,
111
+ ShipDimensions.FeedId,
112
+ PackagerDimensions.ProjectId
113
+ ]);
114
+ var RESERVED_DIMENSION_NAMES = new Set([
115
+ ...Object.values(BaseDimensions),
116
+ ...Object.values(CommandDimensions),
117
+ ...Object.values(ShipDimensions),
118
+ ...Object.values(ProjectDimensions),
119
+ ...Object.values(ErrorDimensions),
120
+ ...Object.values(AuthDimensions),
121
+ ...Object.values(SkillsDimensions),
122
+ ...Object.values(PackagerDimensions),
123
+ ...Object.values(ScopeDimensions)
124
+ ]);
125
+ var CURATED_DIMENSIONS = new Set([
126
+ BaseDimensions.ApplicationName,
127
+ BaseDimensions.ProductVersion,
128
+ BaseDimensions.InstallationId,
129
+ BaseDimensions.CloudUserId,
130
+ BaseDimensions.CloudTenantId,
131
+ BaseDimensions.CloudOrganizationId,
132
+ BaseDimensions.IsInternalUser,
133
+ BaseDimensions.Environment,
134
+ BaseDimensions.BaseUrl,
135
+ BaseDimensions.Region,
136
+ BaseDimensions.Agent,
137
+ BaseDimensions.AgentVersion,
138
+ BaseDimensions.ToolVersion,
139
+ BaseDimensions.ExecutionContext,
140
+ BaseDimensions.CiProvider,
141
+ BaseDimensions.SessionIdSource,
142
+ BaseDimensions.SessionId,
143
+ ...Object.values(CommandDimensions),
144
+ ...Object.values(ShipDimensions),
145
+ ...Object.values(ProjectDimensions)
146
+ ]);
147
+
1
148
  // ../common/src/telemetry/pseudonymize.ts
2
149
  var SHA256_K = new Uint32Array([
3
150
  1116352408,
@@ -345,136 +492,6 @@ class InsightsProtocolError extends Error {
345
492
  // ../common/src/telemetry/global-telemetry-properties.ts
346
493
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
347
494
 
348
- // ../common/src/telemetry/telemetry-dimensions.ts
349
- var BaseDimensions = {
350
- ApplicationName: "ApplicationName",
351
- ProductVersion: "ProductVersion",
352
- InstallationId: "InstallationId",
353
- CloudUserId: "CloudUserId",
354
- CloudTenantId: "CloudTenantId",
355
- CloudOrganizationId: "CloudOrganizationId",
356
- IsInternalUser: "IsInternalUser",
357
- Environment: "Environment",
358
- BaseUrl: "BaseUrl",
359
- Region: "Region",
360
- Agent: "Agent",
361
- AgentVersion: "AgentVersion",
362
- AgentModel: "AgentModel",
363
- ToolName: "ToolName",
364
- ToolVersion: "ToolVersion",
365
- ExecutionContext: "ExecutionContext",
366
- CiProvider: "CiProvider",
367
- SessionIdSource: "SessionIdSource",
368
- SessionId: "SessionId"
369
- };
370
- var CommandDimensions = {
371
- IsCommand: "IsCommand",
372
- IsReexec: "IsReexec",
373
- CommandName: "CommandName",
374
- ExitCode: "ExitCode",
375
- TerminalOutcome: "TerminalOutcome",
376
- ErrorClass: "ErrorClass",
377
- TerminalSignal: "TerminalSignal",
378
- ErrorMessage: "ErrorMessage",
379
- SkillName: "SkillName",
380
- ProductArea: "ProductArea",
381
- Mode: "Mode"
382
- };
383
- var ShipDimensions = {
384
- ShipKind: "ShipKind",
385
- Target: "Target",
386
- ProjectType: "ProjectType",
387
- ProjectTypes: "ProjectTypes",
388
- ArtifactCorrelationKey: "ArtifactCorrelationKey",
389
- PackageName: "PackageName",
390
- PackageVersion: "PackageVersion",
391
- PackageVersionKey: "PackageVersionKey",
392
- DeploymentKey: "DeploymentKey",
393
- SolutionId: "SolutionId",
394
- FolderKey: "FolderKey",
395
- FeedId: "FeedId"
396
- };
397
- var ErrorDimensions = {
398
- Result: "Result",
399
- ErrorCode: "ErrorCode",
400
- Retry: "Retry",
401
- ErrorMessage: "ErrorMessage",
402
- HttpStatus: "HttpStatus",
403
- UpstreamErrorCode: "UpstreamErrorCode"
404
- };
405
- var AuthDimensions = {
406
- AuthenticationMethod: "AuthenticationMethod",
407
- Success: "Success",
408
- Reason: "Reason"
409
- };
410
- var SkillsDimensions = {
411
- SchemaVersion: "SchemaVersion",
412
- AgentType: "AgentType",
413
- SkillsVersion: "SkillsVersion",
414
- UipSubcommand: "UipSubcommand",
415
- FileExtension: "FileExtension",
416
- SubagentModel: "SubagentModel",
417
- SubagentType: "SubagentType",
418
- PermissionMode: "PermissionMode",
419
- EffortLevel: "EffortLevel",
420
- SessionSource: "SessionSource",
421
- Outcome: "Outcome",
422
- DurationMs: "DurationMs",
423
- Source: "Source"
424
- };
425
- var PackagerDimensions = {
426
- ProjectId: "ProjectId",
427
- ProjectType: "ProjectType",
428
- SolutionId: "SolutionId"
429
- };
430
- var ScopeDimensions = {
431
- FolderId: "FolderId"
432
- };
433
- var ID_DIMENSIONS = new Set([
434
- BaseDimensions.CloudUserId,
435
- BaseDimensions.CloudTenantId,
436
- BaseDimensions.CloudOrganizationId,
437
- BaseDimensions.InstallationId,
438
- ShipDimensions.ArtifactCorrelationKey,
439
- ShipDimensions.PackageVersionKey,
440
- ShipDimensions.DeploymentKey,
441
- ShipDimensions.SolutionId,
442
- ShipDimensions.FolderKey,
443
- ShipDimensions.FeedId,
444
- PackagerDimensions.ProjectId
445
- ]);
446
- var RESERVED_DIMENSION_NAMES = new Set([
447
- ...Object.values(BaseDimensions),
448
- ...Object.values(CommandDimensions),
449
- ...Object.values(ShipDimensions),
450
- ...Object.values(ErrorDimensions),
451
- ...Object.values(AuthDimensions),
452
- ...Object.values(SkillsDimensions),
453
- ...Object.values(PackagerDimensions),
454
- ...Object.values(ScopeDimensions)
455
- ]);
456
- var CURATED_DIMENSIONS = new Set([
457
- BaseDimensions.ApplicationName,
458
- BaseDimensions.ProductVersion,
459
- BaseDimensions.InstallationId,
460
- BaseDimensions.CloudUserId,
461
- BaseDimensions.CloudTenantId,
462
- BaseDimensions.CloudOrganizationId,
463
- BaseDimensions.IsInternalUser,
464
- BaseDimensions.Environment,
465
- BaseDimensions.BaseUrl,
466
- BaseDimensions.Region,
467
- BaseDimensions.Agent,
468
- BaseDimensions.AgentVersion,
469
- BaseDimensions.ToolVersion,
470
- BaseDimensions.ExecutionContext,
471
- BaseDimensions.CiProvider,
472
- BaseDimensions.SessionIdSource,
473
- BaseDimensions.SessionId,
474
- ...Object.values(CommandDimensions),
475
- ...Object.values(ShipDimensions)
476
- ]);
477
-
478
495
  // ../common/src/sdk-user-agent.ts
479
496
  var AGENT_PROPERTY = BaseDimensions.Agent;
480
497
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
@@ -504,7 +521,7 @@ var package_default = {
504
521
  name: "@uipath/insights-sdk",
505
522
  author: "UiPath",
506
523
  license: "SEE LICENSE IN LICENSE.txt",
507
- version: "1.205.0-preview.276",
524
+ version: "1.206.0-preview.279",
508
525
  description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
509
526
  repository: {
510
527
  type: "git",
@@ -1952,4 +1969,4 @@ export {
1952
1969
  verifyExportDestination
1953
1970
  };
1954
1971
 
1955
- //# debugId=144EEF3824E3BBEB64756E2164756E21
1972
+ //# debugId=65927651EDE6180764756E2164756E21
package/dist/index.js CHANGED
@@ -1,19 +1,15 @@
1
1
  import { createRequire } from "node:module";
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
2
+ var __esm = (fn, res, err) => () => {
3
+ if (fn)
4
+ try {
5
+ res = fn(fn = 0);
6
+ } catch (e) {
7
+ err = [e];
8
+ }
9
+ if (err)
10
+ throw err[0];
11
+ return res;
15
12
  };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
13
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
18
14
 
19
15
  // ../auth/src/catch-error.ts
@@ -400,12 +396,6 @@ var init_is_in_ssh = __esm(() => {
400
396
  });
401
397
 
402
398
  // ../../node_modules/open/index.js
403
- var exports_open = {};
404
- __export(exports_open, {
405
- apps: () => apps,
406
- default: () => open_default,
407
- openApp: () => openApp
408
- });
409
399
  import process8 from "node:process";
410
400
  import path from "node:path";
411
401
  import { fileURLToPath } from "node:url";
@@ -639,21 +629,6 @@ var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform, arch, tryEach
639
629
  ...options,
640
630
  target
641
631
  });
642
- }, openApp = (name, options) => {
643
- if (typeof name !== "string" && !Array.isArray(name)) {
644
- throw new TypeError("Expected a valid `name`");
645
- }
646
- const { arguments: appArguments = [] } = options ?? {};
647
- if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
648
- throw new TypeError("Expected `appArguments` as Array type");
649
- }
650
- return baseOpen({
651
- ...options,
652
- app: {
653
- name,
654
- arguments: appArguments
655
- }
656
- });
657
632
  }, apps, open_default;
658
633
  var init_open = __esm(() => {
659
634
  init_wsl_utils();
@@ -710,7 +685,7 @@ var init_open = __esm(() => {
710
685
  });
711
686
 
712
687
  // ../filesystem/src/node.ts
713
- import { randomUUID } from "node:crypto";
688
+ import { createHash, randomUUID } from "node:crypto";
714
689
  import { existsSync } from "node:fs";
715
690
  import * as fs6 from "node:fs/promises";
716
691
  import * as os2 from "node:os";
@@ -733,16 +708,16 @@ class NodeFileSystem {
733
708
  };
734
709
  utils = {
735
710
  open: async (url) => {
736
- const { default: open2 } = await Promise.resolve().then(() => (init_open(), exports_open));
737
- await open2(url);
711
+ await Promise.resolve().then(() => init_open());
712
+ await open_default(url);
738
713
  }
739
714
  };
740
- async readFile(path3, options) {
715
+ async readFile(path, options) {
741
716
  try {
742
717
  if (options) {
743
- return await fs6.readFile(path3, "utf-8");
718
+ return await fs6.readFile(path, "utf-8");
744
719
  }
745
- return await fs6.readFile(path3);
720
+ return await fs6.readFile(path);
746
721
  } catch (error) {
747
722
  if (this.isEnoent(error))
748
723
  return null;
@@ -772,6 +747,15 @@ class NodeFileSystem {
772
747
  throw error;
773
748
  }
774
749
  }
750
+ async readdirEntries(dirPath) {
751
+ try {
752
+ return await fs6.readdir(dirPath, { withFileTypes: true });
753
+ } catch (error) {
754
+ if (this.isEnoent(error))
755
+ return [];
756
+ throw error;
757
+ }
758
+ }
775
759
  async stat(filePath) {
776
760
  try {
777
761
  const stats = await fs6.stat(filePath);
@@ -779,7 +763,8 @@ class NodeFileSystem {
779
763
  isFile: () => stats.isFile(),
780
764
  isDirectory: () => stats.isDirectory(),
781
765
  size: stats.size,
782
- mtimeMs: stats.mtimeMs
766
+ mtimeMs: stats.mtimeMs,
767
+ ctimeMs: stats.ctimeMs
783
768
  };
784
769
  } catch (error) {
785
770
  if (this.isEnoent(error))
@@ -893,6 +878,42 @@ class NodeFileSystem {
893
878
  throw error;
894
879
  }
895
880
  }
881
+ async hashFile(filePath) {
882
+ let handle;
883
+ try {
884
+ handle = await fs6.open(filePath, "r");
885
+ } catch (error) {
886
+ if (this.isEnoent(error))
887
+ return null;
888
+ throw error;
889
+ }
890
+ const buffer = hashBuffers.pop() ?? Buffer.allocUnsafe(HASH_CHUNK_BYTES);
891
+ try {
892
+ const opened = await handle.stat();
893
+ const stats = {
894
+ isFile: () => opened.isFile(),
895
+ isDirectory: () => opened.isDirectory(),
896
+ size: opened.size,
897
+ mtimeMs: opened.mtimeMs,
898
+ ctimeMs: opened.ctimeMs
899
+ };
900
+ const hash = createHash("sha256");
901
+ let size = 0;
902
+ for (;; ) {
903
+ const { bytesRead } = await handle.read(buffer, 0, buffer.byteLength, null);
904
+ if (bytesRead === 0)
905
+ break;
906
+ hash.update(buffer.subarray(0, bytesRead));
907
+ size += bytesRead;
908
+ }
909
+ return { sha256: hash.digest("hex"), size, stats };
910
+ } finally {
911
+ if (hashBuffers.length < HASH_BUFFERS_KEPT) {
912
+ hashBuffers.push(buffer);
913
+ }
914
+ await handle.close();
915
+ }
916
+ }
896
917
  async realpath(filePath) {
897
918
  try {
898
919
  return await fs6.realpath(filePath);
@@ -938,8 +959,11 @@ class NodeFileSystem {
938
959
  return typeof error === "object" && error !== null && "code" in error && error.code === code;
939
960
  }
940
961
  }
941
- var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
942
- var init_node = () => {};
962
+ var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200, HASH_CHUNK_BYTES, hashBuffers, HASH_BUFFERS_KEPT = 64;
963
+ var init_node = __esm(() => {
964
+ HASH_CHUNK_BYTES = 256 * 1024;
965
+ hashBuffers = [];
966
+ });
943
967
  // ../filesystem/src/index.ts
944
968
  var fsInstance, getFileSystem = () => fsInstance;
945
969
  var init_src = __esm(() => {
@@ -948,6 +972,153 @@ var init_src = __esm(() => {
948
972
  fsInstance = new NodeFileSystem;
949
973
  });
950
974
 
975
+ // ../common/src/telemetry/telemetry-dimensions.ts
976
+ var BaseDimensions = {
977
+ ApplicationName: "ApplicationName",
978
+ ProductVersion: "ProductVersion",
979
+ InstallationId: "InstallationId",
980
+ CloudUserId: "CloudUserId",
981
+ CloudTenantId: "CloudTenantId",
982
+ CloudOrganizationId: "CloudOrganizationId",
983
+ IsInternalUser: "IsInternalUser",
984
+ Environment: "Environment",
985
+ BaseUrl: "BaseUrl",
986
+ Region: "Region",
987
+ Agent: "Agent",
988
+ AgentVersion: "AgentVersion",
989
+ AgentModel: "AgentModel",
990
+ ToolName: "ToolName",
991
+ ToolVersion: "ToolVersion",
992
+ ExecutionContext: "ExecutionContext",
993
+ CiProvider: "CiProvider",
994
+ SessionIdSource: "SessionIdSource",
995
+ SessionId: "SessionId"
996
+ };
997
+ var CommandDimensions = {
998
+ IsCommand: "IsCommand",
999
+ IsReexec: "IsReexec",
1000
+ CommandName: "CommandName",
1001
+ ExitCode: "ExitCode",
1002
+ TerminalOutcome: "TerminalOutcome",
1003
+ ErrorClass: "ErrorClass",
1004
+ TerminalSignal: "TerminalSignal",
1005
+ ErrorMessage: "ErrorMessage",
1006
+ SkillName: "SkillName",
1007
+ ProductArea: "ProductArea",
1008
+ Mode: "Mode"
1009
+ };
1010
+ var ProjectDimensions = {
1011
+ ProjectKey: "ProjectKey",
1012
+ ProjectType: "ProjectType",
1013
+ ProjectIdentityStatus: "ProjectIdentityStatus",
1014
+ SolutionKey: "SolutionKey",
1015
+ SolutionProjectKey: "SolutionProjectKey",
1016
+ SolutionIdentityStatus: "SolutionIdentityStatus",
1017
+ PreviousSolutionKey: "PreviousSolutionKey"
1018
+ };
1019
+ var GUID_KEY_DIMENSIONS = new Set([
1020
+ ProjectDimensions.ProjectKey,
1021
+ ProjectDimensions.SolutionKey,
1022
+ ProjectDimensions.SolutionProjectKey,
1023
+ ProjectDimensions.PreviousSolutionKey
1024
+ ]);
1025
+ var ShipDimensions = {
1026
+ ShipKind: "ShipKind",
1027
+ Target: "Target",
1028
+ ProjectType: "ProjectType",
1029
+ ProjectTypes: "ProjectTypes",
1030
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
1031
+ PackageName: "PackageName",
1032
+ PackageVersion: "PackageVersion",
1033
+ PackageVersionKey: "PackageVersionKey",
1034
+ DeploymentKey: "DeploymentKey",
1035
+ SolutionId: "SolutionId",
1036
+ FolderKey: "FolderKey",
1037
+ FeedId: "FeedId"
1038
+ };
1039
+ var ErrorDimensions = {
1040
+ Result: "Result",
1041
+ ErrorCode: "ErrorCode",
1042
+ Retry: "Retry",
1043
+ ErrorMessage: "ErrorMessage",
1044
+ HttpStatus: "HttpStatus",
1045
+ UpstreamErrorCode: "UpstreamErrorCode"
1046
+ };
1047
+ var AuthDimensions = {
1048
+ AuthenticationMethod: "AuthenticationMethod",
1049
+ Success: "Success",
1050
+ Reason: "Reason"
1051
+ };
1052
+ var SkillsDimensions = {
1053
+ SchemaVersion: "SchemaVersion",
1054
+ AgentType: "AgentType",
1055
+ SkillsVersion: "SkillsVersion",
1056
+ UipSubcommand: "UipSubcommand",
1057
+ FileExtension: "FileExtension",
1058
+ SubagentModel: "SubagentModel",
1059
+ SubagentType: "SubagentType",
1060
+ PermissionMode: "PermissionMode",
1061
+ EffortLevel: "EffortLevel",
1062
+ SessionSource: "SessionSource",
1063
+ Outcome: "Outcome",
1064
+ DurationMs: "DurationMs",
1065
+ Source: "Source"
1066
+ };
1067
+ var PackagerDimensions = {
1068
+ ProjectId: "ProjectId",
1069
+ ProjectType: "ProjectType",
1070
+ SolutionId: "SolutionId"
1071
+ };
1072
+ var ScopeDimensions = {
1073
+ FolderId: "FolderId"
1074
+ };
1075
+ var ID_DIMENSIONS = new Set([
1076
+ BaseDimensions.CloudUserId,
1077
+ BaseDimensions.CloudTenantId,
1078
+ BaseDimensions.CloudOrganizationId,
1079
+ BaseDimensions.InstallationId,
1080
+ ShipDimensions.ArtifactCorrelationKey,
1081
+ ShipDimensions.PackageVersionKey,
1082
+ ShipDimensions.DeploymentKey,
1083
+ ShipDimensions.SolutionId,
1084
+ ShipDimensions.FolderKey,
1085
+ ShipDimensions.FeedId,
1086
+ PackagerDimensions.ProjectId
1087
+ ]);
1088
+ var RESERVED_DIMENSION_NAMES = new Set([
1089
+ ...Object.values(BaseDimensions),
1090
+ ...Object.values(CommandDimensions),
1091
+ ...Object.values(ShipDimensions),
1092
+ ...Object.values(ProjectDimensions),
1093
+ ...Object.values(ErrorDimensions),
1094
+ ...Object.values(AuthDimensions),
1095
+ ...Object.values(SkillsDimensions),
1096
+ ...Object.values(PackagerDimensions),
1097
+ ...Object.values(ScopeDimensions)
1098
+ ]);
1099
+ var CURATED_DIMENSIONS = new Set([
1100
+ BaseDimensions.ApplicationName,
1101
+ BaseDimensions.ProductVersion,
1102
+ BaseDimensions.InstallationId,
1103
+ BaseDimensions.CloudUserId,
1104
+ BaseDimensions.CloudTenantId,
1105
+ BaseDimensions.CloudOrganizationId,
1106
+ BaseDimensions.IsInternalUser,
1107
+ BaseDimensions.Environment,
1108
+ BaseDimensions.BaseUrl,
1109
+ BaseDimensions.Region,
1110
+ BaseDimensions.Agent,
1111
+ BaseDimensions.AgentVersion,
1112
+ BaseDimensions.ToolVersion,
1113
+ BaseDimensions.ExecutionContext,
1114
+ BaseDimensions.CiProvider,
1115
+ BaseDimensions.SessionIdSource,
1116
+ BaseDimensions.SessionId,
1117
+ ...Object.values(CommandDimensions),
1118
+ ...Object.values(ShipDimensions),
1119
+ ...Object.values(ProjectDimensions)
1120
+ ]);
1121
+
951
1122
  // ../common/src/telemetry/pseudonymize.ts
952
1123
  var SHA256_K = new Uint32Array([
953
1124
  1116352408,
@@ -1295,136 +1466,6 @@ class InsightsProtocolError extends Error {
1295
1466
  // ../common/src/telemetry/global-telemetry-properties.ts
1296
1467
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
1297
1468
 
1298
- // ../common/src/telemetry/telemetry-dimensions.ts
1299
- var BaseDimensions = {
1300
- ApplicationName: "ApplicationName",
1301
- ProductVersion: "ProductVersion",
1302
- InstallationId: "InstallationId",
1303
- CloudUserId: "CloudUserId",
1304
- CloudTenantId: "CloudTenantId",
1305
- CloudOrganizationId: "CloudOrganizationId",
1306
- IsInternalUser: "IsInternalUser",
1307
- Environment: "Environment",
1308
- BaseUrl: "BaseUrl",
1309
- Region: "Region",
1310
- Agent: "Agent",
1311
- AgentVersion: "AgentVersion",
1312
- AgentModel: "AgentModel",
1313
- ToolName: "ToolName",
1314
- ToolVersion: "ToolVersion",
1315
- ExecutionContext: "ExecutionContext",
1316
- CiProvider: "CiProvider",
1317
- SessionIdSource: "SessionIdSource",
1318
- SessionId: "SessionId"
1319
- };
1320
- var CommandDimensions = {
1321
- IsCommand: "IsCommand",
1322
- IsReexec: "IsReexec",
1323
- CommandName: "CommandName",
1324
- ExitCode: "ExitCode",
1325
- TerminalOutcome: "TerminalOutcome",
1326
- ErrorClass: "ErrorClass",
1327
- TerminalSignal: "TerminalSignal",
1328
- ErrorMessage: "ErrorMessage",
1329
- SkillName: "SkillName",
1330
- ProductArea: "ProductArea",
1331
- Mode: "Mode"
1332
- };
1333
- var ShipDimensions = {
1334
- ShipKind: "ShipKind",
1335
- Target: "Target",
1336
- ProjectType: "ProjectType",
1337
- ProjectTypes: "ProjectTypes",
1338
- ArtifactCorrelationKey: "ArtifactCorrelationKey",
1339
- PackageName: "PackageName",
1340
- PackageVersion: "PackageVersion",
1341
- PackageVersionKey: "PackageVersionKey",
1342
- DeploymentKey: "DeploymentKey",
1343
- SolutionId: "SolutionId",
1344
- FolderKey: "FolderKey",
1345
- FeedId: "FeedId"
1346
- };
1347
- var ErrorDimensions = {
1348
- Result: "Result",
1349
- ErrorCode: "ErrorCode",
1350
- Retry: "Retry",
1351
- ErrorMessage: "ErrorMessage",
1352
- HttpStatus: "HttpStatus",
1353
- UpstreamErrorCode: "UpstreamErrorCode"
1354
- };
1355
- var AuthDimensions = {
1356
- AuthenticationMethod: "AuthenticationMethod",
1357
- Success: "Success",
1358
- Reason: "Reason"
1359
- };
1360
- var SkillsDimensions = {
1361
- SchemaVersion: "SchemaVersion",
1362
- AgentType: "AgentType",
1363
- SkillsVersion: "SkillsVersion",
1364
- UipSubcommand: "UipSubcommand",
1365
- FileExtension: "FileExtension",
1366
- SubagentModel: "SubagentModel",
1367
- SubagentType: "SubagentType",
1368
- PermissionMode: "PermissionMode",
1369
- EffortLevel: "EffortLevel",
1370
- SessionSource: "SessionSource",
1371
- Outcome: "Outcome",
1372
- DurationMs: "DurationMs",
1373
- Source: "Source"
1374
- };
1375
- var PackagerDimensions = {
1376
- ProjectId: "ProjectId",
1377
- ProjectType: "ProjectType",
1378
- SolutionId: "SolutionId"
1379
- };
1380
- var ScopeDimensions = {
1381
- FolderId: "FolderId"
1382
- };
1383
- var ID_DIMENSIONS = new Set([
1384
- BaseDimensions.CloudUserId,
1385
- BaseDimensions.CloudTenantId,
1386
- BaseDimensions.CloudOrganizationId,
1387
- BaseDimensions.InstallationId,
1388
- ShipDimensions.ArtifactCorrelationKey,
1389
- ShipDimensions.PackageVersionKey,
1390
- ShipDimensions.DeploymentKey,
1391
- ShipDimensions.SolutionId,
1392
- ShipDimensions.FolderKey,
1393
- ShipDimensions.FeedId,
1394
- PackagerDimensions.ProjectId
1395
- ]);
1396
- var RESERVED_DIMENSION_NAMES = new Set([
1397
- ...Object.values(BaseDimensions),
1398
- ...Object.values(CommandDimensions),
1399
- ...Object.values(ShipDimensions),
1400
- ...Object.values(ErrorDimensions),
1401
- ...Object.values(AuthDimensions),
1402
- ...Object.values(SkillsDimensions),
1403
- ...Object.values(PackagerDimensions),
1404
- ...Object.values(ScopeDimensions)
1405
- ]);
1406
- var CURATED_DIMENSIONS = new Set([
1407
- BaseDimensions.ApplicationName,
1408
- BaseDimensions.ProductVersion,
1409
- BaseDimensions.InstallationId,
1410
- BaseDimensions.CloudUserId,
1411
- BaseDimensions.CloudTenantId,
1412
- BaseDimensions.CloudOrganizationId,
1413
- BaseDimensions.IsInternalUser,
1414
- BaseDimensions.Environment,
1415
- BaseDimensions.BaseUrl,
1416
- BaseDimensions.Region,
1417
- BaseDimensions.Agent,
1418
- BaseDimensions.AgentVersion,
1419
- BaseDimensions.ToolVersion,
1420
- BaseDimensions.ExecutionContext,
1421
- BaseDimensions.CiProvider,
1422
- BaseDimensions.SessionIdSource,
1423
- BaseDimensions.SessionId,
1424
- ...Object.values(CommandDimensions),
1425
- ...Object.values(ShipDimensions)
1426
- ]);
1427
-
1428
1469
  // ../common/src/sdk-user-agent.ts
1429
1470
  var AGENT_PROPERTY = BaseDimensions.Agent;
1430
1471
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
@@ -1454,7 +1495,7 @@ var package_default = {
1454
1495
  name: "@uipath/insights-sdk",
1455
1496
  author: "UiPath",
1456
1497
  license: "SEE LICENSE IN LICENSE.txt",
1457
- version: "1.205.0-preview.276",
1498
+ version: "1.206.0-preview.279",
1458
1499
  description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
1459
1500
  repository: {
1460
1501
  type: "git",
@@ -2176,8 +2217,8 @@ function resolveAuthProfileFilePath(profile) {
2176
2217
  if (normalized === undefined) {
2177
2218
  throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
2178
2219
  }
2179
- const fs7 = getFileSystem();
2180
- return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
2220
+ const fs = getFileSystem();
2221
+ return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
2181
2222
  }
2182
2223
  function getActiveAuthProfileFilePath() {
2183
2224
  const profile = getActiveAuthProfile();
@@ -2349,6 +2390,8 @@ var ENV_AUTH_VARS = {
2349
2390
  };
2350
2391
 
2351
2392
  class EnvAuthConfigError extends Error {
2393
+ errorCode = "configuration_error";
2394
+ retry = "RetryWillNotFix";
2352
2395
  constructor(message) {
2353
2396
  super(message);
2354
2397
  this.name = "EnvAuthConfigError";
@@ -2387,11 +2430,11 @@ var readAuthFromEnv = () => {
2387
2430
  if (!rawUrl) {
2388
2431
  throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
2389
2432
  }
2390
- const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
2433
+ const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
2391
2434
  return {
2392
2435
  loginStatus: "Logged in",
2393
2436
  accessToken,
2394
- baseUrl: baseUrl2,
2437
+ baseUrl,
2395
2438
  organizationName,
2396
2439
  organizationId,
2397
2440
  tenantName,
@@ -2443,9 +2486,9 @@ function breakerPathFor(authPath) {
2443
2486
  return `${authPath}${BREAKER_SUFFIX}`;
2444
2487
  }
2445
2488
  async function loadRefreshBreaker(authPath) {
2446
- const fs7 = getFileSystem();
2489
+ const fs = getFileSystem();
2447
2490
  try {
2448
- const content = await fs7.readFile(breakerPathFor(authPath), "utf-8");
2491
+ const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
2449
2492
  if (!content)
2450
2493
  return {};
2451
2494
  const parsed = JSON.parse(content);
@@ -2456,20 +2499,20 @@ async function loadRefreshBreaker(authPath) {
2456
2499
  }
2457
2500
  async function saveRefreshBreaker(authPath, state) {
2458
2501
  try {
2459
- const fs7 = getFileSystem();
2460
- const path3 = breakerPathFor(authPath);
2461
- await fs7.mkdir(fs7.path.dirname(path3));
2462
- const tempPath = `${path3}.tmp`;
2463
- await fs7.writeFile(tempPath, JSON.stringify(state));
2464
- await fs7.rename(tempPath, path3);
2502
+ const fs = getFileSystem();
2503
+ const path = breakerPathFor(authPath);
2504
+ await fs.mkdir(fs.path.dirname(path));
2505
+ const tempPath = `${path}.tmp`;
2506
+ await fs.writeFile(tempPath, JSON.stringify(state));
2507
+ await fs.rename(tempPath, path);
2465
2508
  } catch {}
2466
2509
  }
2467
2510
  async function clearRefreshBreaker(authPath) {
2468
- const fs7 = getFileSystem();
2469
- const path3 = breakerPathFor(authPath);
2511
+ const fs = getFileSystem();
2512
+ const path = breakerPathFor(authPath);
2470
2513
  try {
2471
- if (await fs7.exists(path3)) {
2472
- await fs7.rm(path3);
2514
+ if (await fs.exists(path)) {
2515
+ await fs.rm(path);
2473
2516
  }
2474
2517
  } catch {}
2475
2518
  }
@@ -2491,13 +2534,13 @@ var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
2491
2534
  var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
2492
2535
  var PIPE_NAME_MAX_LENGTH = 103;
2493
2536
  var getRobotIpcPipeNames = async () => {
2494
- const fs7 = getFileSystem();
2495
- const username = fs7.env.getenv("USER") ?? fs7.env.getenv("USERNAME");
2537
+ const fs = getFileSystem();
2538
+ const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
2496
2539
  if (!username) {
2497
2540
  throw new Error("Unable to determine current username");
2498
2541
  }
2499
- const tempPath = fs7.env.getenv("TMPDIR") ?? "/tmp/";
2500
- return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs7.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
2542
+ const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
2543
+ return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
2501
2544
  };
2502
2545
  var defaultIsRobotIpcAvailable = async () => {
2503
2546
  if (process.platform === "win32") {
@@ -2507,20 +2550,20 @@ var defaultIsRobotIpcAvailable = async () => {
2507
2550
  if (pipeNamesError || !pipeNames) {
2508
2551
  return false;
2509
2552
  }
2510
- const fs7 = getFileSystem();
2553
+ const fs = getFileSystem();
2511
2554
  for (const pipeName of pipeNames) {
2512
- const [existsError, exists] = await catchError2(fs7.exists(pipeName));
2555
+ const [existsError, exists] = await catchError2(fs.exists(pipeName));
2513
2556
  if (!existsError && exists === true) {
2514
2557
  return true;
2515
2558
  }
2516
2559
  }
2517
2560
  return false;
2518
2561
  };
2519
- var withTimeout = (promise, timeoutMs) => new Promise((resolve2, reject) => {
2562
+ var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
2520
2563
  const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
2521
2564
  promise.then((value) => {
2522
2565
  clearTimeout(timer);
2523
- resolve2(value);
2566
+ resolve(value);
2524
2567
  }, (error) => {
2525
2568
  clearTimeout(timer);
2526
2569
  reject(error);
@@ -2693,9 +2736,12 @@ var refreshAccessToken = async ({
2693
2736
  body: tokenParams
2694
2737
  });
2695
2738
  const tokenData = await tokenResponse.json();
2696
- if (!tokenResponse.ok) {
2739
+ if (tokenResponse.status === 400 || tokenResponse.status === 401) {
2697
2740
  throw new TokenRefreshOAuthError;
2698
2741
  }
2742
+ if (!tokenResponse.ok) {
2743
+ throw new Error(`Token refresh failed: HTTP ${tokenResponse.status}`);
2744
+ }
2699
2745
  const newAccessToken = tokenData.access_token;
2700
2746
  const newRefreshToken = tokenData.refresh_token;
2701
2747
  if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
@@ -2729,9 +2775,9 @@ var errorCode = (err) => {
2729
2775
  }
2730
2776
  return "EUNKNOWN";
2731
2777
  };
2732
- var probeAsync = async (fs7, candidate) => {
2778
+ var probeAsync = async (fs, candidate) => {
2733
2779
  try {
2734
- const stats = await fs7.stat(candidate);
2780
+ const stats = await fs.stat(candidate);
2735
2781
  if (stats === null) {
2736
2782
  return { exists: false };
2737
2783
  }
@@ -2758,36 +2804,36 @@ var probeAsync = async (fs7, candidate) => {
2758
2804
  }
2759
2805
  };
2760
2806
  var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
2761
- const fs7 = getFileSystem();
2762
- if (fs7.path.isAbsolute(envFilePath)) {
2763
- const probe2 = await probeAsync(fs7, envFilePath);
2764
- return probe2.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
2807
+ const fs = getFileSystem();
2808
+ if (fs.path.isAbsolute(envFilePath)) {
2809
+ const probe = await probeAsync(fs, envFilePath);
2810
+ return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
2765
2811
  exists: false,
2766
2812
  absolutePath: envFilePath,
2767
2813
  source: "absolute",
2768
- ...probe2.unusable ? { unusable: probe2.unusable } : {}
2814
+ ...probe.unusable ? { unusable: probe.unusable } : {}
2769
2815
  };
2770
2816
  }
2771
- const cwd = opts?.cwd ?? fs7.env.cwd();
2817
+ const cwd = opts?.cwd ?? fs.env.cwd();
2772
2818
  let searchDir = cwd;
2773
2819
  while (true) {
2774
- const candidate = fs7.path.join(searchDir, envFilePath);
2775
- const probe2 = await probeAsync(fs7, candidate);
2776
- if (probe2.exists) {
2820
+ const candidate = fs.path.join(searchDir, envFilePath);
2821
+ const probe = await probeAsync(fs, candidate);
2822
+ if (probe.exists) {
2777
2823
  return {
2778
2824
  exists: true,
2779
2825
  absolutePath: candidate,
2780
2826
  source: searchDir === cwd ? "cwd" : "ancestor"
2781
2827
  };
2782
2828
  }
2783
- const parentDir = fs7.path.dirname(searchDir);
2829
+ const parentDir = fs.path.dirname(searchDir);
2784
2830
  if (parentDir === searchDir) {
2785
2831
  break;
2786
2832
  }
2787
2833
  searchDir = parentDir;
2788
2834
  }
2789
- const homePath = fs7.path.join(fs7.env.homedir(), envFilePath);
2790
- const probe = await probeAsync(fs7, homePath);
2835
+ const homePath = fs.path.join(fs.env.homedir(), envFilePath);
2836
+ const probe = await probeAsync(fs, homePath);
2791
2837
  if (probe.exists) {
2792
2838
  return { exists: true, absolutePath: homePath, source: "home" };
2793
2839
  }
@@ -2830,12 +2876,12 @@ var parseEnvContent = (content) => {
2830
2876
  return env;
2831
2877
  };
2832
2878
  var loadEnvFileAsync = async ({ envPath }) => {
2833
- const fs7 = getFileSystem();
2834
- const absolutePath = fs7.path.isAbsolute(envPath) ? envPath : fs7.path.join(fs7.env.cwd(), envPath);
2835
- if (!await fs7.exists(absolutePath)) {
2879
+ const fs = getFileSystem();
2880
+ const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
2881
+ if (!await fs.exists(absolutePath)) {
2836
2882
  throw new Error(`Environment file not found: ${envPath}`);
2837
2883
  }
2838
- const content = await fs7.readFile(absolutePath, "utf-8");
2884
+ const content = await fs.readFile(absolutePath, "utf-8");
2839
2885
  if (content === null) {
2840
2886
  throw new Error(`Environment file not found: ${envPath}`);
2841
2887
  }
@@ -2846,10 +2892,10 @@ var saveEnvFileAsync = async ({
2846
2892
  data,
2847
2893
  merge = true
2848
2894
  }) => {
2849
- const fs7 = getFileSystem();
2850
- const absolutePath = fs7.path.isAbsolute(envPath) ? envPath : fs7.path.join(fs7.env.homedir(), envPath);
2895
+ const fs = getFileSystem();
2896
+ const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
2851
2897
  let existingData = {};
2852
- if (merge && await fs7.exists(absolutePath)) {
2898
+ if (merge && await fs.exists(absolutePath)) {
2853
2899
  try {
2854
2900
  existingData = await loadEnvFileAsync({ envPath: absolutePath });
2855
2901
  } catch {}
@@ -2867,11 +2913,11 @@ var saveEnvFileAsync = async ({
2867
2913
  const content = `${lines.join(`
2868
2914
  `)}
2869
2915
  `;
2870
- const dir = fs7.path.dirname(absolutePath);
2871
- await fs7.mkdir(dir);
2916
+ const dir = fs.path.dirname(absolutePath);
2917
+ await fs.mkdir(dir);
2872
2918
  const tempPath = `${absolutePath}.tmp`;
2873
- await fs7.writeFile(tempPath, content);
2874
- await fs7.rename(tempPath, absolutePath);
2919
+ await fs.writeFile(tempPath, content);
2920
+ await fs.rename(tempPath, absolutePath);
2875
2921
  };
2876
2922
 
2877
2923
  // ../auth/src/loginStatus.ts
@@ -2995,11 +3041,11 @@ async function loadFileCredentials(loadEnvFile, absolutePath) {
2995
3041
  return { credentials };
2996
3042
  }
2997
3043
  async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
2998
- const fs7 = getFs();
2999
- const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
3044
+ const fs = getFs();
3045
+ const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
3000
3046
  if (absolutePath === globalPath)
3001
3047
  return;
3002
- if (!await fs7.exists(globalPath))
3048
+ if (!await fs.exists(globalPath))
3003
3049
  return;
3004
3050
  try {
3005
3051
  const globalCreds = await loadEnvFile({ envPath: globalPath });
@@ -3416,26 +3462,38 @@ function errorMessage(error) {
3416
3462
  }
3417
3463
 
3418
3464
  // ../auth/src/authContext.ts
3465
+ class AuthContextUnavailableError extends Error {
3466
+ instructionContext;
3467
+ sessionHint;
3468
+ errorCode = "authentication_required";
3469
+ retry = "RetryWillNotFix";
3470
+ constructor(message, instructionContext = "auth", sessionHint) {
3471
+ super(message);
3472
+ this.instructionContext = instructionContext;
3473
+ this.sessionHint = sessionHint;
3474
+ this.name = "AuthContextUnavailableError";
3475
+ }
3476
+ }
3419
3477
  var getAuthContext = async (options = {}) => {
3420
3478
  const status = await getLoginStatusAsync({
3421
3479
  ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
3422
3480
  envFilePath: options.envFilePath
3423
3481
  });
3424
3482
  if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
3425
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
3483
+ throw new AuthContextUnavailableError(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.", "auth", status.hint);
3426
3484
  }
3427
- const tenantName = options.tenant ?? status.tenantName;
3485
+ const tenantName = options.tenant || status.tenantName;
3428
3486
  if (options.requireOrganizationId && !status.organizationId) {
3429
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
3487
+ throw new AuthContextUnavailableError("Organization ID not available. Ensure you are logged in with an organization context.", "identity");
3430
3488
  }
3431
3489
  if (options.requireOrganizationName && !status.organizationName) {
3432
- throw new Error("Organization name not available. Ensure you are logged in with an organization context.");
3490
+ throw new AuthContextUnavailableError("Organization name not available. Ensure you are logged in with an organization context.", "identity");
3433
3491
  }
3434
3492
  if (options.requireTenantId && !status.tenantId) {
3435
- throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
3493
+ throw new AuthContextUnavailableError(`Tenant ID not available. Ensure UIPATH_TENANT_ID is set.${status.hint ? ` ${status.hint}` : ""}`, "identity", status.hint);
3436
3494
  }
3437
- if (options.requireTenantName && tenantName === undefined) {
3438
- throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
3495
+ if (options.requireTenantName && !tenantName) {
3496
+ throw new AuthContextUnavailableError("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.", "identity");
3439
3497
  }
3440
3498
  return {
3441
3499
  baseUrl: status.baseUrl,
@@ -3524,132 +3582,132 @@ function isRecord(value) {
3524
3582
  function asRecord(value) {
3525
3583
  return isRecord(value) ? value : undefined;
3526
3584
  }
3527
- function checkString(value, path3) {
3528
- return typeof value === "string" ? undefined : path3;
3585
+ function checkString(value, path) {
3586
+ return typeof value === "string" ? undefined : path;
3529
3587
  }
3530
- function checkBoolean(value, path3) {
3531
- return typeof value === "boolean" ? undefined : path3;
3588
+ function checkBoolean(value, path) {
3589
+ return typeof value === "boolean" ? undefined : path;
3532
3590
  }
3533
- function checkInteger(value, path3) {
3534
- return typeof value === "number" && Number.isInteger(value) ? undefined : path3;
3591
+ function checkInteger(value, path) {
3592
+ return typeof value === "number" && Number.isInteger(value) ? undefined : path;
3535
3593
  }
3536
- function checkOptional(value, path3, check) {
3537
- return value === undefined || value === null ? undefined : check(value, path3);
3594
+ function checkOptional(value, path, check) {
3595
+ return value === undefined || value === null ? undefined : check(value, path);
3538
3596
  }
3539
- function checkNullableString(value, path3) {
3540
- return checkOptional(value, path3, checkString);
3597
+ function checkNullableString(value, path) {
3598
+ return checkOptional(value, path, checkString);
3541
3599
  }
3542
- function checkArray(value, path3, checkItem) {
3600
+ function checkArray(value, path, checkItem) {
3543
3601
  if (!Array.isArray(value)) {
3544
- return path3;
3602
+ return path;
3545
3603
  }
3546
3604
  for (const [index, item] of value.entries()) {
3547
- const fault = checkItem(item, `${path3}[${index}]`);
3605
+ const fault = checkItem(item, `${path}[${index}]`);
3548
3606
  if (fault !== undefined) {
3549
3607
  return fault;
3550
3608
  }
3551
3609
  }
3552
3610
  return;
3553
3611
  }
3554
- function checkNullableArray(value, path3, checkItem) {
3555
- return checkOptional(value, path3, (inner, innerPath) => checkArray(inner, innerPath, checkItem));
3612
+ function checkNullableArray(value, path, checkItem) {
3613
+ return checkOptional(value, path, (inner, innerPath) => checkArray(inner, innerPath, checkItem));
3556
3614
  }
3557
3615
  function firstFault(...faults) {
3558
3616
  return faults.find((fault) => fault !== undefined);
3559
3617
  }
3560
- function checkFieldFormat(value, path3) {
3618
+ function checkFieldFormat(value, path) {
3561
3619
  const record = asRecord(value);
3562
3620
  if (record === undefined) {
3563
- return path3;
3621
+ return path;
3564
3622
  }
3565
- return firstFault(checkOptional(record.trueDisplay, `${path3}.trueDisplay`, checkString), checkOptional(record.falseDisplay, `${path3}.falseDisplay`, checkString));
3623
+ return firstFault(checkOptional(record.trueDisplay, `${path}.trueDisplay`, checkString), checkOptional(record.falseDisplay, `${path}.falseDisplay`, checkString));
3566
3624
  }
3567
- function checkField(value, path3) {
3625
+ function checkField(value, path) {
3568
3626
  const record = asRecord(value);
3569
3627
  if (record === undefined) {
3570
- return path3;
3628
+ return path;
3571
3629
  }
3572
- return firstFault(checkString(record.id, `${path3}.id`), checkString(record.display, `${path3}.display`), checkString(record.type, `${path3}.type`), checkOptional(record.hidden, `${path3}.hidden`, checkBoolean), checkOptional(record.format, `${path3}.format`, checkFieldFormat));
3630
+ return firstFault(checkString(record.id, `${path}.id`), checkString(record.display, `${path}.display`), checkString(record.type, `${path}.type`), checkOptional(record.hidden, `${path}.hidden`, checkBoolean), checkOptional(record.format, `${path}.format`, checkFieldFormat));
3573
3631
  }
3574
- function checkTable(value, path3) {
3632
+ function checkTable(value, path) {
3575
3633
  const record = asRecord(value);
3576
3634
  if (record === undefined) {
3577
- return path3;
3635
+ return path;
3578
3636
  }
3579
- return firstFault(checkString(record.id, `${path3}.id`), checkString(record.display, `${path3}.display`), checkArray(record.fields, `${path3}.fields`, checkField));
3637
+ return firstFault(checkString(record.id, `${path}.id`), checkString(record.display, `${path}.display`), checkArray(record.fields, `${path}.fields`, checkField));
3580
3638
  }
3581
- function checkJsonArray(value, path3) {
3582
- return Array.isArray(value) ? undefined : path3;
3639
+ function checkJsonArray(value, path) {
3640
+ return Array.isArray(value) ? undefined : path;
3583
3641
  }
3584
- function checkMetricFilter(value, path3) {
3642
+ function checkMetricFilter(value, path) {
3585
3643
  const record = asRecord(value);
3586
3644
  if (record === undefined) {
3587
- return path3;
3645
+ return path;
3588
3646
  }
3589
- return firstFault(checkNullableString(record.kind, `${path3}.kind`), checkNullableString(record.dimension, `${path3}.dimension`), checkNullableString(record.type, `${path3}.type`), checkBoolean(record.invert, `${path3}.invert`), checkOptional(record.values, `${path3}.values`, checkJsonArray), checkOptional(record.pattern, `${path3}.pattern`, checkString), checkOptional(record.filterType, `${path3}.filterType`, checkString));
3647
+ return firstFault(checkNullableString(record.kind, `${path}.kind`), checkNullableString(record.dimension, `${path}.dimension`), checkNullableString(record.type, `${path}.type`), checkBoolean(record.invert, `${path}.invert`), checkOptional(record.values, `${path}.values`, checkJsonArray), checkOptional(record.pattern, `${path}.pattern`, checkString), checkOptional(record.filterType, `${path}.filterType`, checkString));
3590
3648
  }
3591
- function checkMetricExpression(value, path3) {
3649
+ function checkMetricExpression(value, path) {
3592
3650
  const record = asRecord(value);
3593
3651
  if (record === undefined) {
3594
- return path3;
3652
+ return path;
3595
3653
  }
3596
- return firstFault(checkNullableString(record.type, `${path3}.type`), checkNullableString(record.argument, `${path3}.argument`), checkNullableString(record.aggregation, `${path3}.aggregation`), checkOptional(record.id, `${path3}.id`, checkString), checkNullableArray(record.filters, `${path3}.filters`, checkMetricFilter));
3654
+ return firstFault(checkNullableString(record.type, `${path}.type`), checkNullableString(record.argument, `${path}.argument`), checkNullableString(record.aggregation, `${path}.aggregation`), checkOptional(record.id, `${path}.id`, checkString), checkNullableArray(record.filters, `${path}.filters`, checkMetricFilter));
3597
3655
  }
3598
- function checkMetric(value, path3) {
3656
+ function checkMetric(value, path) {
3599
3657
  const record = asRecord(value);
3600
3658
  if (record === undefined) {
3601
- return path3;
3659
+ return path;
3602
3660
  }
3603
- return firstFault(checkString(record.id, `${path3}.id`), checkString(record.display, `${path3}.display`), checkOptional(record.expression, `${path3}.expression`, checkMetricExpression));
3661
+ return firstFault(checkString(record.id, `${path}.id`), checkString(record.display, `${path}.display`), checkOptional(record.expression, `${path}.expression`, checkMetricExpression));
3604
3662
  }
3605
- function checkChartFilterRange(value, path3) {
3663
+ function checkChartFilterRange(value, path) {
3606
3664
  const record = asRecord(value);
3607
3665
  if (record === undefined) {
3608
- return path3;
3666
+ return path;
3609
3667
  }
3610
- return firstFault(checkOptional(record.inclusive, `${path3}.inclusive`, checkBoolean), checkOptional(record.preset, `${path3}.preset`, checkString));
3668
+ return firstFault(checkOptional(record.inclusive, `${path}.inclusive`, checkBoolean), checkOptional(record.preset, `${path}.preset`, checkString));
3611
3669
  }
3612
- function checkChartFilter(value, path3) {
3670
+ function checkChartFilter(value, path) {
3613
3671
  const record = asRecord(value);
3614
3672
  if (record === undefined) {
3615
- return path3;
3673
+ return path;
3616
3674
  }
3617
- return firstFault(checkNullableString(record.type, `${path3}.type`), checkNullableString(record.field, `${path3}.field`), checkNullableString(record.valueType, `${path3}.valueType`), checkOptional(record.values, `${path3}.values`, checkJsonArray), checkOptional(record.range, `${path3}.range`, checkChartFilterRange), checkOptional(record.invert, `${path3}.invert`, checkBoolean), checkOptional(record.pattern, `${path3}.pattern`, checkString), checkOptional(record.searchFilterType, `${path3}.searchFilterType`, checkString));
3675
+ return firstFault(checkNullableString(record.type, `${path}.type`), checkNullableString(record.field, `${path}.field`), checkNullableString(record.valueType, `${path}.valueType`), checkOptional(record.values, `${path}.values`, checkJsonArray), checkOptional(record.range, `${path}.range`, checkChartFilterRange), checkOptional(record.invert, `${path}.invert`, checkBoolean), checkOptional(record.pattern, `${path}.pattern`, checkString), checkOptional(record.searchFilterType, `${path}.searchFilterType`, checkString));
3618
3676
  }
3619
- function checkChartAction(value, path3) {
3677
+ function checkChartAction(value, path) {
3620
3678
  const record = asRecord(value);
3621
3679
  if (record === undefined) {
3622
- return path3;
3680
+ return path;
3623
3681
  }
3624
- return firstFault(checkNullableString(record.type, `${path3}.type`), checkNullableString(record.icon, `${path3}.icon`), checkNullableString(record.testId, `${path3}.testId`), checkNullableString(record.label, `${path3}.label`), checkNullableString(record.tooltip, `${path3}.tooltip`), checkNullableString(record.onClickAction, `${path3}.onClickAction`));
3682
+ return firstFault(checkNullableString(record.type, `${path}.type`), checkNullableString(record.icon, `${path}.icon`), checkNullableString(record.testId, `${path}.testId`), checkNullableString(record.label, `${path}.label`), checkNullableString(record.tooltip, `${path}.tooltip`), checkNullableString(record.onClickAction, `${path}.onClickAction`));
3625
3683
  }
3626
- function checkChart(value, path3) {
3684
+ function checkChart(value, path) {
3627
3685
  const record = asRecord(value);
3628
3686
  if (record === undefined) {
3629
- return path3;
3687
+ return path;
3630
3688
  }
3631
- return firstFault(checkString(record.type, `${path3}.type`), checkNullableArray(record.dimensions, `${path3}.dimensions`, checkString), checkNullableArray(record.metrics, `${path3}.metrics`, checkString), checkString(record.id, `${path3}.id`), checkString(record.name, `${path3}.name`), checkNullableArray(record.filters, `${path3}.filters`, checkChartFilter), checkNullableArray(record.actions, `${path3}.actions`, checkChartAction));
3689
+ return firstFault(checkString(record.type, `${path}.type`), checkNullableArray(record.dimensions, `${path}.dimensions`, checkString), checkNullableArray(record.metrics, `${path}.metrics`, checkString), checkString(record.id, `${path}.id`), checkString(record.name, `${path}.name`), checkNullableArray(record.filters, `${path}.filters`, checkChartFilter), checkNullableArray(record.actions, `${path}.actions`, checkChartAction));
3632
3690
  }
3633
- function checkContainer(value, path3) {
3691
+ function checkContainer(value, path) {
3634
3692
  const record = asRecord(value);
3635
3693
  if (record === undefined) {
3636
- return path3;
3694
+ return path;
3637
3695
  }
3638
- return firstFault(checkNullableString(record.id, `${path3}.id`), checkOptional(record.chartId, `${path3}.chartId`, checkString), checkInteger(record.rowStart, `${path3}.rowStart`), checkInteger(record.rowEnd, `${path3}.rowEnd`), checkInteger(record.columnStart, `${path3}.columnStart`), checkInteger(record.columnEnd, `${path3}.columnEnd`));
3696
+ return firstFault(checkNullableString(record.id, `${path}.id`), checkOptional(record.chartId, `${path}.chartId`, checkString), checkInteger(record.rowStart, `${path}.rowStart`), checkInteger(record.rowEnd, `${path}.rowEnd`), checkInteger(record.columnStart, `${path}.columnStart`), checkInteger(record.columnEnd, `${path}.columnEnd`));
3639
3697
  }
3640
- function checkCustomLayout(value, path3) {
3698
+ function checkCustomLayout(value, path) {
3641
3699
  const record = asRecord(value);
3642
3700
  if (record === undefined) {
3643
- return path3;
3701
+ return path;
3644
3702
  }
3645
- return firstFault(checkInteger(record.columnCount, `${path3}.columnCount`), checkInteger(record.rowCount, `${path3}.rowCount`), checkNullableArray(record.containers, `${path3}.containers`, checkContainer));
3703
+ return firstFault(checkInteger(record.columnCount, `${path}.columnCount`), checkInteger(record.rowCount, `${path}.rowCount`), checkNullableArray(record.containers, `${path}.containers`, checkContainer));
3646
3704
  }
3647
- function checkLayout(value, path3) {
3705
+ function checkLayout(value, path) {
3648
3706
  const record = asRecord(value);
3649
3707
  if (record === undefined) {
3650
- return path3;
3708
+ return path;
3651
3709
  }
3652
- return firstFault(checkString(record.type, `${path3}.type`), checkOptional(record.layout, `${path3}.layout`, checkCustomLayout));
3710
+ return firstFault(checkString(record.type, `${path}.type`), checkOptional(record.layout, `${path}.layout`, checkCustomLayout));
3653
3711
  }
3654
3712
  function findDashboardDefinitionFault(value) {
3655
3713
  const record = asRecord(value);
@@ -4346,4 +4404,4 @@ export {
4346
4404
  verifyExportDestination
4347
4405
  };
4348
4406
 
4349
- //# debugId=F53600599C5452D564756E2164756E21
4407
+ //# debugId=9DF3A7B4A2E19B2864756E2164756E21
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.205.0-preview.276",
5
+ "version": "1.206.0-preview.279",
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": "9c262c3cc03e56190185733888dca266bbb01ba6"
38
+ "gitHead": "d2176feff38d4e91a9d84723af847b2dfd5c6008"
39
39
  }