apify-client 3.0.0-beta.15 → 3.0.0-beta.17
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_api_error.d.ts +4 -19
- package/dist/apify_api_error.js +16 -15
- package/dist/apify_client.d.ts +22 -3
- package/dist/apify_client.js +35 -29
- package/dist/base/api_client.d.ts +6 -6
- package/dist/base/api_client.js +11 -10
- package/dist/base/resource_client.d.ts +13 -8
- package/dist/base/resource_client.js +35 -19
- package/dist/base/resource_collection_client.d.ts +6 -4
- package/dist/base/resource_collection_client.js +17 -11
- package/dist/bundle.js +12 -12
- package/dist/bundle.js.map +1 -1
- package/dist/http_client.d.ts +18 -51
- package/dist/http_client.js +67 -38
- package/dist/index.d.ts +1 -0
- package/dist/resource_clients/actor.d.ts +26 -11
- package/dist/resource_clients/actor.js +62 -33
- package/dist/resource_clients/actor_collection.d.ts +6 -2
- package/dist/resource_clients/actor_collection.js +9 -3
- package/dist/resource_clients/actor_env_var.d.ts +10 -3
- package/dist/resource_clients/actor_env_var.js +16 -6
- package/dist/resource_clients/actor_env_var_collection.d.ts +7 -2
- package/dist/resource_clients/actor_env_var_collection.js +11 -4
- package/dist/resource_clients/actor_version.d.ts +10 -3
- package/dist/resource_clients/actor_version.js +18 -8
- package/dist/resource_clients/actor_version_collection.d.ts +7 -2
- package/dist/resource_clients/actor_version_collection.js +11 -4
- package/dist/resource_clients/build.d.ts +16 -6
- package/dist/resource_clients/build.js +30 -15
- package/dist/resource_clients/build_collection.d.ts +3 -1
- package/dist/resource_clients/build_collection.js +4 -1
- package/dist/resource_clients/dataset.d.ts +21 -7
- package/dist/resource_clients/dataset.js +56 -34
- package/dist/resource_clients/dataset_collection.d.ts +6 -2
- package/dist/resource_clients/dataset_collection.js +12 -2
- package/dist/resource_clients/key_value_store.d.ts +31 -11
- package/dist/resource_clients/key_value_store.js +58 -34
- package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
- package/dist/resource_clients/key_value_store_collection.js +12 -2
- package/dist/resource_clients/log.d.ts +5 -17
- package/dist/resource_clients/log.js +46 -37
- package/dist/resource_clients/request_queue.d.ts +47 -19
- package/dist/resource_clients/request_queue.js +127 -73
- package/dist/resource_clients/request_queue_collection.d.ts +6 -2
- package/dist/resource_clients/request_queue_collection.js +9 -3
- package/dist/resource_clients/run.d.ts +33 -13
- package/dist/resource_clients/run.js +65 -35
- package/dist/resource_clients/run_collection.d.ts +3 -1
- package/dist/resource_clients/run_collection.js +4 -1
- package/dist/resource_clients/schedule.d.ts +13 -4
- package/dist/resource_clients/schedule.js +23 -9
- package/dist/resource_clients/schedule_collection.d.ts +6 -2
- package/dist/resource_clients/schedule_collection.js +9 -3
- package/dist/resource_clients/store_collection.d.ts +3 -1
- package/dist/resource_clients/store_collection.js +4 -1
- package/dist/resource_clients/task.d.ts +27 -9
- package/dist/resource_clients/task.js +60 -31
- package/dist/resource_clients/task_collection.d.ts +6 -2
- package/dist/resource_clients/task_collection.js +9 -3
- package/dist/resource_clients/user.d.ts +14 -5
- package/dist/resource_clients/user.js +30 -14
- package/dist/resource_clients/webhook.d.ts +13 -4
- package/dist/resource_clients/webhook.js +24 -10
- package/dist/resource_clients/webhook_collection.d.ts +6 -2
- package/dist/resource_clients/webhook_collection.js +9 -3
- package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
- package/dist/resource_clients/webhook_dispatch.js +7 -2
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
- package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
- package/dist/statistics.d.ts +1 -6
- package/dist/statistics.js +2 -2
- package/dist/timeouts.d.ts +72 -0
- package/dist/timeouts.js +31 -0
- package/dist/utils.d.ts +1 -4
- package/dist/utils.js +14 -14
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { z } from 'zod';
|
|
2
|
+
import type { Timeout, TimeoutOptions } from '../timeouts.js';
|
|
2
3
|
import type { PaginatedResponse, PaginationOptions } from '../utils.js';
|
|
3
4
|
import { ApiClient } from './api_client.js';
|
|
4
5
|
/**
|
|
@@ -9,11 +10,12 @@ export declare class ResourceCollectionClient extends ApiClient {
|
|
|
9
10
|
/**
|
|
10
11
|
* @private
|
|
11
12
|
*/
|
|
12
|
-
protected
|
|
13
|
+
protected listResources<T, R>(schema: z.ZodType, options: T | undefined, timeoutSecs: Timeout): Promise<R>;
|
|
13
14
|
/**
|
|
14
15
|
* Returns async iterator to iterate through all items and Promise that can be awaited to get first page of results.
|
|
16
|
+
* `defaultTimeoutSecs` applies to every page request unless `options.timeoutSecs` overrides it.
|
|
15
17
|
*/
|
|
16
|
-
protected
|
|
17
|
-
protected
|
|
18
|
-
protected
|
|
18
|
+
protected listResourcesPaginated<T extends PaginationOptions & TimeoutOptions, Data, R extends PaginatedResponse<Data>>(schema: z.ZodType, options: T, defaultTimeoutSecs: Timeout): AsyncIterable<Data> & Promise<R>;
|
|
19
|
+
protected createResource<D, R>(schema: z.ZodType, resource: D, timeoutSecs: Timeout): Promise<R>;
|
|
20
|
+
protected getOrCreateResource<D, R>(schema: z.ZodType, name: string | undefined, resource: D | undefined, timeoutSecs: Timeout): Promise<R>;
|
|
19
21
|
}
|
|
@@ -8,35 +8,41 @@ export class ResourceCollectionClient extends ApiClient {
|
|
|
8
8
|
/**
|
|
9
9
|
* @private
|
|
10
10
|
*/
|
|
11
|
-
async
|
|
11
|
+
async listResources(schema, options, timeoutSecs) {
|
|
12
12
|
const response = await this.httpClient.call({
|
|
13
|
-
url: this.
|
|
13
|
+
url: this.buildUrl(),
|
|
14
14
|
method: 'GET',
|
|
15
|
-
params: this.
|
|
15
|
+
params: this.buildParams(options),
|
|
16
|
+
timeoutSecs,
|
|
16
17
|
});
|
|
17
18
|
return parseResponse(response, schema);
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Returns async iterator to iterate through all items and Promise that can be awaited to get first page of results.
|
|
22
|
+
* `defaultTimeoutSecs` applies to every page request unless `options.timeoutSecs` overrides it.
|
|
21
23
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
listResourcesPaginated(schema, options, defaultTimeoutSecs) {
|
|
25
|
+
// `timeoutSecs` only times the page requests; it is not an API parameter, so it must not reach the query string.
|
|
26
|
+
const { timeoutSecs = defaultTimeoutSecs, ...listOptions } = options;
|
|
27
|
+
return this.listPaginatedFromCallback(async (pageOptions) => this.listResources(schema, pageOptions, timeoutSecs), listOptions);
|
|
24
28
|
}
|
|
25
|
-
async
|
|
29
|
+
async createResource(schema, resource, timeoutSecs) {
|
|
26
30
|
const response = await this.httpClient.call({
|
|
27
|
-
url: this.
|
|
31
|
+
url: this.buildUrl(),
|
|
28
32
|
method: 'POST',
|
|
29
|
-
params: this.
|
|
33
|
+
params: this.buildParams(),
|
|
30
34
|
data: resource,
|
|
35
|
+
timeoutSecs,
|
|
31
36
|
});
|
|
32
37
|
return parseResponse(response, schema);
|
|
33
38
|
}
|
|
34
|
-
async
|
|
39
|
+
async getOrCreateResource(schema, name, resource, timeoutSecs) {
|
|
35
40
|
const response = await this.httpClient.call({
|
|
36
|
-
url: this.
|
|
41
|
+
url: this.buildUrl(),
|
|
37
42
|
method: 'POST',
|
|
38
|
-
params: this.
|
|
43
|
+
params: this.buildParams({ name }),
|
|
39
44
|
data: resource,
|
|
45
|
+
timeoutSecs,
|
|
40
46
|
});
|
|
41
47
|
return parseResponse(response, schema);
|
|
42
48
|
}
|