@uipath/uipath-typescript 1.3.9 → 1.3.11

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 (39) hide show
  1. package/dist/assets/index.cjs +19 -6
  2. package/dist/assets/index.mjs +19 -6
  3. package/dist/attachments/index.cjs +19 -6
  4. package/dist/attachments/index.mjs +19 -6
  5. package/dist/buckets/index.cjs +141 -6
  6. package/dist/buckets/index.d.ts +164 -1
  7. package/dist/buckets/index.mjs +141 -6
  8. package/dist/cases/index.cjs +70 -6
  9. package/dist/cases/index.d.ts +91 -1
  10. package/dist/cases/index.mjs +70 -6
  11. package/dist/conversational-agent/index.cjs +19 -6
  12. package/dist/conversational-agent/index.mjs +19 -6
  13. package/dist/core/index.cjs +1 -1
  14. package/dist/core/index.mjs +1 -1
  15. package/dist/entities/index.cjs +239 -34
  16. package/dist/entities/index.d.ts +311 -12
  17. package/dist/entities/index.mjs +239 -34
  18. package/dist/feedback/index.cjs +19 -6
  19. package/dist/feedback/index.mjs +19 -6
  20. package/dist/index.cjs +490 -64
  21. package/dist/index.d.ts +714 -36
  22. package/dist/index.mjs +490 -64
  23. package/dist/index.umd.js +491 -65
  24. package/dist/jobs/index.cjs +19 -6
  25. package/dist/jobs/index.mjs +19 -6
  26. package/dist/maestro-processes/index.cjs +70 -6
  27. package/dist/maestro-processes/index.d.ts +91 -1
  28. package/dist/maestro-processes/index.mjs +70 -6
  29. package/dist/processes/index.cjs +47 -35
  30. package/dist/processes/index.d.ts +76 -26
  31. package/dist/processes/index.mjs +47 -35
  32. package/dist/queues/index.cjs +19 -6
  33. package/dist/queues/index.mjs +19 -6
  34. package/dist/tasks/index.cjs +19 -6
  35. package/dist/tasks/index.mjs +19 -6
  36. package/dist/traces/index.cjs +1902 -0
  37. package/dist/traces/index.d.ts +565 -0
  38. package/dist/traces/index.mjs +1900 -0
  39. package/package.json +12 -2
