apify-client 3.0.0-beta.36 → 3.0.0-beta.38

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.
@@ -4,6 +4,18 @@ import { ResourceClient } from '../base/resource_client.js';
4
4
  import type { Dataset, DatasetStatistics } from '../models.js';
5
5
  import type { TimeoutOptions } from '../timeouts.js';
6
6
  import type { PaginatedIterator, PaginationOptions } from '../utils.js';
7
+ /**
8
+ * Supported formats for downloading dataset items.
9
+ */
10
+ export declare enum DownloadItemsFormat {
11
+ JSON = "json",
12
+ JSONL = "jsonl",
13
+ XML = "xml",
14
+ HTML = "html",
15
+ CSV = "csv",
16
+ XLSX = "xlsx",
17
+ RSS = "rss"
18
+ }
7
19
  export type { Dataset, DatasetStatistics, DatasetStats, FieldStatistics } from '../models.js';
8
20
  /**
9
21
  * Client for managing a specific Dataset.
@@ -211,6 +223,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
211
223
  * @param options - URL generation options (extends all options from {@link listItems})
212
224
  * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires.
213
225
  * @param options.fields - Array of field names to include in the response.
226
+ * @param options.format - Format of the items served by the URL. Defaults to `json`.
214
227
  * @param options.limit - Maximum number of items to return.
215
228
  * @param options.offset - Number of items to skip.
216
229
  * @param options.timeoutSecs - Timeout for the API request that fetches the dataset. Default is `'long'`.
@@ -280,25 +293,18 @@ export interface DatasetClientListItemOptions extends PaginationOptions, Timeout
280
293
  /**
281
294
  * Options for creating a public URL to access dataset items.
282
295
  *
283
- * Extends {@link DatasetClientListItemOptions} with URL expiration control, minus `chunkSize` (it only
296
+ * Extends {@link DatasetClientListItemOptions} with output format and URL expiration control, minus `chunkSize` (it only
284
297
  * sizes a client-side iteration) and `signature` (this method produces one).
285
298
  * @since Added in 2.16.0
286
299
  */
287
300
  export interface DatasetClientCreateItemsUrlOptions extends Omit<DatasetClientListItemOptions, 'chunkSize' | 'signature'> {
301
+ /**
302
+ * Format of the items served by the URL. Defaults to `json`.
303
+ * @since Added in 2.26.0
304
+ */
305
+ format?: `${DownloadItemsFormat}`;
288
306
  expiresInSecs?: number;
289
307
  }
290
- /**
291
- * Supported formats for downloading dataset items.
292
- */
293
- export declare enum DownloadItemsFormat {
294
- JSON = "json",
295
- JSONL = "jsonl",
296
- XML = "xml",
297
- HTML = "html",
298
- CSV = "csv",
299
- XLSX = "xlsx",
300
- RSS = "rss"
301
- }
302
308
  /**
303
309
  * Options for downloading dataset items in a specific format.
304
310
  *
@@ -4,6 +4,20 @@ import { ResourceClient } from '../base/resource_client.js';
4
4
  import * as schemas from '../schemas.js';
5
5
  import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
6
6
  import { anyObjectSchema, applyQueryParamsToUrl, cast, isNonArrayObject, paginationOptionsShape, parseArgument, parseResponse, SCANNED_COUNT, } from '../utils.js';
7
+ /**
8
+ * Supported formats for downloading dataset items.
9
+ */
10
+ export var DownloadItemsFormat;
11
+ (function (DownloadItemsFormat) {
12
+ DownloadItemsFormat["JSON"] = "json";
13
+ DownloadItemsFormat["JSONL"] = "jsonl";
14
+ DownloadItemsFormat["XML"] = "xml";
15
+ DownloadItemsFormat["HTML"] = "html";
16
+ DownloadItemsFormat["CSV"] = "csv";
17
+ DownloadItemsFormat["XLSX"] = "xlsx";
18
+ DownloadItemsFormat["RSS"] = "rss";
19
+ })(DownloadItemsFormat || (DownloadItemsFormat = {}));
20
+ const itemFormatSchema = z.enum(DownloadItemsFormat);
7
21
  // A predicate, not a `z.object()` arm, which would walk and copy every key of every pushed item.
8
22
  const itemSchema = z.custom(isNonArrayObject, 'Expected an object');
9
23
  const listItemsOptionsSchema = z.strictObject({
@@ -52,6 +66,7 @@ const createItemsPublicUrlOptionsSchema = z.strictObject({
52
66
  desc: z.boolean().optional(),
53
67
  flatten: z.array(z.string()).optional(),
54
68
  fields: z.array(z.string()).optional(),
69
+ format: itemFormatSchema.optional(),
55
70
  omit: z.array(z.string()).optional(),
56
71
  limit: z.number().min(0).optional(),
57
72
  offset: z.number().min(0).optional(),
@@ -335,6 +350,7 @@ export class DatasetClient extends ResourceClient {
335
350
  * @param options - URL generation options (extends all options from {@link listItems})
336
351
  * @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires.
337
352
  * @param options.fields - Array of field names to include in the response.
353
+ * @param options.format - Format of the items served by the URL. Defaults to `json`.
338
354
  * @param options.limit - Maximum number of items to return.
339
355
  * @param options.offset - Number of items to skip.
340
356
  * @param options.timeoutSecs - Timeout for the API request that fetches the dataset. Default is `'long'`.
@@ -392,19 +408,3 @@ export class DatasetClient extends ResourceClient {
392
408
  });
393
409
  }
394
410
  }
395
- /**
396
- * Supported formats for downloading dataset items.
397
- */
398
- export var DownloadItemsFormat;
399
- (function (DownloadItemsFormat) {
400
- DownloadItemsFormat["JSON"] = "json";
401
- DownloadItemsFormat["JSONL"] = "jsonl";
402
- DownloadItemsFormat["XML"] = "xml";
403
- DownloadItemsFormat["HTML"] = "html";
404
- DownloadItemsFormat["CSV"] = "csv";
405
- DownloadItemsFormat["XLSX"] = "xlsx";
406
- DownloadItemsFormat["RSS"] = "rss";
407
- })(DownloadItemsFormat || (DownloadItemsFormat = {}));
408
- const validItemFormats = [...new Set(Object.values(DownloadItemsFormat).map((item) => item.toLowerCase()))];
409
- // Declared below `validItemFormats` because it references it at module load time.
410
- const itemFormatSchema = z.enum(validItemFormats);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify-client",
3
- "version": "3.0.0-beta.36",
3
+ "version": "3.0.0-beta.38",
4
4
  "description": "Apify API client for JavaScript",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"