@uipath/agent-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
  // ../common/src/singleton.ts
912
942
  var PREFIX = "@uipath/common/";
@@ -1327,7 +1357,7 @@ class TextApiResponse {
1327
1357
  var package_default = {
1328
1358
  name: "@uipath/agent-sdk",
1329
1359
  license: "MIT",
1330
- version: "1.200.0-preview.109",
1360
+ version: "1.201.0-preview.115",
1331
1361
  description: "SDK for the UiPath Agent Runtime API — evaluation execution and debug sessions.",
1332
1362
  repository: {
1333
1363
  type: "git",
@@ -4552,6 +4582,67 @@ var getTokenExpiration = (accessToken) => {
4552
4582
  }
4553
4583
  };
4554
4584
 
4585
+ // ../auth/src/sessionIdentity.ts
4586
+ var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
4587
+ var decodeClaims = (accessToken) => {
4588
+ const [error, claims] = catchError(() => parseJWT(accessToken));
4589
+ return error ? undefined : claims;
4590
+ };
4591
+ var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
4592
+ var resolveIdentityType = (claims, authFlow, email) => {
4593
+ const subType = asString(claims?.sub_type);
4594
+ if (subType) {
4595
+ return subType.startsWith("service") ? "Application" : "User";
4596
+ }
4597
+ if (authFlow) {
4598
+ return authFlow === "authorization_code" ? "User" : "Application";
4599
+ }
4600
+ if (email)
4601
+ return "User";
4602
+ if (asString(claims?.client_id) && !asString(claims?.sub)) {
4603
+ return "Application";
4604
+ }
4605
+ return;
4606
+ };
4607
+ var looksLikeEmail = (value) => value?.includes("@") ?? false;
4608
+ var pickEmail = (claims) => {
4609
+ for (const candidate of [claims?.email, claims?.preferred_username]) {
4610
+ const value = asString(candidate);
4611
+ if (looksLikeEmail(value))
4612
+ return value;
4613
+ }
4614
+ return;
4615
+ };
4616
+ var pickName = (claims) => {
4617
+ const username = asString(claims?.preferred_username);
4618
+ return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
4619
+ };
4620
+ var resolveSessionIdentity = (accessToken, authFlow) => {
4621
+ const claims = accessToken ? decodeClaims(accessToken) : undefined;
4622
+ const email = pickEmail(claims);
4623
+ const type = resolveIdentityType(claims, authFlow, email);
4624
+ if (!type)
4625
+ return;
4626
+ const identity = { type };
4627
+ if (authFlow)
4628
+ identity.authFlow = authFlow;
4629
+ if (type === "User") {
4630
+ const userId = asString(claims?.sub);
4631
+ if (userId)
4632
+ identity.userId = userId;
4633
+ if (email)
4634
+ identity.userEmail = email;
4635
+ const name = pickName(claims);
4636
+ if (name)
4637
+ identity.userName = name;
4638
+ return identity;
4639
+ }
4640
+ const clientId = asString(claims?.client_id);
4641
+ if (clientId)
4642
+ identity.clientId = clientId;
4643
+ return identity;
4644
+ };
4645
+
4555
4646
  // ../auth/src/envAuth.ts
4556
4647
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
4557
4648
  var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
@@ -4601,6 +4692,7 @@ var readAuthFromEnv = () => {
4601
4692
  }
4602
4693
  const expiration = getTokenExpiration(accessToken);
4603
4694
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
4695
+ const identity = resolveSessionIdentity(accessToken);
4604
4696
  return {
4605
4697
  loginStatus,
4606
4698
  accessToken,
@@ -4610,7 +4702,8 @@ var readAuthFromEnv = () => {
4610
4702
  tenantName,
4611
4703
  tenantId,
4612
4704
  expiration,
4613
- source: "env" /* Env */
4705
+ source: "env-vars" /* EnvironmentVariables */,
4706
+ ...identity ? { identity } : {}
4614
4707
  };
4615
4708
  };
4616
4709
 
@@ -4863,6 +4956,9 @@ var refreshAccessToken = async ({
4863
4956
  return { accessToken: newAccessToken, refreshToken: newRefreshToken };
4864
4957
  };
4865
4958
 
4959
+ // ../auth/src/types.ts
4960
+ var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
4961
+
4866
4962
  // ../auth/src/utils/envFile.ts
4867
4963
  init_src();
4868
4964
  init_constants();
@@ -5230,7 +5326,8 @@ async function buildFileStatus(tokens, credentials, globalHint) {
5230
5326
  tenantName: credentials.UIPATH_TENANT_NAME,
5231
5327
  tenantId: credentials.UIPATH_TENANT_ID,
5232
5328
  expiration: tokens.expiration,
5233
- source: "file" /* File */,
5329
+ source: "saved-login" /* SavedLogin */,
5330
+ ...identityFields(tokens.accessToken, credentials),
5234
5331
  ...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
5235
5332
  ...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
5236
5333
  ...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
@@ -5243,7 +5340,12 @@ async function buildFileStatus(tokens, credentials, globalHint) {
5243
5340
  }
5244
5341
  return result;
5245
5342
  }
5343
+ function identityFields(accessToken, credentials) {
5344
+ const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
5345
+ return identity ? { identity } : {};
5346
+ }
5246
5347
  function buildRobotStatus(robotCreds) {
5348
+ const identity = resolveSessionIdentity(robotCreds.accessToken);
5247
5349
  return {
5248
5350
  loginStatus: "Logged in",
5249
5351
  accessToken: robotCreds.accessToken,
@@ -5254,7 +5356,8 @@ function buildRobotStatus(robotCreds) {
5254
5356
  tenantId: robotCreds.tenantId,
5255
5357
  issuer: robotCreds.issuer,
5256
5358
  expiration: getTokenExpiration(robotCreds.accessToken),
5257
- source: "robot" /* Robot */
5359
+ source: "robot" /* Robot */,
5360
+ ...identity ? { identity } : {}
5258
5361
  };
5259
5362
  }
5260
5363
  var isFileNotFoundError = (error) => {
@@ -5305,7 +5408,8 @@ async function circuitBreakerShortCircuit(ctx) {
5305
5408
  tenantName: credentials.UIPATH_TENANT_NAME,
5306
5409
  tenantId: credentials.UIPATH_TENANT_ID,
5307
5410
  expiration,
5308
- source: "file" /* File */
5411
+ source: "saved-login" /* SavedLogin */,
5412
+ ...identityFields(accessToken, credentials)
5309
5413
  } : {},
5310
5414
  hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
5311
5415
  refreshCircuitOpen: true,
@@ -5327,7 +5431,8 @@ async function lockAcquireFailureStatus(ctx, error) {
5327
5431
  tenantName: ctx.credentials.UIPATH_TENANT_NAME,
5328
5432
  tenantId: ctx.credentials.UIPATH_TENANT_ID,
5329
5433
  expiration: ctx.expiration,
5330
- source: "file" /* File */,
5434
+ source: "saved-login" /* SavedLogin */,
5435
+ ...identityFields(ctx.accessToken, ctx.credentials),
5331
5436
  hint: globalHint,
5332
5437
  tokenRefresh: {
5333
5438
  attempted: false,
@@ -5537,10 +5642,6 @@ var TENANT_SELECTION_CODES = new Set([
5537
5642
  ]);
5538
5643
  // ../auth/src/logout.ts
5539
5644
  init_src();
5540
-
5541
- // ../auth/src/index.ts
5542
- init_server();
5543
-
5544
5645
  // src/client-factory.ts
5545
5646
  async function createAgentRuntimeConfig(options) {
5546
5647
  const ctx = await getAuthContext({
@@ -6072,4 +6173,4 @@ export {
6072
6173
  AgentAppearanceFromJSON
6073
6174
  };
6074
6175
 
6075
- //# debugId=F97BC2C32214A60864756E2164756E21
6176
+ //# debugId=E1CA51B0582394AB64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uipath/agent-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 Agent Runtime API — evaluation execution and debug sessions.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -29,5 +29,5 @@
29
29
  "files": [
30
30
  "dist"
31
31
  ],
32
- "gitHead": "fcc01cdae81bbd0c25d3d4fc287537a9d19d99f4"
32
+ "gitHead": "f1086b73654d7728cb71f280588b3e0c77d535fc"
33
33
  }