apify-client 3.0.0-beta.5 → 3.0.0-beta.50

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 (115) hide show
  1. package/README.md +13 -3
  2. package/dist/apify_api_error.d.ts +62 -21
  3. package/dist/apify_api_error.js +96 -23
  4. package/dist/apify_client.d.ts +125 -10
  5. package/dist/apify_client.js +133 -48
  6. package/dist/base/api_client.d.ts +7 -7
  7. package/dist/base/api_client.js +36 -24
  8. package/dist/base/resource_client.d.ts +21 -8
  9. package/dist/base/resource_client.js +54 -26
  10. package/dist/base/resource_collection_client.d.ts +12 -4
  11. package/dist/base/resource_collection_client.js +34 -11
  12. package/dist/body_parser.d.ts +3 -4
  13. package/dist/body_parser.js +19 -26
  14. package/dist/bundle.js +27 -22
  15. package/dist/bundle.js.map +1 -1
  16. package/dist/generated/api.d.ts +610 -112
  17. package/dist/generated/schemas.d.ts +726 -703
  18. package/dist/generated/schemas.js +92 -85
  19. package/dist/http_clients/axios.d.ts +60 -0
  20. package/dist/http_clients/axios.js +117 -0
  21. package/dist/http_clients/base.d.ts +333 -0
  22. package/dist/http_clients/base.js +563 -0
  23. package/dist/http_clients/index.d.ts +4 -0
  24. package/dist/http_clients/index.js +2 -0
  25. package/dist/http_compressors/base.d.ts +40 -0
  26. package/dist/http_compressors/base.js +9 -0
  27. package/dist/http_compressors/brotli.d.ts +33 -0
  28. package/dist/http_compressors/brotli.js +39 -0
  29. package/dist/http_compressors/gzip.d.ts +33 -0
  30. package/dist/http_compressors/gzip.js +39 -0
  31. package/dist/http_compressors/index.d.ts +6 -0
  32. package/dist/http_compressors/index.js +2 -0
  33. package/dist/http_compressors/resolve.d.ts +23 -0
  34. package/dist/http_compressors/resolve.js +27 -0
  35. package/dist/index.d.ts +4 -1
  36. package/dist/index.js +3 -1
  37. package/dist/invalid_response_body_error.d.ts +13 -0
  38. package/dist/invalid_response_body_error.js +17 -0
  39. package/dist/models.d.ts +19 -22
  40. package/dist/resource_clients/actor.d.ts +72 -32
  41. package/dist/resource_clients/actor.js +87 -56
  42. package/dist/resource_clients/actor_collection.d.ts +9 -5
  43. package/dist/resource_clients/actor_collection.js +11 -3
  44. package/dist/resource_clients/actor_env_var.d.ts +10 -3
  45. package/dist/resource_clients/actor_env_var.js +16 -6
  46. package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
  47. package/dist/resource_clients/actor_env_var_collection.js +17 -11
  48. package/dist/resource_clients/actor_version.d.ts +18 -3
  49. package/dist/resource_clients/actor_version.js +19 -9
  50. package/dist/resource_clients/actor_version_collection.d.ts +16 -17
  51. package/dist/resource_clients/actor_version_collection.js +19 -11
  52. package/dist/resource_clients/build.d.ts +18 -6
  53. package/dist/resource_clients/build.js +34 -15
  54. package/dist/resource_clients/build_collection.d.ts +3 -1
  55. package/dist/resource_clients/build_collection.js +4 -1
  56. package/dist/resource_clients/dataset.d.ts +51 -33
  57. package/dist/resource_clients/dataset.js +105 -80
  58. package/dist/resource_clients/dataset_collection.d.ts +6 -2
  59. package/dist/resource_clients/dataset_collection.js +13 -2
  60. package/dist/resource_clients/key_value_store.d.ts +58 -16
  61. package/dist/resource_clients/key_value_store.js +78 -40
  62. package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
  63. package/dist/resource_clients/key_value_store_collection.js +13 -2
  64. package/dist/resource_clients/log.d.ts +11 -19
  65. package/dist/resource_clients/log.js +64 -46
  66. package/dist/resource_clients/request_queue.d.ts +56 -26
  67. package/dist/resource_clients/request_queue.js +176 -103
  68. package/dist/resource_clients/request_queue_collection.d.ts +6 -2
  69. package/dist/resource_clients/request_queue_collection.js +9 -3
  70. package/dist/resource_clients/run.d.ts +108 -18
  71. package/dist/resource_clients/run.js +183 -43
  72. package/dist/resource_clients/run_collection.d.ts +3 -1
  73. package/dist/resource_clients/run_collection.js +4 -1
  74. package/dist/resource_clients/schedule.d.ts +14 -5
  75. package/dist/resource_clients/schedule.js +29 -21
  76. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  77. package/dist/resource_clients/schedule_collection.js +9 -3
  78. package/dist/resource_clients/store_collection.d.ts +3 -1
  79. package/dist/resource_clients/store_collection.js +4 -1
  80. package/dist/resource_clients/task.d.ts +33 -10
  81. package/dist/resource_clients/task.js +79 -46
  82. package/dist/resource_clients/task_collection.d.ts +6 -2
  83. package/dist/resource_clients/task_collection.js +9 -3
  84. package/dist/resource_clients/user.d.ts +17 -8
  85. package/dist/resource_clients/user.js +42 -38
  86. package/dist/resource_clients/webhook.d.ts +14 -5
  87. package/dist/resource_clients/webhook.js +30 -22
  88. package/dist/resource_clients/webhook_collection.d.ts +6 -2
  89. package/dist/resource_clients/webhook_collection.js +9 -3
  90. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  91. package/dist/resource_clients/webhook_dispatch.js +7 -2
  92. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  93. package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
  94. package/dist/runtime/node.d.ts +6 -0
  95. package/dist/runtime/node.js +49 -0
  96. package/dist/runtime/types.d.ts +52 -0
  97. package/dist/runtime/types.js +1 -0
  98. package/dist/runtime/web.d.ts +5 -0
  99. package/dist/runtime/web.js +18 -0
  100. package/dist/schemas.d.ts +1 -1
  101. package/dist/schemas.js +1 -1
  102. package/dist/statistics.d.ts +1 -6
  103. package/dist/statistics.js +2 -2
  104. package/dist/timeouts.d.ts +84 -0
  105. package/dist/timeouts.js +37 -0
  106. package/dist/timezones.d.ts +1 -1
  107. package/dist/utils.d.ts +81 -52
  108. package/dist/utils.js +201 -170
  109. package/dist/wait_for_resources.d.ts +8 -0
  110. package/dist/wait_for_resources.js +39 -0
  111. package/package.json +32 -29
  112. package/dist/http_client.d.ts +0 -88
  113. package/dist/http_client.js +0 -255
  114. package/dist/interceptors.d.ts +0 -19
  115. package/dist/interceptors.js +0 -105
