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.
Files changed (84) hide show
  1. package/README.md +2 -2
  2. package/dist/apify_api_error.js +5 -9
  3. package/dist/apify_client.d.ts +27 -27
  4. package/dist/apify_client.js +86 -91
  5. package/dist/base/api_client.d.ts +3 -3
  6. package/dist/base/api_client.js +6 -10
  7. package/dist/base/resource_client.d.ts +1 -1
  8. package/dist/base/resource_client.js +14 -18
  9. package/dist/base/resource_collection_client.d.ts +2 -2
  10. package/dist/base/resource_collection_client.js +6 -10
  11. package/dist/body_parser.js +6 -11
  12. package/dist/bundle.js +35 -47
  13. package/dist/bundle.js.map +1 -1
  14. package/dist/generated/api.js +1 -2
  15. package/dist/http_client.d.ts +2 -2
  16. package/dist/http_client.js +23 -28
  17. package/dist/index.d.ts +32 -32
  18. package/dist/index.js +31 -36
  19. package/dist/interceptors.d.ts +1 -1
  20. package/dist/interceptors.js +14 -19
  21. package/dist/models.d.ts +3 -3
  22. package/dist/models.js +8 -11
  23. package/dist/resource_clients/actor.d.ts +13 -13
  24. package/dist/resource_clients/actor.js +67 -71
  25. package/dist/resource_clients/actor_collection.d.ts +7 -7
  26. package/dist/resource_clients/actor_collection.js +14 -18
  27. package/dist/resource_clients/actor_env_var.d.ts +3 -3
  28. package/dist/resource_clients/actor_env_var.js +4 -8
  29. package/dist/resource_clients/actor_env_var_collection.d.ts +4 -4
  30. package/dist/resource_clients/actor_env_var_collection.js +5 -9
  31. package/dist/resource_clients/actor_version.d.ts +7 -7
  32. package/dist/resource_clients/actor_version.js +12 -17
  33. package/dist/resource_clients/actor_version_collection.d.ts +4 -4
  34. package/dist/resource_clients/actor_version_collection.js +5 -9
  35. package/dist/resource_clients/build.d.ts +5 -5
  36. package/dist/resource_clients/build.js +11 -15
  37. package/dist/resource_clients/build_collection.d.ts +5 -5
  38. package/dist/resource_clients/build_collection.js +8 -12
  39. package/dist/resource_clients/dataset.d.ts +5 -5
  40. package/dist/resource_clients/dataset.js +72 -76
  41. package/dist/resource_clients/dataset_collection.d.ts +4 -4
  42. package/dist/resource_clients/dataset_collection.js +15 -19
  43. package/dist/resource_clients/key_value_store.d.ts +4 -4
  44. package/dist/resource_clients/key_value_store.js +57 -62
  45. package/dist/resource_clients/key_value_store_collection.d.ts +4 -4
  46. package/dist/resource_clients/key_value_store_collection.js +15 -19
  47. package/dist/resource_clients/log.d.ts +2 -2
  48. package/dist/resource_clients/log.js +15 -22
  49. package/dist/resource_clients/request_queue.d.ts +4 -4
  50. package/dist/resource_clients/request_queue.js +91 -96
  51. package/dist/resource_clients/request_queue_collection.d.ts +4 -4
  52. package/dist/resource_clients/request_queue_collection.js +13 -17
  53. package/dist/resource_clients/run.d.ts +8 -8
  54. package/dist/resource_clients/run.js +46 -50
  55. package/dist/resource_clients/run_collection.d.ts +4 -4
  56. package/dist/resource_clients/run_collection.js +13 -17
  57. package/dist/resource_clients/schedule.d.ts +6 -6
  58. package/dist/resource_clients/schedule.js +7 -12
  59. package/dist/resource_clients/schedule_collection.d.ts +4 -4
  60. package/dist/resource_clients/schedule_collection.js +10 -14
  61. package/dist/resource_clients/store_collection.d.ts +5 -5
  62. package/dist/resource_clients/store_collection.js +13 -17
  63. package/dist/resource_clients/task.d.ts +9 -9
  64. package/dist/resource_clients/task.js +44 -48
  65. package/dist/resource_clients/task_collection.d.ts +6 -6
  66. package/dist/resource_clients/task_collection.js +9 -13
  67. package/dist/resource_clients/user.d.ts +5 -5
  68. package/dist/resource_clients/user.js +8 -13
  69. package/dist/resource_clients/webhook.d.ts +6 -6
  70. package/dist/resource_clients/webhook.js +8 -12
  71. package/dist/resource_clients/webhook_collection.d.ts +4 -4
  72. package/dist/resource_clients/webhook_collection.js +10 -14
  73. package/dist/resource_clients/webhook_dispatch.d.ts +5 -5
  74. package/dist/resource_clients/webhook_dispatch.js +3 -8
  75. package/dist/resource_clients/webhook_dispatch_collection.d.ts +4 -4
  76. package/dist/resource_clients/webhook_dispatch_collection.js +8 -12
  77. package/dist/statistics.js +5 -9
  78. package/dist/timezones.js +1 -2
  79. package/dist/utils.d.ts +5 -13
  80. package/dist/utils.js +30 -69
  81. package/package.json +10 -12
  82. package/dist/argument_validation_error.d.ts +0 -17
  83. package/dist/argument_validation_error.js +0 -157
  84. package/dist/index.mjs +0 -42
