@uipath/rules-tool 1.204.0-preview.249 → 1.204.0-preview.254

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.
Files changed (154) hide show
  1. package/dist/DmnFactory-VWZOSZHH-jkpbxz3n.js +42 -0
  2. package/dist/DmnModelTypes-ATR7FVKZ-jp35cecy.js +18 -0
  3. package/dist/KieDmnMarshaller-6TTUU5B4-47q50gk4.js +20 -0
  4. package/dist/THIRD-PARTY-NOTICES.md +1085 -0
  5. package/dist/business-rules-bnr581tz.js +26 -0
  6. package/dist/{constants-za5vbzp8.js → constants-9pa118cj.js} +17 -10
  7. package/dist/{embedded-file-reader-wmsg31a8.js → embedded-file-reader-rf2g1kfj.js} +4 -1
  8. package/dist/first-party-service-sd8yaf73.js +27 -0
  9. package/dist/hitPolicyResult-4WDHTX4A-gk103w84.js +33 -0
  10. package/dist/index-2hzp9b97.js +116 -0
  11. package/dist/index-34pj9f36.js +48 -0
  12. package/dist/{index-zdwhfpt1.js → index-4c4exdzw.js} +370 -406
  13. package/dist/index-dqa169gp.js +25 -0
  14. package/dist/{index-we6zjs66.js → index-fs1nd5ap.js} +40 -4
  15. package/dist/{index-nzr4mx5p.js → index-sby22td6.js} +22 -2
  16. package/dist/{index-7wc0g78k.js → index-t4mx1a5e.js} +5 -2
  17. package/dist/index.js +9 -8
  18. package/dist/{jmespath-ab6tdc42.js → jmespath-231m3hyn.js} +1 -1
  19. package/dist/{js-yaml-a2bk27p6.js → js-yaml-88tdqrtd.js} +3 -1
  20. package/dist/rule-catalog-5gzpe93c.js +46 -0
  21. package/dist/rules-command-error-20gp2dv9.js +14 -0
  22. package/dist/{rules-debug-service-h1ahd6p3.js → rules-debug-service-yvh448xp.js} +36 -35
  23. package/dist/{rules-init-service-y678kjje.js → rules-init-service-ewahc0vh.js} +16 -12
  24. package/dist/{rules-refresh-service-btn64j8j.js → rules-refresh-service-jgk2kq9d.js} +14 -13
  25. package/dist/{rules-validate-service-sppr4x13.js → rules-validate-service-mr2fk58k.js} +13 -10
  26. package/dist/{tool-97x3zjcm.js → tool-19b4ect0.js} +158 -113
  27. package/dist/{tool-epsr41wx.js → tool-1de529jm.js} +3 -12
  28. package/dist/{tool-7xmarr97.js → tool-2cky8jwp.js} +2578 -1777
  29. package/dist/{tool-x67kek1m.js → tool-2qj74g14.js} +12 -652
  30. package/dist/{tool-0bthsb3x.js → tool-4dfpdepw.js} +15 -15
  31. package/dist/tool-53w8skv5.js +262 -0
  32. package/dist/tool-7haj67tr.js +19 -0
  33. package/dist/{tool-e1mmqsjr.js → tool-8h4er38s.js} +411 -396
  34. package/dist/{tool-2trg1fpx.js → tool-8qy8pkp4.js} +8 -8
  35. package/dist/tool-av4mmsef.js +73 -0
  36. package/dist/{tool-6sqt4zrx.js → tool-cgmy94zt.js} +32 -29
  37. package/dist/{tool-8j9f6ns5.js → tool-eymjx05p.js} +11 -11
  38. package/dist/{tool-mm1x18d6.js → tool-gdtpsdn7.js} +28 -223
  39. package/dist/tool-m41px07w.js +49 -0
  40. package/dist/{tool-k2s349kn.js → tool-mkn83w88.js} +17 -14
  41. package/dist/tool-pm3ewdxc.js +1115 -0
  42. package/dist/{tool-6rp0gx98.js → tool-tkcx6png.js} +107 -127
  43. package/dist/{tool-1dycs173.js → tool-wmh645tm.js} +202 -194
  44. package/dist/tool.js +8 -7
  45. package/package.json +2 -15
  46. package/dist/DmnFactory-SG3RP3T3-cr8e7mxz.js +0 -8
  47. package/dist/DmnFactory-VWZOSZHH-azx0zqcn.js +0 -8
  48. package/dist/DmnModelTypes-ATR7FVKZ-vkv7n0jn.js +0 -8
  49. package/dist/KieDmnMarshaller-6TTUU5B4-rsxhvw7a.js +0 -8
  50. package/dist/business-rules-d51977r1.js +0 -25
  51. package/dist/business-rules-dekge24t.js +0 -23
  52. package/dist/business-rules-ew76mbwg.js +0 -25
  53. package/dist/business-rules-jmwx05k2.js +0 -25
  54. package/dist/business-rules-zpzqxyce.js +0 -26
  55. package/dist/constants-4r8pfr16.js +0 -22
  56. package/dist/embedded-file-reader-0228j82a.js +0 -111
  57. package/dist/first-party-service-1qa6cp4d.js +0 -8
  58. package/dist/first-party-service-28dkctkz.js +0 -8
  59. package/dist/first-party-service-4fsz3cnj.js +0 -8
  60. package/dist/first-party-service-ahcc6xc6.js +0 -8
  61. package/dist/first-party-service-y1ccmsvp.js +0 -8
  62. package/dist/first-party-service-zpr1q3nd.js +0 -8
  63. package/dist/hitPolicyResult-4WDHTX4A-dbtkgpqp.js +0 -12
  64. package/dist/index-2zxy6zgp.js +0 -23
  65. package/dist/index-3nx77wfh.js +0 -23
  66. package/dist/index-43zg1wqe.js +0 -19621
  67. package/dist/index-47jera73.js +0 -23
  68. package/dist/index-70jn7cz1.js +0 -19631
  69. package/dist/index-8kb5kc5y.js +0 -24
  70. package/dist/index-97yad7ms.js +0 -8
  71. package/dist/index-dfn83hxf.js +0 -14
  72. package/dist/index-e301h23h.js +0 -24
  73. package/dist/index-frd259yv.js +0 -24
  74. package/dist/index-gc7cw2jh.js +0 -23
  75. package/dist/index-gya2v502.js +0 -8
  76. package/dist/index-hb3gk1wf.js +0 -24
  77. package/dist/index-nsnfdqd5.js +0 -24
  78. package/dist/index-vffktc0w.js +0 -166
  79. package/dist/index-xymrydfw.js +0 -3095
  80. package/dist/index-z2qk2qn6.js +0 -24
  81. package/dist/index-zecwgvg7.js +0 -23
  82. package/dist/rule-catalog-a5w86qns.js +0 -43
  83. package/dist/rule-catalog-etpf962f.js +0 -69
  84. package/dist/rule-catalog-q5cr17hf.js +0 -58
  85. package/dist/rule-catalog-vc98yg4n.js +0 -43
  86. package/dist/rule-catalog-z3h66kh5.js +0 -56
  87. package/dist/rules-command-error-10qmb5w7.js +0 -13
  88. package/dist/rules-command-error-5bdv4bcx.js +0 -13
  89. package/dist/rules-command-error-cmssf0w4.js +0 -13
  90. package/dist/rules-command-error-fsm3b1mv.js +0 -13
  91. package/dist/rules-debug-service-5rcdh3pj.js +0 -192
  92. package/dist/rules-debug-service-8q7mkd0r.js +0 -199
  93. package/dist/rules-debug-service-b9j29ejz.js +0 -192
  94. package/dist/rules-debug-service-v3jr3r1n.js +0 -192
  95. package/dist/rules-init-service-3c2yfa7p.js +0 -687
  96. package/dist/rules-init-service-3wgd9cqp.js +0 -100
  97. package/dist/rules-init-service-8fqytxq0.js +0 -685
  98. package/dist/rules-init-service-pspt7sje.js +0 -100
  99. package/dist/rules-init-service-sbtzw93j.js +0 -102
  100. package/dist/rules-init-service-x7paqa63.js +0 -687
  101. package/dist/rules-init-service-y7qzmxx0.js +0 -102
  102. package/dist/rules-refresh-service-4xxj6ex6.js +0 -65
  103. package/dist/rules-refresh-service-ba5jk1y9.js +0 -65
  104. package/dist/rules-refresh-service-qkmphj53.js +0 -65
  105. package/dist/rules-validate-service-dmgnfne7.js +0 -60
  106. package/dist/rules-validate-service-hk2d006t.js +0 -60
  107. package/dist/rules-validate-service-xp05n2d9.js +0 -60
  108. package/dist/tool-1pkqxwwd.js +0 -17472
  109. package/dist/tool-24mr6g8c.js +0 -1556
  110. package/dist/tool-39fmkx2d.js +0 -611
  111. package/dist/tool-3e2q1x2y.js +0 -6578
  112. package/dist/tool-3j0747gg.js +0 -17077
  113. package/dist/tool-4z7zcq4z.js +0 -6058
  114. package/dist/tool-56smnjrh.js +0 -73
  115. package/dist/tool-5qygptrc.js +0 -6171
  116. package/dist/tool-5xx6x8pe.js +0 -6596
  117. package/dist/tool-7fkrd618.js +0 -1556
  118. package/dist/tool-89xzeteg.js +0 -361
  119. package/dist/tool-911s9czz.js +0 -570
  120. package/dist/tool-9bz2x04j.js +0 -40
  121. package/dist/tool-akh7nnqs.js +0 -704
  122. package/dist/tool-axfzew45.js +0 -1555
  123. package/dist/tool-b71jq9pt.js +0 -389
  124. package/dist/tool-bfj846v8.js +0 -141
  125. package/dist/tool-bvmc017m.js +0 -96
  126. package/dist/tool-bykz5ryf.js +0 -454
  127. package/dist/tool-c76qb8ap.js +0 -17052
  128. package/dist/tool-ca15515v.js +0 -570
  129. package/dist/tool-f9qs255w.js +0 -70
  130. package/dist/tool-ga79rety.js +0 -389
  131. package/dist/tool-gb547mcn.js +0 -141
  132. package/dist/tool-gta9rr4h.js +0 -68
  133. package/dist/tool-h2dfnxdq.js +0 -6486
  134. package/dist/tool-hg6vr5y9.js +0 -3769
  135. package/dist/tool-hgvnm4vh.js +0 -1843
  136. package/dist/tool-hjbf9aay.js +0 -571
  137. package/dist/tool-k5jm64n3.js +0 -5650
  138. package/dist/tool-ketztpgf.js +0 -73
  139. package/dist/tool-n1d88ryb.js +0 -6396
  140. package/dist/tool-nmqpwh9m.js +0 -6166
  141. package/dist/tool-pb80pswx.js +0 -73
  142. package/dist/tool-pcsgwpfw.js +0 -40
  143. package/dist/tool-q3c1bjyb.js +0 -454
  144. package/dist/tool-rwp1skmf.js +0 -40
  145. package/dist/tool-s3fbt22r.js +0 -454
  146. package/dist/tool-tmbst1r8.js +0 -68
  147. package/dist/tool-v6w109p0.js +0 -455
  148. package/dist/tool-w2js05qv.js +0 -389
  149. package/dist/tool-x89947ah.js +0 -17052
  150. package/dist/tool-xhksjdka.js +0 -4005
  151. package/dist/tool-yv3t4gg5.js +0 -108
  152. package/dist/tool-zbyb1ttx.js +0 -5650
  153. /package/dist/{tool-fbqnqf9k.js → tool-jd313s2x.js} +0 -0
  154. /package/dist/{tool-vyx8fpft.js → tool-qgqscsjc.js} +0 -0