@@ -21,7 +21,7 @@ export const ActorStats = lazySchema(() => z.looseObject({
21
21
  totalUsers30Days: z.int().optional(),
22
22
  totalUsers90Days: z.int().optional(),
23
23
  totalMetamorphs: z.int().optional(),
24
- lastRunStartedAt: z.date().optional(),
24
+ lastRunStartedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
25
25
  actorReviewCount: z.int().optional(),
26
26
  actorReviewRating: z.number().optional(),
27
27
  bookmarkCount: z.int().optional(),
@@ -35,8 +35,8 @@ export const ActorStats = lazySchema(() => z.looseObject({
35
35
  }));
36
36
  export const ActorShort = lazySchema(() => z.looseObject({
37
37
  id: z.string(),
38
- createdAt: z.date(),
39
- modifiedAt: z.date(),
38
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
39
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
40
40
  name: z.string(),
41
41
  username: z.string(),
42
42
  title: z.string().optional(),
@@ -132,10 +132,10 @@ export const CreateActorRequest = lazySchema(() => z.looseObject({
132
132
  }));
133
133
  export const CommonActorPricingInfo = lazySchema(() => z.looseObject({
134
134
  apifyMarginPercentage: z.number(),
135
- createdAt: z.date(),
136
- startedAt: z.date(),
137
- notifiedAboutFutureChangeAt: z.date().nullable().optional(),
138
- notifiedAboutChangeAt: z.date().nullable().optional(),
135
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
136
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
137
+ notifiedAboutFutureChangeAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
138
+ notifiedAboutChangeAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
139
139
  reasonForChange: z.string().nullable().optional(),
140
140
  isPriceChangeNotificationSuppressed: z.boolean().optional(),
141
141
  forceContainsSignificantPriceChange: z.boolean().optional(),
@@ -197,7 +197,7 @@ export const TaggedBuildInfo = lazySchema(() => z.looseObject({
197
197
  buildId: z.string().optional(),
198
198
  buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).nullable().optional(),
199
199
  buildNumberInt: z.int().optional(),
200
- finishedAt: z.date().nullable().optional(),
200
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
201
201
  }));
202
202
  /** A dictionary mapping build tag names (e.g., "latest", "beta") to their build information. */
203
203
  export const TaggedBuilds = lazySchema(() => z.record(z.string(), TaggedBuildInfo().nullable()));
@@ -212,8 +212,8 @@ export const Actor = lazySchema(() => z.looseObject({
212
212
  restartOnError: z.boolean().optional(),
213
213
  isPublic: z.boolean(),
214
214
  actorPermissionLevel: ActorPermissionLevel().optional(),
215
- createdAt: z.date(),
216
- modifiedAt: z.date(),
215
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
216
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
217
217
  stats: ActorStats(),
218
218
  versions: z.array(Version()),
219
219
  pricingInfos: z.array(ActorRunPricingInfo()).optional(),
@@ -305,16 +305,16 @@ export const WebhookCondition = lazySchema(() => z.looseObject({
305
305
  export const WebhookDispatchStatus = lazySchema(() => z.enum(["ACTIVE", "SUCCEEDED", "FAILED"]).or(z.string()));
306
306
  export const ExampleWebhookDispatch = lazySchema(() => z.looseObject({
307
307
  status: WebhookDispatchStatus(),
308
- finishedAt: z.date().nullable().optional(),
309
- removedAt: z.date().nullable().optional(),
308
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
309
+ removedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
310
310
  }));
311
311
  export const WebhookStats = lazySchema(() => z.looseObject({
312
312
  totalDispatches: z.int().optional(),
313
313
  }));
314
314
  export const WebhookShort = lazySchema(() => z.looseObject({
315
315
  id: z.string(),
316
- createdAt: z.date(),
317
- modifiedAt: z.date(),
316
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
317
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
318
318
  userId: z.string(),
319
319
  isAdHoc: z.boolean().nullable().optional(),
320
320
  isApifyIntegration: z.boolean().optional(),
@@ -325,7 +325,7 @@ export const WebhookShort = lazySchema(() => z.looseObject({
325
325
  condition: WebhookCondition(),
326
326
  ignoreSslErrors: z.boolean(),
327
327
  doNotRetry: z.boolean(),
328
- requestUrl: z.string(),
328
+ requestUrl: z.url({ normalize: true }),
329
329
  lastDispatch: ExampleWebhookDispatch().nullable().optional(),
330
330
  stats: WebhookStats().nullable().optional(),
331
331
  }));
@@ -348,8 +348,8 @@ export const BuildShort = lazySchema(() => z.looseObject({
348
348
  actId: z.string().optional(),
349
349
  userId: z.string().optional(),
350
350
  status: ActorJobStatus(),
351
- startedAt: z.date(),
352
- finishedAt: z.date().nullable().optional(),
351
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
352
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
353
353
  usageTotalUsd: z.number(),
354
354
  buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/),
355
355
  buildNumberInt: z.int().optional(),
@@ -400,8 +400,8 @@ export const Build = lazySchema(() => z.looseObject({
400
400
  id: z.string(),
401
401
  actId: z.string(),
402
402
  userId: z.string(),
403
- startedAt: z.date(),
404
- finishedAt: z.date().nullable().optional(),
403
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
404
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
405
405
  status: ActorJobStatus(),
406
406
  meta: BuildsMeta(),
407
407
  stats: BuildStats().nullable().optional(),
@@ -412,6 +412,7 @@ export const Build = lazySchema(() => z.looseObject({
412
412
  inputSchema: z.string().nullable().optional(),
413
413
  readme: z.string().nullable().optional(),
414
414
  buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/),
415
+ imageDigest: z.string().nullable().optional(),
415
416
  actVersion: z.looseObject({
416
417
  sourceType: VersionSourceType().optional(),
417
418
  buildTag: z.string().optional(),
@@ -430,7 +431,7 @@ export const RunMeta = lazySchema(() => z.looseObject({
430
431
  clientIp: z.string().nullable().optional(),
431
432
  userAgent: z.string().nullable().optional(),
432
433
  scheduleId: z.string().nullable().optional(),
433
- scheduledAt: z.date().nullable().optional(),
434
+ scheduledAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
434
435
  }));
435
436
  export const RunShort = lazySchema(() => z.looseObject({
436
437
  id: z.string(),
@@ -438,8 +439,8 @@ export const RunShort = lazySchema(() => z.looseObject({
438
439
  userId: z.string().optional(),
439
440
  actorTaskId: z.string().nullable().optional(),
440
441
  status: ActorJobStatus(),
441
- startedAt: z.date(),
442
- finishedAt: z.date().nullable().optional(),
442
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
443
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
443
444
  buildId: z.string(),
444
445
  buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).optional(),
445
446
  buildNumberInt: z.int().optional(),
@@ -530,7 +531,7 @@ export const RunUsageUsd = lazySchema(() => z.looseObject({
530
531
  }));
531
532
  /** Information about a metamorph event that occurred during the run. */
532
533
  export const Metamorph = lazySchema(() => z.looseObject({
533
- createdAt: z.date(),
534
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
534
535
  actorId: z.string(),
535
536
  buildId: z.string(),
536
537
  inputKey: z.string().nullable().optional(),
@@ -541,8 +542,8 @@ export const Run = lazySchema(() => z.looseObject({
541
542
  actId: z.string(),
542
543
  userId: z.string(),
543
544
  actorTaskId: z.string().nullable().optional(),
544
- startedAt: z.date(),
545
- finishedAt: z.date().nullable().optional(),
545
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
546
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
546
547
  status: ActorJobStatus(),
547
548
  statusMessage: z.string().nullable().optional(),
548
549
  isStatusMessageTerminal: z.boolean().nullable().optional(),
@@ -569,7 +570,7 @@ export const Run = lazySchema(() => z.looseObject({
569
570
  }).catchall(z.string()).optional(),
570
571
  }).optional(),
571
572
  buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).nullable().optional(),
572
- containerUrl: z.string().optional(),
573
+ containerUrl: z.url({ normalize: true }).optional(),
573
574
  isContainerServerReady: z.boolean().nullable().optional(),
574
575
  gitBranchName: z.string().nullable().optional(),
575
576
  usage: RunUsage().nullable().optional(),
@@ -591,17 +592,17 @@ export const Dataset = lazySchema(() => z.looseObject({
591
592
  id: z.string(),
592
593
  name: z.string().nullable().optional(),
593
594
  userId: z.string(),
594
- createdAt: z.date(),
595
- modifiedAt: z.date(),
596
- accessedAt: z.date(),
595
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
596
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
597
+ accessedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
597
598
  itemCount: z.int().min(0),
598
599
  cleanItemCount: z.int().min(0),
599
600
  actId: z.string().nullable().optional(),
600
601
  actRunId: z.string().nullable().optional(),
601
602
  fields: z.array(z.string()).nullable().optional(),
602
603
  schema: z.record(z.string(), z.unknown()).nullable().optional(),
603
- consoleUrl: z.string(),
604
- itemsPublicUrl: z.string().optional(),
604
+ consoleUrl: z.url({ normalize: true }),
605
+ itemsPublicUrl: z.url({ normalize: true }).optional(),
605
606
  urlSigningSecretKey: z.string().nullable().optional(),
606
607
  generalAccess: GeneralAccess().nullable().optional(),
607
608
  stats: DatasetStats().optional(),
@@ -666,14 +667,14 @@ export const KeyValueStore = lazySchema(() => z.looseObject({
666
667
  name: z.string().nullable().optional(),
667
668
  userId: z.string().nullable().optional(),
668
669
  username: z.string().nullable().optional(),
669
- createdAt: z.date(),
670
- modifiedAt: z.date(),
671
- accessedAt: z.date(),
670
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
671
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
672
+ accessedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
672
673
  actId: z.string().nullable().optional(),
673
674
  actRunId: z.string().nullable().optional(),
674
- consoleUrl: z.string().optional(),
675
- keysPublicUrl: z.string().optional(),
676
- recordsPublicUrl: z.string().optional(),
675
+ consoleUrl: z.url({ normalize: true }).optional(),
676
+ keysPublicUrl: z.url({ normalize: true }).optional(),
677
+ recordsPublicUrl: z.url({ normalize: true }).optional(),
677
678
  schema: z.record(z.string(), z.unknown()).nullable().optional(),
678
679
  urlSigningSecretKey: z.string().nullable().optional(),
679
680
  generalAccess: GeneralAccess().nullable().optional(),
@@ -690,7 +691,7 @@ export const UpdateStoreRequest = lazySchema(() => z.looseObject({
690
691
  export const KeyValueStoreKey = lazySchema(() => z.looseObject({
691
692
  key: z.string(),
692
693
  size: z.int(),
693
- recordPublicUrl: z.string(),
694
+ recordPublicUrl: z.url({ normalize: true }),
694
695
  }));
695
696
  export const ListOfKeys = lazySchema(() => z.looseObject({
696
697
  items: z.array(KeyValueStoreKey()),
@@ -718,11 +719,11 @@ export const QueueId = lazySchema(() => z.string());
718
719
  /** The ID of the user who owns the request queue. */
719
720
  export const QueueUserId = lazySchema(() => z.string());
720
721
  /** The timestamp when the request queue was created. */
721
- export const QueueCreatedAt = lazySchema(() => z.date());
722
+ export const QueueCreatedAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
722
723
  /** The timestamp when the request queue was last modified. Modifications include adding, updating, or removing requests, as well as locking or unlocking requests in the request queue. */
723
- export const QueueModifiedAt = lazySchema(() => z.date());
724
+ export const QueueModifiedAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
724
725
  /** The timestamp when the request queue was last accessed. */
725
- export const QueueAccessedAt = lazySchema(() => z.date());
726
+ export const QueueAccessedAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
726
727
  /** The total number of requests in the request queue. */
727
728
  export const TotalRequestCount = lazySchema(() => z.int().min(0));
728
729
  /** The number of requests that have been handled. */
@@ -753,7 +754,7 @@ export const RequestQueue = lazySchema(() => z.looseObject({
753
754
  handledRequestCount: HandledRequestCount(),
754
755
  pendingRequestCount: PendingRequestCount(),
755
756
  hadMultipleClients: HadMultipleClients(),
756
- consoleUrl: z.string(),
757
+ consoleUrl: z.url({ normalize: true }),
757
758
  stats: RequestQueueStats().optional(),
758
759
  generalAccess: GeneralAccess().nullable().optional(),
759
760
  }));
@@ -771,6 +772,8 @@ export const UniqueKey = lazySchema(() => z.string());
771
772
  /** The URL of the request. */
772
773
  export const RequestUrl = lazySchema(() => z.string());
773
774
  export const HttpMethod = lazySchema(() => z.enum(["GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]).or(z.string()));
775
+ /** The HTTP method of the request. */
776
+ export const RequestMethod = lazySchema(() => HttpMethod());
774
777
  /** The number of times this request has been retried. */
775
778
  export const RetryCount = lazySchema(() => z.int());
776
779
  /** Custom user data attached to the request. Can contain arbitrary fields. */
@@ -778,7 +781,7 @@ export const RequestUserData = lazySchema(() => z.record(z.string(), z.unknown()
778
781
  export const RequestBase = lazySchema(() => z.looseObject({
779
782
  uniqueKey: UniqueKey(),
780
783
  url: RequestUrl(),
781
- method: HttpMethod().optional(),
784
+ method: RequestMethod().optional(),
782
785
  retryCount: RetryCount().optional(),
783
786
  loadedUrl: z.string().nullable().optional(),
784
787
  payload: z.union([z.string(), z.record(z.string(), z.unknown())]).nullable().optional(),
@@ -786,7 +789,7 @@ export const RequestBase = lazySchema(() => z.looseObject({
786
789
  userData: RequestUserData().optional(),
787
790
  noRetry: z.boolean().nullable().optional(),
788
791
  errorMessages: z.array(z.string()).nullable().optional(),
789
- handledAt: z.date().nullable().optional(),
792
+ handledAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
790
793
  }));
791
794
  /** A unique identifier assigned to the request. */
792
795
  export const RequestId = lazySchema(() => z.string());
@@ -834,7 +837,7 @@ export const RequestDraft = lazySchema(() => z.looseObject({
834
837
  id: RequestId().optional(),
835
838
  uniqueKey: UniqueKey(),
836
839
  url: RequestUrl(),
837
- method: HttpMethod().optional(),
840
+ method: RequestMethod().optional(),
838
841
  }));
839
842
  /** Result of a batch add operation containing successfully processed and failed requests. */
840
843
  export const BatchAddResult = lazySchema(() => z.looseObject({
@@ -895,7 +898,7 @@ export const UpdateRequestResponse = lazySchema(() => z.looseObject({
895
898
  data: RequestRegistration(),
896
899
  }));
897
900
  /** The timestamp when the lock on this request expires. */
898
- export const LockExpiresAt = lazySchema(() => z.date());
901
+ export const LockExpiresAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
899
902
  /** Information about a request lock. */
900
903
  export const RequestLockInfo = lazySchema(() => z.looseObject({
901
904
  lockExpiresAt: LockExpiresAt(),
@@ -911,7 +914,7 @@ export const HeadRequest = lazySchema(() => z.looseObject({
911
914
  id: RequestId(),
912
915
  uniqueKey: UniqueKey(),
913
916
  url: RequestUrl(),
914
- method: HttpMethod().optional(),
917
+ method: RequestMethod().optional(),
915
918
  retryCount: RetryCount().optional(),
916
919
  }));
917
920
  /** A batch of requests from the request queue head without locking. */
@@ -930,7 +933,7 @@ export const LockedHeadRequest = lazySchema(() => z.looseObject({
930
933
  id: RequestId(),
931
934
  uniqueKey: UniqueKey(),
932
935
  url: RequestUrl(),
933
- method: HttpMethod().optional(),
936
+ method: RequestMethod().optional(),
934
937
  retryCount: RetryCount().optional(),
935
938
  lockExpiresAt: LockExpiresAt(),
936
939
  }));
@@ -959,8 +962,8 @@ export const TaskShort = lazySchema(() => z.looseObject({
959
962
  name: z.string(),
960
963
  username: z.string().nullable().optional(),
961
964
  actUsername: z.string().nullable().optional(),
962
- createdAt: z.date(),
963
- modifiedAt: z.date(),
965
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
966
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
964
967
  stats: TaskStats().nullable().optional(),
965
968
  }));
966
969
  export const ListOfTasks = lazySchema(() => PaginationResponse().extend({
@@ -988,7 +991,7 @@ export const TaskInput = lazySchema(() => z.record(z.string(), z.unknown()));
988
991
  * `publishedAt` is set and unpublished when it is `null`.
989
992
  */
990
993
  export const TaskPublicConfig = lazySchema(() => z.looseObject({
991
- publishedAt: z.date().nullable().optional(),
994
+ publishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
992
995
  seoTitle: z.string().max(60).nullable().optional(),
993
996
  seoDescription: z.string().max(160).nullable().optional(),
994
997
  inputSchemaFields: z.array(z.string()).nullable().optional(),
@@ -1001,6 +1004,7 @@ export const CreateTaskRequest = lazySchema(() => z.looseObject({
1001
1004
  options: TaskOptions().nullable().optional(),
1002
1005
  input: z.union([TaskInput(), z.array(TaskInput())]).nullable().optional(),
1003
1006
  title: z.string().nullable().optional(),
1007
+ description: z.string().nullable().optional(),
1004
1008
  actorStandby: ActorStandby().nullable().optional(),
1005
1009
  publicConfig: TaskPublicConfig().optional(),
1006
1010
  }));
@@ -1010,15 +1014,16 @@ export const Task = lazySchema(() => z.looseObject({
1010
1014
  actId: z.string(),
1011
1015
  name: z.string(),
1012
1016
  username: z.string().nullable().optional(),
1013
- createdAt: z.date(),
1014
- modifiedAt: z.date(),
1015
- removedAt: z.date().nullable().optional(),
1017
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1018
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1019
+ removedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1016
1020
  stats: TaskStats().nullable().optional(),
1017
1021
  options: TaskOptions().nullable().optional(),
1018
1022
  input: z.union([TaskInput(), z.array(TaskInput())]).nullable().optional(),
1019
1023
  title: z.string().nullable().optional(),
1024
+ description: z.string().nullable().optional(),
1020
1025
  actorStandby: ActorStandby().nullable().optional(),
1021
- standbyUrl: z.string().nullable().optional(),
1026
+ standbyUrl: z.url({ normalize: true }).nullable().optional(),
1022
1027
  isPublic: z.boolean().optional(),
1023
1028
  publicConfig: TaskPublicConfig().nullable().optional(),
1024
1029
  }));
@@ -1031,14 +1036,15 @@ export const UpdateTaskRequest = lazySchema(() => z.looseObject({
1031
1036
  options: TaskOptions().nullable().optional(),
1032
1037
  input: z.union([TaskInput(), z.array(TaskInput())]).nullable().optional(),
1033
1038
  title: z.string().nullable().optional(),
1039
+ description: z.string().nullable().optional(),
1034
1040
  actorStandby: ActorStandby().nullable().optional(),
1035
1041
  publicConfig: TaskPublicConfig().optional(),
1036
1042
  isPublic: z.boolean().optional(),
1037
1043
  }));
1038
1044
  export const Webhook = lazySchema(() => z.looseObject({
1039
1045
  id: z.string(),
1040
- createdAt: z.date(),
1041
- modifiedAt: z.date(),
1046
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1047
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1042
1048
  userId: z.string(),
1043
1049
  isAdHoc: z.boolean().nullable().optional(),
1044
1050
  shouldInterpolateStrings: z.boolean().nullable().optional(),
@@ -1046,7 +1052,7 @@ export const Webhook = lazySchema(() => z.looseObject({
1046
1052
  condition: WebhookCondition(),
1047
1053
  ignoreSslErrors: z.boolean(),
1048
1054
  doNotRetry: z.boolean().nullable().optional(),
1049
- requestUrl: z.string().nullable().optional(),
1055
+ requestUrl: z.url({ normalize: true }).nullable().optional(),
1050
1056
  payloadTemplate: z.string().nullable().optional(),
1051
1057
  headersTemplate: z.string().nullable().optional(),
1052
1058
  description: z.string().nullable().optional(),
@@ -1075,9 +1081,9 @@ export const DatasetListItem = lazySchema(() => z.looseObject({
1075
1081
  id: z.string(),
1076
1082
  name: z.string(),
1077
1083
  userId: z.string(),
1078
- createdAt: z.date(),
1079
- modifiedAt: z.date(),
1080
- accessedAt: z.date(),
1084
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1085
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1086
+ accessedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1081
1087
  itemCount: z.int(),
1082
1088
  cleanItemCount: z.int(),
1083
1089
  actId: z.string().nullable().optional(),
@@ -1103,7 +1109,7 @@ export const RequestQueueShort = lazySchema(() => z.looseObject({
1103
1109
  createdAt: QueueCreatedAt(),
1104
1110
  modifiedAt: QueueModifiedAt(),
1105
1111
  accessedAt: QueueAccessedAt(),
1106
- expireAt: z.date().optional(),
1112
+ expireAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1107
1113
  totalRequestCount: TotalRequestCount(),
1108
1114
  handledRequestCount: HandledRequestCount(),
1109
1115
  pendingRequestCount: PendingRequestCount(),
@@ -1145,7 +1151,7 @@ export const WebhookUpdate = lazySchema(() => z.looseObject({
1145
1151
  condition: WebhookCondition().nullable().optional(),
1146
1152
  ignoreSslErrors: z.boolean().nullable().optional(),
1147
1153
  doNotRetry: z.boolean().nullable().optional(),
1148
- requestUrl: z.string().nullable().optional(),
1154
+ requestUrl: z.url({ normalize: true }).nullable().optional(),
1149
1155
  payloadTemplate: z.string().nullable().optional(),
1150
1156
  headersTemplate: z.string().nullable().optional(),
1151
1157
  description: z.string().nullable().optional(),
@@ -1155,14 +1161,14 @@ export const WebhookUpdate = lazySchema(() => z.looseObject({
1155
1161
  export const WebhookDispatchWebhookSummary = lazySchema(() => z.looseObject({
1156
1162
  actionType: z.string().optional(),
1157
1163
  condition: WebhookCondition().optional(),
1158
- requestUrl: z.string().nullable().optional(),
1164
+ requestUrl: z.url({ normalize: true }).nullable().optional(),
1159
1165
  isAdHoc: z.boolean().optional(),
1160
1166
  }));
1161
1167
  export const WebhookDispatch = lazySchema(() => z.looseObject({
1162
1168
  id: z.string(),
1163
1169
  userId: z.string(),
1164
1170
  webhookId: z.string(),
1165
- createdAt: z.date(),
1171
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1166
1172
  status: WebhookDispatchStatus(),
1167
1173
  eventType: WebhookEventType(),
1168
1174
  eventData: z.looseObject({
@@ -1173,8 +1179,8 @@ export const WebhookDispatch = lazySchema(() => z.looseObject({
1173
1179
  }).nullable().optional(),
1174
1180
  webhook: WebhookDispatchWebhookSummary().nullable().optional(),
1175
1181
  calls: z.array(z.looseObject({
1176
- startedAt: z.date().nullable().optional(),
1177
- finishedAt: z.date().nullable().optional(),
1182
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1183
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1178
1184
  errorMessage: z.string().nullable().optional(),
1179
1185
  responseStatus: z.int().nullable().optional(),
1180
1186
  responseBody: z.string().nullable().optional(),
@@ -1200,10 +1206,10 @@ export const ScheduleBase = lazySchema(() => z.looseObject({
1200
1206
  timezone: z.string(),
1201
1207
  isEnabled: z.boolean(),
1202
1208
  isExclusive: z.boolean(),
1203
- createdAt: z.date(),
1204
- modifiedAt: z.date(),
1205
- nextRunAt: z.date().nullable().optional(),
1206
- lastRunAt: z.date().nullable().optional(),
1209
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1210
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1211
+ nextRunAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1212
+ lastRunAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1207
1213
  }));
1208
1214
  export const ScheduleActionShortRunActor = lazySchema(() => z.looseObject({
1209
1215
  id: z.string(),
@@ -1279,7 +1285,7 @@ export const ScheduleResponse = lazySchema(() => z.looseObject({
1279
1285
  export const ScheduleInvoked = lazySchema(() => z.looseObject({
1280
1286
  message: z.string(),
1281
1287
  level: z.string(),
1282
- createdAt: z.date(),
1288
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1283
1289
  }));
1284
1290
  export const ScheduleLogResponse = lazySchema(() => z.looseObject({
1285
1291
  data: z.array(ScheduleInvoked()),
@@ -1287,10 +1293,10 @@ export const ScheduleLogResponse = lazySchema(() => z.looseObject({
1287
1293
  export const CurrentPricingInfo = lazySchema(() => z.looseObject({
1288
1294
  pricingModel: z.string(),
1289
1295
  apifyMarginPercentage: z.number().optional(),
1290
- createdAt: z.date().optional(),
1291
- startedAt: z.date().optional(),
1292
- notifiedAboutChangeAt: z.date().nullable().optional(),
1293
- notifiedAboutFutureChangeAt: z.date().nullable().optional(),
1296
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1297
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1298
+ notifiedAboutChangeAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1299
+ notifiedAboutFutureChangeAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1294
1300
  isPriceChangeNotificationSuppressed: z.boolean().optional(),
1295
1301
  forceContainsSignificantPriceChange: z.boolean().optional(),
1296
1302
  isPPEPlatformUsagePaidByUser: z.boolean().optional(),
@@ -1311,8 +1317,8 @@ export const StoreListActor = lazySchema(() => z.looseObject({
1311
1317
  categories: z.array(z.string()).optional(),
1312
1318
  notice: ActorNotice().optional(),
1313
1319
  pictureUrl: z.string().nullable().optional(),
1314
- userPictureUrl: z.string().nullable().optional(),
1315
- url: z.string().nullable().optional(),
1320
+ userPictureUrl: z.url({ normalize: true }).nullable().optional(),
1321
+ url: z.url({ normalize: true }).nullable().optional(),
1316
1322
  stats: ActorStats(),
1317
1323
  currentPricingInfo: CurrentPricingInfo().optional(),
1318
1324
  isWhiteListedForAgenticPayments: z.boolean().nullable().optional(),
@@ -1330,10 +1336,11 @@ export const ListOfActorsInStoreResponse = lazySchema(() => z.looseObject({
1330
1336
  }));
1331
1337
  export const Profile = lazySchema(() => z.looseObject({
1332
1338
  bio: z.string().nullable().optional(),
1339
+ readme: z.string().nullable().optional(),
1333
1340
  name: z.string().optional(),
1334
- pictureUrl: z.string().nullable().optional(),
1341
+ pictureUrl: z.url({ normalize: true }).nullable().optional(),
1335
1342
  githubUsername: z.string().nullable().optional(),
1336
- websiteUrl: z.string().nullable().optional(),
1343
+ websiteUrl: z.url({ normalize: true }).nullable().optional(),
1337
1344
  twitterUsername: z.string().nullable().optional(),
1338
1345
  }));
1339
1346
  export const UserPublicInfo = lazySchema(() => z.looseObject({
@@ -1390,7 +1397,7 @@ export const EffectivePlatformFeature = lazySchema(() => z.looseObject({
1390
1397
  disabledReason: z.string().nullable(),
1391
1398
  disabledReasonType: z.string().nullable(),
1392
1399
  isTrial: z.boolean(),
1393
- trialExpirationAt: z.date().nullable(),
1400
+ trialExpirationAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable(),
1394
1401
  }));
1395
1402
  export const EffectivePlatformFeatures = lazySchema(() => z.looseObject({
1396
1403
  ACTORS: EffectivePlatformFeature(),
@@ -1412,15 +1419,15 @@ export const UserPrivateInfo = lazySchema(() => z.looseObject({
1412
1419
  proxy: Proxy().optional(),
1413
1420
  plan: Plan().optional(),
1414
1421
  effectivePlatformFeatures: EffectivePlatformFeatures().optional(),
1415
- createdAt: z.date().optional(),
1422
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1416
1423
  isPaying: z.boolean().optional(),
1417
1424
  }));
1418
1425
  export const PrivateUserDataResponse = lazySchema(() => z.looseObject({
1419
1426
  data: UserPrivateInfo(),
1420
1427
  }));
1421
1428
  export const UsageCycle = lazySchema(() => z.looseObject({
1422
- startAt: z.date(),
1423
- endAt: z.date(),
1429
+ startAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1430
+ endAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1424
1431
  }));
1425
1432
  export const PriceTiers = lazySchema(() => z.looseObject({
1426
1433
  quantityAbove: z.number(),
@@ -1441,7 +1448,7 @@ export const MonthlyServiceUsage = lazySchema(() => z.record(z.string(), UsageIt
1441
1448
  /** A map of service usage item names to their usage details. */
1442
1449
  export const ServiceUsage = lazySchema(() => z.record(z.string(), UsageItem()));
1443
1450
  export const DailyServiceUsages = lazySchema(() => z.looseObject({
1444
- date: z.date(),
1451
+ date: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1445
1452
  serviceUsage: ServiceUsage(),
1446
1453
  totalUsageCreditsUsd: z.number(),
1447
1454
  }));
@@ -0,0 +1,60 @@
1
+ import type http from 'node:http';
2
+ import type https from 'node:https';
3
+ import type { AxiosInstance, AxiosInterceptorManager, InternalAxiosRequestConfig } from 'axios';
4
+ import type { HttpClientOptions, HttpRequest, HttpResponse } from './base.js';
5
+ import { HttpClient } from './base.js';
6
+ /**
7
+ * An [axios request interceptor](https://axios-http.com/docs/interceptors). It runs on every attempt, right before
8
+ * the request is handed to axios, and sees the request as the shared pipeline prepared it: headers merged and the
9
+ * body already serialized and compressed.
10
+ */
11
+ export type RequestInterceptorFunction = Parameters<AxiosInterceptorManager<InternalAxiosRequestConfig>['use']>[0];
12
+ /**
13
+ * Configuration of {@link AxiosHttpClient}.
14
+ */
15
+ export interface AxiosHttpClientOptions extends HttpClientOptions {
16
+ /** @default [] */
17
+ requestInterceptors?: RequestInterceptorFunction[];
18
+ }
19
+ /**
20
+ * The default HTTP client of {@link ApifyClient}, built on [axios](https://axios-http.com).
21
+ *
22
+ * It inherits the request pipeline from {@link HttpClient} and adds the transport: in Node.js, keep-alive agents
23
+ * that honor the `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` environment variables; in the browser, the XHR
24
+ * adapter of axios. Network errors are retried, timeouts included, and a stream body is sent without following
25
+ * redirects, since the part of it already sent could not be replayed.
26
+ */
27
+ export declare class AxiosHttpClient extends HttpClient {
28
+ #private;
29
+ /** The axios instance the requests go through. */
30
+ axios: AxiosInstance;
31
+ /**
32
+ * Keep-alive agent for plain HTTP, created with the first request in Node.js. It is the same `ProxyAgent` as
33
+ * {@link httpsAgent}, so the socket pool is shared across both schemes.
34
+ */
35
+ httpAgent?: http.Agent;
36
+ /** Keep-alive agent for HTTPS. The same instance as {@link httpAgent}. */
37
+ httpsAgent?: https.Agent;
38
+ constructor(options?: AxiosHttpClientOptions);
39
+ /**
40
+ * A timeout is an axios error coded `ECONNABORTED` or `ETIMEDOUT`, besides the `TimeoutError` the base class
41
+ * recognizes.
42
+ */
43
+ isTimeoutError(error: unknown): boolean;
44
+ /**
45
+ * A network failure is an axios error that carries the request it was sending: a connection that could not be
46
+ * made, dropped mid-way or timed out. Errors raised before a request exists, such as an invalid URL, are not
47
+ * retried.
48
+ */
49
+ isRetryableTransportError(error: unknown): boolean;
50
+ /**
51
+ * Destroys the keep-alive agents, closing every pooled socket. A client that never sent a request in Node.js
52
+ * has nothing to close.
53
+ */
54
+ close(): Promise<void>;
55
+ /**
56
+ * Sends the request through axios and hands the raw response back. A stream body is sent without following
57
+ * redirects, since the part of it already sent could not be replayed.
58
+ */
59
+ sendRequest(request: HttpRequest): Promise<HttpResponse>;
60
+ }