apify-client 3.0.0-beta.1 → 3.0.0-beta.11
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 +5 -3
- package/dist/apify_api_error.d.ts +59 -3
- package/dist/apify_api_error.js +71 -11
- package/dist/apify_client.d.ts +27 -27
- package/dist/apify_client.js +86 -91
- package/dist/base/api_client.d.ts +3 -3
- package/dist/base/api_client.js +6 -10
- package/dist/base/resource_client.d.ts +13 -4
- package/dist/base/resource_client.js +25 -21
- package/dist/base/resource_collection_client.d.ts +7 -6
- package/dist/base/resource_collection_client.js +11 -15
- package/dist/body_parser.js +6 -11
- package/dist/bundle.js +38 -48
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +287 -214
- package/dist/generated/api.js +1 -2
- package/dist/generated/schemas.d.ts +6699 -0
- package/dist/generated/schemas.js +1521 -0
- package/dist/http_client.d.ts +2 -2
- package/dist/http_client.js +23 -28
- package/dist/index.d.ts +33 -32
- package/dist/index.js +32 -36
- package/dist/interceptors.d.ts +1 -1
- package/dist/interceptors.js +14 -19
- package/dist/lazy_schema.d.ts +8 -0
- package/dist/lazy_schema.js +11 -0
- package/dist/models.d.ts +33 -52
- package/dist/models.js +8 -11
- package/dist/resource_clients/actor.d.ts +13 -13
- package/dist/resource_clients/actor.js +70 -73
- package/dist/resource_clients/actor_collection.d.ts +10 -10
- package/dist/resource_clients/actor_collection.js +19 -20
- package/dist/resource_clients/actor_env_var.d.ts +3 -3
- package/dist/resource_clients/actor_env_var.js +7 -10
- package/dist/resource_clients/actor_env_var_collection.d.ts +11 -20
- package/dist/resource_clients/actor_env_var_collection.js +15 -19
- package/dist/resource_clients/actor_version.d.ts +16 -8
- package/dist/resource_clients/actor_version.js +15 -19
- package/dist/resource_clients/actor_version_collection.d.ts +13 -19
- package/dist/resource_clients/actor_version_collection.js +17 -19
- package/dist/resource_clients/build.d.ts +7 -5
- package/dist/resource_clients/build.js +16 -17
- package/dist/resource_clients/build_collection.d.ts +5 -5
- package/dist/resource_clients/build_collection.js +10 -13
- package/dist/resource_clients/dataset.d.ts +8 -8
- package/dist/resource_clients/dataset.js +75 -85
- package/dist/resource_clients/dataset_collection.d.ts +4 -4
- package/dist/resource_clients/dataset_collection.js +18 -21
- package/dist/resource_clients/key_value_store.d.ts +16 -8
- package/dist/resource_clients/key_value_store.js +61 -65
- package/dist/resource_clients/key_value_store_collection.d.ts +4 -4
- package/dist/resource_clients/key_value_store_collection.js +18 -21
- package/dist/resource_clients/log.d.ts +6 -4
- package/dist/resource_clients/log.js +23 -28
- package/dist/resource_clients/request_queue.d.ts +4 -11
- package/dist/resource_clients/request_queue.js +100 -106
- package/dist/resource_clients/request_queue_collection.d.ts +4 -4
- package/dist/resource_clients/request_queue_collection.js +16 -19
- package/dist/resource_clients/run.d.ts +18 -8
- package/dist/resource_clients/run.js +62 -54
- package/dist/resource_clients/run_collection.d.ts +4 -4
- package/dist/resource_clients/run_collection.js +15 -18
- package/dist/resource_clients/schedule.d.ts +8 -8
- package/dist/resource_clients/schedule.js +14 -23
- package/dist/resource_clients/schedule_collection.d.ts +4 -4
- package/dist/resource_clients/schedule_collection.js +13 -16
- package/dist/resource_clients/store_collection.d.ts +5 -5
- package/dist/resource_clients/store_collection.js +15 -18
- package/dist/resource_clients/task.d.ts +11 -11
- package/dist/resource_clients/task.js +49 -59
- package/dist/resource_clients/task_collection.d.ts +6 -6
- package/dist/resource_clients/task_collection.js +12 -15
- package/dist/resource_clients/user.d.ts +11 -11
- package/dist/resource_clients/user.js +16 -35
- package/dist/resource_clients/webhook.d.ts +8 -8
- package/dist/resource_clients/webhook.js +13 -23
- package/dist/resource_clients/webhook_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_collection.js +13 -16
- package/dist/resource_clients/webhook_dispatch.d.ts +5 -5
- package/dist/resource_clients/webhook_dispatch.js +5 -9
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_dispatch_collection.js +10 -13
- package/dist/response_validation_error.d.ts +26 -0
- package/dist/response_validation_error.js +37 -0
- package/dist/schemas.d.ts +15 -0
- package/dist/schemas.js +15 -0
- package/dist/statistics.js +5 -9
- package/dist/timezones.js +1 -2
- package/dist/utils.d.ts +27 -24
- package/dist/utils.js +69 -93
- package/package.json +38 -40
- package/dist/argument_validation_error.d.ts +0 -17
- package/dist/argument_validation_error.js +0 -157
- package/dist/index.mjs +0 -42
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ACTOR_PERMISSION_LEVEL } from '@apify/consts';
|
|
2
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
3
|
-
import { ResourceCollectionClient } from '../base/resource_collection_client';
|
|
4
|
-
import type { ActorCollectionListItem } from '../models';
|
|
5
|
-
import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils';
|
|
6
|
-
import type { Actor, ActorDefaultRunOptions, ActorExampleRunInput, ActorStandby } from './actor';
|
|
7
|
-
import type { ActorVersion } from './actor_version';
|
|
8
|
-
export type { ActorCollectionListItem } from '../models';
|
|
2
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
3
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
4
|
+
import type { ActorCollectionListItem } from '../models.js';
|
|
5
|
+
import type { PaginatedIterator, PaginatedList, PaginationOptions } from '../utils.js';
|
|
6
|
+
import type { Actor, ActorDefaultRunOptions, ActorExampleRunInput, ActorStandby } from './actor.js';
|
|
7
|
+
import type { ActorVersion } from './actor_version.js';
|
|
8
|
+
export type { ActorCollectionListItem } from '../models.js';
|
|
9
9
|
/**
|
|
10
10
|
* Client for managing the collection of Actors in your account.
|
|
11
11
|
*
|
|
@@ -65,6 +65,8 @@ export declare class ActorCollectionClient extends ResourceCollectionClient {
|
|
|
65
65
|
create(actor: ActorCollectionCreateOptions): Promise<Actor>;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
+
* Field to order a list of Actors by.
|
|
69
|
+
*
|
|
68
70
|
* @since Added in 2.12.6
|
|
69
71
|
*/
|
|
70
72
|
export declare enum ActorListSortBy {
|
|
@@ -77,7 +79,7 @@ export interface ActorCollectionListOptions extends PaginationOptions {
|
|
|
77
79
|
/**
|
|
78
80
|
* @since Added in 2.12.6
|
|
79
81
|
*/
|
|
80
|
-
sortBy?: ActorListSortBy
|
|
82
|
+
sortBy?: `${ActorListSortBy}`;
|
|
81
83
|
}
|
|
82
84
|
export type ActorCollectionListResult = PaginatedList<ActorCollectionListItem>;
|
|
83
85
|
export interface ActorCollectionCreateOptions {
|
|
@@ -100,8 +102,6 @@ export interface ActorCollectionCreateOptions {
|
|
|
100
102
|
isDeprecated?: boolean;
|
|
101
103
|
isPublic?: boolean;
|
|
102
104
|
name?: string;
|
|
103
|
-
/** @deprecated Use defaultRunOptions.restartOnError instead */
|
|
104
|
-
restartOnError?: boolean;
|
|
105
105
|
/**
|
|
106
106
|
* @since Added in 2.8.6
|
|
107
107
|
*/
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const actorCreateSchema = utils_1.anyObjectSchema.optional();
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import * as schemas from '../schemas.js';
|
|
4
|
+
import { anyObjectSchema, paginationOptionsShape, parseArgument } from '../utils.js';
|
|
5
|
+
const actorCreateSchema = anyObjectSchema.optional();
|
|
8
6
|
/**
|
|
9
7
|
* Client for managing the collection of Actors in your account.
|
|
10
8
|
*
|
|
@@ -28,7 +26,7 @@ const actorCreateSchema = utils_1.anyObjectSchema.optional();
|
|
|
28
26
|
*
|
|
29
27
|
* @see https://docs.apify.com/platform/actors
|
|
30
28
|
*/
|
|
31
|
-
class ActorCollectionClient extends
|
|
29
|
+
export class ActorCollectionClient extends ResourceCollectionClient {
|
|
32
30
|
/**
|
|
33
31
|
* @hidden
|
|
34
32
|
*/
|
|
@@ -59,8 +57,8 @@ class ActorCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
59
57
|
* @see https://docs.apify.com/api/v2/acts-get
|
|
60
58
|
*/
|
|
61
59
|
list(options = {}) {
|
|
62
|
-
const parsed =
|
|
63
|
-
return this._listPaginated(parsed);
|
|
60
|
+
const parsed = parseArgument(options, listOptionsSchema, 'ActorCollectionListOptions');
|
|
61
|
+
return this._listPaginated(schemas.ListOfActors(), parsed);
|
|
64
62
|
}
|
|
65
63
|
/**
|
|
66
64
|
* Creates a new Actor.
|
|
@@ -70,23 +68,24 @@ class ActorCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
70
68
|
* @see https://docs.apify.com/api/v2/acts-post
|
|
71
69
|
*/
|
|
72
70
|
async create(actor) {
|
|
73
|
-
|
|
74
|
-
return this._create(actor);
|
|
71
|
+
parseArgument(actor, actorCreateSchema);
|
|
72
|
+
return this._create(schemas.Actor(), actor);
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
|
-
exports.ActorCollectionClient = ActorCollectionClient;
|
|
78
75
|
/**
|
|
76
|
+
* Field to order a list of Actors by.
|
|
77
|
+
*
|
|
79
78
|
* @since Added in 2.12.6
|
|
80
79
|
*/
|
|
81
|
-
var ActorListSortBy;
|
|
80
|
+
export var ActorListSortBy;
|
|
82
81
|
(function (ActorListSortBy) {
|
|
83
82
|
ActorListSortBy["CREATED_AT"] = "createdAt";
|
|
84
83
|
ActorListSortBy["LAST_RUN_STARTED_AT"] = "stats.lastRunStartedAt";
|
|
85
|
-
})(ActorListSortBy || (
|
|
84
|
+
})(ActorListSortBy || (ActorListSortBy = {}));
|
|
86
85
|
// Declared below `ActorListSortBy` because it references it at module load time.
|
|
87
|
-
const listOptionsSchema =
|
|
88
|
-
my:
|
|
89
|
-
...
|
|
90
|
-
desc:
|
|
91
|
-
sortBy:
|
|
86
|
+
const listOptionsSchema = z.strictObject({
|
|
87
|
+
my: z.boolean().optional(),
|
|
88
|
+
...paginationOptionsShape,
|
|
89
|
+
desc: z.boolean().optional(),
|
|
90
|
+
sortBy: z.enum(ActorListSortBy).optional(),
|
|
92
91
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceClient } from '../base/resource_client';
|
|
3
|
-
import type { ActorEnvironmentVariable } from './actor_version';
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import type { ActorEnvironmentVariable } from './actor_version.js';
|
|
4
4
|
/**
|
|
5
5
|
* Client for managing a specific Actor environment variable.
|
|
6
6
|
*
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const resource_client_1 = require("../base/resource_client");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
1
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
2
|
+
import * as schemas from '../schemas.js';
|
|
3
|
+
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
6
4
|
/**
|
|
7
5
|
* Client for managing a specific Actor environment variable.
|
|
8
6
|
*
|
|
@@ -26,7 +24,7 @@ const utils_1 = require("../utils");
|
|
|
26
24
|
* @see https://docs.apify.com/platform/actors/development/programming-interface/environment-variables
|
|
27
25
|
* @since Added in 2.1.0
|
|
28
26
|
*/
|
|
29
|
-
class ActorEnvVarClient extends
|
|
27
|
+
export class ActorEnvVarClient extends ResourceClient {
|
|
30
28
|
/**
|
|
31
29
|
* @hidden
|
|
32
30
|
*/
|
|
@@ -43,7 +41,7 @@ class ActorEnvVarClient extends resource_client_1.ResourceClient {
|
|
|
43
41
|
* @see https://docs.apify.com/api/v2/act-version-env-var-get
|
|
44
42
|
*/
|
|
45
43
|
async get() {
|
|
46
|
-
return this._get();
|
|
44
|
+
return this._get(schemas.EnvVar());
|
|
47
45
|
}
|
|
48
46
|
/**
|
|
49
47
|
* Updates the environment variable.
|
|
@@ -53,8 +51,8 @@ class ActorEnvVarClient extends resource_client_1.ResourceClient {
|
|
|
53
51
|
* @see https://docs.apify.com/api/v2/act-version-env-var-put
|
|
54
52
|
*/
|
|
55
53
|
async update(actorEnvVar) {
|
|
56
|
-
|
|
57
|
-
return this._update(actorEnvVar);
|
|
54
|
+
parseArgument(actorEnvVar, anyObjectSchema);
|
|
55
|
+
return this._update(schemas.EnvVar(), actorEnvVar);
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
58
|
* Deletes the environment variable.
|
|
@@ -65,4 +63,3 @@ class ActorEnvVarClient extends resource_client_1.ResourceClient {
|
|
|
65
63
|
return this._delete();
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
|
-
exports.ActorEnvVarClient = ActorEnvVarClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceCollectionClient } from '../base/resource_collection_client';
|
|
3
|
-
import type { PaginatedList
|
|
4
|
-
import type { ActorEnvironmentVariable } from './actor_version';
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import type { PaginatedList } from '../utils.js';
|
|
4
|
+
import type { ActorEnvironmentVariable } from './actor_version.js';
|
|
5
5
|
/**
|
|
6
6
|
* Client for managing the collection of environment variables for an Actor version.
|
|
7
7
|
*
|
|
@@ -37,23 +37,22 @@ export declare class ActorEnvVarCollectionClient extends ResourceCollectionClien
|
|
|
37
37
|
/**
|
|
38
38
|
* Lists all environment variables of this Actor version.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
40
|
+
* The endpoint returns every environment variable in one response, so awaiting the return value (as you would
|
|
41
|
+
* with a Promise) gets the whole list.
|
|
42
42
|
* ```javascript
|
|
43
|
-
* const
|
|
44
|
-
|
|
43
|
+
* const { items } = await client.list();
|
|
44
|
+
* ```
|
|
45
45
|
*
|
|
46
|
-
* Asynchronous iteration is also supported
|
|
47
|
-
* retrieved.
|
|
46
|
+
* Asynchronous iteration is also supported, and yields the environment variables one by one.
|
|
48
47
|
*
|
|
49
48
|
* ```javascript
|
|
50
49
|
* for await (const singleItem of client.list()) {...}
|
|
51
50
|
* ```
|
|
52
51
|
*
|
|
53
|
-
* @returns
|
|
52
|
+
* @returns The environment variables, awaitable as a whole list or iterable one by one.
|
|
54
53
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-get
|
|
55
54
|
*/
|
|
56
|
-
list(
|
|
55
|
+
list(): Promise<ActorEnvVarListResult> & AsyncIterable<ActorEnvironmentVariable>;
|
|
57
56
|
/**
|
|
58
57
|
* Creates a new environment variable for this Actor version.
|
|
59
58
|
*
|
|
@@ -63,14 +62,6 @@ export declare class ActorEnvVarCollectionClient extends ResourceCollectionClien
|
|
|
63
62
|
*/
|
|
64
63
|
create(actorEnvVar: ActorEnvironmentVariable): Promise<ActorEnvironmentVariable>;
|
|
65
64
|
}
|
|
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;
|
|
73
|
-
}
|
|
74
65
|
/**
|
|
75
66
|
* @since Added in 2.1.0
|
|
76
67
|
*/
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const actorEnvVarSchema = utils_1.anyObjectSchema.optional();
|
|
1
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
|
+
import * as schemas from '../schemas.js';
|
|
3
|
+
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
4
|
+
const actorEnvVarSchema = anyObjectSchema.optional();
|
|
7
5
|
/**
|
|
8
6
|
* Client for managing the collection of environment variables for an Actor version.
|
|
9
7
|
*
|
|
@@ -31,7 +29,7 @@ const actorEnvVarSchema = utils_1.anyObjectSchema.optional();
|
|
|
31
29
|
* @see https://docs.apify.com/platform/actors/development/programming-interface/environment-variables
|
|
32
30
|
* @since Added in 2.1.0
|
|
33
31
|
*/
|
|
34
|
-
class ActorEnvVarCollectionClient extends
|
|
32
|
+
export class ActorEnvVarCollectionClient extends ResourceCollectionClient {
|
|
35
33
|
/**
|
|
36
34
|
* @hidden
|
|
37
35
|
*/
|
|
@@ -44,24 +42,23 @@ class ActorEnvVarCollectionClient extends resource_collection_client_1.ResourceC
|
|
|
44
42
|
/**
|
|
45
43
|
* Lists all environment variables of this Actor version.
|
|
46
44
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* The endpoint returns every environment variable in one response, so awaiting the return value (as you would
|
|
46
|
+
* with a Promise) gets the whole list.
|
|
49
47
|
* ```javascript
|
|
50
|
-
* const
|
|
51
|
-
|
|
48
|
+
* const { items } = await client.list();
|
|
49
|
+
* ```
|
|
52
50
|
*
|
|
53
|
-
* Asynchronous iteration is also supported
|
|
54
|
-
* retrieved.
|
|
51
|
+
* Asynchronous iteration is also supported, and yields the environment variables one by one.
|
|
55
52
|
*
|
|
56
53
|
* ```javascript
|
|
57
54
|
* for await (const singleItem of client.list()) {...}
|
|
58
55
|
* ```
|
|
59
56
|
*
|
|
60
|
-
* @returns
|
|
57
|
+
* @returns The environment variables, awaitable as a whole list or iterable one by one.
|
|
61
58
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-get
|
|
62
59
|
*/
|
|
63
|
-
list(
|
|
64
|
-
return this._listPaginated();
|
|
60
|
+
list() {
|
|
61
|
+
return this._listPaginated(schemas.ListOfEnvVars());
|
|
65
62
|
}
|
|
66
63
|
/**
|
|
67
64
|
* Creates a new environment variable for this Actor version.
|
|
@@ -71,8 +68,7 @@ class ActorEnvVarCollectionClient extends resource_collection_client_1.ResourceC
|
|
|
71
68
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-post
|
|
72
69
|
*/
|
|
73
70
|
async create(actorEnvVar) {
|
|
74
|
-
|
|
75
|
-
return this._create(actorEnvVar);
|
|
71
|
+
parseArgument(actorEnvVar, actorEnvVarSchema);
|
|
72
|
+
return this._create(schemas.EnvVar(), actorEnvVar);
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
exports.ActorEnvVarCollectionClient = ActorEnvVarCollectionClient;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceClient } from '../base/resource_client';
|
|
3
|
-
import type { ActorVersion, FinalActorVersion } from '../models';
|
|
4
|
-
import { ActorEnvVarClient } from './actor_env_var';
|
|
5
|
-
import { ActorEnvVarCollectionClient } from './actor_env_var_collection';
|
|
6
|
-
export type { ActorEnvironmentVariable, ActorVersion, ActorVersionGitHubGist, ActorVersionGitRepo, ActorVersionSourceCode, ActorVersionSourceFile, ActorVersionSourceFiles, ActorVersionSourceFolder, ActorVersionTarball, BaseActorVersion, FinalActorVersion, } from '../models';
|
|
7
|
-
export { ActorSourceType } from '../models';
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import type { ActorVersion, FinalActorVersion } from '../models.js';
|
|
4
|
+
import { ActorEnvVarClient } from './actor_env_var.js';
|
|
5
|
+
import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
|
|
6
|
+
export type { ActorEnvironmentVariable, ActorVersion, ActorVersionGitHubGist, ActorVersionGitRepo, ActorVersionSourceCode, ActorVersionSourceFile, ActorVersionSourceFiles, ActorVersionSourceFolder, ActorVersionTarball, BaseActorVersion, FinalActorVersion, } from '../models.js';
|
|
7
|
+
export { ActorSourceType } from '../models.js';
|
|
8
8
|
/**
|
|
9
9
|
* Client for managing a specific Actor version.
|
|
10
10
|
*
|
|
@@ -45,7 +45,7 @@ export declare class ActorVersionClient extends ResourceClient {
|
|
|
45
45
|
* @returns The updated Actor version object.
|
|
46
46
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
47
47
|
*/
|
|
48
|
-
update(newFields:
|
|
48
|
+
update(newFields: ActorVersionUpdateData): Promise<FinalActorVersion>;
|
|
49
49
|
/**
|
|
50
50
|
* Deletes the Actor version.
|
|
51
51
|
*
|
|
@@ -70,3 +70,11 @@ export declare class ActorVersionClient extends ResourceClient {
|
|
|
70
70
|
*/
|
|
71
71
|
envVars(): ActorEnvVarCollectionClient;
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Fields that can be changed on an existing Actor version.
|
|
75
|
+
*
|
|
76
|
+
* All of them are optional, because the endpoint leaves untouched whatever the payload does not
|
|
77
|
+
* mention. The version union enforces the pairing: a `sourceType` can only be sent next to the
|
|
78
|
+
* source location it implies, never next to one of the other three.
|
|
79
|
+
*/
|
|
80
|
+
export type ActorVersionUpdateData = Partial<ActorVersion>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const envVarNameSchema = zod_1.z.string();
|
|
10
|
-
var models_1 = require("../models");
|
|
11
|
-
Object.defineProperty(exports, "ActorSourceType", { enumerable: true, get: function () { return models_1.ActorSourceType; } });
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import * as schemas from '../schemas.js';
|
|
4
|
+
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
5
|
+
import { ActorEnvVarClient } from './actor_env_var.js';
|
|
6
|
+
import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
|
|
7
|
+
const envVarNameSchema = z.string().min(1);
|
|
8
|
+
export { ActorSourceType } from '../models.js';
|
|
12
9
|
/**
|
|
13
10
|
* Client for managing a specific Actor version.
|
|
14
11
|
*
|
|
@@ -30,7 +27,7 @@ Object.defineProperty(exports, "ActorSourceType", { enumerable: true, get: funct
|
|
|
30
27
|
*
|
|
31
28
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
32
29
|
*/
|
|
33
|
-
class ActorVersionClient extends
|
|
30
|
+
export class ActorVersionClient extends ResourceClient {
|
|
34
31
|
/**
|
|
35
32
|
* @hidden
|
|
36
33
|
*/
|
|
@@ -47,7 +44,7 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
47
44
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
48
45
|
*/
|
|
49
46
|
async get() {
|
|
50
|
-
return this._get();
|
|
47
|
+
return this._get(schemas.Version());
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
53
50
|
* Updates the Actor version with the specified fields.
|
|
@@ -57,8 +54,8 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
57
54
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
58
55
|
*/
|
|
59
56
|
async update(newFields) {
|
|
60
|
-
|
|
61
|
-
return this._update(newFields);
|
|
57
|
+
parseArgument(newFields, anyObjectSchema);
|
|
58
|
+
return this._update(schemas.Version(), newFields);
|
|
62
59
|
}
|
|
63
60
|
/**
|
|
64
61
|
* Deletes the Actor version.
|
|
@@ -77,8 +74,8 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
77
74
|
* @since Added in 2.1.0
|
|
78
75
|
*/
|
|
79
76
|
envVar(envVarName) {
|
|
80
|
-
|
|
81
|
-
return new
|
|
77
|
+
parseArgument(envVarName, envVarNameSchema);
|
|
78
|
+
return new ActorEnvVarClient(this._subResourceOptions({
|
|
82
79
|
id: envVarName,
|
|
83
80
|
}));
|
|
84
81
|
}
|
|
@@ -90,7 +87,6 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
90
87
|
* @since Added in 2.1.0
|
|
91
88
|
*/
|
|
92
89
|
envVars() {
|
|
93
|
-
return new
|
|
90
|
+
return new ActorEnvVarCollectionClient(this._subResourceOptions());
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
|
-
exports.ActorVersionClient = ActorVersionClient;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceCollectionClient } from '../base/resource_collection_client';
|
|
3
|
-
import type { PaginatedList
|
|
4
|
-
import type { ActorVersion, FinalActorVersion } from './actor_version';
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
3
|
+
import type { PaginatedList } from '../utils.js';
|
|
4
|
+
import type { ActorVersion, FinalActorVersion } from './actor_version.js';
|
|
5
5
|
/**
|
|
6
6
|
* Client for managing the collection of Actor versions.
|
|
7
7
|
*
|
|
@@ -20,6 +20,8 @@ import type { ActorVersion, FinalActorVersion } from './actor_version';
|
|
|
20
20
|
* // Create a new version
|
|
21
21
|
* const newVersion = await versionsClient.create({
|
|
22
22
|
* versionNumber: '0.2',
|
|
23
|
+
* sourceType: 'GIT_REPO',
|
|
24
|
+
* gitRepoUrl: 'https://github.com/my-account/my-actor',
|
|
23
25
|
* buildTag: 'latest'
|
|
24
26
|
* });
|
|
25
27
|
* ```
|
|
@@ -34,23 +36,22 @@ export declare class ActorVersionCollectionClient extends ResourceCollectionClie
|
|
|
34
36
|
/**
|
|
35
37
|
* Lists all Actor versions.
|
|
36
38
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
+
* The endpoint returns every version in one response, so awaiting the return value (as you would with a Promise)
|
|
40
|
+
* gets the whole list.
|
|
39
41
|
* ```javascript
|
|
40
|
-
* const
|
|
41
|
-
|
|
42
|
+
* const { items } = await client.list();
|
|
43
|
+
* ```
|
|
42
44
|
*
|
|
43
|
-
* Asynchronous iteration is also supported
|
|
44
|
-
* retrieved.
|
|
45
|
+
* Asynchronous iteration is also supported, and yields the versions one by one.
|
|
45
46
|
*
|
|
46
47
|
* ```javascript
|
|
47
48
|
* for await (const singleItem of client.list()) {...}
|
|
48
49
|
* ```
|
|
49
50
|
*
|
|
50
|
-
* @returns
|
|
51
|
+
* @returns The Actor versions, awaitable as a whole list or iterable one by one.
|
|
51
52
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
52
53
|
*/
|
|
53
|
-
list(
|
|
54
|
+
list(): Promise<ActorVersionListResult> & AsyncIterable<FinalActorVersion>;
|
|
54
55
|
/**
|
|
55
56
|
* Creates a new Actor version.
|
|
56
57
|
*
|
|
@@ -60,11 +61,4 @@ export declare class ActorVersionCollectionClient extends ResourceCollectionClie
|
|
|
60
61
|
*/
|
|
61
62
|
create(actorVersion: ActorVersion): Promise<FinalActorVersion>;
|
|
62
63
|
}
|
|
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;
|
|
69
|
-
}
|
|
70
64
|
export type ActorVersionListResult = Pick<PaginatedList<FinalActorVersion>, 'total' | 'items'>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const actorVersionSchema = utils_1.anyObjectSchema.optional();
|
|
1
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
|
+
import * as schemas from '../schemas.js';
|
|
3
|
+
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
4
|
+
const actorVersionSchema = anyObjectSchema.optional();
|
|
7
5
|
/**
|
|
8
6
|
* Client for managing the collection of Actor versions.
|
|
9
7
|
*
|
|
@@ -22,13 +20,15 @@ const actorVersionSchema = utils_1.anyObjectSchema.optional();
|
|
|
22
20
|
* // Create a new version
|
|
23
21
|
* const newVersion = await versionsClient.create({
|
|
24
22
|
* versionNumber: '0.2',
|
|
23
|
+
* sourceType: 'GIT_REPO',
|
|
24
|
+
* gitRepoUrl: 'https://github.com/my-account/my-actor',
|
|
25
25
|
* buildTag: 'latest'
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
29
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
30
30
|
*/
|
|
31
|
-
class ActorVersionCollectionClient extends
|
|
31
|
+
export class ActorVersionCollectionClient extends ResourceCollectionClient {
|
|
32
32
|
/**
|
|
33
33
|
* @hidden
|
|
34
34
|
*/
|
|
@@ -41,24 +41,23 @@ class ActorVersionCollectionClient extends resource_collection_client_1.Resource
|
|
|
41
41
|
/**
|
|
42
42
|
* Lists all Actor versions.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
44
|
+
* The endpoint returns every version in one response, so awaiting the return value (as you would with a Promise)
|
|
45
|
+
* gets the whole list.
|
|
46
46
|
* ```javascript
|
|
47
|
-
* const
|
|
48
|
-
|
|
47
|
+
* const { items } = await client.list();
|
|
48
|
+
* ```
|
|
49
49
|
*
|
|
50
|
-
* Asynchronous iteration is also supported
|
|
51
|
-
* retrieved.
|
|
50
|
+
* Asynchronous iteration is also supported, and yields the versions one by one.
|
|
52
51
|
*
|
|
53
52
|
* ```javascript
|
|
54
53
|
* for await (const singleItem of client.list()) {...}
|
|
55
54
|
* ```
|
|
56
55
|
*
|
|
57
|
-
* @returns
|
|
56
|
+
* @returns The Actor versions, awaitable as a whole list or iterable one by one.
|
|
58
57
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
59
58
|
*/
|
|
60
|
-
list(
|
|
61
|
-
return this._listPaginated();
|
|
59
|
+
list() {
|
|
60
|
+
return this._listPaginated(schemas.ListOfVersions());
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
64
63
|
* Creates a new Actor version.
|
|
@@ -68,8 +67,7 @@ class ActorVersionCollectionClient extends resource_collection_client_1.Resource
|
|
|
68
67
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
69
68
|
*/
|
|
70
69
|
async create(actorVersion) {
|
|
71
|
-
|
|
72
|
-
return this._create(actorVersion);
|
|
70
|
+
parseArgument(actorVersion, actorVersionSchema);
|
|
71
|
+
return this._create(schemas.Version(), actorVersion);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
exports.ActorVersionCollectionClient = ActorVersionCollectionClient;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
2
|
-
import { ResourceClient } from '../base/resource_client';
|
|
3
|
-
import type { Build } from '../models';
|
|
4
|
-
import { LogClient } from './log';
|
|
5
|
-
export type { Build, BuildMeta, BuildOptions, BuildStats, BuildUsage } from '../models';
|
|
1
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import type { Build } from '../models.js';
|
|
4
|
+
import { LogClient } from './log.js';
|
|
5
|
+
export type { Build, BuildMeta, BuildOptions, BuildStats, BuildUsage } from '../models.js';
|
|
6
6
|
/**
|
|
7
7
|
* Client for managing a specific Actor build.
|
|
8
8
|
*
|
|
@@ -113,6 +113,8 @@ export declare class BuildClient extends ResourceClient {
|
|
|
113
113
|
/**
|
|
114
114
|
* Returns a client for accessing the log of this Actor build.
|
|
115
115
|
*
|
|
116
|
+
* A 404 from this client throws an `ApifyApiError`, since the build itself may be what is missing.
|
|
117
|
+
*
|
|
116
118
|
* @returns A client for accessing the build's log
|
|
117
119
|
* @see https://docs.apify.com/api/v2/actor-build-log-get
|
|
118
120
|
*
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const getOptionsSchema = zod_1.z.strictObject({ waitForFinish: zod_1.z.number().optional() });
|
|
9
|
-
const waitForFinishOptionsSchema = zod_1.z.strictObject({ waitSecs: zod_1.z.number().optional() });
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
3
|
+
import * as schemas from '../schemas.js';
|
|
4
|
+
import { parseArgument, parseResponse } from '../utils.js';
|
|
5
|
+
import { LogClient } from './log.js';
|
|
6
|
+
const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional() });
|
|
7
|
+
const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional() });
|
|
10
8
|
/**
|
|
11
9
|
* Client for managing a specific Actor build.
|
|
12
10
|
*
|
|
@@ -30,7 +28,7 @@ const waitForFinishOptionsSchema = zod_1.z.strictObject({ waitSecs: zod_1.z.numb
|
|
|
30
28
|
*
|
|
31
29
|
* @see https://docs.apify.com/platform/actors/running/runs-and-builds#builds
|
|
32
30
|
*/
|
|
33
|
-
class BuildClient extends
|
|
31
|
+
export class BuildClient extends ResourceClient {
|
|
34
32
|
/**
|
|
35
33
|
* @hidden
|
|
36
34
|
*/
|
|
@@ -59,8 +57,8 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
59
57
|
* ```
|
|
60
58
|
*/
|
|
61
59
|
async get(options = {}) {
|
|
62
|
-
const parsed =
|
|
63
|
-
return this._get(parsed);
|
|
60
|
+
const parsed = parseArgument(options, getOptionsSchema, 'BuildClientGetOptions');
|
|
61
|
+
return this._get(schemas.Build(), parsed);
|
|
64
62
|
}
|
|
65
63
|
/**
|
|
66
64
|
* Aborts the Actor build.
|
|
@@ -81,7 +79,7 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
81
79
|
method: 'POST',
|
|
82
80
|
params: this._params(),
|
|
83
81
|
});
|
|
84
|
-
return (
|
|
82
|
+
return parseResponse(response, schemas.Build());
|
|
85
83
|
}
|
|
86
84
|
/**
|
|
87
85
|
* Deletes the Actor build.
|
|
@@ -138,12 +136,14 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
138
136
|
* ```
|
|
139
137
|
*/
|
|
140
138
|
async waitForFinish(options = {}) {
|
|
141
|
-
const parsed =
|
|
142
|
-
return this._waitForFinish(parsed);
|
|
139
|
+
const parsed = parseArgument(options, waitForFinishOptionsSchema, 'BuildClientWaitForFinishOptions');
|
|
140
|
+
return this._waitForFinish(schemas.Build(), parsed);
|
|
143
141
|
}
|
|
144
142
|
/**
|
|
145
143
|
* Returns a client for accessing the log of this Actor build.
|
|
146
144
|
*
|
|
145
|
+
* A 404 from this client throws an `ApifyApiError`, since the build itself may be what is missing.
|
|
146
|
+
*
|
|
147
147
|
* @returns A client for accessing the build's log
|
|
148
148
|
* @see https://docs.apify.com/api/v2/actor-build-log-get
|
|
149
149
|
*
|
|
@@ -156,9 +156,8 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
156
156
|
* @since Added in 2.9.0
|
|
157
157
|
*/
|
|
158
158
|
log() {
|
|
159
|
-
return new
|
|
159
|
+
return new LogClient(this._subResourceOptions({
|
|
160
160
|
resourcePath: 'log',
|
|
161
161
|
}));
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
exports.BuildClient = BuildClient;
|