@uipath/solution-tool 1.206.0-preview.303 → 1.207.0-preview.305

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 (122) hide show
  1. package/dist/{archive-extract-ma0gy822.js → archive-extract-afgwacbg.js} +3 -3
  2. package/dist/{cleanup-command-service-07yjaezn.js → cleanup-command-service-j9kawew9.js} +20 -15
  3. package/dist/deploy-delete-service-1erqap9a.js +23 -0
  4. package/dist/deploy-run-service-jbs6dxye.js +24 -0
  5. package/dist/{deploy-status-service-eh32jm3n.js → deploy-status-service-4zn90vds.js} +49 -25
  6. package/dist/deploy.js +21 -20
  7. package/dist/{deployment-search-kxvr7anp.js → deployment-search-dwzahe4v.js} +9 -9
  8. package/dist/feed-resolver-d14rdjss.js +31 -0
  9. package/dist/feed-scope-failure-w16mze3z.js +20 -0
  10. package/dist/{feed-session-aw2aef0b.js → feed-session-f2sby6t8.js} +6 -6
  11. package/dist/{first-party-service-6gf3n6d8.js → first-party-service-7cggb17y.js} +1 -1
  12. package/dist/folder-runtime-check-586c41dq.js +25 -0
  13. package/dist/{governance-options-9f0gkd59.js → governance-options-y2xsv7ff.js} +7 -7
  14. package/dist/{packager-tool-pdfjwnzf.js → index-6ma58k47.js} +33 -708
  15. package/dist/{index-p3x7ztdr.js → index-795rsz0e.js} +1 -1
  16. package/dist/{index-yjvmjpdn.js → index-pzkzbqbs.js} +12 -11
  17. package/dist/{index-j6bry1jf.js → index-wfqzwh7k.js} +9 -7
  18. package/dist/index.js +26 -26
  19. package/dist/init.js +10 -10
  20. package/dist/{list-vj7bxwas.js → list-6pe1nab5.js} +11 -11
  21. package/dist/models/pack-command-types.d.ts +12 -0
  22. package/dist/{node-jn4c2v8d.js → node-13wj5mzd.js} +6 -6
  23. package/dist/pack-command-service-j9bqnsn1.js +32 -0
  24. package/dist/{pack-project-4m8g3xws.js → pack-project-3sdddc42.js} +21 -18
  25. package/dist/pack.js +25 -22
  26. package/dist/{package-id-6ht7na7b.js → package-id-5j4q232a.js} +3 -3
  27. package/dist/{packager-tool-vgrswa8p.js → packager-tool-1db1wqdy.js} +30 -8
  28. package/dist/{packager-tool-vx2c68sb.js → packager-tool-1dsxhz1r.js} +2 -2
  29. package/dist/{packager-tool-wrv1xqep.js → packager-tool-1tvhgac9.js} +15 -6
  30. package/dist/{packager-tool-4ngwhqrt.js → packager-tool-2atxqqgd.js} +49 -24
  31. package/dist/packager-tool-3ft8hywr.js +449 -0
  32. package/dist/{packager-tool-7m6avabc.js → packager-tool-46x80z85.js} +8 -4
  33. package/dist/{packager-tool-ztk5t400.js → packager-tool-4hm40a32.js} +8 -74
  34. package/dist/{packager-tool-f15an17m.js → packager-tool-5p1vy335.js} +1 -1
  35. package/dist/packager-tool-612prgtc.js +140 -0
  36. package/dist/packager-tool-7gqn5apd.js +72 -0
  37. package/dist/{packager-tool-aws5w512.js → packager-tool-887bkh9y.js} +1 -1
  38. package/dist/{packager-tool-gn42ht23.js → packager-tool-8tckw03n.js} +28 -9
  39. package/dist/{packager-tool-y5jkhz8b.js → packager-tool-93qy1v8m.js} +52 -15
  40. package/dist/{packager-tool-fx4ws49n.js → packager-tool-cenfraf4.js} +2 -2
  41. package/dist/{packager-tool-chff74yz.js → packager-tool-cr1khqtm.js} +103 -166
  42. package/dist/{packager-tool-hagvwahw.js → packager-tool-da3hvfyn.js} +528 -202
  43. package/dist/{packager-tool-2zn98p5r.js → packager-tool-dd937g7k.js} +4 -4
  44. package/dist/{packager-tool-a7s0gbxs.js → packager-tool-devc4w73.js} +7 -2
  45. package/dist/{packager-tool-gh3tk9qy.js → packager-tool-ewbkaecg.js} +18 -11
  46. package/dist/{packager-tool-1hf1eza3.js → packager-tool-g08b669a.js} +22 -18
  47. package/dist/{packager-tool-m07vyk89.js → packager-tool-gb3dq79g.js} +36 -9
  48. package/dist/{packager-tool-mr0bmnez.js → packager-tool-gmbcn83x.js} +3 -3
  49. package/dist/{packager-tool-2p1hbxb8.js → packager-tool-jhtsana2.js} +119 -52
  50. package/dist/{packager-tool-1153jhyk.js → packager-tool-jtg2arr8.js} +20 -8
  51. package/dist/{packager-tool-t39pjz7n.js → packager-tool-jtvhkavz.js} +48 -6
  52. package/dist/packager-tool-kffz64hn.js +279 -0
  53. package/dist/{packager-tool-p5322gew.js → packager-tool-kmwjscby.js} +88 -10
  54. package/dist/{packager-tool-ppj5f4y7.js → packager-tool-n1zrk6zv.js} +4 -2
  55. package/dist/{packager-tool-8y4g6zmj.js → packager-tool-pmc5txbm.js} +4 -6
  56. package/dist/{packager-tool-egc54x78.js → packager-tool-qhht1tc9.js} +2408 -771
  57. package/dist/{packager-tool-1x83nb8h.js → packager-tool-qm876ezh.js} +84 -29
  58. package/dist/{packager-tool-resolver-30hxk8vm.js → packager-tool-resolver-y52kztnx.js} +6 -6
  59. package/dist/{packager-tool-t700684m.js → packager-tool-rhg3mwkn.js} +14 -8
  60. package/dist/{packager-tool-ckrt4gyr.js → packager-tool-t9zked1m.js} +3 -3
  61. package/dist/{packager-tool-nhtc47fy.js → packager-tool-tat0qs6z.js} +26 -10
  62. package/dist/packager-tool-tf0rn1tp.js +741 -0
  63. package/dist/{packager-tool-v8aac3ec.js → packager-tool-tmba5jv0.js} +140 -10
  64. package/dist/{packager-tool-2n8dp801.js → packager-tool-tqe3m1xp.js} +6 -6
  65. package/dist/{packager-tool-1ctvbx0h.js → packager-tool-tr3ttz5c.js} +1 -1
  66. package/dist/{packager-tool-k9dk39tg.js → packager-tool-txygqgb2.js} +3 -3
  67. package/dist/packager-tool-v6jcys3s.js +46 -0
  68. package/dist/packager-tool-w35s60sx.js +179 -0
  69. package/dist/{packager-tool-axqk17xw.js → packager-tool-xbfr6y2x.js} +142 -34
  70. package/dist/{packager-tool-2qsbh4kd.js → packager-tool-yfcscjfp.js} +50 -12
  71. package/dist/{packager-tool-ay4j9x92.js → packager-tool-ykq6gmhc.js} +19 -8
  72. package/dist/packager-tool.js +2 -2
  73. package/dist/prepare-solution-resources-sk3tyy8b.js +26 -0
  74. package/dist/{project-command-utils-82tja3k0.js → project-command-utils-7ygs8xq0.js} +20 -13
  75. package/dist/project-contributions-nzh06q0y.js +31 -0
  76. package/dist/project-identity-telemetry-47k2g7nq.js +18 -0
  77. package/dist/publish.js +14 -14
  78. package/dist/{resource-mutations-h6wfdqr4.js → resource-mutations-qcz2vcxe.js} +9 -9
  79. package/dist/{resource-version-lookup-xzgnvr48.js → resource-version-lookup-w3kzh4z9.js} +9 -9
  80. package/dist/resource.js +9 -9
  81. package/dist/{restore-command-service-wx8jw22q.js → restore-command-service-m6c8fb7q.js} +20 -15
  82. package/dist/run-service-cmrzccnm.js +1055 -0
  83. package/dist/services/deploy-activate-service.d.ts +5 -2
  84. package/dist/services/deploy-config-file.d.ts +24 -0
  85. package/dist/services/deploy-delete-service.d.ts +1 -1
  86. package/dist/services/deploy-run-service.d.ts +8 -1
  87. package/dist/services/deploy-uninstall-service.d.ts +4 -2
  88. package/dist/services/deploy-upgrade-service.d.ts +23 -2
  89. package/dist/services/deployment-feed-locator.d.ts +19 -6
  90. package/dist/services/deployment-links.d.ts +16 -0
  91. package/dist/services/deployment-progress.d.ts +10 -0
  92. package/dist/services/deployment-search.d.ts +15 -2
  93. package/dist/services/deployment-state.d.ts +9 -0
  94. package/dist/services/feed-resolver.d.ts +17 -0
  95. package/dist/services/feed-selection.d.ts +59 -0
  96. package/dist/services/folder-runtime-check.d.ts +107 -0
  97. package/dist/services/incomplete-feed-sweep.d.ts +6 -0
  98. package/dist/services/pack-command-service.d.ts +6 -0
  99. package/dist/services/pack-project.d.ts +1 -1
  100. package/dist/services/package-metadata-rewrite.d.ts +13 -0
  101. package/dist/services/personal-workspace-resolver.d.ts +4 -1
  102. package/dist/services/prepare-solution-resources.d.ts +11 -6
  103. package/dist/services/project-contributions.d.ts +26 -2
  104. package/dist/services/project-identity-telemetry.d.ts +31 -0
  105. package/dist/services/solution-members.d.ts +31 -0
  106. package/dist/{ship-telemetry-19gx83af.js → ship-telemetry-9djqndmy.js} +4 -4
  107. package/dist/{solution-auth-jxcgd2m0.js → solution-auth-0e3qm74f.js} +3 -3
  108. package/dist/{solution-definition-helper-tqwd6cxn.js → solution-definition-helper-bkyhs1bd.js} +1 -1
  109. package/dist/{solution-identity-c23d9bfv.js → solution-identity-j63p6n81.js} +4 -4
  110. package/dist/templates/AGENTS.md +131 -24
  111. package/dist/tool.js +26 -26
  112. package/package.json +2 -2
  113. package/dist/deploy-delete-service-p9gade7a.js +0 -23
  114. package/dist/deploy-run-service-1k4paz52.js +0 -23
  115. package/dist/feed-resolver-3cs1dmhh.js +0 -27
  116. package/dist/feed-scope-failure-78fn8bay.js +0 -20
  117. package/dist/pack-command-service-zc7hq5s6.js +0 -29
  118. package/dist/packager-tool-pp4067m7.js +0 -74
  119. package/dist/packager-tool-vrqbbh01.js +0 -182
  120. package/dist/prepare-solution-resources-h7zvnncd.js +0 -26
  121. package/dist/project-contributions-xx560n8y.js +0 -27
  122. package/dist/run-service-32pky7na.js +0 -506
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  catchError,
3
3
  extractErrorDetails