@@ -1,36 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RunClient = void 0;
4
- const zod_1 = require("zod");
5
- const log_1 = require("@apify/log");
6
- const resource_client_1 = require("../base/resource_client");
7
- const utils_1 = require("../utils");
8
- const dataset_1 = require("./dataset");
9
- const key_value_store_1 = require("./key_value_store");
10
- const log_2 = require("./log");
11
- const request_queue_1 = require("./request_queue");
1
+ import { z } from 'zod';
2
+ import { LEVELS, Log } from '@apify/log';
3
+ import { ResourceClient } from '../base/resource_client.js';
4
+ import { anyObjectSchema, cast, isNode, parseArgument, parseDateFields, pluckData } from '../utils.js';
5
+ import { DatasetClient } from './dataset.js';
6
+ import { KeyValueStoreClient } from './key_value_store.js';
7
+ import { LogClient, LoggerActorRedirect, StreamedLog } from './log.js';
8
+ import { RequestQueueClient } from './request_queue.js';
12
9
  const RUN_CHARGE_IDEMPOTENCY_HEADER = 'idempotency-key';
13
- const getOptionsSchema = zod_1.z.strictObject({ waitForFinish: zod_1.z.number().optional() });
14
- const abortOptionsSchema = zod_1.z.strictObject({ gracefully: zod_1.z.boolean().optional() });
15
- const targetActorIdSchema = zod_1.z.string();
16
- const metamorphOptionsSchema = zod_1.z.strictObject({
17
- contentType: zod_1.z.string().optional(),
18
- build: zod_1.z.string().optional(),
10
+ const getOptionsSchema = z.strictObject({ waitForFinish: z.number().optional() });
11
+ const abortOptionsSchema = z.strictObject({ gracefully: z.boolean().optional() });
12
+ const targetActorIdSchema = z.string();
13
+ const metamorphOptionsSchema = z.strictObject({
14
+ contentType: z.string().optional(),
15
+ build: z.string().optional(),
19
16
  });
20
- const resurrectOptionsSchema = zod_1.z.strictObject({
21
- build: zod_1.z.string().optional(),
22
- memory: zod_1.z.number().optional(),
23
- timeout: zod_1.z.number().optional(),
24
- maxItems: zod_1.z.number().optional(),
25
- maxTotalChargeUsd: zod_1.z.number().optional(),
26
- restartOnError: zod_1.z.boolean().optional(),
17
+ const resurrectOptionsSchema = z.strictObject({
18
+ build: z.string().optional(),
19
+ memory: z.number().optional(),
20
+ timeout: z.number().optional(),
21
+ maxItems: z.number().optional(),
22
+ maxTotalChargeUsd: z.number().optional(),
23
+ restartOnError: z.boolean().optional(),
27
24
  });
28
- const chargeOptionsSchema = zod_1.z.strictObject({
29
- eventName: zod_1.z.string(),
30
- count: zod_1.z.number().default(1),
31
- idempotencyKey: zod_1.z.string().optional(),
25
+ const chargeOptionsSchema = z.strictObject({
26
+ eventName: z.string(),
27
+ count: z.number().default(1),
28
+ idempotencyKey: z.string().optional(),
32
29
  });
33
- const waitForFinishOptionsSchema = zod_1.z.strictObject({ waitSecs: zod_1.z.number().optional() });
30
+ const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional() });
34
31
  /**
35
32
  * Client for managing a specific Actor run.
36
33
  *
@@ -54,7 +51,7 @@ const waitForFinishOptionsSchema = zod_1.z.strictObject({ waitSecs: zod_1.z.numb
54
51
  *
55
52
  * @see https://docs.apify.com/platform/actors/running/runs-and-builds
56
53
  */
57
- class RunClient extends resource_client_1.ResourceClient {
54
+ export class RunClient extends ResourceClient {
58
55
  /**
59
56
  * @hidden
60
57
  */
@@ -83,7 +80,7 @@ class RunClient extends resource_client_1.ResourceClient {
83
80
  * ```
84
81
  */
85
82
  async get(options = {}) {
86
- const parsed = (0, utils_1.parseArgument)(options, getOptionsSchema, 'RunGetOptions');
83
+ const parsed = parseArgument(options, getOptionsSchema, 'RunGetOptions');
87
84
  return this._get(parsed);
88
85
  }
89
86
  /**
@@ -104,13 +101,13 @@ class RunClient extends resource_client_1.ResourceClient {
104
101
  * ```
105
102
  */
106
103
  async abort(options = {}) {
107
- const parsed = (0, utils_1.parseArgument)(options, abortOptionsSchema, 'RunAbortOptions');
104
+ const parsed = parseArgument(options, abortOptionsSchema, 'RunAbortOptions');
108
105
  const response = await this.httpClient.call({
109
106
  url: this._url('abort'),
110
107
  method: 'POST',
111
108
  params: this._params(parsed),
112
109
  });
113
- return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
110
+ return cast(parseDateFields(pluckData(response.data)));
114
111
  }
115
112
  /**
116
113
  * Deletes the Actor run.
@@ -147,9 +144,9 @@ class RunClient extends resource_client_1.ResourceClient {
147
144
  * ```
148
145
  */
149
146
  async metamorph(targetActorId, input, options = {}) {
150
- (0, utils_1.parseArgument)(targetActorId, targetActorIdSchema);
147
+ parseArgument(targetActorId, targetActorIdSchema);
151
148
  // input can be anything, pointless to validate
152
- const parsed = (0, utils_1.parseArgument)(options, metamorphOptionsSchema, 'RunMetamorphOptions');
149
+ const parsed = parseArgument(options, metamorphOptionsSchema, 'RunMetamorphOptions');
153
150
  const safeTargetActorId = this._toSafeId(targetActorId);
154
151
  const params = {
155
152
  targetActorId: safeTargetActorId,
@@ -172,7 +169,7 @@ class RunClient extends resource_client_1.ResourceClient {
172
169
  };
173
170
  }
174
171
  const response = await this.httpClient.call(request);
175
- return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
172
+ return cast(parseDateFields(pluckData(response.data)));
176
173
  }
177
174
  /**
178
175
  * Reboots the Actor run.
@@ -196,7 +193,7 @@ class RunClient extends resource_client_1.ResourceClient {
196
193
  method: 'POST',
197
194
  };
198
195
  const response = await this.httpClient.call(request);
199
- return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
196
+ return cast(parseDateFields(pluckData(response.data)));
200
197
  }
201
198
  /**
202
199
  * Updates the Actor run with specified fields.
@@ -217,7 +214,7 @@ class RunClient extends resource_client_1.ResourceClient {
217
214
  * @since Added in 2.6.0
218
215
  */
219
216
  async update(newFields) {
220
- (0, utils_1.parseArgument)(newFields, utils_1.anyObjectSchema);
217
+ parseArgument(newFields, anyObjectSchema);
221
218
  return this._update(newFields);
222
219
  }
223
220
  /**
@@ -244,13 +241,13 @@ class RunClient extends resource_client_1.ResourceClient {
244
241
  * ```
245
242
  */
246
243
  async resurrect(options = {}) {
247
- const parsed = (0, utils_1.parseArgument)(options, resurrectOptionsSchema, 'RunResurrectOptions');
244
+ const parsed = parseArgument(options, resurrectOptionsSchema, 'RunResurrectOptions');
248
245
  const response = await this.httpClient.call({
249
246
  url: this._url('resurrect'),
250
247
  method: 'POST',
251
248
  params: this._params(parsed),
252
249
  });
253
- return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
250
+ return cast(parseDateFields(pluckData(response.data)));
254
251
  }
255
252
  /**
256
253
  * Charges the Actor run for a specific event.
@@ -264,7 +261,7 @@ class RunClient extends resource_client_1.ResourceClient {
264
261
  * @since Added in 2.11.0
265
262
  */
266
263
  async charge(options) {
267
- const { eventName, count, idempotencyKey: providedIdempotencyKey, } = (0, utils_1.parseArgument)(options, chargeOptionsSchema, 'RunChargeOptions');
264
+ const { eventName, count, idempotencyKey: providedIdempotencyKey, } = parseArgument(options, chargeOptionsSchema, 'RunChargeOptions');
268
265
  /** To avoid duplicates during the same milisecond, doesn't need to by crypto-secure. */
269
266
  const randomSuffix = (Math.random() + 1).toString(36).slice(3, 8);
270
267
  const idempotencyKey = providedIdempotencyKey ?? `${this.id}-${eventName}-${Date.now()}-${randomSuffix}`;
@@ -311,7 +308,7 @@ class RunClient extends resource_client_1.ResourceClient {
311
308
  * ```
312
309
  */
313
310
  async waitForFinish(options = {}) {
314
- const parsed = (0, utils_1.parseArgument)(options, waitForFinishOptionsSchema, 'RunWaitForFinishOptions');
311
+ const parsed = parseArgument(options, waitForFinishOptionsSchema, 'RunWaitForFinishOptions');
315
312
  return this._waitForFinish(parsed);
316
313
  }
317
314
  /**
@@ -327,7 +324,7 @@ class RunClient extends resource_client_1.ResourceClient {
327
324
  * ```
328
325
  */
329
326
  dataset() {
330
- return new dataset_1.DatasetClient(this._subResourceOptions({
327
+ return new DatasetClient(this._subResourceOptions({
331
328
  resourcePath: 'dataset',
332
329
  }));
333
330
  }
@@ -344,7 +341,7 @@ class RunClient extends resource_client_1.ResourceClient {
344
341
  * ```
345
342
  */
346
343
  keyValueStore() {
347
- return new key_value_store_1.KeyValueStoreClient(this._subResourceOptions({
344
+ return new KeyValueStoreClient(this._subResourceOptions({
348
345
  resourcePath: 'key-value-store',
349
346
  }));
350
347
  }
@@ -361,7 +358,7 @@ class RunClient extends resource_client_1.ResourceClient {
361
358
  * ```
362
359
  */
363
360
  requestQueue() {
364
- return new request_queue_1.RequestQueueClient(this._subResourceOptions({
361
+ return new RequestQueueClient(this._subResourceOptions({
365
362
  resourcePath: 'request-queue',
366
363
  }));
367
364
  }
@@ -379,7 +376,7 @@ class RunClient extends resource_client_1.ResourceClient {
379
376
  * ```
380
377
  */
381
378
  log() {
382
- return new log_2.LogClient(this._subResourceOptions({
379
+ return new LogClient(this._subResourceOptions({
383
380
  resourcePath: 'log',
384
381
  }));
385
382
  }
@@ -390,7 +387,7 @@ class RunClient extends resource_client_1.ResourceClient {
390
387
  async getStreamedLog(options = {}) {
391
388
  const { fromStart = true } = options;
392
389
  let { toLog } = options;
393
- if (toLog === null || !(0, utils_1.isNode)()) {
390
+ if (toLog === null || !isNode()) {
394
391
  // Explicitly no logging or not in Node.js
395
392
  return undefined;
396
393
  }
@@ -403,9 +400,8 @@ class RunClient extends resource_client_1.ResourceClient {
403
400
  const actorData = (await this.apifyClient.actor(actorId).get()) || { name: '' };
404
401
  const actorName = actorData?.name ?? '';
405
402
  const name = [actorName, `runId:${runId}`].filter(Boolean).join(' ');
406
- toLog = new log_1.Log({ level: log_1.LEVELS.DEBUG, prefix: `${name} -> `, logger: new log_2.LoggerActorRedirect() });
403
+ toLog = new Log({ level: LEVELS.DEBUG, prefix: `${name} -> `, logger: new LoggerActorRedirect() });
407
404
  }
408
- return new log_2.StreamedLog({ logClient: this.log(), toLog, fromStart });
405
+ return new StreamedLog({ logClient: this.log(), toLog, fromStart });
409
406
  }
410
407
  }
411
- exports.RunClient = RunClient;
@@ -1,8 +1,8 @@
1
1
  import { ACTOR_JOB_STATUSES } from '@apify/consts';
2
- import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_client';
3
- import { ResourceCollectionClient } from '../base/resource_collection_client';
4
- import type { PaginatedIterator, PaginationOptions } from '../utils';
5
- import type { ActorRunListItem } from './actor';
2
+ import type { ApiClientOptionsWithOptionalResourcePath } from '../base/api_client.js';
3
+ import { ResourceCollectionClient } from '../base/resource_collection_client.js';
4
+ import type { PaginatedIterator, PaginationOptions } from '../utils.js';
5
+ import type { ActorRunListItem } from './actor.js';
6
6
  /**
7
7
  * Client for managing the collection of Actor runs.
8
8
  *
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RunCollectionClient = void 0;
4
- const zod_1 = require("zod");
5
- const consts_1 = require("@apify/consts");
6
- const resource_collection_client_1 = require("../base/resource_collection_client");
7
- const utils_1 = require("../utils");
8
- const jobStatusSchema = zod_1.z.enum(consts_1.ACTOR_JOB_STATUSES);
9
- const listOptionsSchema = zod_1.z.strictObject({
10
- ...utils_1.paginationOptionsShape,
11
- desc: zod_1.z.boolean().optional(),
12
- status: zod_1.z.union([jobStatusSchema, zod_1.z.array(jobStatusSchema)]).optional(),
13
- startedBefore: zod_1.z.union([zod_1.z.date(), zod_1.z.string()]).optional(),
14
- startedAfter: zod_1.z.union([zod_1.z.date(), zod_1.z.string()]).optional(),
1
+ import { z } from 'zod';
2
+ import { ACTOR_JOB_STATUSES } from '@apify/consts';
3
+ import { ResourceCollectionClient } from '../base/resource_collection_client.js';
4
+ import { paginationOptionsShape, parseArgument } from '../utils.js';
5
+ const jobStatusSchema = z.enum(ACTOR_JOB_STATUSES);
6
+ const listOptionsSchema = z.strictObject({
7
+ ...paginationOptionsShape,
8
+ desc: z.boolean().optional(),
9
+ status: z.union([jobStatusSchema, z.array(jobStatusSchema)]).optional(),
10
+ startedBefore: z.union([z.date(), z.string()]).optional(),
11
+ startedAfter: z.union([z.date(), z.string()]).optional(),
15
12
  });
16
13
  /**
17
14
  * Client for managing the collection of Actor runs.
@@ -34,7 +31,7 @@ const listOptionsSchema = zod_1.z.strictObject({
34
31
  *
35
32
  * @see https://docs.apify.com/platform/actors/running/runs-and-builds
36
33
  */
37
- class RunCollectionClient extends resource_collection_client_1.ResourceCollectionClient {
34
+ export class RunCollectionClient extends ResourceCollectionClient {
38
35
  /**
39
36
  * @hidden
40
37
  */
@@ -65,8 +62,7 @@ class RunCollectionClient extends resource_collection_client_1.ResourceCollectio
65
62
  * @see https://docs.apify.com/api/v2/actor-runs-get
66
63
  */
67
64
  list(options = {}) {
68
- const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'RunCollectionListOptions');
65
+ const parsed = parseArgument(options, listOptionsSchema, 'RunCollectionListOptions');
69
66
  return this._listPaginated(parsed);
70
67
  }
71
68
  }
72
- exports.RunCollectionClient = RunCollectionClient;
@@ -1,9 +1,9 @@
1
- import type { ApiClientSubResourceOptions } from '../base/api_client';
2
- import { ResourceClient } from '../base/resource_client';
3
- import type { Schedule, ScheduleAction } from '../models';
4
- import type { DistributiveOptional } from '../utils';
5
- export type { Schedule, ScheduleAction, ScheduleActionRunActor, ScheduleActionRunActorTask, ScheduledActorRunInput, ScheduledActorRunOptions, } from '../models';
6
- export { ScheduleActions } from '../models';
1
+ import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
+ import { ResourceClient } from '../base/resource_client.js';
3
+ import type { Schedule, ScheduleAction } from '../models.js';
4
+ import type { DistributiveOptional } from '../utils.js';
5
+ export type { Schedule, ScheduleAction, ScheduleActionRunActor, ScheduleActionRunActorTask, ScheduledActorRunInput, ScheduledActorRunOptions, } from '../models.js';
6
+ export { ScheduleActions } from '../models.js';
7
7
  /**
8
8
  * Client for managing a specific Schedule.
9
9
  *
@@ -1,10 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScheduleClient = exports.ScheduleActions = void 0;
4
- const resource_client_1 = require("../base/resource_client");
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; } });
1
+ import { ResourceClient } from '../base/resource_client.js';
2
+ import { anyObjectSchema, cast, catchNotFoundOrThrow, parseArgument, parseDateFields, pluckData } from '../utils.js';
3
+ export { ScheduleActions } from '../models.js';
8
4
  /**
9
5
  * Client for managing a specific Schedule.
10
6
  *
@@ -28,7 +24,7 @@ Object.defineProperty(exports, "ScheduleActions", { enumerable: true, get: funct
28
24
  *
29
25
  * @see https://docs.apify.com/platform/schedules
30
26
  */
31
- class ScheduleClient extends resource_client_1.ResourceClient {
27
+ export class ScheduleClient extends ResourceClient {
32
28
  /**
33
29
  * @hidden
34
30
  */
@@ -55,7 +51,7 @@ class ScheduleClient extends resource_client_1.ResourceClient {
55
51
  * @see https://docs.apify.com/api/v2/schedule-put
56
52
  */
57
53
  async update(newFields) {
58
- (0, utils_1.parseArgument)(newFields, utils_1.anyObjectSchema);
54
+ parseArgument(newFields, anyObjectSchema);
59
55
  return this._update(newFields);
60
56
  }
61
57
  /**
@@ -80,12 +76,11 @@ class ScheduleClient extends resource_client_1.ResourceClient {
80
76
  };
81
77
  try {
82
78
  const response = await this.httpClient.call(requestOpts);
83
- return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
79
+ return cast(parseDateFields(pluckData(response.data)));
84
80
  }
85
81
  catch (err) {
86
- (0, utils_1.catchNotFoundOrThrow)(err);
82
+ catchNotFoundOrThrow(err);
87
83
  }
88
84
  return undefined;
89
85
  }
90
86
  }
91
- exports.ScheduleClient = ScheduleClient;
@@ -1,7 +1,7 @@
1
- import type { ApiClientSubResourceOptions } from '../base/api_client';
2
- import { ResourceCollectionClient } from '../base/resource_collection_client';
3
- import type { PaginatedIterator, PaginationOptions } from '../utils';
4
- import type { Schedule, ScheduleCreateOrUpdateData } from './schedule';
1
+ import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
+ import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
+ import type { PaginatedIterator, PaginationOptions } from '../utils.js';
4
+ import type { Schedule, ScheduleCreateOrUpdateData } from './schedule.js';
5
5
  /**
6
6
  * Client for managing the collection of Schedules in your account.
7
7
  *
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScheduleCollectionClient = void 0;
4
- const zod_1 = require("zod");
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(),
1
+ import { z } from 'zod';
2
+ import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
+ import { anyObjectSchema, paginationOptionsShape, parseArgument } from '../utils.js';
4
+ const listOptionsSchema = z.strictObject({
5
+ ...paginationOptionsShape,
6
+ desc: z.boolean().optional(),
10
7
  });
11
- const scheduleCreateSchema = utils_1.anyObjectSchema.optional();
8
+ const scheduleCreateSchema = anyObjectSchema.optional();
12
9
  /**
13
10
  * Client for managing the collection of Schedules in your account.
14
11
  *
@@ -33,7 +30,7 @@ const scheduleCreateSchema = utils_1.anyObjectSchema.optional();
33
30
  *
34
31
  * @see https://docs.apify.com/platform/schedules
35
32
  */
36
- class ScheduleCollectionClient extends resource_collection_client_1.ResourceCollectionClient {
33
+ export class ScheduleCollectionClient extends ResourceCollectionClient {
37
34
  /**
38
35
  * @hidden
39
36
  */
@@ -64,7 +61,7 @@ class ScheduleCollectionClient extends resource_collection_client_1.ResourceColl
64
61
  * @see https://docs.apify.com/api/v2/schedules-get
65
62
  */
66
63
  list(options = {}) {
67
- const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'ScheduleCollectionListOptions');
64
+ const parsed = parseArgument(options, listOptionsSchema, 'ScheduleCollectionListOptions');
68
65
  return this._listPaginated(parsed);
69
66
  }
70
67
  /**
@@ -75,8 +72,7 @@ class ScheduleCollectionClient extends resource_collection_client_1.ResourceColl
75
72
  * @see https://docs.apify.com/api/v2/schedules-post
76
73
  */
77
74
  async create(schedule) {
78
- (0, utils_1.parseArgument)(schedule, scheduleCreateSchema);
75
+ parseArgument(schedule, scheduleCreateSchema);
79
76
  return this._create(schedule);
80
77
  }
81
78
  }
82
- exports.ScheduleCollectionClient = ScheduleCollectionClient;
@@ -1,8 +1,8 @@
1
- import type { ApiClientSubResourceOptions } from '../base/api_client';
2
- import { ResourceCollectionClient } from '../base/resource_collection_client';
3
- import type { ActorStoreList } from '../models';
4
- import type { PaginatedIterator, PaginationOptions } from '../utils';
5
- export type { ActorStoreList, PricingInfo } from '../models';
1
+ import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
+ import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
+ import type { ActorStoreList } from '../models.js';
4
+ import type { PaginatedIterator, PaginationOptions } from '../utils.js';
5
+ export type { ActorStoreList, PricingInfo } from '../models.js';
6
6
  /**
7
7
  * Client for browsing Actors in the Apify Store.
8
8
  *
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StoreCollectionClient = void 0;
4
- const zod_1 = require("zod");
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(),
1
+ import { z } from 'zod';
2
+ import { ResourceCollectionClient } from '../base/resource_collection_client.js';
3
+ import { paginationOptionsShape, parseArgument } from '../utils.js';
4
+ const listOptionsSchema = z.strictObject({
5
+ ...paginationOptionsShape,
6
+ search: z.string().optional(),
7
+ sortBy: z.string().optional(),
8
+ category: z.string().optional(),
9
+ username: z.string().optional(),
10
+ pricingModel: z.string().optional(),
11
+ includeUnrunnableActors: z.boolean().optional(),
15
12
  });
16
13
  /**
17
14
  * Client for browsing Actors in the Apify Store.
@@ -34,7 +31,7 @@ const listOptionsSchema = zod_1.z.strictObject({
34
31
  * @see https://docs.apify.com/platform/actors/publishing
35
32
  * @since Added in 2.7.2
36
33
  */
37
- class StoreCollectionClient extends resource_collection_client_1.ResourceCollectionClient {
34
+ export class StoreCollectionClient extends ResourceCollectionClient {
38
35
  /**
39
36
  * @hidden
40
37
  */
@@ -65,8 +62,7 @@ class StoreCollectionClient extends resource_collection_client_1.ResourceCollect
65
62
  * @see https://docs.apify.com/api/v2/store-get
66
63
  */
67
64
  list(options = {}) {
68
- const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'StoreCollectionListOptions');
65
+ const parsed = parseArgument(options, listOptionsSchema, 'StoreCollectionListOptions');
69
66
  return this._listPaginated(parsed);
70
67
  }
71
68
  }
72
- exports.StoreCollectionClient = StoreCollectionClient;
@@ -1,12 +1,12 @@
1
- import type { ApiClientSubResourceOptions } from '../base/api_client';
2
- import { ResourceClient } from '../base/resource_client';
3
- import type { Task, TaskPublicConfig } from '../models';
4
- import type { Dictionary } from '../utils';
5
- import type { ActorLastRunOptions, ActorRun, ActorStartOptions } from './actor';
6
- import { RunClient } from './run';
7
- import { RunCollectionClient } from './run_collection';
8
- import { WebhookCollectionClient } from './webhook_collection';
9
- export type { Task, TaskOptions, TaskPublicConfig, TaskStats } from '../models';
1
+ import type { ApiClientSubResourceOptions } from '../base/api_client.js';
2
+ import { ResourceClient } from '../base/resource_client.js';
3
+ import type { Task, TaskPublicConfig } from '../models.js';
4
+ import type { Dictionary } from '../utils.js';
5
+ import type { ActorLastRunOptions, ActorRun, ActorStartOptions } from './actor.js';
6
+ import { RunClient } from './run.js';
7
+ import { RunCollectionClient } from './run_collection.js';
8
+ import { WebhookCollectionClient } from './webhook_collection.js';
9
+ export type { Task, TaskOptions, TaskPublicConfig, TaskStats } from '../models.js';
10
10
  /**
11
11
  * Client for managing a specific Actor task.
12
12
  *