@uipath/aops-policy-sdk 1.203.0-preview.212 → 1.204.0-preview.211

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 +149 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -971,8 +971,137 @@ function singleton(ctorOrName) {
971
971
  // ../../common/src/telemetry/global-telemetry-properties.ts
972
972
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
973
973
 
974
+ // ../../common/src/telemetry/telemetry-dimensions.ts
975
+ var BaseDimensions = {
976
+ ApplicationName: "ApplicationName",
977
+ ProductVersion: "ProductVersion",
978
+ InstallationId: "InstallationId",
979
+ CloudUserId: "CloudUserId",
980
+ CloudTenantId: "CloudTenantId",
981
+ CloudOrganizationId: "CloudOrganizationId",
982
+ IsInternalUser: "IsInternalUser",
983
+ Environment: "Environment",
984
+ BaseUrl: "BaseUrl",
985
+ Region: "Region",
986
+ Agent: "Agent",
987
+ AgentVersion: "AgentVersion",
988
+ AgentModel: "AgentModel",
989
+ ToolName: "ToolName",
990
+ ToolVersion: "ToolVersion",
991
+ ExecutionContext: "ExecutionContext",
992
+ CiProvider: "CiProvider",
993
+ SessionIdSource: "SessionIdSource",
994
+ SessionId: "SessionId"
995
+ };
996
+ var CommandDimensions = {
997
+ IsCommand: "IsCommand",
998
+ IsReexec: "IsReexec",
999
+ CommandName: "CommandName",
1000
+ ExitCode: "ExitCode",
1001
+ TerminalOutcome: "TerminalOutcome",
1002
+ ErrorClass: "ErrorClass",
1003
+ TerminalSignal: "TerminalSignal",
1004
+ ErrorMessage: "ErrorMessage",
1005
+ SkillName: "SkillName",
1006
+ ProductArea: "ProductArea",
1007
+ Mode: "Mode"
1008
+ };
1009
+ var ShipDimensions = {
1010
+ ShipKind: "ShipKind",
1011
+ Target: "Target",
1012
+ ProjectType: "ProjectType",
1013
+ ProjectTypes: "ProjectTypes",
1014
+ ArtifactCorrelationKey: "ArtifactCorrelationKey",
1015
+ PackageName: "PackageName",
1016
+ PackageVersion: "PackageVersion",
1017
+ PackageVersionKey: "PackageVersionKey",
1018
+ DeploymentKey: "DeploymentKey",
1019
+ SolutionId: "SolutionId",
1020
+ FolderKey: "FolderKey",
1021
+ FeedId: "FeedId"
1022
+ };
1023
+ var ErrorDimensions = {
1024
+ Result: "Result",
1025
+ ErrorCode: "ErrorCode",
1026
+ Retry: "Retry",
1027
+ ErrorMessage: "ErrorMessage"
1028
+ };
1029
+ var AuthDimensions = {
1030
+ AuthenticationMethod: "AuthenticationMethod",
1031
+ Success: "Success",
1032
+ Reason: "Reason"
1033
+ };
1034
+ var SkillsDimensions = {
1035
+ SchemaVersion: "SchemaVersion",
1036
+ AgentType: "AgentType",
1037
+ SkillsVersion: "SkillsVersion",
1038
+ UipSubcommand: "UipSubcommand",
1039
+ FileExtension: "FileExtension",
1040
+ SubagentModel: "SubagentModel",
1041
+ SubagentType: "SubagentType",
1042
+ PermissionMode: "PermissionMode",
1043
+ EffortLevel: "EffortLevel",
1044
+ SessionSource: "SessionSource",
1045
+ Outcome: "Outcome",
1046
+ DurationMs: "DurationMs",
1047
+ Source: "Source"
1048
+ };
1049
+ var PackagerDimensions = {
1050
+ ProjectId: "ProjectId",
1051
+ ProjectType: "ProjectType",
1052
+ SolutionId: "SolutionId"
1053
+ };
1054
+ var ScopeDimensions = {
1055
+ FolderId: "FolderId"
1056
+ };
1057
+ var ID_DIMENSIONS = new Set([
1058
+ BaseDimensions.CloudUserId,
1059
+ BaseDimensions.CloudTenantId,
1060
+ BaseDimensions.CloudOrganizationId,
1061
+ BaseDimensions.InstallationId,
1062
+ ShipDimensions.ArtifactCorrelationKey,
1063
+ ShipDimensions.PackageVersionKey,
1064
+ ShipDimensions.DeploymentKey,
1065
+ ShipDimensions.SolutionId,
1066
+ ShipDimensions.FolderKey,
1067
+ ShipDimensions.FeedId,
1068
+ PackagerDimensions.ProjectId
1069
+ ]);
1070
+ var RESERVED_DIMENSION_NAMES = new Set([
1071
+ ...Object.values(BaseDimensions),
1072
+ ...Object.values(CommandDimensions),
1073
+ ...Object.values(ShipDimensions),
1074
+ ...Object.values(ErrorDimensions),
1075
+ ...Object.values(AuthDimensions),
1076
+ ...Object.values(SkillsDimensions),
1077
+ ...Object.values(PackagerDimensions),
1078
+ ...Object.values(ScopeDimensions)
1079
+ ]);
1080
+ var CURATED_DIMENSIONS = new Set([
1081
+ BaseDimensions.ApplicationName,
1082
+ BaseDimensions.ProductVersion,
1083
+ BaseDimensions.InstallationId,
1084
+ BaseDimensions.CloudUserId,
1085
+ BaseDimensions.CloudTenantId,
1086
+ BaseDimensions.CloudOrganizationId,
1087
+ BaseDimensions.IsInternalUser,
1088
+ BaseDimensions.Environment,
1089
+ BaseDimensions.BaseUrl,
1090
+ BaseDimensions.Region,
1091
+ BaseDimensions.Agent,
1092
+ BaseDimensions.AgentVersion,
1093
+ BaseDimensions.ToolVersion,
1094
+ BaseDimensions.ExecutionContext,
1095
+ BaseDimensions.CiProvider,
1096
+ BaseDimensions.SessionIdSource,
1097
+ BaseDimensions.SessionId,
1098
+ ...Object.values(CommandDimensions),
1099
+ ...Object.values(ShipDimensions)
1100
+ ]);
1101
+
974
1102
  // ../../common/src/sdk-user-agent.ts
975
1103
  var USER_AGENT_HEADER = "User-Agent";
1104
+ var AGENT_PROPERTY = BaseDimensions.Agent;
976
1105
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
977
1106
  function userAgentPatchKey(userAgent) {
978
1107
  return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
@@ -1346,7 +1475,7 @@ var package_default = {
1346
1475
  name: "@uipath/aops-policy-sdk",
1347
1476
  author: "UiPath",
1348
1477
  license: "SEE LICENSE IN LICENSE.txt",
1349
- version: "1.203.0-preview.212",
1478
+ version: "1.204.0-preview.211",
1350
1479
  description: "SDK for the UiPath AOps Governance API — policy management and deployment.",
1351
1480
  repository: {
1352
1481
  type: "git",
@@ -1381,6 +1510,7 @@ var package_default = {
1381
1510
  private: false,
1382
1511
  scripts: {
1383
1512
  build: "bun build ./src/index.ts ./src/policy-resolver.ts --outdir dist --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
1513
+ typecheck: "tsc --noEmit",
1384
1514
  generate: "bun run src/scripts/generate-sdk.ts",
1385
1515
  lint: "biome check .",
1386
1516
  test: "vitest run"
@@ -7080,6 +7210,11 @@ var pickName = (claims) => {
7080
7210
  const username = asString(claims?.preferred_username);
7081
7211
  return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
7082
7212
  };
7213
+ var pickScopes = (claims) => {
7214
+ const raw = claims?.scope;
7215
+ const scopes = Array.isArray(raw) ? raw.filter((entry) => asString(entry) !== undefined) : typeof raw === "string" ? raw.split(/\s+/).filter(Boolean) : [];
7216
+ return scopes.length > 0 ? scopes : undefined;
7217
+ };
7083
7218
  var resolveSessionIdentity = (accessToken, authFlow) => {
7084
7219
  const claims = accessToken ? decodeClaims(accessToken) : undefined;
7085
7220
  const email = pickEmail(claims);
@@ -7105,6 +7240,7 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
7105
7240
  identity.clientId = clientId;
7106
7241
  return identity;
7107
7242
  };
7243
+ var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
7108
7244
 
7109
7245
  // ../../auth/src/envAuth.ts
7110
7246
  var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
@@ -7177,6 +7313,7 @@ var readAuthFromEnv = () => {
7177
7313
  const expiration = getTokenExpiration(accessToken);
7178
7314
  const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
7179
7315
  const identity = resolveSessionIdentity(accessToken);
7316
+ const scopes = readTokenScopes(accessToken);
7180
7317
  return {
7181
7318
  loginStatus,
7182
7319
  accessToken,
@@ -7187,7 +7324,8 @@ var readAuthFromEnv = () => {
7187
7324
  tenantId,
7188
7325
  expiration,
7189
7326
  source: "env-vars" /* EnvironmentVariables */,
7190
- ...identity ? { identity } : {}
7327
+ ...identity ? { identity } : {},
7328
+ ...scopes ? { scopes } : {}
7191
7329
  };
7192
7330
  };
7193
7331
 
@@ -7829,10 +7967,15 @@ async function buildFileStatus(tokens, credentials, globalHint) {
7829
7967
  }
7830
7968
  function identityFields(accessToken, credentials) {
7831
7969
  const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
7832
- return identity ? { identity } : {};
7970
+ const scopes = readTokenScopes(accessToken);
7971
+ return {
7972
+ ...identity ? { identity } : {},
7973
+ ...scopes ? { scopes } : {}
7974
+ };
7833
7975
  }
7834
7976
  function buildRobotStatus(robotCreds) {
7835
7977
  const identity = resolveSessionIdentity(robotCreds.accessToken);
7978
+ const scopes = readTokenScopes(robotCreds.accessToken);
7836
7979
  return {
7837
7980
  loginStatus: "Logged in",
7838
7981
  accessToken: robotCreds.accessToken,
@@ -7844,7 +7987,8 @@ function buildRobotStatus(robotCreds) {
7844
7987
  issuer: robotCreds.issuer,
7845
7988
  expiration: getTokenExpiration(robotCreds.accessToken),
7846
7989
  source: "robot" /* Robot */,
7847
- ...identity ? { identity } : {}
7990
+ ...identity ? { identity } : {},
7991
+ ...scopes ? { scopes } : {}
7848
7992
  };
7849
7993
  }
7850
7994
  var isFileNotFoundError = (error) => {
@@ -8538,4 +8682,4 @@ export {
8538
8682
  querystring
8539
8683
  };
8540
8684
 
8541
- //# debugId=0D6FB04F5E86F5A364756E2164756E21
8685
+ //# debugId=12ECAE1C7963767D64756E2164756E21
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/aops-policy-sdk",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.203.0-preview.212",
5
+ "version": "1.204.0-preview.211",
6
6
  "description": "SDK for the UiPath AOps Governance API — policy management and deployment.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -35,5 +35,5 @@
35
35
  "dist"
36
36
  ],
37
37
  "private": false,
38
- "gitHead": "15094ce85cf76c59a54affbed3304febc271f41a"
38
+ "gitHead": "275e01f1f6098d4c3bc9673f5225f33372822534"
39
39
  }