apify-client 3.0.0-beta.14 → 3.0.0-beta.16
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.js +23 -7
- 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 +24 -16
- 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 +13 -13
- package/dist/bundle.js.map +1 -1
- package/dist/http_client.d.ts +34 -13
- package/dist/http_client.js +58 -28
- 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 +65 -37
- 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 +4 -1
- package/dist/resource_clients/log.js +15 -6
- package/dist/resource_clients/request_queue.d.ts +52 -18
- package/dist/resource_clients/request_queue.js +114 -60
- 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/timeouts.d.ts +72 -0
- package/dist/timeouts.js +31 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +10 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ResourceClient } from '../base/resource_client.js';
|
|
3
3
|
import * as schemas from '../schemas.js';
|
|
4
|
+
import { timeoutOptionsSchema } from '../timeouts.js';
|
|
4
5
|
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
5
6
|
import { ActorEnvVarClient } from './actor_env_var.js';
|
|
6
7
|
import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
|
|
@@ -40,30 +41,39 @@ export class ActorVersionClient extends ResourceClient {
|
|
|
40
41
|
/**
|
|
41
42
|
* Retrieves the Actor version.
|
|
42
43
|
*
|
|
44
|
+
* @param options - Request options
|
|
45
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
43
46
|
* @returns The Actor version object, or `undefined` if it does not exist.
|
|
44
47
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
45
48
|
*/
|
|
46
|
-
async get() {
|
|
47
|
-
|
|
49
|
+
async get(options = {}) {
|
|
50
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
51
|
+
return this.getResource(schemas.Version(), {}, timeoutSecs);
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* Updates the Actor version with the specified fields.
|
|
51
55
|
*
|
|
52
56
|
* @param newFields - Fields to update.
|
|
57
|
+
* @param options - Request options
|
|
58
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
53
59
|
* @returns The updated Actor version object.
|
|
54
60
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
55
61
|
*/
|
|
56
|
-
async update(newFields) {
|
|
62
|
+
async update(newFields, options = {}) {
|
|
57
63
|
parseArgument(newFields, anyObjectSchema);
|
|
58
|
-
|
|
64
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
65
|
+
return this.updateResource(schemas.Version(), newFields, timeoutSecs);
|
|
59
66
|
}
|
|
60
67
|
/**
|
|
61
68
|
* Deletes the Actor version.
|
|
62
69
|
*
|
|
70
|
+
* @param options - Request options
|
|
71
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
63
72
|
* @see https://docs.apify.com/api/v2/act-version-delete
|
|
64
73
|
*/
|
|
65
|
-
async delete() {
|
|
66
|
-
|
|
74
|
+
async delete(options = {}) {
|
|
75
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
76
|
+
return this.deleteResource(timeoutSecs);
|
|
67
77
|
}
|
|
68
78
|
/**
|
|
69
79
|
* Returns a client for the specified environment variable of this Actor version.
|
|
@@ -75,7 +85,7 @@ export class ActorVersionClient extends ResourceClient {
|
|
|
75
85
|
*/
|
|
76
86
|
envVar(envVarName) {
|
|
77
87
|
parseArgument(envVarName, envVarNameSchema);
|
|
78
|
-
return new ActorEnvVarClient(this.
|
|
88
|
+
return new ActorEnvVarClient(this.subResourceOptions({
|
|
79
89
|
id: envVarName,
|
|
80
90
|
}));
|
|
81
91
|
}
|
|
@@ -87,6 +97,6 @@ export class ActorVersionClient extends ResourceClient {
|
|
|
87
97
|
* @since Added in 2.1.0
|
|
88
98
|
*/
|
|
89
99
|
envVars() {
|
|
90
|
-
return new ActorEnvVarCollectionClient(this.
|
|
100
|
+
return new ActorEnvVarCollectionClient(this.subResourceOptions());
|
|
91
101
|
}
|
|
92
102
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
2
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
3
4
|
import type { PaginatedList } from '../utils.js';
|
|
4
5
|
import type { ActorVersion, FinalActorVersion } from './actor_version.js';
|
|
5
6
|
/**
|
|
@@ -48,17 +49,21 @@ export declare class ActorVersionCollectionClient extends ResourceCollectionClie
|
|
|
48
49
|
* for await (const singleItem of client.list()) {...}
|
|
49
50
|
* ```
|
|
50
51
|
*
|
|
52
|
+
* @param options - Request options
|
|
53
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
51
54
|
* @returns The Actor versions, awaitable as a whole list or iterable one by one.
|
|
52
55
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
53
56
|
*/
|
|
54
|
-
list(): Promise<ActorVersionListResult> & AsyncIterable<FinalActorVersion>;
|
|
57
|
+
list(options?: TimeoutOptions): Promise<ActorVersionListResult> & AsyncIterable<FinalActorVersion>;
|
|
55
58
|
/**
|
|
56
59
|
* Creates a new Actor version.
|
|
57
60
|
*
|
|
58
61
|
* @param actorVersion - The Actor version data.
|
|
62
|
+
* @param options - Request options
|
|
63
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
59
64
|
* @returns The created Actor version object.
|
|
60
65
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
61
66
|
*/
|
|
62
|
-
create(actorVersion: ActorVersion): Promise<FinalActorVersion>;
|
|
67
|
+
create(actorVersion: ActorVersion, options?: TimeoutOptions): Promise<FinalActorVersion>;
|
|
63
68
|
}
|
|
64
69
|
export type ActorVersionListResult = Pick<PaginatedList<FinalActorVersion>, 'total' | 'items'>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
2
|
import * as schemas from '../schemas.js';
|
|
3
|
+
import { timeoutOptionsSchema } from '../timeouts.js';
|
|
3
4
|
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
4
5
|
const actorVersionSchema = anyObjectSchema.optional();
|
|
5
6
|
/**
|
|
@@ -53,21 +54,27 @@ export class ActorVersionCollectionClient extends ResourceCollectionClient {
|
|
|
53
54
|
* for await (const singleItem of client.list()) {...}
|
|
54
55
|
* ```
|
|
55
56
|
*
|
|
57
|
+
* @param options - Request options
|
|
58
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
56
59
|
* @returns The Actor versions, awaitable as a whole list or iterable one by one.
|
|
57
60
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
58
61
|
*/
|
|
59
|
-
list() {
|
|
60
|
-
|
|
62
|
+
list(options = {}) {
|
|
63
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
64
|
+
return this.listResourcesPaginated(schemas.ListOfVersions(), {}, timeoutSecs);
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* Creates a new Actor version.
|
|
64
68
|
*
|
|
65
69
|
* @param actorVersion - The Actor version data.
|
|
70
|
+
* @param options - Request options
|
|
71
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
66
72
|
* @returns The created Actor version object.
|
|
67
73
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
68
74
|
*/
|
|
69
|
-
async create(actorVersion) {
|
|
75
|
+
async create(actorVersion, options = {}) {
|
|
70
76
|
parseArgument(actorVersion, actorVersionSchema);
|
|
71
|
-
|
|
77
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
78
|
+
return this.createResource(schemas.Version(), actorVersion, timeoutSecs);
|
|
72
79
|
}
|
|
73
80
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
2
|
import { ResourceClient } from '../base/resource_client.js';
|
|
3
3
|
import type { Build } from '../models.js';
|
|
4
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
4
5
|
import { LogClient } from './log.js';
|
|
5
6
|
export type { Build, BuildMeta, BuildOptions, BuildStats, BuildUsage } from '../models.js';
|
|
6
7
|
/**
|
|
@@ -36,6 +37,8 @@ export declare class BuildClient extends ResourceClient {
|
|
|
36
37
|
*
|
|
37
38
|
* @param options - Get options
|
|
38
39
|
* @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately).
|
|
40
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
|
|
41
|
+
* when the API is asked to hold the response.
|
|
39
42
|
* @returns The Build object, or `undefined` if it does not exist
|
|
40
43
|
* @see https://docs.apify.com/api/v2/actor-build-get
|
|
41
44
|
*
|
|
@@ -55,6 +58,8 @@ export declare class BuildClient extends ResourceClient {
|
|
|
55
58
|
*
|
|
56
59
|
* Stops the build process immediately. The build will have an `ABORTED` status.
|
|
57
60
|
*
|
|
61
|
+
* @param options - Request options
|
|
62
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
58
63
|
* @returns The updated Build object with `ABORTED` status
|
|
59
64
|
* @see https://docs.apify.com/api/v2/actor-build-abort-post
|
|
60
65
|
*
|
|
@@ -63,22 +68,26 @@ export declare class BuildClient extends ResourceClient {
|
|
|
63
68
|
* await client.build('build-id').abort();
|
|
64
69
|
* ```
|
|
65
70
|
*/
|
|
66
|
-
abort(): Promise<Build>;
|
|
71
|
+
abort(options?: TimeoutOptions): Promise<Build>;
|
|
67
72
|
/**
|
|
68
73
|
* Deletes the Actor build.
|
|
69
74
|
*
|
|
75
|
+
* @param options - Request options
|
|
76
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
70
77
|
* @see https://docs.apify.com/api/v2/actor-build-delete
|
|
71
78
|
* @since Added in 2.8.1
|
|
72
79
|
*/
|
|
73
|
-
delete(): Promise<void>;
|
|
80
|
+
delete(options?: TimeoutOptions): Promise<void>;
|
|
74
81
|
/**
|
|
75
82
|
* Retrieves the OpenAPI definition for the Actor build.
|
|
76
83
|
*
|
|
84
|
+
* @param options - Request options
|
|
85
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
77
86
|
* @returns The OpenAPI definition object.
|
|
78
87
|
* @see https://docs.apify.com/api/v2/actor-build-openapi-json-get
|
|
79
88
|
* @since Added in 2.11.2
|
|
80
89
|
*/
|
|
81
|
-
getOpenApiDefinition(): Promise<OpenApiDefinition>;
|
|
90
|
+
getOpenApiDefinition(options?: TimeoutOptions): Promise<OpenApiDefinition>;
|
|
82
91
|
/**
|
|
83
92
|
* Waits for the Actor build to finish and returns the finished Build object.
|
|
84
93
|
*
|
|
@@ -94,7 +103,8 @@ export declare class BuildClient extends ResourceClient {
|
|
|
94
103
|
*
|
|
95
104
|
* @param options - Wait options
|
|
96
105
|
* @param options.waitSecs - Maximum time to wait for the build to finish, in seconds. If omitted, waits indefinitely.
|
|
97
|
-
* @
|
|
106
|
+
* @param options.timeoutSecs - Timeout for each polling API request. Default is `'noTimeout'`.
|
|
107
|
+
* @returns The Build object (finished or still building if the timeout was reached)
|
|
98
108
|
*
|
|
99
109
|
* @example
|
|
100
110
|
* ```javascript
|
|
@@ -131,13 +141,13 @@ export declare class BuildClient extends ResourceClient {
|
|
|
131
141
|
/**
|
|
132
142
|
* Options for getting a Build.
|
|
133
143
|
*/
|
|
134
|
-
export interface BuildClientGetOptions {
|
|
144
|
+
export interface BuildClientGetOptions extends TimeoutOptions {
|
|
135
145
|
waitForFinish?: number;
|
|
136
146
|
}
|
|
137
147
|
/**
|
|
138
148
|
* Options for waiting for a Build to finish.
|
|
139
149
|
*/
|
|
140
|
-
export interface BuildClientWaitForFinishOptions {
|
|
150
|
+
export interface BuildClientWaitForFinishOptions extends TimeoutOptions {
|
|
141
151
|
/**
|
|
142
152
|
* Maximum time to wait for the build to finish, in seconds.
|
|
143
153
|
* If the limit is reached, the returned promise is resolved to a build object that will have
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ResourceClient } from '../base/resource_client.js';
|
|
3
3
|
import * as schemas from '../schemas.js';
|
|
4
|
+
import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
|
|
4
5
|
import { parseArgument, parseResponse } from '../utils.js';
|
|
5
6
|
import { LogClient } from './log.js';
|
|
6
|
-
const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional() });
|
|
7
|
-
const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional() });
|
|
7
|
+
const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional(), ...timeoutOptionsShape });
|
|
8
|
+
const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional(), ...timeoutOptionsShape });
|
|
8
9
|
/**
|
|
9
10
|
* Client for managing a specific Actor build.
|
|
10
11
|
*
|
|
@@ -43,6 +44,8 @@ export class BuildClient extends ResourceClient {
|
|
|
43
44
|
*
|
|
44
45
|
* @param options - Get options
|
|
45
46
|
* @param options.waitForFinish - Maximum time to wait (in seconds, max 60s) for the build to finish on the API side before returning. Default is 0 (returns immediately).
|
|
47
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`, extended to cover `waitForFinish`
|
|
48
|
+
* when the API is asked to hold the response.
|
|
46
49
|
* @returns The Build object, or `undefined` if it does not exist
|
|
47
50
|
* @see https://docs.apify.com/api/v2/actor-build-get
|
|
48
51
|
*
|
|
@@ -57,14 +60,16 @@ export class BuildClient extends ResourceClient {
|
|
|
57
60
|
* ```
|
|
58
61
|
*/
|
|
59
62
|
async get(options = {}) {
|
|
60
|
-
const
|
|
61
|
-
return this.
|
|
63
|
+
const { timeoutSecs, ...params } = parseArgument(options, getOptionsSchema, 'BuildClientGetOptions');
|
|
64
|
+
return this.getResource(schemas.Build(), params, this.timeoutForWaitForFinish(timeoutSecs, 'short', params.waitForFinish));
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
64
67
|
* Aborts the Actor build.
|
|
65
68
|
*
|
|
66
69
|
* Stops the build process immediately. The build will have an `ABORTED` status.
|
|
67
70
|
*
|
|
71
|
+
* @param options - Request options
|
|
72
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
68
73
|
* @returns The updated Build object with `ABORTED` status
|
|
69
74
|
* @see https://docs.apify.com/api/v2/actor-build-abort-post
|
|
70
75
|
*
|
|
@@ -73,35 +78,44 @@ export class BuildClient extends ResourceClient {
|
|
|
73
78
|
* await client.build('build-id').abort();
|
|
74
79
|
* ```
|
|
75
80
|
*/
|
|
76
|
-
async abort() {
|
|
81
|
+
async abort(options = {}) {
|
|
82
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
77
83
|
const response = await this.httpClient.call({
|
|
78
|
-
url: this.
|
|
84
|
+
url: this.buildUrl('abort'),
|
|
79
85
|
method: 'POST',
|
|
80
|
-
params: this.
|
|
86
|
+
params: this.buildParams(),
|
|
87
|
+
timeoutSecs,
|
|
81
88
|
});
|
|
82
89
|
return parseResponse(response, schemas.Build());
|
|
83
90
|
}
|
|
84
91
|
/**
|
|
85
92
|
* Deletes the Actor build.
|
|
86
93
|
*
|
|
94
|
+
* @param options - Request options
|
|
95
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
87
96
|
* @see https://docs.apify.com/api/v2/actor-build-delete
|
|
88
97
|
* @since Added in 2.8.1
|
|
89
98
|
*/
|
|
90
|
-
async delete() {
|
|
91
|
-
|
|
99
|
+
async delete(options = {}) {
|
|
100
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
101
|
+
return this.deleteResource(timeoutSecs);
|
|
92
102
|
}
|
|
93
103
|
/**
|
|
94
104
|
* Retrieves the OpenAPI definition for the Actor build.
|
|
95
105
|
*
|
|
106
|
+
* @param options - Request options
|
|
107
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
96
108
|
* @returns The OpenAPI definition object.
|
|
97
109
|
* @see https://docs.apify.com/api/v2/actor-build-openapi-json-get
|
|
98
110
|
* @since Added in 2.11.2
|
|
99
111
|
*/
|
|
100
|
-
async getOpenApiDefinition() {
|
|
112
|
+
async getOpenApiDefinition(options = {}) {
|
|
113
|
+
const { timeoutSecs = 'medium' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
101
114
|
const response = await this.httpClient.call({
|
|
102
|
-
url: this.
|
|
115
|
+
url: this.buildUrl('openapi.json'),
|
|
103
116
|
method: 'GET',
|
|
104
|
-
params: this.
|
|
117
|
+
params: this.buildParams(),
|
|
118
|
+
timeoutSecs,
|
|
105
119
|
});
|
|
106
120
|
return response.data;
|
|
107
121
|
}
|
|
@@ -120,7 +134,8 @@ export class BuildClient extends ResourceClient {
|
|
|
120
134
|
*
|
|
121
135
|
* @param options - Wait options
|
|
122
136
|
* @param options.waitSecs - Maximum time to wait for the build to finish, in seconds. If omitted, waits indefinitely.
|
|
123
|
-
* @
|
|
137
|
+
* @param options.timeoutSecs - Timeout for each polling API request. Default is `'noTimeout'`.
|
|
138
|
+
* @returns The Build object (finished or still building if the timeout was reached)
|
|
124
139
|
*
|
|
125
140
|
* @example
|
|
126
141
|
* ```javascript
|
|
@@ -137,7 +152,7 @@ export class BuildClient extends ResourceClient {
|
|
|
137
152
|
*/
|
|
138
153
|
async waitForFinish(options = {}) {
|
|
139
154
|
const parsed = parseArgument(options, waitForFinishOptionsSchema, 'BuildClientWaitForFinishOptions');
|
|
140
|
-
return this.
|
|
155
|
+
return this.waitForJobFinish(schemas.Build(), parsed);
|
|
141
156
|
}
|
|
142
157
|
/**
|
|
143
158
|
* Returns a client for accessing the log of this Actor build.
|
|
@@ -156,7 +171,7 @@ export class BuildClient extends ResourceClient {
|
|
|
156
171
|
* @since Added in 2.9.0
|
|
157
172
|
*/
|
|
158
173
|
log() {
|
|
159
|
-
return new LogClient(this.
|
|
174
|
+
return new LogClient(this.subResourceOptions({
|
|
160
175
|
resourcePath: 'log',
|
|
161
176
|
}));
|
|
162
177
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_client.js';
|
|
2
2
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
3
|
import type { BuildCollectionClientListItem } from '../models.js';
|
|
4
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
4
5
|
import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils.js';
|
|
5
6
|
export type { BuildCollectionClientListItem } from '../models.js';
|
|
6
7
|
/**
|
|
@@ -46,12 +47,13 @@ export declare class BuildCollectionClient extends ResourceCollectionClient {
|
|
|
46
47
|
* ```
|
|
47
48
|
*
|
|
48
49
|
* @param options - Pagination and sorting options.
|
|
50
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
|
|
49
51
|
* @returns A paginated iterator of Actor builds.
|
|
50
52
|
* @see https://docs.apify.com/api/v2/actor-builds-get
|
|
51
53
|
*/
|
|
52
54
|
list(options?: BuildCollectionClientListOptions): PaginatedIterator<BuildCollectionClientListItem>;
|
|
53
55
|
}
|
|
54
|
-
export interface BuildCollectionClientListOptions extends PaginationOptions {
|
|
56
|
+
export interface BuildCollectionClientListOptions extends PaginationOptions, TimeoutOptions {
|
|
55
57
|
desc?: boolean;
|
|
56
58
|
}
|
|
57
59
|
export type BuildCollectionClientListResult = PaginatedList<BuildCollectionClientListItem>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
3
|
import * as schemas from '../schemas.js';
|
|
4
|
+
import { timeoutOptionsShape } from '../timeouts.js';
|
|
4
5
|
import { paginationOptionsShape, parseArgument } from '../utils.js';
|
|
5
6
|
const listOptionsSchema = z.strictObject({
|
|
6
7
|
...paginationOptionsShape,
|
|
7
8
|
desc: z.boolean().optional(),
|
|
9
|
+
...timeoutOptionsShape,
|
|
8
10
|
});
|
|
9
11
|
/**
|
|
10
12
|
* Client for managing the collection of Actor builds.
|
|
@@ -54,11 +56,12 @@ export class BuildCollectionClient extends ResourceCollectionClient {
|
|
|
54
56
|
* ```
|
|
55
57
|
*
|
|
56
58
|
* @param options - Pagination and sorting options.
|
|
59
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
|
|
57
60
|
* @returns A paginated iterator of Actor builds.
|
|
58
61
|
* @see https://docs.apify.com/api/v2/actor-builds-get
|
|
59
62
|
*/
|
|
60
63
|
list(options = {}) {
|
|
61
64
|
const parsed = parseArgument(options, listOptionsSchema, 'BuildCollectionClientListOptions');
|
|
62
|
-
return this.
|
|
65
|
+
return this.listResourcesPaginated(schemas.ListOfBuilds(), parsed, 'medium');
|
|
63
66
|
}
|
|
64
67
|
}
|
|
@@ -2,6 +2,7 @@ import type { STORAGE_GENERAL_ACCESS } from '@apify/consts';
|
|
|
2
2
|
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
3
3
|
import { ResourceClient } from '../base/resource_client.js';
|
|
4
4
|
import type { Dataset, DatasetStatistics } from '../models.js';
|
|
5
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
5
6
|
import type { PaginatedIterator, PaginationOptions } from '../utils.js';
|
|
6
7
|
export type { Dataset, DatasetStatistics, DatasetStats, FieldStatistics } from '../models.js';
|
|
7
8
|
/**
|
|
@@ -41,24 +42,30 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
41
42
|
/**
|
|
42
43
|
* Gets the dataset object from the Apify API.
|
|
43
44
|
*
|
|
45
|
+
* @param options - Request options
|
|
46
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
44
47
|
* @returns The Dataset object, or `undefined` if it does not exist
|
|
45
48
|
* @see https://docs.apify.com/api/v2/dataset-get
|
|
46
49
|
*/
|
|
47
|
-
get(): Promise<Dataset | undefined>;
|
|
50
|
+
get(options?: TimeoutOptions): Promise<Dataset | undefined>;
|
|
48
51
|
/**
|
|
49
52
|
* Updates the dataset with specified fields.
|
|
50
53
|
*
|
|
51
54
|
* @param newFields - Fields to update in the dataset
|
|
55
|
+
* @param options - Request options
|
|
56
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
52
57
|
* @returns The updated Dataset object
|
|
53
58
|
* @see https://docs.apify.com/api/v2/dataset-put
|
|
54
59
|
*/
|
|
55
|
-
update(newFields: DatasetClientUpdateOptions): Promise<Dataset>;
|
|
60
|
+
update(newFields: DatasetClientUpdateOptions, options?: TimeoutOptions): Promise<Dataset>;
|
|
56
61
|
/**
|
|
57
62
|
* Deletes the dataset.
|
|
58
63
|
*
|
|
64
|
+
* @param options - Request options
|
|
65
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
59
66
|
* @see https://docs.apify.com/api/v2/dataset-delete
|
|
60
67
|
*/
|
|
61
|
-
delete(): Promise<void>;
|
|
68
|
+
delete(options?: TimeoutOptions): Promise<void>;
|
|
62
69
|
/**
|
|
63
70
|
* Lists items in the dataset.
|
|
64
71
|
*
|
|
@@ -79,6 +86,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
79
86
|
* @param options.flatten - Array of field names to flatten. Nested objects are converted to dot notation (e.g., `obj.field`).
|
|
80
87
|
* @param options.unwind - Field name or array of field names to unwind. Each array value creates a separate item.
|
|
81
88
|
* @param options.view - Name of a predefined view to use for field selection.
|
|
89
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'long'`.
|
|
82
90
|
* @returns A paginated list with `items`, `total` count, `offset`, `count`, and `limit`
|
|
83
91
|
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
84
92
|
*
|
|
@@ -121,6 +129,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
121
129
|
* @param options.xmlRow - Name of the XML element for each item. Default is `'item'`.
|
|
122
130
|
* @param options.fields - Array of field names to include in the export.
|
|
123
131
|
* @param options.omit - Array of field names to exclude from the export.
|
|
132
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'long'`.
|
|
124
133
|
* @returns Buffer containing the serialized data in the specified format
|
|
125
134
|
* @see https://docs.apify.com/api/v2/dataset-items-get
|
|
126
135
|
*
|
|
@@ -155,6 +164,8 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
155
164
|
*
|
|
156
165
|
* @param items - A single item (object or string) or an array of items to store.
|
|
157
166
|
* Objects are automatically stringified to JSON. Strings are stored as-is.
|
|
167
|
+
* @param options - Request options
|
|
168
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
158
169
|
* @see https://docs.apify.com/api/v2/dataset-items-post
|
|
159
170
|
*
|
|
160
171
|
* @example
|
|
@@ -177,18 +188,20 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
177
188
|
* await client.dataset('my-dataset').pushItems(['item1', 'item2', 'item3']);
|
|
178
189
|
* ```
|
|
179
190
|
*/
|
|
180
|
-
pushItems(items: Data | Data[] | string | string[]): Promise<void>;
|
|
191
|
+
pushItems(items: Data | Data[] | string | string[], options?: TimeoutOptions): Promise<void>;
|
|
181
192
|
/**
|
|
182
193
|
* Gets statistical information about the dataset.
|
|
183
194
|
*
|
|
184
195
|
* Returns statistics for each field in the dataset, including information about
|
|
185
196
|
* data types, null counts, and value ranges.
|
|
186
197
|
*
|
|
198
|
+
* @param options - Request options
|
|
199
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
187
200
|
* @returns Dataset statistics
|
|
188
201
|
* @see https://docs.apify.com/api/v2/dataset-statistics-get
|
|
189
202
|
* @since Added in 2.11.2
|
|
190
203
|
*/
|
|
191
|
-
getStatistics(): Promise<DatasetStatistics>;
|
|
204
|
+
getStatistics(options?: TimeoutOptions): Promise<DatasetStatistics>;
|
|
192
205
|
/**
|
|
193
206
|
* Generates a public URL for accessing dataset items.
|
|
194
207
|
*
|
|
@@ -201,6 +214,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
201
214
|
* @param options.fields - Array of field names to include in the response.
|
|
202
215
|
* @param options.limit - Maximum number of items to return.
|
|
203
216
|
* @param options.offset - Number of items to skip.
|
|
217
|
+
* @param options.timeoutSecs - Timeout for the API request that fetches the dataset. Default is `'long'`.
|
|
204
218
|
* @returns A public URL string for accessing the dataset items
|
|
205
219
|
*
|
|
206
220
|
* @example
|
|
@@ -222,7 +236,7 @@ export declare class DatasetClient<Data extends Record<string | number, any> = R
|
|
|
222
236
|
* @since Added in 2.13.0
|
|
223
237
|
*/
|
|
224
238
|
createItemsPublicUrl(options?: DatasetClientCreateItemsUrlOptions): Promise<string>;
|
|
225
|
-
private
|
|
239
|
+
private createPaginationList;
|
|
226
240
|
}
|
|
227
241
|
/**
|
|
228
242
|
* Options for updating a dataset.
|
|
@@ -244,7 +258,7 @@ export interface DatasetClientUpdateOptions {
|
|
|
244
258
|
* Provides various filtering, pagination, and transformation options to customize
|
|
245
259
|
* the output format and content of retrieved items.
|
|
246
260
|
*/
|
|
247
|
-
export interface DatasetClientListItemOptions extends PaginationOptions {
|
|
261
|
+
export interface DatasetClientListItemOptions extends PaginationOptions, TimeoutOptions {
|
|
248
262
|
clean?: boolean;
|
|
249
263
|
desc?: boolean;
|
|
250
264
|
/**
|