4
- } from "./packager-tool-m07vyk89.js";
4
+ } from "./packager-tool-gb3dq79g.js";
5
5
  import {
6
6
  logger,
7
7
  DEFAULT_PAGE_SIZE,
@@ -9,10 +9,10 @@ import {
9
9
  mapPollFailure,
10
10
  pollUntil,
11
11
  quoteForShell
12
- } from "./packager-tool-axqk17xw.js";
12
+ } from "./packager-tool-xbfr6y2x.js";
13
13
  import {
14
14
  getSolutionAuthContext2
15
- } from "./packager-tool-ppj5f4y7.js";
15
+ } from "./packager-tool-n1zrk6zv.js";
16
16
  import {
17
17
  Configuration2,
18
18
  DeploymentOperation,
@@ -29,7 +29,7 @@ import {
29
29
  feedReadRefusalForApplication2,
30
30
  feedSessionRefusalAsync2,
31
31
  feedReadRefusalAsync2
32
- } from "./packager-tool-2n8dp801.js";
32
+ } from "./packager-tool-tqe3m1xp.js";
33
33
  import {
34
34
  Configuration3,
35
35
  WorkflowAction2,
@@ -37,44 +37,43 @@ import {
37
37
  SolutionDeploymentAction2,
38
38
  DeploymentsApi2,
39
39
  SearchApi
40
- } from "./packager-tool-7m6avabc.js";
40
+ } from "./packager-tool-46x80z85.js";
41
41
  import {
42
42
  readDeploymentByKeyAsync2,
43
43
  findDeploymentByName2,
44
44
  isCompletedUninstall2,
45
45
  findDeploymentsByName2,
46
46
  newestDeploymentRow2
47
- } from "./packager-tool-t700684m.js";
47
+ } from "./packager-tool-rhg3mwkn.js";
48
48
  import {
49
+ deploymentProgressStatus,
50
+ createDeploymentProgress,
49
51
  activateDeployment,
52
+ buildDeploymentLinks,
53
+ readDeploymentLinksAsync,
54
+ readDeployConfigFileAsync,
50
55
  NO_SERVER_REASON,
51
56
  describeValidationFailureAsync,
52
57
  listPermanentDeletionResourcesAsync,
53
58
  ACKNOWLEDGE_PERMANENT_DELETION_FLAG,
54
59
  finiteOr,
55
60
  runInstallToOutcomeAsync
56
- } from "./packager-tool-v8aac3ec.js";
61
+ } from "./packager-tool-tmba5jv0.js";
57
62
  import {
58
63
  resolvePersonalWorkspace,
59
64
  resolveParentFolder,
60
65
  folderKeyInitOverride2,
61
66
  feedScopeInitOverride2,
62
67
  feedSelectorFlag2,
68
+ tenantFlag2,
69
+ deleteDeploymentCommand2,
63
70
  describeFeedResolutionFailureAsync2,
64
71
  resolveFeedScope2
65
- } from "./packager-tool-gh3tk9qy.js";
72
+ } from "./packager-tool-ewbkaecg.js";
66
73
  import {
67
- pendingResourceApis,
68
- reportedActivationStatus,
69
- readPendingResourcesAsync,
70
- isCurrentRecordAsync,
71
- explainRefusal,
72
- needsPendingResources,
73
- deploymentNextSteps
74
- } from "./packager-tool-wrv1xqep.js";
75
- import {
76
- resolveFeedSelectionAsync
77
- } from "./packager-tool-pp4067m7.js";
74
+ missingDeploymentMessage,
75
+ resolveDeploymentTargetAsync
76
+ } from "./packager-tool-612prgtc.js";
78
77
  import {
79
78
  coerceWorkflowErrorMessages,
80
79
  formatServiceErrors,
@@ -92,7 +91,16 @@ import {
92
91
  INCOMPLETE_SWEEP_ADVICE,
93
92
  retryAdvice,
94
93
  reportIncompleteSweepAsync
95
- } from "./packager-tool-nhtc47fy.js";
94
+ } from "./packager-tool-tat0qs6z.js";
95
+ import {
96
+ pendingResourceApis,
97
+ reportedActivationStatus,
98
+ readPendingResourcesAsync,
99
+ isCurrentRecordAsync,
100
+ explainRefusal,
101
+ needsPendingResources,
102
+ deploymentNextSteps
103
+ } from "./packager-tool-1tvhgac9.js";
96
104
 
