apify-client 2.25.1-beta.8 → 3.0.0-beta.1

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.
Files changed (60) hide show
  1. package/dist/apify_client.js +34 -30
  2. package/dist/argument_validation_error.d.ts +17 -0
  3. package/dist/argument_validation_error.js +157 -0
  4. package/dist/base/api_client.d.ts +2 -2
  5. package/dist/base/api_client.js +13 -10
  6. package/dist/bundle.js +66 -28147
  7. package/dist/bundle.js.LICENSE.txt +33 -0
  8. package/dist/bundle.js.map +1 -1
  9. package/dist/generated/api.d.ts +20522 -0
  10. package/dist/generated/api.js +6 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +1 -0
  13. package/dist/index.mjs +1 -0
  14. package/dist/models.d.ts +1072 -0
  15. package/dist/models.js +89 -0
  16. package/dist/resource_clients/actor.d.ts +2 -448
  17. package/dist/resource_clients/actor.js +60 -55
  18. package/dist/resource_clients/actor_collection.d.ts +2 -7
  19. package/dist/resource_clients/actor_collection.js +13 -11
  20. package/dist/resource_clients/actor_env_var.js +2 -3
  21. package/dist/resource_clients/actor_env_var_collection.js +3 -3
  22. package/dist/resource_clients/actor_version.d.ts +3 -40
  23. package/dist/resource_clients/actor_version.js +8 -12
  24. package/dist/resource_clients/actor_version_collection.js +3 -3
  25. package/dist/resource_clients/build.d.ts +2 -77
  26. package/dist/resource_clients/build.js +7 -10
  27. package/dist/resource_clients/build_collection.d.ts +2 -2
  28. package/dist/resource_clients/build_collection.js +8 -8
  29. package/dist/resource_clients/dataset.d.ts +8 -72
  30. package/dist/resource_clients/dataset.js +66 -57
  31. package/dist/resource_clients/dataset_collection.js +14 -12
  32. package/dist/resource_clients/key_value_store.d.ts +5 -73
  33. package/dist/resource_clients/key_value_store.js +69 -51
  34. package/dist/resource_clients/key_value_store_collection.js +14 -12
  35. package/dist/resource_clients/request_queue.d.ts +15 -174
  36. package/dist/resource_clients/request_queue.js +85 -91
  37. package/dist/resource_clients/request_queue_collection.js +12 -11
  38. package/dist/resource_clients/run.js +39 -40
  39. package/dist/resource_clients/run_collection.js +12 -11
  40. package/dist/resource_clients/schedule.d.ts +3 -81
  41. package/dist/resource_clients/schedule.js +4 -12
  42. package/dist/resource_clients/schedule_collection.js +10 -9
  43. package/dist/resource_clients/store_collection.d.ts +2 -30
  44. package/dist/resource_clients/store_collection.js +13 -13
  45. package/dist/resource_clients/task.d.ts +3 -73
  46. package/dist/resource_clients/task.js +36 -33
  47. package/dist/resource_clients/task_collection.d.ts +2 -1
  48. package/dist/resource_clients/task_collection.js +9 -9
  49. package/dist/resource_clients/user.d.ts +3 -179
  50. package/dist/resource_clients/user.js +3 -11
  51. package/dist/resource_clients/webhook.d.ts +2 -61
  52. package/dist/resource_clients/webhook.js +1 -3
  53. package/dist/resource_clients/webhook_collection.js +10 -9
  54. package/dist/resource_clients/webhook_dispatch.d.ts +3 -36
  55. package/dist/resource_clients/webhook_dispatch.js +3 -7
  56. package/dist/resource_clients/webhook_dispatch_collection.js +8 -8
  57. package/dist/statistics.js +4 -3
  58. package/dist/utils.d.ts +51 -5
  59. package/dist/utils.js +103 -15
  60. package/package.json +22 -7
@@ -1,7 +1,9 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client';
2
2
  import { ResourceClient } from '../base/resource_client';
