@uipath/codedapp-tool 1.201.0-preview.133 → 1.202.0-preview.134
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/{browser-strategy-16yagjhr.js → browser-strategy-6atc7v8s.js} +3 -3
- package/dist/{index-y19pndcy.js → index-d9c1ecq8.js} +71 -69
- package/dist/{index-4tmzxx6y.js → index-h630x08t.js} +158 -76
- package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
- package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
- package/dist/index.js +11 -9
- package/dist/{js-yaml-cggj6w7q.js → js-yaml-87tvr6f6.js} +16 -16
- package/dist/{multipart-parser-kme45c99.js → multipart-parser-ab4q7byb.js} +2 -2
- package/dist/{node-strategy-gfq7k0sx.js → node-strategy-bpshtz02.js} +130 -14
- package/dist/packager-tool-14ha5twz.js +1838 -0
- package/dist/{tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
- package/dist/{tool-yadq0xpc.js → packager-tool-8hncwr6a.js} +56 -302
- package/dist/packager-tool-jke4p8q1.js +1515 -0
- package/dist/{tool-4pvh3k50.js → packager-tool-qyctya2j.js} +2 -2
- package/dist/{tool-bydtassw.js → packager-tool-s019q130.js} +1443 -3112
- package/dist/{tool-25qmnad0.js → packager-tool-vcw2ht7n.js} +1188 -1873
- package/dist/{tool-y0g9grx6.js → packager-tool-vv9c52ax.js} +5 -5
- package/dist/{tool-q42rrs00.js → packager-tool-yc4kw997.js} +3 -2
- package/dist/packager-tool.js +17 -0
- package/dist/tool.js +13 -11
- package/package.json +4 -3
- /package/dist/{tool-0gctz400.js → packager-tool-0gctz400.js} +0 -0
|
@@ -19,12 +19,14 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
}
|
|
20
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
28
30
|
if (canCache)
|
|
29
31
|
cache.set(mod, to);
|
|
30
32
|
return to;
|
|
@@ -47,4 +49,4 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
47
49
|
|
|
48
50
|
export { __toESM, __commonJS, __export, __require };
|
|
49
51
|
|
|
50
|
-
//# debugId=
|
|
52
|
+
//# debugId=7B09EB233830E89F64756E2164756E21
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getGlobalThis,
|
|
3
|
-
isBrowser
|
|
4
|
-
} from "./tool-0gctz400.js";
|
|
5
1
|
import {
|
|
6
2
|
catchError,
|
|
7
3
|
getFileSystem
|
|
8
|
-
} from "./tool-
|
|
4
|
+
} from "./packager-tool-qyctya2j.js";
|
|
5
|
+
import {
|
|
6
|
+
getGlobalThis,
|
|
7
|
+
isBrowser
|
|
8
|
+
} from "./packager-tool-0gctz400.js";
|
|
9
9
|
import {
|
|
10
10
|
AUTH_FILENAME,
|
|
11
11
|
DEFAULT_BASE_URL,
|
|
12
12
|
DEFAULT_REDIRECT_URI,
|
|
13
13
|
UIPATH_HOME_DIR
|
|
14
|
-
} from "./tool-
|
|
14
|
+
} from "./packager-tool-yc4kw997.js";
|
|
15
15
|
import {
|
|
16
16
|
__require
|
|
17
|
-
} from "./tool-
|
|
17
|
+
} from "./packager-tool-1yh8g550.js";
|
|
18
18
|
|
|
19
19
|
// ../auth/src/config.ts
|
|
20
20
|
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
@@ -32,7 +32,7 @@ class InvalidBaseUrlError extends Error {
|
|
|
32
32
|
super(`Invalid base URL: "${url}"
|
|
33
33
|
` + `Reason: ${reason}
|
|
34
34
|
|
|
35
|
-
` + `Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
35
|
+
` + `Expected format: an https:// URL (or bare host — https:// is assumed), e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
36
36
|
` + `You can specify the URL via:
|
|
37
37
|
` + ` • --authority flag
|
|
38
38
|
` + ` • UIPATH_URL environment variable
|
|
@@ -53,10 +53,16 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
|
53
53
|
while (baseUrl.endsWith("/")) {
|
|
54
54
|
baseUrl = baseUrl.slice(0, -1);
|
|
55
55
|
}
|
|
56
|
+
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
|
|
57
|
+
const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
|
|
58
|
+
if (!hasScheme && hostCandidate.includes(".")) {
|
|
59
|
+
baseUrl = `https://${baseUrl}`;
|
|
60
|
+
}
|
|
56
61
|
const resolvedBaseUrl = baseUrl;
|
|
57
62
|
const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
|
|
58
63
|
if (urlError) {
|
|
59
|
-
|
|
64
|
+
const shapeHint = !hasScheme && !hostCandidate.includes(".") ? ` "${rawUrl.trim()}" is not a URL or a host name. Pass the full authority URL — https://<host>, or just <host> (https:// is assumed).` : ` ${urlError instanceof Error ? urlError.message : "Unknown error"}`;
|
|
65
|
+
throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
|
|
60
66
|
}
|
|
61
67
|
if (url.protocol !== "https:") {
|
|
62
68
|
throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
|
|
@@ -190,17 +196,6 @@ function b64u(input) {
|
|
|
190
196
|
}
|
|
191
197
|
return encodeBase64Url(input);
|
|
192
198
|
}
|
|
193
|
-
|
|
194
|
-
class UnsupportedOperationError extends Error {
|
|
195
|
-
code;
|
|
196
|
-
constructor(message, options) {
|
|
197
|
-
super(message, options);
|
|
198
|
-
this.name = this.constructor.name;
|
|
199
|
-
this.code = UNSUPPORTED_OPERATION;
|
|
200
|
-
Error.captureStackTrace?.(this, this.constructor);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
199
|
class OperationProcessingError extends Error {
|
|
205
200
|
code;
|
|
206
201
|
constructor(message, options) {
|
|
@@ -215,60 +210,6 @@ class OperationProcessingError extends Error {
|
|
|
215
210
|
function OPE(message, code, cause) {
|
|
216
211
|
return new OperationProcessingError(message, { code, cause });
|
|
217
212
|
}
|
|
218
|
-
async function calculateJwkThumbprint(jwk) {
|
|
219
|
-
let components;
|
|
220
|
-
switch (jwk.kty) {
|
|
221
|
-
case "EC":
|
|
222
|
-
components = {
|
|
223
|
-
crv: jwk.crv,
|
|
224
|
-
kty: jwk.kty,
|
|
225
|
-
x: jwk.x,
|
|
226
|
-
y: jwk.y
|
|
227
|
-
};
|
|
228
|
-
break;
|
|
229
|
-
case "OKP":
|
|
230
|
-
components = {
|
|
231
|
-
crv: jwk.crv,
|
|
232
|
-
kty: jwk.kty,
|
|
233
|
-
x: jwk.x
|
|
234
|
-
};
|
|
235
|
-
break;
|
|
236
|
-
case "AKP":
|
|
237
|
-
components = {
|
|
238
|
-
alg: jwk.alg,
|
|
239
|
-
kty: jwk.kty,
|
|
240
|
-
pub: jwk.pub
|
|
241
|
-
};
|
|
242
|
-
break;
|
|
243
|
-
case "RSA":
|
|
244
|
-
components = {
|
|
245
|
-
e: jwk.e,
|
|
246
|
-
kty: jwk.kty,
|
|
247
|
-
n: jwk.n
|
|
248
|
-
};
|
|
249
|
-
break;
|
|
250
|
-
default:
|
|
251
|
-
throw new UnsupportedOperationError("unsupported JWK key type", { cause: jwk });
|
|
252
|
-
}
|
|
253
|
-
return b64u(await crypto.subtle.digest("SHA-256", buf(JSON.stringify(components))));
|
|
254
|
-
}
|
|
255
|
-
function assertCryptoKey(key, it) {
|
|
256
|
-
if (!(key instanceof CryptoKey)) {
|
|
257
|
-
throw CodedTypeError(`${it} must be a CryptoKey`, ERR_INVALID_ARG_TYPE);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
function assertPrivateKey(key, it) {
|
|
261
|
-
assertCryptoKey(key, it);
|
|
262
|
-
if (key.type !== "private") {
|
|
263
|
-
throw CodedTypeError(`${it} must be a private CryptoKey`, ERR_INVALID_ARG_VALUE);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function assertPublicKey(key, it) {
|
|
267
|
-
assertCryptoKey(key, it);
|
|
268
|
-
if (key.type !== "public") {
|
|
269
|
-
throw CodedTypeError(`${it} must be a public CryptoKey`, ERR_INVALID_ARG_VALUE);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
213
|
function assertString(input, it, code, cause) {
|
|
273
214
|
try {
|
|
274
215
|
if (typeof input !== "string") {
|
|
@@ -297,72 +238,6 @@ async function calculatePKCECodeChallenge(codeVerifier) {
|
|
|
297
238
|
assertString(codeVerifier, "codeVerifier");
|
|
298
239
|
return b64u(await crypto.subtle.digest("SHA-256", buf(codeVerifier)));
|
|
299
240
|
}
|
|
300
|
-
function psAlg(key) {
|
|
301
|
-
switch (key.algorithm.hash.name) {
|
|
302
|
-
case "SHA-256":
|
|
303
|
-
return "PS256";
|
|
304
|
-
case "SHA-384":
|
|
305
|
-
return "PS384";
|
|
306
|
-
case "SHA-512":
|
|
307
|
-
return "PS512";
|
|
308
|
-
default:
|
|
309
|
-
throw new UnsupportedOperationError("unsupported RsaHashedKeyAlgorithm hash name", {
|
|
310
|
-
cause: key
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function rsAlg(key) {
|
|
315
|
-
switch (key.algorithm.hash.name) {
|
|
316
|
-
case "SHA-256":
|
|
317
|
-
return "RS256";
|
|
318
|
-
case "SHA-384":
|
|
319
|
-
return "RS384";
|
|
320
|
-
case "SHA-512":
|
|
321
|
-
return "RS512";
|
|
322
|
-
default:
|
|
323
|
-
throw new UnsupportedOperationError("unsupported RsaHashedKeyAlgorithm hash name", {
|
|
324
|
-
cause: key
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
function esAlg(key) {
|
|
329
|
-
switch (key.algorithm.namedCurve) {
|
|
330
|
-
case "P-256":
|
|
331
|
-
return "ES256";
|
|
332
|
-
case "P-384":
|
|
333
|
-
return "ES384";
|
|
334
|
-
case "P-521":
|
|
335
|
-
return "ES512";
|
|
336
|
-
default:
|
|
337
|
-
throw new UnsupportedOperationError("unsupported EcKeyAlgorithm namedCurve", { cause: key });
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function keyToJws(key) {
|
|
341
|
-
switch (key.algorithm.name) {
|
|
342
|
-
case "RSA-PSS":
|
|
343
|
-
return psAlg(key);
|
|
344
|
-
case "RSASSA-PKCS1-v1_5":
|
|
345
|
-
return rsAlg(key);
|
|
346
|
-
case "ECDSA":
|
|
347
|
-
return esAlg(key);
|
|
348
|
-
case "Ed25519":
|
|
349
|
-
case "ML-DSA-44":
|
|
350
|
-
case "ML-DSA-65":
|
|
351
|
-
case "ML-DSA-87":
|
|
352
|
-
return key.algorithm.name;
|
|
353
|
-
case "EdDSA":
|
|
354
|
-
return "Ed25519";
|
|
355
|
-
default:
|
|
356
|
-
throw new UnsupportedOperationError("unsupported CryptoKey algorithm name", { cause: key });
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function getClockSkew(client) {
|
|
360
|
-
const skew = client?.[clockSkew];
|
|
361
|
-
return typeof skew === "number" && Number.isFinite(skew) ? skew : 0;
|
|
362
|
-
}
|
|
363
|
-
function epochTime() {
|
|
364
|
-
return Math.floor(Date.now() / 1000);
|
|
365
|
-
}
|
|
366
241
|
function ClientSecretPost(clientSecret) {
|
|
367
242
|
assertString(clientSecret, '"clientSecret"');
|
|
368
243
|
return (_as, client, body, _headers) => {
|
|
@@ -375,27 +250,6 @@ function None() {
|
|
|
375
250
|
body.set("client_id", client.client_id);
|
|
376
251
|
};
|
|
377
252
|
}
|
|
378
|
-
async function signJwt(header, payload, key) {
|
|
379
|
-
if (!key.usages.includes("sign")) {
|
|
380
|
-
throw CodedTypeError('CryptoKey instances used for signing assertions must include "sign" in their "usages"', ERR_INVALID_ARG_VALUE);
|
|
381
|
-
}
|
|
382
|
-
const input = `${b64u(buf(JSON.stringify(header)))}.${b64u(buf(JSON.stringify(payload)))}`;
|
|
383
|
-
const signature = b64u(await crypto.subtle.sign(keyToSubtle(key), key, buf(input)));
|
|
384
|
-
return `${input}.${signature}`;
|
|
385
|
-
}
|
|
386
|
-
var jwkCache;
|
|
387
|
-
async function getSetPublicJwkCache(key, alg) {
|
|
388
|
-
const { kty, e, n, x, y, crv, pub } = await crypto.subtle.exportKey("jwk", key);
|
|
389
|
-
const jwk = { kty, e, n, x, y, crv, pub };
|
|
390
|
-
if (kty === "AKP")
|
|
391
|
-
jwk.alg = alg;
|
|
392
|
-
jwkCache.set(key, jwk);
|
|
393
|
-
return jwk;
|
|
394
|
-
}
|
|
395
|
-
async function publicJwk(key, alg) {
|
|
396
|
-
jwkCache ||= new WeakMap;
|
|
397
|
-
return jwkCache.get(key) || getSetPublicJwkCache(key, alg);
|
|
398
|
-
}
|
|
399
253
|
var URLParse = URL.parse ? (url, base) => URL.parse(url, base) : (url, base) => {
|
|
400
254
|
try {
|
|
401
255
|
return new URL(url, base);
|
|
@@ -403,79 +257,6 @@ var URLParse = URL.parse ? (url, base) => URL.parse(url, base) : (url, base) =>
|
|
|
403
257
|
return null;
|
|
404
258
|
}
|
|
405
259
|
};
|
|
406
|
-
class DPoPHandler {
|
|
407
|
-
#header;
|
|
408
|
-
#privateKey;
|
|
409
|
-
#publicKey;
|
|
410
|
-
#clockSkew;
|
|
411
|
-
#modifyAssertion;
|
|
412
|
-
#map;
|
|
413
|
-
#jkt;
|
|
414
|
-
constructor(client, keyPair, options) {
|
|
415
|
-
assertPrivateKey(keyPair?.privateKey, '"DPoP.privateKey"');
|
|
416
|
-
assertPublicKey(keyPair?.publicKey, '"DPoP.publicKey"');
|
|
417
|
-
if (!keyPair.publicKey.extractable) {
|
|
418
|
-
throw CodedTypeError('"DPoP.publicKey.extractable" must be true', ERR_INVALID_ARG_VALUE);
|
|
419
|
-
}
|
|
420
|
-
this.#modifyAssertion = options?.[modifyAssertion];
|
|
421
|
-
this.#clockSkew = getClockSkew(client);
|
|
422
|
-
this.#privateKey = keyPair.privateKey;
|
|
423
|
-
this.#publicKey = keyPair.publicKey;
|
|
424
|
-
branded.add(this);
|
|
425
|
-
}
|
|
426
|
-
#get(key) {
|
|
427
|
-
this.#map ||= new Map;
|
|
428
|
-
let item = this.#map.get(key);
|
|
429
|
-
if (item) {
|
|
430
|
-
this.#map.delete(key);
|
|
431
|
-
this.#map.set(key, item);
|
|
432
|
-
}
|
|
433
|
-
return item;
|
|
434
|
-
}
|
|
435
|
-
#set(key, val) {
|
|
436
|
-
this.#map ||= new Map;
|
|
437
|
-
this.#map.delete(key);
|
|
438
|
-
if (this.#map.size === 100) {
|
|
439
|
-
this.#map.delete(this.#map.keys().next().value);
|
|
440
|
-
}
|
|
441
|
-
this.#map.set(key, val);
|
|
442
|
-
}
|
|
443
|
-
async calculateThumbprint() {
|
|
444
|
-
if (!this.#jkt) {
|
|
445
|
-
const jwk = await crypto.subtle.exportKey("jwk", this.#publicKey);
|
|
446
|
-
this.#jkt ||= await calculateJwkThumbprint(jwk);
|
|
447
|
-
}
|
|
448
|
-
return this.#jkt;
|
|
449
|
-
}
|
|
450
|
-
async addProof(url, headers, htm, accessToken) {
|
|
451
|
-
const alg = keyToJws(this.#privateKey);
|
|
452
|
-
this.#header ||= {
|
|
453
|
-
alg,
|
|
454
|
-
typ: "dpop+jwt",
|
|
455
|
-
jwk: await publicJwk(this.#publicKey, alg)
|
|
456
|
-
};
|
|
457
|
-
const nonce = this.#get(url.origin);
|
|
458
|
-
const now = epochTime() + this.#clockSkew;
|
|
459
|
-
const payload = {
|
|
460
|
-
iat: now,
|
|
461
|
-
jti: randomBytes(),
|
|
462
|
-
htm,
|
|
463
|
-
nonce,
|
|
464
|
-
htu: `${url.origin}${url.pathname}`,
|
|
465
|
-
ath: accessToken ? b64u(await crypto.subtle.digest("SHA-256", buf(accessToken))) : undefined
|
|
466
|
-
};
|
|
467
|
-
this.#modifyAssertion?.(this.#header, payload);
|
|
468
|
-
headers.set("dpop", await signJwt(this.#header, payload, this.#privateKey));
|
|
469
|
-
}
|
|
470
|
-
cacheNonce(response, url) {
|
|
471
|
-
try {
|
|
472
|
-
const nonce = response.headers.get("dpop-nonce");
|
|
473
|
-
if (nonce) {
|
|
474
|
-
this.#set(url.origin, nonce);
|
|
475
|
-
}
|
|
476
|
-
} catch {}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
260
|
var tokenMatch = "[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+";
|
|
480
261
|
var token68Match = "[a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2}";
|
|
481
262
|
var quotedMatch = '"((?:[^"\\\\]|\\\\[\\s\\S])*)"';
|
|
@@ -492,60 +273,6 @@ var branded = new WeakSet;
|
|
|
492
273
|
var nopkce = Symbol();
|
|
493
274
|
var expectNoNonce = Symbol();
|
|
494
275
|
var skipAuthTimeCheck = Symbol();
|
|
495
|
-
var UNSUPPORTED_OPERATION = "OAUTH_UNSUPPORTED_OPERATION";
|
|
496
|
-
function checkRsaKeyAlgorithm(key) {
|
|
497
|
-
const { algorithm } = key;
|
|
498
|
-
if (typeof algorithm.modulusLength !== "number" || algorithm.modulusLength < 2048) {
|
|
499
|
-
throw new UnsupportedOperationError(`unsupported ${algorithm.name} modulusLength`, {
|
|
500
|
-
cause: key
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
function ecdsaHashName(key) {
|
|
505
|
-
const { algorithm } = key;
|
|
506
|
-
switch (algorithm.namedCurve) {
|
|
507
|
-
case "P-256":
|
|
508
|
-
return "SHA-256";
|
|
509
|
-
case "P-384":
|
|
510
|
-
return "SHA-384";
|
|
511
|
-
case "P-521":
|
|
512
|
-
return "SHA-512";
|
|
513
|
-
default:
|
|
514
|
-
throw new UnsupportedOperationError("unsupported ECDSA namedCurve", { cause: key });
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
function keyToSubtle(key) {
|
|
518
|
-
switch (key.algorithm.name) {
|
|
519
|
-
case "ECDSA":
|
|
520
|
-
return {
|
|
521
|
-
name: key.algorithm.name,
|
|
522
|
-
hash: ecdsaHashName(key)
|
|
523
|
-
};
|
|
524
|
-
case "RSA-PSS": {
|
|
525
|
-
checkRsaKeyAlgorithm(key);
|
|
526
|
-
switch (key.algorithm.hash.name) {
|
|
527
|
-
case "SHA-256":
|
|
528
|
-
case "SHA-384":
|
|
529
|
-
case "SHA-512":
|
|
530
|
-
return {
|
|
531
|
-
name: key.algorithm.name,
|
|
532
|
-
saltLength: parseInt(key.algorithm.hash.name.slice(-3), 10) >> 3
|
|
533
|
-
};
|
|
534
|
-
default:
|
|
535
|
-
throw new UnsupportedOperationError("unsupported RSA-PSS hash name", { cause: key });
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
case "RSASSA-PKCS1-v1_5":
|
|
539
|
-
checkRsaKeyAlgorithm(key);
|
|
540
|
-
return key.algorithm.name;
|
|
541
|
-
case "ML-DSA-44":
|
|
542
|
-
case "ML-DSA-65":
|
|
543
|
-
case "ML-DSA-87":
|
|
544
|
-
case "Ed25519":
|
|
545
|
-
return key.algorithm.name;
|
|
546
|
-
}
|
|
547
|
-
throw new UnsupportedOperationError("unsupported CryptoKey algorithm name", { cause: key });
|
|
548
|
-
}
|
|
549
276
|
var skipStateCheck = Symbol();
|
|
550
277
|
var expectNoState = Symbol();
|
|
551
278
|
var _nodiscoverycheck = Symbol();
|
|
@@ -998,6 +725,17 @@ var requireEnv = (name) => {
|
|
|
998
725
|
}
|
|
999
726
|
return value;
|
|
1000
727
|
};
|
|
728
|
+
var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
|
|
729
|
+
var resolveBaseUrl = (rawUrl, failureContext) => {
|
|
730
|
+
const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(rawUrl));
|
|
731
|
+
if (baseUrlError) {
|
|
732
|
+
if (baseUrlError instanceof InvalidBaseUrlError) {
|
|
733
|
+
throw baseUrlError;
|
|
734
|
+
}
|
|
735
|
+
throw new EnvAuthConfigError(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
|
|
736
|
+
}
|
|
737
|
+
return baseUrl;
|
|
738
|
+
};
|
|
1001
739
|
var readAuthFromEnv = () => {
|
|
1002
740
|
const accessToken = requireEnv(ENV_AUTH_VARS.token);
|
|
1003
741
|
const organizationName = requireEnv(ENV_AUTH_VARS.organizationName);
|
|
@@ -1006,19 +744,29 @@ var readAuthFromEnv = () => {
|
|
|
1006
744
|
const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
|
|
1007
745
|
const [parseError, payload] = catchError(() => parseJWT(accessToken));
|
|
1008
746
|
if (parseError) {
|
|
1009
|
-
|
|
747
|
+
const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
|
|
748
|
+
const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
|
|
749
|
+
if (!rawUrl) {
|
|
750
|
+
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} is not a JWT (treating it as an opaque token, ` + `e.g. a Personal Access Token). Set ${OPAQUE_TOKEN_BASE_URL_VAR} to the ` + `UiPath base URL if this is a PAT, or fix the token if it was meant to ` + `be a JWT (parse error: ${parseErrorMessage}).`);
|
|
751
|
+
}
|
|
752
|
+
const baseUrl2 = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
|
|
753
|
+
return {
|
|
754
|
+
loginStatus: "Logged in",
|
|
755
|
+
accessToken,
|
|
756
|
+
baseUrl: baseUrl2,
|
|
757
|
+
organizationName,
|
|
758
|
+
organizationId,
|
|
759
|
+
tenantName,
|
|
760
|
+
tenantId,
|
|
761
|
+
source: "env-vars" /* EnvironmentVariables */,
|
|
762
|
+
hint: "Token is opaque (not a JWT) - expiration and identity cannot be " + "determined locally. Commands will fail with 401 once it is revoked or " + `expired. If this was meant to be a JWT instead of a PAT, note: ${parseErrorMessage}`
|
|
763
|
+
};
|
|
1010
764
|
}
|
|
1011
765
|
const iss = payload.iss;
|
|
1012
766
|
if (typeof iss !== "string" || iss.length === 0) {
|
|
1013
767
|
throw new EnvAuthConfigError(`${ENV_AUTH_VARS.token} has no 'iss' claim; cannot determine ` + `the UiPath server. Ensure the token was issued by a UiPath identity server.`);
|
|
1014
768
|
}
|
|
1015
|
-
const
|
|
1016
|
-
if (baseUrlError) {
|
|
1017
|
-
if (baseUrlError instanceof InvalidBaseUrlError) {
|
|
1018
|
-
throw baseUrlError;
|
|
1019
|
-
}
|
|
1020
|
-
throw new EnvAuthConfigError(`Failed to derive server URL from token 'iss' claim: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
|
|
1021
|
-
}
|
|
769
|
+
const baseUrl = resolveBaseUrl(iss, "Failed to derive server URL from token 'iss' claim");
|
|
1022
770
|
const expiration = getTokenExpiration(accessToken);
|
|
1023
771
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
1024
772
|
const identity = resolveSessionIdentity(accessToken);
|
|
@@ -2346,7 +2094,11 @@ var interactiveLoginWithDeps = async (options, deps) => {
|
|
|
2346
2094
|
timeoutMs,
|
|
2347
2095
|
noBrowser,
|
|
2348
2096
|
signal,
|
|
2349
|
-
onAuthUrl: noBrowser ? (url) => deliverAuthUrl(url) : undefined
|
|
2097
|
+
onAuthUrl: noBrowser ? (url) => deliverAuthUrl(url) : undefined,
|
|
2098
|
+
onPortReclaimed: ({ pid }) => emit({
|
|
2099
|
+
type: "port-reclaimed",
|
|
2100
|
+
message: `A previous 'uip login'${pid === undefined ? "" : ` (PID ${pid})`} was still holding the callback port ` + `(${new URL(DEFAULT_REDIRECT_URI).port}) and was released; continuing with this login.`
|
|
2101
|
+
})
|
|
2350
2102
|
});
|
|
2351
2103
|
return {
|
|
2352
2104
|
UIPATH_ACCESS_TOKEN: authTokens.accessToken,
|
|
@@ -2500,7 +2252,8 @@ var authenticate = async ({
|
|
|
2500
2252
|
timeoutMs,
|
|
2501
2253
|
noBrowser,
|
|
2502
2254
|
onAuthUrl,
|
|
2503
|
-
signal
|
|
2255
|
+
signal,
|
|
2256
|
+
onPortReclaimed
|
|
2504
2257
|
}) => {
|
|
2505
2258
|
const config = await resolveConfigAsync({
|
|
2506
2259
|
customAuthority: baseUrl,
|
|
@@ -2544,17 +2297,18 @@ var authenticate = async ({
|
|
|
2544
2297
|
const authUrl = `${authorizationEndpoint}?${authParams.toString()}`;
|
|
2545
2298
|
let strategy;
|
|
2546
2299
|
if (isBrowser()) {
|
|
2547
|
-
const { BrowserAuthStrategy } = await import("./browser-strategy-
|
|
2300
|
+
const { BrowserAuthStrategy } = await import("./browser-strategy-6atc7v8s.js");
|
|
2548
2301
|
strategy = new BrowserAuthStrategy;
|
|
2549
2302
|
} else {
|
|
2550
|
-
const { NodeAuthStrategy } = await import("./node-strategy-
|
|
2303
|
+
const { NodeAuthStrategy } = await import("./node-strategy-bpshtz02.js");
|
|
2551
2304
|
strategy = new NodeAuthStrategy;
|
|
2552
2305
|
}
|
|
2553
2306
|
const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, {
|
|
2554
2307
|
timeoutMs,
|
|
2555
2308
|
noBrowser,
|
|
2556
2309
|
onAuthUrl,
|
|
2557
|
-
signal
|
|
2310
|
+
signal,
|
|
2311
|
+
onPortReclaimed
|
|
2558
2312
|
});
|
|
2559
2313
|
return await exchangeCodeForTokens({
|
|
2560
2314
|
code,
|
|
@@ -2568,4 +2322,4 @@ var authenticate = async ({
|
|
|
2568
2322
|
|
|
2569
2323
|
export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, parseAuthFlow, resolveSessionIdentity, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, AUTH_FLOW_ENV_VAR, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, CredentialSource, getLoginStatusAsync, getLoginStatusWithDeps, getAuthContext, getAuthEnv, ClientCredentialsAuthenticationError, clientCredentialsLogin, JWT_BEARER_ASSERTION_TYPE, FederatedCredentialsAuthenticationError, federatedCredentialsLogin, fetchTenantsAndOrganizations, TENANT_SELECTION_REQUIRED_CODE, INVALID_TENANT_CODE, TenantSelectionError, TenantSelectionRequiredError, InvalidTenantError, isTenantSelectionError, selectTenantWithDeps, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
|
|
2570
2324
|
|
|
2571
|
-
//# debugId=
|
|
2325
|
+
//# debugId=432C00A85D700C2164756E2164756E21
|