@uipath/solution-tool 1.203.0-preview.203 → 1.204.0-preview.206
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.
- package/README.md +2 -2
- package/dist/THIRD-PARTY-NOTICES.md +42 -4
- package/dist/deploy-delete-service-y9dwehmn.js +22 -0
- package/dist/deploy-status-service-nmhnnjmy.js +256 -0
- package/dist/deploy.d.ts +11 -4
- package/dist/deploy.js +19 -7
- package/dist/deployment-search-eb337bjh.js +49 -0
- package/dist/{embedded-file-reader-xxqe8vs8.js → embedded-file-reader-rf2g1kfj.js} +2 -2
- package/dist/feed-resolver-dmtnswcc.js +27 -0
- package/dist/feed-scope-failure-e2yaqfg2.js +18 -0
- package/dist/feed-session-sxga31vn.js +17 -0
- package/dist/index.js +27 -18
- package/dist/init.js +10 -7
- package/dist/{list-n0xd5rgn.js → list-rbjqgz6s.js} +9 -6
- package/dist/pack.js +14 -11
- package/dist/{packager-tool-vas0xg5h.js → packager-tool-2cntqvdv.js} +5 -3
- package/dist/{packager-tool-1haahq17.js → packager-tool-3enm2h28.js} +5 -5
- package/dist/{packager-tool-2syrt51a.js → packager-tool-3fv6zc86.js} +1062 -825
- package/dist/packager-tool-3fyq6wjs.js +5889 -0
- package/dist/{packager-tool-k4mskzww.js → packager-tool-5dzjsw5q.js} +3 -3
- package/dist/{packager-tool-0f0wt9vh.js → packager-tool-5fjp60dk.js} +3071 -2794
- package/dist/{packager-tool-x6gzyxnn.js → packager-tool-752zvh64.js} +756 -359
- package/dist/{packager-tool-bkwnetqn.js → packager-tool-83rzavkx.js} +383 -88
- package/dist/{packager-tool-7znqtw3f.js → packager-tool-9vvdgbay.js} +8 -6
- package/dist/packager-tool-b8pppqbb.js +172 -0
- package/dist/packager-tool-bqre28m1.js +43 -0
- package/dist/packager-tool-dh0m3ebf.js +173 -0
- package/dist/packager-tool-f5gq77m5.js +28 -0
- package/dist/{packager-tool-nzghfa48.js → packager-tool-fv7xyzg2.js} +550 -2
- package/dist/{packager-tool-3jrq7smt.js → packager-tool-gb35b4qs.js} +206 -289
- package/dist/{packager-tool-j2cqgegq.js → packager-tool-he7ak44z.js} +16 -74
- package/dist/packager-tool-myn57mc3.js +322 -0
- package/dist/{packager-tool-4rzjjv2p.js → packager-tool-n1nzj2b9.js} +1008 -647
- package/dist/packager-tool-n6yb6zp9.js +113 -0
- package/dist/{packager-tool-h4wn0y42.js → packager-tool-qgaqqq41.js} +320 -151
- package/dist/{packager-tool-resolver-fmjr60x8.js → packager-tool-resolver-2cbxyq6k.js} +6 -5
- package/dist/{packager-tool-ge4rvy7p.js → packager-tool-t12hj6pd.js} +1022 -1342
- package/dist/{packager-tool-znakt6yw.js → packager-tool-vh4ng74p.js} +8 -6
- package/dist/packager-tool-vmsxq1pc.js +104 -0
- package/dist/packager-tool-w6jr4638.js +166 -0
- package/dist/packager-tool-zf3929se.js +237 -0
- package/dist/packager-tool-zns6n8zp.js +837 -0
- package/dist/packager-tool-zw3036b8.js +37 -0
- package/dist/packager-tool.js +2 -2
- package/dist/prepare-solution-resources-p3gzdecy.js +25 -0
- package/dist/{project-contributions-cvttys34.js → project-contributions-txe8v6sm.js} +12 -9
- package/dist/publish.js +12 -7
- package/dist/resource.js +9 -6
- package/dist/services/activation.d.ts +17 -2
- package/dist/services/deploy-activate-service.d.ts +10 -0
- package/dist/services/deploy-delete-service.d.ts +82 -0
- package/dist/services/deploy-list-service.d.ts +15 -45
- package/dist/services/deploy-run-service.d.ts +36 -23
- package/dist/services/deploy-upgrade-service.d.ts +198 -39
- package/dist/services/deployment-feed-locator.d.ts +50 -12
- package/dist/services/deployment-search-client.d.ts +55 -0
- package/dist/services/deployment-search.d.ts +87 -34
- package/dist/services/deployment-state.d.ts +119 -0
- package/dist/services/feed-resolver.d.ts +31 -0
- package/dist/services/feed-session.d.ts +70 -0
- package/dist/services/folder-helper.d.ts +4 -27
- package/dist/services/http-status.d.ts +9 -0
- package/dist/services/incomplete-feed-sweep.d.ts +77 -0
- package/dist/services/legacy-deployment-search-v3.d.ts +23 -0
- package/dist/services/packages-list-service.d.ts +5 -0
- package/dist/services/pipeline-deploy-poll.d.ts +69 -0
- package/dist/services/publish-service.d.ts +14 -16
- package/dist/services/search-failure.d.ts +27 -0
- package/dist/templates/AGENTS.md +60 -20
- package/dist/tool.js +27 -18
- package/dist/utils/deployment-errors.d.ts +57 -0
- package/package.json +2 -2
- package/dist/packager-tool-07bqr90h.js +0 -51960
- package/dist/packager-tool-jz2wbfjz.js +0 -2275
- package/dist/prepare-solution-resources-wds3r8bq.js +0 -22
- package/dist/services/personal-workspace-deploy.d.ts +0 -49
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
assertNoContributionErrors,
|
|
4
4
|
collectProjectContributions,
|
|
5
5
|
contributionErrorMessages
|
|
6
|
-
} from "./packager-tool-
|
|
6
|
+
} from "./packager-tool-vh4ng74p.js";
|
|
7
7
|
import {
|
|
8
8
|
ensurePackagerTools
|
|
9
|
-
} from "./packager-tool-
|
|
9
|
+
} from "./packager-tool-5dzjsw5q.js";
|
|
10
10
|
import {
|
|
11
11
|
Tokens,
|
|
12
12
|
createResourceBuilderServices,
|
|
@@ -17,12 +17,14 @@ import {
|
|
|
17
17
|
models_BindingsResourceType,
|
|
18
18
|
readUipxProjects,
|
|
19
19
|
syncAndLog
|
|
20
|
-
} from "./packager-tool-
|
|
20
|
+
} from "./packager-tool-83rzavkx.js";
|
|
21
21
|
import {
|
|
22
22
|
catchError,
|
|
23
|
-
getFileSystem,
|
|
24
23
|
logger
|
|
25
|
-
} from "./packager-tool-
|
|
24
|
+
} from "./packager-tool-5fjp60dk.js";
|
|
25
|
+
import {
|
|
26
|
+
getFileSystem
|
|
27
|
+
} from "./packager-tool-zf3929se.js";
|
|
26
28
|
|
|
27
29
|
// src/services/emit-runtime-dependencies.ts
|
|
28
30
|
import { createHash } from "node:crypto";
|
|
@@ -241,4 +243,4 @@ async function prepareSolutionResources(solutionDir, fs, options) {
|
|
|
241
243
|
|
|
242
244
|
export { projectSubTypesFrom, prepareSolutionResources };
|
|
243
245
|
|
|
244
|
-
//# debugId=
|
|
246
|
+
//# debugId=16FA8B6372D1A69964756E2164756E21
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import {
|
|
2
|
+
findDeploymentByName,
|
|
3
|
+
findLiveDeploymentByName
|
|
4
|
+
} from "./packager-tool-myn57mc3.js";
|
|
5
|
+
import {
|
|
6
|
+
folderKeyInitOverride,
|
|
7
|
+
listSelectablePublishLocations,
|
|
8
|
+
resolvePersonalWorkspace
|
|
9
|
+
} from "./packager-tool-dh0m3ebf.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,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveSessionIdentity
|
|
3
|
+
} from "./packager-tool-gb35b4qs.js";
|
|
4
|
+
|
|
5
|
+
// src/services/feed-session.ts
|
|
6
|
+
function classifyFeedSession(session) {
|
|
7
|
+
const type = (session.identity ?? resolveSessionIdentity(session.accessToken))?.type;
|
|
8
|
+
if (type === "User") {
|
|
9
|
+
return "user";
|
|
10
|
+
}
|
|
11
|
+
return type === "Application" ? "application" : "unknown";
|
|
12
|
+
}
|
|
13
|
+
function feedSessionRefusal(verdict, action, alternative) {
|
|
14
|
+
if (verdict === "application") {
|
|
15
|
+
return {
|
|
16
|
+
message: `${action} needs a user session; this session is an external app.`,
|
|
17
|
+
instructions: `The server does not apply X-UIPATH-FolderKey to client-credentials requests, so the request would run against the tenant feed instead. Run it with a user session ('uip login'), or ${alternative}.`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
message: `${action} needs a user session, and this session's kind could not be read from its token.`,
|
|
22
|
+
instructions: `The server applies X-UIPATH-FolderKey to user-token requests only, and a session that cannot be shown to be a user's is not allowed to act on a feed — guessing wrong would run the request against the tenant feed. Refresh the session with 'uip login' (an interactive login is recorded as a user session), or ${alternative}.`
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function feedReadRefusalForApplication(session, action) {
|
|
26
|
+
if (classifyFeedSession(session) !== "application") {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
return feedSessionRefusal("application", action, "drop the feed flag to read the tenant feed");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class FeedReadRefusedError extends Error {
|
|
33
|
+
refusal;
|
|
34
|
+
constructor(refusal) {
|
|
35
|
+
super(refusal.message);
|
|
36
|
+
this.refusal = refusal;
|
|
37
|
+
this.name = "FeedReadRefusedError";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { classifyFeedSession, feedSessionRefusal, feedReadRefusalForApplication, FeedReadRefusedError };
|
|
42
|
+
|
|
43
|
+
//# debugId=46593028C6477B8B64756E2164756E21
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAvailablePublishLocationsV2
|
|
3
|
+
} from "./packager-tool-t12hj6pd.js";
|
|
4
|
+
import {
|
|
5
|
+
classifyFeedSession
|
|
6
|
+
} from "./packager-tool-bqre28m1.js";
|
|
7
|
+
import {
|
|
8
|
+
PersonalWorkspacesApi,
|
|
9
|
+
createOrchestratorConfig
|
|
10
|
+
} from "./packager-tool-3fv6zc86.js";
|
|
11
|
+
import {
|
|
12
|
+
extractErrorDetails
|
|
13
|
+
} from "./packager-tool-5fjp60dk.js";
|
|
14
|
+
import {
|
|
15
|
+
getLoginStatusAsync
|
|
16
|
+
} from "./packager-tool-gb35b4qs.js";
|
|
17
|
+
|
|
18
|
+
// src/services/personal-workspace-resolver.ts
|
|
19
|
+
async function resolvePersonalWorkspace(options) {
|
|
20
|
+
const config = await createOrchestratorConfig(options);
|
|
21
|
+
const api = new PersonalWorkspacesApi(config);
|
|
22
|
+
const pw = await api.personalWorkspacesGetPersonalWorkspace();
|
|
23
|
+
if (!pw?.key || !pw.name) {
|
|
24
|
+
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.");
|
|
25
|
+
}
|
|
26
|
+
return { key: pw.key, name: pw.name };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/services/publish-locations-service.ts
|
|
30
|
+
async function resolveStudioWebTarget(options) {
|
|
31
|
+
const loginStatus = await getLoginStatusAsync({
|
|
32
|
+
ensureTokenValidityMinutes: options?.loginValidity,
|
|
33
|
+
envFilePath: options?.envFilePath
|
|
34
|
+
});
|
|
35
|
+
if (loginStatus.loginStatus !== "Logged in" || !loginStatus.accessToken || !loginStatus.baseUrl) {
|
|
36
|
+
throw new Error("Not logged in. Run 'uip login' first.");
|
|
37
|
+
}
|
|
38
|
+
if (!loginStatus.organizationName) {
|
|
39
|
+
throw new Error("Organization name is not available. Re-authenticate with 'uip login'.");
|
|
40
|
+
}
|
|
41
|
+
if (options?.tenant && loginStatus.tenantName && options.tenant.toLowerCase() !== loginStatus.tenantName.toLowerCase()) {
|
|
42
|
+
throw new Error(`Feeds are resolved for the logged-in tenant ('${loginStatus.tenantName}'), so --tenant '${options.tenant}' can't apply here. Switch tenants first with: uip login tenant set ${options.tenant}.`);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
config: {
|
|
46
|
+
baseUrl: loginStatus.baseUrl,
|
|
47
|
+
authToken: loginStatus.accessToken,
|
|
48
|
+
tenantId: loginStatus.tenantId
|
|
49
|
+
},
|
|
50
|
+
organizationName: loginStatus.organizationName
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function isSelectableFeed(location) {
|
|
54
|
+
switch (location.type) {
|
|
55
|
+
case "Tenant":
|
|
56
|
+
case "Folder":
|
|
57
|
+
return true;
|
|
58
|
+
case "PersonalWorkspace":
|
|
59
|
+
return location.isMyPersonalWorkspace;
|
|
60
|
+
default:
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function listSelectablePublishLocations(options) {
|
|
65
|
+
const { config, organizationName } = await resolveStudioWebTarget(options);
|
|
66
|
+
const all = await getAvailablePublishLocationsV2(config, organizationName);
|
|
67
|
+
return all.filter(isSelectableFeed);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/services/feed-resolver.ts
|
|
71
|
+
function folderKeyInitOverride(folderKey) {
|
|
72
|
+
return async ({ init }) => ({
|
|
73
|
+
headers: { ...init.headers, "X-UIPATH-FolderKey": folderKey }
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function feedScopeInitOverride(scope) {
|
|
77
|
+
const { folderKey } = scope;
|
|
78
|
+
if (!folderKey) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
return folderKeyInitOverride(folderKey);
|
|
82
|
+
}
|
|
83
|
+
function feedSelectorFlag(scope) {
|
|
84
|
+
if (!scope || scope.kind === "tenant" || !scope.folderKey) {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
return scope.kind === "personal" ? " --personal-workspace" : ` --feed ${scope.folderKey}`;
|
|
88
|
+
}
|
|
89
|
+
function feedResolutionFailureInstructions(options) {
|
|
90
|
+
if (options.personalWorkspace) {
|
|
91
|
+
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.";
|
|
92
|
+
}
|
|
93
|
+
if (options.feed !== undefined) {
|
|
94
|
+
return "List the feeds you can target with: uip solution feeds list.";
|
|
95
|
+
}
|
|
96
|
+
return "Check the selected feed and try again.";
|
|
97
|
+
}
|
|
98
|
+
async function describeFeedResolutionFailureAsync(error, options, session) {
|
|
99
|
+
const details = await extractErrorDetails(error);
|
|
100
|
+
if (options.personalWorkspace && isRefusal(details.context?.httpStatus) && classifyFeedSession(session) === "application") {
|
|
101
|
+
return {
|
|
102
|
+
message: "--personal-workspace needs a user session; this session is an external app, which has no Personal Workspace.",
|
|
103
|
+
instructions: "Run it with a user session that has a Personal Workspace ('uip login'). A client-credentials login cannot target one.",
|
|
104
|
+
errorCode: "permission_denied",
|
|
105
|
+
retry: "RetryWillNotFix",
|
|
106
|
+
context: details.context
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
message: details.message,
|
|
111
|
+
instructions: feedResolutionFailureInstructions(options),
|
|
112
|
+
errorCode: details.errorCode,
|
|
113
|
+
retry: details.retry,
|
|
114
|
+
context: details.context
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function isRefusal(status) {
|
|
118
|
+
return status !== undefined && status >= 400 && status < 500 && status !== 408 && status !== 429;
|
|
119
|
+
}
|
|
120
|
+
async function resolveFeedScope(options) {
|
|
121
|
+
const { personalWorkspace, feed } = options;
|
|
122
|
+
if (personalWorkspace && feed !== undefined) {
|
|
123
|
+
throw new Error("Use either --personal-workspace or --feed, not both.");
|
|
124
|
+
}
|
|
125
|
+
if (personalWorkspace) {
|
|
126
|
+
const pw = await resolvePersonalWorkspace({
|
|
127
|
+
tenant: options.tenant,
|
|
128
|
+
loginValidity: options.loginValidity,
|
|
129
|
+
envFilePath: options.envFilePath
|
|
130
|
+
});
|
|
131
|
+
return { kind: "personal", folderKey: pw.key, name: pw.name };
|
|
132
|
+
}
|
|
133
|
+
if (feed !== undefined) {
|
|
134
|
+
return resolveNamedFeed(feed, options);
|
|
135
|
+
}
|
|
136
|
+
return { kind: "tenant" };
|
|
137
|
+
}
|
|
138
|
+
async function resolveNamedFeed(feed, options) {
|
|
139
|
+
const locations = await listSelectablePublishLocations({
|
|
140
|
+
tenant: options.tenant,
|
|
141
|
+
envFilePath: options.envFilePath,
|
|
142
|
+
loginValidity: options.loginValidity
|
|
143
|
+
});
|
|
144
|
+
const match = matchFeed(feed, locations);
|
|
145
|
+
const kind = match.type === "Tenant" ? "tenant" : match.type === "PersonalWorkspace" ? "personal" : "folder";
|
|
146
|
+
if (kind !== "tenant" && !match.key) {
|
|
147
|
+
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.`);
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
kind,
|
|
151
|
+
folderKey: kind === "tenant" ? undefined : match.key,
|
|
152
|
+
name: match.name
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function matchFeed(feed, locations) {
|
|
156
|
+
const byKey = locations.find((location) => location.key === feed);
|
|
157
|
+
if (byKey) {
|
|
158
|
+
return byKey;
|
|
159
|
+
}
|
|
160
|
+
const target = feed.toLowerCase();
|
|
161
|
+
const byName = locations.filter((location) => location.name.toLowerCase() === target);
|
|
162
|
+
if (byName.length === 1) {
|
|
163
|
+
return byName[0];
|
|
164
|
+
}
|
|
165
|
+
if (byName.length > 1) {
|
|
166
|
+
throw new Error(`More than one feed is named '${feed}'. Pass its key instead — ` + "'uip solution feeds list' shows each feed's key.");
|
|
167
|
+
}
|
|
168
|
+
throw new Error(`Feed '${feed}' is not an available publish location. ` + "Run 'uip solution feeds list' to see the feeds you can publish to.");
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { resolvePersonalWorkspace, listSelectablePublishLocations, folderKeyInitOverride, feedScopeInitOverride, feedSelectorFlag, feedResolutionFailureInstructions, describeFeedResolutionFailureAsync, resolveFeedScope };
|
|
172
|
+
|
|
173
|
+
//# debugId=F37E07288EA6F3E164756E2164756E21
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAuthContext
|
|
3
|
+
} from "./packager-tool-gb35b4qs.js";
|
|
4
|
+
|
|
5
|
+
// ../solution-sdk/src/solution-auth.ts
|
|
6
|
+
async function getSolutionAuthContext(options) {
|
|
7
|
+
const ctx = await getAuthContext({
|
|
8
|
+
tenant: options.tenant,
|
|
9
|
+
ensureTokenValidityMinutes: options.loginValidity ?? 10,
|
|
10
|
+
envFilePath: options.envFilePath,
|
|
11
|
+
requireOrganizationId: true,
|
|
12
|
+
requireTenantName: true
|
|
13
|
+
});
|
|
14
|
+
const organizationId = ctx.organizationId;
|
|
15
|
+
const tenantName = ctx.tenantName;
|
|
16
|
+
const basePath = `${ctx.baseUrl}/${organizationId}/${tenantName}/automationsolutions_`;
|
|
17
|
+
return {
|
|
18
|
+
accessToken: ctx.accessToken,
|
|
19
|
+
basePath,
|
|
20
|
+
organizationId,
|
|
21
|
+
tenantName,
|
|
22
|
+
identity: ctx.identity
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { getSolutionAuthContext };
|
|
27
|
+
|
|
28
|
+
//# debugId=7C83D4398979D25864756E2164756E21
|