@@ -1,3769 +0,0 @@
1
- import {
2
- getFileSystem,
3
- getSdkUserAgentToken,
4
- addSdkUserAgentHeader,
5
- installSdkUserAgentHeader
6
- } from "./tool-5xx6x8pe.js";
7
- import {
8
- __require
9
- } from "./tool-epsr41wx.js";
10
-
11
- // ../auth/src/catch-error.ts
12
- function isPromiseLike(value) {
13
- return value !== null && typeof value === "object" && typeof value.then === "function";
14
- }
15
- function catchError(fnOrPromise) {
16
- if (isPromiseLike(fnOrPromise)) {
17
- return settlePromiseLike(fnOrPromise);
18
- }
19
- try {
20
- const result = fnOrPromise();
21
- if (isPromiseLike(result)) {
22
- return settlePromiseLike(result);
23
- }
24
- return [undefined, result];
25
- } catch (error) {
26
- return [
27
- error instanceof Error ? error : new Error(String(error)),
28
- undefined
29
- ];
30
- }
31
- }
32
- function settlePromiseLike(thenable) {
33
- return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [
34
- error instanceof Error ? error : new Error(String(error)),
35
- undefined
36
- ]);
37
- }
38
-
39
- // ../auth/src/constants.ts
40
- var UIPATH_HOME_DIR = ".uipath";
41
- var AUTH_FILENAME = ".auth";
42
- var DEFAULT_BASE_URL = "https://cloud.uipath.com";
43
- var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
44
-
45
- // ../auth/src/authProfile.ts
46
- var DEFAULT_AUTH_PROFILE = "default";
47
- var PROFILE_DIR = "profiles";
48
- var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
49
- var ACTIVE_AUTH_PROFILE_KEY = Symbol.for("@uipath/auth/ActiveAuthProfile");
50
- var AUTH_PROFILE_STORAGE_KEY = Symbol.for("@uipath/auth/ProfileStorage");
51
- var globalSlot = globalThis;
52
- function isAuthProfileStorage(value) {
53
- return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
54
- }
55
- function createProfileStorage() {
56
- const [error, mod] = catchError(() => __require("node:async_hooks"));
57
- if (error || typeof mod?.AsyncLocalStorage !== "function") {
58
- return {
59
- getStore: () => {
60
- return;
61
- },
62
- run: (_store, fn) => fn()
63
- };
64
- }
65
- return new mod.AsyncLocalStorage;
66
- }
67
- function getProfileStorage() {
68
- const existing = globalSlot[AUTH_PROFILE_STORAGE_KEY];
69
- if (isAuthProfileStorage(existing)) {
70
- return existing;
71
- }
72
- const storage = createProfileStorage();
73
- globalSlot[AUTH_PROFILE_STORAGE_KEY] = storage;
74
- return storage;
75
- }
76
- var profileStorage = getProfileStorage();
77
-
78
- class AuthProfileValidationError extends Error {
79
- constructor(message) {
80
- super(message);
81
- this.name = "AuthProfileValidationError";
82
- }
83
- }
84
- function normalizeAuthProfileName(profile) {
85
- if (profile === undefined || profile === DEFAULT_AUTH_PROFILE) {
86
- return;
87
- }
88
- if (profile.length === 0 || profile === "." || profile === ".." || !PROFILE_NAME_RE.test(profile)) {
89
- throw new AuthProfileValidationError(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
90
- }
91
- return profile;
92
- }
93
- function getActiveAuthProfile() {
94
- const scopedState = profileStorage.getStore();
95
- if (scopedState !== undefined) {
96
- return scopedState.profile;
97
- }
98
- return globalSlot[ACTIVE_AUTH_PROFILE_KEY]?.profile;
99
- }
100
- function resolveAuthProfileFilePath(profile) {
101
- const normalized = normalizeAuthProfileName(profile);
102
- if (normalized === undefined) {
103
- throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
104
- }
105
- const fs = getFileSystem();
106
- return fs.path.join(fs.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
107
- }
108
- function getActiveAuthProfileFilePath() {
109
- const profile = getActiveAuthProfile();
110
- return profile ? resolveAuthProfileFilePath(profile) : undefined;
111
- }
112
-
113
- // ../auth/src/config.ts
114
- var DEFAULT_CLIENT_ID = "36dea5b8-e8bb-423d-8e7b-c808df8f1c00";
115
- var AUTH_FILE_CONFIG_KEY = Symbol.for("@uipath/auth/AuthFileConfig");
116
- var globalSlot2 = globalThis;
117
- var getAuthFileConfig = () => globalSlot2[AUTH_FILE_CONFIG_KEY] ?? {};
118
-
119
- class InvalidBaseUrlError extends Error {
120
- url;
121
- reason;
122
- constructor(url, reason) {
123
- super(`Invalid base URL: "${url}"
124
- ` + `Reason: ${reason}
125
-
126
- ` + `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>).
127
- ` + `You can specify the URL via:
128
- ` + ` • --authority flag
129
- ` + ` • UIPATH_URL environment variable
130
- ` + ` • auth.authority in config file`);
131
- this.url = url;
132
- this.reason = reason;
133
- this.name = "InvalidBaseUrlError";
134
- }
135
- }
136
- var DEFAULT_SCOPES = ["openid", "profile", "offline_access"];
137
- var normalizeAndValidateBaseUrl = (rawUrl) => {
138
- let baseUrl = rawUrl;
139
- if (baseUrl.endsWith("/identity_/")) {
140
- baseUrl = baseUrl.slice(0, -11);
141
- } else if (baseUrl.endsWith("/identity_")) {
142
- baseUrl = baseUrl.slice(0, -10);
143
- }
144
- while (baseUrl.endsWith("/")) {
145
- baseUrl = baseUrl.slice(0, -1);
146
- }
147
- const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(baseUrl);
148
- const [hostCandidate] = baseUrl.split(/[/?#]/, 1);
149
- if (!hasScheme && hostCandidate.includes(".")) {
150
- baseUrl = `https://${baseUrl}`;
151
- }
152
- const resolvedBaseUrl = baseUrl;
153
- const [urlError, url] = catchError(() => new URL(resolvedBaseUrl));
154
- if (urlError) {
155
- 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"}`;
156
- throw new InvalidBaseUrlError(baseUrl, `Malformed URL.${shapeHint}`);
157
- }
158
- if (url.protocol !== "https:") {
159
- throw new InvalidBaseUrlError(baseUrl, `Authority must use https:// scheme, got ${url.protocol}//. OIDC token exchange requires TLS end-to-end.`);
160
- }
161
- return url.pathname.length > 1 ? url.origin : baseUrl;
162
- };
163
- var resolveScopes = (isExternalAppAuth, customScopes, fileScopes) => {
164
- const requestedScopes = customScopes?.length ? customScopes : fileScopes ?? [];
165
- if (isExternalAppAuth)
166
- return requestedScopes;
167
- return [...new Set([...DEFAULT_SCOPES, ...requestedScopes])];
168
- };
169
- var resolveConfigAsync = async ({
170
- customAuthority,
171
- customClientId,
172
- customClientSecret,
173
- customClientAssertion,
174
- customScopes
175
- } = {}) => {
176
- const fileAuth = getAuthFileConfig();
177
- let baseUrl = customAuthority;
178
- if (!baseUrl) {
179
- baseUrl = process.env.UIPATH_URL;
180
- }
181
- if (!baseUrl && fileAuth.authority) {
182
- baseUrl = fileAuth.authority;
183
- }
184
- if (!baseUrl) {
185
- baseUrl = DEFAULT_BASE_URL;
186
- }
187
- baseUrl = normalizeAndValidateBaseUrl(baseUrl);
188
- let clientId = customClientId;
189
- if (!clientId && fileAuth.clientId) {
190
- clientId = fileAuth.clientId;
191
- }
192
- if (!clientId) {
193
- clientId = DEFAULT_CLIENT_ID;
194
- }
195
- let clientSecret = customClientSecret;
196
- if (!clientSecret && fileAuth.clientSecret) {
197
- clientSecret = fileAuth.clientSecret;
198
- }
199
- const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
200
- const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
201
- return {
202
- clientId,
203
- clientSecret,
204
- scopes,
205
- baseUrl,
206
- authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
207
- tokenEndpoint: `${baseUrl}/identity_/connect/token`
208
- };
209
- };
210
-
211
- // ../auth/src/utils/platform.ts
212
- function isBrowser() {
213
- return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
214
- }
215
-
216
- // ../auth/src/utils/jwt.ts
217
- class InvalidIssuerError extends Error {
218
- expected;
219
- actual;
220
- constructor(expected, actual) {
221
- const actualText = actual ?? "<missing>";
222
- super(`Token issuer does not match the authority used to log in.
223
- ` + `Expected: ${expected}
224
- ` + `Actual: ${actualText}
225
-
226
- ` + `The identity server that issued this token is not the one ` + `you pointed --authority at. Refusing to save credentials.`);
227
- this.expected = expected;
228
- this.actual = actual;
229
- this.name = "InvalidIssuerError";
230
- }
231
- }
232
- var parseJWT = (token) => {
233
- try {
234
- const parts = token.split(".");
235
- const base64Url = parts[1];
236
- if (!base64Url) {
237
- throw new Error("Invalid JWT token format - missing payload section");
238
- }
239
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
240
- let decodedString;
241
- if (isBrowser() && typeof atob !== "undefined") {
242
- decodedString = atob(base64);
243
- } else {
244
- decodedString = Buffer.from(base64, "base64").toString();
245
- }
246
- const jsonPayload = decodeURIComponent(decodedString.split("").map((c) => `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));
247
- const parsed = JSON.parse(jsonPayload);
248
- return parsed;
249
- } catch (error) {
250
- throw new Error(`Failed to parse JWT: ${error instanceof Error ? error.message : "Unknown error"}`);
251
- }
252
- };
253
- var assertIssuerMatchesAuthority = (token, authority) => {
254
- let payload;
255
- try {
256
- payload = parseJWT(token);
257
- } catch (error) {
258
- throw new InvalidIssuerError(`${authority.replace(/\/+$/, "")}/identity_`, `<unparseable: ${error instanceof Error ? error.message : "unknown error"}>`);
259
- }
260
- const stripTrailingSlash = (s) => s.replace(/\/+$/, "");
261
- const expected = `${stripTrailingSlash(authority)}/identity_`;
262
- const actual = typeof payload.iss === "string" ? stripTrailingSlash(payload.iss) : undefined;
263
- if (actual !== expected) {
264
- throw new InvalidIssuerError(expected, payload.iss);
265
- }
266
- };
267
- var getTokenExpiration = (accessToken) => {
268
- try {
269
- const parts = accessToken.split(".");
270
- if (parts.length !== 3) {
271
- return;
272
- }
273
- const payload = parts[1];
274
- const base64 = payload.replace(/-/g, "+").replace(/_/g, "/");
275
- const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
276
- const decoded = atob(padded);
277
- const claims = JSON.parse(decoded);
278
- if (typeof claims.exp !== "number") {
279
- return;
280
- }
281
- return new Date(claims.exp * 1000);
282
- } catch {
283
- return;
284
- }
285
- };
286
-
287
- // ../auth/src/sessionIdentity.ts
288
- var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
289
- var decodeClaims = (accessToken) => {
290
- const [error, claims] = catchError(() => parseJWT(accessToken));
291
- return error ? undefined : claims;
292
- };
293
- var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
294
- var resolveIdentityType = (claims, authFlow, email) => {
295
- const subType = asString(claims?.sub_type);
296
- if (subType) {
297
- return subType.startsWith("service") ? "Application" : "User";
298
- }
299
- if (authFlow) {
300
- return authFlow === "authorization_code" ? "User" : "Application";
301
- }
302
- if (email)
303
- return "User";
304
- if (asString(claims?.client_id) && !asString(claims?.sub)) {
305
- return "Application";
306
- }
307
- return;
308
- };
309
- var resolveApplicationSubtype = (claims, authFlow) => {
310
- switch (asString(claims?.sub_type)) {
311
- case "service.external":
312
- return "External";
313
- case "service.internal":
314
- return "Internal";
315
- default:
316
- return authFlow === "client_credentials" || authFlow === "federated_credentials" ? "External" : undefined;
317
- }
318
- };
319
- var looksLikeEmail = (value) => value?.includes("@") ?? false;
320
- var pickEmail = (claims) => {
321
- for (const candidate of [claims?.email, claims?.preferred_username]) {
322
- const value = asString(candidate);
323
- if (looksLikeEmail(value))
324
- return value;
325
- }
326
- return;
327
- };
328
- var pickName = (claims) => {
329
- const username = asString(claims?.preferred_username);
330
- return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
331
- };
332
- var pickScopes = (claims) => {
333
- const raw = claims?.scope;
334
- const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
335
- return scopes.length > 0 ? scopes : undefined;
336
- };
337
- var resolveSessionIdentity = (accessToken, authFlow) => {
338
- const claims = accessToken ? decodeClaims(accessToken) : undefined;
339
- const email = pickEmail(claims);
340
- const type = resolveIdentityType(claims, authFlow, email);
341
- if (!type)
342
- return;
343
- const identity = { type };
344
- if (authFlow)
345
- identity.authFlow = authFlow;
346
- if (type === "User") {
347
- const userId = asString(claims?.sub);
348
- if (userId)
349
- identity.userId = userId;
350
- if (email)
351
- identity.userEmail = email;
352
- const name = pickName(claims);
353
- if (name)
354
- identity.userName = name;
355
- return identity;
356
- }
357
- const clientId = asString(claims?.client_id);
358
- if (clientId)
359
- identity.clientId = clientId;
360
- const subType = asString(claims?.sub_type);
361
- if (subType)
362
- identity.subType = subType;
363
- const applicationSubtype = resolveApplicationSubtype(claims, authFlow);
364
- if (applicationSubtype)
365
- identity.applicationSubtype = applicationSubtype;
366
- return identity;
367
- };
368
- var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
369
-
370
- // ../auth/src/envAuth.ts
371
- var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
372
- var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
373
- var ENV_AUTH_VARS = {
374
- token: "UIPATH_CLI_AUTH_TOKEN",
375
- organizationName: "UIPATH_CLI_ORGANIZATION_NAME",
376
- organizationId: "UIPATH_CLI_ORGANIZATION_ID",
377
- tenantName: "UIPATH_CLI_TENANT_NAME",
378
- tenantId: "UIPATH_CLI_TENANT_ID"
379
- };
380
-
381
- class EnvAuthConfigError extends Error {
382
- constructor(message) {
383
- super(message);
384
- this.name = "EnvAuthConfigError";
385
- }
386
- }
387
- var isEnvAuthEnabled = () => process.env[ENV_AUTH_ENABLE_VAR] === "true";
388
- var isRobotAuthEnforced = () => process.env[ENFORCE_ROBOT_AUTH_VAR] === "true";
389
- var requireEnv = (name) => {
390
- const value = process.env[name];
391
- if (!value) {
392
- throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true but ${name} is not set. ` + `Set ${name} to enable env-var authentication.`);
393
- }
394
- return value;
395
- };
396
- var OPAQUE_TOKEN_BASE_URL_VAR = "UIPATH_URL";
397
- var resolveBaseUrl = (rawUrl, failureContext) => {
398
- const [baseUrlError, baseUrl] = catchError(() => normalizeAndValidateBaseUrl(rawUrl));
399
- if (baseUrlError) {
400
- if (baseUrlError instanceof InvalidBaseUrlError) {
401
- throw baseUrlError;
402
- }
403
- throw new EnvAuthConfigError(`${failureContext}: ` + `${baseUrlError instanceof Error ? baseUrlError.message : String(baseUrlError)}`);
404
- }
405
- return baseUrl;
406
- };
407
- var readAuthFromEnv = () => {
408
- const accessToken = requireEnv(ENV_AUTH_VARS.token);
409
- const organizationName = requireEnv(ENV_AUTH_VARS.organizationName);
410
- const organizationId = requireEnv(ENV_AUTH_VARS.organizationId);
411
- const tenantName = requireEnv(ENV_AUTH_VARS.tenantName);
412
- const tenantId = requireEnv(ENV_AUTH_VARS.tenantId);
413
- const [parseError, payload] = catchError(() => parseJWT(accessToken));
414
- if (parseError) {
415
- const parseErrorMessage = parseError instanceof Error ? parseError.message : String(parseError);
416
- const rawUrl = process.env[OPAQUE_TOKEN_BASE_URL_VAR];
417
- if (!rawUrl) {
418
- 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}).`);
419
- }
420
- const baseUrl = resolveBaseUrl(rawUrl, `Failed to validate ${OPAQUE_TOKEN_BASE_URL_VAR}`);
421
- return {
422
- loginStatus: "Logged in",
423
- accessToken,
424
- baseUrl,
425
- organizationName,
426
- organizationId,
427
- tenantName,
428
- tenantId,
429
- source: "env-vars" /* EnvironmentVariables */,
430
- 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}`
431
- };
432
- }
433
- const iss = payload.iss;
434
- if (typeof iss !== "string" || iss.length === 0) {
435
- 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.`);
436
- }
437
- const baseUrl = resolveBaseUrl(iss, "Failed to derive server URL from token 'iss' claim");
438
- const expiration = getTokenExpiration(accessToken);
439
- const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
440
- const identity = resolveSessionIdentity(accessToken);
441
- const scopes = readTokenScopes(accessToken);
442
- return {
443
- loginStatus,
444
- accessToken,
445
- baseUrl,
446
- organizationName,
447
- organizationId,
448
- tenantName,
449
- tenantId,
450
- expiration,
451
- source: "env-vars" /* EnvironmentVariables */,
452
- ...identity ? { identity } : {},
453
- ...scopes ? { scopes } : {}
454
- };
455
- };
456
-
457
- // ../auth/src/refreshCircuitBreaker.ts
458
- var BREAKER_SUFFIX = ".refresh-state";
459
- var BACKOFF_BASE_MS = 60000;
460
- var BACKOFF_CAP_MS = 60 * 60 * 1000;
461
- var SURFACE_WINDOW_MS = 60 * 60 * 1000;
462
- async function refreshTokenFingerprint(refreshToken) {
463
- const bytes = new TextEncoder().encode(refreshToken);
464
- if (globalThis.crypto?.subtle) {
465
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
466
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
467
- }
468
- const { createHash } = await import("node:crypto");
469
- return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
470
- }
471
- function breakerPathFor(authPath) {
472
- return `${authPath}${BREAKER_SUFFIX}`;
473
- }
474
- async function loadRefreshBreaker(authPath) {
475
- const fs = getFileSystem();
476
- try {
477
- const content = await fs.readFile(breakerPathFor(authPath), "utf-8");
478
- if (!content)
479
- return {};
480
- const parsed = JSON.parse(content);
481
- return parsed && typeof parsed === "object" ? parsed : {};
482
- } catch {
483
- return {};
484
- }
485
- }
486
- async function saveRefreshBreaker(authPath, state) {
487
- try {
488
- const fs = getFileSystem();
489
- const path = breakerPathFor(authPath);
490
- await fs.mkdir(fs.path.dirname(path));
491
- const tempPath = `${path}.tmp`;
492
- await fs.writeFile(tempPath, JSON.stringify(state));
493
- await fs.rename(tempPath, path);
494
- } catch {}
495
- }
496
- async function clearRefreshBreaker(authPath) {
497
- const fs = getFileSystem();
498
- const path = breakerPathFor(authPath);
499
- try {
500
- if (await fs.exists(path)) {
501
- await fs.rm(path);
502
- }
503
- } catch {}
504
- }
505
- function nextBackoffMs(attempts) {
506
- const shift = Math.max(0, attempts - 1);
507
- return Math.min(BACKOFF_BASE_MS * 2 ** shift, BACKOFF_CAP_MS);
508
- }
509
- function shouldSurface(state, nowMs) {
510
- if (state.lastSurfacedAtMs === undefined)
511
- return true;
512
- return nowMs - state.lastSurfacedAtMs >= SURFACE_WINDOW_MS;
513
- }
514
-
515
- // ../auth/src/robotClientFallback.ts
516
- var DEFAULT_TIMEOUT_MS = 1000;
517
- var CLOSE_TIMEOUT_MS = 500;
518
- var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
519
- var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
520
- var PIPE_NAME_MAX_LENGTH = 103;
521
- var getRobotIpcPipeNames = async () => {
522
- const fs = getFileSystem();
523
- const username = fs.env.getenv("USER") ?? fs.env.getenv("USERNAME");
524
- if (!username) {
525
- throw new Error("Unable to determine current username");
526
- }
527
- const tempPath = fs.env.getenv("TMPDIR") ?? "/tmp/";
528
- return [ROBOT_USER_SERVICES_PIPE, ROBOT_USER_SERVICES_ALTERNATE_PIPE].map((baseName) => fs.path.join(tempPath, `${baseName}_${username}`).substring(0, PIPE_NAME_MAX_LENGTH));
529
- };
530
- var defaultIsRobotIpcAvailable = async () => {
531
- if (process.platform === "win32") {
532
- return true;
533
- }
534
- const [pipeNamesError, pipeNames] = await catchError(getRobotIpcPipeNames());
535
- if (pipeNamesError || !pipeNames) {
536
- return false;
537
- }
538
- const fs = getFileSystem();
539
- for (const pipeName of pipeNames) {
540
- const [existsError, exists] = await catchError(fs.exists(pipeName));
541
- if (!existsError && exists === true) {
542
- return true;
543
- }
544
- }
545
- return false;
546
- };
547
- var withTimeout = (promise, timeoutMs) => new Promise((resolve, reject) => {
548
- const timer = setTimeout(() => reject(new Error(`Robot IPC call timed out after ${timeoutMs}ms`)), timeoutMs);
549
- promise.then((value) => {
550
- clearTimeout(timer);
551
- resolve(value);
552
- }, (error) => {
553
- clearTimeout(timer);
554
- reject(error);
555
- });
556
- });
557
- var parseResourceUrl = (url) => {
558
- const [error, parsed] = catchError(() => new URL(url));
559
- if (error || !parsed)
560
- return;
561
- const segments = parsed.pathname.split("/").filter(Boolean);
562
- return {
563
- baseUrl: parsed.origin,
564
- organizationName: segments[0],
565
- tenantName: segments[1]
566
- };
567
- };
568
- var ROBOT_CLIENT_LOADER_KEY = Symbol.for("@uipath/auth/RobotClientLoader");
569
- var getRegisteredRobotClientLoader = () => {
570
- const loader = globalThis[ROBOT_CLIENT_LOADER_KEY];
571
- return typeof loader === "function" ? loader : undefined;
572
- };
573
- var defaultLoadModule = async () => {
574
- const hostLoader = getRegisteredRobotClientLoader();
575
- if (!hostLoader) {
576
- return;
577
- }
578
- const [error, mod] = await catchError(() => hostLoader());
579
- if (error || !mod) {
580
- return;
581
- }
582
- return mod;
583
- };
584
- var tryRobotClientFallback = async (options = {}) => {
585
- if (isBrowser())
586
- return;
587
- if (!options.force) {
588
- if (process.env.CI || process.env.GITHUB_ACTIONS) {
589
- return;
590
- }
591
- if (process.env.UIPATH_URL) {
592
- return;
593
- }
594
- }
595
- const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
596
- const isRobotIpcAvailable = options.isRobotIpcAvailable ?? defaultIsRobotIpcAvailable;
597
- const loadModule = options.loadModule ?? defaultLoadModule;
598
- if (!await isRobotIpcAvailable()) {
599
- return;
600
- }
601
- const mod = await loadModule();
602
- if (!mod)
603
- return;
604
- const [ctorError, proxy] = catchError(() => new mod.RobotProxyConstructor);
605
- if (ctorError || !proxy) {
606
- return;
607
- }
608
- try {
609
- const enabled = await withTimeout(proxy.interactiveConnectFlow.IsEnabled(), timeoutMs);
610
- if (!enabled) {
611
- return;
612
- }
613
- const [resourceUrl, accessToken] = await Promise.all([
614
- withTimeout(proxy.accessProvider.GetResourceUrl("Orchestrator"), timeoutMs),
615
- withTimeout(proxy.accessProvider.GetAccessToken("Orchestrator", false), timeoutMs)
616
- ]);
617
- if (!accessToken) {
618
- return;
619
- }
620
- const parsedUrl = parseResourceUrl(resourceUrl);
621
- if (!parsedUrl) {
622
- return;
623
- }
624
- let organizationIdFromToken;
625
- let tenantIdFromToken;
626
- let issuerFromToken;
627
- const [jwtError, claims] = catchError(() => parseJWT(accessToken));
628
- if (!jwtError && claims) {
629
- const rawOrgId = claims.prtId ?? claims.organizationId ?? claims.prt_id;
630
- if (typeof rawOrgId === "string" && rawOrgId.length > 0) {
631
- organizationIdFromToken = rawOrgId;
632
- }
633
- const tenantClaim = claims.tenantId ?? claims.tenant_id;
634
- if (typeof tenantClaim === "string" && tenantClaim.length > 0) {
635
- tenantIdFromToken = tenantClaim;
636
- }
637
- const issClaim = claims.iss;
638
- if (typeof issClaim === "string" && issClaim.length > 0) {
639
- issuerFromToken = issClaim;
640
- }
641
- }
642
- return {
643
- accessToken,
644
- baseUrl: parsedUrl.baseUrl,
645
- organizationName: parsedUrl.organizationName,
646
- organizationId: organizationIdFromToken ?? parsedUrl.organizationName,
647
- tenantName: parsedUrl.tenantName,
648
- tenantId: tenantIdFromToken,
649
- issuer: issuerFromToken
650
- };
651
- } catch {
652
- return;
653
- } finally {
654
- await catchError(() => withTimeout(proxy.CloseAsync(), CLOSE_TIMEOUT_MS));
655
- }
656
- };
657
-
658
- // ../auth/src/tenantSelection.ts
659
- var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
660
- var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
661
- var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
662
- var describeNonJsonResponse = (organizationId, response, parseError) => {
663
- if (response.redirected) {
664
- return `Could not find organization '${organizationId}': the request was ` + `redirected to a sign-in page instead of the organization's tenant ` + `list. ${LOGIN_STATUS_HINT}`;
665
- }
666
- const contentType = response.headers.get("content-type") ?? "unknown";
667
- return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
668
- };
669
- var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
670
- const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
671
- const response = await fetch(url, {
672
- headers: {
673
- Authorization: `Bearer ${accessToken}`
674
- },
675
- ...signal ? { signal } : {}
676
- });
677
- if (!response.ok) {
678
- if (response.status === 401) {
679
- throw new Error(`Unauthorized: the access token was rejected, it was not ` + `issued for organization '${organizationId}', or ` + `'${organizationId}' was not accepted as an organization ` + `URL segment in this environment. ` + LOGIN_STATUS_HINT);
680
- }
681
- const errorText = await response.text();
682
- const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
683
- throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
684
- }
685
- const [parseError, data] = await catchError(response.json());
686
- if (parseError) {
687
- throw new Error(describeNonJsonResponse(organizationId, response, parseError));
688
- }
689
- return data;
690
- };
691
-
692
- // ../auth/src/tokenRefresh.ts
693
- var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
694
-
695
- class TokenRefreshOAuthError extends Error {
696
- __brand = "TokenRefreshOAuthError";
697
- constructor() {
698
- super(TOKEN_REFRESH_REAUTHENTICATE_MESSAGE);
699
- this.name = "TokenRefreshOAuthError";
700
- }
701
- }
702
- function isTokenRefreshOAuthFailure(error) {
703
- return error instanceof TokenRefreshOAuthError;
704
- }
705
- var refreshAccessToken = async ({
706
- refreshToken,
707
- tokenEndpoint,
708
- clientId,
709
- expectedAuthority
710
- }) => {
711
- const tokenParams = new URLSearchParams({
712
- grant_type: "refresh_token",
713
- refresh_token: refreshToken,
714
- client_id: clientId
715
- });
716
- const tokenResponse = await fetch(tokenEndpoint, {
717
- method: "POST",
718
- headers: {
719
- "Content-Type": "application/x-www-form-urlencoded"
720
- },
721
- body: tokenParams
722
- });
723
- const tokenData = await tokenResponse.json();
724
- if (!tokenResponse.ok) {
725
- throw new TokenRefreshOAuthError;
726
- }
727
- const newAccessToken = tokenData.access_token;
728
- const newRefreshToken = tokenData.refresh_token;
729
- if (typeof newAccessToken !== "string" || typeof newRefreshToken !== "string") {
730
- throw new Error("Token refresh response is missing access_token or refresh_token");
731
- }
732
- if (expectedAuthority) {
733
- assertIssuerMatchesAuthority(newAccessToken, expectedAuthority);
734
- }
735
- return { accessToken: newAccessToken, refreshToken: newRefreshToken };
736
- };
737
-
738
- // ../auth/src/types.ts
739
- var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
740
-
741
- // ../auth/src/utils/envFile.ts
742
- var DEFAULT_ENV_FILENAME = `${UIPATH_HOME_DIR}/${AUTH_FILENAME}`;
743
- var KNOWN_ERROR_CODES = new Set([
744
- "EISDIR",
745
- "EACCES",
746
- "EPERM",
747
- "ELOOP",
748
- "ENOTDIR",
749
- "EUNKNOWN"
750
- ]);
751
- var errorCode = (err) => {
752
- if (err !== null && typeof err === "object" && "code" in err && typeof err.code === "string") {
753
- const raw = err.code;
754
- return KNOWN_ERROR_CODES.has(raw) ? raw : "EUNKNOWN";
755
- }
756
- return "EUNKNOWN";
757
- };
758
- var probeAsync = async (fs, candidate) => {
759
- try {
760
- const stats = await fs.stat(candidate);
761
- if (stats === null) {
762
- return { exists: false };
763
- }
764
- if (!stats.isFile()) {
765
- return {
766
- exists: false,
767
- unusable: {
768
- reason: "not-a-file",
769
- code: "EISDIR",
770
- message: `Path is not a regular file: ${candidate}`
771
- }
772
- };
773
- }
774
- return { exists: true };
775
- } catch (err) {
776
- return {
777
- exists: false,
778
- unusable: {
779
- reason: "unreadable",
780
- code: errorCode(err),
781
- message: err instanceof Error ? err.message : String(err)
782
- }
783
- };
784
- }
785
- };
786
- var resolveEnvFileLocationAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
787
- const fs = getFileSystem();
788
- if (fs.path.isAbsolute(envFilePath)) {
789
- const probe = await probeAsync(fs, envFilePath);
790
- return probe.exists ? { exists: true, absolutePath: envFilePath, source: "absolute" } : {
791
- exists: false,
792
- absolutePath: envFilePath,
793
- source: "absolute",
794
- ...probe.unusable ? { unusable: probe.unusable } : {}
795
- };
796
- }
797
- const cwd = opts?.cwd ?? fs.env.cwd();
798
- let searchDir = cwd;
799
- while (true) {
800
- const candidate = fs.path.join(searchDir, envFilePath);
801
- const probe = await probeAsync(fs, candidate);
802
- if (probe.exists) {
803
- return {
804
- exists: true,
805
- absolutePath: candidate,
806
- source: searchDir === cwd ? "cwd" : "ancestor"
807
- };
808
- }
809
- const parentDir = fs.path.dirname(searchDir);
810
- if (parentDir === searchDir) {
811
- break;
812
- }
813
- searchDir = parentDir;
814
- }
815
- const homePath = fs.path.join(fs.env.homedir(), envFilePath);
816
- const probe = await probeAsync(fs, homePath);
817
- if (probe.exists) {
818
- return { exists: true, absolutePath: homePath, source: "home" };
819
- }
820
- return {
821
- exists: false,
822
- absolutePath: homePath,
823
- source: "default",
824
- ...probe.unusable ? { unusable: probe.unusable } : {}
825
- };
826
- };
827
- var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) => {
828
- const location = await resolveEnvFileLocationAsync(envFilePath, opts);
829
- if (location.exists) {
830
- return { absolutePath: location.absolutePath };
831
- }
832
- return {
833
- absolutePath: undefined,
834
- errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
835
- };
836
- };
837
- var parseEnvContent = (content) => {
838
- const env = {};
839
- for (const line of content.split(`
840
- `)) {
841
- const trimmed = line.trim();
842
- if (!trimmed || trimmed.startsWith("#")) {
843
- continue;
844
- }
845
- const equalIndex = trimmed.indexOf("=");
846
- if (equalIndex === -1) {
847
- continue;
848
- }
849
- const key = trimmed.slice(0, equalIndex).trim();
850
- let value = trimmed.slice(equalIndex + 1).trim();
851
- if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
852
- value = value.slice(1, -1);
853
- }
854
- env[key] = value;
855
- }
856
- return env;
857
- };
858
- var loadEnvFileAsync = async ({ envPath }) => {
859
- const fs = getFileSystem();
860
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.cwd(), envPath);
861
- if (!await fs.exists(absolutePath)) {
862
- throw new Error(`Environment file not found: ${envPath}`);
863
- }
864
- const content = await fs.readFile(absolutePath, "utf-8");
865
- if (content === null) {
866
- throw new Error(`Environment file not found: ${envPath}`);
867
- }
868
- return parseEnvContent(content);
869
- };
870
- var saveEnvFileAsync = async ({
871
- envPath,
872
- data,
873
- merge = true
874
- }) => {
875
- const fs = getFileSystem();
876
- const absolutePath = fs.path.isAbsolute(envPath) ? envPath : fs.path.join(fs.env.homedir(), envPath);
877
- let existingData = {};
878
- if (merge && await fs.exists(absolutePath)) {
879
- try {
880
- existingData = await loadEnvFileAsync({ envPath: absolutePath });
881
- } catch {}
882
- }
883
- const finalData = { ...existingData, ...data };
884
- const lines = [];
885
- for (const [key, value] of Object.entries(finalData)) {
886
- if (value === undefined) {
887
- continue;
888
- }
889
- const needsQuotes = value.includes(" ") || value.includes("#");
890
- const finalValue = needsQuotes ? `"${value}"` : value;
891
- lines.push(`${key}=${finalValue}`);
892
- }
893
- const content = `${lines.join(`
894
- `)}
895
- `;
896
- const dir = fs.path.dirname(absolutePath);
897
- await fs.mkdir(dir);
898
- const tempPath = `${absolutePath}.tmp`;
899
- await fs.writeFile(tempPath, content);
900
- await fs.rename(tempPath, absolutePath);
901
- };
902
-
903
- // ../auth/src/loginStatus.ts
904
- var defaultRobotTenantIdCache = new Map;
905
- var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
906
- var getLoginStatusAsync = async (options = {}) => {
907
- return getLoginStatusWithDeps(options);
908
- };
909
- var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
910
- const {
911
- resolveEnvFilePath = resolveEnvFilePathAsync,
912
- loadEnvFile = loadEnvFileAsync,
913
- saveEnvFile = saveEnvFileAsync,
914
- getFs = getFileSystem,
915
- refreshToken: refreshTokenFn = refreshAccessToken,
916
- resolveConfig = resolveConfigAsync,
917
- robotFallback = tryRobotClientFallback,
918
- fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
919
- robotTenantIdCache = defaultRobotTenantIdCache,
920
- robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
921
- loadBreaker = loadRefreshBreaker,
922
- saveBreaker = saveRefreshBreaker,
923
- clearBreaker = clearRefreshBreaker
924
- } = deps;
925
- const robotDeps = {
926
- fetchTenantsAndOrgs,
927
- cache: robotTenantIdCache,
928
- lookupTimeoutMs: robotTenantLookupTimeoutMs
929
- };
930
- if (isRobotAuthEnforced()) {
931
- return resolveRobotEnforcedStatus(robotFallback, robotDeps);
932
- }
933
- if (isEnvAuthEnabled()) {
934
- return readAuthFromEnv();
935
- }
936
- const activeProfile = getActiveAuthProfile();
937
- const activeProfileFilePath = getActiveAuthProfileFilePath();
938
- const usingActiveProfile = activeProfile !== undefined && (options.envFilePath === undefined || options.envFilePath === activeProfileFilePath);
939
- const envFilePath = options.envFilePath ?? activeProfileFilePath ?? DEFAULT_ENV_FILENAME;
940
- const { ensureTokenValidityMinutes } = options;
941
- const { absolutePath } = await resolveEnvFilePath(envFilePath);
942
- if (absolutePath === undefined) {
943
- if (usingActiveProfile) {
944
- return {
945
- loginStatus: "Not logged in",
946
- hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
947
- };
948
- }
949
- return resolveBorrowedRobotStatus(robotFallback, robotDeps);
950
- }
951
- const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
952
- if ("status" in loaded) {
953
- return loaded.status;
954
- }
955
- const { credentials } = loaded;
956
- const globalHint = () => usingActiveProfile ? Promise.resolve(undefined) : getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath);
957
- const expiration = getTokenExpiration(credentials.UIPATH_ACCESS_TOKEN);
958
- const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
959
- let tokens = {
960
- accessToken: credentials.UIPATH_ACCESS_TOKEN,
961
- refreshToken: credentials.UIPATH_REFRESH_TOKEN,
962
- expiration,
963
- lockReleaseFailed: false
964
- };
965
- const refreshToken = credentials.UIPATH_REFRESH_TOKEN;
966
- if (expiration && expiration <= outerThreshold && refreshToken) {
967
- const refreshed = await attemptRefresh({
968
- absolutePath,
969
- credentials,
970
- accessToken: credentials.UIPATH_ACCESS_TOKEN,
971
- refreshToken,
972
- expiration,
973
- ensureTokenValidityMinutes,
974
- getFs,
975
- loadEnvFile,
976
- saveEnvFile,
977
- refreshFn: refreshTokenFn,
978
- resolveConfig,
979
- loadBreaker,
980
- saveBreaker,
981
- clearBreaker,
982
- globalHint
983
- });
984
- if (refreshed.kind === "terminal") {
985
- return refreshed.status;
986
- }
987
- tokens = refreshed.tokens;
988
- }
989
- return buildFileStatus(tokens, credentials, globalHint);
990
- };
991
- async function resolveRobotEnforcedStatus(robotFallback, deps) {
992
- if (isEnvAuthEnabled()) {
993
- throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
994
- }
995
- const robotCreds = await robotFallback({ force: true });
996
- if (!robotCreds) {
997
- return {
998
- loginStatus: "Not logged in",
999
- hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
1000
- };
1001
- }
1002
- return buildRobotStatus(robotCreds, deps);
1003
- }
1004
- async function resolveBorrowedRobotStatus(robotFallback, deps) {
1005
- const robotCreds = await robotFallback();
1006
- return robotCreds ? buildRobotStatus(robotCreds, deps) : { loginStatus: "Not logged in" };
1007
- }
1008
- async function loadFileCredentials(loadEnvFile, absolutePath) {
1009
- let credentials;
1010
- try {
1011
- credentials = await loadEnvFile({ envPath: absolutePath });
1012
- } catch (error) {
1013
- if (isFileNotFoundError(error)) {
1014
- return { status: { loginStatus: "Not logged in" } };
1015
- }
1016
- throw error;
1017
- }
1018
- if (!credentials.UIPATH_ACCESS_TOKEN) {
1019
- return { status: { loginStatus: "Not logged in" } };
1020
- }
1021
- return { credentials };
1022
- }
1023
- async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
1024
- const fs = getFs();
1025
- const globalPath = fs.path.join(fs.env.homedir(), envFilePath);
1026
- if (absolutePath === globalPath)
1027
- return;
1028
- if (!await fs.exists(globalPath))
1029
- return;
1030
- try {
1031
- const globalCreds = await loadEnvFile({ envPath: globalPath });
1032
- if (!globalCreds.UIPATH_ACCESS_TOKEN)
1033
- return;
1034
- const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
1035
- if (globalExp && globalExp <= new Date)
1036
- return;
1037
- return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
1038
- } catch {
1039
- return;
1040
- }
1041
- }
1042
- function computeExpirationThreshold(ensureTokenValidityMinutes) {
1043
- return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
1044
- }
1045
- async function attemptRefresh(ctx) {
1046
- const shortCircuit = await circuitBreakerShortCircuit(ctx);
1047
- if (shortCircuit) {
1048
- return { kind: "terminal", status: shortCircuit };
1049
- }
1050
- let release;
1051
- try {
1052
- release = await ctx.getFs().acquireLock(ctx.absolutePath);
1053
- } catch (error) {
1054
- return {
1055
- kind: "terminal",
1056
- status: await lockAcquireFailureStatus(ctx, error)
1057
- };
1058
- }
1059
- let lockedFailure;
1060
- let lockReleaseFailed = false;
1061
- let success;
1062
- try {
1063
- const outcome = await runRefreshLocked({
1064
- absolutePath: ctx.absolutePath,
1065
- refreshToken: ctx.refreshToken,
1066
- customAuthority: ctx.credentials.UIPATH_URL,
1067
- ensureTokenValidityMinutes: ctx.ensureTokenValidityMinutes,
1068
- loadEnvFile: ctx.loadEnvFile,
1069
- saveEnvFile: ctx.saveEnvFile,
1070
- refreshFn: ctx.refreshFn,
1071
- resolveConfig: ctx.resolveConfig,
1072
- loadBreaker: ctx.loadBreaker,
1073
- saveBreaker: ctx.saveBreaker,
1074
- clearBreaker: ctx.clearBreaker
1075
- });
1076
- if (outcome.kind === "fail") {
1077
- lockedFailure = outcome.status;
1078
- } else {
1079
- success = outcome;
1080
- }
1081
- } finally {
1082
- try {
1083
- await release();
1084
- } catch {
1085
- lockReleaseFailed = true;
1086
- }
1087
- }
1088
- if (lockedFailure) {
1089
- const globalHint = await ctx.globalHint();
1090
- const base = globalHint ? { ...lockedFailure, loginStatus: "Expired", hint: globalHint } : lockedFailure;
1091
- return {
1092
- kind: "terminal",
1093
- status: lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base
1094
- };
1095
- }
1096
- return {
1097
- kind: "refreshed",
1098
- tokens: {
1099
- accessToken: success?.accessToken,
1100
- refreshToken: success?.refreshToken,
1101
- expiration: success?.expiration,
1102
- tokenRefresh: success?.tokenRefresh,
1103
- persistenceWarning: success?.persistenceWarning,
1104
- lockReleaseFailed
1105
- }
1106
- };
1107
- }
1108
- async function buildFileStatus(tokens, credentials, globalHint) {
1109
- const result = {
1110
- loginStatus: tokens.expiration && tokens.expiration <= new Date ? "Expired" : "Logged in",
1111
- accessToken: tokens.accessToken,
1112
- refreshToken: tokens.refreshToken,
1113
- baseUrl: credentials.UIPATH_URL,
1114
- organizationName: credentials.UIPATH_ORGANIZATION_NAME,
1115
- organizationId: credentials.UIPATH_ORGANIZATION_ID,
1116
- tenantName: credentials.UIPATH_TENANT_NAME,
1117
- tenantId: credentials.UIPATH_TENANT_ID,
1118
- expiration: tokens.expiration,
1119
- source: "saved-login" /* SavedLogin */,
1120
- ...identityFields(tokens.accessToken, credentials),
1121
- ...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
1122
- ...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
1123
- ...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
1124
- };
1125
- if (result.loginStatus === "Expired") {
1126
- const hint = await globalHint();
1127
- if (hint) {
1128
- result.hint = hint;
1129
- }
1130
- }
1131
- return result;
1132
- }
1133
- function identityFields(accessToken, credentials) {
1134
- const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1135
- const scopes = readTokenScopes(accessToken);
1136
- return {
1137
- ...identity ? { identity } : {},
1138
- ...scopes ? { scopes } : {}
1139
- };
1140
- }
1141
- async function buildRobotStatus(robotCreds, deps) {
1142
- const identity = resolveSessionIdentity(robotCreds.accessToken);
1143
- const scopes = readTokenScopes(robotCreds.accessToken);
1144
- const tenant = robotCreds.tenantId ? { tenantId: robotCreds.tenantId } : await resolveRobotTenantId(robotCreds, deps);
1145
- return {
1146
- loginStatus: "Logged in",
1147
- accessToken: robotCreds.accessToken,
1148
- baseUrl: robotCreds.baseUrl,
1149
- organizationName: robotCreds.organizationName,
1150
- organizationId: robotCreds.organizationId,
1151
- tenantName: robotCreds.tenantName,
1152
- tenantId: tenant.tenantId,
1153
- issuer: robotCreds.issuer,
1154
- expiration: getTokenExpiration(robotCreds.accessToken),
1155
- source: "robot" /* Robot */,
1156
- ...tenant.hint ? { hint: tenant.hint } : {},
1157
- ...identity ? { identity } : {},
1158
- ...scopes ? { scopes } : {}
1159
- };
1160
- }
1161
- async function resolveRobotTenantId(robotCreds, deps) {
1162
- const { baseUrl, accessToken, tenantName } = robotCreds;
1163
- const organization = robotCreds.organizationName ?? robotCreds.organizationId;
1164
- if (!tenantName || !organization) {
1165
- return {};
1166
- }
1167
- const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
1168
- let pending = deps.cache.get(key);
1169
- if (!pending) {
1170
- pending = catchError(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
1171
- const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
1172
- if (!settled.tenantId) {
1173
- deps.cache.delete(key);
1174
- }
1175
- return settled;
1176
- });
1177
- deps.cache.set(key, pending);
1178
- }
1179
- return pending;
1180
- }
1181
- async function lookupRobotTenantId(target, deps) {
1182
- const { baseUrl, accessToken, organization, tenantName } = target;
1183
- const [error, data] = await catchError(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
1184
- if (error) {
1185
- const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
1186
- return { hint: tenantLookupFailureHint(tenantName, reason) };
1187
- }
1188
- const rows = data?.tenants;
1189
- const tenants = Array.isArray(rows) ? rows.filter((tenant) => typeof tenant?.id === "string" && typeof tenant?.name === "string") : [];
1190
- const wantedName = decodePathSegment(tenantName);
1191
- const wanted = wantedName.toLowerCase();
1192
- const match = tenants.find((tenant) => tenant.name === wantedName) ?? tenants.find((tenant) => tenant.name.toLowerCase() === wanted);
1193
- if (!match) {
1194
- const names = tenants.map((tenant) => tenant.name).join(", ");
1195
- return {
1196
- hint: `The Robot session targets tenant '${tenantName}', but ` + `organization '${organization}' lists no tenant of that name` + `${names ? ` (available: ${names})` : ""}. Commands that need ` + `the tenant id will fail until it can be resolved.`
1197
- };
1198
- }
1199
- return { tenantId: match.id };
1200
- }
1201
- function tenantLookupFailureHint(tenantName, reason) {
1202
- return `Could not resolve the id of tenant '${tenantName}' from the ` + `Robot session: ${reason} Commands that need the tenant id will ` + `fail until it can be resolved.`;
1203
- }
1204
- function decodePathSegment(segment) {
1205
- const [error, decoded] = catchError(() => decodeURIComponent(segment));
1206
- return error ? segment : decoded;
1207
- }
1208
- var isFileNotFoundError = (error) => {
1209
- if (!(error instanceof Object))
1210
- return false;
1211
- return error.code === "ENOENT";
1212
- };
1213
- async function circuitBreakerShortCircuit(ctx) {
1214
- const {
1215
- absolutePath,
1216
- refreshToken,
1217
- accessToken,
1218
- credentials,
1219
- expiration,
1220
- loadBreaker,
1221
- saveBreaker,
1222
- clearBreaker
1223
- } = ctx;
1224
- const fingerprint = await refreshTokenFingerprint(refreshToken);
1225
- const breaker = await loadBreaker(absolutePath).catch(() => ({}));
1226
- if (breaker.deadTokenFp && breaker.deadTokenFp !== fingerprint) {
1227
- await clearBreaker(absolutePath);
1228
- breaker.deadTokenFp = undefined;
1229
- }
1230
- const nowMs = Date.now();
1231
- const tokenIsDead = breaker.deadTokenFp === fingerprint;
1232
- const inBackoff = breaker.backoffUntilMs !== undefined && nowMs < breaker.backoffUntilMs;
1233
- if (!tokenIsDead && !inBackoff)
1234
- return;
1235
- const globalHint = await ctx.globalHint();
1236
- const suppressed = !shouldSurface(breaker, nowMs);
1237
- if (!suppressed) {
1238
- await saveBreaker(absolutePath, {
1239
- ...breaker,
1240
- lastSurfacedAtMs: nowMs
1241
- });
1242
- }
1243
- const deadHint = "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>.";
1244
- const backoffHint = "Token refresh is temporarily backed off after a recent network error and will retry automatically once the backoff window elapses.";
1245
- return {
1246
- loginStatus: globalHint ? "Expired" : "Refresh Failed",
1247
- ...globalHint ? {
1248
- accessToken,
1249
- refreshToken,
1250
- baseUrl: credentials.UIPATH_URL,
1251
- organizationName: credentials.UIPATH_ORGANIZATION_NAME,
1252
- organizationId: credentials.UIPATH_ORGANIZATION_ID,
1253
- tenantName: credentials.UIPATH_TENANT_NAME,
1254
- tenantId: credentials.UIPATH_TENANT_ID,
1255
- expiration,
1256
- source: "saved-login" /* SavedLogin */,
1257
- ...identityFields(accessToken, credentials)
1258
- } : {},
1259
- hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
1260
- refreshCircuitOpen: true,
1261
- refreshTelemetrySuppressed: suppressed,
1262
- tokenRefresh: { attempted: false, success: false }
1263
- };
1264
- }
1265
- async function lockAcquireFailureStatus(ctx, error) {
1266
- const msg = errorMessage(error);
1267
- const globalHint = await ctx.globalHint();
1268
- if (globalHint) {
1269
- return {
1270
- loginStatus: "Expired",
1271
- accessToken: ctx.accessToken,
1272
- refreshToken: ctx.refreshToken,
1273
- baseUrl: ctx.credentials.UIPATH_URL,
1274
- organizationName: ctx.credentials.UIPATH_ORGANIZATION_NAME,
1275
- organizationId: ctx.credentials.UIPATH_ORGANIZATION_ID,
1276
- tenantName: ctx.credentials.UIPATH_TENANT_NAME,
1277
- tenantId: ctx.credentials.UIPATH_TENANT_ID,
1278
- expiration: ctx.expiration,
1279
- source: "saved-login" /* SavedLogin */,
1280
- ...identityFields(ctx.accessToken, ctx.credentials),
1281
- hint: globalHint,
1282
- tokenRefresh: {
1283
- attempted: false,
1284
- success: false,
1285
- errorMessage: `lock acquisition failed: ${msg}`
1286
- }
1287
- };
1288
- }
1289
- return {
1290
- loginStatus: "Refresh Failed",
1291
- hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
1292
- tokenRefresh: {
1293
- attempted: false,
1294
- success: false,
1295
- errorMessage: `lock acquisition failed: ${msg}`
1296
- }
1297
- };
1298
- }
1299
- async function runRefreshLocked(inputs) {
1300
- const {
1301
- absolutePath,
1302
- refreshToken: callerRefreshToken,
1303
- customAuthority,
1304
- ensureTokenValidityMinutes,
1305
- loadEnvFile,
1306
- saveEnvFile,
1307
- refreshFn,
1308
- resolveConfig,
1309
- loadBreaker,
1310
- saveBreaker,
1311
- clearBreaker
1312
- } = inputs;
1313
- const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
1314
- let fresh;
1315
- try {
1316
- fresh = await loadEnvFile({ envPath: absolutePath });
1317
- } catch (error) {
1318
- return {
1319
- kind: "fail",
1320
- status: {
1321
- loginStatus: "Refresh Failed",
1322
- hint: "Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",
1323
- tokenRefresh: {
1324
- attempted: false,
1325
- success: false,
1326
- errorMessage: `auth file read failed: ${errorMessage(error)}`
1327
- }
1328
- }
1329
- };
1330
- }
1331
- const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
1332
- const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
1333
- if (freshAccess && freshExp && freshExp > expirationThreshold) {
1334
- await clearBreaker(absolutePath);
1335
- return {
1336
- kind: "ok",
1337
- accessToken: freshAccess,
1338
- refreshToken: fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken,
1339
- expiration: freshExp,
1340
- tokenRefresh: { attempted: false, success: true }
1341
- };
1342
- }
1343
- const tokenForIdP = fresh.UIPATH_REFRESH_TOKEN ?? callerRefreshToken;
1344
- let refreshedAccess;
1345
- let refreshedRefresh;
1346
- try {
1347
- const config = await resolveConfig({ customAuthority });
1348
- const refreshed = await refreshFn({
1349
- refreshToken: tokenForIdP,
1350
- tokenEndpoint: config.tokenEndpoint,
1351
- clientId: config.clientId,
1352
- expectedAuthority: customAuthority
1353
- });
1354
- refreshedAccess = refreshed.accessToken;
1355
- refreshedRefresh = refreshed.refreshToken;
1356
- } catch (error) {
1357
- const isOAuthFailure = isTokenRefreshOAuthFailure(error);
1358
- const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
1359
- const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
1360
- const fp = await refreshTokenFingerprint(tokenForIdP);
1361
- if (isOAuthFailure) {
1362
- await saveBreaker(absolutePath, { deadTokenFp: fp });
1363
- } else {
1364
- const prior = await loadBreaker(absolutePath).catch(() => ({}));
1365
- const attempts = (prior.attempts ?? 0) + 1;
1366
- await saveBreaker(absolutePath, {
1367
- ...prior,
1368
- deadTokenFp: undefined,
1369
- attempts,
1370
- backoffUntilMs: Date.now() + nextBackoffMs(attempts)
1371
- });
1372
- }
1373
- return {
1374
- kind: "fail",
1375
- status: {
1376
- loginStatus: "Refresh Failed",
1377
- hint,
1378
- tokenRefresh: {
1379
- attempted: true,
1380
- success: false,
1381
- errorMessage: message
1382
- }
1383
- }
1384
- };
1385
- }
1386
- const refreshedExp = getTokenExpiration(refreshedAccess);
1387
- if (!refreshedExp || refreshedExp <= new Date) {
1388
- return {
1389
- kind: "fail",
1390
- status: {
1391
- loginStatus: "Refresh Failed",
1392
- hint: "The identity server returned an unusable token. Run 'uip login' to re-authenticate.",
1393
- tokenRefresh: {
1394
- attempted: true,
1395
- success: false,
1396
- errorMessage: "refreshed token has no valid expiration claim"
1397
- }
1398
- }
1399
- };
1400
- }
1401
- await clearBreaker(absolutePath);
1402
- try {
1403
- await saveEnvFile({
1404
- envPath: absolutePath,
1405
- data: {
1406
- UIPATH_ACCESS_TOKEN: refreshedAccess,
1407
- UIPATH_REFRESH_TOKEN: refreshedRefresh
1408
- },
1409
- merge: true
1410
- });
1411
- return {
1412
- kind: "ok",
1413
- accessToken: refreshedAccess,
1414
- refreshToken: refreshedRefresh,
1415
- expiration: refreshedExp,
1416
- tokenRefresh: { attempted: true, success: true }
1417
- };
1418
- } catch (error) {
1419
- const msg = errorMessage(error);
1420
- return {
1421
- kind: "ok",
1422
- accessToken: refreshedAccess,
1423
- refreshToken: refreshedRefresh,
1424
- expiration: refreshedExp,
1425
- persistenceWarning: `Access token refreshed in memory but could not be written to ${absolutePath}: ${msg}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,
1426
- tokenRefresh: {
1427
- attempted: true,
1428
- success: true,
1429
- errorMessage: `persistence failed: ${msg}`
1430
- }
1431
- };
1432
- }
1433
- }
1434
- function normalizeTokenRefreshFailure() {
1435
- return "stored refresh token is invalid or expired";
1436
- }
1437
- function normalizeTokenRefreshUnavailableFailure() {
1438
- return "token refresh failed before authentication completed";
1439
- }
1440
- function errorMessage(error) {
1441
- return error instanceof Error ? error.message : String(error);
1442
- }
1443
-
1444
- // ../auth/src/authContext.ts
1445
- var getAuthContext = async (options = {}) => {
1446
- const status = await getLoginStatusAsync({
1447
- ensureTokenValidityMinutes: options.ensureTokenValidityMinutes,
1448
- envFilePath: options.envFilePath
1449
- });
1450
- if (status.loginStatus !== "Logged in" || !status.baseUrl || !status.accessToken) {
1451
- throw new Error(status.hint ? `Not logged in. ${status.hint}` : "Not logged in. Run 'uip login' first.");
1452
- }
1453
- const tenantName = options.tenant ?? status.tenantName;
1454
- if (options.requireOrganizationId && !status.organizationId) {
1455
- throw new Error("Organization ID not available. Ensure you are logged in with an organization context.");
1456
- }
1457
- if (options.requireOrganizationName && !status.organizationName) {
1458
- throw new Error("Organization name not available. Ensure you are logged in with an organization context.");
1459
- }
1460
- if (options.requireTenantId && !status.tenantId) {
1461
- throw new Error("Tenant ID not available. Ensure UIPATH_TENANT_ID is set.");
1462
- }
1463
- if (options.requireTenantName && tenantName === undefined) {
1464
- throw new Error("Tenant not provided and UIPATH_TENANT_NAME not set. Run 'uip login' to select a tenant, or use 'uip login tenant set <tenant>' to switch tenants.");
1465
- }
1466
- return {
1467
- baseUrl: status.baseUrl,
1468
- accessToken: status.accessToken,
1469
- organizationId: status.organizationId,
1470
- organizationName: status.organizationName,
1471
- tenantId: status.tenantId,
1472
- tenantName,
1473
- identity: status.identity
1474
- };
1475
- };
1476
- // ../auth/src/selectTenant.ts
1477
- var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
1478
- var INVALID_TENANT_CODE = "INVALID_TENANT";
1479
- var TENANT_SELECTION_CODES = new Set([
1480
- TENANT_SELECTION_REQUIRED_CODE,
1481
- INVALID_TENANT_CODE
1482
- ]);
1483
- // ../orchestrator-sdk/generated/src/runtime.ts
1484
- var BASE_PATH = "https://alpha.uipath.com/Ada/byoa/orchestrator_".replace(/\/+$/, "");
1485
-
1486
- class Configuration {
1487
- configuration;
1488
- constructor(configuration = {}) {
1489
- this.configuration = configuration;
1490
- }
1491
- set config(configuration) {
1492
- this.configuration = configuration;
1493
- }
1494
- get basePath() {
1495
- return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
1496
- }
1497
- get fetchApi() {
1498
- return this.configuration.fetchApi;
1499
- }
1500
- get middleware() {
1501
- return this.configuration.middleware || [];
1502
- }
1503
- get queryParamsStringify() {
1504
- return this.configuration.queryParamsStringify || querystring;
1505
- }
1506
- get username() {
1507
- return this.configuration.username;
1508
- }
1509
- get password() {
1510
- return this.configuration.password;
1511
- }
1512
- get apiKey() {
1513
- const apiKey = this.configuration.apiKey;
1514
- if (apiKey) {
1515
- return typeof apiKey === "function" ? apiKey : () => apiKey;
1516
- }
1517
- return;
1518
- }
1519
- get accessToken() {
1520
- const accessToken = this.configuration.accessToken;
1521
- if (accessToken) {
1522
- return typeof accessToken === "function" ? accessToken : async () => accessToken;
1523
- }
1524
- return;
1525
- }
1526
- get headers() {
1527
- return this.configuration.headers;
1528
- }
1529
- get credentials() {
1530
- return this.configuration.credentials;
1531
- }
1532
- }
1533
- var DefaultConfig = new Configuration;
1534
-
1535
- class BaseAPI {
1536
- configuration;
1537
- static jsonRegex = new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$", "i");
1538
- middleware;
1539
- constructor(configuration = DefaultConfig) {
1540
- this.configuration = configuration;
1541
- this.middleware = configuration.middleware;
1542
- }
1543
- withMiddleware(...middlewares) {
1544
- const next = this.clone();
1545
- next.middleware = next.middleware.concat(...middlewares);
1546
- return next;
1547
- }
1548
- withPreMiddleware(...preMiddlewares) {
1549
- const middlewares = preMiddlewares.map((pre) => ({ pre }));
1550
- return this.withMiddleware(...middlewares);
1551
- }
1552
- withPostMiddleware(...postMiddlewares) {
1553
- const middlewares = postMiddlewares.map((post) => ({ post }));
1554
- return this.withMiddleware(...middlewares);
1555
- }
1556
- isJsonMime(mime) {
1557
- if (!mime) {
1558
- return false;
1559
- }
1560
- return BaseAPI.jsonRegex.test(mime);
1561
- }
1562
- async request(context, initOverrides) {
1563
- const { url, init } = await this.createFetchParams(context, initOverrides);
1564
- const response = await this.fetchApi(url, init);
1565
- if (response && (response.status >= 200 && response.status < 300)) {
1566
- return response;
1567
- }
1568
- throw new ResponseError(response, "Response returned an error code");
1569
- }
1570
- async createFetchParams(context, initOverrides) {
1571
- let url = this.configuration.basePath + context.path;
1572
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
1573
- url += "?" + this.configuration.queryParamsStringify(context.query);
1574
- }
1575
- const headers = Object.assign({}, this.configuration.headers, context.headers);
1576
- Object.keys(headers).forEach((key) => headers[key] === undefined ? delete headers[key] : {});
1577
- const initOverrideFn = typeof initOverrides === "function" ? initOverrides : async () => initOverrides;
1578
- const initParams = {
1579
- method: context.method,
1580
- headers,
1581
- body: context.body,
1582
- credentials: this.configuration.credentials
1583
- };
1584
- const overriddenInit = {
1585
- ...initParams,
1586
- ...await initOverrideFn({
1587
- init: initParams,
1588
- context
1589
- })
1590
- };
1591
- let body;
1592
- if (isFormData(overriddenInit.body) || overriddenInit.body instanceof URLSearchParams || isBlob(overriddenInit.body)) {
1593
- body = overriddenInit.body;
1594
- } else if (this.isJsonMime(headers["Content-Type"])) {
1595
- body = JSON.stringify(overriddenInit.body);
1596
- } else {
1597
- body = overriddenInit.body;
1598
- }
1599
- const init = {
1600
- ...overriddenInit,
1601
- body
1602
- };
1603
- return { url, init };
1604
- }
1605
- fetchApi = async (url, init) => {
1606
- let fetchParams = { url, init };
1607
- for (const middleware of this.middleware) {
1608
- if (middleware.pre) {
1609
- fetchParams = await middleware.pre({
1610
- fetch: this.fetchApi,
1611
- ...fetchParams
1612
- }) || fetchParams;
1613
- }
1614
- }
1615
- let response = undefined;
1616
- try {
1617
- response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
1618
- } catch (e) {
1619
- for (const middleware of this.middleware) {
1620
- if (middleware.onError) {
1621
- response = await middleware.onError({
1622
- fetch: this.fetchApi,
1623
- url: fetchParams.url,
1624
- init: fetchParams.init,
1625
- error: e,
1626
- response: response ? response.clone() : undefined
1627
- }) || response;
1628
- }
1629
- }
1630
- if (response === undefined) {
1631
- if (e instanceof Error) {
1632
- throw new FetchError(e, "The request failed and the interceptors did not return an alternative response");
1633
- } else {
1634
- throw e;
1635
- }
1636
- }
1637
- }
1638
- for (const middleware of this.middleware) {
1639
- if (middleware.post) {
1640
- response = await middleware.post({
1641
- fetch: this.fetchApi,
1642
- url: fetchParams.url,
1643
- init: fetchParams.init,
1644
- response: response.clone()
1645
- }) || response;
1646
- }
1647
- }
1648
- return response;
1649
- };
1650
- clone() {
1651
- const constructor = this.constructor;
1652
- const next = new constructor(this.configuration);
1653
- next.middleware = this.middleware.slice();
1654
- return next;
1655
- }
1656
- }
1657
- function isBlob(value) {
1658
- return typeof Blob !== "undefined" && value instanceof Blob;
1659
- }
1660
- function isFormData(value) {
1661
- return typeof FormData !== "undefined" && value instanceof FormData;
1662
- }
1663
-
1664
- class ResponseError extends Error {
1665
- response;
1666
- name = "ResponseError";
1667
- constructor(response, msg) {
1668
- super(msg);
1669
- this.response = response;
1670
- }
1671
- }
1672
-
1673
- class FetchError extends Error {
1674
- cause;
1675
- name = "FetchError";
1676
- constructor(cause, msg) {
1677
- super(msg);
1678
- this.cause = cause;
1679
- }
1680
- }
1681
-
1682
- class RequiredError extends Error {
1683
- field;
1684
- name = "RequiredError";
1685
- constructor(field, msg) {
1686
- super(msg);
1687
- this.field = field;
1688
- }
1689
- }
1690
- function querystring(params, prefix = "") {
1691
- return Object.keys(params).map((key) => querystringSingleKey(key, params[key], prefix)).filter((part) => part.length > 0).join("&");
1692
- }
1693
- function querystringSingleKey(key, value, keyPrefix = "") {
1694
- const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
1695
- if (value instanceof Array) {
1696
- const multiValue = value.map((singleValue) => encodeURIComponent(String(singleValue))).join(`&${encodeURIComponent(fullKey)}=`);
1697
- return `${encodeURIComponent(fullKey)}=${multiValue}`;
1698
- }
1699
- if (value instanceof Set) {
1700
- const valueAsArray = Array.from(value);
1701
- return querystringSingleKey(key, valueAsArray, keyPrefix);
1702
- }
1703
- if (value instanceof Date) {
1704
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
1705
- }
1706
- if (value instanceof Object) {
1707
- return querystring(value, fullKey);
1708
- }
1709
- return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
1710
- }
1711
- class JSONApiResponse {
1712
- raw;
1713
- transformer;
1714
- constructor(raw, transformer = (jsonValue) => jsonValue) {
1715
- this.raw = raw;
1716
- this.transformer = transformer;
1717
- }
1718
- async value() {
1719
- return this.transformer(await this.raw.json());
1720
- }
1721
- }
1722
-
1723
- class VoidApiResponse {
1724
- raw;
1725
- constructor(raw) {
1726
- this.raw = raw;
1727
- }
1728
- async value() {
1729
- return;
1730
- }
1731
- }
1732
-
1733
- // ../orchestrator-sdk/generated/src/models/SimpleFolderDto.ts
1734
- function SimpleFolderDtoFromJSON(json) {
1735
- return SimpleFolderDtoFromJSONTyped(json, false);
1736
- }
1737
- function SimpleFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
1738
- if (json == null) {
1739
- return json;
1740
- }
1741
- return {
1742
- displayName: json["DisplayName"] == null ? undefined : json["DisplayName"],
1743
- fullyQualifiedName: json["FullyQualifiedName"] == null ? undefined : json["FullyQualifiedName"],
1744
- id: json["Id"] == null ? undefined : json["Id"]
1745
- };
1746
- }
1747
- // ../orchestrator-sdk/generated/src/models/TagDto.ts
1748
- function TagDtoFromJSON(json) {
1749
- return TagDtoFromJSONTyped(json, false);
1750
- }
1751
- function TagDtoFromJSONTyped(json, ignoreDiscriminator) {
1752
- if (json == null) {
1753
- return json;
1754
- }
1755
- return {
1756
- name: json["Name"],
1757
- displayName: json["DisplayName"] == null ? undefined : json["DisplayName"],
1758
- value: json["Value"] == null ? undefined : json["Value"],
1759
- displayValue: json["DisplayValue"] == null ? undefined : json["DisplayValue"]
1760
- };
1761
- }
1762
- // ../orchestrator-sdk/generated/src/models/AttendedRobotDto.ts
1763
- function AttendedRobotDtoFromJSON(json) {
1764
- return AttendedRobotDtoFromJSONTyped(json, false);
1765
- }
1766
- function AttendedRobotDtoFromJSONTyped(json, ignoreDiscriminator) {
1767
- if (json == null) {
1768
- return json;
1769
- }
1770
- return {
1771
- userName: json["UserName"] == null ? undefined : json["UserName"],
1772
- executionSettings: json["ExecutionSettings"] == null ? undefined : json["ExecutionSettings"],
1773
- robotId: json["RobotId"] == null ? undefined : json["RobotId"],
1774
- robotType: json["RobotType"] == null ? undefined : json["RobotType"]
1775
- };
1776
- }
1777
- function AttendedRobotDtoToJSON(json) {
1778
- return AttendedRobotDtoToJSONTyped(json, false);
1779
- }
1780
- function AttendedRobotDtoToJSONTyped(value, ignoreDiscriminator = false) {
1781
- if (value == null) {
1782
- return value;
1783
- }
1784
- return {
1785
- UserName: value["userName"],
1786
- ExecutionSettings: value["executionSettings"],
1787
- RobotId: value["robotId"],
1788
- RobotType: value["robotType"]
1789
- };
1790
- }
1791
- // ../orchestrator-sdk/generated/src/models/BusinessRuleVersionDto.ts
1792
- function BusinessRuleVersionDtoFromJSON(json) {
1793
- return BusinessRuleVersionDtoFromJSONTyped(json, false);
1794
- }
1795
- function BusinessRuleVersionDtoFromJSONTyped(json, ignoreDiscriminator) {
1796
- if (json == null) {
1797
- return json;
1798
- }
1799
- return {
1800
- businessRuleKey: json["BusinessRuleKey"] == null ? undefined : json["BusinessRuleKey"],
1801
- versionNumber: json["VersionNumber"] == null ? undefined : json["VersionNumber"],
1802
- creatorUserId: json["CreatorUserId"] == null ? undefined : json["CreatorUserId"],
1803
- isActive: json["IsActive"] == null ? undefined : json["IsActive"],
1804
- creationTime: json["CreationTime"] == null ? undefined : new Date(json["CreationTime"]),
1805
- id: json["Id"] == null ? undefined : json["Id"]
1806
- };
1807
- }
1808
-
1809
- // ../orchestrator-sdk/generated/src/models/BusinessRuleDto.ts
1810
- function BusinessRuleDtoFromJSON(json) {
1811
- return BusinessRuleDtoFromJSONTyped(json, false);
1812
- }
1813
- function BusinessRuleDtoFromJSONTyped(json, ignoreDiscriminator) {
1814
- if (json == null) {
1815
- return json;
1816
- }
1817
- return {
1818
- name: json["Name"],
1819
- description: json["Description"] == null ? undefined : json["Description"],
1820
- currentVersion: json["CurrentVersion"] == null ? undefined : BusinessRuleVersionDtoFromJSON(json["CurrentVersion"]),
1821
- foldersCount: json["FoldersCount"] == null ? undefined : json["FoldersCount"],
1822
- tags: json["Tags"] == null ? undefined : json["Tags"].map(TagDtoFromJSON),
1823
- lastModificationTime: json["LastModificationTime"] == null ? undefined : new Date(json["LastModificationTime"]),
1824
- lastModifierUserId: json["LastModifierUserId"] == null ? undefined : json["LastModifierUserId"],
1825
- creationTime: json["CreationTime"] == null ? undefined : new Date(json["CreationTime"]),
1826
- creatorUserId: json["CreatorUserId"] == null ? undefined : json["CreatorUserId"],
1827
- id: json["Id"] == null ? undefined : json["Id"]
1828
- };
1829
- }
1830
- // ../orchestrator-sdk/generated/src/models/CurrentUserFolderDto.ts
1831
- function CurrentUserFolderDtoFromJSON(json) {
1832
- return CurrentUserFolderDtoFromJSONTyped(json, false);
1833
- }
1834
- function CurrentUserFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
1835
- if (json == null) {
1836
- return json;
1837
- }
1838
- return {
1839
- key: json["Key"] == null ? undefined : json["Key"],
1840
- displayName: json["DisplayName"] == null ? undefined : json["DisplayName"],
1841
- fullyQualifiedName: json["FullyQualifiedName"] == null ? undefined : json["FullyQualifiedName"],
1842
- description: json["Description"] == null ? undefined : json["Description"],
1843
- folderType: json["FolderType"] == null ? undefined : json["FolderType"],
1844
- parentId: json["ParentId"] == null ? undefined : json["ParentId"],
1845
- parentKey: json["ParentKey"] == null ? undefined : json["ParentKey"],
1846
- id: json["Id"] == null ? undefined : json["Id"]
1847
- };
1848
- }
1849
- // ../orchestrator-sdk/generated/src/models/MachineVpnSettingsDto.ts
1850
- function MachineVpnSettingsDtoFromJSON(json) {
1851
- return MachineVpnSettingsDtoFromJSONTyped(json, false);
1852
- }
1853
- function MachineVpnSettingsDtoFromJSONTyped(json, ignoreDiscriminator) {
1854
- if (json == null) {
1855
- return json;
1856
- }
1857
- return {
1858
- cidr: json["cidr"] == null ? undefined : json["cidr"]
1859
- };
1860
- }
1861
-
1862
- // ../orchestrator-sdk/generated/src/models/MaintenanceWindowDto.ts
1863
- function MaintenanceWindowDtoFromJSON(json) {
1864
- return MaintenanceWindowDtoFromJSONTyped(json, false);
1865
- }
1866
- function MaintenanceWindowDtoFromJSONTyped(json, ignoreDiscriminator) {
1867
- if (json == null) {
1868
- return json;
1869
- }
1870
- return {
1871
- enabled: json["enabled"] == null ? undefined : json["enabled"],
1872
- jobStopStrategy: json["jobStopStrategy"] == null ? undefined : json["jobStopStrategy"],
1873
- cronExpression: json["cronExpression"] == null ? undefined : json["cronExpression"],
1874
- timezoneId: json["timezoneId"] == null ? undefined : json["timezoneId"],
1875
- duration: json["duration"] == null ? undefined : json["duration"],
1876
- nextExecutionTime: json["nextExecutionTime"] == null ? undefined : new Date(json["nextExecutionTime"])
1877
- };
1878
- }
1879
-
1880
- // ../orchestrator-sdk/generated/src/models/UpdateInfoDto.ts
1881
- function UpdateInfoDtoFromJSON(json) {
1882
- return UpdateInfoDtoFromJSONTyped(json, false);
1883
- }
1884
- function UpdateInfoDtoFromJSONTyped(json, ignoreDiscriminator) {
1885
- if (json == null) {
1886
- return json;
1887
- }
1888
- return {
1889
- updateStatus: json["updateStatus"] == null ? undefined : json["updateStatus"],
1890
- reason: json["reason"] == null ? undefined : json["reason"],
1891
- targetUpdateVersion: json["targetUpdateVersion"] == null ? undefined : json["targetUpdateVersion"],
1892
- isCommunity: json["isCommunity"] == null ? undefined : json["isCommunity"],
1893
- statusInfo: json["statusInfo"] == null ? undefined : json["statusInfo"]
1894
- };
1895
- }
1896
-
1897
- // ../orchestrator-sdk/generated/src/models/MachinesRobotVersionDto.ts
1898
- function MachinesRobotVersionDtoFromJSON(json) {
1899
- return MachinesRobotVersionDtoFromJSONTyped(json, false);
1900
- }
1901
- function MachinesRobotVersionDtoFromJSONTyped(json, ignoreDiscriminator) {
1902
- if (json == null) {
1903
- return json;
1904
- }
1905
- return {
1906
- count: json["Count"] == null ? undefined : json["Count"],
1907
- version: json["Version"] == null ? undefined : json["Version"],
1908
- machineId: json["MachineId"] == null ? undefined : json["MachineId"]
1909
- };
1910
- }
1911
-
1912
- // ../orchestrator-sdk/generated/src/models/UpdatePolicyDto.ts
1913
- function UpdatePolicyDtoFromJSON(json) {
1914
- return UpdatePolicyDtoFromJSONTyped(json, false);
1915
- }
1916
- function UpdatePolicyDtoFromJSONTyped(json, ignoreDiscriminator) {
1917
- if (json == null) {
1918
- return json;
1919
- }
1920
- return {
1921
- type: json["Type"] == null ? undefined : json["Type"],
1922
- specificVersion: json["SpecificVersion"] == null ? undefined : json["SpecificVersion"]
1923
- };
1924
- }
1925
- function UpdatePolicyDtoToJSON(json) {
1926
- return UpdatePolicyDtoToJSONTyped(json, false);
1927
- }
1928
- function UpdatePolicyDtoToJSONTyped(value, ignoreDiscriminator = false) {
1929
- if (value == null) {
1930
- return value;
1931
- }
1932
- return {
1933
- Type: value["type"],
1934
- SpecificVersion: value["specificVersion"]
1935
- };
1936
- }
1937
-
1938
- // ../orchestrator-sdk/generated/src/models/RobotUserDto.ts
1939
- function RobotUserDtoFromJSON(json) {
1940
- return RobotUserDtoFromJSONTyped(json, false);
1941
- }
1942
- function RobotUserDtoFromJSONTyped(json, ignoreDiscriminator) {
1943
- if (json == null) {
1944
- return json;
1945
- }
1946
- return {
1947
- userName: json["UserName"] == null ? undefined : json["UserName"],
1948
- robotId: json["RobotId"],
1949
- hasTriggers: json["HasTriggers"] == null ? undefined : json["HasTriggers"]
1950
- };
1951
- }
1952
- // ../orchestrator-sdk/generated/src/models/MachineAssignmentsDto.ts
1953
- function MachineAssignmentsDtoToJSON(json) {
1954
- return MachineAssignmentsDtoToJSONTyped(json, false);
1955
- }
1956
- function MachineAssignmentsDtoToJSONTyped(value, ignoreDiscriminator = false) {
1957
- if (value == null) {
1958
- return value;
1959
- }
1960
- return {
1961
- MachineIds: value["machineIds"],
1962
- FolderIds: value["folderIds"]
1963
- };
1964
- }
1965
-
1966
- // ../orchestrator-sdk/generated/src/models/FolderAssignMachinesRequest.ts
1967
- function FolderAssignMachinesRequestToJSON(json) {
1968
- return FolderAssignMachinesRequestToJSONTyped(json, false);
1969
- }
1970
- function FolderAssignMachinesRequestToJSONTyped(value, ignoreDiscriminator = false) {
1971
- if (value == null) {
1972
- return value;
1973
- }
1974
- return {
1975
- assignments: MachineAssignmentsDtoToJSON(value["assignments"])
1976
- };
1977
- }
1978
- // ../orchestrator-sdk/generated/src/models/FolderRolesDto.ts
1979
- function FolderRolesDtoToJSON(json) {
1980
- return FolderRolesDtoToJSONTyped(json, false);
1981
- }
1982
- function FolderRolesDtoToJSONTyped(value, ignoreDiscriminator = false) {
1983
- if (value == null) {
1984
- return value;
1985
- }
1986
- return {
1987
- FolderId: value["folderId"],
1988
- RoleIds: value["roleIds"]
1989
- };
1990
- }
1991
-
1992
- // ../orchestrator-sdk/generated/src/models/UserAssignmentsDto.ts
1993
- function UserAssignmentsDtoToJSON(json) {
1994
- return UserAssignmentsDtoToJSONTyped(json, false);
1995
- }
1996
- function UserAssignmentsDtoToJSONTyped(value, ignoreDiscriminator = false) {
1997
- if (value == null) {
1998
- return value;
1999
- }
2000
- return {
2001
- UserIds: value["userIds"],
2002
- RolesPerFolder: value["rolesPerFolder"] == null ? undefined : value["rolesPerFolder"].map(FolderRolesDtoToJSON)
2003
- };
2004
- }
2005
-
2006
- // ../orchestrator-sdk/generated/src/models/FolderAssignUsersRequest.ts
2007
- function FolderAssignUsersRequestToJSON(json) {
2008
- return FolderAssignUsersRequestToJSONTyped(json, false);
2009
- }
2010
- function FolderAssignUsersRequestToJSONTyped(value, ignoreDiscriminator = false) {
2011
- if (value == null) {
2012
- return value;
2013
- }
2014
- return {
2015
- assignments: UserAssignmentsDtoToJSON(value["assignments"])
2016
- };
2017
- }
2018
- // ../orchestrator-sdk/generated/src/models/SimpleUserEntityDto.ts
2019
- function SimpleUserEntityDtoFromJSON(json) {
2020
- return SimpleUserEntityDtoFromJSONTyped(json, false);
2021
- }
2022
- function SimpleUserEntityDtoFromJSONTyped(json, ignoreDiscriminator) {
2023
- if (json == null) {
2024
- return json;
2025
- }
2026
- return {
2027
- key: json["Key"] == null ? undefined : json["Key"],
2028
- userName: json["UserName"] == null ? undefined : json["UserName"],
2029
- isInherited: json["IsInherited"] == null ? undefined : json["IsInherited"],
2030
- assignedToFolderIds: json["AssignedToFolderIds"] == null ? undefined : json["AssignedToFolderIds"],
2031
- mayHaveAttended: json["MayHaveAttended"] == null ? undefined : json["MayHaveAttended"],
2032
- mayHaveUnattended: json["MayHaveUnattended"] == null ? undefined : json["MayHaveUnattended"],
2033
- type: json["Type"] == null ? undefined : json["Type"],
2034
- source: json["Source"] == null ? undefined : json["Source"],
2035
- isActive: json["IsActive"] == null ? undefined : json["IsActive"],
2036
- id: json["Id"] == null ? undefined : json["Id"]
2037
- };
2038
- }
2039
-
2040
- // ../orchestrator-sdk/generated/src/models/RoleUsersDto.ts
2041
- function RoleUsersDtoFromJSON(json) {
2042
- return RoleUsersDtoFromJSONTyped(json, false);
2043
- }
2044
- function RoleUsersDtoFromJSONTyped(json, ignoreDiscriminator) {
2045
- if (json == null) {
2046
- return json;
2047
- }
2048
- return {
2049
- name: json["Name"] == null ? undefined : json["Name"],
2050
- users: json["Users"] == null ? undefined : json["Users"].map(SimpleUserEntityDtoFromJSON),
2051
- id: json["Id"] == null ? undefined : json["Id"]
2052
- };
2053
- }
2054
-
2055
- // ../orchestrator-sdk/generated/src/models/FolderAssignmentsDto.ts
2056
- function FolderAssignmentsDtoFromJSON(json) {
2057
- return FolderAssignmentsDtoFromJSONTyped(json, false);
2058
- }
2059
- function FolderAssignmentsDtoFromJSONTyped(json, ignoreDiscriminator) {
2060
- if (json == null) {
2061
- return json;
2062
- }
2063
- return {
2064
- folder: json["Folder"] == null ? undefined : SimpleFolderDtoFromJSON(json["Folder"]),
2065
- roles: json["Roles"] == null ? undefined : json["Roles"].map(RoleUsersDtoFromJSON)
2066
- };
2067
- }
2068
- // ../orchestrator-sdk/generated/src/models/FolderDto.ts
2069
- function FolderDtoFromJSON(json) {
2070
- return FolderDtoFromJSONTyped(json, false);
2071
- }
2072
- function FolderDtoFromJSONTyped(json, ignoreDiscriminator) {
2073
- if (json == null) {
2074
- return json;
2075
- }
2076
- return {
2077
- key: json["Key"] == null ? undefined : json["Key"],
2078
- displayName: json["DisplayName"],
2079
- fullyQualifiedName: json["FullyQualifiedName"] == null ? undefined : json["FullyQualifiedName"],
2080
- description: json["Description"] == null ? undefined : json["Description"],
2081
- folderType: json["FolderType"] == null ? undefined : json["FolderType"],
2082
- isPersonal: json["IsPersonal"] == null ? undefined : json["IsPersonal"],
2083
- provisionType: json["ProvisionType"] == null ? undefined : json["ProvisionType"],
2084
- permissionModel: json["PermissionModel"] == null ? undefined : json["PermissionModel"],
2085
- parentId: json["ParentId"] == null ? undefined : json["ParentId"],
2086
- parentKey: json["ParentKey"] == null ? undefined : json["ParentKey"],
2087
- feedType: json["FeedType"] == null ? undefined : json["FeedType"],
2088
- id: json["Id"] == null ? undefined : json["Id"]
2089
- };
2090
- }
2091
- function FolderDtoToJSON(json) {
2092
- return FolderDtoToJSONTyped(json, false);
2093
- }
2094
- function FolderDtoToJSONTyped(value, ignoreDiscriminator = false) {
2095
- if (value == null) {
2096
- return value;
2097
- }
2098
- return {
2099
- Key: value["key"],
2100
- DisplayName: value["displayName"],
2101
- FullyQualifiedName: value["fullyQualifiedName"],
2102
- Description: value["description"],
2103
- FolderType: value["folderType"],
2104
- ProvisionType: value["provisionType"],
2105
- PermissionModel: value["permissionModel"],
2106
- ParentId: value["parentId"],
2107
- ParentKey: value["parentKey"],
2108
- FeedType: value["feedType"],
2109
- Id: value["id"]
2110
- };
2111
- }
2112
- // ../orchestrator-sdk/generated/src/models/FolderUpdateNameDescriptionRequest.ts
2113
- function FolderUpdateNameDescriptionRequestToJSON(json) {
2114
- return FolderUpdateNameDescriptionRequestToJSONTyped(json, false);
2115
- }
2116
- function FolderUpdateNameDescriptionRequestToJSONTyped(value, ignoreDiscriminator = false) {
2117
- if (value == null) {
2118
- return value;
2119
- }
2120
- return {
2121
- name: value["name"],
2122
- description: value["description"]
2123
- };
2124
- }
2125
- // ../orchestrator-sdk/generated/src/models/OrganizationUnitDto.ts
2126
- function OrganizationUnitDtoFromJSON(json) {
2127
- return OrganizationUnitDtoFromJSONTyped(json, false);
2128
- }
2129
- function OrganizationUnitDtoFromJSONTyped(json, ignoreDiscriminator) {
2130
- if (json == null) {
2131
- return json;
2132
- }
2133
- return {
2134
- displayName: json["displayName"],
2135
- id: json["id"] == null ? undefined : json["id"]
2136
- };
2137
- }
2138
- function OrganizationUnitDtoToJSON(json) {
2139
- return OrganizationUnitDtoToJSONTyped(json, false);
2140
- }
2141
- function OrganizationUnitDtoToJSONTyped(value, ignoreDiscriminator = false) {
2142
- if (value == null) {
2143
- return value;
2144
- }
2145
- return {
2146
- displayName: value["displayName"],
2147
- id: value["id"]
2148
- };
2149
- }
2150
-
2151
- // ../orchestrator-sdk/generated/src/models/UserRoleDto.ts
2152
- function UserRoleDtoFromJSON(json) {
2153
- return UserRoleDtoFromJSONTyped(json, false);
2154
- }
2155
- function UserRoleDtoFromJSONTyped(json, ignoreDiscriminator) {
2156
- if (json == null) {
2157
- return json;
2158
- }
2159
- return {
2160
- userId: json["UserId"] == null ? undefined : json["UserId"],
2161
- roleId: json["RoleId"] == null ? undefined : json["RoleId"],
2162
- userName: json["UserName"] == null ? undefined : json["UserName"],
2163
- roleName: json["RoleName"] == null ? undefined : json["RoleName"],
2164
- roleType: json["RoleType"] == null ? undefined : json["RoleType"],
2165
- id: json["Id"] == null ? undefined : json["Id"]
2166
- };
2167
- }
2168
- function UserRoleDtoToJSON(json) {
2169
- return UserRoleDtoToJSONTyped(json, false);
2170
- }
2171
- function UserRoleDtoToJSONTyped(value, ignoreDiscriminator = false) {
2172
- if (value == null) {
2173
- return value;
2174
- }
2175
- return {
2176
- UserId: value["userId"],
2177
- RoleId: value["roleId"],
2178
- UserName: value["userName"],
2179
- RoleName: value["roleName"],
2180
- RoleType: value["roleType"],
2181
- Id: value["id"]
2182
- };
2183
- }
2184
-
2185
- // ../orchestrator-sdk/generated/src/models/UserNotificationSubscription.ts
2186
- function UserNotificationSubscriptionFromJSON(json) {
2187
- return UserNotificationSubscriptionFromJSONTyped(json, false);
2188
- }
2189
- function UserNotificationSubscriptionFromJSONTyped(json, ignoreDiscriminator) {
2190
- if (json == null) {
2191
- return json;
2192
- }
2193
- return {
2194
- queues: json["Queues"] == null ? undefined : json["Queues"],
2195
- robots: json["Robots"] == null ? undefined : json["Robots"],
2196
- jobs: json["Jobs"] == null ? undefined : json["Jobs"],
2197
- schedules: json["Schedules"] == null ? undefined : json["Schedules"],
2198
- tasks: json["Tasks"] == null ? undefined : json["Tasks"],
2199
- queueItems: json["QueueItems"] == null ? undefined : json["QueueItems"],
2200
- insights: json["Insights"] == null ? undefined : json["Insights"],
2201
- cloudRobots: json["CloudRobots"] == null ? undefined : json["CloudRobots"],
2202
- serverless: json["Serverless"] == null ? undefined : json["Serverless"],
2203
- _export: json["Export"] == null ? undefined : json["Export"],
2204
- rateLimitsDaily: json["RateLimitsDaily"] == null ? undefined : json["RateLimitsDaily"],
2205
- rateLimitsRealTime: json["RateLimitsRealTime"] == null ? undefined : json["RateLimitsRealTime"],
2206
- autopilotForRobotsDetectedIssues: json["AutopilotForRobotsDetectedIssues"] == null ? undefined : json["AutopilotForRobotsDetectedIssues"],
2207
- webhooks: json["Webhooks"] == null ? undefined : json["Webhooks"]
2208
- };
2209
- }
2210
- function UserNotificationSubscriptionToJSON(json) {
2211
- return UserNotificationSubscriptionToJSONTyped(json, false);
2212
- }
2213
- function UserNotificationSubscriptionToJSONTyped(value, ignoreDiscriminator = false) {
2214
- if (value == null) {
2215
- return value;
2216
- }
2217
- return {
2218
- Queues: value["queues"],
2219
- Robots: value["robots"],
2220
- Jobs: value["jobs"],
2221
- Schedules: value["schedules"],
2222
- Tasks: value["tasks"],
2223
- QueueItems: value["queueItems"],
2224
- Insights: value["insights"],
2225
- CloudRobots: value["cloudRobots"],
2226
- Serverless: value["serverless"],
2227
- Export: value["_export"],
2228
- RateLimitsDaily: value["rateLimitsDaily"],
2229
- RateLimitsRealTime: value["rateLimitsRealTime"],
2230
- AutopilotForRobotsDetectedIssues: value["autopilotForRobotsDetectedIssues"],
2231
- Webhooks: value["webhooks"]
2232
- };
2233
- }
2234
-
2235
- // ../orchestrator-sdk/generated/src/models/UnattendedRobotDto.ts
2236
- function UnattendedRobotDtoFromJSON(json) {
2237
- return UnattendedRobotDtoFromJSONTyped(json, false);
2238
- }
2239
- function UnattendedRobotDtoFromJSONTyped(json, ignoreDiscriminator) {
2240
- if (json == null) {
2241
- return json;
2242
- }
2243
- return {
2244
- userName: json["UserName"] == null ? undefined : json["UserName"],
2245
- password: json["Password"] == null ? undefined : json["Password"],
2246
- credentialStoreId: json["CredentialStoreId"] == null ? undefined : json["CredentialStoreId"],
2247
- credentialType: json["CredentialType"] == null ? undefined : json["CredentialType"],
2248
- credentialExternalName: json["CredentialExternalName"] == null ? undefined : json["CredentialExternalName"],
2249
- executionSettings: json["ExecutionSettings"] == null ? undefined : json["ExecutionSettings"],
2250
- limitConcurrentExecution: json["LimitConcurrentExecution"] == null ? undefined : json["LimitConcurrentExecution"],
2251
- robotId: json["RobotId"] == null ? undefined : json["RobotId"],
2252
- machineMappingsCount: json["MachineMappingsCount"] == null ? undefined : json["MachineMappingsCount"]
2253
- };
2254
- }
2255
- function UnattendedRobotDtoToJSON(json) {
2256
- return UnattendedRobotDtoToJSONTyped(json, false);
2257
- }
2258
- function UnattendedRobotDtoToJSONTyped(value, ignoreDiscriminator = false) {
2259
- if (value == null) {
2260
- return value;
2261
- }
2262
- return {
2263
- UserName: value["userName"],
2264
- Password: value["password"],
2265
- CredentialStoreId: value["credentialStoreId"],
2266
- CredentialType: value["credentialType"],
2267
- CredentialExternalName: value["credentialExternalName"],
2268
- ExecutionSettings: value["executionSettings"],
2269
- LimitConcurrentExecution: value["limitConcurrentExecution"],
2270
- RobotId: value["robotId"],
2271
- MachineMappingsCount: value["machineMappingsCount"]
2272
- };
2273
- }
2274
- // ../orchestrator-sdk/generated/src/models/MachineFolderDto.ts
2275
- function MachineFolderDtoFromJSON(json) {
2276
- return MachineFolderDtoFromJSONTyped(json, false);
2277
- }
2278
- function MachineFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
2279
- if (json == null) {
2280
- return json;
2281
- }
2282
- return {
2283
- licenseKey: json["LicenseKey"] == null ? undefined : json["LicenseKey"],
2284
- name: json["Name"],
2285
- description: json["Description"] == null ? undefined : json["Description"],
2286
- type: json["Type"] == null ? undefined : json["Type"],
2287
- scope: json["Scope"] == null ? undefined : json["Scope"],
2288
- nonProductionSlots: json["NonProductionSlots"] == null ? undefined : json["NonProductionSlots"],
2289
- unattendedSlots: json["UnattendedSlots"] == null ? undefined : json["UnattendedSlots"],
2290
- headlessSlots: json["HeadlessSlots"] == null ? undefined : json["HeadlessSlots"],
2291
- testAutomationSlots: json["TestAutomationSlots"] == null ? undefined : json["TestAutomationSlots"],
2292
- hostingSlots: json["HostingSlots"] == null ? undefined : json["HostingSlots"],
2293
- appTestSlots: json["AppTestSlots"] == null ? undefined : json["AppTestSlots"],
2294
- performanceTestSlots: json["PerformanceTestSlots"] == null ? undefined : json["PerformanceTestSlots"],
2295
- agentSlots: json["AgentSlots"] == null ? undefined : json["AgentSlots"],
2296
- functionSlots: json["FunctionSlots"] == null ? undefined : json["FunctionSlots"],
2297
- verticalsRpaSlots: json["VerticalsRpaSlots"] == null ? undefined : json["VerticalsRpaSlots"],
2298
- verticalsAgentSlots: json["VerticalsAgentSlots"] == null ? undefined : json["VerticalsAgentSlots"],
2299
- verticalsFunctionSlots: json["VerticalsFunctionSlots"] == null ? undefined : json["VerticalsFunctionSlots"],
2300
- executionOptions: json["ExecutionOptions"] == null ? undefined : json["ExecutionOptions"],
2301
- automationCloudSlots: json["AutomationCloudSlots"] == null ? undefined : json["AutomationCloudSlots"],
2302
- automationCloudTestAutomationSlots: json["AutomationCloudTestAutomationSlots"] == null ? undefined : json["AutomationCloudTestAutomationSlots"],
2303
- key: json["Key"] == null ? undefined : json["Key"],
2304
- endpointDetectionStatus: json["EndpointDetectionStatus"] == null ? undefined : json["EndpointDetectionStatus"],
2305
- robotVersions: json["RobotVersions"] == null ? undefined : json["RobotVersions"].map(MachinesRobotVersionDtoFromJSON),
2306
- robotUsers: json["RobotUsers"] == null ? undefined : json["RobotUsers"].map(RobotUserDtoFromJSON),
2307
- automationType: json["AutomationType"] == null ? undefined : json["AutomationType"],
2308
- targetFramework: json["TargetFramework"] == null ? undefined : json["TargetFramework"],
2309
- serverlessLicensingModel: json["ServerlessLicensingModel"] == null ? undefined : json["ServerlessLicensingModel"],
2310
- updatePolicy: json["UpdatePolicy"] == null ? undefined : UpdatePolicyDtoFromJSON(json["UpdatePolicy"]),
2311
- clientSecret: json["ClientSecret"] == null ? undefined : json["ClientSecret"],
2312
- tags: json["Tags"] == null ? undefined : json["Tags"].map(TagDtoFromJSON),
2313
- maintenanceWindow: json["MaintenanceWindow"] == null ? undefined : MaintenanceWindowDtoFromJSON(json["MaintenanceWindow"]),
2314
- vpnSettings: json["VpnSettings"] == null ? undefined : MachineVpnSettingsDtoFromJSON(json["VpnSettings"]),
2315
- machineSettings: json["MachineSettings"] == null ? undefined : json["MachineSettings"],
2316
- id: json["Id"] == null ? undefined : json["Id"],
2317
- isAssignedToFolder: json["IsAssignedToFolder"] == null ? undefined : json["IsAssignedToFolder"],
2318
- hasMachineRobots: json["HasMachineRobots"] == null ? undefined : json["HasMachineRobots"],
2319
- isInherited: json["IsInherited"] == null ? undefined : json["IsInherited"],
2320
- propagateToSubFolders: json["PropagateToSubFolders"] == null ? undefined : json["PropagateToSubFolders"],
2321
- inheritedFromFolderName: json["InheritedFromFolderName"] == null ? undefined : json["InheritedFromFolderName"],
2322
- updateInfo: json["UpdateInfo"] == null ? undefined : UpdateInfoDtoFromJSON(json["UpdateInfo"])
2323
- };
2324
- }
2325
- // ../orchestrator-sdk/generated/src/models/UserDto.ts
2326
- function UserDtoFromJSON(json) {
2327
- return UserDtoFromJSONTyped(json, false);
2328
- }
2329
- function UserDtoFromJSONTyped(json, ignoreDiscriminator) {
2330
- if (json == null) {
2331
- return json;
2332
- }
2333
- return {
2334
- name: json["Name"] == null ? undefined : json["Name"],
2335
- surname: json["Surname"] == null ? undefined : json["Surname"],
2336
- userName: json["UserName"] == null ? undefined : json["UserName"],
2337
- domain: json["Domain"] == null ? undefined : json["Domain"],
2338
- directoryIdentifier: json["DirectoryIdentifier"] == null ? undefined : json["DirectoryIdentifier"],
2339
- fullName: json["FullName"] == null ? undefined : json["FullName"],
2340
- emailAddress: json["EmailAddress"] == null ? undefined : json["EmailAddress"],
2341
- lastLoginTime: json["LastLoginTime"] == null ? undefined : new Date(json["LastLoginTime"]),
2342
- isActive: json["IsActive"] == null ? undefined : json["IsActive"],
2343
- creationTime: json["CreationTime"] == null ? undefined : new Date(json["CreationTime"]),
2344
- authenticationSource: json["AuthenticationSource"] == null ? undefined : json["AuthenticationSource"],
2345
- organizationUnits: json["OrganizationUnits"] == null ? undefined : json["OrganizationUnits"].map(OrganizationUnitDtoFromJSON),
2346
- password: json["Password"] == null ? undefined : json["Password"],
2347
- isExternalLicensed: json["IsExternalLicensed"] == null ? undefined : json["IsExternalLicensed"],
2348
- userRoles: json["UserRoles"] == null ? undefined : json["UserRoles"].map(UserRoleDtoFromJSON),
2349
- rolesList: json["RolesList"] == null ? undefined : json["RolesList"],
2350
- loginProviders: json["LoginProviders"] == null ? undefined : json["LoginProviders"],
2351
- tenantId: json["TenantId"] == null ? undefined : json["TenantId"],
2352
- tenancyName: json["TenancyName"] == null ? undefined : json["TenancyName"],
2353
- tenantDisplayName: json["TenantDisplayName"] == null ? undefined : json["TenantDisplayName"],
2354
- tenantKey: json["TenantKey"] == null ? undefined : json["TenantKey"],
2355
- type: json["Type"] == null ? undefined : json["Type"],
2356
- provisionType: json["ProvisionType"] == null ? undefined : json["ProvisionType"],
2357
- licenseType: json["LicenseType"] == null ? undefined : json["LicenseType"],
2358
- robotProvision: json["RobotProvision"] == null ? undefined : AttendedRobotDtoFromJSON(json["RobotProvision"]),
2359
- unattendedRobot: json["UnattendedRobot"] == null ? undefined : UnattendedRobotDtoFromJSON(json["UnattendedRobot"]),
2360
- notificationSubscription: json["NotificationSubscription"] == null ? undefined : UserNotificationSubscriptionFromJSON(json["NotificationSubscription"]),
2361
- key: json["Key"] == null ? undefined : json["Key"],
2362
- mayHaveUserSession: json["MayHaveUserSession"] == null ? undefined : json["MayHaveUserSession"],
2363
- mayHaveRobotSession: json["MayHaveRobotSession"] == null ? undefined : json["MayHaveRobotSession"],
2364
- mayHaveUnattendedSession: json["MayHaveUnattendedSession"] == null ? undefined : json["MayHaveUnattendedSession"],
2365
- mayHavePersonalWorkspace: json["MayHavePersonalWorkspace"] == null ? undefined : json["MayHavePersonalWorkspace"],
2366
- restrictToPersonalWorkspace: json["RestrictToPersonalWorkspace"] == null ? undefined : json["RestrictToPersonalWorkspace"],
2367
- updatePolicy: json["UpdatePolicy"] == null ? undefined : UpdatePolicyDtoFromJSON(json["UpdatePolicy"]),
2368
- accountId: json["AccountId"] == null ? undefined : json["AccountId"],
2369
- hasOnlyInheritedPrivileges: json["HasOnlyInheritedPrivileges"] == null ? undefined : json["HasOnlyInheritedPrivileges"],
2370
- explicitMayHaveUserSession: json["ExplicitMayHaveUserSession"] == null ? undefined : json["ExplicitMayHaveUserSession"],
2371
- explicitMayHaveRobotSession: json["ExplicitMayHaveRobotSession"] == null ? undefined : json["ExplicitMayHaveRobotSession"],
2372
- explicitMayHavePersonalWorkspace: json["ExplicitMayHavePersonalWorkspace"] == null ? undefined : json["ExplicitMayHavePersonalWorkspace"],
2373
- explicitRestrictToPersonalWorkspace: json["ExplicitRestrictToPersonalWorkspace"] == null ? undefined : json["ExplicitRestrictToPersonalWorkspace"],
2374
- lastModificationTime: json["LastModificationTime"] == null ? undefined : new Date(json["LastModificationTime"]),
2375
- lastModifierUserId: json["LastModifierUserId"] == null ? undefined : json["LastModifierUserId"],
2376
- creatorUserId: json["CreatorUserId"] == null ? undefined : json["CreatorUserId"],
2377
- id: json["Id"] == null ? undefined : json["Id"]
2378
- };
2379
- }
2380
- function UserDtoToJSON(json) {
2381
- return UserDtoToJSONTyped(json, false);
2382
- }
2383
- function UserDtoToJSONTyped(value, ignoreDiscriminator = false) {
2384
- if (value == null) {
2385
- return value;
2386
- }
2387
- return {
2388
- Name: value["name"],
2389
- Surname: value["surname"],
2390
- UserName: value["userName"],
2391
- Domain: value["domain"],
2392
- DirectoryIdentifier: value["directoryIdentifier"],
2393
- FullName: value["fullName"],
2394
- EmailAddress: value["emailAddress"],
2395
- LastLoginTime: value["lastLoginTime"] == null ? value["lastLoginTime"] : value["lastLoginTime"].toISOString(),
2396
- IsActive: value["isActive"],
2397
- CreationTime: value["creationTime"] == null ? value["creationTime"] : value["creationTime"].toISOString(),
2398
- AuthenticationSource: value["authenticationSource"],
2399
- OrganizationUnits: value["organizationUnits"] == null ? undefined : value["organizationUnits"].map(OrganizationUnitDtoToJSON),
2400
- Password: value["password"],
2401
- IsExternalLicensed: value["isExternalLicensed"],
2402
- UserRoles: value["userRoles"] == null ? undefined : value["userRoles"].map(UserRoleDtoToJSON),
2403
- RolesList: value["rolesList"],
2404
- LoginProviders: value["loginProviders"],
2405
- TenantId: value["tenantId"],
2406
- TenancyName: value["tenancyName"],
2407
- TenantDisplayName: value["tenantDisplayName"],
2408
- TenantKey: value["tenantKey"],
2409
- Type: value["type"],
2410
- ProvisionType: value["provisionType"],
2411
- LicenseType: value["licenseType"],
2412
- RobotProvision: AttendedRobotDtoToJSON(value["robotProvision"]),
2413
- UnattendedRobot: UnattendedRobotDtoToJSON(value["unattendedRobot"]),
2414
- NotificationSubscription: UserNotificationSubscriptionToJSON(value["notificationSubscription"]),
2415
- Key: value["key"],
2416
- MayHaveUserSession: value["mayHaveUserSession"],
2417
- MayHaveRobotSession: value["mayHaveRobotSession"],
2418
- MayHaveUnattendedSession: value["mayHaveUnattendedSession"],
2419
- MayHavePersonalWorkspace: value["mayHavePersonalWorkspace"],
2420
- RestrictToPersonalWorkspace: value["restrictToPersonalWorkspace"],
2421
- UpdatePolicy: UpdatePolicyDtoToJSON(value["updatePolicy"]),
2422
- AccountId: value["accountId"],
2423
- HasOnlyInheritedPrivileges: value["hasOnlyInheritedPrivileges"],
2424
- ExplicitMayHaveUserSession: value["explicitMayHaveUserSession"],
2425
- ExplicitMayHaveRobotSession: value["explicitMayHaveRobotSession"],
2426
- ExplicitMayHavePersonalWorkspace: value["explicitMayHavePersonalWorkspace"],
2427
- ExplicitRestrictToPersonalWorkspace: value["explicitRestrictToPersonalWorkspace"],
2428
- LastModificationTime: value["lastModificationTime"] == null ? value["lastModificationTime"] : value["lastModificationTime"].toISOString(),
2429
- LastModifierUserId: value["lastModifierUserId"],
2430
- CreatorUserId: value["creatorUserId"],
2431
- Id: value["id"]
2432
- };
2433
- }
2434
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfBusinessRuleDto.ts
2435
- function ODataValueOfIEnumerableOfBusinessRuleDtoFromJSON(json) {
2436
- return ODataValueOfIEnumerableOfBusinessRuleDtoFromJSONTyped(json, false);
2437
- }
2438
- function ODataValueOfIEnumerableOfBusinessRuleDtoFromJSONTyped(json, ignoreDiscriminator) {
2439
- if (json == null) {
2440
- return json;
2441
- }
2442
- return {
2443
- value: json["value"] == null ? undefined : json["value"].map(BusinessRuleDtoFromJSON)
2444
- };
2445
- }
2446
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfBusinessRuleVersionDto.ts
2447
- function ODataValueOfIEnumerableOfBusinessRuleVersionDtoFromJSON(json) {
2448
- return ODataValueOfIEnumerableOfBusinessRuleVersionDtoFromJSONTyped(json, false);
2449
- }
2450
- function ODataValueOfIEnumerableOfBusinessRuleVersionDtoFromJSONTyped(json, ignoreDiscriminator) {
2451
- if (json == null) {
2452
- return json;
2453
- }
2454
- return {
2455
- value: json["value"] == null ? undefined : json["value"].map(BusinessRuleVersionDtoFromJSON)
2456
- };
2457
- }
2458
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfFolderDto.ts
2459
- function ODataValueOfIEnumerableOfFolderDtoFromJSON(json) {
2460
- return ODataValueOfIEnumerableOfFolderDtoFromJSONTyped(json, false);
2461
- }
2462
- function ODataValueOfIEnumerableOfFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
2463
- if (json == null) {
2464
- return json;
2465
- }
2466
- return {
2467
- value: json["value"] == null ? undefined : json["value"].map(FolderDtoFromJSON)
2468
- };
2469
- }
2470
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfMachineFolderDto.ts
2471
- function ODataValueOfIEnumerableOfMachineFolderDtoFromJSON(json) {
2472
- return ODataValueOfIEnumerableOfMachineFolderDtoFromJSONTyped(json, false);
2473
- }
2474
- function ODataValueOfIEnumerableOfMachineFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
2475
- if (json == null) {
2476
- return json;
2477
- }
2478
- return {
2479
- value: json["value"] == null ? undefined : json["value"].map(MachineFolderDtoFromJSON)
2480
- };
2481
- }
2482
- // ../orchestrator-sdk/generated/src/models/PersonalWorkspaceDto.ts
2483
- function PersonalWorkspaceDtoFromJSON(json) {
2484
- return PersonalWorkspaceDtoFromJSONTyped(json, false);
2485
- }
2486
- function PersonalWorkspaceDtoFromJSONTyped(json, ignoreDiscriminator) {
2487
- if (json == null) {
2488
- return json;
2489
- }
2490
- return {
2491
- key: json["Key"] == null ? undefined : json["Key"],
2492
- name: json["Name"] == null ? undefined : json["Name"],
2493
- isActive: json["IsActive"] == null ? undefined : json["IsActive"],
2494
- ownerId: json["OwnerId"] == null ? undefined : json["OwnerId"],
2495
- ownerKey: json["OwnerKey"] == null ? undefined : json["OwnerKey"],
2496
- ownerName: json["OwnerName"] == null ? undefined : json["OwnerName"],
2497
- lastLogin: json["LastLogin"] == null ? undefined : new Date(json["LastLogin"]),
2498
- exploringUserIds: json["ExploringUserIds"] == null ? undefined : json["ExploringUserIds"],
2499
- id: json["Id"] == null ? undefined : json["Id"]
2500
- };
2501
- }
2502
-
2503
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfPersonalWorkspaceDto.ts
2504
- function ODataValueOfIEnumerableOfPersonalWorkspaceDtoFromJSON(json) {
2505
- return ODataValueOfIEnumerableOfPersonalWorkspaceDtoFromJSONTyped(json, false);
2506
- }
2507
- function ODataValueOfIEnumerableOfPersonalWorkspaceDtoFromJSONTyped(json, ignoreDiscriminator) {
2508
- if (json == null) {
2509
- return json;
2510
- }
2511
- return {
2512
- value: json["value"] == null ? undefined : json["value"].map(PersonalWorkspaceDtoFromJSON)
2513
- };
2514
- }
2515
- // ../orchestrator-sdk/generated/src/models/SearchUserDto.ts
2516
- function SearchUserDtoFromJSON(json) {
2517
- return SearchUserDtoFromJSONTyped(json, false);
2518
- }
2519
- function SearchUserDtoFromJSONTyped(json, ignoreDiscriminator) {
2520
- if (json == null) {
2521
- return json;
2522
- }
2523
- return {
2524
- userName: json["UserName"] == null ? undefined : json["UserName"],
2525
- userRoles: json["UserRoles"] == null ? undefined : json["UserRoles"].map(UserRoleDtoFromJSON),
2526
- rolesList: json["RolesList"] == null ? undefined : json["RolesList"],
2527
- id: json["Id"] == null ? undefined : json["Id"]
2528
- };
2529
- }
2530
-
2531
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfSearchUserDto.ts
2532
- function ODataValueOfIEnumerableOfSearchUserDtoFromJSON(json) {
2533
- return ODataValueOfIEnumerableOfSearchUserDtoFromJSONTyped(json, false);
2534
- }
2535
- function ODataValueOfIEnumerableOfSearchUserDtoFromJSONTyped(json, ignoreDiscriminator) {
2536
- if (json == null) {
2537
- return json;
2538
- }
2539
- return {
2540
- value: json["value"] == null ? undefined : json["value"].map(SearchUserDtoFromJSON)
2541
- };
2542
- }
2543
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfUserDto.ts
2544
- function ODataValueOfIEnumerableOfUserDtoFromJSON(json) {
2545
- return ODataValueOfIEnumerableOfUserDtoFromJSONTyped(json, false);
2546
- }
2547
- function ODataValueOfIEnumerableOfUserDtoFromJSONTyped(json, ignoreDiscriminator) {
2548
- if (json == null) {
2549
- return json;
2550
- }
2551
- return {
2552
- value: json["value"] == null ? undefined : json["value"].map(UserDtoFromJSON)
2553
- };
2554
- }
2555
- // ../orchestrator-sdk/generated/src/models/UserEntityDto.ts
2556
- function UserEntityDtoFromJSON(json) {
2557
- return UserEntityDtoFromJSONTyped(json, false);
2558
- }
2559
- function UserEntityDtoFromJSONTyped(json, ignoreDiscriminator) {
2560
- if (json == null) {
2561
- return json;
2562
- }
2563
- return {
2564
- fullName: json["FullName"] == null ? undefined : json["FullName"],
2565
- authenticationSource: json["AuthenticationSource"] == null ? undefined : json["AuthenticationSource"],
2566
- key: json["Key"] == null ? undefined : json["Key"],
2567
- userName: json["UserName"] == null ? undefined : json["UserName"],
2568
- isInherited: json["IsInherited"] == null ? undefined : json["IsInherited"],
2569
- assignedToFolderIds: json["AssignedToFolderIds"] == null ? undefined : json["AssignedToFolderIds"],
2570
- mayHaveAttended: json["MayHaveAttended"] == null ? undefined : json["MayHaveAttended"],
2571
- mayHaveUnattended: json["MayHaveUnattended"] == null ? undefined : json["MayHaveUnattended"],
2572
- type: json["Type"] == null ? undefined : json["Type"],
2573
- source: json["Source"] == null ? undefined : json["Source"],
2574
- isActive: json["IsActive"] == null ? undefined : json["IsActive"],
2575
- id: json["Id"] == null ? undefined : json["Id"]
2576
- };
2577
- }
2578
-
2579
- // ../orchestrator-sdk/generated/src/models/SimpleRoleDto.ts
2580
- function SimpleRoleDtoFromJSON(json) {
2581
- return SimpleRoleDtoFromJSONTyped(json, false);
2582
- }
2583
- function SimpleRoleDtoFromJSONTyped(json, ignoreDiscriminator) {
2584
- if (json == null) {
2585
- return json;
2586
- }
2587
- return {
2588
- origin: json["Origin"] == null ? undefined : json["Origin"],
2589
- roleType: json["RoleType"] == null ? undefined : json["RoleType"],
2590
- inheritedFromFolder: json["InheritedFromFolder"] == null ? undefined : SimpleFolderDtoFromJSON(json["InheritedFromFolder"]),
2591
- name: json["Name"] == null ? undefined : json["Name"],
2592
- id: json["Id"] == null ? undefined : json["Id"]
2593
- };
2594
- }
2595
-
2596
- // ../orchestrator-sdk/generated/src/models/UserRolesDto.ts
2597
- function UserRolesDtoFromJSON(json) {
2598
- return UserRolesDtoFromJSONTyped(json, false);
2599
- }
2600
- function UserRolesDtoFromJSONTyped(json, ignoreDiscriminator) {
2601
- if (json == null) {
2602
- return json;
2603
- }
2604
- return {
2605
- userEntity: json["UserEntity"] == null ? undefined : UserEntityDtoFromJSON(json["UserEntity"]),
2606
- roles: json["Roles"] == null ? undefined : json["Roles"].map(SimpleRoleDtoFromJSON),
2607
- hasAlertsEnabled: json["HasAlertsEnabled"] == null ? undefined : json["HasAlertsEnabled"],
2608
- id: json["Id"] == null ? undefined : json["Id"]
2609
- };
2610
- }
2611
-
2612
- // ../orchestrator-sdk/generated/src/models/ODataValueOfIEnumerableOfUserRolesDto.ts
2613
- function ODataValueOfIEnumerableOfUserRolesDtoFromJSON(json) {
2614
- return ODataValueOfIEnumerableOfUserRolesDtoFromJSONTyped(json, false);
2615
- }
2616
- function ODataValueOfIEnumerableOfUserRolesDtoFromJSONTyped(json, ignoreDiscriminator) {
2617
- if (json == null) {
2618
- return json;
2619
- }
2620
- return {
2621
- value: json["value"] == null ? undefined : json["value"].map(UserRolesDtoFromJSON)
2622
- };
2623
- }
2624
- // ../orchestrator-sdk/generated/src/models/ODataValueOfInt64.ts
2625
- function ODataValueOfInt64FromJSON(json) {
2626
- return ODataValueOfInt64FromJSONTyped(json, false);
2627
- }
2628
- function ODataValueOfInt64FromJSONTyped(json, ignoreDiscriminator) {
2629
- if (json == null) {
2630
- return json;
2631
- }
2632
- return {
2633
- value: json["value"] == null ? undefined : json["value"]
2634
- };
2635
- }
2636
- // ../orchestrator-sdk/generated/src/models/PageResultDtoOfCurrentUserFolderDto.ts
2637
- function PageResultDtoOfCurrentUserFolderDtoFromJSON(json) {
2638
- return PageResultDtoOfCurrentUserFolderDtoFromJSONTyped(json, false);
2639
- }
2640
- function PageResultDtoOfCurrentUserFolderDtoFromJSONTyped(json, ignoreDiscriminator) {
2641
- if (json == null) {
2642
- return json;
2643
- }
2644
- return {
2645
- pageItems: json["PageItems"] == null ? undefined : json["PageItems"].map(CurrentUserFolderDtoFromJSON),
2646
- count: json["Count"] == null ? undefined : json["Count"]
2647
- };
2648
- }
2649
- // ../orchestrator-sdk/generated/src/models/RemoveMachinesFromFolderRequest.ts
2650
- function RemoveMachinesFromFolderRequestToJSON(json) {
2651
- return RemoveMachinesFromFolderRequestToJSONTyped(json, false);
2652
- }
2653
- function RemoveMachinesFromFolderRequestToJSONTyped(value, ignoreDiscriminator = false) {
2654
- if (value == null) {
2655
- return value;
2656
- }
2657
- return {
2658
- machineIds: value["machineIds"]
2659
- };
2660
- }
2661
- // ../orchestrator-sdk/generated/src/models/RemoveUserFromFolderRequest.ts
2662
- function RemoveUserFromFolderRequestToJSON(json) {
2663
- return RemoveUserFromFolderRequestToJSONTyped(json, false);
2664
- }
2665
- function RemoveUserFromFolderRequestToJSONTyped(value, ignoreDiscriminator = false) {
2666
- if (value == null) {
2667
- return value;
2668
- }
2669
- return {
2670
- userId: value["userId"]
2671
- };
2672
- }
2673
- // ../orchestrator-sdk/generated/src/models/UserAssignRolesRequest.ts
2674
- function UserAssignRolesRequestToJSON(json) {
2675
- return UserAssignRolesRequestToJSONTyped(json, false);
2676
- }
2677
- function UserAssignRolesRequestToJSONTyped(value, ignoreDiscriminator = false) {
2678
- if (value == null) {
2679
- return value;
2680
- }
2681
- return {
2682
- roleIds: value["roleIds"]
2683
- };
2684
- }
2685
- // ../orchestrator-sdk/generated/src/models/UserRoleAssignmentsDto.ts
2686
- function UserRoleAssignmentsDtoFromJSON(json) {
2687
- return UserRoleAssignmentsDtoFromJSONTyped(json, false);
2688
- }
2689
- function UserRoleAssignmentsDtoFromJSONTyped(json, ignoreDiscriminator) {
2690
- if (json == null) {
2691
- return json;
2692
- }
2693
- return {
2694
- tenantRoles: json["TenantRoles"] == null ? undefined : json["TenantRoles"].map(RoleUsersDtoFromJSON),
2695
- pageItems: json["PageItems"] == null ? undefined : json["PageItems"].map(FolderAssignmentsDtoFromJSON),
2696
- count: json["Count"] == null ? undefined : json["Count"],
2697
- id: json["Id"] == null ? undefined : json["Id"]
2698
- };
2699
- }
2700
- // ../orchestrator-sdk/generated/src/apis/BusinessRulesApi.ts
2701
- class BusinessRulesApi extends BaseAPI {
2702
- async businessRulesGetRaw(requestParameters, initOverrides) {
2703
- const queryParameters = {};
2704
- if (requestParameters["$select"] != null) {
2705
- queryParameters["$select"] = requestParameters["$select"];
2706
- }
2707
- if (requestParameters["$expand"] != null) {
2708
- queryParameters["$expand"] = requestParameters["$expand"];
2709
- }
2710
- if (requestParameters["$filter"] != null) {
2711
- queryParameters["$filter"] = requestParameters["$filter"];
2712
- }
2713
- if (requestParameters["$orderby"] != null) {
2714
- queryParameters["$orderby"] = requestParameters["$orderby"];
2715
- }
2716
- if (requestParameters["$top"] != null) {
2717
- queryParameters["$top"] = requestParameters["$top"];
2718
- }
2719
- if (requestParameters["$skip"] != null) {
2720
- queryParameters["$skip"] = requestParameters["$skip"];
2721
- }
2722
- if (requestParameters["$count"] != null) {
2723
- queryParameters["$count"] = requestParameters["$count"];
2724
- }
2725
- const headerParameters = {};
2726
- if (requestParameters["xUIPATHOrganizationUnitId"] != null) {
2727
- headerParameters["X-UIPATH-OrganizationUnitId"] = String(requestParameters["xUIPATHOrganizationUnitId"]);
2728
- }
2729
- if (this.configuration && this.configuration.accessToken) {
2730
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
2731
- }
2732
- let urlPath = `/odata/BusinessRules`;
2733
- const response = await this.request({
2734
- path: urlPath,
2735
- method: "GET",
2736
- headers: headerParameters,
2737
- query: queryParameters
2738
- }, initOverrides);
2739
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfBusinessRuleDtoFromJSON(jsonValue));
2740
- }
2741
- async businessRulesGet(requestParameters = {}, initOverrides) {
2742
- const response = await this.businessRulesGetRaw(requestParameters, initOverrides);
2743
- return await response.value();
2744
- }
2745
- async businessRulesGetVersionListByIdRaw(requestParameters, initOverrides) {
2746
- if (requestParameters["id"] == null) {
2747
- throw new RequiredError("id", 'Required parameter "id" was null or undefined when calling businessRulesGetVersionListById().');
2748
- }
2749
- const queryParameters = {};
2750
- if (requestParameters["$select"] != null) {
2751
- queryParameters["$select"] = requestParameters["$select"];
2752
- }
2753
- if (requestParameters["$expand"] != null) {
2754
- queryParameters["$expand"] = requestParameters["$expand"];
2755
- }
2756
- if (requestParameters["$filter"] != null) {
2757
- queryParameters["$filter"] = requestParameters["$filter"];
2758
- }
2759
- if (requestParameters["$orderby"] != null) {
2760
- queryParameters["$orderby"] = requestParameters["$orderby"];
2761
- }
2762
- if (requestParameters["$top"] != null) {
2763
- queryParameters["$top"] = requestParameters["$top"];
2764
- }
2765
- if (requestParameters["$skip"] != null) {
2766
- queryParameters["$skip"] = requestParameters["$skip"];
2767
- }
2768
- if (requestParameters["$count"] != null) {
2769
- queryParameters["$count"] = requestParameters["$count"];
2770
- }
2771
- const headerParameters = {};
2772
- if (requestParameters["xUIPATHOrganizationUnitId"] != null) {
2773
- headerParameters["X-UIPATH-OrganizationUnitId"] = String(requestParameters["xUIPATHOrganizationUnitId"]);
2774
- }
2775
- if (this.configuration && this.configuration.accessToken) {
2776
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
2777
- }
2778
- let urlPath = `/odata/BusinessRules/UiPath.Server.Configuration.OData.GetVersionList(id={id})`;
2779
- urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters["id"])));
2780
- const response = await this.request({
2781
- path: urlPath,
2782
- method: "GET",
2783
- headers: headerParameters,
2784
- query: queryParameters
2785
- }, initOverrides);
2786
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfBusinessRuleVersionDtoFromJSON(jsonValue));
2787
- }
2788
- async businessRulesGetVersionListById(requestParameters, initOverrides) {
2789
- const response = await this.businessRulesGetVersionListByIdRaw(requestParameters, initOverrides);
2790
- return await response.value();
2791
- }
2792
- }
2793
-
2794
- // ../orchestrator-sdk/generated/src/apis/PersonalWorkspacesApi.ts
2795
- class PersonalWorkspacesApi extends BaseAPI {
2796
- async personalWorkspacesGetRaw(requestParameters, initOverrides) {
2797
- const queryParameters = {};
2798
- if (requestParameters["$select"] != null) {
2799
- queryParameters["$select"] = requestParameters["$select"];
2800
- }
2801
- if (requestParameters["$expand"] != null) {
2802
- queryParameters["$expand"] = requestParameters["$expand"];
2803
- }
2804
- if (requestParameters["$filter"] != null) {
2805
- queryParameters["$filter"] = requestParameters["$filter"];
2806
- }
2807
- if (requestParameters["$orderby"] != null) {
2808
- queryParameters["$orderby"] = requestParameters["$orderby"];
2809
- }
2810
- if (requestParameters["$top"] != null) {
2811
- queryParameters["$top"] = requestParameters["$top"];
2812
- }
2813
- if (requestParameters["$skip"] != null) {
2814
- queryParameters["$skip"] = requestParameters["$skip"];
2815
- }
2816
- if (requestParameters["$count"] != null) {
2817
- queryParameters["$count"] = requestParameters["$count"];
2818
- }
2819
- const headerParameters = {};
2820
- if (this.configuration && this.configuration.accessToken) {
2821
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
2822
- }
2823
- let urlPath = `/odata/PersonalWorkspaces`;
2824
- const response = await this.request({
2825
- path: urlPath,
2826
- method: "GET",
2827
- headers: headerParameters,
2828
- query: queryParameters
2829
- }, initOverrides);
2830
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfPersonalWorkspaceDtoFromJSON(jsonValue));
2831
- }
2832
- async personalWorkspacesGet(requestParameters = {}, initOverrides) {
2833
- const response = await this.personalWorkspacesGetRaw(requestParameters, initOverrides);
2834
- return await response.value();
2835
- }
2836
- async personalWorkspacesGetPersonalWorkspaceRaw(requestParameters, initOverrides) {
2837
- const queryParameters = {};
2838
- if (requestParameters["$select"] != null) {
2839
- queryParameters["$select"] = requestParameters["$select"];
2840
- }
2841
- if (requestParameters["$expand"] != null) {
2842
- queryParameters["$expand"] = requestParameters["$expand"];
2843
- }
2844
- const headerParameters = {};
2845
- if (this.configuration && this.configuration.accessToken) {
2846
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
2847
- }
2848
- let urlPath = `/odata/PersonalWorkspaces/UiPath.Server.Configuration.OData.GetPersonalWorkspace`;
2849
- const response = await this.request({
2850
- path: urlPath,
2851
- method: "GET",
2852
- headers: headerParameters,
2853
- query: queryParameters
2854
- }, initOverrides);
2855
- return new JSONApiResponse(response, (jsonValue) => PersonalWorkspaceDtoFromJSON(jsonValue));
2856
- }
2857
- async personalWorkspacesGetPersonalWorkspace(requestParameters = {}, initOverrides) {
2858
- const response = await this.personalWorkspacesGetPersonalWorkspaceRaw(requestParameters, initOverrides);
2859
- return await response.value();
2860
- }
2861
- }
2862
-
2863
- // ../common/src/session-kind.ts
2864
- var SESSION_KIND_KEY = Symbol.for("@uipath/common/SessionKind");
2865
- function attachSessionKind(carrier, kind) {
2866
- if (!kind)
2867
- return carrier;
2868
- Object.defineProperty(carrier, SESSION_KIND_KEY, {
2869
- value: {
2870
- __brand: "SessionKind",
2871
- type: kind.type,
2872
- ...kind.clientId ? { clientId: kind.clientId } : {},
2873
- ...kind.applicationSubtype ? { applicationSubtype: kind.applicationSubtype } : {}
2874
- },
2875
- enumerable: false,
2876
- configurable: true
2877
- });
2878
- const clone = carrier.clone;
2879
- if (typeof clone === "function") {
2880
- Object.defineProperty(carrier, "clone", {
2881
- value: function stampedClone(...args) {
2882
- const copy = clone.apply(this, args);
2883
- return typeof copy === "object" && copy !== null ? attachSessionKind(copy, kind) : copy;
2884
- },
2885
- enumerable: false,
2886
- configurable: true,
2887
- writable: true
2888
- });
2889
- }
2890
- return carrier;
2891
- }
2892
- // ../orchestrator-sdk/package.json
2893
- var package_default = {
2894
- name: "@uipath/orchestrator-sdk",
2895
- author: "UiPath",
2896
- license: "SEE LICENSE IN LICENSE.txt",
2897
- version: "1.205.0",
2898
- repository: {
2899
- type: "git",
2900
- url: "https://github.com/UiPath/cli.git",
2901
- directory: "packages/orchestrator-sdk"
2902
- },
2903
- publishConfig: {
2904
- registry: "https://npm.pkg.github.com/@uipath"
2905
- },
2906
- keywords: [
2907
- "uipath",
2908
- "orchestrator",
2909
- "sdk"
2910
- ],
2911
- type: "module",
2912
- main: "./dist/index.js",
2913
- types: "./dist/src/index.d.ts",
2914
- exports: {
2915
- ".": {
2916
- browser: {
2917
- types: "./dist/src/index.browser.d.ts",
2918
- default: "./dist/index.browser.js"
2919
- },
2920
- default: {
2921
- types: "./dist/src/index.d.ts",
2922
- default: "./dist/index.js"
2923
- }
2924
- }
2925
- },
2926
- files: [
2927
- "dist"
2928
- ],
2929
- private: true,
2930
- scripts: {
2931
- build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && bun build ./src/index.browser.ts --outdir dist --format esm --target browser --external @uipath/auth --external @uipath/common --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
2932
- generate: "bun run src/scripts/generate-sdk.ts",
2933
- lint: "biome check .",
2934
- test: "vitest run",
2935
- "test:coverage": "vitest run --coverage"
2936
- },
2937
- devDependencies: {
2938
- "@uipath/auth": "workspace:*",
2939
- "@uipath/common": "workspace:*",
2940
- "@openapitools/openapi-generator-cli": "^2.31.1",
2941
- "@types/node": "^25.5.2",
2942
- typescript: "^7.0.2"
2943
- }
2944
- };
2945
-
2946
- // ../orchestrator-sdk/src/user-agent.ts
2947
- var SDK_USER_AGENT = getSdkUserAgentToken(package_default);
2948
- installSdkUserAgentHeader(BaseAPI, SDK_USER_AGENT);
2949
-
2950
- // ../orchestrator-sdk/src/client-factory.ts
2951
- async function createOrchestratorConfig(options) {
2952
- const ctx = await getAuthContext({
2953
- tenant: options?.tenant,
2954
- ensureTokenValidityMinutes: options?.loginValidity,
2955
- envFilePath: options?.envFilePath
2956
- });
2957
- const orchestratorBasePath = ctx.organizationId && ctx.tenantName ? `${ctx.baseUrl}/${ctx.organizationId}/${ctx.tenantName}/orchestrator_` : ctx.baseUrl;
2958
- const headers = addSdkUserAgentHeader({
2959
- Authorization: `Bearer ${ctx.accessToken}`
2960
- }, SDK_USER_AGENT);
2961
- if (options?.folderId) {
2962
- headers["X-UIPATH-OrganizationUnitId"] = options.folderId;
2963
- } else if (options?.folderKey && options?.folderPath) {
2964
- throw new Error("Provide either folderKey or folderPath, not both.");
2965
- } else if (options?.folderKey) {
2966
- headers["X-UIPATH-FolderKey"] = options.folderKey;
2967
- } else if (options?.folderPath) {
2968
- headers["X-UIPATH-FolderPath"] = options.folderPath;
2969
- }
2970
- return new Configuration({
2971
- basePath: orchestratorBasePath,
2972
- headers,
2973
- fetchApi: sessionKindStampingFetch(ctx.identity ?? resolveSessionIdentity(ctx.accessToken))
2974
- });
2975
- }
2976
- function sessionKindStampingFetch(kind) {
2977
- if (!kind)
2978
- return;
2979
- return async (...args) => attachSessionKind(await fetch(...args), kind);
2980
- }
2981
- async function createApiClient(ApiClass, options) {
2982
- const config = await createOrchestratorConfig(options);
2983
- return new ApiClass(config);
2984
- }
2985
-
2986
- // ../orchestrator-sdk/generated/src/apis/FoldersApi.ts
2987
- class FoldersApi extends BaseAPI {
2988
- async foldersAssignMachinesRaw(requestParameters, initOverrides) {
2989
- const queryParameters = {};
2990
- const headerParameters = {};
2991
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
2992
- if (this.configuration && this.configuration.accessToken) {
2993
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
2994
- }
2995
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.AssignMachines`;
2996
- const response = await this.request({
2997
- path: urlPath,
2998
- method: "POST",
2999
- headers: headerParameters,
3000
- query: queryParameters,
3001
- body: FolderAssignMachinesRequestToJSON(requestParameters["body"])
3002
- }, initOverrides);
3003
- return new VoidApiResponse(response);
3004
- }
3005
- async foldersAssignMachines(requestParameters = {}, initOverrides) {
3006
- await this.foldersAssignMachinesRaw(requestParameters, initOverrides);
3007
- }
3008
- async foldersAssignUsersRaw(requestParameters, initOverrides) {
3009
- const queryParameters = {};
3010
- const headerParameters = {};
3011
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3012
- if (this.configuration && this.configuration.accessToken) {
3013
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3014
- }
3015
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.AssignUsers`;
3016
- const response = await this.request({
3017
- path: urlPath,
3018
- method: "POST",
3019
- headers: headerParameters,
3020
- query: queryParameters,
3021
- body: FolderAssignUsersRequestToJSON(requestParameters["body"])
3022
- }, initOverrides);
3023
- return new VoidApiResponse(response);
3024
- }
3025
- async foldersAssignUsers(requestParameters = {}, initOverrides) {
3026
- await this.foldersAssignUsersRaw(requestParameters, initOverrides);
3027
- }
3028
- async foldersDeleteByIdRaw(requestParameters, initOverrides) {
3029
- if (requestParameters["key"] == null) {
3030
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling foldersDeleteById().');
3031
- }
3032
- const queryParameters = {};
3033
- const headerParameters = {};
3034
- if (this.configuration && this.configuration.accessToken) {
3035
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3036
- }
3037
- let urlPath = `/odata/Folders({key})`;
3038
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3039
- const response = await this.request({
3040
- path: urlPath,
3041
- method: "DELETE",
3042
- headers: headerParameters,
3043
- query: queryParameters
3044
- }, initOverrides);
3045
- return new VoidApiResponse(response);
3046
- }
3047
- async foldersDeleteById(requestParameters, initOverrides) {
3048
- await this.foldersDeleteByIdRaw(requestParameters, initOverrides);
3049
- }
3050
- async foldersGetRaw(requestParameters, initOverrides) {
3051
- const queryParameters = {};
3052
- if (requestParameters["$select"] != null) {
3053
- queryParameters["$select"] = requestParameters["$select"];
3054
- }
3055
- if (requestParameters["$expand"] != null) {
3056
- queryParameters["$expand"] = requestParameters["$expand"];
3057
- }
3058
- if (requestParameters["$filter"] != null) {
3059
- queryParameters["$filter"] = requestParameters["$filter"];
3060
- }
3061
- if (requestParameters["$orderby"] != null) {
3062
- queryParameters["$orderby"] = requestParameters["$orderby"];
3063
- }
3064
- if (requestParameters["$top"] != null) {
3065
- queryParameters["$top"] = requestParameters["$top"];
3066
- }
3067
- if (requestParameters["$skip"] != null) {
3068
- queryParameters["$skip"] = requestParameters["$skip"];
3069
- }
3070
- if (requestParameters["$count"] != null) {
3071
- queryParameters["$count"] = requestParameters["$count"];
3072
- }
3073
- const headerParameters = {};
3074
- if (this.configuration && this.configuration.accessToken) {
3075
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3076
- }
3077
- let urlPath = `/odata/Folders`;
3078
- const response = await this.request({
3079
- path: urlPath,
3080
- method: "GET",
3081
- headers: headerParameters,
3082
- query: queryParameters
3083
- }, initOverrides);
3084
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfFolderDtoFromJSON(jsonValue));
3085
- }
3086
- async foldersGet(requestParameters = {}, initOverrides) {
3087
- const response = await this.foldersGetRaw(requestParameters, initOverrides);
3088
- return await response.value();
3089
- }
3090
- async foldersGetAllForCurrentUserRaw(requestParameters, initOverrides) {
3091
- const queryParameters = {};
3092
- if (requestParameters["take"] != null) {
3093
- queryParameters["take"] = requestParameters["take"];
3094
- }
3095
- if (requestParameters["skip"] != null) {
3096
- queryParameters["skip"] = requestParameters["skip"];
3097
- }
3098
- const headerParameters = {};
3099
- if (this.configuration && this.configuration.accessToken) {
3100
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3101
- }
3102
- let urlPath = `/api/Folders/GetAllForCurrentUser`;
3103
- const response = await this.request({
3104
- path: urlPath,
3105
- method: "GET",
3106
- headers: headerParameters,
3107
- query: queryParameters
3108
- }, initOverrides);
3109
- return new JSONApiResponse(response, (jsonValue) => PageResultDtoOfCurrentUserFolderDtoFromJSON(jsonValue));
3110
- }
3111
- async foldersGetAllForCurrentUser(requestParameters = {}, initOverrides) {
3112
- const response = await this.foldersGetAllForCurrentUserRaw(requestParameters, initOverrides);
3113
- return await response.value();
3114
- }
3115
- async foldersGetAllRolesForUserByUsernameAndSkipAndTakeRaw(requestParameters, initOverrides) {
3116
- if (requestParameters["username"] == null) {
3117
- throw new RequiredError("username", 'Required parameter "username" was null or undefined when calling foldersGetAllRolesForUserByUsernameAndSkipAndTake().');
3118
- }
3119
- if (requestParameters["skip"] == null) {
3120
- throw new RequiredError("skip", 'Required parameter "skip" was null or undefined when calling foldersGetAllRolesForUserByUsernameAndSkipAndTake().');
3121
- }
3122
- if (requestParameters["take"] == null) {
3123
- throw new RequiredError("take", 'Required parameter "take" was null or undefined when calling foldersGetAllRolesForUserByUsernameAndSkipAndTake().');
3124
- }
3125
- const queryParameters = {};
3126
- if (requestParameters["type"] != null) {
3127
- queryParameters["type"] = requestParameters["type"];
3128
- }
3129
- if (requestParameters["searchText"] != null) {
3130
- queryParameters["searchText"] = requestParameters["searchText"];
3131
- }
3132
- if (requestParameters["$select"] != null) {
3133
- queryParameters["$select"] = requestParameters["$select"];
3134
- }
3135
- if (requestParameters["$expand"] != null) {
3136
- queryParameters["$expand"] = requestParameters["$expand"];
3137
- }
3138
- const headerParameters = {};
3139
- if (this.configuration && this.configuration.accessToken) {
3140
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3141
- }
3142
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.GetAllRolesForUser(username='{username}',skip={skip},take={take})`;
3143
- urlPath = urlPath.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters["username"])));
3144
- urlPath = urlPath.replace(`{${"skip"}}`, encodeURIComponent(String(requestParameters["skip"])));
3145
- urlPath = urlPath.replace(`{${"take"}}`, encodeURIComponent(String(requestParameters["take"])));
3146
- const response = await this.request({
3147
- path: urlPath,
3148
- method: "GET",
3149
- headers: headerParameters,
3150
- query: queryParameters
3151
- }, initOverrides);
3152
- return new JSONApiResponse(response, (jsonValue) => UserRoleAssignmentsDtoFromJSON(jsonValue));
3153
- }
3154
- async foldersGetAllRolesForUserByUsernameAndSkipAndTake(requestParameters, initOverrides) {
3155
- const response = await this.foldersGetAllRolesForUserByUsernameAndSkipAndTakeRaw(requestParameters, initOverrides);
3156
- return await response.value();
3157
- }
3158
- async foldersGetByIdRaw(requestParameters, initOverrides) {
3159
- if (requestParameters["key"] == null) {
3160
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling foldersGetById().');
3161
- }
3162
- const queryParameters = {};
3163
- if (requestParameters["$select"] != null) {
3164
- queryParameters["$select"] = requestParameters["$select"];
3165
- }
3166
- if (requestParameters["$expand"] != null) {
3167
- queryParameters["$expand"] = requestParameters["$expand"];
3168
- }
3169
- const headerParameters = {};
3170
- if (this.configuration && this.configuration.accessToken) {
3171
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3172
- }
3173
- let urlPath = `/odata/Folders({key})`;
3174
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3175
- const response = await this.request({
3176
- path: urlPath,
3177
- method: "GET",
3178
- headers: headerParameters,
3179
- query: queryParameters
3180
- }, initOverrides);
3181
- return new JSONApiResponse(response, (jsonValue) => FolderDtoFromJSON(jsonValue));
3182
- }
3183
- async foldersGetById(requestParameters, initOverrides) {
3184
- const response = await this.foldersGetByIdRaw(requestParameters, initOverrides);
3185
- return await response.value();
3186
- }
3187
- async foldersGetByKeyByIdentifierRaw(requestParameters, initOverrides) {
3188
- if (requestParameters["identifier"] == null) {
3189
- throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling foldersGetByKeyByIdentifier().');
3190
- }
3191
- const queryParameters = {};
3192
- if (requestParameters["$select"] != null) {
3193
- queryParameters["$select"] = requestParameters["$select"];
3194
- }
3195
- if (requestParameters["$expand"] != null) {
3196
- queryParameters["$expand"] = requestParameters["$expand"];
3197
- }
3198
- if (requestParameters["$filter"] != null) {
3199
- queryParameters["$filter"] = requestParameters["$filter"];
3200
- }
3201
- if (requestParameters["$orderby"] != null) {
3202
- queryParameters["$orderby"] = requestParameters["$orderby"];
3203
- }
3204
- if (requestParameters["$top"] != null) {
3205
- queryParameters["$top"] = requestParameters["$top"];
3206
- }
3207
- if (requestParameters["$skip"] != null) {
3208
- queryParameters["$skip"] = requestParameters["$skip"];
3209
- }
3210
- if (requestParameters["$count"] != null) {
3211
- queryParameters["$count"] = requestParameters["$count"];
3212
- }
3213
- const headerParameters = {};
3214
- if (this.configuration && this.configuration.accessToken) {
3215
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3216
- }
3217
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.GetByKey(identifier={identifier})`;
3218
- urlPath = urlPath.replace(`{${"identifier"}}`, encodeURIComponent(String(requestParameters["identifier"])));
3219
- const response = await this.request({
3220
- path: urlPath,
3221
- method: "GET",
3222
- headers: headerParameters,
3223
- query: queryParameters
3224
- }, initOverrides);
3225
- return new JSONApiResponse(response, (jsonValue) => FolderDtoFromJSON(jsonValue));
3226
- }
3227
- async foldersGetByKeyByIdentifier(requestParameters, initOverrides) {
3228
- const response = await this.foldersGetByKeyByIdentifierRaw(requestParameters, initOverrides);
3229
- return await response.value();
3230
- }
3231
- async foldersGetMachinesForFolderByKeyRaw(requestParameters, initOverrides) {
3232
- if (requestParameters["key"] == null) {
3233
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling foldersGetMachinesForFolderByKey().');
3234
- }
3235
- const queryParameters = {};
3236
- if (requestParameters["$select"] != null) {
3237
- queryParameters["$select"] = requestParameters["$select"];
3238
- }
3239
- if (requestParameters["$expand"] != null) {
3240
- queryParameters["$expand"] = requestParameters["$expand"];
3241
- }
3242
- if (requestParameters["$filter"] != null) {
3243
- queryParameters["$filter"] = requestParameters["$filter"];
3244
- }
3245
- if (requestParameters["$orderby"] != null) {
3246
- queryParameters["$orderby"] = requestParameters["$orderby"];
3247
- }
3248
- if (requestParameters["$top"] != null) {
3249
- queryParameters["$top"] = requestParameters["$top"];
3250
- }
3251
- if (requestParameters["$skip"] != null) {
3252
- queryParameters["$skip"] = requestParameters["$skip"];
3253
- }
3254
- if (requestParameters["$count"] != null) {
3255
- queryParameters["$count"] = requestParameters["$count"];
3256
- }
3257
- const headerParameters = {};
3258
- if (this.configuration && this.configuration.accessToken) {
3259
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3260
- }
3261
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.GetMachinesForFolder(key={key})`;
3262
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3263
- const response = await this.request({
3264
- path: urlPath,
3265
- method: "GET",
3266
- headers: headerParameters,
3267
- query: queryParameters
3268
- }, initOverrides);
3269
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfMachineFolderDtoFromJSON(jsonValue));
3270
- }
3271
- async foldersGetMachinesForFolderByKey(requestParameters, initOverrides) {
3272
- const response = await this.foldersGetMachinesForFolderByKeyRaw(requestParameters, initOverrides);
3273
- return await response.value();
3274
- }
3275
- async foldersGetUsersForFolderByKeyAndIncludeinheritedRaw(requestParameters, initOverrides) {
3276
- if (requestParameters["key"] == null) {
3277
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling foldersGetUsersForFolderByKeyAndIncludeinherited().');
3278
- }
3279
- if (requestParameters["includeInherited"] == null) {
3280
- throw new RequiredError("includeInherited", 'Required parameter "includeInherited" was null or undefined when calling foldersGetUsersForFolderByKeyAndIncludeinherited().');
3281
- }
3282
- const queryParameters = {};
3283
- if (requestParameters["includeAlertsEnabled"] != null) {
3284
- queryParameters["includeAlertsEnabled"] = requestParameters["includeAlertsEnabled"];
3285
- }
3286
- if (requestParameters["$select"] != null) {
3287
- queryParameters["$select"] = requestParameters["$select"];
3288
- }
3289
- if (requestParameters["$expand"] != null) {
3290
- queryParameters["$expand"] = requestParameters["$expand"];
3291
- }
3292
- if (requestParameters["$filter"] != null) {
3293
- queryParameters["$filter"] = requestParameters["$filter"];
3294
- }
3295
- if (requestParameters["$orderby"] != null) {
3296
- queryParameters["$orderby"] = requestParameters["$orderby"];
3297
- }
3298
- if (requestParameters["$top"] != null) {
3299
- queryParameters["$top"] = requestParameters["$top"];
3300
- }
3301
- if (requestParameters["$skip"] != null) {
3302
- queryParameters["$skip"] = requestParameters["$skip"];
3303
- }
3304
- if (requestParameters["$count"] != null) {
3305
- queryParameters["$count"] = requestParameters["$count"];
3306
- }
3307
- const headerParameters = {};
3308
- if (this.configuration && this.configuration.accessToken) {
3309
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3310
- }
3311
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.GetUsersForFolder(key={key},includeInherited={includeInherited})`;
3312
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3313
- urlPath = urlPath.replace(`{${"includeInherited"}}`, encodeURIComponent(String(requestParameters["includeInherited"])));
3314
- const response = await this.request({
3315
- path: urlPath,
3316
- method: "GET",
3317
- headers: headerParameters,
3318
- query: queryParameters
3319
- }, initOverrides);
3320
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfUserRolesDtoFromJSON(jsonValue));
3321
- }
3322
- async foldersGetUsersForFolderByKeyAndIncludeinherited(requestParameters, initOverrides) {
3323
- const response = await this.foldersGetUsersForFolderByKeyAndIncludeinheritedRaw(requestParameters, initOverrides);
3324
- return await response.value();
3325
- }
3326
- async foldersGetUsersToAssignByFolderidRaw(requestParameters, initOverrides) {
3327
- if (requestParameters["folderId"] == null) {
3328
- throw new RequiredError("folderId", 'Required parameter "folderId" was null or undefined when calling foldersGetUsersToAssignByFolderid().');
3329
- }
3330
- const queryParameters = {};
3331
- if (requestParameters["$select"] != null) {
3332
- queryParameters["$select"] = requestParameters["$select"];
3333
- }
3334
- if (requestParameters["$expand"] != null) {
3335
- queryParameters["$expand"] = requestParameters["$expand"];
3336
- }
3337
- if (requestParameters["$filter"] != null) {
3338
- queryParameters["$filter"] = requestParameters["$filter"];
3339
- }
3340
- if (requestParameters["$orderby"] != null) {
3341
- queryParameters["$orderby"] = requestParameters["$orderby"];
3342
- }
3343
- if (requestParameters["$top"] != null) {
3344
- queryParameters["$top"] = requestParameters["$top"];
3345
- }
3346
- if (requestParameters["$skip"] != null) {
3347
- queryParameters["$skip"] = requestParameters["$skip"];
3348
- }
3349
- if (requestParameters["$count"] != null) {
3350
- queryParameters["$count"] = requestParameters["$count"];
3351
- }
3352
- const headerParameters = {};
3353
- if (this.configuration && this.configuration.accessToken) {
3354
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3355
- }
3356
- let urlPath = `/odata/Folders/UiPath.Server.Configuration.OData.GetUsersToAssign(folderId={folderId})`;
3357
- urlPath = urlPath.replace(`{${"folderId"}}`, encodeURIComponent(String(requestParameters["folderId"])));
3358
- const response = await this.request({
3359
- path: urlPath,
3360
- method: "GET",
3361
- headers: headerParameters,
3362
- query: queryParameters
3363
- }, initOverrides);
3364
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfSearchUserDtoFromJSON(jsonValue));
3365
- }
3366
- async foldersGetUsersToAssignByFolderid(requestParameters, initOverrides) {
3367
- const response = await this.foldersGetUsersToAssignByFolderidRaw(requestParameters, initOverrides);
3368
- return await response.value();
3369
- }
3370
- async foldersMoveFolderByFolderidRaw(requestParameters, initOverrides) {
3371
- if (requestParameters["folderId"] == null) {
3372
- throw new RequiredError("folderId", 'Required parameter "folderId" was null or undefined when calling foldersMoveFolderByFolderid().');
3373
- }
3374
- const queryParameters = {};
3375
- if (requestParameters["targetParentId"] != null) {
3376
- queryParameters["targetParentId"] = requestParameters["targetParentId"];
3377
- }
3378
- const headerParameters = {};
3379
- if (this.configuration && this.configuration.accessToken) {
3380
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3381
- }
3382
- let urlPath = `/odata/Folders({folderId})/UiPath.Server.Configuration.OData.MoveFolder`;
3383
- urlPath = urlPath.replace(`{${"folderId"}}`, encodeURIComponent(String(requestParameters["folderId"])));
3384
- const response = await this.request({
3385
- path: urlPath,
3386
- method: "PUT",
3387
- headers: headerParameters,
3388
- query: queryParameters
3389
- }, initOverrides);
3390
- return new VoidApiResponse(response);
3391
- }
3392
- async foldersMoveFolderByFolderid(requestParameters, initOverrides) {
3393
- await this.foldersMoveFolderByFolderidRaw(requestParameters, initOverrides);
3394
- }
3395
- async foldersPatchNameDescriptionRaw(requestParameters, initOverrides) {
3396
- const queryParameters = {};
3397
- if (requestParameters["key"] != null) {
3398
- queryParameters["key"] = requestParameters["key"];
3399
- }
3400
- const headerParameters = {};
3401
- headerParameters["Content-Type"] = "application/json";
3402
- if (this.configuration && this.configuration.accessToken) {
3403
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3404
- }
3405
- let urlPath = `/api/Folders/PatchNameDescription`;
3406
- const response = await this.request({
3407
- path: urlPath,
3408
- method: "PATCH",
3409
- headers: headerParameters,
3410
- query: queryParameters,
3411
- body: FolderUpdateNameDescriptionRequestToJSON(requestParameters["body"])
3412
- }, initOverrides);
3413
- return new VoidApiResponse(response);
3414
- }
3415
- async foldersPatchNameDescription(requestParameters = {}, initOverrides) {
3416
- await this.foldersPatchNameDescriptionRaw(requestParameters, initOverrides);
3417
- }
3418
- async foldersPostRaw(requestParameters, initOverrides) {
3419
- const queryParameters = {};
3420
- const headerParameters = {};
3421
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3422
- if (this.configuration && this.configuration.accessToken) {
3423
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3424
- }
3425
- let urlPath = `/odata/Folders`;
3426
- const response = await this.request({
3427
- path: urlPath,
3428
- method: "POST",
3429
- headers: headerParameters,
3430
- query: queryParameters,
3431
- body: FolderDtoToJSON(requestParameters["body"])
3432
- }, initOverrides);
3433
- return new JSONApiResponse(response, (jsonValue) => FolderDtoFromJSON(jsonValue));
3434
- }
3435
- async foldersPost(requestParameters = {}, initOverrides) {
3436
- const response = await this.foldersPostRaw(requestParameters, initOverrides);
3437
- return await response.value();
3438
- }
3439
- async foldersRemoveMachinesFromFolderByIdRaw(requestParameters, initOverrides) {
3440
- if (requestParameters["key"] == null) {
3441
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling foldersRemoveMachinesFromFolderById().');
3442
- }
3443
- const queryParameters = {};
3444
- const headerParameters = {};
3445
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3446
- if (this.configuration && this.configuration.accessToken) {
3447
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3448
- }
3449
- let urlPath = `/odata/Folders({key})/UiPath.Server.Configuration.OData.RemoveMachinesFromFolder`;
3450
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3451
- const response = await this.request({
3452
- path: urlPath,
3453
- method: "POST",
3454
- headers: headerParameters,
3455
- query: queryParameters,
3456
- body: RemoveMachinesFromFolderRequestToJSON(requestParameters["body"])
3457
- }, initOverrides);
3458
- return new VoidApiResponse(response);
3459
- }
3460
- async foldersRemoveMachinesFromFolderById(requestParameters, initOverrides) {
3461
- await this.foldersRemoveMachinesFromFolderByIdRaw(requestParameters, initOverrides);
3462
- }
3463
- async foldersRemoveUserFromFolderByIdRaw(requestParameters, initOverrides) {
3464
- if (requestParameters["key"] == null) {
3465
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling foldersRemoveUserFromFolderById().');
3466
- }
3467
- const queryParameters = {};
3468
- const headerParameters = {};
3469
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3470
- if (this.configuration && this.configuration.accessToken) {
3471
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3472
- }
3473
- let urlPath = `/odata/Folders({key})/UiPath.Server.Configuration.OData.RemoveUserFromFolder`;
3474
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3475
- const response = await this.request({
3476
- path: urlPath,
3477
- method: "POST",
3478
- headers: headerParameters,
3479
- query: queryParameters,
3480
- body: RemoveUserFromFolderRequestToJSON(requestParameters["body"])
3481
- }, initOverrides);
3482
- return new VoidApiResponse(response);
3483
- }
3484
- async foldersRemoveUserFromFolderById(requestParameters, initOverrides) {
3485
- await this.foldersRemoveUserFromFolderByIdRaw(requestParameters, initOverrides);
3486
- }
3487
- }
3488
-
3489
- // ../orchestrator-sdk/src/folder-resolver.ts
3490
- var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3491
- async function resolveFolder(input, options) {
3492
- if (!input?.folderPath && !input?.folderKey) {
3493
- return;
3494
- }
3495
- const config = await createOrchestratorConfig(options);
3496
- const foldersApi = new FoldersApi(config);
3497
- if (input.folderKey) {
3498
- if (!UUID_REGEX.test(input.folderKey)) {
3499
- throw new Error(`Invalid folder key: '${input.folderKey}'. Expected a UUID (e.g. '12345678-1234-1234-1234-123456789abc').`);
3500
- }
3501
- return resolveByKey(foldersApi, input.folderKey);
3502
- }
3503
- return resolveByPath(foldersApi, input.folderPath);
3504
- }
3505
- async function resolveByKey(foldersApi, folderKey) {
3506
- const folder = await foldersApi.foldersGetByKeyByIdentifier({
3507
- identifier: folderKey
3508
- });
3509
- if (!folder?.id || !folder.key || !folder.fullyQualifiedName || !folder.displayName) {
3510
- throw new Error(`Folder not found: '${folderKey}'.`);
3511
- }
3512
- return {
3513
- id: folder.id,
3514
- key: folder.key,
3515
- path: folder.fullyQualifiedName,
3516
- displayName: folder.displayName
3517
- };
3518
- }
3519
- async function resolveByPath(foldersApi, folderPath) {
3520
- const response = await foldersApi.foldersGet({
3521
- $filter: `FullyQualifiedName eq '${folderPath.replace(/'/g, "''")}'`,
3522
- $top: 1
3523
- });
3524
- const folder = response.value?.[0];
3525
- if (!folder?.id || !folder.key || !folder.fullyQualifiedName || !folder.displayName) {
3526
- throw new Error(`Folder not found: '${folderPath}'.`);
3527
- }
3528
- return {
3529
- id: folder.id,
3530
- key: folder.key,
3531
- path: folder.fullyQualifiedName,
3532
- displayName: folder.displayName
3533
- };
3534
- }
3535
-
3536
- // ../orchestrator-sdk/src/odata.ts
3537
- var ODATA_STRING_LITERAL_PATTERN = /^'(?:[^']|'')*'$/;
3538
- function quoteODataStringLiteral(value) {
3539
- if (ODATA_STRING_LITERAL_PATTERN.test(value)) {
3540
- return value;
3541
- }
3542
- return `'${value.replace(/'/g, "''")}'`;
3543
- }
3544
- // ../orchestrator-sdk/generated/src/apis/UsersApi.ts
3545
- class UsersApi extends BaseAPI {
3546
- async usersAssignRolesByIdRaw(requestParameters, initOverrides) {
3547
- if (requestParameters["key"] == null) {
3548
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersAssignRolesById().');
3549
- }
3550
- const queryParameters = {};
3551
- const headerParameters = {};
3552
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3553
- if (this.configuration && this.configuration.accessToken) {
3554
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3555
- }
3556
- let urlPath = `/odata/Users({key})/UiPath.Server.Configuration.OData.AssignRoles`;
3557
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3558
- const response = await this.request({
3559
- path: urlPath,
3560
- method: "POST",
3561
- headers: headerParameters,
3562
- query: queryParameters,
3563
- body: UserAssignRolesRequestToJSON(requestParameters["body"])
3564
- }, initOverrides);
3565
- return new VoidApiResponse(response);
3566
- }
3567
- async usersAssignRolesById(requestParameters, initOverrides) {
3568
- await this.usersAssignRolesByIdRaw(requestParameters, initOverrides);
3569
- }
3570
- async usersGetRaw(requestParameters, initOverrides) {
3571
- const queryParameters = {};
3572
- if (requestParameters["$select"] != null) {
3573
- queryParameters["$select"] = requestParameters["$select"];
3574
- }
3575
- if (requestParameters["$expand"] != null) {
3576
- queryParameters["$expand"] = requestParameters["$expand"];
3577
- }
3578
- if (requestParameters["$filter"] != null) {
3579
- queryParameters["$filter"] = requestParameters["$filter"];
3580
- }
3581
- if (requestParameters["$orderby"] != null) {
3582
- queryParameters["$orderby"] = requestParameters["$orderby"];
3583
- }
3584
- if (requestParameters["$top"] != null) {
3585
- queryParameters["$top"] = requestParameters["$top"];
3586
- }
3587
- if (requestParameters["$skip"] != null) {
3588
- queryParameters["$skip"] = requestParameters["$skip"];
3589
- }
3590
- if (requestParameters["$count"] != null) {
3591
- queryParameters["$count"] = requestParameters["$count"];
3592
- }
3593
- const headerParameters = {};
3594
- if (this.configuration && this.configuration.accessToken) {
3595
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3596
- }
3597
- let urlPath = `/odata/Users`;
3598
- const response = await this.request({
3599
- path: urlPath,
3600
- method: "GET",
3601
- headers: headerParameters,
3602
- query: queryParameters
3603
- }, initOverrides);
3604
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfIEnumerableOfUserDtoFromJSON(jsonValue));
3605
- }
3606
- async usersGet(requestParameters = {}, initOverrides) {
3607
- const response = await this.usersGetRaw(requestParameters, initOverrides);
3608
- return await response.value();
3609
- }
3610
- async usersGetByKeyByIdentifierRaw(requestParameters, initOverrides) {
3611
- if (requestParameters["identifier"] == null) {
3612
- throw new RequiredError("identifier", 'Required parameter "identifier" was null or undefined when calling usersGetByKeyByIdentifier().');
3613
- }
3614
- const queryParameters = {};
3615
- if (requestParameters["$select"] != null) {
3616
- queryParameters["$select"] = requestParameters["$select"];
3617
- }
3618
- if (requestParameters["$expand"] != null) {
3619
- queryParameters["$expand"] = requestParameters["$expand"];
3620
- }
3621
- if (requestParameters["$filter"] != null) {
3622
- queryParameters["$filter"] = requestParameters["$filter"];
3623
- }
3624
- if (requestParameters["$orderby"] != null) {
3625
- queryParameters["$orderby"] = requestParameters["$orderby"];
3626
- }
3627
- if (requestParameters["$top"] != null) {
3628
- queryParameters["$top"] = requestParameters["$top"];
3629
- }
3630
- if (requestParameters["$skip"] != null) {
3631
- queryParameters["$skip"] = requestParameters["$skip"];
3632
- }
3633
- if (requestParameters["$count"] != null) {
3634
- queryParameters["$count"] = requestParameters["$count"];
3635
- }
3636
- const headerParameters = {};
3637
- if (this.configuration && this.configuration.accessToken) {
3638
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3639
- }
3640
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetByKey(identifier={identifier})`;
3641
- urlPath = urlPath.replace(`{${"identifier"}}`, encodeURIComponent(String(requestParameters["identifier"])));
3642
- const response = await this.request({
3643
- path: urlPath,
3644
- method: "GET",
3645
- headers: headerParameters,
3646
- query: queryParameters
3647
- }, initOverrides);
3648
- return new JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
3649
- }
3650
- async usersGetByKeyByIdentifier(requestParameters, initOverrides) {
3651
- const response = await this.usersGetByKeyByIdentifierRaw(requestParameters, initOverrides);
3652
- return await response.value();
3653
- }
3654
- async usersGetCurrentUserRaw(requestParameters, initOverrides) {
3655
- const queryParameters = {};
3656
- if (requestParameters["$select"] != null) {
3657
- queryParameters["$select"] = requestParameters["$select"];
3658
- }
3659
- if (requestParameters["$expand"] != null) {
3660
- queryParameters["$expand"] = requestParameters["$expand"];
3661
- }
3662
- const headerParameters = {};
3663
- if (this.configuration && this.configuration.accessToken) {
3664
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3665
- }
3666
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetCurrentUser`;
3667
- const response = await this.request({
3668
- path: urlPath,
3669
- method: "GET",
3670
- headers: headerParameters,
3671
- query: queryParameters
3672
- }, initOverrides);
3673
- return new JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
3674
- }
3675
- async usersGetCurrentUser(requestParameters = {}, initOverrides) {
3676
- const response = await this.usersGetCurrentUserRaw(requestParameters, initOverrides);
3677
- switch (response.raw.status) {
3678
- case 200:
3679
- return await response.value();
3680
- case 204:
3681
- return null;
3682
- default:
3683
- return await response.value();
3684
- }
3685
- }
3686
- async usersGetUserIdByUserkeyRaw(requestParameters, initOverrides) {
3687
- if (requestParameters["userKey"] == null) {
3688
- throw new RequiredError("userKey", 'Required parameter "userKey" was null or undefined when calling usersGetUserIdByUserkey().');
3689
- }
3690
- const queryParameters = {};
3691
- if (requestParameters["$select"] != null) {
3692
- queryParameters["$select"] = requestParameters["$select"];
3693
- }
3694
- if (requestParameters["$expand"] != null) {
3695
- queryParameters["$expand"] = requestParameters["$expand"];
3696
- }
3697
- const headerParameters = {};
3698
- if (this.configuration && this.configuration.accessToken) {
3699
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3700
- }
3701
- let urlPath = `/odata/Users/UiPath.Server.Configuration.OData.GetUserId(userKey='{userKey}')`;
3702
- urlPath = urlPath.replace(`{${"userKey"}}`, encodeURIComponent(String(requestParameters["userKey"])));
3703
- const response = await this.request({
3704
- path: urlPath,
3705
- method: "GET",
3706
- headers: headerParameters,
3707
- query: queryParameters
3708
- }, initOverrides);
3709
- return new JSONApiResponse(response, (jsonValue) => ODataValueOfInt64FromJSON(jsonValue));
3710
- }
3711
- async usersGetUserIdByUserkey(requestParameters, initOverrides) {
3712
- const response = await this.usersGetUserIdByUserkeyRaw(requestParameters, initOverrides);
3713
- return await response.value();
3714
- }
3715
- async usersPostRaw(requestParameters, initOverrides) {
3716
- const queryParameters = {};
3717
- const headerParameters = {};
3718
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3719
- if (this.configuration && this.configuration.accessToken) {
3720
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3721
- }
3722
- let urlPath = `/odata/Users`;
3723
- const response = await this.request({
3724
- path: urlPath,
3725
- method: "POST",
3726
- headers: headerParameters,
3727
- query: queryParameters,
3728
- body: UserDtoToJSON(requestParameters["body"])
3729
- }, initOverrides);
3730
- return new JSONApiResponse(response, (jsonValue) => UserDtoFromJSON(jsonValue));
3731
- }
3732
- async usersPost(requestParameters = {}, initOverrides) {
3733
- const response = await this.usersPostRaw(requestParameters, initOverrides);
3734
- return await response.value();
3735
- }
3736
- async usersPutByIdRaw(requestParameters, initOverrides) {
3737
- if (requestParameters["key"] == null) {
3738
- throw new RequiredError("key", 'Required parameter "key" was null or undefined when calling usersPutById().');
3739
- }
3740
- const queryParameters = {};
3741
- const headerParameters = {};
3742
- headerParameters["Content-Type"] = "application/json;odata.metadata=minimal;odata.streaming=true";
3743
- if (this.configuration && this.configuration.accessToken) {
3744
- headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2", []);
3745
- }
3746
- let urlPath = `/odata/Users({key})`;
3747
- urlPath = urlPath.replace(`{${"key"}}`, encodeURIComponent(String(requestParameters["key"])));
3748
- const response = await this.request({
3749
- path: urlPath,
3750
- method: "PUT",
3751
- headers: headerParameters,
3752
- query: queryParameters,
3753
- body: UserDtoToJSON(requestParameters["body"])
3754
- }, initOverrides);
3755
- return new VoidApiResponse(response);
3756
- }
3757
- async usersPutById(requestParameters, initOverrides) {
3758
- await this.usersPutByIdRaw(requestParameters, initOverrides);
3759
- }
3760
- }
3761
- // ../orchestrator-sdk/src/knowledge-bundles.ts
3762
- var KB_INLINE_LIMITS = {
3763
- maxObjectBytes: 16 * 1024 * 1024,
3764
- maxBodyBytes: 100 * 1024 * 1024,
3765
- maxParts: 1e4
3766
- };
3767
- export { getLoginStatusAsync, getAuthContext, BusinessRulesApi, PersonalWorkspacesApi, UsersApi, createApiClient, resolveFolder, quoteODataStringLiteral };
3768
-
3769
- //# debugId=031632314989DF1264756E2164756E21