@uipath/solution-tool 1.205.0-preview.281 → 1.206.0-preview.282

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 (132) hide show
  1. package/dist/{archive-extract-x35t9ktj.js → archive-extract-136rn3ja.js} +13 -15
  2. package/dist/{cleanup-command-service-je9d70vv.js → cleanup-command-service-kadmvyk4.js} +34 -31
  3. package/dist/deploy-delete-service-xa25k94p.js +23 -0
  4. package/dist/deploy-run-service-rsedb9hr.js +23 -0
  5. package/dist/{deploy-status-service-919yn8wn.js → deploy-status-service-nmm8k9fa.js} +72 -62
  6. package/dist/deploy.js +35 -37
  7. package/dist/deployment-search-wtbye8v6.js +54 -0
  8. package/dist/{embedded-file-reader-z4becc02.js → embedded-file-reader-0228j82a.js} +1 -4
  9. package/dist/feed-resolver-28pfxmky.js +27 -0
  10. package/dist/feed-scope-failure-d4avsc7j.js +20 -0
  11. package/dist/feed-session-4skrr620.js +23 -0
  12. package/dist/first-party-service-n3vva2m4.js +8 -0
  13. package/dist/governance-options-bevmhh1z.js +19 -0
  14. package/dist/index-aspmac9f.js +24 -0
  15. package/dist/index-md8d2ttf.js +60 -0
  16. package/dist/{index-sby22td6.js → index-nzr4mx5p.js} +2 -22
  17. package/dist/index-qq4kre7a.js +93 -0
  18. package/dist/index-t262f2xv.js +16 -0
  19. package/dist/index.js +33 -34
  20. package/dist/init.js +18 -21
  21. package/dist/{jmespath-231m3hyn.js → jmespath-ab6tdc42.js} +1 -1
  22. package/dist/{js-yaml-88tdqrtd.js → js-yaml-a2bk27p6.js} +1 -3
  23. package/dist/{list-5fke71jn.js → list-pnggwekk.js} +23 -23
  24. package/dist/models/pack-command-types.d.ts +3 -1
  25. package/dist/node-z9c03k2q.js +25 -0
  26. package/dist/pack-command-service-2txx876d.js +29 -0
  27. package/dist/{pack-project-ha0pxw3h.js → pack-project-ngwtfgge.js} +33 -40
  28. package/dist/pack.js +26 -30
  29. package/dist/package-id-350pep6r.js +11 -0
  30. package/dist/{packager-tool-5qzgdb66.js → packager-tool-0k205evy.js} +13 -15
  31. package/dist/{packager-tool-wm0jaz7p.js → packager-tool-0vz19vhv.js} +305 -657
  32. package/dist/{packager-tool-gs3f3tf7.js → packager-tool-1ctvbx0h.js} +1 -1
  33. package/dist/{packager-tool-h1tq7bqf.js → packager-tool-41a5axkd.js} +65 -35
  34. package/dist/packager-tool-8097ps72.js +2307 -0
  35. package/dist/{packager-tool-1ybnxbp9.js → packager-tool-85f75be3.js} +18 -18
  36. package/dist/{packager-tool-tx834spe.js → packager-tool-9vrwpgt3.js} +757 -309
  37. package/dist/{packager-tool-pbmqk39a.js → packager-tool-a7s0gbxs.js} +33 -28
  38. package/dist/{packager-tool-47wzvqw0.js → packager-tool-aws5w512.js} +6 -6
  39. package/dist/packager-tool-c64hqa8n.js +106 -0
  40. package/dist/{packager-tool-5ddtwzva.js → packager-tool-ca5ngmqv.js} +12 -12
  41. package/dist/{packager-tool-d78ww4hb.js → packager-tool-cp66jc40.js} +51 -48
  42. package/dist/{packager-tool-6kz1pv9f.js → packager-tool-d1texmvn.js} +828 -338
  43. package/dist/{packager-tool-cvf46scg.js → packager-tool-daphtc6e.js} +122 -89
  44. package/dist/{packager-tool-1de529jm.js → packager-tool-epsr41wx.js} +12 -3
  45. package/dist/packager-tool-f84z7nds.js +130 -0
  46. package/dist/{packager-tool-45a8fkw0.js → packager-tool-fgk0fkm5.js} +37 -39
  47. package/dist/{packager-tool-8ptbmmmp.js → packager-tool-fp46ebde.js} +147 -76
  48. package/dist/{packager-tool-3bwnkjdq.js → packager-tool-fx4ws49n.js} +12 -12
  49. package/dist/{packager-tool-4pa108k7.js → packager-tool-g8ghm6wk.js} +11 -11
  50. package/dist/{packager-tool-2t72aez8.js → packager-tool-gpcr8zxf.js} +15 -15
  51. package/dist/packager-tool-gqb9ytg9.js +290 -0
  52. package/dist/packager-tool-hrkvdw31.js +280 -0
  53. package/dist/{packager-tool-056k8w2f.js → packager-tool-hs1kjv0c.js} +75 -9
  54. package/dist/{packager-tool-2vmz56qh.js → packager-tool-jatbb6c5.js} +184 -33
  55. package/dist/{packager-tool-f23a485e.js → packager-tool-jfp5mvqm.js} +176 -196
  56. package/dist/{packager-tool-6ybywxxn.js → packager-tool-m07vyk89.js} +371 -221
  57. package/dist/{packager-tool-61pwb567.js → packager-tool-ppj5f4y7.js} +6 -7
  58. package/dist/{packager-tool-t8gh825q.js → packager-tool-qf8753ee.js} +53 -41
  59. package/dist/{packager-tool-60af1hw2.js → packager-tool-qzcd5c9s.js} +3 -3
  60. package/dist/packager-tool-rb06drad.js +1178 -0
  61. package/dist/packager-tool-resolver-td3bhccd.js +20 -0
  62. package/dist/{packager-tool-dfrk01gn.js → packager-tool-rj2d1g0w.js} +154 -154
  63. package/dist/{packager-tool-43ahv5mn.js → packager-tool-t39pjz7n.js} +35 -18
  64. package/dist/{packager-tool-v1f5e8t9.js → packager-tool-vgrswa8p.js} +53 -8
  65. package/dist/{packager-tool-gyqfs04e.js → packager-tool-vq5fwggb.js} +273 -255
  66. package/dist/{packager-tool-gmwva4yv.js → packager-tool-vx2c68sb.js} +2 -2
  67. package/dist/{packager-tool-b2nhscfk.js → packager-tool-wm8nj6e9.js} +18 -18
  68. package/dist/{packager-tool-amhyxzz6.js → packager-tool-x33sdw6n.js} +16 -16
  69. package/dist/{packager-tool-97rcgwvv.js → packager-tool-x461tgwy.js} +331 -55
  70. package/dist/{packager-tool-dnrk1gg6.js → packager-tool-y6efv1f8.js} +356 -298
  71. package/dist/{packager-tool-wy4fx250.js → packager-tool-yetmzme9.js} +89 -30
  72. package/dist/packager-tool-z45eej6s.js +74 -0
  73. package/dist/packager-tool.js +6 -7
  74. package/dist/prepare-solution-resources-pwnyvtza.js +26 -0
  75. package/dist/{project-command-utils-t6pmpvq3.js → project-command-utils-zcmbecfy.js} +23 -26
  76. package/dist/project-contributions-kh9yftvg.js +27 -0
  77. package/dist/publish.js +17 -17
  78. package/dist/resource-mutations-mfn5k1hb.js +27 -0
  79. package/dist/{resource-version-lookup-0e3e2j58.js → resource-version-lookup-6ejh1hwd.js} +20 -23
  80. package/dist/resource.js +13 -16
  81. package/dist/{restore-command-service-pzpet021.js → restore-command-service-r7t52t25.js} +37 -34
  82. package/dist/{run-service-hk8w2h31.js → run-service-xrhg0z2a.js} +144 -66
  83. package/dist/services/deploy-activate-service.d.ts +2 -1
  84. package/dist/services/deployment-search-client.d.ts +2 -1
  85. package/dist/services/deployment-search.d.ts +39 -0
  86. package/dist/services/feed-resolver.d.ts +13 -1
  87. package/dist/services/feed-selection.d.ts +8 -5
  88. package/dist/services/feed-session.d.ts +34 -0
  89. package/dist/services/install-run.d.ts +92 -0
  90. package/dist/services/prepare-solution-resources.d.ts +11 -2
  91. package/dist/services/project-contributions.d.ts +2 -0
  92. package/dist/services/project-identity-telemetry.d.ts +3 -0
  93. package/dist/services/publish-service.d.ts +20 -3
  94. package/dist/services/solution-identity.d.ts +18 -0
  95. package/dist/ship-telemetry-bkf3800w.js +16 -0
  96. package/dist/solution-auth-jxcgd2m0.js +10 -0
  97. package/dist/solution-identity-92h2fbpa.js +19 -0
  98. package/dist/templates/AGENTS.md +27 -29
  99. package/dist/tool.js +32 -33
  100. package/package.json +2 -2
  101. package/dist/deploy-delete-service-0tm600d1.js +0 -25
  102. package/dist/deploy-run-service-hne5w17k.js +0 -25
  103. package/dist/deployment-search-32zvxn35.js +0 -55
  104. package/dist/feed-resolver-pdeb4wkq.js +0 -28
  105. package/dist/feed-scope-failure-4baame72.js +0 -19
  106. package/dist/feed-session-7xqphdrg.js +0 -17
  107. package/dist/first-party-service-sd8yaf73.js +0 -27
  108. package/dist/governance-options-bqgv5fte.js +0 -32
  109. package/dist/index-dqa169gp.js +0 -25
  110. package/dist/index-prm27bvm.js +0 -138
  111. package/dist/index-wdndcwab.js +0 -667
  112. package/dist/node-v7xhqwe2.js +0 -86
  113. package/dist/pack-command-service-b1v9c8cw.js +0 -35
  114. package/dist/package-id-rpzgy31w.js +0 -13
  115. package/dist/packager-tool-53w8skv5.js +0 -262
  116. package/dist/packager-tool-5edvzz80.js +0 -543
  117. package/dist/packager-tool-99jaqabz.js +0 -171
  118. package/dist/packager-tool-9hsmn8th.js +0 -418
  119. package/dist/packager-tool-azre7mm1.js +0 -182
  120. package/dist/packager-tool-fn13r8e1.js +0 -188
  121. package/dist/packager-tool-gdtpsdn7.js +0 -342
  122. package/dist/packager-tool-qw47eyw7.js +0 -43
  123. package/dist/packager-tool-resolver-994z3jkj.js +0 -23
  124. package/dist/packager-tool-tedbebpq.js +0 -5367
  125. package/dist/packager-tool-x1ah4eez.js +0 -68
  126. package/dist/prepare-solution-resources-m1djfj62.js +0 -29
  127. package/dist/project-contributions-79ndycrx.js +0 -32
  128. package/dist/resource-mutations-c3krjqze.js +0 -36
  129. package/dist/ship-telemetry-myes7ak5.js +0 -21
  130. package/dist/solution-auth-aead70sw.js +0 -11
  131. /package/dist/{packager-tool-act5r386.js → packager-tool-2pxe2r4j.js} +0 -0
  132. /package/dist/{packager-tool-kkfb5kgn.js → packager-tool-vrqbbh01.js} +0 -0