3
- import type { Timezone } from '../timezones';
3
+ import type { Schedule, ScheduleAction } from '../models';
4
4
  import type { DistributiveOptional } from '../utils';
5
+ export type { Schedule, ScheduleAction, ScheduleActionRunActor, ScheduleActionRunActorTask, ScheduledActorRunInput, ScheduledActorRunOptions, } from '../models';
6
+ export { ScheduleActions } from '../models';
5
7
  /**
6
8
  * Client for managing a specific Schedule.
7
9
  *
@@ -59,36 +61,6 @@ export declare class ScheduleClient extends ResourceClient {
59
61
  */
60
62
  getLog(): Promise<string | undefined>;
61
63
  }
62
- /**
63
- * Represents a schedule for automated Actor or Task runs.
64
- *
65
- * Schedules use cron expressions to define when Actors or Tasks should run automatically.
66
- */
67
- export interface Schedule {
68
- id: string;
69
- userId: string;
70
- name: string;
71
- /**
72
- * @since Added in 2.6.1
73
- */
74
- title?: string;
75
- cronExpression: string;
76
- timezone: Timezone;
77
- isEnabled: boolean;
78
- isExclusive: boolean;
79
- description?: string;
80
- createdAt: Date;
81
- modifiedAt: Date;
82
- nextRunAt: string;
83
- lastRunAt: string;
84
- actions: ScheduleAction[];
85
- /**
86
- * @since Added in 2.9.4
87
- */
88
- notifications: {
89
- email: boolean;
90
- };
91
- }
92
64
  /**
93
65
  * Data for creating or updating a Schedule.
94
66
  * @since Added in 2.6.2
@@ -96,53 +68,3 @@ export interface Schedule {
96
68
  export type ScheduleCreateOrUpdateData = Partial<Pick<Schedule, 'name' | 'title' | 'cronExpression' | 'timezone' | 'isEnabled' | 'isExclusive' | 'description' | 'notifications'> & {
97
69
  actions: DistributiveOptional<ScheduleAction, 'id'>[];
98
70
  }>;
99
- /**
100
- * Types of actions that can be scheduled.
101
- */
102
- export declare enum ScheduleActions {
103
- RunActor = "RUN_ACTOR",
104
- RunActorTask = "RUN_ACTOR_TASK"
105
- }
106
- interface BaseScheduleAction<Type extends ScheduleActions> {
107
- id: string;
108
- type: Type;
109
- }
110
- /**
111
- * Union type representing all possible scheduled actions.
112
- */
113
- export type ScheduleAction = ScheduleActionRunActor | ScheduleActionRunActorTask;
114
- /**
115
- * Scheduled action to run an Actor.
116
- */
117
- export interface ScheduleActionRunActor extends BaseScheduleAction<ScheduleActions.RunActor> {
118
- actorId: string;
119
- runInput?: ScheduledActorRunInput;
120
- runOptions?: ScheduledActorRunOptions;
121
- }
122
- /**
123
- * Input configuration for a scheduled Actor run.
124
- */
125
- export interface ScheduledActorRunInput {
126
- body: string;
127
- contentType: string;
128
- }
129
- /**
130
- * Run options for a scheduled Actor run.
131
- */
132
- export interface ScheduledActorRunOptions {
133
- build: string;
134
- timeoutSecs: number;
135
- memoryMbytes: number;
136
- /**
137
- * @since Added in 2.19.0
138
- */
139
- restartOnError?: boolean;
140
- }
141
- /**
142
- * Scheduled action to run an Actor task.
143
- */
144
- export interface ScheduleActionRunActorTask extends BaseScheduleAction<ScheduleActions.RunActorTask> {
145
- actorTaskId: string;
146
- input?: string;
147
- }
148
- export {};
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScheduleActions = exports.ScheduleClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const ow_1 = tslib_1.__importDefault(require("ow"));
3
+ exports.ScheduleClient = exports.ScheduleActions = void 0;
6
4
  const resource_client_1 = require("../base/resource_client");
