@uipath/insights-tool 1.204.0 → 1.205.0-preview.258

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.
@@ -22,6 +22,7 @@ import {
22
22
  hasUnreadBody,
23
23
  isRecord,
24
24
  isTemplateKeyedDashboardId,
25
+ joinParts,
25
26
  listDashboardFilters,
26
27
  overPagedNote,
27
28
  resolveInsightsConfig,
@@ -30,7 +31,7 @@ import {
30
31
  writeInsightsFailure,
31
32
  writeInsightsNotFound,
32
33
  writeNetworkFailure
33
- } from "./tool-r32j3rq9.js";
34
+ } from "./tool-hkc3xm98.js";
34
35
 
35
36
  // src/utils/validate.ts
36
37
  var TIME_GROUPING_SIZES = ["FifteenMinutes", "Hour", "Day"];
@@ -910,7 +911,10 @@ function buildFiltersInstructions(total, pageLength, hasMore) {
910
911
  if (pageLength === 0) {
911
912
  return overPagedNote(total, FILTERS_OVER_PAGED_SCOPE);
912
913
  }
913
- return [FILTERS_SCOPE_NOTE, hasMore ? truncatedNote("a filter") : ""].filter((part) => part !== "").join(" ");
914
+ return joinParts([
915
+ FILTERS_SCOPE_NOTE,
916
+ hasMore ? truncatedNote("a filter") : ""
917
+ ]);
914
918
  }
