@uipath/agent-tool 1.201.0-preview.133 → 1.202.0-preview.134

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.
Files changed (54) hide show
  1. package/dist/agent-tool-OK5DK57D-hw5d866f.js +11 -0
  2. package/dist/{de-5KVP66U6-f7knj511.js → de-5KVP66U6-1bnf4zt5.js} +52 -52
  3. package/dist/{en-4KXU7N7B-66fntxa2.js → en-X3S6IZ5J-nhkg6pwn.js} +54 -60
  4. package/dist/{es-MX-XAVLOQW3-9b3cp9n8.js → es-MX-XAVLOQW3-q00km2y7.js} +52 -52
  5. package/dist/{es-VFPNVMP5-thm0z9sr.js → es-VFPNVMP5-bx2c337j.js} +52 -52
  6. package/dist/executor-tool.js +5 -13
  7. package/dist/{fr-E5MDO4EG-exvrs7ge.js → fr-E5MDO4EG-c3mkty2t.js} +52 -52
  8. package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
  9. package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
  10. package/dist/{index-26bymy67.js → index-t1etnx58.js} +160 -88
  11. package/dist/index.js +7 -17
  12. package/dist/{ja-DPO5PPLO-s2a7j3nj.js → ja-DPO5PPLO-mysfmznx.js} +52 -52
  13. package/dist/{js-yaml-cggj6w7q.js → js-yaml-87tvr6f6.js} +16 -16
  14. package/dist/{ko-ITOPNIYI-qz39kamf.js → ko-ITOPNIYI-hmxd2asd.js} +52 -52
  15. package/dist/{packager-tool-h5zqhhbj.js → packager-tool-0srzfhdr.js} +1089 -690
  16. package/dist/{packager-tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
  17. package/dist/packager-tool-5kwdv57x.js +9753 -0
  18. package/dist/{packager-tool-tq9q9m77.js → packager-tool-a42jnpy5.js} +3 -9
  19. package/dist/{packager-tool-hxqevkqd.js → packager-tool-j5vxmyem.js} +695 -1136
  20. package/dist/{packager-tool-6r1yy3e4.js → packager-tool-s1vqz1zd.js} +9227 -6826
  21. package/dist/{packager-tool-v02mthyt.js → packager-tool-vkv0j95b.js} +637 -637
  22. package/dist/packager-tool.js +5 -6
  23. package/dist/{pt-BR-BXURWX4W-dqr4dnf9.js → pt-BR-BXURWX4W-bwfcwhk1.js} +52 -52
  24. package/dist/{pt-YI4VE4YQ-v7gjeg82.js → pt-YI4VE4YQ-wdkn2dcf.js} +52 -52
  25. package/dist/{ro-RKXZUG7Z-cm3xn3fj.js → ro-RKXZUG7Z-nndrrsq7.js} +52 -52
  26. package/dist/{ru-WBLQ5B2U-awt245ky.js → ru-WBLQ5B2U-8r3c7v6d.js} +1 -1
  27. package/dist/tool.js +9 -19
  28. package/dist/{tr-AA6O2WSR-ga1xnymp.js → tr-AA6O2WSR-86ba4bdf.js} +52 -52
  29. package/dist/{zh-CN-R2KLHXQV-wttmznep.js → zh-CN-R2KLHXQV-agqr45ds.js} +52 -52
  30. package/dist/{zh-TW-RJGCQANM-gqn0aca0.js → zh-TW-RJGCQANM-w0x3qc1p.js} +52 -52
  31. package/package.json +2 -2
  32. package/dist/agent-project-service-j4pgc7gk.js +0 -12
  33. package/dist/agent-tool-OK5DK57D-zenkdkdp.js +0 -12
  34. package/dist/browser-strategy-16yagjhr.js +0 -99
  35. package/dist/index-byw2z4xp.js +0 -141
  36. package/dist/index-k1h2vppc.js +0 -2933
  37. package/dist/index-p50kx6jv.js +0 -48756
  38. package/dist/index-rqfxg3fq.js +0 -15
  39. package/dist/index-t82tsh16.js +0 -53
  40. package/dist/index.umd.min-drpc57vn.js +0 -7814
  41. package/dist/integration-tool-service-n214kzdn.js +0 -297
  42. package/dist/is-client-d8dfn2qf.js +0 -124
  43. package/dist/node-strategy-1r3qegaf.js +0 -350
  44. package/dist/packager-tool-0gctz400.js +0 -17
  45. package/dist/packager-tool-4fge2k9c.js +0 -419
  46. package/dist/packager-tool-5xdkh3vm.js +0 -2573
  47. package/dist/packager-tool-bpegrcj1.js +0 -5336
  48. package/dist/packager-tool-eqdy8fs3.js +0 -20663
  49. package/dist/packager-tool-gkvdytpj.js +0 -5085
  50. package/dist/packager-tool-nsrs2tm5.js +0 -114
  51. package/dist/packager-tool-q42rrs00.js +0 -12
  52. package/dist/packager-tool-qa9gftnj.js +0 -31
  53. package/dist/packager-tool-wzknj3dr.js +0 -394
  54. package/dist/packager-tool-yv3rvyas.js +0 -239
@@ -1,29 +1,21 @@
1
1
  import {
2
- AgentProjectService
3
- } from "./packager-tool-wzknj3dr.js";
4
- import {
2
+ OutputFormatter,
5
3
  PersonalWorkspacesApi,
4
+ RESULTS,
5
+ addSdkUserAgentHeader,
6
+ catchError,
6
7
  createApiClient,
7
8
  findSolutionFile,
9
+ getFileSystem,
10
+ getLoginStatusAsync,
11
+ getSdkUserAgentToken,
12
+ installSdkUserAgentHeader,
13
+ logger,
8
14
  readUipxFile,
15
+ summarizePlatformBody,
9
16
  updateSolutionFile,
10
17
  updateUipxSolutionId
11
- } from "./packager-tool-bpegrcj1.js";
12
- import {
13
- getLoginStatusAsync
14
- } from "./packager-tool-5xdkh3vm.js";
15
- import {
16
- catchError,
17
- logger
18
- } from "./packager-tool-gkvdytpj.js";
19
- import {
20
- addSdkUserAgentHeader,
21
- getSdkUserAgentToken,
22
- installSdkUserAgentHeader
23
- } from "./packager-tool-nsrs2tm5.js";
24
- import {
25
- getFileSystem
26
- } from "./packager-tool-yv3rvyas.js";
18
+ } from "./packager-tool-5kwdv57x.js";
27
19
  import {
28
20
  zipSync
29
21
  } from "./packager-tool-b098y4a2.js";
@@ -31,10 +23,10 @@ import {
31
23
  __commonJS,
32
24
  __require,
33
25
  __toESM
34
- } from "./packager-tool-wckvcay0.js";
26
+ } from "./packager-tool-1yh8g550.js";
35
27
 
36
28
  // ../../node_modules/adm-zip/util/constants.js
