@uipath/solution-tool 1.203.0-preview.212 → 1.204.0-preview.211

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 (76) hide show
  1. package/README.md +2 -2
  2. package/dist/THIRD-PARTY-NOTICES.md +4 -4
  3. package/dist/deploy-delete-service-gg00vadc.js +22 -0
  4. package/dist/deploy-status-service-cqfrvxpz.js +256 -0
  5. package/dist/deploy.d.ts +11 -4
  6. package/dist/deploy.js +19 -7
  7. package/dist/deployment-search-j34w33b2.js +49 -0
  8. package/dist/{embedded-file-reader-xxqe8vs8.js → embedded-file-reader-rf2g1kfj.js} +2 -2
  9. package/dist/feed-resolver-31gcvnnk.js +27 -0
  10. package/dist/feed-scope-failure-fwtdvvrh.js +18 -0
  11. package/dist/feed-session-sxga31vn.js +17 -0
  12. package/dist/index.js +27 -18
  13. package/dist/init.js +10 -7
  14. package/dist/{list-xjdnbyka.js → list-q4dzkv45.js} +9 -6
  15. package/dist/pack.js +14 -11
  16. package/dist/{packager-tool-7qmx64kz.js → packager-tool-00vh1ktg.js} +1022 -1342
  17. package/dist/packager-tool-1phh2rfx.js +37 -0
  18. package/dist/{packager-tool-vas0xg5h.js → packager-tool-2cntqvdv.js} +5 -3
  19. package/dist/{packager-tool-1haahq17.js → packager-tool-3enm2h28.js} +5 -5
  20. package/dist/{packager-tool-2syrt51a.js → packager-tool-3fv6zc86.js} +1062 -825
  21. package/dist/{packager-tool-grtmkd54.js → packager-tool-3m36mxn7.js} +16 -74
  22. package/dist/packager-tool-40vcj4wv.js +172 -0
  23. package/dist/packager-tool-482eg22x.js +322 -0
  24. package/dist/{packager-tool-k4mskzww.js → packager-tool-5dzjsw5q.js} +3 -3
  25. package/dist/{packager-tool-0f0wt9vh.js → packager-tool-5fjp60dk.js} +3071 -2794
  26. package/dist/{packager-tool-bkwnetqn.js → packager-tool-83rzavkx.js} +383 -88
  27. package/dist/{packager-tool-f423v35w.js → packager-tool-9hj0cfd0.js} +756 -359
  28. package/dist/{packager-tool-7znqtw3f.js → packager-tool-9vvdgbay.js} +8 -6
  29. package/dist/packager-tool-bqre28m1.js +43 -0
  30. package/dist/packager-tool-f5gq77m5.js +28 -0
  31. package/dist/{packager-tool-nzghfa48.js → packager-tool-fv7xyzg2.js} +550 -2
  32. package/dist/{packager-tool-3jrq7smt.js → packager-tool-gb35b4qs.js} +206 -289
  33. package/dist/{packager-tool-4kdt8mys.js → packager-tool-j30xck4w.js} +1008 -647
  34. package/dist/packager-tool-ks8spnq8.js +166 -0
  35. package/dist/packager-tool-q3tgpemc.js +113 -0
  36. package/dist/packager-tool-qdtjywsk.js +173 -0
  37. package/dist/{packager-tool-2p5yh1q9.js → packager-tool-qgaqqq41.js} +320 -151
  38. package/dist/packager-tool-qm24rbae.js +5889 -0
  39. package/dist/{packager-tool-resolver-fmjr60x8.js → packager-tool-resolver-2cbxyq6k.js} +6 -5
  40. package/dist/{packager-tool-znakt6yw.js → packager-tool-vh4ng74p.js} +8 -6
  41. package/dist/packager-tool-vmsxq1pc.js +104 -0
  42. package/dist/packager-tool-zf3929se.js +237 -0
  43. package/dist/packager-tool-zns6n8zp.js +837 -0
  44. package/dist/packager-tool.js +2 -2
  45. package/dist/prepare-solution-resources-p3gzdecy.js +25 -0
  46. package/dist/{project-contributions-cvttys34.js → project-contributions-txe8v6sm.js} +12 -9
  47. package/dist/publish.js +12 -7
  48. package/dist/resource.js +9 -6
  49. package/dist/services/activation.d.ts +17 -2
  50. package/dist/services/deploy-activate-service.d.ts +10 -0
  51. package/dist/services/deploy-delete-service.d.ts +82 -0
  52. package/dist/services/deploy-list-service.d.ts +15 -45
  53. package/dist/services/deploy-run-service.d.ts +36 -23
  54. package/dist/services/deploy-upgrade-service.d.ts +198 -39
  55. package/dist/services/deployment-feed-locator.d.ts +50 -12
  56. package/dist/services/deployment-search-client.d.ts +55 -0
  57. package/dist/services/deployment-search.d.ts +87 -34
  58. package/dist/services/deployment-state.d.ts +119 -0
  59. package/dist/services/feed-resolver.d.ts +31 -0
  60. package/dist/services/feed-session.d.ts +70 -0
  61. package/dist/services/folder-helper.d.ts +4 -27
  62. package/dist/services/http-status.d.ts +9 -0
  63. package/dist/services/incomplete-feed-sweep.d.ts +77 -0
  64. package/dist/services/legacy-deployment-search-v3.d.ts +23 -0
  65. package/dist/services/packages-list-service.d.ts +5 -0
  66. package/dist/services/pipeline-deploy-poll.d.ts +69 -0
  67. package/dist/services/publish-service.d.ts +14 -16
  68. package/dist/services/search-failure.d.ts +27 -0
  69. package/dist/templates/AGENTS.md +60 -20
  70. package/dist/tool.js +27 -18
  71. package/dist/utils/deployment-errors.d.ts +57 -0
  72. package/package.json +2 -2
  73. package/dist/packager-tool-jz2wbfjz.js +0 -2275
  74. package/dist/packager-tool-wtpe9285.js +0 -51960
  75. package/dist/prepare-solution-resources-wds3r8bq.js +0 -22
  76. package/dist/services/personal-workspace-deploy.d.ts +0 -49
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  Configuration,
3
- PipelinesApi,
3
+ PipelinesApi
4
+ } from "./packager-tool-qgaqqq41.js";
5
+ import {
4
6
  feedScopeInitOverride,
5
7
  resolveFeedScope
6
- } from "./packager-tool-2p5yh1q9.js";
7
- import {
8
- Configuration as Configuration2,
9
- PackagesApi
10
- } from "./packager-tool-7qmx64kz.js";
8
+ } from "./packager-tool-qdtjywsk.js";
11
9
  import {
12
10
  getSolutionAuthContext
13
- } from "./packager-tool-2syrt51a.js";
11
+ } from "./packager-tool-f5gq77m5.js";
14
12
  import {
15
13
  PollOutcome,
16
14
  catchError,
17
15
  extractErrorDetails,
18
- getFileSystem,
19
16
  logger,
20
17
  mapPollFailure,
21
18
  pollUntil
22
- } from "./packager-tool-0f0wt9vh.js";
19
+ } from "./packager-tool-5fjp60dk.js";
20
+ import {
21
+ getFileSystem
22
+ } from "./packager-tool-zf3929se.js";
23
23
  import {
24
24
  strFromU8,
25
25
  strToU8,
@@ -248,15 +248,16 @@ async function publishSolutionAsync(packagePath, options = {}) {
248
248
  message: scopeError.message
249
249
  };
250
250
  }
