@uipath/uipath-typescript 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/agent-memory/index.cjs +16 -9
  2. package/dist/agent-memory/index.mjs +16 -9
  3. package/dist/agents/index.cjs +278 -9
  4. package/dist/agents/index.d.ts +465 -6
  5. package/dist/agents/index.mjs +279 -10
  6. package/dist/assets/index.cjs +16 -9
  7. package/dist/assets/index.mjs +16 -9
  8. package/dist/attachments/index.cjs +16 -9
  9. package/dist/attachments/index.mjs +16 -9
  10. package/dist/buckets/index.cjs +114 -124
  11. package/dist/buckets/index.d.ts +197 -84
  12. package/dist/buckets/index.mjs +114 -124
  13. package/dist/cases/index.cjs +79 -13
  14. package/dist/cases/index.d.ts +30 -3
  15. package/dist/cases/index.mjs +79 -13
  16. package/dist/conversational-agent/index.cjs +16 -9
  17. package/dist/conversational-agent/index.mjs +16 -9
  18. package/dist/core/index.cjs +35 -6
  19. package/dist/core/index.mjs +35 -6
  20. package/dist/document-understanding/index.cjs +84 -84
  21. package/dist/document-understanding/index.d.ts +2 -1
  22. package/dist/document-understanding/index.mjs +1 -1
  23. package/dist/entities/index.cjs +253 -69
  24. package/dist/entities/index.d.ts +343 -116
  25. package/dist/entities/index.mjs +253 -69
  26. package/dist/feedback/index.cjs +16 -9
  27. package/dist/feedback/index.mjs +16 -9
  28. package/dist/governance/index.cjs +16 -9
  29. package/dist/governance/index.mjs +16 -9
  30. package/dist/index.cjs +529 -193
  31. package/dist/index.d.ts +2141 -750
  32. package/dist/index.mjs +529 -194
  33. package/dist/index.umd.js +529 -193
  34. package/dist/jobs/index.cjs +16 -9
  35. package/dist/jobs/index.mjs +16 -9
  36. package/dist/maestro-processes/index.cjs +16 -9
  37. package/dist/maestro-processes/index.mjs +16 -9
  38. package/dist/orchestrator-du-module/index.cjs +1788 -0
  39. package/dist/orchestrator-du-module/index.d.ts +757 -0
  40. package/dist/orchestrator-du-module/index.mjs +1785 -0
  41. package/dist/processes/index.cjs +16 -9
  42. package/dist/processes/index.mjs +16 -9
  43. package/dist/queues/index.cjs +16 -9
  44. package/dist/queues/index.mjs +16 -9
  45. package/dist/tasks/index.cjs +79 -13
  46. package/dist/tasks/index.d.ts +109 -4
  47. package/dist/tasks/index.mjs +80 -14
  48. package/dist/traces/index.cjs +303 -9
  49. package/dist/traces/index.d.ts +482 -2
  50. package/dist/traces/index.mjs +302 -10
  51. package/package.json +11 -1
@@ -919,6 +919,35 @@ const ODATA_PREFIX = '$';
919
919
  const HTTP_METHODS = {
920
920
  GET: 'GET',
921
921
  POST: 'POST'};
922
+ /**
923
+ * Agents pagination constants — items and total count are nested under the response envelope
924
+ */
925
+ const AGENTS_PAGINATION = {
926
+ /** Dotted path to the total count in the agents response envelope */
927
+ TOTAL_COUNT_FIELD: 'pagination.totalCount'
928
+ };
929
+ /**
930
+ * Agents OFFSET pagination parameter names (page-number style, 0-based, no skip conversion)
931
+ */
932
+ const AGENTS_OFFSET_PARAMS = {
933
+ /** Page size parameter name */
934
+ PAGE_SIZE_PARAM: 'pageSize',
935
+ /** Page number parameter name (sent directly, 0-based) */
936
+ OFFSET_PARAM: 'pageNumber',
937
+ /** No count param needed */
938
+ COUNT_PARAM: undefined
939
+ };
940
+ /**
941
+ * Traceview spans pagination constants — items sit directly under `data`,
942
+ * total count under the same envelope location as the agents list. Request
943
+ * params reuse {@link AGENTS_OFFSET_PARAMS} (pageSize + 0-based pageNumber).
944
+ */
945
+ const TRACEVIEW_SPANS_PAGINATION = {
946
+ /** Field name for the spans array in the response envelope */
947
+ ITEMS_FIELD: 'data',
948
+ /** Total count path — same envelope location as the agents list. */
949
+ TOTAL_COUNT_FIELD: AGENTS_PAGINATION.TOTAL_COUNT_FIELD
950
+ };
922
951
  /**
923
952
  * OData OFFSET pagination parameter names (ODATA-style)
924
953
  */
