@uipath/agent-tool 1.201.0 → 1.202.0-preview.136

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-vhhz1bs5.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-87cdx6bm.js} +27 -19
  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-tq9q9m77.js → packager-tool-a42jnpy5.js} +3 -9
  18. package/dist/{packager-tool-kwp8tznh.js → packager-tool-g8yfc7ef.js} +9227 -6826
  19. package/dist/{packager-tool-1zt6rezn.js → packager-tool-hwy2sxr3.js} +858 -1171
  20. package/dist/{packager-tool-v02mthyt.js → packager-tool-vkv0j95b.js} +637 -637
  21. package/dist/packager-tool-y80gnt72.js +9753 -0
  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-k00qjyec.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-a1hbz77f.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-8xv16pb3.js +0 -20663
  48. package/dist/packager-tool-bpegrcj1.js +0 -5336
  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-y80gnt72.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)",
@@ -161,6 +153,7 @@ var require_errors = __commonJS((exports) => {
161
153
  DESCRIPTOR_FAULTY: "Descriptor data is malformed",
162
154
  NO_DATA: "Nothing to decompress",
163
155
  BAD_CRC: "CRC32 checksum failed {0}",
156
+ MAX_OUTPUT_EXCEEDED: "Decompressed data exceeds the declared uncompressed size",
164
157
  FILE_IN_THE_WAY: "There is a file in the way: {0}",
165
158
  UNKNOWN_METHOD: "Invalid/unsupported compression method",
166
159
  AVAIL_DATA: "inflate::Available inflate data did not terminate",
@@ -178,11 +171,13 @@ var require_errors = __commonJS((exports) => {
178
171
  DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
179
172
  NO_ZIP: "No zip file was loaded",
180
173
  NO_ENTRY: "Entry doesn't exist",
174
+ DUPLICATE_ENTRY: "Duplicate entry name {0}",
181
175
  DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
182
176
  FILE_NOT_FOUND: 'File not found: "{0}"',
183
177
  NOT_IMPLEMENTED: "Not implemented",
184
178
  INVALID_FILENAME: "Invalid filename",
185
179
  INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
180
+ ZIP64_VALUE_TOO_LARGE: "Zip64 value exceeds the maximum safe integer",
186
181
  INVALID_PASS_PARAM: "Incompatible password parameter",
187
182
  WRONG_PASSWORD: "Wrong Password",
188
183
  COMMENT_TOO_LONG: "Comment is too long",
@@ -202,7 +197,7 @@ var require_errors = __commonJS((exports) => {
202
197
  });
203
198
 
204
199
  // ../../node_modules/adm-zip/util/utils.js
205
- var require_utils = __commonJS((exports, module) => {
200
+ var require_utils = __commonJS(function(exports, module) {
206
201
  var fsystem = __require("fs");
207
202
  var pth = __require("path");
208
203
  var Constants = require_constants();
@@ -336,8 +331,49 @@ var require_utils = __commonJS((exports, module) => {
336
331
  });
337
332
  });
338
333
  };
334
+ Utils.prototype.assertPathSafe = function(root, target) {
335
+ const self = this;
336
+ if (typeof self.fs.lstatSync !== "function")
337
+ return;
338
+ const resolvedRoot = pth.resolve(root);
339
+ const resolvedTarget = pth.resolve(target);
340
+ if (resolvedTarget === resolvedRoot)
341
+ return;
342
+ const rel = pth.relative(resolvedRoot, resolvedTarget);
343
+ if (!rel || rel === ".." || rel.startsWith(".." + pth.sep) || pth.isAbsolute(rel))
344
+ return;
345
+ let cur = resolvedRoot;
346
+ for (const part of rel.split(pth.sep)) {
347
+ if (!part || part === ".")
348
+ continue;
349
+ cur = pth.join(cur, part);
350
+ let stat;
351
+ try {
352
+ stat = self.fs.lstatSync(cur);
353
+ } catch (e) {
354
+ break;
355
+ }
356
+ if (stat.isSymbolicLink())
357
+ throw Errors.FILE_IN_THE_WAY(`"${cur}"`);
358
+ }
359
+ };
339
360
  Utils.prototype.findFiles = function(path) {
340
361
  const self = this;
362
+ const canLstat = typeof self.fs.lstatSync === "function";
363
+ const rootReal = self.fs.realpathSync(path);
364
+ function escapesRoot(p) {
365
+ if (!canLstat)
366
+ return false;
367
+ if (!self.fs.lstatSync(p).isSymbolicLink())
368
+ return false;
369
+ let real;
370
+ try {
371
+ real = self.fs.realpathSync(p);
372
+ } catch (e) {
373
+ return true;
374
+ }
375
+ return !(real === rootReal || real.startsWith(rootReal + pth.sep));
376
+ }
341
377
  function findSync(dir, pattern, recursive, visited) {
342
378
  if (typeof pattern === "boolean") {
343
379
  recursive = pattern;
@@ -346,6 +382,8 @@ var require_utils = __commonJS((exports, module) => {
346
382
  let files = [];
347
383
  self.fs.readdirSync(dir).forEach(function(file) {
348
384
  const path2 = pth.join(dir, file);
385
+ if (escapesRoot(path2))
386
+ return;
349
387
  const stat = self.fs.statSync(path2);
350
388
  if (!pattern || pattern.test(path2)) {
351
389
  files.push(pth.normalize(path2) + (stat.isDirectory() ? self.sep : ""));
@@ -360,7 +398,7 @@ var require_utils = __commonJS((exports, module) => {
360
398
  });
361
399
  return files;
362
400
  }
363
- return findSync(path, undefined, true, new Set([self.fs.realpathSync(path)]));
401
+ return findSync(path, undefined, true, new Set([rootReal]));
364
402
  };
365
403
  Utils.prototype.findFilesAsync = function(dir, cb) {
366
404
  const self = this;
@@ -372,6 +410,23 @@ var require_utils = __commonJS((exports, module) => {
372
410
  finished = true;
373
411
  cb(err, err ? undefined : results);
374
412
  };
413
+ const canLstat = typeof self.fs.lstat === "function";
414
+ let rootReal = null;
415
+ const escapesRoot = function(file, cb2) {
416
+ if (!canLstat)
417
+ return cb2(null, false);
418
+ self.fs.lstat(file, function(err, lst) {
419
+ if (err)
420
+ return cb2(err);
421
+ if (!lst || !lst.isSymbolicLink())
422
+ return cb2(null, false);
423
+ self.fs.realpath(file, function(err2, real) {
424
+ if (err2)
425
+ return cb2(null, true);
426
+ cb2(null, !(real === rootReal || real.startsWith(rootReal + pth.sep)));
427
+ });
428
+ });
429
+ };
375
430
  const walk = function(dir2, visited, done) {
376
431
  self.fs.readdir(dir2, function(err, list) {
377
432
  if (err)
@@ -381,34 +436,43 @@ var require_utils = __commonJS((exports, module) => {
381
436
  return done();
382
437
  list.forEach(function(name) {
383
438
  const file = pth.join(dir2, name);
384
- self.fs.stat(file, function(err2, stat) {
439
+ escapesRoot(file, function(err2, escapes) {
385
440
  if (err2)
386
441
  return done(err2);
387
- if (!stat) {
388
- if (!--pending)
389
- done();
390
- return;
391
- }
392
- results.push(pth.normalize(file) + (stat.isDirectory() ? self.sep : ""));
393
- if (!stat.isDirectory()) {
442
+ if (escapes) {
394
443
  if (!--pending)
395
444
  done();
396
445
  return;
397
446
  }
398
- self.fs.realpath(file, function(err3, realDir) {
447
+ self.fs.stat(file, function(err3, stat) {
399
448
  if (err3)
400
449
  return done(err3);
401
- if (visited.has(realDir)) {
450
+ if (!stat) {
402
451
  if (!--pending)
403
452
  done();
404
453
  return;
405
454
  }
406
- visited.add(realDir);
407
- walk(file, visited, function(err4) {
408
- if (err4)
409
- return done(err4);
455
+ results.push(pth.normalize(file) + (stat.isDirectory() ? self.sep : ""));
456
+ if (!stat.isDirectory()) {
410
457
  if (!--pending)
411
458
  done();
459
+ return;
460
+ }
461
+ self.fs.realpath(file, function(err4, realDir) {
462
+ if (err4)
463
+ return done(err4);
464
+ if (visited.has(realDir)) {
465
+ if (!--pending)
466
+ done();
467
+ return;
468
+ }
469
+ visited.add(realDir);
470
+ walk(file, visited, function(err5) {
471
+ if (err5)
472
+ return done(err5);
473
+ if (!--pending)
474
+ done();
475
+ });
412
476
  });
413
477
  });
414
478
  });
@@ -418,6 +482,7 @@ var require_utils = __commonJS((exports, module) => {
418
482
  self.fs.realpath(dir, function(err, realDir) {
419
483
  if (err)
420
484
  return finish(err);
485
+ rootReal = realDir;
421
486
  walk(dir, new Set([realDir]), finish);
422
487
  });
423
488
  };
@@ -492,7 +557,11 @@ var require_utils = __commonJS((exports, module) => {
492
557
  Utils.readBigUInt64LE = function(buffer, index) {
493
558
  const lo = buffer.readUInt32LE(index);
494
559
  const hi = buffer.readUInt32LE(index + 4);
495
- return hi * 4294967296 + lo;
560
+ const value = hi * 4294967296 + lo;
561
+ if (value > Number.MAX_SAFE_INTEGER) {
562
+ throw Errors.ZIP64_VALUE_TOO_LARGE();
563
+ }
564
+ return value;
496
565
  };
497
566
  Utils.writeBigUInt64LE = function(buffer, value, index) {
498
567
  const lo = value >>> 0;
@@ -517,7 +586,7 @@ var require_utils = __commonJS((exports, module) => {
517
586
  });
518
587
 
519
588
  // ../../node_modules/adm-zip/util/fattr.js
520
- var require_fattr = __commonJS((exports, module) => {
589
+ var require_fattr = __commonJS(function(exports, module) {
521
590
  var pth = __require("path");
522
591
  module.exports = function(path, { fs }) {
523
592
  var _path = path || "", _obj = newAttr(), _stat = null;
@@ -582,7 +651,7 @@ var require_fattr = __commonJS((exports, module) => {
582
651
  });
583
652
 
584
653
  // ../../node_modules/adm-zip/util/decoder.js
585
- var require_decoder = __commonJS((exports, module) => {
654
+ var require_decoder = __commonJS(function(exports, module) {
586
655
  module.exports = {
587
656
  efs: true,
588
657
  encode: (data) => Buffer.from(data, "utf8"),
@@ -591,7 +660,7 @@ var require_decoder = __commonJS((exports, module) => {
591
660
  });
592
661
 
593
662
  // ../../node_modules/adm-zip/util/index.js
594
- var require_util = __commonJS((exports, module) => {
663
+ var require_util = __commonJS(function(exports, module) {
595
664
  module.exports = require_utils();
596
665
  module.exports.Constants = require_constants();
597
666
  module.exports.Errors = require_errors();
@@ -600,7 +669,7 @@ var require_util = __commonJS((exports, module) => {
600
669
  });
601
670
 
602
671
  // ../../node_modules/adm-zip/headers/entryHeader.js
603
- var require_entryHeader = __commonJS((exports, module) => {
672
+ var require_entryHeader = __commonJS(function(exports, module) {
604
673
  var Utils = require_util();
605
674
  var Constants = Utils.Constants;
606
675
  module.exports = function() {
@@ -744,7 +813,7 @@ var require_entryHeader = __commonJS((exports, module) => {
744
813
  _attr = uint32(val);
745
814
  },
746
815
  get fileAttr() {
747
- return (_attr || 0) >> 16 & 4095;
816
+ return (_attr || 0) >> 16 & 511;
748
817
  },
749
818
  get offset() {
750
819
  return _offset;
@@ -765,6 +834,9 @@ var require_entryHeader = __commonJS((exports, module) => {
765
834
  return _localHeader;
766
835
  },
767
836
  loadLocalHeaderFromBinary: function(input) {
837
+ if (_offset < 0 || _offset + Constants.LOCHDR > input.length) {
838
+ throw Utils.Errors.INVALID_LOC();
839
+ }
768
840
  var data = input.slice(_offset, _offset + Constants.LOCHDR);
769
841
  if (data.readUInt32LE(0) !== Constants.LOCSIG) {
770
842
  throw Utils.Errors.INVALID_LOC();
@@ -868,7 +940,7 @@ var require_entryHeader = __commonJS((exports, module) => {
868
940
  });
869
941
 
870
942
  // ../../node_modules/adm-zip/headers/mainHeader.js
871
- var require_mainHeader = __commonJS((exports, module) => {
943
+ var require_mainHeader = __commonJS(function(exports, module) {
872
944
  var Utils = require_util();
873
945
  var Constants = Utils.Constants;
874
946
  module.exports = function() {
@@ -991,13 +1063,13 @@ var require_mainHeader = __commonJS((exports, module) => {
991
1063
  });
992
1064
 
993
1065
  // ../../node_modules/adm-zip/headers/index.js
994
- var require_headers = __commonJS((exports) => {
1066
+ var require_headers = __commonJS(function(exports) {
995
1067
  exports.EntryHeader = require_entryHeader();
996
1068
  exports.MainHeader = require_mainHeader();
997
1069
  });
998
1070
 
999
1071
  // ../../node_modules/adm-zip/methods/deflater.js
1000
- var require_deflater = __commonJS((exports, module) => {
1072
+ var require_deflater = __commonJS(function(exports, module) {
1001
1073
  module.exports = function(inbuf) {
1002
1074
  var zlib = __require("zlib");
1003
1075
  var opts = { chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024 };
@@ -1028,22 +1100,42 @@ var require_deflater = __commonJS((exports, module) => {
1028
1100
  });
1029
1101
 
1030
1102
  // ../../node_modules/adm-zip/methods/inflater.js
1031
- var require_inflater = __commonJS((exports, module) => {
1103
+ var require_inflater = __commonJS(function(exports, module) {
1032
1104
  var version = +(process?.versions?.node ?? "").split(".")[0] || 0;
1105
+ var Errors = require_errors();
1033
1106
  module.exports = function(inbuf, expectedLength) {
1034
1107
  var zlib = __require("zlib");
1035
- const option = version >= 15 && expectedLength > 0 ? { maxOutputLength: expectedLength } : {};
1108
+ const maxOutputLength = expectedLength > 0 ? expectedLength : 1;
1109
+ const option = version >= 15 ? { maxOutputLength } : {};
1036
1110
  return {
1037
1111
  inflate: function() {
1038
1112
  return zlib.inflateRawSync(inbuf, option);
1039
1113
  },
1040
1114
  inflateAsync: function(callback) {
1041
- var tmp = zlib.createInflateRaw(option), parts = [], total = 0;
1115
+ var tmp = zlib.createInflateRaw(option), parts = [], total = 0, done = false;
1116
+ const fail = function(err) {
1117
+ if (done)
1118
+ return;
1119
+ done = true;
1120
+ tmp.destroy();
1121
+ callback && callback(Buffer.alloc(0), err);
1122
+ };
1123
+ tmp.on("error", function(err) {
1124
+ fail(err);
1125
+ });
1042
1126
  tmp.on("data", function(data) {
1043
- parts.push(data);
1127
+ if (done)
1128
+ return;
1044
1129
  total += data.length;
1130
+ if (total > maxOutputLength) {
1131
+ return fail(Errors.MAX_OUTPUT_EXCEEDED());
1132
+ }
1133
+ parts.push(data);
1045
1134
  });
1046
1135
  tmp.on("end", function() {
1136
+ if (done)
1137
+ return;
1138
+ done = true;
1047
1139
  var buf = Buffer.alloc(total), written = 0;
1048
1140
  buf.fill(0);
1049
1141
  for (var i = 0;i < parts.length; i++) {
@@ -1060,7 +1152,7 @@ var require_inflater = __commonJS((exports, module) => {
1060
1152
  });
1061
1153
 
1062
1154
  // ../../node_modules/adm-zip/methods/zipcrypto.js
1063
- var require_zipcrypto = __commonJS((exports, module) => {
1155
+ var require_zipcrypto = __commonJS(function(exports, module) {
1064
1156
  var { randomFillSync } = __require("crypto");
1065
1157
  var Errors = require_errors();
1066
1158
  var crctable = new Uint32Array(256).map((t, crc) => {
@@ -1178,14 +1270,14 @@ var require_zipcrypto = __commonJS((exports, module) => {
1178
1270
  });
1179
1271
 
1180
1272
  // ../../node_modules/adm-zip/methods/index.js
1181
- var require_methods = __commonJS((exports) => {
1273
+ var require_methods = __commonJS(function(exports) {
1182
1274
  exports.Deflater = require_deflater();
1183
1275
  exports.Inflater = require_inflater();
1184
1276
  exports.ZipCrypto = require_zipcrypto();
1185
1277
  });
1186
1278
 
1187
1279
  // ../../node_modules/adm-zip/zipEntry.js
1188
- var require_zipEntry = __commonJS((exports, module) => {
1280
+ var require_zipEntry = __commonJS(function(exports, module) {
1189
1281
  var Utils = require_util();
1190
1282
  var Headers = require_headers();
1191
1283
  var Constants = Utils.Constants;
@@ -1200,7 +1292,12 @@ var require_zipEntry = __commonJS((exports, module) => {
1200
1292
  return Buffer.alloc(0);
1201
1293
  }
1202
1294
  _extralocal = _centralHeader.loadLocalHeaderFromBinary(input);
1203
- return input.slice(_centralHeader.realDataOffset, _centralHeader.realDataOffset + _centralHeader.compressedSize);
1295
+ const dataOffset = _centralHeader.realDataOffset;
1296
+ const dataEnd = dataOffset + _centralHeader.compressedSize;
1297
+ if (dataOffset < 0 || dataEnd < dataOffset || dataEnd > input.length) {
1298
+ throw Utils.Errors.INVALID_LOC();
1299
+ }
1300
+ return input.slice(dataOffset, dataEnd);
1204
1301
  }
1205
1302
  function crc32OK(data) {
1206
1303
  const expectedCrc = _centralHeader.flags_desc || _centralHeader.localHeader.flags_desc ? _centralHeader.crc : _centralHeader.localHeader.crc;
@@ -1217,17 +1314,26 @@ var require_zipEntry = __commonJS((exports, module) => {
1217
1314
  }
1218
1315
  return Buffer.alloc(0);
1219
1316
  }
1220
- var compressedData = getCompressedDataFromZip();
1221
- if (compressedData.length === 0) {
1222
- if (async && callback)
1223
- callback(compressedData);
1224
- return compressedData;
1225
- }
1226
- if (_centralHeader.encrypted) {
1227
- if (typeof pass !== "string" && !Buffer.isBuffer(pass)) {
1228
- throw Utils.Errors.INVALID_PASS_PARAM();
1317
+ var compressedData;
1318
+ try {
1319
+ compressedData = getCompressedDataFromZip();
1320
+ if (compressedData.length === 0) {
1321
+ if (async && callback)
1322
+ callback(compressedData);
1323
+ return compressedData;
1324
+ }
1325
+ if (_centralHeader.encrypted) {
1326
+ if (typeof pass !== "string" && !Buffer.isBuffer(pass)) {
1327
+ throw Utils.Errors.INVALID_PASS_PARAM();
1328
+ }
1329
+ compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass);
1330
+ }
1331
+ } catch (err) {
1332
+ if (async && callback) {
1333
+ callback(Buffer.alloc(0), err);
1334
+ return Buffer.alloc(0);
1229
1335
  }
1230
- compressedData = Methods.ZipCrypto.decrypt(compressedData, _centralHeader, pass);
1336
+ throw err;
1231
1337
  }
1232
1338
  var data;
1233
1339
  switch (_centralHeader.method) {
@@ -1252,13 +1358,15 @@ var require_zipEntry = __commonJS((exports, module) => {
1252
1358
  }
1253
1359
  return data;
1254
1360
  } else {
1255
- inflater.inflateAsync(function(result) {
1256
- if (callback) {
1257
- if (!crc32OK(result)) {
1258
- callback(result, Utils.Errors.BAD_CRC());
1259
- } else {
1260
- callback(result);
1261
- }
1361
+ inflater.inflateAsync(function(result, err) {
1362
+ if (!callback)
1363
+ return;
1364
+ if (err) {
1365
+ callback(Buffer.alloc(0), err);
1366
+ } else if (!crc32OK(result)) {
1367
+ callback(result, Utils.Errors.BAD_CRC());
1368
+ } else {
1369
+ callback(result);
1262
1370
  }
1263
1371
  });
1264
1372
  }
@@ -1493,7 +1601,7 @@ var require_zipEntry = __commonJS((exports, module) => {
1493
1601
  });
1494
1602
 
1495
1603
  // ../../node_modules/adm-zip/zipFile.js
1496
- var require_zipFile = __commonJS((exports, module) => {
1604
+ var require_zipFile = __commonJS(function(exports, module) {
1497
1605
  var ZipEntry = require_zipEntry();
1498
1606
  var Headers = require_headers();
1499
1607
  var Utils = require_util();
@@ -1550,6 +1658,9 @@ var require_zipFile = __commonJS((exports, module) => {
1550
1658
  if (entry.header.commentLength)
1551
1659
  entry.comment = inBuffer.slice(tmp, tmp + entry.header.commentLength);
1552
1660
  index += entry.header.centralHeaderSize;
1661
+ if (entry.entryName in entryTable) {
1662
+ throw Utils.Errors.DUPLICATE_ENTRY(`"${entry.entryName}"`);
1663
+ }
1553
1664
  entryList[i] = entry;
1554
1665
  entryTable[entry.entryName] = entry;
1555
1666
  }
@@ -1796,7 +1907,7 @@ var require_zipFile = __commonJS((exports, module) => {
1796
1907
  });
1797
1908
 
1798
1909
  // ../../node_modules/adm-zip/adm-zip.js
1799
- var require_adm_zip = __commonJS((exports, module) => {
1910
+ var require_adm_zip = __commonJS(function(exports, module) {
1800
1911
  var Utils = require_util();
1801
1912
  var pth = __require("path");
1802
1913
  var ZipEntry = require_zipEntry();
@@ -2075,7 +2186,7 @@ var require_adm_zip = __commonJS((exports, module) => {
2075
2186
  addLocalFolderAsync2: function(options2, callback) {
2076
2187
  const self = this;
2077
2188
  options2 = typeof options2 === "object" ? options2 : { localPath: options2 };
2078
- const localPath = pth.resolve(fixPath(options2.localPath));
2189
+ const localPath = pth.resolve(options2.localPath);
2079
2190
  let { zipPath, filter, namefix } = options2;
2080
2191
  if (filter instanceof RegExp) {
2081
2192
  filter = function(rx) {
@@ -2098,16 +2209,16 @@ var require_adm_zip = __commonJS((exports, module) => {
2098
2209
  const fileNameFix = (entry) => pth.win32.basename(pth.win32.normalize(namefix(entry)));
2099
2210
  filetools.fs.open(localPath, "r", function(err) {
2100
2211
  if (err && err.code === "ENOENT") {
2101
- callback(undefined, Utils.Errors.FILE_NOT_FOUND(localPath));
2212
+ callback(Utils.Errors.FILE_NOT_FOUND(localPath), false);
2102
2213
  } else if (err) {
2103
- callback(undefined, err);
2214
+ callback(err, false);
2104
2215
  } else {
2105
2216
  filetools.findFilesAsync(localPath, function(err2, fileEntries) {
2106
2217
  if (err2)
2107
- return callback(err2);
2218
+ return callback(err2, false);
2108
2219
  fileEntries = fileEntries.filter((dir) => filter(relPathFix(dir)));
2109
2220
  if (!fileEntries.length)
2110
- callback(undefined, false);
2221
+ return callback(undefined, true);
2111
2222
  setImmediate(fileEntries.reverse().reduce(function(next, entry) {
2112
2223
  return function(err3, done) {
2113
2224
  if (err3 || done === false)
@@ -2127,7 +2238,7 @@ var require_adm_zip = __commonJS((exports, module) => {
2127
2238
  return new Promise((resolve, reject) => {
2128
2239
  this.addLocalFolderAsync2(Object.assign({ localPath }, props), (err, done) => {
2129
2240
  if (err)
2130
- reject(err);
2241
+ return reject(err);
2131
2242
  if (done)
2132
2243
  resolve(this);
2133
2244
  });
@@ -2197,6 +2308,7 @@ var require_adm_zip = __commonJS((exports, module) => {
2197
2308
  }
2198
2309
  var name = canonical(maintainEntryPath ? child.entryName : child.entryName.substring(item.entryName.length));
2199
2310
  var childName = sanitize(targetPath, name);
2311
+ filetools.assertPathSafe(targetPath, childName);
2200
2312
  const fileAttr2 = keepOriginalPermission ? child.header.fileAttr : undefined;
2201
2313
  filetools.writeFileTo(childName, content2, overwrite, fileAttr2);
2202
2314
  });
@@ -2205,6 +2317,7 @@ var require_adm_zip = __commonJS((exports, module) => {
2205
2317
  var content = item.getData(_zip.password);
2206
2318
  if (!content)
2207
2319
  throw Utils.Errors.CANT_EXTRACT_FILE();
2320
+ filetools.assertPathSafe(targetPath, target);
2208
2321
  if (filetools.fs.existsSync(target) && !overwrite) {
2209
2322
  throw Utils.Errors.CANT_OVERRIDE();
2210
2323
  }
@@ -2240,6 +2353,7 @@ var require_adm_zip = __commonJS((exports, module) => {
2240
2353
  const dirEntries = [];
2241
2354
  _zip.entries.forEach(function(entry) {
2242
2355
  var entryName = sanitize(targetPath, canonical(entry.entryName));
2356
+ filetools.assertPathSafe(targetPath, entryName);
2243
2357
  if (entry.isDirectory) {
2244
2358
  filetools.makeDir(entryName);
2245
2359
  if (keepOriginalPermission)
@@ -2294,6 +2408,7 @@ var require_adm_zip = __commonJS((exports, module) => {
2294
2408
  const dirPath = getPath(entry);
2295
2409
  const dirAttr = keepOriginalPermission ? entry.header.fileAttr : undefined;
2296
2410
  try {
2411
+ filetools.assertPathSafe(targetPath, dirPath);
2297
2412
  filetools.makeDir(dirPath);
2298
2413
  } catch (er) {
2299
2414
  callback(getError("Unable to create folder", dirPath));
@@ -2322,6 +2437,11 @@ var require_adm_zip = __commonJS((exports, module) => {
2322
2437
  } else {
2323
2438
  const entryName = pth.normalize(canonical(entry.entryName));
2324
2439
  const filePath = sanitize(targetPath, entryName);
2440
+ try {
2441
+ filetools.assertPathSafe(targetPath, filePath);
2442
+ } catch (er) {
2443
+ return next(er);
2444
+ }
2325
2445
  entry.getDataAsync(function(content, err_1) {
2326
2446
  if (err_1) {
2327
2447
  next(err_1);
@@ -2391,8 +2511,26 @@ var require_adm_zip = __commonJS((exports, module) => {
2391
2511
  };
2392
2512
  });
2393
2513
 
2394
- // ../solution-sdk/generated/src/runtime.ts
2395
- var BASE_PATH = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
2514
+ // ../solution-sdk/src/studio-web-compat.ts
2515
+ var API_PROJECT_TYPES = new Set(["api", "apiautomation"]);
2516
+
2517
+ class StudioWebIncompatibleProjectError extends Error {
2518
+ offendingProjects;
2519
+ constructor(offendingProjects) {
2520
+ 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.`);
2521
+ this.offendingProjects = offendingProjects;
2522
+ this.name = "StudioWebIncompatibleProjectError";
2523
+ }
2524
+ }
2525
+ function assertStudioWebCompatibleProjects(projects) {
2526
+ const incompatible = projects.filter((p) => typeof p.Type === "string" && API_PROJECT_TYPES.has(p.Type.toLowerCase()) && p.ProjectRelativePath.replace(/\\/g, "/").split("/").pop() === "project.json");
2527
+ if (incompatible.length > 0) {
2528
+ throw new StudioWebIncompatibleProjectError(incompatible.map((p) => p.ProjectRelativePath));
2529
+ }
2530
+ }
2531
+
2532
+ // ../studioweb-sdk/generated/src/runtime.ts
2533
+ var BASE_PATH = "https://alpha.uipath.com/studio_/backend".replace(/\/+$/, "");
2396
2534
 
2397
2535
  class Configuration {
2398
2536
  configuration;
@@ -2589,15 +2727,6 @@ class FetchError extends Error {
2589
2727
  this.cause = cause;
2590
2728
  }
2591
2729
  }
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
2730
  function querystring(params, prefix = "") {
2602
2731
  return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
2603
2732
  }
@@ -2619,813 +2748,230 @@ function querystringSingleKey(key, value, keyPrefix = "") {
2619
2748
  }
2620
2749
  return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
2621
2750
  }
2622
- class JSONApiResponse {
2623
- raw;
2624
- transformer;
2625
- constructor(raw, transformer = (jsonValue) => jsonValue) {
2626
- this.raw = raw;
2627
- this.transformer = transformer;
2628
- }
2629
- async value() {
2630
- return this.transformer(await this.raw.json());
2631
- }
2632
- }
2751
+ // ../solution-sdk/generated/src/runtime.ts
2752
+ var BASE_PATH2 = "https://alpha.uipath.com/uipattycyrhx/abizon_1/automationsolutions_".replace(/\/+$/, "");
2633
2753
 
2634
- class VoidApiResponse {
2635
- raw;
2636
- constructor(raw) {
2637
- this.raw = raw;
2638
- }
2639
- async value() {
2640
- return;
2754
+ class Configuration2 {
2755
+ configuration;
2756
+ constructor(configuration = {}) {
2757
+ this.configuration = configuration;
2641
2758
  }
2642
- }
2643
- class TextApiResponse {
2644
- raw;
2645
- constructor(raw) {
2646
- this.raw = raw;
2759
+ set config(configuration) {
2760
+ this.configuration = configuration;
2647
2761
  }
2648
- async value() {
2649
- return await this.raw.text();
2762
+ get basePath() {
2763
+ return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH2;
2650
2764
  }
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;
2765
+ get fetchApi() {
2766
+ return this.configuration.fetchApi;
2660
2767
  }
2661
- return {
2662
- keys: json["keys"] == null ? undefined : json["keys"],
2663
- values: json["values"] == null ? undefined : json["values"]
2664
- };
2665
- }
2666
-
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;
2768
+ get middleware() {
2769
+ return this.configuration.middleware || [];
2674
2770
  }
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;
2771
+ get queryParamsStringify() {
2772
+ return this.configuration.queryParamsStringify || querystring2;
2688
2773
  }
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;
2774
+ get username() {
2775
+ return this.configuration.username;
2713
2776
  }
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;
2777
+ get password() {
2778
+ return this.configuration.password;
2731
2779
  }
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;
2780
+ get apiKey() {
2781
+ const apiKey = this.configuration.apiKey;
2782
+ if (apiKey) {
2783
+ return typeof apiKey === "function" ? apiKey : () => apiKey;
2784
+ }
2785
+ return;
2746
2786
  }
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;
2787
+ get accessToken() {
2788
+ const accessToken = this.configuration.accessToken;
2789
+ if (accessToken) {
2790
+ return typeof accessToken === "function" ? accessToken : async () => accessToken;
2791
+ }
2792
+ return;
2757
2793
  }
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;
2794
+ get headers() {
2795
+ return this.configuration.headers;
2770
2796
  }
2771
- return {
2772
- packageVersionKey: value["packageVersionKey"],
2773
- folderFQN: value["folderFQN"],
2774
- overwrites: value["overwrites"].map(ResourceOverwriteToJSON),
2775
- runtimeSetup: RuntimeSetupToJSON(value["runtimeSetup"])
2776
- };
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;
2797
+ get credentials() {
2798
+ return this.configuration.credentials;
2785
2799
  }
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
- }
2822
-
2823
- // ../solution-sdk/generated/src/models/DeploymentUpgradeType.ts
2824
- function DeploymentUpgradeTypeFromJSON(json) {
2825
- return DeploymentUpgradeTypeFromJSONTyped(json, false);
2826
- }
2827
- function DeploymentUpgradeTypeFromJSONTyped(json, ignoreDiscriminator) {
2828
- return json;
2829
- }
2830
-
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;
2837
2800
  }
2801
+ var DefaultConfig2 = new Configuration2;
2838
2802
 
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;
2846
- }
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
- }
2880
- // ../solution-sdk/generated/src/models/DeploymentRequest.ts
2881
- function DeploymentRequestToJSON(json) {
2882
- return DeploymentRequestToJSONTyped(json, false);
2883
- }
2884
- function DeploymentRequestToJSONTyped(value, ignoreDiscriminator = false) {
2885
- if (value == null) {
2886
- return value;
2803
+ class BaseAPI2 {
2804
+ configuration;
2805
+ static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
2806
+ middleware;
2807
+ constructor(configuration = DefaultConfig2) {
2808
+ this.configuration = configuration;
2809
+ this.middleware = configuration.middleware;
2887
2810
  }
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;
2811
+ withMiddleware(...middlewares) {
2812
+ const next = this.clone();
2813
+ next.middleware = next.middleware.concat(...middlewares);
2814
+ return next;
2905
2815
  }
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;
2816
+ withPreMiddleware(...preMiddlewares) {
2817
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
2818
+ return this.withMiddleware(...middlewares);
2925
2819
  }
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;
2820
+ withPostMiddleware(...postMiddlewares) {
2821
+ const middlewares = postMiddlewares.map((post) => ({ post }));
2822
+ return this.withMiddleware(...middlewares);
2939
2823
  }
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;
2824
+ isJsonMime(mime) {
2825
+ if (!mime) {
2826
+ return false;
2827
+ }
2828
+ return BaseAPI2.jsonRegex.test(mime);
2953
2829
  }
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;
2830
+ async request(context, initOverrides) {
2831
+ const { url, init } = await this.createFetchParams(context, initOverrides);
2832
+ const response = await this.fetchApi(url, init);
2833
+ if (response && (response.status >= 200 && response.status < 300)) {
2834
+ return response;
2835
+ }
2836
+ throw new ResponseError2(response, "Response returned an error code");
2976
2837
  }
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
- }
2838
+ async createFetchParams(context, initOverrides) {
2839
+ let url = this.configuration.basePath + context.path;
2840
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
2841
+ url += "?" + this.configuration.queryParamsStringify(context.query);
3057
2842
  }
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);
2843
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
2844
+ Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
2845
+ const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
2846
+ const initParams = {
2847
+ method: context.method,
2848
+ headers,
2849
+ body: context.body,
2850
+ credentials: this.configuration.credentials
2851
+ };
2852
+ const overriddenInit = {
2853
+ ...initParams,
2854
+ ...await initOverrideFn({
2855
+ init: initParams,
2856
+ context
2857
+ })
2858
+ };
2859
+ let body;
2860
+ if (isFormData2(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob2(overriddenInit.body)) {
2861
+ body = overriddenInit.body;
2862
+ } else if (this.isJsonMime(headers["Content-Type"])) {
2863
+ body = JSON.stringify(overriddenInit.body);
3068
2864
  } else {
3069
- return new TextApiResponse(response);
2865
+ body = overriddenInit.body;
3070
2866
  }
2867
+ const init = {
2868
+ ...overriddenInit,
2869
+ body
2870
+ };
2871
+ return { url, init };
3071
2872
  }
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}`;
2873
+ fetchApi = async (url, init) => {
2874
+ let fetchParams = { url, init };
2875
+ for (const middleware of this.middleware) {
2876
+ if (middleware.pre) {
2877
+ fetchParams = await middleware.pre({
2878
+ fetch: this.fetchApi,
2879
+ ...fetchParams
2880
+ }) || fetchParams;
3098
2881
  }
3099
2882
  }
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}`;
2883
+ let response = undefined;
2884
+ try {
2885
+ response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
2886
+ } catch (e) {
2887
+ for (const middleware of this.middleware) {
2888
+ if (middleware.onError) {
2889
+ response = await middleware.onError({
2890
+ fetch: this.fetchApi,
2891
+ url: fetchParams.url,
2892
+ init: fetchParams.init,
2893
+ error: e,
2894
+ response: response ? response.clone() : undefined
2895
+ }) || response;
2896
+ }
3128
2897
  }
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}`;
2898
+ if (response === undefined) {
2899
+ if (e instanceof Error) {
2900
+ throw new FetchError2(e, "The request failed and the interceptors did not return an alternative response");
2901
+ } else {
2902
+ throw e;
2903
+ }
3159
2904
  }
3160
2905
  }
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}`;
2906
+ for (const middleware of this.middleware) {
2907
+ if (middleware.post) {
2908
+ response = await middleware.post({
2909
+ fetch: this.fetchApi,
2910
+ url: fetchParams.url,
2911
+ init: fetchParams.init,
2912
+ response: response.clone()
2913
+ }) || response;
3193
2914
  }
3194
2915
  }
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));
2916
+ return response;
2917
+ };
2918
+ clone() {
2919
+ const constructor = this.constructor;
2920
+ const next = new constructor(this.configuration);
2921
+ next.middleware = this.middleware.slice();
2922
+ return next;
3205
2923
  }
3206
- async deploymentsUpgrade(requestParameters, initOverrides) {
3207
- const response = await this.deploymentsUpgradeRaw(requestParameters, initOverrides);
3208
- return await response.value();
2924
+ }
2925
+ function isBlob2(value) {
2926
+ return typeof Blob !== "undefined" && value instanceof Blob;
2927
+ }
2928
+ function isFormData2(value) {
2929
+ return typeof FormData !== "undefined" && value instanceof FormData;
2930
+ }
2931
+
2932
+ class ResponseError2 extends Error {
2933
+ response;
2934
+ name = "ResponseError";
2935
+ constructor(response, msg) {
2936
+ super(msg);
2937
+ this.response = response;
3209
2938
  }
3210
2939
  }
3211
2940
 
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
- }
2941
+ class FetchError2 extends Error {
2942
+ cause;
2943
+ name = "FetchError";
2944
+ constructor(cause, msg) {
2945
+ super(msg);
2946
+ this.cause = cause;
3418
2947
  }
3419
- async packagesUpload(requestParameters = {}, initOverrides) {
3420
- const response = await this.packagesUploadRaw(requestParameters, initOverrides);
3421
- return await response.value();
2948
+ }
2949
+ function querystring2(params, prefix = "") {
2950
+ return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
2951
+ }
2952
+ function querystringSingleKey2(key, value, keyPrefix = "") {
2953
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
2954
+ if (value instanceof Array) {
2955
+ const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
2956
+ return `${encodeURIComponent(fullKey)}=${multiValue}`;
3422
2957
  }
2958
+ if (value instanceof Set) {
2959
+ const valueAsArray = Array.from(value);
2960
+ return querystringSingleKey2(key, valueAsArray, keyPrefix);
2961
+ }
2962
+ if (value instanceof Date) {
2963
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
2964
+ }
2965
+ if (value instanceof Object) {
2966
+ return querystring2(value, fullKey);
2967
+ }
2968
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
3423
2969
  }
3424
2970
  // ../solution-sdk/package.json
3425
2971
  var package_default = {
3426
2972
  name: "@uipath/solution-sdk",
3427
2973
  license: "MIT",
3428
- version: "1.201.0",
2974
+ version: "1.202.0-preview.136",
3429
2975
  repository: {
3430
2976
  type: "git",
3431
2977
  url: "https://github.com/UiPath/cli.git",
@@ -3487,233 +3033,216 @@ var package_default = {
3487
3033
 
3488
3034
  // ../solution-sdk/src/user-agent.ts
3489
3035
  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;
3036
+ installSdkUserAgentHeader(BaseAPI2, SDK_USER_AGENT);
3037
+
3038
+ // ../solution-sdk/src/upload-service.ts
3039
+ class SolutionUploadHttpError extends Error {
3040
+ status;
3041
+ operation;
3042
+ method;
3043
+ endpoint;
3044
+ url;
3045
+ body;
3046
+ solutionId;
3047
+ parsedErrorCode;
3048
+ parsedErrorMessage;
3049
+ constructor(details) {
3050
+ super(details.message);
3051
+ this.name = "SolutionUploadHttpError";
3052
+ this.status = details.status;
3053
+ this.operation = details.operation;
3054
+ this.method = details.method;
3055
+ this.endpoint = details.endpoint;
3056
+ this.url = details.url;
3057
+ this.body = details.body;
3058
+ if (details.operation === "overwrite") {
3059
+ this.solutionId = details.solutionId;
3060
+ }
3061
+ const parsed = parseUploadErrorBody(details.body);
3062
+ this.parsedErrorCode = parsed.code;
3063
+ this.parsedErrorMessage = parsed.message;
3064
+ }
3065
+ }
3066
+ function parseUploadErrorBody(body) {
3067
+ const [, parsed] = catchError(() => JSON.parse(body));
3068
+ if (!parsed || typeof parsed !== "object")
3069
+ return {};
3070
+ const rawCode = parsed.code ?? parsed.Code;
3071
+ const rawMessage = parsed.message ?? parsed.Message;
3072
+ return {
3073
+ code: typeof rawCode === "string" || typeof rawCode === "number" ? String(rawCode) : undefined,
3074
+ message: typeof rawMessage === "string" && rawMessage.trim() ? rawMessage : undefined
3658
3075
  };
3659
- clone() {
3660
- const constructor = this.constructor;
3661
- const next = new constructor(this.configuration);
3662
- next.middleware = this.middleware.slice();
3663
- return next;
3076
+ }
3077
+ function isSolutionUploadHttpError(error) {
3078
+ 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";
3079
+ }
3080
+ function requestPath(url) {
3081
+ const [, parsed] = catchError(() => new URL(url));
3082
+ return parsed ? `${parsed.pathname}${parsed.search}` : url;
3083
+ }
3084
+ function buildSolutionUploadFailureOutput(err, options = {}) {
3085
+ const stage = err.operation === "overwrite" ? "overwrite-solution" : "import-solution";
3086
+ const detail = err.parsedErrorMessage ? ` — ${err.parsedErrorMessage}` : "";
3087
+ const Message = `Failed during ${stage}: HTTP ${err.status} on ${err.method} ` + `${err.endpoint}${detail}`;
3088
+ const body = err.parsedErrorMessage ? "" : summarizePlatformBody(err.body);
3089
+ const bodySuffix = body ? ` Platform response: "${body}".` : "";
3090
+ const importHint = options.importCheckHint ? ` ${options.importCheckHint}` : "";
3091
+ const subject = options.subject ?? "project";
3092
+ const target = err.solutionId ?? `the solution at ${err.endpoint}`;
3093
+ 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}`;
3094
+ const Context = {
3095
+ httpStatus: err.status,
3096
+ stage,
3097
+ endpoint: err.endpoint,
3098
+ method: err.method
3099
+ };
3100
+ if (err.parsedErrorCode !== undefined) {
3101
+ Context.errorCode = err.parsedErrorCode;
3102
+ }
3103
+ const output = {
3104
+ Result: RESULTS.Failure,
3105
+ Message,
3106
+ Instructions,
3107
+ Context
3108
+ };
3109
+ if (err.operation === "overwrite" && err.status >= 500 && err.status < 600) {
3110
+ output.Retry = "RetryAfter30Seconds";
3664
3111
  }
3112
+ return output;
3665
3113
  }
3666
- function isBlob2(value) {
3667
- return typeof Blob !== "undefined" && value instanceof Blob;
3114
+ var DEFAULT_UPLOAD_TIMEOUT_MS = 120000;
3115
+ function resolveUploadTimeoutMs() {
3116
+ const raw = Number(process.env?.UIPATH_SOLUTION_UPLOAD_TIMEOUT_MS);
3117
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_UPLOAD_TIMEOUT_MS;
3668
3118
  }
3669
- function isFormData2(value) {
3670
- return typeof FormData !== "undefined" && value instanceof FormData;
3119
+ function formatTimeout(timeoutMs) {
3120
+ return timeoutMs < 1000 ? `${Math.round(timeoutMs)}ms` : `${Math.round(timeoutMs / 1000)}s`;
3671
3121
  }
3672
-
3673
- class ResponseError2 extends Error {
3674
- response;
3675
- name = "ResponseError";
3676
- constructor(response, msg) {
3677
- super(msg);
3678
- this.response = response;
3122
+ function timeoutMessage(what, timeoutMs) {
3123
+ 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.`;
3124
+ }
3125
+ function isTimeoutError(error) {
3126
+ let current = error;
3127
+ for (let depth = 0;depth < 5 && current instanceof Error; depth += 1) {
3128
+ if (current.name === "TimeoutError")
3129
+ return true;
3130
+ current = current.cause;
3679
3131
  }
3132
+ return false;
3680
3133
  }
3681
-
3682
- class FetchError2 extends Error {
3683
- cause;
3684
- name = "FetchError";
3685
- constructor(cause, msg) {
3686
- super(msg);
3687
- this.cause = cause;
3134
+ async function fetchWithUploadTimeout(url, init, what) {
3135
+ const timeoutMs = resolveUploadTimeoutMs();
3136
+ const [error, response] = await catchError(fetch(url, { ...init, signal: AbortSignal.timeout(timeoutMs) }));
3137
+ if (error) {
3138
+ if (isTimeoutError(error)) {
3139
+ throw new Error(timeoutMessage(what, timeoutMs));
3140
+ }
3141
+ throw error;
3688
3142
  }
3143
+ return response;
3689
3144
  }
3690
- function querystring2(params, prefix = "") {
3691
- return Object.keys(params).map((key) => querystringSingleKey2(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
3145
+ async function importSolution(config, organizationName, fileBuffer, fileName) {
3146
+ const importUrl = `${config.baseUrl}/${encodeURIComponent(organizationName)}/studio_/backend/api/Solution/Import?desktopJit=true&useFileRest=true&enableUnifiedBuild=true`;
3147
+ const formData = new FormData;
3148
+ const fileBlob = new Blob([fileBuffer], {
3149
+ type: "application/octet-stream"
3150
+ });
3151
+ formData.append("uploadFile", fileBlob, fileName);
3152
+ formData.append("telemetryData", JSON.stringify({ FirstRun: false }));
3153
+ const headers = addSdkUserAgentHeader({
3154
+ Authorization: `Bearer ${config.authToken}`
3155
+ }, SDK_USER_AGENT);
3156
+ if (config.tenantId) {
3157
+ headers["x-uipath-tenantid"] = config.tenantId;
3158
+ }
3159
+ const response = await fetchWithUploadTimeout(importUrl, { method: "POST", headers, body: formData }, "Studio Web solution import");
3160
+ if (!response.ok) {
3161
+ const text = await response.text().catch(() => "");
3162
+ throw new SolutionUploadHttpError({
3163
+ operation: "import",
3164
+ status: response.status,
3165
+ method: "POST",
3166
+ endpoint: requestPath(importUrl),
3167
+ url: importUrl,
3168
+ body: text,
3169
+ message: `Import failed (${response.status}): ${text}`
3170
+ });
3171
+ }
3172
+ return await response.json();
3692
3173
  }
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}`;
3174
+ async function overwriteSolution(config, organizationName, fileBuffer, fileName, solutionId, createSnapshot = false) {
3175
+ const overwriteUrl = `${config.baseUrl}/${encodeURIComponent(organizationName)}/studio_/backend/api/Solution/${encodeURIComponent(solutionId)}/Overwrite`;
3176
+ const formData = new FormData;
3177
+ const fileBlob = new Blob([fileBuffer], {
3178
+ type: "application/octet-stream"
3179
+ });
3180
+ formData.append("UploadFile", fileBlob, fileName);
3181
+ if (createSnapshot) {
3182
+ formData.append("createSnapshot", "true");
3698
3183
  }
3699
- if (value instanceof Set) {
3700
- const valueAsArray = Array.from(value);
3701
- return querystringSingleKey2(key, valueAsArray, keyPrefix);
3184
+ const headers = addSdkUserAgentHeader({
3185
+ Authorization: `Bearer ${config.authToken}`
3186
+ }, SDK_USER_AGENT);
3187
+ if (config.tenantId) {
3188
+ headers["x-uipath-tenantid"] = config.tenantId;
3702
3189
  }
3703
- if (value instanceof Date) {
3704
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
3190
+ const response = await fetchWithUploadTimeout(overwriteUrl, { method: "POST", headers, body: formData }, "Studio Web solution overwrite");
3191
+ if (!response.ok) {
3192
+ const text = await response.text().catch(() => "");
3193
+ throw new SolutionUploadHttpError({
3194
+ operation: "overwrite",
3195
+ status: response.status,
3196
+ method: "POST",
3197
+ endpoint: requestPath(overwriteUrl),
3198
+ url: overwriteUrl,
3199
+ body: text,
3200
+ message: `Overwrite failed (${response.status}): ${text}`,
3201
+ solutionId
3202
+ });
3705
3203
  }
3706
- if (value instanceof Object) {
3707
- return querystring2(value, fullKey);
3204
+ return await response.json();
3205
+ }
3206
+ async function uploadOrOverwriteSolution(config, organizationName, fileBufferOrPath, solutionId, fs) {
3207
+ let fileBuffer;
3208
+ let fileName;
3209
+ if (typeof fileBufferOrPath === "string") {
3210
+ if (!fs) {
3211
+ throw new Error("IFileSystem is required when passing a file path to uploadOrOverwriteSolution");
3212
+ }
3213
+ const content = await fs.readFile(fileBufferOrPath);
3214
+ if (content === null) {
3215
+ throw new Error(`Failed to read file: ${fileBufferOrPath}`);
3216
+ }
3217
+ fileBuffer = new Uint8Array(content);
3218
+ fileName = fs.path.basename(fileBufferOrPath);
3219
+ } else {
3220
+ fileBuffer = fileBufferOrPath;
3221
+ fileName = "solution.uis";
3708
3222
  }
3709
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
3223
+ if (solutionId) {
3224
+ logger.info(`Attempting to overwrite existing solution ${solutionId} on Studio Web...`);
3225
+ const [overwriteError, overwriteResult] = await catchError(overwriteSolution(config, organizationName, fileBuffer, fileName, solutionId));
3226
+ if (!overwriteError) {
3227
+ logger.info("Solution overwritten successfully.");
3228
+ return overwriteResult;
3229
+ }
3230
+ if (isSolutionUploadHttpError(overwriteError) && overwriteError.status === 404) {
3231
+ logger.info(`Solution ${solutionId} not found on Studio Web. Importing as new solution...`);
3232
+ } else {
3233
+ throw overwriteError;
3234
+ }
3235
+ }
3236
+ logger.info("Importing new solution to Studio Web...");
3237
+ return importSolution(config, organizationName, fileBuffer, fileName);
3710
3238
  }
3711
3239
  // ../solution-sdk/src/zip-utils.ts
3712
3240
  var DEFAULT_EXCLUDED_DIR_NAMES = new Set([
3713
3241
  ".venv",
3714
3242
  "node_modules",
3715
3243
  "__pycache__",
3716
- ".git"
3244
+ ".git",
3245
+ ".local"
3717
3246
  ]);
3718
3247
  var DEFAULT_EXCLUDED_FILE_PATTERNS = [
3719
3248
  /^\.env($|\..+)/
@@ -3794,7 +3323,76 @@ async function createZipFromDir(fs, dir, options = {}) {
3794
3323
  }
3795
3324
  zippable[`${relPath}/`] = new Uint8Array(0);
3796
3325
  }
3797
- return zipSync(zippable, { level: 6 });
3326
+ return finalizeZip64(zipSync(zippable, { level: 6 }));
3327
+ }
3328
+ var EOCD_SIZE = 22;
3329
+ var EOCD_SIGNATURE = 101010256;
3330
+ var CD_HEADER_SIGNATURE = 33639248;
3331
+ var ZIP64_EOCD_SIGNATURE = 101075792;
3332
+ var ZIP64_EOCD_SIZE = 56;
3333
+ var ZIP64_LOCATOR_SIGNATURE = 117853008;
3334
+ var ZIP64_LOCATOR_SIZE = 20;
3335
+ var MAX_ZIP32_ENTRIES = 65535;
3336
+ var MAX_ZIP32_OFFSET = 4294967295;
3337
+ function finalizeZip64(zip) {
3338
+ const view = new DataView(zip.buffer, zip.byteOffset, zip.byteLength);
3339
+ const eocdStart = zip.byteLength - EOCD_SIZE;
3340
+ if (eocdStart < 0 || view.getUint32(eocdStart, true) !== EOCD_SIGNATURE) {
3341
+ throw new Error("Cannot finalize the solution archive: it does not end with an end-of-central-directory record.");
3342
+ }
3343
+ const cdSize = view.getUint32(eocdStart + 12, true);
3344
+ const cdOffset = view.getUint32(eocdStart + 16, true);
3345
+ const entryCount = countCentralDirectoryEntries(view, cdOffset, cdSize);
3346
+ if (entryCount <= MAX_ZIP32_ENTRIES) {
3347
+ return zip;
3348
+ }
3349
+ if (cdOffset >= MAX_ZIP32_OFFSET || zip.byteLength >= MAX_ZIP32_OFFSET) {
3350
+ 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.`);
3351
+ }
3352
+ const tail = new Uint8Array(ZIP64_EOCD_SIZE + ZIP64_LOCATOR_SIZE + EOCD_SIZE);
3353
+ const tailView = new DataView(tail.buffer);
3354
+ const count = BigInt(entryCount);
3355
+ tailView.setUint32(0, ZIP64_EOCD_SIGNATURE, true);
3356
+ tailView.setBigUint64(4, BigInt(ZIP64_EOCD_SIZE - 12), true);
3357
+ tailView.setUint16(12, 45, true);
3358
+ tailView.setUint16(14, 45, true);
3359
+ tailView.setUint32(16, 0, true);
3360
+ tailView.setUint32(20, 0, true);
3361
+ tailView.setBigUint64(24, count, true);
3362
+ tailView.setBigUint64(32, count, true);
3363
+ tailView.setBigUint64(40, BigInt(cdSize), true);
3364
+ tailView.setBigUint64(48, BigInt(cdOffset), true);
3365
+ const locator = ZIP64_EOCD_SIZE;
3366
+ tailView.setUint32(locator, ZIP64_LOCATOR_SIGNATURE, true);
3367
+ tailView.setUint32(locator + 4, 0, true);
3368
+ tailView.setBigUint64(locator + 8, BigInt(eocdStart), true);
3369
+ tailView.setUint32(locator + 16, 1, true);
3370
+ const eocd = ZIP64_EOCD_SIZE + ZIP64_LOCATOR_SIZE;
3371
+ tailView.setUint32(eocd, EOCD_SIGNATURE, true);
3372
+ tailView.setUint16(eocd + 4, 0, true);
3373
+ tailView.setUint16(eocd + 6, 0, true);
3374
+ tailView.setUint16(eocd + 8, MAX_ZIP32_ENTRIES, true);
3375
+ tailView.setUint16(eocd + 10, MAX_ZIP32_ENTRIES, true);
3376
+ tailView.setUint32(eocd + 12, cdSize, true);
3377
+ tailView.setUint32(eocd + 16, cdOffset, true);
3378
+ tailView.setUint16(eocd + 20, 0, true);
3379
+ const out = new Uint8Array(eocdStart + tail.byteLength);
3380
+ out.set(zip.subarray(0, eocdStart), 0);
3381
+ out.set(tail, eocdStart);
3382
+ return out;
3383
+ }
3384
+ function countCentralDirectoryEntries(view, cdOffset, cdSize) {
3385
+ const end = cdOffset + cdSize;
3386
+ let position = cdOffset;
3387
+ let count = 0;
3388
+ while (position + 46 <= end && view.getUint32(position, true) === CD_HEADER_SIGNATURE) {
3389
+ const nameLength = view.getUint16(position + 28, true);
3390
+ const extraLength = view.getUint16(position + 30, true);
3391
+ const commentLength = view.getUint16(position + 32, true);
3392
+ position += 46 + nameLength + extraLength + commentLength;
3393
+ count++;
3394
+ }
3395
+ return count;
3798
3396
  }
3799
3397
 
3800
3398
  // ../solution-sdk/src/bundle-service.ts
@@ -3912,6 +3510,7 @@ async function bundleSolution(fs, solutionDir, outputDir, outputName) {
3912
3510
  for (const project of uipx.Projects) {
3913
3511
  project.ProjectRelativePath = toForwardSlash(project.ProjectRelativePath);
3914
3512
  }
3513
+ assertStudioWebCompatibleProjects(uipx.Projects);
3915
3514
  const solutionStorage = {
3916
3515
  SolutionId: uipx.SolutionId,
3917
3516
  Projects: uipx.Projects.map((p) => ({
@@ -3968,119 +3567,214 @@ async function bundleSolution(fs, solutionDir, outputDir, outputName) {
3968
3567
  // ../solution-sdk/src/project-debug-status.ts
3969
3568
  var SUCCEEDED = "creationsucceeded";
3970
3569
  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;
3570
+ // src/services/agent-debug-service.ts
3571
+ import { randomUUID } from "node:crypto";
3572
+
3573
+ // src/services/agent-builder-migrations.ts
3574
+ var warnedLegacyToolGuardrailPolicies = false;
3575
+ function migrateLegacyToolGuardrailPolicies(builder) {
3576
+ let migrated = false;
3577
+ for (const resource of builder.resources ?? []) {
3578
+ if (resource.$resourceType !== "tool" || !Array.isArray(resource.guardrailPolicies)) {
3579
+ continue;
3580
+ }
3581
+ if (!resource.guardrail?.policies?.length) {
3582
+ resource.guardrail = { policies: resource.guardrailPolicies };
3583
+ migrated = true;
3584
+ }
3585
+ delete resource.guardrailPolicies;
3977
3586
  }
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;
3587
+ if (migrated && !warnedLegacyToolGuardrailPolicies) {
3588
+ OutputFormatter.log({
3589
+ Warning: "Migrated legacy guardrailPolicies to guardrail.policies."
3590
+ });
3591
+ warnedLegacyToolGuardrailPolicies = true;
3996
3592
  }
3997
- return false;
3998
3593
  }
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));
3594
+
3595
+ // src/services/agent-project-service.ts
3596
+ class AgentProjectService {
3597
+ fs = getFileSystem();
3598
+ resolvedAgentDirs = new Map;
3599
+ getAgentDir(projectPath) {
3600
+ const cached = this.resolvedAgentDirs.get(projectPath);
3601
+ if (cached) {
3602
+ return cached;
3603
+ }
3604
+ return projectPath;
3605
+ }
3606
+ async resolveAgentDir(projectPath) {
3607
+ const cached = this.resolvedAgentDirs.get(projectPath);
3608
+ if (cached) {
3609
+ return cached;
3610
+ }
3611
+ const flatAgent = this.fs.path.join(projectPath, "agent.json");
3612
+ if (await this.fs.stat(flatAgent)) {
3613
+ this.resolvedAgentDirs.set(projectPath, projectPath);
3614
+ return projectPath;
3615
+ }
3616
+ const entries = await this.fs.readdir(projectPath);
3617
+ for (const entry of entries) {
3618
+ if (entry.startsWith(".") || entry === "evals" || entry === "features" || entry === "resources" || entry === "userProfile") {
3619
+ continue;
3620
+ }
3621
+ const candidate = this.fs.path.join(projectPath, entry);
3622
+ const candidateStat = await this.fs.stat(candidate);
3623
+ if (!candidateStat?.isDirectory())
3624
+ continue;
3625
+ const agentStat = await this.fs.stat(this.fs.path.join(candidate, "agent.json"));
3626
+ if (agentStat) {
3627
+ this.resolvedAgentDirs.set(projectPath, candidate);
3628
+ return candidate;
3629
+ }
4005
3630
  }
4006
- throw error;
4007
- }
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;
4023
- }
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}`);
3631
+ this.resolvedAgentDirs.set(projectPath, projectPath);
3632
+ return projectPath;
3633
+ }
3634
+ async readAgentJson(projectPath) {
3635
+ const agentDir = this.getAgentDir(projectPath);
3636
+ const raw = await this.fs.readFile(this.fs.path.join(agentDir, "agent.json"), "utf-8");
3637
+ return JSON.parse(raw);
3638
+ }
3639
+ async writeAgentJson(projectPath, agent) {
3640
+ const agentDir = this.getAgentDir(projectPath);
3641
+ await this.fs.writeFile(this.fs.path.join(agentDir, "agent.json"), `${JSON.stringify(agent, null, 2)}
3642
+ `);
3643
+ const builderDir = this.fs.path.join(agentDir, ".agent-builder");
3644
+ await this.safeMkdir(builderDir);
3645
+ let existingBuilder;
3646
+ const [builderReadError, builderRaw] = await catchError(this.fs.readFile(this.fs.path.join(builderDir, "agent.json"), "utf-8"));
3647
+ if (!builderReadError && builderRaw) {
3648
+ try {
3649
+ existingBuilder = JSON.parse(builderRaw);
3650
+ migrateLegacyToolGuardrailPolicies(existingBuilder);
3651
+ } catch {}
3652
+ }
3653
+ const builderAgent = {
3654
+ id: agent.projectId,
3655
+ name: existingBuilder?.name ?? "Agent",
3656
+ ...agent,
3657
+ resources: existingBuilder?.resources ?? agent.resources ?? [],
3658
+ features: existingBuilder?.features ?? agent.features ?? []
3659
+ };
3660
+ await this.fs.writeFile(this.fs.path.join(builderDir, "agent.json"), `${JSON.stringify(builderAgent, null, 2)}
3661
+ `);
3662
+ }
3663
+ async readSolutionStorage(projectPath) {
3664
+ const raw = await this.fs.readFile(this.fs.path.join(projectPath, "SolutionStorage.json"), "utf-8");
3665
+ return JSON.parse(raw);
3666
+ }
3667
+ async writeSolutionStorage(projectPath, storage) {
3668
+ await this.fs.writeFile(this.fs.path.join(projectPath, "SolutionStorage.json"), `${JSON.stringify(storage, null, 2)}
3669
+ `);
3670
+ }
3671
+ async readEvaluator(projectPath, fileName) {
3672
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators", fileName);
3673
+ const raw = await this.fs.readFile(filePath, "utf-8");
3674
+ return JSON.parse(raw);
3675
+ }
3676
+ async writeEvaluator(projectPath, evaluator) {
3677
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators");
3678
+ await this.safeMkdir(dir);
3679
+ await this.fs.writeFile(this.fs.path.join(dir, evaluator.fileName), `${JSON.stringify(evaluator, null, 2)}
3680
+ `);
3681
+ }
3682
+ async listEvaluators(projectPath) {
3683
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators");
3684
+ const [error, files] = await catchError(this.fs.readdir(dir));
3685
+ if (error) {
3686
+ return [];
3687
+ }
3688
+ const evaluators = [];
3689
+ for (const file of files) {
3690
+ if (file.endsWith(".json")) {
3691
+ const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
3692
+ evaluators.push(JSON.parse(raw));
3693
+ }
3694
+ }
3695
+ return evaluators;
3696
+ }
3697
+ async deleteEvaluator(projectPath, fileName) {
3698
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "evaluators", fileName);
3699
+ await this.fs.rm(filePath);
3700
+ }
3701
+ async readEvalSet(projectPath, fileName) {
3702
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets", fileName);
3703
+ const raw = await this.fs.readFile(filePath, "utf-8");
3704
+ return JSON.parse(raw);
3705
+ }
3706
+ async writeEvalSet(projectPath, evalSet, fileName) {
3707
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets");
3708
+ await this.safeMkdir(dir);
3709
+ await this.fs.writeFile(this.fs.path.join(dir, fileName), `${JSON.stringify(evalSet, null, 2)}
3710
+ `);
3711
+ }
3712
+ async listEvalSets(projectPath) {
3713
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets");
3714
+ const [error, files] = await catchError(this.fs.readdir(dir));
3715
+ if (error) {
3716
+ return [];
3717
+ }
3718
+ const sets = [];
3719
+ for (const file of files) {
3720
+ if (file.endsWith(".json")) {
3721
+ const raw = await this.fs.readFile(this.fs.path.join(dir, file), "utf-8");
3722
+ sets.push(JSON.parse(raw));
3723
+ }
3724
+ }
3725
+ return sets;
4028
3726
  }
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;
3727
+ async deleteEvalSet(projectPath, fileName) {
3728
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "evals", "eval-sets", fileName);
3729
+ await this.fs.rm(filePath);
4043
3730
  }
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}`);
3731
+ async writeFeature(projectPath, featureName, feature) {
3732
+ this.validateFeatureName(featureName);
3733
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName);
3734
+ await this.safeMkdir(dir);
3735
+ await this.fs.writeFile(this.fs.path.join(dir, "feature.json"), `${JSON.stringify(feature, null, 2)}
3736
+ `);
4048
3737
  }
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");
3738
+ async readFeature(projectPath, featureName) {
3739
+ this.validateFeatureName(featureName);
3740
+ const filePath = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName, "feature.json");
3741
+ const raw = await this.fs.readFile(filePath, "utf-8");
3742
+ if (!raw) {
3743
+ throw new Error(`Feature file not found: ${filePath}`);
4057
3744
  }
4058
- const content = await fs.readFile(fileBufferOrPath);
4059
- if (content === null) {
4060
- throw new Error(`Failed to read file: ${fileBufferOrPath}`);
3745
+ const parsed = JSON.parse(raw);
3746
+ if (!parsed) {
3747
+ throw new Error(`Feature file is empty: ${filePath}`);
4061
3748
  }
4062
- fileBuffer = new Uint8Array(content);
4063
- fileName = fs.path.basename(fileBufferOrPath);
4064
- } else {
4065
- fileBuffer = fileBufferOrPath;
4066
- fileName = "solution.uis";
3749
+ return parsed;
4067
3750
  }
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;
3751
+ async listFeatureDirs(projectPath) {
3752
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "features");
3753
+ const [error, entries] = await catchError(this.fs.readdir(dir));
3754
+ if (error) {
3755
+ return [];
4074
3756
  }
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;
3757
+ return entries;
3758
+ }
3759
+ async deleteFeature(projectPath, featureName) {
3760
+ this.validateFeatureName(featureName);
3761
+ const dir = this.fs.path.join(this.getAgentDir(projectPath), "features", featureName);
3762
+ await this.fs.rm(dir);
3763
+ }
3764
+ async safeMkdir(dir) {
3765
+ await this.fs.mkdir(dir);
3766
+ }
3767
+ async writeJsonFile(filePath, data) {
3768
+ await this.fs.writeFile(filePath, `${JSON.stringify(data, null, 2)}
3769
+ `);
3770
+ }
3771
+ validateFeatureName(featureName) {
3772
+ if (featureName.trim().length === 0 || featureName === "." || featureName === ".." || featureName.includes("/") || featureName.includes("\\") || featureName.includes("\x00") || featureName !== this.fs.path.basename(featureName)) {
3773
+ throw new Error(`Invalid feature name: "${featureName}"`);
4079
3774
  }
4080
3775
  }
4081
- logger.info("Importing new solution to Studio Web...");
4082
- return importSolution(config, organizationName, fileBuffer, fileName);
4083
3776
  }
3777
+
4084
3778
  // src/services/pack-helpers.ts
4085
3779
  var import_adm_zip = __toESM(require_adm_zip(), 1);
4086
3780
  async function collectProjectFiles(rootDir) {
@@ -4130,13 +3824,6 @@ async function createArchive(sourceDir, outputPath, exclude) {
4130
3824
  }
4131
3825
  zip.writeZip(outputPath);
4132
3826
  }
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
3827
 
4141
3828
  // src/services/agent-local-workspace-eval-preparer.ts
4142
3829
  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 +4174,6 @@ function parseOutput(outputArguments) {
4487
4174
  return error ? outputArguments : parsed;
4488
4175
  }
4489
4176
 
4490
- export { Configuration, ConfigurationsApi, DeploymentsApi, PackagesApi, createArchive, extractArchive, resolveStudioWebConfig, AgentLocalWorkspaceEvalPreparer, AgentDebugCancelledError, AgentDebugService };
4177
+ export { StudioWebIncompatibleProjectError, isSolutionUploadHttpError, buildSolutionUploadFailureOutput, migrateLegacyToolGuardrailPolicies, AgentProjectService, resolveStudioWebConfig, AgentLocalWorkspaceEvalPreparer, AgentDebugCancelledError, AgentDebugService };
4491
4178
 
4492
- //# debugId=984A753BD1DBCA2064756E2164756E21
4179
+ //# debugId=2093FF1DAB75AB6164756E2164756E21