@uipath/codedapp-tool 1.200.0-preview.109 → 1.201.0-preview.115

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.
@@ -0,0 +1,265 @@
1
+ import {
2
+ __require
3
+ } from "./tool-wckvcay0.js";
4
+
5
+ // ../filesystem/src/node.ts
6
+ import { randomUUID } from "node:crypto";
7
+ import { existsSync } from "node:fs";
8
+ import * as fs from "node:fs/promises";
9
+ import * as os from "node:os";
10
+ import * as path from "node:path";
11
+ var LOCK_HEARTBEAT_MS = 5000;
12
+ var LOCK_STALE_MS = 15000;
13
+ var LOCK_MAX_WAIT_MS = 20000;
14
+ var LOCK_MAX_HOLD_MS = 60000;
15
+ var LOCK_RETRY_MIN_MS = 100;
16
+ var LOCK_RETRY_JITTER_MS = 200;
17
+
18
+ class NodeFileSystem {
19
+ path = {
20
+ join: path.join,
21
+ resolve: path.resolve,
22
+ relative: path.relative,
23
+ dirname: path.dirname,
24
+ isAbsolute: path.isAbsolute,
25
+ basename: path.basename
26
+ };
27
+ env = {
28
+ cwd: process.cwd,
29
+ homedir: os.homedir,
30
+ tmpdir: os.tmpdir,
31
+ getenv: (key) => process.env[key]
32
+ };
33
+ utils = {
34
+ open: async (url) => {
35
+ const { default: open } = await import("./index-hsadteg4.js");
36
+ await open(url);
37
+ }
38
+ };
39
+ async readFile(path2, options) {
40
+ try {
41
+ if (options) {
42
+ return await fs.readFile(path2, "utf-8");
43
+ }
44
+ return await fs.readFile(path2);
45
+ } catch (error) {
46
+ if (this.isEnoent(error))
47
+ return null;
48
+ throw error;
49
+ }
50
+ }
51
+ async writeFile(filePath, data) {
52
+ const dir = path.dirname(filePath);
53
+ if (dir) {
54
+ await fs.mkdir(dir, { recursive: true });
55
+ }
56
+ await fs.writeFile(filePath, data);
57
+ }
58
+ async appendFile(filePath, data) {
59
+ const dir = path.dirname(filePath);
60
+ if (dir) {
61
+ await fs.mkdir(dir, { recursive: true });
62
+ }
63
+ await fs.appendFile(filePath, data);
64
+ }
65
+ async readdir(dirPath) {
66
+ try {
67
+ return await fs.readdir(dirPath);
68
+ } catch (error) {
69
+ if (this.isEnoent(error))
70
+ return [];
71
+ throw error;
72
+ }
73
+ }
74
+ async stat(filePath) {
75
+ try {
76
+ const stats = await fs.stat(filePath);
77
+ return {
78
+ isFile: () => stats.isFile(),
79
+ isDirectory: () => stats.isDirectory(),
80
+ size: stats.size,
81
+ mtimeMs: stats.mtimeMs
82
+ };
83
+ } catch (error) {
84
+ if (this.isEnoent(error))
85
+ return null;
86
+ throw error;
87
+ }
88
+ }
89
+ async exists(filePath) {
90
+ return existsSync(filePath);
91
+ }
92
+ async mkdir(dirPath) {
93
+ await fs.mkdir(dirPath, { recursive: true });
94
+ }
95
+ async acquireLock(lockPath) {
96
+ const canonicalPath = await this.canonicalizeLockTarget(lockPath);
97
+ const lockFile = `${canonicalPath}.lock`;
98
+ const ownerId = randomUUID();
99
+ const start = Date.now();
100
+ while (true) {
101
+ try {
102
+ await fs.writeFile(lockFile, ownerId, { flag: "wx" });
103
+ return this.createLockRelease(lockFile, ownerId);
104
+ } catch (error) {
105
+ if (!this.hasErrnoCode(error, "EEXIST")) {
106
+ throw error;
107
+ }
108
+ const stats = await fs.stat(lockFile).catch(() => null);
109
+ if (stats && Date.now() - stats.mtimeMs > LOCK_STALE_MS) {
110
+ const reclaimed = await fs.rm(lockFile, { force: true }).then(() => true).catch(() => false);
111
+ if (reclaimed)
112
+ continue;
113
+ }
114
+ if (Date.now() - start > LOCK_MAX_WAIT_MS) {
115
+ throw new Error(`ELOCKED: timed out waiting for lock on ${canonicalPath}`);
116
+ }
117
+ await new Promise((resolve2) => setTimeout(resolve2, LOCK_RETRY_MIN_MS + Math.random() * LOCK_RETRY_JITTER_MS));
118
+ }
119
+ }
120
+ }
121
+ async canonicalizeLockTarget(lockPath) {
122
+ const absolute = path.resolve(lockPath);
123
+ const fullReal = await fs.realpath(absolute).catch(() => null);
124
+ if (fullReal)
125
+ return fullReal;
126
+ const parent = path.dirname(absolute);
127
+ const base = path.basename(absolute);
128
+ const canonicalParent = await fs.realpath(parent).catch(() => parent);
129
+ return path.join(canonicalParent, base);
130
+ }
131
+ createLockRelease(lockFile, ownerId) {
132
+ const heartbeatStart = Date.now();
133
+ let heartbeatTimer;
134
+ let stopped = false;
135
+ const stopHeartbeat = () => {
136
+ stopped = true;
137
+ if (heartbeatTimer)
138
+ clearTimeout(heartbeatTimer);
139
+ };
140
+ const scheduleNextHeartbeat = () => {
141
+ if (stopped)
142
+ return;
143
+ if (Date.now() - heartbeatStart >= LOCK_MAX_HOLD_MS) {
144
+ stopped = true;
145
+ return;
146
+ }
147
+ heartbeatTimer = setTimeout(() => {
148
+ runHeartbeat();
149
+ }, LOCK_HEARTBEAT_MS);
150
+ heartbeatTimer.unref?.();
151
+ };
152
+ const runHeartbeat = async () => {
153
+ if (stopped)
154
+ return;
155
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
156
+ if (stopped)
157
+ return;
158
+ if (current !== ownerId) {
159
+ stopped = true;
160
+ return;
161
+ }
162
+ const now = Date.now() / 1000;
163
+ await fs.utimes(lockFile, now, now).catch(() => {});
164
+ scheduleNextHeartbeat();
165
+ };
166
+ scheduleNextHeartbeat();
167
+ let released = false;
168
+ return async () => {
169
+ if (released)
170
+ return;
171
+ released = true;
172
+ stopHeartbeat();
173
+ const current = await fs.readFile(lockFile, "utf-8").catch(() => null);
174
+ if (current === ownerId) {
175
+ await fs.rm(lockFile, { force: true });
176
+ }
177
+ };
178
+ }
179
+ async rm(filePath) {
180
+ await fs.rm(filePath, { recursive: true, force: true });
181
+ }
182
+ async rename(oldPath, newPath) {
183
+ await fs.rename(oldPath, newPath);
184
+ }
185
+ async realpath(filePath) {
186
+ try {
187
+ return await fs.realpath(filePath);
188
+ } catch (error) {
189
+ if (this.isEnoent(error))
190
+ return filePath;
191
+ throw error;
192
+ }
193
+ }
194
+ async getTempDir() {
195
+ return await fs.mkdtemp(path.join(os.tmpdir(), "uipath-fs-"));
196
+ }
197
+ async copyDirectory(sourcePath, destPath) {
198
+ const sourceStats = await this.stat(sourcePath);
199
+ if (!sourceStats) {
200
+ throw new Error(`Source directory does not exist: ${sourcePath}`);
201
+ }
202
+ if (!sourceStats.isDirectory()) {
203
+ throw new Error(`Source path is not a directory: ${sourcePath}`);
204
+ }
205
+ await this.mkdir(destPath);
206
+ const entries = await this.readdir(sourcePath);
207
+ for (const entry of entries) {
208
+ const srcEntry = path.join(sourcePath, entry);
209
+ const destEntry = path.join(destPath, entry);
210
+ const entryStats = await this.stat(srcEntry);
211
+ if (!entryStats)
212
+ continue;
213
+ if (entryStats.isDirectory()) {
214
+ await this.copyDirectory(srcEntry, destEntry);
215
+ } else if (entryStats.isFile()) {
216
+ const content = await this.readFile(srcEntry);
217
+ if (content !== null) {
218
+ await this.writeFile(destEntry, content);
219
+ }
220
+ }
221
+ }
222
+ }
223
+ isEnoent(error) {
224
+ return this.hasErrnoCode(error, "ENOENT");
225
+ }
226
+ hasErrnoCode(error, code) {
227
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
228
+ }
229
+ }
230
+
231
+ // ../filesystem/src/index.ts
232
+ var fsInstance = new NodeFileSystem;
233
+ var getFileSystem = () => fsInstance;
234
+
235
+ // ../auth/src/catch-error.ts
236
+ function isPromiseLike(value) {
237
+ return value !== null && typeof value === "object" && typeof value.then === "function";
238
+ }
239
+ function catchError(fnOrPromise) {
240
+ if (isPromiseLike(fnOrPromise)) {
241
+ return settlePromiseLike(fnOrPromise);
242
+ }
243
+ try {
244
+ const result = fnOrPromise();
245
+ if (isPromiseLike(result)) {
246
+ return settlePromiseLike(result);
247
+ }
248
+ return [undefined, result];
249
+ } catch (error) {
250
+ return [
251
+ error instanceof Error ? error : new Error(String(error)),
252
+ undefined
253
+ ];
254
+ }
255
+ }
256
+ function settlePromiseLike(thenable) {
257
+ return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
258
+ error instanceof Error ? error : new Error(String(error)),
259
+ undefined
260
+ ]);
261
+ }
262
+
263
+ export { getFileSystem, catchError };
264
+
265
+ //# debugId=7C969342331D7A5864756E2164756E21
@@ -5,13 +5,13 @@ import {
5
5
  import {
6
6
  catchError,
7
7
  getFileSystem
8
- } from "./tool-7ktmqc73.js";
8
+ } from "./tool-4pvh3k50.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-1snc64g4.js";
14
+ } from "./tool-q42rrs00.js";
15
15
  import {
16
16
  __require
17
17
  } from "./tool-wckvcay0.js";
