@uipath/solution-tool 1.203.0-preview.205 → 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-pytnrana.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-1qnyt7sm.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-7rarcemd.js → packager-tool-he7ak44z.js} +16 -74
- package/dist/packager-tool-myn57mc3.js +322 -0
- package/dist/{packager-tool-jmpgr1an.js → packager-tool-n1nzj2b9.js} +1008 -647
- package/dist/packager-tool-n6yb6zp9.js +113 -0
- package/dist/{packager-tool-wkj58797.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-2kvztdcy.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-364pcg21.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
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
logger
|
|
5
|
-
} from "./packager-tool-0f0wt9vh.js";
|
|
2
|
+
getFileSystem
|
|
3
|
+
} from "./packager-tool-zf3929se.js";
|
|
6
4
|
import {
|
|
7
5
|
__require
|
|
8
6
|
} from "./packager-tool-1de529jm.js";
|
|
@@ -11,7 +9,7 @@ import {
|
|
|
11
9
|
function isPromiseLike(value) {
|
|
12
10
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
13
11
|
}
|
|
14
|
-
function
|
|
12
|
+
function catchError(fnOrPromise) {
|
|
15
13
|
if (isPromiseLike(fnOrPromise)) {
|
|
16
14
|
return settlePromiseLike(fnOrPromise);
|
|
17
15
|
}
|
|
@@ -35,178 +33,6 @@ function settlePromiseLike(thenable) {
|
|
|
35
33
|
]);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
// ../auth/src/constants.ts
|
|
39
|
-
var UIPATH_HOME_DIR = ".uipath";
|
|
40
|
-
var AUTH_FILENAME = ".auth";
|
|
41
|
-
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
42
|
-
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
43
|
-
|
|
44
|
-
// ../auth/src/authProfile.ts
|
|
45
|
-
var DEFAULT_AUTH_PROFILE = "default";
|
|
46
|
-
var PROFILE_DIR = "profiles";
|
|
47
|
-
var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
|
|
48
|
-
var ACTIVE_AUTH_PROFILE_KEY = Symbol.for("@uipath/auth/ActiveAuthProfile");
|
|
49
|
-
var AUTH_PROFILE_STORAGE_KEY = Symbol.for("@uipath/auth/ProfileStorage");
|
|
50
|
-
var globalSlot = globalThis;
|
|
51
|
-
function isAuthProfileStorage(value) {
|
|
52
|
-
return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
|
|
53
|
-
}
|
|
54
|
-
function createProfileStorage() {
|
|
55
|
-
const [error, mod] = catchError2(() => __require("node:async_hooks"));
|
|
56
|
-
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
57
|
-
return {
|
|
58
|
-
getStore: () => {
|
|
59
|
-
return;
|
|
60
|
-
},
|
|
61
|
-
run: (_store, fn) => fn()
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return new mod.AsyncLocalStorage;
|
|
65
|
-
}
|
|
66
|
-
function getProfileStorage() {
|
|
67
|
-
const existing = globalSlot[AUTH_PROFILE_STORAGE_KEY];
|
|
68
|
-
if (isAuthProfileStorage(existing)) {
|
|
69
|
-
return existing;
|
|
70
|
-
}
|
|
71
|
-
const storage = createProfileStorage();
|
|
72
|
-
globalSlot[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
73
|
-
return storage;
|
|
74
|
-
}
|
|
75
|
-
var profileStorage = getProfileStorage();
|
|
76
|
-
|
|
77
|
-
class AuthProfileValidationError extends Error {
|
|
78
|
-
constructor(message) {
|
|
79
|
-
super(message);
|
|
80
|
-
this.name = "AuthProfileValidationError";
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function normalizeAuthProfileName(profile) {
|
|
84
|
-
if (profile === undefined || profile === DEFAULT_AUTH_PROFILE) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (profile.length === 0 || profile === "." || profile === ".." || !PROFILE_NAME_RE.test(profile)) {
|
|
88
|
-
throw new AuthProfileValidationError(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
|
|
89
|
-
}
|
|
90
|
-
return profile;
|
|
91
|
-
}
|
|
92
|
-
function getActiveAuthProfile() {
|
|
93
|
-
const scopedState = profileStorage.getStore();
|
|
94
|
-
if (scopedState !== undefined) {
|
|
95
|
-
return scopedState.profile;
|
|
96
|
-
}
|
|
97
|
-
return globalSlot[ACTIVE_AUTH_PROFILE_KEY]?.profile;
|
|
98
|
-
}
|
|
99
|
-
function resolveAuthProfileFilePath(profile) {
|
|
100
|
-
const normalized = normalizeAuthProfileName(profile);
|
|
101
|
-
if (normalized === undefined) {
|
|
102
|
-
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
103
|
-
}
|
|
104
|
-
const fs = getFileSystem();
|
|
105
|
-
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
106
|
-
}
|
|
107
|
-
function getActiveAuthProfileFilePath() {
|
|
108
|
-
const profile = getActiveAuthProfile();
|
|
109
|
-
return profile ? resolveAuthProfileFilePath(profile) : undefined;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// ../auth/src/config.ts
|
|
113
|
-
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
114
|
-
var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
|
|
115
|
-
var globalSlot2 = globalThis;
|
|
116
|
-
var getAuthFileConfig = () => globalSlot2[AUTH_FILE_CONFIG_KEY] ?? {};
|
|
117
|
-
|
|
118
|
-
class InvalidBaseUrlError extends Error {
|
|
119
|
-
url;
|
|
120
|
-
reason;
|
|
121
|
-
constructor(url, reason) {
|
|
122
|
-
super(`Invalid base URL: "${url}"
|
|
123
|
-
` + `Reason: ${reason}
|
|
124
|
-
|
|
125
|
-
` + `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>).
|
|
126
|
-
` + `You can specify the URL via:
|
|
127
|
-
` + ` • --authority flag
|
|
128
|
-
` + ` • UIPATH_URL environment variable
|
|
129
|
-
` + ` • auth.authority in config file`);
|
|
130
|
-
this.url = url;
|
|
131
|
-
this.reason = reason;
|
|
132
|
-
this.name = "InvalidBaseUrlError";
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
136
|
-
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
137
|
-
let baseUrl = rawUrl;
|
|
138
|
-
if (baseUrl.endsWith("/identity_/")) {
|
|
139
|
-
baseUrl = baseUrl.slice(0, -11);
|
|
140
|
-
} else if (baseUrl.endsWith("/identity_")) {
|
|
141
|
-
baseUrl = baseUrl.slice(0, -10);
|
|
142
|
-
}
|
|
143
|
-
while (baseUrl.endsWith("/")) {
|
|
144
|
-
baseUrl = baseUrl.slice(0, -1);
|
|
145
|
-
}
|
|
146
|
-
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
|
|
147
|
-
const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
|
|
148
|
-
if (!hasScheme && hostCandidate.includes(".")) {
|
|
149
|
-
baseUrl = `https://${baseUrl}`;
|
|
150
|
-
}
|
|
151
|
-
const resolvedBaseUrl = baseUrl;
|
|
152
|
-
const [urlError, url] = catchError2(() => new URL(resolvedBaseUrl));
|
|
153
|
-
if (urlError) {
|
|
154
|
-
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"}`;
|
|
155
|
-
throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
|
|
156
|
-
}
|
|
157
|
-
if (url.protocol !== "https:") {
|
|
158
|
-
throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
|
|
159
|
-
}
|
|
160
|
-
return url.pathname.length > 1 ? url.origin : baseUrl;
|
|
161
|
-
};
|
|
162
|
-
var resolveScopes = (isExternalAppAuth, customScopes, fileScopes) => {
|
|
163
|
-
const requestedScopes = customScopes?.length ? customScopes : fileScopes ?? [];
|
|
164
|
-
if (isExternalAppAuth)
|
|
165
|
-
return requestedScopes;
|
|
166
|
-
return [...new Set([...DEFAULT_SCOPES, ...requestedScopes])];
|
|
167
|
-
};
|
|
168
|
-
var resolveConfigAsync = async ({
|
|
169
|
-
customAuthority,
|
|
170
|
-
customClientId,
|
|
171
|
-
customClientSecret,
|
|
172
|
-
customClientAssertion,
|
|
173
|
-
customScopes
|
|
174
|
-
} = {}) => {
|
|
175
|
-
const fileAuth = getAuthFileConfig();
|
|
176
|
-
let baseUrl = customAuthority;
|
|
177
|
-
if (!baseUrl) {
|
|
178
|
-
baseUrl = process.env.UIPATH_URL;
|
|
179
|
-
}
|
|
180
|
-
if (!baseUrl && fileAuth.authority) {
|
|
181
|
-
baseUrl = fileAuth.authority;
|
|
182
|
-
}
|
|
183
|
-
if (!baseUrl) {
|
|
184
|
-
baseUrl = DEFAULT_BASE_URL;
|
|
185
|
-
}
|
|
186
|
-
baseUrl = normalizeAndValidateBaseUrl(baseUrl);
|
|
187
|
-
let clientId = customClientId;
|
|
188
|
-
if (!clientId && fileAuth.clientId) {
|
|
189
|
-
clientId = fileAuth.clientId;
|
|
190
|
-
}
|
|
191
|
-
if (!clientId) {
|
|
192
|
-
clientId = DEFAULT_CLIENT_ID;
|
|
193
|
-
}
|
|
194
|
-
let clientSecret = customClientSecret;
|
|
195
|
-
if (!clientSecret && fileAuth.clientSecret) {
|
|
196
|
-
clientSecret = fileAuth.clientSecret;
|
|
197
|
-
}
|
|
198
|
-
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
|
|
199
|
-
const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
|
|
200
|
-
return {
|
|
201
|
-
clientId,
|
|
202
|
-
clientSecret,
|
|
203
|
-
scopes,
|
|
204
|
-
baseUrl,
|
|
205
|
-
authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
|
|
206
|
-
tokenEndpoint: `${baseUrl}/identity_/connect/token`
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
|
|
210
36
|
// ../auth/src/utils/platform.ts
|
|
211
37
|
function isBrowser() {
|
|
212
38
|
return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
|
|
@@ -286,7 +112,7 @@ var getTokenExpiration = (accessToken) => {
|
|
|
286
112
|
// ../auth/src/sessionIdentity.ts
|
|
287
113
|
var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
|
|
288
114
|
var decodeClaims = (accessToken) => {
|
|
289
|
-
const [error, claims] =
|
|
115
|
+
const [error, claims] = catchError(() => parseJWT(accessToken));
|
|
290
116
|
return error ? undefined : claims;
|
|
291
117
|
};
|
|
292
118
|
var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
@@ -318,6 +144,11 @@ var pickName = (claims) => {
|
|
|
318
144
|
const username = asString(claims?.preferred_username);
|
|
319
145
|
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
320
146
|
};
|
|
147
|
+
var pickScopes = (claims) => {
|
|
148
|
+
const raw = claims?.scope;
|
|
149
|
+
const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
|
|
150
|
+
return scopes.length > 0 ? scopes : undefined;
|
|
151
|
+
};
|
|
321
152
|
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
322
153
|
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
323
154
|
const email = pickEmail(claims);
|
|
@@ -343,6 +174,179 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
|
343
174
|
identity.clientId = clientId;
|
|
344
175
|
return identity;
|
|
345
176
|
};
|
|
177
|
+
var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
|
|
178
|
+
|
|
179
|
+
// ../auth/src/constants.ts
|
|
180
|
+
var UIPATH_HOME_DIR = ".uipath";
|
|
181
|
+
var AUTH_FILENAME = ".auth";
|
|
182
|
+
var DEFAULT_BASE_URL = "https://cloud.uipath.com";
|
|
183
|
+
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
184
|
+
|
|
185
|
+
// ../auth/src/config.ts
|
|
186
|
+
var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
|
|
187
|
+
var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
|
|
188
|
+
var globalSlot = globalThis;
|
|
189
|
+
var getAuthFileConfig = () => globalSlot[AUTH_FILE_CONFIG_KEY] ?? {};
|
|
190
|
+
|
|
191
|
+
class InvalidBaseUrlError extends Error {
|
|
192
|
+
url;
|
|
193
|
+
reason;
|
|
194
|
+
constructor(url, reason) {
|
|
195
|
+
super(`Invalid base URL: "${url}"
|
|
196
|
+
` + `Reason: ${reason}
|
|
197
|
+
|
|
198
|
+
` + `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>).
|
|
199
|
+
` + `You can specify the URL via:
|
|
200
|
+
` + ` • --authority flag
|
|
201
|
+
` + ` • UIPATH_URL environment variable
|
|
202
|
+
` + ` • auth.authority in config file`);
|
|
203
|
+
this.url = url;
|
|
204
|
+
this.reason = reason;
|
|
205
|
+
this.name = "InvalidBaseUrlError";
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
|
|
209
|
+
var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
210
|
+
let baseUrl = rawUrl;
|
|
211
|
+
if (baseUrl.endsWith("/identity_/")) {
|
|
212
|
+
baseUrl = baseUrl.slice(0, -11);
|
|
213
|
+
} else if (baseUrl.endsWith("/identity_")) {
|
|
214
|
+
baseUrl = baseUrl.slice(0, -10);
|
|
215
|
+
}
|
|
216
|
+
while (baseUrl.endsWith("/")) {
|
|
217
|
+
baseUrl = baseUrl.slice(0, -1);
|
|
218
|
+
}
|
|
219
|
+
const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
|
|
220
|
+
const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
|
|
221
|
+
if (!hasScheme && hostCandidate.includes(".")) {
|
|
222
|
+
baseUrl = `https://${baseUrl}`;
|
|
223
|
+
}
|
|
224
|
+
const resolvedBaseUrl = baseUrl;
|
|
225
|
+
const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
|
|
226
|
+
if (urlError) {
|
|
227
|
+
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"}`;
|
|
228
|
+
throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
|
|
229
|
+
}
|
|
230
|
+
if (url.protocol !== "https:") {
|
|
231
|
+
throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
|
|
232
|
+
}
|
|
233
|
+
return url.pathname.length > 1 ? url.origin : baseUrl;
|
|
234
|
+
};
|
|
235
|
+
var resolveScopes = (isExternalAppAuth, customScopes, fileScopes) => {
|
|
236
|
+
const requestedScopes = customScopes?.length ? customScopes : fileScopes ?? [];
|
|
237
|
+
if (isExternalAppAuth)
|
|
238
|
+
return requestedScopes;
|
|
239
|
+
return [...new Set([...DEFAULT_SCOPES, ...requestedScopes])];
|
|
240
|
+
};
|
|
241
|
+
var resolveConfigAsync = async ({
|
|
242
|
+
customAuthority,
|
|
243
|
+
customClientId,
|
|
244
|
+
customClientSecret,
|
|
245
|
+
customClientAssertion,
|
|
246
|
+
customScopes
|
|
247
|
+
} = {}) => {
|
|
248
|
+
const fileAuth = getAuthFileConfig();
|
|
249
|
+
let baseUrl = customAuthority;
|
|
250
|
+
if (!baseUrl) {
|
|
251
|
+
baseUrl = process.env.UIPATH_URL;
|
|
252
|
+
}
|
|
253
|
+
if (!baseUrl && fileAuth.authority) {
|
|
254
|
+
baseUrl = fileAuth.authority;
|
|
255
|
+
}
|
|
256
|
+
if (!baseUrl) {
|
|
257
|
+
baseUrl = DEFAULT_BASE_URL;
|
|
258
|
+
}
|
|
259
|
+
baseUrl = normalizeAndValidateBaseUrl(baseUrl);
|
|
260
|
+
let clientId = customClientId;
|
|
261
|
+
if (!clientId && fileAuth.clientId) {
|
|
262
|
+
clientId = fileAuth.clientId;
|
|
263
|
+
}
|
|
264
|
+
if (!clientId) {
|
|
265
|
+
clientId = DEFAULT_CLIENT_ID;
|
|
266
|
+
}
|
|
267
|
+
let clientSecret = customClientSecret;
|
|
268
|
+
if (!clientSecret && fileAuth.clientSecret) {
|
|
269
|
+
clientSecret = fileAuth.clientSecret;
|
|
270
|
+
}
|
|
271
|
+
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
|
|
272
|
+
const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
|
|
273
|
+
return {
|
|
274
|
+
clientId,
|
|
275
|
+
clientSecret,
|
|
276
|
+
scopes,
|
|
277
|
+
baseUrl,
|
|
278
|
+
authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
|
|
279
|
+
tokenEndpoint: `${baseUrl}/identity_/connect/token`
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
// ../auth/src/authProfile.ts
|
|
284
|
+
var DEFAULT_AUTH_PROFILE = "default";
|
|
285
|
+
var PROFILE_DIR = "profiles";
|
|
286
|
+
var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
|
|
287
|
+
var ACTIVE_AUTH_PROFILE_KEY = Symbol.for("@uipath/auth/ActiveAuthProfile");
|
|
288
|
+
var AUTH_PROFILE_STORAGE_KEY = Symbol.for("@uipath/auth/ProfileStorage");
|
|
289
|
+
var globalSlot2 = globalThis;
|
|
290
|
+
function isAuthProfileStorage(value) {
|
|
291
|
+
return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
|
|
292
|
+
}
|
|
293
|
+
function createProfileStorage() {
|
|
294
|
+
const [error, mod] = catchError(() => __require("node:async_hooks"));
|
|
295
|
+
if (error || typeof mod?.AsyncLocalStorage !== "function") {
|
|
296
|
+
return {
|
|
297
|
+
getStore: () => {
|
|
298
|
+
return;
|
|
299
|
+
},
|
|
300
|
+
run: (_store, fn) => fn()
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return new mod.AsyncLocalStorage;
|
|
304
|
+
}
|
|
305
|
+
function getProfileStorage() {
|
|
306
|
+
const existing = globalSlot2[AUTH_PROFILE_STORAGE_KEY];
|
|
307
|
+
if (isAuthProfileStorage(existing)) {
|
|
308
|
+
return existing;
|
|
309
|
+
}
|
|
310
|
+
const storage = createProfileStorage();
|
|
311
|
+
globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
312
|
+
return storage;
|
|
313
|
+
}
|
|
314
|
+
var profileStorage = getProfileStorage();
|
|
315
|
+
|
|
316
|
+
class AuthProfileValidationError extends Error {
|
|
317
|
+
constructor(message) {
|
|
318
|
+
super(message);
|
|
319
|
+
this.name = "AuthProfileValidationError";
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function normalizeAuthProfileName(profile) {
|
|
323
|
+
if (profile === undefined || profile === DEFAULT_AUTH_PROFILE) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (profile.length === 0 || profile === "." || profile === ".." || !PROFILE_NAME_RE.test(profile)) {
|
|
327
|
+
throw new AuthProfileValidationError(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
|
|
328
|
+
}
|
|
329
|
+
return profile;
|
|
330
|
+
}
|
|
331
|
+
function getActiveAuthProfile() {
|
|
332
|
+
const scopedState = profileStorage.getStore();
|
|
333
|
+
if (scopedState !== undefined) {
|
|
334
|
+
return scopedState.profile;
|
|
335
|
+
}
|
|
336
|
+
return globalSlot2[ACTIVE_AUTH_PROFILE_KEY]?.profile;
|
|
337
|
+
}
|
|
338
|
+
function resolveAuthProfileFilePath(profile) {
|
|
339
|
+
const normalized = normalizeAuthProfileName(profile);
|
|
340
|
+
if (normalized === undefined) {
|
|
341
|
+
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
342
|
+
}
|
|
343
|
+
const fs = getFileSystem();
|
|
344
|
+
return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
345
|
+
}
|
|
346
|
+
function getActiveAuthProfileFilePath() {
|
|
347
|
+
const profile = getActiveAuthProfile();
|
|
348
|
+
return profile ? resolveAuthProfileFilePath(profile) : undefined;
|
|
349
|
+
}
|
|
346
350
|
|
|
347
351
|
// ../auth/src/envAuth.ts
|
|
348
352
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
@@ -372,7 +376,7 @@ var requireEnv = (name) => {
|
|
|
372
376
|
};
|
|
373
377
|
var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
|
|
374
378
|
var resolveBaseUrl = (rawUrl, failureContext) => {
|
|
375
|
-
const [baseUrlError, baseUrl] =
|
|
379
|
+
const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(rawUrl));
|
|
376
380
|
if (baseUrlError) {
|
|
377
381
|
if (baseUrlError instanceof InvalidBaseUrlError) {
|
|
378
382
|
throw baseUrlError;
|
|
@@ -387,7 +391,7 @@ var readAuthFromEnv = () => {
|
|
|
387
391
|
const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
|
|
388
392
|
const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
|
|
389
393
|
const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
|
|
390
|
-
const [parseError, payload] =
|
|
394
|
+
const [parseError, payload] = catchError(() => parseJWT(accessToken));
|
|
391
395
|
if (parseError) {
|
|
392
396
|
const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
|
|
393
397
|
const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
|
|
@@ -415,6 +419,7 @@ var readAuthFromEnv = () => {
|
|
|
415
419
|
const expiration = getTokenExpiration(accessToken);
|
|
416
420
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
417
421
|
const identity = resolveSessionIdentity(accessToken);
|
|
422
|
+
const scopes = readTokenScopes(accessToken);
|
|
418
423
|
return {
|
|
419
424
|
loginStatus,
|
|
420
425
|
accessToken,
|
|
@@ -425,7 +430,8 @@ var readAuthFromEnv = () => {
|
|
|
425
430
|
tenantId,
|
|
426
431
|
expiration,
|
|
427
432
|
source: "env-vars" /* EnvironmentVariables */,
|
|
428
|
-
...identity ? { identity } : {}
|
|
433
|
+
...identity ? { identity } : {},
|
|
434
|
+
...scopes ? { scopes } : {}
|
|
429
435
|
};
|
|
430
436
|
};
|
|
431
437
|
|
|
@@ -506,13 +512,13 @@ var defaultIsRobotIpcAvailable = async () => {
|
|
|
506
512
|
if (process.platform === "win32") {
|
|
507
513
|
return true;
|
|
508
514
|
}
|
|
509
|
-
const [pipeNamesError, pipeNames] = await
|
|
515
|
+
const [pipeNamesError, pipeNames] = await catchError(getRobotIpcPipeNames());
|
|
510
516
|
if (pipeNamesError || !pipeNames) {
|
|
511
517
|
return false;
|
|
512
518
|
}
|
|
513
519
|
const fs = getFileSystem();
|
|
514
520
|
for (const pipeName of pipeNames) {
|
|
515
|
-
const [existsError, exists] = await
|
|
521
|
+
const [existsError, exists] = await catchError(fs.exists(pipeName));
|
|
516
522
|
if (!existsError && exists === true) {
|
|
517
523
|
return true;
|
|
518
524
|
}
|
|
@@ -530,7 +536,7 @@ var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
|
|
|
530
536
|
});
|
|
531
537
|
});
|
|
532
538
|
var parseResourceUrl = (url) => {
|
|
533
|
-
const [error, parsed] =
|
|
539
|
+
const [error, parsed] = catchError(() => new URL(url));
|
|
534
540
|
if (error || !parsed)
|
|
535
541
|
return;
|
|
536
542
|
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
@@ -550,7 +556,7 @@ var defaultLoadModule = async () => {
|
|
|
550
556
|
if (!hostLoader) {
|
|
551
557
|
return;
|
|
552
558
|
}
|
|
553
|
-
const [error, mod] = await
|
|
559
|
+
const [error, mod] = await catchError(() => hostLoader());
|
|
554
560
|
if (error || !mod) {
|
|
555
561
|
return;
|
|
556
562
|
}
|
|
@@ -576,7 +582,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
576
582
|
const mod = await loadModule();
|
|
577
583
|
if (!mod)
|
|
578
584
|
return;
|
|
579
|
-
const [ctorError, proxy] =
|
|
585
|
+
const [ctorError, proxy] = catchError(() => new mod.RobotProxyConstructor);
|
|
580
586
|
if (ctorError || !proxy) {
|
|
581
587
|
return;
|
|
582
588
|
}
|
|
@@ -599,7 +605,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
599
605
|
let organizationIdFromToken;
|
|
600
606
|
let tenantIdFromToken;
|
|
601
607
|
let issuerFromToken;
|
|
602
|
-
const [jwtError, claims] =
|
|
608
|
+
const [jwtError, claims] = catchError(() => parseJWT(accessToken));
|
|
603
609
|
if (!jwtError && claims) {
|
|
604
610
|
const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
|
|
605
611
|
if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
|
|
@@ -626,7 +632,7 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
626
632
|
} catch {
|
|
627
633
|
return;
|
|
628
634
|
} finally {
|
|
629
|
-
await
|
|
635
|
+
await catchError(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
|
|
630
636
|
}
|
|
631
637
|
};
|
|
632
638
|
|
|
@@ -1063,10 +1069,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
1063
1069
|
}
|
|
1064
1070
|
function identityFields(accessToken, credentials) {
|
|
1065
1071
|
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
1066
|
-
|
|
1072
|
+
const scopes = readTokenScopes(accessToken);
|
|
1073
|
+
return {
|
|
1074
|
+
...identity ? { identity } : {},
|
|
1075
|
+
...scopes ? { scopes } : {}
|
|
1076
|
+
};
|
|
1067
1077
|
}
|
|
1068
1078
|
function buildRobotStatus(robotCreds) {
|
|
1069
1079
|
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
1080
|
+
const scopes = readTokenScopes(robotCreds.accessToken);
|
|
1070
1081
|
return {
|
|
1071
1082
|
loginStatus: "Logged in",
|
|
1072
1083
|
accessToken: robotCreds.accessToken,
|
|
@@ -1078,7 +1089,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
1078
1089
|
issuer: robotCreds.issuer,
|
|
1079
1090
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
1080
1091
|
source: "robot" /* Robot */,
|
|
1081
|
-
...identity ? { identity } : {}
|
|
1092
|
+
...identity ? { identity } : {},
|
|
1093
|
+
...scopes ? { scopes } : {}
|
|
1082
1094
|
};
|
|
1083
1095
|
}
|
|
1084
1096
|
var isFileNotFoundError = (error) => {
|
|
@@ -1345,7 +1357,8 @@ var getAuthContext = async (options = {}) => {
|
|
|
1345
1357
|
organizationId: status.organizationId,
|
|
1346
1358
|
organizationName: status.organizationName,
|
|
1347
1359
|
tenantId: status.tenantId,
|
|
1348
|
-
tenantName
|
|
1360
|
+
tenantName,
|
|
1361
|
+
identity: status.identity
|
|
1349
1362
|
};
|
|
1350
1363
|
};
|
|
1351
1364
|
// ../auth/src/tenantSelection.ts
|
|
@@ -1358,102 +1371,6 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
1358
1371
|
TENANT_SELECTION_REQUIRED_CODE,
|
|
1359
1372
|
INVALID_TENANT_CODE
|
|
1360
1373
|
]);
|
|
1361
|
-
|
|
1362
|
-
var STUDIO_WEB_PROJECT_TYPE_OVERRIDES = {
|
|
1363
|
-
ProcessOrchestration: "processOrchestration"
|
|
1364
|
-
};
|
|
1365
|
-
function normalizeProjectType(projectType) {
|
|
1366
|
-
return STUDIO_WEB_PROJECT_TYPE_OVERRIDES[projectType] ?? projectType;
|
|
1367
|
-
}
|
|
1368
|
-
function toPortableRelativePath(relativePath) {
|
|
1369
|
-
return relativePath.replace(/\\/g, "/");
|
|
1370
|
-
}
|
|
1371
|
-
async function readUipxFile(fs, solutionDir) {
|
|
1372
|
-
const dirEntries = await fs.readdir(solutionDir);
|
|
1373
|
-
const uipxFileName = dirEntries.find((f) => f.endsWith(".uipx"));
|
|
1374
|
-
if (!uipxFileName) {
|
|
1375
|
-
throw new Error(`No .uipx file found in ${solutionDir}. Run 'uip solution init' first.`);
|
|
1376
|
-
}
|
|
1377
|
-
const uipxContent = await fs.readFile(fs.path.join(solutionDir, uipxFileName), "utf-8");
|
|
1378
|
-
if (!uipxContent) {
|
|
1379
|
-
throw new Error(`Could not read .uipx file: ${uipxFileName} is empty or missing.`);
|
|
1380
|
-
}
|
|
1381
|
-
const [parseError, parsed] = catchError(() => JSON.parse(uipxContent));
|
|
1382
|
-
if (parseError) {
|
|
1383
|
-
throw new Error(`Invalid .uipx file: could not parse JSON in ${uipxFileName}.`);
|
|
1384
|
-
}
|
|
1385
|
-
const uipx = validateUipxFile(parsed, uipxFileName);
|
|
1386
|
-
return { uipx, uipxFileName };
|
|
1387
|
-
}
|
|
1388
|
-
function validateUipxFile(parsed, uipxFileName) {
|
|
1389
|
-
if (!isRecord(parsed)) {
|
|
1390
|
-
throw new Error(`Invalid .uipx file: ${uipxFileName} must contain a JSON object.`);
|
|
1391
|
-
}
|
|
1392
|
-
if (typeof parsed.SolutionId !== "string" || !parsed.SolutionId.trim()) {
|
|
1393
|
-
throw new Error("Invalid .uipx file: missing SolutionId.");
|
|
1394
|
-
}
|
|
1395
|
-
if (!Array.isArray(parsed.Projects) || parsed.Projects.length === 0) {
|
|
1396
|
-
throw new Error("Invalid .uipx file: missing Projects.");
|
|
1397
|
-
}
|
|
1398
|
-
for (const [index, project] of parsed.Projects.entries()) {
|
|
1399
|
-
if (!isRecord(project)) {
|
|
1400
|
-
throw new Error(`Invalid .uipx file: Projects[${index}] must be an object.`);
|
|
1401
|
-
}
|
|
1402
|
-
if (typeof project.ProjectRelativePath !== "string" || !project.ProjectRelativePath.trim()) {
|
|
1403
|
-
const pathHint = typeof project.Path === "string" ? " Found Path, but .uipx uses ProjectRelativePath." : "";
|
|
1404
|
-
throw new Error(`Invalid .uipx file: Projects[${index}] is missing ProjectRelativePath.${pathHint} Use 'uip solution projects add' to add projects, or set ProjectRelativePath to the project file path, for example "Foo/project.uiproj".`);
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
return parsed;
|
|
1408
|
-
}
|
|
1409
|
-
function isRecord(value) {
|
|
1410
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1411
|
-
}
|
|
1412
|
-
function resolveSolutionDir(fs, inputPath) {
|
|
1413
|
-
const resolved = fs.path.resolve(inputPath);
|
|
1414
|
-
if (resolved.endsWith(".uipx")) {
|
|
1415
|
-
return fs.path.dirname(resolved);
|
|
1416
|
-
}
|
|
1417
|
-
return resolved;
|
|
1418
|
-
}
|
|
1419
|
-
async function updateUipxSolutionId(fs, uipxPath, newSolutionId) {
|
|
1420
|
-
const [readError, content] = await catchError(fs.readFile(uipxPath, "utf-8"));
|
|
1421
|
-
if (readError || !content) {
|
|
1422
|
-
logger.error(`Could not read .uipx file for update: ${readError?.message ?? "empty file"}`);
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1425
|
-
const [parseError, parsed] = catchError(() => JSON.parse(content));
|
|
1426
|
-
if (parseError) {
|
|
1427
|
-
logger.error(`Could not parse .uipx file for update: ${parseError.message}`);
|
|
1428
|
-
return;
|
|
1429
|
-
}
|
|
1430
|
-
parsed.SolutionId = newSolutionId;
|
|
1431
|
-
const [writeError] = await catchError(fs.writeFile(uipxPath, JSON.stringify(parsed, null, 4)));
|
|
1432
|
-
if (writeError) {
|
|
1433
|
-
logger.error(`Could not update .uipx with new SolutionId: ${writeError.message}`);
|
|
1434
|
-
} else {
|
|
1435
|
-
logger.info(`Updated .uipx with Studio Web SolutionId: ${newSolutionId}`);
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
async function findSolutionFileUpward(fs, startDir) {
|
|
1439
|
-
let dir = startDir;
|
|
1440
|
-
while (true) {
|
|
1441
|
-
const entries = await fs.readdir(dir);
|
|
1442
|
-
const files = entries.filter((f) => f.endsWith(".uipx"));
|
|
1443
|
-
if (files.length === 1) {
|
|
1444
|
-
return fs.path.join(dir, files[0]);
|
|
1445
|
-
}
|
|
1446
|
-
if (files.length > 1) {
|
|
1447
|
-
throw new Error(`Multiple .uipx files found in ${dir}. Please specify which solution file to use.`);
|
|
1448
|
-
}
|
|
1449
|
-
const parent = fs.path.dirname(dir);
|
|
1450
|
-
if (parent === dir) {
|
|
1451
|
-
throw new Error(`No .uipx solution file found (searched from ${startDir} to filesystem root)`);
|
|
1452
|
-
}
|
|
1453
|
-
dir = parent;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
export { getLoginStatusAsync, getAuthContext, normalizeProjectType, toPortableRelativePath, readUipxFile, resolveSolutionDir, updateUipxSolutionId, findSolutionFileUpward };
|
|
1374
|
+
export { resolveSessionIdentity, getLoginStatusAsync, getAuthContext };
|
|
1458
1375
|
|
|
1459
|
-
//# debugId=
|
|
1376
|
+
//# debugId=EF43D376A9ABA26B64756E2164756E21
|