251
- if (scope.kind !== "tenant") {
252
- return publishToFeed(auth, fileBuffer, scope, options);
253
- }
254
251
  const configuration = new Configuration({
255
252
  basePath: auth.basePath,
256
253
  accessToken: auth.accessToken
257
254
  });
258
255
  const api = new PipelinesApi(configuration);
259
- const [uploadError, uploadResult] = await catchError(api.pipelinesPackageUpload({ body: fileBuffer }));
256
+ const feedScope = feedScopeInitOverride(scope);
257
+ const [uploadError, uploadResult] = await catchError(api.pipelinesPackageUpload({
258
+ body: fileBuffer,
259
+ locationKey: scope.folderKey
260
+ }));
260
261
  if (uploadError) {
261
262
  return mapUploadError(uploadError);
262
263
  }
@@ -266,7 +267,7 @@ async function publishSolutionAsync(packagePath, options = {}) {
266
267
  fn: () => api.pipelinesGetPackageVersion({
267
268
  packageName: uploadResult.packageName,
268
269
  packageVersion: uploadResult.packageVersion
269
- }),
270
+ }, feedScope),
270
271
  until: (result) => TERMINAL_STATES.has(result.state),
271
272
  getStatus: (result) => result.state,
272
273
  label: `publish ${uploadResult.packageName}:${uploadResult.packageVersion}`,
