apify-client 3.0.0-beta.0 → 3.0.0-beta.1
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/bundle.js +6 -6
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +20522 -0
- package/dist/generated/api.js +6 -0
- package/dist/models.d.ts +1072 -0
- package/dist/models.js +89 -0
- package/dist/resource_clients/actor.d.ts +2 -448
- package/dist/resource_clients/actor_collection.d.ts +2 -7
- package/dist/resource_clients/actor_version.d.ts +3 -40
- package/dist/resource_clients/actor_version.js +3 -8
- package/dist/resource_clients/build.d.ts +2 -77
- package/dist/resource_clients/build_collection.d.ts +2 -2
- package/dist/resource_clients/dataset.d.ts +2 -68
- package/dist/resource_clients/key_value_store.d.ts +2 -71
- package/dist/resource_clients/key_value_store.js +3 -1
- package/dist/resource_clients/request_queue.d.ts +15 -174
- package/dist/resource_clients/request_queue.js +2 -2
- package/dist/resource_clients/schedule.d.ts +3 -81
- package/dist/resource_clients/schedule.js +3 -9
- package/dist/resource_clients/store_collection.d.ts +2 -30
- package/dist/resource_clients/task.d.ts +3 -73
- package/dist/resource_clients/task_collection.d.ts +2 -1
- package/dist/resource_clients/user.d.ts +3 -179
- package/dist/resource_clients/user.js +3 -11
- package/dist/resource_clients/webhook.d.ts +2 -61
- package/dist/resource_clients/webhook_dispatch.d.ts +3 -36
- package/dist/resource_clients/webhook_dispatch.js +3 -7
- package/dist/utils.js +9 -3
- package/package.json +13 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ACT_JOB_TERMINAL_STATUSES } from '@apify/consts';
|
|
2
1
|
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
3
2
|
import { ResourceClient } from '../base/resource_client';
|
|
4
|
-
import type {
|
|
3
|
+
import type { Build } from '../models';
|
|
5
4
|
import { LogClient } from './log';
|
|
5
|
+
export type { Build, BuildMeta, BuildOptions, BuildStats, BuildUsage } from '../models';
|
|
6
6
|
/**
|
|
7
7
|
* Client for managing a specific Actor build.
|
|
8
8
|
*
|
|
@@ -143,80 +143,6 @@ export interface BuildClientWaitForFinishOptions {
|
|
|
143
143
|
*/
|
|
144
144
|
waitSecs?: number;
|
|
145
145
|
}
|
|
146
|
-
/**
|
|
147
|
-
* Metadata about how a Build was initiated.
|
|
148
|
-
*/
|
|
149
|
-
export interface BuildMeta {
|
|
150
|
-
origin: string;
|
|
151
|
-
clientIp: string;
|
|
152
|
-
userAgent: string;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Represents an Actor build.
|
|
156
|
-
*
|
|
157
|
-
* Builds compile Actor source code and prepare it for execution. Each build has a unique ID
|
|
158
|
-
* and can be tagged (e.g., 'latest', 'beta') for easy reference.
|
|
159
|
-
*/
|
|
160
|
-
export interface Build {
|
|
161
|
-
id: string;
|
|
162
|
-
actId: string;
|
|
163
|
-
userId: string;
|
|
164
|
-
startedAt: Date;
|
|
165
|
-
finishedAt?: Date;
|
|
166
|
-
status: (typeof ACT_JOB_TERMINAL_STATUSES)[number];
|
|
167
|
-
meta: BuildMeta;
|
|
168
|
-
stats?: BuildStats;
|
|
169
|
-
options?: BuildOptions;
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated This property is deprecated in favor of `actorDefinition.input`.
|
|
172
|
-
*/
|
|
173
|
-
inputSchema?: string;
|
|
174
|
-
/**
|
|
175
|
-
* @deprecated This property is deprecated in favor of `actorDefinition.readme`.
|
|
176
|
-
*/
|
|
177
|
-
readme?: string;
|
|
178
|
-
buildNumber: string;
|
|
179
|
-
/**
|
|
180
|
-
* @since Added in 2.7.2
|
|
181
|
-
*/
|
|
182
|
-
usage?: BuildUsage;
|
|
183
|
-
/**
|
|
184
|
-
* @since Added in 2.7.2
|
|
185
|
-
*/
|
|
186
|
-
usageTotalUsd?: number;
|
|
187
|
-
/**
|
|
188
|
-
* @since Added in 2.7.2
|
|
189
|
-
*/
|
|
190
|
-
usageUsd?: BuildUsage;
|
|
191
|
-
/**
|
|
192
|
-
* @since Added in 2.11.0
|
|
193
|
-
*/
|
|
194
|
-
actorDefinition?: ActorDefinition;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Resource usage for an Actor build.
|
|
198
|
-
* @since Added in 2.7.2
|
|
199
|
-
*/
|
|
200
|
-
export interface BuildUsage {
|
|
201
|
-
ACTOR_COMPUTE_UNITS?: number;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Runtime statistics for an Actor build.
|
|
205
|
-
*/
|
|
206
|
-
export interface BuildStats {
|
|
207
|
-
durationMillis: number;
|
|
208
|
-
runTimeSecs: number;
|
|
209
|
-
computeUnits: number;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Configuration options used for an Actor build.
|
|
213
|
-
*/
|
|
214
|
-
export interface BuildOptions {
|
|
215
|
-
useCache?: boolean;
|
|
216
|
-
betaPackages?: boolean;
|
|
217
|
-
memoryMbytes?: number;
|
|
218
|
-
diskMbytes?: number;
|
|
219
|
-
}
|
|
220
146
|
/**
|
|
221
147
|
* OpenAPI specification for an Actor.
|
|
222
148
|
*
|
|
@@ -283,4 +209,3 @@ interface OpenApiOperation {
|
|
|
283
209
|
};
|
|
284
210
|
};
|
|
285
211
|
}
|
|
286
|
-
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_client';
|
|
2
2
|
import { ResourceCollectionClient } from '../base/resource_collection_client';
|
|
3
|
+
import type { BuildCollectionClientListItem } from '../models';
|
|
3
4
|
import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils';
|
|
4
|
-
|
|
5
|
+
export type { BuildCollectionClientListItem } from '../models';
|
|
5
6
|
/**
|
|
6
7
|
* Client for managing the collection of Actor builds.
|
|
7
8
|
*
|
|
@@ -53,5 +54,4 @@ export declare class BuildCollectionClient extends ResourceCollectionClient {
|
|
|
53
54
|
export interface BuildCollectionClientListOptions extends PaginationOptions {
|
|
54
55
|
desc?: boolean;
|
|
55
56
|
}
|
|
56
|
-
export type BuildCollectionClientListItem = Required<Pick<Build, 'id' | 'status' | 'startedAt' | 'finishedAt'>> & Partial<Pick<Build, 'meta' | 'usageTotalUsd'>>;
|
|
57
57
|
export type BuildCollectionClientListResult = PaginatedList<BuildCollectionClientListItem>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
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
|
+
import type { Dataset, DatasetStatistics } from '../models';
|
|
4
5
|
import type { PaginatedIterator, PaginationOptions } from '../utils';
|
|
6
|
+
export type { Dataset, DatasetStatistics, DatasetStats, FieldStatistics } from '../models';
|
|
5
7
|
/**
|
|
6
8
|
* Client for managing a specific Dataset.
|
|
7
9
|
*
|
|
@@ -222,55 +224,6 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
222
224
|
createItemsPublicUrl(options?: DatasetClientCreateItemsUrlOptions): Promise<string>;
|
|
223
225
|
private _createPaginationList;
|
|
224
226
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Represents a dataset storage on the Apify platform.
|
|
227
|
-
*
|
|
228
|
-
* Datasets store structured data as a sequence of items (records). Each item is a JSON object.
|
|
229
|
-
* Datasets are useful for storing results from web scraping, crawling, or data processing tasks.
|
|
230
|
-
*/
|
|
231
|
-
export interface Dataset {
|
|
232
|
-
id: string;
|
|
233
|
-
name?: string;
|
|
234
|
-
/**
|
|
235
|
-
* @since Added in 2.6.1
|
|
236
|
-
*/
|
|
237
|
-
title?: string;
|
|
238
|
-
userId: string;
|
|
239
|
-
/**
|
|
240
|
-
* @since Added in 2.21.0
|
|
241
|
-
*/
|
|
242
|
-
username?: string;
|
|
243
|
-
createdAt: Date;
|
|
244
|
-
modifiedAt: Date;
|
|
245
|
-
accessedAt: Date;
|
|
246
|
-
itemCount: number;
|
|
247
|
-
cleanItemCount: number;
|
|
248
|
-
actId?: string;
|
|
249
|
-
actRunId?: string;
|
|
250
|
-
stats: DatasetStats;
|
|
251
|
-
fields: string[];
|
|
252
|
-
/**
|
|
253
|
-
* @since Added in 2.12.2
|
|
254
|
-
*/
|
|
255
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
256
|
-
/**
|
|
257
|
-
* @since Added in 2.13.0
|
|
258
|
-
*/
|
|
259
|
-
urlSigningSecretKey?: string | null;
|
|
260
|
-
/**
|
|
261
|
-
* @since Added in 2.13.0
|
|
262
|
-
*/
|
|
263
|
-
itemsPublicUrl: string;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Statistics about dataset usage and storage.
|
|
267
|
-
*/
|
|
268
|
-
export interface DatasetStats {
|
|
269
|
-
readCount?: number;
|
|
270
|
-
writeCount?: number;
|
|
271
|
-
deleteCount?: number;
|
|
272
|
-
storageBytes?: number;
|
|
273
|
-
}
|
|
274
227
|
/**
|
|
275
228
|
* Options for updating a dataset.
|
|
276
229
|
*/
|
|
@@ -348,22 +301,3 @@ export interface DatasetClientDownloadItemsOptions extends Omit<DatasetClientLis
|
|
|
348
301
|
xmlRoot?: string;
|
|
349
302
|
xmlRow?: string;
|
|
350
303
|
}
|
|
351
|
-
/**
|
|
352
|
-
* Statistical information about dataset fields.
|
|
353
|
-
*
|
|
354
|
-
* Provides insights into the data structure and content of the dataset.
|
|
355
|
-
* @since Added in 2.11.2
|
|
356
|
-
*/
|
|
357
|
-
export interface DatasetStatistics {
|
|
358
|
-
fieldStatistics: Record<string, FieldStatistics>;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Statistics for a single field in a dataset.
|
|
362
|
-
* @since Added in 2.11.2
|
|
363
|
-
*/
|
|
364
|
-
export interface FieldStatistics {
|
|
365
|
-
min?: number;
|
|
366
|
-
max?: number;
|
|
367
|
-
nullCount?: number;
|
|
368
|
-
emptyCount?: number;
|
|
369
|
-
}
|
|
@@ -3,6 +3,8 @@ import type { JsonValue } from 'type-fest';
|
|
|
3
3
|
import type { STORAGE_GENERAL_ACCESS } from '@apify/consts';
|
|
4
4
|
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
5
5
|
import { ResourceClient } from '../base/resource_client';
|
|
6
|
+
import type { KeyValueClientListKeysResult, KeyValueListItem, KeyValueStore } from '../models';
|
|
7
|
+
export type { KeyValueClientListKeysResult, KeyValueListItem, KeyValueStore, KeyValueStoreStats } from '../models';
|
|
6
8
|
/**
|
|
7
9
|
* Client for managing a specific key-value store.
|
|
8
10
|
*
|
|
@@ -231,53 +233,6 @@ export declare class KeyValueStoreClient extends ResourceClient {
|
|
|
231
233
|
*/
|
|
232
234
|
deleteRecord(key: string): Promise<void>;
|
|
233
235
|
}
|
|
234
|
-
/**
|
|
235
|
-
* Represents a Key-Value Store storage on the Apify platform.
|
|
236
|
-
*
|
|
237
|
-
* Key-value stores are used to store arbitrary data records or files. Each record is identified
|
|
238
|
-
* by a unique key and can contain any data - JSON objects, strings, binary files, etc.
|
|
239
|
-
*/
|
|
240
|
-
export interface KeyValueStore {
|
|
241
|
-
id: string;
|
|
242
|
-
name?: string;
|
|
243
|
-
/**
|
|
244
|
-
* @since Added in 2.6.1
|
|
245
|
-
*/
|
|
246
|
-
title?: string;
|
|
247
|
-
userId: string;
|
|
248
|
-
/**
|
|
249
|
-
* @since Added in 2.21.0
|
|
250
|
-
*/
|
|
251
|
-
username?: string;
|
|
252
|
-
createdAt: Date;
|
|
253
|
-
modifiedAt: Date;
|
|
254
|
-
accessedAt: Date;
|
|
255
|
-
actId?: string;
|
|
256
|
-
actRunId?: string;
|
|
257
|
-
stats?: KeyValueStoreStats;
|
|
258
|
-
/**
|
|
259
|
-
* @since Added in 2.12.2
|
|
260
|
-
*/
|
|
261
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
262
|
-
/**
|
|
263
|
-
* @since Added in 2.13.0
|
|
264
|
-
*/
|
|
265
|
-
urlSigningSecretKey?: string | null;
|
|
266
|
-
/**
|
|
267
|
-
* @since Added in 2.13.0
|
|
268
|
-
*/
|
|
269
|
-
keysPublicUrl: string;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Statistics about Key-Value Store usage and storage.
|
|
273
|
-
*/
|
|
274
|
-
export interface KeyValueStoreStats {
|
|
275
|
-
readCount?: number;
|
|
276
|
-
writeCount?: number;
|
|
277
|
-
deleteCount?: number;
|
|
278
|
-
listCount?: number;
|
|
279
|
-
storageBytes?: number;
|
|
280
|
-
}
|
|
281
236
|
/**
|
|
282
237
|
* Options for updating a Key-Value Store.
|
|
283
238
|
*/
|
|
@@ -318,30 +273,6 @@ export interface KeyValueClientListKeysOptions {
|
|
|
318
273
|
export interface KeyValueClientCreateKeysUrlOptions extends Omit<KeyValueClientListKeysOptions, 'signature'> {
|
|
319
274
|
expiresInSecs?: number;
|
|
320
275
|
}
|
|
321
|
-
/**
|
|
322
|
-
* Result of listing keys in a Key-Value Store.
|
|
323
|
-
*
|
|
324
|
-
* Contains paginated list of keys with metadata and pagination information.
|
|
325
|
-
*/
|
|
326
|
-
export interface KeyValueClientListKeysResult {
|
|
327
|
-
count: number;
|
|
328
|
-
limit: number;
|
|
329
|
-
exclusiveStartKey: string;
|
|
330
|
-
isTruncated: boolean;
|
|
331
|
-
nextExclusiveStartKey: string;
|
|
332
|
-
items: KeyValueListItem[];
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Metadata about a single key in a Key-Value Store.
|
|
336
|
-
*/
|
|
337
|
-
export interface KeyValueListItem {
|
|
338
|
-
key: string;
|
|
339
|
-
size: number;
|
|
340
|
-
/**
|
|
341
|
-
* @since Added in 2.15.1
|
|
342
|
-
*/
|
|
343
|
-
recordPublicUrl: string;
|
|
344
|
-
}
|
|
345
276
|
/**
|
|
346
277
|
* Options for retrieving a record from a Key-Value Store.
|
|
347
278
|
*/
|
|
@@ -168,7 +168,9 @@ class KeyValueStoreClient extends resource_client_1.ResourceClient {
|
|
|
168
168
|
yield* currentPage.items;
|
|
169
169
|
let remainingItems = parsed.limit ? parsed.limit - currentPage.items.length : undefined;
|
|
170
170
|
while (currentPage.items.length > 0 && // Continue only if at least some items were returned in the last page.
|
|
171
|
-
|
|
171
|
+
// Continue only if there is some next key. The API answers with `null` on the last page and
|
|
172
|
+
// omits the field entirely for a listing that was not truncated.
|
|
173
|
+
currentPage.nextExclusiveStartKey != null &&
|
|
172
174
|
(remainingItems === undefined || remainingItems > 0) // Continue only if the limit was not exceeded.
|
|
173
175
|
) {
|
|
174
176
|
const newOptions = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
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
|
+
import type { RequestQueue, RequestQueueClientAddRequestResult, RequestQueueClientBatchDeleteRequestsResult, RequestQueueClientBatchRequestsOperationResult, RequestQueueClientListAndLockHeadResult, RequestQueueClientListHeadResult, RequestQueueClientListRequestsResult, RequestQueueClientProlongRequestLockResult, RequestQueueClientRequestSchema, RequestQueueClientRequestToAdd, RequestQueueClientRequestToUpdate, RequestQueueClientUnlockRequestsResult } from '../models';
|
|
5
|
+
export type { AllowedHttpMethods, RequestQueue, RequestQueueClientAddRequestResult, RequestQueueClientBatchDeleteRequestsResult, RequestQueueClientBatchRequestsOperationResult, RequestQueueClientListAndLockHeadResult, RequestQueueClientListHeadResult, RequestQueueClientListItem, RequestQueueClientListRequestsResult, RequestQueueClientLockedListItem, RequestQueueClientProlongRequestLockResult, RequestQueueClientRequestSchema, RequestQueueClientRequestToAdd, RequestQueueClientRequestToUpdate, RequestQueueClientUnlockRequestsResult, RequestQueueStats, } from '../models';
|
|
4
6
|
/**
|
|
5
7
|
* Client for managing a specific Request queue.
|
|
6
8
|
*
|
|
@@ -20,12 +22,12 @@ import { ResourceClient } from '../base/resource_client';
|
|
|
20
22
|
* });
|
|
21
23
|
*
|
|
22
24
|
* // Get the next request from the queue
|
|
23
|
-
* const request = await queueClient.listHead();
|
|
25
|
+
* const { items: [request] } = await queueClient.listHead({ limit: 1 });
|
|
24
26
|
*
|
|
25
27
|
* // Mark request as handled
|
|
26
28
|
* await queueClient.updateRequest({
|
|
27
29
|
* id: request.id,
|
|
28
|
-
* handledAt: new Date()
|
|
30
|
+
* handledAt: new Date()
|
|
29
31
|
* });
|
|
30
32
|
* ```
|
|
31
33
|
*
|
|
@@ -142,14 +144,14 @@ export declare class RequestQueueClient extends ResourceClient {
|
|
|
142
144
|
* );
|
|
143
145
|
* ```
|
|
144
146
|
*/
|
|
145
|
-
addRequest(request:
|
|
147
|
+
addRequest(request: RequestQueueClientRequestToAdd, options?: RequestQueueClientAddRequestOptions): Promise<RequestQueueClientAddRequestResult>;
|
|
146
148
|
/**
|
|
147
149
|
* Writes requests to Request queue in batch.
|
|
148
150
|
*
|
|
149
151
|
* @private
|
|
150
152
|
*/
|
|
151
|
-
protected _batchAddRequests(requests:
|
|
152
|
-
protected _batchAddRequestsWithRetries(requests:
|
|
153
|
+
protected _batchAddRequests(requests: RequestQueueClientRequestToAdd[], options?: RequestQueueClientAddRequestOptions): Promise<RequestQueueClientBatchRequestsOperationResult>;
|
|
154
|
+
protected _batchAddRequestsWithRetries(requests: RequestQueueClientRequestToAdd[], options?: RequestQueueClientBatchAddRequestWithRetriesOptions): Promise<RequestQueueClientBatchRequestsOperationResult>;
|
|
153
155
|
/**
|
|
154
156
|
* Adds multiple requests to the queue in a single operation.
|
|
155
157
|
*
|
|
@@ -188,7 +190,7 @@ export declare class RequestQueueClient extends ResourceClient {
|
|
|
188
190
|
* ```
|
|
189
191
|
* @since Added in 2.1.0
|
|
190
192
|
*/
|
|
191
|
-
batchAddRequests(requests:
|
|
193
|
+
batchAddRequests(requests: RequestQueueClientRequestToAdd[], options?: RequestQueueClientBatchAddRequestWithRetriesOptions): Promise<RequestQueueClientBatchRequestsOperationResult>;
|
|
192
194
|
/**
|
|
193
195
|
* Deletes multiple requests from the queue in a single operation.
|
|
194
196
|
*
|
|
@@ -199,7 +201,7 @@ export declare class RequestQueueClient extends ResourceClient {
|
|
|
199
201
|
* @see https://docs.apify.com/api/v2/request-queue-requests-batch-delete
|
|
200
202
|
* @since Added in 2.3.0
|
|
201
203
|
*/
|
|
202
|
-
batchDeleteRequests(requests: RequestQueueClientRequestToDelete[]): Promise<
|
|
204
|
+
batchDeleteRequests(requests: RequestQueueClientRequestToDelete[]): Promise<RequestQueueClientBatchDeleteRequestsResult>;
|
|
203
205
|
/**
|
|
204
206
|
* Gets a specific request from the queue by its ID.
|
|
205
207
|
*
|
|
@@ -216,7 +218,7 @@ export declare class RequestQueueClient extends ResourceClient {
|
|
|
216
218
|
* @returns Information about the updated request
|
|
217
219
|
* @see https://docs.apify.com/api/v2/request-queue-request-put
|
|
218
220
|
*/
|
|
219
|
-
updateRequest(request:
|
|
221
|
+
updateRequest(request: RequestQueueClientRequestToUpdate, options?: RequestQueueClientAddRequestOptions): Promise<RequestQueueClientAddRequestResult>;
|
|
220
222
|
/**
|
|
221
223
|
* Deletes a specific request from the queue.
|
|
222
224
|
*
|
|
@@ -314,50 +316,6 @@ export interface RequestQueueUserOptions {
|
|
|
314
316
|
*/
|
|
315
317
|
timeoutSecs?: number;
|
|
316
318
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Represents a Request Queue storage on the Apify platform.
|
|
319
|
-
*
|
|
320
|
-
* Request queues store URLs (requests) to be processed by web crawlers. They provide
|
|
321
|
-
* automatic deduplication, request locking for parallel processing, and persistence.
|
|
322
|
-
*/
|
|
323
|
-
export interface RequestQueue {
|
|
324
|
-
id: string;
|
|
325
|
-
name?: string;
|
|
326
|
-
/**
|
|
327
|
-
* @since Added in 2.6.1
|
|
328
|
-
*/
|
|
329
|
-
title?: string;
|
|
330
|
-
userId: string;
|
|
331
|
-
/**
|
|
332
|
-
* @since Added in 2.21.0
|
|
333
|
-
*/
|
|
334
|
-
username?: string;
|
|
335
|
-
createdAt: Date;
|
|
336
|
-
modifiedAt: Date;
|
|
337
|
-
accessedAt: Date;
|
|
338
|
-
expireAt?: string;
|
|
339
|
-
totalRequestCount: number;
|
|
340
|
-
handledRequestCount: number;
|
|
341
|
-
pendingRequestCount: number;
|
|
342
|
-
actId?: string;
|
|
343
|
-
actRunId?: string;
|
|
344
|
-
hadMultipleClients: boolean;
|
|
345
|
-
stats: RequestQueueStats;
|
|
346
|
-
/**
|
|
347
|
-
* @since Added in 2.12.2
|
|
348
|
-
*/
|
|
349
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Statistics about Request Queue usage and storage.
|
|
353
|
-
*/
|
|
354
|
-
export interface RequestQueueStats {
|
|
355
|
-
readCount?: number;
|
|
356
|
-
writeCount?: number;
|
|
357
|
-
deleteCount?: number;
|
|
358
|
-
headItemReadCount?: number;
|
|
359
|
-
storageBytes?: number;
|
|
360
|
-
}
|
|
361
319
|
/**
|
|
362
320
|
* Options for updating a Request Queue.
|
|
363
321
|
*/
|
|
@@ -378,15 +336,6 @@ export interface RequestQueueClientUpdateOptions {
|
|
|
378
336
|
export interface RequestQueueClientListHeadOptions {
|
|
379
337
|
limit?: number;
|
|
380
338
|
}
|
|
381
|
-
/**
|
|
382
|
-
* Result of listing requests from the queue head.
|
|
383
|
-
*/
|
|
384
|
-
export interface RequestQueueClientListHeadResult {
|
|
385
|
-
limit: number;
|
|
386
|
-
queueModifiedAt: Date;
|
|
387
|
-
hadMultipleClients: boolean;
|
|
388
|
-
items: RequestQueueClientListItem[];
|
|
389
|
-
}
|
|
390
339
|
/**
|
|
391
340
|
* @since Added in 2.23.2
|
|
392
341
|
*/
|
|
@@ -429,24 +378,6 @@ export interface RequestQueueClientPaginateRequestsOptions {
|
|
|
429
378
|
*/
|
|
430
379
|
filter?: readonly RequestQueueListRequestsFilter[];
|
|
431
380
|
}
|
|
432
|
-
/**
|
|
433
|
-
* Result of listing all requests in the queue.
|
|
434
|
-
* @since Added in 2.5.1
|
|
435
|
-
*/
|
|
436
|
-
export interface RequestQueueClientListRequestsResult {
|
|
437
|
-
limit: number;
|
|
438
|
-
/** @deprecated Use `cursor` for pagination instead. */
|
|
439
|
-
exclusiveStartId?: string;
|
|
440
|
-
/**
|
|
441
|
-
* @since Added in 2.23.2
|
|
442
|
-
*/
|
|
443
|
-
cursor?: string;
|
|
444
|
-
/**
|
|
445
|
-
* @since Added in 2.23.2
|
|
446
|
-
*/
|
|
447
|
-
nextCursor?: string;
|
|
448
|
-
items: RequestQueueClientRequestSchema[];
|
|
449
|
-
}
|
|
450
381
|
/**
|
|
451
382
|
* Options for listing and locking requests from the queue head.
|
|
452
383
|
* @since Added in 2.4.1
|
|
@@ -455,37 +386,6 @@ export interface RequestQueueClientListAndLockHeadOptions {
|
|
|
455
386
|
lockSecs: number;
|
|
456
387
|
limit?: number;
|
|
457
388
|
}
|
|
458
|
-
/**
|
|
459
|
-
* Result of listing and locking requests from the queue head.
|
|
460
|
-
*
|
|
461
|
-
* Extends {@link RequestQueueClientListHeadResult} with lock information.
|
|
462
|
-
* @since Added in 2.4.1
|
|
463
|
-
*/
|
|
464
|
-
export interface RequestQueueClientListAndLockHeadResult extends RequestQueueClientListHeadResult {
|
|
465
|
-
lockSecs: number;
|
|
466
|
-
/**
|
|
467
|
-
* @since Added in 2.11.0
|
|
468
|
-
*/
|
|
469
|
-
queueHasLockedRequests: boolean;
|
|
470
|
-
/**
|
|
471
|
-
* @since Added in 2.11.0
|
|
472
|
-
*/
|
|
473
|
-
clientKey: string;
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Simplified request information used in list results.
|
|
477
|
-
*/
|
|
478
|
-
export interface RequestQueueClientListItem {
|
|
479
|
-
id: string;
|
|
480
|
-
retryCount: number;
|
|
481
|
-
uniqueKey: string;
|
|
482
|
-
url: string;
|
|
483
|
-
method: AllowedHttpMethods;
|
|
484
|
-
/**
|
|
485
|
-
* @since Added in 2.4.1
|
|
486
|
-
*/
|
|
487
|
-
lockExpiresAt?: Date;
|
|
488
|
-
}
|
|
489
389
|
export interface RequestQueueClientAddRequestOptions {
|
|
490
390
|
forefront?: boolean;
|
|
491
391
|
}
|
|
@@ -502,12 +402,6 @@ export interface RequestQueueClientProlongRequestLockOptions {
|
|
|
502
402
|
export interface RequestQueueClientDeleteRequestLockOptions {
|
|
503
403
|
forefront?: boolean;
|
|
504
404
|
}
|
|
505
|
-
/**
|
|
506
|
-
* @since Added in 2.4.1
|
|
507
|
-
*/
|
|
508
|
-
export interface RequestQueueClientProlongRequestLockResult {
|
|
509
|
-
lockExpiresAt: Date;
|
|
510
|
-
}
|
|
511
405
|
/**
|
|
512
406
|
* @since Added in 2.3.0
|
|
513
407
|
*/
|
|
@@ -520,71 +414,18 @@ export interface RequestQueueClientBatchAddRequestWithRetriesOptions {
|
|
|
520
414
|
*/
|
|
521
415
|
minDelayBetweenUnprocessedRequestsRetriesMillis?: number;
|
|
522
416
|
}
|
|
523
|
-
/**
|
|
524
|
-
* Complete schema for a request in the queue.
|
|
525
|
-
*
|
|
526
|
-
* Represents a URL to be crawled along with its metadata, retry information, and custom data.
|
|
527
|
-
*/
|
|
528
|
-
export interface RequestQueueClientRequestSchema {
|
|
529
|
-
id: string;
|
|
530
|
-
uniqueKey: string;
|
|
531
|
-
url: string;
|
|
532
|
-
method?: AllowedHttpMethods;
|
|
533
|
-
payload?: string;
|
|
534
|
-
retryCount?: number;
|
|
535
|
-
errorMessages?: string[];
|
|
536
|
-
headers?: Record<string, string>;
|
|
537
|
-
userData?: Record<string, unknown>;
|
|
538
|
-
handledAt?: string;
|
|
539
|
-
noRetry?: boolean;
|
|
540
|
-
loadedUrl?: string;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Result of adding a request to the queue.
|
|
544
|
-
*/
|
|
545
|
-
export interface RequestQueueClientAddRequestResult {
|
|
546
|
-
requestId: string;
|
|
547
|
-
wasAlreadyPresent: boolean;
|
|
548
|
-
wasAlreadyHandled: boolean;
|
|
549
|
-
}
|
|
550
|
-
interface ProcessedRequest {
|
|
551
|
-
uniqueKey: string;
|
|
552
|
-
requestId: string;
|
|
553
|
-
wasAlreadyPresent: boolean;
|
|
554
|
-
wasAlreadyHandled: boolean;
|
|
555
|
-
}
|
|
556
|
-
interface UnprocessedRequest {
|
|
557
|
-
uniqueKey: string;
|
|
558
|
-
url: string;
|
|
559
|
-
method?: AllowedHttpMethods;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* @since Added in 2.12.5
|
|
563
|
-
*/
|
|
564
|
-
export interface RequestQueueClientUnlockRequestsResult {
|
|
565
|
-
unlockedCount: number;
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Result of a batch operation on requests.
|
|
569
|
-
*
|
|
570
|
-
* Contains lists of successfully processed and unprocessed requests.
|
|
571
|
-
* @since Added in 2.3.0
|
|
572
|
-
*/
|
|
573
|
-
export interface RequestQueueClientBatchRequestsOperationResult {
|
|
574
|
-
processedRequests: ProcessedRequest[];
|
|
575
|
-
unprocessedRequests: UnprocessedRequest[];
|
|
576
|
-
}
|
|
577
417
|
/**
|
|
578
418
|
* @since Added in 2.3.0
|
|
579
419
|
*/
|
|
580
420
|
export type RequestQueueClientRequestToDelete = Pick<RequestQueueClientRequestSchema, 'id'> | Pick<RequestQueueClientRequestSchema, 'uniqueKey'>;
|
|
581
|
-
export type RequestQueueClientGetRequestResult = Omit<RequestQueueClientListItem, 'retryCount'>;
|
|
582
421
|
/**
|
|
583
|
-
*
|
|
422
|
+
* Result of getting a single request from the queue.
|
|
423
|
+
*
|
|
424
|
+
* `GET /v2/request-queues/{queueId}/requests/{requestId}` answers with the whole request rather than
|
|
425
|
+
* a queue-head projection.
|
|
584
426
|
*/
|
|
585
|
-
export type
|
|
427
|
+
export type RequestQueueClientGetRequestResult = RequestQueueClientRequestSchema;
|
|
586
428
|
/**
|
|
587
429
|
* @since Added in 2.5.1
|
|
588
430
|
*/
|
|
589
431
|
export type RequestQueueRequestsAsyncIterable<T> = AsyncIterable<T>;
|
|
590
|
-
export {};
|
|
@@ -73,12 +73,12 @@ const paginateRequestsOptionsSchema = zod_1.z
|
|
|
73
73
|
* });
|
|
74
74
|
*
|
|
75
75
|
* // Get the next request from the queue
|
|
76
|
-
* const request = await queueClient.listHead();
|
|
76
|
+
* const { items: [request] } = await queueClient.listHead({ limit: 1 });
|
|
77
77
|
*
|
|
78
78
|
* // Mark request as handled
|
|
79
79
|
* await queueClient.updateRequest({
|
|
80
80
|
* id: request.id,
|
|
81
|
-
* handledAt: new Date()
|
|
81
|
+
* handledAt: new Date()
|
|
82
82
|
* });
|
|
83
83
|
* ```
|
|
84
84
|
*
|