@@ -1205,12 +1234,18 @@ class PaginationHelpers {
1205
1234
  * @returns Promise resolving to a paginated result
1206
1235
  */
1207
1236
  static async getAllPaginated(params) {
1208
- const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1237
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1209
1238
  const endpoint = getEndpoint(folderId);
1210
1239
  const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1240
+ // On POST, the caller's options go in the body; queryParams stays in the URL.
1241
+ // On GET, everything is URL — queryParams merges with additionalParams.
1242
+ const isPost = method === HTTP_METHODS.POST;
1243
+ const requestSpec = isPost
1244
+ ? { body: additionalParams, params: queryParams }
1245
+ : { params: { ...additionalParams, ...queryParams } };
1211
1246
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1212
1247
  headers,
1213
- params: additionalParams,
1248
+ ...requestSpec,
1214
1249
  pagination: {
1215
1250
  paginationType: options.paginationType || PaginationType.OFFSET,
1216
1251
  itemsField: options.itemsField || DEFAULT_ITEMS_FIELD,
@@ -1235,7 +1270,7 @@ class PaginationHelpers {
1235
1270
  * @returns Promise resolving to an object with data and totalCount
1236
1271
  */
1237
1272
  static async getAllNonPaginated(params) {
1238
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1273
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, queryParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1239
1274
  // Set default field names
1240
1275
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1241
1276
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
@@ -1245,11 +1280,11 @@ class PaginationHelpers {
1245
1280
  // Make the API call based on method
1246
1281
  let response;
1247
1282
  if (method === HTTP_METHODS.POST) {
1248
- response = await serviceAccess.post(endpoint, additionalParams, { headers });
1283
+ response = await serviceAccess.post(endpoint, additionalParams, { headers, params: queryParams });
1249
1284
  }
1250
1285
  else {
1251
1286
  response = await serviceAccess.get(endpoint, {
1252
- params: additionalParams,
1287
+ params: { ...additionalParams, ...queryParams },
1253
1288
  headers
1254
1289
  });
1255
1290
  }
@@ -1304,6 +1339,7 @@ class PaginationHelpers {
1304
1339
  headers: config.headers,
1305
1340
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage !== undefined ? { jumpToPage, pageSize } : { pageSize },
1306
1341
  additionalParams: prefixedOptions,
1342
+ queryParams: config.queryParams,
1307
1343
  transformFn: config.transformFn,
1308
1344
  method: config.method,
1309
1345
  options: {
@@ -1321,6 +1357,7 @@ class PaginationHelpers {
1321
1357
  folderId,
1322
1358
  headers: config.headers,
1323
1359
  additionalParams: prefixedOptions,
1360
+ queryParams: config.queryParams,
1324
1361
  transformFn: config.transformFn,
1325
1362
  method: config.method,
1326
1363
  options: {
@@ -1512,18 +1549,17 @@ class BaseService {
1512
1549
  const params = this.validateAndPreparePaginationParams(paginationType, paginationOptions);
1513
1550
  // Prepare request parameters based on pagination type
1514
1551
  const requestParams = this.preparePaginationRequestParams(paginationType, params, options.pagination);
1515
- // For POST requests, merge pagination params into body and set params to undefined; for GET, use query params
1552
+ // Route pagination state to wherever the API expects it (body for POST, URL for GET).
1553
+ // Caller-supplied options.body / options.params are respected as-is — the api-client
1554
+ // already handles params (URL) and body (request body) independently for every method.
1516
1555
  if (method.toUpperCase() === 'POST') {
1517
1556
  const existingBody = (options.body && typeof options.body === 'object') ? options.body : {};
1518
1557
  options.body = {
1519
1558
  ...existingBody,
1520
- ...options.params,
1521
1559
  ...requestParams
1522
1560
  };
1523
- options.params = undefined;
1524
1561
  }
1525
1562
  else {
1526
- // Merge pagination parameters with existing parameters
1527
1563
  options.params = {
1528
1564
  ...options.params,
1529
1565
  ...requestParams
@@ -1793,6 +1829,23 @@ const SpanAttachmentDirectionMap = {
1793
1829
  * Base path constants for different services
1794
1830
  */
1795
1831
  const LLMOPS_BASE = 'llmopstenant_';
1832
+ const INSIGHTS_RTM_BASE = 'insightsrtm_';
1833
+
1834
+ /**
1835
+ * Agent Traces Service Endpoints
1836
+ */
1837
+ const AGENT_TRACES_ENDPOINTS = {
1838
+ /** Trace-level time-series of error counts grouped by error name. */
1839
+ GET_ERRORS_TIMELINE: `${INSIGHTS_RTM_BASE}/Traceview/errorsTimeline`,
1840
+ /** Trace-level time-series of latency (decimal seconds per series). */
1841
+ GET_LATENCY_TIMELINE: `${INSIGHTS_RTM_BASE}/Traceview/latencyTimeline`,
1842
+ /** Trace-level per-agent AGU/PLTU consumption totals. */
1843
+ GET_UNIT_CONSUMPTION: `${INSIGHTS_RTM_BASE}/Traceview/unitConsumption`,
1844
+ /** All spans for a single trace (flat array, not paginated). */
1845
+ GET_SPANS_BY_TRACE_ID: (traceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/${traceId}`,
1846
+ /** Paginated spans whose reference hierarchy contains the given reference id. */
1847
+ GET_SPANS_BY_REFERENCE: (referenceId) => `${INSIGHTS_RTM_BASE}/Traceview/spans/reference/${referenceId}`,
1848
+ };
1796
1849
 
1797
1850
  /**
1798
1851
  * Traces Service Endpoints
@@ -1930,4 +1983,245 @@ __decorate([
1930
1983
  track('Traces.GetSpansByIds')
1931
1984
  ], TracesService.prototype, "getSpansByIds", null);
1932
1985
 
1986
+ /**
1987
+ * Maps a raw span record to a {@link AgentSpanGetResponse}
1988
+ */
1989
+ const transformSpan = (span) => {
1990
+ const { expiryTimeUtc, ...rest } = span;
1991
+ return { ...rest, expiredTime: expiryTimeUtc };
1992
+ };
1993
+ /**
1994
+ * Service for retrieving UiPath Agent trace metrics.
1995
+ */
1996
+ class AgentTracesService extends BaseService {
1997
+ /**
1998
+ * Retrieves a trace-level time-series of error counts grouped by error name.
1999
+ *
2000
+ * @param options - Optional window and filters
2001
+ * @returns Promise resolving to an array of {@link AgentTraceGetErrorsTimelineResponse}
2002
+ * @example
2003
+ * ```typescript
2004
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2005
+ *
2006
+ * const trace = new AgentTraces(sdk);
2007
+ *
2008
+ * // Get the errors timeline
2009
+ * const result = await trace.getErrorsTimeline();
2010
+ * result.forEach((point) => {
2011
+ * console.log(`${point.date} ${point.name}: ${point.value} errors`);
2012
+ * });
2013
+ * ```
2014
+ * @example
2015
+ * ```typescript
2016
+ * import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
2017
+ *
2018
+ * // Get the errors timeline for an agent version within a time window
2019
+ * const filtered = await trace.getErrorsTimeline({
2020
+ * startTime: new Date('2025-05-01T00:00:00Z'),
2021
+ * endTime: new Date('2025-06-01T00:00:00Z'),
2022
+ * agentId: '<agentId>',
2023
+ * agentVersion: '1.0.0',
2024
+ * executionType: AgentTraceExecutionType.Runtime,
2025
+ * });
2026
+ * ```
2027
+ */
2028
+ async getErrorsTimeline(options) {
2029
+ const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_ERRORS_TIMELINE, this.buildTraceFilterBody(options));
2030
+ return response.data.data;
2031
+ }
2032
+ /**
2033
+ * Retrieves a trace-level time-series of latency.
2034
+ *
2035
+ * @param options - Optional window and filters
2036
+ * @returns Promise resolving to an array of {@link AgentTraceGetLatencyTimelineResponse}
2037
+ * @example
2038
+ * ```typescript
2039
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2040
+ *
2041
+ * const trace = new AgentTraces(sdk);
2042
+ *
2043
+ * // Get the latency timeline
2044
+ * const result = await trace.getLatencyTimeline();
2045
+ * result.forEach((point) => {
2046
+ * console.log(`${point.date} ${point.name}: ${point.value}s`);
2047
+ * });
2048
+ * ```
2049
+ * @example
2050
+ * ```typescript
2051
+ * import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
2052
+ *
2053
+ * // Get the latency timeline for an agent version within a time window
2054
+ * const filtered = await trace.getLatencyTimeline({
2055
+ * startTime: new Date('2025-05-01T00:00:00Z'),
2056
+ * endTime: new Date('2025-06-01T00:00:00Z'),
2057
+ * agentId: '<agentId>',
2058
+ * agentVersion: '1.0.0',
2059
+ * executionType: AgentTraceExecutionType.Runtime,
2060
+ * });
2061
+ * ```
2062
+ */
2063
+ async getLatencyTimeline(options) {
2064
+ const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_LATENCY_TIMELINE, this.buildTraceFilterBody(options));
2065
+ return response.data.data;
2066
+ }
2067
+ /**
2068
+ * Retrieves trace-level per-agent unit consumption totals.
2069
+ *
2070
+ * @param options - Optional window and filters
2071
+ * @returns Promise resolving to an array of {@link AgentTraceGetUnitConsumptionResponse}
2072
+ * @example
2073
+ * ```typescript
2074
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2075
+ *
2076
+ * const trace = new AgentTraces(sdk);
2077
+ *
2078
+ * // Get per-agent unit consumption
2079
+ * const result = await trace.getUnitConsumption();
2080
+ * result.forEach((row) => {
2081
+ * console.log(`${row.agentId}: ${row.agentUnitsConsumed} AGU, ${row.platformUnitsConsumed} PLTU`);
2082
+ * });
2083
+ * ```
2084
+ * @example
2085
+ * ```typescript
2086
+ * import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
2087
+ *
2088
+ * // Get per-agent unit consumption for an agent version within a time window
2089
+ * const filtered = await trace.getUnitConsumption({
2090
+ * startTime: new Date('2025-05-01T00:00:00Z'),
2091
+ * endTime: new Date('2025-06-01T00:00:00Z'),
2092
+ * agentId: '<agentId>',
2093
+ * agentVersion: '1.0.0',
2094
+ * executionType: AgentTraceExecutionType.Runtime,
2095
+ * });
2096
+ * ```
2097
+ */
2098
+ async getUnitConsumption(options) {
2099
+ const response = await this.post(AGENT_TRACES_ENDPOINTS.GET_UNIT_CONSUMPTION, this.buildTraceFilterBody(options));
2100
+ return response.data.data;
2101
+ }
2102
+ /**
2103
+ * Retrieves every span belonging to a single trace.
2104
+ *
2105
+ * @param traceId - Identifier of the trace whose spans should be returned
2106
+ * @returns Promise resolving to an array of {@link AgentSpanGetResponse}
2107
+ * @example
2108
+ * ```typescript
2109
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2110
+ *
2111
+ * const trace = new AgentTraces(sdk);
2112
+ *
2113
+ * const spans = await trace.getSpansByTraceId('<traceId>');
2114
+ * spans.forEach((span) => {
2115
+ * console.log(`${span.name} (${span.startTime} → ${span.endTime ?? 'in progress'})`);
2116
+ * });
2117
+ * ```
2118
+ */
2119
+ async getSpansByTraceId(traceId) {
2120
+ if (!traceId)
2121
+ throw new ValidationError({ message: 'traceId is required for getSpansByTraceId' });
2122
+ const response = await this.get(AGENT_TRACES_ENDPOINTS.GET_SPANS_BY_TRACE_ID(traceId));
2123
+ return (response.data ?? []).map(transformSpan);
2124
+ }
2125
+ /**
2126
+ * Retrieves spans whose reference hierarchy contains the given reference id.
2127
+ *
2128
+ * Returns a {@link PaginatedResponse} when pagination options (`pageSize`,
2129
+ * `cursor`, or `jumpToPage`) are provided, otherwise a
2130
+ * {@link NonPaginatedResponse}.
2131
+ *
2132
+ * @param referenceId - Reference id matched against each span's reference hierarchy
2133
+ * @param options - Optional pagination and hierarchy/time filters
2134
+ * @returns Promise resolving to a paginated or non-paginated list of {@link AgentSpanGetResponse}
2135
+ * @example
2136
+ * ```typescript
2137
+ * import { AgentTraces } from '@uipath/uipath-typescript/traces';
2138
+ *
2139
+ * const trace = new AgentTraces(sdk);
2140
+ *
2141
+ * // Get spans by referenceId
2142
+ * const result = await trace.getSpansByReference('<referenceId>');
2143
+ * result.items.forEach((span) => console.log(span.name));
2144
+ * ```
2145
+ * @example
2146
+ * ```typescript
2147
+ * import { AgentTraceExecutionType } from '@uipath/uipath-typescript/traces';
2148
+ *
2149
+ * // Get spans by referenceId within a trace and time window
2150
+ * const page = await trace.getSpansByReference('<referenceId>', {
2151
+ * traceId: '<traceId>',
2152
+ * executionType: AgentTraceExecutionType.Runtime,
2153
+ * startTime: new Date('2025-05-01T00:00:00Z'),
2154
+ * endTime: new Date('2025-06-01T00:00:00Z'),
2155
+ * pageSize: 25,
2156
+ * });
2157
+ *
2158
+ * if (page.hasNextPage && page.nextCursor) {
2159
+ * const next = await trace.getSpansByReference('<referenceId>', { cursor: page.nextCursor });
2160
+ * }
2161
+ * ```
2162
+ */
2163
+ async getSpansByReference(referenceId, options) {
2164
+ if (!referenceId)
2165
+ throw new ValidationError({ message: 'referenceId is required for getSpansByReference' });
2166
+ const { startTime, endTime, ...rest } = options ?? {};
2167
+ const apiOptions = {
2168
+ ...rest,
2169
+ ...(startTime !== undefined ? { startTime: startTime.toISOString() } : {}),
2170
+ ...(endTime !== undefined ? { endTime: endTime.toISOString() } : {}),
2171
+ };
2172
+ return PaginationHelpers.getAll({
2173
+ serviceAccess: this.createPaginationServiceAccess(),
2174
+ getEndpoint: () => AGENT_TRACES_ENDPOINTS.GET_SPANS_BY_REFERENCE(referenceId),
2175
+ method: HTTP_METHODS.GET,
2176
+ transformFn: transformSpan,
2177
+ excludeFromPrefix: Object.keys(apiOptions),
2178
+ pagination: {
2179
+ paginationType: PaginationType.OFFSET,
2180
+ itemsField: TRACEVIEW_SPANS_PAGINATION.ITEMS_FIELD,
2181
+ totalCountField: TRACEVIEW_SPANS_PAGINATION.TOTAL_COUNT_FIELD,
2182
+ paginationParams: {
2183
+ pageSizeParam: AGENTS_OFFSET_PARAMS.PAGE_SIZE_PARAM,
2184
+ offsetParam: AGENTS_OFFSET_PARAMS.OFFSET_PARAM,
2185
+ countParam: AGENTS_OFFSET_PARAMS.COUNT_PARAM,
2186
+ convertToSkip: false,
2187
+ zeroBased: true,
2188
+ },
2189
+ },
2190
+ }, apiOptions);
2191
+ }
2192
+ buildTraceFilterBody(options) {
2193
+ const body = {};
2194
+ if (options?.startTime !== undefined)
2195
+ body.startTime = options.startTime.toISOString();
2196
+ if (options?.endTime !== undefined)
2197
+ body.endTime = options.endTime.toISOString();
2198
+ if (options?.folderKeys !== undefined)
2199
+ body.folderKeys = options.folderKeys;
2200
+ if (options?.agentId !== undefined)
2201
+ body.agentId = options.agentId;
2202
+ if (options?.agentVersion !== undefined)
2203
+ body.agentVersion = options.agentVersion;
2204
+ if (options?.executionType !== undefined)
2205
+ body.executionType = options.executionType;
2206
+ return body;
2207
+ }
2208
+ }
2209
+ __decorate([
2210
+ track('AgentTraces.GetErrorsTimeline')
2211
+ ], AgentTracesService.prototype, "getErrorsTimeline", null);
2212
+ __decorate([
2213
+ track('AgentTraces.GetLatencyTimeline')
2214
+ ], AgentTracesService.prototype, "getLatencyTimeline", null);
2215
+ __decorate([
2216
+ track('AgentTraces.GetUnitConsumption')
2217
+ ], AgentTracesService.prototype, "getUnitConsumption", null);
2218
+ __decorate([
2219
+ track('AgentTraces.GetSpansByTraceId')
2220
+ ], AgentTracesService.prototype, "getSpansByTraceId", null);
2221
+ __decorate([
2222
+ track('AgentTraces.GetSpansByReference')
2223
+ ], AgentTracesService.prototype, "getSpansByReference", null);
2224
+
2225
+ exports.AgentTraceExecutionType = exports.SpanExecutionType;
2226
+ exports.AgentTraces = AgentTracesService;
1933
2227
  exports.Traces = TracesService;