@@ -301,65 +302,6 @@ async function publishSolutionAsync(packagePath, options = {}) {
301
302
  packageName: packageVersionInfo.packageName,
302
303
  packageVersion: packageVersionInfo.packageVersion,
303
304
  state: packageVersionInfo.state,
304
- feedKind: "tenant"
305
- };
306
- }
307
- async function publishToFeed(auth, fileBuffer, scope, options) {
308
- const config = new Configuration2({
309
- basePath: auth.basePath,
310
- accessToken: auth.accessToken
311
- });
312
- const api = new PackagesApi(config);
313
- const [uploadError, packageVersionKey] = await catchError(api.packagesUpload({
314
- body: fileBuffer,
315
- locationKey: scope.folderKey
316
- }));
317
- if (uploadError) {
318
- return mapUploadError(uploadError);
319
- }
320
- const feedScope = feedScopeInitOverride(scope);
321
- const [getError, initialInfo] = await catchError(api.packagesGetVersion({ packageVersionKey }, feedScope));
322
- if (getError) {
323
- logger.warn(`Package uploaded (key ${packageVersionKey}) but its metadata was not yet retrievable; PackageName/PackageVersion/State will be absent from output: ${getError.message}`);
324
- }
325
- let packageVersionInfo = getError ? undefined : initialInfo;
326
- if (options.wait) {
327
- const pollResult = await pollUntil({
328
- fn: () => api.packagesGetVersion({ packageVersionKey }, feedScope),
329
- until: (result) => TERMINAL_STATES.has(result.state),
330
- getStatus: (result) => result.state,
331
- label: `publish ${packageVersionInfo ? `${packageVersionInfo.packageName}:${packageVersionInfo.packageVersion}` : packageVersionKey}`,
332
- logPrefix: "publish",
333
- timeoutMs: (options.timeout ?? 360) * 1000,
334
- intervalMs: options.pollInterval ?? 5000,
335
- signal: options.signal
336
- });
337
- if (pollResult.outcome !== PollOutcome.Completed) {
338
- const { reason, message } = mapPollFailure(pollResult, "Package publish");
339
- return { ok: false, reason, message };
340
- }
341
- if (!pollResult.data) {
342
- return {
343
- ok: false,
344
- reason: "poll_failed",
345
- message: "Package publish did not return a final state."
346
- };
347
- }
348
- packageVersionInfo = pollResult.data;
349
- if (packageVersionInfo.state === "Failed") {
350
- return {
351
- ok: false,
352
- reason: "publish_failed",
353
- message: `Package publish failed with state: ${packageVersionInfo.state}`
354
- };
355
- }
356
- }
357
- return {
358
- ok: true,
359
- packageVersionKey: packageVersionInfo?.key ?? packageVersionKey,
360
- packageName: packageVersionInfo?.packageName,
361
- packageVersion: packageVersionInfo?.packageVersion,
362
- state: packageVersionInfo?.state,
363
305
  feedKind: scope.kind
364
306
  };
365
307
  }
