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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/deploy.d.ts +6 -1
  2. package/dist/deploy.js +15 -16
  3. package/dist/{index-2fj08e7n.js → index-gpd94m28.js} +27 -27
  4. package/dist/{index-w03qc9m8.js → index-sby22td6.js} +4 -4
  5. package/dist/index.js +16 -19
  6. package/dist/init.js +10 -13
  7. package/dist/{js-yaml-4ypbq2tt.js → js-yaml-b2jq67kn.js} +16 -16
  8. package/dist/{list-skbehtq2.js → list-3mrc9s3f.js} +7 -11
  9. package/dist/models/pack-command-types.d.ts +8 -0
  10. package/dist/pack.js +9 -12
  11. package/dist/{packager-tool-krd5v2r5.js → packager-tool-0qva0ebq.js} +129 -53
  12. package/dist/{packager-tool-0v6na3yp.js → packager-tool-1de529jm.js} +9 -7
  13. package/dist/{packager-tool-9vehmnke.js → packager-tool-3hbsdwjm.js} +6 -661
  14. package/dist/{packager-tool-fzwxq48d.js → packager-tool-3y92zbg2.js} +3 -3
  15. package/dist/{packager-tool-f7kj5fpa.js → packager-tool-5pfxgc8z.js} +19 -11
  16. package/dist/{packager-tool-9w3k4e77.js → packager-tool-b16qemg2.js} +494 -198
  17. package/dist/{packager-tool-zbp5p149.js → packager-tool-bahvrjbv.js} +592 -264
  18. package/dist/{packager-tool-129wn232.js → packager-tool-dfrk01gn.js} +198 -2
  19. package/dist/{packager-tool-67ssxgph.js → packager-tool-fh8pb2th.js} +3 -5
  20. package/dist/{packager-tool-c29pg93e.js → packager-tool-hc6ybtdw.js} +5 -5
  21. package/dist/{packager-tool-bcpknnr8.js → packager-tool-hgx66d1p.js} +1656 -558
  22. package/dist/{packager-tool-2yz7m5ny.js → packager-tool-nq2nq71y.js} +21282 -20197
  23. package/dist/{packager-tool-wjhn59ft.js → packager-tool-t89r1edr.js} +596 -180
  24. package/dist/{packager-tool-vpr77gre.js → packager-tool-x3ehbhsn.js} +3 -2
  25. package/dist/{packager-tool-yktm4v4r.js → packager-tool-xntjj1bt.js} +1 -1
  26. package/dist/packager-tool.d.ts +4 -3
  27. package/dist/packager-tool.js +4 -4
  28. package/dist/publish.js +8 -11
  29. package/dist/resource.js +7 -10
  30. package/dist/services/activation.d.ts +9 -1
  31. package/dist/services/deploy-run-service.d.ts +25 -1
  32. package/dist/services/deploy-uninstall-service.d.ts +20 -1
  33. package/dist/services/deploy-upgrade-service.d.ts +94 -0
  34. package/dist/services/deployment-feed-locator.d.ts +36 -0
  35. package/dist/services/deployment-search.d.ts +88 -7
  36. package/dist/services/pack-command-service.d.ts +15 -0
  37. package/dist/services/package-metadata-rewrite.d.ts +9 -5
  38. package/dist/services/publish-service.d.ts +11 -9
  39. package/dist/services/solution-path.d.ts +34 -0
  40. package/dist/templates/AGENTS.md +183 -16
  41. package/dist/tool.js +18 -21
  42. package/package.json +2 -2
  43. package/dist/browser-strategy-yccf8mtd.js +0 -99
  44. package/dist/node-strategy-12qfy0nv.js +0 -348
  45. package/dist/packager-tool-5arsyj36.js +0 -11
  46. package/dist/packager-tool-7eva0peq.js +0 -265
  47. package/dist/packager-tool-9qecd4wb.js +0 -14
@@ -4,39 +4,41 @@ import {
4
4
  feedResolutionFailureInstructions,
5
5
  feedScopeInitOverride,
6
6
  folderKeyInitOverride,
7
+ listSelectablePublishLocations,
7
8
  resolveFeedScope,
8
9
  resolvePersonalWorkspace
9
- } from "./packager-tool-c29pg93e.js";
10
+ } from "./packager-tool-hc6ybtdw.js";
10
11
  import {
11
12
  Configuration as Configuration2,
13
+ DeploymentOperationStatus,
14
+ DeploymentsApi,
12
15
  SearchApi,
16
+ SolutionDeploymentAction,
13
17
  deploymentsAutoInstall,
14
18
  searchPackageVersions
15
- } from "./packager-tool-9w3k4e77.js";
19
+ } from "./packager-tool-b16qemg2.js";
16
20
  import {
17
21
  getSolutionAuthContext,
18
22
  resolveFolder
19
- } from "./packager-tool-fzwxq48d.js";
23
+ } from "./packager-tool-3y92zbg2.js";
20
24
  import {
21
25
  DEFAULT_PAGE_SIZE,
22
26
  PollOutcome,
23
27
  catchError,
24
28
  extractErrorDetails,
29
+ getFileSystem,
25
30
  logger,
26
31
  mapPollFailure,
27
32
  pollUntil,
28
33
  processContext
29
- } from "./packager-tool-bcpknnr8.js";
30
- import {
31
- getFileSystem
32
- } from "./packager-tool-7eva0peq.js";
34
+ } from "./packager-tool-hgx66d1p.js";
33
35
  import {
34
36
  __commonJS,
35
37
  __require
36
- } from "./packager-tool-0v6na3yp.js";
38
+ } from "./packager-tool-1de529jm.js";
37
39
 
38
40
  // ../../node_modules/yaml/dist/nodes/identity.js
