@uipath/insights-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.
- package/dist/index.browser.js +21 -14
- package/dist/index.js +141 -31
- package/dist/src/errors.d.ts +12 -4
- package/package.json +2 -2
package/dist/index.browser.js
CHANGED
|
@@ -35,7 +35,7 @@ class InsightsHttpError extends Error {
|
|
|
35
35
|
requestId;
|
|
36
36
|
retryAfterSeconds;
|
|
37
37
|
constructor(init) {
|
|
38
|
-
super(`Insights request failed with HTTP ${init.status} for ${init.endpoint}
|
|
38
|
+
super(`Insights request failed with HTTP ${init.status} for ${init.endpoint}`, init.cause === undefined ? undefined : { cause: init.cause });
|
|
39
39
|
this.name = "InsightsHttpError";
|
|
40
40
|
this.status = init.status;
|
|
41
41
|
this.method = init.method;
|
|
@@ -48,8 +48,8 @@ class InsightsHttpError extends Error {
|
|
|
48
48
|
|
|
49
49
|
class InsightsNetworkError extends Error {
|
|
50
50
|
endpoint;
|
|
51
|
-
constructor(endpoint, cause) {
|
|
52
|
-
super(`Insights request failed before a response was received for ${endpoint}`, { cause });
|
|
51
|
+
constructor(endpoint, cause, phase = "request") {
|
|
52
|
+
super(phase === "request" ? `Insights request failed before a response was received for ${endpoint}` : `Insights connection failed while reading the response body for ${endpoint}`, { cause });
|
|
53
53
|
this.name = "InsightsNetworkError";
|
|
54
54
|
this.endpoint = endpoint;
|
|
55
55
|
}
|
|
@@ -124,7 +124,7 @@ function getSdkUserAgentToken(pkg) {
|
|
|
124
124
|
var package_default = {
|
|
125
125
|
name: "@uipath/insights-sdk",
|
|
126
126
|
license: "MIT",
|
|
127
|
-
version: "1.
|
|
127
|
+
version: "1.201.0-preview.121",
|
|
128
128
|
description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
|
|
129
129
|
repository: {
|
|
130
130
|
type: "git",
|
|
@@ -356,6 +356,17 @@ function parseRetryAfterSeconds(header) {
|
|
|
356
356
|
const seconds = Number.parseInt(header, 10);
|
|
357
357
|
return Number.isNaN(seconds) || seconds < 0 ? undefined : seconds;
|
|
358
358
|
}
|
|
359
|
+
function httpErrorFrom(response, route, bodyKind, cause) {
|
|
360
|
+
return new InsightsHttpError({
|
|
361
|
+
status: response.status,
|
|
362
|
+
method: route.method,
|
|
363
|
+
endpoint: route.template,
|
|
364
|
+
bodyKind,
|
|
365
|
+
requestId: response.headers.get("x-request-id") ?? undefined,
|
|
366
|
+
retryAfterSeconds: parseRetryAfterSeconds(response.headers.get("retry-after")),
|
|
367
|
+
cause
|
|
368
|
+
});
|
|
369
|
+
}
|
|
359
370
|
async function requestInsightsRoute(config, routeKey, request = {}) {
|
|
360
371
|
const route = INSIGHTS_ROUTES[routeKey];
|
|
361
372
|
if (!route) {
|
|
@@ -374,17 +385,13 @@ async function requestInsightsRoute(config, routeKey, request = {}) {
|
|
|
374
385
|
}
|
|
375
386
|
const [readError, text] = await catchError(response.text());
|
|
376
387
|
if (readError) {
|
|
377
|
-
|
|
388
|
+
if (!response.ok) {
|
|
389
|
+
throw httpErrorFrom(response, route, "absent", readError);
|
|
390
|
+
}
|
|
391
|
+
throw new InsightsNetworkError(route.template, readError, "response-body");
|
|
378
392
|
}
|
|
379
393
|
if (!response.ok) {
|
|
380
|
-
throw
|
|
381
|
-
status: response.status,
|
|
382
|
-
method: route.method,
|
|
383
|
-
endpoint: route.template,
|
|
384
|
-
bodyKind: classifyErrorBody(text),
|
|
385
|
-
requestId: response.headers.get("x-request-id") ?? undefined,
|
|
386
|
-
retryAfterSeconds: parseRetryAfterSeconds(response.headers.get("retry-after"))
|
|
387
|
-
});
|
|
394
|
+
throw httpErrorFrom(response, route, classifyErrorBody(text));
|
|
388
395
|
}
|
|
389
396
|
if (!text.trim()) {
|
|
390
397
|
if (route.allowsEmptyResponse) {
|
|
@@ -620,4 +627,4 @@ export {
|
|
|
620
627
|
InsightsHttpError
|
|
621
628
|
};
|
|
622
629
|
|
|
623
|
-
//# debugId=
|
|
630
|
+
//# debugId=F2B16527F5319E9064756E2164756E21
|
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
|
|
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 =
|
|
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/catch-error.ts
|
|
912
942
|
function isPromiseLike(value) {
|
|
@@ -945,7 +975,7 @@ class InsightsHttpError extends Error {
|
|
|
945
975
|
requestId;
|
|
946
976
|
retryAfterSeconds;
|
|
947
977
|
constructor(init) {
|
|
948
|
-
super(`Insights request failed with HTTP ${init.status} for ${init.endpoint}
|
|
978
|
+
super(`Insights request failed with HTTP ${init.status} for ${init.endpoint}`, init.cause === undefined ? undefined : { cause: init.cause });
|
|
949
979
|
this.name = "InsightsHttpError";
|
|
950
980
|
this.status = init.status;
|
|
951
981
|
this.method = init.method;
|
|
@@ -958,8 +988,8 @@ class InsightsHttpError extends Error {
|
|
|
958
988
|
|
|
959
989
|
class InsightsNetworkError extends Error {
|
|
960
990
|
endpoint;
|
|
961
|
-
constructor(endpoint, cause) {
|
|
962
|
-
super(`Insights request failed before a response was received for ${endpoint}`, { cause });
|
|
991
|
+
constructor(endpoint, cause, phase = "request") {
|
|
992
|
+
super(phase === "request" ? `Insights request failed before a response was received for ${endpoint}` : `Insights connection failed while reading the response body for ${endpoint}`, { cause });
|
|
963
993
|
this.name = "InsightsNetworkError";
|
|
964
994
|
this.endpoint = endpoint;
|
|
965
995
|
}
|
|
@@ -1034,7 +1064,7 @@ function getSdkUserAgentToken(pkg) {
|
|
|
1034
1064
|
var package_default = {
|
|
1035
1065
|
name: "@uipath/insights-sdk",
|
|
1036
1066
|
license: "MIT",
|
|
1037
|
-
version: "1.
|
|
1067
|
+
version: "1.201.0-preview.121",
|
|
1038
1068
|
description: "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
|
|
1039
1069
|
repository: {
|
|
1040
1070
|
type: "git",
|
|
@@ -1266,6 +1296,17 @@ function parseRetryAfterSeconds(header) {
|
|
|
1266
1296
|
const seconds = Number.parseInt(header, 10);
|
|
1267
1297
|
return Number.isNaN(seconds) || seconds < 0 ? undefined : seconds;
|
|
1268
1298
|
}
|
|
1299
|
+
function httpErrorFrom(response, route, bodyKind, cause) {
|
|
1300
|
+
return new InsightsHttpError({
|
|
1301
|
+
status: response.status,
|
|
1302
|
+
method: route.method,
|
|
1303
|
+
endpoint: route.template,
|
|
1304
|
+
bodyKind,
|
|
1305
|
+
requestId: response.headers.get("x-request-id") ?? undefined,
|
|
1306
|
+
retryAfterSeconds: parseRetryAfterSeconds(response.headers.get("retry-after")),
|
|
1307
|
+
cause
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1269
1310
|
async function requestInsightsRoute(config, routeKey, request = {}) {
|
|
1270
1311
|
const route = INSIGHTS_ROUTES[routeKey];
|
|
1271
1312
|
if (!route) {
|
|
@@ -1284,17 +1325,13 @@ async function requestInsightsRoute(config, routeKey, request = {}) {
|
|
|
1284
1325
|
}
|
|
1285
1326
|
const [readError, text] = await catchError(response.text());
|
|
1286
1327
|
if (readError) {
|
|
1287
|
-
|
|
1328
|
+
if (!response.ok) {
|
|
1329
|
+
throw httpErrorFrom(response, route, "absent", readError);
|
|
1330
|
+
}
|
|
1331
|
+
throw new InsightsNetworkError(route.template, readError, "response-body");
|
|
1288
1332
|
}
|
|
1289
1333
|
if (!response.ok) {
|
|
1290
|
-
throw
|
|
1291
|
-
status: response.status,
|
|
1292
|
-
method: route.method,
|
|
1293
|
-
endpoint: route.template,
|
|
1294
|
-
bodyKind: classifyErrorBody(text),
|
|
1295
|
-
requestId: response.headers.get("x-request-id") ?? undefined,
|
|
1296
|
-
retryAfterSeconds: parseRetryAfterSeconds(response.headers.get("retry-after"))
|
|
1297
|
-
});
|
|
1334
|
+
throw httpErrorFrom(response, route, classifyErrorBody(text));
|
|
1298
1335
|
}
|
|
1299
1336
|
if (!text.trim()) {
|
|
1300
1337
|
if (route.allowsEmptyResponse) {
|
|
@@ -1624,6 +1661,67 @@ var getTokenExpiration = (accessToken) => {
|
|
|
1624
1661
|
}
|
|
1625
1662
|
};
|
|
1626
1663
|
|
|
1664
|
+
// ../auth/src/sessionIdentity.ts
|
|
1665
|
+
var parseAuthFlow = (value) => value === "authorization_code" || value === "client_credentials" || value === "federated_credentials" ? value : undefined;
|
|
1666
|
+
var decodeClaims = (accessToken) => {
|
|
1667
|
+
const [error, claims] = catchError2(() => parseJWT(accessToken));
|
|
1668
|
+
return error ? undefined : claims;
|
|
1669
|
+
};
|
|
1670
|
+
var asString = (value) => typeof value === "string" && value.length > 0 ? value : undefined;
|
|
1671
|
+
var resolveIdentityType = (claims, authFlow, email) => {
|
|
1672
|
+
const subType = asString(claims?.sub_type);
|
|
1673
|
+
if (subType) {
|
|
1674
|
+
return subType.startsWith("service") ? "Application" : "User";
|
|
1675
|
+
}
|
|
1676
|
+
if (authFlow) {
|
|
1677
|
+
return authFlow === "authorization_code" ? "User" : "Application";
|
|
1678
|
+
}
|
|
1679
|
+
if (email)
|
|
1680
|
+
return "User";
|
|
1681
|
+
if (asString(claims?.client_id) && !asString(claims?.sub)) {
|
|
1682
|
+
return "Application";
|
|
1683
|
+
}
|
|
1684
|
+
return;
|
|
1685
|
+
};
|
|
1686
|
+
var looksLikeEmail = (value) => value?.includes("@") ?? false;
|
|
1687
|
+
var pickEmail = (claims) => {
|
|
1688
|
+
for (const candidate of [claims?.email, claims?.preferred_username]) {
|
|
1689
|
+
const value = asString(candidate);
|
|
1690
|
+
if (looksLikeEmail(value))
|
|
1691
|
+
return value;
|
|
1692
|
+
}
|
|
1693
|
+
return;
|
|
1694
|
+
};
|
|
1695
|
+
var pickName = (claims) => {
|
|
1696
|
+
const username = asString(claims?.preferred_username);
|
|
1697
|
+
return asString(claims?.name) ?? (looksLikeEmail(username) ? undefined : username);
|
|
1698
|
+
};
|
|
1699
|
+
var resolveSessionIdentity = (accessToken, authFlow) => {
|
|
1700
|
+
const claims = accessToken ? decodeClaims(accessToken) : undefined;
|
|
1701
|
+
const email = pickEmail(claims);
|
|
1702
|
+
const type = resolveIdentityType(claims, authFlow, email);
|
|
1703
|
+
if (!type)
|
|
1704
|
+
return;
|
|
1705
|
+
const identity = { type };
|
|
1706
|
+
if (authFlow)
|
|
1707
|
+
identity.authFlow = authFlow;
|
|
1708
|
+
if (type === "User") {
|
|
1709
|
+
const userId = asString(claims?.sub);
|
|
1710
|
+
if (userId)
|
|
1711
|
+
identity.userId = userId;
|
|
1712
|
+
if (email)
|
|
1713
|
+
identity.userEmail = email;
|
|
1714
|
+
const name = pickName(claims);
|
|
1715
|
+
if (name)
|
|
1716
|
+
identity.userName = name;
|
|
1717
|
+
return identity;
|
|
1718
|
+
}
|
|
1719
|
+
const clientId = asString(claims?.client_id);
|
|
1720
|
+
if (clientId)
|
|
1721
|
+
identity.clientId = clientId;
|
|
1722
|
+
return identity;
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1627
1725
|
// ../auth/src/envAuth.ts
|
|
1628
1726
|
var ENV_AUTH_ENABLE_VAR = "UIPATH_CLI_ENABLE_ENV_AUTH";
|
|
1629
1727
|
var ENFORCE_ROBOT_AUTH_VAR = "UIPATH_CLI_ENFORCE_ROBOT_AUTH";
|
|
@@ -1673,6 +1771,7 @@ var readAuthFromEnv = () => {
|
|
|
1673
1771
|
}
|
|
1674
1772
|
const expiration = getTokenExpiration(accessToken);
|
|
1675
1773
|
const loginStatus = expiration && expiration <= new Date ? "Expired" : "Logged in";
|
|
1774
|
+
const identity = resolveSessionIdentity(accessToken);
|
|
1676
1775
|
return {
|
|
1677
1776
|
loginStatus,
|
|
1678
1777
|
accessToken,
|
|
@@ -1682,7 +1781,8 @@ var readAuthFromEnv = () => {
|
|
|
1682
1781
|
tenantName,
|
|
1683
1782
|
tenantId,
|
|
1684
1783
|
expiration,
|
|
1685
|
-
source: "env" /*
|
|
1784
|
+
source: "env-vars" /* EnvironmentVariables */,
|
|
1785
|
+
...identity ? { identity } : {}
|
|
1686
1786
|
};
|
|
1687
1787
|
};
|
|
1688
1788
|
|
|
@@ -1935,6 +2035,9 @@ var refreshAccessToken = async ({
|
|
|
1935
2035
|
return { accessToken: newAccessToken, refreshToken: newRefreshToken };
|
|
1936
2036
|
};
|
|
1937
2037
|
|
|
2038
|
+
// ../auth/src/types.ts
|
|
2039
|
+
var AUTH_FLOW_ENV_VAR = "UIPATH_AUTH_FLOW";
|
|
2040
|
+
|
|
1938
2041
|
// ../auth/src/utils/envFile.ts
|
|
1939
2042
|
init_src();
|
|
1940
2043
|
init_constants();
|
|
@@ -2302,7 +2405,8 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
2302
2405
|
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
2303
2406
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
2304
2407
|
expiration: tokens.expiration,
|
|
2305
|
-
source: "
|
|
2408
|
+
source: "saved-login" /* SavedLogin */,
|
|
2409
|
+
...identityFields(tokens.accessToken, credentials),
|
|
2306
2410
|
...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
|
|
2307
2411
|
...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
2308
2412
|
...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
|
|
@@ -2315,7 +2419,12 @@ async function buildFileStatus(tokens, credentials, globalHint) {
|
|
|
2315
2419
|
}
|
|
2316
2420
|
return result;
|
|
2317
2421
|
}
|
|
2422
|
+
function identityFields(accessToken, credentials) {
|
|
2423
|
+
const identity = resolveSessionIdentity(accessToken, parseAuthFlow(credentials[AUTH_FLOW_ENV_VAR]));
|
|
2424
|
+
return identity ? { identity } : {};
|
|
2425
|
+
}
|
|
2318
2426
|
function buildRobotStatus(robotCreds) {
|
|
2427
|
+
const identity = resolveSessionIdentity(robotCreds.accessToken);
|
|
2319
2428
|
return {
|
|
2320
2429
|
loginStatus: "Logged in",
|
|
2321
2430
|
accessToken: robotCreds.accessToken,
|
|
@@ -2326,7 +2435,8 @@ function buildRobotStatus(robotCreds) {
|
|
|
2326
2435
|
tenantId: robotCreds.tenantId,
|
|
2327
2436
|
issuer: robotCreds.issuer,
|
|
2328
2437
|
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
2329
|
-
source: "robot" /* Robot
|
|
2438
|
+
source: "robot" /* Robot */,
|
|
2439
|
+
...identity ? { identity } : {}
|
|
2330
2440
|
};
|
|
2331
2441
|
}
|
|
2332
2442
|
var isFileNotFoundError = (error) => {
|
|
@@ -2377,7 +2487,8 @@ async function circuitBreakerShortCircuit(ctx) {
|
|
|
2377
2487
|
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
2378
2488
|
tenantId: credentials.UIPATH_TENANT_ID,
|
|
2379
2489
|
expiration,
|
|
2380
|
-
source: "
|
|
2490
|
+
source: "saved-login" /* SavedLogin */,
|
|
2491
|
+
...identityFields(accessToken, credentials)
|
|
2381
2492
|
} : {},
|
|
2382
2493
|
hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
|
|
2383
2494
|
refreshCircuitOpen: true,
|
|
@@ -2399,7 +2510,8 @@ async function lockAcquireFailureStatus(ctx, error) {
|
|
|
2399
2510
|
tenantName: ctx.credentials.UIPATH_TENANT_NAME,
|
|
2400
2511
|
tenantId: ctx.credentials.UIPATH_TENANT_ID,
|
|
2401
2512
|
expiration: ctx.expiration,
|
|
2402
|
-
source: "
|
|
2513
|
+
source: "saved-login" /* SavedLogin */,
|
|
2514
|
+
...identityFields(ctx.accessToken, ctx.credentials),
|
|
2403
2515
|
hint: globalHint,
|
|
2404
2516
|
tokenRefresh: {
|
|
2405
2517
|
attempted: false,
|
|
@@ -2599,6 +2711,8 @@ init_constants();
|
|
|
2599
2711
|
|
|
2600
2712
|
// ../auth/src/interactive.ts
|
|
2601
2713
|
init_src();
|
|
2714
|
+
// ../auth/src/tenantSelection.ts
|
|
2715
|
+
var IDENTIFIER_STATUSES = new Set([400, 403, 404]);
|
|
2602
2716
|
|
|
2603
2717
|
// ../auth/src/selectTenant.ts
|
|
2604
2718
|
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
@@ -2609,10 +2723,6 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
2609
2723
|
]);
|
|
2610
2724
|
// ../auth/src/logout.ts
|
|
2611
2725
|
init_src();
|
|
2612
|
-
|
|
2613
|
-
// ../auth/src/index.ts
|
|
2614
|
-
init_server();
|
|
2615
|
-
|
|
2616
2726
|
// src/client-factory.ts
|
|
2617
2727
|
async function createInsightsConfig(tenantOverride) {
|
|
2618
2728
|
const ctx = await getAuthContext({
|
|
@@ -2756,4 +2866,4 @@ export {
|
|
|
2756
2866
|
InsightsHttpError
|
|
2757
2867
|
};
|
|
2758
2868
|
|
|
2759
|
-
//# debugId=
|
|
2869
|
+
//# debugId=98FB615A2CA6DD0E64756E2164756E21
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -7,11 +7,16 @@ interface InsightsHttpErrorInit {
|
|
|
7
7
|
bodyKind: InsightsBodyKind;
|
|
8
8
|
requestId?: string;
|
|
9
9
|
retryAfterSeconds?: number;
|
|
10
|
+
/** The read failure, when the error body could not be read. */
|
|
11
|
+
cause?: unknown;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Transport failure carrying safe metadata only. The response body is
|
|
13
15
|
* classified but never stored: deployed error bodies are unverified and
|
|
14
|
-
* may carry data that must not reach output, logs, or telemetry.
|
|
16
|
+
* may carry data that must not reach output, logs, or telemetry. When
|
|
17
|
+
* the body read itself failed, the read error is preserved via `cause`
|
|
18
|
+
* so its detail is not lost; callers currently classify these errors
|
|
19
|
+
* by status alone and do not read the cause.
|
|
15
20
|
*/
|
|
16
21
|
export declare class InsightsHttpError extends Error {
|
|
17
22
|
readonly status: number;
|
|
@@ -24,8 +29,11 @@ export declare class InsightsHttpError extends Error {
|
|
|
24
29
|
constructor(init: InsightsHttpErrorInit);
|
|
25
30
|
}
|
|
26
31
|
/**
|
|
27
|
-
* A
|
|
28
|
-
* TLS error, connection
|
|
32
|
+
* A transport failure: either no response was received (DNS failure,
|
|
33
|
+
* TLS error, connection refused) or the connection died while reading
|
|
34
|
+
* the body of a 2xx response. Error statuses whose body read fails keep
|
|
35
|
+
* their status via InsightsHttpError instead (with the read failure as
|
|
36
|
+
* its `cause`). The original error is
|
|
29
37
|
* preserved via `cause`: downstream `@uipath/common`
|
|
30
38
|
* describeConnectivityError walks the cause chain to classify
|
|
31
39
|
* connectivity failures (orchestrator-sdk FetchError precedent), so
|
|
@@ -34,7 +42,7 @@ export declare class InsightsHttpError extends Error {
|
|
|
34
42
|
export declare class InsightsNetworkError extends Error {
|
|
35
43
|
/** Route template with placeholder segments, never session values. */
|
|
36
44
|
readonly endpoint: string;
|
|
37
|
-
constructor(endpoint: string, cause: unknown);
|
|
45
|
+
constructor(endpoint: string, cause: unknown, phase?: "request" | "response-body");
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
48
|
* A 2xx response whose body does not match the documented contract.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/insights-sdk",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.201.0-preview.121",
|
|
5
5
|
"description": "SDK for the UiPath Insights API — jobs, failures, and performance metrics.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"files": [
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "c70ccfc0b12e637441d67df1d212b71d7784b5f8"
|
|
38
38
|
}
|