apify-client 3.0.0-beta.2 → 3.0.0-beta.21
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/README.md +7 -3
- package/dist/apify_api_error.d.ts +60 -19
- package/dist/apify_api_error.js +88 -22
- package/dist/apify_client.d.ts +22 -3
- package/dist/apify_client.js +37 -31
- package/dist/base/api_client.d.ts +6 -6
- package/dist/base/api_client.js +24 -16
- package/dist/base/resource_client.d.ts +23 -9
- package/dist/base/resource_client.js +49 -25
- package/dist/base/resource_collection_client.d.ts +7 -4
- package/dist/base/resource_collection_client.js +21 -15
- package/dist/body_parser.d.ts +3 -4
- package/dist/body_parser.js +17 -24
- package/dist/bundle.js +38 -48
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +287 -214
- package/dist/generated/schemas.d.ts +6699 -0
- package/dist/generated/schemas.js +1521 -0
- package/dist/http_client.d.ts +18 -51
- package/dist/http_client.js +90 -85
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/interceptors.js +24 -6
- package/dist/lazy_schema.d.ts +8 -0
- package/dist/lazy_schema.js +11 -0
- package/dist/models.d.ts +32 -52
- package/dist/resource_clients/actor.d.ts +46 -31
- package/dist/resource_clients/actor.js +71 -53
- package/dist/resource_clients/actor_collection.d.ts +9 -5
- package/dist/resource_clients/actor_collection.js +12 -3
- package/dist/resource_clients/actor_env_var.d.ts +10 -3
- package/dist/resource_clients/actor_env_var.js +17 -6
- package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
- package/dist/resource_clients/actor_env_var_collection.js +18 -11
- package/dist/resource_clients/actor_version.d.ts +18 -3
- package/dist/resource_clients/actor_version.js +20 -9
- package/dist/resource_clients/actor_version_collection.d.ts +16 -17
- package/dist/resource_clients/actor_version_collection.js +20 -11
- package/dist/resource_clients/build.d.ts +18 -6
- package/dist/resource_clients/build.js +35 -17
- package/dist/resource_clients/build_collection.d.ts +3 -1
- package/dist/resource_clients/build_collection.js +5 -1
- package/dist/resource_clients/dataset.d.ts +23 -9
- package/dist/resource_clients/dataset.js +70 -48
- package/dist/resource_clients/dataset_collection.d.ts +6 -2
- package/dist/resource_clients/dataset_collection.js +13 -2
- package/dist/resource_clients/key_value_store.d.ts +48 -15
- package/dist/resource_clients/key_value_store.js +71 -40
- package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
- package/dist/resource_clients/key_value_store_collection.js +13 -2
- package/dist/resource_clients/log.d.ts +9 -19
- package/dist/resource_clients/log.js +57 -45
- package/dist/resource_clients/request_queue.d.ts +56 -26
- package/dist/resource_clients/request_queue.js +178 -113
- package/dist/resource_clients/request_queue_collection.d.ts +6 -2
- package/dist/resource_clients/request_queue_collection.js +10 -3
- package/dist/resource_clients/run.d.ts +51 -17
- package/dist/resource_clients/run.js +85 -44
- package/dist/resource_clients/run_collection.d.ts +3 -1
- package/dist/resource_clients/run_collection.js +5 -1
- package/dist/resource_clients/schedule.d.ts +16 -7
- package/dist/resource_clients/schedule.js +31 -21
- package/dist/resource_clients/schedule_collection.d.ts +6 -2
- package/dist/resource_clients/schedule_collection.js +10 -3
- package/dist/resource_clients/store_collection.d.ts +3 -1
- package/dist/resource_clients/store_collection.js +5 -1
- package/dist/resource_clients/task.d.ts +28 -10
- package/dist/resource_clients/task.js +67 -44
- package/dist/resource_clients/task_collection.d.ts +6 -2
- package/dist/resource_clients/task_collection.js +10 -3
- package/dist/resource_clients/user.d.ts +17 -8
- package/dist/resource_clients/user.js +40 -39
- package/dist/resource_clients/webhook.d.ts +14 -5
- package/dist/resource_clients/webhook.js +30 -22
- package/dist/resource_clients/webhook_collection.d.ts +6 -2
- package/dist/resource_clients/webhook_collection.js +10 -3
- package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
- package/dist/resource_clients/webhook_dispatch.js +8 -2
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
- package/dist/resource_clients/webhook_dispatch_collection.js +5 -1
- package/dist/response_validation_error.d.ts +26 -0
- package/dist/response_validation_error.js +37 -0
- package/dist/runtime/node.d.ts +6 -0
- package/dist/runtime/node.js +58 -0
- package/dist/runtime/types.d.ts +50 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/web.d.ts +5 -0
- package/dist/runtime/web.js +17 -0
- package/dist/schemas.d.ts +15 -0
- package/dist/schemas.js +15 -0
- 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 +75 -55
- package/dist/utils.js +201 -180
- package/package.json +42 -35
- package/dist/argument_validation_error.d.ts +0 -17
- package/dist/argument_validation_error.js +0 -153
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
|
+
import * as schemas from '../schemas.js';
|
|
3
|
+
import { timeoutOptionsSchema } from '../timeouts.js';
|
|
2
4
|
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
3
5
|
const actorEnvVarSchema = anyObjectSchema.optional();
|
|
4
6
|
/**
|
|
@@ -41,34 +43,39 @@ export class ActorEnvVarCollectionClient extends ResourceCollectionClient {
|
|
|
41
43
|
/**
|
|
42
44
|
* Lists all environment variables of this Actor version.
|
|
43
45
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
+
* The endpoint returns every environment variable in one response, so awaiting the return value (as you would
|
|
47
|
+
* with a Promise) gets the whole list.
|
|
46
48
|
* ```javascript
|
|
47
|
-
* const
|
|
48
|
-
|
|
49
|
+
* const { items } = await client.list();
|
|
50
|
+
* ```
|
|
49
51
|
*
|
|
50
|
-
* Asynchronous iteration is also supported
|
|
51
|
-
* retrieved.
|
|
52
|
+
* Asynchronous iteration is also supported, and yields the environment variables one by one.
|
|
52
53
|
*
|
|
53
54
|
* ```javascript
|
|
54
55
|
* for await (const singleItem of client.list()) {...}
|
|
55
56
|
* ```
|
|
56
57
|
*
|
|
57
|
-
* @
|
|
58
|
+
* @param options - Request options
|
|
59
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
60
|
+
* @returns The environment variables, awaitable as a whole list or iterable one by one.
|
|
58
61
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-get
|
|
59
62
|
*/
|
|
60
|
-
list(
|
|
61
|
-
|
|
63
|
+
list(options = {}) {
|
|
64
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
65
|
+
return this.listResourcesPaginated(schemas.ListOfEnvVars(), {}, timeoutSecs);
|
|
62
66
|
}
|
|
63
67
|
/**
|
|
64
68
|
* Creates a new environment variable for this Actor version.
|
|
65
69
|
*
|
|
66
70
|
* @param actorEnvVar - The environment variable data.
|
|
71
|
+
* @param options - Request options
|
|
72
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
67
73
|
* @returns The created environment variable object.
|
|
68
74
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-post
|
|
69
75
|
*/
|
|
70
|
-
async create(actorEnvVar) {
|
|
76
|
+
async create(actorEnvVar, options = {}) {
|
|
71
77
|
parseArgument(actorEnvVar, actorEnvVarSchema);
|
|
72
|
-
|
|
78
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
79
|
+
return this.createResource(schemas.EnvVar(), actorEnvVar, timeoutSecs);
|
|
73
80
|
}
|
|
74
81
|
}
|
|
@@ -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 { ActorVersion, FinalActorVersion } from '../models.js';
|
|
4
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
4
5
|
import { ActorEnvVarClient } from './actor_env_var.js';
|
|
5
6
|
import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
|
|
6
7
|
export type { ActorEnvironmentVariable, ActorVersion, ActorVersionGitHubGist, ActorVersionGitRepo, ActorVersionSourceCode, ActorVersionSourceFile, ActorVersionSourceFiles, ActorVersionSourceFolder, ActorVersionTarball, BaseActorVersion, FinalActorVersion, } from '../models.js';
|
|
@@ -34,24 +35,30 @@ export declare class ActorVersionClient extends ResourceClient {
|
|
|
34
35
|
/**
|
|
35
36
|
* Retrieves the Actor version.
|
|
36
37
|
*
|
|
38
|
+
* @param options - Request options
|
|
39
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
37
40
|
* @returns The Actor version object, or `undefined` if it does not exist.
|
|
38
41
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
39
42
|
*/
|
|
40
|
-
get(): Promise<FinalActorVersion | undefined>;
|
|
43
|
+
get(options?: TimeoutOptions): Promise<FinalActorVersion | undefined>;
|
|
41
44
|
/**
|
|
42
45
|
* Updates the Actor version with the specified fields.
|
|
43
46
|
*
|
|
44
47
|
* @param newFields - Fields to update.
|
|
48
|
+
* @param options - Request options
|
|
49
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
45
50
|
* @returns The updated Actor version object.
|
|
46
51
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
47
52
|
*/
|
|
48
|
-
update(newFields:
|
|
53
|
+
update(newFields: ActorVersionUpdateData, options?: TimeoutOptions): Promise<FinalActorVersion>;
|
|
49
54
|
/**
|
|
50
55
|
* Deletes the Actor version.
|
|
51
56
|
*
|
|
57
|
+
* @param options - Request options
|
|
58
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
52
59
|
* @see https://docs.apify.com/api/v2/act-version-delete
|
|
53
60
|
*/
|
|
54
|
-
delete(): Promise<void>;
|
|
61
|
+
delete(options?: TimeoutOptions): Promise<void>;
|
|
55
62
|
/**
|
|
56
63
|
* Returns a client for the specified environment variable of this Actor version.
|
|
57
64
|
*
|
|
@@ -70,3 +77,11 @@ export declare class ActorVersionClient extends ResourceClient {
|
|
|
70
77
|
*/
|
|
71
78
|
envVars(): ActorEnvVarCollectionClient;
|
|
72
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Fields that can be changed on an existing Actor version.
|
|
82
|
+
*
|
|
83
|
+
* All of them are optional, because the endpoint leaves untouched whatever the payload does not
|
|
84
|
+
* mention. The version union enforces the pairing: a `sourceType` can only be sent next to the
|
|
85
|
+
* source location it implies, never next to one of the other three.
|
|
86
|
+
*/
|
|
87
|
+
export type ActorVersionUpdateData = Partial<ActorVersion>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import * as schemas from '../schemas.js';
|
|
4
|
+
import { timeoutOptionsSchema } from '../timeouts.js';
|
|
3
5
|
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
4
6
|
import { ActorEnvVarClient } from './actor_env_var.js';
|
|
5
7
|
import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
|
|
6
|
-
const envVarNameSchema = z.string();
|
|
8
|
+
const envVarNameSchema = z.string().min(1);
|
|
7
9
|
export { ActorSourceType } from '../models.js';
|
|
8
10
|
/**
|
|
9
11
|
* Client for managing a specific Actor version.
|
|
@@ -39,30 +41,39 @@ export class ActorVersionClient extends ResourceClient {
|
|
|
39
41
|
/**
|
|
40
42
|
* Retrieves the Actor version.
|
|
41
43
|
*
|
|
44
|
+
* @param options - Request options
|
|
45
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
42
46
|
* @returns The Actor version object, or `undefined` if it does not exist.
|
|
43
47
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
44
48
|
*/
|
|
45
|
-
async get() {
|
|
46
|
-
|
|
49
|
+
async get(options = {}) {
|
|
50
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
51
|
+
return this.getResource(schemas.Version(), {}, timeoutSecs);
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
54
|
* Updates the Actor version with the specified fields.
|
|
50
55
|
*
|
|
51
56
|
* @param newFields - Fields to update.
|
|
57
|
+
* @param options - Request options
|
|
58
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
52
59
|
* @returns The updated Actor version object.
|
|
53
60
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
54
61
|
*/
|
|
55
|
-
async update(newFields) {
|
|
62
|
+
async update(newFields, options = {}) {
|
|
56
63
|
parseArgument(newFields, anyObjectSchema);
|
|
57
|
-
|
|
64
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
65
|
+
return this.updateResource(schemas.Version(), newFields, timeoutSecs);
|
|
58
66
|
}
|
|
59
67
|
/**
|
|
60
68
|
* Deletes the Actor version.
|
|
61
69
|
*
|
|
70
|
+
* @param options - Request options
|
|
71
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
62
72
|
* @see https://docs.apify.com/api/v2/act-version-delete
|
|
63
73
|
*/
|
|
64
|
-
async delete() {
|
|
65
|
-
|
|
74
|
+
async delete(options = {}) {
|
|
75
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
76
|
+
return this.deleteResource(timeoutSecs);
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
79
|
* Returns a client for the specified environment variable of this Actor version.
|
|
@@ -74,7 +85,7 @@ export class ActorVersionClient extends ResourceClient {
|
|
|
74
85
|
*/
|
|
75
86
|
envVar(envVarName) {
|
|
76
87
|
parseArgument(envVarName, envVarNameSchema);
|
|
77
|
-
return new ActorEnvVarClient(this.
|
|
88
|
+
return new ActorEnvVarClient(this.subResourceOptions({
|
|
78
89
|
id: envVarName,
|
|
79
90
|
}));
|
|
80
91
|
}
|
|
@@ -86,6 +97,6 @@ export class ActorVersionClient extends ResourceClient {
|
|
|
86
97
|
* @since Added in 2.1.0
|
|
87
98
|
*/
|
|
88
99
|
envVars() {
|
|
89
|
-
return new ActorEnvVarCollectionClient(this.
|
|
100
|
+
return new ActorEnvVarCollectionClient(this.subResourceOptions());
|
|
90
101
|
}
|
|
91
102
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
2
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
4
|
+
import type { PaginatedList } from '../utils.js';
|
|
4
5
|
import type { ActorVersion, FinalActorVersion } from './actor_version.js';
|
|
5
6
|
/**
|
|
6
7
|
* Client for managing the collection of Actor versions.
|
|
@@ -20,6 +21,8 @@ import type { ActorVersion, FinalActorVersion } from './actor_version.js';
|
|
|
20
21
|
* // Create a new version
|
|
21
22
|
* const newVersion = await versionsClient.create({
|
|
22
23
|
* versionNumber: '0.2',
|
|
24
|
+
* sourceType: 'GIT_REPO',
|
|
25
|
+
* gitRepoUrl: 'https://github.com/my-account/my-actor',
|
|
23
26
|
* buildTag: 'latest'
|
|
24
27
|
* });
|
|
25
28
|
* ```
|
|
@@ -34,37 +37,33 @@ export declare class ActorVersionCollectionClient extends ResourceCollectionClie
|
|
|
34
37
|
/**
|
|
35
38
|
* Lists all Actor versions.
|
|
36
39
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
40
|
+
* The endpoint returns every version in one response, so awaiting the return value (as you would with a Promise)
|
|
41
|
+
* gets the whole list.
|
|
39
42
|
* ```javascript
|
|
40
|
-
* const
|
|
41
|
-
|
|
43
|
+
* const { items } = await client.list();
|
|
44
|
+
* ```
|
|
42
45
|
*
|
|
43
|
-
* Asynchronous iteration is also supported
|
|
44
|
-
* retrieved.
|
|
46
|
+
* Asynchronous iteration is also supported, and yields the versions one by one.
|
|
45
47
|
*
|
|
46
48
|
* ```javascript
|
|
47
49
|
* for await (const singleItem of client.list()) {...}
|
|
48
50
|
* ```
|
|
49
51
|
*
|
|
50
|
-
* @
|
|
52
|
+
* @param options - Request options
|
|
53
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
54
|
+
* @returns The Actor versions, awaitable as a whole list or iterable one by one.
|
|
51
55
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
52
56
|
*/
|
|
53
|
-
list(
|
|
57
|
+
list(options?: TimeoutOptions): Promise<ActorVersionListResult> & AsyncIterable<FinalActorVersion>;
|
|
54
58
|
/**
|
|
55
59
|
* Creates a new Actor version.
|
|
56
60
|
*
|
|
57
61
|
* @param actorVersion - The Actor version data.
|
|
62
|
+
* @param options - Request options
|
|
63
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
58
64
|
* @returns The created Actor version object.
|
|
59
65
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
60
66
|
*/
|
|
61
|
-
create(actorVersion: ActorVersion): Promise<FinalActorVersion>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated No options are used in the current API implementation.
|
|
65
|
-
* https://github.com/apify/apify-client-js/issues/799
|
|
66
|
-
*/
|
|
67
|
-
export interface ActorVersionCollectionListOptions extends PaginationOptions {
|
|
68
|
-
desc?: boolean;
|
|
67
|
+
create(actorVersion: ActorVersion, options?: TimeoutOptions): Promise<FinalActorVersion>;
|
|
69
68
|
}
|
|
70
69
|
export type ActorVersionListResult = Pick<PaginatedList<FinalActorVersion>, 'total' | 'items'>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
|
+
import * as schemas from '../schemas.js';
|
|
3
|
+
import { timeoutOptionsSchema } from '../timeouts.js';
|
|
2
4
|
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
3
5
|
const actorVersionSchema = anyObjectSchema.optional();
|
|
4
6
|
/**
|
|
@@ -19,6 +21,8 @@ const actorVersionSchema = anyObjectSchema.optional();
|
|
|
19
21
|
* // Create a new version
|
|
20
22
|
* const newVersion = await versionsClient.create({
|
|
21
23
|
* versionNumber: '0.2',
|
|
24
|
+
* sourceType: 'GIT_REPO',
|
|
25
|
+
* gitRepoUrl: 'https://github.com/my-account/my-actor',
|
|
22
26
|
* buildTag: 'latest'
|
|
23
27
|
* });
|
|
24
28
|
* ```
|
|
@@ -38,34 +42,39 @@ export class ActorVersionCollectionClient extends ResourceCollectionClient {
|
|
|
38
42
|
/**
|
|
39
43
|
* Lists all Actor versions.
|
|
40
44
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
45
|
+
* The endpoint returns every version in one response, so awaiting the return value (as you would with a Promise)
|
|
46
|
+
* gets the whole list.
|
|
43
47
|
* ```javascript
|
|
44
|
-
* const
|
|
45
|
-
|
|
48
|
+
* const { items } = await client.list();
|
|
49
|
+
* ```
|
|
46
50
|
*
|
|
47
|
-
* Asynchronous iteration is also supported
|
|
48
|
-
* retrieved.
|
|
51
|
+
* Asynchronous iteration is also supported, and yields the versions one by one.
|
|
49
52
|
*
|
|
50
53
|
* ```javascript
|
|
51
54
|
* for await (const singleItem of client.list()) {...}
|
|
52
55
|
* ```
|
|
53
56
|
*
|
|
54
|
-
* @
|
|
57
|
+
* @param options - Request options
|
|
58
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
59
|
+
* @returns The Actor versions, awaitable as a whole list or iterable one by one.
|
|
55
60
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
56
61
|
*/
|
|
57
|
-
list(
|
|
58
|
-
|
|
62
|
+
list(options = {}) {
|
|
63
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
64
|
+
return this.listResourcesPaginated(schemas.ListOfVersions(), {}, timeoutSecs);
|
|
59
65
|
}
|
|
60
66
|
/**
|
|
61
67
|
* Creates a new Actor version.
|
|
62
68
|
*
|
|
63
69
|
* @param actorVersion - The Actor version data.
|
|
70
|
+
* @param options - Request options
|
|
71
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
64
72
|
* @returns The created Actor version object.
|
|
65
73
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
66
74
|
*/
|
|
67
|
-
async create(actorVersion) {
|
|
75
|
+
async create(actorVersion, options = {}) {
|
|
68
76
|
parseArgument(actorVersion, actorVersionSchema);
|
|
69
|
-
|
|
77
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
78
|
+
return this.createResource(schemas.Version(), actorVersion, timeoutSecs);
|
|
70
79
|
}
|
|
71
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
|
|
@@ -113,6 +123,8 @@ export declare class BuildClient extends ResourceClient {
|
|
|
113
123
|
/**
|
|
114
124
|
* Returns a client for accessing the log of this Actor build.
|
|
115
125
|
*
|
|
126
|
+
* A 404 from this client throws an `ApifyApiError`, since the build itself may be what is missing.
|
|
127
|
+
*
|
|
116
128
|
* @returns A client for accessing the build's log
|
|
117
129
|
* @see https://docs.apify.com/api/v2/actor-build-log-get
|
|
118
130
|
*
|
|
@@ -129,13 +141,13 @@ export declare class BuildClient extends ResourceClient {
|
|
|
129
141
|
/**
|
|
130
142
|
* Options for getting a Build.
|
|
131
143
|
*/
|
|
132
|
-
export interface BuildClientGetOptions {
|
|
144
|
+
export interface BuildClientGetOptions extends TimeoutOptions {
|
|
133
145
|
waitForFinish?: number;
|
|
134
146
|
}
|
|
135
147
|
/**
|
|
136
148
|
* Options for waiting for a Build to finish.
|
|
137
149
|
*/
|
|
138
|
-
export interface BuildClientWaitForFinishOptions {
|
|
150
|
+
export interface BuildClientWaitForFinishOptions extends TimeoutOptions {
|
|
139
151
|
/**
|
|
140
152
|
* Maximum time to wait for the build to finish, in seconds.
|
|
141
153
|
* If the limit is reached, the returned promise is resolved to a build object that will have
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
-
import
|
|
3
|
+
import * as schemas from '../schemas.js';
|
|
4
|
+
import { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
|
|
5
|
+
import { parseArgument, parseResponse } from '../utils.js';
|
|
4
6
|
import { LogClient } from './log.js';
|
|
5
|
-
const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional() });
|
|
6
|
-
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 });
|
|
7
9
|
/**
|
|
8
10
|
* Client for managing a specific Actor build.
|
|
9
11
|
*
|
|
@@ -42,6 +44,8 @@ export class BuildClient extends ResourceClient {
|
|
|
42
44
|
*
|
|
43
45
|
* @param options - Get options
|
|
44
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.
|
|
45
49
|
* @returns The Build object, or `undefined` if it does not exist
|
|
46
50
|
* @see https://docs.apify.com/api/v2/actor-build-get
|
|
47
51
|
*
|
|
@@ -56,14 +60,16 @@ export class BuildClient extends ResourceClient {
|
|
|
56
60
|
* ```
|
|
57
61
|
*/
|
|
58
62
|
async get(options = {}) {
|
|
59
|
-
const
|
|
60
|
-
return this.
|
|
63
|
+
const { timeoutSecs, ...params } = parseArgument(options, getOptionsSchema, 'BuildClientGetOptions');
|
|
64
|
+
return this.getResource(schemas.Build(), params, this.timeoutForWaitForFinish(timeoutSecs, 'short', params.waitForFinish));
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* Aborts the Actor build.
|
|
64
68
|
*
|
|
65
69
|
* Stops the build process immediately. The build will have an `ABORTED` status.
|
|
66
70
|
*
|
|
71
|
+
* @param options - Request options
|
|
72
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
67
73
|
* @returns The updated Build object with `ABORTED` status
|
|
68
74
|
* @see https://docs.apify.com/api/v2/actor-build-abort-post
|
|
69
75
|
*
|
|
@@ -72,35 +78,44 @@ export class BuildClient extends ResourceClient {
|
|
|
72
78
|
* await client.build('build-id').abort();
|
|
73
79
|
* ```
|
|
74
80
|
*/
|
|
75
|
-
async abort() {
|
|
81
|
+
async abort(options = {}) {
|
|
82
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
76
83
|
const response = await this.httpClient.call({
|
|
77
|
-
url: this.
|
|
84
|
+
url: this.buildUrl('abort'),
|
|
78
85
|
method: 'POST',
|
|
79
|
-
params: this.
|
|
86
|
+
params: this.buildParams(),
|
|
87
|
+
timeoutSecs,
|
|
80
88
|
});
|
|
81
|
-
return
|
|
89
|
+
return parseResponse(response, schemas.Build());
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
84
92
|
* Deletes the Actor build.
|
|
85
93
|
*
|
|
94
|
+
* @param options - Request options
|
|
95
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
86
96
|
* @see https://docs.apify.com/api/v2/actor-build-delete
|
|
87
97
|
* @since Added in 2.8.1
|
|
88
98
|
*/
|
|
89
|
-
async delete() {
|
|
90
|
-
|
|
99
|
+
async delete(options = {}) {
|
|
100
|
+
const { timeoutSecs = 'short' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
101
|
+
return this.deleteResource(timeoutSecs);
|
|
91
102
|
}
|
|
92
103
|
/**
|
|
93
104
|
* Retrieves the OpenAPI definition for the Actor build.
|
|
94
105
|
*
|
|
106
|
+
* @param options - Request options
|
|
107
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
95
108
|
* @returns The OpenAPI definition object.
|
|
96
109
|
* @see https://docs.apify.com/api/v2/actor-build-openapi-json-get
|
|
97
110
|
* @since Added in 2.11.2
|
|
98
111
|
*/
|
|
99
|
-
async getOpenApiDefinition() {
|
|
112
|
+
async getOpenApiDefinition(options = {}) {
|
|
113
|
+
const { timeoutSecs = 'medium' } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
100
114
|
const response = await this.httpClient.call({
|
|
101
|
-
url: this.
|
|
115
|
+
url: this.buildUrl('openapi.json'),
|
|
102
116
|
method: 'GET',
|
|
103
|
-
params: this.
|
|
117
|
+
params: this.buildParams(),
|
|
118
|
+
timeoutSecs,
|
|
104
119
|
});
|
|
105
120
|
return response.data;
|
|
106
121
|
}
|
|
@@ -119,7 +134,8 @@ export class BuildClient extends ResourceClient {
|
|
|
119
134
|
*
|
|
120
135
|
* @param options - Wait options
|
|
121
136
|
* @param options.waitSecs - Maximum time to wait for the build to finish, in seconds. If omitted, waits indefinitely.
|
|
122
|
-
* @
|
|
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)
|
|
123
139
|
*
|
|
124
140
|
* @example
|
|
125
141
|
* ```javascript
|
|
@@ -136,11 +152,13 @@ export class BuildClient extends ResourceClient {
|
|
|
136
152
|
*/
|
|
137
153
|
async waitForFinish(options = {}) {
|
|
138
154
|
const parsed = parseArgument(options, waitForFinishOptionsSchema, 'BuildClientWaitForFinishOptions');
|
|
139
|
-
return this.
|
|
155
|
+
return this.waitForJobFinish(schemas.Build(), parsed);
|
|
140
156
|
}
|
|
141
157
|
/**
|
|
142
158
|
* Returns a client for accessing the log of this Actor build.
|
|
143
159
|
*
|
|
160
|
+
* A 404 from this client throws an `ApifyApiError`, since the build itself may be what is missing.
|
|
161
|
+
*
|
|
144
162
|
* @returns A client for accessing the build's log
|
|
145
163
|
* @see https://docs.apify.com/api/v2/actor-build-log-get
|
|
146
164
|
*
|
|
@@ -153,7 +171,7 @@ export class BuildClient extends ResourceClient {
|
|
|
153
171
|
* @since Added in 2.9.0
|
|
154
172
|
*/
|
|
155
173
|
log() {
|
|
156
|
-
return new LogClient(this.
|
|
174
|
+
return new LogClient(this.subResourceOptions({
|
|
157
175
|
resourcePath: 'log',
|
|
158
176
|
}));
|
|
159
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,9 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import * as schemas from '../schemas.js';
|
|
4
|
+
import { timeoutOptionsShape } from '../timeouts.js';
|
|
3
5
|
import { paginationOptionsShape, parseArgument } from '../utils.js';
|
|
4
6
|
const listOptionsSchema = z.strictObject({
|
|
5
7
|
...paginationOptionsShape,
|
|
6
8
|
desc: z.boolean().optional(),
|
|
9
|
+
...timeoutOptionsShape,
|
|
7
10
|
});
|
|
8
11
|
/**
|
|
9
12
|
* Client for managing the collection of Actor builds.
|
|
@@ -53,11 +56,12 @@ export class BuildCollectionClient extends ResourceCollectionClient {
|
|
|
53
56
|
* ```
|
|
54
57
|
*
|
|
55
58
|
* @param options - Pagination and sorting options.
|
|
59
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
|
|
56
60
|
* @returns A paginated iterator of Actor builds.
|
|
57
61
|
* @see https://docs.apify.com/api/v2/actor-builds-get
|
|
58
62
|
*/
|
|
59
63
|
list(options = {}) {
|
|
60
64
|
const parsed = parseArgument(options, listOptionsSchema, 'BuildCollectionClientListOptions');
|
|
61
|
-
return this.
|
|
65
|
+
return this.listResourcesPaginated(schemas.ListOfBuilds(), parsed, 'medium');
|
|
62
66
|
}
|
|
63
67
|
}
|