7
5
  const utils_1 = require("../utils");
6
+ var models_1 = require("../models");
7
+ Object.defineProperty(exports, "ScheduleActions", { enumerable: true, get: function () { return models_1.ScheduleActions; } });
8
8
  /**
9
9
  * Client for managing a specific Schedule.
10
10
  *
@@ -55,7 +55,7 @@ class ScheduleClient extends resource_client_1.ResourceClient {
55
55
  * @see https://docs.apify.com/api/v2/schedule-put
56
56
  */
57
57
  async update(newFields) {
58
- (0, ow_1.default)(newFields, ow_1.default.object);
58
+ (0, utils_1.parseArgument)(newFields, utils_1.anyObjectSchema);
59
59
  return this._update(newFields);
60
60
  }
61
61
  /**
@@ -89,11 +89,3 @@ class ScheduleClient extends resource_client_1.ResourceClient {
89
89
  }
90
90
  }
91
91
  exports.ScheduleClient = ScheduleClient;
92
- /**
93
- * Types of actions that can be scheduled.
94
- */
95
- var ScheduleActions;
96
- (function (ScheduleActions) {
97
- ScheduleActions["RunActor"] = "RUN_ACTOR";
98
- ScheduleActions["RunActorTask"] = "RUN_ACTOR_TASK";
99
- })(ScheduleActions || (exports.ScheduleActions = ScheduleActions = {}));
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ScheduleCollectionClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const ow_1 = tslib_1.__importDefault(require("ow"));
4
+ const zod_1 = require("zod");
6
5
  const resource_collection_client_1 = require("../base/resource_collection_client");
6
+ const utils_1 = require("../utils");
7
+ const listOptionsSchema = zod_1.z.strictObject({
8
+ ...utils_1.paginationOptionsShape,
9
+ desc: zod_1.z.boolean().optional(),
10
+ });
11
+ const scheduleCreateSchema = utils_1.anyObjectSchema.optional();
7
12
  /**
8
13
  * Client for managing the collection of Schedules in your account.
9
14
  *
@@ -59,12 +64,8 @@ class ScheduleCollectionClient extends resource_collection_client_1.ResourceColl
59
64
  * @see https://docs.apify.com/api/v2/schedules-get
60
65
  */
61
66
  list(options = {}) {
62
- (0, ow_1.default)(options, ow_1.default.object.exactShape({
63
- limit: ow_1.default.optional.number.not.negative,
64
- offset: ow_1.default.optional.number.not.negative,
65
- desc: ow_1.default.optional.boolean,
66
- }));
67
- return this._listPaginated(options);
67
+ const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'ScheduleCollectionListOptions');
68
+ return this._listPaginated(parsed);
68
69
  }
69
70
  /**
70
71
  * Creates a new schedule.
@@ -74,7 +75,7 @@ class ScheduleCollectionClient extends resource_collection_client_1.ResourceColl
74
75
  * @see https://docs.apify.com/api/v2/schedules-post
75
76
  */
76
77
  async create(schedule) {
77
- (0, ow_1.default)(schedule, ow_1.default.optional.object);
78
+ (0, utils_1.parseArgument)(schedule, scheduleCreateSchema);
78
79
  return this._create(schedule);
79
80
  }
80
81
  }
@@ -1,7 +1,8 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client';
2
2
  import { ResourceCollectionClient } from '../base/resource_collection_client';
3
+ import type { ActorStoreList } from '../models';
3
4
  import type { PaginatedIterator, PaginationOptions } from '../utils';
4
- import type { ActorStats } from './actor';
5
+ export type { ActorStoreList, PricingInfo } from '../models';
5
6
  /**
6
7
  * Client for browsing Actors in the Apify Store.
7
8
  *
@@ -50,35 +51,6 @@ export declare class StoreCollectionClient extends ResourceCollectionClient {
50
51
  */
