@uipath/solution-tool 1.204.0-preview.255 → 1.205.0-preview.256

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/README.md +3 -3
  2. package/dist/THIRD-PARTY-NOTICES.md +2 -2
  3. package/dist/archive-extract-x35t9ktj.js +120 -0
  4. package/dist/cleanup-command-service-n4e7vxnw.js +149 -0
  5. package/dist/deploy-delete-service-cag0q8yx.js +25 -0
  6. package/dist/deploy-run-service-f0h8wb9w.js +25 -0
  7. package/dist/{deploy-status-service-6svq7c6w.js → deploy-status-service-yh6xn6e0.js} +41 -33
  8. package/dist/deploy.js +23 -17
  9. package/dist/{deployment-search-v2qtz23x.js → deployment-search-mnywd9nc.js} +16 -10
  10. package/dist/{embedded-file-reader-rf2g1kfj.js → embedded-file-reader-z4becc02.js} +2 -2
  11. package/dist/{feed-resolver-xz3akamf.js → feed-resolver-fve33dxq.js} +10 -9
  12. package/dist/feed-scope-failure-jmg4t1r1.js +19 -0
  13. package/dist/{feed-session-sxga31vn.js → feed-session-7xqphdrg.js} +3 -3
  14. package/dist/governance-options-4vxz7ekn.js +32 -0
  15. package/dist/index-g8c8nf1c.js +667 -0
  16. package/dist/index-prm27bvm.js +138 -0
  17. package/dist/index.js +27 -29
  18. package/dist/init.js +11 -10
  19. package/dist/{list-tjetkspc.js → list-50mepbed.js} +10 -8
  20. package/dist/models/pack-command-types.d.ts +15 -0
  21. package/dist/node-7jm7ksqa.js +86 -0
  22. package/dist/pack-command-service-dewf5vsq.js +35 -0
  23. package/dist/pack-project-xwd1rbaa.js +97 -0
  24. package/dist/pack.js +24 -14
  25. package/dist/package-id-1wr3cy9c.js +13 -0
  26. package/dist/packager-tool-09swr9cp.js +171 -0
  27. package/dist/{packager-tool-a9jx8gf4.js → packager-tool-2vmsh5pt.js} +196 -1519
  28. package/dist/{packager-tool-px1j9kre.js → packager-tool-3bwnkjdq.js} +2 -2
  29. package/dist/{packager-tool-gb35b4qs.js → packager-tool-43ahv5mn.js} +192 -96
  30. package/dist/{packager-tool-9ha2z8h5.js → packager-tool-47by487p.js} +6 -4
  31. package/dist/packager-tool-47wzvqw0.js +86 -0
  32. package/dist/{packager-tool-zns6n8zp.js → packager-tool-5ddtwzva.js} +1 -1
  33. package/dist/packager-tool-5edvzz80.js +543 -0
  34. package/dist/{packager-tool-jq9zw82w.js → packager-tool-5n6jsn41.js} +104 -14
  35. package/dist/packager-tool-60af1hw2.js +26 -0
  36. package/dist/{packager-tool-f5gq77m5.js → packager-tool-61pwb567.js} +2 -2
  37. package/dist/{packager-tool-yrz4mwfn.js → packager-tool-6kz1pv9f.js} +1373 -486
  38. package/dist/packager-tool-6ybywxxn.js +1809 -0
  39. package/dist/packager-tool-8ptbmmmp.js +2132 -0
  40. package/dist/{packager-tool-7gr2nphb.js → packager-tool-97rcgwvv.js} +224 -6
  41. package/dist/{packager-tool-83m6ns0r.js → packager-tool-9t26kde1.js} +3556 -1646
  42. package/dist/packager-tool-act5r386.js +239 -0
  43. package/dist/packager-tool-amhyxzz6.js +125 -0
  44. package/dist/packager-tool-b03rva43.js +188 -0
  45. package/dist/{packager-tool-e2rtr49j.js → packager-tool-b2nhscfk.js} +15 -31
  46. package/dist/{packager-tool-tv9c1e80.js → packager-tool-d6rrfd46.js} +149 -53
  47. package/dist/packager-tool-frr2xmkr.js +445 -0
  48. package/dist/{packager-tool-v8bkkqdb.js → packager-tool-gmwva4yv.js} +5 -5
  49. package/dist/packager-tool-gs3f3tf7.js +103 -0
  50. package/dist/packager-tool-jg692f13.js +517 -0
  51. package/dist/packager-tool-jmpb786m.js +109 -0
  52. package/dist/{packager-tool-5sex4a1h.js → packager-tool-kds8ytzw.js} +74 -23
  53. package/dist/packager-tool-kkfb5kgn.js +182 -0
  54. package/dist/packager-tool-kvcxg0zv.js +1510 -0
  55. package/dist/packager-tool-n3jfjn5r.js +42 -0
  56. package/dist/{packager-tool-fjsn5h8s.js → packager-tool-n5d5dx5j.js} +2196 -3455
  57. package/dist/{packager-tool-yfpcvdpm.js → packager-tool-nsya65z1.js} +357 -1370
  58. package/dist/{packager-tool-fv7xyzg2.js → packager-tool-pbmqk39a.js} +126 -128
  59. package/dist/{packager-tool-bqre28m1.js → packager-tool-qw47eyw7.js} +1 -1
  60. package/dist/{packager-tool-9qgmwy21.js → packager-tool-rc3hwn4b.js} +25 -4
  61. package/dist/packager-tool-resolver-994z3jkj.js +23 -0
  62. package/dist/{packager-tool-tgw5x6vx.js → packager-tool-rvt68c1t.js} +17 -8
  63. package/dist/{packager-tool-gab9y5ct.js → packager-tool-t8gh825q.js} +37 -13
  64. package/dist/{packager-tool-kswwd3hp.js → packager-tool-tx834spe.js} +2376 -4077
  65. package/dist/{packager-tool-zf3929se.js → packager-tool-v1f5e8t9.js} +11 -1
  66. package/dist/{packager-tool-ssq2kzqm.js → packager-tool-w77d72a7.js} +13 -11
  67. package/dist/{packager-tool-1rzssy0x.js → packager-tool-wy4fx250.js} +19 -18
  68. package/dist/packager-tool-wz34ma3s.js +1333 -0
  69. package/dist/packager-tool-zq16e1xv.js +68 -0
  70. package/dist/packager-tool.js +2 -2
  71. package/dist/prepare-solution-resources-m1djfj62.js +29 -0
  72. package/dist/project-command-utils-t6pmpvq3.js +90 -0
  73. package/dist/project-contributions-79ndycrx.js +32 -0
  74. package/dist/publish.js +13 -12
  75. package/dist/resource-mutations-c3krjqze.js +36 -0
  76. package/dist/resource-version-lookup-0e3e2j58.js +99 -0
  77. package/dist/resource.js +10 -9
  78. package/dist/restore-command-service-5v0b9363.js +155 -0
  79. package/dist/run-service-tg6b67wp.js +428 -0
  80. package/dist/services/deploy-activate-service.d.ts +10 -5
  81. package/dist/services/deploy-delete-service.d.ts +8 -4
  82. package/dist/services/deploy-run-service.d.ts +34 -1
  83. package/dist/services/deploy-uninstall-service.d.ts +21 -3
  84. package/dist/services/deploy-upgrade-service.d.ts +35 -1
  85. package/dist/services/deployment-feed-locator.d.ts +15 -4
  86. package/dist/services/deployment-search-client.d.ts +5 -53
  87. package/dist/services/deployment-search.d.ts +58 -3
  88. package/dist/services/deployment-state.d.ts +84 -24
  89. package/dist/services/deployment-validation.d.ts +5 -0
  90. package/dist/services/emit-runtime-dependencies.d.ts +2 -1
  91. package/dist/services/feed-resolver.d.ts +6 -4
  92. package/dist/services/feed-selection.d.ts +47 -0
  93. package/dist/services/http-status.d.ts +2 -7
  94. package/dist/services/pack-command-service.d.ts +9 -0
  95. package/dist/services/pack-project-selection.d.ts +51 -0
  96. package/dist/services/pack-project.d.ts +26 -0
  97. package/dist/services/pack-service.d.ts +7 -3
  98. package/dist/services/package-search-client.d.ts +7 -0
  99. package/dist/services/packager-tool-resolver.d.ts +7 -1
  100. package/dist/services/packages-list-service.d.ts +1 -1
  101. package/dist/services/permanent-deletion-consent.d.ts +110 -0
  102. package/dist/services/pipeline-deploy-poll.d.ts +7 -0
  103. package/dist/services/prepare-solution-resources.d.ts +12 -2
  104. package/dist/services/project-contributions.d.ts +5 -4
  105. package/dist/services/search-failure.d.ts +9 -13
  106. package/dist/services/solution-packager-helpers.d.ts +5 -2
  107. package/dist/services/solution-path.d.ts +1 -1
  108. package/dist/services/uninstall-consent.d.ts +82 -0
  109. package/dist/ship-telemetry-myes7ak5.js +21 -0
  110. package/dist/solution-auth-aead70sw.js +11 -0
  111. package/dist/templates/AGENTS.md +125 -12
  112. package/dist/tool.js +27 -29
  113. package/dist/utils/deployment-errors.d.ts +9 -1
  114. package/package.json +2 -2
  115. package/dist/deploy-delete-service-w3e8x1kq.js +0 -22
  116. package/dist/feed-scope-failure-0j5byccb.js +0 -18
  117. package/dist/packager-tool-f2e9rzxk.js +0 -104
  118. package/dist/packager-tool-resolver-6zwhec62.js +0 -20
  119. package/dist/packager-tool-zdfn32bc.js +0 -4465
  120. package/dist/prepare-solution-resources-jpb5as2s.js +0 -25
  121. package/dist/project-contributions-6wpff2hm.js +0 -30
  122. package/dist/services/legacy-deployment-search-v3.d.ts +0 -23