97
105
  // src/services/deploy-activate-service.ts
98
106
  var fail = (reason, message, instructions, exitCode = 1) => ({
@@ -119,7 +127,7 @@ async function incompleteSweepRefusalAsync(deploymentName, skipped, result) {
119
127
  retry: report.retry
120
128
  };
121
129
  }
122
- async function activateDeploymentAsync2(deploymentName, options = {}) {
130
+ async function activateDeploymentAsync2(reference, options = {}) {
123
131
  const [authError, auth] = await catchError(getSolutionAuthContext2({
124
132
  tenant: options.tenant,
125
133
  loginValidity: options.loginValidity,
@@ -128,15 +136,15 @@ async function activateDeploymentAsync2(deploymentName, options = {}) {
128
136
  if (authError) {
129
137
  return fail("auth_failed", authError.message, AUTH_INSTRUCTIONS);
130
138
  }
131
- const selection = await resolveFeedSelectionAsync(auth, options, "Activating a deployment");
132
- if (!selection.ok) {
139
+ const target = await resolveDeploymentTargetAsync(auth, reference, options, "Activating a deployment");
140
+ if (!target.ok) {
133
141
  return {
134
- ...fail(selection.reason, selection.message, selection.instructions),
135
- errorCode: selection.errorCode,
136
- retry: selection.retry
142
+ ...fail(target.reason, target.message, target.instructions),
143
+ errorCode: target.errorCode,
144
+ retry: target.retry
137
145
  };
138
146
  }
139
- const { selectedFeed } = selection;
147
+ const { deploymentName, selectedFeed, deploymentKey } = target;
140
148
  const sweep = await findDeploymentAcrossFeeds(auth, deploymentName, {
141
149
  tenant: options.tenant,
142
150
  loginValidity: options.loginValidity,
@@ -161,12 +169,13 @@ async function activateDeploymentAsync2(deploymentName, options = {}) {
161
169
  const feedSelector = feedSelectorFlag2(location?.feed ?? selectedFeed);
162
170
  const explanation = known ? explainRefusal(known, pendingResources, feedSelector) : undefined;
163
171
  const instructions = explanation ? [...explanation, details].join(`
164
- `) : known ? `Deployment '${known.name}' exists (Operation: ${known.operation}, OperationStatus: ${known.operationStatus}, ActivationStatus: ${known.activationStatus}) but the service refused to activate it. Check it with: uip solution deploy status ${known.key}${feedSelector}. ${details}` : selectedFeed ? `No deployment named '${deploymentName}' was found in the selected feed. Check the name with 'uip solution deploy list${feedSelector}', or drop the feed flag to search every feed you can reach. ${details}` : result.phase === "preActivateSteps" ? `Check deployment name. Deploy first with: uip solution deploy run. ${details}` : `Check deployment name matches an existing deployment. ${details}`;
172
+ `) : !known && deploymentKey ? `Deployment '${deploymentName}' exists but the service refused to activate it. Check it with: uip solution deploy status ${deploymentKey}. ${details}` : known ? `Deployment '${known.name}' exists (Operation: ${known.operation}, OperationStatus: ${known.operationStatus}, ActivationStatus: ${known.activationStatus}) but the service refused to activate it. Check it with: uip solution deploy status ${known.key}${feedSelector}. ${details}` : selectedFeed ? `${missingDeploymentMessage(reference)} in the selected feed. Check the name with 'uip solution deploy list${feedSelector}', or drop the feed flag to search every feed you can reach. ${details}` : result.phase === "preActivateSteps" ? `Check deployment name. Deploy first with: uip solution deploy run. ${details}` : `Check deployment name matches an existing deployment. ${details}`;
165
173
  return fail("request_failed", result.message, instructions);
166
174
  }
167
175
  if (result.kind === "NoInstance") {
168
176
  return {
169
177
  ok: true,
178
+ ...buildDeploymentLinks(auth, location?.deployment.key, location?.deployment.installedRootFolderKey, location?.feed?.folderKey ?? selectedFeed?.folderKey),
170
179
  status: "Activation completed (no instance to poll)",
171
180
  deploymentName
172
181
  };
@@ -184,6 +193,7 @@ async function activateDeploymentAsync2(deploymentName, options = {}) {
184
193
  }
185
194
  return {
186
195
  ok: true,
196
+ ...buildDeploymentLinks(auth, location?.deployment.key, location?.deployment.installedRootFolderKey, location?.feed?.folderKey ?? selectedFeed?.folderKey),
187
197
  status: result.status,
188
198
  deploymentName,
189
199
  instanceId: result.instanceId
@@ -491,7 +501,7 @@ function requestErrorInstructions(deploymentName, errorCode, details, feedSelect
491
501
  case "server_error":
492
502
  return `Orchestrator returned a server error. Wait and retry; if it persists, check Orchestrator status. Details: ${details}`;
493
503
  case "not_found":
494
- return `No deployment named '${deploymentName}' was found. Run 'uip solution deploy list${feedSelector}' to see valid deployment names. Details: ${details}`;
504
+ return `${missingDeploymentMessage(deploymentName)}. Run 'uip solution deploy list${feedSelector}' to see valid deployment names. Details: ${details}`;
495
505
  default:
496
506
  return `Uninstall request failed. Run 'uip solution deploy list${feedSelector}' to check the deployment's state, then retry. Details: ${details}`;
497
507
  }
@@ -530,10 +540,12 @@ async function waitForOperationToFinishAsync(auth, deploymentName, opts) {
530
540
  operationStatus = last?.operationStatus;
531
541
  return last ? operationStatus : undefined;
532
542
  };
543
+ const progress = createDeploymentProgress(`uninstall '${deploymentName}' waiting for current operation`);
533
544
  const poll = await pollUntil({
534
545
  fn: readState,
535
546
  until: (status) => status !== undefined && status !== "InProgress",
536
547
  getStatus: (status) => status ?? "Unknown",
548
+ onPoll: (status, elapsedMs) => progress(`OperationStatus: ${status ?? "Unknown"}`, elapsedMs),
537
549
  label: `deployment '${deploymentName}' to finish its current operation`,
538
550
  logPrefix: "uninstall",
539
551
  timeoutMs: opts.remainingMs(),
@@ -614,7 +626,7 @@ async function requestUninstallAsync(api, auth, deploymentName, ctx) {
614
626
  }
615
627
  return fail3("uninstall_request_failed", message, requestErrorInstructions(deploymentName, errorCode, details, feedSelector), { errorCode, retry });
616
628
  }
617
- const instructions = state ? buildDeploymentStateInstructions(state, details, feedSelector) : ctx.selectedFeed ? `No deployment named '${deploymentName}' was found in the selected feed. Check the name with 'uip solution deploy list${feedSelector}', or drop the feed flag to search every feed you can reach. Details: ${details}` : `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}`;
629
+ const instructions = state ? buildDeploymentStateInstructions(state, details, feedSelector) : ctx.deploymentKey ? `Deployment '${deploymentName}' exists but the service refused to uninstall it. Check it with: uip solution deploy status ${ctx.deploymentKey}. Details: ${details}` : ctx.selectedFeed ? `${missingDeploymentMessage(deploymentName)} in the selected feed. Check the name with 'uip solution deploy list${feedSelector}', or drop the feed flag to search every feed you can reach. Details: ${details}` : `${missingDeploymentMessage(deploymentName)} in any feed you can reach (tenant, Personal Workspace, or a folder feed). Check the name with 'uip solution deploy list'. Details: ${details}`;
618
630
  return fail3("uninstall_request_failed", message, instructions, {
619
631
  errorCode,
620
632
  retry
@@ -625,7 +637,7 @@ async function incompleteSweepFailureAsync(deploymentName, sweep, refusalDetails
625
637
  const report = await reportIncompleteSweepAsync(deploymentName, sweep.skipped);
626
638
  return fail3("uninstall_request_failed", report.message, `${INCOMPLETE_SWEEP_ADVICE} Without its feed the uninstall request went to the tenant feed, which refused it. ${report.nextStep} Details: ${refusalDetails} (feed search: ${report.details})`, { errorCode: report.errorCode, retry: report.retry });
627
639
  }
628
- async function uninstallDeploymentAsync2(deploymentName, options = {}) {
640
+ async function uninstallDeploymentAsync2(reference, options = {}) {
629
641
  const [authError, auth] = await catchError(getSolutionAuthContext2({
630
642
  tenant: options.tenant,
631
643
  loginValidity: options.loginValidity,
@@ -641,14 +653,14 @@ async function uninstallDeploymentAsync2(deploymentName, options = {}) {
641
653
  const deadline = Date.now() + (options.timeout ?? 360) * 1000;
642
654
  const intervalMs = options.pollInterval ?? 5000;
643
655
  const remainingMs = () => Math.max(deadline - Date.now(), 1);
644
- const selection = await resolveFeedSelectionAsync(auth, options, "Uninstalling a deployment");
645
- if (!selection.ok) {
646
- return fail3(selection.reason, selection.message, selection.instructions, {
647
- errorCode: selection.errorCode,
648
- retry: selection.retry
656
+ const target = await resolveDeploymentTargetAsync(auth, reference, options, "Uninstalling a deployment");
657
+ if (!target.ok) {
658
+ return fail3(target.reason, target.message, target.instructions, {
659
+ errorCode: target.errorCode,
660
+ retry: target.retry
649
661
  });
650
662
  }
651
- const { selectedFeed } = selection;
663
+ const { deploymentName, selectedFeed, deploymentKey } = target;
652
664
  const sweep = await findDeploymentAcrossFeeds(auth, deploymentName, {
653
665
  ...options,
654
666
  selectedFeed
@@ -660,6 +672,7 @@ async function uninstallDeploymentAsync2(deploymentName, options = {}) {
660
672
  sweep,
661
673
  scope,
662
674
  selectedFeed,
675
+ deploymentKey,
663
676
  intervalMs,
664
677
  remainingMs
665
678
  }));
@@ -686,10 +699,12 @@ async function uninstallDeploymentAsync2(deploymentName, options = {}) {
686
699
  scheduled: uninstallResult.scheduled
687
700
  };
688
701
  }
702
+ const progress = createDeploymentProgress(`uninstall '${deploymentName}'`);
689
703
  const pollResult = await pollUntil({
690
704
  fn: () => api.pipelinesGetDeploymentInstanceStatus({ instanceId }, scope),
691
705
  until: (result) => TERMINAL_STATUSES.has(result.status),
692
706
  getStatus: (result) => result.status,
707
+ onPoll: (result, elapsedMs) => progress(deploymentProgressStatus(result), elapsedMs),
693
708
  label: `uninstall ${deploymentName}`,
694
709
  logPrefix: "uninstall",
695
710
  timeoutMs: remainingMs(),
@@ -783,6 +798,17 @@ async function upgradeDeploymentAsync2(first, second) {
783
798
  if (targetError) {
784
799
  return targetError;
785
800
  }
801
+ let configBody;
802
+ if (options.configFile !== undefined) {
803
+ const config = await readDeployConfigFileAsync(options.configFile);
804
+ if (!config.ok) {
805
+ return fail4(config.reason, config.message, config.instructions, {
806
+ errorCode: config.errorCode,
807
+ retry: config.retry
808
+ });
809
+ }
810
+ configBody = config.body;
811
+ }
786
812
  const [authError, auth] = await catchError(getSolutionAuthContext2({
787
813
  tenant: options.tenant,
788
814
  loginValidity: options.loginValidity,
@@ -817,7 +843,8 @@ async function upgradeDeploymentAsync2(first, second) {
817
843
  deploymentName,
818
844
  packageName,
819
845
  packageVersion: targetVersion,
820
- solutionRootFolderName: deploymentName
846
+ solutionRootFolderName: deploymentName,
847
+ body: configBody
821
848
  }, scope));
822
849
  if (installError || !installResult?.pipelineDeploymentId) {
823
850
  return describeInstallRefusalAsync(installError, {
@@ -861,7 +888,7 @@ async function upgradeDeploymentAsync2(first, second) {
861
888
  return {
862
889
  verb: "Upgrading",
863
890
  confirmHint: `re-run the same command with ${ACKNOWLEDGE_PERMANENT_DELETION_FLAG}: ${acknowledgeRetryCommand(options, target)}`,
864
- keepCopiesHint: `discard the draft and upgrade without those links: ${discardRetryCommand(options, target, refusedKey)}, or remove the links from the deployment in Orchestrator first`
891
+ keepCopiesHint: options.configFile !== undefined ? `${removeFromConfigFileStep(options.configFile)}, then discard the draft and upgrade: ${discardRetryCommand(options, target, refusedKey)}, or remove the links from the deployment in Orchestrator first` : `discard the draft and upgrade without those links: ${discardRetryCommand(options, target, refusedKey)}, or remove the links from the deployment in Orchestrator first`
865
892
  };
866
893
  }
867
894
  });
@@ -912,10 +939,35 @@ async function upgradeDeploymentAsync2(first, second) {
912
939
  return fail4("deploy_failed", `The upgrade of '${deploymentName}' to ${targetVersion} ended in ${finalStatus.status}.`, `${await describeUpgradeFailureAsync(auth.basePath, auth.accessToken, pipelineDeploymentId, finalStatus, scope, options.signal)}
913
940
  ${leavesPendingDraft(finalStatus.status) ? `Nothing was installed; the deployment stays on the version it was already running. The rejected attempt is kept as a pending draft${finalStatus.deploymentKey ? ` (${finalStatus.deploymentKey})` : ""}, which a plain retry would run into, so once the cause is fixed discard it and retry: ${discardRetryCommand(options, target, finalStatus.deploymentKey || undefined)}` : "Fix the reported problem, then retry the upgrade. The deployment stays on the version it was already running."}`, classifyTerminalFailure(finalStatus.status));
914
941
  }
915
- const described = await describeUpgradedDeploymentAsync(auth, deploymentName, finalStatus, scope, target.listFlag);
942
+ const described = await describeUpgradedDeploymentAsync(auth, {
943
+ deploymentName,
944
+ packageName,
945
+ installDeploymentKey: target.installDeploymentKey
946
+ }, finalStatus, scope, target.listFlag);
947
+ const {
948
+ checkFolderRuntimesAsync,
949
+ linkedProcessNamesFromConfig,
950
+ logFolderRuntimeWarnings
951
+ } = await import("./folder-runtime-check-586c41dq.js");
952
+ const [, found] = await catchError(checkFolderRuntimesAsync({
953
+ auth,
954
+ packageName,
955
+ packageVersion: targetVersion,
956
+ scope,
957
+ deploymentKey: finalStatus.deploymentKey,
958
+ configuredLinks: linkedProcessNamesFromConfig(configBody),
959
+ personalWorkspace: options.personalWorkspace || undefined,
960
+ feedKey: target.feedKey,
961
+ tenant: options.tenant,
962
+ loginValidity: options.loginValidity,
963
+ envFilePath: options.envFilePath,
964
+ signal: options.signal
965
+ }));
966
+ const warnings = logFolderRuntimeWarnings(found ?? []);
916
967
  return {
917
968
  ok: true,
918
969
  ...base,
970
+ ...await readDeploymentLinksAsync(auth, finalStatus.deploymentKey, scope, target.locationKey, options.signal),
919
971
  deploymentKey: finalStatus.deploymentKey,
920
972
  operation: finalStatus.deploymentResult?.operation ?? finalStatus.synthesizedOperation,
921
973
  status: finalStatus.status,
@@ -929,10 +981,12 @@ ${leavesPendingDraft(finalStatus.status) ? `Nothing was installed; the deploymen
929
981
  explainPipelineStatusAfterInstall(finalStatus),
930
982
  ...described.nextSteps ?? []
931
983
  ]
932
- }
984
+ },
985
+ ...warnings.length > 0 && { warnings }
933
986
  };
934
987
  }
935
- async function describeUpgradedDeploymentAsync(auth, deploymentName, finalStatus, scope, listFlag) {
988
+ async function describeUpgradedDeploymentAsync(auth, deployment, finalStatus, scope, listFlag) {
989
+ const { deploymentName } = deployment;
936
990
  const record = finalStatus.deploymentResult;
937
991
  const actions = record?.actions ?? [];
938
992
  if (record?.status === "SuccessfulActivate") {
@@ -951,7 +1005,10 @@ async function describeUpgradedDeploymentAsync(auth, deploymentName, finalStatus
951
1005
  operationStatus: row?.operationStatus ?? record?.operationStatus ?? "Successful",
952
1006
  activationStatus,
953
1007
  packageVersion: row?.packageVersion ?? record?.packageVersion,
954
- currentPackageVersion: row?.currentPackageVersion ?? record?.packageVersion
1008
+ currentPackageVersion: row?.currentPackageVersion ?? record?.packageVersion,
1009
+ key: finalStatus.deploymentKey,
1010
+ installDeploymentKey: deployment.installDeploymentKey,
1011
+ packageName: deployment.packageName
955
1012
  };
956
1013
  const pendingResources = needsPendingResources(state) && finalStatus.deploymentKey ? await readPendingResourcesAsync(pendingResourceApis(auth), { name: deploymentName, key: finalStatus.deploymentKey }, scope) : undefined;
957
1014
  const nextSteps = deploymentNextSteps(state, pendingResources, listFlag ? ` ${listFlag}` : "");
@@ -993,7 +1050,7 @@ function acknowledgeRetryCommand(options, target) {
993
1050
  const workspace = options.personalWorkspace ? " --personal-workspace" : "";
994
1051
  address = `--name ${quoteForShell(target.deploymentName)} --package-name ${quoteForShell(target.packageName)}${workspace}`;
995
1052
  }
996
- return `uip solution deploy upgrade ${address}${version}${tenantFlag(options)} ${ACKNOWLEDGE_PERMANENT_DELETION_FLAG}`;
1053
+ return `uip solution deploy upgrade ${address}${version}${configFileFlag(options)}${tenantFlag2(options)} ${ACKNOWLEDGE_PERMANENT_DELETION_FLAG}`;
997
1054
  }
998
1055
  async function consentDraftDecisionAsync(pipelinesApi, options, target, draft, scope) {
999
1056
  if (options.noWait && !options.discardDraft) {
@@ -1003,7 +1060,7 @@ async function consentDraftDecisionAsync(pipelinesApi, options, target, draft, s
1003
1060
  return;
1004
1061
  }
1005
1062
  if (options.discardDraft) {
1006
- return fail4("pending_draft", `Deployment '${target.deploymentName}' has a pending draft (${draft.key}) that awaits the permanent-deletion confirmation, and --discard-draft would drop the links being confirmed.`, `Nothing was changed. To confirm the deletion and upgrade with those links, re-run without --discard-draft: ${acknowledgeRetryCommand(options, target)}. To keep the installed copies instead, re-run without ${ACKNOWLEDGE_PERMANENT_DELETION_FLAG}, which discards the draft: ${discardRetryCommand(options, target, draft.key)}`, INVALID_TARGET);
1063
+ return fail4("pending_draft", `Deployment '${target.deploymentName}' has a pending draft (${draft.key}) that awaits the permanent-deletion confirmation, and --discard-draft would drop the links being confirmed.`, `Nothing was changed. To confirm the deletion and upgrade with those links, re-run without --discard-draft: ${acknowledgeRetryCommand(options, target)}. To keep the installed copies instead, ${options.configFile !== undefined ? `${removeFromConfigFileStep(options.configFile)}, then ` : ""}re-run without ${ACKNOWLEDGE_PERMANENT_DELETION_FLAG}, which discards the draft: ${discardRetryCommand(options, target, draft.key)}, or remove the links from the deployment in Orchestrator first`, INVALID_TARGET);
1007
1064
  }
1008
1065
  return "rerun";
1009
1066
  }
@@ -1018,7 +1075,7 @@ async function draftAwaitsConsentAsync(pipelinesApi, options, deploymentName, dr
1018
1075
  return (resources?.length ?? 0) > 0;
1019
1076
  }
1020
1077
  function discardRetryCommand(options, target, draftKey) {
1021
- const version = `${versionFlag(options)}${tenantFlag(options)}`;
1078
+ const version = `${versionFlag(options)}${configFileFlag(options)}${tenantFlag2(options)}`;
1022
1079
  const key = draftKey ?? options.deploymentKey;
1023
1080
  if (key) {
1024
1081
  return `uip solution deploy upgrade ${quoteForShell(key)} --discard-draft${version}`;
@@ -1026,8 +1083,11 @@ function discardRetryCommand(options, target, draftKey) {
1026
1083
  const workspace = options.personalWorkspace ? " --personal-workspace" : "";
1027
1084
  return `uip solution deploy upgrade --name ${quoteForShell(target.deploymentName)} --package-name ${quoteForShell(target.packageName)}${workspace} --discard-draft${version}`;
1028
1085
  }
1029
- function tenantFlag(options) {
1030
- return options.tenant ? ` --tenant ${quoteForShell(options.tenant)}` : "";
1086
+ function removeFromConfigFileStep(configFile) {
1087
+ return `delete the entries that link them from ${quoteForShell(configFile)} first, if the file links them (a resource the file leaves out keeps its installed copy and values)`;
1088
+ }
1089
+ function configFileFlag(options) {
1090
+ return options.configFile !== undefined ? ` --config-file ${quoteForShell(options.configFile)}` : "";
1031
1091
  }
1032
1092
  function versionFlag(options) {
1033
1093
  return options.version ? ` --version ${quoteForShell(options.version)}` : "";
@@ -1051,6 +1111,7 @@ function validateTarget(options) {
1051
1111
  }
1052
1112
  async function resolveTargetByNameAsync(pipelinesApi, auth, options) {
1053
1113
  const deploymentName = options.deploymentName;
1114
+ let locationKey;
1054
1115
  let scope;
1055
1116
  if (options.personalWorkspace) {
1056
1117
  const verdict = classifyFeedSession2(auth);
@@ -1070,6 +1131,7 @@ async function resolveTargetByNameAsync(pipelinesApi, auth, options) {
1070
1131
  return fail4("personal_workspace_failed", pwError?.message ?? "Personal Workspace could not be resolved.", "Ensure your user has a Personal Workspace, then retry.");
1071
1132
  }
1072
1133
  scope = folderKeyInitOverride2(pw.key);
1134
+ locationKey = pw.key;
1073
1135
  }
1074
1136
  const [existsError] = await catchError(pipelinesApi.pipelinesGetPreActivateSteps({ deploymentName }, scope));
1075
1137
  if (existsError) {
@@ -1093,6 +1155,7 @@ async function resolveTargetByNameAsync(pipelinesApi, auth, options) {
1093
1155
  }
1094
1156
  const resolved = {
1095
1157
  deploymentName,
1158
+ locationKey,
1096
1159
  packageName: options.packageName,
1097
1160
  listFlag: scope ? "--personal-workspace" : undefined
1098
1161
  };
@@ -1193,10 +1256,12 @@ async function resolveTargetByKeyAsync(pipelinesApi, auth, options, deploymentKe
1193
1256
  if (consentDraft === "rerun") {
1194
1257
  return {
1195
1258
  ok: true,
1259
+ locationKey: info.locationKey ?? undefined,
1196
1260
  deploymentName: info.deploymentName,
1197
1261
  packageName: info.packageName,
1198
1262
  scope,
1199
1263
  listFlag,
1264
+ feedKey: info.locationKey ?? undefined,
1200
1265
  fromVersion: info.packageVersion ?? undefined,
1201
1266
  installDeploymentKey: info.installDeploymentKey,
1202
1267
  pendingDraftVersion: draft.targetVersion ?? undefined
@@ -1219,7 +1284,7 @@ async function resolveTargetByKeyAsync(pipelinesApi, auth, options, deploymentKe
1219
1284
  }));
1220
1285
  if (relookupError || !current) {
1221
1286
  const detail = relookupError ? await extractErrorDetails(relookupError) : undefined;
1222
- return fail4("lookup_failed", `The pending draft ${draft.key} of '${info.deploymentName}' was discarded, but the live deployment could not be looked up again${detail ? `: ${detail.message}` : "."}`, `Nothing was upgraded. Retry the upgrade: uip solution deploy upgrade ${quoteForShell(info.installDeploymentKey)}${versionFlag(options)}${tenantFlag(options)}`, detail ? { errorCode: detail.errorCode, retry: detail.retry } : {});
1287
+ return fail4("lookup_failed", `The pending draft ${draft.key} of '${info.deploymentName}' was discarded, but the live deployment could not be looked up again${detail ? `: ${detail.message}` : "."}`, `Nothing was upgraded. Retry the upgrade: uip solution deploy upgrade ${quoteForShell(info.installDeploymentKey)}${versionFlag(options)}${configFileFlag(options)}${tenantFlag2(options)}`, detail ? { errorCode: detail.errorCode, retry: detail.retry } : {});
1223
1288
  }
1224
1289
  if (current.status === DeploymentStatus.Draft || current.status === DeploymentStatus.SuccessfulUninstall) {
1225
1290
  return fail4("pending_draft", `The pending draft ${draft.key} of '${info.deploymentName}' was discarded, but the deployment's newest generation is now ${current.status === DeploymentStatus.Draft ? `another draft (${current.deploymentKey})` : "an uninstall"}.`, "Nothing was upgraded. Another operation on this deployment ran in between; check it with 'uip solution deploy list', then retry.", INVALID_TARGET);
@@ -1229,10 +1294,12 @@ async function resolveTargetByKeyAsync(pipelinesApi, auth, options, deploymentKe
1229
1294
  }
1230
1295
  return {
1231
1296
  ok: true,
1297
+ locationKey: live.locationKey ?? undefined,
1232
1298
  deploymentName: live.deploymentName,
1233
1299
  packageName: live.packageName,
1234
1300
  scope,
1235
1301
  listFlag,
1302
+ feedKey: info.locationKey ?? undefined,
1236
1303
  fromVersion: live.packageVersion ?? undefined,
1237
1304
  installDeploymentKey: live.installDeploymentKey,
1238
1305
  discardedDraftKey
@@ -1280,9 +1347,9 @@ function refusePendingDraft(options, target, draft) {
1280
1347
  const targetVersion = draft.targetVersion ?? "<version>";
1281
1348
  const feed = target.listFlag ? ` ${target.listFlag}` : "";
1282
1349
  const packageVersion = draft.targetVersion ? quoteForShell(draft.targetVersion) : "<version>";
1283
- const retryDraft = `uip solution deploy run --name ${quoteForShell(target.deploymentName)} --package-name ${quoteForShell(target.packageName)} --package-version ${packageVersion} --config-file <fixed-config>${feed}${tenantFlag(options)} --yes`;
1350
+ const retryDraft = `uip solution deploy run --name ${quoteForShell(target.deploymentName)} --package-name ${quoteForShell(target.packageName)} --package-version ${packageVersion} --config-file <fixed-config>${feed}${tenantFlag2(options)} --yes`;
1284
1351
  if (draft.firstInstall) {
1285
- return fail4("pending_draft", `Deployment '${target.deploymentName}' was never installed: its first install (${draft.key}) is still a pending draft, so there is nothing to upgrade.`, `The draft is an attempt that never completed, usually one rejected by validation, or one still running. To retry it with a corrected configuration: ${retryDraft} (the server re-validates the draft with the new file). To abandon it, delete it in Orchestrator.`, INVALID_TARGET);
1352
+ return fail4("pending_draft", `Deployment '${target.deploymentName}' was never installed: its first install (${draft.key}) is still a pending draft, so there is nothing to upgrade.`, `The draft is an attempt that never completed, usually one rejected by validation, or one still running. To retry it with a corrected configuration: ${retryDraft} (the server re-validates the draft with the new file). To abandon it: ${deleteDeploymentCommand2(target.deploymentName, feed, options)}, or Delete draft in Orchestrator.`, INVALID_TARGET);
1286
1353
  }
1287
1354
  if (options.discardDraft) {
1288
1355
  return;
@@ -1487,4 +1554,4 @@ async function listPackagesAsync2(options = {}) {
1487
1554
 
1488
1555
  export { activateDeploymentAsync2, listDeploymentsAsync2, uninstallDeploymentAsync2, upgradeDeploymentAsync2, listPackagesAsync2 };
1489
1556
 
1490
- //# debugId=A1C4A5D519F3025564756E2164756E21
1557
+ //# debugId=0083160698999D7564756E2164756E21
@@ -6,7 +6,7 @@ import {
6
6
  translate,
7
7
  ToolResult,
8
8
  toolsFactoryRepository
9
- } from "./packager-tool-a7s0gbxs.js";
9
+ } from "./packager-tool-devc4w73.js";
10
10
  import {
11
11
  PackagerParameters,
12
12
  setGlobalLogHandler,
@@ -22,19 +22,19 @@ import {
22
22
  ToolsFactory,
23
23
  ProjectPackager,
24
24
  PackageIdReader
25
- } from "./packager-tool-1x83nb8h.js";
25
+ } from "./packager-tool-qm876ezh.js";
26
26
  import {
27
27
  NodeFileSystem
28
- } from "./packager-tool-vgrswa8p.js";
28
+ } from "./packager-tool-1db1wqdy.js";
29
29
  import {
30
30
  PackagerDimensions,
31
31
  carriedInstructions,
32
32
  TelemetryService
33
- } from "./packager-tool-m07vyk89.js";
33
+ } from "./packager-tool-gb3dq79g.js";
34
34
  import {
35
35
  DebugTelemetryProvider,
36
36
  NodeContextStorage
37
- } from "./packager-tool-axqk17xw.js";
37
+ } from "./packager-tool-xbfr6y2x.js";
38
38
  // ../packager/project-packager/src/base-node-packager-factory.ts
39
39
  class BaseNodePackagerFactory2 {
40
40
  dotnetDiscovery;
@@ -239,6 +239,17 @@ function hasFailedResults(results) {
239
239
  function getFailedResultsMessage(results) {
240
240
  return results.filter((result) => !result.isSuccess).map((r) => r.message || "Unknown error").join(", ");
241
241
  }
242
+ var CLASSIFIED_FAILURE_CODES = new Set([
243
+ "INVALID_PROJECT" /* InvalidProject */,
244
+ "DEPENDENCY_INSTALL_FAILED" /* DependencyInstallFailed */
245
+ ]);
246
+ function getFailedResultsErrorCode(results) {
247
+ const failedCodes = results.filter((result) => !result.isSuccess).map((result) => result.errorCode);
248
+ if (failedCodes.length === 0 || !failedCodes.every((code) => CLASSIFIED_FAILURE_CODES.has(code))) {
249
+ return "INTERNAL_ERROR" /* InternalError */;
250
+ }
251
+ return failedCodes.includes("INVALID_PROJECT" /* InvalidProject */) ? "INVALID_PROJECT" /* InvalidProject */ : "DEPENDENCY_INSTALL_FAILED" /* DependencyInstallFailed */;
252
+ }
242
253
  function getFailedResultsInstructions(results) {
243
254
  const instructions = new Set;
244
255
  for (const result of results) {
@@ -755,7 +766,8 @@ class OptionsBuilder {
755
766
  package: packageInfo,
756
767
  skipDependencyOptimization: solutionOptions.packOptions?.skipDependencyOptimization ?? false,
757
768
  includeSources: solutionOptions.packOptions?.includeSources ?? false,
758
- splitPackages: solutionOptions.packOptions?.splitPackages ?? false
769
+ splitPackages: solutionOptions.packOptions?.splitPackages ?? false,
770
+ skipBuild: solutionOptions.packOptions?.skipBuild ?? false
759
771
  };
760
772
  }
761
773
  buildProjectValidateOptions(solutionOptions, project) {
@@ -1028,7 +1040,7 @@ class SolutionPackService {
1028
1040
  ...projectResults
1029
1041
  ];
1030
1042
  if (hasFailedResults(restoreAndPackResults)) {
1031
- const failure = ToolResult.error("INTERNAL_ERROR" /* InternalError */, `Solution pack failed: ${getFailedResultsMessage(restoreAndPackResults)}`, getFailedResultsInstructions(restoreAndPackResults));
1043
+ const failure = ToolResult.error(getFailedResultsErrorCode(restoreAndPackResults), `Solution pack failed: ${getFailedResultsMessage(restoreAndPackResults)}`, getFailedResultsInstructions(restoreAndPackResults));
1032
1044
  failure.details = {
1033
1045
  projects: toProjectDiagnostics(solution.Projects, projectResults)
1034
1046
  };
@@ -1481,4 +1493,4 @@ async function createNodeSolutionPackager(options) {
1481
1493
  }
1482
1494
  export { SolutionPackOptions, BaseNodePackagerFactory2, DotnetDiscoveryService2, NodePackageSignService2, createNodeProjectPackager2, INVALID_PACKAGE_ID, toProjectDiagnostics, createNodeSolutionPackager };
1483
1495
 
1484
- //# debugId=674BB2230E4EB3E364756E2164756E21
1496
+ //# debugId=CA2217AEBA80F83764756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getFileSystem
3
- } from "./packager-tool-vgrswa8p.js";
3
+ } from "./packager-tool-1db1wqdy.js";
4
4
  import {
5
5
  __require
6
6
  } from "./packager-tool-epsr41wx.js";
@@ -195,6 +195,8 @@ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(acc
195
195
  // ../auth/src/constants.ts
196
196
  var UIPATH_HOME_DIR = ".uipath";
197
197
  var AUTH_FILENAME = ".auth";
198
+ var AUTH_FILE_MODE = 384;
199
+ var AUTH_DIR_MODE = 448;
198
200
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
199
201
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
200
202
 
@@ -859,6 +861,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
859
861
  }
860
862
  return parseEnvContent(content);
861
863
  };
864
+ var findAuthHomeDir = (fs, dir) => {
865
+ let current = dir;
866
+ for (;; ) {
867
+ if (fs.path.basename(current) === UIPATH_HOME_DIR)
868
+ return current;
869
+ const parent = fs.path.dirname(current);
870
+ if (parent === current)
871
+ return;
872
+ current = parent;
873
+ }
874
+ };
875
+ var TEMP_FILE_ATTEMPTS = 5;
876
+ var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
877
+ var writeTempFile = async (fs, targetPath, content) => {
878
+ for (let attempt = 1;; attempt++) {
879
+ const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
880
+ try {
881
+ await fs.writeFile(tempPath, content, {
882
+ mode: AUTH_FILE_MODE,
883
+ exclusive: true
884
+ });
885
+ return tempPath;
886
+ } catch (error) {
887
+ if (!isFileExists(error)) {
888
+ await fs.rm(tempPath).catch(() => {});
889
+ throw error;
890
+ }
891
+ if (attempt === TEMP_FILE_ATTEMPTS)
892
+ throw error;
893
+ }
894
+ }
895
+ };
862
896
  var saveEnvFileAsync = async ({
863
897
  envPath,
864
898
  data,
@@ -886,10 +920,18 @@ var saveEnvFileAsync = async ({
886
920
  `)}
887
921
  `;
888
922
  const dir = fs.path.dirname(absolutePath);
889
- await fs.mkdir(dir);
890
- const tempPath = `${absolutePath}.tmp`;
891
- await fs.writeFile(tempPath, content);
892
- await fs.rename(tempPath, absolutePath);
923
+ await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
924
+ const authHomeDir = findAuthHomeDir(fs, dir);
925
+ if (authHomeDir !== undefined) {
926
+ await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
927
+ }
928
+ const tempPath = await writeTempFile(fs, absolutePath, content);
929
+ try {
930
+ await fs.rename(tempPath, absolutePath);
931
+ } catch (error) {
932
+ await fs.rm(tempPath).catch(() => {});
933
+ throw error;
934
+ }
893
935
  };
894
936
 
895
937
  // ../auth/src/loginStatus.ts
@@ -1486,4 +1528,4 @@ var TENANT_SELECTION_CODES = new Set([
1486
1528
  ]);
1487
1529
  export { resolveSessionIdentity, getLoginStatusAsync, getAuthContext };
1488
1530
 
1489
- //# debugId=269529FCB4F57A9664756E2164756E21
1531
+ //# debugId=3B20C7545532AB8464756E2164756E21