@uipath/uipath-typescript 1.3.11 → 1.4.1
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/agent-memory/index.cjs +1772 -0
- package/dist/agent-memory/index.d.ts +588 -0
- package/dist/agent-memory/index.mjs +1770 -0
- package/dist/agents/index.cjs +1995 -0
- package/dist/agents/index.d.ts +961 -0
- package/dist/agents/index.mjs +1993 -0
- package/dist/assets/index.cjs +171 -39
- package/dist/assets/index.d.ts +84 -5
- package/dist/assets/index.mjs +171 -39
- package/dist/attachments/index.cjs +53 -15
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.mjs +53 -15
- package/dist/buckets/index.cjs +151 -130
- package/dist/buckets/index.d.ts +198 -84
- package/dist/buckets/index.mjs +151 -130
- package/dist/cases/index.cjs +220 -23
- package/dist/cases/index.d.ts +148 -10
- package/dist/cases/index.mjs +220 -24
- package/dist/conversational-agent/index.cjs +140 -66
- package/dist/conversational-agent/index.d.ts +190 -122
- package/dist/conversational-agent/index.mjs +140 -66
- package/dist/core/index.cjs +445 -108
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.mjs +445 -108
- package/dist/entities/index.cjs +365 -102
- package/dist/entities/index.d.ts +446 -114
- package/dist/entities/index.mjs +365 -102
- package/dist/feedback/index.cjs +53 -15
- package/dist/feedback/index.d.ts +1 -0
- package/dist/feedback/index.mjs +53 -15
- package/dist/governance/index.cjs +1789 -0
- package/dist/governance/index.d.ts +598 -0
- package/dist/governance/index.mjs +1787 -0
- package/dist/index.cjs +1453 -444
- package/dist/index.d.ts +4150 -1742
- package/dist/index.mjs +1452 -445
- package/dist/index.umd.js +5035 -4009
- package/dist/jobs/index.cjs +53 -15
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.mjs +53 -15
- package/dist/maestro-processes/index.cjs +189 -27
- package/dist/maestro-processes/index.d.ts +131 -9
- package/dist/maestro-processes/index.mjs +189 -27
- package/dist/orchestrator-du-module/index.cjs +1788 -0
- package/dist/orchestrator-du-module/index.d.ts +757 -0
- package/dist/orchestrator-du-module/index.mjs +1785 -0
- package/dist/processes/index.cjs +53 -15
- package/dist/processes/index.d.ts +1 -0
- package/dist/processes/index.mjs +53 -15
- package/dist/queues/index.cjs +53 -15
- package/dist/queues/index.d.ts +1 -0
- package/dist/queues/index.mjs +53 -15
- package/dist/tasks/index.cjs +116 -19
- package/dist/tasks/index.d.ts +110 -4
- package/dist/tasks/index.mjs +117 -20
- package/dist/traces/index.cjs +340 -15
- package/dist/traces/index.d.ts +483 -2
- package/dist/traces/index.mjs +339 -16
- package/package.json +42 -2
package/dist/traces/index.mjs
CHANGED
|
@@ -717,6 +717,32 @@ function filterUndefined(obj) {
|
|
|
717
717
|
*/
|
|
718
718
|
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
719
719
|
isBrowser && window.self != window.top && window.location.href.includes('source=ActionCenter');
|
|
720
|
+
const _params = isBrowser ? new URLSearchParams(window.location.search) : null;
|
|
721
|
+
/**
|
|
722
|
+
* True when the coded app has been loaded inside a host frame that explicitly
|
|
723
|
+
* opted into token delegation by adding `?host=embed` to the iframe src URL.
|
|
724
|
+
*/
|
|
725
|
+
const isHostEmbedded = isBrowser && window.self !== window.top && _params?.get('host') === 'embed';
|
|
726
|
+
/**
|
|
727
|
+
* The validated parent origin, read from the `?basedomain=` query param set
|
|
728
|
+
* by the embedding host in the iframe src URL.
|
|
729
|
+
* Mirrors the same mechanism used by ActionCenterTokenManager.
|
|
730
|
+
* Non-null only when `?host=embed` is present and `?basedomain=` is a valid URL.
|
|
731
|
+
*/
|
|
732
|
+
(() => {
|
|
733
|
+
if (!isHostEmbedded)
|
|
734
|
+
return null;
|
|
735
|
+
const basedomain = _params?.get('basedomain');
|
|
736
|
+
if (!basedomain)
|
|
737
|
+
return null;
|
|
738
|
+
try {
|
|
739
|
+
return new URL(basedomain).origin;
|
|
740
|
+
}
|
|
741
|
+
catch {
|
|
742
|
+
console.warn('embeddingOrigin: basedomain query param is not a valid URL', basedomain);
|
|
743
|
+
return null;
|
|
744
|
+
}
|
|
745
|
+
})();
|
|
720
746
|
|
|
721
747
|
/**
|
|
722
748
|
* Base64 encoding/decoding
|
|
@@ -891,6 +917,35 @@ const ODATA_PREFIX = '$';
|
|
|
891
917
|
const HTTP_METHODS = {
|
|
892
918
|
GET: 'GET',
|
|
893
919
|
POST: 'POST'};
|
|
920
|
+
/**
|
|
921
|
+
* Agents pagination constants — items and total count are nested under the response envelope
|
|
922
|
+
*/
|
|
923
|
+
const AGENTS_PAGINATION = {
|
|
924
|
+
/** Dotted path to the total count in the agents response envelope */
|
|
925
|
+
TOTAL_COUNT_FIELD: 'pagination.totalCount'
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* Agents OFFSET pagination parameter names (page-number style, 0-based, no skip conversion)
|
|
929
|
+
*/
|
|
930
|
+
const AGENTS_OFFSET_PARAMS = {
|
|
931
|
+
/** Page size parameter name */
|
|
932
|
+
PAGE_SIZE_PARAM: 'pageSize',
|
|
933
|
+
/** Page number parameter name (sent directly, 0-based) */
|
|
934
|
+
OFFSET_PARAM: 'pageNumber',
|
|
935
|
+
/** No count param needed */
|
|
936
|
+
COUNT_PARAM: undefined
|
|
937
|
+
};
|
|
938
|
+
/**
|
|
939
|
+
* Traceview spans pagination constants — items sit directly under `data`,
|
|
940
|
+
* total count under the same envelope location as the agents list. Request
|
|
941
|
+
* params reuse {@link AGENTS_OFFSET_PARAMS} (pageSize + 0-based pageNumber).
|
|
942
|
+
*/
|
|
943
|
+
const TRACEVIEW_SPANS_PAGINATION = {
|
|
944
|
+
/** Field name for the spans array in the response envelope */
|
|
945
|
+
ITEMS_FIELD: 'data',
|
|
946
|
+
/** Total count path — same envelope location as the agents list. */
|
|
947
|
+
TOTAL_COUNT_FIELD: AGENTS_PAGINATION.TOTAL_COUNT_FIELD
|
|
948
|
+
};
|
|
894
949
|
/**
|
|
895
950
|
* OData OFFSET pagination parameter names (ODATA-style)
|
|
896
951
|
*/
|
|
@@ -1177,12 +1232,18 @@ class PaginationHelpers {
|
|
|
1177
1232
|
* @returns Promise resolving to a paginated result
|
|
1178
1233
|
*/
|
|
1179
1234
|
static async getAllPaginated(params) {
|
|
1180
|
-
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1235
|
+
const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1181
1236
|
const endpoint = getEndpoint(folderId);
|
|
1182
1237
|
const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
|
|
1238
|
+
// On POST, the caller's options go in the body; queryParams stays in the URL.
|
|
1239
|
+
// On GET, everything is URL — queryParams merges with additionalParams.
|
|
1240
|
+
const isPost = method === HTTP_METHODS.POST;
|
|
1241
|
+
const requestSpec = isPost
|
|
1242
|
+
? { body: additionalParams, params: queryParams }
|
|
1243
|
+
: { params: { ...additionalParams, ...queryParams } };
|
|
1183
1244
|
const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
|
|
1184
1245
|
headers,
|
|
1185
|
-
|
|
1246
|
+
...requestSpec,
|
|
1186
1247
|
pagination: {
|
|
1187
1248
|
paginationType: options.paginationType || PaginationType.OFFSET,
|
|
1188
1249
|
itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
|
|
@@ -1207,7 +1268,7 @@ class PaginationHelpers {
|
|
|
1207
1268
|
* @returns Promise resolving to an object with data and totalCount
|
|
1208
1269
|
*/
|
|
1209
1270
|
static async getAllNonPaginated(params) {
|
|
1210
|
-
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1271
|
+
const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
|
|
1211
1272
|
// Set default field names
|
|
1212
1273
|
const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
|
|
1213
1274
|
const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
|
|
@@ -1217,17 +1278,18 @@ class PaginationHelpers {
|
|
|
1217
1278
|
// Make the API call based on method
|
|
1218
1279
|
let response;
|
|
1219
1280
|
if (method === HTTP_METHODS.POST) {
|
|
1220
|
-
response = await serviceAccess.post(endpoint, additionalParams, { headers });
|
|
1281
|
+
response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
|
|
1221
1282
|
}
|
|
1222
1283
|
else {
|
|
1223
1284
|
response = await serviceAccess.get(endpoint, {
|
|
1224
|
-
params: additionalParams,
|
|
1285
|
+
params: { ...additionalParams, ...queryParams },
|
|
1225
1286
|
headers
|
|
1226
1287
|
});
|
|
1227
1288
|
}
|
|
1228
1289
|
// Extract and transform items from response
|
|
1229
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1230
|
-
|
|
1290
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1291
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1292
|
+
const rawItems = Array.isArray(response.data) ? response.data : resolveNestedField(response.data, itemsField);
|
|
1231
1293
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1232
1294
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1233
1295
|
// Parse items - automatically handle JSON string responses
|
|
@@ -1273,8 +1335,9 @@ class PaginationHelpers {
|
|
|
1273
1335
|
getEndpoint: config.getEndpoint,
|
|
1274
1336
|
folderId,
|
|
1275
1337
|
headers: config.headers,
|
|
1276
|
-
paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
|
|
1338
|
+
paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
|
|
1277
1339
|
additionalParams: prefixedOptions,
|
|
1340
|
+
queryParams: config.queryParams,
|
|
1278
1341
|
transformFn: config.transformFn,
|
|
1279
1342
|
method: config.method,
|
|
1280
1343
|
options: {
|
|
@@ -1292,6 +1355,7 @@ class PaginationHelpers {
|
|
|
1292
1355
|
folderId,
|
|
1293
1356
|
headers: config.headers,
|
|
1294
1357
|
additionalParams: prefixedOptions,
|
|
1358
|
+
queryParams: config.queryParams,
|
|
1295
1359
|
transformFn: config.transformFn,
|
|
1296
1360
|
method: config.method,
|
|
1297
1361
|
options: {
|
|
@@ -1483,18 +1547,17 @@ class BaseService {
|
|
|
1483
1547
|
const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
|
|
1484
1548
|
// Prepare request parameters based on pagination type
|
|
1485
1549
|
const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
|
|
1486
|
-
//
|
|
1550
|
+
// Route pagination state to wherever the API expects it (body for POST, URL for GET).
|
|
1551
|
+
// Caller-supplied options.body / options.params are respected as-is — the api-client
|
|
1552
|
+
// already handles params (URL) and body (request body) independently for every method.
|
|
1487
1553
|
if (method.toUpperCase() === 'POST') {
|
|
1488
1554
|
const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
|
|
1489
1555
|
options.body = {
|
|
1490
1556
|
...existingBody,
|
|
1491
|
-
...options.params,
|
|
1492
1557
|
...requestParams
|
|
1493
1558
|
};
|
|
1494
|
-
options.params = undefined;
|
|
1495
1559
|
}
|
|
1496
1560
|
else {
|
|
1497
|
-
// Merge pagination parameters with existing parameters
|
|
1498
1561
|
options.params = {
|
|
1499
1562
|
...options.params,
|
|
1500
1563
|
...requestParams
|
|
@@ -1531,6 +1594,8 @@ class BaseService {
|
|
|
1531
1594
|
// When true (default), converts pageNumber to a skip/offset value (e.g., page 3 with pageSize 10 → skip 20).
|
|
1532
1595
|
// When false, passes pageNumber directly as the offset param — used by APIs that accept a page number instead of a record offset.
|
|
1533
1596
|
const convertToSkip = paginationParams?.convertToSkip ?? true;
|
|
1597
|
+
// When true, sends pageNumber - 1 (for 0-based APIs). Default false (1-based).
|
|
1598
|
+
const zeroBased = paginationParams?.zeroBased ?? false;
|
|
1534
1599
|
requestParams[pageSizeParam] = limitedPageSize;
|
|
1535
1600
|
if (convertToSkip) {
|
|
1536
1601
|
if (params.pageNumber && params.pageNumber > 1) {
|
|
@@ -1538,7 +1603,8 @@ class BaseService {
|
|
|
1538
1603
|
}
|
|
1539
1604
|
}
|
|
1540
1605
|
else {
|
|
1541
|
-
|
|
1606
|
+
const sdkPageNumber = params.pageNumber || 1;
|
|
1607
|
+
requestParams[offsetParam] = zeroBased ? sdkPageNumber - 1 : sdkPageNumber;
|
|
1542
1608
|
}
|
|
1543
1609
|
{
|
|
1544
1610
|
requestParams[countParam] = true;
|
|
@@ -1567,8 +1633,9 @@ class BaseService {
|
|
|
1567
1633
|
const totalCountField = fields.totalCountField || 'totalRecordCount';
|
|
1568
1634
|
const continuationTokenField = fields.continuationTokenField || 'continuationToken';
|
|
1569
1635
|
// Extract items and metadata
|
|
1570
|
-
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N })
|
|
1571
|
-
|
|
1636
|
+
// Handle both plain array responses and envelope responses ({ value: [...], totalRecordCount: N }).
|
|
1637
|
+
// itemsField may be a dotted path (e.g. 'data.agents') for nested envelopes.
|
|
1638
|
+
const items = Array.isArray(response.data) ? response.data : (resolveNestedField(response.data, itemsField) || []);
|
|
1572
1639
|
const rawTotalCount = Array.isArray(response.data) ? undefined : resolveNestedField(response.data, totalCountField);
|
|
1573
1640
|
const totalCount = typeof rawTotalCount === 'number' ? rawTotalCount : undefined;
|
|
1574
1641
|
const continuationToken = response.data[continuationTokenField];
|
|
@@ -1760,6 +1827,23 @@ const SpanAttachmentDirectionMap = {
|
|
|
1760
1827
|
* Base path constants for different services
|
|
1761
1828
|
*/
|
|
1762
1829
|
const LLMOPS_BASE = 'llmopstenant_';
|
|
1830
|
+
const INSIGHTS_RTM_BASE = 'insightsrtm_';
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* Agent Traces Service Endpoints
|
|
1834
|
+
*/
|
|
1835
|
+
const AGENT_TRACES_ENDPOINTS = {
|
|
1836
|
+
/** Trace-level time-series of error counts grouped by error name. */
|
|
1837
|
+
GET_ERRORS_TIMELINE: `${INSIGHTS_RTM_BASE}/Traceview/errorsTimeline`,
|
|
1838
|
+
/** Trace-level time-series of latency (decimal seconds per series). */
|
|
1839
|
+
GET_LATENCY_TIMELINE: `${INSIGHTS_RTM_BASE}/Traceview/latencyTimeline`,
|
|
1840
|
+
/** Trace-level per-agent AGU/PLTU consumption totals. */
|
|
1841
|
+
GET_UNIT_CONSUMPTION: `${INSIGHTS_RTM_BASE}/Traceview/unitConsumption`,
|
|
1842
|
+
/** All spans for a single trace (flat array, not paginated). */
|
|
1843
|
+
GET_SPANS_BY_TRACE_ID: (traceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/${traceId}`,
|
|
1844
|
+
/** Paginated spans whose reference hierarchy contains the given reference id. */
|
|
1845
|
+
GET_SPANS_BY_REFERENCE: (referenceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/reference/${referenceId}`,
|
|
1846
|
+
};
|
|
1763
1847
|
|
|
1764
1848
|
/**
|
|
1765
1849
|
* Traces Service Endpoints
|
|
@@ -1897,4 +1981,243 @@ __decorate([
|
|
|
1897
1981
|
track('Traces.GetSpansByIds')
|
|
1898
1982
|
], TracesService.prototype, "getSpansByIds", null);
|
|
1899
1983
|
|
|
1900
|
-
|
|
1984
|
+
/**
|
|
1985
|
+
* Maps a raw span record to a {@link AgentSpanGetResponse}
|
|
1986
|
+
*/
|
|
1987
|
+
const transformSpan = (span) => {
|
|
1988
|
+
const { expiryTimeUtc, ...rest } = span;
|
|
1989
|
+
return { ...rest, expiredTime: expiryTimeUtc };
|
|
1990
|
+
};
|
|
1991
|
+
/**
|
|
1992
|
+
* Service for retrieving UiPath Agent trace metrics.
|
|
1993
|
+
*/
|
|
1994
|
+
class AgentTracesService extends BaseService {
|
|
1995
|
+
/**
|
|
1996
|
+
* Retrieves a trace-level time-series of error counts grouped by error name.
|
|
1997
|
+
*
|
|
1998
|
+
* @param options - Optional window and filters
|
|
1999
|
+
* @returns Promise resolving to an array of {@link AgentTraceGetErrorsTimelineResponse}
|
|
2000
|
+
* @example
|
|
2001
|
+
* ```typescript
|
|
2002
|
+
* import { AgentTraces } from '@uipath/uipath-typescript/traces';
|
|
2003
|
+
*
|
|
2004
|
+
* const trace = new AgentTraces(sdk);
|
|
2005
|
+
*
|
|
2006
|
+
* // Get the errors timeline
|
|
2007
|
+
* const result = await trace.getErrorsTimeline();
|
|
2008
|
+
* result.forEach((point) => {
|
|
2009
|
+
* console.log(`${point.date} ${point.name}: ${point.value} errors`);
|
|
2010
|
+
* });
|
|
2011
|
+
* ```
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```typescript
|
|
2014
|
+
* import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
|
|
2015
|
+
*
|
|
2016
|
+
* // Get the errors timeline for an agent version within a time window
|
|
2017
|
+
* const filtered = await trace.getErrorsTimeline({
|
|
2018
|
+
* startTime: new Date('2025-05-01T00:00:00Z'),
|
|
2019
|
+
* endTime: new Date('2025-06-01T00:00:00Z'),
|
|
2020
|
+
* agentId: '<agentId>',
|
|
2021
|
+
* agentVersion: '1.0.0',
|
|
2022
|
+
* executionType: AgentTraceExecutionType.Runtime,
|
|
2023
|
+
* });
|
|
2024
|
+
* ```
|
|
2025
|
+
*/
|
|
2026
|
+
async getErrorsTimeline(options) {
|
|
2027
|
+
const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_ERRORS_TIMELINE, this.buildTraceFilterBody(options));
|
|
2028
|
+
return response.data.data;
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Retrieves a trace-level time-series of latency.
|
|
2032
|
+
*
|
|
2033
|
+
* @param options - Optional window and filters
|
|
2034
|
+
* @returns Promise resolving to an array of {@link AgentTraceGetLatencyTimelineResponse}
|
|
2035
|
+
* @example
|
|
2036
|
+
* ```typescript
|
|
2037
|
+
* import { AgentTraces } from '@uipath/uipath-typescript/traces';
|
|
2038
|
+
*
|
|
2039
|
+
* const trace = new AgentTraces(sdk);
|
|
2040
|
+
*
|
|
2041
|
+
* // Get the latency timeline
|
|
2042
|
+
* const result = await trace.getLatencyTimeline();
|
|
2043
|
+
* result.forEach((point) => {
|
|
2044
|
+
* console.log(`${point.date} ${point.name}: ${point.value}s`);
|
|
2045
|
+
* });
|
|
2046
|
+
* ```
|
|
2047
|
+
* @example
|
|
2048
|
+
* ```typescript
|
|
2049
|
+
* import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
|
|
2050
|
+
*
|
|
2051
|
+
* // Get the latency timeline for an agent version within a time window
|
|
2052
|
+
* const filtered = await trace.getLatencyTimeline({
|
|
2053
|
+
* startTime: new Date('2025-05-01T00:00:00Z'),
|
|
2054
|
+
* endTime: new Date('2025-06-01T00:00:00Z'),
|
|
2055
|
+
* agentId: '<agentId>',
|
|
2056
|
+
* agentVersion: '1.0.0',
|
|
2057
|
+
* executionType: AgentTraceExecutionType.Runtime,
|
|
2058
|
+
* });
|
|
2059
|
+
* ```
|
|
2060
|
+
*/
|
|
2061
|
+
async getLatencyTimeline(options) {
|
|
2062
|
+
const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_LATENCY_TIMELINE, this.buildTraceFilterBody(options));
|
|
2063
|
+
return response.data.data;
|
|
2064
|
+
}
|
|
2065
|
+
/**
|
|
2066
|
+
* Retrieves trace-level per-agent unit consumption totals.
|
|
2067
|
+
*
|
|
2068
|
+
* @param options - Optional window and filters
|
|
2069
|
+
* @returns Promise resolving to an array of {@link AgentTraceGetUnitConsumptionResponse}
|
|
2070
|
+
* @example
|
|
2071
|
+
* ```typescript
|
|
2072
|
+
* import { AgentTraces } from '@uipath/uipath-typescript/traces';
|
|
2073
|
+
*
|
|
2074
|
+
* const trace = new AgentTraces(sdk);
|
|
2075
|
+
*
|
|
2076
|
+
* // Get per-agent unit consumption
|
|
2077
|
+
* const result = await trace.getUnitConsumption();
|
|
2078
|
+
* result.forEach((row) => {
|
|
2079
|
+
* console.log(`${row.agentId}: ${row.agentUnitsConsumed} AGU, ${row.platformUnitsConsumed} PLTU`);
|
|
2080
|
+
* });
|
|
2081
|
+
* ```
|
|
2082
|
+
* @example
|
|
2083
|
+
* ```typescript
|
|
2084
|
+
* import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
|
|
2085
|
+
*
|
|
2086
|
+
* // Get per-agent unit consumption for an agent version within a time window
|
|
2087
|
+
* const filtered = await trace.getUnitConsumption({
|
|
2088
|
+
* startTime: new Date('2025-05-01T00:00:00Z'),
|
|
2089
|
+
* endTime: new Date('2025-06-01T00:00:00Z'),
|
|
2090
|
+
* agentId: '<agentId>',
|
|
2091
|
+
* agentVersion: '1.0.0',
|
|
2092
|
+
* executionType: AgentTraceExecutionType.Runtime,
|
|
2093
|
+
* });
|
|
2094
|
+
* ```
|
|
2095
|
+
*/
|
|
2096
|
+
async getUnitConsumption(options) {
|
|
2097
|
+
const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_UNIT_CONSUMPTION, this.buildTraceFilterBody(options));
|
|
2098
|
+
return response.data.data;
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Retrieves every span belonging to a single trace.
|
|
2102
|
+
*
|
|
2103
|
+
* @param traceId - Identifier of the trace whose spans should be returned
|
|
2104
|
+
* @returns Promise resolving to an array of {@link AgentSpanGetResponse}
|
|
2105
|
+
* @example
|
|
2106
|
+
* ```typescript
|
|
2107
|
+
* import { AgentTraces } from '@uipath/uipath-typescript/traces';
|
|
2108
|
+
*
|
|
2109
|
+
* const trace = new AgentTraces(sdk);
|
|
2110
|
+
*
|
|
2111
|
+
* const spans = await trace.getSpansByTraceId('<traceId>');
|
|
2112
|
+
* spans.forEach((span) => {
|
|
2113
|
+
* console.log(`${span.name} (${span.startTime} → ${span.endTime ?? 'in progress'})`);
|
|
2114
|
+
* });
|
|
2115
|
+
* ```
|
|
2116
|
+
*/
|
|
2117
|
+
async getSpansByTraceId(traceId) {
|
|
2118
|
+
if (!traceId)
|
|
2119
|
+
throw new ValidationError({ message: 'traceId is required for getSpansByTraceId' });
|
|
2120
|
+
const response = await this.get(AGENT_TRACES_ENDPOINTS.GET_SPANS_BY_TRACE_ID(traceId));
|
|
2121
|
+
return (response.data ?? []).map(transformSpan);
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Retrieves spans whose reference hierarchy contains the given reference id.
|
|
2125
|
+
*
|
|
2126
|
+
* Returns a {@link PaginatedResponse} when pagination options (`pageSize`,
|
|
2127
|
+
* `cursor`, or `jumpToPage`) are provided, otherwise a
|
|
2128
|
+
* {@link NonPaginatedResponse}.
|
|
2129
|
+
*
|
|
2130
|
+
* @param referenceId - Reference id matched against each span's reference hierarchy
|
|
2131
|
+
* @param options - Optional pagination and hierarchy/time filters
|
|
2132
|
+
* @returns Promise resolving to a paginated or non-paginated list of {@link AgentSpanGetResponse}
|
|
2133
|
+
* @example
|
|
2134
|
+
* ```typescript
|
|
2135
|
+
* import { AgentTraces } from '@uipath/uipath-typescript/traces';
|
|
2136
|
+
*
|
|
2137
|
+
* const trace = new AgentTraces(sdk);
|
|
2138
|
+
*
|
|
2139
|
+
* // Get spans by referenceId
|
|
2140
|
+
* const result = await trace.getSpansByReference('<referenceId>');
|
|
2141
|
+
* result.items.forEach((span) => console.log(span.name));
|
|
2142
|
+
* ```
|
|
2143
|
+
* @example
|
|
2144
|
+
* ```typescript
|
|
2145
|
+
* import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
|
|
2146
|
+
*
|
|
2147
|
+
* // Get spans by referenceId within a trace and time window
|
|
2148
|
+
* const page = await trace.getSpansByReference('<referenceId>', {
|
|
2149
|
+
* traceId: '<traceId>',
|
|
2150
|
+
* executionType: AgentTraceExecutionType.Runtime,
|
|
2151
|
+
* startTime: new Date('2025-05-01T00:00:00Z'),
|
|
2152
|
+
* endTime: new Date('2025-06-01T00:00:00Z'),
|
|
2153
|
+
* pageSize: 25,
|
|
2154
|
+
* });
|
|
2155
|
+
*
|
|
2156
|
+
* if (page.hasNextPage && page.nextCursor) {
|
|
2157
|
+
* const next = await trace.getSpansByReference('<referenceId>', { cursor: page.nextCursor });
|
|
2158
|
+
* }
|
|
2159
|
+
* ```
|
|
2160
|
+
*/
|
|
2161
|
+
async getSpansByReference(referenceId, options) {
|
|
2162
|
+
if (!referenceId)
|
|
2163
|
+
throw new ValidationError({ message: 'referenceId is required for getSpansByReference' });
|
|
2164
|
+
const { startTime, endTime, ...rest } = options ?? {};
|
|
2165
|
+
const apiOptions = {
|
|
2166
|
+
...rest,
|
|
2167
|
+
...(startTime !== undefined ? { startTime: startTime.toISOString() } : {}),
|
|
2168
|
+
...(endTime !== undefined ? { endTime: endTime.toISOString() } : {}),
|
|
2169
|
+
};
|
|
2170
|
+
return PaginationHelpers.getAll({
|
|
2171
|
+
serviceAccess: this.createPaginationServiceAccess(),
|
|
2172
|
+
getEndpoint: () => AGENT_TRACES_ENDPOINTS.GET_SPANS_BY_REFERENCE(referenceId),
|
|
2173
|
+
method: HTTP_METHODS.GET,
|
|
2174
|
+
transformFn: transformSpan,
|
|
2175
|
+
excludeFromPrefix: Object.keys(apiOptions),
|
|
2176
|
+
pagination: {
|
|
2177
|
+
paginationType: PaginationType.OFFSET,
|
|
2178
|
+
itemsField: TRACEVIEW_SPANS_PAGINATION.ITEMS_FIELD,
|
|
2179
|
+
totalCountField: TRACEVIEW_SPANS_PAGINATION.TOTAL_COUNT_FIELD,
|
|
2180
|
+
paginationParams: {
|
|
2181
|
+
pageSizeParam: AGENTS_OFFSET_PARAMS.PAGE_SIZE_PARAM,
|
|
2182
|
+
offsetParam: AGENTS_OFFSET_PARAMS.OFFSET_PARAM,
|
|
2183
|
+
countParam: AGENTS_OFFSET_PARAMS.COUNT_PARAM,
|
|
2184
|
+
convertToSkip: false,
|
|
2185
|
+
zeroBased: true,
|
|
2186
|
+
},
|
|
2187
|
+
},
|
|
2188
|
+
}, apiOptions);
|
|
2189
|
+
}
|
|
2190
|
+
buildTraceFilterBody(options) {
|
|
2191
|
+
const body = {};
|
|
2192
|
+
if (options?.startTime !== undefined)
|
|
2193
|
+
body.startTime = options.startTime.toISOString();
|
|
2194
|
+
if (options?.endTime !== undefined)
|
|
2195
|
+
body.endTime = options.endTime.toISOString();
|
|
2196
|
+
if (options?.folderKeys !== undefined)
|
|
2197
|
+
body.folderKeys = options.folderKeys;
|
|
2198
|
+
if (options?.agentId !== undefined)
|
|
2199
|
+
body.agentId = options.agentId;
|
|
2200
|
+
if (options?.agentVersion !== undefined)
|
|
2201
|
+
body.agentVersion = options.agentVersion;
|
|
2202
|
+
if (options?.executionType !== undefined)
|
|
2203
|
+
body.executionType = options.executionType;
|
|
2204
|
+
return body;
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
__decorate([
|
|
2208
|
+
track('AgentTraces.GetErrorsTimeline')
|
|
2209
|
+
], AgentTracesService.prototype, "getErrorsTimeline", null);
|
|
2210
|
+
__decorate([
|
|
2211
|
+
track('AgentTraces.GetLatencyTimeline')
|
|
2212
|
+
], AgentTracesService.prototype, "getLatencyTimeline", null);
|
|
2213
|
+
__decorate([
|
|
2214
|
+
track('AgentTraces.GetUnitConsumption')
|
|
2215
|
+
], AgentTracesService.prototype, "getUnitConsumption", null);
|
|
2216
|
+
__decorate([
|
|
2217
|
+
track('AgentTraces.GetSpansByTraceId')
|
|
2218
|
+
], AgentTracesService.prototype, "getSpansByTraceId", null);
|
|
2219
|
+
__decorate([
|
|
2220
|
+
track('AgentTraces.GetSpansByReference')
|
|
2221
|
+
], AgentTracesService.prototype, "getSpansByReference", null);
|
|
2222
|
+
|
|
2223
|
+
export { SpanExecutionType as AgentTraceExecutionType, AgentTracesService as AgentTraces, SpanAttachmentDirection, SpanAttachmentProvider, SpanExecutionType, SpanPermissionStatus, SpanSource, SpanStatus, SpanVerbosityLevel, TracesService as Traces };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/uipath-typescript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "UiPath TypeScript SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -156,6 +156,16 @@
|
|
|
156
156
|
"default": "./dist/feedback/index.cjs"
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
|
+
"./agent-memory": {
|
|
160
|
+
"import": {
|
|
161
|
+
"types": "./dist/agent-memory/index.d.ts",
|
|
162
|
+
"default": "./dist/agent-memory/index.mjs"
|
|
163
|
+
},
|
|
164
|
+
"require": {
|
|
165
|
+
"types": "./dist/agent-memory/index.d.ts",
|
|
166
|
+
"default": "./dist/agent-memory/index.cjs"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
159
169
|
"./traces": {
|
|
160
170
|
"import": {
|
|
161
171
|
"types": "./dist/traces/index.d.ts",
|
|
@@ -175,6 +185,36 @@
|
|
|
175
185
|
"types": "./dist/document-understanding/index.d.ts",
|
|
176
186
|
"default": "./dist/document-understanding/index.cjs"
|
|
177
187
|
}
|
|
188
|
+
},
|
|
189
|
+
"./orchestrator-du-module": {
|
|
190
|
+
"import": {
|
|
191
|
+
"types": "./dist/orchestrator-du-module/index.d.ts",
|
|
192
|
+
"default": "./dist/orchestrator-du-module/index.mjs"
|
|
193
|
+
},
|
|
194
|
+
"require": {
|
|
195
|
+
"types": "./dist/orchestrator-du-module/index.d.ts",
|
|
196
|
+
"default": "./dist/orchestrator-du-module/index.cjs"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
"./agents": {
|
|
200
|
+
"import": {
|
|
201
|
+
"types": "./dist/agents/index.d.ts",
|
|
202
|
+
"default": "./dist/agents/index.mjs"
|
|
203
|
+
},
|
|
204
|
+
"require": {
|
|
205
|
+
"types": "./dist/agents/index.d.ts",
|
|
206
|
+
"default": "./dist/agents/index.cjs"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"./governance": {
|
|
210
|
+
"import": {
|
|
211
|
+
"types": "./dist/governance/index.d.ts",
|
|
212
|
+
"default": "./dist/governance/index.mjs"
|
|
213
|
+
},
|
|
214
|
+
"require": {
|
|
215
|
+
"types": "./dist/governance/index.d.ts",
|
|
216
|
+
"default": "./dist/governance/index.cjs"
|
|
217
|
+
}
|
|
178
218
|
}
|
|
179
219
|
},
|
|
180
220
|
"files": [
|
|
@@ -206,7 +246,7 @@
|
|
|
206
246
|
"test:coverage": "vitest --coverage"
|
|
207
247
|
},
|
|
208
248
|
"dependencies": {
|
|
209
|
-
"@uipath/core-telemetry": "^1.0.0-beta.
|
|
249
|
+
"@uipath/core-telemetry": "^1.0.0-beta.3",
|
|
210
250
|
"socket.io-client": "^4.8.1"
|
|
211
251
|
},
|
|
212
252
|
"peerDependencies": {
|