apify-client 2.20.1-beta.6 → 2.20.1-beta.8
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/apify_client.d.ts +237 -25
- package/dist/apify_client.d.ts.map +1 -1
- package/dist/apify_client.js +234 -25
- package/dist/apify_client.js.map +1 -1
- package/dist/bundle.js +2042 -253
- package/dist/bundle.js.map +1 -1
- package/dist/resource_clients/actor.d.ts +322 -31
- package/dist/resource_clients/actor.d.ts.map +1 -1
- package/dist/resource_clients/actor.js +167 -19
- package/dist/resource_clients/actor.js.map +1 -1
- package/dist/resource_clients/actor_collection.d.ts +34 -3
- package/dist/resource_clients/actor_collection.d.ts.map +1 -1
- package/dist/resource_clients/actor_collection.js +34 -3
- package/dist/resource_clients/actor_collection.js.map +1 -1
- package/dist/resource_clients/actor_env_var.d.ts +34 -3
- package/dist/resource_clients/actor_env_var.d.ts.map +1 -1
- package/dist/resource_clients/actor_env_var.js +34 -3
- package/dist/resource_clients/actor_env_var.js.map +1 -1
- package/dist/resource_clients/actor_env_var_collection.d.ts +37 -3
- package/dist/resource_clients/actor_env_var_collection.d.ts.map +1 -1
- package/dist/resource_clients/actor_env_var_collection.js +37 -3
- package/dist/resource_clients/actor_env_var_collection.js.map +1 -1
- package/dist/resource_clients/actor_version.d.ts +42 -6
- package/dist/resource_clients/actor_version.d.ts.map +1 -1
- package/dist/resource_clients/actor_version.js +42 -6
- package/dist/resource_clients/actor_version.js.map +1 -1
- package/dist/resource_clients/actor_version_collection.d.ts +35 -3
- package/dist/resource_clients/actor_version_collection.d.ts.map +1 -1
- package/dist/resource_clients/actor_version_collection.js +35 -3
- package/dist/resource_clients/actor_version_collection.js.map +1 -1
- package/dist/resource_clients/build.d.ts +123 -11
- package/dist/resource_clients/build.d.ts.map +1 -1
- package/dist/resource_clients/build.js +93 -11
- package/dist/resource_clients/build.js.map +1 -1
- package/dist/resource_clients/build_collection.d.ts +27 -2
- package/dist/resource_clients/build_collection.d.ts.map +1 -1
- package/dist/resource_clients/build_collection.js +27 -2
- package/dist/resource_clients/build_collection.js.map +1 -1
- package/dist/resource_clients/dataset.d.ts +221 -15
- package/dist/resource_clients/dataset.d.ts.map +1 -1
- package/dist/resource_clients/dataset.js +185 -15
- package/dist/resource_clients/dataset.js.map +1 -1
- package/dist/resource_clients/dataset_collection.d.ts +32 -3
- package/dist/resource_clients/dataset_collection.d.ts.map +1 -1
- package/dist/resource_clients/dataset_collection.js +32 -3
- package/dist/resource_clients/dataset_collection.js.map +1 -1
- package/dist/resource_clients/key_value_store.d.ts +219 -26
- package/dist/resource_clients/key_value_store.d.ts.map +1 -1
- package/dist/resource_clients/key_value_store.js +172 -25
- package/dist/resource_clients/key_value_store.js.map +1 -1
- package/dist/resource_clients/key_value_store_collection.d.ts +32 -3
- package/dist/resource_clients/key_value_store_collection.d.ts.map +1 -1
- package/dist/resource_clients/key_value_store_collection.js +32 -3
- package/dist/resource_clients/key_value_store_collection.js.map +1 -1
- package/dist/resource_clients/log.d.ts +34 -3
- package/dist/resource_clients/log.d.ts.map +1 -1
- package/dist/resource_clients/log.js +34 -3
- package/dist/resource_clients/log.js.map +1 -1
- package/dist/resource_clients/request_queue.d.ts +290 -19
- package/dist/resource_clients/request_queue.d.ts.map +1 -1
- package/dist/resource_clients/request_queue.js +233 -19
- package/dist/resource_clients/request_queue.js.map +1 -1
- package/dist/resource_clients/request_queue_collection.d.ts +31 -3
- package/dist/resource_clients/request_queue_collection.d.ts.map +1 -1
- package/dist/resource_clients/request_queue_collection.js +31 -3
- package/dist/resource_clients/request_queue_collection.js.map +1 -1
- package/dist/resource_clients/run.d.ts +224 -27
- package/dist/resource_clients/run.d.ts.map +1 -1
- package/dist/resource_clients/run.js +200 -27
- package/dist/resource_clients/run.js.map +1 -1
- package/dist/resource_clients/run_collection.d.ts +27 -2
- package/dist/resource_clients/run_collection.d.ts.map +1 -1
- package/dist/resource_clients/run_collection.js +27 -2
- package/dist/resource_clients/run_collection.js.map +1 -1
- package/dist/resource_clients/schedule.d.ts +65 -4
- package/dist/resource_clients/schedule.d.ts.map +1 -1
- package/dist/resource_clients/schedule.js +42 -4
- package/dist/resource_clients/schedule.js.map +1 -1
- package/dist/resource_clients/schedule_collection.d.ts +35 -3
- package/dist/resource_clients/schedule_collection.d.ts.map +1 -1
- package/dist/resource_clients/schedule_collection.js +35 -3
- package/dist/resource_clients/schedule_collection.js.map +1 -1
- package/dist/resource_clients/store_collection.d.ts +26 -2
- package/dist/resource_clients/store_collection.d.ts.map +1 -1
- package/dist/resource_clients/store_collection.js +26 -2
- package/dist/resource_clients/store_collection.js.map +1 -1
- package/dist/resource_clients/task.d.ts +110 -11
- package/dist/resource_clients/task.d.ts.map +1 -1
- package/dist/resource_clients/task.js +83 -11
- package/dist/resource_clients/task.js.map +1 -1
- package/dist/resource_clients/task_collection.d.ts +35 -8
- package/dist/resource_clients/task_collection.d.ts.map +1 -1
- package/dist/resource_clients/task_collection.js +35 -8
- package/dist/resource_clients/task_collection.js.map +1 -1
- package/dist/resource_clients/user.d.ts +41 -4
- package/dist/resource_clients/user.d.ts.map +1 -1
- package/dist/resource_clients/user.js +41 -4
- package/dist/resource_clients/user.js.map +1 -1
- package/dist/resource_clients/webhook.d.ts +66 -5
- package/dist/resource_clients/webhook.d.ts.map +1 -1
- package/dist/resource_clients/webhook.js +48 -5
- package/dist/resource_clients/webhook.js.map +1 -1
- package/dist/resource_clients/webhook_collection.d.ts +34 -3
- package/dist/resource_clients/webhook_collection.d.ts.map +1 -1
- package/dist/resource_clients/webhook_collection.js +34 -3
- package/dist/resource_clients/webhook_collection.js.map +1 -1
- package/dist/resource_clients/webhook_dispatch.d.ts +22 -1
- package/dist/resource_clients/webhook_dispatch.d.ts.map +1 -1
- package/dist/resource_clients/webhook_dispatch.js +22 -1
- package/dist/resource_clients/webhook_dispatch.js.map +1 -1
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +24 -2
- package/dist/resource_clients/webhook_dispatch_collection.d.ts.map +1 -1
- package/dist/resource_clients/webhook_dispatch_collection.js +24 -2
- package/dist/resource_clients/webhook_dispatch_collection.js.map +1 -1
- package/dist/utils.d.ts +42 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,56 +2,229 @@ import type { STORAGE_GENERAL_ACCESS } from '@apify/consts';
|
|
|
2
2
|
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
3
3
|
import { ResourceClient } from '../base/resource_client';
|
|
4
4
|
import type { PaginatedList } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Client for managing a specific Dataset.
|
|
7
|
+
*
|
|
8
|
+
* Datasets store structured data results from Actor runs. This client provides methods to push items,
|
|
9
|
+
* list and retrieve items, download items in various formats (JSON, CSV, Excel, etc.), and manage
|
|
10
|
+
* the dataset.
|
|
11
|
+
*
|
|
12
|
+
* @template Data - Type of items stored in the dataset
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* const client = new ApifyClient({ token: 'my-token' });
|
|
17
|
+
* const datasetClient = client.dataset('my-dataset-id');
|
|
18
|
+
*
|
|
19
|
+
* // Push items to the dataset
|
|
20
|
+
* await datasetClient.pushItems([
|
|
21
|
+
* { url: 'https://example.com', title: 'Example' },
|
|
22
|
+
* { url: 'https://test.com', title: 'Test' }
|
|
23
|
+
* ]);
|
|
24
|
+
*
|
|
25
|
+
* // List all items
|
|
26
|
+
* const { items } = await datasetClient.listItems();
|
|
27
|
+
*
|
|
28
|
+
* // Download items as CSV
|
|
29
|
+
* const buffer = await datasetClient.downloadItems('csv');
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @see https://docs.apify.com/platform/storage/dataset
|
|
33
|
+
*/
|
|
5
34
|
export declare class DatasetClient<Data extends Record<string | number, any> = Record<string | number, unknown>> extends ResourceClient {
|
|
6
35
|
/**
|
|
7
36
|
* @hidden
|
|
8
37
|
*/
|
|
9
38
|
constructor(options: ApiClientSubResourceOptions);
|
|
10
39
|
/**
|
|
11
|
-
*
|
|
40
|
+
* Gets the dataset object from the Apify API.
|
|
41
|
+
*
|
|
42
|
+
* @returns The Dataset object, or `undefined` if it does not exist
|
|
43
|
+
* @see https://docs.apify.com/api/v2/dataset-get
|
|
12
44
|
*/
|
|
13
45
|
get(): Promise<Dataset | undefined>;
|
|
14
46
|
/**
|
|
15
|
-
*
|
|
47
|
+
* Updates the dataset with specified fields.
|
|
48
|
+
*
|
|
49
|
+
* @param newFields - Fields to update in the dataset
|
|
50
|
+
* @returns The updated Dataset object
|
|
51
|
+
* @see https://docs.apify.com/api/v2/dataset-put
|
|
16
52
|
*/
|
|
17
53
|
update(newFields: DatasetClientUpdateOptions): Promise<Dataset>;
|
|
18
54
|
/**
|
|
19
|
-
*
|
|
55
|
+
* Deletes the dataset.
|
|
56
|
+
*
|
|
57
|
+
* @see https://docs.apify.com/api/v2/dataset-delete
|
|
20
58
|
*/
|
|
21
59
|
delete(): Promise<void>;
|
|
22
60
|
/**
|
|
23
|
-
*
|
|
61
|
+
* Lists items in the dataset.
|
|
62
|
+
*
|
|
63
|
+
* Returns a paginated list of dataset items. You can use pagination parameters to retrieve
|
|
64
|
+
* specific subsets of items, and various filtering and formatting options to customize
|
|
65
|
+
* the output.
|
|
66
|
+
*
|
|
67
|
+
* @param options - Options for listing items
|
|
68
|
+
* @param options.limit - Maximum number of items to return. Default is all items.
|
|
69
|
+
* @param options.offset - Number of items to skip from the beginning. Default is 0.
|
|
70
|
+
* @param options.desc - If `true`, items are returned in descending order (newest first). Default is `false`.
|
|
71
|
+
* @param options.fields - Array of field names to include in the results. Omits all other fields.
|
|
72
|
+
* @param options.omit - Array of field names to exclude from the results.
|
|
73
|
+
* @param options.clean - If `true`, returns only non-empty items and skips hidden fields. Default is `false`.
|
|
74
|
+
* @param options.skipEmpty - If `true`, skips empty items. Default is `false`.
|
|
75
|
+
* @param options.skipHidden - If `true`, skips hidden fields (fields starting with `#`). Default is `false`.
|
|
76
|
+
* @param options.flatten - Array of field names to flatten. Nested objects are converted to dot notation (e.g., `obj.field`).
|
|
77
|
+
* @param options.unwind - Field name or array of field names to unwind. Each array value creates a separate item.
|
|
78
|
+
* @param options.view - Name of a predefined view to use for field selection.
|
|
79
|
+
* @returns A paginated list with `items`, `total` count, `offset`, `count`, and `limit`
|
|
80
|
+
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```javascript
|
|
84
|
+
* // Get first 100 items
|
|
85
|
+
* const { items, total } = await client.dataset('my-dataset').listItems({ limit: 100 });
|
|
86
|
+
* console.log(`Retrieved ${items.length} of ${total} total items`);
|
|
87
|
+
*
|
|
88
|
+
* // Get items with specific fields only
|
|
89
|
+
* const { items } = await client.dataset('my-dataset').listItems({
|
|
90
|
+
* fields: ['url', 'title'],
|
|
91
|
+
* skipEmpty: true,
|
|
92
|
+
* limit: 50
|
|
93
|
+
* });
|
|
94
|
+
*
|
|
95
|
+
* // Get items in descending order with pagination
|
|
96
|
+
* const { items } = await client.dataset('my-dataset').listItems({
|
|
97
|
+
* desc: true,
|
|
98
|
+
* offset: 100,
|
|
99
|
+
* limit: 50
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
24
102
|
*/
|
|
25
103
|
listItems(options?: DatasetClientListItemOptions): Promise<PaginatedList<Data>>;
|
|
26
104
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
105
|
+
* Downloads dataset items in a specific format.
|
|
106
|
+
*
|
|
107
|
+
* Unlike {@link listItems} which returns a {@link PaginatedList} with an array of individual
|
|
108
|
+
* dataset items, this method returns the items serialized to the provided format
|
|
109
|
+
* (JSON, CSV, Excel, etc.) as a Buffer. Useful for exporting data for further processing.
|
|
110
|
+
*
|
|
111
|
+
* @param format - Output format: `'json'`, `'jsonl'`, `'csv'`, `'xlsx'`, `'xml'`, `'rss'`, or `'html'`
|
|
112
|
+
* @param options - Download and formatting options (extends all options from {@link listItems})
|
|
113
|
+
* @param options.attachment - If `true`, the response will have `Content-Disposition: attachment` header.
|
|
114
|
+
* @param options.bom - If `true`, adds UTF-8 BOM to the beginning of the file (useful for Excel compatibility).
|
|
115
|
+
* @param options.delimiter - CSV delimiter character. Default is `,` (comma).
|
|
116
|
+
* @param options.skipHeaderRow - If `true`, CSV export will not include the header row with field names.
|
|
117
|
+
* @param options.xmlRoot - Name of the root XML element. Default is `'items'`.
|
|
118
|
+
* @param options.xmlRow - Name of the XML element for each item. Default is `'item'`.
|
|
119
|
+
* @param options.fields - Array of field names to include in the export.
|
|
120
|
+
* @param options.omit - Array of field names to exclude from the export.
|
|
121
|
+
* @returns Buffer containing the serialized data in the specified format
|
|
122
|
+
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```javascript
|
|
126
|
+
* // Download as CSV with BOM for Excel compatibility
|
|
127
|
+
* const csvBuffer = await client.dataset('my-dataset').downloadItems('csv', { bom: true });
|
|
128
|
+
* require('fs').writeFileSync('output.csv', csvBuffer);
|
|
129
|
+
*
|
|
130
|
+
* // Download as Excel with custom options
|
|
131
|
+
* const xlsxBuffer = await client.dataset('my-dataset').downloadItems('xlsx', {
|
|
132
|
+
* fields: ['url', 'title', 'price'],
|
|
133
|
+
* skipEmpty: true,
|
|
134
|
+
* limit: 1000
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // Download as XML with custom element names
|
|
138
|
+
* const xmlBuffer = await client.dataset('my-dataset').downloadItems('xml', {
|
|
139
|
+
* xmlRoot: 'products',
|
|
140
|
+
* xmlRow: 'product'
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
30
143
|
*/
|
|
31
144
|
downloadItems(format: DownloadItemsFormat, options?: DatasetClientDownloadItemsOptions): Promise<Buffer>;
|
|
32
145
|
/**
|
|
33
|
-
*
|
|
146
|
+
* Stores one or more items into the dataset.
|
|
147
|
+
*
|
|
148
|
+
* Items can be objects, strings, or arrays thereof. Each item will be stored as a separate
|
|
149
|
+
* record in the dataset. Objects are automatically serialized to JSON. If you provide an array,
|
|
150
|
+
* all items will be stored in order. This method is idempotent - calling it multiple times
|
|
151
|
+
* with the same data will not create duplicates, but will append items each time.
|
|
152
|
+
*
|
|
153
|
+
* @param items - A single item (object or string) or an array of items to store.
|
|
154
|
+
* Objects are automatically stringified to JSON. Strings are stored as-is.
|
|
155
|
+
* @see https://docs.apify.com/api/v2/dataset-items-post
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```javascript
|
|
159
|
+
* // Store a single object
|
|
160
|
+
* await client.dataset('my-dataset').pushItems({
|
|
161
|
+
* url: 'https://example.com',
|
|
162
|
+
* title: 'Example Page',
|
|
163
|
+
* extractedAt: new Date()
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* // Store multiple items at once
|
|
167
|
+
* await client.dataset('my-dataset').pushItems([
|
|
168
|
+
* { url: 'https://example.com', title: 'Example' },
|
|
169
|
+
* { url: 'https://test.com', title: 'Test' },
|
|
170
|
+
* { url: 'https://demo.com', title: 'Demo' }
|
|
171
|
+
* ]);
|
|
172
|
+
*
|
|
173
|
+
* // Store string items
|
|
174
|
+
* await client.dataset('my-dataset').pushItems(['item1', 'item2', 'item3']);
|
|
175
|
+
* ```
|
|
34
176
|
*/
|
|
35
177
|
pushItems(items: Data | Data[] | string | string[]): Promise<void>;
|
|
36
178
|
/**
|
|
37
|
-
*
|
|
179
|
+
* Gets statistical information about the dataset.
|
|
180
|
+
*
|
|
181
|
+
* Returns statistics for each field in the dataset, including information about
|
|
182
|
+
* data types, null counts, and value ranges.
|
|
183
|
+
*
|
|
184
|
+
* @returns Dataset statistics, or `undefined` if not available
|
|
185
|
+
* @see https://docs.apify.com/api/v2/dataset-statistics-get
|
|
38
186
|
*/
|
|
39
187
|
getStatistics(): Promise<DatasetStatistics | undefined>;
|
|
40
188
|
/**
|
|
41
|
-
* Generates a URL
|
|
189
|
+
* Generates a public URL for accessing dataset items.
|
|
42
190
|
*
|
|
43
191
|
* If the client has permission to access the dataset's URL signing key,
|
|
44
|
-
* the URL will include a signature
|
|
192
|
+
* the URL will include a cryptographic signature allowing access without authentication.
|
|
193
|
+
* This is useful for sharing dataset results with external services or users.
|
|
194
|
+
*
|
|
195
|
+
* @param options - URL generation options (extends all options from {@link listItems})
|
|
196
|
+
* @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires.
|
|
197
|
+
* @param options.fields - Array of field names to include in the response.
|
|
198
|
+
* @param options.limit - Maximum number of items to return.
|
|
199
|
+
* @param options.offset - Number of items to skip.
|
|
200
|
+
* @returns A public URL string for accessing the dataset items
|
|
45
201
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```javascript
|
|
204
|
+
* // Create a URL that expires in 1 hour with specific fields
|
|
205
|
+
* const url = await client.dataset('my-dataset').createItemsPublicUrl({
|
|
206
|
+
* expiresInSecs: 3600,
|
|
207
|
+
* fields: ['url', 'title'],
|
|
208
|
+
* limit: 100
|
|
209
|
+
* });
|
|
210
|
+
* console.log(`Share this URL: ${url}`);
|
|
49
211
|
*
|
|
50
|
-
*
|
|
212
|
+
* // Create a permanent public URL for clean items only
|
|
213
|
+
* const url = await client.dataset('my-dataset').createItemsPublicUrl({
|
|
214
|
+
* clean: true,
|
|
215
|
+
* skipEmpty: true
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
51
218
|
*/
|
|
52
219
|
createItemsPublicUrl(options?: DatasetClientCreateItemsUrlOptions): Promise<string>;
|
|
53
220
|
private _createPaginationList;
|
|
54
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Represents a dataset storage on the Apify platform.
|
|
224
|
+
*
|
|
225
|
+
* Datasets store structured data as a sequence of items (records). Each item is a JSON object.
|
|
226
|
+
* Datasets are useful for storing results from web scraping, crawling, or data processing tasks.
|
|
227
|
+
*/
|
|
55
228
|
export interface Dataset {
|
|
56
229
|
id: string;
|
|
57
230
|
name?: string;
|
|
@@ -71,17 +244,29 @@ export interface Dataset {
|
|
|
71
244
|
urlSigningSecretKey?: string | null;
|
|
72
245
|
itemsPublicUrl: string;
|
|
73
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Statistics about dataset usage and storage.
|
|
249
|
+
*/
|
|
74
250
|
export interface DatasetStats {
|
|
75
251
|
readCount?: number;
|
|
76
252
|
writeCount?: number;
|
|
77
253
|
deleteCount?: number;
|
|
78
254
|
storageBytes?: number;
|
|
79
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Options for updating a dataset.
|
|
258
|
+
*/
|
|
80
259
|
export interface DatasetClientUpdateOptions {
|
|
81
260
|
name?: string | null;
|
|
82
261
|
title?: string;
|
|
83
262
|
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
84
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Options for listing items from a dataset.
|
|
266
|
+
*
|
|
267
|
+
* Provides various filtering, pagination, and transformation options to customize
|
|
268
|
+
* the output format and content of retrieved items.
|
|
269
|
+
*/
|
|
85
270
|
export interface DatasetClientListItemOptions {
|
|
86
271
|
clean?: boolean;
|
|
87
272
|
desc?: boolean;
|
|
@@ -96,9 +281,17 @@ export interface DatasetClientListItemOptions {
|
|
|
96
281
|
view?: string;
|
|
97
282
|
signature?: string;
|
|
98
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Options for creating a public URL to access dataset items.
|
|
286
|
+
*
|
|
287
|
+
* Extends {@link DatasetClientListItemOptions} with URL expiration control.
|
|
288
|
+
*/
|
|
99
289
|
export interface DatasetClientCreateItemsUrlOptions extends DatasetClientListItemOptions {
|
|
100
290
|
expiresInSecs?: number;
|
|
101
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Supported formats for downloading dataset items.
|
|
294
|
+
*/
|
|
102
295
|
export declare enum DownloadItemsFormat {
|
|
103
296
|
JSON = "json",
|
|
104
297
|
JSONL = "jsonl",
|
|
@@ -108,6 +301,11 @@ export declare enum DownloadItemsFormat {
|
|
|
108
301
|
XLSX = "xlsx",
|
|
109
302
|
RSS = "rss"
|
|
110
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* Options for downloading dataset items in a specific format.
|
|
306
|
+
*
|
|
307
|
+
* Extends {@link DatasetClientListItemOptions} with format-specific options.
|
|
308
|
+
*/
|
|
111
309
|
export interface DatasetClientDownloadItemsOptions extends DatasetClientListItemOptions {
|
|
112
310
|
attachment?: boolean;
|
|
113
311
|
bom?: boolean;
|
|
@@ -116,9 +314,17 @@ export interface DatasetClientDownloadItemsOptions extends DatasetClientListItem
|
|
|
116
314
|
xmlRoot?: string;
|
|
117
315
|
xmlRow?: string;
|
|
118
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Statistical information about dataset fields.
|
|
319
|
+
*
|
|
320
|
+
* Provides insights into the data structure and content of the dataset.
|
|
321
|
+
*/
|
|
119
322
|
export interface DatasetStatistics {
|
|
120
323
|
fieldStatistics: Record<string, FieldStatistics>;
|
|
121
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Statistics for a single field in a dataset.
|
|
327
|
+
*/
|
|
122
328
|
export interface FieldStatistics {
|
|
123
329
|
min?: number;
|
|
124
330
|
max?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset.d.ts","sourceRoot":"","sources":["../../src/resource_clients/dataset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAI5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAGH,cAAc,EAEjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,qBAAa,aAAa,CACtB,IAAI,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,M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EAAE,eAAe,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -6,6 +6,35 @@ const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
|
6
6
|
const utilities_1 = require("@apify/utilities");
|
|
7
7
|
const resource_client_1 = require("../base/resource_client");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
|
+
/**
|
|
10
|
+
* Client for managing a specific Dataset.
|
|
11
|
+
*
|
|
12
|
+
* Datasets store structured data results from Actor runs. This client provides methods to push items,
|
|
13
|
+
* list and retrieve items, download items in various formats (JSON, CSV, Excel, etc.), and manage
|
|
14
|
+
* the dataset.
|
|
15
|
+
*
|
|
16
|
+
* @template Data - Type of items stored in the dataset
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```javascript
|
|
20
|
+
* const client = new ApifyClient({ token: 'my-token' });
|
|
21
|
+
* const datasetClient = client.dataset('my-dataset-id');
|
|
22
|
+
*
|
|
23
|
+
* // Push items to the dataset
|
|
24
|
+
* await datasetClient.pushItems([
|
|
25
|
+
* { url: 'https://example.com', title: 'Example' },
|
|
26
|
+
* { url: 'https://test.com', title: 'Test' }
|
|
27
|
+
* ]);
|
|
28
|
+
*
|
|
29
|
+
* // List all items
|
|
30
|
+
* const { items } = await datasetClient.listItems();
|
|
31
|
+
*
|
|
32
|
+
* // Download items as CSV
|
|
33
|
+
* const buffer = await datasetClient.downloadItems('csv');
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @see https://docs.apify.com/platform/storage/dataset
|
|
37
|
+
*/
|
|
9
38
|
class DatasetClient extends resource_client_1.ResourceClient {
|
|
10
39
|
/**
|
|
11
40
|
* @hidden
|
|
@@ -17,26 +46,75 @@ class DatasetClient extends resource_client_1.ResourceClient {
|
|
|
17
46
|
});
|
|
18
47
|
}
|
|
19
48
|
/**
|
|
20
|
-
*
|
|
49
|
+
* Gets the dataset object from the Apify API.
|
|
50
|
+
*
|
|
51
|
+
* @returns The Dataset object, or `undefined` if it does not exist
|
|
52
|
+
* @see https://docs.apify.com/api/v2/dataset-get
|
|
21
53
|
*/
|
|
22
54
|
async get() {
|
|
23
55
|
return this._get({}, resource_client_1.SMALL_TIMEOUT_MILLIS);
|
|
24
56
|
}
|
|
25
57
|
/**
|
|
26
|
-
*
|
|
58
|
+
* Updates the dataset with specified fields.
|
|
59
|
+
*
|
|
60
|
+
* @param newFields - Fields to update in the dataset
|
|
61
|
+
* @returns The updated Dataset object
|
|
62
|
+
* @see https://docs.apify.com/api/v2/dataset-put
|
|
27
63
|
*/
|
|
28
64
|
async update(newFields) {
|
|
29
65
|
(0, ow_1.default)(newFields, ow_1.default.object);
|
|
30
66
|
return this._update(newFields, resource_client_1.SMALL_TIMEOUT_MILLIS);
|
|
31
67
|
}
|
|
32
68
|
/**
|
|
33
|
-
*
|
|
69
|
+
* Deletes the dataset.
|
|
70
|
+
*
|
|
71
|
+
* @see https://docs.apify.com/api/v2/dataset-delete
|
|
34
72
|
*/
|
|
35
73
|
async delete() {
|
|
36
74
|
return this._delete(resource_client_1.SMALL_TIMEOUT_MILLIS);
|
|
37
75
|
}
|
|
38
76
|
/**
|
|
39
|
-
*
|
|
77
|
+
* Lists items in the dataset.
|
|
78
|
+
*
|
|
79
|
+
* Returns a paginated list of dataset items. You can use pagination parameters to retrieve
|
|
80
|
+
* specific subsets of items, and various filtering and formatting options to customize
|
|
81
|
+
* the output.
|
|
82
|
+
*
|
|
83
|
+
* @param options - Options for listing items
|
|
84
|
+
* @param options.limit - Maximum number of items to return. Default is all items.
|
|
85
|
+
* @param options.offset - Number of items to skip from the beginning. Default is 0.
|
|
86
|
+
* @param options.desc - If `true`, items are returned in descending order (newest first). Default is `false`.
|
|
87
|
+
* @param options.fields - Array of field names to include in the results. Omits all other fields.
|
|
88
|
+
* @param options.omit - Array of field names to exclude from the results.
|
|
89
|
+
* @param options.clean - If `true`, returns only non-empty items and skips hidden fields. Default is `false`.
|
|
90
|
+
* @param options.skipEmpty - If `true`, skips empty items. Default is `false`.
|
|
91
|
+
* @param options.skipHidden - If `true`, skips hidden fields (fields starting with `#`). Default is `false`.
|
|
92
|
+
* @param options.flatten - Array of field names to flatten. Nested objects are converted to dot notation (e.g., `obj.field`).
|
|
93
|
+
* @param options.unwind - Field name or array of field names to unwind. Each array value creates a separate item.
|
|
94
|
+
* @param options.view - Name of a predefined view to use for field selection.
|
|
95
|
+
* @returns A paginated list with `items`, `total` count, `offset`, `count`, and `limit`
|
|
96
|
+
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```javascript
|
|
100
|
+
* // Get first 100 items
|
|
101
|
+
* const { items, total } = await client.dataset('my-dataset').listItems({ limit: 100 });
|
|
102
|
+
* console.log(`Retrieved ${items.length} of ${total} total items`);
|
|
103
|
+
*
|
|
104
|
+
* // Get items with specific fields only
|
|
105
|
+
* const { items } = await client.dataset('my-dataset').listItems({
|
|
106
|
+
* fields: ['url', 'title'],
|
|
107
|
+
* skipEmpty: true,
|
|
108
|
+
* limit: 50
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* // Get items in descending order with pagination
|
|
112
|
+
* const { items } = await client.dataset('my-dataset').listItems({
|
|
113
|
+
* desc: true,
|
|
114
|
+
* offset: 100,
|
|
115
|
+
* limit: 50
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
40
118
|
*/
|
|
41
119
|
async listItems(options = {}) {
|
|
42
120
|
var _a;
|
|
@@ -63,9 +141,44 @@ class DatasetClient extends resource_client_1.ResourceClient {
|
|
|
63
141
|
return this._createPaginationList(response, (_a = options.desc) !== null && _a !== void 0 ? _a : false);
|
|
64
142
|
}
|
|
65
143
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
144
|
+
* Downloads dataset items in a specific format.
|
|
145
|
+
*
|
|
146
|
+
* Unlike {@link listItems} which returns a {@link PaginatedList} with an array of individual
|
|
147
|
+
* dataset items, this method returns the items serialized to the provided format
|
|
148
|
+
* (JSON, CSV, Excel, etc.) as a Buffer. Useful for exporting data for further processing.
|
|
149
|
+
*
|
|
150
|
+
* @param format - Output format: `'json'`, `'jsonl'`, `'csv'`, `'xlsx'`, `'xml'`, `'rss'`, or `'html'`
|
|
151
|
+
* @param options - Download and formatting options (extends all options from {@link listItems})
|
|
152
|
+
* @param options.attachment - If `true`, the response will have `Content-Disposition: attachment` header.
|
|
153
|
+
* @param options.bom - If `true`, adds UTF-8 BOM to the beginning of the file (useful for Excel compatibility).
|
|
154
|
+
* @param options.delimiter - CSV delimiter character. Default is `,` (comma).
|
|
155
|
+
* @param options.skipHeaderRow - If `true`, CSV export will not include the header row with field names.
|
|
156
|
+
* @param options.xmlRoot - Name of the root XML element. Default is `'items'`.
|
|
157
|
+
* @param options.xmlRow - Name of the XML element for each item. Default is `'item'`.
|
|
158
|
+
* @param options.fields - Array of field names to include in the export.
|
|
159
|
+
* @param options.omit - Array of field names to exclude from the export.
|
|
160
|
+
* @returns Buffer containing the serialized data in the specified format
|
|
161
|
+
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```javascript
|
|
165
|
+
* // Download as CSV with BOM for Excel compatibility
|
|
166
|
+
* const csvBuffer = await client.dataset('my-dataset').downloadItems('csv', { bom: true });
|
|
167
|
+
* require('fs').writeFileSync('output.csv', csvBuffer);
|
|
168
|
+
*
|
|
169
|
+
* // Download as Excel with custom options
|
|
170
|
+
* const xlsxBuffer = await client.dataset('my-dataset').downloadItems('xlsx', {
|
|
171
|
+
* fields: ['url', 'title', 'price'],
|
|
172
|
+
* skipEmpty: true,
|
|
173
|
+
* limit: 1000
|
|
174
|
+
* });
|
|
175
|
+
*
|
|
176
|
+
* // Download as XML with custom element names
|
|
177
|
+
* const xmlBuffer = await client.dataset('my-dataset').downloadItems('xml', {
|
|
178
|
+
* xmlRoot: 'products',
|
|
179
|
+
* xmlRow: 'product'
|
|
180
|
+
* });
|
|
181
|
+
* ```
|
|
69
182
|
*/
|
|
70
183
|
async downloadItems(format, options = {}) {
|
|
71
184
|
(0, ow_1.default)(format, ow_1.default.string.oneOf(validItemFormats));
|
|
@@ -102,7 +215,36 @@ class DatasetClient extends resource_client_1.ResourceClient {
|
|
|
102
215
|
return (0, utils_1.cast)(data);
|
|
103
216
|
}
|
|
104
217
|
/**
|
|
105
|
-
*
|
|
218
|
+
* Stores one or more items into the dataset.
|
|
219
|
+
*
|
|
220
|
+
* Items can be objects, strings, or arrays thereof. Each item will be stored as a separate
|
|
221
|
+
* record in the dataset. Objects are automatically serialized to JSON. If you provide an array,
|
|
222
|
+
* all items will be stored in order. This method is idempotent - calling it multiple times
|
|
223
|
+
* with the same data will not create duplicates, but will append items each time.
|
|
224
|
+
*
|
|
225
|
+
* @param items - A single item (object or string) or an array of items to store.
|
|
226
|
+
* Objects are automatically stringified to JSON. Strings are stored as-is.
|
|
227
|
+
* @see https://docs.apify.com/api/v2/dataset-items-post
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```javascript
|
|
231
|
+
* // Store a single object
|
|
232
|
+
* await client.dataset('my-dataset').pushItems({
|
|
233
|
+
* url: 'https://example.com',
|
|
234
|
+
* title: 'Example Page',
|
|
235
|
+
* extractedAt: new Date()
|
|
236
|
+
* });
|
|
237
|
+
*
|
|
238
|
+
* // Store multiple items at once
|
|
239
|
+
* await client.dataset('my-dataset').pushItems([
|
|
240
|
+
* { url: 'https://example.com', title: 'Example' },
|
|
241
|
+
* { url: 'https://test.com', title: 'Test' },
|
|
242
|
+
* { url: 'https://demo.com', title: 'Demo' }
|
|
243
|
+
* ]);
|
|
244
|
+
*
|
|
245
|
+
* // Store string items
|
|
246
|
+
* await client.dataset('my-dataset').pushItems(['item1', 'item2', 'item3']);
|
|
247
|
+
* ```
|
|
106
248
|
*/
|
|
107
249
|
async pushItems(items) {
|
|
108
250
|
(0, ow_1.default)(items, ow_1.default.any(ow_1.default.object, ow_1.default.string, ow_1.default.array.ofType(ow_1.default.any(ow_1.default.object, ow_1.default.string))));
|
|
@@ -119,7 +261,13 @@ class DatasetClient extends resource_client_1.ResourceClient {
|
|
|
119
261
|
});
|
|
120
262
|
}
|
|
121
263
|
/**
|
|
122
|
-
*
|
|
264
|
+
* Gets statistical information about the dataset.
|
|
265
|
+
*
|
|
266
|
+
* Returns statistics for each field in the dataset, including information about
|
|
267
|
+
* data types, null counts, and value ranges.
|
|
268
|
+
*
|
|
269
|
+
* @returns Dataset statistics, or `undefined` if not available
|
|
270
|
+
* @see https://docs.apify.com/api/v2/dataset-statistics-get
|
|
123
271
|
*/
|
|
124
272
|
async getStatistics() {
|
|
125
273
|
const requestOpts = {
|
|
@@ -138,16 +286,35 @@ class DatasetClient extends resource_client_1.ResourceClient {
|
|
|
138
286
|
return undefined;
|
|
139
287
|
}
|
|
140
288
|
/**
|
|
141
|
-
* Generates a URL
|
|
289
|
+
* Generates a public URL for accessing dataset items.
|
|
142
290
|
*
|
|
143
291
|
* If the client has permission to access the dataset's URL signing key,
|
|
144
|
-
* the URL will include a signature
|
|
292
|
+
* the URL will include a cryptographic signature allowing access without authentication.
|
|
293
|
+
* This is useful for sharing dataset results with external services or users.
|
|
294
|
+
*
|
|
295
|
+
* @param options - URL generation options (extends all options from {@link listItems})
|
|
296
|
+
* @param options.expiresInSecs - Number of seconds until the signed URL expires. If omitted, the URL never expires.
|
|
297
|
+
* @param options.fields - Array of field names to include in the response.
|
|
298
|
+
* @param options.limit - Maximum number of items to return.
|
|
299
|
+
* @param options.offset - Number of items to skip.
|
|
300
|
+
* @returns A public URL string for accessing the dataset items
|
|
145
301
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```javascript
|
|
304
|
+
* // Create a URL that expires in 1 hour with specific fields
|
|
305
|
+
* const url = await client.dataset('my-dataset').createItemsPublicUrl({
|
|
306
|
+
* expiresInSecs: 3600,
|
|
307
|
+
* fields: ['url', 'title'],
|
|
308
|
+
* limit: 100
|
|
309
|
+
* });
|
|
310
|
+
* console.log(`Share this URL: ${url}`);
|
|
149
311
|
*
|
|
150
|
-
*
|
|
312
|
+
* // Create a permanent public URL for clean items only
|
|
313
|
+
* const url = await client.dataset('my-dataset').createItemsPublicUrl({
|
|
314
|
+
* clean: true,
|
|
315
|
+
* skipEmpty: true
|
|
316
|
+
* });
|
|
317
|
+
* ```
|
|
151
318
|
*/
|
|
152
319
|
async createItemsPublicUrl(options = {}) {
|
|
153
320
|
(0, ow_1.default)(options, ow_1.default.object.exactShape({
|
|
@@ -192,6 +359,9 @@ class DatasetClient extends resource_client_1.ResourceClient {
|
|
|
192
359
|
}
|
|
193
360
|
}
|
|
194
361
|
exports.DatasetClient = DatasetClient;
|
|
362
|
+
/**
|
|
363
|
+
* Supported formats for downloading dataset items.
|
|
364
|
+
*/
|
|
195
365
|
var DownloadItemsFormat;
|
|
196
366
|
(function (DownloadItemsFormat) {
|
|
197
367
|
DownloadItemsFormat["JSON"] = "json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../src/resource_clients/dataset.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AAGpB,gDAAsE;AAItE,6DAKiC;AAGjC,oCAAwF;AAExF,MAAa,aAEX,SAAQ,gCAAc;IACpB;;OAEG;IACH,YAAY,OAAoC;QAC5C,KAAK,CAAC;YACF,YAAY,EAAE,UAAU;YACxB,GAAG,OAAO;SACb,CAAC,CAAC;IACP,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"dataset.js","sourceRoot":"","sources":["../../src/resource_clients/dataset.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AAGpB,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