apify-client 3.0.0-beta.2 → 3.0.0-beta.20

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 (91) hide show
  1. package/README.md +3 -1
  2. package/dist/apify_api_error.d.ts +60 -19
  3. package/dist/apify_api_error.js +88 -21
  4. package/dist/apify_client.d.ts +22 -3
  5. package/dist/apify_client.js +35 -29
  6. package/dist/base/api_client.d.ts +6 -6
  7. package/dist/base/api_client.js +24 -16
  8. package/dist/base/resource_client.d.ts +23 -9
  9. package/dist/base/resource_client.js +49 -25
  10. package/dist/base/resource_collection_client.d.ts +7 -4
  11. package/dist/base/resource_collection_client.js +21 -15
  12. package/dist/bundle.js +38 -48
  13. package/dist/bundle.js.map +1 -1
  14. package/dist/generated/api.d.ts +287 -214
  15. package/dist/generated/schemas.d.ts +6699 -0
  16. package/dist/generated/schemas.js +1521 -0
  17. package/dist/http_client.d.ts +18 -51
  18. package/dist/http_client.js +79 -42
  19. package/dist/index.d.ts +3 -1
  20. package/dist/index.js +2 -1
  21. package/dist/interceptors.js +22 -4
  22. package/dist/lazy_schema.d.ts +8 -0
  23. package/dist/lazy_schema.js +11 -0
  24. package/dist/models.d.ts +32 -52
  25. package/dist/resource_clients/actor.d.ts +46 -31
  26. package/dist/resource_clients/actor.js +71 -53
  27. package/dist/resource_clients/actor_collection.d.ts +9 -5
  28. package/dist/resource_clients/actor_collection.js +12 -3
  29. package/dist/resource_clients/actor_env_var.d.ts +10 -3
  30. package/dist/resource_clients/actor_env_var.js +17 -6
  31. package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
  32. package/dist/resource_clients/actor_env_var_collection.js +18 -11
  33. package/dist/resource_clients/actor_version.d.ts +18 -3
  34. package/dist/resource_clients/actor_version.js +20 -9
  35. package/dist/resource_clients/actor_version_collection.d.ts +16 -17
  36. package/dist/resource_clients/actor_version_collection.js +20 -11
  37. package/dist/resource_clients/build.d.ts +18 -6
  38. package/dist/resource_clients/build.js +35 -17
  39. package/dist/resource_clients/build_collection.d.ts +3 -1
  40. package/dist/resource_clients/build_collection.js +5 -1
  41. package/dist/resource_clients/dataset.d.ts +23 -9
  42. package/dist/resource_clients/dataset.js +70 -48
  43. package/dist/resource_clients/dataset_collection.d.ts +6 -2
  44. package/dist/resource_clients/dataset_collection.js +13 -2
  45. package/dist/resource_clients/key_value_store.d.ts +48 -15
  46. package/dist/resource_clients/key_value_store.js +69 -39
  47. package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
  48. package/dist/resource_clients/key_value_store_collection.js +13 -2
  49. package/dist/resource_clients/log.d.ts +9 -19
  50. package/dist/resource_clients/log.js +55 -44
  51. package/dist/resource_clients/request_queue.d.ts +56 -26
  52. package/dist/resource_clients/request_queue.js +178 -113
  53. package/dist/resource_clients/request_queue_collection.d.ts +6 -2
  54. package/dist/resource_clients/request_queue_collection.js +10 -3
  55. package/dist/resource_clients/run.d.ts +51 -17
  56. package/dist/resource_clients/run.js +83 -43
  57. package/dist/resource_clients/run_collection.d.ts +3 -1
  58. package/dist/resource_clients/run_collection.js +5 -1
  59. package/dist/resource_clients/schedule.d.ts +16 -7
  60. package/dist/resource_clients/schedule.js +31 -21
  61. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  62. package/dist/resource_clients/schedule_collection.js +10 -3
  63. package/dist/resource_clients/store_collection.d.ts +3 -1
  64. package/dist/resource_clients/store_collection.js +5 -1
  65. package/dist/resource_clients/task.d.ts +28 -10
  66. package/dist/resource_clients/task.js +67 -44
  67. package/dist/resource_clients/task_collection.d.ts +6 -2
  68. package/dist/resource_clients/task_collection.js +10 -3
  69. package/dist/resource_clients/user.d.ts +17 -8
  70. package/dist/resource_clients/user.js +40 -39
  71. package/dist/resource_clients/webhook.d.ts +14 -5
  72. package/dist/resource_clients/webhook.js +30 -22
  73. package/dist/resource_clients/webhook_collection.d.ts +6 -2
  74. package/dist/resource_clients/webhook_collection.js +10 -3
  75. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  76. package/dist/resource_clients/webhook_dispatch.js +8 -2
  77. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  78. package/dist/resource_clients/webhook_dispatch_collection.js +5 -1
  79. package/dist/response_validation_error.d.ts +26 -0
  80. package/dist/response_validation_error.js +37 -0
  81. package/dist/schemas.d.ts +15 -0
  82. package/dist/schemas.js +15 -0
  83. package/dist/statistics.d.ts +1 -6
  84. package/dist/statistics.js +2 -2
  85. package/dist/timeouts.d.ts +72 -0
  86. package/dist/timeouts.js +31 -0
  87. package/dist/utils.d.ts +57 -41
  88. package/dist/utils.js +155 -121
  89. package/package.json +36 -35
  90. package/dist/argument_validation_error.d.ts +0 -17
  91. package/dist/argument_validation_error.js +0 -153