915
919
  function writeFiltersNotFound(error, sourceType) {
916
920
  writeInsightsNotFound(error, `The dashboard filter list returned HTTP 404 for source type ${sourceType}.`, `'${sourceType}' is not a built-in source type, so it must be registered as a data model of the active tenant. ${GATE_SENTENCE}`);
@@ -1237,4 +1241,4 @@ async function sendCreate(config, prepared, slot) {
1237
1241
 
1238
1242
  export { TIME_GROUPING_SIZES, validateTimeSelection, findBodyTenantMismatch, CHART_TYPES, DEFINITION_FILE_RECOVERY, INT32_MAX, sanitizeDashboardDefinition, findRendererFault, findUnknownTables, findDashboardInputFault, readJsonFile, serializeJsonFile, writeJsonFile, DASHBOARDS_FAMILY, isSavedDashboardId, trimDashboardId, requireDashboardId, shellQuote, sourceTypeFlag, trimOption, resolveSourceType, RENDER_CAVEAT, classifyDashboardWrite400Branch, dashboardWrite400Failure, writeUnknownWriteOutcome, countCharts, caseFlag, slotReadCommand, writeDashboardGetError, executeDashboardGet, executeDashboardFiltersList, readAoDashboard, readSlot, writeSlotOccupied, nothingWritten, prepareDefinition, modelTableIds, modelFieldIds, readBackFailure, writeReadBackFailed, defaultedFilterValuesSentence, executeDashboardCreate, projectWriteOutcome, postDashboardCreate };
1239
1243
 
1240
- //# debugId=FD03924BA63D1A0864756E2164756E21
1244
+ //# debugId=06211865E08D83EE64756E2164756E21
@@ -2277,6 +2277,16 @@ class NodeFileSystem {
2277
2277
  async rename(oldPath, newPath) {
2278
2278
  await fs.rename(oldPath, newPath);
2279
2279
  }
2280
+ async isSymbolicLink(filePath) {
2281
+ try {
2282
+ return (await fs.lstat(filePath)).isSymbolicLink();
2283
+ } catch (error) {
2284
+ if (this.isEnoent(error) || this.hasErrnoCode(error, "ENOTDIR")) {
2285
+ return false;
2286
+ }
2287
+ throw error;
2288
+ }
2289
+ }
2280
2290
  async realpath(filePath) {
2281
2291
  try {
2282
2292
  return await fs.realpath(filePath);
@@ -3045,7 +3055,7 @@ function setGlobalLogFilePath(path2) {
3045
3055
  function getGlobalLogFilePath() {
3046
3056
  return logFilePathSlot.get("");
3047
3057
  }
3048
- var DEFAULT_LOG_LEVEL = 3 /* ERROR */;
3058
+ var DEFAULT_LOG_LEVEL = 2 /* WARN */;
3049
3059
 
3050
3060
  class SimpleLogger {
3051
3061
  __brand = "SimpleLogger";
@@ -3312,7 +3322,9 @@ var ErrorDimensions = {
3312
3322
  Result: "Result",
3313
3323
  ErrorCode: "ErrorCode",
3314
3324
  Retry: "Retry",
3315
- ErrorMessage: "ErrorMessage"
3325
+ ErrorMessage: "ErrorMessage",
3326
+ HttpStatus: "HttpStatus",
3327
+ UpstreamErrorCode: "UpstreamErrorCode"
3316
3328
  };
3317
3329
  var AuthDimensions = {
3318
3330
  AuthenticationMethod: "AuthenticationMethod",
@@ -4300,7 +4312,9 @@ var CLI_ERROR_CODES = [
4300
4312
  "timeout",
4301
4313
  "server_error",
4302
4314
  "method_not_allowed",
4315
+ "not_supported",
4303
4316
  "configuration_error",
4317
+ "execution_failed",
4304
4318
  "unknown_error"
4305
4319
  ];
4306
4320
  var RETRY_HINTS = [
@@ -5290,7 +5304,9 @@ var OutputFormatter;
5290
5304
  [ErrorDimensions.Result]: data.Result,
5291
5305
  [ErrorDimensions.ErrorCode]: data.ErrorCode,
5292
5306
  [ErrorDimensions.Retry]: data.Retry,
5293
- [ErrorDimensions.ErrorMessage]: data.Message
5307
+ [ErrorDimensions.ErrorMessage]: data.Message,
5308
+ [ErrorDimensions.HttpStatus]: data.Context?.httpStatus?.toString(),
5309
+ [ErrorDimensions.UpstreamErrorCode]: data.Context?.errorCode
5294
5310
  });
5295
5311
  }
5296
5312
  logOutput(normalizeOutputKeys(envelope), getOutputFormat());
@@ -6226,6 +6242,19 @@ var KNOWN_ERROR_LABELS = new Set([
6226
6242
  DASHBOARD_NOT_FOUND_LABEL,
6227
6243
  MODEL_NOT_FOUND_LABEL
6228
6244
  ]);
6245
+ var PORTAL_ERROR_CODE = {
6246
+ InvalidUserInput: 6,
6247
+ LookerUnavailableError: 8,
6248
+ PermissionsUserUnauthorized: 10,
6249
+ UnableToGetEmbedLink: 23,
6250
+ UnableToRetrieveDashboards: 26
6251
+ };
6252
+ var LOOKER_USER_UNAVAILABLE_MESSAGE = "Unable to get Looker userInfo";
6253
+ var LOOKER_NO_DASHBOARDS_MESSAGE = "Unable to retrieve dashboards";
6254
+ var KNOWN_PORTAL_ERROR_MESSAGES = new Set([
6255
+ LOOKER_USER_UNAVAILABLE_MESSAGE,
6256
+ LOOKER_NO_DASHBOARDS_MESSAGE
6257
+ ]);
6229
6258
 
6230
6259
  class InsightsHttpError extends Error {
6231
6260
  status;
@@ -6272,7 +6301,7 @@ var package_default = {
6272
6301
  name: "@uipath/insights-sdk",
6273
6302
  author: "UiPath",
6274
6303
  license: "SEE LICENSE IN LICENSE.txt",
6275
- version: "1.204.0",
6304
+ version: "1.205.0-preview.258",
6276
6305
  description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
6277
6306
  repository: {
6278
6307
  type: "git",
@@ -6477,6 +6506,16 @@ var INSIGHTS_ROUTES = {
6477
6506
  method: "POST",
6478
6507
  template: "Authorization/tenant/insights"
6479
6508
  },
6509
+ lookerDashboardsList: {
6510
+ service: "portal",
6511
+ method: "GET",
6512
+ template: "AllDashboards/folders"
6513
+ },
6514
+ lookerDashboardEmbedUrl: {
6515
+ service: "portal",
6516
+ method: "POST",
6517
+ template: "DashboardUrl"
6518
+ },
6480
6519
  exportConfigurationsList: {
6481
6520
  service: "portal",
6482
6521
  method: "GET",
@@ -6578,9 +6617,43 @@ function buildServiceHeaders(config, route, hasBody) {
6578
6617
  return headers;
6579
6618
  }
6580
6619
  var MODEL_PATH_PATTERN = /^[A-Za-z0-9_.[\]]{1,200}$/;
6620
+ var MAX_PORTAL_ERROR_CODE = 999;
6621
+ function isJsonObject(value) {
6622
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6623
+ }
6624
+ function readPortalErrorCode(error) {
6625
+ if (!isJsonObject(error)) {
6626
+ return;
6627
+ }
6628
+ const code = error.errorCode;
6629
+ if (typeof code !== "number" || !Number.isInteger(code) || code < 0 || code > MAX_PORTAL_ERROR_CODE) {
6630
+ return;
6631
+ }
6632
+ return code;
6633
+ }
6634
+ function readPortalErrorMessage(error) {
6635
+ if (!isJsonObject(error)) {
6636
+ return;
6637
+ }
6638
+ const message = error.message;
6639
+ if (typeof message !== "string" || !KNOWN_PORTAL_ERROR_MESSAGES.has(message)) {
6640
+ return;
6641
+ }
6642
+ return message;
6643
+ }
6644
+ function liftPortalError(hint, error) {
6645
+ const portalErrorCode = readPortalErrorCode(error);
6646
+ if (portalErrorCode !== undefined) {
6647
+ hint.portalErrorCode = portalErrorCode;
6648
+ }
6649
+ const portalErrorMessage = readPortalErrorMessage(error);
6650
+ if (portalErrorMessage !== undefined) {
6651
+ hint.portalErrorMessage = portalErrorMessage;
6652
+ }
6653
+ }
6581
6654
  function describeJsonErrorBody(parsed) {
6582
6655
  if (typeof parsed === "string") {
6583
- return { shape: "string" };
6656
+ return describeStringErrorBody(parsed);
6584
6657
  }
6585
6658
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
6586
6659
  return { shape: "other" };
@@ -6600,6 +6673,19 @@ function describeJsonErrorBody(parsed) {
6600
6673
  hint.firstInvalidField = firstKey;
6601
6674
  }
6602
6675
  }
6676
+ liftPortalError(hint, record.error);
6677
+ return hint;
6678
+ }
6679
+ function describeStringErrorBody(parsed) {
6680
+ const hint = { shape: "string" };
6681
+ const [parseError, inner] = catchError(() => JSON.parse(parsed));
6682
+ if (parseError) {
6683
+ return hint;
6684
+ }
6685
+ if (!isJsonObject(inner)) {
6686
+ return hint;
6687
+ }
6688
+ liftPortalError(hint, inner.error);
6603
6689
  return hint;
6604
6690
  }
6605
6691
  function describeErrorBody(text) {
@@ -7188,22 +7274,12 @@ var resolveConfigAsync = async ({
7188
7274
  baseUrl = DEFAULT_BASE_URL;
7189
7275
  }
7190
7276
  baseUrl = normalizeAndValidateBaseUrl(baseUrl);
7191
- let clientId = customClientId;
7192
- if (!clientId && fileAuth.clientId) {
7193
- clientId = fileAuth.clientId;
7194
- }
7195
- if (!clientId) {
7196
- clientId = DEFAULT_CLIENT_ID;
7197
- }
7198
- let clientSecret = customClientSecret;
7199
- if (!clientSecret && fileAuth.clientSecret) {
7200
- clientSecret = fileAuth.clientSecret;
7201
- }
7202
- const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(clientSecret) || Boolean(customClientAssertion));
7277
+ const clientId = customClientId || DEFAULT_CLIENT_ID;
7278
+ const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && (Boolean(customClientSecret) || Boolean(customClientAssertion));
7203
7279
  const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
7204
7280
  return {
7205
7281
  clientId,
7206
- clientSecret,
7282
+ clientSecret: customClientSecret,
7207
7283
  scopes,
7208
7284
  baseUrl,
7209
7285
  authorizationEndpoint: `${baseUrl}/identity_/connect/authorize`,
@@ -7377,6 +7453,16 @@ var resolveIdentityType = (claims, authFlow, email) => {
7377
7453
  }
7378
7454
  return;
7379
7455
  };
7456
+ var resolveApplicationSubtype = (claims, authFlow) => {
7457
+ switch (asString(claims?.sub_type)) {
7458
+ case "service.external":
7459
+ return "External";
7460
+ case "service.internal":
7461
+ return "Internal";
7462
+ default:
7463
+ return authFlow === "client_credentials" || authFlow === "federated_credentials" ? "External" : undefined;
7464
+ }
7465
+ };
7380
7466
  var looksLikeEmail = (value) => value?.includes("@") ?? false;
7381
7467
  var pickEmail = (claims) => {
7382
7468
  for (const candidate of [claims?.email, claims?.preferred_username]) {
@@ -7418,6 +7504,12 @@ var resolveSessionIdentity = (accessToken, authFlow) => {
7418
7504
  const clientId = asString(claims?.client_id);
7419
7505
  if (clientId)
7420
7506
  identity.clientId = clientId;
7507
+ const subType = asString(claims?.sub_type);
7508
+ if (subType)
7509
+ identity.subType = subType;
7510
+ const applicationSubtype = resolveApplicationSubtype(claims, authFlow);
7511
+ if (applicationSubtype)
7512
+ identity.applicationSubtype = applicationSubtype;
7421
7513
  return identity;
7422
7514
  };
7423
7515
  var readTokenScopes = (accessToken) => accessToken ? pickScopes(decodeClaims(accessToken)) : undefined;
@@ -7710,6 +7802,40 @@ var tryRobotClientFallback = async (options = {}) => {
7710
7802
  }
7711
7803
  };
7712
7804
 
7805
+ // ../auth/src/tenantSelection.ts
7806
+ var LOGIN_STATUS_HINT = "Run 'uip login status' to see the organization the CLI is signed in to.";
7807
+ var organizationHint = (organizationId) => `The request used '${organizationId}' as the organization. ${LOGIN_STATUS_HINT}`;
7808
+ var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
7809
+ var describeNonJsonResponse = (organizationId, response, parseError) => {
7810
+ if (response.redirected) {
7811
+ 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}`;
7812
+ }
7813
+ const contentType = response.headers.get("content-type") ?? "unknown";
7814
+ return `The organization service returned a '${contentType}' response instead ` + `of JSON: ${parseError.message}. ${organizationHint(organizationId)}`;
7815
+ };
7816
+ var fetchTenantsAndOrganizations = async (baseUrl, accessToken, organizationId, signal) => {
7817
+ const url = `${baseUrl}/${organizationId}/portal_/api/filtering/leftnav/tenantsAndOrganizationInfo`;
7818
+ const response = await fetch(url, {
7819
+ headers: {
7820
+ Authorization: `Bearer ${accessToken}`
7821
+ },
7822
+ ...signal ? { signal } : {}
7823
+ });
7824
+ if (!response.ok) {
7825
+ if (response.status === 401) {
7826
+ 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);
7827
+ }
7828
+ const errorText = await response.text();
7829
+ const message = `Failed to get tenants and organizations: ${response.status} ${errorText}`;
7830
+ throw new Error(IDENTIFIER_STATUSES.has(response.status) ? `${message}. ${organizationHint(organizationId)}` : message);
7831
+ }
7832
+ const [parseError, data] = await catchError2(response.json());
7833
+ if (parseError) {
7834
+ throw new Error(describeNonJsonResponse(organizationId, response, parseError));
7835
+ }
7836
+ return data;
7837
+ };
7838
+
7713
7839
  // ../auth/src/tokenRefresh.ts
7714
7840
  var TOKEN_REFRESH_REAUTHENTICATE_MESSAGE = "Token refresh failed. Run 'uip login' to re-authenticate.";
7715
7841
 
@@ -7922,6 +8048,8 @@ var saveEnvFileAsync = async ({
7922
8048
  };
7923
8049
 
7924
8050
  // ../auth/src/loginStatus.ts
8051
+ var defaultRobotTenantIdCache = new Map;
8052
+ var ROBOT_TENANT_LOOKUP_TIMEOUT_MS = 5000;
7925
8053
  var getLoginStatusAsync = async (options = {}) => {
7926
8054
  return getLoginStatusWithDeps(options);
7927
8055
  };
@@ -7934,12 +8062,20 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
7934
8062
  refreshToken: refreshTokenFn = refreshAccessToken,
7935
8063
  resolveConfig = resolveConfigAsync,
7936
8064
  robotFallback = tryRobotClientFallback,
8065
+ fetchTenantsAndOrgs = fetchTenantsAndOrganizations,
8066
+ robotTenantIdCache = defaultRobotTenantIdCache,
8067
+ robotTenantLookupTimeoutMs = ROBOT_TENANT_LOOKUP_TIMEOUT_MS,
7937
8068
  loadBreaker = loadRefreshBreaker,
7938
8069
  saveBreaker = saveRefreshBreaker,
7939
8070
  clearBreaker = clearRefreshBreaker
7940
8071
  } = deps;
8072
+ const robotDeps = {
8073
+ fetchTenantsAndOrgs,
8074
+ cache: robotTenantIdCache,
8075
+ lookupTimeoutMs: robotTenantLookupTimeoutMs
8076
+ };
7941
8077
  if (isRobotAuthEnforced()) {
7942
- return resolveRobotEnforcedStatus(robotFallback);
8078
+ return resolveRobotEnforcedStatus(robotFallback, robotDeps);
7943
8079
  }
7944
8080
  if (isEnvAuthEnabled()) {
7945
8081
  return readAuthFromEnv();
@@ -7957,7 +8093,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
7957
8093
  hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
7958
8094
  };
7959
8095
  }
7960
- return resolveBorrowedRobotStatus(robotFallback);
8096
+ return resolveBorrowedRobotStatus(robotFallback, robotDeps);
7961
8097
  }
7962
8098
  const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
7963
8099
  if ("status" in loaded) {
@@ -7999,7 +8135,7 @@ var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
7999
8135
  }
8000
8136
  return buildFileStatus(tokens, credentials, globalHint);
8001
8137
  };
8002
- async function resolveRobotEnforcedStatus(robotFallback) {
8138
+ async function resolveRobotEnforcedStatus(robotFallback, deps) {
8003
8139
  if (isEnvAuthEnabled()) {
8004
8140
  throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
8005
8141
  }
@@ -8010,11 +8146,11 @@ async function resolveRobotEnforcedStatus(robotFallback) {
8010
8146
  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.`
8011
8147
  };
8012
8148
  }
8013
- return buildRobotStatus(robotCreds);
8149
+ return buildRobotStatus(robotCreds, deps);
8014
8150
  }
8015
- async function resolveBorrowedRobotStatus(robotFallback) {
8151
+ async function resolveBorrowedRobotStatus(robotFallback, deps) {
8016
8152
  const robotCreds = await robotFallback();
8017
- return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
8153
+ return robotCreds ? buildRobotStatus(robotCreds, deps) : { loginStatus: "Not logged in" };
8018
8154
  }
8019
8155
  async function loadFileCredentials(loadEnvFile, absolutePath) {
8020
8156
  let credentials;
@@ -8149,9 +8285,10 @@ function identityFields(accessToken, credentials) {
8149
8285
  ...scopes ? { scopes } : {}
8150
8286
  };
8151
8287
  }
8152
- function buildRobotStatus(robotCreds) {
8288
+ async function buildRobotStatus(robotCreds, deps) {
8153
8289
  const identity = resolveSessionIdentity(robotCreds.accessToken);
8154
8290
  const scopes = readTokenScopes(robotCreds.accessToken);
8291
+ const tenant = robotCreds.tenantId ? { tenantId: robotCreds.tenantId } : await resolveRobotTenantId(robotCreds, deps);
8155
8292
  return {
8156
8293
  loginStatus: "Logged in",
8157
8294
  accessToken: robotCreds.accessToken,
@@ -8159,14 +8296,62 @@ function buildRobotStatus(robotCreds) {
8159
8296
  organizationName: robotCreds.organizationName,
8160
8297
  organizationId: robotCreds.organizationId,
8161
8298
  tenantName: robotCreds.tenantName,
8162
- tenantId: robotCreds.tenantId,
8299
+ tenantId: tenant.tenantId,
8163
8300
  issuer: robotCreds.issuer,
8164
8301
  expiration: getTokenExpiration(robotCreds.accessToken),
8165
8302
  source: "robot" /* Robot */,
8303
+ ...tenant.hint ? { hint: tenant.hint } : {},
8166
8304
  ...identity ? { identity } : {},
8167
8305
  ...scopes ? { scopes } : {}
8168
8306
  };
8169
8307
  }
8308
+ async function resolveRobotTenantId(robotCreds, deps) {
8309
+ const { baseUrl, accessToken, tenantName } = robotCreds;
8310
+ const organization = robotCreds.organizationName ?? robotCreds.organizationId;
8311
+ if (!tenantName || !organization) {
8312
+ return {};
8313
+ }
8314
+ const key = `${baseUrl}|${organization}|${tenantName}|${accessToken}`;
8315
+ let pending = deps.cache.get(key);
8316
+ if (!pending) {
8317
+ pending = catchError2(lookupRobotTenantId({ baseUrl, accessToken, organization, tenantName }, deps)).then(([error, resolution]) => {
8318
+ const settled = error ? { hint: tenantLookupFailureHint(tenantName, error.message) } : resolution;
8319
+ if (!settled.tenantId) {
8320
+ deps.cache.delete(key);
8321
+ }
8322
+ return settled;
8323
+ });
8324
+ deps.cache.set(key, pending);
8325
+ }
8326
+ return pending;
8327
+ }
8328
+ async function lookupRobotTenantId(target, deps) {
8329
+ const { baseUrl, accessToken, organization, tenantName } = target;
8330
+ const [error, data] = await catchError2(deps.fetchTenantsAndOrgs(baseUrl, accessToken, organization, AbortSignal.timeout(deps.lookupTimeoutMs)));
8331
+ if (error) {
8332
+ const reason = error.name === "TimeoutError" ? `the tenant list did not answer within ${deps.lookupTimeoutMs} ms.` : error.message;
8333
+ return { hint: tenantLookupFailureHint(tenantName, reason) };
8334
+ }
8335
+ const rows = data?.tenants;
8336
+ const tenants = Array.isArray(rows) ? rows.filter((tenant) => typeof tenant?.id === "string" && typeof tenant?.name === "string") : [];
8337
+ const wantedName = decodePathSegment(tenantName);
8338
+ const wanted = wantedName.toLowerCase();
8339
+ const match = tenants.find((tenant) => tenant.name === wantedName) ?? tenants.find((tenant) => tenant.name.toLowerCase() === wanted);
8340
+ if (!match) {
8341
+ const names = tenants.map((tenant) => tenant.name).join(", ");
8342
+ return {
8343
+ 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.`
8344
+ };
8345
+ }
8346
+ return { tenantId: match.id };
8347
+ }
8348
+ function tenantLookupFailureHint(tenantName, reason) {
8349
+ 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.`;
8350
+ }
8351
+ function decodePathSegment(segment) {
8352
+ const [error, decoded] = catchError2(() => decodeURIComponent(segment));
8353
+ return error ? segment : decoded;
8354
+ }
8170
8355
  var isFileNotFoundError = (error) => {
8171
8356
  if (!(error instanceof Object))
8172
8357
  return false;
@@ -8435,9 +8620,6 @@ var getAuthContext = async (options = {}) => {
8435
8620
  identity: status.identity
8436
8621
  };
8437
8622
  };
8438
- // ../auth/src/tenantSelection.ts
8439
- var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
8440
-
8441
8623
  // ../auth/src/selectTenant.ts
8442
8624
  var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
8443
8625
  var INVALID_TENANT_CODE = "INVALID_TENANT";
@@ -8531,6 +8713,151 @@ async function listQueueFilters(config) {
8531
8713
  async function listMachineFilters(config) {
8532
8714
  return listFilters(config, "filtersAllMachines", isMachineFiltersResponse, "machine filters");
8533
8715
  }
8716
+ // ../insights-sdk/src/looker-dashboards.ts
8717
+ var TEMPLATE_ID_DELIMITER = "::";
8718
+ var INTEGER_ID_PATTERN = /^\d+$/;
8719
+ var LOOKER_FOLDERS = [
8720
+ "personal",
8721
+ "tenant",
8722
+ "templates",
8723
+ "organization"
8724
+ ];
8725
+ var LOOKER_THEMES = ["light", "dark"];
8726
+ async function listLookerDashboards(config) {
8727
+ return requestInsightsRoute(config, "lookerDashboardsList");
8728
+ }
8729
+ async function getLookerDashboardEmbedUrl(config, options) {
8730
+ const dashboardId = options.dashboardId.trim();
8731
+ if (dashboardId === "") {
8732
+ throw new Error("Insights Looker dashboard id must not be empty.");
8733
+ }
8734
+ if (!isDashboardId(dashboardId)) {
8735
+ throw new Error("Insights Looker dashboard id must be all digits or contain '::'; resolve a title with resolveLookerDashboard first.");
8736
+ }
8737
+ if (!LOOKER_THEMES.includes(options.theme)) {
8738
+ throw new Error(`Insights Looker theme must be one of ${LOOKER_THEMES.join(", ")}.`);
8739
+ }
8740
+ const locale = options.localization?.trim();
8741
+ if (locale === "") {
8742
+ throw new Error("Insights Looker localization must not be empty.");
8743
+ }
8744
+ return requestInsightsRoute(config, "lookerDashboardEmbedUrl", {
8745
+ body: {
8746
+ dashboardId,
8747
+ theme: options.theme,
8748
+ ...locale === undefined ? {} : { locale }
8749
+ }
8750
+ });
8751
+ }
8752
+ function parseLookerEnvelope(raw, routeKey) {
8753
+ const endpoint = insightsRouteTemplate(routeKey);
8754
+ if (typeof raw !== "string") {
8755
+ throw new InsightsProtocolError(endpoint, "the body is not the JSON string literal this root answers with");
8756
+ }
8757
+ const [parseError, envelope] = catchError(() => JSON.parse(raw));
8758
+ if (parseError) {
8759
+ throw new InsightsProtocolError(endpoint, "the body string does not hold JSON");
8760
+ }
8761
+ if (!isJsonObject(envelope)) {
8762
+ throw new InsightsProtocolError(endpoint, "the body string does not hold an object");
8763
+ }
8764
+ if (typeof envelope.isSuccess !== "boolean") {
8765
+ throw new InsightsProtocolError(endpoint, "the body carries no boolean isSuccess");
8766
+ }
8767
+ if (envelope.isSuccess !== true) {
8768
+ throw new InsightsProtocolError(endpoint, "the body reports isSuccess false inside a success status");
8769
+ }
8770
+ if (envelope.result === undefined || envelope.result === null) {
8771
+ throw new InsightsProtocolError(endpoint, "the body carries no result");
8772
+ }
8773
+ return envelope.result;
8774
+ }
8775
+
8776
+ class LookerResolveError extends Error {
8777
+ kind;
8778
+ candidates;
8779
+ constructor(kind, message, candidates = []) {
8780
+ super(message);
8781
+ this.name = "LookerResolveError";
8782
+ this.kind = kind;
8783
+ this.candidates = candidates;
8784
+ }
8785
+ }
8786
+ function isDashboardId(value) {
8787
+ return INTEGER_ID_PATTERN.test(value) || value.includes(TEMPLATE_ID_DELIMITER);
8788
+ }
8789
+ function isLookerTemplateDashboardId(id) {
8790
+ return !INTEGER_ID_PATTERN.test(id);
8791
+ }
8792
+ function readLookerListing(raw) {
8793
+ const endpoint = insightsRouteTemplate("lookerDashboardsList");
8794
+ const folders = parseLookerEnvelope(raw, "lookerDashboardsList");
8795
+ if (!isJsonObject(folders)) {
8796
+ throw new InsightsProtocolError(endpoint, "the result is not an object");
8797
+ }
8798
+ const listing = { rows: [], omittedFolders: [] };
8799
+ for (const folder of LOOKER_FOLDERS) {
8800
+ const group = readFolderGroup(folders[folder], folder, endpoint);
8801
+ if (group === null) {
8802
+ listing.omittedFolders.push(folder);
8803
+ continue;
8804
+ }
8805
+ for (const element of group) {
8806
+ listing.rows.push(readListingRow(element, folder, endpoint));
8807
+ }
8808
+ }
8809
+ return listing;
8810
+ }
8811
+ function readFolderGroup(group, folder, endpoint) {
8812
+ if (group === undefined) {
8813
+ throw new InsightsProtocolError(endpoint, `the result carries no ${folder} key`);
8814
+ }
8815
+ if (group === null) {
8816
+ return null;
8817
+ }
8818
+ if (!Array.isArray(group)) {
8819
+ throw new InsightsProtocolError(endpoint, `the result's ${folder} is neither an array nor null`);
8820
+ }
8821
+ return group;
8822
+ }
8823
+ function readListingRow(record, folder, endpoint) {
8824
+ if (!isJsonObject(record)) {
8825
+ throw new InsightsProtocolError(endpoint, `a row in the ${folder} folder is not an object`);
8826
+ }
8827
+ if (typeof record.id !== "string") {
8828
+ throw new InsightsProtocolError(endpoint, `a row in the ${folder} folder has no string id`);
8829
+ }
8830
+ if (record.title !== null && typeof record.title !== "string") {
8831
+ throw new InsightsProtocolError(endpoint, `a row in the ${folder} folder has a title that is neither a string nor null`);
8832
+ }
8833
+ return { folder, id: record.id, title: record.title, record };
8834
+ }
8835
+ async function resolveLookerDashboard(config, value) {
8836
+ const trimmed = value.trim();
8837
+ if (trimmed === "") {
8838
+ throw new Error("Insights Looker dashboard must not be empty.");
8839
+ }
8840
+ if (isDashboardId(trimmed)) {
8841
+ return { id: trimmed, resolvedFrom: "id" };
8842
+ }
8843
+ const { rows } = readLookerListing(await listLookerDashboards(config));
8844
+ const matches = rows.filter((row) => row.title?.trim() === trimmed);
8845
+ if (matches.length === 0) {
8846
+ throw new LookerResolveError("notFound", "No Looker dashboard with that title is listed for this session.");
8847
+ }
8848
+ for (const match of matches) {
8849
+ requireEmbeddableId(match);
8850
+ }
8851
+ if (matches.length > 1) {
8852
+ throw new LookerResolveError("ambiguous", `${matches.length} Looker dashboards share that title.`, matches.map((row) => ({ folder: row.folder, id: row.id })));
8853
+ }
8854
+ return { id: matches[0].id, resolvedFrom: "title" };
8855
+ }
8856
+ function requireEmbeddableId(row) {
8857
+ if (!isDashboardId(row.id)) {
8858
+ throw new InsightsProtocolError(insightsRouteTemplate("lookerDashboardsList"), `a row in the ${row.folder} folder has an id that is neither all digits nor contains '::'`);
8859
+ }
8860
+ }
8534
8861
  // ../insights-sdk/src/machines.ts
8535
8862
  function isNullish(value) {
8536
8863
  return value === undefined || value === null;
@@ -8885,6 +9212,11 @@ function surfaceUnavailableInstructions(family) {
8885
9212
  ].join(" ");
8886
9213
  }
8887
9214
  var FOLDER_LOOKUP_NOT_FOUND_INSTRUCTIONS = "These routes resolve the caller's Orchestrator folders before running, and this 404 came from that lookup: Orchestrator answered 404 for the folder list, which happens transiently right after tenant provisioning. Wait and send the same request again. If it persists, check that the tenant's Orchestrator is reachable. No automatic retry was made.";
9215
+ var RETRY_LATER_INSTRUCTIONS = "Wait and send the same request again. No automatic retry was made.";
9216
+ var PORTAL_PROVISIONING_NOT_FOUND_INSTRUCTIONS = "This route cannot miss for data reasons; the active tenant likely does not have the Insights Portal service provisioned. Do not retry until the tenant changes.";
9217
+ function writePortalProvisioningNotFound(error, message) {
9218
+ writeInsightsNotFound(error, message, PORTAL_PROVISIONING_NOT_FOUND_INSTRUCTIONS);
9219
+ }
8888
9220
  function writeInsightsActionNotFound(error, family, instructions) {
8889
9221
  OutputFormatter.error({
8890
9222
  Result: RESULTS.Failure,
@@ -8986,7 +9318,7 @@ var RTM_STATUS_ENVELOPES = {
8986
9318
  ErrorCode: "server_error",
8987
9319
  Retry: "RetryLater",
8988
9320
  Message: `Insights could not serve the ${family.subject} request: a backing data service is temporarily unavailable.`,
8989
- Instructions: "The request itself was accepted. Wait and send the same request again. No automatic retry was made.",
9321
+ Instructions: `The request itself was accepted. ${RETRY_LATER_INSTRUCTIONS}`,
8990
9322
  Context: context
8991
9323
  });
8992
9324
  processContext.exit(EXIT_CODES.Failure);
@@ -9142,6 +9474,10 @@ function pagingCostNote(subject) {
9142
9474
  function overPagedNote(total, scope = "") {
9143
9475
  return `The requested --offset is past the last row: ${total} rows exist${scope}. Lower --offset to see them.`;
9144
9476
  }
9477
+ var EMPTY_LIST_NOTE = "An empty list is a successful result, not an error.";
9478
+ function joinParts(parts) {
9479
+ return parts.filter((part) => part !== "").join(" ");
9480
+ }
9145
9481
  function compareRowKeys(a, b) {
9146
9482
  if (a === b) {
9147
9483
  return 0;
@@ -9308,6 +9644,6 @@ function createContractGuards(newError) {
9308
9644
  };
9309
9645
  }
9310
9646
 
9311
- export { getFileSystem, catchError, describeConnectivityError, describePermissionError, RESULTS, OutputFormatter, Command, Option, processContext, requireConfirmation, isGuid, createHiddenDeprecatedTenantOption, parseLimit, parseOffset, parseBoundedInt, MODEL_NOT_FOUND_LABEL, DASHBOARD_NOT_FOUND_LABEL, VALIDATION_FAILED_LABEL, CREATE_BACKEND_FAILURE_LABEL, UPDATE_BACKEND_FAILURE_LABEL, InsightsHttpError, InsightsNetworkError, InsightsProtocolError, listAlertDefinitions, listAgenticAlertDefinitions, getAlertDefinition, checkAlertEntitlement, listAlertHistoryDetails, getAlertHistoryMetrics, getDefaultDelivery, insightsPost, createInsightsConfig, DASHBOARD_SLOT_DELIMITER, MAESTRO_DASHBOARD_SOURCE_TYPE, composeDashboardSlotId, isTemplateKeyedDashboardId, getDashboard, listDashboardFilters, DashboardRequestError, createDashboard, updateDashboard, deleteDashboard, listExportConfigurations, verifyAllExportDestinations, verifyExportDestination, listFolderFilters, listProcessFilters, listQueueFilters, listMachineFilters, getMachineRuntimeMix, getMachineDetails, getMachineAvailabilityTimeline, getMachineTopFailures, getMachineUtilization, getQueueCompletedTimeline, getQueueUncompletedTimeline, getQueueTopFailures, getQueueFailuresByReason, getQueueDetails, getQueueRetryOutcomes, getQueueSummary, getQueueFailureDetails, getQueueSla, getQueueOperationalMetrics, listUsers, getUser, listRoles, getRole, listGroups, getGroup, fail, failValidation, writeNetworkFailure, resolveInsightsConfig, writeInsightsFailure, writeInsightsNotFound, FOLDER_LOOKUP_NOT_FOUND_INSTRUCTIONS, hasUnreadBody, claimGatedSurface404, writeInsightsError, addMonitoringTimeOptions, validateMonitoringTime, buildMonitoringTimeFields, truncatedNote, pagingCostNote, overPagedNote, compareRowKeys, bindInsightsQuery, monitoringDisclosures, monitoringListInstructions, byRowKeys, preserveBackendOrder, claimHttpError, executeInsightsList, executeInsightsGet, isRecord3 as isRecord, asRecord2 as asRecord, pickScalar, createContractGuards };
9647
+ export { getFileSystem, catchError, describeConnectivityError, describePermissionError, RESULTS, OutputFormatter, Command, Option, processContext, requireConfirmation, isGuid, createHiddenDeprecatedTenantOption, parseLimit, parseOffset, parseBoundedInt, MODEL_NOT_FOUND_LABEL, DASHBOARD_NOT_FOUND_LABEL, VALIDATION_FAILED_LABEL, CREATE_BACKEND_FAILURE_LABEL, UPDATE_BACKEND_FAILURE_LABEL, PORTAL_ERROR_CODE, LOOKER_USER_UNAVAILABLE_MESSAGE, LOOKER_NO_DASHBOARDS_MESSAGE, InsightsHttpError, InsightsNetworkError, InsightsProtocolError, listAlertDefinitions, listAgenticAlertDefinitions, getAlertDefinition, checkAlertEntitlement, listAlertHistoryDetails, getAlertHistoryMetrics, getDefaultDelivery, insightsPost, createInsightsConfig, DASHBOARD_SLOT_DELIMITER, MAESTRO_DASHBOARD_SOURCE_TYPE, composeDashboardSlotId, isTemplateKeyedDashboardId, getDashboard, listDashboardFilters, DashboardRequestError, createDashboard, updateDashboard, deleteDashboard, listExportConfigurations, verifyAllExportDestinations, verifyExportDestination, listFolderFilters, listProcessFilters, listQueueFilters, listMachineFilters, LOOKER_FOLDERS, LOOKER_THEMES, listLookerDashboards, getLookerDashboardEmbedUrl, parseLookerEnvelope, LookerResolveError, isLookerTemplateDashboardId, readLookerListing, resolveLookerDashboard, getMachineRuntimeMix, getMachineDetails, getMachineAvailabilityTimeline, getMachineTopFailures, getMachineUtilization, getQueueCompletedTimeline, getQueueUncompletedTimeline, getQueueTopFailures, getQueueFailuresByReason, getQueueDetails, getQueueRetryOutcomes, getQueueSummary, getQueueFailureDetails, getQueueSla, getQueueOperationalMetrics, listUsers, getUser, listRoles, getRole, listGroups, getGroup, fail, failValidation, writeNetworkFailure, resolveInsightsConfig, writeInsightsFailure, writeInsightsNotFound, FOLDER_LOOKUP_NOT_FOUND_INSTRUCTIONS, RETRY_LATER_INSTRUCTIONS, writePortalProvisioningNotFound, hasUnreadBody, claimGatedSurface404, writeInsightsError, addMonitoringTimeOptions, validateMonitoringTime, buildMonitoringTimeFields, truncatedNote, pagingCostNote, overPagedNote, EMPTY_LIST_NOTE, joinParts, compareRowKeys, bindInsightsQuery, monitoringDisclosures, monitoringListInstructions, byRowKeys, preserveBackendOrder, claimHttpError, executeInsightsList, executeInsightsGet, isRecord3 as isRecord, asRecord2 as asRecord, pickScalar, createContractGuards };
9312
9648
 
9313
- //# debugId=669DFFA12FE8CD3E64756E2164756E21
9649
+ //# debugId=7DB4A32E0D8D25A364756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  asRecord
3
- } from "./tool-r32j3rq9.js";
3
+ } from "./tool-hkc3xm98.js";
4
4
 
5
5
  // src/utils/portal-envelope.ts
6
6
  function unwrapPortalEnvelope(raw, subject, newError) {
package/dist/tool.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-1ajpjrv3.js";
5
- import"./tool-pjh955qc.js";
4
+ } from "./tool-bpkdemsh.js";
5
+ import"./tool-751bt6xf.js";
6
6
  import"./tool-fqh66108.js";
7
- import"./tool-3fs6wz16.js";
8
- import"./tool-dpkb9gc4.js";
9
- import"./tool-r32j3rq9.js";
7
+ import"./tool-sy0dv0f1.js";
8
+ import"./tool-dha9dpb9.js";
9
+ import"./tool-hkc3xm98.js";
10
10
  import"./tool-1de529jm.js";
11
11
  export {
12
12
  metadata,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/insights-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.204.0",
5
+ "version": "1.205.0-preview.258",
6
6
  "description": "Query UiPath Insights data — jobs, failures, and performance metrics.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "699c58dabb59414557755a8933bcbe40aa420df3"
30
+ "gitHead": "8f629ee9fa89abf94f197436a60cb3b9620f8b27"
31
31
  }