51
52
  list(options?: StoreCollectionListOptions): PaginatedIterator<ActorStoreList>;
52
53
  }
53
- /**
54
- * @since Added in 2.7.2
55
- */
56
- export interface PricingInfo {
57
- pricingModel: string;
58
- }
59
- /**
60
- * @since Added in 2.7.2
61
- */
62
- export interface ActorStoreList {
63
- id: string;
64
- name: string;
65
- username: string;
66
- title?: string;
67
- description?: string;
68
- stats: ActorStats;
69
- currentPricingInfo: PricingInfo;
70
- pictureUrl?: string;
71
- userPictureUrl?: string;
72
- /**
73
- * @since Added in 2.8.6
74
- */
75
- url: string;
76
- /**
77
- * A brief, LLM-generated readme summary
78
- * @since Added in 2.22.1
79
- */
80
- readmeSummary?: string;
81
- }
82
54
  /**
83
55
  * @since Added in 2.7.2
84
56
  */
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StoreCollectionClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const ow_1 = tslib_1.__importDefault(require("ow"));
4
+ const zod_1 = require("zod");
6
5
  const resource_collection_client_1 = require("../base/resource_collection_client");
6
+ const utils_1 = require("../utils");
7
+ const listOptionsSchema = zod_1.z.strictObject({
8
+ ...utils_1.paginationOptionsShape,
9
+ search: zod_1.z.string().optional(),
10
+ sortBy: zod_1.z.string().optional(),
11
+ category: zod_1.z.string().optional(),
12
+ username: zod_1.z.string().optional(),
13
+ pricingModel: zod_1.z.string().optional(),
14
+ includeUnrunnableActors: zod_1.z.boolean().optional(),
15
+ });
7
16
  /**
8
17
  * Client for browsing Actors in the Apify Store.
9
18
  *
@@ -56,17 +65,8 @@ class StoreCollectionClient extends resource_collection_client_1.ResourceCollect
56
65
  * @see https://docs.apify.com/api/v2/store-get
57
66
  */
58
67
  list(options = {}) {
59
- (0, ow_1.default)(options, ow_1.default.object.exactShape({
60
- limit: ow_1.default.optional.number.not.negative,
61
- offset: ow_1.default.optional.number.not.negative,
62
- search: ow_1.default.optional.string,
63
- sortBy: ow_1.default.optional.string,
64
- category: ow_1.default.optional.string,
65
- username: ow_1.default.optional.string,
66
- pricingModel: ow_1.default.optional.string,
67
- includeUnrunnableActors: ow_1.default.optional.boolean,
68
- }));
69
- return this._listPaginated(options);
68
+ const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'StoreCollectionListOptions');
69
+ return this._listPaginated(parsed);
70
70
  }
71
71
  }
72
72
  exports.StoreCollectionClient = StoreCollectionClient;
@@ -1,10 +1,12 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client';
2
2
  import { ResourceClient } from '../base/resource_client';
3
+ import type { Task, TaskPublicConfig } from '../models';
3
4
  import type { Dictionary } from '../utils';
4
- import type { ActorLastRunOptions, ActorRun, ActorStandby, ActorStartOptions } from './actor';
5
+ import type { ActorLastRunOptions, ActorRun, ActorStartOptions } from './actor';
5
6
  import { RunClient } from './run';
6
7
  import { RunCollectionClient } from './run_collection';
7
8
  import { WebhookCollectionClient } from './webhook_collection';
9
+ export type { Task, TaskOptions, TaskPublicConfig, TaskStats } from '../models';
8
10
  /**
9
11
  * Client for managing a specific Actor task.
10
12
  *
@@ -152,78 +154,6 @@ export declare class TaskClient extends ResourceClient {
152
154
  */
153
155
  webhooks(): WebhookCollectionClient;
154
156
  }
