apify-client 3.0.0-beta.1 → 3.0.0-beta.10
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 +5 -4
- package/dist/base/resource_client.js +17 -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 +5 -5
- package/dist/resource_clients/build.js +14 -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 +6 -6
- package/dist/resource_clients/dataset.js +73 -76
- 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 +2 -2
- package/dist/resource_clients/log.js +15 -22
- 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 +8 -8
- package/dist/resource_clients/run.js +50 -53
- 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 +13 -15
- 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 +9 -9
- package/dist/resource_clients/task.js +47 -50
- 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 +5 -5
- package/dist/resource_clients/user.js +11 -16
- package/dist/resource_clients/webhook.d.ts +6 -6
- package/dist/resource_clients/webhook.js +11 -14
- 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 +19 -24
- package/dist/utils.js +57 -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
package/dist/models.d.ts
CHANGED
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
* nullability and optionality are adopted rather than papered over.
|
|
25
25
|
*/
|
|
26
26
|
import type { ACTOR_JOB_STATUSES, ACTOR_PERMISSION_LEVEL, META_ORIGINS, RUN_GENERAL_ACCESS, STORAGE_GENERAL_ACCESS, ValueOf, WEBHOOK_EVENT_TYPES } from '@apify/consts';
|
|
27
|
-
import type { components } from './generated/api';
|
|
28
|
-
import type { Timezone } from './timezones';
|
|
29
|
-
import type { Dictionary } from './utils';
|
|
27
|
+
import type { components } from './generated/api.js';
|
|
28
|
+
import type { Timezone } from './timezones.js';
|
|
29
|
+
import type { Dictionary } from './utils.js';
|
|
30
30
|
type Schemas = components['schemas'];
|
|
31
31
|
/**
|
|
32
32
|
* Event types that can trigger webhooks.
|
|
@@ -48,6 +48,12 @@ export declare enum WebhookDispatchStatus {
|
|
|
48
48
|
Succeeded = "SUCCEEDED",
|
|
49
49
|
Failed = "FAILED"
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Machine-readable type of an error returned by the Apify API, carried by `ApifyApiError.type`.
|
|
53
|
+
*
|
|
54
|
+
* Declared here, next to the other spec-derived types, and re-exported from `./apify_api_error`.
|
|
55
|
+
*/
|
|
56
|
+
export type ApifyApiErrorType = Schemas['ErrorType'];
|
|
51
57
|
/**
|
|
52
58
|
* Fields the API returns on a dataset that the OpenAPI spec does not describe yet.
|
|
53
59
|
*
|
|
@@ -59,9 +65,9 @@ export interface DatasetSpecGaps {
|
|
|
59
65
|
}
|
|
60
66
|
export interface DatasetRePointed {
|
|
61
67
|
stats?: DatasetStats;
|
|
68
|
+
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
62
69
|
}
|
|
63
70
|
export interface DatasetSpecNarrowings {
|
|
64
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
65
71
|
consoleUrl?: string;
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
@@ -145,8 +151,6 @@ export interface KeyValueStoreSpecGaps {
|
|
|
145
151
|
}
|
|
146
152
|
export interface KeyValueStoreRePointed {
|
|
147
153
|
stats?: KeyValueStoreStats;
|
|
148
|
-
}
|
|
149
|
-
export interface KeyValueStoreSpecNarrowings {
|
|
150
154
|
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
151
155
|
}
|
|
152
156
|
/**
|
|
@@ -155,7 +159,7 @@ export interface KeyValueStoreSpecNarrowings {
|
|
|
155
159
|
* Key-value stores are used to store arbitrary data records or files. Each record is identified
|
|
156
160
|
* by a unique key and can contain any data - JSON objects, strings, binary files, etc.
|
|
157
161
|
*/
|
|
158
|
-
export interface KeyValueStore extends Omit<Schemas['KeyValueStore'], keyof KeyValueStoreRePointed
|
|
162
|
+
export interface KeyValueStore extends Omit<Schemas['KeyValueStore'], keyof KeyValueStoreRePointed>, KeyValueStoreRePointed, KeyValueStoreSpecGaps {
|
|
159
163
|
}
|
|
160
164
|
/** Statistics about Key-Value Store usage and storage. */
|
|
161
165
|
export interface KeyValueStoreStats extends GeneratedKeyValueStoreStats {
|
|
@@ -215,7 +219,7 @@ export interface ActorVersionRePointed {
|
|
|
215
219
|
envVars?: ActorEnvironmentVariable[] | null;
|
|
216
220
|
}
|
|
217
221
|
export interface ActorVersionClientNarrowings {
|
|
218
|
-
sourceType: ActorSourceType
|
|
222
|
+
sourceType: `${ActorSourceType}`;
|
|
219
223
|
}
|
|
220
224
|
/**
|
|
221
225
|
* Fields every Actor version carries, whatever its source type.
|
|
@@ -224,26 +228,26 @@ export interface ActorVersionClientNarrowings {
|
|
|
224
228
|
* keeps a union discriminated on `sourceType` instead, because that narrows the source location down
|
|
225
229
|
* to the single field which applies -- so the four are dropped here and reinstated per variant.
|
|
226
230
|
*/
|
|
227
|
-
export interface BaseActorVersion<SourceType extends ActorSourceType
|
|
231
|
+
export interface BaseActorVersion<SourceType extends `${ActorSourceType}`> extends Omit<GeneratedVersion, keyof ActorVersionClientNarrowings | keyof ActorVersionRePointed | ActorVersionSourceLocation>, ActorVersionRePointed {
|
|
228
232
|
sourceType: SourceType;
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
235
|
* An Actor version whose source code is stored on the Apify platform.
|
|
232
236
|
* @since Added in 2.6.1
|
|
233
237
|
*/
|
|
234
|
-
export interface ActorVersionSourceFiles extends BaseActorVersion
|
|
238
|
+
export interface ActorVersionSourceFiles extends BaseActorVersion<`${ActorSourceType.SourceFiles}`> {
|
|
235
239
|
sourceFiles: (ActorVersionSourceFile | ActorVersionSourceFolder)[];
|
|
236
240
|
}
|
|
237
241
|
/** An Actor version built from a Git repository. */
|
|
238
|
-
export interface ActorVersionGitRepo extends BaseActorVersion
|
|
242
|
+
export interface ActorVersionGitRepo extends BaseActorVersion<`${ActorSourceType.GitRepo}`> {
|
|
239
243
|
gitRepoUrl: NonNullable<GeneratedVersion['gitRepoUrl']>;
|
|
240
244
|
}
|
|
241
245
|
/** An Actor version built from a downloadable tarball or ZIP archive. */
|
|
242
|
-
export interface ActorVersionTarball extends BaseActorVersion
|
|
246
|
+
export interface ActorVersionTarball extends BaseActorVersion<`${ActorSourceType.Tarball}`> {
|
|
243
247
|
tarballUrl: NonNullable<GeneratedVersion['tarballUrl']>;
|
|
244
248
|
}
|
|
245
249
|
/** An Actor version built from a GitHub Gist. */
|
|
246
|
-
export interface ActorVersionGitHubGist extends BaseActorVersion
|
|
250
|
+
export interface ActorVersionGitHubGist extends BaseActorVersion<`${ActorSourceType.GitHubGist}`> {
|
|
247
251
|
gitHubGistUrl: NonNullable<GeneratedVersion['gitHubGistUrl']>;
|
|
248
252
|
}
|
|
249
253
|
/**
|
|
@@ -252,7 +256,7 @@ export interface ActorVersionGitHubGist extends BaseActorVersion<ActorSourceType
|
|
|
252
256
|
* It carries no source location of its own, so it adds nothing to `BaseActorVersion`; the variant
|
|
253
257
|
* exists so that `SOURCE_CODE`, which both the spec and `@apify/consts` list, is representable.
|
|
254
258
|
*/
|
|
255
|
-
export interface ActorVersionSourceCode extends BaseActorVersion
|
|
259
|
+
export interface ActorVersionSourceCode extends BaseActorVersion<`${ActorSourceType.SourceCode}`> {
|
|
256
260
|
}
|
|
257
261
|
/** A version of an Actor, discriminated on where its source code comes from. */
|
|
258
262
|
export type ActorVersion = ActorVersionSourceFiles | ActorVersionGitRepo | ActorVersionTarball | ActorVersionGitHubGist | ActorVersionSourceCode;
|
|
@@ -310,11 +314,7 @@ export interface ActorDefinitionSpecGaps {
|
|
|
310
314
|
*/
|
|
311
315
|
output?: object | null;
|
|
312
316
|
}
|
|
313
|
-
|
|
314
|
-
readme?: string | null;
|
|
315
|
-
input?: object | null;
|
|
316
|
-
changelog?: string | null;
|
|
317
|
-
}
|
|
317
|
+
type GeneratedActorDefinition = Schemas['ActorDefinition'];
|
|
318
318
|
/**
|
|
319
319
|
* Actor definition from the `.actor/actor.json` file.
|
|
320
320
|
*
|
|
@@ -322,7 +322,7 @@ export interface ActorDefinitionSpecNarrowings {
|
|
|
322
322
|
* @see https://docs.apify.com/platform/actors/development/actor-definition/actor-json
|
|
323
323
|
* @since Added in 2.11.0
|
|
324
324
|
*/
|
|
325
|
-
export interface ActorDefinition extends
|
|
325
|
+
export interface ActorDefinition extends GeneratedActorDefinition, ActorDefinitionSpecGaps {
|
|
326
326
|
}
|
|
327
327
|
export interface ActorChargeEventRePointed {
|
|
328
328
|
eventTieredPricingUsd?: TieredPricingPerEvent;
|
|
@@ -571,6 +571,7 @@ export interface ActorRun extends Omit<Schemas['Run'], keyof ActorRunRePointed |
|
|
|
571
571
|
}
|
|
572
572
|
type GeneratedTaskStats = Schemas['TaskStats'];
|
|
573
573
|
type GeneratedTaskOptions = Schemas['TaskOptions'];
|
|
574
|
+
type GeneratedTaskPublicConfig = Schemas['TaskPublicConfig'];
|
|
574
575
|
type GeneratedCurrentPricingInfo = Schemas['CurrentPricingInfo'];
|
|
575
576
|
/** Statistics about Actor task usage. */
|
|
576
577
|
export interface TaskStats extends GeneratedTaskStats {
|
|
@@ -586,14 +587,7 @@ export interface TaskOptions extends GeneratedTaskOptions {
|
|
|
586
587
|
* {@apilink TaskClient.unpublish} to change the publication state.
|
|
587
588
|
* @since Added in 2.25.0
|
|
588
589
|
*/
|
|
589
|
-
export interface TaskPublicConfig {
|
|
590
|
-
publishedAt: Date | null;
|
|
591
|
-
seoTitle?: string | null;
|
|
592
|
-
seoDescription?: string | null;
|
|
593
|
-
categorization?: string | null;
|
|
594
|
-
inputSchemaFields?: string[] | null;
|
|
595
|
-
datasetName?: string | null;
|
|
596
|
-
datasetView?: string | null;
|
|
590
|
+
export interface TaskPublicConfig extends GeneratedTaskPublicConfig {
|
|
597
591
|
}
|
|
598
592
|
/**
|
|
599
593
|
* Fields the API returns on a task that the OpenAPI spec does not describe yet.
|
|
@@ -602,23 +596,12 @@ export interface TaskPublicConfig {
|
|
|
602
596
|
*/
|
|
603
597
|
export interface TaskSpecGaps {
|
|
604
598
|
description?: string;
|
|
605
|
-
/**
|
|
606
|
-
* Whether the task is published on its public landing page. Derived from
|
|
607
|
-
* `publicConfig.publishedAt` -- set it on update to publish or unpublish the task.
|
|
608
|
-
* @since Added in 2.25.0
|
|
609
|
-
*/
|
|
610
|
-
isPublic?: boolean;
|
|
611
|
-
/**
|
|
612
|
-
* @since Added in 2.25.0
|
|
613
|
-
*/
|
|
614
|
-
publicConfig?: TaskPublicConfig | null;
|
|
615
599
|
}
|
|
616
600
|
export interface TaskRePointed {
|
|
617
601
|
stats?: TaskStats | null;
|
|
618
602
|
options?: TaskOptions | null;
|
|
619
603
|
actorStandby?: ActorStandby | null;
|
|
620
|
-
|
|
621
|
-
export interface TaskSpecNarrowings {
|
|
604
|
+
publicConfig?: TaskPublicConfig | null;
|
|
622
605
|
input?: Dictionary | Dictionary[] | null;
|
|
623
606
|
}
|
|
624
607
|
/**
|
|
@@ -627,7 +610,7 @@ export interface TaskSpecNarrowings {
|
|
|
627
610
|
* Tasks are saved Actor configurations with input and settings that can be executed
|
|
628
611
|
* repeatedly without having to specify the full input each time.
|
|
629
612
|
*/
|
|
630
|
-
export interface Task extends Omit<Schemas['Task'], keyof TaskRePointed
|
|
613
|
+
export interface Task extends Omit<Schemas['Task'], keyof TaskRePointed>, TaskRePointed, TaskSpecGaps {
|
|
631
614
|
}
|
|
632
615
|
export interface TaskListRePointed {
|
|
633
616
|
stats?: TaskStats | null;
|
|
@@ -756,7 +739,7 @@ export interface ScheduledActorRunInput extends GeneratedScheduleActionRunInput
|
|
|
756
739
|
export interface ScheduledActorRunOptions extends GeneratedTaskOptions {
|
|
757
740
|
}
|
|
758
741
|
export interface ScheduleActionRunActorRePointed {
|
|
759
|
-
type: ScheduleActions.RunActor
|
|
742
|
+
type: `${ScheduleActions.RunActor}`;
|
|
760
743
|
runInput?: ScheduledActorRunInput | null;
|
|
761
744
|
runOptions?: ScheduledActorRunOptions | null;
|
|
762
745
|
}
|
|
@@ -764,13 +747,17 @@ export interface ScheduleActionRunActorRePointed {
|
|
|
764
747
|
export interface ScheduleActionRunActor extends Omit<Schemas['ScheduleActionRunActor'], keyof ScheduleActionRunActorRePointed>, ScheduleActionRunActorRePointed {
|
|
765
748
|
}
|
|
766
749
|
export interface ScheduleActionRunActorTaskRePointed {
|
|
767
|
-
type: ScheduleActions.RunActorTask
|
|
750
|
+
type: `${ScheduleActions.RunActorTask}`;
|
|
768
751
|
}
|
|
769
752
|
/** Scheduled action to run an Actor task. */
|
|
770
753
|
export interface ScheduleActionRunActorTask extends Omit<Schemas['ScheduleActionRunActorTask'], keyof ScheduleActionRunActorTaskRePointed>, ScheduleActionRunActorTaskRePointed {
|
|
771
754
|
}
|
|
772
755
|
/** Union type representing all possible scheduled actions. */
|
|
773
756
|
export type ScheduleAction = ScheduleActionRunActor | ScheduleActionRunActorTask;
|
|
757
|
+
type GeneratedScheduleInvoked = Schemas['ScheduleInvoked'];
|
|
758
|
+
/** One entry of a schedule's log: an invocation of the schedule and how it went. */
|
|
759
|
+
export interface ScheduleInvoked extends GeneratedScheduleInvoked {
|
|
760
|
+
}
|
|
774
761
|
export interface ScheduleRePointed {
|
|
775
762
|
actions: ScheduleAction[];
|
|
776
763
|
}
|
|
@@ -850,11 +837,8 @@ export interface UserPlan extends Omit<Schemas['Plan'], keyof UserPlanRePointed>
|
|
|
850
837
|
export interface UserRePointed {
|
|
851
838
|
profile?: UserProfile;
|
|
852
839
|
proxy?: UserProxy;
|
|
853
|
-
}
|
|
854
|
-
export interface UserSpecNarrowings {
|
|
855
840
|
plan?: UserPlan;
|
|
856
841
|
effectivePlatformFeatures?: EffectivePlatformFeatures;
|
|
857
|
-
isPaying?: boolean;
|
|
858
842
|
}
|
|
859
843
|
/**
|
|
860
844
|
* A user account.
|
|
@@ -862,7 +846,7 @@ export interface UserSpecNarrowings {
|
|
|
862
846
|
* The private fields are only populated for `GET /v2/users/me`, which needs a token; the public
|
|
863
847
|
* endpoint returns the username and profile alone.
|
|
864
848
|
*/
|
|
865
|
-
export interface User extends Omit<Schemas['UserPrivateInfo'], keyof UserRePointed
|
|
849
|
+
export interface User extends Omit<Schemas['UserPrivateInfo'], keyof UserRePointed>, UserRePointed {
|
|
866
850
|
}
|
|
867
851
|
/**
|
|
868
852
|
* The start and end of a billing cycle.
|
|
@@ -897,11 +881,8 @@ export interface ServiceUsage {
|
|
|
897
881
|
export interface DailyServiceUsageRePointed {
|
|
898
882
|
serviceUsage: ServiceUsage;
|
|
899
883
|
}
|
|
900
|
-
export interface DailyServiceUsageClientConversions {
|
|
901
|
-
date: Date;
|
|
902
|
-
}
|
|
903
884
|
/** A single day's usage within a monthly cycle. The spec names this schema `DailyServiceUsages`. */
|
|
904
|
-
export interface DailyServiceUsage extends Omit<Schemas['DailyServiceUsages'], keyof DailyServiceUsageRePointed
|
|
885
|
+
export interface DailyServiceUsage extends Omit<Schemas['DailyServiceUsages'], keyof DailyServiceUsageRePointed>, DailyServiceUsageRePointed {
|
|
905
886
|
}
|
|
906
887
|
export interface MonthlyUsageRePointed {
|
|
907
888
|
usageCycle: UsageCycle;
|
|
@@ -966,9 +947,9 @@ export interface RequestQueueSpecGaps {
|
|
|
966
947
|
}
|
|
967
948
|
export interface RequestQueueRePointed {
|
|
968
949
|
stats?: RequestQueueStats;
|
|
950
|
+
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
969
951
|
}
|
|
970
952
|
export interface RequestQueueSpecNarrowings {
|
|
971
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
972
953
|
consoleUrl?: string;
|
|
973
954
|
}
|
|
974
955
|
/**
|
package/dist/models.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Public models adapted from the generated OpenAPI types in `./generated/api`.
|
|
4
3
|
*
|
|
@@ -24,8 +23,6 @@
|
|
|
24
23
|
* Backward-compatibility shims are deliberately absent. This lands in the next major, so the spec's
|
|
25
24
|
* nullability and optionality are adopted rather than papered over.
|
|
26
25
|
*/
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.PlatformFeature = exports.ScheduleActions = exports.ActorSourceType = exports.WebhookDispatchStatus = void 0;
|
|
29
26
|
/**
|
|
30
27
|
* Status of a webhook dispatch.
|
|
31
28
|
*
|
|
@@ -33,12 +30,12 @@ exports.PlatformFeature = exports.ScheduleActions = exports.ActorSourceType = ex
|
|
|
33
30
|
* reference it without closing an import cycle. It is re-exported from there, so the public name and
|
|
34
31
|
* import path are unchanged.
|
|
35
32
|
*/
|
|
36
|
-
var WebhookDispatchStatus;
|
|
33
|
+
export var WebhookDispatchStatus;
|
|
37
34
|
(function (WebhookDispatchStatus) {
|
|
38
35
|
WebhookDispatchStatus["Active"] = "ACTIVE";
|
|
39
36
|
WebhookDispatchStatus["Succeeded"] = "SUCCEEDED";
|
|
40
37
|
WebhookDispatchStatus["Failed"] = "FAILED";
|
|
41
|
-
})(WebhookDispatchStatus || (
|
|
38
|
+
})(WebhookDispatchStatus || (WebhookDispatchStatus = {}));
|
|
42
39
|
/**
|
|
43
40
|
* Where the source code of an Actor version lives.
|
|
44
41
|
*
|
|
@@ -46,14 +43,14 @@ var WebhookDispatchStatus;
|
|
|
46
43
|
* reference it without closing an import cycle. It is re-exported from there, so the public name and
|
|
47
44
|
* import path are unchanged.
|
|
48
45
|
*/
|
|
49
|
-
var ActorSourceType;
|
|
46
|
+
export var ActorSourceType;
|
|
50
47
|
(function (ActorSourceType) {
|
|
51
48
|
ActorSourceType["SourceFiles"] = "SOURCE_FILES";
|
|
52
49
|
ActorSourceType["GitRepo"] = "GIT_REPO";
|
|
53
50
|
ActorSourceType["Tarball"] = "TARBALL";
|
|
54
51
|
ActorSourceType["GitHubGist"] = "GITHUB_GIST";
|
|
55
52
|
ActorSourceType["SourceCode"] = "SOURCE_CODE";
|
|
56
|
-
})(ActorSourceType || (
|
|
53
|
+
})(ActorSourceType || (ActorSourceType = {}));
|
|
57
54
|
/**
|
|
58
55
|
* Types of actions that can be scheduled.
|
|
59
56
|
*
|
|
@@ -61,11 +58,11 @@ var ActorSourceType;
|
|
|
61
58
|
* without closing an import cycle. It is re-exported from there, so the public name and import path are
|
|
62
59
|
* unchanged.
|
|
63
60
|
*/
|
|
64
|
-
var ScheduleActions;
|
|
61
|
+
export var ScheduleActions;
|
|
65
62
|
(function (ScheduleActions) {
|
|
66
63
|
ScheduleActions["RunActor"] = "RUN_ACTOR";
|
|
67
64
|
ScheduleActions["RunActorTask"] = "RUN_ACTOR_TASK";
|
|
68
|
-
})(ScheduleActions || (
|
|
65
|
+
})(ScheduleActions || (ScheduleActions = {}));
|
|
69
66
|
/**
|
|
70
67
|
* Platform features a plan can enable.
|
|
71
68
|
*
|
|
@@ -77,7 +74,7 @@ var ScheduleActions;
|
|
|
77
74
|
* Declared here rather than in `./resource_clients/user` so the user types can live alongside it. It is
|
|
78
75
|
* re-exported from there, so the public name and import path are unchanged.
|
|
79
76
|
*/
|
|
80
|
-
var PlatformFeature;
|
|
77
|
+
export var PlatformFeature;
|
|
81
78
|
(function (PlatformFeature) {
|
|
82
79
|
PlatformFeature["Actors"] = "ACTORS";
|
|
83
80
|
PlatformFeature["Storage"] = "STORAGE";
|
|
@@ -86,4 +83,4 @@ var PlatformFeature;
|
|
|
86
83
|
PlatformFeature["Webhooks"] = "WEBHOOKS";
|
|
87
84
|
PlatformFeature["Proxy"] = "PROXY";
|
|
88
85
|
PlatformFeature["ProxyExternalAccess"] = "PROXY_EXTERNAL_ACCESS";
|
|
89
|
-
})(PlatformFeature || (
|
|
86
|
+
})(PlatformFeature || (PlatformFeature = {}));
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { ACTOR_JOB_STATUSES, ACTOR_PERMISSION_LEVEL, META_ORIGINS } from '@apify/consts';
|
|
2
2
|
import { Log } from '@apify/log';
|
|
3
|
-
import type { ApiClientSubResourceOptions } from '../base/api_client';
|
|
4
|
-
import { ResourceClient } from '../base/resource_client';
|
|
5
|
-
import type { Actor, ActorRun } from '../models';
|
|
6
|
-
import { ActorVersionClient } from './actor_version';
|
|
7
|
-
import { ActorVersionCollectionClient } from './actor_version_collection';
|
|
8
|
-
import type { Build, BuildClientGetOptions } from './build';
|
|
9
|
-
import { BuildClient } from './build';
|
|
10
|
-
import { BuildCollectionClient } from './build_collection';
|
|
11
|
-
import { RunClient } from './run';
|
|
12
|
-
import { RunCollectionClient } from './run_collection';
|
|
13
|
-
import type { WebhookUpdateData } from './webhook';
|
|
14
|
-
import { WebhookCollectionClient } from './webhook_collection';
|
|
3
|
+
import type { ApiClientSubResourceOptions } from '../base/api_client.js';
|
|
4
|
+
import { ResourceClient } from '../base/resource_client.js';
|
|
5
|
+
import type { Actor, ActorRun } from '../models.js';
|
|
6
|
+
import { ActorVersionClient } from './actor_version.js';
|
|
7
|
+
import { ActorVersionCollectionClient } from './actor_version_collection.js';
|
|
8
|
+
import type { Build, BuildClientGetOptions } from './build.js';
|
|
9
|
+
import { BuildClient } from './build.js';
|
|
10
|
+
import { BuildCollectionClient } from './build_collection.js';
|
|
11
|
+
import { RunClient } from './run.js';
|
|
12
|
+
import { RunCollectionClient } from './run_collection.js';
|
|
13
|
+
import type { WebhookUpdateData } from './webhook.js';
|
|
14
|
+
import { WebhookCollectionClient } from './webhook_collection.js';
|
|
15
15
|
import type { ValueOf } from 'type-fest';
|
|
16
|
-
export type { Actor, ActorChargeEvent, ActorChargeEvents, ActorDefaultRunOptions, ActorDefinition, ActorExampleRunInput, ActorRun, ActorRunListItem, ActorRunMeta, ActorRunMetamorph, ActorRunOptions, ActorRunPricingInfo, ActorRunStats, ActorRunStorageIds, ActorRunUsage, ActorStandby, ActorStats, ActorTaggedBuild, ActorTaggedBuilds, FlatPricePerMonthActorPricingInfo, FreeActorPricingInfo, PricePerDatasetItemActorPricingInfo, PricePerEventActorPricingInfo, TieredPricingPerDatasetItem, TieredPricingPerDatasetItemEntry, TieredPricingPerEvent, TieredPricingPerEventEntry, } from '../models';
|
|
16
|
+
export type { Actor, ActorChargeEvent, ActorChargeEvents, ActorDefaultRunOptions, ActorDefinition, ActorExampleRunInput, ActorRun, ActorRunListItem, ActorRunMeta, ActorRunMetamorph, ActorRunOptions, ActorRunPricingInfo, ActorRunStats, ActorRunStorageIds, ActorRunUsage, ActorStandby, ActorStats, ActorTaggedBuild, ActorTaggedBuilds, FlatPricePerMonthActorPricingInfo, FreeActorPricingInfo, PricePerDatasetItemActorPricingInfo, PricePerEventActorPricingInfo, TieredPricingPerDatasetItem, TieredPricingPerDatasetItemEntry, TieredPricingPerEvent, TieredPricingPerEventEntry, } from '../models.js';
|
|
17
17
|
/**
|
|
18
18
|
* Client for managing a specific Actor.
|
|
19
19
|
*
|
|
@@ -1,57 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 * as schemas from '../schemas.js';
|
|
6
|
+
import { anyObjectSchema, parseArgument, parseResponse, stringifyWebhooksToBase64 } from '../utils.js';
|
|
7
|
+
import { ActorVersionClient } from './actor_version.js';
|
|
8
|
+
import { ActorVersionCollectionClient } from './actor_version_collection.js';
|
|
9
|
+
import { BuildClient } from './build.js';
|
|
10
|
+
import { BuildCollectionClient } from './build_collection.js';
|
|
11
|
+
import { RunClient } from './run.js';
|
|
12
|
+
import { RunCollectionClient } from './run_collection.js';
|
|
13
|
+
import { WebhookCollectionClient } from './webhook_collection.js';
|
|
14
|
+
const startOptionsSchema = z.strictObject({
|
|
15
|
+
build: z.string().optional(),
|
|
16
|
+
contentType: z.string().optional(),
|
|
17
|
+
memory: z.number().optional(),
|
|
18
|
+
timeout: z.number().optional(),
|
|
19
|
+
waitForFinish: z.number().optional(),
|
|
20
|
+
webhooks: z.array(anyObjectSchema).optional(),
|
|
21
|
+
maxItems: z.number().min(0).optional(),
|
|
22
|
+
maxTotalChargeUsd: z.number().min(0).optional(),
|
|
23
|
+
restartOnError: z.boolean().optional(),
|
|
24
|
+
forcePermissionLevel: z.enum(ACTOR_PERMISSION_LEVEL).optional(),
|
|
27
25
|
});
|
|
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:
|
|
26
|
+
const callOptionsSchema = z.strictObject({
|
|
27
|
+
build: z.string().optional(),
|
|
28
|
+
contentType: z.string().optional(),
|
|
29
|
+
memory: z.number().optional(),
|
|
30
|
+
timeout: z.number().min(0).optional(),
|
|
31
|
+
waitSecs: z.number().min(0).optional(),
|
|
32
|
+
webhooks: z.array(anyObjectSchema).optional(),
|
|
33
|
+
maxItems: z.number().min(0).optional(),
|
|
34
|
+
maxTotalChargeUsd: z.number().min(0).optional(),
|
|
35
|
+
log: z.union([z.null(), z.instanceof(Log), z.literal('default')]).optional(),
|
|
36
|
+
restartOnError: z.boolean().optional(),
|
|
37
|
+
forcePermissionLevel: z.enum(ACTOR_PERMISSION_LEVEL).optional(),
|
|
40
38
|
});
|
|
41
|
-
const validateInputOptionsSchema =
|
|
42
|
-
build:
|
|
43
|
-
contentType:
|
|
39
|
+
const validateInputOptionsSchema = z.strictObject({
|
|
40
|
+
build: z.string().optional(),
|
|
41
|
+
contentType: z.string().optional(),
|
|
44
42
|
});
|
|
45
|
-
const versionNumberSchema =
|
|
46
|
-
const buildOptionsSchema =
|
|
47
|
-
betaPackages:
|
|
48
|
-
tag:
|
|
49
|
-
useCache:
|
|
50
|
-
waitForFinish:
|
|
43
|
+
const versionNumberSchema = z.string();
|
|
44
|
+
const buildOptionsSchema = z.strictObject({
|
|
45
|
+
betaPackages: z.boolean().optional(),
|
|
46
|
+
tag: z.string().optional(),
|
|
47
|
+
useCache: z.boolean().optional(),
|
|
48
|
+
waitForFinish: z.number().optional(),
|
|
51
49
|
});
|
|
52
|
-
const lastRunOptionsSchema =
|
|
53
|
-
status:
|
|
54
|
-
origin:
|
|
50
|
+
const lastRunOptionsSchema = z.strictObject({
|
|
51
|
+
status: z.enum(ACTOR_JOB_STATUSES).optional(),
|
|
52
|
+
origin: z.enum(META_ORIGINS).optional(),
|
|
55
53
|
});
|
|
56
54
|
/**
|
|
57
55
|
* Client for managing a specific Actor.
|
|
@@ -73,7 +71,7 @@ const lastRunOptionsSchema = zod_1.z.strictObject({
|
|
|
73
71
|
*
|
|
74
72
|
* @see https://docs.apify.com/platform/actors
|
|
75
73
|
*/
|
|
76
|
-
class ActorClient extends
|
|
74
|
+
export class ActorClient extends ResourceClient {
|
|
77
75
|
/**
|
|
78
76
|
* @hidden
|
|
79
77
|
*/
|
|
@@ -90,7 +88,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
90
88
|
* @see https://docs.apify.com/api/v2/act-get
|
|
91
89
|
*/
|
|
92
90
|
async get() {
|
|
93
|
-
return this._get();
|
|
91
|
+
return this._get(schemas.Actor());
|
|
94
92
|
}
|
|
95
93
|
/**
|
|
96
94
|
* Updates the Actor with specified fields.
|
|
@@ -100,8 +98,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
100
98
|
* @see https://docs.apify.com/api/v2/act-put
|
|
101
99
|
*/
|
|
102
100
|
async update(newFields) {
|
|
103
|
-
|
|
104
|
-
return this._update(newFields);
|
|
101
|
+
parseArgument(newFields, anyObjectSchema);
|
|
102
|
+
return this._update(schemas.Actor(), newFields);
|
|
105
103
|
}
|
|
106
104
|
/**
|
|
107
105
|
* Deletes the Actor.
|
|
@@ -148,14 +146,14 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
148
146
|
async start(input, options = {}) {
|
|
149
147
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
150
148
|
// then it will process input as a buffer.
|
|
151
|
-
const parsed =
|
|
149
|
+
const parsed = parseArgument(options, startOptionsSchema, 'ActorStartOptions');
|
|
152
150
|
const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel, } = parsed;
|
|
153
151
|
const params = {
|
|
154
152
|
waitForFinish,
|
|
155
153
|
timeout,
|
|
156
154
|
memory,
|
|
157
155
|
build,
|
|
158
|
-
webhooks:
|
|
156
|
+
webhooks: stringifyWebhooksToBase64(parsed.webhooks),
|
|
159
157
|
maxItems,
|
|
160
158
|
maxTotalChargeUsd,
|
|
161
159
|
restartOnError,
|
|
@@ -176,7 +174,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
176
174
|
};
|
|
177
175
|
}
|
|
178
176
|
const response = await this.httpClient.call(request);
|
|
179
|
-
return (
|
|
177
|
+
return parseResponse(response, schemas.Run());
|
|
180
178
|
}
|
|
181
179
|
/**
|
|
182
180
|
* Starts the Actor and waits for it to finish before returning the Run object.
|
|
@@ -218,7 +216,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
218
216
|
async call(input, options = {}) {
|
|
219
217
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
220
218
|
// then it will process input as a buffer.
|
|
221
|
-
const parsed =
|
|
219
|
+
const parsed = parseArgument(options, callOptionsSchema, 'ActorCallOptions');
|
|
222
220
|
const { waitSecs, log, ...startOptions } = parsed;
|
|
223
221
|
const { id } = await this.start(input, startOptions);
|
|
224
222
|
// Calling root client because we need access to top level API.
|
|
@@ -268,7 +266,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
268
266
|
async validateInput(input, options = {}) {
|
|
269
267
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
270
268
|
// then it will process input as a buffer.
|
|
271
|
-
const parsed =
|
|
269
|
+
const parsed = parseArgument(options, validateInputOptionsSchema, 'ActorValidateInputOptions');
|
|
272
270
|
const request = {
|
|
273
271
|
url: this._url('validate-input'),
|
|
274
272
|
method: 'POST',
|
|
@@ -316,8 +314,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
316
314
|
* ```
|
|
317
315
|
*/
|
|
318
316
|
async build(versionNumber, options = {}) {
|
|
319
|
-
|
|
320
|
-
const parsed =
|
|
317
|
+
parseArgument(versionNumber, versionNumberSchema);
|
|
318
|
+
const parsed = parseArgument(options, buildOptionsSchema, 'ActorBuildOptions');
|
|
321
319
|
const response = await this.httpClient.call({
|
|
322
320
|
url: this._url('builds'),
|
|
323
321
|
method: 'POST',
|
|
@@ -326,7 +324,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
326
324
|
...parsed,
|
|
327
325
|
}),
|
|
328
326
|
});
|
|
329
|
-
return (
|
|
327
|
+
return parseResponse(response, schemas.Build());
|
|
330
328
|
}
|
|
331
329
|
/**
|
|
332
330
|
* Returns a client for the default build of this Actor.
|
|
@@ -359,8 +357,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
359
357
|
method: 'GET',
|
|
360
358
|
params: this._params(options),
|
|
361
359
|
});
|
|
362
|
-
const { id } = (
|
|
363
|
-
return new
|
|
360
|
+
const { id } = parseResponse(response, schemas.Build());
|
|
361
|
+
return new BuildClient({
|
|
364
362
|
baseUrl: this.apifyClient.baseUrl,
|
|
365
363
|
publicBaseUrl: this.apifyClient.publicBaseUrl,
|
|
366
364
|
httpClient: this.httpClient,
|
|
@@ -386,8 +384,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
386
384
|
* ```
|
|
387
385
|
*/
|
|
388
386
|
lastRun(options = {}) {
|
|
389
|
-
const parsed =
|
|
390
|
-
return new
|
|
387
|
+
const parsed = parseArgument(options, lastRunOptionsSchema, 'ActorLastRunOptions');
|
|
388
|
+
return new RunClient(this._subResourceOptions({
|
|
391
389
|
id: 'last',
|
|
392
390
|
params: this._params(parsed),
|
|
393
391
|
resourcePath: 'runs',
|
|
@@ -400,7 +398,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
400
398
|
* @see https://docs.apify.com/api/v2/act-builds-get
|
|
401
399
|
*/
|
|
402
400
|
builds() {
|
|
403
|
-
return new
|
|
401
|
+
return new BuildCollectionClient(this._subResourceOptions({
|
|
404
402
|
resourcePath: 'builds',
|
|
405
403
|
}));
|
|
406
404
|
}
|
|
@@ -411,7 +409,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
411
409
|
* @see https://docs.apify.com/api/v2/act-runs-get
|
|
412
410
|
*/
|
|
413
411
|
runs() {
|
|
414
|
-
return new
|
|
412
|
+
return new RunCollectionClient(this._subResourceOptions({
|
|
415
413
|
resourcePath: 'runs',
|
|
416
414
|
}));
|
|
417
415
|
}
|
|
@@ -423,8 +421,8 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
423
421
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
424
422
|
*/
|
|
425
423
|
version(versionNumber) {
|
|
426
|
-
|
|
427
|
-
return new
|
|
424
|
+
parseArgument(versionNumber, versionNumberSchema);
|
|
425
|
+
return new ActorVersionClient(this._subResourceOptions({
|
|
428
426
|
id: versionNumber,
|
|
429
427
|
}));
|
|
430
428
|
}
|
|
@@ -435,7 +433,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
435
433
|
* @see https://docs.apify.com/api/v2/act-versions-get
|
|
436
434
|
*/
|
|
437
435
|
versions() {
|
|
438
|
-
return new
|
|
436
|
+
return new ActorVersionCollectionClient(this._subResourceOptions());
|
|
439
437
|
}
|
|
440
438
|
/**
|
|
441
439
|
* Returns a client for managing webhooks associated with this Actor.
|
|
@@ -444,7 +442,6 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
444
442
|
* @see https://docs.apify.com/api/v2/act-webhooks-get
|
|
445
443
|
*/
|
|
446
444
|
webhooks() {
|
|
447
|
-
return new
|
|
445
|
+
return new WebhookCollectionClient(this._subResourceOptions());
|
|
448
446
|
}
|
|
449
447
|
}
|
|
450
|
-
exports.ActorClient = ActorClient;
|