@@ -0,0 +1,428 @@
1
+ import {
2
+ ProjectRunner,
3
+ RunResult,
4
+ ensureExecutorFactory,
5
+ executorsFactoryRepository
6
+ } from "./packager-tool-kkfb5kgn.js";
7
+ import {
8
+ packSolutionAsync
9
+ } from "./packager-tool-n3jfjn5r.js";
10
+ import"./packager-tool-jg692f13.js";
11
+ import"./packager-tool-t8gh825q.js";
12
+ import"./packager-tool-wy4fx250.js";
13
+ import"./packager-tool-47wzvqw0.js";
14
+ import"./packager-tool-jmpb786m.js";
15
+ import"./packager-tool-b2nhscfk.js";
16
+ import"./packager-tool-60af1hw2.js";
17
+ import"./packager-tool-wz34ma3s.js";
18
+ import"./packager-tool-09swr9cp.js";
19
+ import"./packager-tool-b03rva43.js";
20
+ import"./packager-tool-n5d5dx5j.js";
21
+ import"./packager-tool-5ddtwzva.js";
22
+ import"./packager-tool-gs3f3tf7.js";
23
+ import {
24
+ publishSolutionAsync
25
+ } from "./packager-tool-w77d72a7.js";
26
+ import {
27
+ listSelectablePublishLocations
28
+ } from "./packager-tool-rvt68c1t.js";
29
+ import"./packager-tool-97rcgwvv.js";
30
+ import {
31
+ getProjectDebugStatus,
32
+ isDebugProvisioningSucceeded,
33
+ isDebugProvisioningTerminal
34
+ } from "./packager-tool-9t26kde1.js";
35
+ import"./packager-tool-qw47eyw7.js";
36
+ import {
37
+ createResourceBuilderServices
38
+ } from "./packager-tool-6kz1pv9f.js";
39
+ import"./packager-tool-gdtpsdn7.js";
40
+ import"./packager-tool-53w8skv5.js";
41
+ import"./packager-tool-pbmqk39a.js";
42
+ import {
43
+ getSolutionAuthContext
44
+ } from "./packager-tool-61pwb567.js";
45
+ import"./packager-tool-8ptbmmmp.js";
46
+ import"./packager-tool-5edvzz80.js";
47
+ import {
48
+ getLoginStatusAsync
49
+ } from "./packager-tool-43ahv5mn.js";
50
+ import {
51
+ PollOutcome,
52
+ logger,
53
+ pollUntil,
54
+ processContext
55
+ } from "./packager-tool-tx834spe.js";
56
+ import {
57
+ carriedInstructions,
58
+ catchError
59
+ } from "./packager-tool-6ybywxxn.js";
60
+ import {
61
+ getFileSystem
62
+ } from "./packager-tool-v1f5e8t9.js";
63
+ import"./packager-tool-dfrk01gn.js";
64
+ import"./packager-tool-1de529jm.js";
65
+
66
+ // src/services/executor-tool-resolver.ts
67
+ var PROJECT_TYPE_TO_TOOL = new Map([
68
+ ["Process", "rpa"],
69
+ ["Tests", "rpa"],
70
+ ["WebApp", "rpa"],
71
+ ["Agent", "agent"],
72
+ ["Api", "api-workflow"]
73
+ ]);
74
+ var TOOL_TO_PACKAGE = new Map([
75
+ ["rpa", "@uipath/rpa-tool"],
76
+ ["agent", "@uipath/agent-tool"],
77
+ ["api-workflow", "@uipath/api-workflow-tool"]
78
+ ]);
79
+ function hasExecutorToolFor(projectType) {
80
+ return PROJECT_TYPE_TO_TOOL.has(projectType);
81
+ }
82
+ async function ensureExecutorTools(projectTypes) {
83
+ const neededTools = new Set;
84
+ for (const type of projectTypes) {
85
+ if (executorsFactoryRepository.canHandleProject(type))
86
+ continue;
87
+ const toolVerb = PROJECT_TYPE_TO_TOOL.get(type);
88
+ if (toolVerb) {
89
+ neededTools.add(toolVerb);
90
+ } else {
91
+ logger.warn(`No installable tool runs project type '${type}'. Run may fail.`);
92
+ }
93
+ }
94
+ for (const toolVerb of neededTools) {
95
+ logger.info(`Loading executor factory for '${toolVerb}' to run project types...`);
96
+ await ensureExecutorFactory(toolVerb, TOOL_TO_PACKAGE.get(toolVerb));
97
+ }
98
+ }
99
+ function projectDirOf(fs, declaredPath) {
100
+ const dir = fs.path.dirname(declaredPath);
101
+ return dir && dir !== "." ? dir : "";
102
+ }
103
+ async function readSolutionProjects(solutionDir, fs) {
104
+ const entries = await fs.readdir(solutionDir);
105
+ const uipxFile = entries.find((f) => f.endsWith(".uipx"));
106
+ if (!uipxFile) {
107
+ throw new Error(`No .uipx solution file found in '${solutionDir}'. ` + `Pass a solution directory or run 'uip solution init' first.`);
108
+ }
109
+ const content = await fs.readFile(fs.path.join(solutionDir, uipxFile));
110
+ if (!content) {
111
+ throw new Error(`Solution file '${uipxFile}' is empty.`);
112
+ }
113
+ const json = typeof content === "string" ? content : new TextDecoder().decode(content);
114
+ const [parseError, solution] = catchError(() => JSON.parse(json));
115
+ if (parseError) {
116
+ throw new Error(`Failed to parse ${uipxFile}: ${parseError.message}`);
117
+ }
118
+ return (solution.Projects ?? []).map((p) => {
119
+ const relativePath = projectDirOf(fs, p.ProjectRelativePath ?? "");
120
+ return {
121
+ name: p.Name || fs.path.basename(relativePath || solutionDir) || "",
122
+ projectType: p.Type ?? "",
123
+ relativePath
124
+ };
125
+ });
126
+ }
127
+
128
+ // src/services/provision-debug-service.ts
129
+ function nextDebugVersion() {
130
+ return `1.0.${Math.floor(Date.now() / 1000)}`;
131
+ }
132
+ async function defaultGetSolutionBuilder(solutionDir) {
133
+ const services = await createResourceBuilderServices();
134
+ return services.getSolutionBuilder(solutionDir, true);
135
+ }
136
+ async function provisionSolutionForDebugAsync(options, deps = {}) {
137
+ const listLocations = deps.listLocations ?? listSelectablePublishLocations;
138
+ const pack = deps.pack ?? packSolutionAsync;
139
+ const publish = deps.publish ?? publishSolutionAsync;
140
+ const getBuilder = deps.getSolutionBuilder ?? defaultGetSolutionBuilder;
141
+ const newSessionId = deps.newSessionId ?? (() => crypto.randomUUID());
142
+ const authOptions = {
143
+ tenant: options.tenant,
144
+ loginValidity: options.loginValidity
145
+ };
146
+ const getDebugStatus = deps.getDebugStatus ?? (async (solutionKey2, debugSessionId) => {
147
+ const auth = await getSolutionAuthContext(authOptions);
148
+ return getProjectDebugStatus({ basePath: auth.basePath, accessToken: auth.accessToken }, solutionKey2, debugSessionId);
149
+ });
150
+ logger.info("Resolving the personal workspace to deploy into...");
151
+ const [locationsError, locations] = await catchError(listLocations(authOptions));
152
+ if (locationsError) {
153
+ return fail(`Could not resolve a personal workspace to deploy into: ${locationsError.message}`);
154
+ }
155
+ const personal = locations.find((l) => l.isMyPersonalWorkspace);
156
+ if (!personal) {
157
+ return fail("This account has no personal workspace, so there is nowhere to deploy the solution for a debug run. " + "Ask an administrator to enable a personal workspace, or run with --no-provision-resources — " + "the run then starts without a deployment, and cross-project calls will not resolve.");
158
+ }
159
+ const version = options.version ?? nextDebugVersion();
160
+ const fs = getFileSystem();
161
+ const outputPath = fs.path.join(fs.env.tmpdir(), "uip-solution-run", newSessionId());
162
+ const uploaded = await packAndUploadAsync({
163
+ options,
164
+ authOptions,
165
+ pack,
166
+ publish,
167
+ version,
168
+ outputPath
169
+ });
170
+ if (!uploaded.ok) {
171
+ return fail(uploaded.message);
172
+ }
173
+ const packageVersionKey = uploaded.packageVersionKey;
174
+ logger.info("Provisioning the solution's resources for the run...");
175
+ const [builderError, builder] = await catchError(getBuilder(options.solutionDir));
176
+ if (builderError) {
177
+ return fail(`Could not read the solution: ${builderError.message}`);
178
+ }
179
+ const sessionId = newSessionId();
180
+ const [debugError, debug] = await catchError(builder.debugProjectAsync(personal.key, options.solutionName, sessionId, packageVersionKey, true));
181
+ let solutionKey;
182
+ if (!debugError && debug.complete === false) {
183
+ const [, definition] = await catchError(builder.context.loadAsync());
184
+ solutionKey = definition?.key;
185
+ }
186
+ await builder.disposeAsync().catch(() => {});
187
+ if (debugError) {
188
+ return fail(`Provisioning the solution failed: ${debugError.message}`);
189
+ }
190
+ if (debug.complete === false) {
191
+ if (!solutionKey) {
192
+ return fail("The cloud is still provisioning the solution, but its key could not be read back from the .uipx, so the provisioning cannot be waited on. Retry the run.");
193
+ }
194
+ return waitForProvisioningAsync({
195
+ solutionKey,
196
+ sessionId,
197
+ packageVersionKey,
198
+ options,
199
+ getDebugStatus
200
+ });
201
+ }
202
+ const folderPath = debug.folderFullyQualifiedName;
203
+ logger.info(folderPath ? `Solution provisioned into ${folderPath}.` : "Solution provisioned.");
204
+ return {
205
+ ok: true,
206
+ folderPath,
207
+ packageVersionKey
208
+ };
209
+ }
210
+ function fail(message) {
211
+ return { ok: false, message };
212
+ }
213
+ async function packAndUploadAsync(args) {
214
+ const { options, authOptions, version } = args;
215
+ logger.info("Packing the solution...");
216
+ const [packError, packed] = await catchError(args.pack(options.solutionDir, {
217
+ output: args.outputPath,
218
+ name: options.solutionName,
219
+ version,
220
+ loginValidity: options.loginValidity
221
+ }));
222
+ if (packError) {
223
+ return {
224
+ ok: false,
225
+ message: `Packing the solution failed: ${packError.message}`
226
+ };
227
+ }
228
+ if (!packed.ok) {
229
+ return {
230
+ ok: false,
231
+ message: `Packing the solution failed: ${packed.message}`
232
+ };
233
+ }
234
+ const packagePath = packed.packages?.[0];
235
+ if (!packagePath) {
236
+ return {
237
+ ok: false,
238
+ message: "Packing the solution produced no package."
239
+ };
240
+ }
241
+ logger.info("Uploading the solution to the personal workspace...");
242
+ const [publishError, published] = await catchError(args.publish(packagePath, {
243
+ ...authOptions,
244
+ personalWorkspace: true,
245
+ packageVersion: version
246
+ }));
247
+ if (publishError) {
248
+ return {
249
+ ok: false,
250
+ message: `Uploading the solution failed: ${publishError.message}`
251
+ };
252
+ }
253
+ if (!published.ok) {
254
+ return {
255
+ ok: false,
256
+ message: `Uploading the solution failed: ${published.message}`
257
+ };
258
+ }
259
+ if (!published.packageVersionKey) {
260
+ return {
261
+ ok: false,
262
+ message: "The solution was uploaded but the feed did not report a package version, so it cannot be provisioned. Retry the run."
263
+ };
264
+ }
265
+ return { ok: true, packageVersionKey: published.packageVersionKey };
266
+ }
267
+ async function waitForProvisioningAsync(args) {
268
+ const { solutionKey, sessionId, packageVersionKey, options } = args;
269
+ const timeoutMs = options.provisioningTimeoutMs ?? 360000;
270
+ logger.info("Waiting for the cloud to finish provisioning...");
271
+ const poll = await pollUntil({
272
+ fn: () => args.getDebugStatus(solutionKey, sessionId),
273
+ until: (info2) => isDebugProvisioningTerminal(info2.status),
274
+ getStatus: (info2) => info2.status ?? "pending",
275
+ label: `solution provisioning (session ${sessionId})`,
276
+ logPrefix: "provision",
277
+ timeoutMs,
278
+ intervalMs: options.provisioningPollIntervalMs ?? 5000,
279
+ maxConsecutiveErrors: 5,
280
+ signal: processContext.pollSignal
281
+ });
282
+ if (poll.outcome !== PollOutcome.Completed || !poll.data) {
283
+ return fail(describeIncompleteWait(poll, timeoutMs));
284
+ }
285
+ const info = poll.data;
286
+ if (!isDebugProvisioningSucceeded(info.status)) {
287
+ const details = (info.errors ?? []).map((error) => error.resource ? `${error.resource.kind ?? "resource"} '${error.resource.name ?? error.resource.key ?? ""}': ${error.message}` : error.message).join(`
288
+ `);
289
+ return fail(`Provisioning the solution failed (${info.status}).` + (details ? `
290
+ ${details}` : ""));
291
+ }
292
+ logger.info("Solution provisioned.");
293
+ return { ok: true, packageVersionKey };
294
+ }
295
+ function describeIncompleteWait(poll, timeoutMs) {
296
+ const lastStatus = poll.data?.status ?? "unknown";
297
+ if (poll.outcome === PollOutcome.Interrupted) {
298
+ return `The wait for the solution's provisioning was cancelled (last status: ${lastStatus}). ` + "The cloud may still finish it.";
299
+ }
300
+ if (poll.outcome === PollOutcome.Failed || poll.outcome === PollOutcome.Aborted) {
301
+ return `Checking the solution's provisioning status failed: ${poll.error?.message ?? "too many consecutive errors"} ` + `(last status: ${lastStatus}). The provisioning itself may still be running or have finished — ` + "retry the run to check.";
302
+ }
303
+ return `The solution was uploaded, but the cloud did not finish provisioning it within ${Math.round(timeoutMs / 1000)}s ` + `(last status: ${lastStatus}). ` + "Running again will not help: each run uploads a new version and provisions that one too. " + "To run a project that calls another project, deploy the solution once " + "('uip solution pack' → 'publish' → 'deploy run') and then run with " + "--no-provision-resources --folder-path <deployed folder>.";
304
+ }
305
+
306
+ // src/services/run-service.ts
307
+ async function runSolutionAsync(options, deps, cancellationToken) {
308
+ const { fileSystem } = deps;
309
+ const solutionDir = fileSystem.path.resolve(options.solutionPath);
310
+ const [readError, projects] = await catchError(readSolutionProjects(solutionDir, fileSystem));
311
+ if (readError) {
312
+ return RunResult.failed("InvalidInput" /* InvalidInput */, readError.message);
313
+ }
314
+ const runnable = projects.filter((p) => hasExecutorToolFor(p.projectType));
315
+ if (runnable.length === 0) {
316
+ const seen = projects.map((p) => `${p.name} (${p.projectType})`).join(", ") || "none";
317
+ return RunResult.failed("UnsupportedProjectType" /* UnsupportedProjectType */, `No project in this solution can be run. Projects: ${seen}.`);
318
+ }
319
+ const [selectionError, selected] = selectProject(runnable, options.projectName);
320
+ if (selectionError) {
321
+ return RunResult.failed("InvalidInput" /* InvalidInput */, selectionError);
322
+ }
323
+ const provision = deps.provisionForDebug ?? provisionSolutionForDebugAsync;
324
+ const shouldProvision = options.provisionResources ?? projects.length > 1;
325
+ const [executorOutcome, provisionOutcome] = await Promise.allSettled([
326
+ ensureExecutorTools([selected.projectType]),
327
+ shouldProvision ? provision({
328
+ solutionDir,
329
+ solutionName: fileSystem.path.basename(solutionDir),
330
+ tenant: options.tenant,
331
+ loginValidity: options.loginValidity
332
+ }) : Promise.resolve(undefined)
333
+ ]);
334
+ if (executorOutcome.status === "rejected") {
335
+ return RunResult.failed("PrepareFailed" /* PrepareFailed */, `Could not load the runner for project type '${selected.projectType}': ${describeError(executorOutcome.reason)}`);
336
+ }
337
+ if (provisionOutcome.status === "rejected") {
338
+ return RunResult.failed("PrepareFailed" /* PrepareFailed */, `Could not deploy the solution before the run: ${describeError(provisionOutcome.reason)}`);
339
+ }
340
+ let folderPath = options.folderPath;
341
+ const provisioned = provisionOutcome.value;
342
+ if (provisioned) {
343
+ if (!provisioned.ok) {
344
+ return RunResult.failed("PrepareFailed" /* PrepareFailed */, provisioned.message ?? "Could not deploy the solution before the run.");
345
+ }
346
+ folderPath = provisioned.folderPath;
347
+ }
348
+ const projectPath = fileSystem.path.resolve(solutionDir, selected.relativePath);
349
+ logger.debug(`Running '${selected.name}' (${selected.projectType}) from ${projectPath}` + `${options.entryPoint ? ` with entry point ${options.entryPoint}` : " with its default entry point"}`);
350
+ const connection = await resolveConnection(folderPath, options, deps);
351
+ const runner = new ProjectRunner({
352
+ fileSystem,
353
+ logger: deps.logger
354
+ });
355
+ return runner.runAsync({
356
+ project: {
357
+ name: selected.name,
358
+ projectType: selected.projectType,
359
+ projectPath
360
+ },
361
+ entryPoint: options.entryPoint,
362
+ inputArguments: options.inputArguments,
363
+ target: "Local" /* Local */,
364
+ connection,
365
+ siblingProjects: projects.filter((p) => p !== selected).map((p) => ({
366
+ name: p.name,
367
+ projectType: p.projectType,
368
+ projectPath: fileSystem.path.resolve(solutionDir, p.relativePath)
369
+ })),
370
+ timeoutMs: options.timeoutMs
371
+ }, cancellationToken);
372
+ }
373
+ async function resolveConnection(folderPath, options, deps) {
374
+ const getLoginStatus = deps.getLoginStatus ?? getLoginStatusAsync;
375
+ const [loginError, status] = await catchError(getLoginStatus({
376
+ ensureTokenValidityMinutes: options.loginValidity
377
+ }));
378
+ if (loginError || status.loginStatus !== "Logged in") {
379
+ logger.debug(`No signed-in session for the run: ${loginError?.message ?? status.loginStatus}. ` + "A project type that needs one will say so.");
380
+ return {
381
+ folderPath,
382
+ baseUrl: "",
383
+ accessToken: "",
384
+ organizationId: "",
385
+ organizationName: ""
386
+ };
387
+ }
388
+ return {
389
+ folderPath,
390
+ baseUrl: status.baseUrl ?? "",
391
+ accessToken: status.accessToken ?? "",
392
+ organizationId: status.organizationId ?? "",
393
+ organizationName: status.organizationName ?? "",
394
+ tenantId: status.tenantId,
395
+ tenantName: status.tenantName
396
+ };
397
+ }
398
+ function describeError(reason) {
399
+ const message = reason instanceof Error ? reason.message : String(reason);
400
+ const instructions = carriedInstructions(reason);
401
+ return instructions ? `${message} ${instructions}` : message;
402
+ }
403
+ function selectProject(runnable, requested) {
404
+ if (requested) {
405
+ const match = runnable.find((p) => p.name === requested);
406
+ if (!match) {
407
+ const names = runnable.map((p) => p.name).join(", ");
408
+ return [
409
+ `Project '${requested}' is not a runnable project in this solution. Runnable projects: ${names}.`,
410
+ runnable[0]
411
+ ];
412
+ }
413
+ return [undefined, match];
414
+ }
415
+ if (runnable.length > 1) {
416
+ const names = runnable.map((p) => p.name).join(", ");
417
+ return [
418
+ `This solution has more than one runnable project, so one has to be named with --project-name. Runnable projects: ${names}.`,
419
+ runnable[0]
420
+ ];
421
+ }
422
+ return [undefined, runnable[0]];
423
+ }
424
+ export {
425
+ runSolutionAsync
426
+ };
427
+
428
+ //# debugId=56CE2FF893D2961664756E2164756E21
@@ -1,12 +1,17 @@
1
1
  import { type CliErrorCode, type RetryHint } from "@uipath/common";
