@uipath/cli 1.205.0-preview.276 → 1.206.0-preview.279
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/dist/{applicationinsights-s28k1t0d.js → applicationinsights-pwe8sf3y.js} +1269 -1269
- package/dist/{browser-strategy-6atc7v8s.js → browser-strategy-p5fhwxqj.js} +6 -7
- package/dist/cli-q6fp9ccp.js +23 -0
- package/dist/contentStore-c51xqdn2.js +41 -0
- package/dist/environmentInfo-fn0za9jw.js +71 -0
- package/dist/feedbackPrompts-t1enxv1x.js +144 -0
- package/dist/handlers-93z27zrr.js +805 -0
- package/dist/index-16d4evd1.js +1051 -0
- package/dist/index-1vyte4ma.js +14 -0
- package/dist/index-21kns9qg.js +10 -0
- package/dist/{index-yhj4pgvt.js → index-2j7ss97f.js} +331 -2595
- package/dist/index-2k8rhmad.js +274 -0
- package/dist/{index-30618bjs.js → index-2mm750yx.js} +174 -234
- package/dist/{index-622x1qb5.js → index-3fvbddpw.js} +7092 -7092
- package/dist/{index-d3w0wn6k.js → index-5gce5wfd.js} +16 -16
- package/dist/index-5j0bfd3e.js +4744 -0
- package/dist/index-68xmrb9x.js +237 -0
- package/dist/index-6wj58qka.js +59 -0
- package/dist/index-898c4tfz.js +668 -0
- package/dist/index-8gr7ny79.js +365 -0
- package/dist/index-99emfvtm.js +13 -0
- package/dist/{index-pj3g8ftz.js → index-9db5vwx9.js} +2429 -1693
- package/dist/index-ayg25v46.js +151 -0
- package/dist/index-bf0e4evz.js +6180 -0
- package/dist/index-bpqx6f8h.js +92 -0
- package/dist/index-bpxh3fqv.js +392 -0
- package/dist/index-cc653qc1.js +1327 -0
- package/dist/{index-m5nwse9v.js → index-cj4v0jct.js} +21 -69
- package/dist/{index-469jgr1w.js → index-dsj3jrm0.js} +105 -106
- package/dist/{index-1yh8g550.js → index-epsr41wx.js} +8 -12
- package/dist/{index-yb4er9vd.js → index-jjejkkg4.js} +474 -528
- package/dist/index-kg1xrq51.js +171 -0
- package/dist/index-m8vqyv3g.js +72 -0
- package/dist/index-mzqm6xfh.js +45 -0
- package/dist/index-nsrrst23.js +44 -0
- package/dist/{index-h8cph72k.js → index-nzr4mx5p.js} +2 -22
- package/dist/index-p9s0gyrw.js +72 -0
- package/dist/index-qadhm1gn.js +271 -0
- package/dist/index-qwbyt2q5.js +95 -0
- package/dist/index-rbna3w6k.js +200 -0
- package/dist/index-rr5hdtcy.js +95 -0
- package/dist/{index-qa9gftnj.js → index-xd2w5pct.js} +3 -3
- package/dist/index-xpdtagqw.js +30 -0
- package/dist/{index-925304r7.js → index-y085rpen.js} +29 -25
- package/dist/index-y5ncb93a.js +240 -0
- package/dist/index-y7d0cth0.js +93 -0
- package/dist/{index-hdxtgckw.js → index-z070caqq.js} +56 -12
- package/dist/index-zdqbp34f.js +14 -0
- package/dist/index.js +38 -36
- package/dist/install-3gw33jcf.js +558 -0
- package/dist/{jmespath-e4a59c8w.js → jmespath-ab6tdc42.js} +1 -1
- package/dist/js-yaml-0c4svjwq.js +36 -0
- package/dist/{mcp-jssaz3wr.js → mcp-s50h6d56.js} +236 -472
- package/dist/{node-strategy-ggx3nmyj.js → node-strategy-p1n8wr5s.js} +16 -19
- package/dist/project-context-285hydnd.js +94 -0
- package/dist/prompt-hxbzt92e.js +13 -0
- package/dist/{server-nfjr7xrb.js → server-gkr3c7hv.js} +28 -43
- package/dist/skillCatalog-fvw4wgw1.js +22 -0
- package/dist/skillsService-20es18vs.js +29 -0
- package/dist/{stdio-tmngemcz.js → stdio-kpsab5bz.js} +2 -4
- package/dist/{telemetry-drain-r92f0e4r.js → telemetry-drain-bw59e8f5.js} +8 -9
- package/dist/tree-j4w7p0pg.js +17 -0
- package/dist/updateService-pq7pkd42.js +522 -0
- package/dist/updateService.skills-4t1s7z45.js +22 -0
- package/dist/updateService.tools-f7tr6kc6.js +16 -0
- package/package.json +2 -2
- package/dist/cli-r7998zeh.js +0 -19
- package/dist/index-0gctz400.js +0 -17
- package/dist/index-2dp7m4r8.js +0 -9867
- package/dist/index-4cq44eth.js +0 -19427
- package/dist/index-7tshyfxx.js +0 -157
- package/dist/index-g8ck9tv6.js +0 -2
- package/dist/index-ngs0a2he.js +0 -15
- package/dist/index-yc4kw997.js +0 -13
- package/dist/js-yaml-69tsdrrf.js +0 -37
- package/dist/updateService-nrmb1tsc.js +0 -14
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_AUTH_TIMEOUT_MS2,
|
|
3
|
+
AUTH_TIMEOUT_ERROR_CODE2,
|
|
4
|
+
AUTH_CANCELLED_ERROR_CODE2,
|
|
5
|
+
AUTH_RECLAIMED_ERROR_CODE2
|
|
6
|
+
} from "./index-99emfvtm.js";
|
|
7
|
+
import {
|
|
8
|
+
getActiveAuthProfile2,
|
|
9
|
+
getActiveAuthProfileFilePath2,
|
|
10
|
+
ENV_AUTH_ENABLE_VAR2,
|
|
11
|
+
ENV_AUTH_VARS2,
|
|
12
|
+
EnvAuthConfigError2,
|
|
13
|
+
isEnvAuthEnabled2,
|
|
14
|
+
AUTH_FLOW_ENV_VAR2,
|
|
15
|
+
DEFAULT_AUTH_FILENAME2,
|
|
16
|
+
DEFAULT_ENV_FILENAME2,
|
|
17
|
+
resolveEnvFileLocationAsync2,
|
|
18
|
+
isTenantSelectionError2
|
|
19
|
+
} from "./index-2mm750yx.js";
|
|
20
|
+
import {
|
|
21
|
+
getFileSystem2
|
|
22
|
+
} from "./index-z070caqq.js";
|
|
23
|
+
import {
|
|
24
|
+
catchError,
|
|
25
|
+
formatErrorChain,
|
|
26
|
+
describeConnectivityError,
|
|
27
|
+
RESULTS,
|
|
28
|
+
getOutputSink,
|
|
29
|
+
logger,
|
|
30
|
+
getOutputFormat,
|
|
31
|
+
getOutputFormatExplicit,
|
|
32
|
+
EXIT_CODES,
|
|
33
|
+
OutputFormatter,
|
|
34
|
+
resolveEnvReference,
|
|
35
|
+
canPrompt,
|
|
36
|
+
splitScopeList
|
|
37
|
+
} from "./index-9db5vwx9.js";
|
|
38
|
+
import"./index-5j0bfd3e.js";
|
|
39
|
+
import {
|
|
40
|
+
auth
|
|
41
|
+
} from "./index-rr5hdtcy.js";
|
|
42
|
+
import {
|
|
43
|
+
COPYRIGHT_NOTICE,
|
|
44
|
+
trackAuthLogin,
|
|
45
|
+
trackTenantSelection,
|
|
46
|
+
trackTokenRefresh
|
|
47
|
+
} from "./index-ayg25v46.js";
|
|
48
|
+
|
|
49
|
+
// src/commands/login/handlers.ts
|
|
50
|
+
function resolveCallbackTimeoutOverrideMs() {
|
|
51
|
+
const raw = process.env.UIPATH_CLI_AUTH_CALLBACK_TIMEOUT_MS?.trim();
|
|
52
|
+
if (!raw || !/^\d+$/.test(raw)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const ms = Number.parseInt(raw, 10);
|
|
56
|
+
if (ms < 1000 || ms > DEFAULT_AUTH_TIMEOUT_MS2) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
return ms;
|
|
60
|
+
}
|
|
61
|
+
function resolveAuthFilePath(folder) {
|
|
62
|
+
const profilePath = getActiveAuthProfileFilePath2();
|
|
63
|
+
if (profilePath && !folder) {
|
|
64
|
+
return profilePath;
|
|
65
|
+
}
|
|
66
|
+
if (folder) {
|
|
67
|
+
return getFileSystem2().path.join(folder, DEFAULT_AUTH_FILENAME2);
|
|
68
|
+
}
|
|
69
|
+
return DEFAULT_ENV_FILENAME2;
|
|
70
|
+
}
|
|
71
|
+
function rejectProfileFileConflict(context, folder) {
|
|
72
|
+
const profile = getActiveAuthProfile2();
|
|
73
|
+
if (!profile || folder === undefined) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
OutputFormatter.error({
|
|
77
|
+
Result: RESULTS.ValidationError,
|
|
78
|
+
Message: "error: option '--profile' cannot be used with option '--file'",
|
|
79
|
+
Instructions: "Use --profile <name> for a named login profile, or --file <folder> for an explicit credentials folder."
|
|
80
|
+
});
|
|
81
|
+
context.exit(EXIT_CODES.ValidationError);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
var ENV_AUTH_FALLBACK_HINT = "Headless? Set UIPATH_CLI_ENABLE_ENV_AUTH=true with UIPATH_CLI_AUTH_TOKEN, UIPATH_CLI_ORGANIZATION_NAME, UIPATH_CLI_ORGANIZATION_ID, UIPATH_CLI_TENANT_NAME, and UIPATH_CLI_TENANT_ID to skip the browser flow.";
|
|
85
|
+
function instructionsForLoginError(error, message, noBrowser) {
|
|
86
|
+
if (/[\r\n]/.test(message)) {
|
|
87
|
+
return `See message above for details. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
88
|
+
}
|
|
89
|
+
const code = error instanceof Object && "code" in error ? error.code : undefined;
|
|
90
|
+
if (code === "EPERM" || code === "EACCES") {
|
|
91
|
+
return `The callback listener on port 8104 was blocked by the OS or sandbox (${String(code)}). Grant local-network permission or run outside the sandbox, then try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
92
|
+
}
|
|
93
|
+
if (code === "EADDRINUSE") {
|
|
94
|
+
return `Port 8104 is already in use by another application (a stale 'uip login' would have been released automatically). Close the application holding the port, then try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
95
|
+
}
|
|
96
|
+
if (code === "EADDRNOTAVAIL") {
|
|
97
|
+
return `The callback listener could not bind to the loopback address. Check that 127.0.0.1 resolves locally, then try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
98
|
+
}
|
|
99
|
+
if (code === AUTH_RECLAIMED_ERROR_CODE2) {
|
|
100
|
+
return "Only one 'uip login' can wait for a sign-in at a time, and a newer one took over the callback port. If that wasn't you, run 'uip login' again to take it back.";
|
|
101
|
+
}
|
|
102
|
+
if (code === AUTH_TIMEOUT_ERROR_CODE2) {
|
|
103
|
+
return noBrowser ? `No sign-in callback was received within the timeout. The printed URL may not have been opened, may have been copied incompletely (a line-wrapped or truncated copy is rejected by the identity server), or the sign-in was not completed. Retry and open the URL exactly as printed. ${ENV_AUTH_FALLBACK_HINT}` : `The browser did not return an authorization code within the timeout. Make sure your default browser opened, complete the sign-in, then retry. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
104
|
+
}
|
|
105
|
+
const connectivity = describeConnectivityError(error);
|
|
106
|
+
if (connectivity) {
|
|
107
|
+
return connectivity.instructions;
|
|
108
|
+
}
|
|
109
|
+
return `Inspect command arguments and message and try again. ${ENV_AUTH_FALLBACK_HINT}`;
|
|
110
|
+
}
|
|
111
|
+
function loginErrorMessage(error) {
|
|
112
|
+
logger.debug(`login command error:
|
|
113
|
+
${formatErrorChain(error)}`);
|
|
114
|
+
const base = error instanceof Error ? error.message : String(error);
|
|
115
|
+
const connectivity = describeConnectivityError(error);
|
|
116
|
+
if (connectivity && connectivity.message !== base) {
|
|
117
|
+
return `${base}: ${connectivity.message}`;
|
|
118
|
+
}
|
|
119
|
+
return base;
|
|
120
|
+
}
|
|
121
|
+
function instructionsForStatusError(err) {
|
|
122
|
+
if (err instanceof EnvAuthConfigError2 || isEnvAuthEnabled2()) {
|
|
123
|
+
return "Check the UIPATH_CLI_* environment variables and re-run.";
|
|
124
|
+
}
|
|
125
|
+
const connectivity = describeConnectivityError(err);
|
|
126
|
+
if (connectivity) {
|
|
127
|
+
return connectivity.instructions;
|
|
128
|
+
}
|
|
129
|
+
return "Failed to read login status. Check your credentials file.";
|
|
130
|
+
}
|
|
131
|
+
function credentialSourceLabel(source) {
|
|
132
|
+
switch (source) {
|
|
133
|
+
case "robot" /* Robot */:
|
|
134
|
+
return "Robot";
|
|
135
|
+
case "env-vars" /* EnvironmentVariables */:
|
|
136
|
+
return "EnvironmentVariables";
|
|
137
|
+
case "saved-login" /* SavedLogin */:
|
|
138
|
+
return "SavedLogin";
|
|
139
|
+
default:
|
|
140
|
+
return "N/A";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function legacyProviderLabel(source) {
|
|
144
|
+
switch (source) {
|
|
145
|
+
case "robot" /* Robot */:
|
|
146
|
+
return "Robot";
|
|
147
|
+
case "env-vars" /* EnvironmentVariables */:
|
|
148
|
+
return "Environment";
|
|
149
|
+
case "saved-login" /* SavedLogin */:
|
|
150
|
+
return "File";
|
|
151
|
+
default:
|
|
152
|
+
return "N/A";
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function authFlowLabel(flow) {
|
|
156
|
+
switch (flow) {
|
|
157
|
+
case "authorization_code":
|
|
158
|
+
return "Interactive";
|
|
159
|
+
case "client_credentials":
|
|
160
|
+
return "ClientCredentials";
|
|
161
|
+
case "federated_credentials":
|
|
162
|
+
return "FederatedCredentials";
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function identityLabel(identity) {
|
|
166
|
+
if (identity.type === "User") {
|
|
167
|
+
return identity.userEmail ?? identity.userName ?? identity.userId;
|
|
168
|
+
}
|
|
169
|
+
return identity.clientId ? `External application ${identity.clientId}` : "External application";
|
|
170
|
+
}
|
|
171
|
+
function buildIdentityHeadline(identity) {
|
|
172
|
+
if (!identity)
|
|
173
|
+
return {};
|
|
174
|
+
const label = identityLabel(identity);
|
|
175
|
+
return {
|
|
176
|
+
...label ? { Identity: label } : {},
|
|
177
|
+
IdentityType: identity.type,
|
|
178
|
+
...identity.authFlow ? { AuthFlow: authFlowLabel(identity.authFlow) } : {}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function buildIdentityDetail(identity) {
|
|
182
|
+
if (!identity)
|
|
183
|
+
return {};
|
|
184
|
+
return {
|
|
185
|
+
...identity.userId ? { UserId: identity.userId } : {},
|
|
186
|
+
...identity.userEmail ? { UserEmail: identity.userEmail } : {},
|
|
187
|
+
...identity.userName ? { UserName: identity.userName } : {},
|
|
188
|
+
...identity.clientId ? { ClientId: identity.clientId } : {}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function buildScopeDetail(scopes, detailed) {
|
|
192
|
+
return detailed && scopes ? { Scopes: scopes } : {};
|
|
193
|
+
}
|
|
194
|
+
function buildRefreshData(status) {
|
|
195
|
+
const data = {
|
|
196
|
+
Status: status.loginStatus,
|
|
197
|
+
Organization: status.organizationName || status.organizationId || "N/A",
|
|
198
|
+
Tenant: status.tenantName || status.tenantId || "N/A",
|
|
199
|
+
"Expiration Date": status.expiration
|
|
200
|
+
};
|
|
201
|
+
if (status.hint)
|
|
202
|
+
data.Hint = status.hint;
|
|
203
|
+
if (status.baseUrl)
|
|
204
|
+
data.BaseUrl = status.baseUrl;
|
|
205
|
+
if (status.organizationId)
|
|
206
|
+
data.OrganizationId = status.organizationId;
|
|
207
|
+
if (status.organizationName)
|
|
208
|
+
data.OrganizationName = status.organizationName;
|
|
209
|
+
if (status.tenantId)
|
|
210
|
+
data.TenantId = status.tenantId;
|
|
211
|
+
if (status.tenantName)
|
|
212
|
+
data.TenantName = status.tenantName;
|
|
213
|
+
const emitToken = getOutputFormat() === "json" && (getOutputFormatExplicit() || !getOutputSink().capabilities.isInteractive);
|
|
214
|
+
if (emitToken && status.accessToken) {
|
|
215
|
+
data.AccessToken = status.accessToken;
|
|
216
|
+
}
|
|
217
|
+
return data;
|
|
218
|
+
}
|
|
219
|
+
function buildLoginData(credentials) {
|
|
220
|
+
const {
|
|
221
|
+
UIPATH_ACCESS_TOKEN: _token,
|
|
222
|
+
UIPATH_REFRESH_TOKEN: _refresh,
|
|
223
|
+
[AUTH_FLOW_ENV_VAR2]: _authFlow,
|
|
224
|
+
...safeCredentials
|
|
225
|
+
} = credentials;
|
|
226
|
+
if (getOutputFormat() === "table") {
|
|
227
|
+
return {
|
|
228
|
+
UIPATH_URL: credentials.UIPATH_URL,
|
|
229
|
+
UIPATH_ORGANIZATION_NAME: credentials.UIPATH_ORGANIZATION_NAME,
|
|
230
|
+
UIPATH_TENANT_NAME: credentials.UIPATH_TENANT_NAME
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return safeCredentials;
|
|
234
|
+
}
|
|
235
|
+
function loginRetryCommand(args = []) {
|
|
236
|
+
const profile = getActiveAuthProfile2();
|
|
237
|
+
return [
|
|
238
|
+
"uip",
|
|
239
|
+
"login",
|
|
240
|
+
...profile ? ["--profile", profile] : [],
|
|
241
|
+
...args
|
|
242
|
+
].join(" ");
|
|
243
|
+
}
|
|
244
|
+
function quotedLoginRetryCommand(args = []) {
|
|
245
|
+
return `'${loginRetryCommand(args)}'`;
|
|
246
|
+
}
|
|
247
|
+
function authenticateInstruction() {
|
|
248
|
+
return getActiveAuthProfile2() ? `Run ${quotedLoginRetryCommand()} to authenticate this profile.` : "Run 'uip login' to authenticate.";
|
|
249
|
+
}
|
|
250
|
+
function authenticateFirstInstruction() {
|
|
251
|
+
return getActiveAuthProfile2() ? `Run ${quotedLoginRetryCommand()} to authenticate this profile.` : "Run 'uip login' to authenticate first.";
|
|
252
|
+
}
|
|
253
|
+
function reauthenticateInstruction() {
|
|
254
|
+
return getActiveAuthProfile2() ? `Run ${quotedLoginRetryCommand()} to re-authenticate this profile.` : "Run 'uip login' to re-authenticate.";
|
|
255
|
+
}
|
|
256
|
+
function tenantSelectionInstructions(authFlow) {
|
|
257
|
+
if (authFlow === "client_credentials" || authFlow === "federated_credentials") {
|
|
258
|
+
return `Run ${quotedLoginRetryCommand(["--tenant", "<name>"])} to select a tenant.`;
|
|
259
|
+
}
|
|
260
|
+
return `Run ${quotedLoginRetryCommand(["--tenant", "<name>"])} or run from an interactive terminal to select a tenant during login. Use ${quotedLoginRetryCommand(["--interactive"])} to force a prompt.`;
|
|
261
|
+
}
|
|
262
|
+
function noCredentialsInstruction() {
|
|
263
|
+
const profile = getActiveAuthProfile2();
|
|
264
|
+
return profile ? `No credentials found for profile "${profile}". ${authenticateInstruction()}` : "No credentials found. Run 'uip login' to authenticate.";
|
|
265
|
+
}
|
|
266
|
+
function emitRefreshFailure(status) {
|
|
267
|
+
const refreshFailed = status.loginStatus === "Refresh Failed";
|
|
268
|
+
OutputFormatter.error({
|
|
269
|
+
Result: RESULTS.AuthenticationError,
|
|
270
|
+
Message: refreshFailed ? `Token refresh failed. ${reauthenticateInstruction()}` : `Not authenticated. ${authenticateInstruction()}`,
|
|
271
|
+
Instructions: status.hint ?? defaultRefreshFailureInstructions(status),
|
|
272
|
+
...status.refreshTelemetrySuppressed ? { SuppressTelemetry: true } : {}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function isUserCancellationError(error) {
|
|
276
|
+
if (!(error instanceof Error)) {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
const exitCode = error.exitCode;
|
|
280
|
+
const code = error.code;
|
|
281
|
+
return error.name === "ExitPromptError" || exitCode === 130 || code === AUTH_CANCELLED_ERROR_CODE2 || error.message === "Selection cancelled by user";
|
|
282
|
+
}
|
|
283
|
+
function defaultRefreshFailureInstructions(status) {
|
|
284
|
+
switch (status.loginStatus) {
|
|
285
|
+
case "Refresh Failed":
|
|
286
|
+
return "The stored refresh token is invalid or expired.";
|
|
287
|
+
case "Expired":
|
|
288
|
+
return "The access token has expired and no refresh token is available.";
|
|
289
|
+
case "Not logged in":
|
|
290
|
+
return noCredentialsInstruction();
|
|
291
|
+
default:
|
|
292
|
+
return authenticateInstruction();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function emitAuthEnv() {
|
|
296
|
+
const vars = Object.values(ENV_AUTH_VARS2);
|
|
297
|
+
const missingVars = vars.filter((name) => !process.env[name]);
|
|
298
|
+
const data = {
|
|
299
|
+
EnableVar: ENV_AUTH_ENABLE_VAR2,
|
|
300
|
+
AllVarsPresent: missingVars.length === 0,
|
|
301
|
+
MissingVars: missingVars,
|
|
302
|
+
Vars: vars
|
|
303
|
+
};
|
|
304
|
+
OutputFormatter.success({
|
|
305
|
+
Result: RESULTS.Success,
|
|
306
|
+
Code: "AuthEnv",
|
|
307
|
+
Data: data
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function authFlowFor(clientSecret, clientAssertion) {
|
|
311
|
+
if (clientAssertion) {
|
|
312
|
+
return "federated_credentials";
|
|
313
|
+
}
|
|
314
|
+
return clientSecret ? "client_credentials" : "authorization_code";
|
|
315
|
+
}
|
|
316
|
+
function authStartMessage(authFlow, noBrowser) {
|
|
317
|
+
switch (authFlow) {
|
|
318
|
+
case "federated_credentials":
|
|
319
|
+
return "→ Authenticating with Federated Credentials (workload identity)...";
|
|
320
|
+
case "client_credentials":
|
|
321
|
+
return "→ Authenticating with Client Credentials...";
|
|
322
|
+
case "authorization_code":
|
|
323
|
+
return noBrowser ? "→ Headless login: open the printed authorize URL to continue..." : "→ Opening browser for authentication. Sign in via the browser to continue...";
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function tenantReasonSuffix(tenantOption) {
|
|
327
|
+
if (tenantOption) {
|
|
328
|
+
return " (from --tenant)";
|
|
329
|
+
}
|
|
330
|
+
return canPrompt() ? "" : " (only tenant in this organization)";
|
|
331
|
+
}
|
|
332
|
+
function isLiveSession(status) {
|
|
333
|
+
return status.loginStatus === "Logged in" && !!status.accessToken && !!status.baseUrl && !!status.organizationId;
|
|
334
|
+
}
|
|
335
|
+
async function settleLoginStatus(context, pending) {
|
|
336
|
+
const [statusError, status] = await catchError(pending);
|
|
337
|
+
if (statusError) {
|
|
338
|
+
OutputFormatter.error({
|
|
339
|
+
Result: RESULTS.ConfigError,
|
|
340
|
+
Message: loginErrorMessage(statusError),
|
|
341
|
+
Instructions: instructionsForStatusError(statusError)
|
|
342
|
+
});
|
|
343
|
+
context.exit(1);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
trackTokenRefresh(status);
|
|
347
|
+
return status;
|
|
348
|
+
}
|
|
349
|
+
async function readLiveSession(context, envFilePath) {
|
|
350
|
+
const status = await settleLoginStatus(context, auth.getLoginStatus({ envFilePath }));
|
|
351
|
+
if (!status) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (!isLiveSession(status)) {
|
|
355
|
+
OutputFormatter.error({
|
|
356
|
+
Result: RESULTS.AuthenticationError,
|
|
357
|
+
Message: "Not authenticated",
|
|
358
|
+
Instructions: status.hint || authenticateFirstInstruction()
|
|
359
|
+
});
|
|
360
|
+
context.exit(2);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
return status;
|
|
364
|
+
}
|
|
365
|
+
async function fetchTenantsOrReport(context, session) {
|
|
366
|
+
const [fetchError, data] = await catchError(auth.fetchTenants(session.baseUrl, session.accessToken, session.organizationName || session.organizationId));
|
|
367
|
+
if (fetchError) {
|
|
368
|
+
const connectivity = describeConnectivityError(fetchError);
|
|
369
|
+
OutputFormatter.error({
|
|
370
|
+
Result: RESULTS.Failure,
|
|
371
|
+
Message: loginErrorMessage(fetchError),
|
|
372
|
+
Instructions: connectivity?.instructions ?? "Failed to fetch tenants. Check your network connection and try again."
|
|
373
|
+
});
|
|
374
|
+
context.exit(1);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
return data.tenants;
|
|
378
|
+
}
|
|
379
|
+
async function locateAuthFile(context, envFilePath) {
|
|
380
|
+
const [locationError, location] = await catchError(resolveEnvFileLocationAsync2(envFilePath));
|
|
381
|
+
if (locationError) {
|
|
382
|
+
OutputFormatter.error({
|
|
383
|
+
Result: RESULTS.Failure,
|
|
384
|
+
Message: `Failed to locate credentials file: ${locationError.message}`,
|
|
385
|
+
Instructions: "Check filesystem permissions on the current directory and your home directory, then re-run."
|
|
386
|
+
});
|
|
387
|
+
context.exit(1);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (!location.exists && location.unusable) {
|
|
391
|
+
const { absolutePath, unusable } = location;
|
|
392
|
+
OutputFormatter.error({
|
|
393
|
+
Result: RESULTS.Failure,
|
|
394
|
+
Message: `Credentials file at ${absolutePath} is not usable: ${unusable.message}`,
|
|
395
|
+
Instructions: unusable.reason === "not-a-file" ? `Path resolves to a directory or special file. Move or rename ${absolutePath}, then run ${quotedLoginRetryCommand()} to recreate the credentials file.` : `Check filesystem permissions on ${absolutePath} and re-run.`
|
|
396
|
+
});
|
|
397
|
+
context.exit(1);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
return location;
|
|
401
|
+
}
|
|
402
|
+
async function runLogin(context, options) {
|
|
403
|
+
if (rejectProfileFileConflict(context, options.file)) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const envFilePath = resolveAuthFilePath(options.file);
|
|
407
|
+
let clientId;
|
|
408
|
+
let clientSecret;
|
|
409
|
+
let explicitAssertion;
|
|
410
|
+
try {
|
|
411
|
+
clientId = resolveEnvReference(options.clientId);
|
|
412
|
+
clientSecret = resolveEnvReference(options.clientSecret);
|
|
413
|
+
explicitAssertion = resolveEnvReference(options.clientAssertion);
|
|
414
|
+
} catch (e) {
|
|
415
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
416
|
+
OutputFormatter.error({
|
|
417
|
+
Result: RESULTS.ConfigError,
|
|
418
|
+
Message: message,
|
|
419
|
+
Instructions: "Inspect command arguments and try again."
|
|
420
|
+
});
|
|
421
|
+
context.exit(1);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (options.clientAssertion && !options.clientAssertion.startsWith("env.")) {
|
|
425
|
+
getOutputSink().writeErr(`WARNING: Passing --client-assertion as a literal value exposes the token in shell history, process listings, and CI logs. Prefer --client-assertion env.YOUR_TOKEN_VAR.
|
|
426
|
+
`);
|
|
427
|
+
}
|
|
428
|
+
const clientAssertion = explicitAssertion;
|
|
429
|
+
if (clientSecret && clientAssertion) {
|
|
430
|
+
OutputFormatter.error({
|
|
431
|
+
Result: RESULTS.ConfigError,
|
|
432
|
+
Message: "--client-secret cannot be combined with --client-assertion.",
|
|
433
|
+
Instructions: "Federated login replaces the client secret. Use either --client-secret (client credentials) or --client-assertion (workload identity), not both."
|
|
434
|
+
});
|
|
435
|
+
context.exit(1);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
if (clientAssertion && !clientId) {
|
|
439
|
+
OutputFormatter.error({
|
|
440
|
+
Result: RESULTS.ConfigError,
|
|
441
|
+
Message: "Federated login requires --client-id (the external application ID).",
|
|
442
|
+
Instructions: "Pass --client-id <app-id> along with --client-assertion."
|
|
443
|
+
});
|
|
444
|
+
context.exit(1);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
if (clientSecret && !clientId) {
|
|
448
|
+
OutputFormatter.error({
|
|
449
|
+
Result: RESULTS.ConfigError,
|
|
450
|
+
Message: "Client credentials login requires --client-id (the external application ID).",
|
|
451
|
+
Instructions: "Pass --client-id <app-id> along with --client-secret."
|
|
452
|
+
});
|
|
453
|
+
context.exit(1);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (clientId && !clientSecret && !clientAssertion) {
|
|
457
|
+
OutputFormatter.error({
|
|
458
|
+
Result: RESULTS.ConfigError,
|
|
459
|
+
Message: "--client-id requires --client-secret or --client-assertion.",
|
|
460
|
+
Instructions: "For an external application, pass --client-secret (client credentials) or --client-assertion (federated login) with --client-id. For browser login, drop --client-id."
|
|
461
|
+
});
|
|
462
|
+
context.exit(1);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const authFlow = authFlowFor(clientSecret, clientAssertion);
|
|
466
|
+
if (authFlow === "authorization_code" && canPrompt()) {
|
|
467
|
+
getOutputSink().writeErr(`${COPYRIGHT_NOTICE}
|
|
468
|
+
`);
|
|
469
|
+
}
|
|
470
|
+
const noBrowser = options.browser === false || process.env.UIPATH_CLI_NO_BROWSER === "true";
|
|
471
|
+
if (options.organization && (clientSecret || clientAssertion)) {
|
|
472
|
+
logger.warn(clientSecret ? "--organization is ignored when using client credentials; the organization is fixed by the client-id." : "--organization is ignored for federated login; the organization is fixed by the client-id.");
|
|
473
|
+
}
|
|
474
|
+
if (noBrowser && (clientSecret || clientAssertion)) {
|
|
475
|
+
logger.warn(clientSecret ? "--no-browser has no effect with client credentials; no browser is opened." : "--no-browser has no effect for federated login; no browser is opened.");
|
|
476
|
+
}
|
|
477
|
+
logger.info(authStartMessage(authFlow, noBrowser));
|
|
478
|
+
let tenantFetchError;
|
|
479
|
+
const handleAuthEvent = (event) => {
|
|
480
|
+
switch (event.type) {
|
|
481
|
+
case "info":
|
|
482
|
+
logger.info(event.message);
|
|
483
|
+
break;
|
|
484
|
+
case "warn":
|
|
485
|
+
logger.warn(event.message);
|
|
486
|
+
break;
|
|
487
|
+
case "tenant-fetch-failed":
|
|
488
|
+
tenantFetchError = event.message;
|
|
489
|
+
logger.error(`Could not establish an active tenant: ${event.message}`);
|
|
490
|
+
break;
|
|
491
|
+
case "saved":
|
|
492
|
+
logger.info(event.locality === "local" ? `Credentials saved locally to ${event.path}` : `Credentials saved to ${event.path}`);
|
|
493
|
+
break;
|
|
494
|
+
case "auth-url":
|
|
495
|
+
getOutputSink().writeErr(`UIPATH_AUTH_URL ${event.url}
|
|
496
|
+
`);
|
|
497
|
+
getOutputSink().writeErr(`
|
|
498
|
+
Open this URL in a browser to sign in:
|
|
499
|
+
|
|
500
|
+
${event.url}
|
|
501
|
+
|
|
502
|
+
`);
|
|
503
|
+
getOutputSink().writeErr(`Open the URL exactly as printed — a line-wrapped or truncated copy is rejected by the identity server.
|
|
504
|
+
|
|
505
|
+
`);
|
|
506
|
+
getOutputSink().writeErr(`Waiting for the sign-in to complete — this command blocks until the browser finishes (or the wait times out).
|
|
507
|
+
` + `Agents/automation: if a person is doing the sign-in, have them run 'uip login' in their own terminal instead of running it on their behalf.
|
|
508
|
+
|
|
509
|
+
`);
|
|
510
|
+
break;
|
|
511
|
+
case "port-reclaimed":
|
|
512
|
+
getOutputSink().writeErr(`${event.message}
|
|
513
|
+
`);
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
const scopes = splitScopeList(options.scope);
|
|
518
|
+
const [error, authResult] = await catchError(auth.interactiveLogin({
|
|
519
|
+
envFilePath,
|
|
520
|
+
authority: options.authority,
|
|
521
|
+
clientId,
|
|
522
|
+
clientSecret,
|
|
523
|
+
clientAssertion,
|
|
524
|
+
scope: scopes.length > 0 ? scopes : undefined,
|
|
525
|
+
tenant: options.tenant,
|
|
526
|
+
organization: options.organization,
|
|
527
|
+
interactive: canPrompt(),
|
|
528
|
+
noBrowser,
|
|
529
|
+
timeoutMs: resolveCallbackTimeoutOverrideMs(),
|
|
530
|
+
signal: context.pollSignal,
|
|
531
|
+
onEvent: handleAuthEvent
|
|
532
|
+
}));
|
|
533
|
+
if (error) {
|
|
534
|
+
if (isUserCancellationError(error)) {
|
|
535
|
+
if (error.code === AUTH_CANCELLED_ERROR_CODE2) {
|
|
536
|
+
throw Object.assign(error, { exitCode: 130 });
|
|
537
|
+
}
|
|
538
|
+
throw error;
|
|
539
|
+
}
|
|
540
|
+
if (isTenantSelectionError2(error)) {
|
|
541
|
+
trackAuthLogin(authFlow, { success: true });
|
|
542
|
+
trackTenantSelection({
|
|
543
|
+
success: false,
|
|
544
|
+
errorMessage: error.message
|
|
545
|
+
});
|
|
546
|
+
const tenants = error.availableTenants;
|
|
547
|
+
const pickInstructions = tenantSelectionInstructions(authFlow);
|
|
548
|
+
OutputFormatter.error({
|
|
549
|
+
Result: RESULTS.ConfigError,
|
|
550
|
+
Message: error.message.split(`
|
|
551
|
+
`)[0],
|
|
552
|
+
Instructions: `${pickInstructions} Available tenants: ${tenants.join(", ")}.`,
|
|
553
|
+
Data: { AvailableTenants: tenants }
|
|
554
|
+
});
|
|
555
|
+
context.exit(1);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
const message = loginErrorMessage(error);
|
|
559
|
+
trackAuthLogin(authFlow, {
|
|
560
|
+
success: false,
|
|
561
|
+
errorMessage: message
|
|
562
|
+
});
|
|
563
|
+
if (tenantFetchError) {
|
|
564
|
+
trackTenantSelection({
|
|
565
|
+
success: false,
|
|
566
|
+
errorMessage: tenantFetchError
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
const httpStatus = error instanceof Object && "status" in error && typeof error.status === "number" ? error.status : undefined;
|
|
570
|
+
OutputFormatter.error({
|
|
571
|
+
Result: RESULTS.AuthenticationError,
|
|
572
|
+
Message: message,
|
|
573
|
+
Instructions: instructionsForLoginError(error, message, noBrowser),
|
|
574
|
+
...httpStatus ? { Context: { httpStatus } } : {}
|
|
575
|
+
});
|
|
576
|
+
context.exit(2);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (!authResult?.UIPATH_TENANT_ID || !authResult.UIPATH_TENANT_NAME) {
|
|
580
|
+
const message = "No active tenant selected";
|
|
581
|
+
trackAuthLogin(authFlow, {
|
|
582
|
+
success: false,
|
|
583
|
+
errorMessage: message
|
|
584
|
+
});
|
|
585
|
+
trackTenantSelection({
|
|
586
|
+
success: false,
|
|
587
|
+
...tenantFetchError ? { errorMessage: tenantFetchError } : {}
|
|
588
|
+
});
|
|
589
|
+
OutputFormatter.error({
|
|
590
|
+
Result: RESULTS.ConfigError,
|
|
591
|
+
Message: message,
|
|
592
|
+
Instructions: tenantSelectionInstructions(authFlow)
|
|
593
|
+
});
|
|
594
|
+
context.exit(1);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
trackAuthLogin(authFlow, { success: true });
|
|
598
|
+
if (authResult?.UIPATH_ORGANIZATION_ID) {
|
|
599
|
+
trackTenantSelection(authResult.UIPATH_TENANT_ID ? { success: true } : {
|
|
600
|
+
success: false,
|
|
601
|
+
...tenantFetchError ? { errorMessage: tenantFetchError } : {}
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
logger.info("✓ Authenticated");
|
|
605
|
+
if (authResult?.UIPATH_ORGANIZATION_ID) {
|
|
606
|
+
logger.info(`✓ Organization ID: ${authResult.UIPATH_ORGANIZATION_ID}`);
|
|
607
|
+
}
|
|
608
|
+
if (authResult?.UIPATH_TENANT_NAME) {
|
|
609
|
+
logger.info(`✓ Tenant: ${authResult.UIPATH_TENANT_NAME}${tenantReasonSuffix(options.tenant)}`);
|
|
610
|
+
}
|
|
611
|
+
OutputFormatter.success({
|
|
612
|
+
Result: RESULTS.Success,
|
|
613
|
+
Code: "Authenticated",
|
|
614
|
+
Data: buildLoginData(authResult ?? {})
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
async function runLoginStatus(context, options) {
|
|
618
|
+
const status = await settleLoginStatus(context, auth.getLoginStatus());
|
|
619
|
+
if (!status) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const activeProfile = getActiveAuthProfile2();
|
|
623
|
+
const statusData = {
|
|
624
|
+
Status: status.loginStatus,
|
|
625
|
+
...buildIdentityHeadline(status.identity),
|
|
626
|
+
CredentialSource: credentialSourceLabel(status.source),
|
|
627
|
+
Provider: legacyProviderLabel(status.source),
|
|
628
|
+
...buildIdentityDetail(status.identity),
|
|
629
|
+
...buildScopeDetail(status.scopes, options.detailed === true),
|
|
630
|
+
...activeProfile && status.source === "saved-login" /* SavedLogin */ ? { Profile: activeProfile } : {},
|
|
631
|
+
BaseUrl: status.baseUrl,
|
|
632
|
+
Organization: status.organizationName || status.organizationId || "N/A"
|
|
633
|
+
};
|
|
634
|
+
if (status.organizationId) {
|
|
635
|
+
statusData.OrganizationId = status.organizationId;
|
|
636
|
+
}
|
|
637
|
+
statusData.Tenant = status.tenantName || status.tenantId || "N/A";
|
|
638
|
+
if (status.tenantId) {
|
|
639
|
+
statusData.TenantId = status.tenantId;
|
|
640
|
+
}
|
|
641
|
+
statusData["Expiration Date"] = status.expiration;
|
|
642
|
+
if (status.hint) {
|
|
643
|
+
statusData.Hint = status.hint;
|
|
644
|
+
} else if (status.loginStatus !== "Logged in") {
|
|
645
|
+
statusData.Hint = defaultRefreshFailureInstructions(status);
|
|
646
|
+
}
|
|
647
|
+
OutputFormatter.success({
|
|
648
|
+
Result: RESULTS.Success,
|
|
649
|
+
Code: "LoginStatus",
|
|
650
|
+
Data: statusData
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
async function runLoginRefresh(context, options) {
|
|
654
|
+
const [statusError, status] = await catchError(auth.getLoginStatus({
|
|
655
|
+
ensureTokenValidityMinutes: options.loginValidity
|
|
656
|
+
}));
|
|
657
|
+
if (statusError) {
|
|
658
|
+
OutputFormatter.error({
|
|
659
|
+
Result: RESULTS.AuthenticationError,
|
|
660
|
+
Message: `Could not read credentials: ${loginErrorMessage(statusError)}`,
|
|
661
|
+
Instructions: instructionsForStatusError(statusError)
|
|
662
|
+
});
|
|
663
|
+
context.exit(2);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
trackTokenRefresh(status);
|
|
667
|
+
if (status.loginStatus !== "Logged in") {
|
|
668
|
+
emitRefreshFailure(status);
|
|
669
|
+
context.exit(2);
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
OutputFormatter.success({
|
|
673
|
+
Result: RESULTS.Success,
|
|
674
|
+
Code: status.persistenceFailed ? "LoginRefreshPartial" : "LoginRefresh",
|
|
675
|
+
Data: buildRefreshData(status)
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
async function runTenantList(context, options) {
|
|
679
|
+
if (rejectProfileFileConflict(context, options.file)) {
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
const session = await readLiveSession(context, resolveAuthFilePath(options.file));
|
|
683
|
+
if (!session) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
const tenants = await fetchTenantsOrReport(context, session);
|
|
687
|
+
if (!tenants) {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
const tenantRows = tenants.map((t) => ({
|
|
691
|
+
TenantName: t.name,
|
|
692
|
+
TenantId: t.id
|
|
693
|
+
}));
|
|
694
|
+
OutputFormatter.success({
|
|
695
|
+
Result: RESULTS.Success,
|
|
696
|
+
Code: "TenantList",
|
|
697
|
+
Data: tenantRows
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
async function runTenantSet(context, name, options) {
|
|
701
|
+
if (rejectProfileFileConflict(context, options.file)) {
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
if (isEnvAuthEnabled2()) {
|
|
705
|
+
OutputFormatter.error({
|
|
706
|
+
Result: RESULTS.ConfigError,
|
|
707
|
+
Message: "Cannot change the active tenant while environment-variable authentication is enabled.",
|
|
708
|
+
Instructions: "Update UIPATH_CLI_TENANT_NAME and UIPATH_CLI_TENANT_ID, or unset UIPATH_CLI_ENABLE_ENV_AUTH to use file-based login."
|
|
709
|
+
});
|
|
710
|
+
context.exit(1);
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
const location = await locateAuthFile(context, resolveAuthFilePath(options.file));
|
|
714
|
+
if (!location) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
if (!location.exists) {
|
|
718
|
+
OutputFormatter.error({
|
|
719
|
+
Result: RESULTS.AuthenticationError,
|
|
720
|
+
Message: "Not authenticated",
|
|
721
|
+
Instructions: authenticateFirstInstruction()
|
|
722
|
+
});
|
|
723
|
+
context.exit(2);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
const resolvedEnvFilePath = location.absolutePath;
|
|
727
|
+
const session = await readLiveSession(context, resolvedEnvFilePath);
|
|
728
|
+
if (!session) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
const tenants = await fetchTenantsOrReport(context, session);
|
|
732
|
+
if (!tenants) {
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
const matchedTenant = tenants.find((t) => t.name === name);
|
|
736
|
+
if (!matchedTenant) {
|
|
737
|
+
const availableNames = tenants.map((t) => t.name).join(", ");
|
|
738
|
+
OutputFormatter.error({
|
|
739
|
+
Result: RESULTS.ValidationError,
|
|
740
|
+
Message: `Tenant "${name}" not found`,
|
|
741
|
+
Instructions: `argument should be one of ${availableNames}`
|
|
742
|
+
});
|
|
743
|
+
context.exit(3);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
const [saveError] = await catchError(auth.saveTenantSelection(resolvedEnvFilePath, matchedTenant.name, matchedTenant.id));
|
|
747
|
+
if (saveError) {
|
|
748
|
+
OutputFormatter.error({
|
|
749
|
+
Result: RESULTS.Failure,
|
|
750
|
+
Message: saveError.message,
|
|
751
|
+
Instructions: "Failed to save tenant selection. Check file permissions and try again."
|
|
752
|
+
});
|
|
753
|
+
context.exit(1);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
OutputFormatter.success({
|
|
757
|
+
Result: RESULTS.Success,
|
|
758
|
+
Code: "TenantSet",
|
|
759
|
+
Data: {
|
|
760
|
+
Name: matchedTenant.name,
|
|
761
|
+
Id: matchedTenant.id
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
async function runLoginWhich(context) {
|
|
766
|
+
if (isEnvAuthEnabled2()) {
|
|
767
|
+
emitAuthEnv();
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const profile = getActiveAuthProfile2();
|
|
771
|
+
const location = await locateAuthFile(context, resolveAuthFilePath());
|
|
772
|
+
if (!location) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
if (location.exists) {
|
|
776
|
+
const data = {
|
|
777
|
+
Path: location.absolutePath,
|
|
778
|
+
Exists: true,
|
|
779
|
+
Source: location.source,
|
|
780
|
+
...profile ? { Profile: profile } : {}
|
|
781
|
+
};
|
|
782
|
+
OutputFormatter.success({
|
|
783
|
+
Result: RESULTS.Success,
|
|
784
|
+
Code: "AuthFile",
|
|
785
|
+
Data: data
|
|
786
|
+
});
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
OutputFormatter.error({
|
|
790
|
+
Result: RESULTS.AuthenticationError,
|
|
791
|
+
Message: profile ? `No credentials file found for profile "${profile}".` : "No credentials file found.",
|
|
792
|
+
Instructions: profile ? `Run 'uip login --profile ${profile}' to authenticate this profile.` : "Run 'uip login' to authenticate, or set UIPATH_CLI_ENABLE_ENV_AUTH=true to use environment variables."
|
|
793
|
+
});
|
|
794
|
+
context.exit(2);
|
|
795
|
+
}
|
|
796
|
+
export {
|
|
797
|
+
runLogin,
|
|
798
|
+
runLoginRefresh,
|
|
799
|
+
runLoginStatus,
|
|
800
|
+
runLoginWhich,
|
|
801
|
+
runTenantList,
|
|
802
|
+
runTenantSet
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
//# debugId=F2F4D8935A5FFB5B64756E2164756E21
|