@uipath/uipath-typescript 1.3.9 → 1.3.10

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.
@@ -613,14 +613,25 @@ class ApiClient {
613
613
  if (!text) {
614
614
  return undefined;
615
615
  }
616
- return JSON.parse(text);
616
+ try {
617
+ return JSON.parse(text);
618
+ }
619
+ catch (error) {
620
+ if (error instanceof SyntaxError) {
621
+ throw new ServerError({
622
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
623
+ statusCode: response.status,
624
+ });
625
+ }
626
+ throw error;
627
+ }
617
628
  }
618
629
  catch (error) {
619
630
  // If it's already one of our errors, re-throw it
620
631
  if (error.type && error.type.includes('Error')) {
621
632
  throw error;
622
633
  }
623
- // Otherwise, it's likely a network error
634
+ // Otherwise, it's a genuine network/fetch failure
624
635
  throw ErrorFactory.createNetworkError(error);
625
636
  }
626
637
  }
@@ -1221,9 +1232,9 @@ class PaginationHelpers {
1221
1232
  * @returns Promise resolving to a paginated result
1222
1233
  */
1223
1234
  static async getAllPaginated(params) {
1224
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1235
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1225
1236
  const endpoint = getEndpoint(folderId);
1226
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1237
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1227
1238
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1228
1239
  headers,
1229
1240
  params: additionalParams,
@@ -1251,13 +1262,13 @@ class PaginationHelpers {
1251
1262
  * @returns Promise resolving to an object with data and totalCount
1252
1263
  */
1253
1264
  static async getAllNonPaginated(params) {
1254
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1265
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1255
1266
  // Set default field names
1256
1267
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1257
1268
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1258
1269
  // Determine endpoint and headers based on folderId
1259
1270
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1260
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1271
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1261
1272
  // Make the API call based on method
1262
1273
  let response;
1263
1274
  if (method === HTTP_METHODS.POST) {
@@ -1316,6 +1327,7 @@ class PaginationHelpers {
1316
1327
  serviceAccess: config.serviceAccess,
1317
1328
  getEndpoint: config.getEndpoint,
1318
1329
  folderId,
1330
+ headers: config.headers,
1319
1331
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1320
1332
  additionalParams: prefixedOptions,
1321
1333
  transformFn: config.transformFn,
@@ -1333,6 +1345,7 @@ class PaginationHelpers {
1333
1345
  getAllEndpoint: config.getEndpoint(),
1334
1346
  getByFolderEndpoint: byFolderEndpoint,
1335
1347
  folderId,
1348
+ headers: config.headers,
1336
1349
  additionalParams: prefixedOptions,
1337
1350
  transformFn: config.transformFn,
1338
1351
  method: config.method,
@@ -611,14 +611,25 @@ class ApiClient {
611
611
  if (!text) {
612
612
  return undefined;
613
613
  }
614
- return JSON.parse(text);
614
+ try {
615
+ return JSON.parse(text);
616
+ }
617
+ catch (error) {
618
+ if (error instanceof SyntaxError) {
619
+ throw new ServerError({
620
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
621
+ statusCode: response.status,
622
+ });
623
+ }
624
+ throw error;
625
+ }
615
626
  }
616
627
  catch (error) {
617
628
  // If it's already one of our errors, re-throw it
618
629
  if (error.type && error.type.includes('Error')) {
619
630
  throw error;
620
631
  }
621
- // Otherwise, it's likely a network error
632
+ // Otherwise, it's a genuine network/fetch failure
622
633
  throw ErrorFactory.createNetworkError(error);
623
634
  }
624
635
  }
@@ -1219,9 +1230,9 @@ class PaginationHelpers {
1219
1230
  * @returns Promise resolving to a paginated result
1220
1231
  */
1221
1232
  static async getAllPaginated(params) {
1222
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1233
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1223
1234
  const endpoint = getEndpoint(folderId);
1224
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1235
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1225
1236
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1226
1237
  headers,
1227
1238
  params: additionalParams,
@@ -1249,13 +1260,13 @@ class PaginationHelpers {
1249
1260
  * @returns Promise resolving to an object with data and totalCount
1250
1261
  */
1251
1262
  static async getAllNonPaginated(params) {
1252
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1263
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1253
1264
  // Set default field names
1254
1265
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1255
1266
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1256
1267
  // Determine endpoint and headers based on folderId
1257
1268
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1258
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1269
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1259
1270
  // Make the API call based on method
1260
1271
  let response;
1261
1272
  if (method === HTTP_METHODS.POST) {
@@ -1314,6 +1325,7 @@ class PaginationHelpers {
1314
1325
  serviceAccess: config.serviceAccess,
1315
1326
  getEndpoint: config.getEndpoint,
1316
1327
  folderId,
1328
+ headers: config.headers,
1317
1329
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1318
1330
  additionalParams: prefixedOptions,
1319
1331
  transformFn: config.transformFn,
@@ -1331,6 +1343,7 @@ class PaginationHelpers {
1331
1343
  getAllEndpoint: config.getEndpoint(),
1332
1344
  getByFolderEndpoint: byFolderEndpoint,
1333
1345
  folderId,
1346
+ headers: config.headers,
1334
1347
  additionalParams: prefixedOptions,
1335
1348
  transformFn: config.transformFn,
1336
1349
  method: config.method,
@@ -850,14 +850,25 @@ class ApiClient {
850
850
  if (!text) {
851
851
  return undefined;
852
852
  }
853
- return JSON.parse(text);
853
+ try {
854
+ return JSON.parse(text);
855
+ }
856
+ catch (error) {
857
+ if (error instanceof SyntaxError) {
858
+ throw new ServerError({
859
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
860
+ statusCode: response.status,
861
+ });
862
+ }
863
+ throw error;
864
+ }
854
865
  }
855
866
  catch (error) {
856
867
  // If it's already one of our errors, re-throw it
857
868
  if (error.type && error.type.includes('Error')) {
858
869
  throw error;
859
870
  }
860
- // Otherwise, it's likely a network error
871
+ // Otherwise, it's a genuine network/fetch failure
861
872
  throw ErrorFactory.createNetworkError(error);
862
873
  }
863
874
  }
@@ -1262,9 +1273,9 @@ class PaginationHelpers {
1262
1273
  * @returns Promise resolving to a paginated result
1263
1274
  */
1264
1275
  static async getAllPaginated(params) {
1265
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1276
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1266
1277
  const endpoint = getEndpoint(folderId);
1267
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1278
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1268
1279
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1269
1280
  headers,
1270
1281
  params: additionalParams,
@@ -1292,13 +1303,13 @@ class PaginationHelpers {
1292
1303
  * @returns Promise resolving to an object with data and totalCount
1293
1304
  */
1294
1305
  static async getAllNonPaginated(params) {
1295
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1306
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1296
1307
  // Set default field names
1297
1308
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1298
1309
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1299
1310
  // Determine endpoint and headers based on folderId
1300
1311
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1301
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1312
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1302
1313
  // Make the API call based on method
1303
1314
  let response;
1304
1315
  if (method === HTTP_METHODS.POST) {
@@ -1357,6 +1368,7 @@ class PaginationHelpers {
1357
1368
  serviceAccess: config.serviceAccess,
1358
1369
  getEndpoint: config.getEndpoint,
1359
1370
  folderId,
1371
+ headers: config.headers,
1360
1372
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1361
1373
  additionalParams: prefixedOptions,
1362
1374
  transformFn: config.transformFn,
@@ -1374,6 +1386,7 @@ class PaginationHelpers {
1374
1386
  getAllEndpoint: config.getEndpoint(),
1375
1387
  getByFolderEndpoint: byFolderEndpoint,
1376
1388
  folderId,
1389
+ headers: config.headers,
1377
1390
  additionalParams: prefixedOptions,
1378
1391
  transformFn: config.transformFn,
1379
1392
  method: config.method,
@@ -848,14 +848,25 @@ class ApiClient {
848
848
  if (!text) {
849
849
  return undefined;
850
850
  }
851
- return JSON.parse(text);
851
+ try {
852
+ return JSON.parse(text);
853
+ }
854
+ catch (error) {
855
+ if (error instanceof SyntaxError) {
856
+ throw new ServerError({
857
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
858
+ statusCode: response.status,
859
+ });
860
+ }
861
+ throw error;
862
+ }
852
863
  }
853
864
  catch (error) {
854
865
  // If it's already one of our errors, re-throw it
855
866
  if (error.type && error.type.includes('Error')) {
856
867
  throw error;
857
868
  }
858
- // Otherwise, it's likely a network error
869
+ // Otherwise, it's a genuine network/fetch failure
859
870
  throw ErrorFactory.createNetworkError(error);
860
871
  }
861
872
  }
@@ -1260,9 +1271,9 @@ class PaginationHelpers {
1260
1271
  * @returns Promise resolving to a paginated result
1261
1272
  */
1262
1273
  static async getAllPaginated(params) {
1263
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1274
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1264
1275
  const endpoint = getEndpoint(folderId);
1265
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1276
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1266
1277
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1267
1278
  headers,
1268
1279
  params: additionalParams,
@@ -1290,13 +1301,13 @@ class PaginationHelpers {
1290
1301
  * @returns Promise resolving to an object with data and totalCount
1291
1302
  */
1292
1303
  static async getAllNonPaginated(params) {
1293
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1304
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1294
1305
  // Set default field names
1295
1306
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1296
1307
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1297
1308
  // Determine endpoint and headers based on folderId
1298
1309
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1299
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1310
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1300
1311
  // Make the API call based on method
1301
1312
  let response;
1302
1313
  if (method === HTTP_METHODS.POST) {
@@ -1355,6 +1366,7 @@ class PaginationHelpers {
1355
1366
  serviceAccess: config.serviceAccess,
1356
1367
  getEndpoint: config.getEndpoint,
1357
1368
  folderId,
1369
+ headers: config.headers,
1358
1370
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1359
1371
  additionalParams: prefixedOptions,
1360
1372
  transformFn: config.transformFn,
@@ -1372,6 +1384,7 @@ class PaginationHelpers {
1372
1384
  getAllEndpoint: config.getEndpoint(),
1373
1385
  getByFolderEndpoint: byFolderEndpoint,
1374
1386
  folderId,
1387
+ headers: config.headers,
1375
1388
  additionalParams: prefixedOptions,
1376
1389
  transformFn: config.transformFn,
1377
1390
  method: config.method,
@@ -613,14 +613,25 @@ class ApiClient {
613
613
  if (!text) {
614
614
  return undefined;
615
615
  }
616
- return JSON.parse(text);
616
+ try {
617
+ return JSON.parse(text);
618
+ }
619
+ catch (error) {
620
+ if (error instanceof SyntaxError) {
621
+ throw new ServerError({
622
+ message: `Server returned non-JSON response (${response.status} ${response.url}): ${error.message}`,
623
+ statusCode: response.status,
624
+ });
625
+ }
626
+ throw error;
627
+ }
617
628
  }
618
629
  catch (error) {
619
630
  // If it's already one of our errors, re-throw it
620
631
  if (error.type && error.type.includes('Error')) {
621
632
  throw error;
622
633
  }
623
- // Otherwise, it's likely a network error
634
+ // Otherwise, it's a genuine network/fetch failure
624
635
  throw ErrorFactory.createNetworkError(error);
625
636
  }
626
637
  }
@@ -1264,9 +1275,9 @@ class PaginationHelpers {
1264
1275
  * @returns Promise resolving to a paginated result
1265
1276
  */
1266
1277
  static async getAllPaginated(params) {
1267
- const { serviceAccess, getEndpoint, folderId, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1278
+ const { serviceAccess, getEndpoint, folderId, headers: providedHeaders, paginationParams, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1268
1279
  const endpoint = getEndpoint(folderId);
1269
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1280
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1270
1281
  const paginatedResponse = await serviceAccess.requestWithPagination(method, endpoint, paginationParams, {
1271
1282
  headers,
1272
1283
  params: additionalParams,
@@ -1294,13 +1305,13 @@ class PaginationHelpers {
1294
1305
  * @returns Promise resolving to an object with data and totalCount
1295
1306
  */
1296
1307
  static async getAllNonPaginated(params) {
1297
- const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1308
+ const { serviceAccess, getAllEndpoint, getByFolderEndpoint, folderId, headers: providedHeaders, additionalParams, transformFn, method = HTTP_METHODS.GET, options = {} } = params;
1298
1309
  // Set default field names
1299
1310
  const itemsField = options.itemsField || DEFAULT_ITEMS_FIELD;
1300
1311
  const totalCountField = options.totalCountField || DEFAULT_TOTAL_COUNT_FIELD;
1301
1312
  // Determine endpoint and headers based on folderId
1302
1313
  const endpoint = folderId ? getByFolderEndpoint : getAllEndpoint;
1303
- const headers = folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {};
1314
+ const headers = providedHeaders ?? (folderId ? createHeaders({ [FOLDER_ID]: folderId }) : {});
1304
1315
  // Make the API call based on method
1305
1316
  let response;
1306
1317
  if (method === HTTP_METHODS.POST) {
@@ -1359,6 +1370,7 @@ class PaginationHelpers {
1359
1370
  serviceAccess: config.serviceAccess,
1360
1371
  getEndpoint: config.getEndpoint,
1361
1372
  folderId,
1373
+ headers: config.headers,
1362
1374
  paginationParams: cursor ? { cursor, pageSize } : jumpToPage ? { jumpToPage, pageSize } : { pageSize },
1363
1375
  additionalParams: prefixedOptions,
1364
1376
  transformFn: config.transformFn,
@@ -1376,6 +1388,7 @@ class PaginationHelpers {
1376
1388
  getAllEndpoint: config.getEndpoint(),
1377
1389
  getByFolderEndpoint: byFolderEndpoint,
1378
1390
  folderId,
1391
+ headers: config.headers,
1379
1392
  additionalParams: prefixedOptions,
1380
1393
  transformFn: config.transformFn,
1381
1394
  method: config.method,
@@ -1920,6 +1933,8 @@ const BUCKET_ENDPOINTS = {
1920
1933
  GET_FILE_META_DATA: (id) => `${ORCHESTRATOR_BASE}/api/Buckets/${id}/ListFiles`,
1921
1934
  GET_READ_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetReadUri`,
1922
1935
  GET_WRITE_URI: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetWriteUri`,
1936
+ DELETE_FILE: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.DeleteFile`,
1937
+ GET_FILES: (id) => `${ORCHESTRATOR_BASE}/odata/Buckets(${id})/UiPath.Server.Configuration.OData.GetFiles`,
1923
1938
  };
1924
1939
 
1925
1940
  /**
@@ -2293,6 +2308,120 @@ class BucketService extends FolderScopedService {
2293
2308
  }
2294
2309
  return transformedData;
2295
2310
  }
2311
+ /**
2312
+ * Lists all files in a bucket.
2313
+ *
2314
+ * Returns a flat, recursive listing of all files in the bucket. Supports regex filtering
2315
+ * and filter / orderby / select / expand. {@link BucketFile} entries include
2316
+ * `isDirectory` so callers can distinguish folders from files.
2317
+ *
2318
+ * The method returns either:
2319
+ * - A NonPaginatedResponse with items array (when no pagination parameters are provided)
2320
+ * - A PaginatedResponse with navigation cursors (when any pagination parameter is provided)
2321
+ *
2322
+ * @param bucketId - The ID of the bucket
2323
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`) and optional parameters for regex filtering, query options, and pagination
2324
+ * @returns Promise resolving to either an array of files NonPaginatedResponse<BucketFile> or a PaginatedResponse<BucketFile> when pagination options are used.
2325
+ *
2326
+ * @example
2327
+ * ```typescript
2328
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2329
+ *
2330
+ * const buckets = new Buckets(sdk);
2331
+ *
2332
+ * // List all files in the bucket
2333
+ * const files = await buckets.getFiles(<bucketId>, { folderId: <folderId> });
2334
+ *
2335
+ * // Filter by regex pattern
2336
+ * const pdfs = await buckets.getFiles(<bucketId>, {
2337
+ * folderId: <folderId>,
2338
+ * fileNameRegex: '.*\\.pdf$'
2339
+ * });
2340
+ *
2341
+ * // First page with pagination
2342
+ * const page1 = await buckets.getFiles(<bucketId>, { folderId: <folderId>, pageSize: 10 });
2343
+ *
2344
+ * // Navigate using cursor
2345
+ * if (page1.hasNextPage) {
2346
+ * const page2 = await buckets.getFiles(<bucketId>, { folderId: <folderId>, cursor: page1.nextCursor });
2347
+ * }
2348
+ *
2349
+ * // Jump to specific page
2350
+ * const page5 = await buckets.getFiles(<bucketId>, {
2351
+ * folderId: <folderId>,
2352
+ * jumpToPage: 5,
2353
+ * pageSize: 10
2354
+ * });
2355
+ * ```
2356
+ */
2357
+ async getFiles(bucketId, options) {
2358
+ if (!bucketId) {
2359
+ throw new ValidationError({ message: 'bucketId is required for getFiles' });
2360
+ }
2361
+ const { folderId, folderKey, folderPath, ...restOptions } = options ?? {};
2362
+ const headers = resolveFolderHeaders({
2363
+ folderId,
2364
+ folderKey,
2365
+ folderPath,
2366
+ resourceType: 'Buckets.getFiles',
2367
+ fallbackFolderKey: this.config.folderKey,
2368
+ });
2369
+ const transformBucketFile = (file) => transformData(pascalToCamelCaseKeys(file), BucketMap);
2370
+ return PaginationHelpers.getAll({
2371
+ serviceAccess: this.createPaginationServiceAccess(),
2372
+ getEndpoint: () => BUCKET_ENDPOINTS.GET_FILES(bucketId),
2373
+ transformFn: transformBucketFile,
2374
+ pagination: {
2375
+ paginationType: PaginationType.OFFSET,
2376
+ itemsField: ODATA_PAGINATION.ITEMS_FIELD,
2377
+ totalCountField: ODATA_PAGINATION.TOTAL_COUNT_FIELD,
2378
+ paginationParams: {
2379
+ pageSizeParam: ODATA_OFFSET_PARAMS.PAGE_SIZE_PARAM,
2380
+ offsetParam: ODATA_OFFSET_PARAMS.OFFSET_PARAM,
2381
+ countParam: ODATA_OFFSET_PARAMS.COUNT_PARAM,
2382
+ },
2383
+ },
2384
+ excludeFromPrefix: ['directory', 'recursive', 'fileNameRegex'],
2385
+ headers,
2386
+ }, { ...restOptions, directory: '/', recursive: true });
2387
+ }
2388
+ /**
2389
+ * Deletes a file from a bucket
2390
+ *
2391
+ * @param bucketId - The ID of the bucket
2392
+ * @param path - The full path to the file to delete
2393
+ * @param options - Folder scoping (`folderId` / `folderKey` / `folderPath`)
2394
+ * @returns Promise resolving when the file is deleted
2395
+ *
2396
+ * @example
2397
+ * ```typescript
2398
+ * import { Buckets } from '@uipath/uipath-typescript/buckets';
2399
+ *
2400
+ * const buckets = new Buckets(sdk);
2401
+ *
2402
+ * // Delete a file from a bucket
2403
+ * await buckets.deleteFile(<bucketId>, '/folder/file.pdf', { folderId: <folderId> });
2404
+ * ```
2405
+ */
2406
+ async deleteFile(bucketId, path, options) {
2407
+ if (!bucketId) {
2408
+ throw new ValidationError({ message: 'bucketId is required for deleteFile' });
2409
+ }
2410
+ if (!path) {
2411
+ throw new ValidationError({ message: 'path is required for deleteFile' });
2412
+ }
2413
+ const headers = resolveFolderHeaders({
2414
+ folderId: options?.folderId,
2415
+ folderKey: options?.folderKey,
2416
+ folderPath: options?.folderPath,
2417
+ resourceType: 'Buckets.deleteFile',
2418
+ fallbackFolderKey: this.config.folderKey,
2419
+ });
2420
+ await this.delete(BUCKET_ENDPOINTS.DELETE_FILE(bucketId), {
2421
+ params: { path },
2422
+ headers,
2423
+ });
2424
+ }
2296
2425
  /**
2297
2426
  * Gets a direct upload URL for a file in the bucket
2298
2427
  *
@@ -2326,6 +2455,12 @@ __decorate([
2326
2455
  __decorate([
2327
2456
  track('Buckets.GetReadUri')
2328
2457
  ], BucketService.prototype, "getReadUri", null);
2458
+ __decorate([
2459
+ track('Buckets.GetFiles')
2460
+ ], BucketService.prototype, "getFiles", null);
2461
+ __decorate([
2462
+ track('Buckets.DeleteFile')
2463
+ ], BucketService.prototype, "deleteFile", null);
2329
2464
 
2330
2465
  exports.BucketOptions = void 0;
2331
2466
  (function (BucketOptions) {