37
- var require_constants = __commonJS((exports, module) => {
29
+ var require_constants = __commonJS(function(exports, module) {
38
30
  module.exports = {
39
31
  LOCHDR: 30,
40
32
  LOCSIG: 67324752,
@@ -151,7 +143,7 @@ var require_constants = __commonJS((exports, module) => {
151
143
  });
152
144
 
153
145
  // ../../node_modules/adm-zip/util/errors.js
154
- var require_errors = __commonJS((exports) => {
146
+ var require_errors = __commonJS(function(exports) {
155
147
  var errors = {
156
148
  INVALID_LOC: "Invalid LOC header (bad signature)",
157
149
  INVALID_CEN: "Invalid CEN header (bad signature)",
@@ -202,7 +194,7 @@ var require_errors = __commonJS((exports) => {
202
194
  });
203
195
 
204
196
  // ../../node_modules/adm-zip/util/utils.js
205
- var require_utils = __commonJS((exports, module) => {
197
+ var require_utils = __commonJS(function(exports, module) {
206
198
  var fsystem = __require("fs");
207
199
  var pth = __require("path");
208
200
  var Constants = require_constants();
@@ -517,7 +509,7 @@ var require_utils = __commonJS((exports, module) => {
517
509
  });
518
510
 
519
511
  // ../../node_modules/adm-zip/util/fattr.js
520
- var require_fattr = __commonJS((exports, module) => {
512
+ var require_fattr = __commonJS(function(exports, module) {
521
513
  var pth = __require("path");
522
514
  module.exports = function(path, { fs }) {
523
515
  var _path = path || "", _obj = newAttr(), _stat = null;
@@ -582,7 +574,7 @@ var require_fattr = __commonJS((exports, module) => {
582
574
  });
583
575
 
584
576
  // ../../node_modules/adm-zip/util/decoder.js
585
- var require_decoder = __commonJS((exports, module) => {
577
+ var require_decoder = __commonJS(function(exports, module) {
586
578
  module.exports = {
587
579
  efs: true,
588
580
  encode: (data) => Buffer.from(data, "utf8"),
@@ -591,7 +583,7 @@ var require_decoder = __commonJS((exports, module) => {
591
583
  });
592
584
 
593
585
  // ../../node_modules/adm-zip/util/index.js
594
- var require_util = __commonJS((exports, module) => {
586
+ var require_util = __commonJS(function(exports, module) {
595
587
  module.exports = require_utils();
596
588
  module.exports.Constants = require_constants();
597
589
  module.exports.Errors = require_errors();
@@ -600,7 +592,7 @@ var require_util = __commonJS((exports, module) => {
600
592
  });
601
593
 
602
594
  // ../../node_modules/adm-zip/headers/entryHeader.js
603
- var require_entryHeader = __commonJS((exports, module) => {
595
+ var require_entryHeader = __commonJS(function(exports, module) {
604
596
  var Utils = require_util();
605
597
  var Constants = Utils.Constants;
606
598
  module.exports = function() {
@@ -868,7 +860,7 @@ var require_entryHeader = __commonJS((exports, module) => {
868
860
  });
869
861
 
870
862
  // ../../node_modules/adm-zip/headers/mainHeader.js
871
- var require_mainHeader = __commonJS((exports, module) => {
863
+ var require_mainHeader = __commonJS(function(exports, module) {
872
864
  var Utils = require_util();
873
865
  var Constants = Utils.Constants;
874
866
  module.exports = function() {
@@ -991,13 +983,13 @@ var require_mainHeader = __commonJS((exports, module) => {
991
983
  });
992
984
 
993
985
  // ../../node_modules/adm-zip/headers/index.js
994
- var require_headers = __commonJS((exports) => {
986
+ var require_headers = __commonJS(function(exports) {
995
987
  exports.EntryHeader = require_entryHeader();
996
988
  exports.MainHeader = require_mainHeader();
997
989
  });
998
990
 
999
991
  // ../../node_modules/adm-zip/methods/deflater.js
1000
- var require_deflater = __commonJS((exports, module) => {
992
+ var require_deflater = __commonJS(function(exports, module) {
1001
993
  module.exports = function(inbuf) {
1002
994
  var zlib = __require("zlib");
1003
995
  var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
@@ -1028,7 +1020,7 @@ var require_deflater = __commonJS((exports, module) => {
1028
1020
  });
1029
1021
 
1030
1022
  // ../../node_modules/adm-zip/methods/inflater.js
1031
- var require_inflater = __commonJS((exports, module) => {
1023
+ var require_inflater = __commonJS(function(exports, module) {
1032
1024
  var version = +(process?.versions?.node ?? "").split(".")[0] || 0;
1033
1025
  module.exports = function(inbuf, expectedLength) {
1034
1026
  var zlib = __require("zlib");
@@ -1060,7 +1052,7 @@ var require_inflater = __commonJS((exports, module) => {
1060
1052
  });
1061
1053
 
1062
1054
  // ../../node_modules/adm-zip/methods/zipcrypto.js
1063
- var require_zipcrypto = __commonJS((exports, module) => {
1055
+ var require_zipcrypto = __commonJS(function(exports, module) {
1064
1056
  var { randomFillSync } = __require("crypto");
1065
1057
  var Errors = require_errors();
1066
1058
  var crctable = new Uint32Array(256).map((t, crc) => {
@@ -1178,14 +1170,14 @@ var require_zipcrypto = __commonJS((exports, module) => {
1178
1170
  });
1179
1171
 
1180
1172
  // ../../node_modules/adm-zip/methods/index.js
1181
- var require_methods = __commonJS((exports) => {
1173
+ var require_methods = __commonJS(function(exports) {
1182
1174
  exports.Deflater = require_deflater();
1183
1175
  exports.Inflater = require_inflater();
1184
1176
  exports.ZipCrypto = require_zipcrypto();
1185
1177
  });
1186
1178
 
1187
1179
  // ../../node_modules/adm-zip/zipEntry.js
1188
- var require_zipEntry = __commonJS((exports, module) => {
1180
+ var require_zipEntry = __commonJS(function(exports, module) {
1189
1181
  var Utils = require_util();
1190
1182
  var Headers = require_headers();
1191
1183
  var Constants = Utils.Constants;
@@ -1493,7 +1485,7 @@ var require_zipEntry = __commonJS((exports, module) => {
1493
1485
  });
1494
1486
 
1495
1487
  // ../../node_modules/adm-zip/zipFile.js
1496
- var require_zipFile = __commonJS((exports, module) => {
1488
+ var require_zipFile = __commonJS(function(exports, module) {
1497
1489
  var ZipEntry = require_zipEntry();
1498
1490
  var Headers = require_headers();
1499
1491
  var Utils = require_util();
@@ -1796,7 +1788,7 @@ var require_zipFile = __commonJS((exports, module) => {
1796
1788
  });
1797
1789
 
1798
1790
  // ../../node_modules/adm-zip/adm-zip.js
1799
- var require_adm_zip = __commonJS((exports, module) => {
1791
+ var require_adm_zip = __commonJS(function(exports, module) {
1800
1792
  var Utils = require_util();
1801
1793
  var pth = __require("path");
1802
1794
  var ZipEntry = require_zipEntry();
@@ -2391,8 +2383,26 @@ var require_adm_zip = __commonJS((exports, module) => {
2391
2383
  };
2392
2384
  });
2393
2385
 
2394
- // ../solution-sdk/generated/src/runtime.ts
2395
- var BASE_PATH = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
2386
+ // ../solution-sdk/src/studio-web-compat.ts
2387
+ var API_PROJECT_TYPES = new Set(["api", "apiautomation"]);
2388
+
2389
+ class StudioWebIncompatibleProjectError extends Error {
2390
+ offendingProjects;
2391
+ constructor(offendingProjects) {
2392
+ super(`Studio Web cannot import API Workflow project(s) manifested by project.json: ${offendingProjects.join(", ")}. Studio Web's solution import accepts only project.uiproj-manifested projects.`);
2393
+ this.offendingProjects = offendingProjects;
2394
+ this.name = "StudioWebIncompatibleProjectError";
2395
+ }
2396
+ }
2397
+ function assertStudioWebCompatibleProjects(projects) {
2398
+ const incompatible = projects.filter((p) => typeof p.Type === "string" && API_PROJECT_TYPES.has(p.Type.toLowerCase()) && p.ProjectRelativePath.replace(/\\/g, "/").split("/").pop() === "project.json");
2399
+ if (incompatible.length > 0) {
2400
+ throw new StudioWebIncompatibleProjectError(incompatible.map((p) => p.ProjectRelativePath));
2401
+ }
2402
+ }
2403
+
2404
+ // ../studioweb-sdk/generated/src/runtime.ts
2405
+ var BASE_PATH = "https://alpha.uipath.com/studio_/backend".replace(/\/+$/, "");
2396
2406
 
2397
2407
  class Configuration {
2398
2408
  configuration;
@@ -2589,15 +2599,6 @@ class FetchError extends Error {
2589
2599
  this.cause = cause;
2590
2600
  }
2591
2601
  }
2592
-
2593
- class RequiredError extends Error {
2594
- field;
2595
- name = "RequiredError";
2596
- constructor(field, msg) {
2597
- super(msg);
2598
- this.field = field;
2599
- }
2600
- }
2601
2602
  function querystring(params, prefix = "") {
2602
2603
  return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
2603
2604
  }
@@ -2619,813 +2620,230 @@ function querystringSingleKey(key, value, keyPrefix = "") {
2619
2620
  }
2620
2621
  return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
2621
2622
  }
2622
- class JSONApiResponse {
2623
- raw;
2624
- transformer;
2625
- constructor(raw, transformer = (jsonValue) => jsonValue) {
2626
- this.raw = raw;
2627
- this.transformer = transformer;
2623
+ // ../solution-sdk/generated/src/runtime.ts
2624
+ var BASE_PATH2 = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
2625
+
2626
+ class Configuration2 {
2627
+ configuration;
2628
+ constructor(configuration = {}) {
2629
+ this.configuration = configuration;
2628
2630
  }
2629
- async value() {
2630
- return this.transformer(await this.raw.json());
2631
+ set config(configuration) {
2632
+ this.configuration = configuration;
2631
2633
  }
2632
- }
2633
-
2634
- class VoidApiResponse {
2635
- raw;
2636
- constructor(raw) {
2637
- this.raw = raw;
2634
+ get basePath() {
2635
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
2636
+ }
2637
+ get fetchApi() {
2638
+ return this.configuration.fetchApi;
2639
+ }
2640
+ get middleware() {
2641
+ return this.configuration.middleware || [];
2642
+ }
2643
+ get queryParamsStringify() {
2644
+ return this.configuration.queryParamsStringify || querystring2;
2645
+ }
2646
+ get username() {
2647
+ return this.configuration.username;
2648
+ }
2649
+ get password() {
2650
+ return this.configuration.password;
2638
2651
  }
2639
- async value() {
2652
+ get apiKey() {
2653
+ const apiKey = this.configuration.apiKey;
2654
+ if (apiKey) {
2655
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
2656
+ }
2640
2657
  return;
2641
2658
  }
2642
- }
2643
- class TextApiResponse {
2644
- raw;
2645
- constructor(raw) {
2646
- this.raw = raw;
2659
+ get accessToken() {
2660
+ const accessToken = this.configuration.accessToken;
2661
+ if (accessToken) {
2662
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
2663
+ }
2664
+ return;
2647
2665
  }
2648
- async value() {
2649
- return await this.raw.text();
2666
+ get headers() {
2667
+ return this.configuration.headers;
2650
2668
  }
2651
- }
2652
-
2653
- // ../solution-sdk/generated/src/models/ResponseDictionaryDto.ts
2654
- function ResponseDictionaryDtoFromJSON(json) {
2655
- return ResponseDictionaryDtoFromJSONTyped(json, false);
2656
- }
2657
- function ResponseDictionaryDtoFromJSONTyped(json, ignoreDiscriminator) {
2658
- if (json == null) {
2659
- return json;
2669
+ get credentials() {
2670
+ return this.configuration.credentials;
2660
2671
  }
2661
- return {
2662
- keys: json["keys"] == null ? undefined : json["keys"],
2663
- values: json["values"] == null ? undefined : json["values"]
2664
- };
2665
2672
  }
2673
+ var DefaultConfig2 = new Configuration2;
2666
2674
 
2667
- // ../solution-sdk/generated/src/models/BlobFileAccessDto.ts
2668
- function BlobFileAccessDtoFromJSON(json) {
2669
- return BlobFileAccessDtoFromJSONTyped(json, false);
2670
- }
2671
- function BlobFileAccessDtoFromJSONTyped(json, ignoreDiscriminator) {
2672
- if (json == null) {
2673
- return json;
2675
+ class BaseAPI2 {
2676
+ configuration;
2677
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
2678
+ middleware;
2679
+ constructor(configuration = DefaultConfig2) {
2680
+ this.configuration = configuration;
2681
+ this.middleware = configuration.middleware;
2674
2682
  }
2675
- return {
2676
- uri: json["uri"],
2677
- verb: json["verb"],
2678
- headers: json["headers"] == null ? undefined : ResponseDictionaryDtoFromJSON(json["headers"])
2679
- };
2680
- }
2681
- // ../solution-sdk/generated/src/models/CreateConfigurationCommand.ts
2682
- function CreateConfigurationCommandToJSON(json) {
2683
- return CreateConfigurationCommandToJSONTyped(json, false);
2684
- }
2685
- function CreateConfigurationCommandToJSONTyped(value, ignoreDiscriminator = false) {
2686
- if (value == null) {
2687
- return value;
2683
+ withMiddleware(...middlewares) {
2684
+ const next = this.clone();
2685
+ next.middleware = next.middleware.concat(...middlewares);
2686
+ return next;
2688
2687
  }
2689
- return {
2690
- packageVersionKey: value["packageVersionKey"],
2691
- name: value["name"]
2692
- };
2693
- }
2694
- // ../solution-sdk/generated/src/models/DeploymentActivationStatus.ts
2695
- function DeploymentActivationStatusFromJSON(json) {
2696
- return DeploymentActivationStatusFromJSONTyped(json, false);
2697
- }
2698
- function DeploymentActivationStatusFromJSONTyped(json, ignoreDiscriminator) {
2699
- return json;
2700
- }
2701
- // ../solution-sdk/generated/src/models/OverwriteType.ts
2702
- function OverwriteTypeToJSON(value) {
2703
- return value;
2704
- }
2705
-
2706
- // ../solution-sdk/generated/src/models/Overwrite.ts
2707
- function OverwriteToJSON(json) {
2708
- return OverwriteToJSONTyped(json, false);
2709
- }
2710
- function OverwriteToJSONTyped(value, ignoreDiscriminator = false) {
2711
- if (value == null) {
2712
- return value;
2688
+ withPreMiddleware(...preMiddlewares) {
2689
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
2690
+ return this.withMiddleware(...middlewares);
2713
2691
  }
2714
- return {
2715
- resourceKey: value["resourceKey"],
2716
- resourceName: value["resourceName"],
2717
- folderKey: value["folderKey"],
2718
- folderFullyQualifiedName: value["folderFullyQualifiedName"],
2719
- folderPath: value["folderPath"],
2720
- type: OverwriteTypeToJSON(value["type"])
2721
- };
2722
- }
2723
-
2724
- // ../solution-sdk/generated/src/models/ResourceOverwrite.ts
2725
- function ResourceOverwriteToJSON(json) {
2726
- return ResourceOverwriteToJSONTyped(json, false);
2727
- }
2728
- function ResourceOverwriteToJSONTyped(value, ignoreDiscriminator = false) {
2729
- if (value == null) {
2730
- return value;
2692
+ withPostMiddleware(...postMiddlewares) {
2693
+ const middlewares = postMiddlewares.map((post) => ({ post }));
2694
+ return this.withMiddleware(...middlewares);
2731
2695
  }
2732
- return {
2733
- solutionResourceKey: value["solutionResourceKey"],
2734
- reprovisioningIndex: value["reprovisioningIndex"],
2735
- overwrite: OverwriteToJSON(value["overwrite"])
2736
- };
2737
- }
2738
-
2739
- // ../solution-sdk/generated/src/models/RuntimeSetup.ts
2740
- function RuntimeSetupFromJSON(json) {
2741
- return RuntimeSetupFromJSONTyped(json, false);
2742
- }
2743
- function RuntimeSetupFromJSONTyped(json, ignoreDiscriminator) {
2744
- if (json == null) {
2745
- return json;
2696
+ isJsonMime(mime) {
2697
+ if (!mime) {
2698
+ return false;
2699
+ }
2700
+ return BaseAPI2.jsonRegex.test(mime);
2746
2701
  }
2747
- return {
2748
- requireServerlessTemplate: json["requireServerlessTemplate"]
2749
- };
2750
- }
2751
- function RuntimeSetupToJSON(json) {
2752
- return RuntimeSetupToJSONTyped(json, false);
2753
- }
2754
- function RuntimeSetupToJSONTyped(value, ignoreDiscriminator = false) {
2755
- if (value == null) {
2756
- return value;
2702
+ async request(context, initOverrides) {
2703
+ const { url, init } = await this.createFetchParams(context, initOverrides);
2704
+ const response = await this.fetchApi(url, init);
2705
+ if (response && (response.status >= 200 && response.status < 300)) {
2706
+ return response;
2707
+ }
2708
+ throw new ResponseError2(response, "Response returned an error code");
2757
2709
  }
2758
- return {
2759
- requireServerlessTemplate: value["requireServerlessTemplate"]
2760
- };
2761
- }
2762
-
2763
- // ../solution-sdk/generated/src/models/DeploymentAutoRequest.ts
2764
- function DeploymentAutoRequestToJSON(json) {
2765
- return DeploymentAutoRequestToJSONTyped(json, false);
2766
- }
2767
- function DeploymentAutoRequestToJSONTyped(value, ignoreDiscriminator = false) {
2768
- if (value == null) {
2769
- return value;
2710
+ async createFetchParams(context, initOverrides) {
2711
+ let url = this.configuration.basePath + context.path;
2712
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
2713
+ url += "?" + this.configuration.queryParamsStringify(context.query);
2714
+ }
2715
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
2716
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
2717
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
2718
+ const initParams = {
2719
+ method: context.method,
2720
+ headers,
2721
+ body: context.body,
2722
+ credentials: this.configuration.credentials
2723
+ };
2724
+ const overriddenInit = {
2725
+ ...initParams,
2726
+ ...await initOverrideFn({
2727
+ init: initParams,
2728
+ context
2729
+ })
2730
+ };
2731
+ let body;
2732
+ if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
2733
+ body = overriddenInit.body;
2734
+ } else if (this.isJsonMime(headers["Content-Type"])) {
2735
+ body = JSON.stringify(overriddenInit.body);
2736
+ } else {
2737
+ body = overriddenInit.body;
2738
+ }
2739
+ const init = {
2740
+ ...overriddenInit,
2741
+ body
2742
+ };
2743
+ return { url, init };
2770
2744
  }
2771
- return {
2772
- packageVersionKey: value["packageVersionKey"],
2773
- folderFQN: value["folderFQN"],
2774
- overwrites: value["overwrites"].map(ResourceOverwriteToJSON),
2775
- runtimeSetup: RuntimeSetupToJSON(value["runtimeSetup"])
2745
+ fetchApi = async (url, init) => {
2746
+ let fetchParams = { url, init };
2747
+ for (const middleware of this.middleware) {
2748
+ if (middleware.pre) {
2749
+ fetchParams = await middleware.pre({
2750
+ fetch: this.fetchApi,
2751
+ ...fetchParams
2752
+ }) || fetchParams;
2753
+ }
2754
+ }
2755
+ let response = undefined;
2756
+ try {
2757
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
2758
+ } catch (e) {
2759
+ for (const middleware of this.middleware) {
2760
+ if (middleware.onError) {
2761
+ response = await middleware.onError({
2762
+ fetch: this.fetchApi,
2763
+ url: fetchParams.url,
2764
+ init: fetchParams.init,
2765
+ error: e,
2766
+ response: response ? response.clone() : undefined
2767
+ }) || response;
2768
+ }
2769
+ }
2770
+ if (response === undefined) {
2771
+ if (e instanceof Error) {
2772
+ throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
2773
+ } else {
2774
+ throw e;
2775
+ }
2776
+ }
2777
+ }
2778
+ for (const middleware of this.middleware) {
2779
+ if (middleware.post) {
2780
+ response = await middleware.post({
2781
+ fetch: this.fetchApi,
2782
+ url: fetchParams.url,
2783
+ init: fetchParams.init,
2784
+ response: response.clone()
2785
+ }) || response;
2786
+ }
2787
+ }
2788
+ return response;
2776
2789
  };
2777
- }
2778
- // ../solution-sdk/generated/src/models/DeploymentDto.ts
2779
- function DeploymentDtoFromJSON(json) {
2780
- return DeploymentDtoFromJSONTyped(json, false);
2781
- }
2782
- function DeploymentDtoFromJSONTyped(json, ignoreDiscriminator) {
2783
- if (json == null) {
2784
- return json;
2790
+ clone() {
2791
+ const constructor = this.constructor;
2792
+ const next = new constructor(this.configuration);
2793
+ next.middleware = this.middleware.slice();
2794
+ return next;
2785
2795
  }
2786
- return {
2787
- packageName: json["packageName"],
2788
- deploymentName: json["deploymentName"]
2789
- };
2790
- }
2791
- // ../solution-sdk/generated/src/models/WorkflowAction.ts
2792
- function WorkflowActionFromJSON(json) {
2793
- return WorkflowActionFromJSONTyped(json, false);
2794
- }
2795
- function WorkflowActionFromJSONTyped(json, ignoreDiscriminator) {
2796
- return json;
2797
- }
2798
-
2799
- // ../solution-sdk/generated/src/models/DeploymentOperation.ts
2800
- function DeploymentOperationFromJSON(json) {
2801
- return DeploymentOperationFromJSONTyped(json, false);
2802
- }
2803
- function DeploymentOperationFromJSONTyped(json, ignoreDiscriminator) {
2804
- return json;
2805
- }
2806
-
2807
- // ../solution-sdk/generated/src/models/PackageVersionOrigin.ts
2808
- function PackageVersionOriginFromJSON(json) {
2809
- return PackageVersionOriginFromJSONTyped(json, false);
2810
- }
2811
- function PackageVersionOriginFromJSONTyped(json, ignoreDiscriminator) {
2812
- return json;
2813
- }
2814
-
2815
- // ../solution-sdk/generated/src/models/DeploymentOperationStatus.ts
2816
- function DeploymentOperationStatusFromJSON(json) {
2817
- return DeploymentOperationStatusFromJSONTyped(json, false);
2818
- }
2819
- function DeploymentOperationStatusFromJSONTyped(json, ignoreDiscriminator) {
2820
- return json;
2821
2796
  }
2822
-
2823
- // ../solution-sdk/generated/src/models/DeploymentUpgradeType.ts
2824
- function DeploymentUpgradeTypeFromJSON(json) {
2825
- return DeploymentUpgradeTypeFromJSONTyped(json, false);
2797
+ function isBlob2(value) {
2798
+ return typeof Blob !== "undefined" && value instanceof Blob;
2826
2799
  }
2827
- function DeploymentUpgradeTypeFromJSONTyped(json, ignoreDiscriminator) {
2828
- return json;
2800
+ function isFormData2(value) {
2801
+ return typeof FormData !== "undefined" && value instanceof FormData;
2829
2802
  }
2830
2803
 
2831
- // ../solution-sdk/generated/src/models/DeploymentStatus.ts
2832
- function DeploymentStatusFromJSON(json) {
2833
- return DeploymentStatusFromJSONTyped(json, false);
2834
- }
2835
- function DeploymentStatusFromJSONTyped(json, ignoreDiscriminator) {
2836
- return json;
2804
+ class ResponseError2 extends Error {
2805
+ response;
2806
+ name = "ResponseError";
2807
+ constructor(response, msg) {
2808
+ super(msg);
2809
+ this.response = response;
2810
+ }
2837
2811
  }
2838
2812
 
2839
- // ../solution-sdk/generated/src/models/DeploymentItemDto.ts
2840
- function DeploymentItemDtoFromJSON(json) {
2841
- return DeploymentItemDtoFromJSONTyped(json, false);
2842
- }
2843
- function DeploymentItemDtoFromJSONTyped(json, ignoreDiscriminator) {
2844
- if (json == null) {
2845
- return json;
2813
+ class FetchError2 extends Error {
2814
+ cause;
2815
+ name = "FetchError";
2816
+ constructor(cause, msg) {
2817
+ super(msg);
2818
+ this.cause = cause;
2846
2819
  }
2847
- return {
2848
- key: json["key"],
2849
- installDeploymentKey: json["installDeploymentKey"],
2850
- name: json["name"],
2851
- configurationKey: json["configurationKey"],
2852
- packageVersionKey: json["packageVersionKey"],
2853
- packageKey: json["packageKey"],
2854
- packageName: json["packageName"],
2855
- packageVersion: json["packageVersion"],
2856
- currentPackageVersion: json["currentPackageVersion"] == null ? undefined : json["currentPackageVersion"],
2857
- targetPackageVersion: json["targetPackageVersion"] == null ? undefined : json["targetPackageVersion"],
2858
- folderPath: json["folderPath"] == null ? undefined : json["folderPath"],
2859
- installedRootFolderKey: json["installedRootFolderKey"] == null ? undefined : json["installedRootFolderKey"],
2860
- installedRootFolderName: json["installedRootFolderName"] == null ? undefined : json["installedRootFolderName"],
2861
- packageVersionOrigin: PackageVersionOriginFromJSON(json["packageVersionOrigin"]),
2862
- deploymentCreationTime: new Date(json["deploymentCreationTime"]),
2863
- status: DeploymentStatusFromJSON(json["status"]),
2864
- startTime: json["startTime"] == null ? undefined : new Date(json["startTime"]),
2865
- endTime: json["endTime"] == null ? undefined : new Date(json["endTime"]),
2866
- upgradeType: json["upgradeType"] == null ? undefined : DeploymentUpgradeTypeFromJSON(json["upgradeType"]),
2867
- operation: DeploymentOperationFromJSON(json["operation"]),
2868
- operationStatus: DeploymentOperationStatusFromJSON(json["operationStatus"]),
2869
- activationStatus: DeploymentActivationStatusFromJSON(json["activationStatus"]),
2870
- instanceId: json["instanceId"] == null ? undefined : json["instanceId"],
2871
- newPackageVersionAvailable: json["newPackageVersionAvailable"] == null ? undefined : json["newPackageVersionAvailable"],
2872
- packageVersionDescription: json["packageVersionDescription"] == null ? undefined : json["packageVersionDescription"],
2873
- packageVersionReleaseNotes: json["packageVersionReleaseNotes"] == null ? undefined : json["packageVersionReleaseNotes"],
2874
- authorName: json["authorName"],
2875
- previousDeploymentKey: json["previousDeploymentKey"] == null ? undefined : json["previousDeploymentKey"],
2876
- runtimeSetup: json["runtimeSetup"] == null ? undefined : RuntimeSetupFromJSON(json["runtimeSetup"]),
2877
- actions: json["actions"].map(WorkflowActionFromJSON)
2878
- };
2879
2820
  }
2880
- // ../solution-sdk/generated/src/models/DeploymentRequest.ts
2881
- function DeploymentRequestToJSON(json) {
2882
- return DeploymentRequestToJSONTyped(json, false);
2821
+ function querystring2(params, prefix = "") {
2822
+ return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
2883
2823
  }
2884
- function DeploymentRequestToJSONTyped(value, ignoreDiscriminator = false) {
2885
- if (value == null) {
2886
- return value;
2887
- }
2888
- return {
2889
- configurationKey: value["configurationKey"],
2890
- deploymentName: value["deploymentName"],
2891
- installationFolderKey: value["installationFolderKey"],
2892
- pathFullyQualifiedName: value["pathFullyQualifiedName"],
2893
- solutionRootFolderName: value["solutionRootFolderName"],
2894
- forceActivate: value["forceActivate"],
2895
- runtimeSetup: RuntimeSetupToJSON(value["runtimeSetup"])
2896
- };
2897
- }
2898
- // ../solution-sdk/generated/src/models/DeploymentUpgradeRequest.ts
2899
- function DeploymentUpgradeRequestToJSON(json) {
2900
- return DeploymentUpgradeRequestToJSONTyped(json, false);
2901
- }
2902
- function DeploymentUpgradeRequestToJSONTyped(value, ignoreDiscriminator = false) {
2903
- if (value == null) {
2904
- return value;
2905
- }
2906
- return {
2907
- deploymentName: value["deploymentName"],
2908
- packageVersionKey: value["packageVersionKey"]
2909
- };
2910
- }
2911
- // ../solution-sdk/generated/src/models/ExtendedPackageVersionState.ts
2912
- function ExtendedPackageVersionStateFromJSON(json) {
2913
- return ExtendedPackageVersionStateFromJSONTyped(json, false);
2914
- }
2915
- function ExtendedPackageVersionStateFromJSONTyped(json, ignoreDiscriminator) {
2916
- return json;
2917
- }
2918
- // ../solution-sdk/generated/src/models/FolderInfo.ts
2919
- function FolderInfoFromJSON(json) {
2920
- return FolderInfoFromJSONTyped(json, false);
2921
- }
2922
- function FolderInfoFromJSONTyped(json, ignoreDiscriminator) {
2923
- if (json == null) {
2924
- return json;
2925
- }
2926
- return {
2927
- fullyQualifiedName: json["fullyQualifiedName"],
2928
- path: json["path"] == null ? undefined : json["path"],
2929
- folderKey: json["folderKey"] == null ? undefined : json["folderKey"]
2930
- };
2931
- }
2932
- // ../solution-sdk/generated/src/models/LocationDto.ts
2933
- function LocationDtoFromJSON(json) {
2934
- return LocationDtoFromJSONTyped(json, false);
2935
- }
2936
- function LocationDtoFromJSONTyped(json, ignoreDiscriminator) {
2937
- if (json == null) {
2938
- return json;
2939
- }
2940
- return {
2941
- name: json["name"],
2942
- key: json["key"],
2943
- isPersonalWorkspace: json["isPersonalWorkspace"]
2944
- };
2945
- }
2946
- // ../solution-sdk/generated/src/models/PackageInfo.ts
2947
- function PackageInfoFromJSON(json) {
2948
- return PackageInfoFromJSONTyped(json, false);
2949
- }
2950
- function PackageInfoFromJSONTyped(json, ignoreDiscriminator) {
2951
- if (json == null) {
2952
- return json;
2953
- }
2954
- return {
2955
- key: json["key"],
2956
- name: json["name"],
2957
- latestVersion: json["latestVersion"],
2958
- packageVersionKey: json["packageVersionKey"],
2959
- authorName: json["authorName"],
2960
- authorEmail: json["authorEmail"] == null ? undefined : json["authorEmail"],
2961
- publishDate: new Date(json["publishDate"]),
2962
- description: json["description"] == null ? undefined : json["description"],
2963
- releaseNotes: json["releaseNotes"] == null ? undefined : json["releaseNotes"],
2964
- state: ExtendedPackageVersionStateFromJSON(json["state"]),
2965
- solutionRootFolderName: json["solutionRootFolderName"],
2966
- hasUpgradeableDeployments: json["hasUpgradeableDeployments"]
2967
- };
2968
- }
2969
- // ../solution-sdk/generated/src/models/ResourceStats.ts
2970
- function ResourceStatsFromJSON(json) {
2971
- return ResourceStatsFromJSONTyped(json, false);
2972
- }
2973
- function ResourceStatsFromJSONTyped(json, ignoreDiscriminator) {
2974
- if (json == null) {
2975
- return json;
2976
- }
2977
- return {
2978
- count: json["count"],
2979
- kind: json["kind"],
2980
- serviceName: json["serviceName"]
2981
- };
2982
- }
2983
-
2984
- // ../solution-sdk/generated/src/models/PackageVersionResourceDto.ts
2985
- function PackageVersionResourceDtoFromJSON(json) {
2986
- return PackageVersionResourceDtoFromJSONTyped(json, false);
2987
- }
2988
- function PackageVersionResourceDtoFromJSONTyped(json, ignoreDiscriminator) {
2989
- if (json == null) {
2990
- return json;
2991
- }
2992
- return {
2993
- key: json["key"],
2994
- name: json["name"],
2995
- kind: json["kind"],
2996
- type: json["type"] == null ? undefined : json["type"],
2997
- apiVersion: json["apiVersion"],
2998
- folders: json["folders"].map(FolderInfoFromJSON)
2999
- };
3000
- }
3001
-
3002
- // ../solution-sdk/generated/src/models/PackageVersionComponentsDto.ts
3003
- function PackageVersionComponentsDtoFromJSON(json) {
3004
- return PackageVersionComponentsDtoFromJSONTyped(json, false);
3005
- }
3006
- function PackageVersionComponentsDtoFromJSONTyped(json, ignoreDiscriminator) {
3007
- if (json == null) {
3008
- return json;
3009
- }
3010
- return {
3011
- count: json["count"],
3012
- resources: json["resources"].map(PackageVersionResourceDtoFromJSON),
3013
- stats: json["stats"].map(ResourceStatsFromJSON)
3014
- };
3015
- }
3016
- // ../solution-sdk/generated/src/models/PackageVersionInfoDto.ts
3017
- function PackageVersionInfoDtoFromJSON(json) {
3018
- return PackageVersionInfoDtoFromJSONTyped(json, false);
3019
- }
3020
- function PackageVersionInfoDtoFromJSONTyped(json, ignoreDiscriminator) {
3021
- if (json == null) {
3022
- return json;
3023
- }
3024
- return {
3025
- key: json["key"],
3026
- packageName: json["packageName"],
3027
- packageVersion: json["packageVersion"],
3028
- publishDate: new Date(json["publishDate"]),
3029
- authorName: json["authorName"],
3030
- authorEmail: json["authorEmail"] == null ? undefined : json["authorEmail"],
3031
- description: json["description"] == null ? undefined : json["description"],
3032
- releaseNotes: json["releaseNotes"] == null ? undefined : json["releaseNotes"],
3033
- state: ExtendedPackageVersionStateFromJSON(json["state"]),
3034
- solutionRootFolderName: json["solutionRootFolderName"],
3035
- locationKey: json["locationKey"] == null ? undefined : json["locationKey"],
3036
- components: json["components"] == null ? undefined : PackageVersionComponentsDtoFromJSON(json["components"])
3037
- };
3038
- }
3039
- // ../solution-sdk/generated/src/apis/ConfigurationsApi.ts
3040
- class ConfigurationsApi extends BaseAPI {
3041
- async configurationsPostRaw(requestParameters, initOverrides) {
3042
- if (requestParameters["createConfigurationCommand"] == null) {
3043
- throw new RequiredError("createConfigurationCommand", 'Required parameter "createConfigurationCommand" was null or undefined when calling configurationsPost().');
3044
- }
3045
- const queryParameters = {};
3046
- const headerParameters = {};
3047
- headerParameters["Content-Type"] = "application/json";
3048
- if (requestParameters["xUipathAsVersion"] != null) {
3049
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3050
- }
3051
- if (this.configuration && this.configuration.accessToken) {
3052
- const token = this.configuration.accessToken;
3053
- const tokenString = await token("Bearer", []);
3054
- if (tokenString) {
3055
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3056
- }
3057
- }
3058
- let urlPath = `/api/configurations`;
3059
- const response = await this.request({
3060
- path: urlPath,
3061
- method: "POST",
3062
- headers: headerParameters,
3063
- query: queryParameters,
3064
- body: CreateConfigurationCommandToJSON(requestParameters["createConfigurationCommand"])
3065
- }, initOverrides);
3066
- if (this.isJsonMime(response.headers.get("content-type"))) {
3067
- return new JSONApiResponse(response);
3068
- } else {
3069
- return new TextApiResponse(response);
3070
- }
3071
- }
3072
- async configurationsPost(requestParameters, initOverrides) {
3073
- const response = await this.configurationsPostRaw(requestParameters, initOverrides);
3074
- return await response.value();
3075
- }
3076
- }
3077
-
3078
- // ../solution-sdk/generated/src/apis/DeploymentsApi.ts
3079
- class DeploymentsApi extends BaseAPI {
3080
- async deploymentsDeployRaw(requestParameters, initOverrides) {
3081
- if (requestParameters["deploymentAutoRequest"] == null) {
3082
- throw new RequiredError("deploymentAutoRequest", 'Required parameter "deploymentAutoRequest" was null or undefined when calling deploymentsDeploy().');
3083
- }
3084
- const queryParameters = {};
3085
- const headerParameters = {};
3086
- headerParameters["Content-Type"] = "application/json";
3087
- if (requestParameters["xUIPATHFolderKey"] != null) {
3088
- headerParameters["X-UIPATH-FolderKey"] = String(requestParameters["xUIPATHFolderKey"]);
3089
- }
3090
- if (requestParameters["xUipathAsVersion"] != null) {
3091
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3092
- }
3093
- if (this.configuration && this.configuration.accessToken) {
3094
- const token = this.configuration.accessToken;
3095
- const tokenString = await token("Bearer", []);
3096
- if (tokenString) {
3097
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3098
- }
3099
- }
3100
- let urlPath = `/api/deployments/deploy`;
3101
- const response = await this.request({
3102
- path: urlPath,
3103
- method: "POST",
3104
- headers: headerParameters,
3105
- query: queryParameters,
3106
- body: DeploymentAutoRequestToJSON(requestParameters["deploymentAutoRequest"])
3107
- }, initOverrides);
3108
- return new JSONApiResponse(response, (jsonValue) => DeploymentDtoFromJSON(jsonValue));
3109
- }
3110
- async deploymentsDeploy(requestParameters, initOverrides) {
3111
- const response = await this.deploymentsDeployRaw(requestParameters, initOverrides);
3112
- return await response.value();
3113
- }
3114
- async deploymentsGetByKeyRaw(requestParameters, initOverrides) {
3115
- if (requestParameters["deploymentKey"] == null) {
3116
- throw new RequiredError("deploymentKey", 'Required parameter "deploymentKey" was null or undefined when calling deploymentsGetByKey().');
3117
- }
3118
- const queryParameters = {};
3119
- const headerParameters = {};
3120
- if (requestParameters["xUipathAsVersion"] != null) {
3121
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3122
- }
3123
- if (this.configuration && this.configuration.accessToken) {
3124
- const token = this.configuration.accessToken;
3125
- const tokenString = await token("Bearer", []);
3126
- if (tokenString) {
3127
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3128
- }
3129
- }
3130
- let urlPath = `/api/deployments/{deploymentKey}`;
3131
- urlPath = urlPath.replace(`{${"deploymentKey"}}`, encodeURIComponent(String(requestParameters["deploymentKey"])));
3132
- const response = await this.request({
3133
- path: urlPath,
3134
- method: "GET",
3135
- headers: headerParameters,
3136
- query: queryParameters
3137
- }, initOverrides);
3138
- return new JSONApiResponse(response, (jsonValue) => DeploymentItemDtoFromJSON(jsonValue));
3139
- }
3140
- async deploymentsGetByKey(requestParameters, initOverrides) {
3141
- const response = await this.deploymentsGetByKeyRaw(requestParameters, initOverrides);
3142
- return await response.value();
3143
- }
3144
- async deploymentsPostRaw(requestParameters, initOverrides) {
3145
- if (requestParameters["deploymentRequest"] == null) {
3146
- throw new RequiredError("deploymentRequest", 'Required parameter "deploymentRequest" was null or undefined when calling deploymentsPost().');
3147
- }
3148
- const queryParameters = {};
3149
- const headerParameters = {};
3150
- headerParameters["Content-Type"] = "application/json";
3151
- if (requestParameters["xUipathAsVersion"] != null) {
3152
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3153
- }
3154
- if (this.configuration && this.configuration.accessToken) {
3155
- const token = this.configuration.accessToken;
3156
- const tokenString = await token("Bearer", []);
3157
- if (tokenString) {
3158
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3159
- }
3160
- }
3161
- let urlPath = `/api/deployments`;
3162
- const response = await this.request({
3163
- path: urlPath,
3164
- method: "POST",
3165
- headers: headerParameters,
3166
- query: queryParameters,
3167
- body: DeploymentRequestToJSON(requestParameters["deploymentRequest"])
3168
- }, initOverrides);
3169
- return new JSONApiResponse(response, (jsonValue) => DeploymentItemDtoFromJSON(jsonValue));
3170
- }
3171
- async deploymentsPost(requestParameters, initOverrides) {
3172
- const response = await this.deploymentsPostRaw(requestParameters, initOverrides);
3173
- return await response.value();
3174
- }
3175
- async deploymentsUpgradeRaw(requestParameters, initOverrides) {
3176
- if (requestParameters["deploymentKey"] == null) {
3177
- throw new RequiredError("deploymentKey", 'Required parameter "deploymentKey" was null or undefined when calling deploymentsUpgrade().');
3178
- }
3179
- const queryParameters = {};
3180
- if (requestParameters["packageVersionKey"] != null) {
3181
- queryParameters["packageVersionKey"] = requestParameters["packageVersionKey"];
3182
- }
3183
- const headerParameters = {};
3184
- headerParameters["Content-Type"] = "application/json";
3185
- if (requestParameters["xUipathAsVersion"] != null) {
3186
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3187
- }
3188
- if (this.configuration && this.configuration.accessToken) {
3189
- const token = this.configuration.accessToken;
3190
- const tokenString = await token("Bearer", []);
3191
- if (tokenString) {
3192
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3193
- }
3194
- }
3195
- let urlPath = `/api/deployments/{deploymentKey}/upgrade`;
3196
- urlPath = urlPath.replace(`{${"deploymentKey"}}`, encodeURIComponent(String(requestParameters["deploymentKey"])));
3197
- const response = await this.request({
3198
- path: urlPath,
3199
- method: "POST",
3200
- headers: headerParameters,
3201
- query: queryParameters,
3202
- body: DeploymentUpgradeRequestToJSON(requestParameters["deploymentUpgradeRequest"])
3203
- }, initOverrides);
3204
- return new JSONApiResponse(response, (jsonValue) => DeploymentItemDtoFromJSON(jsonValue));
2824
+ function querystringSingleKey2(key, value, keyPrefix = "") {
2825
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
2826
+ if (value instanceof Array) {
2827
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
2828
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
3205
2829
  }
3206
- async deploymentsUpgrade(requestParameters, initOverrides) {
3207
- const response = await this.deploymentsUpgradeRaw(requestParameters, initOverrides);
3208
- return await response.value();
2830
+ if (value instanceof Set) {
2831
+ const valueAsArray = Array.from(value);
2832
+ return querystringSingleKey2(key, valueAsArray, keyPrefix);
3209
2833
  }
3210
- }
3211
-
3212
- // ../solution-sdk/generated/src/apis/PackagesApi.ts
3213
- class PackagesApi extends BaseAPI {
3214
- async packagesDeletePackageRaw(requestParameters, initOverrides) {
3215
- if (requestParameters["packageKey"] == null) {
3216
- throw new RequiredError("packageKey", 'Required parameter "packageKey" was null or undefined when calling packagesDeletePackage().');
3217
- }
3218
- const queryParameters = {};
3219
- const headerParameters = {};
3220
- if (requestParameters["xUipathAsVersion"] != null) {
3221
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3222
- }
3223
- if (this.configuration && this.configuration.accessToken) {
3224
- const token = this.configuration.accessToken;
3225
- const tokenString = await token("Bearer", []);
3226
- if (tokenString) {
3227
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3228
- }
3229
- }
3230
- let urlPath = `/api/packages/{packageKey}`;
3231
- urlPath = urlPath.replace(`{${"packageKey"}}`, encodeURIComponent(String(requestParameters["packageKey"])));
3232
- const response = await this.request({
3233
- path: urlPath,
3234
- method: "DELETE",
3235
- headers: headerParameters,
3236
- query: queryParameters
3237
- }, initOverrides);
3238
- return new VoidApiResponse(response);
3239
- }
3240
- async packagesDeletePackage(requestParameters, initOverrides) {
3241
- await this.packagesDeletePackageRaw(requestParameters, initOverrides);
3242
- }
3243
- async packagesDeleteVersionRaw(requestParameters, initOverrides) {
3244
- if (requestParameters["packageVersionKey"] == null) {
3245
- throw new RequiredError("packageVersionKey", 'Required parameter "packageVersionKey" was null or undefined when calling packagesDeleteVersion().');
3246
- }
3247
- const queryParameters = {};
3248
- const headerParameters = {};
3249
- if (requestParameters["xUipathAsVersion"] != null) {
3250
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3251
- }
3252
- if (this.configuration && this.configuration.accessToken) {
3253
- const token = this.configuration.accessToken;
3254
- const tokenString = await token("Bearer", []);
3255
- if (tokenString) {
3256
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3257
- }
3258
- }
3259
- let urlPath = `/api/packages/versions/{packageVersionKey}`;
3260
- urlPath = urlPath.replace(`{${"packageVersionKey"}}`, encodeURIComponent(String(requestParameters["packageVersionKey"])));
3261
- const response = await this.request({
3262
- path: urlPath,
3263
- method: "DELETE",
3264
- headers: headerParameters,
3265
- query: queryParameters
3266
- }, initOverrides);
3267
- return new VoidApiResponse(response);
3268
- }
3269
- async packagesDeleteVersion(requestParameters, initOverrides) {
3270
- await this.packagesDeleteVersionRaw(requestParameters, initOverrides);
3271
- }
3272
- async packagesDownloadRaw(requestParameters, initOverrides) {
3273
- if (requestParameters["packageVersionKey"] == null) {
3274
- throw new RequiredError("packageVersionKey", 'Required parameter "packageVersionKey" was null or undefined when calling packagesDownload().');
3275
- }
3276
- const queryParameters = {};
3277
- const headerParameters = {};
3278
- if (requestParameters["xUipathAsVersion"] != null) {
3279
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3280
- }
3281
- if (this.configuration && this.configuration.accessToken) {
3282
- const token = this.configuration.accessToken;
3283
- const tokenString = await token("Bearer", []);
3284
- if (tokenString) {
3285
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3286
- }
3287
- }
3288
- let urlPath = `/api/packages/{packageVersionKey}/download`;
3289
- urlPath = urlPath.replace(`{${"packageVersionKey"}}`, encodeURIComponent(String(requestParameters["packageVersionKey"])));
3290
- const response = await this.request({
3291
- path: urlPath,
3292
- method: "GET",
3293
- headers: headerParameters,
3294
- query: queryParameters
3295
- }, initOverrides);
3296
- return new JSONApiResponse(response, (jsonValue) => BlobFileAccessDtoFromJSON(jsonValue));
3297
- }
3298
- async packagesDownload(requestParameters, initOverrides) {
3299
- const response = await this.packagesDownloadRaw(requestParameters, initOverrides);
3300
- return await response.value();
3301
- }
3302
- async packagesGetPackageRaw(requestParameters, initOverrides) {
3303
- if (requestParameters["packageKey"] == null) {
3304
- throw new RequiredError("packageKey", 'Required parameter "packageKey" was null or undefined when calling packagesGetPackage().');
3305
- }
3306
- const queryParameters = {};
3307
- const headerParameters = {};
3308
- if (requestParameters["xUipathAsVersion"] != null) {
3309
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3310
- }
3311
- if (this.configuration && this.configuration.accessToken) {
3312
- const token = this.configuration.accessToken;
3313
- const tokenString = await token("Bearer", []);
3314
- if (tokenString) {
3315
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3316
- }
3317
- }
3318
- let urlPath = `/api/packages/{packageKey}`;
3319
- urlPath = urlPath.replace(`{${"packageKey"}}`, encodeURIComponent(String(requestParameters["packageKey"])));
3320
- const response = await this.request({
3321
- path: urlPath,
3322
- method: "GET",
3323
- headers: headerParameters,
3324
- query: queryParameters
3325
- }, initOverrides);
3326
- return new JSONApiResponse(response, (jsonValue) => PackageInfoFromJSON(jsonValue));
3327
- }
3328
- async packagesGetPackage(requestParameters, initOverrides) {
3329
- const response = await this.packagesGetPackageRaw(requestParameters, initOverrides);
3330
- return await response.value();
3331
- }
3332
- async packagesGetPublishLocationsRaw(requestParameters, initOverrides) {
3333
- const queryParameters = {};
3334
- const headerParameters = {};
3335
- if (requestParameters["xUipathAsVersion"] != null) {
3336
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3337
- }
3338
- if (this.configuration && this.configuration.accessToken) {
3339
- const token = this.configuration.accessToken;
3340
- const tokenString = await token("Bearer", []);
3341
- if (tokenString) {
3342
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3343
- }
3344
- }
3345
- let urlPath = `/api/packages/publish-locations`;
3346
- const response = await this.request({
3347
- path: urlPath,
3348
- method: "GET",
3349
- headers: headerParameters,
3350
- query: queryParameters
3351
- }, initOverrides);
3352
- return new JSONApiResponse(response, (jsonValue) => jsonValue.map(LocationDtoFromJSON));
3353
- }
3354
- async packagesGetPublishLocations(requestParameters = {}, initOverrides) {
3355
- const response = await this.packagesGetPublishLocationsRaw(requestParameters, initOverrides);
3356
- return await response.value();
3357
- }
3358
- async packagesGetVersionRaw(requestParameters, initOverrides) {
3359
- if (requestParameters["packageVersionKey"] == null) {
3360
- throw new RequiredError("packageVersionKey", 'Required parameter "packageVersionKey" was null or undefined when calling packagesGetVersion().');
3361
- }
3362
- const queryParameters = {};
3363
- const headerParameters = {};
3364
- if (requestParameters["xUipathAsVersion"] != null) {
3365
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3366
- }
3367
- if (this.configuration && this.configuration.accessToken) {
3368
- const token = this.configuration.accessToken;
3369
- const tokenString = await token("Bearer", []);
3370
- if (tokenString) {
3371
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3372
- }
3373
- }
3374
- let urlPath = `/api/packages/versions/{packageVersionKey}`;
3375
- urlPath = urlPath.replace(`{${"packageVersionKey"}}`, encodeURIComponent(String(requestParameters["packageVersionKey"])));
3376
- const response = await this.request({
3377
- path: urlPath,
3378
- method: "GET",
3379
- headers: headerParameters,
3380
- query: queryParameters
3381
- }, initOverrides);
3382
- return new JSONApiResponse(response, (jsonValue) => PackageVersionInfoDtoFromJSON(jsonValue));
3383
- }
3384
- async packagesGetVersion(requestParameters, initOverrides) {
3385
- const response = await this.packagesGetVersionRaw(requestParameters, initOverrides);
3386
- return await response.value();
3387
- }
3388
- async packagesUploadRaw(requestParameters, initOverrides) {
3389
- const queryParameters = {};
3390
- if (requestParameters["locationKey"] != null) {
3391
- queryParameters["locationKey"] = requestParameters["locationKey"];
3392
- }
3393
- const headerParameters = {};
3394
- headerParameters["Content-Type"] = "application/zip";
3395
- if (requestParameters["xUipathAsVersion"] != null) {
3396
- headerParameters["x-uipath-as-version"] = String(requestParameters["xUipathAsVersion"]);
3397
- }
3398
- if (this.configuration && this.configuration.accessToken) {
3399
- const token = this.configuration.accessToken;
3400
- const tokenString = await token("Bearer", []);
3401
- if (tokenString) {
3402
- headerParameters["Authorization"] = `Bearer ${tokenString}`;
3403
- }
3404
- }
3405
- let urlPath = `/api/packages/upload`;
3406
- const response = await this.request({
3407
- path: urlPath,
3408
- method: "POST",
3409
- headers: headerParameters,
3410
- query: queryParameters,
3411
- body: requestParameters["body"]
3412
- }, initOverrides);
3413
- if (this.isJsonMime(response.headers.get("content-type"))) {
3414
- return new JSONApiResponse(response);
3415
- } else {
3416
- return new TextApiResponse(response);
3417
- }
2834
+ if (value instanceof Date) {
2835
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
3418
2836
  }
3419
- async packagesUpload(requestParameters = {}, initOverrides) {
3420
- const response = await this.packagesUploadRaw(requestParameters, initOverrides);
3421
- return await response.value();
2837
+ if (value instanceof Object) {
2838
+ return querystring2(value, fullKey);
3422
2839
  }
2840
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
3423
2841
  }
3424
2842
  // ../solution-sdk/package.json
3425
2843
  var package_default = {
3426
2844
  name: "@uipath/solution-sdk",
3427
2845
  license: "MIT",
3428
- version: "1.201.0-preview.133",
2846
+ version: "1.202.0-preview.134",
3429
2847
  repository: {
3430
2848
  type: "git",
3431
2849
  url: "https://github.com/UiPath/cli.git",
@@ -3482,238 +2900,221 @@ var package_default = {
3482
2900
  "@types/node": "^25.5.2",
3483
2901
  fflate: "^0.8.2",
3484
2902
  typescript: "^7.0.2"
3485
- }
3486
- };
3487
-
3488
- // ../solution-sdk/src/user-agent.ts
3489
- var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
3490
- installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
3491
-
3492
- // ../studioweb-sdk/generated/src/runtime.ts
3493
- var BASE_PATH2 = "https://alpha.uipath.com/studio_/backend".replace(/\/+$/, "");
3494
-
3495
- class Configuration2 {
3496
- configuration;
3497
- constructor(configuration = {}) {
3498
- this.configuration = configuration;
3499
- }
3500
- set config(configuration) {
3501
- this.configuration = configuration;
3502
- }
3503
- get basePath() {
3504
- return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
3505
- }
3506
- get fetchApi() {
3507
- return this.configuration.fetchApi;
3508
- }
3509
- get middleware() {
3510
- return this.configuration.middleware || [];
3511
- }
3512
- get queryParamsStringify() {
3513
- return this.configuration.queryParamsStringify || querystring2;
3514
- }
3515
- get username() {
3516
- return this.configuration.username;
3517
- }
3518
- get password() {
3519
- return this.configuration.password;
3520
- }
3521
- get apiKey() {
3522
- const apiKey = this.configuration.apiKey;
3523
- if (apiKey) {
3524
- return typeof apiKey === "function" ? apiKey : () => apiKey;
3525
- }
3526
- return;
3527
- }
3528
- get accessToken() {
3529
- const accessToken = this.configuration.accessToken;
3530
- if (accessToken) {
3531
- return typeof accessToken === "function" ? accessToken : async () => accessToken;
3532
- }
3533
- return;
3534
- }
3535
- get headers() {
3536
- return this.configuration.headers;
3537
- }
3538
- get credentials() {
3539
- return this.configuration.credentials;
3540
- }
3541
- }
3542
- var DefaultConfig2 = new Configuration2;
3543
-
3544
- class BaseAPI2 {
3545
- configuration;
3546
- static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
3547
- middleware;
3548
- constructor(configuration = DefaultConfig2) {
3549
- this.configuration = configuration;
3550
- this.middleware = configuration.middleware;
3551
- }
3552
- withMiddleware(...middlewares) {
3553
- const next = this.clone();
3554
- next.middleware = next.middleware.concat(...middlewares);
3555
- return next;
3556
- }
3557
- withPreMiddleware(...preMiddlewares) {
3558
- const middlewares = preMiddlewares.map((pre) => ({ pre }));
3559
- return this.withMiddleware(...middlewares);
3560
- }
3561
- withPostMiddleware(...postMiddlewares) {
3562
- const middlewares = postMiddlewares.map((post) => ({ post }));
3563
- return this.withMiddleware(...middlewares);
3564
- }
3565
- isJsonMime(mime) {
3566
- if (!mime) {
3567
- return false;
3568
- }
3569
- return BaseAPI2.jsonRegex.test(mime);
3570
- }
3571
- async request(context, initOverrides) {
3572
- const { url, init } = await this.createFetchParams(context, initOverrides);
3573
- const response = await this.fetchApi(url, init);
3574
- if (response && (response.status >= 200 && response.status < 300)) {
3575
- return response;
3576
- }
3577
- throw new ResponseError2(response, "Response returned an error code");
3578
- }
3579
- async createFetchParams(context, initOverrides) {
3580
- let url = this.configuration.basePath + context.path;
3581
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
3582
- url += "?" + this.configuration.queryParamsStringify(context.query);
3583
- }
3584
- const headers = Object.assign({}, this.configuration.headers, context.headers);
3585
- Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
3586
- const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
3587
- const initParams = {
3588
- method: context.method,
3589
- headers,
3590
- body: context.body,
3591
- credentials: this.configuration.credentials
3592
- };
3593
- const overriddenInit = {
3594
- ...initParams,
3595
- ...await initOverrideFn({
3596
- init: initParams,
3597
- context
3598
- })
3599
- };
3600
- let body;
3601
- if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
3602
- body = overriddenInit.body;
3603
- } else if (this.isJsonMime(headers["Content-Type"])) {
3604
- body = JSON.stringify(overriddenInit.body);
3605
- } else {
3606
- body = overriddenInit.body;
3607
- }
3608
- const init = {
3609
- ...overriddenInit,
3610
- body
3611
- };
3612
- return { url, init };
3613
- }
3614
- fetchApi = async (url, init) => {
3615
- let fetchParams = { url, init };
3616
- for (const middleware of this.middleware) {
3617
- if (middleware.pre) {
3618
- fetchParams = await middleware.pre({
3619
- fetch: this.fetchApi,
3620
- ...fetchParams
3621
- }) || fetchParams;
3622
- }
3623
- }
3624
- let response = undefined;
3625
- try {
3626
- response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
3627
- } catch (e) {
3628
- for (const middleware of this.middleware) {
3629
- if (middleware.onError) {
3630
- response = await middleware.onError({
3631
- fetch: this.fetchApi,
3632
- url: fetchParams.url,
3633
- init: fetchParams.init,
3634
- error: e,
3635
- response: response ? response.clone() : undefined
3636
- }) || response;
3637
- }
3638
- }
3639
- if (response === undefined) {
3640
- if (e instanceof Error) {
3641
- throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
3642
- } else {
3643
- throw e;
3644
- }
3645
- }
3646
- }
3647
- for (const middleware of this.middleware) {
3648
- if (middleware.post) {
3649
- response = await middleware.post({
3650
- fetch: this.fetchApi,
3651
- url: fetchParams.url,
3652
- init: fetchParams.init,
3653
- response: response.clone()
3654
- }) || response;
3655
- }
3656
- }
3657
- return response;
2903
+ }
2904
+ };
2905
+
2906
+ // ../solution-sdk/src/user-agent.ts
2907
+ var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
2908
+ installSdkUserAgentHeader(BaseAPI2, SDK_USER_AGENT);
2909
+
2910
+ // ../solution-sdk/src/upload-service.ts
2911
+ class SolutionUploadHttpError extends Error {
2912
+ status;
2913
+ operation;
2914
+ method;
2915
+ endpoint;
2916
+ url;
2917
+ body;
2918
+ solutionId;
2919
+ parsedErrorCode;
2920
+ parsedErrorMessage;
2921
+ constructor(details) {
2922
+ super(details.message);
2923
+ this.name = "SolutionUploadHttpError";
2924
+ this.status = details.status;
2925
+ this.operation = details.operation;
2926
+ this.method = details.method;
2927
+ this.endpoint = details.endpoint;
2928
+ this.url = details.url;
2929
+ this.body = details.body;
2930
+ if (details.operation === "overwrite") {
2931
+ this.solutionId = details.solutionId;
2932
+ }
2933
+ const parsed = parseUploadErrorBody(details.body);
2934
+ this.parsedErrorCode = parsed.code;
2935
+ this.parsedErrorMessage = parsed.message;
2936
+ }
2937
+ }
2938
+ function parseUploadErrorBody(body) {
2939
+ const [, parsed] = catchError(() => JSON.parse(body));
2940
+ if (!parsed || typeof parsed !== "object")
2941
+ return {};
2942
+ const rawCode = parsed.code ?? parsed.Code;
2943
+ const rawMessage = parsed.message ?? parsed.Message;
2944
+ return {
2945
+ code: typeof rawCode === "string" || typeof rawCode === "number" ? String(rawCode) : undefined,
2946
+ message: typeof rawMessage === "string" && rawMessage.trim() ? rawMessage : undefined
3658
2947
  };
3659
- clone() {
3660
- const constructor = this.constructor;
3661
- const next = new constructor(this.configuration);
3662
- next.middleware = this.middleware.slice();
3663
- return next;
2948
+ }
2949
+ function isSolutionUploadHttpError(error) {
2950
+ return error instanceof Error && error.name === "SolutionUploadHttpError" && "operation" in error && (error.operation === "import" || error.operation === "overwrite") && "status" in error && typeof error.status === "number" && "body" in error && typeof error.body === "string";
2951
+ }
2952
+ function requestPath(url) {
2953
+ const [, parsed] = catchError(() => new URL(url));
2954
+ return parsed ? `${parsed.pathname}${parsed.search}` : url;
2955
+ }
2956
+ function buildSolutionUploadFailureOutput(err, options = {}) {
2957
+ const stage = err.operation === "overwrite" ? "overwrite-solution" : "import-solution";
2958
+ const detail = err.parsedErrorMessage ? ` — ${err.parsedErrorMessage}` : "";
2959
+ const Message = `Failed during ${stage}: HTTP ${err.status} on ${err.method} ` + `${err.endpoint}${detail}`;
2960
+ const body = err.parsedErrorMessage ? "" : summarizePlatformBody(err.body);
2961
+ const bodySuffix = body ? ` Platform response: "${body}".` : "";
2962
+ const importHint = options.importCheckHint ? ` ${options.importCheckHint}` : "";
2963
+ const subject = options.subject ?? "project";
2964
+ const target = err.solutionId ?? `the solution at ${err.endpoint}`;
2965
+ const Instructions = err.operation === "overwrite" ? `Studio Web refused to replace the contents of solution ` + `${target}. Nothing was uploaded and nothing ran, so the ` + `${subject} is not the cause: do not re-author it, and do not ` + `copy the project into another solution. Confirm that ${target} ` + `is a solution you can still write to, and that it is the one ` + `this project should publish to — it comes from the SolutionId ` + `recorded in the enclosing solution file. If it is right, report ` + `the platform response.${bodySuffix}` : `Studio Web refused to import the solution package. Nothing was ` + `uploaded and nothing ran, so no part of the ${subject} executed ` + `— but the package itself may be what was rejected.${importHint} ` + `Report the platform response if the ${subject} is ` + `well-formed.${bodySuffix}`;
2966
+ const Context = {
2967
+ httpStatus: err.status,
2968
+ stage,
2969
+ endpoint: err.endpoint,
2970
+ method: err.method
2971
+ };
2972
+ if (err.parsedErrorCode !== undefined) {
2973
+ Context.errorCode = err.parsedErrorCode;
2974
+ }
2975
+ const output = {
2976
+ Result: RESULTS.Failure,
2977
+ Message,
2978
+ Instructions,
2979
+ Context
2980
+ };
2981
+ if (err.operation === "overwrite" && err.status >= 500 && err.status < 600) {
2982
+ output.Retry = "RetryAfter30Seconds";
3664
2983
  }
2984
+ return output;
3665
2985
  }
3666
- function isBlob2(value) {
3667
- return typeof Blob !== "undefined" && value instanceof Blob;
2986
+ var DEFAULT_UPLOAD_TIMEOUT_MS = 120000;
2987
+ function resolveUploadTimeoutMs() {
2988
+ const raw = Number(process.env?.UIPATH_SOLUTION_UPLOAD_TIMEOUT_MS);
2989
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_UPLOAD_TIMEOUT_MS;
3668
2990
  }
3669
- function isFormData2(value) {
3670
- return typeof FormData !== "undefined" && value instanceof FormData;
2991
+ function formatTimeout(timeoutMs) {
2992
+ return timeoutMs < 1000 ? `${Math.round(timeoutMs)}ms` : `${Math.round(timeoutMs / 1000)}s`;
3671
2993
  }
3672
-
3673
- class ResponseError2 extends Error {
3674
- response;
3675
- name = "ResponseError";
3676
- constructor(response, msg) {
3677
- super(msg);
3678
- this.response = response;
2994
+ function timeoutMessage(what, timeoutMs) {
2995
+ return `${what} timed out after ${formatTimeout(timeoutMs)} — the connection ` + `stalled with no response from Studio Web. Retry the command; if it keeps ` + `timing out, check connectivity (VPN/proxy) to the tenant, or raise the ` + `ceiling with UIPATH_SOLUTION_UPLOAD_TIMEOUT_MS.`;
2996
+ }
2997
+ function isTimeoutError(error) {
2998
+ let current = error;
2999
+ for (let depth = 0;depth < 5 && current instanceof Error; depth += 1) {
3000
+ if (current.name === "TimeoutError")
3001
+ return true;
3002
+ current = current.cause;
3679
3003
  }
3004
+ return false;
3680
3005
  }
3681
-
3682
- class FetchError2 extends Error {
3683
- cause;
3684
- name = "FetchError";
3685
- constructor(cause, msg) {
3686
- super(msg);
3687
- this.cause = cause;
3006
+ async function fetchWithUploadTimeout(url, init, what) {
3007
+ const timeoutMs = resolveUploadTimeoutMs();
3008
+ const [error, response] = await catchError(fetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) }));
3009
+ if (error) {
3010
+ if (isTimeoutError(error)) {
3011
+ throw new Error(timeoutMessage(what, timeoutMs));
3012
+ }
3013
+ throw error;
3688
3014
  }
3015
+ return response;
3689
3016
  }
3690
- function querystring2(params, prefix = "") {
3691
- return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
3017
+ async function importSolution(config, organizationName, fileBuffer, fileName) {
3018
+ const importUrl = `${config.baseUrl}/${encodeURIComponent(organizationName)}/studio_/backend/api/Solution/Import?desktopJit=true&useFileRest=true&enableUnifiedBuild=true`;
3019
+ const formData = new FormData;
3020
+ const fileBlob = new Blob([fileBuffer], {
3021
+ type: "application/octet-stream"
3022
+ });
3023
+ formData.append("uploadFile", fileBlob, fileName);
3024
+ formData.append("telemetryData", JSON.stringify({ FirstRun: false }));
3025
+ const headers = addSdkUserAgentHeader({
3026
+ Authorization: `Bearer ${config.authToken}`
3027
+ }, SDK_USER_AGENT);
3028
+ if (config.tenantId) {
3029
+ headers["x-uipath-tenantid"] = config.tenantId;
3030
+ }
3031
+ const response = await fetchWithUploadTimeout(importUrl, { method: "POST", headers, body: formData }, "Studio Web solution import");
3032
+ if (!response.ok) {
3033
+ const text = await response.text().catch(() => "");
3034
+ throw new SolutionUploadHttpError({
3035
+ operation: "import",
3036
+ status: response.status,
3037
+ method: "POST",
3038
+ endpoint: requestPath(importUrl),
3039
+ url: importUrl,
3040
+ body: text,
3041
+ message: `Import failed (${response.status}): ${text}`
3042
+ });
3043
+ }
3044
+ return await response.json();
3692
3045
  }
3693
- function querystringSingleKey2(key, value, keyPrefix = "") {
3694
- const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
3695
- if (value instanceof Array) {
3696
- const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
3697
- return `${encodeURIComponent(fullKey)}=${multiValue}`;
3046
+ async function overwriteSolution(config, organizationName, fileBuffer, fileName, solutionId, createSnapshot = false) {
3047
+ const overwriteUrl = `${config.baseUrl}/${encodeURIComponent(organizationName)}/studio_/backend/api/Solution/${encodeURIComponent(solutionId)}/Overwrite`;
3048
+ const formData = new FormData;
3049
+ const fileBlob = new Blob([fileBuffer], {
3050
+ type: "application/octet-stream"
3051
+ });
3052
+ formData.append("UploadFile", fileBlob, fileName);
3053
+ if (createSnapshot) {
3054
+ formData.append("createSnapshot", "true");
3698
3055
  }
3699
- if (value instanceof Set) {
3700
- const valueAsArray = Array.from(value);
3701
- return querystringSingleKey2(key, valueAsArray, keyPrefix);
3056
+ const headers = addSdkUserAgentHeader({
3057
+ Authorization: `Bearer ${config.authToken}`
3058
+ }, SDK_USER_AGENT);
3059
+ if (config.tenantId) {
3060
+ headers["x-uipath-tenantid"] = config.tenantId;
3702
3061
  }
3703
- if (value instanceof Date) {
3704
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
3062
+ const response = await fetchWithUploadTimeout(overwriteUrl, { method: "POST", headers, body: formData }, "Studio Web solution overwrite");
3063
+ if (!response.ok) {
3064
+ const text = await response.text().catch(() => "");
3065
+ throw new SolutionUploadHttpError({
3066
+ operation: "overwrite",
3067
+ status: response.status,
3068
+ method: "POST",
3069
+ endpoint: requestPath(overwriteUrl),
3070
+ url: overwriteUrl,
3071
+ body: text,
3072
+ message: `Overwrite failed (${response.status}): ${text}`,
3073
+ solutionId
3074
+ });
3705
3075
  }
3706
- if (value instanceof Object) {
3707
- return querystring2(value, fullKey);
3076
+ return await response.json();
3077
+ }
3078
+ async function uploadOrOverwriteSolution(config, organizationName, fileBufferOrPath, solutionId, fs) {
3079
+ let fileBuffer;
3080
+ let fileName;
3081
+ if (typeof fileBufferOrPath === "string") {
3082
+ if (!fs) {
3083
+ throw new Error("IFileSystem is required when passing a file path to uploadOrOverwriteSolution");
3084
+ }
3085
+ const content = await fs.readFile(fileBufferOrPath);
3086
+ if (content === null) {
3087
+ throw new Error(`Failed to read file: ${fileBufferOrPath}`);
3088
+ }
3089
+ fileBuffer = new Uint8Array(content);
3090
+ fileName = fs.path.basename(fileBufferOrPath);
3091
+ } else {
3092
+ fileBuffer = fileBufferOrPath;
3093
+ fileName = "solution.uis";
3708
3094
  }
3709
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
3095
+ if (solutionId) {
3096
+ logger.info(`Attempting to overwrite existing solution ${solutionId} on Studio Web...`);
3097
+ const [overwriteError, overwriteResult] = await catchError(overwriteSolution(config, organizationName, fileBuffer, fileName, solutionId));
3098
+ if (!overwriteError) {
3099
+ logger.info("Solution overwritten successfully.");
3100
+ return overwriteResult;
3101
+ }
3102
+ if (isSolutionUploadHttpError(overwriteError) && overwriteError.status === 404) {
3103
+ logger.info(`Solution ${solutionId} not found on Studio Web. Importing as new solution...`);
3104
+ } else {
3105
+ throw overwriteError;
3106
+ }
3107
+ }
3108
+ logger.info("Importing new solution to Studio Web...");
3109
+ return importSolution(config, organizationName, fileBuffer, fileName);
3710
3110
  }
3711
3111
  // ../solution-sdk/src/zip-utils.ts
3712
3112
  var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
3713
3113
  ".venv",
3714
3114
  "node_modules",
3715
3115
  "__pycache__",
3716
- ".git"
3116
+ ".git",
3117
+ ".local"
3717
3118
  ]);
3718
3119
  var DEFAULT_EXCLUDED_FILE_PATTERNS = [
3719
3120
  /^\.env($|\..+)/
@@ -3794,7 +3195,76 @@ async function createZipFromDir(fs, dir, options = {}) {
3794
3195
  }
3795
3196
  zippable[`${relPath}/`] = new Uint8Array(0);
3796
3197
  }
3797
- return zipSync(zippable, { level: 6 });
3198
+ return finalizeZip64(zipSync(zippable, { level: 6 }));
3199
+ }
3200
+ var EOCD_SIZE = 22;
3201
+ var EOCD_SIGNATURE = 101010256;
3202
+ var CD_HEADER_SIGNATURE = 33639248;
3203
+ var ZIP64_EOCD_SIGNATURE = 101075792;
3204
+ var ZIP64_EOCD_SIZE = 56;
3205
+ var ZIP64_LOCATOR_SIGNATURE = 117853008;
3206
+ var ZIP64_LOCATOR_SIZE = 20;
3207
+ var MAX_ZIP32_ENTRIES = 65535;
3208
+ var MAX_ZIP32_OFFSET = 4294967295;
3209
+ function finalizeZip64(zip) {
3210
+ const view = new DataView(zip.buffer, zip.byteOffset, zip.byteLength);
3211
+ const eocdStart = zip.byteLength - EOCD_SIZE;
3212
+ if (eocdStart < 0 || view.getUint32(eocdStart, true) !== EOCD_SIGNATURE) {
3213
+ throw new Error("Cannot finalize the solution archive: it does not end with an end-of-central-directory record.");
3214
+ }
3215
+ const cdSize = view.getUint32(eocdStart + 12, true);
3216
+ const cdOffset = view.getUint32(eocdStart + 16, true);
3217
+ const entryCount = countCentralDirectoryEntries(view, cdOffset, cdSize);
3218
+ if (entryCount <= MAX_ZIP32_ENTRIES) {
3219
+ return zip;
3220
+ }
3221
+ if (cdOffset >= MAX_ZIP32_OFFSET || zip.byteLength >= MAX_ZIP32_OFFSET) {
3222
+ throw new Error(`The solution archive is ${zip.byteLength} bytes, past the 4 GB limit this packer supports. Exclude large directories from the solution with a .uipignore file.`);
3223
+ }
3224
+ const tail = new Uint8Array(ZIP64_EOCD_SIZE + ZIP64_LOCATOR_SIZE + EOCD_SIZE);
3225
+ const tailView = new DataView(tail.buffer);
3226
+ const count = BigInt(entryCount);
3227
+ tailView.setUint32(0, ZIP64_EOCD_SIGNATURE, true);
3228
+ tailView.setBigUint64(4, BigInt(ZIP64_EOCD_SIZE - 12), true);
3229
+ tailView.setUint16(12, 45, true);
3230
+ tailView.setUint16(14, 45, true);
3231
+ tailView.setUint32(16, 0, true);
3232
+ tailView.setUint32(20, 0, true);
3233
+ tailView.setBigUint64(24, count, true);
3234
+ tailView.setBigUint64(32, count, true);
3235
+ tailView.setBigUint64(40, BigInt(cdSize), true);
3236
+ tailView.setBigUint64(48, BigInt(cdOffset), true);
3237
+ const locator = ZIP64_EOCD_SIZE;
3238
+ tailView.setUint32(locator, ZIP64_LOCATOR_SIGNATURE, true);
3239
+ tailView.setUint32(locator + 4, 0, true);
3240
+ tailView.setBigUint64(locator + 8, BigInt(eocdStart), true);
3241
+ tailView.setUint32(locator + 16, 1, true);
3242
+ const eocd = ZIP64_EOCD_SIZE + ZIP64_LOCATOR_SIZE;
3243
+ tailView.setUint32(eocd, EOCD_SIGNATURE, true);
3244
+ tailView.setUint16(eocd + 4, 0, true);
3245
+ tailView.setUint16(eocd + 6, 0, true);
3246
+ tailView.setUint16(eocd + 8, MAX_ZIP32_ENTRIES, true);
3247
+ tailView.setUint16(eocd + 10, MAX_ZIP32_ENTRIES, true);
3248
+ tailView.setUint32(eocd + 12, cdSize, true);
3249
+ tailView.setUint32(eocd + 16, cdOffset, true);
3250
+ tailView.setUint16(eocd + 20, 0, true);
3251
+ const out = new Uint8Array(eocdStart + tail.byteLength);
3252
+ out.set(zip.subarray(0, eocdStart), 0);
3253
+ out.set(tail, eocdStart);
3254
+ return out;
3255
+ }
3256
+ function countCentralDirectoryEntries(view, cdOffset, cdSize) {
3257
+ const end = cdOffset + cdSize;
3258
+ let position = cdOffset;
3259
+ let count = 0;
3260
+ while (position + 46 <= end && view.getUint32(position, true) === CD_HEADER_SIGNATURE) {
3261
+ const nameLength = view.getUint16(position + 28, true);
3262
+ const extraLength = view.getUint16(position + 30, true);
3263
+ const commentLength = view.getUint16(position + 32, true);
3264
+ position += 46 + nameLength + extraLength + commentLength;
3265
+ count++;
3266
+ }
3267
+ return count;
3798
3268
  }
3799
3269
 
3800
3270
  // ../solution-sdk/src/bundle-service.ts
@@ -3912,6 +3382,7 @@ async function bundleSolution(fs, solutionDir, outputDir, outputName) {
3912
3382
  for (const project of uipx.Projects) {
3913
3383
  project.ProjectRelativePath = toForwardSlash(project.ProjectRelativePath);
3914
3384
  }
3385
+ assertStudioWebCompatibleProjects(uipx.Projects);
3915
3386
  const solutionStorage = {
3916
3387
  SolutionId: uipx.SolutionId,
3917
3388
  Projects: uipx.Projects.map((p) => ({
@@ -3968,119 +3439,214 @@ async function bundleSolution(fs, solutionDir, outputDir, outputName) {
3968
3439
  // ../solution-sdk/src/project-debug-status.ts
3969
3440
  var SUCCEEDED = "creationsucceeded";
3970
3441
  var TERMINAL = new Set([SUCCEEDED, "creationfailed", "validationfailed"]);
3971
- // ../solution-sdk/src/upload-service.ts
3972
- class HttpError extends Error {
3973
- status;
3974
- constructor(status, message) {
3975
- super(message);
3976
- this.status = status;
3442
+ // src/services/agent-debug-service.ts
3443
+ import { randomUUID } from "node:crypto";
3444
+
3445
+ // src/services/agent-builder-migrations.ts
3446
+ var warnedLegacyToolGuardrailPolicies = false;
3447
+ function migrateLegacyToolGuardrailPolicies(builder) {
3448
+ let migrated = false;
3449
+ for (const resource of builder.resources ?? []) {
3450
+ if (resource.$resourceType !== "tool" || !Array.isArray(resource.guardrailPolicies)) {
3451
+ continue;
3452
+ }
3453
+ if (!resource.guardrail?.policies?.length) {
3454
+ resource.guardrail = { policies: resource.guardrailPolicies };
3455
+ migrated = true;
3456
+ }
3457
+ delete resource.guardrailPolicies;
3977
3458
  }
3978
- }
3979
- var DEFAULT_UPLOAD_TIMEOUT_MS = 120000;
3980
- function resolveUploadTimeoutMs() {
3981
- const raw = Number(process.env?.UIPATH_SOLUTION_UPLOAD_TIMEOUT_MS);
3982
- return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_UPLOAD_TIMEOUT_MS;
3983
- }
3984
- function formatTimeout(timeoutMs) {
3985
- return timeoutMs < 1000 ? `${Math.round(timeoutMs)}ms` : `${Math.round(timeoutMs / 1000)}s`;
3986
- }
3987
- function timeoutMessage(what, timeoutMs) {
3988
- return `${what} timed out after ${formatTimeout(timeoutMs)} — the connection ` + `stalled with no response from Studio Web. Retry the command; if it keeps ` + `timing out, check connectivity (VPN/proxy) to the tenant, or raise the ` + `ceiling with UIPATH_SOLUTION_UPLOAD_TIMEOUT_MS.`;
3989
- }
3990
- function isTimeoutError(error) {
3991
- let current = error;
3992
- for (let depth = 0;depth < 5 && current instanceof Error; depth += 1) {
3993
- if (current.name === "TimeoutError")
3994
- return true;
3995
- current = current.cause;
3459
+ if (migrated && !warnedLegacyToolGuardrailPolicies) {
3460
+ OutputFormatter.log({
3461
+ Warning: "Migrated legacy guardrailPolicies to guardrail.policies."
3462
+ });
3463
+ warnedLegacyToolGuardrailPolicies = true;
3996
3464
  }
3997
- return false;
3998
3465
  }
3999
- async function fetchWithUploadTimeout(url, init, what) {
4000
- const timeoutMs = resolveUploadTimeoutMs();
4001
- const [error, response] = await catchError(fetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) }));
4002
- if (error) {
4003
- if (isTimeoutError(error)) {
4004
- throw new Error(timeoutMessage(what, timeoutMs));
3466
+
3467
+ // src/services/agent-project-service.ts
3468
+ class AgentProjectService {
3469
+ fs = getFileSystem();
3470
+ resolvedAgentDirs = new Map;
3471
+ getAgentDir(projectPath) {
3472
+ const cached = this.resolvedAgentDirs.get(projectPath);
3473
+ if (cached) {
3474
+ return cached;
3475
+ }
3476
+ return projectPath;
3477
+ }
3478
+ async resolveAgentDir(projectPath) {
3479
+ const cached = this.resolvedAgentDirs.get(projectPath);
3480
+ if (cached) {
3481
+ return cached;
3482
+ }
3483
+ const flatAgent = this.fs.path.join(projectPath, "agent.json");
3484
+ if (await this.fs.stat(flatAgent)) {
3485
+ this.resolvedAgentDirs.set(projectPath, projectPath);
3486
+ return projectPath;
3487
+ }
3488
+ const entries = await this.fs.readdir(projectPath);
3489
+ for (const entry of entries) {
3490
+ if (entry.startsWith(".") || entry === "evals" || entry === "features" || entry === "resources" || entry === "userProfile") {
3491
+ continue;
3492
+ }
3493
+ const candidate = this.fs.path.join(projectPath, entry);
3494
+ const candidateStat = await this.fs.stat(candidate);
3495
+ if (!candidateStat?.isDirectory())
3496
+ continue;
3497
+ const agentStat = await this.fs.stat(this.fs.path.join(candidate, "agent.json"));
3498
+ if (agentStat) {
3499
+ this.resolvedAgentDirs.set(projectPath, candidate);
3500
+ return candidate;
3501
+ }
3502
+ }
3503
+ this.resolvedAgentDirs.set(projectPath, projectPath);
3504
+ return projectPath;
3505
+ }
3506
+ async readAgentJson(projectPath) {
3507
+ const agentDir = this.getAgentDir(projectPath);
3508
+ const raw = await this.fs.readFile(this.fs.path.join(agentDir, "agent.json"), "utf-8");
3509
+ return JSON.parse(raw);
3510
+ }
3511
+ async writeAgentJson(projectPath, agent) {
3512
+ const agentDir = this.getAgentDir(projectPath);
3513
+ await this.fs.writeFile(this.fs.path.join(agentDir, "agent.json"), `${JSON.stringify(agent, null, 2)}
3514
+ `);
3515
+ const builderDir = this.fs.path.join(agentDir, ".agent-builder");
3516
+ await this.safeMkdir(builderDir);
3517
+ let existingBuilder;
3518
+ const [builderReadError, builderRaw] = await catchError(this.fs.readFile(this.fs.path.join(builderDir, "agent.json"), "utf-8"));
3519
+ if (!builderReadError && builderRaw) {
3520
+ try {
3521
+ existingBuilder = JSON.parse(builderRaw);
3522
+ migrateLegacyToolGuardrailPolicies(existingBuilder);
3523
+ } catch {}
3524
+ }
3525
+ const builderAgent = {
3526
+ id: agent.projectId,
3527
+ name: existingBuilder?.name ?? "Agent",
3528
+ ...agent,
3529
+ resources: existingBuilder?.resources ?? agent.resources ?? [],
3530
+ features: existingBuilder?.features ?? agent.features ?? []
3531
+ };
3532
+ await this.fs.writeFile(this.fs.path.join(builderDir, "agent.json"), `${JSON.stringify(builderAgent, null, 2)}
3533
+ `);
3534
+ }
3535
+ async readSolutionStorage(projectPath) {
3536
+ const raw = await this.fs.readFile(this.fs.path.join(projectPath, "SolutionStorage.json"), "utf-8");
3537
+ return JSON.parse(raw);
3538
+ }
3539
+ async writeSolutionStorage(projectPath, storage) {
3540
+ await this.fs.writeFile(this.fs.path.join(projectPath, "SolutionStorage.json"), `${JSON.stringify(storage, null, 2)}
3541
+ `);
3542
+ }
3543
+ async readEvaluator(projectPath, fileName) {
3544
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators", fileName);
3545
+ const raw = await this.fs.readFile(filePath, "utf-8");
3546
+ return JSON.parse(raw);
3547
+ }
3548
+ async writeEvaluator(projectPath, evaluator) {
3549
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators");
3550
+ await this.safeMkdir(dir);
3551
+ await this.fs.writeFile(this.fs.path.join(dir, evaluator.fileName), `${JSON.stringify(evaluator, null, 2)}
3552
+ `);
3553
+ }
3554
+ async listEvaluators(projectPath) {
3555
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators");
3556
+ const [error, files] = await catchError(this.fs.readdir(dir));
3557
+ if (error) {
3558
+ return [];
4005
3559
  }
4006
- throw error;
3560
+ const evaluators = [];
3561
+ for (const file of files) {
3562
+ if (file.endsWith(".json")) {
3563
+ const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
3564
+ evaluators.push(JSON.parse(raw));
3565
+ }
3566
+ }
3567
+ return evaluators;
4007
3568
  }
4008
- return response;
4009
- }
4010
- async function importSolution(config, organizationName, fileBuffer, fileName) {
4011
- const importUrl = `${config.baseUrl}/${organizationName}/studio_/backend/api/Solution/Import?desktopJit=true&useFileRest=true&enableUnifiedBuild=true`;
4012
- const formData = new FormData;
4013
- const fileBlob = new Blob([fileBuffer], {
4014
- type: "application/octet-stream"
4015
- });
4016
- formData.append("uploadFile", fileBlob, fileName);
4017
- formData.append("telemetryData", JSON.stringify({ FirstRun: false }));
4018
- const headers = addSdkUserAgentHeader({
4019
- Authorization: `Bearer ${config.authToken}`
4020
- }, SDK_USER_AGENT);
4021
- if (config.tenantId) {
4022
- headers["x-uipath-tenantid"] = config.tenantId;
3569
+ async deleteEvaluator(projectPath, fileName) {
3570
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators", fileName);
3571
+ await this.fs.rm(filePath);
4023
3572
  }
4024
- const response = await fetchWithUploadTimeout(importUrl, { method: "POST", headers, body: formData }, "Studio Web solution import");
4025
- if (!response.ok) {
4026
- const text = await response.text();
4027
- throw new HttpError(response.status, `Import failed (${response.status}): ${text}`);
3573
+ async readEvalSet(projectPath, fileName) {
3574
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets", fileName);
3575
+ const raw = await this.fs.readFile(filePath, "utf-8");
3576
+ return JSON.parse(raw);
4028
3577
  }
4029
- return await response.json();
4030
- }
4031
- async function overwriteSolution(config, organizationName, fileBuffer, fileName, solutionId) {
4032
- const overwriteUrl = `${config.baseUrl}/${organizationName}/studio_/backend/api/Solution/${solutionId}/Overwrite`;
4033
- const formData = new FormData;
4034
- const fileBlob = new Blob([fileBuffer], {
4035
- type: "application/octet-stream"
4036
- });
4037
- formData.append("UploadFile", fileBlob, fileName);
4038
- const headers = addSdkUserAgentHeader({
4039
- Authorization: `Bearer ${config.authToken}`
4040
- }, SDK_USER_AGENT);
4041
- if (config.tenantId) {
4042
- headers["x-uipath-tenantid"] = config.tenantId;
3578
+ async writeEvalSet(projectPath, evalSet, fileName) {
3579
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets");
3580
+ await this.safeMkdir(dir);
3581
+ await this.fs.writeFile(this.fs.path.join(dir, fileName), `${JSON.stringify(evalSet, null, 2)}
3582
+ `);
4043
3583
  }
4044
- const response = await fetchWithUploadTimeout(overwriteUrl, { method: "POST", headers, body: formData }, "Studio Web solution overwrite");
4045
- if (!response.ok) {
4046
- const text = await response.text();
4047
- throw new HttpError(response.status, `Overwrite failed (${response.status}): ${text}`);
3584
+ async listEvalSets(projectPath) {
3585
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets");
3586
+ const [error, files] = await catchError(this.fs.readdir(dir));
3587
+ if (error) {
3588
+ return [];
3589
+ }
3590
+ const sets = [];
3591
+ for (const file of files) {
3592
+ if (file.endsWith(".json")) {
3593
+ const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
3594
+ sets.push(JSON.parse(raw));
3595
+ }
3596
+ }
3597
+ return sets;
4048
3598
  }
4049
- return await response.json();
4050
- }
4051
- async function uploadOrOverwriteSolution(config, organizationName, fileBufferOrPath, solutionId, fs) {
4052
- let fileBuffer;
4053
- let fileName;
4054
- if (typeof fileBufferOrPath === "string") {
4055
- if (!fs) {
4056
- throw new Error("IFileSystem is required when passing a file path to uploadOrOverwriteSolution");
3599
+ async deleteEvalSet(projectPath, fileName) {
3600
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets", fileName);
3601
+ await this.fs.rm(filePath);
3602
+ }
3603
+ async writeFeature(projectPath, featureName, feature) {
3604
+ this.validateFeatureName(featureName);
3605
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName);
3606
+ await this.safeMkdir(dir);
3607
+ await this.fs.writeFile(this.fs.path.join(dir, "feature.json"), `${JSON.stringify(feature, null, 2)}
3608
+ `);
3609
+ }
3610
+ async readFeature(projectPath, featureName) {
3611
+ this.validateFeatureName(featureName);
3612
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName, "feature.json");
3613
+ const raw = await this.fs.readFile(filePath, "utf-8");
3614
+ if (!raw) {
3615
+ throw new Error(`Feature file not found: ${filePath}`);
4057
3616
  }
4058
- const content = await fs.readFile(fileBufferOrPath);
4059
- if (content === null) {
4060
- throw new Error(`Failed to read file: ${fileBufferOrPath}`);
3617
+ const parsed = JSON.parse(raw);
3618
+ if (!parsed) {
3619
+ throw new Error(`Feature file is empty: ${filePath}`);
4061
3620
  }
4062
- fileBuffer = new Uint8Array(content);
4063
- fileName = fs.path.basename(fileBufferOrPath);
4064
- } else {
4065
- fileBuffer = fileBufferOrPath;
4066
- fileName = "solution.uis";
3621
+ return parsed;
4067
3622
  }
4068
- if (solutionId) {
4069
- logger.info(`Attempting to overwrite existing solution ${solutionId} on Studio Web...`);
4070
- const [overwriteError, overwriteResult] = await catchError(overwriteSolution(config, organizationName, fileBuffer, fileName, solutionId));
4071
- if (!overwriteError) {
4072
- logger.info("Solution overwritten successfully.");
4073
- return overwriteResult;
3623
+ async listFeatureDirs(projectPath) {
3624
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "features");
3625
+ const [error, entries] = await catchError(this.fs.readdir(dir));
3626
+ if (error) {
3627
+ return [];
4074
3628
  }
4075
- if (overwriteError instanceof HttpError && overwriteError.status === 404) {
4076
- logger.info(`Solution ${solutionId} not found on Studio Web. Importing as new solution...`);
4077
- } else {
4078
- throw overwriteError;
3629
+ return entries;
3630
+ }
3631
+ async deleteFeature(projectPath, featureName) {
3632
+ this.validateFeatureName(featureName);
3633
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName);
3634
+ await this.fs.rm(dir);
3635
+ }
3636
+ async safeMkdir(dir) {
3637
+ await this.fs.mkdir(dir);
3638
+ }
3639
+ async writeJsonFile(filePath, data) {
3640
+ await this.fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
3641
+ `);
3642
+ }
3643
+ validateFeatureName(featureName) {
3644
+ if (featureName.trim().length === 0 || featureName === "." || featureName === ".." || featureName.includes("/") || featureName.includes("\\") || featureName.includes("\x00") || featureName !== this.fs.path.basename(featureName)) {
3645
+ throw new Error(`Invalid feature name: "${featureName}"`);
4079
3646
  }
4080
3647
  }
4081
- logger.info("Importing new solution to Studio Web...");
4082
- return importSolution(config, organizationName, fileBuffer, fileName);
4083
3648
  }
3649
+
4084
3650
  // src/services/pack-helpers.ts
4085
3651
  var import_adm_zip = __toESM(require_adm_zip(), 1);
4086
3652
  async function collectProjectFiles(rootDir) {
@@ -4130,13 +3696,6 @@ async function createArchive(sourceDir, outputPath, exclude) {
4130
3696
  }
4131
3697
  zip.writeZip(outputPath);
4132
3698
  }
4133
- async function extractArchive(archivePath, destDir) {
4134
- const zip = new import_adm_zip.default(archivePath);
4135
- zip.extractAllTo(destDir, true);
4136
- }
4137
-
4138
- // src/services/agent-debug-service.ts
4139
- import { randomUUID } from "node:crypto";
4140
3699
 
4141
3700
  // src/services/agent-local-workspace-eval-preparer.ts
4142
3701
  var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
@@ -4487,6 +4046,6 @@ function parseOutput(outputArguments) {
4487
4046
  return error ? outputArguments : parsed;
4488
4047
  }
4489
4048
 
4490
- export { Configuration, ConfigurationsApi, DeploymentsApi, PackagesApi, createArchive, extractArchive, resolveStudioWebConfig, AgentLocalWorkspaceEvalPreparer, AgentDebugCancelledError, AgentDebugService };
4049
+ export { StudioWebIncompatibleProjectError, isSolutionUploadHttpError, buildSolutionUploadFailureOutput, migrateLegacyToolGuardrailPolicies, AgentProjectService, resolveStudioWebConfig, AgentLocalWorkspaceEvalPreparer, AgentDebugCancelledError, AgentDebugService };
4491
4050
 
4492
- //# debugId=55FCEF59BA2E4A8864756E2164756E21
4051
+ //# debugId=4327A7CD95EEE18564756E2164756E21