@@ -911,6 +911,67 @@ var getTokenExpiration = (accessToken) => {
911
911
  }
912
912
  };
913
913
 
914
+ // ../auth/src/sessionIdentity.ts
915
+ var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
916
+ var decodeClaims = (accessToken) => {
917
+ const [error, claims] = catchError(() => parseJWT(accessToken));
918
+ return error ? undefined : claims;
919
+ };
920
+ var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
921
+ var resolveIdentityType = (claims, authFlow, email) => {
922
+ const subType = asString(claims?.sub_type);
923
+ if (subType) {
924
+ return subType.startsWith("service") ? "Application" : "User";
925
+ }
926
+ if (authFlow) {
927
+ return authFlow === "authorization_code" ? "User" : "Application";
928
+ }
929
+ if (email)
930
+ return "User";
931
+ if (asString(claims?.client_id) && !asString(claims?.sub)) {
932
+ return "Application";
933
+ }
934
+ return;
935
+ };
936
+ var looksLikeEmail = (value) => value?.includes("@") ?? false;
937
+ var pickEmail = (claims) => {
938
+ for (const candidate of [claims?.email, claims?.preferred_username]) {
939
+ const value = asString(candidate);
940
+ if (looksLikeEmail(value))
941
+ return value;
942
+ }
943
+ return;
944
+ };
945
+ var pickName = (claims) => {
946
+ const username = asString(claims?.preferred_username);
947
+ return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
948
+ };
949
+ var resolveSessionIdentity = (accessToken, authFlow) => {
950
+ const claims = accessToken ? decodeClaims(accessToken) : undefined;
951
+ const email = pickEmail(claims);
952
+ const type = resolveIdentityType(claims, authFlow, email);
953
+ if (!type)
954
+ return;
955
+ const identity = { type };
956
+ if (authFlow)
957
+ identity.authFlow = authFlow;
958
+ if (type === "User") {
959
+ const userId = asString(claims?.sub);
960
+ if (userId)
961
+ identity.userId = userId;
962
+ if (email)
963
+ identity.userEmail = email;
964
+ const name = pickName(claims);
965
+ if (name)
966
+ identity.userName = name;
967
+ return identity;
968
+ }
969
+ const clientId = asString(claims?.client_id);
970
+ if (clientId)
971
+ identity.clientId = clientId;
972
+ return identity;
973
+ };
974
+
914
975
  // ../auth/src/envAuth.ts