2
+ import { type FeedSelectionFlags } from "./feed-selection";
2
3
  export type ActivateDeploymentFailureReason = "auth_failed"
4
+ /** `--feed` named no feed this session can reach. */
5
+ | "feed_resolution_failed"
6
+ /** `--feed` / `--personal-workspace` with a session the server would not scope. */
7
+ | "feed_requires_user_session"
3
8
  /** Activation HTTP request failed (e.g. unknown deployment name). */
4
9
  | "request_failed"
5
10
  /** Activation poll didn't reach a terminal state — recommended exit 2 (CI distinguishability). */
6
11
  | "poll_timeout" | "poll_failed" | "poll_aborted"
7
12
  /** Activation reached a terminal state but was a failure. */
8
13
  | "activation_failed";
9
- export interface ActivateDeploymentOptions {
14
+ export interface ActivateDeploymentOptions extends Pick<FeedSelectionFlags, "personalWorkspace" | "feed"> {
10
15
  /**
11
16
  * Override the active tenant for auth resolution. The CLI's deprecated
12
17
  * `--tenant` flag flows through here; library callers usually omit it.
@@ -39,10 +44,10 @@ export interface ActivateDeploymentFailure {
39
44
  exitCode: number;
40
45
  /**
41
46
  * Set only when the service knows better than the formatter's guess from
42
- * the message — today, a refusal that followed a feed sweep which could
43
- * not ask every feed: the sweep's classification for a refusal about the
44
- * name or feed, the request's own for any other. Absent everywhere else,
45
- * as before.
47
+ * the message: a refused feed selection, or a refusal that followed a
48
+ * feed sweep which could not ask every feed (the sweep's classification
49
+ * for a refusal about the name or feed, the request's own for any other).
50
+ * Absent everywhere else, as before.
46
51
  */
47
52
  errorCode?: CliErrorCode;
48
53
  retry?: RetryHint;
@@ -1,5 +1,10 @@
1
1
  import { type CliErrorCode, type RetryHint } from "@uipath/common";
2
+ import { type FeedSelectionFlags } from "./feed-selection";
2
3
  export type DeleteDeploymentFailureReason = "auth_failed"
4
+ /** `--feed` named no feed this session can reach. */
5
+ | "feed_resolution_failed"
6
+ /** `--feed` / `--personal-workspace` with a session the server would not scope. */
7
+ | "feed_requires_user_session"
3
8
  /**
4
9
  * No deployment with that name in the tenant feed or any feed swept after
5
10
  * it — and every one of those feeds answered.
@@ -20,7 +25,7 @@ export type DeleteDeploymentFailureReason = "auth_failed"
20
25
  | "delete_unavailable"
21
26
  /** The DELETE request itself failed. */
22
27
  | "delete_request_failed";
23
- export interface DeleteDeploymentOptions {
28
+ export interface DeleteDeploymentOptions extends Pick<FeedSelectionFlags, "personalWorkspace" | "feed"> {
24
29
  /**
25
30
  * Override the active tenant for auth resolution. The CLI's deprecated
26
31
  * `--tenant` flag flows through here; library callers usually omit it.
@@ -49,9 +54,8 @@ export type DeleteDeploymentResult = DeleteDeploymentSuccess | DeleteDeploymentF
49
54
  /**
50
55
  * Programmatic core of `uip solution deploy delete` (UV-16671, UV-16341).
51
56
  *
52
- * Calls `DELETE /api/deployments/{key}`, which the CLI never reached before:
53
- * the SDK generator kept only `get` for that path, so the route looked absent
54
- * and both tickets were read as a platform gap.
57
+ * Sends the delete through the Pipelines route, so a CI/CD pipeline logged in
58
+ * as an external application can run it (see {@link sendDeleteAsync}).
55
59
  *
56
60
  * Delete is not a second name for uninstall. `deploy uninstall` removes the
57
61
  * provisioned resources and the solution folder of a live deployment, and
@@ -1,6 +1,7 @@
1
1
  import { type CliErrorCode, type RetryHint } from "@uipath/common";
2
2
  import { type PendingResource } from "./deployment-state";
3
3
  import { type FeedScope } from "./feed-resolver";
4
+ import { type PermanentDeletionResource } from "./permanent-deletion-consent";
4
5
  /** Discriminator for {@link DeployFailure}; library callers can ignore the tag and read `.message`/`.instructions`. */
5
6
  export type DeployFailureReason = "auth_failed"
6
7
  /**
@@ -41,7 +42,16 @@ export type DeployFailureReason = "auth_failed"
41
42
  /** Activation poll didn't reach a terminal state. */
42
43
  | "activation_poll_failed"
43
44
  /** Activation reached a terminal state but it was a failure. */
44
- | "activation_failed";
45
+ | "activation_failed"
46
+ /**
47
+ * The server wants the permanent deletion of installed resources replaced
48
+ * by links confirmed (schedule error 4026), and `acknowledgePermanentDeletion`
49
+ * was not set, the resources could not be listed, or the re-run after
50
+ * acknowledging them was refused again. Nothing was installed.
51
+ */
52
+ | "permanent_deletion_confirmation_required"
53
+ /** Acknowledging a flagged resource failed; the install was not re-run. */
54
+ | "acknowledge_failed";
45
55
  export interface DeployOptions {
46
56
  /** Override the active tenant for auth + folder-lookup. The CLI's deprecated `--tenant` flag flows through here. */
47
57
  tenant?: string;
@@ -85,6 +95,15 @@ export interface DeployOptions {
85
95
  * that really do want a second, independent copy opt in here.
86
96
  */
87
97
  yes?: boolean;
98
+ /**
99
+ * Confirm that installed resources this deployment replaces with a link
100
+ * are permanently deleted with their data. Without it a deploy the server
101
+ * stops for that confirmation fails with
102
+ * `permanent_deletion_confirmation_required` and lists them; with it they
103
+ * are acknowledged and the identical install runs once more, inside the
104
+ * same `timeout`.
105
+ */
106
+ acknowledgePermanentDeletion?: boolean;
88
107
  /** Host-side cancellation for both poll loops (e.g. VS Code's cancel button); replaces `processContext.pollSignal`. */
89
108
  signal?: AbortSignal;
90
109
  }
@@ -131,6 +150,11 @@ export interface DeploySuccess {
131
150
  packageVersion?: string;
132
151
  /** Which feed the deploy targeted — drives telemetry `target`. */
133
152
  feedKind: FeedScope["kind"];
153
+ /**
154
+ * The installed resources acknowledged for permanent deletion before the
155
+ * install that succeeded (`kind 'name'`). Absent when none were.
156
+ */
157
+ permanentlyDeletedResources?: string[];
134
158
  }
135
159
  export interface DeployFailure {
136
160
  ok: false;
@@ -152,6 +176,15 @@ export interface DeployFailure {
152
176
  */
153
177
  errorCode?: CliErrorCode;
154
178
  retry?: RetryHint;
179
+ /** The refused attempt's draft, on a permanent-deletion refusal. */
180
+ deploymentKey?: string;
181
+ /** What the server wants confirmed, on a permanent-deletion refusal. */
182
+ permanentDeletionResources?: PermanentDeletionResource[];
183
+ /**
184
+ * Resources already acknowledged for permanent deletion when the deploy
185
+ * failed after the install that deleted them (activation failures).
186
+ */
187
+ permanentlyDeletedResources?: string[];
155
188
  }
156
189
  export type DeployResult = DeploySuccess | DeployFailure;
157
190
  /**
@@ -1,5 +1,10 @@
1
1
  import { type CliErrorCode, type RetryHint } from "@uipath/common";
2
- export type UninstallDeploymentFailureReason = "auth_failed" | "uninstall_request_failed"
2
+ import { type FeedSelectionFlags } from "./feed-selection";
3
+ export type UninstallDeploymentFailureReason = "auth_failed"
4
+ /** `--feed` named no feed this session can reach. */
5
+ | "feed_resolution_failed"
6
+ /** `--feed` / `--personal-workspace` with a session the server would not scope. */
7
+ | "feed_requires_user_session" | "uninstall_request_failed"
3
8
  /**
4
9
  * Orchestrator refused the uninstall because the deployment still had an
5
10
  * operation running, and it was still running when the wait ran out —
@@ -9,8 +14,13 @@ export type UninstallDeploymentFailureReason = "auth_failed" | "uninstall_reques
9
14
  /** Uninstall poll didn't reach a terminal state — recommended exit 2 (CI distinguishability). */
10
15
  | "poll_timeout" | "poll_failed" | "poll_aborted"
11
16
  /** Uninstall reached a terminal state but it was `FailedUninstall`. */
12
- | "uninstall_failed";
13
- export interface UninstallDeploymentOptions {
17
+ | "uninstall_failed"
18
+ /**
19
+ * Refused for a cause only `--force` gets past: uncompleted jobs, or the
20
+ * permanent deletion of installed resources replaced by links.
21
+ */
22
+ | "uninstall_confirmation_required";
23
+ export interface UninstallDeploymentOptions extends Pick<FeedSelectionFlags, "personalWorkspace" | "feed"> {
14
24
  /**
15
25
  * Override the active tenant for auth resolution. The CLI's deprecated
16
26
  * `--tenant` flag flows through here; library callers usually omit it.
@@ -30,6 +40,12 @@ export interface UninstallDeploymentOptions {
30
40
  loginValidity?: number;
31
41
  /** Host-side cancellation for the poll loop; replaces `processContext.pollSignal`. */
32
42
  signal?: AbortSignal;
43
+ /**
44
+ * Send `forceUninstall`: uninstall past uncompleted jobs and the
45
+ * permanent deletion of resources replaced by links. The caller's consent;
46
+ * never set on the caller's behalf.
47
+ */
48
+ force?: boolean;
33
49
  }
34
50
  export interface UninstallDeploymentSuccess {
35
51
  ok: true;
@@ -55,6 +71,8 @@ export interface UninstallDeploymentFailure {
55
71
  */
56
72
  errorCode?: CliErrorCode;
57
73
  retry?: RetryHint;
74
+ /** Structured facts for the failure envelope's `Data`, keys as printed. */
75
+ data?: Record<string, unknown>;
58
76
  }
59
77
  export type UninstallDeploymentResult = UninstallDeploymentSuccess | UninstallDeploymentFailure;
60
78
  /**
@@ -1,6 +1,7 @@
1
1
  import type { CliErrorCode, PollFailureReason, RetryHint } from "@uipath/common";
2
2
  import type { PipelineDeploymentStatus } from "@uipath/pipelines-sdk";
3
3
  import { type PendingResource } from "./deployment-state";
4
+ import { type PermanentDeletionResource } from "./permanent-deletion-consent";
4
5
  export type UpgradeDeploymentFailureReason =
5
6
  /** Neither a deployment key nor a name+package pair was given, or both were. */
6
7
  "invalid_target" | "auth_failed"
@@ -51,7 +52,16 @@ export type UpgradeDeploymentFailureReason =
51
52
  * interrupted / aborted. Distinct from `install_timeout`: the deadline was
52
53
  * never reached, so a longer `--timeout` is not the fix.
53
54
  */
54
- | PollFailureReason;
55
+ | PollFailureReason
56
+ /**
57
+ * The server wants the permanent deletion of installed resources replaced
58
+ * by links confirmed (schedule error 4026), and `acknowledgePermanentDeletion`
59
+ * was not set, the resources could not be listed, or the re-run after
60
+ * acknowledging them was refused again. Nothing was installed.
61
+ */
62
+ | "permanent_deletion_confirmation_required"
63
+ /** Acknowledging a flagged resource failed; the upgrade was not re-run. */
64
+ | "acknowledge_failed";
55
65
  export interface UpgradeDeploymentOptions {
56
66
  /**
57
67
  * Key of the deployment to upgrade, as `deploy list` reports it. Resolved
@@ -105,6 +115,19 @@ export interface UpgradeDeploymentOptions {
105
115
  * the deployment by key.
106
116
  */
107
117
  discardDraft?: boolean;
118
+ /**
119
+ * Confirm that installed resources the new version replaces with a link
120
+ * are permanently deleted with their data. Without it an upgrade the
121
+ * server stops for that confirmation fails with
122
+ * `permanent_deletion_confirmation_required` and lists them; with it they
123
+ * are acknowledged and the identical install runs once more, inside the
124
+ * same `timeout`. Has no effect with `noWait`, which never sees the run end.
125
+ * Also lets through a pending draft of the requested version (or, with no
126
+ * version given, of its own) whose only open question is this
127
+ * confirmation: that draft is re-run instead of refused, so the links it
128
+ * carries are kept and acknowledged.
129
+ */
130
+ acknowledgePermanentDeletion?: boolean;
108
131
  /** Minimum minutes before token expiration to trigger a refresh. Default 10. */
109
132
  loginValidity?: number;
110
133
  /**
@@ -192,6 +215,11 @@ export interface UpgradeDeploymentSuccess {
192
215
  pendingResources?: PendingResource[];
193
216
  /** What is left before the new version runs; absent when it does. */
194
217
  nextSteps?: string[];
218
+ /**
219
+ * The installed resources acknowledged for permanent deletion before the
220
+ * install that succeeded (`kind 'name'`). Absent when none were.
221
+ */
222
+ permanentlyDeletedResources?: string[];
195
223
  }
196
224
  export interface UpgradeDeploymentFailure {
197
225
  ok: false;
@@ -208,6 +236,12 @@ export interface UpgradeDeploymentFailure {
208
236
  */
209
237
  errorCode?: CliErrorCode;
210
238
  retry?: RetryHint;
239
+ /** The refused run, on a permanent-deletion refusal. */
240
+ pipelineDeploymentId?: string;
241
+ /** The refused attempt's draft, on a permanent-deletion refusal. */
242
+ deploymentKey?: string;
243
+ /** What the server wants confirmed, on a permanent-deletion refusal. */
244
+ permanentDeletionResources?: PermanentDeletionResource[];
211
245
  }
212
246
  export type UpgradeDeploymentResult = UpgradeDeploymentSuccess | UpgradeDeploymentFailure;
213
247
  /**