@@ -392,4 +334,4 @@ async function mapUploadError(uploadError) {
392
334
 
393
335
  export { publishSolutionAsync };
394
336
 
395
- //# debugId=A863118C75768F1764756E2164756E21
337
+ //# debugId=1A9ADF95167C0E9D64756E2164756E21
@@ -0,0 +1,172 @@
1
+ import {
2
+ findDeploymentByName,
3
+ findLiveDeploymentByName
4
+ } from "./packager-tool-482eg22x.js";
5
+ import {
6
+ folderKeyInitOverride,
7
+ listSelectablePublishLocations,
8
+ resolvePersonalWorkspace
9
+ } from "./packager-tool-qdtjywsk.js";
10
+ import {
11
+ catchError,
12
+ extractErrorDetails
13
+ } from "./packager-tool-5fjp60dk.js";
14
+
15
+ // src/services/deployment-feed-locator.ts
16
+ var sweepResult = (location, skipped) => ({
17
+ location,
18
+ skipped,
19
+ complete: skipped.length === 0
20
+ });
21
+ async function nonTenantFeedsAsync(options) {
22
+ const [listError, locations] = await catchError(listSelectablePublishLocations({
23
+ tenant: options.tenant,
24
+ loginValidity: options.loginValidity,
25
+ envFilePath: options.envFilePath
26
+ }));
27
+ if (!listError) {
28
+ const rank = (location) => location.type === "PersonalWorkspace" ? 0 : 1;
29
+ const feeds = [];
30
+ const skipped2 = [];
31
+ const nonTenant = [...locations].filter((location) => location.type !== "Tenant").sort((a, b) => rank(a) - rank(b));
32
+ for (const location of nonTenant) {
33
+ const kind = location.type === "PersonalWorkspace" ? "personal" : "folder";
34
+ if (location.key) {
35
+ feeds.push({ kind, folderKey: location.key });
36
+ continue;
37
+ }
38
+ skipped2.push({
39
+ kind,
40
+ reason: "no_key",
41
+ name: location.name,
42
+ error: new Error(`The list of feeds returned ${kind === "personal" ? "the Personal Workspace" : `folder feed '${location.name}'`} with no folder key, so it could not be searched.`)
43
+ });
44
+ }
45
+ return { feeds, skipped: skipped2 };
46
+ }
47
+ const skipped = [
48
+ { kind: "folder", reason: "listing_failed", error: listError }
49
+ ];
50
+ const [workspaceError, personalWorkspace] = await catchError(resolvePersonalWorkspace({
51
+ tenant: options.tenant,
52
+ loginValidity: options.loginValidity,
53
+ envFilePath: options.envFilePath
54
+ }));
55
+ if (workspaceError) {
56
+ skipped.push({
57
+ kind: "personal",
58
+ reason: "workspace_unresolved",
59
+ error: workspaceError
60
+ });
61
+ }
62
+ return {
63
+ feeds: personalWorkspace?.key ? [{ kind: "personal", folderKey: personalWorkspace.key }] : [],
64
+ skipped
65
+ };
66
+ }
67
+ async function findDeploymentAcrossFeeds(auth, deploymentName, options) {
68
+ const find = options.includeUninstalled ? findDeploymentByName : findLiveDeploymentByName;
69
+ const [tenantError, tenantMatch] = await catchError(find(auth, deploymentName));
70
+ if (tenantError) {
71
+ return sweepResult(undefined, [
72
+ { kind: "tenant", reason: "search_failed", error: tenantError }
73
+ ]);
74
+ }
75
+ if (tenantMatch) {
76
+ return sweepResult({ deployment: tenantMatch }, []);
77
+ }
78
+ const { feeds, skipped } = await nonTenantFeedsAsync(options);
79
+ for (const feed of feeds) {
80
+ const scope = folderKeyInitOverride(feed.folderKey);
81
+ const [searchError, deployment] = await catchError(find(auth, deploymentName, scope));
82
+ if (searchError) {
83
+ skipped.push({
84
+ ...feed,
85
+ reason: "search_failed",
86
+ error: searchError
87
+ });
88
+ continue;
89
+ }
90
+ if (deployment) {
91
+ return sweepResult({ deployment, scope, feed }, skipped);
92
+ }
93
+ }
94
+ return sweepResult(undefined, skipped);
95
+ }
96
+
97
+ // src/services/incomplete-feed-sweep.ts
98
+ function isNameOrFeedRefusal(errorCode, httpStatus) {
99
+ return errorCode === "not_found" || errorCode === "invalid_argument" && httpStatus === 400;
100
+ }
101
+ var INCOMPLETE_SWEEP_ADVICE = "The deployment may be in a feed that was not searched.";
102
+ function describeSkippedFeed(feed) {
103
+ const noKey = feed.reason === "no_key" ? " (the list of feeds gave it no key)" : "";
104
+ switch (feed.kind) {
105
+ case "tenant":
106
+ return "the tenant feed";
107
+ case "personal":
108
+ return feed.folderKey ? `your Personal Workspace feed (${feed.folderKey})` : `your Personal Workspace feed${noKey}`;
109
+ case "folder":
110
+ if (feed.reason === "listing_failed") {
111
+ return "the folder feeds (the list of feeds could not be read)";
112
+ }
113
+ if (feed.folderKey) {
114
+ return `folder feed ${feed.folderKey}`;
115
+ }
116
+ return feed.name ? `folder feed '${feed.name}'${noKey}` : `a folder feed${noKey}`;
117
+ }
118
+ }
119
+ function retryAdvice(errorCode, retry, service) {
120
+ switch (errorCode) {
121
+ case "authentication_required":
122
+ return "Run 'uip login' to refresh the session, then retry.";
123
+ case "permission_denied":
124
+ return "The account or its token lacks access; check the session and its scopes with 'uip login status --detailed', then retry.";
125
+ case "network_error":
126
+ return "Check the connection, then retry.";
127
+ case "rate_limited":
128
+ return "Wait a moment, then retry.";
129
+ default:
130
+ return retry === "RetryWillNotFix" ? "Retrying alone will not help; fix the cause in the details first." : `Retry once ${service} answers.`;
131
+ }
132
+ }
133
+ var NO_KEY_NEXT_STEP = "Retrying will not help: the list of feeds gives the skipped feeds no folder key, so neither the search nor --feed can reach them. Run 'uip solution feeds list' to see each feed's Key.";
134
+ var keylessOnly = (skipped) => skipped.length > 0 && skipped.every((feed) => feed.reason === "no_key");
135
+ function oneFeedFlags(skipped) {
136
+ const flags = [];
137
+ if (!skipped.some((feed) => feed.reason === "workspace_unresolved")) {
138
+ flags.push("--personal-workspace");
139
+ }
140
+ if (!skipped.some((feed) => feed.reason === "listing_failed") && !keylessOnly(skipped)) {
141
+ flags.push("--feed <name-or-key>");
142
+ }
143
+ return flags;
144
+ }
145
+ function isClassified(cause) {
146
+ return cause.errorCode !== "not_found" && cause.errorCode !== "unknown_error";
147
+ }
148
+ async function reportIncompleteSweepAsync(deploymentName, skipped) {
149
+ const feeds = skipped.map(describeSkippedFeed).join(", ");
150
+ const causes = await Promise.all(skipped.map((feed) => extractErrorDetails(feed.error)));
151
+ const cause = causes.find(isClassified) ?? causes[0] ?? await extractErrorDetails(undefined);
152
+ const unclassified = !isClassified(cause);
153
+ const keyless = keylessOnly(skipped);
154
+ const errorCode = unclassified ? "unknown_error" : cause.errorCode;
155
+ let retry = unclassified ? "RetryLater" : cause.retry;
156
+ if (keyless) {
157
+ retry = "RetryWillNotFix";
158
+ }
159
+ const message = skipped.some((feed) => feed.kind === "tenant") ? `Could not look up deployment '${deploymentName}': ${feeds} could not be searched.` : `Deployment '${deploymentName}' was not found in the feeds that answered, but these could not be searched: ${feeds}.`;
160
+ return {
161
+ message,
162
+ errorCode,
163
+ retry,
164
+ details: cause.details,
165
+ nextStep: keyless ? NO_KEY_NEXT_STEP : retryAdvice(errorCode, retry, "the feed service"),
166
+ oneFeedFlags: oneFeedFlags(skipped)
167
+ };
168
+ }
169
+
170
+ export { findDeploymentAcrossFeeds, isNameOrFeedRefusal, INCOMPLETE_SWEEP_ADVICE, retryAdvice, reportIncompleteSweepAsync };
171
+
172
+ //# debugId=43A92F098DF7C11664756E2164756E21
@@ -0,0 +1,322 @@
1
+ import {
2
+ Configuration as Configuration2,
3
+ PipelinesApi
4
+ } from "./packager-tool-qgaqqq41.js";
5
+ import {
6
+ Configuration,
7
+ DeploymentSearchItemDto2FromJSON,
8
+ SearchApi
9
+ } from "./packager-tool-00vh1ktg.js";
10
+ import {
11
+ classifyFeedSession
12
+ } from "./packager-tool-bqre28m1.js";
13
+ import {
14
+ catchError,
15
+ logger
16
+ } from "./packager-tool-5fjp60dk.js";
17
+
18
+ // src/services/http-status.ts
19
+ function httpStatusOf(error) {
20
+ if (!error || typeof error !== "object") {
21
+ return;
22
+ }
23
+ const response = error.response;
24
+ const fromResponse = response && typeof response === "object" ? response.status : undefined;
25
+ const status = typeof fromResponse === "number" ? fromResponse : error.status;
26
+ return typeof status === "number" ? status : undefined;
27
+ }
28
+ function isAuthRefusal(error) {
29
+ const status = httpStatusOf(error);
30
+ return status === 401 || status === 403;
31
+ }
32
+
33
+ // src/services/legacy-deployment-search-v3.ts
34
+ async function searchDeploymentsLegacyV3(auth, query, scope) {
35
+ const api = new SearchApi(new Configuration({
36
+ basePath: auth.basePath,
37
+ accessToken: auth.accessToken
38
+ }));
39
+ const result = await api.searchSearchDeployments22({ deploymentsSearchRequest2: toLegacyV3Request(query) }, scope);
40
+ const values = result.values ?? [];
41
+ return { count: result.count, values };
42
+ }
43
+ function toLegacyV3Request(query) {
44
+ return {
45
+ searchTerm: query.searchTerm ?? query.deploymentName ?? query.packageName,
46
+ packageName: query.packageName,
47
+ ...query.targetFolderName ? { targetFolderName: query.targetFolderName } : {},
48
+ take: query.take,
49
+ skip: query.skip,
50
+ orderByColumn: query.orderByColumn,
51
+ orderByDirection: query.orderByDirection,
52
+ operationStatuses: query.operationStatuses ?? [],
53
+ activationStatuses: query.activationStatuses ?? []
54
+ };
55
+ }
56
+
57
+ // src/services/deployment-search-client.ts
58
+ var PIPELINES_SEARCH_ROUTE = "POST /v1/pipelines/deployments/search";
59
+
60
+ class DeploymentSearchNeedsUserSessionError extends Error {
61
+ constructor() {
62
+ super("This server's deployment search reads user sessions only; an application (client-credentials) login cannot read it. Sign in with 'uip login' to use it.");
63
+ this.name = "DeploymentSearchNeedsUserSessionError";
64
+ }
65
+ }
66
+ var serversWithoutPipelinesSearch = new Set;
67
+ async function isMissingPipelinesSearchRoute(error) {
68
+ const status = httpStatusOf(error);
69
+ if (status === 405) {
70
+ return true;
71
+ }
72
+ if (status !== 404) {
73
+ return false;
74
+ }
75
+ const response = error.response;
76
+ const [, body] = await catchError(response ? response.clone().text() : Promise.resolve(""));
77
+ return (body ?? "").trim() === "";
78
+ }
79
+ async function searchDeploymentsPage(auth, query, scope) {
80
+ if (!serversWithoutPipelinesSearch.has(auth.basePath)) {
81
+ const [error, page2] = await catchError(searchViaPipelines(auth, query, scope));
82
+ if (!error) {
83
+ return { ...page2, source: "pipelines" };
84
+ }
85
+ if (!await isMissingPipelinesSearchRoute(error)) {
86
+ throw error;
87
+ }
88
+ serversWithoutPipelinesSearch.add(auth.basePath);
89
+ logger.debug(`${PIPELINES_SEARCH_ROUTE} is not served at ${auth.basePath}; using the deprecated POST /api/v3/search/deployments.`);
90
+ }
91
+ if (classifyFeedSession(auth) === "application") {
92
+ throw new DeploymentSearchNeedsUserSessionError;
93
+ }
94
+ const page = await searchDeploymentsLegacyV3(auth, query, scope);
95
+ return { ...page, source: "legacy-v3" };
96
+ }
97
+ async function searchViaPipelines(auth, query, scope) {
98
+ const api = new PipelinesApi(new Configuration2({
99
+ basePath: auth.basePath,
100
+ accessToken: auth.accessToken
101
+ }));
102
+ const response = await api.pipelinesSearchDeploymentsRaw({
103
+ pipelineDeploymentsSearchRequest: {
104
+ take: query.take,
105
+ skip: query.skip,
106
+ deploymentName: query.deploymentName,
107
+ packageName: query.packageName,
108
+ targetFolderName: query.targetFolderName,
109
+ searchTerm: query.searchTerm,
110
+ orderByColumn: query.orderByColumn,
111
+ orderByDirection: query.orderByDirection,
112
+ operationStatuses: query.operationStatuses,
113
+ activationStatuses: query.activationStatuses
114
+ }
115
+ }, scope);
116
+ const body = await response.raw.json();
117
+ const values = (body.values ?? []).map((row) => DeploymentSearchItemDto2FromJSON(row));
118
+ return { count: body.count, values };
119
+ }
120
+
121
+ // src/services/deployment-search.ts
122
+ async function findDeploymentByName(auth, deploymentName, scope) {
123
+ return newestDeploymentRow(await findDeploymentsByName(auth, deploymentName, scope));
124
+ }
125
+ async function findLiveDeploymentByName(auth, deploymentName, scope) {
126
+ const newest = await findDeploymentByName(auth, deploymentName, scope);
127
+ return isCompletedUninstall(newest) ? undefined : newest;
128
+ }
129
+ function isCompletedUninstall(row) {
130
+ return row?.operation === "Uninstall" && row.operationStatus === "Successful";
131
+ }
132
+ async function findDeploymentsByPackageName(auth, packageName, options = {}) {
133
+ const take = 50;
134
+ const maxPages = 20;
135
+ const matches = [];
136
+ for (let page = 0, skip = 0;page < maxPages; page++) {
137
+ const result = await searchDeploymentsPage(auth, { packageName, take, skip }, options.scope);
138
+ const values = result.values ?? [];
139
+ for (const deployment of values) {
140
+ if (deployment.packageName === packageName && (options.folderPath === undefined || deployment.folderPath === options.folderPath)) {
141
+ matches.push(deployment);
142
+ }
143
+ }
144
+ if (values.length < take) {
145
+ break;
146
+ }
147
+ skip += values.length;
148
+ }
149
+ return matches;
150
+ }
151
+ async function findCurrentDeploymentAsync(auth, deployment, scope) {
152
+ const installKey = deployment.installDeploymentKey ?? deployment.key;
153
+ const rows = await findDeploymentsByPackageName(auth, deployment.packageName, { scope });
154
+ return rows.find((row) => (row.installDeploymentKey ?? row.key) === installKey);
155
+ }
156
+ function blocksRedeploy(deployment) {
157
+ if (deployment.operationStatus === "InProgress") {
158
+ return true;
159
+ }
160
+ if (deployment.operationStatus === "Successful") {
161
+ return deployment.operation !== "Uninstall";
162
+ }
163
+ if (deployment.operationStatus === "Draft" || deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
164
+ return deployment.operation !== undefined && deployment.operation !== null && deployment.operation !== "Install";
165
+ }
166
+ return false;
167
+ }
168
+ var MAX_LISTED_DEPLOYMENTS = 5;
169
+ function formatExistingDeployments(deployments, folderByKey) {
170
+ const described = deployments.slice(0, MAX_LISTED_DEPLOYMENTS).map((deployment) => {
171
+ const resolved = deployment.installedRootFolderKey ? folderByKey?.get(deployment.installedRootFolderKey) : undefined;
172
+ const folder = resolved ?? deployment.folderPath ?? "an unknown folder";
173
+ const current = deployment.currentPackageVersion ?? deployment.packageVersion ?? "an unknown version";
174
+ const target = deployment.targetPackageVersion ?? deployment.newPackageVersionAvailable;
175
+ const version = target && target !== current ? `${current} → ${target}` : current;
176
+ const state = [
177
+ deployment.operation,
178
+ deployment.operationStatus,
179
+ deployment.activationStatus
180
+ ].filter((part) => part !== undefined && part !== null).join("/");
181
+ return `'${deployment.name}' in ${folder} (version ${version}${state ? `, ${state}` : ""})`;
182
+ }).join("; ");
183
+ const remaining = deployments.length - MAX_LISTED_DEPLOYMENTS;
184
+ return remaining > 0 ? `${described}; and ${remaining} more (see: uip solution deploy list)` : described;
185
+ }
186
+ async function findDeploymentsByName(auth, deploymentName, scope) {
187
+ const matches = [];
188
+ const take = 50;
189
+ for (let skip = 0;; ) {
190
+ const result = await searchDeploymentsPage(auth, { deploymentName, take, skip }, scope);
191
+ const values = result.values ?? [];
192
+ matches.push(...values.filter((deployment) => deployment.name === deploymentName));
193
+ skip += values.length;
194
+ const total = result.count;
195
+ if (values.length < take || typeof total === "number" && skip >= total || skip >= MAX_SEARCH_ROWS) {
196
+ return matches;
197
+ }
198
+ }
199
+ }
200
+ var MAX_SEARCH_ROWS = 5000;
201
+ async function findDeploymentBestEffort(auth, deploymentName, scope, prefer = {}) {
202
+ const [lookupError, rows] = await catchError(findDeploymentsByName(auth, deploymentName, scope));
203
+ if (lookupError || !rows) {
204
+ return;
205
+ }
206
+ if (prefer.deploymentKey) {
207
+ return rows.find((row) => row.key === prefer.deploymentKey && row.operation !== "Uninstall");
208
+ }
209
+ const candidates = rows.filter((row) => row.operation !== "Uninstall");
210
+ return candidates.sort((a, b) => creationMillis(b) - creationMillis(a))[0];
211
+ }
212
+ function newestDeploymentRow(rows) {
213
+ return [...rows].sort((a, b) => creationMillis(b) - creationMillis(a))[0];
214
+ }
215
+ function creationMillis(row) {
216
+ const millis = row.deploymentCreationTime ? new Date(row.deploymentCreationTime).getTime() : Number.NaN;
217
+ return Number.isFinite(millis) ? millis : 0;
218
+ }
219
+ async function isPipelineDeploymentNotFoundError(error) {
220
+ if (!error || typeof error !== "object") {
221
+ return false;
222
+ }
223
+ const response = error.response;
224
+ if (!response || typeof response !== "object") {
225
+ return false;
226
+ }
227
+ const status = response.status;
228
+ if (status !== 404) {
229
+ return false;
230
+ }
231
+ const [bodyError, body] = await catchError(response.clone().text());
232
+ if (bodyError || !body) {
233
+ return false;
234
+ }
235
+ return body.includes("PipelineDeploymentNotFound");
236
+ }
237
+ function interpretFailedDeployPoll(deployment) {
238
+ if (!deployment) {
239
+ return;
240
+ }
241
+ if (deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
242
+ return {
243
+ kind: "DeployFailed",
244
+ operationStatus: deployment.operationStatus
245
+ };
246
+ }
247
+ if (deployment.operationStatus !== "Successful") {
248
+ return;
249
+ }
250
+ switch (deployment.activationStatus) {
251
+ case "Active":
252
+ return { kind: "Active", instanceId: deployment.instanceId };
253
+ case "NeedsSetupToActivate":
254
+ return { kind: "NeedsSetupToActivate" };
255
+ case "ReadyToActivate":
256
+ case "Inactive":
257
+ return { kind: "ReadyToActivate" };
258
+ case "ActivationFailed":
259
+ return { kind: "ActivationFailed" };
260
+ default:
261
+ return;
262
+ }
263
+ }
264
+ function mapOperationStatusToPipelineStatus(operationStatus) {
265
+ switch (operationStatus) {
266
+ case "Successful":
267
+ return "DeploymentSucceeded";
268
+ case "Failed":
269
+ case "FailedRollback":
270
+ case "Draft":
271
+ return "DeploymentFailed";
272
+ default:
273
+ return;
274
+ }
275
+ }
276
+ function deploymentToTerminalPipelineResult(deployment) {
277
+ const status = mapOperationStatusToPipelineStatus(deployment.operationStatus);
278
+ if (!status) {
279
+ return;
280
+ }
281
+ return {
282
+ status,
283
+ validationResult: { validationErrors: [], conflictErrors: [] },
284
+ deploymentKey: deployment.key,
285
+ configurationKey: deployment.configurationKey,
286
+ instanceId: deployment.instanceId,
287
+ conflictFixingErrors: [],
288
+ deploymentScheduleErrors: []
289
+ };
290
+ }
291
+ async function resolveInstalledFolder(deployment, requested, resolveFolderByKey) {
292
+ const fallback = {
293
+ folderName: requested.folderName,
294
+ folderPath: requested.folderPath,
295
+ requestedMatched: true
296
+ };
297
+ const pathFor = (name, path) => path ?? (requested.parentFolderPath ? `${requested.parentFolderPath}/${name}` : name);
298
+ const folderKey = deployment?.installedRootFolderKey;
299
+ if (folderKey && resolveFolderByKey) {
300
+ const [lookupError, folder] = await catchError(resolveFolderByKey(folderKey));
301
+ if (!lookupError && folder?.name) {
302
+ return {
303
+ folderName: folder.name,
304
+ folderPath: pathFor(folder.name, folder.path ?? deployment?.folderPath ?? undefined),
305
+ requestedMatched: folder.name === requested.folderName
306
+ };
307
+ }
308
+ }
309
+ const resolvedName = deployment?.installedRootFolderName;
310
+ if (resolvedName) {
311
+ return {
312
+ folderName: resolvedName,
313
+ folderPath: pathFor(resolvedName, deployment?.folderPath ?? undefined),
314
+ requestedMatched: resolvedName === requested.folderName
315
+ };
316
+ }
317
+ return fallback;
318
+ }
319
+
320
+ export { httpStatusOf, isAuthRefusal, DeploymentSearchNeedsUserSessionError, searchDeploymentsPage, findDeploymentByName, findLiveDeploymentByName, isCompletedUninstall, findDeploymentsByPackageName, findCurrentDeploymentAsync, blocksRedeploy, MAX_LISTED_DEPLOYMENTS, formatExistingDeployments, findDeploymentsByName, findDeploymentBestEffort, newestDeploymentRow, isPipelineDeploymentNotFoundError, interpretFailedDeployPoll, mapOperationStatusToPipelineStatus, deploymentToTerminalPipelineResult, resolveInstalledFolder };
321
+
322
+ //# debugId=982982E1F13E2BA464756E2164756E21
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  registerPackagerFactories
3
- } from "./packager-tool-jz2wbfjz.js";
3
+ } from "./packager-tool-zns6n8zp.js";
4
4
  import {
5
5
  toolsFactoryRepository
6
- } from "./packager-tool-nzghfa48.js";
6
+ } from "./packager-tool-fv7xyzg2.js";
7
7
  import {
8
8
  catchError,
9
9
  ensurePackagerFactory,
10
10
  logger,
11
11
  unsupportedSolutionProjectType
12
- } from "./packager-tool-0f0wt9vh.js";
12
+ } from "./packager-tool-5fjp60dk.js";
13
13
 
14
14
  // src/services/project-type-tools.ts
15
15
  var PROJECT_TYPE_TO_TOOL = new Map([