@uipath/ixp-sdk 1.200.0-preview.120 → 1.201.0-preview.121

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 +147 -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,
@@ -2089,6 +2194,8 @@ init_constants();
2089
2194
 
2090
2195
  // ../auth/src/interactive.ts
2091
2196
  init_src();
2197
+ // ../auth/src/tenantSelection.ts
2198
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
2092
2199
 
2093
2200
  // ../auth/src/selectTenant.ts
2094
2201
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
@@ -2099,10 +2206,6 @@ var TENANT_SELECTION_CODES = new Set([
2099
2206
  ]);
2100
2207
  // ../auth/src/logout.ts
2101
2208
  init_src();
2102
-
2103
- // ../auth/src/index.ts
2104
- init_server();
2105
-
2106
2209
  // ../common/src/singleton.ts
2107
2210
  var PREFIX = "@uipath/common/";
2108
2211
  var _g = globalThis;
@@ -2163,7 +2266,7 @@ function getSdkUserAgentToken(pkg) {
2163
2266
  var package_default = {
2164
2267
  name: "@uipath/ixp-sdk",
2165
2268
  license: "MIT",
2166
- version: "1.200.0-preview.120",
2269
+ version: "1.201.0-preview.121",
2167
2270
  description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
2168
2271
  repository: {
2169
2272
  type: "git",
@@ -2344,6 +2447,28 @@ async function getDeploymentTaxonomy(config, projectName, version) {
2344
2447
  }
2345
2448
  return designtimeGet(config, `/api/projects/${encodeURIComponent(projectName)}/models/${version}/taxonomy`, "Failed to get deployment taxonomy");
2346
2449
  }
2450
+ function deploymentsPath(projectName) {
2451
+ return `/api/projects/${encodeURIComponent(projectName)}/deployments`;
2452
+ }
2453
+ async function deployModel(config, projectName, options) {
2454
+ const body = {
2455
+ ModelVersion: options.modelVersion,
2456
+ FolderKey: options.folderKey
2457
+ };
2458
+ if (options.deploymentTitle !== undefined) {
2459
+ body.DeploymentTitle = options.deploymentTitle;
2460
+ }
2461
+ return designtimePost(config, deploymentsPath(projectName), body, "Failed to deploy model");
2462
+ }
2463
+ async function upgradeDeployment(config, projectName, deploymentName, options) {
2464
+ return designtimePut(config, `${deploymentsPath(projectName)}/${encodeURIComponent(deploymentName)}`, {
2465
+ ModelVersion: options.modelVersion,
2466
+ FolderKey: options.folderKey
2467
+ }, "Failed to upgrade deployment");
2468
+ }
2469
+ async function listDeployments(config, projectName) {
2470
+ return designtimeGet(config, deploymentsPath(projectName), "Failed to list deployments");
2471
+ }
2347
2472
  // src/documents-service.ts
2348
2473
  function documentsPath(projectName) {
2349
2474
  return `/api/projects/${encodeURIComponent(projectName)}/documents`;
@@ -2528,6 +2653,7 @@ async function updateFieldPrompts(config, projectName, updates) {
2528
2653
  }
2529
2654
  export {
2530
2655
  uploadDocument,
2656
+ upgradeDeployment,
2531
2657
  updateProjectTitle,
2532
2658
  updateProjectPrompt,
2533
2659
  updateGroupPrompts,
@@ -2546,6 +2672,7 @@ export {
2546
2672
  listModels,
2547
2673
  listIxpProjects,
2548
2674
  listDocuments,
2675
+ listDeployments,
2549
2676
  importTaxonomy,
2550
2677
  getProjectTaxonomy,
2551
2678
  getProject,
@@ -2553,6 +2680,7 @@ export {
2553
2680
  getDocumentPredictions,
2554
2681
  getDeploymentTaxonomy,
2555
2682
  downloadDocument,
2683
+ deployModel,
2556
2684
  deleteIxpProject,
2557
2685
  deleteGroup,
2558
2686
  deleteField,
@@ -2568,4 +2696,4 @@ export {
2568
2696
  addField
2569
2697
  };
2570
2698
 
2571
- //# debugId=AEAEB4D25383A36864756E2164756E21
2699
+ //# debugId=9A130D0EA719BDC164756E2164756E21
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.120",
4
+ "version": "1.201.0-preview.121",
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": "173ad4b4930bd3e17a493b32e9f1c3c616ea1c10"
27
+ "gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
28
28
  }