155
- /**
156
- * Represents an Actor task.
157
- *
158
- * Tasks are saved Actor configurations with input and settings that can be executed
159
- * repeatedly without having to specify the full input each time.
160
- */
161
- export interface Task {
162
- id: string;
163
- userId: string;
164
- actId: string;
165
- name: string;
166
- /**
167
- * @since Added in 2.6.1
168
- */
169
- title?: string;
170
- description?: string;
171
- username?: string;
172
- createdAt: Date;
173
- modifiedAt: Date;
174
- stats: TaskStats;
175
- options?: TaskOptions;
176
- input?: Dictionary | Dictionary[];
177
- /**
178
- * @since Added in 2.9.5
179
- */
180
- actorStandby?: Partial<ActorStandby>;
181
- /**
182
- * Whether the task is published on its public landing page. Derived from
183
- * `publicConfig.publishedAt` — set it on update to publish or unpublish the task.
184
- * @since Added in 2.25.0
185
- */
186
- isPublic?: boolean;
187
- /**
188
- * @since Added in 2.25.0
189
- */
190
- publicConfig?: TaskPublicConfig | null;
191
- }
192
- /**
193
- * Public-facing display configuration of a task's public landing page.
194
- *
195
- * The task is published when `publishedAt` is set and unpublished when it is `null`. The
196
- * `publishedAt` field is read-only - use {@apilink TaskClient.publish} and
197
- * {@apilink TaskClient.unpublish} to change the publication state.
198
- * @since Added in 2.25.0
199
- */
200
- export interface TaskPublicConfig {
201
- publishedAt: Date | null;
202
- seoTitle?: string | null;
203
- seoDescription?: string | null;
204
- categorization?: string | null;
205
- inputSchemaFields?: string[] | null;
206
- datasetName?: string | null;
207
- datasetView?: string | null;
208
- }
209
- /**
210
- * Statistics about Actor task usage.
211
- */
212
- export interface TaskStats {
213
- totalRuns: number;
214
- }
215
- /**
216
- * Configuration options for an Actor task.
217
- */
218
- export interface TaskOptions {
219
- build?: string;
220
- timeoutSecs?: number;
221
- memoryMbytes?: number;
222
- /**
223
- * @since Added in 2.19.0
224
- */
225
- restartOnError?: boolean;
226
- }
227
157
  /**
228
158
  * Fields that can be updated when modifying a Task.
229
159
  */
@@ -1,14 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TaskClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const ow_1 = tslib_1.__importDefault(require("ow"));
4
+ const zod_1 = require("zod");
6
5
  const consts_1 = require("@apify/consts");
7
6
  const resource_client_1 = require("../base/resource_client");
8
7
  const utils_1 = require("../utils");
9
8
  const run_1 = require("./run");
10
9
  const run_collection_1 = require("./run_collection");
11
10
  const webhook_collection_1 = require("./webhook_collection");
11
+ const inputSchema = utils_1.anyObjectSchema.optional();
12
+ const startOptionsSchema = zod_1.z.strictObject({
13
+ build: zod_1.z.string().optional(),
14
+ memory: zod_1.z.number().optional(),
15
+ timeout: zod_1.z.number().optional(),
16
+ waitForFinish: zod_1.z.number().optional(),
17
+ webhooks: zod_1.z.array(utils_1.anyObjectSchema).optional(),
18
+ maxItems: zod_1.z.number().min(0).optional(),
19
+ maxTotalChargeUsd: zod_1.z.number().min(0).optional(),
20
+ restartOnError: zod_1.z.boolean().optional(),
21
+ });
22
+ const callOptionsSchema = zod_1.z.strictObject({
23
+ build: zod_1.z.string().optional(),
24
+ memory: zod_1.z.number().optional(),
25
+ timeout: zod_1.z.number().min(0).optional(),
26
+ waitSecs: zod_1.z.number().min(0).optional(),
27
+ webhooks: zod_1.z.array(utils_1.anyObjectSchema).optional(),
28
+ maxItems: zod_1.z.number().min(0).optional(),
29
+ maxTotalChargeUsd: zod_1.z.number().min(0).optional(),
30
+ restartOnError: zod_1.z.boolean().optional(),
31
+ });
32
+ const lastRunOptionsSchema = zod_1.z.strictObject({
33
+ status: zod_1.z.enum(consts_1.ACT_JOB_STATUSES).optional(),
34
+ origin: zod_1.z.enum(consts_1.META_ORIGINS).optional(),
35
+ });
12
36
  /**
13
37
  * Client for managing a specific Actor task.
14
38
  *
@@ -56,7 +80,7 @@ class TaskClient extends resource_client_1.ResourceClient {
56
80
  * @see https://docs.apify.com/api/v2/actor-task-put
57
81
  */