39
- var require_identity = __commonJS((exports) => {
41
+ var require_identity = __commonJS(function(exports) {
40
42
  var ALIAS = Symbol.for("yaml.alias");
41
43
  var DOC = Symbol.for("yaml.document");
42
44
  var MAP = Symbol.for("yaml.map");
@@ -90,7 +92,7 @@ var require_identity = __commonJS((exports) => {
90
92
  });
91
93
 
92
94
  // ../../node_modules/yaml/dist/visit.js
93
- var require_visit = __commonJS((exports) => {
95
+ var require_visit = __commonJS(function(exports) {
94
96
  var identity = require_identity();
95
97
  var BREAK = Symbol("break visit");
96
98
  var SKIP = Symbol("skip children");
@@ -245,7 +247,7 @@ var require_visit = __commonJS((exports) => {
245
247
  });
246
248
 
247
249
  // ../../node_modules/yaml/dist/doc/directives.js
248
- var require_directives = __commonJS((exports) => {
250
+ var require_directives = __commonJS(function(exports) {
249
251
  var identity = require_identity();
250
252
  var visit = require_visit();
251
253
  var escapeChars = {
@@ -397,7 +399,7 @@ var require_directives = __commonJS((exports) => {
397
399
  });
398
400
 
399
401
  // ../../node_modules/yaml/dist/doc/anchors.js
400
- var require_anchors = __commonJS((exports) => {
402
+ var require_anchors = __commonJS(function(exports) {
401
403
  var identity = require_identity();
402
404
  var visit = require_visit();
403
405
  function anchorIsValid(anchor) {
@@ -459,7 +461,7 @@ var require_anchors = __commonJS((exports) => {
459
461
  });
460
462
 
461
463
  // ../../node_modules/yaml/dist/doc/applyReviver.js
462
- var require_applyReviver = __commonJS((exports) => {
464
+ var require_applyReviver = __commonJS(function(exports) {
463
465
  function applyReviver(reviver, obj, key, val) {
464
466
  if (val && typeof val === "object") {
465
467
  if (Array.isArray(val)) {
@@ -506,7 +508,7 @@ var require_applyReviver = __commonJS((exports) => {
506
508
  });
507
509
 
508
510
  // ../../node_modules/yaml/dist/nodes/toJS.js
509
- var require_toJS = __commonJS((exports) => {
511
+ var require_toJS = __commonJS(function(exports) {
510
512
  var identity = require_identity();
511
513
  function toJS(value, arg, ctx) {
512
514
  if (Array.isArray(value))
@@ -533,7 +535,7 @@ var require_toJS = __commonJS((exports) => {
533
535
  });
534
536
 
535
537
  // ../../node_modules/yaml/dist/nodes/Node.js
536
- var require_Node = __commonJS((exports) => {
538
+ var require_Node = __commonJS(function(exports) {
537
539
  var applyReviver = require_applyReviver();
538
540
  var identity = require_identity();
539
541
  var toJS = require_toJS();
@@ -570,7 +572,7 @@ var require_Node = __commonJS((exports) => {
570
572
  });
571
573
 
572
574
  // ../../node_modules/yaml/dist/nodes/Alias.js
573
- var require_Alias = __commonJS((exports) => {
575
+ var require_Alias = __commonJS(function(exports) {
574
576
  var anchors = require_anchors();
575
577
  var visit = require_visit();
576
578
  var identity = require_identity();
@@ -680,7 +682,7 @@ var require_Alias = __commonJS((exports) => {
680
682
  });
681
683
 
682
684
  // ../../node_modules/yaml/dist/nodes/Scalar.js
683
- var require_Scalar = __commonJS((exports) => {
685
+ var require_Scalar = __commonJS(function(exports) {
684
686
  var identity = require_identity();
685
687
  var Node = require_Node();
686
688
  var toJS = require_toJS();
@@ -708,7 +710,7 @@ var require_Scalar = __commonJS((exports) => {
708
710
  });
709
711
 
710
712
  // ../../node_modules/yaml/dist/doc/createNode.js
711
- var require_createNode = __commonJS((exports) => {
713
+ var require_createNode = __commonJS(function(exports) {
712
714
  var Alias = require_Alias();
713
715
  var identity = require_identity();
714
716
  var Scalar = require_Scalar();
@@ -780,7 +782,7 @@ var require_createNode = __commonJS((exports) => {
780
782
  });
781
783
 
782
784
  // ../../node_modules/yaml/dist/nodes/Collection.js
783
- var require_Collection = __commonJS((exports) => {
785
+ var require_Collection = __commonJS(function(exports) {
784
786
  var createNode = require_createNode();
785
787
  var identity = require_identity();
786
788
  var Node = require_Node();
@@ -895,7 +897,7 @@ var require_Collection = __commonJS((exports) => {
895
897
  });
896
898
 
897
899
  // ../../node_modules/yaml/dist/stringify/stringifyComment.js
898
- var require_stringifyComment = __commonJS((exports) => {
900
+ var require_stringifyComment = __commonJS(function(exports) {
899
901
  var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
900
902
  function indentComment(comment, indent) {
901
903
  if (/^\n+$/.test(comment))
@@ -912,7 +914,7 @@ var require_stringifyComment = __commonJS((exports) => {
912
914
  });
913
915
 
914
916
  // ../../node_modules/yaml/dist/stringify/foldFlowLines.js
915
- var require_foldFlowLines = __commonJS((exports) => {
917
+ var require_foldFlowLines = __commonJS(function(exports) {
916
918
  var FOLD_FLOW = "flow";
917
919
  var FOLD_BLOCK = "block";
918
920
  var FOLD_QUOTED = "quoted";
@@ -1049,7 +1051,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
1049
1051
  });
1050
1052
 
1051
1053
  // ../../node_modules/yaml/dist/stringify/stringifyString.js
1052
- var require_stringifyString = __commonJS((exports) => {
1054
+ var require_stringifyString = __commonJS(function(exports) {
1053
1055
  var Scalar = require_Scalar();
1054
1056
  var foldFlowLines = require_foldFlowLines();
1055
1057
  var getFoldOptions = (ctx, isBlock) => ({
@@ -1347,7 +1349,7 @@ ${indent}`);
1347
1349
  });
1348
1350
 
1349
1351
  // ../../node_modules/yaml/dist/stringify/stringify.js
1350
- var require_stringify = __commonJS((exports) => {
1352
+ var require_stringify = __commonJS(function(exports) {
1351
1353
  var anchors = require_anchors();
1352
1354
  var identity = require_identity();
1353
1355
  var stringifyComment = require_stringifyComment();
@@ -1468,7 +1470,7 @@ ${ctx.indent}${str}`;
1468
1470
  });
1469
1471
 
1470
1472
  // ../../node_modules/yaml/dist/stringify/stringifyPair.js
1471
- var require_stringifyPair = __commonJS((exports) => {
1473
+ var require_stringifyPair = __commonJS(function(exports) {
1472
1474
  var identity = require_identity();
1473
1475
  var Scalar = require_Scalar();
1474
1476
  var stringify = require_stringify();
@@ -1604,7 +1606,7 @@ ${ctx.indent}`;
1604
1606
  });
1605
1607
 
1606
1608
  // ../../node_modules/yaml/dist/log.js
1607
- var require_log = __commonJS((exports) => {
1609
+ var require_log = __commonJS(function(exports) {
1608
1610
  var node_process = __require("process");
1609
1611
  function debug(logLevel, ...messages) {
1610
1612
  if (logLevel === "debug")
@@ -1623,7 +1625,7 @@ var require_log = __commonJS((exports) => {
1623
1625
  });
1624
1626
 
1625
1627
  // ../../node_modules/yaml/dist/schema/yaml-1.1/merge.js
1626
- var require_merge = __commonJS((exports) => {
1628
+ var require_merge = __commonJS(function(exports) {
1627
1629
  var identity = require_identity();
1628
1630
  var Scalar = require_Scalar();
1629
1631
  var MERGE_KEY = "<<";
@@ -1680,7 +1682,7 @@ var require_merge = __commonJS((exports) => {
1680
1682
  });
1681
1683
 
1682
1684
  // ../../node_modules/yaml/dist/nodes/addPairToJSMap.js
1683
- var require_addPairToJSMap = __commonJS((exports) => {
1685
+ var require_addPairToJSMap = __commonJS(function(exports) {
1684
1686
  var log = require_log();
1685
1687
  var merge = require_merge();
1686
1688
  var stringify = require_stringify();
@@ -1741,7 +1743,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
1741
1743
  });
1742
1744
 
1743
1745
  // ../../node_modules/yaml/dist/nodes/Pair.js
1744
- var require_Pair = __commonJS((exports) => {
1746
+ var require_Pair = __commonJS(function(exports) {
1745
1747
  var createNode = require_createNode();
1746
1748
  var stringifyPair = require_stringifyPair();
1747
1749
  var addPairToJSMap = require_addPairToJSMap();
@@ -1779,7 +1781,7 @@ var require_Pair = __commonJS((exports) => {
1779
1781
  });
1780
1782
 
1781
1783
  // ../../node_modules/yaml/dist/stringify/stringifyCollection.js
1782
- var require_stringifyCollection = __commonJS((exports) => {
1784
+ var require_stringifyCollection = __commonJS(function(exports) {
1783
1785
  var identity = require_identity();
1784
1786
  var stringify = require_stringify();
1785
1787
  var stringifyComment = require_stringifyComment();
@@ -1931,7 +1933,7 @@ ${indent}${end}`;
1931
1933
  });
1932
1934
 
1933
1935
  // ../../node_modules/yaml/dist/nodes/YAMLMap.js
1934
- var require_YAMLMap = __commonJS((exports) => {
1936
+ var require_YAMLMap = __commonJS(function(exports) {
1935
1937
  var stringifyCollection = require_stringifyCollection();
1936
1938
  var addPairToJSMap = require_addPairToJSMap();
1937
1939
  var Collection = require_Collection();
@@ -2058,7 +2060,7 @@ var require_YAMLMap = __commonJS((exports) => {
2058
2060
  });
2059
2061
 
2060
2062
  // ../../node_modules/yaml/dist/schema/common/map.js
2061
- var require_map = __commonJS((exports) => {
2063
+ var require_map = __commonJS(function(exports) {
2062
2064
  var identity = require_identity();
2063
2065
  var YAMLMap = require_YAMLMap();
2064
2066
  var map = {
@@ -2077,7 +2079,7 @@ var require_map = __commonJS((exports) => {
2077
2079
  });
2078
2080
 
2079
2081
  // ../../node_modules/yaml/dist/nodes/YAMLSeq.js
2080
- var require_YAMLSeq = __commonJS((exports) => {
2082
+ var require_YAMLSeq = __commonJS(function(exports) {
2081
2083
  var createNode = require_createNode();
2082
2084
  var stringifyCollection = require_stringifyCollection();
2083
2085
  var Collection = require_Collection();
@@ -2170,7 +2172,7 @@ var require_YAMLSeq = __commonJS((exports) => {
2170
2172
  });
2171
2173
 
2172
2174
  // ../../node_modules/yaml/dist/schema/common/seq.js
2173
- var require_seq = __commonJS((exports) => {
2175
+ var require_seq = __commonJS(function(exports) {
2174
2176
  var identity = require_identity();
2175
2177
  var YAMLSeq = require_YAMLSeq();
2176
2178
  var seq = {
@@ -2189,7 +2191,7 @@ var require_seq = __commonJS((exports) => {
2189
2191
  });
2190
2192
 
2191
2193
  // ../../node_modules/yaml/dist/schema/common/string.js
2192
- var require_string = __commonJS((exports) => {
2194
+ var require_string = __commonJS(function(exports) {
2193
2195
  var stringifyString = require_stringifyString();
2194
2196
  var string = {
2195
2197
  identify: (value) => typeof value === "string",
@@ -2205,7 +2207,7 @@ var require_string = __commonJS((exports) => {
2205
2207
  });
2206
2208
 
2207
2209
  // ../../node_modules/yaml/dist/schema/common/null.js
2208
- var require_null = __commonJS((exports) => {
2210
+ var require_null = __commonJS(function(exports) {
2209
2211
  var Scalar = require_Scalar();
2210
2212
  var nullTag = {
2211
2213
  identify: (value) => value == null,
@@ -2220,7 +2222,7 @@ var require_null = __commonJS((exports) => {
2220
2222
  });
2221
2223
 
2222
2224
  // ../../node_modules/yaml/dist/schema/core/bool.js
2223
- var require_bool = __commonJS((exports) => {
2225
+ var require_bool = __commonJS(function(exports) {
2224
2226
  var Scalar = require_Scalar();
2225
2227
  var boolTag = {
2226
2228
  identify: (value) => typeof value === "boolean",
@@ -2241,7 +2243,7 @@ var require_bool = __commonJS((exports) => {
2241
2243
  });
2242
2244
 
2243
2245
  // ../../node_modules/yaml/dist/stringify/stringifyNumber.js
2244
- var require_stringifyNumber = __commonJS((exports) => {
2246
+ var require_stringifyNumber = __commonJS(function(exports) {
2245
2247
  function stringifyNumber({ format, minFractionDigits, tag, value }) {
2246
2248
  if (typeof value === "bigint")
2247
2249
  return String(value);
@@ -2265,7 +2267,7 @@ var require_stringifyNumber = __commonJS((exports) => {
2265
2267
  });
2266
2268
 
2267
2269
  // ../../node_modules/yaml/dist/schema/core/float.js
2268
- var require_float = __commonJS((exports) => {
2270
+ var require_float = __commonJS(function(exports) {
2269
2271
  var Scalar = require_Scalar();
2270
2272
  var stringifyNumber = require_stringifyNumber();
2271
2273
  var floatNaN = {
@@ -2308,7 +2310,7 @@ var require_float = __commonJS((exports) => {
2308
2310
  });
2309
2311
 
2310
2312
  // ../../node_modules/yaml/dist/schema/core/int.js
2311
- var require_int = __commonJS((exports) => {
2313
+ var require_int = __commonJS(function(exports) {
2312
2314
  var stringifyNumber = require_stringifyNumber();
2313
2315
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
2314
2316
  var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
@@ -2350,7 +2352,7 @@ var require_int = __commonJS((exports) => {
2350
2352
  });
2351
2353
 
2352
2354
  // ../../node_modules/yaml/dist/schema/core/schema.js
2353
- var require_schema = __commonJS((exports) => {
2355
+ var require_schema = __commonJS(function(exports) {
2354
2356
  var map = require_map();
2355
2357
  var _null = require_null();
2356
2358
  var seq = require_seq();
@@ -2375,7 +2377,7 @@ var require_schema = __commonJS((exports) => {
2375
2377
  });
2376
2378
 
2377
2379
  // ../../node_modules/yaml/dist/schema/json/schema.js
2378
- var require_schema2 = __commonJS((exports) => {
2380
+ var require_schema2 = __commonJS(function(exports) {
2379
2381
  var Scalar = require_Scalar();
2380
2382
  var map = require_map();
2381
2383
  var seq = require_seq();
@@ -2439,7 +2441,7 @@ var require_schema2 = __commonJS((exports) => {
2439
2441
  });
2440
2442
 
2441
2443
  // ../../node_modules/yaml/dist/schema/yaml-1.1/binary.js
2442
- var require_binary = __commonJS((exports) => {
2444
+ var require_binary = __commonJS(function(exports) {
2443
2445
  var node_buffer = __require("buffer");
2444
2446
  var Scalar = require_Scalar();
2445
2447
  var stringifyString = require_stringifyString();
@@ -2494,7 +2496,7 @@ var require_binary = __commonJS((exports) => {
2494
2496
  });
2495
2497
 
2496
2498
  // ../../node_modules/yaml/dist/schema/yaml-1.1/pairs.js
2497
- var require_pairs = __commonJS((exports) => {
2499
+ var require_pairs = __commonJS(function(exports) {
2498
2500
  var identity = require_identity();
2499
2501
  var Pair = require_Pair();
2500
2502
  var Scalar = require_Scalar();
@@ -2569,7 +2571,7 @@ ${cn.comment}` : item.comment;
2569
2571
  });
2570
2572
 
2571
2573
  // ../../node_modules/yaml/dist/schema/yaml-1.1/omap.js
2572
- var require_omap = __commonJS((exports) => {
2574
+ var require_omap = __commonJS(function(exports) {
2573
2575
  var identity = require_identity();
2574
2576
  var toJS = require_toJS();
2575
2577
  var YAMLMap = require_YAMLMap();
@@ -2641,7 +2643,7 @@ var require_omap = __commonJS((exports) => {
2641
2643
  });
2642
2644
 
2643
2645
  // ../../node_modules/yaml/dist/schema/yaml-1.1/bool.js
2644
- var require_bool2 = __commonJS((exports) => {
2646
+ var require_bool2 = __commonJS(function(exports) {
2645
2647
  var Scalar = require_Scalar();
2646
2648
  function boolStringify({ value, source }, ctx) {
2647
2649
  const boolObj = value ? trueTag : falseTag;
@@ -2670,7 +2672,7 @@ var require_bool2 = __commonJS((exports) => {
2670
2672
  });
2671
2673
 
2672
2674
  // ../../node_modules/yaml/dist/schema/yaml-1.1/float.js
2673
- var require_float2 = __commonJS((exports) => {
2675
+ var require_float2 = __commonJS(function(exports) {
2674
2676
  var Scalar = require_Scalar();
2675
2677
  var stringifyNumber = require_stringifyNumber();
2676
2678
  var floatNaN = {
@@ -2716,7 +2718,7 @@ var require_float2 = __commonJS((exports) => {
2716
2718
  });
2717
2719
 
2718
2720
  // ../../node_modules/yaml/dist/schema/yaml-1.1/int.js
2719
- var require_int2 = __commonJS((exports) => {
2721
+ var require_int2 = __commonJS(function(exports) {
2720
2722
  var stringifyNumber = require_stringifyNumber();
2721
2723
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
2722
2724
  function intResolve(str, offset, radix, { intAsBigInt }) {
@@ -2792,7 +2794,7 @@ var require_int2 = __commonJS((exports) => {
2792
2794
  });
2793
2795
 
2794
2796
  // ../../node_modules/yaml/dist/schema/yaml-1.1/set.js
2795
- var require_set = __commonJS((exports) => {
2797
+ var require_set = __commonJS(function(exports) {
2796
2798
  var identity = require_identity();
2797
2799
  var Pair = require_Pair();
2798
2800
  var YAMLMap = require_YAMLMap();
@@ -2875,7 +2877,7 @@ var require_set = __commonJS((exports) => {
2875
2877
  });
2876
2878
 
2877
2879
  // ../../node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
2878
- var require_timestamp = __commonJS((exports) => {
2880
+ var require_timestamp = __commonJS(function(exports) {
2879
2881
  var stringifyNumber = require_stringifyNumber();
2880
2882
  function parseSexagesimal(str, asBigInt) {
2881
2883
  const sign = str[0];
@@ -2957,7 +2959,7 @@ var require_timestamp = __commonJS((exports) => {
2957
2959
  });
2958
2960
 
2959
2961
  // ../../node_modules/yaml/dist/schema/yaml-1.1/schema.js
2960
- var require_schema3 = __commonJS((exports) => {
2962
+ var require_schema3 = __commonJS(function(exports) {
2961
2963
  var map = require_map();
2962
2964
  var _null = require_null();
2963
2965
  var seq = require_seq();
@@ -2998,7 +3000,7 @@ var require_schema3 = __commonJS((exports) => {
2998
3000
  });
2999
3001
 
3000
3002
  // ../../node_modules/yaml/dist/schema/tags.js
3001
- var require_tags = __commonJS((exports) => {
3003
+ var require_tags = __commonJS(function(exports) {
3002
3004
  var map = require_map();
3003
3005
  var _null = require_null();
3004
3006
  var seq = require_seq();
@@ -3089,7 +3091,7 @@ var require_tags = __commonJS((exports) => {
3089
3091
  });
3090
3092
 
3091
3093
  // ../../node_modules/yaml/dist/schema/Schema.js
3092
- var require_Schema = __commonJS((exports) => {
3094
+ var require_Schema = __commonJS(function(exports) {
3093
3095
  var identity = require_identity();
3094
3096
  var map = require_map();
3095
3097
  var seq = require_seq();
@@ -3119,7 +3121,7 @@ var require_Schema = __commonJS((exports) => {
3119
3121
  });
3120
3122
 
3121
3123
  // ../../node_modules/yaml/dist/stringify/stringifyDocument.js
3122
- var require_stringifyDocument = __commonJS((exports) => {
3124
+ var require_stringifyDocument = __commonJS(function(exports) {
3123
3125
  var identity = require_identity();
3124
3126
  var stringify = require_stringify();
3125
3127
  var stringifyComment = require_stringifyComment();
@@ -3199,7 +3201,7 @@ var require_stringifyDocument = __commonJS((exports) => {
3199
3201
  });
3200
3202
 
3201
3203
  // ../../node_modules/yaml/dist/doc/Document.js
3202
- var require_Document = __commonJS((exports) => {
3204
+ var require_Document = __commonJS(function(exports) {
3203
3205
  var Alias = require_Alias();
3204
3206
  var Collection = require_Collection();
3205
3207
  var identity = require_identity();
@@ -3434,7 +3436,7 @@ var require_Document = __commonJS((exports) => {
3434
3436
  });
3435
3437
 
3436
3438
  // ../../node_modules/yaml/dist/errors.js
3437
- var require_errors = __commonJS((exports) => {
3439
+ var require_errors = __commonJS(function(exports) {
3438
3440
  class YAMLError extends Error {
3439
3441
  constructor(name, pos, code, message) {
3440
3442
  super();
@@ -3499,7 +3501,7 @@ ${pointer}
3499
3501
  });
3500
3502
 
3501
3503
  // ../../node_modules/yaml/dist/compose/resolve-props.js
3502
- var require_resolve_props = __commonJS((exports) => {
3504
+ var require_resolve_props = __commonJS(function(exports) {
3503
3505
  function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
3504
3506
  let spaceBefore = false;
3505
3507
  let atNewline = startOnNewline;
@@ -3629,7 +3631,7 @@ var require_resolve_props = __commonJS((exports) => {
3629
3631
  });
3630
3632
 
3631
3633
  // ../../node_modules/yaml/dist/compose/util-contains-newline.js
3632
- var require_util_contains_newline = __commonJS((exports) => {
3634
+ var require_util_contains_newline = __commonJS(function(exports) {
3633
3635
  function containsNewline(key) {
3634
3636
  if (!key)
3635
3637
  return null;
@@ -3669,7 +3671,7 @@ var require_util_contains_newline = __commonJS((exports) => {
3669
3671
  });
3670
3672
 
3671
3673
  // ../../node_modules/yaml/dist/compose/util-flow-indent-check.js
3672
- var require_util_flow_indent_check = __commonJS((exports) => {
3674
+ var require_util_flow_indent_check = __commonJS(function(exports) {
3673
3675
  var utilContainsNewline = require_util_contains_newline();
3674
3676
  function flowIndentCheck(indent, fc, onError) {
3675
3677
  if (fc?.type === "flow-collection") {
@@ -3684,7 +3686,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
3684
3686
  });
3685
3687
 
3686
3688
  // ../../node_modules/yaml/dist/compose/util-map-includes.js
3687
- var require_util_map_includes = __commonJS((exports) => {
3689
+ var require_util_map_includes = __commonJS(function(exports) {
3688
3690
  var identity = require_identity();
3689
3691
  function mapIncludes(ctx, items, search) {
3690
3692
  const { uniqueKeys } = ctx.options;
@@ -3697,7 +3699,7 @@ var require_util_map_includes = __commonJS((exports) => {
3697
3699
  });
3698
3700
 
3699
3701
  // ../../node_modules/yaml/dist/compose/resolve-block-map.js
3700
- var require_resolve_block_map = __commonJS((exports) => {
3702
+ var require_resolve_block_map = __commonJS(function(exports) {
3701
3703
  var Pair = require_Pair();
3702
3704
  var YAMLMap = require_YAMLMap();
3703
3705
  var resolveProps = require_resolve_props();
@@ -3804,7 +3806,7 @@ var require_resolve_block_map = __commonJS((exports) => {
3804
3806
  });
3805
3807
 
3806
3808
  // ../../node_modules/yaml/dist/compose/resolve-block-seq.js
3807
- var require_resolve_block_seq = __commonJS((exports) => {
3809
+ var require_resolve_block_seq = __commonJS(function(exports) {
3808
3810
  var YAMLSeq = require_YAMLSeq();
3809
3811
  var resolveProps = require_resolve_props();
3810
3812
  var utilFlowIndentCheck = require_util_flow_indent_check();
@@ -3852,7 +3854,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
3852
3854
  });
3853
3855
 
3854
3856
  // ../../node_modules/yaml/dist/compose/resolve-end.js
3855
- var require_resolve_end = __commonJS((exports) => {
3857
+ var require_resolve_end = __commonJS(function(exports) {
3856
3858
  function resolveEnd(end, offset, reqSpace, onError) {
3857
3859
  let comment = "";
3858
3860
  if (end) {
@@ -3892,7 +3894,7 @@ var require_resolve_end = __commonJS((exports) => {
3892
3894
  });
3893
3895
 
3894
3896
  // ../../node_modules/yaml/dist/compose/resolve-flow-collection.js
3895
- var require_resolve_flow_collection = __commonJS((exports) => {
3897
+ var require_resolve_flow_collection = __commonJS(function(exports) {
3896
3898
  var identity = require_identity();
3897
3899
  var Pair = require_Pair();
3898
3900
  var YAMLMap = require_YAMLMap();
@@ -4083,7 +4085,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
4083
4085
  });
4084
4086
 
4085
4087
  // ../../node_modules/yaml/dist/compose/compose-collection.js
4086
- var require_compose_collection = __commonJS((exports) => {
4088
+ var require_compose_collection = __commonJS(function(exports) {
4087
4089
  var identity = require_identity();
4088
4090
  var Scalar = require_Scalar();
4089
4091
  var YAMLMap = require_YAMLMap();
@@ -4145,7 +4147,7 @@ var require_compose_collection = __commonJS((exports) => {
4145
4147
  });
4146
4148
 
4147
4149
  // ../../node_modules/yaml/dist/compose/resolve-block-scalar.js
4148
- var require_resolve_block_scalar = __commonJS((exports) => {
4150
+ var require_resolve_block_scalar = __commonJS(function(exports) {
4149
4151
  var Scalar = require_Scalar();
4150
4152
  function resolveBlockScalar(ctx, scalar, onError) {
4151
4153
  const start = scalar.offset;
@@ -4338,7 +4340,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
4338
4340
  });
4339
4341
 
4340
4342
  // ../../node_modules/yaml/dist/compose/resolve-flow-scalar.js
4341
- var require_resolve_flow_scalar = __commonJS((exports) => {
4343
+ var require_resolve_flow_scalar = __commonJS(function(exports) {
4342
4344
  var Scalar = require_Scalar();
4343
4345
  var resolveEnd = require_resolve_end();
4344
4346
  function resolveFlowScalar(scalar, strict, onError) {
@@ -4555,7 +4557,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4555
4557
  });
4556
4558
 
4557
4559
  // ../../node_modules/yaml/dist/compose/compose-scalar.js
4558
- var require_compose_scalar = __commonJS((exports) => {
4560
+ var require_compose_scalar = __commonJS(function(exports) {
4559
4561
  var identity = require_identity();
4560
4562
  var Scalar = require_Scalar();
4561
4563
  var resolveBlockScalar = require_resolve_block_scalar();
@@ -4633,7 +4635,7 @@ var require_compose_scalar = __commonJS((exports) => {
4633
4635
  });
4634
4636
 
4635
4637
  // ../../node_modules/yaml/dist/compose/util-empty-scalar-position.js
4636
- var require_util_empty_scalar_position = __commonJS((exports) => {
4638
+ var require_util_empty_scalar_position = __commonJS(function(exports) {
4637
4639
  function emptyScalarPosition(offset, before, pos) {
4638
4640
  if (before) {
4639
4641
  pos ?? (pos = before.length);
@@ -4660,7 +4662,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
4660
4662
  });
4661
4663
 
4662
4664
  // ../../node_modules/yaml/dist/compose/compose-node.js
4663
- var require_compose_node = __commonJS((exports) => {
4665
+ var require_compose_node = __commonJS(function(exports) {
4664
4666
  var Alias = require_Alias();
4665
4667
  var identity = require_identity();
4666
4668
  var composeCollection = require_compose_collection();
@@ -4763,7 +4765,7 @@ var require_compose_node = __commonJS((exports) => {
4763
4765
  });
4764
4766
 
4765
4767
  // ../../node_modules/yaml/dist/compose/compose-doc.js
4766
- var require_compose_doc = __commonJS((exports) => {
4768
+ var require_compose_doc = __commonJS(function(exports) {
4767
4769
  var Document = require_Document();
4768
4770
  var composeNode = require_compose_node();
4769
4771
  var resolveEnd = require_resolve_end();
@@ -4803,7 +4805,7 @@ var require_compose_doc = __commonJS((exports) => {
4803
4805
  });
4804
4806
 
4805
4807
  // ../../node_modules/yaml/dist/compose/composer.js
4806
- var require_composer = __commonJS((exports) => {
4808
+ var require_composer = __commonJS(function(exports) {
4807
4809
  var node_process = __require("process");
4808
4810
  var directives = require_directives();
4809
4811
  var Document = require_Document();
@@ -4994,7 +4996,7 @@ ${end.comment}` : end.comment;
4994
4996
  });
4995
4997
 
4996
4998
  // ../../node_modules/yaml/dist/parse/cst-scalar.js
4997
- var require_cst_scalar = __commonJS((exports) => {
4999
+ var require_cst_scalar = __commonJS(function(exports) {
4998
5000
  var resolveBlockScalar = require_resolve_block_scalar();
4999
5001
  var resolveFlowScalar = require_resolve_flow_scalar();
5000
5002
  var errors = require_errors();
@@ -5184,7 +5186,7 @@ var require_cst_scalar = __commonJS((exports) => {
5184
5186
  });
5185
5187
 
5186
5188
  // ../../node_modules/yaml/dist/parse/cst-stringify.js
5187
- var require_cst_stringify = __commonJS((exports) => {
5189
+ var require_cst_stringify = __commonJS(function(exports) {
5188
5190
  var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
5189
5191
  function stringifyToken(token) {
5190
5192
  switch (token.type) {
@@ -5242,7 +5244,7 @@ var require_cst_stringify = __commonJS((exports) => {
5242
5244
  });
5243
5245
 
5244
5246
  // ../../node_modules/yaml/dist/parse/cst-visit.js
5245
- var require_cst_visit = __commonJS((exports) => {
5247
+ var require_cst_visit = __commonJS(function(exports) {
5246
5248
  var BREAK = Symbol("break visit");
5247
5249
  var SKIP = Symbol("skip children");
5248
5250
  var REMOVE = Symbol("remove item");
@@ -5301,7 +5303,7 @@ var require_cst_visit = __commonJS((exports) => {
5301
5303
  });
5302
5304
 
5303
5305
  // ../../node_modules/yaml/dist/parse/cst.js
5304
- var require_cst = __commonJS((exports) => {
5306
+ var require_cst = __commonJS(function(exports) {
5305
5307
  var cstScalar = require_cst_scalar();
5306
5308
  var cstStringify = require_cst_stringify();
5307
5309
  var cstVisit = require_cst_visit();
@@ -5402,7 +5404,7 @@ var require_cst = __commonJS((exports) => {
5402
5404
  });
5403
5405
 
5404
5406
  // ../../node_modules/yaml/dist/parse/lexer.js
5405
- var require_lexer = __commonJS((exports) => {
5407
+ var require_lexer = __commonJS(function(exports) {
5406
5408
  var cst = require_cst();
5407
5409
  function isEmpty(ch) {
5408
5410
  switch (ch) {
@@ -5999,7 +6001,7 @@ var require_lexer = __commonJS((exports) => {
5999
6001
  });
6000
6002
 
6001
6003
  // ../../node_modules/yaml/dist/parse/line-counter.js
6002
- var require_line_counter = __commonJS((exports) => {
6004
+ var require_line_counter = __commonJS(function(exports) {
6003
6005
  class LineCounter {
6004
6006
  constructor() {
6005
6007
  this.lineStarts = [];
@@ -6027,7 +6029,7 @@ var require_line_counter = __commonJS((exports) => {
6027
6029
  });
6028
6030
 
6029
6031
  // ../../node_modules/yaml/dist/parse/parser.js
6030
- var require_parser = __commonJS((exports) => {
6032
+ var require_parser = __commonJS(function(exports) {
6031
6033
  var node_process = __require("process");
6032
6034
  var cst = require_cst();
6033
6035
  var lexer = require_lexer();
@@ -6883,7 +6885,7 @@ var require_parser = __commonJS((exports) => {
6883
6885
  });
6884
6886
 
6885
6887
  // ../../node_modules/yaml/dist/public-api.js
6886
- var require_public_api = __commonJS((exports) => {
6888
+ var require_public_api = __commonJS(function(exports) {
6887
6889
  var composer = require_composer();
6888
6890
  var Document = require_Document();
6889
6891
  var errors = require_errors();
@@ -7173,41 +7175,70 @@ async function findDeploymentByName(auth, deploymentName, scope) {
7173
7175
  skip += values.length;
7174
7176
  }
7175
7177
  }
7176
- async function findDeploymentByPackageName(auth, packageName, folderPath, scope) {
7177
- const [lookupError, deployment] = await catchError((async () => {
7178
- const api = new SearchApi(new Configuration2({
7179
- basePath: auth.basePath,
7180
- accessToken: auth.accessToken
7181
- }));
7182
- const take = 50;
7183
- for (let skip = 0;; ) {
7184
- const result = await api.searchSearchDeployments22({
7185
- deploymentsSearchRequest2: {
7186
- searchTerm: packageName,
7187
- take,
7188
- skip,
7189
- operationStatuses: [],
7190
- activationStatuses: []
7191
- }
7192
- }, scope);
7193
- const values = result.values ?? [];
7194
- const match = values.find((deployment2) => deployment2.packageName === packageName && (folderPath === undefined || deployment2.folderPath === folderPath));
7195
- if (match) {
7196
- return match;
7178
+ async function findDeploymentsByPackageName(auth, packageName, options = {}) {
7179
+ const api = new SearchApi(new Configuration2({
7180
+ basePath: auth.basePath,
7181
+ accessToken: auth.accessToken
7182
+ }));
7183
+ const take = 50;
7184
+ const maxPages = 20;
7185
+ const matches = [];
7186
+ for (let page = 0, skip = 0;page < maxPages; page++) {
7187
+ const result = await api.searchSearchDeployments22({
7188
+ deploymentsSearchRequest2: {
7189
+ searchTerm: packageName,
7190
+ packageName,
7191
+ take,
7192
+ skip,
7193
+ operationStatuses: [],
7194
+ activationStatuses: []
7197
7195
  }
7198
- if (values.length < take) {
7199
- return;
7196
+ }, options.scope);
7197
+ const values = result.values ?? [];
7198
+ for (const deployment of values) {
7199
+ if (deployment.packageName === packageName && (options.folderPath === undefined || deployment.folderPath === options.folderPath)) {
7200
+ matches.push(deployment);
7200
7201
  }
7201
- skip += values.length;
7202
7202
  }
7203
- })());
7204
- if (lookupError) {
7205
- return;
7203
+ if (values.length < take) {
7204
+ break;
7205
+ }
7206
+ skip += values.length;
7206
7207
  }
7207
- return deployment;
7208
+ return matches;
7208
7209
  }
7209
- async function findDeploymentBestEffort(auth, deploymentName) {
7210
- const [lookupError, deployment] = await catchError(findDeploymentByName(auth, deploymentName));
7210
+ function blocksRedeploy(deployment) {
7211
+ if (deployment.operationStatus === "InProgress") {
7212
+ return true;
7213
+ }
7214
+ if (deployment.operationStatus === "Successful") {
7215
+ return deployment.operation !== "Uninstall";
7216
+ }
7217
+ if (deployment.operationStatus === "Draft" || deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
7218
+ return deployment.operation !== undefined && deployment.operation !== null && deployment.operation !== "Install";
7219
+ }
7220
+ return false;
7221
+ }
7222
+ var MAX_LISTED_DEPLOYMENTS = 5;
7223
+ function formatExistingDeployments(deployments, folderByKey) {
7224
+ const described = deployments.slice(0, MAX_LISTED_DEPLOYMENTS).map((deployment) => {
7225
+ const resolved = deployment.installedRootFolderKey ? folderByKey?.get(deployment.installedRootFolderKey) : undefined;
7226
+ const folder = resolved ?? deployment.folderPath ?? "an unknown folder";
7227
+ const current = deployment.currentPackageVersion ?? deployment.packageVersion ?? "an unknown version";
7228
+ const target = deployment.targetPackageVersion ?? deployment.newPackageVersionAvailable;
7229
+ const version = target && target !== current ? `${current} → ${target}` : current;
7230
+ const state = [
7231
+ deployment.operation,
7232
+ deployment.operationStatus,
7233
+ deployment.activationStatus
7234
+ ].filter((part) => part !== undefined && part !== null).join("/");
7235
+ return `'${deployment.name}' in ${folder} (version ${version}${state ? `, ${state}` : ""})`;
7236
+ }).join("; ");
7237
+ const remaining = deployments.length - MAX_LISTED_DEPLOYMENTS;
7238
+ return remaining > 0 ? `${described}; and ${remaining} more (see: uip solution deploy list)` : described;
7239
+ }
7240
+ async function findDeploymentBestEffort(auth, deploymentName, scope) {
7241
+ const [lookupError, deployment] = await catchError(findDeploymentByName(auth, deploymentName, scope));
7211
7242
  if (lookupError) {
7212
7243
  return;
7213
7244
  }
@@ -7265,6 +7296,9 @@ function interpretFailedDeployPoll(deployment) {
7265
7296
  return;
7266
7297
  }
7267
7298
  }
7299
+ function isSettledDeployOperationStatus(operationStatus) {
7300
+ return operationStatus === "Successful" || operationStatus === "Failed" || operationStatus === "FailedRollback";
7301
+ }
7268
7302
  function mapOperationStatusToPipelineStatus(operationStatus) {
7269
7303
  switch (operationStatus) {
7270
7304
  case "Successful":
@@ -7329,10 +7363,10 @@ async function activateDeployment(auth, deploymentName, options) {
7329
7363
  basePath: auth.basePath,
7330
7364
  accessToken: auth.accessToken
7331
7365
  }));
7332
- const [stepsError, steps] = await catchError(api.pipelinesGetPreActivateSteps({ deploymentName }));
7366
+ const [stepsError, steps] = await catchError(api.pipelinesGetPreActivateSteps({ deploymentName }, options.scope));
7333
7367
  if (stepsError) {
7334
7368
  const { message, details } = await extractErrorDetails(stepsError);
7335
- const deployment = await findDeploymentBestEffort(auth, deploymentName);
7369
+ const deployment = await findDeploymentBestEffort(auth, deploymentName, options.scope);
7336
7370
  return {
7337
7371
  kind: "RequestFailed",
7338
7372
  phase: "preActivateSteps",
@@ -7347,10 +7381,10 @@ async function activateDeployment(auth, deploymentName, options) {
7347
7381
  logger.info(` [${step.serviceName}] ${step.step}: ${step.description}`);
7348
7382
  }
7349
7383
  }
7350
- const [activateError, activateResult] = await catchError(api.pipelinesActivate({ deploymentName }));
7384
+ const [activateError, activateResult] = await catchError(api.pipelinesActivate({ deploymentName }, options.scope));
7351
7385
  if (activateError) {
7352
7386
  const { message, details } = await extractErrorDetails(activateError);
7353
- const deployment = await findDeploymentBestEffort(auth, deploymentName);
7387
+ const deployment = await findDeploymentBestEffort(auth, deploymentName, options.scope);
7354
7388
  return {
7355
7389
  kind: "RequestFailed",
7356
7390
  phase: "activate",
@@ -7364,9 +7398,7 @@ async function activateDeployment(auth, deploymentName, options) {
7364
7398
  return { kind: "NoInstance" };
7365
7399
  }
7366
7400
  const pollResult = await pollUntil({
7367
- fn: () => api.pipelinesGetDeploymentInstanceStatus({
7368
- instanceId
7369
- }),
7401
+ fn: () => api.pipelinesGetDeploymentInstanceStatus({ instanceId }, options.scope),
7370
7402
  until: (result) => TERMINAL_STATUSES.has(result.status),
7371
7403
  getStatus: (result) => result.status,
7372
7404
  label: `activate ${deploymentName}`,
@@ -7395,6 +7427,44 @@ async function activateDeployment(auth, deploymentName, options) {
7395
7427
  };
7396
7428
  }
7397
7429
 
7430
+ // src/services/deployment-feed-locator.ts
7431
+ async function nonTenantFeedKeysAsync(options) {
7432
+ const [listError, locations] = await catchError(listSelectablePublishLocations({
7433
+ tenant: options.tenant,
7434
+ loginValidity: options.loginValidity,
7435
+ envFilePath: options.envFilePath
7436
+ }));
7437
+ if (!listError) {
7438
+ const rank = (location) => location.type === "PersonalWorkspace" ? 0 : 1;
7439
+ return [...locations].filter((location) => location.type !== "Tenant" && location.key).sort((a, b) => rank(a) - rank(b)).map((location) => location.key);
7440
+ }
7441
+ const [, personalWorkspace] = await catchError(resolvePersonalWorkspace({
7442
+ tenant: options.tenant,
7443
+ loginValidity: options.loginValidity,
7444
+ envFilePath: options.envFilePath
7445
+ }));
7446
+ return personalWorkspace?.key ? [personalWorkspace.key] : [];
7447
+ }
7448
+ async function findDeploymentAcrossFeeds(auth, deploymentName, options) {
7449
+ const tenantMatch = await findDeploymentByName(auth, deploymentName);
7450
+ if (tenantMatch) {
7451
+ return { deployment: tenantMatch };
7452
+ }
7453
+ const feedKeys = await nonTenantFeedKeysAsync(options);
7454
+ for (const folderKey of feedKeys) {
7455
+ const scope = folderKeyInitOverride(folderKey);
7456
+ const [, deployment] = await catchError(findDeploymentByName(auth, deploymentName, scope));
7457
+ if (deployment) {
7458
+ return { deployment, scope };
7459
+ }
7460
+ }
7461
+ return;
7462
+ }
7463
+ async function findDeploymentAcrossFeedsBestEffort(auth, deploymentName, options) {
7464
+ const [, location] = await catchError(findDeploymentAcrossFeeds(auth, deploymentName, options));
7465
+ return location ?? undefined;
7466
+ }
7467
+
7398
7468
  // src/services/deploy-activate-service.ts
7399
7469
  var fail = (reason, message, instructions, exitCode = 1) => ({
7400
7470
  ok: false,
@@ -7413,10 +7483,16 @@ async function activateDeploymentAsync(deploymentName, options = {}) {
7413
7483
  if (authError) {
7414
7484
  return fail("auth_failed", authError.message, AUTH_INSTRUCTIONS);
7415
7485
  }
7486
+ const location = await findDeploymentAcrossFeedsBestEffort(auth, deploymentName, {
7487
+ tenant: options.tenant,
7488
+ loginValidity: options.loginValidity,
7489
+ envFilePath: options.envFilePath
7490
+ });
7416
7491
  const result = await activateDeployment(auth, deploymentName, {
7417
7492
  timeoutSeconds: options.timeout ?? 360,
7418
7493
  pollIntervalMs: options.pollInterval ?? 5000,
7419
- signal: options.signal
7494
+ signal: options.signal,
7495
+ scope: location?.scope
7420
7496
  });
7421
7497
  if (result.kind === "RequestFailed") {
7422
7498
  const fallback = result.phase === "preActivateSteps" ? `Check deployment name. Deploy first with: uip solution deploy run. Details: ${result.details}` : `Check deployment name matches an existing deployment. Details: ${result.details}`;
@@ -7727,7 +7803,9 @@ var fail3 = (reason, message, instructions, extras = {}) => ({
7727
7803
  message,
7728
7804
  instructions,
7729
7805
  exitCode: extras.exitCode ?? 1,
7730
- pipelineDeploymentId: extras.pipelineDeploymentId
7806
+ pipelineDeploymentId: extras.pipelineDeploymentId,
7807
+ errorCode: extras.errorCode,
7808
+ retry: extras.retry
7731
7809
  });
7732
7810
  function makeFolderKeyResolver(options) {
7733
7811
  return async (folderKey) => {
@@ -7748,6 +7826,7 @@ async function deployRunAsync(options) {
7748
7826
  if (authError) {
7749
7827
  return fail3("auth_failed", authError.message, authError.message);
7750
7828
  }
7829
+ let feedScope = { kind: "tenant" };
7751
7830
  if (options.personalWorkspace || options.feed !== undefined) {
7752
7831
  const [scopeError, scope] = await catchError(resolveFeedScope({
7753
7832
  personalWorkspace: options.personalWorkspace,
@@ -7759,9 +7838,14 @@ async function deployRunAsync(options) {
7759
7838
  if (scopeError) {
7760
7839
  return fail3(options.feed !== undefined ? "feed_resolution_failed" : "personal_workspace_deploy_failed", scopeError.message, "List the feeds you can deploy from with: uip solution feeds list.");
7761
7840
  }
7762
- if (scope.kind !== "tenant") {
7763
- return deployRunViaFeedAsync(auth, scope, options);
7764
- }
7841
+ feedScope = scope;
7842
+ }
7843
+ const blocked = await guardExistingDeployment(auth, options, feedScope);
7844
+ if (blocked) {
7845
+ return blocked;
7846
+ }
7847
+ if (feedScope.kind !== "tenant") {
7848
+ return deployRunViaFeedAsync(auth, feedScope, options);
7765
7849
  }
7766
7850
  const [folderError, parentFolderPath] = await catchError(resolveParentFolder({
7767
7851
  folderPath: options.parentFolderPath,
@@ -7869,8 +7953,8 @@ async function deployRunAsync(options) {
7869
7953
  if (recovery?.kind === "DeployFailed") {
7870
7954
  return fail3("deploy_failed", `Deployment '${options.deploymentName}' failed (OperationStatus: ${recovery.operationStatus}).`, `Inspect failure details with: uip solution deploy status ${pipelineDeploymentId}. Fix the underlying issue and retry: uip solution deploy run.`, { pipelineDeploymentId });
7871
7955
  }
7872
- const { reason, message, exitCode } = mapPollFailure(pollResult, "Deployment");
7873
- return fail3(reason, message, `Deployment may still be in progress. Check status with: uip solution deploy status ${pipelineDeploymentId}.`, { exitCode, pipelineDeploymentId });
7956
+ const { reason, message, exitCode, errorCode, retry } = mapPollFailure(pollResult, "Deployment");
7957
+ return fail3(reason, message, `Deployment may still be in progress. Check status with: uip solution deploy status ${pipelineDeploymentId}.`, { exitCode, pipelineDeploymentId, errorCode, retry });
7874
7958
  }
7875
7959
  const finalStatus = pollResult.data;
7876
7960
  if (!finalStatus) {
@@ -7907,8 +7991,8 @@ async function deployRunAsync(options) {
7907
7991
  return fail3("activation_request_failed", activationResult.message, appendDraftDeploymentInstructions(fallback, activationResult.deployment), { pipelineDeploymentId });
7908
7992
  }
7909
7993
  if (activationResult.kind === "PollFailed") {
7910
- const { message, exitCode } = mapPollFailure(activationResult.poll, "Activation");
7911
- return fail3("activation_poll_failed", message, `Deployment '${options.deploymentName}' was deployed successfully but activation polling did not complete. Activation may still be in progress; check with: uip solution deploy list.`, { exitCode, pipelineDeploymentId });
7994
+ const { message, exitCode, errorCode, retry } = mapPollFailure(activationResult.poll, "Activation");
7995
+ return fail3("activation_poll_failed", message, `Deployment '${options.deploymentName}' was deployed successfully but activation polling did not complete. Activation may still be in progress; check with: uip solution deploy list.`, { exitCode, pipelineDeploymentId, errorCode, retry });
7912
7996
  }
7913
7997
  if (activationResult.kind === "ActivationFailed") {
7914
7998
  return fail3("activation_failed", `Activation failed with status: ${activationResult.status}`, activationResult.errorMessage, { pipelineDeploymentId });
@@ -7935,14 +8019,78 @@ function isExistingDeploymentConflict(httpStatus, message, details, parsedErrors
7935
8019
  }
7936
8020
  return false;
7937
8021
  }
7938
- function buildDeploymentExistsInstructions(packageName, existing) {
7939
- const base = `A deployment for '${packageName}' already exists and cannot be redeployed — it must be upgraded in place. ` + "For now, open the deployment in the Orchestrator UI and use the Upgrade button. " + "Run 'uip solution deploy list' to see the pending state — the Operation and TargetPackageVersion columns show whether an upgrade is queued.";
7940
- if (!existing) {
7941
- return base;
7942
- }
7943
- const target = existing.targetPackageVersion ?? existing.newPackageVersionAvailable;
7944
- const detail = existing.currentPackageVersion && target ? ` Existing deployment '${existing.name}' is at ${existing.currentPackageVersion} and can be upgraded to ${target}.` : ` Existing deployment: '${existing.name}'.`;
7945
- return `${base}${detail}`;
8022
+ function scopeLabel(scope) {
8023
+ if (scope.kind === "personal") {
8024
+ return "your Personal Workspace";
8025
+ }
8026
+ if (scope.kind === "folder") {
8027
+ return scope.name ? `feed '${scope.name}'` : "the target feed";
8028
+ }
8029
+ return "this tenant";
8030
+ }
8031
+ function buildDeploymentExistsMessage(packageName, scope, existing, folderByKey) {
8032
+ return `Package '${packageName}' is already deployed in ${scopeLabel(scope)}. ` + "Running deploy again creates a second, separate deployment — it does not update the one that is already there. " + `Existing: ${formatExistingDeployments(existing, folderByKey)}.`;
8033
+ }
8034
+ function buildDeploymentExistsInstructions(options) {
8035
+ const { packageName, scope, existing, requestedDeploymentName } = options;
8036
+ const parts = [];
8037
+ const first = existing[0];
8038
+ const selfInflicted = requestedDeploymentName !== undefined && existing.some((d) => d.name === requestedDeploymentName);
8039
+ if (existing.length > 0 && existing.every((d) => d.operationStatus === "InProgress")) {
8040
+ parts.push(`Wait for the operation on '${first.name}' to finish, then decide whether to upgrade it or deploy a separate copy.`);
8041
+ } else if (selfInflicted) {
8042
+ parts.push(`'${requestedDeploymentName}' is the name you passed on --name, so an earlier run of this command probably created it. Check where it got to with: uip solution deploy status <pipeline-deployment-id>.`);
8043
+ } else {
8044
+ parts.push(first?.key ? `To update the existing deployment instead, upgrade it in place — running deploy again does not upgrade it: uip solution deploy upgrade ${first.key}.` : "To update the existing deployment instead, upgrade it in place with 'uip solution deploy upgrade <deployment-key>' — running deploy again does not upgrade it.");
8045
+ if (first?.name) {
8046
+ parts.push(`To remove it first, run: uip solution deploy uninstall '${first.name}' --yes.`);
8047
+ }
8048
+ }
8049
+ parts.push("To see every deployment and its state, run: uip solution deploy list.");
8050
+ parts.push(scope.kind === "tenant" ? "To create a second, separate deployment anyway, re-run this command with --yes." : "To create a second, separate deployment anyway, re-run with --yes — Orchestrator may still refuse it while the existing deployment is running or in a failed state.");
8051
+ if (existing.length === 0) {
8052
+ parts.unshift(`A deployment of '${packageName}' already exists in ${scopeLabel(scope)}.`);
8053
+ } else if (options.includeInventory) {
8054
+ parts.unshift(`Existing: ${formatExistingDeployments(existing)}.`);
8055
+ }
8056
+ return parts.join(" ");
8057
+ }
8058
+ async function resolveDeploymentFolders(deployments, options) {
8059
+ const resolveByKey = makeFolderKeyResolver(options);
8060
+ const keys = [
8061
+ ...new Set(deployments.slice(0, MAX_LISTED_DEPLOYMENTS).map((deployment) => deployment.installedRootFolderKey).filter((key) => Boolean(key)))
8062
+ ];
8063
+ const resolved = new Map;
8064
+ await Promise.all(keys.map(async (key) => {
8065
+ const [lookupError, folder] = await catchError(resolveByKey(key));
8066
+ const label = folder?.path ?? folder?.name;
8067
+ if (!lookupError && label) {
8068
+ resolved.set(key, label);
8069
+ }
8070
+ }));
8071
+ return resolved;
8072
+ }
8073
+ async function guardExistingDeployment(auth, options, scope) {
8074
+ if (options.yes) {
8075
+ return;
8076
+ }
8077
+ const [lookupError, deployments] = await catchError(findDeploymentsByPackageName(auth, options.packageName, {
8078
+ scope: feedScopeInitOverride(scope)
8079
+ }));
8080
+ if (lookupError) {
8081
+ logger.warn(`Skipped the already-deployed check for '${options.packageName}': the deployment lookup failed (${lookupError.message}). Deploying anyway — if a deployment already exists this creates a second one in its own folder. The lookup needs a user session; an application (client-credentials) login cannot read it, and 'uip solution deploy list' reads the same service so it fails the same way. Check what is already deployed in the Orchestrator Solutions UI, or sign in with 'uip login' and re-run.`);
8082
+ return;
8083
+ }
8084
+ const existing = deployments.filter(blocksRedeploy);
8085
+ if (existing.length === 0) {
8086
+ return;
8087
+ }
8088
+ return fail3("deployment_exists", buildDeploymentExistsMessage(options.packageName, scope, existing, await resolveDeploymentFolders(existing, options)), buildDeploymentExistsInstructions({
8089
+ packageName: options.packageName,
8090
+ scope,
8091
+ existing,
8092
+ requestedDeploymentName: options.deploymentName
8093
+ }));
7946
8094
  }
7947
8095
  async function deployRunViaFeedAsync(auth, scope, options) {
7948
8096
  const [locationError, location] = await catchError(resolveFeedDeployLocation(scope, options));
@@ -7964,15 +8112,22 @@ async function deployRunViaFeedAsync(auth, scope, options) {
7964
8112
  if (deployError) {
7965
8113
  const { message, details, context, parsedErrors } = await extractErrorDetails(deployError);
7966
8114
  if (isExistingDeploymentConflict(context?.httpStatus, message, details, parsedErrors)) {
7967
- const feedLookupScope = folderKeyInitOverride(scope.folderKey);
7968
- const existing = await findDeploymentByPackageName(auth, options.packageName, undefined, feedLookupScope);
7969
- return fail3("deployment_exists", message, buildDeploymentExistsInstructions(options.packageName, existing));
8115
+ const [, blockers] = await catchError(findDeploymentsByPackageName(auth, options.packageName, {
8116
+ scope: feedScopeInitOverride(scope)
8117
+ }));
8118
+ return fail3("deployment_exists", message, buildDeploymentExistsInstructions({
8119
+ packageName: options.packageName,
8120
+ scope,
8121
+ existing: blockers ?? [],
8122
+ requestedDeploymentName: options.deploymentName,
8123
+ includeInventory: true
8124
+ }));
7970
8125
  }
7971
8126
  const publishHint = isPersonal ? "uip solution publish <package> --personal-workspace" : `uip solution publish <package> --feed ${options.feed ?? "<name-or-key>"}`;
7972
8127
  return fail3(isPersonal ? "personal_workspace_deploy_failed" : "feed_deploy_failed", message, `Ensure the package was published to the target feed first: ${publishHint}. Details: ${details}`);
7973
8128
  }
7974
8129
  const target = isPersonal ? "your Personal Workspace" : `feed '${scope.name ?? location.folderFQN}'`;
7975
- return {
8130
+ const started = {
7976
8131
  ok: true,
7977
8132
  status: "DeploymentStarted",
7978
8133
  folderName: options.folderName,
@@ -7984,6 +8139,36 @@ async function deployRunViaFeedAsync(auth, scope, options) {
7984
8139
  feedKind: scope.kind,
7985
8140
  nextSteps: options.skipActivate ? `Deployment created in ${target}. Activate it with: uip solution deploy activate ${result.deploymentName}. Check status with: uip solution deploy list.` : `Deployment created in ${target} and will auto-activate. Check status with: uip solution deploy list.`
7986
8141
  };
8142
+ if (!options.wait) {
8143
+ return started;
8144
+ }
8145
+ return awaitFeedDeployAsync(auth, scope, options, started, result.deploymentName);
8146
+ }
8147
+ async function awaitFeedDeployAsync(auth, scope, options, started, deploymentName) {
8148
+ const scopeOverride = feedScopeInitOverride(scope);
8149
+ const pollResult = await pollUntil({
8150
+ fn: () => findDeploymentByName(auth, deploymentName, scopeOverride),
8151
+ until: (deployment2) => isSettledDeployOperationStatus(deployment2?.operationStatus),
8152
+ getStatus: (deployment2) => deployment2?.operationStatus ?? "Unknown",
8153
+ label: `deployment '${deploymentName}'`,
8154
+ logPrefix: "deploy",
8155
+ timeoutMs: (options.timeout ?? 360) * 1000,
8156
+ intervalMs: options.pollInterval ?? 5000,
8157
+ signal: options.signal
8158
+ });
8159
+ if (pollResult.outcome !== PollOutcome.Completed || !pollResult.data) {
8160
+ const { reason, message, exitCode, errorCode, retry } = mapPollFailure(pollResult, "Deployment");
8161
+ return fail3(reason, message, appendDraftDeploymentInstructions(`Deployment '${deploymentName}' may still be in progress. Check it with: uip solution deploy list.`, pollResult.data), { exitCode, errorCode, retry });
8162
+ }
8163
+ const deployment = pollResult.data;
8164
+ if (deployment.operationStatus !== "Successful") {
8165
+ return fail3("deploy_failed", `Deployment '${deploymentName}' failed (OperationStatus: ${deployment.operationStatus}).`, `Inspect the deployment with: uip solution deploy list, fix the underlying issue, then deploy again.`);
8166
+ }
8167
+ return {
8168
+ ...started,
8169
+ status: "DeploymentSucceeded",
8170
+ nextSteps: options.skipActivate ? started.nextSteps : undefined
8171
+ };
7987
8172
  }
7988
8173
  async function resolveFeedDeployLocation(scope, options) {
7989
8174
  const feedFolder = {
@@ -8015,12 +8200,14 @@ var TERMINAL_STATUSES3 = new Set([
8015
8200
  "SuccessfulUninstall",
8016
8201
  "FailedUninstall"
8017
8202
  ]);
8018
- var fail4 = (reason, message, instructions, exitCode = 1) => ({
8203
+ var fail4 = (reason, message, instructions, extras = {}) => ({
8019
8204
  ok: false,
8020
8205
  reason,
8021
8206
  message,
8022
8207
  instructions,
8023
- exitCode
8208
+ exitCode: extras.exitCode ?? 1,
8209
+ errorCode: extras.errorCode,
8210
+ retry: extras.retry
8024
8211
  });
8025
8212
  function requestErrorInstructions(deploymentName, errorCode, details) {
8026
8213
  switch (errorCode) {
@@ -8054,21 +8241,84 @@ function buildDeploymentStateInstructions(deployment, details) {
8054
8241
  }
8055
8242
  return `Deployment '${deployment.name}' cannot be uninstalled in its current state ${status}. Available actions: ${availableActions}. Run 'uip solution deploy list' to recheck its state, or remove it from the Orchestrator Solutions UI. Details: ${details}`;
8056
8243
  }
8057
- async function findDeploymentAcrossFeeds(auth, deploymentName, options) {
8058
- const tenantMatch = await findDeploymentByName(auth, deploymentName);
8059
- if (tenantMatch) {
8060
- return tenantMatch;
8061
- }
8062
- const [, pwMatch] = await catchError((async () => {
8063
- const scope = await resolveFeedScope({
8064
- personalWorkspace: true,
8065
- tenant: options.tenant,
8066
- loginValidity: options.loginValidity,
8067
- envFilePath: options.envFilePath
8244
+ async function waitForOperationToFinishAsync(auth, deploymentName, opts) {
8245
+ let last;
8246
+ const poll = await pollUntil({
8247
+ fn: async () => {
8248
+ last = await findDeploymentByName(auth, deploymentName, opts.scope);
8249
+ return last;
8250
+ },
8251
+ until: (deployment) => deployment !== undefined && deployment.operationStatus !== "InProgress",
8252
+ getStatus: (deployment) => deployment?.operationStatus ?? "Unknown",
8253
+ label: `deployment '${deploymentName}' to finish its current operation`,
8254
+ logPrefix: "uninstall",
8255
+ timeoutMs: opts.remainingMs(),
8256
+ intervalMs: opts.intervalMs,
8257
+ signal: opts.signal
8258
+ });
8259
+ return { outcome: poll.outcome, state: last, error: poll.error };
8260
+ }
8261
+ async function requestUninstallAsync(api, auth, deploymentName, ctx) {
8262
+ const { options, location, intervalMs, remainingMs } = ctx;
8263
+ let state = location?.deployment;
8264
+ let stateUnknown = ctx.lookupError !== undefined;
8265
+ let waited = false;
8266
+ let rechecked = false;
8267
+ for (;; ) {
8268
+ const [uninstallError, result] = await catchError(api.pipelinesUninstall({ deploymentName }, location?.scope));
8269
+ if (!uninstallError) {
8270
+ return { ok: true, result };
8271
+ }
8272
+ const { message, details, errorCode, retry } = await extractErrorDetails(uninstallError);
8273
+ if (errorCode !== "invalid_argument") {
8274
+ return fail4("uninstall_request_failed", message, requestErrorInstructions(deploymentName, errorCode, details), { errorCode, retry });
8275
+ }
8276
+ if (!rechecked && !waited && state?.operationStatus !== "InProgress") {
8277
+ rechecked = true;
8278
+ const [readError, fresh] = await catchError(findDeploymentByName(auth, deploymentName, location?.scope));
8279
+ if (!readError) {
8280
+ state = fresh;
8281
+ stateUnknown = false;
8282
+ }
8283
+ }
8284
+ if (!waited && state?.operationStatus === "InProgress") {
8285
+ waited = true;
8286
+ const wait = await waitForOperationToFinishAsync(auth, deploymentName, {
8287
+ scope: location?.scope,
8288
+ intervalMs,
8289
+ remainingMs,
8290
+ signal: options.signal
8291
+ });
8292
+ if (wait.outcome === PollOutcome.Timeout) {
8293
+ return fail4("uninstall_blocked", `Deployment '${deploymentName}' still had an operation running after ${options.timeout ?? 360}s, so it could not be uninstalled.`, buildDeploymentStateInstructions(wait.state ?? state, details), { exitCode: 2, errorCode: "timeout", retry: "RetryLater" });
8294
+ }
8295
+ if (wait.outcome !== PollOutcome.Completed) {
8296
+ const {
8297
+ reason,
8298
+ message: pollMessage,
8299
+ exitCode,
8300
+ errorCode: pollErrorCode,
8301
+ retry: pollRetry
8302
+ } = mapPollFailure(wait, "Deployment");
8303
+ return fail4(reason, pollMessage, `The deployment may still be installing. Check it with: uip solution deploy list, then retry the uninstall.`, { exitCode, errorCode: pollErrorCode, retry: pollRetry });
8304
+ }
8305
+ state = wait.state;
8306
+ stateUnknown = false;
8307
+ continue;
8308
+ }
8309
+ let instructions;
8310
+ if (stateUnknown) {
8311
+ instructions = `Check the deployment name matches an existing deployment (run 'uip solution deploy list'). Details: ${details}`;
8312
+ } else if (state) {
8313
+ instructions = buildDeploymentStateInstructions(state, details);
8314
+ } else {
8315
+ instructions = `No deployment named '${deploymentName}' was found in any feed you can reach (tenant, Personal Workspace, or a folder feed). Check the name with 'uip solution deploy list'. Details: ${details}`;
8316
+ }
8317
+ return fail4("uninstall_request_failed", message, instructions, {
8318
+ errorCode,
8319
+ retry
8068
8320
  });
8069
- return findDeploymentByName(auth, deploymentName, feedScopeInitOverride(scope));
8070
- })());
8071
- return pwMatch ?? undefined;
8321
+ }
8072
8322
  }
8073
8323
  async function uninstallDeploymentAsync(deploymentName, options = {}) {
8074
8324
  const [authError, auth] = await catchError(getSolutionAuthContext({
@@ -8083,23 +8333,24 @@ async function uninstallDeploymentAsync(deploymentName, options = {}) {
8083
8333
  basePath: auth.basePath,
8084
8334
  accessToken: auth.accessToken
8085
8335
  }));
8086
- const [uninstallError, uninstallResult] = await catchError(api.pipelinesUninstall({ deploymentName }));
8087
- if (uninstallError) {
8088
- const { message, details, errorCode } = await extractErrorDetails(uninstallError);
8089
- if (errorCode !== "invalid_argument") {
8090
- return fail4("uninstall_request_failed", message, requestErrorInstructions(deploymentName, errorCode, details));
8091
- }
8092
- const [lookupError, deployment] = await catchError(findDeploymentAcrossFeeds(auth, deploymentName, options));
8093
- let instructions;
8094
- if (lookupError) {
8095
- instructions = `Check the deployment name matches an existing deployment (run 'uip solution deploy list'). Details: ${details}`;
8096
- } else if (deployment) {
8097
- instructions = buildDeploymentStateInstructions(deployment, details);
8098
- } else {
8099
- instructions = `No deployment named '${deploymentName}' was found in your tenant or Personal Workspace. Check the name with 'uip solution deploy list'. Details: ${details}`;
8100
- }
8101
- return fail4("uninstall_request_failed", message, instructions);
8336
+ const deadline = Date.now() + (options.timeout ?? 360) * 1000;
8337
+ const intervalMs = options.pollInterval ?? 5000;
8338
+ const remainingMs = () => Math.max(deadline - Date.now(), 1);
8339
+ const [lookupError, location] = await catchError(findDeploymentAcrossFeeds(auth, deploymentName, options));
8340
+ const [requestError, requested] = await catchError(requestUninstallAsync(api, auth, deploymentName, {
8341
+ options,
8342
+ location,
8343
+ lookupError,
8344
+ intervalMs,
8345
+ remainingMs
8346
+ }));
8347
+ if (requestError) {
8348
+ throw requestError;
8102
8349
  }
8350
+ if (!requested.ok) {
8351
+ return requested;
8352
+ }
8353
+ const uninstallResult = requested.result;
8103
8354
  if (uninstallResult.complete) {
8104
8355
  return {
8105
8356
  ok: true,
@@ -8117,18 +8368,22 @@ async function uninstallDeploymentAsync(deploymentName, options = {}) {
8117
8368
  };
8118
8369
  }
8119
8370
  const pollResult = await pollUntil({
8120
- fn: () => api.pipelinesGetDeploymentInstanceStatus({ instanceId }),
8371
+ fn: () => api.pipelinesGetDeploymentInstanceStatus({ instanceId }, location?.scope),
8121
8372
  until: (result) => TERMINAL_STATUSES3.has(result.status),
8122
8373
  getStatus: (result) => result.status,
8123
8374
  label: `uninstall ${deploymentName}`,
8124
8375
  logPrefix: "uninstall",
8125
- timeoutMs: (options.timeout ?? 360) * 1000,
8126
- intervalMs: options.pollInterval ?? 5000,
8376
+ timeoutMs: remainingMs(),
8377
+ intervalMs,
8127
8378
  signal: options.signal
8128
8379
  });
8129
8380
  if (pollResult.outcome !== PollOutcome.Completed || !pollResult.data) {
8130
- const { reason, message, exitCode } = mapPollFailure(pollResult, "Uninstall");
8131
- return fail4(reason, message, "Uninstall may still be in progress.", exitCode);
8381
+ const { reason, message, exitCode, errorCode, retry } = mapPollFailure(pollResult, "Uninstall");
8382
+ return fail4(reason, message, "Uninstall may still be in progress.", {
8383
+ exitCode,
8384
+ errorCode,
8385
+ retry
8386
+ });
8132
8387
  }
8133
8388
  const finalStatus = pollResult.data;
8134
8389
  if (finalStatus.status !== "SuccessfulUninstall") {
@@ -8143,7 +8398,7 @@ async function uninstallDeploymentAsync(deploymentName, options = {}) {
8143
8398
  };
8144
8399
  }
8145
8400
 
8146
- // src/services/packages-list-service.ts
8401
+ // src/services/deploy-upgrade-service.ts
8147
8402
  var fail5 = (reason, message, instructions, exitCode = 1) => ({
8148
8403
  ok: false,
8149
8404
  reason,
@@ -8151,6 +8406,167 @@ var fail5 = (reason, message, instructions, exitCode = 1) => ({
8151
8406
  instructions,
8152
8407
  exitCode
8153
8408
  });
8409
+ var DEFAULT_TIMEOUT_SECONDS = 300;
8410
+ var DEFAULT_POLL_INTERVAL_MS = 5000;
8411
+ var AUTH_INSTRUCTIONS2 = "Run 'uip login' to refresh credentials, then retry. If the deployment is in a different tenant, switch with 'uip login tenant set <tenant>'.";
8412
+ async function upgradeDeploymentAsync(deploymentKey, options = {}) {
8413
+ const [authError, auth] = await catchError(getSolutionAuthContext({
8414
+ tenant: options.tenant,
8415
+ loginValidity: options.loginValidity,
8416
+ envFilePath: options.envFilePath
8417
+ }));
8418
+ if (authError) {
8419
+ return fail5("auth_failed", authError.message, AUTH_INSTRUCTIONS2);
8420
+ }
8421
+ const config = new Configuration2({
8422
+ basePath: auth.basePath,
8423
+ accessToken: auth.accessToken
8424
+ });
8425
+ const deploymentsApi = new DeploymentsApi(config);
8426
+ const searchApi = new SearchApi(config);
8427
+ let feedScope;
8428
+ if (options.personalWorkspace) {
8429
+ const [pwError, pw] = await catchError(resolvePersonalWorkspace({
8430
+ tenant: options.tenant,
8431
+ loginValidity: options.loginValidity
8432
+ }));
8433
+ if (pwError || !pw) {
8434
+ return fail5("personal_workspace_failed", pwError?.message ?? "Personal Workspace could not be resolved.", "Ensure your user has a Personal Workspace, then retry.");
8435
+ }
8436
+ feedScope = folderKeyInitOverride(pw.key);
8437
+ }
8438
+ const [getError, deployment] = await catchError(deploymentsApi.deploymentsGetByKey({ deploymentKey }, feedScope));
8439
+ if (getError || !deployment) {
8440
+ const detail = getError && await extractErrorDetails(getError);
8441
+ return fail5("deployment_not_found", detail ? detail.details ? `${detail.message}: ${detail.details}` : detail.message : `Deployment '${deploymentKey}' was not found.`, "Run 'uip solution deploy list' to find the deployment key. Add '--personal-workspace' if it lives in your Personal Workspace.");
8442
+ }
8443
+ const upgradeScope = feedScope;
8444
+ const take = 50;
8445
+ let pkg;
8446
+ for (let skip = 0;; ) {
8447
+ const [searchError, packages] = await catchError(searchApi.searchSearchPackages({
8448
+ searchFilter: {
8449
+ searchTerm: deployment.packageName,
8450
+ take,
8451
+ skip
8452
+ }
8453
+ }, feedScope));
8454
+ if (searchError) {
8455
+ const { message, details } = await extractErrorDetails(searchError);
8456
+ return fail5("package_not_found", details ? `${message}: ${details}` : message, "Confirm the package is published to the tenant (or Personal Workspace) feed.");
8457
+ }
8458
+ const values = packages.values ?? [];
8459
+ pkg = values.find((p) => p.name === deployment.packageName);
8460
+ if (pkg || values.length < take) {
8461
+ break;
8462
+ }
8463
+ skip += values.length;
8464
+ }
8465
+ if (!pkg) {
8466
+ return fail5("package_not_found", `Package '${deployment.packageName}' was not found in the feed.`, "Confirm the package is published to the tenant (or Personal Workspace) feed.");
8467
+ }
8468
+ if (options.version && options.version !== pkg.latestVersion) {
8469
+ return fail5("unsupported_version", `Upgrade supports only the latest published version ('${pkg.latestVersion}'); requested '${options.version}'.`, "Publish the desired version as the latest, or omit '--version' to upgrade to the newest.");
8470
+ }
8471
+ const currentVersion = deployment.currentPackageVersion ?? deployment.packageVersion;
8472
+ if (currentVersion === pkg.latestVersion) {
8473
+ return fail5("no_upgrade_available", `Deployment '${deployment.name}' is already at the latest published version (${pkg.latestVersion}).`, "Publish a newer version of the package, then retry.");
8474
+ }
8475
+ const [upgradeError, draft] = await catchError(deploymentsApi.deploymentsUpgrade({
8476
+ deploymentKey,
8477
+ packageVersionKey: pkg.packageVersionKey,
8478
+ deploymentUpgradeRequest: {
8479
+ packageVersionKey: pkg.packageVersionKey
8480
+ }
8481
+ }, upgradeScope));
8482
+ if (upgradeError || !draft) {
8483
+ let message = "The upgrade request returned no deployment.";
8484
+ if (upgradeError) {
8485
+ const detail = await extractErrorDetails(upgradeError);
8486
+ message = detail.details ? `${detail.message}: ${detail.details}` : detail.message;
8487
+ }
8488
+ return fail5("request_failed", message, "The upgrade could not be started. Check the deployment key and that a newer version is published.");
8489
+ }
8490
+ const [runError] = await catchError(deploymentsApi.deploymentsRun({ deploymentKey: draft.key }, upgradeScope));
8491
+ if (runError) {
8492
+ const { message, details } = await extractErrorDetails(runError);
8493
+ return fail5("install_failed", details ? `${message}: ${details}` : message, `The upgrade was queued as deployment '${draft.key}' but installing it failed. Run 'uip solution deploy list' to inspect its state.`);
8494
+ }
8495
+ const base = {
8496
+ deploymentName: deployment.name,
8497
+ fromVersion: currentVersion,
8498
+ toVersion: pkg.latestVersion,
8499
+ versionChangeKey: draft.key
8500
+ };
8501
+ if (options.noWait) {
8502
+ return { ok: true, ...base, status: draft.operationStatus };
8503
+ }
8504
+ const timeoutSeconds = Number.isFinite(options.timeout) ? options.timeout : DEFAULT_TIMEOUT_SECONDS;
8505
+ const poll = await pollInstallAsync(deploymentsApi, draft.key, upgradeScope, {
8506
+ timeoutMs: timeoutSeconds * 1000,
8507
+ intervalMs: Number.isFinite(options.pollInterval) ? options.pollInterval : DEFAULT_POLL_INTERVAL_MS
8508
+ });
8509
+ if (!poll.ok) {
8510
+ const isTimeout = poll.outcome === PollOutcome.Timeout;
8511
+ return fail5(isTimeout ? "install_timeout" : poll.failure.reason, isTimeout ? `The upgrade of '${deployment.name}' to ${pkg.latestVersion} did not finish within ${timeoutSeconds}s.` : `${poll.failure.message} while upgrading '${deployment.name}' to ${pkg.latestVersion} (last status: ${poll.lastStatus}).`, isTimeout ? `It may still be running. Track deployment '${draft.key}' with 'uip solution deploy list', or pass a longer --timeout.` : `The upgrade may still be running. Track deployment '${draft.key}' with 'uip solution deploy list', then retry if it did not land.`, poll.failure.exitCode);
8512
+ }
8513
+ const status = poll.status;
8514
+ if (FAILURE_STATUSES.has(status)) {
8515
+ return fail5("install_failed", `The upgrade of '${deployment.name}' to ${pkg.latestVersion} ended in ${status}: ${await describeValidationFailureAsync(deploymentsApi, draft.key, upgradeScope)}`, "Fix the reported problem, then retry the upgrade.");
8516
+ }
8517
+ return { ok: true, ...base, status };
8518
+ }
8519
+ var IN_FLIGHT_STATUSES = new Set([
8520
+ DeploymentOperationStatus.Draft,
8521
+ DeploymentOperationStatus.InProgress
8522
+ ]);
8523
+ var FAILURE_STATUSES = new Set([
8524
+ DeploymentOperationStatus.Failed,
8525
+ DeploymentOperationStatus.FailedRollback
8526
+ ]);
8527
+ async function pollInstallAsync(deploymentsApi, versionChangeKey, scope, timing) {
8528
+ const result = await pollUntil({
8529
+ fn: () => deploymentsApi.deploymentsGetByKey({ deploymentKey: versionChangeKey }, scope),
8530
+ until: (deployment) => !IN_FLIGHT_STATUSES.has(deployment.operationStatus),
8531
+ getStatus: (deployment) => deployment.operationStatus,
8532
+ label: `upgrade ${versionChangeKey}`,
8533
+ logPrefix: "deploy upgrade",
8534
+ timeoutMs: timing.timeoutMs,
8535
+ intervalMs: timing.intervalMs
8536
+ });
8537
+ if (result.outcome === PollOutcome.Completed && result.data) {
8538
+ return { ok: true, status: result.data.operationStatus };
8539
+ }
8540
+ return {
8541
+ ok: false,
8542
+ outcome: result.outcome,
8543
+ lastStatus: result.data?.operationStatus ?? DeploymentOperationStatus.Draft,
8544
+ failure: mapPollFailure(result, `Upgrade ${versionChangeKey}`)
8545
+ };
8546
+ }
8547
+ async function describeValidationFailureAsync(deploymentsApi, versionChangeKey, scope) {
8548
+ const [error, validation] = await catchError(deploymentsApi.deploymentsGetValidationResult({
8549
+ deploymentKey: versionChangeKey,
8550
+ deploymentAction: SolutionDeploymentAction.Upgrade
8551
+ }, scope));
8552
+ if (error || !validation) {
8553
+ return "the server reported no reason.";
8554
+ }
8555
+ const messages = [
8556
+ ...validation.validationErrors.map((item) => item.text || item.resource),
8557
+ ...validation.resourceValidationErrors.flatMap((resource) => resource.errors.map((item) => item.text || item.resource))
8558
+ ].filter(Boolean);
8559
+ return messages.length > 0 ? messages.join("; ") : "the server reported no reason.";
8560
+ }
8561
+
8562
+ // src/services/packages-list-service.ts
8563
+ var fail6 = (reason, message, instructions, exitCode = 1) => ({
8564
+ ok: false,
8565
+ reason,
8566
+ message,
8567
+ instructions,
8568
+ exitCode
8569
+ });
8154
8570
  async function listPackagesAsync(options = {}) {
8155
8571
  const limit = options.limit ?? DEFAULT_PAGE_SIZE;
8156
8572
  const offset = options.offset ?? 0;
@@ -8160,7 +8576,7 @@ async function listPackagesAsync(options = {}) {
8160
8576
  envFilePath: options.envFilePath
8161
8577
  }));
8162
8578
  if (authError) {
8163
- return fail5("auth_failed", authError.message, authError.message);
8579
+ return fail6("auth_failed", authError.message, authError.message);
8164
8580
  }
8165
8581
  const [scopeError, scope] = await catchError(resolveFeedScope({
8166
8582
  personalWorkspace: options.personalWorkspace,
@@ -8170,7 +8586,7 @@ async function listPackagesAsync(options = {}) {
8170
8586
  envFilePath: options.envFilePath
8171
8587
  }));
8172
8588
  if (scopeError) {
8173
- return fail5("feed_resolution_failed", scopeError.message, feedResolutionFailureInstructions(options));
8589
+ return fail6("feed_resolution_failed", scopeError.message, feedResolutionFailureInstructions(options));
8174
8590
  }
8175
8591
  const searchApi = new SearchApi(new Configuration2({
8176
8592
  basePath: auth.basePath,
@@ -8187,7 +8603,7 @@ async function listPackagesAsync(options = {}) {
8187
8603
  }, feedScopeInitOverride(scope)));
8188
8604
  if (listError) {
8189
8605
  const { message, details } = await extractErrorDetails(listError);
8190
- return fail5("list_request_failed", message, `Failed to list packages. Details: ${details}`);
8606
+ return fail6("list_request_failed", message, `Failed to list packages. Details: ${details}`);
8191
8607
  }
8192
8608
  const packages = result.values ?? [];
8193
8609
  return {
@@ -8199,6 +8615,6 @@ async function listPackagesAsync(options = {}) {
8199
8615
  };
8200
8616
  }
8201
8617
 
8202
- export { extractDeploymentErrors, formatDeploymentErrorsAsText, activateDeploymentAsync, listDeploymentsAsync, deployRunAsync, uninstallDeploymentAsync, listPackagesAsync };
8618
+ export { extractDeploymentErrors, formatDeploymentErrorsAsText, activateDeploymentAsync, listDeploymentsAsync, deployRunAsync, uninstallDeploymentAsync, upgradeDeploymentAsync, listPackagesAsync };
8203
8619
 
8204
- //# debugId=7B9B9E13DA7CE52664756E2164756E21
8620
+ //# debugId=A0AFD052AEAE53CC64756E2164756E21