apify-client 3.0.0-beta.1 → 3.0.0-beta.3
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 +2 -2
- package/dist/apify_api_error.js +5 -9
- 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 +1 -1
- package/dist/base/resource_client.js +14 -18
- package/dist/base/resource_collection_client.d.ts +2 -2
- package/dist/base/resource_collection_client.js +6 -10
- package/dist/body_parser.js +6 -11
- package/dist/bundle.js +35 -47
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.js +1 -2
- package/dist/http_client.d.ts +2 -2
- package/dist/http_client.js +23 -28
- package/dist/index.d.ts +32 -32
- package/dist/index.js +31 -36
- package/dist/interceptors.d.ts +1 -1
- package/dist/interceptors.js +14 -19
- package/dist/models.d.ts +3 -3
- package/dist/models.js +8 -11
- package/dist/resource_clients/actor.d.ts +13 -13
- package/dist/resource_clients/actor.js +67 -71
- package/dist/resource_clients/actor_collection.d.ts +7 -7
- package/dist/resource_clients/actor_collection.js +14 -18
- package/dist/resource_clients/actor_env_var.d.ts +3 -3
- package/dist/resource_clients/actor_env_var.js +4 -8
- package/dist/resource_clients/actor_env_var_collection.d.ts +4 -4
- package/dist/resource_clients/actor_env_var_collection.js +5 -9
- package/dist/resource_clients/actor_version.d.ts +7 -7
- package/dist/resource_clients/actor_version.js +12 -17
- package/dist/resource_clients/actor_version_collection.d.ts +4 -4
- package/dist/resource_clients/actor_version_collection.js +5 -9
- package/dist/resource_clients/build.d.ts +5 -5
- package/dist/resource_clients/build.js +11 -15
- package/dist/resource_clients/build_collection.d.ts +5 -5
- package/dist/resource_clients/build_collection.js +8 -12
- package/dist/resource_clients/dataset.d.ts +5 -5
- package/dist/resource_clients/dataset.js +72 -76
- package/dist/resource_clients/dataset_collection.d.ts +4 -4
- package/dist/resource_clients/dataset_collection.js +15 -19
- package/dist/resource_clients/key_value_store.d.ts +4 -4
- package/dist/resource_clients/key_value_store.js +57 -62
- package/dist/resource_clients/key_value_store_collection.d.ts +4 -4
- package/dist/resource_clients/key_value_store_collection.js +15 -19
- package/dist/resource_clients/log.d.ts +2 -2
- package/dist/resource_clients/log.js +15 -22
- package/dist/resource_clients/request_queue.d.ts +4 -4
- package/dist/resource_clients/request_queue.js +91 -96
- package/dist/resource_clients/request_queue_collection.d.ts +4 -4
- package/dist/resource_clients/request_queue_collection.js +13 -17
- package/dist/resource_clients/run.d.ts +8 -8
- package/dist/resource_clients/run.js +46 -50
- package/dist/resource_clients/run_collection.d.ts +4 -4
- package/dist/resource_clients/run_collection.js +13 -17
- package/dist/resource_clients/schedule.d.ts +6 -6
- package/dist/resource_clients/schedule.js +7 -12
- package/dist/resource_clients/schedule_collection.d.ts +4 -4
- package/dist/resource_clients/schedule_collection.js +10 -14
- package/dist/resource_clients/store_collection.d.ts +5 -5
- package/dist/resource_clients/store_collection.js +13 -17
- package/dist/resource_clients/task.d.ts +9 -9
- package/dist/resource_clients/task.js +44 -48
- package/dist/resource_clients/task_collection.d.ts +6 -6
- package/dist/resource_clients/task_collection.js +9 -13
- package/dist/resource_clients/user.d.ts +5 -5
- package/dist/resource_clients/user.js +8 -13
- package/dist/resource_clients/webhook.d.ts +6 -6
- package/dist/resource_clients/webhook.js +8 -12
- package/dist/resource_clients/webhook_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_collection.js +10 -14
- package/dist/resource_clients/webhook_dispatch.d.ts +5 -5
- package/dist/resource_clients/webhook_dispatch.js +3 -8
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +4 -4
- package/dist/resource_clients/webhook_dispatch_collection.js +8 -12
- package/dist/statistics.js +5 -9
- package/dist/timezones.js +1 -2
- package/dist/utils.d.ts +5 -13
- package/dist/utils.js +30 -69
- package/package.json +10 -12
- package/dist/argument_validation_error.d.ts +0 -17
- package/dist/argument_validation_error.js +0 -157
- package/dist/index.mjs +0 -42
|
@@ -1,57 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
maxTotalChargeUsd: zod_1.z.number().min(0).optional(),
|
|
25
|
-
restartOnError: zod_1.z.boolean().optional(),
|
|
26
|
-
forcePermissionLevel: zod_1.z.enum(consts_1.ACTOR_PERMISSION_LEVEL).optional(),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ACTOR_JOB_STATUSES, ACTOR_PERMISSION_LEVEL, META_ORIGINS } from '@apify/consts';
|
|
3
|
+
import { Log } from '@apify/log';
|
|
4
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
5
|
+
import { anyObjectSchema, cast, parseArgument, parseDateFields, pluckData, stringifyWebhooksToBase64, } from '../utils.js';
|
|
6
|
+
import { ActorVersionClient } from './actor_version.js';
|
|
7
|
+
import { ActorVersionCollectionClient } from './actor_version_collection.js';
|
|
8
|
+
import { BuildClient } from './build.js';
|
|
9
|
+
import { BuildCollectionClient } from './build_collection.js';
|
|
10
|
+
import { RunClient } from './run.js';
|
|
11
|
+
import { RunCollectionClient } from './run_collection.js';
|
|
12
|
+
import { WebhookCollectionClient } from './webhook_collection.js';
|
|
13
|
+
const startOptionsSchema = z.strictObject({
|
|
14
|
+
build: z.string().optional(),
|
|
15
|
+
contentType: z.string().optional(),
|
|
16
|
+
memory: z.number().optional(),
|
|
17
|
+
timeout: z.number().optional(),
|
|
18
|
+
waitForFinish: z.number().optional(),
|
|
19
|
+
webhooks: z.array(anyObjectSchema).optional(),
|
|
20
|
+
maxItems: z.number().min(0).optional(),
|
|
21
|
+
maxTotalChargeUsd: z.number().min(0).optional(),
|
|
22
|
+
restartOnError: z.boolean().optional(),
|
|
23
|
+
forcePermissionLevel: z.enum(ACTOR_PERMISSION_LEVEL).optional(),
|
|
27
24
|
});
|
|
28
|
-
const callOptionsSchema =
|
|
29
|
-
build:
|
|
30
|
-
contentType:
|
|
31
|
-
memory:
|
|
32
|
-
timeout:
|
|
33
|
-
waitSecs:
|
|
34
|
-
webhooks:
|
|
35
|
-
maxItems:
|
|
36
|
-
maxTotalChargeUsd:
|
|
37
|
-
log:
|
|
38
|
-
restartOnError:
|
|
39
|
-
forcePermissionLevel:
|
|
25
|
+
const callOptionsSchema = z.strictObject({
|
|
26
|
+
build: z.string().optional(),
|
|
27
|
+
contentType: z.string().optional(),
|
|
28
|
+
memory: z.number().optional(),
|
|
29
|
+
timeout: z.number().min(0).optional(),
|
|
30
|
+
waitSecs: z.number().min(0).optional(),
|
|
31
|
+
webhooks: z.array(anyObjectSchema).optional(),
|
|
32
|
+
maxItems: z.number().min(0).optional(),
|
|
33
|
+
maxTotalChargeUsd: z.number().min(0).optional(),
|
|
34
|
+
log: z.union([z.null(), z.instanceof(Log), z.literal('default')]).optional(),
|
|
35
|
+
restartOnError: z.boolean().optional(),
|
|
36
|
+
forcePermissionLevel: z.enum(ACTOR_PERMISSION_LEVEL).optional(),
|
|
40
37
|
});
|
|
41
|
-
const validateInputOptionsSchema =
|
|
42
|
-
build:
|
|
43
|
-
contentType:
|
|
38
|
+
const validateInputOptionsSchema = z.strictObject({
|
|
39
|
+
build: z.string().optional(),
|
|
40
|
+
contentType: z.string().optional(),
|
|
44
41
|
});
|
|
45
|
-
const versionNumberSchema =
|
|
46
|
-
const buildOptionsSchema =
|
|
47
|
-
betaPackages:
|
|
48
|
-
tag:
|
|
49
|
-
useCache:
|
|
50
|
-
waitForFinish:
|
|
42
|
+
const versionNumberSchema = z.string();
|
|
43
|
+
const buildOptionsSchema = z.strictObject({
|
|
44
|
+
betaPackages: z.boolean().optional(),
|
|
45
|
+
tag: z.string().optional(),
|
|
46
|
+
useCache: z.boolean().optional(),
|
|
47
|
+
waitForFinish: z.number().optional(),
|
|
51
48
|
});
|
|
52
|
-
const lastRunOptionsSchema =
|
|
53
|
-
status:
|
|
54
|
-
origin:
|
|
49
|
+
const lastRunOptionsSchema = z.strictObject({
|
|
50
|
+
status: z.enum(ACTOR_JOB_STATUSES).optional(),
|
|
51
|
+
origin: z.enum(META_ORIGINS).optional(),
|
|
55
52
|
});
|
|
56
53
|
/**
|
|
57
54
|
* Client for managing a specific Actor.
|
|
@@ -73,7 +70,7 @@ const lastRunOptionsSchema = zod_1.z.strictObject({
|
|
|
73
70
|
*
|
|
74
71
|
* @see https://docs.apify.com/platform/actors
|
|
75
72
|
*/
|
|
76
|
-
class ActorClient extends
|
|
73
|
+
export class ActorClient extends ResourceClient {
|
|
77
74
|
/**
|
|
78
75
|
* @hidden
|
|
79
76
|
*/
|
|
@@ -100,7 +97,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
100
97
|
* @see https://docs.apify.com/api/v2/act-put
|
|
101
98
|
*/
|
|
102
99
|
async update(newFields) {
|
|
103
|
-
|
|
100
|
+
parseArgument(newFields, anyObjectSchema);
|
|
104
101
|
return this._update(newFields);
|
|
105
102
|
}
|
|
106
103
|
/**
|
|
@@ -148,14 +145,14 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
148
145
|
async start(input, options = {}) {
|
|
149
146
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
150
147
|
// then it will process input as a buffer.
|
|
151
|
-
const parsed =
|
|
148
|
+
const parsed = parseArgument(options, startOptionsSchema, 'ActorStartOptions');
|
|
152
149
|
const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel, } = parsed;
|
|
153
150
|
const params = {
|
|
154
151
|
waitForFinish,
|
|
155
152
|
timeout,
|
|
156
153
|
memory,
|
|
157
154
|
build,
|
|
158
|
-
webhooks:
|
|
155
|
+
webhooks: stringifyWebhooksToBase64(parsed.webhooks),
|
|
159
156
|
maxItems,
|
|
160
157
|
maxTotalChargeUsd,
|
|
161
158
|
restartOnError,
|
|
@@ -176,7 +173,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
176
173
|
};
|
|
177
174
|
}
|
|
178
175
|
const response = await this.httpClient.call(request);
|
|
179
|
-
return
|
|
176
|
+
return cast(parseDateFields(pluckData(response.data)));
|
|
180
177
|
}
|
|
181
178
|
/**
|
|
182
179
|
* Starts the Actor and waits for it to finish before returning the Run object.
|
|
@@ -218,7 +215,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
218
215
|
async call(input, options = {}) {
|
|
219
216
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
220
217
|
// then it will process input as a buffer.
|
|
221
|
-
const parsed =
|
|
218
|
+
const parsed = parseArgument(options, callOptionsSchema, 'ActorCallOptions');
|
|
222
219
|
const { waitSecs, log, ...startOptions } = parsed;
|
|
223
220
|
const { id } = await this.start(input, startOptions);
|
|
224
221
|
// Calling root client because we need access to top level API.
|
|
@@ -268,7 +265,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
268
265
|
async validateInput(input, options = {}) {
|
|
269
266
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
270
267
|
// then it will process input as a buffer.
|
|
271
|
-
const parsed =
|
|
268
|
+
const parsed = parseArgument(options, validateInputOptionsSchema, 'ActorValidateInputOptions');
|
|
272
269
|
const request = {
|
|
273
270
|
url: this._url('validate-input'),
|
|
274
271
|
method: 'POST',
|
|
@@ -316,8 +313,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
316
313
|
* ```
|
|
317
314
|
*/
|
|
318
315
|
async build(versionNumber, options = {}) {
|
|
319
|
-
|
|
320
|
-
const parsed =
|
|
316
|
+
parseArgument(versionNumber, versionNumberSchema);
|
|
317
|
+
const parsed = parseArgument(options, buildOptionsSchema, 'ActorBuildOptions');
|
|
321
318
|
const response = await this.httpClient.call({
|
|
322
319
|
url: this._url('builds'),
|
|
323
320
|
method: 'POST',
|
|
@@ -326,7 +323,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
326
323
|
...parsed,
|
|
327
324
|
}),
|
|
328
325
|
});
|
|
329
|
-
return
|
|
326
|
+
return cast(parseDateFields(pluckData(response.data)));
|
|
330
327
|
}
|
|
331
328
|
/**
|
|
332
329
|
* Returns a client for the default build of this Actor.
|
|
@@ -359,8 +356,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
359
356
|
method: 'GET',
|
|
360
357
|
params: this._params(options),
|
|
361
358
|
});
|
|
362
|
-
const { id } =
|
|
363
|
-
return new
|
|
359
|
+
const { id } = pluckData(response.data);
|
|
360
|
+
return new BuildClient({
|
|
364
361
|
baseUrl: this.apifyClient.baseUrl,
|
|
365
362
|
publicBaseUrl: this.apifyClient.publicBaseUrl,
|
|
366
363
|
httpClient: this.httpClient,
|
|
@@ -386,8 +383,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
386
383
|
* ```
|
|
387
384
|
*/
|
|
388
385
|
lastRun(options = {}) {
|
|
389
|
-
const parsed =
|
|
390
|
-
return new
|
|
386
|
+
const parsed = parseArgument(options, lastRunOptionsSchema, 'ActorLastRunOptions');
|
|
387
|
+
return new RunClient(this._subResourceOptions({
|
|
391
388
|
id: 'last',
|
|
392
389
|
params: this._params(parsed),
|
|
393
390
|
resourcePath: 'runs',
|
|
@@ -400,7 +397,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
400
397
|
* @see https://docs.apify.com/api/v2/act-builds-get
|
|
401
398
|
*/
|
|
402
399
|
builds() {
|
|
403
|
-
return new
|
|
400
|
+
return new BuildCollectionClient(this._subResourceOptions({
|
|
404
401
|
resourcePath: 'builds',
|
|
405
402
|
}));
|
|
406
403
|
}
|
|
@@ -411,7 +408,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
411
408
|
* @see https://docs.apify.com/api/v2/act-runs-get
|
|
412
409
|
*/
|
|
413
410
|
runs() {
|
|
414
|
-
return new
|
|
411
|
+
return new RunCollectionClient(this._subResourceOptions({
|
|
415
412
|
resourcePath: 'runs',
|
|
416
413
|
}));
|
|
417
414
|
}
|
|
@@ -423,8 +420,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
423
420
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
424
421
|
*/
|
|
425
422
|
version(versionNumber) {
|
|
426
|
-
|
|
427
|
-
return new
|
|
423
|
+
parseArgument(versionNumber, versionNumberSchema);
|
|
424
|
+
return new ActorVersionClient(this._subResourceOptions({
|
|
428
425
|
id: versionNumber,
|
|
429
426
|
}));
|
|
430
427
|
}
|
|
@@ -435,7 +432,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
435
432
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
436
433
|
*/
|
|
437
434
|
versions() {
|
|
438
|
-
return new
|
|
435
|
+
return new ActorVersionCollectionClient(this._subResourceOptions());
|
|
439
436
|
}
|
|
440
437
|
/**
|
|
441
438
|
* Returns a client for managing webhooks associated with this Actor.
|
|
@@ -444,7 +441,6 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
444
441
|
* @see https://docs.apify.com/api/v2/act-webhooks-get
|
|
445
442
|
*/
|
|
446
443
|
webhooks() {
|
|
447
|
-
return new
|
|
444
|
+
return new WebhookCollectionClient(this._subResourceOptions());
|
|
448
445
|
}
|
|
449
446
|
}
|
|
450
|
-
exports.ActorClient = ActorClient;
|
|
@@ -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
|
*
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
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 { anyObjectSchema, paginationOptionsShape, parseArgument } from '../utils.js';
|
|
4
|
+
const actorCreateSchema = anyObjectSchema.optional();
|
|
8
5
|
/**
|
|
9
6
|
* Client for managing the collection of Actors in your account.
|
|
10
7
|
*
|
|
@@ -28,7 +25,7 @@ const actorCreateSchema = utils_1.anyObjectSchema.optional();
|
|
|
28
25
|
*
|
|
29
26
|
* @see https://docs.apify.com/platform/actors
|
|
30
27
|
*/
|
|
31
|
-
class ActorCollectionClient extends
|
|
28
|
+
export class ActorCollectionClient extends ResourceCollectionClient {
|
|
32
29
|
/**
|
|
33
30
|
* @hidden
|
|
34
31
|
*/
|
|
@@ -59,7 +56,7 @@ class ActorCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
59
56
|
* @see https://docs.apify.com/api/v2/acts-get
|
|
60
57
|
*/
|
|
61
58
|
list(options = {}) {
|
|
62
|
-
const parsed =
|
|
59
|
+
const parsed = parseArgument(options, listOptionsSchema, 'ActorCollectionListOptions');
|
|
63
60
|
return this._listPaginated(parsed);
|
|
64
61
|
}
|
|
65
62
|
/**
|
|
@@ -70,23 +67,22 @@ class ActorCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
70
67
|
* @see https://docs.apify.com/api/v2/acts-post
|
|
71
68
|
*/
|
|
72
69
|
async create(actor) {
|
|
73
|
-
|
|
70
|
+
parseArgument(actor, actorCreateSchema);
|
|
74
71
|
return this._create(actor);
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
|
-
exports.ActorCollectionClient = ActorCollectionClient;
|
|
78
74
|
/**
|
|
79
75
|
* @since Added in 2.12.6
|
|
80
76
|
*/
|
|
81
|
-
var ActorListSortBy;
|
|
77
|
+
export var ActorListSortBy;
|
|
82
78
|
(function (ActorListSortBy) {
|
|
83
79
|
ActorListSortBy["CREATED_AT"] = "createdAt";
|
|
84
80
|
ActorListSortBy["LAST_RUN_STARTED_AT"] = "stats.lastRunStartedAt";
|
|
85
|
-
})(ActorListSortBy || (
|
|
81
|
+
})(ActorListSortBy || (ActorListSortBy = {}));
|
|
86
82
|
// Declared below `ActorListSortBy` because it references it at module load time.
|
|
87
|
-
const listOptionsSchema =
|
|
88
|
-
my:
|
|
89
|
-
...
|
|
90
|
-
desc:
|
|
91
|
-
sortBy:
|
|
83
|
+
const listOptionsSchema = z.strictObject({
|
|
84
|
+
my: z.boolean().optional(),
|
|
85
|
+
...paginationOptionsShape,
|
|
86
|
+
desc: z.boolean().optional(),
|
|
87
|
+
sortBy: z.enum(ActorListSortBy).optional(),
|
|
92
88
|
});
|
|
@@ -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,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ActorEnvVarClient = void 0;
|
|
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 { anyObjectSchema, parseArgument } from '../utils.js';
|
|
6
3
|
/**
|
|
7
4
|
* Client for managing a specific Actor environment variable.
|
|
8
5
|
*
|
|
@@ -26,7 +23,7 @@ const utils_1 = require("../utils");
|
|
|
26
23
|
* @see https://docs.apify.com/platform/actors/development/programming-interface/environment-variables
|
|
27
24
|
* @since Added in 2.1.0
|
|
28
25
|
*/
|
|
29
|
-
class ActorEnvVarClient extends
|
|
26
|
+
export class ActorEnvVarClient extends ResourceClient {
|
|
30
27
|
/**
|
|
31
28
|
* @hidden
|
|
32
29
|
*/
|
|
@@ -53,7 +50,7 @@ class ActorEnvVarClient extends resource_client_1.ResourceClient {
|
|
|
53
50
|
* @see https://docs.apify.com/api/v2/act-version-env-var-put
|
|
54
51
|
*/
|
|
55
52
|
async update(actorEnvVar) {
|
|
56
|
-
|
|
53
|
+
parseArgument(actorEnvVar, anyObjectSchema);
|
|
57
54
|
return this._update(actorEnvVar);
|
|
58
55
|
}
|
|
59
56
|
/**
|
|
@@ -65,4 +62,3 @@ class ActorEnvVarClient extends resource_client_1.ResourceClient {
|
|
|
65
62
|
return this._delete();
|
|
66
63
|
}
|
|
67
64
|
}
|
|
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, PaginationOptions } from '../utils';
|
|
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, PaginationOptions } 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
|
*
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const actorEnvVarSchema = utils_1.anyObjectSchema.optional();
|
|
1
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
|
+
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
3
|
+
const actorEnvVarSchema = anyObjectSchema.optional();
|
|
7
4
|
/**
|
|
8
5
|
* Client for managing the collection of environment variables for an Actor version.
|
|
9
6
|
*
|
|
@@ -31,7 +28,7 @@ const actorEnvVarSchema = utils_1.anyObjectSchema.optional();
|
|
|
31
28
|
* @see https://docs.apify.com/platform/actors/development/programming-interface/environment-variables
|
|
32
29
|
* @since Added in 2.1.0
|
|
33
30
|
*/
|
|
34
|
-
class ActorEnvVarCollectionClient extends
|
|
31
|
+
export class ActorEnvVarCollectionClient extends ResourceCollectionClient {
|
|
35
32
|
/**
|
|
36
33
|
* @hidden
|
|
37
34
|
*/
|
|
@@ -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
|
-
|
|
71
|
+
parseArgument(actorEnvVar, actorEnvVarSchema);
|
|
75
72
|
return this._create(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
|
*
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const actor_env_var_collection_1 = require("./actor_env_var_collection");
|
|
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 { anyObjectSchema, parseArgument } from '../utils.js';
|
|
4
|
+
import { ActorEnvVarClient } from './actor_env_var.js';
|
|
5
|
+
import { ActorEnvVarCollectionClient } from './actor_env_var_collection.js';
|
|
6
|
+
const envVarNameSchema = z.string();
|
|
7
|
+
export { ActorSourceType } from '../models.js';
|
|
12
8
|
/**
|
|
13
9
|
* Client for managing a specific Actor version.
|
|
14
10
|
*
|
|
@@ -30,7 +26,7 @@ Object.defineProperty(exports, "ActorSourceType", { enumerable: true, get: funct
|
|
|
30
26
|
*
|
|
31
27
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
32
28
|
*/
|
|
33
|
-
class ActorVersionClient extends
|
|
29
|
+
export class ActorVersionClient extends ResourceClient {
|
|
34
30
|
/**
|
|
35
31
|
* @hidden
|
|
36
32
|
*/
|
|
@@ -57,7 +53,7 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
57
53
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
58
54
|
*/
|
|
59
55
|
async update(newFields) {
|
|
60
|
-
|
|
56
|
+
parseArgument(newFields, anyObjectSchema);
|
|
61
57
|
return this._update(newFields);
|
|
62
58
|
}
|
|
63
59
|
/**
|
|
@@ -77,8 +73,8 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
77
73
|
* @since Added in 2.1.0
|
|
78
74
|
*/
|
|
79
75
|
envVar(envVarName) {
|
|
80
|
-
|
|
81
|
-
return new
|
|
76
|
+
parseArgument(envVarName, envVarNameSchema);
|
|
77
|
+
return new ActorEnvVarClient(this._subResourceOptions({
|
|
82
78
|
id: envVarName,
|
|
83
79
|
}));
|
|
84
80
|
}
|
|
@@ -90,7 +86,6 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
90
86
|
* @since Added in 2.1.0
|
|
91
87
|
*/
|
|
92
88
|
envVars() {
|
|
93
|
-
return new
|
|
89
|
+
return new ActorEnvVarCollectionClient(this._subResourceOptions());
|
|
94
90
|
}
|
|
95
91
|
}
|
|
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, PaginationOptions } from '../utils';
|
|
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, PaginationOptions } 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
|
*
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const actorVersionSchema = utils_1.anyObjectSchema.optional();
|
|
1
|
+
import { ResourceCollectionClient } from '../base/resource_collection_client.js';
|
|
2
|
+
import { anyObjectSchema, parseArgument } from '../utils.js';
|
|
3
|
+
const actorVersionSchema = anyObjectSchema.optional();
|
|
7
4
|
/**
|
|
8
5
|
* Client for managing the collection of Actor versions.
|
|
9
6
|
*
|
|
@@ -28,7 +25,7 @@ const actorVersionSchema = utils_1.anyObjectSchema.optional();
|
|
|
28
25
|
*
|
|
29
26
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
30
27
|
*/
|
|
31
|
-
class ActorVersionCollectionClient extends
|
|
28
|
+
export class ActorVersionCollectionClient extends ResourceCollectionClient {
|
|
32
29
|
/**
|
|
33
30
|
* @hidden
|
|
34
31
|
*/
|
|
@@ -68,8 +65,7 @@ class ActorVersionCollectionClient extends resource_collection_client_1.Resource
|
|
|
68
65
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
69
66
|
*/
|
|
70
67
|
async create(actorVersion) {
|
|
71
|
-
|
|
68
|
+
parseArgument(actorVersion, actorVersionSchema);
|
|
72
69
|
return this._create(actorVersion);
|
|
73
70
|
}
|
|
74
71
|
}
|
|
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
|
*
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const log_1 = require("./log");
|
|
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 { cast, parseArgument, parseDateFields, pluckData } from '../utils.js';
|
|
4
|
+
import { LogClient } from './log.js';
|
|
5
|
+
const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional() });
|
|
6
|
+
const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional() });
|
|
10
7
|
/**
|
|
11
8
|
* Client for managing a specific Actor build.
|
|
12
9
|
*
|
|
@@ -30,7 +27,7 @@ const waitForFinishOptionsSchema = zod_1.z.strictObject({ waitSecs: zod_1.z.numb
|
|
|
30
27
|
*
|
|
31
28
|
* @see https://docs.apify.com/platform/actors/running/runs-and-builds#builds
|
|
32
29
|
*/
|
|
33
|
-
class BuildClient extends
|
|
30
|
+
export class BuildClient extends ResourceClient {
|
|
34
31
|
/**
|
|
35
32
|
* @hidden
|
|
36
33
|
*/
|
|
@@ -59,7 +56,7 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
59
56
|
* ```
|
|
60
57
|
*/
|
|
61
58
|
async get(options = {}) {
|
|
62
|
-
const parsed =
|
|
59
|
+
const parsed = parseArgument(options, getOptionsSchema, 'BuildClientGetOptions');
|
|
63
60
|
return this._get(parsed);
|
|
64
61
|
}
|
|
65
62
|
/**
|
|
@@ -81,7 +78,7 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
81
78
|
method: 'POST',
|
|
82
79
|
params: this._params(),
|
|
83
80
|
});
|
|
84
|
-
return
|
|
81
|
+
return cast(parseDateFields(pluckData(response.data)));
|
|
85
82
|
}
|
|
86
83
|
/**
|
|
87
84
|
* Deletes the Actor build.
|
|
@@ -138,7 +135,7 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
138
135
|
* ```
|
|
139
136
|
*/
|
|
140
137
|
async waitForFinish(options = {}) {
|
|
141
|
-
const parsed =
|
|
138
|
+
const parsed = parseArgument(options, waitForFinishOptionsSchema, 'BuildClientWaitForFinishOptions');
|
|
142
139
|
return this._waitForFinish(parsed);
|
|
143
140
|
}
|
|
144
141
|
/**
|
|
@@ -156,9 +153,8 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
156
153
|
* @since Added in 2.9.0
|
|
157
154
|
*/
|
|
158
155
|
log() {
|
|
159
|
-
return new
|
|
156
|
+
return new LogClient(this._subResourceOptions({
|
|
160
157
|
resourcePath: 'log',
|
|
161
158
|
}));
|
|
162
159
|
}
|
|
163
160
|
}
|
|
164
|
-
exports.BuildClient = BuildClient;
|