@uipath/ixp-sdk 1.200.0-preview.109 → 1.201.0-preview.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +120 -19
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  import { createRequire } from "node:module";
2
+ var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true,
12
+ configurable: true,
13
+ set: __exportSetter.bind(all, name)
14
+ });
15
+ };
2
16
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
3
17
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
18
 
@@ -386,6 +400,12 @@ var init_is_in_ssh = __esm(() => {
386
400
  });
387
401
 
388
402
  // ../../node_modules/open/index.js
403
+ var exports_open = {};
404
+ __export(exports_open, {
405
+ openApp: () => openApp,
406
+ default: () => open_default,
407
+ apps: () => apps
408
+ });
389
409
  import process8 from "node:process";
390
410
  import path from "node:path";
391
411
  import { fileURLToPath } from "node:url";
@@ -619,6 +639,21 @@ var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform, arch, tryEach
619
639
  ...options,
620
640
  target
621
641
  });
642
+ }, openApp = (name, options) => {
643
+ if (typeof name !== "string" && !Array.isArray(name)) {
644
+ throw new TypeError("Expected a valid `name`");
645
+ }
646
+ const { arguments: appArguments = [] } = options ?? {};
647
+ if (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {
648
+ throw new TypeError("Expected `appArguments` as Array type");
649
+ }
650
+ return baseOpen({
651
+ ...options,
652
+ app: {
653
+ name,
654
+ arguments: appArguments
655
+ }
656
+ });
622
657
  }, apps, open_default;
623
658
  var init_open = __esm(() => {
624
659
  init_wsl_utils();
@@ -698,7 +733,8 @@ class NodeFileSystem {
698
733
  };
699
734
  utils = {
700
735
  open: async (url) => {
701
- await open_default(url);
736
+ const { default: open2 } = await Promise.resolve().then(() => (init_open(), exports_open));
737
+ await open2(url);
702
738
  }
703
739
  };
704
740
  async readFile(path3, options) {
@@ -893,9 +929,7 @@ class NodeFileSystem {
893
929
  }
894
930
  }
895
931
  var LOCK_HEARTBEAT_MS = 5000, LOCK_STALE_MS = 15000, LOCK_MAX_WAIT_MS = 20000, LOCK_MAX_HOLD_MS = 60000, LOCK_RETRY_MIN_MS = 100, LOCK_RETRY_JITTER_MS = 200;
896
- var init_node = __esm(() => {
897
- init_open();
898
- });
932
+ var init_node = () => {};
899
933
  // ../filesystem/src/index.ts
900
934
  var fsInstance, getFileSystem = () => fsInstance;
901
935
  var init_src = __esm(() => {
@@ -903,10 +937,6 @@ var init_src = __esm(() => {
903
937
  init_node();
904
938
  fsInstance = new NodeFileSystem;
905
939
  });
906
- // ../auth/src/server.ts
907
- var init_server = __esm(() => {
908
- init_constants();
909
- });
910
940
 
911
941
  // ../auth/src/config.ts
912
942
  init_constants();
@@ -1146,6 +1176,67 @@ var getTokenExpiration = (accessToken) => {
1146
1176
  }
1147
1177
  };
1148
1178
 
1179
+ // ../auth/src/sessionIdentity.ts
1180
+ var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
1181
+ var decodeClaims = (accessToken) => {
1182
+ const [error, claims] = catchError(() => parseJWT(accessToken));
1183
+ return error ? undefined : claims;
1184
+ };
1185
+ var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
1186
+ var resolveIdentityType = (claims, authFlow, email) => {
1187
+ const subType = asString(claims?.sub_type);
1188
+ if (subType) {
1189
+ return subType.startsWith("service") ? "Application" : "User";
1190
+ }
1191
+ if (authFlow) {
1192
+ return authFlow === "authorization_code" ? "User" : "Application";
1193
+ }
1194
+ if (email)
1195
+ return "User";
1196
+ if (asString(claims?.client_id) && !asString(claims?.sub)) {
1197
+ return "Application";
1198
+ }
1199
+ return;
1200
+ };
1201
+ var looksLikeEmail = (value) => value?.includes("@") ?? false;
1202
+ var pickEmail = (claims) => {
1203
+ for (const candidate of [claims?.email, claims?.preferred_username]) {
1204
+ const value = asString(candidate);
1205
+ if (looksLikeEmail(value))
1206
+ return value;
1207
+ }
1208
+ return;
1209
+ };
1210
+ var pickName = (claims) => {
1211
+ const username = asString(claims?.preferred_username);
1212
+ return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
1213
+ };
1214
+ var resolveSessionIdentity = (accessToken, authFlow) => {
1215
+ const claims = accessToken ? decodeClaims(accessToken) : undefined;
1216
+ const email = pickEmail(claims);
1217
+ const type = resolveIdentityType(claims, authFlow, email);
1218
+ if (!type)
1219
+ return;
1220
+ const identity = { type };
1221
+ if (authFlow)
1222
+ identity.authFlow = authFlow;
1223
+ if (type === "User") {
1224
+ const userId = asString(claims?.sub);
1225
+ if (userId)
1226
+ identity.userId = userId;
1227
+ if (email)
1228
+ identity.userEmail = email;
1229
+ const name = pickName(claims);
1230
+ if (name)
1231
+ identity.userName = name;
1232
+ return identity;
1233
+ }
1234
+ const clientId = asString(claims?.client_id);
1235
+ if (clientId)
1236
+ identity.clientId = clientId;
1237
+ return identity;
1238
+ };
1239
+
1149
1240
  // ../auth/src/envAuth.ts
1150
1241
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
1151
1242
  var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
@@ -1195,6 +1286,7 @@ var readAuthFromEnv = () => {
1195
1286
  }
1196
1287
  const expiration = getTokenExpiration(accessToken);
1197
1288
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
1289
+ const identity = resolveSessionIdentity(accessToken);
1198
1290
  return {
1199
1291
  loginStatus,
1200
1292
  accessToken,
@@ -1204,7 +1296,8 @@ var readAuthFromEnv = () => {
1204
1296
  tenantName,
1205
1297
  tenantId,
1206
1298
  expiration,
1207
- source: "env" /* Env */
1299
+ source: "env-vars" /* EnvironmentVariables */,
1300
+ ...identity ? { identity } : {}
1208
1301
  };
1209
1302
  };
1210
1303
 
@@ -1457,6 +1550,9 @@ var refreshAccessToken = async ({
1457
1550
  return { accessToken: newAccessToken, refreshToken: newRefreshToken };
1458
1551
  };
1459
1552
 
1553
+ // ../auth/src/types.ts
1554
+ var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
1555
+
1460
1556
  // ../auth/src/utils/envFile.ts
1461
1557
  init_src();
1462
1558
  init_constants();
@@ -1824,7 +1920,8 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1824
1920
  tenantName: credentials.UIPATH_TENANT_NAME,
1825
1921
  tenantId: credentials.UIPATH_TENANT_ID,
1826
1922
  expiration: tokens.expiration,
1827
- source: "file" /* File */,
1923
+ source: "saved-login" /* SavedLogin */,
1924
+ ...identityFields(tokens.accessToken, credentials),
1828
1925
  ...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
1829
1926
  ...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
1830
1927
  ...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
@@ -1837,7 +1934,12 @@ async function buildFileStatus(tokens, credentials, globalHint) {
1837
1934
  }
1838
1935
  return result;
1839
1936
  }
1937
+ function identityFields(accessToken, credentials) {
1938
+ const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
1939
+ return identity ? { identity } : {};
1940
+ }
1840
1941
  function buildRobotStatus(robotCreds) {
1942
+ const identity = resolveSessionIdentity(robotCreds.accessToken);
1841
1943
  return {
1842
1944
  loginStatus: "Logged in",
1843
1945
  accessToken: robotCreds.accessToken,
@@ -1848,7 +1950,8 @@ function buildRobotStatus(robotCreds) {
1848
1950
  tenantId: robotCreds.tenantId,
1849
1951
  issuer: robotCreds.issuer,
1850
1952
  expiration: getTokenExpiration(robotCreds.accessToken),
1851
- source: "robot" /* Robot */
1953
+ source: "robot" /* Robot */,
1954
+ ...identity ? { identity } : {}
1852
1955
  };
1853
1956
  }
1854
1957
  var isFileNotFoundError = (error) => {
@@ -1899,7 +2002,8 @@ async function circuitBreakerShortCircuit(ctx) {
1899
2002
  tenantName: credentials.UIPATH_TENANT_NAME,
1900
2003
  tenantId: credentials.UIPATH_TENANT_ID,
1901
2004
  expiration,
1902
- source: "file" /* File */
2005
+ source: "saved-login" /* SavedLogin */,
2006
+ ...identityFields(accessToken, credentials)
1903
2007
  } : {},
1904
2008
  hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
1905
2009
  refreshCircuitOpen: true,
@@ -1921,7 +2025,8 @@ async function lockAcquireFailureStatus(ctx, error) {
1921
2025
  tenantName: ctx.credentials.UIPATH_TENANT_NAME,
1922
2026
  tenantId: ctx.credentials.UIPATH_TENANT_ID,
1923
2027
  expiration: ctx.expiration,
1924
- source: "file" /* File */,
2028
+ source: "saved-login" /* SavedLogin */,
2029
+ ...identityFields(ctx.accessToken, ctx.credentials),
1925
2030
  hint: globalHint,
1926
2031
  tokenRefresh: {
1927
2032
  attempted: false,
@@ -2099,10 +2204,6 @@ var TENANT_SELECTION_CODES = new Set([
2099
2204
  ]);
2100
2205
  // ../auth/src/logout.ts
2101
2206
  init_src();
2102
-
2103
- // ../auth/src/index.ts
2104
- init_server();
2105
-
2106
2207
  // ../common/src/singleton.ts
2107
2208
  var PREFIX = "@uipath/common/";
2108
2209
  var _g = globalThis;
@@ -2163,7 +2264,7 @@ function getSdkUserAgentToken(pkg) {
2163
2264
  var package_default = {
2164
2265
  name: "@uipath/ixp-sdk",
2165
2266
  license: "MIT",
2166
- version: "1.200.0-preview.109",
2267
+ version: "1.201.0-preview.115",
2167
2268
  description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
2168
2269
  repository: {
2169
2270
  type: "git",
@@ -2568,4 +2669,4 @@ export {
2568
2669
  addField
2569
2670
  };
2570
2671
 
2571
- //# debugId=9CA406E792B1576B64756E2164756E21
2672
+ //# debugId=F01311F0EB89BDE664756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/ixp-sdk",
3
3
  "license": "MIT",
4
- "version": "1.200.0-preview.109",
4
+ "version": "1.201.0-preview.115",
5
5
  "description": "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,5 +24,5 @@
24
24
  "files": [
25
25
  "dist"
26
26
  ],
27
- "gitHead": "fcc01cdae81bbd0c25d3d4fc287537a9d19d99f4"
27
+ "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
28
28
  }