@uipath/aops-tool 1.204.0-preview.254 → 1.205.0-preview.256

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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-r0y4emr3.js";
6
+ } from "./tool-m854xbpw.js";
7
7
  import"./tool-1de529jm.js";
8
8
 
9
9
  // src/index.ts
@@ -2101,7 +2101,7 @@ var package_default = {
2101
2101
  name: "@uipath/aops-tool",
2102
2102
  author: "UiPath",
2103
2103
  license: "SEE LICENSE IN LICENSE.txt",
2104
- version: "1.204.0-preview.254",
2104
+ version: "1.205.0-preview.256",
2105
2105
  description: "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
2106
2106
  private: false,
2107
2107
  repository: {
@@ -2325,6 +2325,16 @@ class NodeFileSystem {
2325
2325
  async rename(oldPath, newPath) {
2326
2326
  await fs.rename(oldPath, newPath);
2327
2327
  }
2328
+ async isSymbolicLink(filePath) {
2329
+ try {
2330
+ return (await fs.lstat(filePath)).isSymbolicLink();
2331
+ } catch (error) {
2332
+ if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
2333
+ return false;
2334
+ }
2335
+ throw error;
2336
+ }
2337
+ }
2328
2338
  async realpath(filePath) {
2329
2339
  try {
2330
2340
  return await fs.realpath(filePath);
@@ -3360,7 +3370,7 @@ function setGlobalLogFilePath(path2) {
3360
3370
  function getGlobalLogFilePath() {
3361
3371
  return logFilePathSlot.get("");
3362
3372
  }
3363
- var DEFAULT_LOG_LEVEL = 3 /* ERROR */;
3373
+ var DEFAULT_LOG_LEVEL = 2 /* WARN */;
3364
3374
 
3365
3375
  class SimpleLogger {
3366
3376
  __brand = "SimpleLogger";
@@ -3627,7 +3637,9 @@ var ErrorDimensions = {
3627
3637
  Result: "Result",
3628
3638
  ErrorCode: "ErrorCode",
3629
3639
  Retry: "Retry",
3630
- ErrorMessage: "ErrorMessage"
3640
+ ErrorMessage: "ErrorMessage",
3641
+ HttpStatus: "HttpStatus",
3642
+ UpstreamErrorCode: "UpstreamErrorCode"
3631
3643
  };
3632
3644
  var AuthDimensions = {
3633
3645
  AuthenticationMethod: "AuthenticationMethod",
@@ -4615,7 +4627,9 @@ var CLI_ERROR_CODES = [
4615
4627
  "timeout",
4616
4628
  "server_error",
4617
4629
  "method_not_allowed",
4630
+ "not_supported",
4618
4631
  "configuration_error",
4632
+ "execution_failed",
4619
4633
  "unknown_error"
4620
4634
  ];
4621
4635
  var RETRY_HINTS = [
@@ -5572,7 +5586,9 @@ var OutputFormatter;
5572
5586
  [ErrorDimensions.Result]: data.Result,
5573
5587
  [ErrorDimensions.ErrorCode]: data.ErrorCode,
5574
5588
  [ErrorDimensions.Retry]: data.Retry,
5575
- [ErrorDimensions.ErrorMessage]: data.Message
5589
+ [ErrorDimensions.ErrorMessage]: data.Message,
5590
+ [ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
5591
+ [ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
5576
5592
  });
5577
5593
  }
5578
5594
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -7218,7 +7234,7 @@ var package_default2 = {
7218
7234
  name: "@uipath/sc-sdk",
7219
7235
  author: "UiPath",
7220
7236
  license: "SEE LICENSE IN LICENSE.txt",
7221
- version: "1.204.0",
7237
+ version: "1.205.0",
7222
7238
  description: "SDK for the UiPath SourceControl API — connections, repositories, automation projects, solutions.",
7223
7239
  repository: {
7224
7240
  type: "git",
@@ -8513,22 +8529,12 @@ var resolveConfigAsync = async ({
8513
8529
  baseUrl = DEFAULT_BASE_URL;
8514
8530
  }
8515
8531
  baseUrl = normalizeAndValidateBaseUrl(baseUrl);
8516
- let clientId = customClientId;
8517
- if (!clientId && fileAuth.clientId) {
8518
- clientId = fileAuth.clientId;
8519
- }
8520
- if (!clientId) {
8521
- clientId = DEFAULT_CLIENT_ID;
8522
- }
8523
- let clientSecret = customClientSecret;
8524
- if (!clientSecret && fileAuth.clientSecret) {
8525
- clientSecret = fileAuth.clientSecret;
8526
- }
8527
- const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
8532
+ const clientId = customClientId || DEFAULT_CLIENT_ID;
8533
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(customClientSecret) || Boolean(customClientAssertion));
8528
8534
  const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
8529
8535
  return {
8530
8536
  clientId,
8531
- clientSecret,
8537
+ clientSecret: customClientSecret,
8532
8538
  scopes,
8533
8539
  baseUrl,
8534
8540
  authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
@@ -8702,6 +8708,16 @@ var resolveIdentityType = (claims, authFlow, email) => {
8702
8708
  }
8703
8709
  return;
8704
8710
  };
8711
+ var resolveApplicationSubtype = (claims, authFlow) => {
8712
+ switch (asString(claims?.sub_type)) {
8713
+ case "service.external":
8714
+ return "External";
8715
+ case "service.internal":
8716
+ return "Internal";
8717
+ default:
8718
+ return authFlow === "client_credentials" || authFlow === "federated_credentials" ? "External" : undefined;
8719
+ }
8720
+ };
8705
8721
  var looksLikeEmail = (value) => value?.includes("@") ?? false;
8706
8722
  var pickEmail = (claims) => {
8707
8723
  for (const candidate of [claims?.email, claims?.preferred_username]) {
@@ -8743,6 +8759,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
8743
8759
  const clientId = asString(claims?.client_id);
8744
8760
  if (clientId)
8745
8761
  identity.clientId = clientId;
8762
+ const subType = asString(claims?.sub_type);
8763
+ if (subType)
8764
+ identity.subType = subType;
8765
+ const applicationSubtype = resolveApplicationSubtype(claims, authFlow);
8766
+ if (applicationSubtype)
8767
+ identity.applicationSubtype = applicationSubtype;
8746
8768
  return identity;
8747
8769
  };
8748
8770
  var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
@@ -9035,6 +9057,40 @@ var tryRobotClientFallback = async (options = {}) => {
9035
9057
  }
9036
9058
  };
9037
9059
 
9060
+ // ../auth/src/tenantSelection.ts
9061
+ var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
9062
+ var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
9063
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
9064
+ var describeNonJsonResponse = (organizationId, response, parseError) => {
9065
+ if (response.redirected) {
9066
+ 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}`;
9067
+ }
9068
+ const contentType = response.headers.get("content-type") ?? "unknown";
9069
+ return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
9070
+ };
9071
+ var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
9072
+ const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
9073
+ const response = await fetch(url, {
9074
+ headers: {
9075
+ Authorization: `Bearer ${accessToken}`
9076
+ },
9077
+ ...signal ? { signal } : {}
9078
+ });
9079
+ if (!response.ok) {
9080
+ if (response.status === 401) {
9081
+ 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);
9082
+ }
9083
+ const errorText = await response.text();
9084
+ const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
9085
+ throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
9086
+ }
9087
+ const [parseError, data] = await catchError2(response.json());
9088
+ if (parseError) {
9089
+ throw new Error(describeNonJsonResponse(organizationId, response, parseError));
9090
+ }
9091
+ return data;
9092
+ };
9093
+
9038
9094
  // ../auth/src/tokenRefresh.ts
9039
9095
  var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
9040
9096
 
@@ -9247,6 +9303,8 @@ var saveEnvFileAsync = async ({
9247
9303
  };
9248
9304
 
9249
9305
  // ../auth/src/loginStatus.ts
9306
+ var defaultRobotTenantIdCache = new Map;
9307
+ var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
9250
9308
  var getLoginStatusAsync = async (options = {}) => {
9251
9309
  return getLoginStatusWithDeps(options);
9252
9310
  };
@@ -9259,12 +9317,20 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
9259
9317
  refreshToken: refreshTokenFn = refreshAccessToken,
9260
9318
  resolveConfig: resolveConfig2 = resolveConfigAsync,
9261
9319
  robotFallback = tryRobotClientFallback,
9320
+ fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
9321
+ robotTenantIdCache = defaultRobotTenantIdCache,
9322
+ robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
9262
9323
  loadBreaker = loadRefreshBreaker,
9263
9324
  saveBreaker = saveRefreshBreaker,
9264
9325
  clearBreaker = clearRefreshBreaker
9265
9326
  } = deps;
9327
+ const robotDeps = {
9328
+ fetchTenantsAndOrgs,
9329
+ cache: robotTenantIdCache,
9330
+ lookupTimeoutMs: robotTenantLookupTimeoutMs
9331
+ };
9266
9332
  if (isRobotAuthEnforced()) {
9267
- return resolveRobotEnforcedStatus(robotFallback);
9333
+ return resolveRobotEnforcedStatus(robotFallback, robotDeps);
9268
9334
  }
9269
9335
  if (isEnvAuthEnabled()) {
9270
9336
  return readAuthFromEnv();
@@ -9282,7 +9348,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
9282
9348
  hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
9283
9349
  };
9284
9350
  }
9285
- return resolveBorrowedRobotStatus(robotFallback);
9351
+ return resolveBorrowedRobotStatus(robotFallback, robotDeps);
9286
9352
  }
9287
9353
  const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
9288
9354
  if ("status" in loaded) {
@@ -9324,7 +9390,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
9324
9390
  }
9325
9391
  return buildFileStatus(tokens, credentials, globalHint);
9326
9392
  };
9327
- async function resolveRobotEnforcedStatus(robotFallback) {
9393
+ async function resolveRobotEnforcedStatus(robotFallback, deps) {
9328
9394
  if (isEnvAuthEnabled()) {
9329
9395
  throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
9330
9396
  }
@@ -9335,11 +9401,11 @@ async function resolveRobotEnforcedStatus(robotFallback) {
9335
9401
  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.`
9336
9402
  };
9337
9403
  }
9338
- return buildRobotStatus(robotCreds);
9404
+ return buildRobotStatus(robotCreds, deps);
9339
9405
  }
9340
- async function resolveBorrowedRobotStatus(robotFallback) {
9406
+ async function resolveBorrowedRobotStatus(robotFallback, deps) {
9341
9407
  const robotCreds = await robotFallback();
9342
- return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
9408
+ return robotCreds ? buildRobotStatus(robotCreds, deps) : { loginStatus: "Not logged in" };
9343
9409
  }
9344
9410
  async function loadFileCredentials(loadEnvFile, absolutePath) {
9345
9411
  let credentials;
@@ -9474,9 +9540,10 @@ function identityFields(accessToken, credentials) {
9474
9540
  ...scopes ? { scopes } : {}
9475
9541
  };
9476
9542
  }
9477
- function buildRobotStatus(robotCreds) {
9543
+ async function buildRobotStatus(robotCreds, deps) {
9478
9544
  const identity = resolveSessionIdentity(robotCreds.accessToken);
9479
9545
  const scopes = readTokenScopes(robotCreds.accessToken);
9546
+ const tenant = robotCreds.tenantId ? { tenantId: robotCreds.tenantId } : await resolveRobotTenantId(robotCreds, deps);
9480
9547
  return {
9481
9548
  loginStatus: "Logged in",
9482
9549
  accessToken: robotCreds.accessToken,
@@ -9484,14 +9551,62 @@ function buildRobotStatus(robotCreds) {
9484
9551
  organizationName: robotCreds.organizationName,
9485
9552
  organizationId: robotCreds.organizationId,
9486
9553
  tenantName: robotCreds.tenantName,
9487
- tenantId: robotCreds.tenantId,
9554
+ tenantId: tenant.tenantId,
9488
9555
  issuer: robotCreds.issuer,
9489
9556
  expiration: getTokenExpiration(robotCreds.accessToken),
9490
9557
  source: "robot" /* Robot */,
9558
+ ...tenant.hint ? { hint: tenant.hint } : {},
9491
9559
  ...identity ? { identity } : {},
9492
9560
  ...scopes ? { scopes } : {}
9493
9561
  };
9494
9562
  }
9563
+ async function resolveRobotTenantId(robotCreds, deps) {
9564
+ const { baseUrl, accessToken, tenantName } = robotCreds;
9565
+ const organization = robotCreds.organizationName ?? robotCreds.organizationId;
9566
+ if (!tenantName || !organization) {
9567
+ return {};
9568
+ }
9569
+ const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
9570
+ let pending = deps.cache.get(key);
9571
+ if (!pending) {
9572
+ pending = catchError2(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
9573
+ const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
9574
+ if (!settled.tenantId) {
9575
+ deps.cache.delete(key);
9576
+ }
9577
+ return settled;
9578
+ });
9579
+ deps.cache.set(key, pending);
9580
+ }
9581
+ return pending;
9582
+ }
9583
+ async function lookupRobotTenantId(target, deps) {
9584
+ const { baseUrl, accessToken, organization, tenantName } = target;
9585
+ const [error, data] = await catchError2(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
9586
+ if (error) {
9587
+ const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
9588
+ return { hint: tenantLookupFailureHint(tenantName, reason) };
9589
+ }
9590
+ const rows = data?.tenants;
9591
+ const tenants = Array.isArray(rows) ? rows.filter((tenant) => typeof tenant?.id === "string" && typeof tenant?.name === "string") : [];
9592
+ const wantedName = decodePathSegment(tenantName);
9593
+ const wanted = wantedName.toLowerCase();
9594
+ const match = tenants.find((tenant) => tenant.name === wantedName) ?? tenants.find((tenant) => tenant.name.toLowerCase() === wanted);
9595
+ if (!match) {
9596
+ const names = tenants.map((tenant) => tenant.name).join(", ");
9597
+ return {
9598
+ 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.`
9599
+ };
9600
+ }
9601
+ return { tenantId: match.id };
9602
+ }
9603
+ function tenantLookupFailureHint(tenantName, reason) {
9604
+ 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.`;
9605
+ }
9606
+ function decodePathSegment(segment) {
9607
+ const [error, decoded] = catchError2(() => decodeURIComponent(segment));
9608
+ return error ? segment : decoded;
9609
+ }
9495
9610
  var isFileNotFoundError = (error) => {
9496
9611
  if (!(error instanceof Object))
9497
9612
  return false;
@@ -9760,9 +9875,6 @@ var getAuthContext = async (options = {}) => {
9760
9875
  identity: status.identity
9761
9876
  };
9762
9877
  };
9763
- // ../auth/src/tenantSelection.ts
9764
- var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
9765
-
9766
9878
  // ../auth/src/selectTenant.ts
9767
9879
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
9768
9880
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -10055,7 +10167,7 @@ var package_default3 = {
10055
10167
  name: "@uipath/cicd-sdk",
10056
10168
  author: "UiPath",
10057
10169
  license: "SEE LICENSE IN LICENSE.txt",
10058
- version: "1.204.0",
10170
+ version: "1.205.0",
10059
10171
  description: "SDK for the UiPath StudioAdmin CICD API — pipelines, pipeline executions, partition configuration.",
10060
10172
  repository: {
10061
10173
  type: "git",
@@ -13906,4 +14018,4 @@ var registerCommands = async (program2) => {
13906
14018
 
13907
14019
  export { Command, metadata, registerCommands };
13908
14020
 
13909
- //# debugId=E2A3DE7BE612E65B64756E2164756E21
14021
+ //# debugId=8B12485983B70B2064756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-r0y4emr3.js";
4
+ } from "./tool-m854xbpw.js";
5
5
  import"./tool-1de529jm.js";
6
6
  export {
7
7
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/aops-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.204.0-preview.254",
5
+ "version": "1.205.0-preview.256",
6
6
  "description": "Manage UiPath StudioAdmin AOps — connections, repos, projects, solutions, pipelines, executions.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "3ee79cdec05b36231a8da9e8de6bf0043585526a"
30
+ "gitHead": "63740c6cbb7ff282fa9118cc16a148eb030b245f"
31
31
  }