915
976
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
916
977
  var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
@@ -960,6 +1021,7 @@ var readAuthFromEnv = () => {
960
1021
  }
961
1022
  const expiration = getTokenExpiration(accessToken);
962
1023
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
1024
+ const identity = resolveSessionIdentity(accessToken);
963
1025
  return {
964
1026
  loginStatus,
965
1027
  accessToken,
@@ -969,7 +1031,8 @@ var readAuthFromEnv = () => {
969
1031
  tenantName,
970
1032
  tenantId,
971
1033
  expiration,
972
- source: "env" /* Env */
1034
+ source: "env-vars" /* EnvironmentVariables */,
1035
+ ...identity ? { identity } : {}
973
1036
  };
974
1037
  };
975
1038
 
@@ -1223,6 +1286,9 @@ var refreshAccessToken = async ({
1223
1286
  return { accessToken: newAccessToken, refreshToken: newRefreshToken };
1224
1287
  };
1225
1288
 
1289
+ // ../auth/src/types.ts
1290
+ var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
1291
+
1226
1292
  // ../auth/src/utils/envFile.ts
1227
1293
  var DEFAULT_AUTH_FILENAME = AUTH_FILENAME;
1228
1294
  var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
@@ -1384,12 +1450,12 @@ var saveEnvFileAsync = async ({
1384
1450
  };
1385
1451
 
1386
1452
  // ../auth/src/loginStatus.ts
1387
- var LoginStatusSource;
1388
- ((LoginStatusSource2) => {
1389
- LoginStatusSource2["File"] = "file";
1390
- LoginStatusSource2["Robot"] = "robot";
1391
- LoginStatusSource2["Env"] = "env";
1392
- })(LoginStatusSource ||= {});
1453
+ var CredentialSource;
1454
+ ((CredentialSource2) => {
1455
+ CredentialSource2["SavedLogin"] = "saved-login";
1456
+ CredentialSource2["Robot"] = "robot";
1457
+ CredentialSource2["EnvironmentVariables"] = "env-vars";
1458
+ })(CredentialSource ||= {});
1393
1459
  var getLoginStatusAsync = async (options = {}) => {
1394
1460
  return getLoginStatusWithDeps(options);
1395
1461
  };
@@ -1595,7 +1661,8 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1595
1661
  tenantName: credentials.UIPATH_TENANT_NAME,
1596
1662
  tenantId: credentials.UIPATH_TENANT_ID,
1597
1663
  expiration: tokens.expiration,
1598
- source: "file" /* File */,
1664
+ source: "saved-login" /* SavedLogin */,
1665
+ ...identityFields(tokens.accessToken, credentials),
1599
1666
  ...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
1600
1667
  ...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
1601
1668
  ...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
@@ -1608,7 +1675,12 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1608
1675
  }
1609
1676
  return result;
1610
1677
  }