58
82
  async update(newFields) {
59
- (0, ow_1.default)(newFields, ow_1.default.object);
83
+ (0, utils_1.parseArgument)(newFields, utils_1.anyObjectSchema);
60
84
  return this._update(newFields);
61
85
  }
62
86
  /**
@@ -114,24 +138,15 @@ class TaskClient extends resource_client_1.ResourceClient {
114
138
  * @see https://docs.apify.com/api/v2/actor-task-runs-post
115
139
  */
116
140
  async start(input, options = {}) {
117
- (0, ow_1.default)(input, ow_1.default.optional.object);
118
- (0, ow_1.default)(options, ow_1.default.object.exactShape({
119
- build: ow_1.default.optional.string,
120
- memory: ow_1.default.optional.number,
121
- timeout: ow_1.default.optional.number,
122
- waitForFinish: ow_1.default.optional.number,
123
- webhooks: ow_1.default.optional.array.ofType(ow_1.default.object),
124
- maxItems: ow_1.default.optional.number.not.negative,
125
- maxTotalChargeUsd: ow_1.default.optional.number.not.negative,
126
- restartOnError: ow_1.default.optional.boolean,
127
- }));
128
- const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError } = options;
141
+ (0, utils_1.parseArgument)(input, inputSchema);
142
+ const parsed = (0, utils_1.parseArgument)(options, startOptionsSchema, 'TaskStartOptions');
143
+ const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError } = parsed;
129
144
  const params = {
130
145
  waitForFinish,
131
146
  timeout,
132
147
  memory,
133
148
  build,
134
- webhooks: (0, utils_1.stringifyWebhooksToBase64)(options.webhooks),
149
+ webhooks: (0, utils_1.stringifyWebhooksToBase64)(parsed.webhooks),
135
150
  maxItems,
136
151
  maxTotalChargeUsd,
137
152
  restartOnError,
@@ -169,18 +184,9 @@ class TaskClient extends resource_client_1.ResourceClient {
169
184
  * @see https://docs.apify.com/api/v2/actor-task-runs-post
170
185
  */
171
186
  async call(input, options = {}) {
172
- (0, ow_1.default)(input, ow_1.default.optional.object);
173
- (0, ow_1.default)(options, ow_1.default.object.exactShape({
174
- build: ow_1.default.optional.string,
175
- memory: ow_1.default.optional.number,
176
- timeout: ow_1.default.optional.number.not.negative,
177
- waitSecs: ow_1.default.optional.number.not.negative,
178
- webhooks: ow_1.default.optional.array.ofType(ow_1.default.object),
179
- maxItems: ow_1.default.optional.number.not.negative,
180
- maxTotalChargeUsd: ow_1.default.optional.number.not.negative,
181
- restartOnError: ow_1.default.optional.boolean,
182
- }));
183
- const { waitSecs, ...startOptions } = options;
187
+ (0, utils_1.parseArgument)(input, inputSchema);
188
+ const parsed = (0, utils_1.parseArgument)(options, callOptionsSchema, 'TaskCallOptions');
189
+ const { waitSecs, ...startOptions } = parsed;
184
190
  const { id } = await this.start(input, startOptions);
185
191
  // Calling root client because we need access to top level API.
186
192
  // Creating a new instance of RunClient here would only allow
@@ -234,13 +240,10 @@ class TaskClient extends resource_client_1.ResourceClient {
234
240
  * @see https://docs.apify.com/api/v2/actor-task-runs-last-get
235
241
  */
236
242
  lastRun(options = {}) {
237
- (0, ow_1.default)(options, ow_1.default.object.exactShape({
238
- status: ow_1.default.optional.string.oneOf(Object.values(consts_1.ACT_JOB_STATUSES)),
239
- origin: ow_1.default.optional.string.oneOf(Object.values(consts_1.META_ORIGINS)),
240
- }));
243
+ const parsed = (0, utils_1.parseArgument)(options, lastRunOptionsSchema, 'TaskLastRunOptions');
241
244
  return new run_1.RunClient(this._subResourceOptions({
242
245
  id: 'last',
243
- params: this._params(options),
246
+ params: this._params(parsed),
244
247
  resourcePath: 'runs',
245
248
  }));
246
249
  }
@@ -1,7 +1,9 @@
1
1
  import type { ApiClientSubResourceOptions } from '../base/api_client';
2
2
  import { ResourceCollectionClient } from '../base/resource_collection_client';
3
+ import type { TaskList } from '../models';
3
4
  import type { PaginatedIterator, PaginationOptions } from '../utils';
4
5
  import type { Task, TaskUpdateData } from './task';
6
+ export type { TaskList } from '../models';
5
7
  /**
6
8
  * Client for managing the collection of Actor tasks in your account.
7
9
  *
@@ -64,7 +66,6 @@ export declare class TaskCollectionClient extends ResourceCollectionClient {
64
66
  export interface TaskCollectionListOptions extends PaginationOptions {
65
67
  desc?: boolean;
66
68
  }
67
- export type TaskList = Omit<Task, 'options' | 'input'>;
68
69
  /**
69
70
  * @since Added in 2.3.0
70
71
  */
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TaskCollectionClient = void 0;
4
- const tslib_1 = require("tslib");
5
- const ow_1 = tslib_1.__importDefault(require("ow"));
4
+ const zod_1 = require("zod");
6
5
  const resource_collection_client_1 = require("../base/resource_collection_client");
6
+ const utils_1 = require("../utils");
7
+ const listOptionsSchema = zod_1.z.strictObject({
8
+ ...utils_1.paginationOptionsShape,
9
+ desc: zod_1.z.boolean().optional(),
10
+ });
7
11
  /**
8
12
  * Client for managing the collection of Actor tasks in your account.
9
13
  *
@@ -59,12 +63,8 @@ class TaskCollectionClient extends resource_collection_client_1.ResourceCollecti
59
63
  * @see https://docs.apify.com/api/v2/actor-tasks-get
60
64
  */
61
65
  list(options = {}) {
62
- (0, ow_1.default)(options, ow_1.default.object.exactShape({
63
- limit: ow_1.default.optional.number.not.negative,
64
- offset: ow_1.default.optional.number.not.negative,
65
- desc: ow_1.default.optional.boolean,
66
- }));
67
- return this._listPaginated(options);
66
+ const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'TaskCollectionListOptions');
67
+ return this._listPaginated(parsed);
68
68
  }
69
69
  /**
70
70
  * Creates a new task.
@@ -74,7 +74,7 @@ class TaskCollectionClient extends resource_collection_client_1.ResourceCollecti
74
74
  * @see https://docs.apify.com/api/v2/actor-tasks-post
75
75
  */
76
76
  async create(task) {
77
- (0, ow_1.default)(task, ow_1.default.object);
77
+ (0, utils_1.parseArgument)(task, utils_1.anyObjectSchema);
78
78
  return this._create(task);
79
79
  }
80
80
  }