@@ -0,0 +1,1521 @@
1
+ /**
2
+ * This file was auto-generated by `scripts/generate_schemas.mts`.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ import { z } from 'zod';
6
+ import { lazySchema } from '../lazy_schema.js';
7
+ /** Common pagination fields for list responses. */
8
+ export const PaginationResponse = lazySchema(() => z.looseObject({
9
+ total: z.int().min(0),
10
+ offset: z.int().min(0),
11
+ limit: z.int().min(1),
12
+ desc: z.boolean(),
13
+ count: z.int().min(0),
14
+ }));
15
+ /** Usage statistics and Apify Store metrics for the Actor. */
16
+ export const ActorStats = lazySchema(() => z.looseObject({
17
+ totalBuilds: z.int().optional(),
18
+ totalRuns: z.int().optional(),
19
+ totalUsers: z.int().optional(),
20
+ totalUsers7Days: z.int().optional(),
21
+ totalUsers30Days: z.int().optional(),
22
+ totalUsers90Days: z.int().optional(),
23
+ totalMetamorphs: z.int().optional(),
24
+ lastRunStartedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
25
+ actorReviewCount: z.int().optional(),
26
+ actorReviewRating: z.number().optional(),
27
+ bookmarkCount: z.int().optional(),
28
+ publicActorRunStats30Days: z.looseObject({
29
+ ABORTED: z.int().optional(),
30
+ FAILED: z.int().optional(),
31
+ SUCCEEDED: z.int().optional(),
32
+ "TIMED-OUT": z.int().optional(),
33
+ TOTAL: z.int().optional(),
34
+ }).optional(),
35
+ }));
36
+ export const ActorShort = lazySchema(() => z.looseObject({
37
+ id: z.string(),
38
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
39
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
40
+ name: z.string(),
41
+ username: z.string(),
42
+ title: z.string().optional(),
43
+ stats: ActorStats().nullable().optional(),
44
+ }));
45
+ export const ListOfActors = lazySchema(() => PaginationResponse().extend({
46
+ items: z.array(ActorShort()),
47
+ }));
48
+ export const ListOfActorsResponse = lazySchema(() => z.looseObject({
49
+ data: ListOfActors(),
50
+ }));
51
+ /** Machine-processable error type identifier. */
52
+ export const ErrorType = lazySchema(() => z.enum(["3d-secure-auth-failed", "access-right-already-exists", "action-not-found", "actor-already-rented", "actor-can-not-be-rented", "actor-disabled", "actor-is-not-rented", "actor-memory-limit-exceeded", "actor-name-exists-new-owner", "actor-name-not-unique", "actor-not-found", "actor-not-github-actor", "actor-not-public", "actor-permission-level-not-supported-for-agentic-payments", "actor-review-already-exists", "actor-run-failed", "actor-standby-not-supported-for-agentic-payments", "actor-task-name-not-unique", "agentic-payment-info-retrieval-error", "agentic-payment-information-missing", "agentic-payment-insufficient-amount", "agentic-payment-provider-internal-error", "agentic-payment-provider-unauthorized", "airtable-webhook-deprecated", "already-subscribed-to-paid-actor", "apify-plan-required-to-use-paid-actor", "apify-signup-not-allowed", "auth-method-not-supported", "authorization-server-not-found", "auto-issue-date-invalid", "background-check-required", "billing-system-error", "black-friday-plan-expired", "braintree-error", "braintree-not-linked", "braintree-operation-timed-out", "braintree-unsupported-currency", "build-not-found", "build-outdated", "cannot-add-apify-events-to-ppe-actor", "cannot-add-multiple-pricing-infos", "cannot-add-pricing-info-that-alters-past", "cannot-add-second-future-pricing-info", "cannot-build-actor-from-webhook", "cannot-change-billing-interval", "cannot-change-owner", "cannot-charge-apify-event", "cannot-charge-non-pay-per-event-actor", "cannot-comment-as-other-user", "cannot-copy-actor-task", "cannot-create-payout", "cannot-create-public-actor", "cannot-create-tax-transaction", "cannot-delete-critical-actor", "cannot-delete-invoice", "cannot-delete-paid-actor", "cannot-disable-one-time-event-for-apify-start-event", "cannot-disable-organization-with-enabled-members", "cannot-disable-user-with-subscription", "cannot-link-oauth-to-unverified-email", "cannot-metamorph-to-pay-per-result-actor", "cannot-modify-actor-pricing-too-frequently", "cannot-modify-actor-pricing-with-immediate-effect", "cannot-monetize-without-payout-billing-info", "cannot-override-paid-actor-trial", "cannot-permanently-delete-subscription", "cannot-publish-actor", "cannot-publish-actor-task", "cannot-reduce-last-full-token", "cannot-reimburse-more-than-original-charge", "cannot-reimburse-non-rental-charge", "cannot-remove-own-actor-from-recently-used", "cannot-remove-payment-method", "cannot-remove-pricing-info", "cannot-remove-running-run", "cannot-remove-user-with-public-actors", "cannot-remove-user-with-subscription", "cannot-remove-user-with-unpaid-invoice", "cannot-rename-env-var", "cannot-rent-paid-actor", "cannot-review-own-actor", "cannot-set-access-rights-for-owner", "cannot-set-is-status-message-terminal", "cannot-unpublish-critical-actor", "cannot-unpublish-paid-actor", "cannot-unpublish-profile", "cannot-update-invoice-field", "concurrent-runs-limit-exceeded", "concurrent-update-detected", "conference-token-not-found", "content-encoding-forbidden-for-html", "coupon-already-redeemed", "coupon-expired", "coupon-for-new-customers", "coupon-for-subscribed-users", "coupon-limits-are-in-conflict-with-current-limits", "coupon-max-number-of-redemptions-reached", "coupon-not-found", "coupon-not-unique", "coupons-disabled", "create-github-issue-not-allowed", "creator-plan-not-available", "cron-expression-invalid", "daily-ai-token-limit-exceeded", "daily-publication-limit-exceeded", "dataset-does-not-have-fields-schema", "dataset-does-not-have-schema", "dataset-locked", "dataset-schema-invalid", "dcr-not-supported", "default-dataset-not-found", "deleting-default-build", "deleting-unfinished-build", "email-already-taken", "email-already-taken-removed-user", "email-domain-not-allowed-for-coupon", "email-invalid", "email-not-allowed", "email-not-valid", "email-update-too-soon", "elevated-permissions-needed", "env-var-already-exists", "exchange-rate-fetch-failed", "expired-conference-token", "failed-to-charge-user", "final-invoice-negative", "full-permission-actor-blocked-for-admin", "full-permission-actor-not-approved", "github-branch-empty", "github-issue-already-exists", "github-public-key-not-found", "github-repository-not-found", "github-signature-does-not-match-payload", "github-user-not-authorized-for-issues", "gmail-not-allowed", "id-does-not-match", "incompatible-billing-interval", "incomplete-payout-billing-info", "inconsistent-currencies", "incorrect-pricing-modifier-prefix", "input-json-invalid-characters", "input-json-not-object", "input-json-too-long", "input-update-collision", "insufficient-permissions", "insufficient-permissions-to-change-field", "insufficient-security-measures", "insufficient-tax-country-evidence", "integration-auth-error", "internal-server-error", "invalid-billing-info", "invalid-billing-period-for-payout", "invalid-build", "invalid-client-key", "invalid-collection", "invalid-conference-login-password", "invalid-content-type-header", "invalid-credentials", "invalid-git-auth-token", "invalid-github-issue-url", "invalid-header", "invalid-id", "invalid-idempotency-key", "invalid-input", "invalid-input-schema", "invalid-invoice", "invalid-invoice-type", "invalid-issue-date", "invalid-label-params", "invalid-main-account-user-id", "invalid-oauth-app", "invalid-oauth-scope", "invalid-one-time-invoice", "invalid-parameter", "invalid-payout-status", "invalid-picture-url", "invalid-record-key", "invalid-request", "invalid-resource-type", "invalid-signature", "invalid-subscription-plan", "invalid-tax-number", "invalid-tax-number-format", "invalid-token", "invalid-token-type", "invalid-two-factor-code", "invalid-two-factor-code-or-recovery-code", "invalid-two-factor-recovery-code", "invalid-username", "invalid-value", "invitation-invalid-resource-type", "invitation-no-longer-valid", "invoice-canceled", "invoice-cannot-be-refunded-due-to-too-high-amount", "invoice-incomplete", "invoice-is-draft", "invoice-locked", "invoice-must-be-buffer", "invoice-not-canceled", "invoice-not-draft", "invoice-not-found", "invoice-outdated", "invoice-paid-already", "issue-already-connected-to-github", "issue-not-found", "issues-bad-request", "issuer-not-registered", "job-finished", "label-already-linked", "last-api-token", "limit-reached", "max-items-must-be-greater-than-zero", "max-metamorphs-exceeded", "max-total-charge-usd-below-minimum", "max-total-charge-usd-must-be-greater-than-zero", "method-not-allowed", "migration-disabled", "missing-actor-rights", "missing-api-token", "missing-billing-info", "missing-line-items", "missing-payment-date", "missing-payout-billing-info", "missing-proxy-password", "missing-reporting-fields", "missing-resource-name", "missing-settings", "missing-username", "monthly-usage-limit-too-low", "more-than-one-update-not-allowed", "multiple-records-found", "must-be-admin", "name-not-unique", "next-runtime-computation-failed", "no-columns-in-exported-dataset", "no-payment-attempt-for-refund-found", "no-payment-method-available", "no-team-account-seats-available", "non-temporary-email", "not-enough-usage-to-run-paid-actor", "not-implemented", "not-supported-currencies", "o-auth-service-already-connected", "o-auth-service-not-connected", "oauth-resource-access-failed", "one-time-invoice-already-marked-paid", "only-drafts-can-be-deleted", "operation-canceled", "operation-not-allowed", "operation-timed-out", "organization-cannot-own-itself", "organization-role-not-found", "overlapping-payout-billing-periods", "own-token-required", "page-not-found", "param-not-one-of", "parameter-required", "parameters-mismatched", "password-reset-email-already-sent", "password-reset-token-expired", "pay-as-you-go-without-monthly-interval", "payment-attempt-status-message-required", "payout-already-paid", "payout-canceled", "payout-invalid-state", "payout-must-be-approved-to-be-marked-paid", "payout-not-found", "payout-number-already-exists", "phone-number-invalid", "phone-number-landline", "phone-number-opted-out", "phone-verification-disabled", "platform-feature-disabled", "price-overrides-validation-failed", "pricing-model-not-supported", "promotional-plan-not-available", "proxy-auth-ip-not-unique", "public-actor-disabled", "query-timeout", "quoted-price-outdated", "rate-limit-exceeded", "recaptcha-invalid", "recaptcha-required", "record-not-found", "record-not-public", "record-or-token-not-found", "record-too-large", "redirect-uri-mismatch", "reduced-plan-not-available", "rental-charge-already-reimbursed", "rental-not-allowed", "request-aborted-prematurely", "request-handled-or-locked", "request-id-invalid", "request-queue-duplicate-requests", "request-too-large", "requested-dataset-view-does-not-exist", "resume-token-expired", "run-failed", "run-input-body-not-valid-json", "run-timeout-exceeded", "russia-is-evil", "same-user", "schedule-actor-not-found", "schedule-actor-task-not-found", "schedule-name-not-unique", "schema-validation", "schema-validation-error", "schema-validation-failed", "service-worker-registration-not-allowed", "sign-up-method-not-allowed", "slack-integration-not-custom", "socket-closed", "socket-destroyed", "store-schema-invalid", "store-terms-not-accepted", "stripe-enabled", "stripe-generic-decline", "stripe-not-enabled", "stripe-not-enabled-for-user", "tagged-build-required", "tax-country-invalid", "tax-number-invalid", "tax-number-validation-failed", "taxamo-call-failed", "taxamo-request-failed", "testing-error", "token-not-provided", "too-few-versions", "too-many-actor-tasks", "too-many-actors", "too-many-labels-on-resource", "too-many-mcp-connectors", "too-many-o-auth-apps", "too-many-organizations", "too-many-requests", "too-many-schedules", "too-many-ui-access-keys", "too-many-user-labels", "too-many-values", "too-many-versions", "too-many-webhooks", "unexpected-route", "unknown-build-tag", "unknown-payment-provider", "unsubscribe-token-invalid", "unsupported-actor-pricing-model-for-agentic-payments", "unsupported-content-encoding", "unsupported-file-type-for-issue", "unsupported-file-type-image-expected", "unsupported-file-type-text-or-json-expected", "unsupported-permission", "upcoming-subscription-bill-not-up-to-date", "user-already-exists", "user-already-verified", "user-creates-organizations-too-fast", "user-disabled", "user-email-is-disposable", "user-email-not-set", "user-email-not-verified", "user-has-no-subscription", "user-integration-not-found", "user-is-already-invited", "user-is-already-organization-member", "user-is-not-member-of-organization", "user-is-not-organization", "user-is-organization", "user-is-organization-owner", "user-is-removed", "user-not-found", "user-not-logged-in", "user-not-verified", "user-or-token-not-found", "user-plan-not-allowed-for-coupon", "user-problem-with-card", "user-record-not-found", "username-already-taken", "username-missing", "username-not-allowed", "username-removal-forbidden", "username-required", "verification-email-already-sent", "verification-token-expired", "version-already-exists", "versions-size-exceeded", "weak-password", "x402-agentic-payment-already-finalized", "x402-agentic-payment-insufficient-amount", "x402-agentic-payment-malformed-token", "x402-agentic-payment-settlement-failed", "x402-agentic-payment-settlement-in-progress", "x402-agentic-payment-settlement-stuck", "x402-agentic-payment-unauthorized", "x402-payment-required", "zero-invoice"]).or(z.string()));
53
+ export const ErrorDetail = lazySchema(() => z.looseObject({
54
+ type: ErrorType().optional(),
55
+ message: z.string().optional(),
56
+ }));
57
+ export const ErrorResponse = lazySchema(() => z.looseObject({
58
+ error: ErrorDetail(),
59
+ }));
60
+ export const VersionSourceType = lazySchema(() => z.enum(["SOURCE_FILES", "GIT_REPO", "TARBALL", "GITHUB_GIST", "SOURCE_CODE"]).or(z.string()));
61
+ export const EnvVar = lazySchema(() => z.looseObject({
62
+ name: z.string(),
63
+ value: z.string().optional(),
64
+ isSecret: z.boolean().nullable().optional(),
65
+ }));
66
+ export const SourceCodeFileFormat = lazySchema(() => z.enum(["BASE64", "TEXT"]).or(z.string()));
67
+ /** Represents a single file in the Actor's source code. */
68
+ export const SourceCodeFile = lazySchema(() => z.looseObject({
69
+ format: SourceCodeFileFormat().optional(),
70
+ content: z.string().optional(),
71
+ name: z.string(),
72
+ }));
73
+ /**
74
+ * Represents a folder in the Actor's source code structure. Distinguished from
75
+ * SourceCodeFile by the presence of the `folder` property set to `true`.
76
+ */
77
+ export const SourceCodeFolder = lazySchema(() => z.looseObject({
78
+ name: z.string(),
79
+ folder: z.boolean(),
80
+ }));
81
+ export const VersionSourceFiles = lazySchema(() => z.array(z.union([SourceCodeFile(), SourceCodeFolder()])));
82
+ export const Version = lazySchema(() => z.looseObject({
83
+ versionNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$/),
84
+ sourceType: VersionSourceType().nullable(),
85
+ envVars: z.array(EnvVar()).nullable().optional(),
86
+ applyEnvVarsToBuild: z.boolean().nullable().optional(),
87
+ buildTag: z.string().nullable().optional(),
88
+ sourceFiles: VersionSourceFiles().optional(),
89
+ gitRepoUrl: z.string().nullable().optional(),
90
+ tarballUrl: z.string().nullable().optional(),
91
+ gitHubGistUrl: z.string().nullable().optional(),
92
+ }));
93
+ /** Determines the permission level that the Actor requires to run. For details, see [Actor permissions](https://docs.apify.com/platform/actors/development/permissions). */
94
+ export const ActorPermissionLevel = lazySchema(() => z.enum(["LIMITED_PERMISSIONS", "FULL_PERMISSIONS"]).or(z.string()));
95
+ /** The default settings applied to an Actor run. Can be overridden elsewhere. */
96
+ export const DefaultRunOptions = lazySchema(() => z.looseObject({
97
+ build: z.string().optional(),
98
+ timeoutSecs: z.int().optional(),
99
+ memoryMbytes: z.int().optional(),
100
+ restartOnError: z.boolean().optional(),
101
+ maxItems: z.int().nullable().optional(),
102
+ forcePermissionLevel: ActorPermissionLevel().nullable().optional(),
103
+ }));
104
+ export const ActorStandby = lazySchema(() => z.looseObject({
105
+ isEnabled: z.boolean().nullable().optional(),
106
+ desiredRequestsPerActorRun: z.int().nullable().optional(),
107
+ maxRequestsPerActorRun: z.int().nullable().optional(),
108
+ idleTimeoutSecs: z.int().nullable().optional(),
109
+ build: z.string().nullable().optional(),
110
+ memoryMbytes: z.int().nullable().optional(),
111
+ disableStandbyFieldsOverride: z.boolean().nullable().optional(),
112
+ shouldPassActorInput: z.boolean().nullable().optional(),
113
+ }));
114
+ export const ExampleRunInput = lazySchema(() => z.looseObject({
115
+ body: z.string().optional(),
116
+ contentType: z.string().optional(),
117
+ }));
118
+ export const CreateActorRequest = lazySchema(() => z.looseObject({
119
+ name: z.string().nullable().optional(),
120
+ description: z.string().nullable().optional(),
121
+ title: z.string().nullable().optional(),
122
+ isPublic: z.boolean().nullable().optional(),
123
+ seoTitle: z.string().nullable().optional(),
124
+ seoDescription: z.string().nullable().optional(),
125
+ restartOnError: z.boolean().optional(),
126
+ versions: z.array(Version()).nullable().optional(),
127
+ categories: z.array(z.string()).nullable().optional(),
128
+ defaultRunOptions: DefaultRunOptions().optional(),
129
+ actorStandby: ActorStandby().nullable().optional(),
130
+ exampleRunInput: ExampleRunInput().nullable().optional(),
131
+ isDeprecated: z.boolean().nullable().optional(),
132
+ }));
133
+ export const CommonActorPricingInfo = lazySchema(() => z.looseObject({
134
+ apifyMarginPercentage: z.number(),
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
+ reasonForChange: z.string().nullable().optional(),
140
+ isPriceChangeNotificationSuppressed: z.boolean().optional(),
141
+ forceContainsSignificantPriceChange: z.boolean().optional(),
142
+ }));
143
+ /** A single tier's price-per-event entry. */
144
+ export const TieredPricingPerEventEntry = lazySchema(() => z.looseObject({
145
+ tieredEventPriceUsd: z.number(),
146
+ }));
147
+ /**
148
+ * Tiered price-per-event pricing for a single charge event, keyed by subscription tier (e.g. `FREE`, `BRONZE`,
149
+ * `SILVER`, `GOLD`, `PLATINUM`, `DIAMOND`). The actual price applied is resolved from the user's tier.
150
+ */
151
+ export const TieredPricingPerEvent = lazySchema(() => z.record(z.string(), TieredPricingPerEventEntry()));
152
+ /**
153
+ * Definition of a single chargeable event for a pay-per-event Actor. Each event is either flat-priced
154
+ * (`eventPriceUsd` is set) or tier-priced (`eventTieredPricingUsd` is set); the two are mutually exclusive.
155
+ */
156
+ export const ActorChargeEvent = lazySchema(() => z.looseObject({
157
+ eventTitle: z.string(),
158
+ eventDescription: z.string(),
159
+ eventPriceUsd: z.number().optional(),
160
+ eventTieredPricingUsd: TieredPricingPerEvent().optional(),
161
+ isPrimaryEvent: z.boolean().optional(),
162
+ isOneTimeEvent: z.boolean().optional(),
163
+ }));
164
+ export const PayPerEventActorPricingInfo = lazySchema(() => CommonActorPricingInfo().extend({
165
+ pricingModel: z.literal("PAY_PER_EVENT"),
166
+ pricingPerEvent: z.looseObject({
167
+ actorChargeEvents: z.record(z.string(), ActorChargeEvent()).optional(),
168
+ }),
169
+ minimalMaxTotalChargeUsd: z.number().nullable().optional(),
170
+ }));
171
+ /** A single tier's price-per-dataset-item entry. */
172
+ export const TieredPricingPerDatasetItemEntry = lazySchema(() => z.looseObject({
173
+ tieredPricePerUnitUsd: z.number(),
174
+ }));
175
+ /**
176
+ * Tiered price-per-dataset-item pricing, keyed by subscription tier (e.g. `FREE`, `BRONZE`, `SILVER`, `GOLD`,
177
+ * `PLATINUM`, `DIAMOND`). The actual price applied to a run is resolved from the user's tier.
178
+ */
179
+ export const TieredPricingPerDatasetItem = lazySchema(() => z.record(z.string(), TieredPricingPerDatasetItemEntry()));
180
+ export const PricePerDatasetItemActorPricingInfo = lazySchema(() => CommonActorPricingInfo().extend({
181
+ pricingModel: z.literal("PRICE_PER_DATASET_ITEM"),
182
+ unitName: z.string(),
183
+ pricePerUnitUsd: z.number().optional(),
184
+ tieredPricing: TieredPricingPerDatasetItem().optional(),
185
+ }));
186
+ export const FlatPricePerMonthActorPricingInfo = lazySchema(() => CommonActorPricingInfo().extend({
187
+ pricingModel: z.literal("FLAT_PRICE_PER_MONTH"),
188
+ trialMinutes: z.int(),
189
+ pricePerUnitUsd: z.number(),
190
+ }));
191
+ export const FreeActorPricingInfo = lazySchema(() => CommonActorPricingInfo().extend({
192
+ pricingModel: z.literal("FREE"),
193
+ }));
194
+ export const ActorRunPricingInfo = lazySchema(() => z.discriminatedUnion("pricingModel", [PayPerEventActorPricingInfo(), PricePerDatasetItemActorPricingInfo(), FlatPricePerMonthActorPricingInfo(), FreeActorPricingInfo()]));
195
+ /** Information about a tagged build. */
196
+ export const TaggedBuildInfo = lazySchema(() => z.looseObject({
197
+ buildId: z.string().optional(),
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
+ buildNumberInt: z.int().optional(),
200
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
201
+ }));
202
+ /** A dictionary mapping build tag names (e.g., "latest", "beta") to their build information. */
203
+ export const TaggedBuilds = lazySchema(() => z.record(z.string(), TaggedBuildInfo().nullable()));
204
+ /** A warning displayed on the Actor's page in Apify Store and Console. Can be set by the Actor's developer or automatically by Apify's quality checks. */
205
+ export const ActorNotice = lazySchema(() => z.enum(["NONE", "RESIDENTIAL_PROXY_REQUIRED", "UNDER_MAINTENANCE"]).or(z.string()).nullable());
206
+ export const Actor = lazySchema(() => z.looseObject({
207
+ id: z.string(),
208
+ userId: z.string(),
209
+ name: z.string(),
210
+ username: z.string(),
211
+ description: z.string().nullable().optional(),
212
+ restartOnError: z.boolean().optional(),
213
+ isPublic: z.boolean(),
214
+ actorPermissionLevel: ActorPermissionLevel().optional(),
215
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
216
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
217
+ stats: ActorStats(),
218
+ versions: z.array(Version()),
219
+ pricingInfos: z.array(ActorRunPricingInfo()).optional(),
220
+ defaultRunOptions: DefaultRunOptions(),
221
+ exampleRunInput: ExampleRunInput().nullable().optional(),
222
+ isDeprecated: z.boolean().nullable().optional(),
223
+ deploymentKey: z.string().optional(),
224
+ title: z.string().nullable().optional(),
225
+ taggedBuilds: TaggedBuilds().nullable().optional(),
226
+ actorStandby: ActorStandby().nullable().optional(),
227
+ readmeSummary: z.string().optional(),
228
+ seoTitle: z.string().nullable().optional(),
229
+ seoDescription: z.string().nullable().optional(),
230
+ pictureUrl: z.string().nullable().optional(),
231
+ standbyUrl: z.string().nullable().optional(),
232
+ notice: ActorNotice().optional(),
233
+ categories: z.array(z.string()).optional(),
234
+ isCritical: z.boolean().optional(),
235
+ isGeneric: z.boolean().optional(),
236
+ isSourceCodeHidden: z.boolean().optional(),
237
+ hasNoDataset: z.boolean().optional(),
238
+ }));
239
+ /** Response containing Actor data. */
240
+ export const ActorResponse = lazySchema(() => z.looseObject({
241
+ data: Actor(),
242
+ }));
243
+ export const CreateOrUpdateVersionRequest = lazySchema(() => z.looseObject({
244
+ versionNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$/).nullable().optional(),
245
+ sourceType: VersionSourceType().nullable().optional(),
246
+ envVars: z.array(EnvVar()).nullable().optional(),
247
+ applyEnvVarsToBuild: z.boolean().nullable().optional(),
248
+ buildTag: z.string().nullable().optional(),
249
+ sourceFiles: VersionSourceFiles().optional(),
250
+ gitRepoUrl: z.string().nullable().optional(),
251
+ tarballUrl: z.string().nullable().optional(),
252
+ gitHubGistUrl: z.string().nullable().optional(),
253
+ }));
254
+ /** The name of the build tag. */
255
+ export const BuildTag = lazySchema(() => z.looseObject({
256
+ buildId: z.string(),
257
+ }).nullable());
258
+ export const UpdateActorRequest = lazySchema(() => z.looseObject({
259
+ name: z.string().optional(),
260
+ description: z.string().nullable().optional(),
261
+ isPublic: z.boolean().optional(),
262
+ actorPermissionLevel: ActorPermissionLevel().nullable().optional(),
263
+ seoTitle: z.string().nullable().optional(),
264
+ seoDescription: z.string().nullable().optional(),
265
+ title: z.string().nullable().optional(),
266
+ restartOnError: z.boolean().optional(),
267
+ versions: z.array(CreateOrUpdateVersionRequest()).optional(),
268
+ pricingInfos: z.array(ActorRunPricingInfo()).optional(),
269
+ categories: z.array(z.string()).nullable().optional(),
270
+ defaultRunOptions: DefaultRunOptions().nullable().optional(),
271
+ taggedBuilds: z.record(z.string(), BuildTag()).nullable().optional(),
272
+ actorStandby: ActorStandby().nullable().optional(),
273
+ exampleRunInput: ExampleRunInput().nullable().optional(),
274
+ isDeprecated: z.boolean().nullable().optional(),
275
+ }));
276
+ export const ListOfVersions = lazySchema(() => z.looseObject({
277
+ total: z.int(),
278
+ items: z.array(Version()),
279
+ }));
280
+ export const ListOfVersionsResponse = lazySchema(() => z.looseObject({
281
+ data: ListOfVersions(),
282
+ }));
283
+ export const VersionResponse = lazySchema(() => z.looseObject({
284
+ data: Version(),
285
+ }));
286
+ export const ListOfEnvVars = lazySchema(() => z.looseObject({
287
+ total: z.int(),
288
+ items: z.array(EnvVar()),
289
+ }));
290
+ export const ListOfEnvVarsResponse = lazySchema(() => z.looseObject({
291
+ data: ListOfEnvVars(),
292
+ }));
293
+ export const EnvVarRequest = lazySchema(() => EnvVar().required({ value: true }));
294
+ export const EnvVarResponse = lazySchema(() => z.looseObject({
295
+ data: EnvVar(),
296
+ }));
297
+ /** Type of event that triggers the webhook. */
298
+ export const WebhookEventType = lazySchema(() => z.enum(["ACTOR.BUILD.ABORTED", "ACTOR.BUILD.CREATED", "ACTOR.BUILD.FAILED", "ACTOR.BUILD.SUCCEEDED", "ACTOR.BUILD.TIMED_OUT", "ACTOR.RUN.ABORTED", "ACTOR.RUN.CREATED", "ACTOR.RUN.FAILED", "ACTOR.RUN.RESURRECTED", "ACTOR.RUN.SUCCEEDED", "ACTOR.RUN.TIMED_OUT", "TEST"]).or(z.string()));
299
+ export const WebhookCondition = lazySchema(() => z.looseObject({
300
+ actorId: z.string().nullable().optional(),
301
+ actorTaskId: z.string().nullable().optional(),
302
+ actorRunId: z.string().nullable().optional(),
303
+ }));
304
+ /** Status of the webhook dispatch indicating whether the HTTP request was successful. */
305
+ export const WebhookDispatchStatus = lazySchema(() => z.enum(["ACTIVE", "SUCCEEDED", "FAILED"]).or(z.string()));
306
+ export const ExampleWebhookDispatch = lazySchema(() => z.looseObject({
307
+ status: WebhookDispatchStatus(),
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
+ }));
311
+ export const WebhookStats = lazySchema(() => z.looseObject({
312
+ totalDispatches: z.int().optional(),
313
+ }));
314
+ export const WebhookShort = lazySchema(() => z.looseObject({
315
+ id: z.string(),
316
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
317
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
318
+ userId: z.string(),
319
+ isAdHoc: z.boolean().nullable().optional(),
320
+ isApifyIntegration: z.boolean().optional(),
321
+ isEnabled: z.boolean().optional(),
322
+ actionType: z.string().optional(),
323
+ shouldInterpolateStrings: z.boolean().nullable().optional(),
324
+ eventTypes: z.array(WebhookEventType()),
325
+ condition: WebhookCondition(),
326
+ ignoreSslErrors: z.boolean(),
327
+ doNotRetry: z.boolean(),
328
+ requestUrl: z.url({ normalize: true }),
329
+ lastDispatch: ExampleWebhookDispatch().nullable().optional(),
330
+ stats: WebhookStats().nullable().optional(),
331
+ }));
332
+ export const ListOfWebhooks = lazySchema(() => PaginationResponse().extend({
333
+ items: z.array(WebhookShort()),
334
+ }));
335
+ export const ListOfWebhooksResponse = lazySchema(() => z.looseObject({
336
+ data: ListOfWebhooks(),
337
+ }));
338
+ /** Status of an Actor job (run or build). */
339
+ export const ActorJobStatus = lazySchema(() => z.enum(["READY", "RUNNING", "SUCCEEDED", "FAILED", "TIMING-OUT", "TIMED-OUT", "ABORTING", "ABORTED"]).or(z.string()));
340
+ export const RunOrigin = lazySchema(() => z.enum(["DEVELOPMENT", "WEB", "API", "SCHEDULER", "TEST", "WEBHOOK", "ACTOR", "CLI", "CI", "STANDBY", "MCP"]).or(z.string()));
341
+ export const BuildsMeta = lazySchema(() => z.looseObject({
342
+ origin: RunOrigin(),
343
+ clientIp: z.string().optional(),
344
+ userAgent: z.string().optional(),
345
+ }));
346
+ export const BuildShort = lazySchema(() => z.looseObject({
347
+ id: z.string(),
348
+ actId: z.string().optional(),
349
+ userId: z.string().optional(),
350
+ status: ActorJobStatus(),
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
+ usageTotalUsd: z.number(),
354
+ buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/),
355
+ buildNumberInt: z.int().optional(),
356
+ meta: BuildsMeta().optional(),
357
+ }));
358
+ export const ListOfBuilds = lazySchema(() => PaginationResponse().extend({
359
+ items: z.array(BuildShort()),
360
+ }));
361
+ export const ListOfBuildsResponse = lazySchema(() => z.looseObject({
362
+ data: ListOfBuilds(),
363
+ }));
364
+ export const BuildStats = lazySchema(() => z.looseObject({
365
+ durationMillis: z.int().optional(),
366
+ runTimeSecs: z.number().optional(),
367
+ computeUnits: z.number().optional(),
368
+ imageSizeBytes: z.int().nullable().optional(),
369
+ }));
370
+ export const BuildOptions = lazySchema(() => z.looseObject({
371
+ useCache: z.boolean().nullable().optional(),
372
+ betaPackages: z.boolean().nullable().optional(),
373
+ memoryMbytes: z.int().nullable().optional(),
374
+ diskMbytes: z.int().nullable().optional(),
375
+ }));
376
+ export const BuildUsage = lazySchema(() => z.looseObject({
377
+ ACTOR_COMPUTE_UNITS: z.number().nullable().optional(),
378
+ }));
379
+ /** The definition of the Actor, the full specification of this field can be found in [Apify docs](https://docs.apify.com/platform/actors/development/actor-definition/actor-json) */
380
+ export const ActorDefinition = lazySchema(() => z.looseObject({
381
+ actorSpecification: z.literal(1).optional(),
382
+ name: z.string().optional(),
383
+ version: z.string().regex(/^[0-9]+(\.[0-9]+)+$/).optional(),
384
+ buildTag: z.string().optional(),
385
+ environmentVariables: z.record(z.string(), z.string()).optional(),
386
+ dockerfile: z.string().optional(),
387
+ dockerContextDir: z.string().optional(),
388
+ readme: z.string().nullable().optional(),
389
+ input: z.record(z.string(), z.unknown()).nullable().optional(),
390
+ changelog: z.string().nullable().optional(),
391
+ storages: z.looseObject({
392
+ dataset: z.record(z.string(), z.unknown()).optional(),
393
+ }).optional(),
394
+ defaultMemoryMbytes: z.union([z.string(), z.int()]).optional(),
395
+ minMemoryMbytes: z.int().min(128).optional(),
396
+ maxMemoryMbytes: z.int().min(128).optional(),
397
+ usesStandbyMode: z.boolean().optional(),
398
+ }));
399
+ export const Build = lazySchema(() => z.looseObject({
400
+ id: z.string(),
401
+ actId: z.string(),
402
+ userId: z.string(),
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
+ status: ActorJobStatus(),
406
+ meta: BuildsMeta(),
407
+ stats: BuildStats().nullable().optional(),
408
+ options: BuildOptions().nullable().optional(),
409
+ usage: BuildUsage().nullable().optional(),
410
+ usageTotalUsd: z.number().nullable().optional(),
411
+ usageUsd: BuildUsage().nullable().optional(),
412
+ inputSchema: z.string().nullable().optional(),
413
+ readme: z.string().nullable().optional(),
414
+ buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/),
415
+ actVersion: z.looseObject({
416
+ sourceType: VersionSourceType().optional(),
417
+ buildTag: z.string().optional(),
418
+ versionNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$/).optional(),
419
+ gitRepoUrl: z.string().optional(),
420
+ sourceFiles: z.array(SourceCodeFile()).optional(),
421
+ }).optional(),
422
+ actorDefinition: ActorDefinition().nullable().optional(),
423
+ }));
424
+ /** Response containing Actor build data. */
425
+ export const BuildResponse = lazySchema(() => z.looseObject({
426
+ data: Build(),
427
+ }));
428
+ export const RunMeta = lazySchema(() => z.looseObject({
429
+ origin: RunOrigin(),
430
+ clientIp: z.string().nullable().optional(),
431
+ userAgent: z.string().nullable().optional(),
432
+ scheduleId: z.string().nullable().optional(),
433
+ scheduledAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
434
+ }));
435
+ export const RunShort = lazySchema(() => z.looseObject({
436
+ id: z.string(),
437
+ actId: z.string(),
438
+ userId: z.string().optional(),
439
+ actorTaskId: z.string().nullable().optional(),
440
+ status: ActorJobStatus(),
441
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
442
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
443
+ buildId: z.string(),
444
+ buildNumber: z.string().regex(/^([0-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])(\.[1-9][0-9]{0,4})$/).optional(),
445
+ buildNumberInt: z.int().optional(),
446
+ meta: RunMeta(),
447
+ usageTotalUsd: z.number(),
448
+ defaultKeyValueStoreId: z.string(),
449
+ defaultDatasetId: z.string(),
450
+ defaultRequestQueueId: z.string(),
451
+ }));
452
+ export const ListOfRuns = lazySchema(() => PaginationResponse().extend({
453
+ items: z.array(RunShort()),
454
+ }));
455
+ export const ListOfRunsResponse = lazySchema(() => z.looseObject({
456
+ data: ListOfRuns(),
457
+ }));
458
+ /**
459
+ * Minimal representation of an ad-hoc webhook attached to a single Actor run or build via the
460
+ * `webhooks` query parameter. The query parameter value is a Base64-encoded JSON array whose
461
+ * items match this schema. Persistent webhook fields (e.g. `condition`) are not used here.
462
+ */
463
+ export const WebhookRepresentation = lazySchema(() => z.looseObject({
464
+ eventTypes: z.array(WebhookEventType()),
465
+ requestUrl: z.string(),
466
+ payloadTemplate: z.string().nullable().optional(),
467
+ headersTemplate: z.string().nullable().optional(),
468
+ shouldInterpolateStrings: z.boolean().nullable().optional(),
469
+ idempotencyKey: z.string().nullable().optional(),
470
+ ignoreSslErrors: z.boolean().nullable().optional(),
471
+ doNotRetry: z.boolean().nullable().optional(),
472
+ }));
473
+ export const RunStats = lazySchema(() => z.looseObject({
474
+ inputBodyLen: z.int().min(0).nullable().optional(),
475
+ migrationCount: z.int().min(0).optional(),
476
+ rebootCount: z.int().min(0).optional(),
477
+ restartCount: z.int().min(0).optional(),
478
+ resurrectCount: z.int().min(0).optional(),
479
+ memAvgBytes: z.number().optional(),
480
+ memMaxBytes: z.int().min(0).optional(),
481
+ memCurrentBytes: z.int().min(0).optional(),
482
+ cpuAvgUsage: z.number().optional(),
483
+ cpuMaxUsage: z.number().optional(),
484
+ cpuCurrentUsage: z.number().optional(),
485
+ netRxBytes: z.int().min(0).optional(),
486
+ netTxBytes: z.int().min(0).optional(),
487
+ durationMillis: z.int().min(0).optional(),
488
+ runTimeSecs: z.number().min(0).optional(),
489
+ metamorph: z.int().min(0).optional(),
490
+ computeUnits: z.number().min(0).optional(),
491
+ }));
492
+ export const RunOptions = lazySchema(() => z.looseObject({
493
+ build: z.string(),
494
+ timeoutSecs: z.int().min(0),
495
+ memoryMbytes: z.int().min(128).max(32768),
496
+ diskMbytes: z.int().min(0),
497
+ maxItems: z.int().min(0).nullable().optional(),
498
+ maxTotalChargeUsd: z.number().min(0).nullable().optional(),
499
+ }));
500
+ /** Defines the general access level for the resource. */
501
+ export const GeneralAccess = lazySchema(() => z.enum(["ANYONE_WITH_ID_CAN_READ", "ANYONE_WITH_NAME_CAN_READ", "FOLLOW_USER_SETTING", "RESTRICTED"]).or(z.string()));
502
+ export const RunUsage = lazySchema(() => z.looseObject({
503
+ ACTOR_COMPUTE_UNITS: z.number().nullable().optional(),
504
+ DATASET_READS: z.int().nullable().optional(),
505
+ DATASET_WRITES: z.int().nullable().optional(),
506
+ KEY_VALUE_STORE_READS: z.int().nullable().optional(),
507
+ KEY_VALUE_STORE_WRITES: z.int().nullable().optional(),
508
+ KEY_VALUE_STORE_LISTS: z.int().nullable().optional(),
509
+ REQUEST_QUEUE_READS: z.int().nullable().optional(),
510
+ REQUEST_QUEUE_WRITES: z.int().nullable().optional(),
511
+ DATA_TRANSFER_INTERNAL_GBYTES: z.number().nullable().optional(),
512
+ DATA_TRANSFER_EXTERNAL_GBYTES: z.number().nullable().optional(),
513
+ PROXY_RESIDENTIAL_TRANSFER_GBYTES: z.number().nullable().optional(),
514
+ PROXY_SERPS: z.int().nullable().optional(),
515
+ }));
516
+ /** Resource usage costs in USD. All values are monetary amounts in US dollars. */
517
+ export const RunUsageUsd = lazySchema(() => z.looseObject({
518
+ ACTOR_COMPUTE_UNITS: z.number().nullable().optional(),
519
+ DATASET_READS: z.number().nullable().optional(),
520
+ DATASET_WRITES: z.number().nullable().optional(),
521
+ KEY_VALUE_STORE_READS: z.number().nullable().optional(),
522
+ KEY_VALUE_STORE_WRITES: z.number().nullable().optional(),
523
+ KEY_VALUE_STORE_LISTS: z.number().nullable().optional(),
524
+ REQUEST_QUEUE_READS: z.number().nullable().optional(),
525
+ REQUEST_QUEUE_WRITES: z.number().nullable().optional(),
526
+ DATA_TRANSFER_INTERNAL_GBYTES: z.number().nullable().optional(),
527
+ DATA_TRANSFER_EXTERNAL_GBYTES: z.number().nullable().optional(),
528
+ PROXY_RESIDENTIAL_TRANSFER_GBYTES: z.number().nullable().optional(),
529
+ PROXY_SERPS: z.number().nullable().optional(),
530
+ }));
531
+ /** Information about a metamorph event that occurred during the run. */
532
+ export const Metamorph = lazySchema(() => z.looseObject({
533
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
534
+ actorId: z.string(),
535
+ buildId: z.string(),
536
+ inputKey: z.string().nullable().optional(),
537
+ }));
538
+ /** Represents an Actor run and its associated data. */
539
+ export const Run = lazySchema(() => z.looseObject({
540
+ id: z.string(),
541
+ actId: z.string(),
542
+ userId: z.string(),
543
+ actorTaskId: z.string().nullable().optional(),
544
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
545
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
546
+ status: ActorJobStatus(),
547
+ statusMessage: z.string().nullable().optional(),
548
+ isStatusMessageTerminal: z.boolean().nullable().optional(),
549
+ meta: RunMeta(),
550
+ pricingInfo: ActorRunPricingInfo().optional(),
551
+ stats: RunStats(),
552
+ chargedEventCounts: z.record(z.string(), z.int()).optional(),
553
+ options: RunOptions(),
554
+ buildId: z.string(),
555
+ exitCode: z.int().nullable().optional(),
556
+ generalAccess: GeneralAccess().nullable().optional(),
557
+ defaultKeyValueStoreId: z.string(),
558
+ defaultDatasetId: z.string(),
559
+ defaultRequestQueueId: z.string(),
560
+ storageIds: z.looseObject({
561
+ datasets: z.looseObject({
562
+ default: z.string().optional(),
563
+ }).catchall(z.string()).optional(),
564
+ keyValueStores: z.looseObject({
565
+ default: z.string().optional(),
566
+ }).catchall(z.string()).optional(),
567
+ requestQueues: z.looseObject({
568
+ default: z.string().optional(),
569
+ }).catchall(z.string()).optional(),
570
+ }).optional(),
571
+ 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.url({ normalize: true }).optional(),
573
+ isContainerServerReady: z.boolean().nullable().optional(),
574
+ gitBranchName: z.string().nullable().optional(),
575
+ usage: RunUsage().nullable().optional(),
576
+ usageTotalUsd: z.number().nullable().optional(),
577
+ usageUsd: RunUsageUsd().nullable().optional(),
578
+ metamorphs: z.array(Metamorph()).nullable().optional(),
579
+ platformUsageBillingModel: z.string().optional(),
580
+ }));
581
+ export const RunResponse = lazySchema(() => z.looseObject({
582
+ data: Run(),
583
+ }));
584
+ export const DatasetStats = lazySchema(() => z.looseObject({
585
+ readCount: z.int().optional(),
586
+ writeCount: z.int().optional(),
587
+ storageBytes: z.int().optional(),
588
+ inflatedBytes: z.int().optional(),
589
+ }));
590
+ export const Dataset = lazySchema(() => z.looseObject({
591
+ id: z.string(),
592
+ name: z.string().nullable().optional(),
593
+ userId: z.string(),
594
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
595
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
596
+ accessedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
597
+ itemCount: z.int().min(0),
598
+ cleanItemCount: z.int().min(0),
599
+ actId: z.string().nullable().optional(),
600
+ actRunId: z.string().nullable().optional(),
601
+ fields: z.array(z.string()).nullable().optional(),
602
+ schema: z.record(z.string(), z.unknown()).nullable().optional(),
603
+ consoleUrl: z.url({ normalize: true }),
604
+ itemsPublicUrl: z.url({ normalize: true }).optional(),
605
+ urlSigningSecretKey: z.string().nullable().optional(),
606
+ generalAccess: GeneralAccess().nullable().optional(),
607
+ stats: DatasetStats().optional(),
608
+ }));
609
+ /** Response containing dataset metadata. */
610
+ export const DatasetResponse = lazySchema(() => z.looseObject({
611
+ data: Dataset(),
612
+ }));
613
+ export const UpdateDatasetRequest = lazySchema(() => z.looseObject({
614
+ name: z.string().nullable().optional(),
615
+ generalAccess: GeneralAccess().optional(),
616
+ }));
617
+ /**
618
+ * The request body containing the item(s) to add to the dataset. Can be a single
619
+ * object or an array of objects. Each object represents one dataset item.
620
+ */
621
+ export const PutItemsRequest = lazySchema(() => z.record(z.string(), z.unknown()));
622
+ export const ValidationError = lazySchema(() => z.looseObject({
623
+ instancePath: z.string().optional(),
624
+ schemaPath: z.string().optional(),
625
+ keyword: z.string().optional(),
626
+ message: z.string().optional(),
627
+ params: z.record(z.string(), z.unknown()).optional(),
628
+ }));
629
+ export const InvalidItem = lazySchema(() => z.looseObject({
630
+ itemPosition: z.int().optional(),
631
+ validationErrors: z.array(ValidationError()).optional(),
632
+ }));
633
+ export const SchemaValidationErrorData = lazySchema(() => z.looseObject({
634
+ invalidItems: z.array(InvalidItem()),
635
+ }));
636
+ export const DatasetSchemaValidationError = lazySchema(() => z.looseObject({
637
+ type: z.string().optional(),
638
+ message: z.string().optional(),
639
+ data: SchemaValidationErrorData().optional(),
640
+ }));
641
+ export const PutItemResponseError = lazySchema(() => z.looseObject({
642
+ error: DatasetSchemaValidationError(),
643
+ }));
644
+ export const DatasetFieldStatistics = lazySchema(() => z.looseObject({
645
+ min: z.number().nullable().optional(),
646
+ max: z.number().nullable().optional(),
647
+ nullCount: z.int().nullable().optional(),
648
+ emptyCount: z.int().nullable().optional(),
649
+ }));
650
+ export const DatasetStatistics = lazySchema(() => z.looseObject({
651
+ fieldStatistics: z.record(z.string(), DatasetFieldStatistics()).nullable().optional(),
652
+ }));
653
+ export const DatasetStatisticsResponse = lazySchema(() => z.looseObject({
654
+ data: DatasetStatistics(),
655
+ }));
656
+ export const KeyValueStoreStats = lazySchema(() => z.looseObject({
657
+ readCount: z.int().optional(),
658
+ writeCount: z.int().optional(),
659
+ deleteCount: z.int().optional(),
660
+ listCount: z.int().optional(),
661
+ s3StorageBytes: z.int().optional(),
662
+ storageBytes: z.int().optional(),
663
+ }));
664
+ export const KeyValueStore = lazySchema(() => z.looseObject({
665
+ id: z.string(),
666
+ name: z.string().nullable().optional(),
667
+ userId: z.string().nullable().optional(),
668
+ username: z.string().nullable().optional(),
669
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
670
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
671
+ accessedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
672
+ actId: z.string().nullable().optional(),
673
+ actRunId: z.string().nullable().optional(),
674
+ consoleUrl: z.url({ normalize: true }).optional(),
675
+ keysPublicUrl: z.url({ normalize: true }).optional(),
676
+ recordsPublicUrl: z.url({ normalize: true }).optional(),
677
+ schema: z.record(z.string(), z.unknown()).nullable().optional(),
678
+ urlSigningSecretKey: z.string().nullable().optional(),
679
+ generalAccess: GeneralAccess().nullable().optional(),
680
+ stats: KeyValueStoreStats().optional(),
681
+ }));
682
+ /** Response containing key-value store data. */
683
+ export const KeyValueStoreResponse = lazySchema(() => z.looseObject({
684
+ data: KeyValueStore(),
685
+ }));
686
+ export const UpdateStoreRequest = lazySchema(() => z.looseObject({
687
+ name: z.string().nullable().optional(),
688
+ generalAccess: GeneralAccess().optional(),
689
+ }));
690
+ export const KeyValueStoreKey = lazySchema(() => z.looseObject({
691
+ key: z.string(),
692
+ size: z.int(),
693
+ recordPublicUrl: z.url({ normalize: true }),
694
+ }));
695
+ export const ListOfKeys = lazySchema(() => z.looseObject({
696
+ items: z.array(KeyValueStoreKey()),
697
+ count: z.int(),
698
+ limit: z.int(),
699
+ exclusiveStartKey: z.string().nullable().optional(),
700
+ isTruncated: z.boolean(),
701
+ nextExclusiveStartKey: z.string().nullable().optional(),
702
+ }));
703
+ export const ListOfKeysResponse = lazySchema(() => z.looseObject({
704
+ data: ListOfKeys(),
705
+ }));
706
+ /**
707
+ * The response body contains the value of the record. The content type of the response
708
+ * is determined by the Content-Type header stored with the record.
709
+ */
710
+ export const RecordResponse = lazySchema(() => z.record(z.string(), z.unknown()));
711
+ /**
712
+ * The request body contains the value to store in the record. The content type
713
+ * should be specified in the Content-Type header.
714
+ */
715
+ export const PutRecordRequest = lazySchema(() => z.record(z.string(), z.unknown()));
716
+ /** A unique identifier assigned to the request queue. */
717
+ export const QueueId = lazySchema(() => z.string());
718
+ /** The ID of the user who owns the request queue. */
719
+ export const QueueUserId = lazySchema(() => z.string());
720
+ /** The timestamp when the request queue was created. */
721
+ export const QueueCreatedAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
722
+ /** 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.iso.datetime({ offset: true }).pipe(z.coerce.date()));
724
+ /** The timestamp when the request queue was last accessed. */
725
+ export const QueueAccessedAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
726
+ /** The total number of requests in the request queue. */
727
+ export const TotalRequestCount = lazySchema(() => z.int().min(0));
728
+ /** The number of requests that have been handled. */
729
+ export const HandledRequestCount = lazySchema(() => z.int().min(0));
730
+ /** The number of requests that are pending and have not been handled yet. */
731
+ export const PendingRequestCount = lazySchema(() => z.int());
732
+ /** Whether the request queue has been accessed by multiple different clients. */
733
+ export const HadMultipleClients = lazySchema(() => z.boolean());
734
+ /** Statistics about request queue operations and storage. */
735
+ export const RequestQueueStats = lazySchema(() => z.looseObject({
736
+ deleteCount: z.int().optional(),
737
+ headItemReadCount: z.int().optional(),
738
+ readCount: z.int().optional(),
739
+ storageBytes: z.int().optional(),
740
+ writeCount: z.int().optional(),
741
+ }));
742
+ /** A request queue object containing metadata and statistics. */
743
+ export const RequestQueue = lazySchema(() => z.looseObject({
744
+ id: QueueId(),
745
+ name: z.string().nullable().optional(),
746
+ userId: QueueUserId(),
747
+ actId: z.string().nullable().optional(),
748
+ actRunId: z.string().nullable().optional(),
749
+ createdAt: QueueCreatedAt(),
750
+ modifiedAt: QueueModifiedAt(),
751
+ accessedAt: QueueAccessedAt(),
752
+ totalRequestCount: TotalRequestCount(),
753
+ handledRequestCount: HandledRequestCount(),
754
+ pendingRequestCount: PendingRequestCount(),
755
+ hadMultipleClients: HadMultipleClients(),
756
+ consoleUrl: z.url({ normalize: true }),
757
+ stats: RequestQueueStats().optional(),
758
+ generalAccess: GeneralAccess().nullable().optional(),
759
+ }));
760
+ /** Response containing request queue data. */
761
+ export const RequestQueueResponse = lazySchema(() => z.looseObject({
762
+ data: RequestQueue(),
763
+ }));
764
+ /** Request object for updating a request queue. */
765
+ export const UpdateRequestQueueRequest = lazySchema(() => z.looseObject({
766
+ name: z.string().nullable().optional(),
767
+ generalAccess: GeneralAccess().optional(),
768
+ }));
769
+ /** A unique key used for request de-duplication. Requests with the same unique key are considered identical. */
770
+ export const UniqueKey = lazySchema(() => z.string());
771
+ /** The URL of the request. */
772
+ export const RequestUrl = lazySchema(() => z.string());
773
+ export const HttpMethod = lazySchema(() => z.enum(["GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"]).or(z.string()));
774
+ /** The number of times this request has been retried. */
775
+ export const RetryCount = lazySchema(() => z.int());
776
+ /** Custom user data attached to the request. Can contain arbitrary fields. */
777
+ export const RequestUserData = lazySchema(() => z.record(z.string(), z.unknown()));
778
+ export const RequestBase = lazySchema(() => z.looseObject({
779
+ uniqueKey: UniqueKey(),
780
+ url: RequestUrl(),
781
+ method: HttpMethod().optional(),
782
+ retryCount: RetryCount().optional(),
783
+ loadedUrl: z.string().nullable().optional(),
784
+ payload: z.union([z.string(), z.record(z.string(), z.unknown())]).nullable().optional(),
785
+ headers: z.record(z.string(), z.unknown()).nullable().optional(),
786
+ userData: RequestUserData().optional(),
787
+ noRetry: z.boolean().nullable().optional(),
788
+ errorMessages: z.array(z.string()).nullable().optional(),
789
+ handledAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
790
+ }));
791
+ /** A unique identifier assigned to the request. */
792
+ export const RequestId = lazySchema(() => z.string());
793
+ /** A request stored in the request queue, including its metadata and processing state. */
794
+ export const Request = lazySchema(() => RequestBase().extend({
795
+ id: RequestId().optional(),
796
+ }).required({ id: true }));
797
+ /** A paginated list of requests from the request queue. */
798
+ export const ListOfRequests = lazySchema(() => z.looseObject({
799
+ items: z.array(Request()),
800
+ limit: z.int(),
801
+ exclusiveStartId: z.string().optional(),
802
+ cursor: z.string().optional(),
803
+ nextCursor: z.string().optional(),
804
+ }));
805
+ /** Response containing a list of requests from the request queue. */
806
+ export const ListOfRequestsResponse = lazySchema(() => z.looseObject({
807
+ data: ListOfRequests(),
808
+ }));
809
+ /** A request stored in the request queue, including its metadata and processing state, without the assigned ID. */
810
+ export const RequestWithoutId = lazySchema(() => RequestBase());
811
+ /** Indicates whether a request with the same unique key already existed in the request queue. If true, no new request was created. */
812
+ export const WasAlreadyPresent = lazySchema(() => z.boolean());
813
+ /** Indicates whether a request with the same unique key has already been processed by the request queue. */
814
+ export const WasAlreadyHandled = lazySchema(() => z.boolean());
815
+ /** Result of registering a request in the request queue, either by adding a new request or updating an existing one. */
816
+ export const RequestRegistration = lazySchema(() => z.looseObject({
817
+ requestId: RequestId(),
818
+ wasAlreadyPresent: WasAlreadyPresent(),
819
+ wasAlreadyHandled: WasAlreadyHandled(),
820
+ }));
821
+ /** Response containing the result of adding a request to the request queue. */
822
+ export const AddRequestResponse = lazySchema(() => z.looseObject({
823
+ data: RequestRegistration(),
824
+ }));
825
+ /** Information about a request that was successfully added to a request queue. */
826
+ export const AddedRequest = lazySchema(() => z.looseObject({
827
+ requestId: RequestId(),
828
+ uniqueKey: UniqueKey(),
829
+ wasAlreadyPresent: WasAlreadyPresent(),
830
+ wasAlreadyHandled: WasAlreadyHandled(),
831
+ }));
832
+ /** A request that failed to be processed during a request queue operation and can be retried. */
833
+ export const RequestDraft = lazySchema(() => z.looseObject({
834
+ id: RequestId().optional(),
835
+ uniqueKey: UniqueKey(),
836
+ url: RequestUrl(),
837
+ method: HttpMethod().optional(),
838
+ }));
839
+ /** Result of a batch add operation containing successfully processed and failed requests. */
840
+ export const BatchAddResult = lazySchema(() => z.looseObject({
841
+ processedRequests: z.array(AddedRequest()),
842
+ unprocessedRequests: z.array(RequestDraft()),
843
+ }));
844
+ /** Response containing the result of a batch add operation. */
845
+ export const BatchAddResponse = lazySchema(() => z.looseObject({
846
+ data: BatchAddResult(),
847
+ }));
848
+ /** A request that should be deleted, identified by its ID. */
849
+ export const RequestDraftDeleteById = lazySchema(() => z.looseObject({
850
+ id: RequestId(),
851
+ uniqueKey: UniqueKey().optional(),
852
+ }));
853
+ /** A request that should be deleted, identified by its unique key. */
854
+ export const RequestDraftDeleteByUniqueKey = lazySchema(() => z.looseObject({
855
+ id: RequestId().optional(),
856
+ uniqueKey: UniqueKey(),
857
+ }));
858
+ /** A request that should be deleted. */
859
+ export const RequestDraftDelete = lazySchema(() => z.union([RequestDraftDeleteById(), RequestDraftDeleteByUniqueKey()]));
860
+ /** Confirmation of a request that was successfully deleted, identified by its ID. */
861
+ export const DeletedRequestById = lazySchema(() => z.looseObject({
862
+ uniqueKey: UniqueKey().optional(),
863
+ id: RequestId(),
864
+ }));
865
+ /** Confirmation of a request that was successfully deleted, identified by its unique key. */
866
+ export const DeletedRequestByUniqueKey = lazySchema(() => z.looseObject({
867
+ uniqueKey: UniqueKey(),
868
+ id: RequestId().optional(),
869
+ }));
870
+ /** Confirmation of a request that was successfully deleted from a request queue. */
871
+ export const DeletedRequest = lazySchema(() => z.union([DeletedRequestById(), DeletedRequestByUniqueKey()]));
872
+ /** Result of a batch delete operation containing successfully deleted and failed requests. */
873
+ export const BatchDeleteResult = lazySchema(() => z.looseObject({
874
+ processedRequests: z.array(DeletedRequest()),
875
+ unprocessedRequests: z.array(RequestDraft()),
876
+ }));
877
+ /** Response containing the result of a batch delete operation. */
878
+ export const BatchDeleteResponse = lazySchema(() => z.looseObject({
879
+ data: BatchDeleteResult(),
880
+ }));
881
+ /** Result of unlocking requests in the request queue. */
882
+ export const UnlockRequestsResult = lazySchema(() => z.looseObject({
883
+ unlockedCount: z.int(),
884
+ }));
885
+ /** Response containing the result of unlocking requests. */
886
+ export const UnlockRequestsResponse = lazySchema(() => z.looseObject({
887
+ data: UnlockRequestsResult(),
888
+ }));
889
+ /** Response containing a single request from the request queue. */
890
+ export const RequestResponse = lazySchema(() => z.looseObject({
891
+ data: Request(),
892
+ }));
893
+ /** Response containing the result of updating a request in the request queue. */
894
+ export const UpdateRequestResponse = lazySchema(() => z.looseObject({
895
+ data: RequestRegistration(),
896
+ }));
897
+ /** The timestamp when the lock on this request expires. */
898
+ export const LockExpiresAt = lazySchema(() => z.iso.datetime({ offset: true }).pipe(z.coerce.date()));
899
+ /** Information about a request lock. */
900
+ export const RequestLockInfo = lazySchema(() => z.looseObject({
901
+ lockExpiresAt: LockExpiresAt(),
902
+ }));
903
+ /** Response containing updated lock information after prolonging a request lock. */
904
+ export const ProlongRequestLockResponse = lazySchema(() => z.looseObject({
905
+ data: RequestLockInfo(),
906
+ }));
907
+ /** The maximum number of requests returned. */
908
+ export const HeadLimit = lazySchema(() => z.int());
909
+ /** A request from the request queue head without lock information. */
910
+ export const HeadRequest = lazySchema(() => z.looseObject({
911
+ id: RequestId(),
912
+ uniqueKey: UniqueKey(),
913
+ url: RequestUrl(),
914
+ method: HttpMethod().optional(),
915
+ retryCount: RetryCount().optional(),
916
+ }));
917
+ /** A batch of requests from the request queue head without locking. */
918
+ export const RequestQueueHead = lazySchema(() => z.looseObject({
919
+ limit: HeadLimit(),
920
+ queueModifiedAt: QueueModifiedAt(),
921
+ hadMultipleClients: HadMultipleClients(),
922
+ items: z.array(HeadRequest()),
923
+ }));
924
+ /** Response containing requests from the request queue head without locking. */
925
+ export const HeadResponse = lazySchema(() => z.looseObject({
926
+ data: RequestQueueHead(),
927
+ }));
928
+ /** A request from the request queue head that has been locked for processing. */
929
+ export const LockedHeadRequest = lazySchema(() => z.looseObject({
930
+ id: RequestId(),
931
+ uniqueKey: UniqueKey(),
932
+ url: RequestUrl(),
933
+ method: HttpMethod().optional(),
934
+ retryCount: RetryCount().optional(),
935
+ lockExpiresAt: LockExpiresAt(),
936
+ }));
937
+ /** A batch of locked requests from the request queue head. */
938
+ export const LockedRequestQueueHead = lazySchema(() => z.looseObject({
939
+ limit: HeadLimit(),
940
+ queueModifiedAt: QueueModifiedAt(),
941
+ queueHasLockedRequests: z.boolean().optional(),
942
+ clientKey: z.string().optional(),
943
+ hadMultipleClients: HadMultipleClients(),
944
+ lockSecs: z.int(),
945
+ items: z.array(LockedHeadRequest()),
946
+ }));
947
+ /** Response containing locked requests from the request queue head. */
948
+ export const HeadAndLockResponse = lazySchema(() => z.looseObject({
949
+ data: LockedRequestQueueHead(),
950
+ }));
951
+ export const TaskStats = lazySchema(() => z.looseObject({
952
+ totalRuns: z.int().optional(),
953
+ }));
954
+ export const TaskShort = lazySchema(() => z.looseObject({
955
+ id: z.string(),
956
+ userId: z.string(),
957
+ actId: z.string(),
958
+ actName: z.string().nullable().optional(),
959
+ name: z.string(),
960
+ username: z.string().nullable().optional(),
961
+ actUsername: z.string().nullable().optional(),
962
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
963
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
964
+ stats: TaskStats().nullable().optional(),
965
+ }));
966
+ export const ListOfTasks = lazySchema(() => PaginationResponse().extend({
967
+ items: z.array(TaskShort()),
968
+ }));
969
+ export const ListOfTasksResponse = lazySchema(() => z.looseObject({
970
+ data: ListOfTasks(),
971
+ }));
972
+ export const TaskOptions = lazySchema(() => z.looseObject({
973
+ build: z.string().nullable().optional(),
974
+ timeoutSecs: z.int().nullable().optional(),
975
+ memoryMbytes: z.int().nullable().optional(),
976
+ maxItems: z.int().nullable().optional(),
977
+ maxTotalChargeUsd: z.number().nullable().optional(),
978
+ restartOnError: z.boolean().nullable().optional(),
979
+ }));
980
+ /**
981
+ * The input configuration for the Actor task. This is a user-defined JSON object
982
+ * that will be passed to the Actor when the task is run.
983
+ */
984
+ export const TaskInput = lazySchema(() => z.record(z.string(), z.unknown()));
985
+ /**
986
+ * Public-facing configuration of a published task, used by the task's public landing page.
987
+ * The task's publication state is determined by `publishedAt` - a task is published when
988
+ * `publishedAt` is set and unpublished when it is `null`.
989
+ */
990
+ export const TaskPublicConfig = lazySchema(() => z.looseObject({
991
+ publishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
992
+ seoTitle: z.string().max(60).nullable().optional(),
993
+ seoDescription: z.string().max(160).nullable().optional(),
994
+ inputSchemaFields: z.array(z.string()).nullable().optional(),
995
+ datasetName: z.string().nullable().optional(),
996
+ datasetView: z.string().nullable().optional(),
997
+ }));
998
+ export const CreateTaskRequest = lazySchema(() => z.looseObject({
999
+ actId: z.string(),
1000
+ name: z.string().optional(),
1001
+ options: TaskOptions().nullable().optional(),
1002
+ input: z.union([TaskInput(), z.array(TaskInput())]).nullable().optional(),
1003
+ title: z.string().nullable().optional(),
1004
+ actorStandby: ActorStandby().nullable().optional(),
1005
+ publicConfig: TaskPublicConfig().optional(),
1006
+ }));
1007
+ export const Task = lazySchema(() => z.looseObject({
1008
+ id: z.string(),
1009
+ userId: z.string(),
1010
+ actId: z.string(),
1011
+ name: z.string(),
1012
+ username: z.string().nullable().optional(),
1013
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1014
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1015
+ removedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1016
+ stats: TaskStats().nullable().optional(),
1017
+ options: TaskOptions().nullable().optional(),
1018
+ input: z.union([TaskInput(), z.array(TaskInput())]).nullable().optional(),
1019
+ title: z.string().nullable().optional(),
1020
+ actorStandby: ActorStandby().nullable().optional(),
1021
+ standbyUrl: z.url({ normalize: true }).nullable().optional(),
1022
+ isPublic: z.boolean().optional(),
1023
+ publicConfig: TaskPublicConfig().nullable().optional(),
1024
+ }));
1025
+ /** Response containing Actor task data. */
1026
+ export const TaskResponse = lazySchema(() => z.looseObject({
1027
+ data: Task(),
1028
+ }));
1029
+ export const UpdateTaskRequest = lazySchema(() => z.looseObject({
1030
+ name: z.string().optional(),
1031
+ options: TaskOptions().nullable().optional(),
1032
+ input: z.union([TaskInput(), z.array(TaskInput())]).nullable().optional(),
1033
+ title: z.string().nullable().optional(),
1034
+ actorStandby: ActorStandby().nullable().optional(),
1035
+ publicConfig: TaskPublicConfig().optional(),
1036
+ isPublic: z.boolean().optional(),
1037
+ }));
1038
+ export const Webhook = lazySchema(() => z.looseObject({
1039
+ id: z.string(),
1040
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1041
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1042
+ userId: z.string(),
1043
+ isAdHoc: z.boolean().nullable().optional(),
1044
+ shouldInterpolateStrings: z.boolean().nullable().optional(),
1045
+ eventTypes: z.array(WebhookEventType()),
1046
+ condition: WebhookCondition(),
1047
+ ignoreSslErrors: z.boolean(),
1048
+ doNotRetry: z.boolean().nullable().optional(),
1049
+ requestUrl: z.url({ normalize: true }).nullable().optional(),
1050
+ payloadTemplate: z.string().nullable().optional(),
1051
+ headersTemplate: z.string().nullable().optional(),
1052
+ description: z.string().nullable().optional(),
1053
+ lastDispatch: ExampleWebhookDispatch().nullable().optional(),
1054
+ stats: WebhookStats().nullable().optional(),
1055
+ }));
1056
+ export const UpdateRunRequest = lazySchema(() => z.looseObject({
1057
+ runId: z.string().optional(),
1058
+ statusMessage: z.string().optional(),
1059
+ isStatusMessageTerminal: z.boolean().optional(),
1060
+ generalAccess: GeneralAccess().optional(),
1061
+ }));
1062
+ export const ChargeRunRequest = lazySchema(() => z.looseObject({
1063
+ eventName: z.string(),
1064
+ count: z.int(),
1065
+ }));
1066
+ export const StorageOwnership = lazySchema(() => z.enum(["ownedByMe", "sharedWithMe"]).or(z.string()));
1067
+ export const ListOfKeyValueStores = lazySchema(() => PaginationResponse().extend({
1068
+ unnamed: z.boolean().optional(),
1069
+ items: z.array(KeyValueStore()),
1070
+ }));
1071
+ export const ListOfKeyValueStoresResponse = lazySchema(() => z.looseObject({
1072
+ data: ListOfKeyValueStores(),
1073
+ }));
1074
+ export const DatasetListItem = lazySchema(() => z.looseObject({
1075
+ id: z.string(),
1076
+ name: z.string(),
1077
+ userId: z.string(),
1078
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1079
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1080
+ accessedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1081
+ itemCount: z.int(),
1082
+ cleanItemCount: z.int(),
1083
+ actId: z.string().nullable().optional(),
1084
+ actRunId: z.string().nullable().optional(),
1085
+ title: z.string().nullable().optional(),
1086
+ username: z.string().optional(),
1087
+ generalAccess: GeneralAccess().nullable().optional(),
1088
+ stats: DatasetStats().optional(),
1089
+ }));
1090
+ export const ListOfDatasets = lazySchema(() => PaginationResponse().extend({
1091
+ unnamed: z.boolean().optional(),
1092
+ items: z.array(DatasetListItem()),
1093
+ }));
1094
+ export const ListOfDatasetsResponse = lazySchema(() => z.looseObject({
1095
+ data: ListOfDatasets(),
1096
+ }));
1097
+ /** A shortened request queue object for list responses. */
1098
+ export const RequestQueueShort = lazySchema(() => z.looseObject({
1099
+ id: QueueId(),
1100
+ name: z.string(),
1101
+ userId: QueueUserId(),
1102
+ username: z.string(),
1103
+ createdAt: QueueCreatedAt(),
1104
+ modifiedAt: QueueModifiedAt(),
1105
+ accessedAt: QueueAccessedAt(),
1106
+ expireAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1107
+ totalRequestCount: TotalRequestCount(),
1108
+ handledRequestCount: HandledRequestCount(),
1109
+ pendingRequestCount: PendingRequestCount(),
1110
+ actId: z.string().nullable().optional(),
1111
+ actRunId: z.string().nullable().optional(),
1112
+ hadMultipleClients: HadMultipleClients(),
1113
+ generalAccess: GeneralAccess().nullable().optional(),
1114
+ stats: RequestQueueStats().optional(),
1115
+ }));
1116
+ /** A paginated list of request queues. */
1117
+ export const ListOfRequestQueues = lazySchema(() => PaginationResponse().extend({
1118
+ unnamed: z.boolean().optional(),
1119
+ items: z.array(RequestQueueShort()),
1120
+ }));
1121
+ /** Response containing a list of request queues. */
1122
+ export const ListOfRequestQueuesResponse = lazySchema(() => z.looseObject({
1123
+ data: ListOfRequestQueues(),
1124
+ }));
1125
+ export const WebhookCreate = lazySchema(() => z.looseObject({
1126
+ isAdHoc: z.boolean().nullable().optional(),
1127
+ eventTypes: z.array(WebhookEventType()),
1128
+ condition: WebhookCondition(),
1129
+ idempotencyKey: z.string().nullable().optional(),
1130
+ ignoreSslErrors: z.boolean().nullable().optional(),
1131
+ doNotRetry: z.boolean().nullable().optional(),
1132
+ requestUrl: z.string(),
1133
+ payloadTemplate: z.string().nullable().optional(),
1134
+ headersTemplate: z.string().nullable().optional(),
1135
+ description: z.string().nullable().optional(),
1136
+ shouldInterpolateStrings: z.boolean().nullable().optional(),
1137
+ }));
1138
+ /** Response containing webhook data. */
1139
+ export const WebhookResponse = lazySchema(() => z.looseObject({
1140
+ data: Webhook(),
1141
+ }));
1142
+ export const WebhookUpdate = lazySchema(() => z.looseObject({
1143
+ isAdHoc: z.boolean().nullable().optional(),
1144
+ eventTypes: z.array(WebhookEventType()).nullable().optional(),
1145
+ condition: WebhookCondition().nullable().optional(),
1146
+ ignoreSslErrors: z.boolean().nullable().optional(),
1147
+ doNotRetry: z.boolean().nullable().optional(),
1148
+ requestUrl: z.url({ normalize: true }).nullable().optional(),
1149
+ payloadTemplate: z.string().nullable().optional(),
1150
+ headersTemplate: z.string().nullable().optional(),
1151
+ description: z.string().nullable().optional(),
1152
+ shouldInterpolateStrings: z.boolean().nullable().optional(),
1153
+ }));
1154
+ /** A summary of the webhook that triggered this dispatch. */
1155
+ export const WebhookDispatchWebhookSummary = lazySchema(() => z.looseObject({
1156
+ actionType: z.string().optional(),
1157
+ condition: WebhookCondition().optional(),
1158
+ requestUrl: z.url({ normalize: true }).nullable().optional(),
1159
+ isAdHoc: z.boolean().optional(),
1160
+ }));
1161
+ export const WebhookDispatch = lazySchema(() => z.looseObject({
1162
+ id: z.string(),
1163
+ userId: z.string(),
1164
+ webhookId: z.string(),
1165
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1166
+ status: WebhookDispatchStatus(),
1167
+ eventType: WebhookEventType(),
1168
+ eventData: z.looseObject({
1169
+ actorId: z.string(),
1170
+ actorRunId: z.string().optional(),
1171
+ actorBuildId: z.string().optional(),
1172
+ actorTaskId: z.string().nullable().optional(),
1173
+ }).nullable().optional(),
1174
+ webhook: WebhookDispatchWebhookSummary().nullable().optional(),
1175
+ calls: z.array(z.looseObject({
1176
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1177
+ finishedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1178
+ errorMessage: z.string().nullable().optional(),
1179
+ responseStatus: z.int().nullable().optional(),
1180
+ responseBody: z.string().nullable().optional(),
1181
+ })).optional(),
1182
+ }));
1183
+ export const TestWebhookResponse = lazySchema(() => z.looseObject({
1184
+ data: WebhookDispatch(),
1185
+ }));
1186
+ export const ListOfWebhookDispatches = lazySchema(() => PaginationResponse().extend({
1187
+ items: z.array(WebhookDispatch()),
1188
+ }));
1189
+ export const ListOfWebhookDispatchesResponse = lazySchema(() => z.looseObject({
1190
+ data: ListOfWebhookDispatches(),
1191
+ }));
1192
+ export const WebhookDispatchResponse = lazySchema(() => z.looseObject({
1193
+ data: WebhookDispatch(),
1194
+ }));
1195
+ export const ScheduleBase = lazySchema(() => z.looseObject({
1196
+ id: z.string(),
1197
+ userId: z.string(),
1198
+ name: z.string(),
1199
+ cronExpression: z.string(),
1200
+ timezone: z.string(),
1201
+ isEnabled: z.boolean(),
1202
+ isExclusive: z.boolean(),
1203
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1204
+ modifiedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1205
+ nextRunAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1206
+ lastRunAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1207
+ }));
1208
+ export const ScheduleActionShortRunActor = lazySchema(() => z.looseObject({
1209
+ id: z.string(),
1210
+ type: z.literal("RUN_ACTOR"),
1211
+ actorId: z.string(),
1212
+ }));
1213
+ export const ScheduleActionShortRunActorTask = lazySchema(() => z.looseObject({
1214
+ id: z.string(),
1215
+ type: z.literal("RUN_ACTOR_TASK"),
1216
+ actorTaskId: z.string(),
1217
+ }));
1218
+ export const ScheduleActionShort = lazySchema(() => z.discriminatedUnion("type", [ScheduleActionShortRunActor(), ScheduleActionShortRunActorTask()]));
1219
+ export const ScheduleShort = lazySchema(() => ScheduleBase().extend({
1220
+ actions: z.array(ScheduleActionShort()),
1221
+ }));
1222
+ export const ListOfSchedules = lazySchema(() => PaginationResponse().extend({
1223
+ items: z.array(ScheduleShort()),
1224
+ }));
1225
+ export const ListOfSchedulesResponse = lazySchema(() => z.looseObject({
1226
+ data: ListOfSchedules(),
1227
+ }));
1228
+ export const ScheduleActionRunInput = lazySchema(() => z.looseObject({
1229
+ body: z.string().nullable().optional(),
1230
+ contentType: z.string().nullable().optional(),
1231
+ }));
1232
+ export const ScheduleCreateActionRunActor = lazySchema(() => z.looseObject({
1233
+ type: z.literal("RUN_ACTOR"),
1234
+ actorId: z.string(),
1235
+ runInput: ScheduleActionRunInput().nullable().optional(),
1236
+ runOptions: TaskOptions().nullable().optional(),
1237
+ }));
1238
+ export const ScheduleCreateActionRunActorTask = lazySchema(() => z.looseObject({
1239
+ type: z.literal("RUN_ACTOR_TASK"),
1240
+ actorTaskId: z.string(),
1241
+ input: z.record(z.string(), z.unknown()).nullable().optional(),
1242
+ }));
1243
+ export const ScheduleCreateAction = lazySchema(() => z.discriminatedUnion("type", [ScheduleCreateActionRunActor(), ScheduleCreateActionRunActorTask()]));
1244
+ export const ScheduleCreate = lazySchema(() => z.looseObject({
1245
+ name: z.string().nullable().optional(),
1246
+ isEnabled: z.boolean().nullable().optional(),
1247
+ isExclusive: z.boolean().nullable().optional(),
1248
+ cronExpression: z.string().nullable().optional(),
1249
+ timezone: z.string().nullable().optional(),
1250
+ description: z.string().nullable().optional(),
1251
+ title: z.string().nullable().optional(),
1252
+ actions: z.array(ScheduleCreateAction()).nullable().optional(),
1253
+ }));
1254
+ export const ScheduleActionRunActor = lazySchema(() => z.looseObject({
1255
+ id: z.string(),
1256
+ type: z.literal("RUN_ACTOR"),
1257
+ actorId: z.string(),
1258
+ runInput: ScheduleActionRunInput().nullable().optional(),
1259
+ runOptions: TaskOptions().nullable().optional(),
1260
+ }));
1261
+ export const ScheduleActionRunActorTask = lazySchema(() => z.looseObject({
1262
+ id: z.string(),
1263
+ type: z.literal("RUN_ACTOR_TASK"),
1264
+ actorTaskId: z.string(),
1265
+ input: z.record(z.string(), z.unknown()).nullable().optional(),
1266
+ }));
1267
+ export const ScheduleAction = lazySchema(() => z.discriminatedUnion("type", [ScheduleActionRunActor(), ScheduleActionRunActorTask()]));
1268
+ export const Schedule = lazySchema(() => ScheduleBase().extend({
1269
+ description: z.string().nullable().optional(),
1270
+ title: z.string().nullable().optional(),
1271
+ notifications: z.looseObject({
1272
+ email: z.boolean().optional(),
1273
+ }).optional(),
1274
+ actions: z.array(ScheduleAction()),
1275
+ }));
1276
+ export const ScheduleResponse = lazySchema(() => z.looseObject({
1277
+ data: Schedule(),
1278
+ }));
1279
+ export const ScheduleInvoked = lazySchema(() => z.looseObject({
1280
+ message: z.string(),
1281
+ level: z.string(),
1282
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1283
+ }));
1284
+ export const ScheduleLogResponse = lazySchema(() => z.looseObject({
1285
+ data: z.array(ScheduleInvoked()),
1286
+ }));
1287
+ export const CurrentPricingInfo = lazySchema(() => z.looseObject({
1288
+ pricingModel: z.string(),
1289
+ apifyMarginPercentage: z.number().optional(),
1290
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1291
+ startedAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1292
+ notifiedAboutChangeAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1293
+ notifiedAboutFutureChangeAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable().optional(),
1294
+ isPriceChangeNotificationSuppressed: z.boolean().optional(),
1295
+ forceContainsSignificantPriceChange: z.boolean().optional(),
1296
+ isPPEPlatformUsagePaidByUser: z.boolean().optional(),
1297
+ reasonForChange: z.string().nullable().optional(),
1298
+ trialMinutes: z.int().nullable().optional(),
1299
+ unitName: z.string().nullable().optional(),
1300
+ pricePerUnitUsd: z.number().nullable().optional(),
1301
+ minimalMaxTotalChargeUsd: z.number().nullable().optional(),
1302
+ pricingPerEvent: z.record(z.string(), z.unknown()).nullable().optional(),
1303
+ }));
1304
+ export const StoreListActor = lazySchema(() => z.looseObject({
1305
+ id: z.string(),
1306
+ title: z.string(),
1307
+ name: z.string(),
1308
+ username: z.string(),
1309
+ userFullName: z.string().nullable().optional(),
1310
+ description: z.string().nullable().optional(),
1311
+ categories: z.array(z.string()).optional(),
1312
+ notice: ActorNotice().optional(),
1313
+ pictureUrl: z.string().nullable().optional(),
1314
+ userPictureUrl: z.url({ normalize: true }).nullable().optional(),
1315
+ url: z.url({ normalize: true }).nullable().optional(),
1316
+ stats: ActorStats(),
1317
+ currentPricingInfo: CurrentPricingInfo().optional(),
1318
+ isWhiteListedForAgenticPayments: z.boolean().nullable().optional(),
1319
+ actorReviewCount: z.int().optional(),
1320
+ actorReviewRating: z.number().optional(),
1321
+ bookmarkCount: z.int().optional(),
1322
+ badge: z.string().nullable().optional(),
1323
+ readmeSummary: z.string().optional(),
1324
+ }));
1325
+ export const ListOfStoreActors = lazySchema(() => PaginationResponse().extend({
1326
+ items: z.array(StoreListActor()),
1327
+ }));
1328
+ export const ListOfActorsInStoreResponse = lazySchema(() => z.looseObject({
1329
+ data: ListOfStoreActors(),
1330
+ }));
1331
+ export const Profile = lazySchema(() => z.looseObject({
1332
+ bio: z.string().nullable().optional(),
1333
+ name: z.string().optional(),
1334
+ pictureUrl: z.url({ normalize: true }).nullable().optional(),
1335
+ githubUsername: z.string().nullable().optional(),
1336
+ websiteUrl: z.url({ normalize: true }).nullable().optional(),
1337
+ twitterUsername: z.string().nullable().optional(),
1338
+ }));
1339
+ export const UserPublicInfo = lazySchema(() => z.looseObject({
1340
+ username: z.string(),
1341
+ profile: Profile().optional(),
1342
+ }));
1343
+ export const PublicUserDataResponse = lazySchema(() => z.looseObject({
1344
+ data: UserPublicInfo(),
1345
+ }));
1346
+ export const ProxyGroup = lazySchema(() => z.looseObject({
1347
+ name: z.string(),
1348
+ description: z.string().nullable(),
1349
+ availableCount: z.int(),
1350
+ }));
1351
+ export const Proxy = lazySchema(() => z.looseObject({
1352
+ password: z.string(),
1353
+ groups: z.array(ProxyGroup()),
1354
+ }));
1355
+ /**
1356
+ * A dictionary mapping proxy group names to the number of available proxies in each group.
1357
+ * The keys are proxy group names (e.g., "RESIDENTIAL", "DATACENTER") and values are
1358
+ * the count of available proxies.
1359
+ */
1360
+ export const AvailableProxyGroups = lazySchema(() => z.record(z.string(), z.int()));
1361
+ export const Plan = lazySchema(() => z.looseObject({
1362
+ id: z.string().optional(),
1363
+ description: z.string().optional(),
1364
+ isEnabled: z.boolean().optional(),
1365
+ monthlyBasePriceUsd: z.number().optional(),
1366
+ monthlyUsageCreditsUsd: z.number().optional(),
1367
+ usageDiscountPercent: z.number().optional(),
1368
+ enabledPlatformFeatures: z.array(z.string()).optional(),
1369
+ maxMonthlyUsageUsd: z.number().optional(),
1370
+ maxActorMemoryGbytes: z.number().optional(),
1371
+ maxMonthlyActorComputeUnits: z.number().optional(),
1372
+ maxMonthlyResidentialProxyGbytes: z.number().optional(),
1373
+ maxMonthlyProxySerps: z.int().optional(),
1374
+ maxMonthlyExternalDataTransferGbytes: z.number().optional(),
1375
+ maxActorCount: z.int().optional(),
1376
+ maxActorTaskCount: z.int().optional(),
1377
+ dataRetentionDays: z.int().optional(),
1378
+ availableProxyGroups: AvailableProxyGroups(),
1379
+ teamAccountSeatCount: z.int().optional(),
1380
+ supportLevel: z.string().optional(),
1381
+ availableAddOns: z.array(z.string()).optional(),
1382
+ tier: z.string().optional(),
1383
+ apiRateLimitBoosts: z.int().optional(),
1384
+ maxScheduleCount: z.int().optional(),
1385
+ maxConcurrentActorRuns: z.int().optional(),
1386
+ planPricing: z.record(z.string(), z.unknown()).optional(),
1387
+ }));
1388
+ export const EffectivePlatformFeature = lazySchema(() => z.looseObject({
1389
+ isEnabled: z.boolean(),
1390
+ disabledReason: z.string().nullable(),
1391
+ disabledReasonType: z.string().nullable(),
1392
+ isTrial: z.boolean(),
1393
+ trialExpirationAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).nullable(),
1394
+ }));
1395
+ export const EffectivePlatformFeatures = lazySchema(() => z.looseObject({
1396
+ ACTORS: EffectivePlatformFeature(),
1397
+ STORAGE: EffectivePlatformFeature(),
1398
+ SCHEDULER: EffectivePlatformFeature(),
1399
+ PROXY: EffectivePlatformFeature(),
1400
+ PROXY_EXTERNAL_ACCESS: EffectivePlatformFeature(),
1401
+ PROXY_RESIDENTIAL: EffectivePlatformFeature(),
1402
+ PROXY_SERPS: EffectivePlatformFeature(),
1403
+ WEBHOOKS: EffectivePlatformFeature(),
1404
+ ACTORS_PUBLIC_ALL: EffectivePlatformFeature(),
1405
+ ACTORS_PUBLIC_DEVELOPER: EffectivePlatformFeature(),
1406
+ }));
1407
+ export const UserPrivateInfo = lazySchema(() => z.looseObject({
1408
+ id: z.string().optional(),
1409
+ username: z.string(),
1410
+ profile: Profile().optional(),
1411
+ email: z.string().optional(),
1412
+ proxy: Proxy().optional(),
1413
+ plan: Plan().optional(),
1414
+ effectivePlatformFeatures: EffectivePlatformFeatures().optional(),
1415
+ createdAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()).optional(),
1416
+ isPaying: z.boolean().optional(),
1417
+ }));
1418
+ export const PrivateUserDataResponse = lazySchema(() => z.looseObject({
1419
+ data: UserPrivateInfo(),
1420
+ }));
1421
+ export const UsageCycle = lazySchema(() => z.looseObject({
1422
+ startAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1423
+ endAt: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1424
+ }));
1425
+ export const PriceTiers = lazySchema(() => z.looseObject({
1426
+ quantityAbove: z.number(),
1427
+ discountPercent: z.number(),
1428
+ tierQuantity: z.number(),
1429
+ unitPriceUsd: z.number(),
1430
+ priceUsd: z.number(),
1431
+ }));
1432
+ export const UsageItem = lazySchema(() => z.looseObject({
1433
+ quantity: z.number(),
1434
+ baseAmountUsd: z.number(),
1435
+ baseUnitPriceUsd: z.number().optional(),
1436
+ amountAfterVolumeDiscountUsd: z.number().optional(),
1437
+ priceTiers: z.array(PriceTiers()).optional(),
1438
+ }));
1439
+ /** A map of usage item names (e.g., ACTOR_COMPUTE_UNITS) to their usage details. */
1440
+ export const MonthlyServiceUsage = lazySchema(() => z.record(z.string(), UsageItem()));
1441
+ /** A map of service usage item names to their usage details. */
1442
+ export const ServiceUsage = lazySchema(() => z.record(z.string(), UsageItem()));
1443
+ export const DailyServiceUsages = lazySchema(() => z.looseObject({
1444
+ date: z.iso.datetime({ offset: true }).pipe(z.coerce.date()),
1445
+ serviceUsage: ServiceUsage(),
1446
+ totalUsageCreditsUsd: z.number(),
1447
+ }));
1448
+ export const MonthlyUsage = lazySchema(() => z.looseObject({
1449
+ usageCycle: UsageCycle(),
1450
+ monthlyServiceUsage: MonthlyServiceUsage(),
1451
+ dailyServiceUsages: z.array(DailyServiceUsages()),
1452
+ totalUsageCreditsUsdBeforeVolumeDiscount: z.number(),
1453
+ totalUsageCreditsUsdAfterVolumeDiscount: z.number(),
1454
+ }));
1455
+ export const MonthlyUsageResponse = lazySchema(() => z.looseObject({
1456
+ data: MonthlyUsage(),
1457
+ }));
1458
+ export const Limits = lazySchema(() => z.looseObject({
1459
+ maxMonthlyUsageUsd: z.number(),
1460
+ maxMonthlyActorComputeUnits: z.number(),
1461
+ maxMonthlyExternalDataTransferGbytes: z.number(),
1462
+ maxMonthlyProxySerps: z.int(),
1463
+ maxMonthlyResidentialProxyGbytes: z.number(),
1464
+ maxActorMemoryGbytes: z.number(),
1465
+ maxActorCount: z.int(),
1466
+ maxActorTaskCount: z.int(),
1467
+ maxConcurrentActorJobs: z.int(),
1468
+ maxTeamAccountSeatCount: z.int(),
1469
+ dataRetentionDays: z.int(),
1470
+ maxScheduleCount: z.int().optional(),
1471
+ }));
1472
+ export const Current = lazySchema(() => z.looseObject({
1473
+ monthlyUsageUsd: z.number(),
1474
+ monthlyActorComputeUnits: z.number(),
1475
+ monthlyExternalDataTransferGbytes: z.number(),
1476
+ monthlyProxySerps: z.int(),
1477
+ monthlyResidentialProxyGbytes: z.number(),
1478
+ actorMemoryGbytes: z.number(),
1479
+ actorCount: z.int(),
1480
+ actorTaskCount: z.int(),
1481
+ activeActorJobCount: z.int(),
1482
+ teamAccountSeatCount: z.int(),
1483
+ scheduleCount: z.int().optional(),
1484
+ }));
1485
+ export const AccountLimits = lazySchema(() => z.looseObject({
1486
+ monthlyUsageCycle: UsageCycle(),
1487
+ limits: Limits(),
1488
+ current: Current(),
1489
+ }));
1490
+ export const LimitsResponse = lazySchema(() => z.looseObject({
1491
+ data: AccountLimits(),
1492
+ }));
1493
+ export const UpdateLimitsRequest = lazySchema(() => z.looseObject({
1494
+ maxMonthlyUsageUsd: z.number().optional(),
1495
+ dataRetentionDays: z.int().optional(),
1496
+ }));
1497
+ export const BrowserInfoResponse = lazySchema(() => z.looseObject({
1498
+ method: z.string(),
1499
+ clientIp: z.string().nullable(),
1500
+ countryCode: z.string().nullable(),
1501
+ bodyLength: z.int(),
1502
+ headers: z.record(z.string(), z.union([z.string(), z.array(z.string())])).optional(),
1503
+ rawHeaders: z.array(z.string()).optional(),
1504
+ }));
1505
+ export const EncodeAndSignData = lazySchema(() => z.looseObject({
1506
+ encoded: z.string(),
1507
+ }));
1508
+ export const EncodeAndSignResponse = lazySchema(() => z.looseObject({
1509
+ data: EncodeAndSignData(),
1510
+ }));
1511
+ export const DecodeAndVerifyRequest = lazySchema(() => z.looseObject({
1512
+ encoded: z.string(),
1513
+ }));
1514
+ export const DecodeAndVerifyData = lazySchema(() => z.looseObject({
1515
+ decoded: z.unknown(),
1516
+ encodedByUserId: z.string().nullable(),
1517
+ isVerifiedUser: z.boolean(),
1518
+ }));
1519
+ export const DecodeAndVerifyResponse = lazySchema(() => z.looseObject({
1520
+ data: DecodeAndVerifyData(),
1521
+ }));