1678
+ function identityFields(accessToken, credentials) {
1679
+ const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1680
+ return identity ? { identity } : {};
1681
+ }
1611
1682
  function buildRobotStatus(robotCreds) {
1683
+ const identity = resolveSessionIdentity(robotCreds.accessToken);
1612
1684
  return {
1613
1685
  loginStatus: "Logged in",
1614
1686
  accessToken: robotCreds.accessToken,
@@ -1619,7 +1691,8 @@ function buildRobotStatus(robotCreds) {
1619
1691
  tenantId: robotCreds.tenantId,
1620
1692
  issuer: robotCreds.issuer,
1621
1693
  expiration: getTokenExpiration(robotCreds.accessToken),
1622
- source: "robot" /* Robot */
1694
+ source: "robot" /* Robot */,
1695
+ ...identity ? { identity } : {}
1623
1696
  };
1624
1697
  }
1625
1698
  var isFileNotFoundError = (error) => {
@@ -1670,7 +1743,8 @@ async function circuitBreakerShortCircuit(ctx) {
1670
1743
  tenantName: credentials.UIPATH_TENANT_NAME,
1671
1744
  tenantId: credentials.UIPATH_TENANT_ID,
1672
1745
  expiration,
1673
- source: "file" /* File */
1746
+ source: "saved-login" /* SavedLogin */,
1747
+ ...identityFields(accessToken, credentials)
1674
1748
  } : {},
1675
1749
  hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
1676
1750
  refreshCircuitOpen: true,
@@ -1692,7 +1766,8 @@ async function lockAcquireFailureStatus(ctx, error) {
1692
1766
  tenantName: ctx.credentials.UIPATH_TENANT_NAME,
1693
1767
  tenantId: ctx.credentials.UIPATH_TENANT_ID,
1694
1768
  expiration: ctx.expiration,
1695
- source: "file" /* File */,
1769
+ source: "saved-login" /* SavedLogin */,
1770
+ ...identityFields(ctx.accessToken, ctx.credentials),
1696
1771
  hint: globalHint,
1697
1772
  tokenRefresh: {
1698
1773
  attempted: false,
@@ -2179,9 +2254,6 @@ var selectTenantWithDeps = async (baseUrl, accessToken, organizationId, targetTe
2179
2254
  return [selectedTenant.name, selectedTenant.id, organization.name];
2180
2255
  };
2181
2256
 
2182
- // ../auth/src/types.ts
2183
- var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
2184
-
2185
2257
  // ../auth/src/interactive.ts
2186
2258
  var interactiveLoginWithDeps = async (options, deps) => {
2187
2259
  const {
@@ -2458,10 +2530,10 @@ var authenticate = async ({
2458
2530
  const authUrl = `${authorizationEndpoint}?${authParams.toString()}`;
2459
2531
  let strategy;
2460
2532
  if (isBrowser()) {
2461
- const { BrowserAuthStrategy } = await import("./browser-strategy-v4n9zxyf.js");
2533
+ const { BrowserAuthStrategy } = await import("./browser-strategy-16yagjhr.js");
2462
2534
  strategy = new BrowserAuthStrategy;
2463
2535
  } else {
2464
- const { NodeAuthStrategy } = await import("./node-strategy-0s9nhcmn.js");
2536
+ const { NodeAuthStrategy } = await import("./node-strategy-gfq7k0sx.js");
2465
2537
  strategy = new NodeAuthStrategy;
2466
2538
  }
2467
2539
  const code = await strategy.execute(authUrl, effectiveRedirectUriUrl, state, {
@@ -2480,6 +2552,6 @@ var authenticate = async ({
2480
2552
  });
2481
2553
  };
2482
2554
 
2483
- export { setAuthFileConfig, InvalidBaseUrlError, DEFAULT_AUTH_PROFILE, AuthProfileValidationError, normalizeAuthProfileName, setActiveAuthProfile, clearActiveAuthProfile, getActiveAuthProfile, runWithAuthProfile, resolveAuthProfileFilePath, getActiveAuthProfileFilePath, parseJWT, ENV_AUTH_ENABLE_VAR, ENFORCE_ROBOT_AUTH_VAR, ENV_AUTH_VARS, EnvAuthConfigError, isEnvAuthEnabled, isRobotAuthEnforced, readAuthFromEnv, refreshTokenFingerprint, loadRefreshBreaker, saveRefreshBreaker, clearRefreshBreaker, registerRobotClientLoader, TokenRefreshOAuthError, isTokenRefreshOAuthFailure, refreshAccessToken, DEFAULT_AUTH_FILENAME, DEFAULT_ENV_FILENAME, resolveEnvFileLocationAsync, resolveEnvFilePathAsync, loadEnvFileAsync, saveEnvFileAsync, LoginStatusSource, 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, AUTH_FLOW_ENV_VAR, interactiveLoginWithDeps, interactiveLogin, logoutWithDeps, logout, authenticate };
2555
+ 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 };
2484
2556
 
2485
- //# debugId=1B99BDDE9F71605864756E2164756E21
2557
+ //# debugId=C70DEAFBFF6807E964756E2164756E21
@@ -3,9 +3,10 @@ var UIPATH_HOME_DIR = ".uipath";
3
3
  var AUTH_FILENAME = ".auth";
4
4
  var DEFAULT_BASE_URL = "https://cloud.uipath.com";
5
5
  var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
6
+ var AUTH_TIMEOUT_ERROR_CODE = "EAUTHTIMEOUT";
6
7
  var AUTH_CANCELLED_ERROR_CODE = "EAUTHCANCELLED";
7
8
  var DEFAULT_REDIRECT_URI = "http://localhost:8104/oidc/login";
8
9
 
9
- export { UIPATH_HOME_DIR, AUTH_FILENAME, DEFAULT_BASE_URL, DEFAULT_AUTH_TIMEOUT_MS, AUTH_CANCELLED_ERROR_CODE, DEFAULT_REDIRECT_URI };
10
+ export { UIPATH_HOME_DIR, AUTH_FILENAME, DEFAULT_BASE_URL, DEFAULT_AUTH_TIMEOUT_MS, AUTH_TIMEOUT_ERROR_CODE, AUTH_CANCELLED_ERROR_CODE, DEFAULT_REDIRECT_URI };
10
11
 
11
- //# debugId=A9146565B192C43A64756E2164756E21
12
+ //# debugId=0F56C5D203AAAAAA64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-qwtpgz76.js";
4
+ } from "./tool-1t4m3bv9.js";
5
+ import"./tool-6d49s6x4.js";
5
6
  import"./tool-y0g9grx6.js";
6
- import"./tool-k7c9wf29.js";
7
7
  import"./tool-0gctz400.js";
8
- import"./tool-7ktmqc73.js";
9
- import"./tool-1snc64g4.js";
8
+ import"./tool-4pvh3k50.js";
9
+ import"./tool-q42rrs00.js";
10
10
  import"./tool-wckvcay0.js";
11
11
  export {
12
12
  registerCommands,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/codedapp-tool",
3
3
  "license": "MIT",
4
- "version": "1.200.0-preview.109",
4
+ "version": "1.201.0-preview.115",
5
5
  "description": "Build, pack, publish, deploy, and manage UiPath Coded Web Applications.",
6
6
  "keywords": [
7
7
  "cli-tool",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "registry": "https://registry.npmjs.org/"
29
29
  },
30
- "gitHead": "fcc01cdae81bbd0c25d3d4fc287537a9d19d99f4"
30
+ "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
31
31
  }
@@ -1,63 +0,0 @@
1
- import {
2
- catchError,
3
- getFileSystem,
4
- startServer
5
- } from "./tool-7ktmqc73.js";
6
- import"./tool-1snc64g4.js";
7
- import"./tool-wckvcay0.js";
8
-
9
- // ../auth/src/strategies/node-strategy.ts
10
- class NodeAuthStrategy {
11
- async execute(url, redirectUri, expectedState, opts) {
12
- const fs = getFileSystem();
13
- const callbackUrl = await startServer({
14
- redirectUri,
15
- timeoutMs: opts?.timeoutMs,
16
- signal: opts?.signal,
17
- onListening: async () => {
18
- let safeUrl = "";
19
- for (const ch of url) {
20
- const c = ch.charCodeAt(0);
21
- if (c > 31 && (c < 128 || c > 159))
22
- safeUrl += ch;
23
- }
24
- if (opts?.noBrowser) {
25
- if (!opts.onAuthUrl) {
26
- throw new Error("Headless login (noBrowser) requires an onAuthUrl handler " + "to surface the authorize URL, but none was provided.");
27
- }
28
- opts.onAuthUrl(safeUrl);
29
- return;
30
- }
31
- const [openError] = await catchError(fs.utils.open(url));
32
- if (!openError)
33
- return;
34
- const isSpawnError = "code" in openError && openError.code === "ENOENT";
35
- if (isSpawnError) {
36
- throw new Error("Could not open a browser. No supported browser launcher was found. " + `On a headless or minimal system, use non-interactive login instead:
37
-
38
- ` + ` uip login --client-id <id> --client-secret <secret> -t <tenant>
39
-
40
- ` + "Or install a browser opener for your OS (e.g. xdg-utils on Linux).", { cause: openError });
41
- }
42
- throw new Error("Could not open the browser automatically. " + `Visit this URL to authenticate:
43
-
44
- ${safeUrl}
45
- `, { cause: openError });
46
- }
47
- });
48
- const returnedState = callbackUrl.searchParams.get("state");
49
- if (returnedState !== expectedState) {
50
- throw new Error("OAuth state mismatch — the callback state does not match the expected value. " + "This may indicate a CSRF attack. Please try signing in again.");
51
- }
52
- const code = callbackUrl.searchParams.get("code");
53
- if (!code) {
54
- throw new Error("No authorization code received");
55
- }
56
- return code;
57
- }
58
- }
59
- export {
60
- NodeAuthStrategy
61
- };
62
-
63
- //# debugId=E5B2BD2B3B179D3D64756E2164756E21