apify-client 3.0.0-beta.4 → 3.0.0-beta.40
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 +13 -3
- package/dist/apify_api_error.d.ts +62 -21
- package/dist/apify_api_error.js +96 -23
- package/dist/apify_client.d.ts +125 -10
- package/dist/apify_client.js +133 -48
- package/dist/base/api_client.d.ts +7 -7
- package/dist/base/api_client.js +24 -16
- package/dist/base/resource_client.d.ts +23 -9
- package/dist/base/resource_client.js +57 -29
- package/dist/base/resource_collection_client.d.ts +8 -4
- package/dist/base/resource_collection_client.js +26 -15
- package/dist/body_parser.d.ts +3 -4
- package/dist/body_parser.js +19 -26
- package/dist/bundle.js +29 -22
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +887 -322
- package/dist/generated/schemas.d.ts +6717 -0
- package/dist/generated/schemas.js +1527 -0
- package/dist/http_clients/axios.d.ts +60 -0
- package/dist/http_clients/axios.js +117 -0
- package/dist/http_clients/base.d.ts +333 -0
- package/dist/http_clients/base.js +563 -0
- package/dist/http_clients/index.d.ts +4 -0
- package/dist/http_clients/index.js +2 -0
- package/dist/http_compressors/base.d.ts +40 -0
- package/dist/http_compressors/base.js +9 -0
- package/dist/http_compressors/brotli.d.ts +33 -0
- package/dist/http_compressors/brotli.js +39 -0
- package/dist/http_compressors/gzip.d.ts +33 -0
- package/dist/http_compressors/gzip.js +39 -0
- package/dist/http_compressors/index.d.ts +6 -0
- package/dist/http_compressors/index.js +2 -0
- package/dist/http_compressors/resolve.d.ts +23 -0
- package/dist/http_compressors/resolve.js +27 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -1
- package/dist/invalid_response_body_error.d.ts +13 -0
- package/dist/invalid_response_body_error.js +17 -0
- package/dist/lazy_schema.d.ts +8 -0
- package/dist/lazy_schema.js +11 -0
- package/dist/models.d.ts +33 -61
- package/dist/resource_clients/actor.d.ts +46 -31
- package/dist/resource_clients/actor.js +78 -58
- 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 +37 -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 +49 -31
- package/dist/resource_clients/dataset.js +102 -76
- package/dist/resource_clients/dataset_collection.d.ts +6 -2
- package/dist/resource_clients/dataset_collection.js +14 -2
- package/dist/resource_clients/key_value_store.d.ts +58 -16
- package/dist/resource_clients/key_value_store.js +80 -41
- package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
- package/dist/resource_clients/key_value_store_collection.js +14 -2
- package/dist/resource_clients/log.d.ts +11 -19
- package/dist/resource_clients/log.js +64 -46
- package/dist/resource_clients/request_queue.d.ts +56 -26
- package/dist/resource_clients/request_queue.js +197 -116
- 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 +52 -18
- package/dist/resource_clients/run.js +93 -47
- 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 +32 -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 +71 -46
- 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 +43 -39
- package/dist/resource_clients/webhook.d.ts +14 -5
- package/dist/resource_clients/webhook.js +31 -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 +49 -0
- package/dist/runtime/types.d.ts +52 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/web.d.ts +5 -0
- package/dist/runtime/web.js +18 -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 +84 -0
- package/dist/timeouts.js +37 -0
- package/dist/timezones.d.ts +1 -1
- package/dist/utils.d.ts +86 -46
- package/dist/utils.js +218 -164
- package/package.json +32 -29
- package/dist/http_client.d.ts +0 -88
- package/dist/http_client.js +0 -255
- package/dist/interceptors.d.ts +0 -19
- package/dist/interceptors.js +0 -105
|
@@ -1,5 +1,7 @@
|
|
|
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 { timeoutOptionsSchema, timeoutOptionsShape } from '../timeouts.js';
|
|
3
5
|
import { anyObjectSchema, paginationOptionsShape, parseArgument } from '../utils.js';
|
|
4
6
|
const actorCreateSchema = anyObjectSchema.optional();
|
|
5
7
|
/**
|
|
@@ -52,26 +54,32 @@ export class ActorCollectionClient extends ResourceCollectionClient {
|
|
|
52
54
|
* ```
|
|
53
55
|
*
|
|
54
56
|
* @param options - Pagination options.
|
|
57
|
+
* @param options.timeoutSecs - Timeout for each API request. Default is `'medium'`.
|
|
55
58
|
* @returns A paginated iterator of Actors.
|
|
56
59
|
* @see https://docs.apify.com/api/v2/acts-get
|
|
57
60
|
*/
|
|
58
61
|
list(options = {}) {
|
|
59
62
|
const parsed = parseArgument(options, listOptionsSchema, 'ActorCollectionListOptions');
|
|
60
|
-
return this.
|
|
63
|
+
return this.listResourcesPaginated(schemas.ListOfActors(), parsed, 'medium');
|
|
61
64
|
}
|
|
62
65
|
/**
|
|
63
66
|
* Creates a new Actor.
|
|
64
67
|
*
|
|
65
68
|
* @param actor - The Actor data.
|
|
69
|
+
* @param options - Request options
|
|
70
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'medium'`.
|
|
66
71
|
* @returns The created Actor object.
|
|
67
72
|
* @see https://docs.apify.com/api/v2/acts-post
|
|
68
73
|
*/
|
|
69
|
-
async create(actor) {
|
|
74
|
+
async create(actor, options = {}) {
|
|
70
75
|
parseArgument(actor, actorCreateSchema);
|
|
71
|
-
|
|
76
|
+
const { timeoutSecs = 'medium', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
77
|
+
return this.createResource(schemas.Actor(), actor, timeoutSecs, signal);
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
/**
|
|
81
|
+
* Field to order a list of Actors by.
|
|
82
|
+
*
|
|
75
83
|
* @since Added in 2.12.6
|
|
76
84
|
*/
|
|
77
85
|
export var ActorListSortBy;
|
|
@@ -85,4 +93,5 @@ const listOptionsSchema = z.strictObject({
|
|
|
85
93
|
...paginationOptionsShape,
|
|
86
94
|
desc: z.boolean().optional(),
|
|
87
95
|
sortBy: z.enum(ActorListSortBy).optional(),
|
|
96
|
+
...timeoutOptionsShape,
|
|
88
97
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
2
|
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import type { TimeoutOptions } from '../timeouts.js';
|
|
3
4
|
import type { ActorEnvironmentVariable } from './actor_version.js';
|
|
4
5
|
/**
|
|
5
6
|
* Client for managing a specific Actor environment variable.
|
|
@@ -32,22 +33,28 @@ export declare class ActorEnvVarClient extends ResourceClient {
|
|
|
32
33
|
/**
|
|
33
34
|
* Retrieves the environment variable.
|
|
34
35
|
*
|
|
36
|
+
* @param options - Request options
|
|
37
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
35
38
|
* @returns The environment variable object, or `undefined` if it does not exist.
|
|
36
39
|
* @see https://docs.apify.com/api/v2/act-version-env-var-get
|
|
37
40
|
*/
|
|
38
|
-
get(): Promise<ActorEnvironmentVariable | undefined>;
|
|
41
|
+
get(options?: TimeoutOptions): Promise<ActorEnvironmentVariable | undefined>;
|
|
39
42
|
/**
|
|
40
43
|
* Updates the environment variable.
|
|
41
44
|
*
|
|
42
45
|
* @param actorEnvVar - The updated environment variable data.
|
|
46
|
+
* @param options - Request options
|
|
47
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
43
48
|
* @returns The updated environment variable object.
|
|
44
49
|
* @see https://docs.apify.com/api/v2/act-version-env-var-put
|
|
45
50
|
*/
|
|
46
|
-
update(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable>;
|
|
51
|
+
update(actorEnvVar: ActorEnvironmentVariable, options?: TimeoutOptions): Promise<ActorEnvironmentVariable>;
|
|
47
52
|
/**
|
|
48
53
|
* Deletes the environment variable.
|
|
49
54
|
*
|
|
55
|
+
* @param options - Request options
|
|
56
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
50
57
|
* @see https://docs.apify.com/api/v2/act-version-env-var-delete
|
|
51
58
|
*/
|
|
52
|
-
delete(): Promise<void>;
|
|
59
|
+
delete(options?: TimeoutOptions): Promise<void>;
|
|
53
60
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ResourceClient } from '../base/resource_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
|
/**
|
|
4
6
|
* Client for managing a specific Actor environment variable.
|
|
@@ -36,29 +38,38 @@ export class ActorEnvVarClient extends ResourceClient {
|
|
|
36
38
|
/**
|
|
37
39
|
* Retrieves the environment variable.
|
|
38
40
|
*
|
|
41
|
+
* @param options - Request options
|
|
42
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
39
43
|
* @returns The environment variable object, or `undefined` if it does not exist.
|
|
40
44
|
* @see https://docs.apify.com/api/v2/act-version-env-var-get
|
|
41
45
|
*/
|
|
42
|
-
async get() {
|
|
43
|
-
|
|
46
|
+
async get(options = {}) {
|
|
47
|
+
const { timeoutSecs = 'short', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
48
|
+
return this.getResource(schemas.EnvVar(), {}, timeoutSecs, signal);
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* Updates the environment variable.
|
|
47
52
|
*
|
|
48
53
|
* @param actorEnvVar - The updated environment variable data.
|
|
54
|
+
* @param options - Request options
|
|
55
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
49
56
|
* @returns The updated environment variable object.
|
|
50
57
|
* @see https://docs.apify.com/api/v2/act-version-env-var-put
|
|
51
58
|
*/
|
|
52
|
-
async update(actorEnvVar) {
|
|
59
|
+
async update(actorEnvVar, options = {}) {
|
|
53
60
|
parseArgument(actorEnvVar, anyObjectSchema);
|
|
54
|
-
|
|
61
|
+
const { timeoutSecs = 'short', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
62
|
+
return this.updateResource(schemas.EnvVar(), actorEnvVar, timeoutSecs, signal);
|
|
55
63
|
}
|
|
56
64
|
/**
|
|
57
65
|
* Deletes the environment variable.
|
|
58
66
|
*
|
|
67
|
+
* @param options - Request options
|
|
68
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
59
69
|
* @see https://docs.apify.com/api/v2/act-version-env-var-delete
|
|
60
70
|
*/
|
|
61
|
-
async delete() {
|
|
62
|
-
|
|
71
|
+
async delete(options = {}) {
|
|
72
|
+
const { timeoutSecs = 'short', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
73
|
+
return this.deleteResource(timeoutSecs, signal);
|
|
63
74
|
}
|
|
64
75
|
}
|
|
@@ -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 { ActorEnvironmentVariable } from './actor_version.js';
|
|
5
6
|
/**
|
|
6
7
|
* Client for managing the collection of environment variables for an Actor version.
|
|
@@ -37,39 +38,34 @@ export declare class ActorEnvVarCollectionClient extends ResourceCollectionClien
|
|
|
37
38
|
/**
|
|
38
39
|
* Lists all environment variables of this Actor version.
|
|
39
40
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
41
|
+
* The endpoint returns every environment variable in one response, so awaiting the return value (as you would
|
|
42
|
+
* with a Promise) gets the whole list.
|
|
42
43
|
* ```javascript
|
|
43
|
-
* const
|
|
44
|
-
|
|
44
|
+
* const { items } = await client.list();
|
|
45
|
+
* ```
|
|
45
46
|
*
|
|
46
|
-
* Asynchronous iteration is also supported
|
|
47
|
-
* retrieved.
|
|
47
|
+
* Asynchronous iteration is also supported, and yields the environment variables one by one.
|
|
48
48
|
*
|
|
49
49
|
* ```javascript
|
|
50
50
|
* for await (const singleItem of client.list()) {...}
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
|
-
* @
|
|
53
|
+
* @param options - Request options
|
|
54
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
55
|
+
* @returns The environment variables, awaitable as a whole list or iterable one by one.
|
|
54
56
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-get
|
|
55
57
|
*/
|
|
56
|
-
list(
|
|
58
|
+
list(options?: TimeoutOptions): Promise<ActorEnvVarListResult> & AsyncIterable<ActorEnvironmentVariable>;
|
|
57
59
|
/**
|
|
58
60
|
* Creates a new environment variable for this Actor version.
|
|
59
61
|
*
|
|
60
62
|
* @param actorEnvVar - The environment variable data.
|
|
63
|
+
* @param options - Request options
|
|
64
|
+
* @param options.timeoutSecs - Timeout for the API request. Default is `'short'`.
|
|
61
65
|
* @returns The created environment variable object.
|
|
62
66
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-post
|
|
63
67
|
*/
|
|
64
|
-
create(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable>;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @deprecated No options are used in the current API implementation.
|
|
68
|
-
* https://github.com/apify/apify-client-js/issues/799
|
|
69
|
-
* @since Added in 2.1.0
|
|
70
|
-
*/
|
|
71
|
-
export interface ActorEnvVarCollectionListOptions extends PaginationOptions {
|
|
72
|
-
desc?: boolean;
|
|
68
|
+
create(actorEnvVar: ActorEnvironmentVariable, options?: TimeoutOptions): Promise<ActorEnvironmentVariable>;
|
|
73
69
|
}
|
|
74
70
|
/**
|
|
75
71
|
* @since Added in 2.1.0
|
|
@@ -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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
65
|
+
return this.listResourcesPaginated(schemas.ListOfEnvVars(), { signal }, 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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
79
|
+
return this.createResource(schemas.EnvVar(), actorEnvVar, timeoutSecs, signal);
|
|
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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
51
|
+
return this.getResource(schemas.Version(), {}, timeoutSecs, signal);
|
|
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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
65
|
+
return this.updateResource(schemas.Version(), newFields, timeoutSecs, signal);
|
|
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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
76
|
+
return this.deleteResource(timeoutSecs, signal);
|
|
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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
64
|
+
return this.listResourcesPaginated(schemas.ListOfVersions(), { signal }, 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', signal } = parseArgument(options, timeoutOptionsSchema, 'TimeoutOptions');
|
|
78
|
+
return this.createResource(schemas.Version(), actorVersion, timeoutSecs, signal);
|
|
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
|