@@ -124,6 +124,8 @@ const MAESTRO_ENDPOINTS = {
124
124
  TOP_PROCESSES_BY_RUN_COUNT: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcessesByRunCount`,
125
125
  /** Top processes ranked by failure count */
126
126
  TOP_PROCESSES_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopProcesseswithFailure`,
127
+ /** Top elements ranked by failure count */
128
+ TOP_ELEMENTS_WITH_FAILURE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/TopElementswithFailure`,
127
129
  /** Instance status aggregated by date for time-series charts */
128
130
  INSTANCE_STATUS_BY_DATE: `${INSIGHTS_RTM_BASE}/agenticInstanceStatus/InstanceStatusByDate`,
129
131
  /** Top processes ranked by total duration */
@@ -746,14 +748,25 @@ class ApiClient {
746
748
  if (!text) {
747
749
  return undefined;
748
750
  }
749
- return JSON.parse(text);
751
+ try {
752
+ return JSON.parse(text);
753
+ }
754
+ catch (error) {
755
+ if (error instanceof SyntaxError) {
756
+ throw new ServerError({
757
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
758
+ statusCode: response.status,
759
+ });
760
+ }
761
+ throw error;
762
+ }
750
763
  }
751
764
  catch (error) {
752
765
  // If it's already one of our errors, re-throw it
753
766
  if (error.type && error.type.includes('Error')) {
754
767
  throw error;
755
768
  }
756
- // Otherwise, it's likely a network error
769
+ // Otherwise, it's a genuine network/fetch failure
757
770
  throw ErrorFactory.createNetworkError(error);
758
771
  }
759
772
  }
@@ -1520,9 +1533,9 @@ class PaginationHelpers {
1520
1533
  * @returns Promise resolving to a paginated result
1521
1534
  */
1522
1535
  static async getAllPaginated(params) {
1523
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1536
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1524
1537
  const endpoint = getEndpoint(folderId);
1525
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1538
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1526
1539
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1527
1540
  headers,
1528
1541
  params: additionalParams,
@@ -1550,13 +1563,13 @@ class PaginationHelpers {
1550
1563
  * @returns Promise resolving to an object with data and totalCount
1551
1564
  */
1552
1565
  static async getAllNonPaginated(params) {
1553
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1566
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1554
1567
  // Set default field names
1555
1568
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1556
1569
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1557
1570
  // Determine endpoint and headers based on folderId
1558
1571
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1559
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1572
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1560
1573
  // Make the API call based on method
1561
1574
  let response;
1562
1575
  if (method === HTTP_METHODS.POST) {
@@ -1615,6 +1628,7 @@ class PaginationHelpers {
1615
1628
  serviceAccess: config.serviceAccess,
1616
1629
  getEndpoint: config.getEndpoint,
1617
1630
  folderId,
1631
+ headers: config.headers,
1618
1632
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1619
1633
  additionalParams: prefixedOptions,
1620
1634
  transformFn: config.transformFn,
@@ -1632,6 +1646,7 @@ class PaginationHelpers {
1632
1646
  getAllEndpoint: config.getEndpoint(),
1633
1647
  getByFolderEndpoint: byFolderEndpoint,
1634
1648
  folderId,
1649
+ headers: config.headers,
1635
1650
  additionalParams: prefixedOptions,
1636
1651
  transformFn: config.transformFn,
1637
1652
  method: config.method,
@@ -2096,6 +2111,52 @@ class CasesService extends BaseService {
2096
2111
  const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_PROCESSES_BY_RUN_COUNT, buildInsightsTopBody(startTime, endTime, true, options));
2097
2112
  return (data ?? []).map(process => ({ ...process, name: this.extractCaseName(process.packageId) }));
2098
2113
  }
2114
+ /**
2115
+ * Get the top 10 BPMN elements ranked by failure count within a time range.
2116
+ *
2117
+ * Returns an array of up to 10 elements sorted by how many times they failed,
2118
+ * useful for identifying the most error-prone activities in case processes.
2119
+ *
2120
+ * @param startTime - Start of the time range to query
2121
+ * @param endTime - End of the time range to query
2122
+ * @param options - Optional filters (packageId, processKey, version)
2123
+ * @returns Promise resolving to an array of {@link ElementGetTopFailedCountResponse}
2124
+ * @example
2125
+ * ```typescript
2126
+ * import { Cases } from '@uipath/uipath-typescript/cases';
2127
+ *
2128
+ * const cases = new Cases(sdk);
2129
+ *
2130
+ * // Get top failing elements for the last 7 days
2131
+ * const topFailing = await cases.getTopElementFailedCount(
2132
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
2133
+ * new Date()
2134
+ * );
2135
+ *
2136
+ * for (const element of topFailing) {
2137
+ * console.log(`${element.elementName} (${element.elementType}): ${element.failedCount} failures`);
2138
+ * }
2139
+ * ```
2140
+ *
2141
+ * @example
2142
+ * ```typescript
2143
+ * // Get top failing elements for a specific process
2144
+ * const filtered = await cases.getTopElementFailedCount(
2145
+ * new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
2146
+ * new Date(),
2147
+ * { processKey: '<processKey>' }
2148
+ * );
2149
+ * ```
2150
+ */
2151
+ async getTopElementFailedCount(startTime, endTime, options) {
2152
+ const { data } = await this.post(MAESTRO_ENDPOINTS.INSIGHTS.TOP_ELEMENTS_WITH_FAILURE, buildInsightsTopBody(startTime, endTime, true, options));
2153
+ return (data ?? []).map(item => ({
2154
+ elementName: item.elementName,
2155
+ elementType: item.elementType,
2156
+ processKey: item.processKey,
2157
+ failedCount: item.count,
2158
+ }));
2159
+ }
2099
2160
  /**
2100
2161
  * Get all instances status counts aggregated by date for case management processes.
2101
2162
  *
@@ -2251,6 +2312,9 @@ __decorate([
2251
2312
  __decorate([
2252
2313
  track('Cases.GetTopRunCount')
2253
2314
  ], CasesService.prototype, "getTopRunCount", null);
2315
+ __decorate([
2316
+ track('Cases.GetTopElementFailedCount')
2317
+ ], CasesService.prototype, "getTopElementFailedCount", null);
2254
2318
  __decorate([
2255
2319
  track('Cases.GetInstanceStatusTimeline')
2256
2320
  ], CasesService.prototype, "getInstanceStatusTimeline", null);
@@ -671,14 +671,25 @@ class ApiClient {
671
671
  if (!text) {
672
672
  return undefined;
673
673
  }
674
- return JSON.parse(text);
674
+ try {
675
+ return JSON.parse(text);
676
+ }
677
+ catch (error) {
678
+ if (error instanceof SyntaxError) {
679
+ throw new ServerError({
680
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
681
+ statusCode: response.status,
682
+ });
683
+ }
684
+ throw error;
685
+ }
675
686
  }
676
687
  catch (error) {
677
688
  // If it's already one of our errors, re-throw it
678
689
  if (error.type && error.type.includes('Error')) {
679
690
  throw error;
680
691
  }
681
- // Otherwise, it's likely a network error
692
+ // Otherwise, it's a genuine network/fetch failure
682
693
  throw ErrorFactory.createNetworkError(error);
683
694
  }
684
695
  }
@@ -1303,9 +1314,9 @@ class PaginationHelpers {
1303
1314
  * @returns Promise resolving to a paginated result
1304
1315
  */
1305
1316
  static async getAllPaginated(params) {
1306
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1317
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1307
1318
  const endpoint = getEndpoint(folderId);
1308
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1319
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1309
1320
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1310
1321
  headers,
1311
1322
  params: additionalParams,
@@ -1333,13 +1344,13 @@ class PaginationHelpers {
1333
1344
  * @returns Promise resolving to an object with data and totalCount
1334
1345
  */
1335
1346
  static async getAllNonPaginated(params) {
1336
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1347
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1337
1348
  // Set default field names
1338
1349
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1339
1350
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1340
1351
  // Determine endpoint and headers based on folderId
1341
1352
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1342
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1353
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1343
1354
  // Make the API call based on method
1344
1355
  let response;
1345
1356
  if (method === HTTP_METHODS.POST) {
@@ -1398,6 +1409,7 @@ class PaginationHelpers {
1398
1409
  serviceAccess: config.serviceAccess,
1399
1410
  getEndpoint: config.getEndpoint,
1400
1411
  folderId,
1412
+ headers: config.headers,
1401
1413
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1402
1414
  additionalParams: prefixedOptions,
1403
1415
  transformFn: config.transformFn,
@@ -1415,6 +1427,7 @@ class PaginationHelpers {
1415
1427
  getAllEndpoint: config.getEndpoint(),
1416
1428
  getByFolderEndpoint: byFolderEndpoint,
1417
1429
  folderId,
1430
+ headers: config.headers,
1418
1431
  additionalParams: prefixedOptions,
1419
1432
  transformFn: config.transformFn,
1420
1433
  method: config.method,
@@ -669,14 +669,25 @@ class ApiClient {
669
669
  if (!text) {
670
670
  return undefined;
671
671
  }
672
- return JSON.parse(text);
672
+ try {
673
+ return JSON.parse(text);
674
+ }
675
+ catch (error) {
676
+ if (error instanceof SyntaxError) {
677
+ throw new ServerError({
678
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
679
+ statusCode: response.status,
680
+ });
681
+ }
682
+ throw error;
683
+ }
673
684
  }
674
685
  catch (error) {
675
686
  // If it's already one of our errors, re-throw it
676
687
  if (error.type && error.type.includes('Error')) {
677
688
  throw error;
678
689
  }
679
- // Otherwise, it's likely a network error
690
+ // Otherwise, it's a genuine network/fetch failure
680
691
  throw ErrorFactory.createNetworkError(error);
681
692
  }
682
693
  }
@@ -1301,9 +1312,9 @@ class PaginationHelpers {
1301
1312
  * @returns Promise resolving to a paginated result
1302
1313
  */
1303
1314
  static async getAllPaginated(params) {
1304
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1315
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1305
1316
  const endpoint = getEndpoint(folderId);
1306
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1317
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1307
1318
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1308
1319
  headers,
1309
1320
  params: additionalParams,
@@ -1331,13 +1342,13 @@ class PaginationHelpers {
1331
1342
  * @returns Promise resolving to an object with data and totalCount
1332
1343
  */
1333
1344
  static async getAllNonPaginated(params) {
1334
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1345
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1335
1346
  // Set default field names
1336
1347
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1337
1348
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1338
1349
  // Determine endpoint and headers based on folderId
1339
1350
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1340
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1351
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1341
1352
  // Make the API call based on method
1342
1353
  let response;
1343
1354
  if (method === HTTP_METHODS.POST) {
@@ -1396,6 +1407,7 @@ class PaginationHelpers {
1396
1407
  serviceAccess: config.serviceAccess,
1397
1408
  getEndpoint: config.getEndpoint,
1398
1409
  folderId,
1410
+ headers: config.headers,
1399
1411
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1400
1412
  additionalParams: prefixedOptions,
1401
1413
  transformFn: config.transformFn,
@@ -1413,6 +1425,7 @@ class PaginationHelpers {
1413
1425
  getAllEndpoint: config.getEndpoint(),
1414
1426
  getByFolderEndpoint: byFolderEndpoint,
1415
1427
  folderId,
1428
+ headers: config.headers,
1416
1429
  additionalParams: prefixedOptions,
1417
1430
  transformFn: config.transformFn,
1418
1431
  method: config.method,
@@ -5312,7 +5312,7 @@ function normalizeBaseUrl(url) {
5312
5312
  * SDK's public API.
5313
5313
  */
5314
5314
  /** SDK version placeholder — patched by the SDK publish workflow. */
5315
- const SDK_VERSION = '1.3.9';
5315
+ const SDK_VERSION = '1.3.11';
5316
5316
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5317
5317
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5318
5318
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';
@@ -5310,7 +5310,7 @@ function normalizeBaseUrl(url) {
5310
5310
  * SDK's public API.
5311
5311
  */
5312
5312
  /** SDK version placeholder — patched by the SDK publish workflow. */
5313
- const SDK_VERSION = '1.3.9';
5313
+ const SDK_VERSION = '1.3.11';
5314
5314
  const CLOUD_ROLE_NAME = 'uipath-ts-sdk';
5315
5315
  const SDK_SERVICE_NAME = 'UiPath.TypeScript.Sdk';
5316
5316
  const SDK_LOGGER_NAME = 'uipath-ts-sdk-telemetry';