@@ -0,0 +1,290 @@
1
+ import {
2
+ catchError,
3
+ httpStatusOf2,
4
+ extractErrorDetails
5
+ } from "./packager-tool-m07vyk89.js";
6
+ import {
7
+ isGuid
8
+ } from "./packager-tool-9vrwpgt3.js";
9
+ import {
10
+ getAuthContext
11
+ } from "./packager-tool-t39pjz7n.js";
12
+ import {
13
+ getSolutionAuthContext2
14
+ } from "./packager-tool-ppj5f4y7.js";
15
+ import {
16
+ classifyFeedSession2
17
+ } from "./packager-tool-x461tgwy.js";
18
+ import {
19
+ PersonalWorkspacesApi,
20
+ createOrchestratorConfig,
21
+ resolveFolder
22
+ } from "./packager-tool-fp46ebde.js";
23
+ import {
24
+ getAvailablePublishLocationsV22
25
+ } from "./packager-tool-8097ps72.js";
26
+
27
+ // src/services/personal-workspace-resolver.ts
28
+ async function resolvePersonalWorkspace(options) {
29
+ const config = await createOrchestratorConfig(options);
30
+ const api = new PersonalWorkspacesApi(config);
31
+ const pw = await api.personalWorkspacesGetPersonalWorkspace();
32
+ if (!pw?.key || !pw.name) {
33
+ throw new Error("Personal Workspace not configured for the current user. " + "Enable Personal Workspace in Orchestrator (or sign in as a user that has one), then retry.");
34
+ }
35
+ return { key: pw.key, name: pw.name };
36
+ }
37
+
38
+ // src/services/folder-helper.ts
39
+ async function resolveParentFolder(options) {
40
+ if (!options.folderPath && !options.folderKey && !options.personalWorkspace) {
41
+ return;
42
+ }
43
+ if (options.personalWorkspace) {
44
+ const [pwError, pw] = await catchError(resolvePersonalWorkspace({
45
+ tenant: options.tenant,
46
+ loginValidity: options.loginValidity,
47
+ envFilePath: options.envFilePath
48
+ }));
49
+ if (pwError) {
50
+ throw new Error(`Failed to resolve Personal Workspace: ${pwError.message}`);
51
+ }
52
+ return pw.name;
53
+ }
54
+ if (options.folderPath) {
55
+ return options.folderPath;
56
+ }
57
+ const [resolveError, resolved] = await catchError(resolveFolder({ folderKey: options.folderKey }, {
58
+ tenant: options.tenant,
59
+ loginValidity: options.loginValidity,
60
+ envFilePath: options.envFilePath
61
+ }));
62
+ if (resolveError) {
63
+ throw new Error(`Failed to resolve folder key '${options.folderKey}': ${resolveError.message}`);
64
+ }
65
+ if (!resolved) {
66
+ throw new Error(`Folder not found for key '${options.folderKey}'.`);
67
+ }
68
+ return resolved.path;
69
+ }
70
+ async function resolveFolderInfo(options) {
71
+ if (!options.folderPath && !options.folderKey) {
72
+ return;
73
+ }
74
+ const [resolveError, resolved] = await catchError(resolveFolder({ folderPath: options.folderPath, folderKey: options.folderKey }, {
75
+ tenant: options.tenant,
76
+ loginValidity: options.loginValidity,
77
+ envFilePath: options.envFilePath
78
+ }));
79
+ if (resolveError) {
80
+ throw new Error(`Failed to resolve folder '${options.folderPath ?? options.folderKey}': ${resolveError.message}`, { cause: resolveError });
81
+ }
82
+ if (!resolved) {
83
+ throw new Error(`Folder not found: '${options.folderPath ?? options.folderKey}'.`);
84
+ }
85
+ return { key: resolved.key, path: resolved.path };
86
+ }
87
+
88
+ // src/services/publish-locations-service.ts
89
+ async function resolveStudioWebTarget(options) {
90
+ const auth = await getAuthContext({
91
+ ensureTokenValidityMinutes: options?.loginValidity,
92
+ envFilePath: options?.envFilePath,
93
+ requireOrganizationName: true
94
+ });
95
+ if (options?.tenant && auth.tenantName && options.tenant.toLowerCase() !== auth.tenantName.toLowerCase()) {
96
+ throw new Error(`Feeds are resolved for the logged-in tenant ('${auth.tenantName}'), so --tenant '${options.tenant}' can't apply here. Switch tenants first with: uip login tenant set ${options.tenant}.`);
97
+ }
98
+ return {
99
+ config: {
100
+ baseUrl: auth.baseUrl,
101
+ authToken: auth.accessToken,
102
+ tenantId: auth.tenantId
103
+ },
104
+ organizationName: auth.organizationName
105
+ };
106
+ }
107
+ function isSelectableFeed(location) {
108
+ switch (location.type) {
109
+ case "Tenant":
110
+ case "Folder":
111
+ return true;
112
+ case "PersonalWorkspace":
113
+ return location.isMyPersonalWorkspace;
114
+ default:
115
+ return false;
116
+ }
117
+ }
118
+ async function listSelectablePublishLocations(options) {
119
+ const { config, organizationName } = await resolveStudioWebTarget(options);
120
+ const all = await getAvailablePublishLocationsV22(config, organizationName);
121
+ return all.filter(isSelectableFeed);
122
+ }
123
+
124
+ // src/services/feed-resolver.ts
125
+ function folderKeyInitOverride2(folderKey) {
126
+ return async ({ init }) => ({
127
+ headers: { ...init.headers, "X-UIPATH-FolderKey": folderKey }
128
+ });
129
+ }
130
+ function feedScopeInitOverride2(scope) {
131
+ const { folderKey } = scope;
132
+ if (!folderKey) {
133
+ return;
134
+ }
135
+ return folderKeyInitOverride2(folderKey);
136
+ }
137
+ function feedSelectorFlag2(scope) {
138
+ if (!scope || scope.kind === "tenant" || !scope.folderKey) {
139
+ return "";
140
+ }
141
+ return scope.kind === "personal" ? " --personal-workspace" : ` --feed ${scope.folderKey}`;
142
+ }
143
+ function feedResolutionFailureInstructions(options) {
144
+ if (options.personalWorkspace) {
145
+ return "Personal Workspace resolution needs an interactive user session and an enabled Personal Workspace. Log in as a user with a Personal Workspace, or omit --personal-workspace to use the tenant feed.";
146
+ }
147
+ if (options.feed !== undefined) {
148
+ return "List the feeds you can target with: uip solution feeds list.";
149
+ }
150
+ return "Check the selected feed and try again.";
151
+ }
152
+ async function describeFeedResolutionFailureAsync2(error, options, session) {
153
+ const details = await extractErrorDetails(error);
154
+ if (error instanceof ApplicationFeedResolutionError) {
155
+ return {
156
+ message: error.message,
157
+ instructions: "Pass the feed's folder key to --feed (it is used as given, with no extra scope), give the external application the OR.Folders scope so a folder path can be looked up, or give it the Studio Web (StudioWebS2S) grants that cover reading publish locations; or run it with a user session ('uip login'). To use the tenant feed, omit --feed.",
158
+ errorCode: "permission_denied",
159
+ retry: "RetryWillNotFix",
160
+ context: details.context
161
+ };
162
+ }
163
+ if (options.personalWorkspace && isRefusal(details.context?.httpStatus) && classifyFeedSession2(session) === "application") {
164
+ return {
165
+ message: "--personal-workspace needs a user session; this session is an external app, which has no Personal Workspace.",
166
+ instructions: "Run it with a user session that has a Personal Workspace ('uip login'). A client-credentials login cannot target one.",
167
+ errorCode: "permission_denied",
168
+ retry: "RetryWillNotFix",
169
+ context: details.context
170
+ };
171
+ }
172
+ if (options.feed !== undefined && isRefusal(details.context?.httpStatus) && classifyFeedSession2(session) === "application") {
173
+ return {
174
+ message: `--feed '${options.feed}' could not be checked: Studio Web refused this external app the list of publish locations (HTTP ${details.context?.httpStatus}).`,
175
+ instructions: "Give the external application the Studio Web (StudioWebS2S) grants that cover reading publish locations, or run it with a user session ('uip login'). To use the tenant feed, omit --feed.",
176
+ errorCode: "permission_denied",
177
+ retry: "RetryWillNotFix",
178
+ context: details.context
179
+ };
180
+ }
181
+ return {
182
+ message: details.message,
183
+ instructions: feedResolutionFailureInstructions(options),
184
+ errorCode: details.errorCode,
185
+ retry: details.retry,
186
+ context: details.context
187
+ };
188
+ }
189
+ function isRefusal(status) {
190
+ return status !== undefined && status >= 400 && status < 500 && status !== 408 && status !== 429;
191
+ }
192
+ async function resolveFeedScope2(options) {
193
+ const { personalWorkspace, feed } = options;
194
+ if (personalWorkspace && feed !== undefined) {
195
+ throw new Error("Use either --personal-workspace or --feed, not both.");
196
+ }
197
+ if (personalWorkspace) {
198
+ const pw = await resolvePersonalWorkspace({
199
+ tenant: options.tenant,
200
+ loginValidity: options.loginValidity,
201
+ envFilePath: options.envFilePath
202
+ });
203
+ return { kind: "personal", folderKey: pw.key, name: pw.name };
204
+ }
205
+ if (feed !== undefined) {
206
+ return resolveNamedFeed(feed, options);
207
+ }
208
+ return { kind: "tenant" };
209
+ }
210
+ async function resolveNamedFeed(feed, options) {
211
+ const [listingError, locations] = await catchError(listSelectablePublishLocations({
212
+ tenant: options.tenant,
213
+ envFilePath: options.envFilePath,
214
+ loginValidity: options.loginValidity
215
+ }));
216
+ if (listingError) {
217
+ const refusedStatus = await applicationRefusedListingStatusAsync(listingError, options);
218
+ if (refusedStatus !== undefined) {
219
+ return resolveFeedForApplication(feed, options, refusedStatus);
220
+ }
221
+ throw listingError;
222
+ }
223
+ const match = matchFeed(feed, locations);
224
+ const kind = match.type === "Tenant" ? "tenant" : match.type === "PersonalWorkspace" ? "personal" : "folder";
225
+ if (kind !== "tenant" && !match.key) {
226
+ throw new Error(`Feed '${match.name || feed}' has no folder key in the publish-locations response, so it can't be targeted. Run 'uip solution feeds list' and pick a feed with a Key.`);
227
+ }
228
+ return {
229
+ kind,
230
+ folderKey: kind === "tenant" ? undefined : match.key,
231
+ name: match.name
232
+ };
233
+ }
234
+ async function applicationRefusedListingStatusAsync(error, options) {
235
+ const status = httpStatusOf2(error);
236
+ if (status !== 401 && status !== 403) {
237
+ return;
238
+ }
239
+ const [authError, auth] = await catchError(getSolutionAuthContext2({
240
+ tenant: options.tenant,
241
+ loginValidity: options.loginValidity,
242
+ envFilePath: options.envFilePath
243
+ }));
244
+ return !authError && classifyFeedSession2(auth) === "application" ? status : undefined;
245
+ }
246
+
247
+ class ApplicationFeedResolutionError extends Error {
248
+ feed;
249
+ status;
250
+ name = "ApplicationFeedResolutionError";
251
+ constructor(feed, status, reason) {
252
+ super(`--feed '${feed}' could not be resolved for this external app: the publish-locations listing refused it (HTTP ${status}), and the Orchestrator folder lookup failed: ${reason}`);
253
+ this.feed = feed;
254
+ this.status = status;
255
+ }
256
+ }
257
+ async function resolveFeedForApplication(feed, options, listingStatus) {
258
+ if (isGuid(feed)) {
259
+ return { kind: "folder", folderKey: feed };
260
+ }
261
+ const [error, folder] = await catchError(resolveFolderInfo({
262
+ folderPath: feed,
263
+ tenant: options.tenant,
264
+ loginValidity: options.loginValidity,
265
+ envFilePath: options.envFilePath
266
+ }));
267
+ if (error || !folder) {
268
+ throw new ApplicationFeedResolutionError(feed, listingStatus, error?.message ?? "folder not found");
269
+ }
270
+ return { kind: "folder", folderKey: folder.key, name: folder.path };
271
+ }
272
+ function matchFeed(feed, locations) {
273
+ const byKey = locations.find((location) => location.key === feed);
274
+ if (byKey) {
275
+ return byKey;
276
+ }
277
+ const target = feed.toLowerCase();
278
+ const byName = locations.filter((location) => location.name.toLowerCase() === target);
279
+ if (byName.length === 1) {
280
+ return byName[0];
281
+ }
282
+ if (byName.length > 1) {
283
+ throw new Error(`More than one feed is named '${feed}'. Pass its key instead — ` + "'uip solution feeds list' shows each feed's key.");
284
+ }
285
+ throw new Error(`Feed '${feed}' is not an available publish location. ` + "Run 'uip solution feeds list' to see the feeds you can publish to.");
286
+ }
287
+
288
+ export { resolvePersonalWorkspace, resolveParentFolder, resolveFolderInfo, listSelectablePublishLocations, folderKeyInitOverride2, feedScopeInitOverride2, feedSelectorFlag2, describeFeedResolutionFailureAsync2, resolveFeedScope2 };
289
+
290
+ //# debugId=4DD932FEEA2EF6A664756E2164756E21
@@ -0,0 +1,280 @@
1
+ import {
2
+ catchError,
3
+ httpStatusOf2
4
+ } from "./packager-tool-m07vyk89.js";
5
+ import {
6
+ Configuration2,
7
+ PipelinesApi,
8
+ DeploymentSearchTruncatedError,
9
+ searchDeploymentsPage,
10
+ classifyFeedSession2
11
+ } from "./packager-tool-x461tgwy.js";
12
+ import {
13
+ Configuration3,
14
+ DeploymentsApi2
15
+ } from "./packager-tool-rb06drad.js";
16
+
17
+ // src/services/deployment-search.ts
18
+ async function readDeploymentByKeyAsync2(auth, deploymentKey, options = {}) {
19
+ if (!options.solutionsOnly) {
20
+ const api = new PipelinesApi(new Configuration2({
21
+ basePath: auth.basePath,
22
+ accessToken: auth.accessToken
23
+ }));
24
+ const [error, info] = await catchError(api.pipelinesGetDeploymentByKey({ key: deploymentKey }));
25
+ if (!error) {
26
+ return info ? fromPipelinesRecord(info) : undefined;
27
+ }
28
+ if (httpStatusOf2(error) !== 404) {
29
+ throw error;
30
+ }
31
+ }
32
+ if (classifyFeedSession2(auth) !== "user") {
33
+ return;
34
+ }
35
+ return readDeploymentByKeyViaSolutionsAsync(auth, deploymentKey, options.scope);
36
+ }
37
+ function fromPipelinesRecord(info) {
38
+ return {
39
+ deploymentKey: info.deploymentKey,
40
+ operationStatus: info.operationStatus,
41
+ installedRootFolderKey: info.installedRootFolderKey,
42
+ source: "pipelines"
43
+ };
44
+ }
45
+ async function readDeploymentByKeyViaSolutionsAsync(auth, deploymentKey, scope) {
46
+ const api = new DeploymentsApi2(new Configuration3({
47
+ basePath: auth.basePath,
48
+ accessToken: auth.accessToken
49
+ }));
50
+ const [error, row] = await catchError(api.deploymentsGetByKey({ deploymentKey }, scope));
51
+ if (error) {
52
+ if (httpStatusOf2(error) === 404) {
53
+ return;
54
+ }
55
+ throw error;
56
+ }
57
+ return row ? {
58
+ deploymentKey: row.key,
59
+ operationStatus: row.operationStatus,
60
+ installedRootFolderKey: row.installedRootFolderKey,
61
+ source: "solutions"
62
+ } : undefined;
63
+ }
64
+ async function findDeploymentByName2(auth, deploymentName, scope) {
65
+ return newestDeploymentRow2(await findDeploymentsByName2(auth, deploymentName, scope));
66
+ }
67
+ async function findLiveDeploymentByName2(auth, deploymentName, scope) {
68
+ const newest = await findDeploymentByName2(auth, deploymentName, scope);
69
+ return isCompletedUninstall2(newest) ? undefined : newest;
70
+ }
71
+ function isCompletedUninstall2(row) {
72
+ return row?.operation === "Uninstall" && row.operationStatus === "Successful";
73
+ }
74
+ async function findDeploymentsByPackageName2(auth, packageName, options = {}) {
75
+ return walkDeploymentSearch(auth, { by: "packageName", term: packageName, cap: MAX_PACKAGE_SEARCH_ROWS }, options.scope, (deployment) => deployment.packageName === packageName && (options.folderPath === undefined || deployment.folderPath === options.folderPath));
76
+ }
77
+ var SEARCH_PAGE_SIZE = 50;
78
+ var MAX_PACKAGE_SEARCH_ROWS = 1000;
79
+ var MAX_NAME_SEARCH_ROWS = 5000;
80
+
81
+ class DeploymentSearchCapError2 extends DeploymentSearchTruncatedError {
82
+ name = "DeploymentSearchCapError";
83
+ search;
84
+ term;
85
+ cap;
86
+ partialRows;
87
+ errorCode = "server_error";
88
+ retry = "RetryWillNotFix";
89
+ instructions = "Check the deployments in Orchestrator (Tenant > Solutions > Deployments), which is not limited by this cap.";
90
+ constructor(walk, partialRows) {
91
+ super(walk.cap, "page-cap");
92
+ this.search = walk.by;
93
+ this.term = walk.term;
94
+ this.cap = walk.cap;
95
+ this.partialRows = partialRows;
96
+ const filter = walk.by === "packageName" ? "package name" : "deployment name";
97
+ this.message = `The deployment search by ${filter} '${walk.term}' stopped at its cap of ${walk.cap} rows with rows still unread, so the deployments it found may not be all of them.`;
98
+ }
99
+ }
100
+ async function walkDeploymentSearch(auth, walk, scope, keep) {
101
+ const matches = [];
102
+ const take = SEARCH_PAGE_SIZE;
103
+ for (let skip = 0;; ) {
104
+ const result = await searchDeploymentsPage(auth, { [walk.by]: walk.term, take, skip }, scope);
105
+ const values = result.values ?? [];
106
+ matches.push(...values.filter(keep));
107
+ skip += values.length;
108
+ const total = result.count;
109
+ if (values.length < take || typeof total === "number" && skip >= total) {
110
+ return matches;
111
+ }
112
+ if (skip >= walk.cap) {
113
+ throw new DeploymentSearchCapError2(walk, matches);
114
+ }
115
+ }
116
+ }
117
+ async function findCurrentDeploymentAsync2(auth, deployment, scope) {
118
+ const installKey = deployment.installDeploymentKey ?? deployment.key;
119
+ const rows = await findDeploymentsByPackageName2(auth, deployment.packageName, { scope });
120
+ return rows.find((row) => (row.installDeploymentKey ?? row.key) === installKey);
121
+ }
122
+ function blocksRedeploy2(deployment) {
123
+ if (deployment.operationStatus === "InProgress") {
124
+ return true;
125
+ }
126
+ if (deployment.operationStatus === "Successful") {
127
+ return deployment.operation !== "Uninstall";
128
+ }
129
+ if (deployment.operationStatus === "Draft" || deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
130
+ return deployment.operation !== undefined && deployment.operation !== null && deployment.operation !== "Install";
131
+ }
132
+ return false;
133
+ }
134
+ var MAX_LISTED_DEPLOYMENTS2 = 5;
135
+ function formatExistingDeployments2(deployments, folderByKey) {
136
+ const described = deployments.slice(0, MAX_LISTED_DEPLOYMENTS2).map((deployment) => {
137
+ const resolved = deployment.installedRootFolderKey ? folderByKey?.get(deployment.installedRootFolderKey) : undefined;
138
+ const folder = resolved ?? deployment.folderPath ?? "an unknown folder";
139
+ const current = deployment.currentPackageVersion ?? deployment.packageVersion ?? "an unknown version";
140
+ const target = deployment.targetPackageVersion ?? deployment.newPackageVersionAvailable;
141
+ const version = target && target !== current ? `${current} → ${target}` : current;
142
+ const state = [
143
+ deployment.operation,
144
+ deployment.operationStatus,
145
+ deployment.activationStatus
146
+ ].filter((part) => part !== undefined && part !== null).join("/");
147
+ return `'${deployment.name}' in ${folder} (version ${version}${state ? `, ${state}` : ""})`;
148
+ }).join("; ");
149
+ const remaining = deployments.length - MAX_LISTED_DEPLOYMENTS2;
150
+ return remaining > 0 ? `${described}; and ${remaining} more (see: uip solution deploy list)` : described;
151
+ }
152
+ async function findDeploymentsByName2(auth, deploymentName, scope) {
153
+ return walkDeploymentSearch(auth, {
154
+ by: "deploymentName",
155
+ term: deploymentName,
156
+ cap: MAX_NAME_SEARCH_ROWS
157
+ }, scope, (deployment) => deployment.name === deploymentName);
158
+ }
159
+ async function findDeploymentBestEffort2(auth, deploymentName, scope, prefer = {}) {
160
+ const [lookupError, rows] = await catchError(findDeploymentsByName2(auth, deploymentName, scope));
161
+ if (lookupError || !rows) {
162
+ return;
163
+ }
164
+ if (prefer.deploymentKey) {
165
+ return rows.find((row) => row.key === prefer.deploymentKey && row.operation !== "Uninstall");
166
+ }
167
+ const candidates = rows.filter((row) => row.operation !== "Uninstall");
168
+ return candidates.sort((a, b) => creationMillis(b) - creationMillis(a))[0];
169
+ }
170
+ function newestDeploymentRow2(rows) {
171
+ return [...rows].sort((a, b) => creationMillis(b) - creationMillis(a))[0];
172
+ }
173
+ function creationMillis(row) {
174
+ const millis = row.deploymentCreationTime ? new Date(row.deploymentCreationTime).getTime() : Number.NaN;
175
+ return Number.isFinite(millis) ? millis : 0;
176
+ }
177
+ async function isPipelineDeploymentNotFoundError2(error) {
178
+ if (!error || typeof error !== "object") {
179
+ return false;
180
+ }
181
+ const response = error.response;
182
+ if (!response || typeof response !== "object") {
183
+ return false;
184
+ }
185
+ const status = response.status;
186
+ if (status !== 404) {
187
+ return false;
188
+ }
189
+ const [bodyError, body] = await catchError(response.clone().text());
190
+ if (bodyError || !body) {
191
+ return false;
192
+ }
193
+ return body.includes("PipelineDeploymentNotFound");
194
+ }
195
+ function interpretFailedDeployPoll2(deployment) {
196
+ if (!deployment) {
197
+ return;
198
+ }
199
+ if (deployment.operationStatus === "Failed" || deployment.operationStatus === "FailedRollback") {
200
+ return {
201
+ kind: "DeployFailed",
202
+ operationStatus: deployment.operationStatus
203
+ };
204
+ }
205
+ if (deployment.operationStatus !== "Successful") {
206
+ return;
207
+ }
208
+ switch (deployment.activationStatus) {
209
+ case "Active":
210
+ return { kind: "Active", instanceId: deployment.instanceId };
211
+ case "NeedsSetupToActivate":
212
+ return { kind: "NeedsSetupToActivate" };
213
+ case "ReadyToActivate":
214
+ case "Inactive":
215
+ return { kind: "ReadyToActivate" };
216
+ case "ActivationFailed":
217
+ return { kind: "ActivationFailed" };
218
+ default:
219
+ return;
220
+ }
221
+ }
222
+ function mapOperationStatusToPipelineStatus2(operationStatus) {
223
+ switch (operationStatus) {
224
+ case "Successful":
225
+ return "DeploymentSucceeded";
226
+ case "Failed":
227
+ case "FailedRollback":
228
+ case "Draft":
229
+ return "DeploymentFailed";
230
+ default:
231
+ return;
232
+ }
233
+ }
234
+ function deploymentToTerminalPipelineResult2(deployment) {
235
+ const status = mapOperationStatusToPipelineStatus2(deployment.operationStatus);
236
+ if (!status) {
237
+ return;
238
+ }
239
+ return {
240
+ status,
241
+ validationResult: { validationErrors: [], conflictErrors: [] },
242
+ deploymentKey: deployment.key,
243
+ configurationKey: deployment.configurationKey,
244
+ instanceId: deployment.instanceId,
245
+ conflictFixingErrors: [],
246
+ deploymentScheduleErrors: []
247
+ };
248
+ }
249
+ async function resolveInstalledFolder2(deployment, requested, resolveFolderByKey) {
250
+ const fallback = {
251
+ folderName: requested.folderName,
252
+ folderPath: requested.folderPath,
253
+ requestedMatched: true
254
+ };
255
+ const pathFor = (name, path) => path ?? (requested.parentFolderPath ? `${requested.parentFolderPath}/${name}` : name);
256
+ const folderKey = deployment?.installedRootFolderKey;
257
+ if (folderKey && resolveFolderByKey) {
258
+ const [lookupError, folder] = await catchError(resolveFolderByKey(folderKey));
259
+ if (!lookupError && folder?.name) {
260
+ return {
261
+ folderName: folder.name,
262
+ folderPath: pathFor(folder.name, folder.path ?? deployment?.folderPath ?? undefined),
263
+ requestedMatched: folder.name === requested.folderName
264
+ };
265
+ }
266
+ }
267
+ const resolvedName = deployment?.installedRootFolderName;
268
+ if (resolvedName) {
269
+ return {
270
+ folderName: resolvedName,
271
+ folderPath: pathFor(resolvedName, deployment?.folderPath ?? undefined),
272
+ requestedMatched: resolvedName === requested.folderName
273
+ };
274
+ }
275
+ return fallback;
276
+ }
277
+
278
+ export { readDeploymentByKeyAsync2, findDeploymentByName2, findLiveDeploymentByName2, isCompletedUninstall2, findDeploymentsByPackageName2, DeploymentSearchCapError2, findCurrentDeploymentAsync2, blocksRedeploy2, MAX_LISTED_DEPLOYMENTS2, formatExistingDeployments2, findDeploymentsByName2, findDeploymentBestEffort2, newestDeploymentRow2, isPipelineDeploymentNotFoundError2, interpretFailedDeployPoll2, mapOperationStatusToPipelineStatus2, deploymentToTerminalPipelineResult2, resolveInstalledFolder2 };
279
+
280
+ //# debugId=72BB1B28C8150E9F64756E2164756E21
@@ -1,16 +1,82 @@
1
1
  import {
2
- createNodeSolutionPackager
3
- } from "./packager-tool-2vmz56qh.js";
2
+ getFileSystem
3
+ } from "./packager-tool-vgrswa8p.js";
4
4
  import {
5
- getLoginStatusAsync
6
- } from "./packager-tool-43ahv5mn.js";
5
+ CommandDimensions,
6
+ ProjectDimensions,
7
+ projectKey,
8
+ projectIdentityProperties,
9
+ PROJECT_IDENTITY_LOOKUP_BUDGET_MS,
10
+ withinProjectIdentityBudget,
11
+ catchError,
12
+ isProjectTelemetryDisabled
13
+ } from "./packager-tool-m07vyk89.js";
7
14
  import {
8
15
  logger,
16
+ CommonTelemetryEvents,
9
17
  telemetry
10
- } from "./packager-tool-tx834spe.js";
18
+ } from "./packager-tool-9vrwpgt3.js";
19
+ import {
20
+ toolsFactoryRepository
21
+ } from "./packager-tool-a7s0gbxs.js";
22
+ import {
23
+ getLoginStatusAsync
24
+ } from "./packager-tool-t39pjz7n.js";
11
25
  import {
12
- catchError
13
- } from "./packager-tool-6ybywxxn.js";
26
+ createNodeSolutionPackager
27
+ } from "./packager-tool-jatbb6c5.js";
28
+
29
+ // src/services/project-identity-telemetry.ts
30
+ function createProjectActivityObserver(commandName) {
31
+ if (isProjectTelemetryDisabled())
32
+ return;
33
+ const properties = new Map;
34
+ const finished = new Set;
35
+ return async (project, phase, success, solutionId) => {
36
+ if (project.Type !== "Api")
37
+ return;
38
+ const member = project.Id;
39
+ if (phase === "before") {
40
+ if (properties.has(member))
41
+ return;
42
+ const membership = {
43
+ [ProjectDimensions.SolutionProjectKey]: projectKey(member),
44
+ ...solutionId ? {
45
+ [ProjectDimensions.SolutionKey]: projectKey(solutionId)
46
+ } : {}
47
+ };
48
+ const row = (status, id) => ({
49
+ ...projectIdentityProperties({
50
+ projectType: project.Type,
51
+ status,
52
+ ...id ? { id } : {}
53
+ }),
54
+ ...membership
55
+ });
56
+ const factory = toolsFactoryRepository.canHandleProject(project.Type) ? toolsFactoryRepository.getProjectToolFactory(project.Type) : undefined;
57
+ if (!factory?.readProjectIdentityAsync || !project.ProjectPath) {
58
+ properties.set(member, row("unsupported"));
59
+ return;
60
+ }
61
+ properties.set(member, row("timeout"));
62
+ let descriptor;
63
+ try {
64
+ descriptor = await withinProjectIdentityBudget(factory.readProjectIdentityAsync(project.ProjectPath, getFileSystem()), () => logger.debug(`project activity identity skipped: no answer within ${PROJECT_IDENTITY_LOOKUP_BUDGET_MS} ms`));
65
+ } catch {
66
+ descriptor = { status: "invalid" };
67
+ }
68
+ if (descriptor && !finished.has(member))
69
+ properties.set(member, row(descriptor.status, descriptor.id));
70
+ } else if (!finished.has(member)) {
71
+ finished.add(member);
72
+ telemetry.trackEvent(CommonTelemetryEvents.ProjectActivity, {
73
+ ...properties.get(member),
74
+ [CommandDimensions.CommandName]: commandName,
75
+ [CommandDimensions.TerminalOutcome]: success ? "success" : "failure"
76
+ });
77
+ }
78
+ };
79
+ }
14
80
 
15
81
  // src/services/solution-packager-helpers.ts
16
82
  async function createSolutionPackager() {
@@ -104,6 +170,6 @@ async function checkSolutionPathAsync(fs, solutionPath) {
104
170
  return { ok: true, absoluteSolutionPath, isUisFile, stats };
105
171
  }
106
172
 
107
- export { createSolutionPackager, readSolutionFileAsUint8Array, resolveSdkLogLevel, applyAuthConnection, SOLUTION_PATH_INSTRUCTIONS, checkSolutionPathAsync };
173
+ export { createProjectActivityObserver, createSolutionPackager, readSolutionFileAsUint8Array, resolveSdkLogLevel, applyAuthConnection, SOLUTION_PATH_INSTRUCTIONS, checkSolutionPathAsync };
108
174
 
109
- //# debugId=E4EA1C14BCE5DE7C64756E2164756E21
175
+ //# debugId=ACC079943269204C64756E2164756E21