apify-client 3.0.0-rc.0 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/apify_api_error.d.ts +4 -3
- package/dist/apify_api_error.js +2 -1
- package/dist/apify_client.d.ts +8 -8
- package/dist/apify_client.js +10 -10
- package/dist/apify_client_error.d.ts +10 -0
- package/dist/apify_client_error.js +10 -0
- package/dist/axios.d.ts +2 -0
- package/dist/axios.js +1 -0
- package/dist/base/api_client.js +8 -20
- package/dist/base/resource_client.js +8 -8
- package/dist/body_parser.d.ts +1 -1
- package/dist/bundle.js +31 -30
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +2427 -725
- package/dist/generated/schemas.d.ts +1868 -274
- package/dist/generated/schemas.js +437 -79
- package/dist/http_clients/axios.d.ts +35 -15
- package/dist/http_clients/axios.js +80 -32
- package/dist/http_clients/base.d.ts +105 -34
- package/dist/http_clients/base.js +169 -52
- package/dist/http_clients/fetch.d.ts +53 -0
- package/dist/http_clients/fetch.js +219 -0
- package/dist/http_clients/index.d.ts +2 -2
- package/dist/http_clients/index.js +1 -1
- package/dist/http_compressors/index.d.ts +2 -0
- package/dist/http_compressors/index.js +1 -0
- package/dist/http_compressors/resolve.d.ts +4 -3
- package/dist/http_compressors/resolve.js +4 -1
- package/dist/http_compressors/zstd.d.ts +34 -0
- package/dist/http_compressors/zstd.js +43 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/invalid_response_body_error.d.ts +5 -4
- package/dist/invalid_response_body_error.js +5 -4
- package/dist/models.d.ts +30 -61
- package/dist/resource_clients/actor.d.ts +33 -2
- package/dist/resource_clients/actor.js +46 -3
- package/dist/resource_clients/actor_server.d.ts +149 -0
- package/dist/resource_clients/actor_server.js +195 -0
- package/dist/resource_clients/actor_version.d.ts +7 -1
- package/dist/resource_clients/actor_version.js +3 -2
- package/dist/resource_clients/actor_version_collection.d.ts +2 -1
- package/dist/resource_clients/actor_version_collection.js +3 -2
- package/dist/resource_clients/dataset.d.ts +33 -5
- package/dist/resource_clients/dataset.js +12 -54
- package/dist/resource_clients/key_value_store.d.ts +63 -22
- package/dist/resource_clients/key_value_store.js +62 -19
- package/dist/resource_clients/log.d.ts +32 -7
- package/dist/resource_clients/log.js +11 -14
- package/dist/resource_clients/request_queue.d.ts +9 -0
- package/dist/resource_clients/request_queue.js +9 -6
- package/dist/resource_clients/run.d.ts +15 -2
- package/dist/resource_clients/run.js +12 -5
- package/dist/resource_clients/store_collection.d.ts +4 -0
- package/dist/resource_clients/task.js +3 -3
- package/dist/response_validation_error.d.ts +2 -1
- package/dist/response_validation_error.js +2 -1
- package/dist/runtime/node.js +79 -17
- package/dist/runtime/types.d.ts +35 -5
- package/dist/runtime/web.js +43 -1
- package/dist/schemas.d.ts +369 -3
- package/dist/schemas.js +25 -3
- package/dist/utils.d.ts +52 -27
- package/dist/utils.js +45 -25
- package/package.json +42 -30
package/dist/schemas.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The schemas the resource clients validate API responses with.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Most of these are the generated ones. This module is the one place where a generated schema is widened
|
|
5
|
+
* when the API is known to return something the specification does not describe, so a documented deviation
|
|
6
|
+
* never sends a resource client reaching into `./generated` directly. An override
|
|
7
7
|
* declared here shadows the generated export of the same name and takes the same form, a `lazySchema()` thunk
|
|
8
8
|
* built on the generated schema it replaces. Every schema that embeds an overridden one has to be rebuilt on
|
|
9
9
|
* top of it, and `spec_guards.ts` checks that each override still produces what the specification describes,
|
|
@@ -12,4 +12,370 @@
|
|
|
12
12
|
* Spec gaps need no override: the generated objects are loose, so a field the specification omits passes
|
|
13
13
|
* through. Neither do client narrowings: a schema only ever accepts more than the published type.
|
|
14
14
|
*/
|
|
15
|
+
import { z } from 'zod';
|
|
15
16
|
export * from './generated/schemas.js';
|
|
17
|
+
/** The API returns `actVersion.buildTag` as `null` for some builds, which the specification types as a string. */
|
|
18
|
+
export declare const Build: () => z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
actId: z.ZodString;
|
|
21
|
+
userId: z.ZodString;
|
|
22
|
+
startedAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
|
|
23
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
|
|
24
|
+
status: z.ZodUnion<[z.ZodEnum<{
|
|
25
|
+
ABORTED: "ABORTED";
|
|
26
|
+
ABORTING: "ABORTING";
|
|
27
|
+
FAILED: "FAILED";
|
|
28
|
+
READY: "READY";
|
|
29
|
+
RUNNING: "RUNNING";
|
|
30
|
+
SUCCEEDED: "SUCCEEDED";
|
|
31
|
+
"TIMED-OUT": "TIMED-OUT";
|
|
32
|
+
"TIMING-OUT": "TIMING-OUT";
|
|
33
|
+
}>, z.ZodString]>;
|
|
34
|
+
meta: z.ZodObject<{
|
|
35
|
+
origin: z.ZodUnion<[z.ZodEnum<{
|
|
36
|
+
ACTOR: "ACTOR";
|
|
37
|
+
API: "API";
|
|
38
|
+
CI: "CI";
|
|
39
|
+
CLI: "CLI";
|
|
40
|
+
DEVELOPMENT: "DEVELOPMENT";
|
|
41
|
+
MCP: "MCP";
|
|
42
|
+
SCHEDULER: "SCHEDULER";
|
|
43
|
+
STANDBY: "STANDBY";
|
|
44
|
+
TEST: "TEST";
|
|
45
|
+
WEB: "WEB";
|
|
46
|
+
WEBHOOK: "WEBHOOK";
|
|
47
|
+
}>, z.ZodString]>;
|
|
48
|
+
clientIp: z.ZodOptional<z.ZodString>;
|
|
49
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
50
|
+
githubActionsRunUrl: z.ZodOptional<z.ZodString>;
|
|
51
|
+
actorRunId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
webhookDispatchId: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$loose>;
|
|
54
|
+
stats: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
55
|
+
durationMillis: z.ZodOptional<z.ZodInt>;
|
|
56
|
+
runTimeSecs: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
computeUnits: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
imageSizeBytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
59
|
+
}, z.core.$loose>>>;
|
|
60
|
+
options: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
61
|
+
useCache: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
62
|
+
betaPackages: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
63
|
+
memoryMbytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
64
|
+
diskMbytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
65
|
+
tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
debug: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
67
|
+
}, z.core.$loose>>>;
|
|
68
|
+
usage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
69
|
+
ACTOR_COMPUTE_UNITS: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
70
|
+
}, z.core.$loose>>>;
|
|
71
|
+
usageTotalUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
72
|
+
usageUsd: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
73
|
+
ACTOR_COMPUTE_UNITS: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
74
|
+
}, z.core.$loose>>>;
|
|
75
|
+
inputSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
readme: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
changelog: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
exitCode: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
79
|
+
gitCommitId: z.ZodOptional<z.ZodString>;
|
|
80
|
+
gitBranchName: z.ZodOptional<z.ZodString>;
|
|
81
|
+
createdByOrganizationMemberUserId: z.ZodOptional<z.ZodString>;
|
|
82
|
+
buildNumber: z.ZodString;
|
|
83
|
+
imageDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
actorDefinition: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
85
|
+
actorSpecification: z.ZodOptional<z.ZodLiteral<1>>;
|
|
86
|
+
name: z.ZodOptional<z.ZodString>;
|
|
87
|
+
title: z.ZodOptional<z.ZodString>;
|
|
88
|
+
description: z.ZodOptional<z.ZodString>;
|
|
89
|
+
version: z.ZodOptional<z.ZodString>;
|
|
90
|
+
buildTag: z.ZodOptional<z.ZodString>;
|
|
91
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
93
|
+
generatedBy: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$loose>>;
|
|
95
|
+
environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
96
|
+
dockerfile: z.ZodOptional<z.ZodString>;
|
|
97
|
+
dockerContextDir: z.ZodOptional<z.ZodString>;
|
|
98
|
+
readme: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
input: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
100
|
+
output: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
101
|
+
changelog: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
storages: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
dataset: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
104
|
+
datasets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
105
|
+
keyValueStore: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
106
|
+
}, z.core.$loose>>;
|
|
107
|
+
defaultMemoryMbytes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
108
|
+
minMemoryMbytes: z.ZodOptional<z.ZodInt>;
|
|
109
|
+
maxMemoryMbytes: z.ZodOptional<z.ZodInt>;
|
|
110
|
+
usesStandbyMode: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
+
webServerSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
|
+
webServerMcpPath: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$loose>>>;
|
|
114
|
+
actVersion: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
sourceType: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
|
|
116
|
+
GITHUB_GIST: "GITHUB_GIST";
|
|
117
|
+
GIT_REPO: "GIT_REPO";
|
|
118
|
+
SOURCE_CODE: "SOURCE_CODE";
|
|
119
|
+
SOURCE_FILES: "SOURCE_FILES";
|
|
120
|
+
TARBALL: "TARBALL";
|
|
121
|
+
}>, z.ZodString]>>;
|
|
122
|
+
versionNumber: z.ZodOptional<z.ZodString>;
|
|
123
|
+
gitRepoUrl: z.ZodOptional<z.ZodString>;
|
|
124
|
+
sourceFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
125
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
|
|
126
|
+
BASE64: "BASE64";
|
|
127
|
+
TEXT: "TEXT";
|
|
128
|
+
}>, z.ZodString]>>;
|
|
129
|
+
content: z.ZodOptional<z.ZodString>;
|
|
130
|
+
name: z.ZodString;
|
|
131
|
+
}, z.core.$loose>>>;
|
|
132
|
+
gitHubGistUrl: z.ZodOptional<z.ZodString>;
|
|
133
|
+
tarballUrl: z.ZodOptional<z.ZodString>;
|
|
134
|
+
actorPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
135
|
+
buildTag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
}, z.core.$loose>>;
|
|
137
|
+
}, z.core.$loose>;
|
|
138
|
+
/** Response containing Actor build data. */
|
|
139
|
+
export declare const BuildResponse: () => z.ZodObject<{
|
|
140
|
+
data: z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
actId: z.ZodString;
|
|
143
|
+
userId: z.ZodString;
|
|
144
|
+
startedAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
|
|
145
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
|
|
146
|
+
status: z.ZodUnion<[z.ZodEnum<{
|
|
147
|
+
ABORTED: "ABORTED";
|
|
148
|
+
ABORTING: "ABORTING";
|
|
149
|
+
FAILED: "FAILED";
|
|
150
|
+
READY: "READY";
|
|
151
|
+
RUNNING: "RUNNING";
|
|
152
|
+
SUCCEEDED: "SUCCEEDED";
|
|
153
|
+
"TIMED-OUT": "TIMED-OUT";
|
|
154
|
+
"TIMING-OUT": "TIMING-OUT";
|
|
155
|
+
}>, z.ZodString]>;
|
|
156
|
+
meta: z.ZodObject<{
|
|
157
|
+
origin: z.ZodUnion<[z.ZodEnum<{
|
|
158
|
+
ACTOR: "ACTOR";
|
|
159
|
+
API: "API";
|
|
160
|
+
CI: "CI";
|
|
161
|
+
CLI: "CLI";
|
|
162
|
+
DEVELOPMENT: "DEVELOPMENT";
|
|
163
|
+
MCP: "MCP";
|
|
164
|
+
SCHEDULER: "SCHEDULER";
|
|
165
|
+
STANDBY: "STANDBY";
|
|
166
|
+
TEST: "TEST";
|
|
167
|
+
WEB: "WEB";
|
|
168
|
+
WEBHOOK: "WEBHOOK";
|
|
169
|
+
}>, z.ZodString]>;
|
|
170
|
+
clientIp: z.ZodOptional<z.ZodString>;
|
|
171
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
172
|
+
githubActionsRunUrl: z.ZodOptional<z.ZodString>;
|
|
173
|
+
actorRunId: z.ZodOptional<z.ZodString>;
|
|
174
|
+
webhookDispatchId: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.core.$loose>;
|
|
176
|
+
stats: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
177
|
+
durationMillis: z.ZodOptional<z.ZodInt>;
|
|
178
|
+
runTimeSecs: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
computeUnits: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
imageSizeBytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
181
|
+
}, z.core.$loose>>>;
|
|
182
|
+
options: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
183
|
+
useCache: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
184
|
+
betaPackages: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
185
|
+
memoryMbytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
186
|
+
diskMbytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
187
|
+
tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
188
|
+
debug: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
189
|
+
}, z.core.$loose>>>;
|
|
190
|
+
usage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
191
|
+
ACTOR_COMPUTE_UNITS: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
192
|
+
}, z.core.$loose>>>;
|
|
193
|
+
usageTotalUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
194
|
+
usageUsd: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
195
|
+
ACTOR_COMPUTE_UNITS: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
196
|
+
}, z.core.$loose>>>;
|
|
197
|
+
inputSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
|
+
readme: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
199
|
+
changelog: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
|
+
exitCode: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
201
|
+
gitCommitId: z.ZodOptional<z.ZodString>;
|
|
202
|
+
gitBranchName: z.ZodOptional<z.ZodString>;
|
|
203
|
+
createdByOrganizationMemberUserId: z.ZodOptional<z.ZodString>;
|
|
204
|
+
buildNumber: z.ZodString;
|
|
205
|
+
imageDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
206
|
+
actorDefinition: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
207
|
+
actorSpecification: z.ZodOptional<z.ZodLiteral<1>>;
|
|
208
|
+
name: z.ZodOptional<z.ZodString>;
|
|
209
|
+
title: z.ZodOptional<z.ZodString>;
|
|
210
|
+
description: z.ZodOptional<z.ZodString>;
|
|
211
|
+
version: z.ZodOptional<z.ZodString>;
|
|
212
|
+
buildTag: z.ZodOptional<z.ZodString>;
|
|
213
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
214
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
215
|
+
generatedBy: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.core.$loose>>;
|
|
217
|
+
environmentVariables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
218
|
+
dockerfile: z.ZodOptional<z.ZodString>;
|
|
219
|
+
dockerContextDir: z.ZodOptional<z.ZodString>;
|
|
220
|
+
readme: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
input: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
222
|
+
output: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
223
|
+
changelog: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
224
|
+
storages: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
dataset: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
226
|
+
datasets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
227
|
+
keyValueStore: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
228
|
+
}, z.core.$loose>>;
|
|
229
|
+
defaultMemoryMbytes: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
230
|
+
minMemoryMbytes: z.ZodOptional<z.ZodInt>;
|
|
231
|
+
maxMemoryMbytes: z.ZodOptional<z.ZodInt>;
|
|
232
|
+
usesStandbyMode: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
webServerSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
234
|
+
webServerMcpPath: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, z.core.$loose>>>;
|
|
236
|
+
actVersion: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
sourceType: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
|
|
238
|
+
GITHUB_GIST: "GITHUB_GIST";
|
|
239
|
+
GIT_REPO: "GIT_REPO";
|
|
240
|
+
SOURCE_CODE: "SOURCE_CODE";
|
|
241
|
+
SOURCE_FILES: "SOURCE_FILES";
|
|
242
|
+
TARBALL: "TARBALL";
|
|
243
|
+
}>, z.ZodString]>>;
|
|
244
|
+
versionNumber: z.ZodOptional<z.ZodString>;
|
|
245
|
+
gitRepoUrl: z.ZodOptional<z.ZodString>;
|
|
246
|
+
sourceFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
247
|
+
format: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
|
|
248
|
+
BASE64: "BASE64";
|
|
249
|
+
TEXT: "TEXT";
|
|
250
|
+
}>, z.ZodString]>>;
|
|
251
|
+
content: z.ZodOptional<z.ZodString>;
|
|
252
|
+
name: z.ZodString;
|
|
253
|
+
}, z.core.$loose>>>;
|
|
254
|
+
gitHubGistUrl: z.ZodOptional<z.ZodString>;
|
|
255
|
+
tarballUrl: z.ZodOptional<z.ZodString>;
|
|
256
|
+
actorPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
257
|
+
buildTag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
258
|
+
}, z.core.$loose>>;
|
|
259
|
+
}, z.core.$loose>;
|
|
260
|
+
}, z.core.$loose>;
|
|
261
|
+
/**
|
|
262
|
+
* The API returns `uiState` as `null` once an API update has changed the schedule's `cronExpression` or `timezone`,
|
|
263
|
+
* which the specification types as an object.
|
|
264
|
+
*/
|
|
265
|
+
export declare const Schedule: () => z.ZodObject<{
|
|
266
|
+
id: z.ZodString;
|
|
267
|
+
userId: z.ZodString;
|
|
268
|
+
name: z.ZodString;
|
|
269
|
+
cronExpression: z.ZodString;
|
|
270
|
+
timezone: z.ZodString;
|
|
271
|
+
isEnabled: z.ZodBoolean;
|
|
272
|
+
isExclusive: z.ZodBoolean;
|
|
273
|
+
createdAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
|
|
274
|
+
modifiedAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
|
|
275
|
+
nextRunAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
|
|
276
|
+
lastRunAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
|
|
277
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
278
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
279
|
+
notifications: z.ZodOptional<z.ZodObject<{
|
|
280
|
+
email: z.ZodOptional<z.ZodBoolean>;
|
|
281
|
+
}, z.core.$loose>>;
|
|
282
|
+
integrationTracking: z.ZodOptional<z.ZodObject<{
|
|
283
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
284
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
285
|
+
isAiTool: z.ZodOptional<z.ZodBoolean>;
|
|
286
|
+
}, z.core.$loose>>;
|
|
287
|
+
actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
288
|
+
id: z.ZodString;
|
|
289
|
+
type: z.ZodLiteral<"RUN_ACTOR">;
|
|
290
|
+
actorId: z.ZodString;
|
|
291
|
+
runInput: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
292
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
293
|
+
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
294
|
+
}, z.core.$loose>>>;
|
|
295
|
+
runOptions: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
296
|
+
build: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
297
|
+
timeoutSecs: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
298
|
+
memoryMbytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
299
|
+
maxItems: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
300
|
+
maxTotalChargeUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
301
|
+
restartOnError: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
302
|
+
isMaxTotalChargeUsdSetByUser: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
303
|
+
forcePermissionLevel: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<{
|
|
304
|
+
FULL_PERMISSIONS: "FULL_PERMISSIONS";
|
|
305
|
+
LIMITED_PERMISSIONS: "LIMITED_PERMISSIONS";
|
|
306
|
+
}>, z.ZodString]>>>;
|
|
307
|
+
}, z.core.$loose>>>;
|
|
308
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
309
|
+
id: z.ZodString;
|
|
310
|
+
type: z.ZodLiteral<"RUN_ACTOR_TASK">;
|
|
311
|
+
actorTaskId: z.ZodString;
|
|
312
|
+
input: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
313
|
+
}, z.core.$loose>], "type">>;
|
|
314
|
+
uiState: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodObject<{
|
|
315
|
+
version: z.ZodOptional<z.ZodInt>;
|
|
316
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
317
|
+
cronExpression: z.ZodOptional<z.ZodString>;
|
|
318
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
319
|
+
}, z.core.$loose>>;
|
|
320
|
+
}, z.core.$loose>>>>;
|
|
321
|
+
}, z.core.$loose>;
|
|
322
|
+
/** Response containing schedule data. */
|
|
323
|
+
export declare const ScheduleResponse: () => z.ZodObject<{
|
|
324
|
+
data: z.ZodObject<{
|
|
325
|
+
id: z.ZodString;
|
|
326
|
+
userId: z.ZodString;
|
|
327
|
+
name: z.ZodString;
|
|
328
|
+
cronExpression: z.ZodString;
|
|
329
|
+
timezone: z.ZodString;
|
|
330
|
+
isEnabled: z.ZodBoolean;
|
|
331
|
+
isExclusive: z.ZodBoolean;
|
|
332
|
+
createdAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
|
|
333
|
+
modifiedAt: z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>;
|
|
334
|
+
nextRunAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
|
|
335
|
+
lastRunAt: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
|
|
336
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
337
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
338
|
+
notifications: z.ZodOptional<z.ZodObject<{
|
|
339
|
+
email: z.ZodOptional<z.ZodBoolean>;
|
|
340
|
+
}, z.core.$loose>>;
|
|
341
|
+
integrationTracking: z.ZodOptional<z.ZodObject<{
|
|
342
|
+
platform: z.ZodOptional<z.ZodString>;
|
|
343
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
344
|
+
isAiTool: z.ZodOptional<z.ZodBoolean>;
|
|
345
|
+
}, z.core.$loose>>;
|
|
346
|
+
actions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
347
|
+
id: z.ZodString;
|
|
348
|
+
type: z.ZodLiteral<"RUN_ACTOR">;
|
|
349
|
+
actorId: z.ZodString;
|
|
350
|
+
runInput: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
351
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
352
|
+
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
353
|
+
}, z.core.$loose>>>;
|
|
354
|
+
runOptions: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
355
|
+
build: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
356
|
+
timeoutSecs: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
357
|
+
memoryMbytes: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
358
|
+
maxItems: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
359
|
+
maxTotalChargeUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
360
|
+
restartOnError: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
361
|
+
isMaxTotalChargeUsdSetByUser: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
362
|
+
forcePermissionLevel: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodEnum<{
|
|
363
|
+
FULL_PERMISSIONS: "FULL_PERMISSIONS";
|
|
364
|
+
LIMITED_PERMISSIONS: "LIMITED_PERMISSIONS";
|
|
365
|
+
}>, z.ZodString]>>>;
|
|
366
|
+
}, z.core.$loose>>>;
|
|
367
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
368
|
+
id: z.ZodString;
|
|
369
|
+
type: z.ZodLiteral<"RUN_ACTOR_TASK">;
|
|
370
|
+
actorTaskId: z.ZodString;
|
|
371
|
+
input: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
372
|
+
}, z.core.$loose>], "type">>;
|
|
373
|
+
uiState: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodObject<{
|
|
374
|
+
version: z.ZodOptional<z.ZodInt>;
|
|
375
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
376
|
+
cronExpression: z.ZodOptional<z.ZodString>;
|
|
377
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
378
|
+
}, z.core.$loose>>;
|
|
379
|
+
}, z.core.$loose>>>>;
|
|
380
|
+
}, z.core.$loose>;
|
|
381
|
+
}, z.core.$loose>;
|
package/dist/schemas.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The schemas the resource clients validate API responses with.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Most of these are the generated ones. This module is the one place where a generated schema is widened
|
|
5
|
+
* when the API is known to return something the specification does not describe, so a documented deviation
|
|
6
|
+
* never sends a resource client reaching into `./generated` directly. An override
|
|
7
7
|
* declared here shadows the generated export of the same name and takes the same form, a `lazySchema()` thunk
|
|
8
8
|
* built on the generated schema it replaces. Every schema that embeds an overridden one has to be rebuilt on
|
|
9
9
|
* top of it, and `spec_guards.ts` checks that each override still produces what the specification describes,
|
|
@@ -12,4 +12,26 @@
|
|
|
12
12
|
* Spec gaps need no override: the generated objects are loose, so a field the specification omits passes
|
|
13
13
|
* through. Neither do client narrowings: a schema only ever accepts more than the published type.
|
|
14
14
|
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import * as generated from './generated/schemas.js';
|
|
17
|
+
import { lazySchema } from './lazy_schema.js';
|
|
15
18
|
export * from './generated/schemas.js';
|
|
19
|
+
/** The API returns `actVersion.buildTag` as `null` for some builds, which the specification types as a string. */
|
|
20
|
+
export const Build = lazySchema(() => {
|
|
21
|
+
const generatedBuild = generated.Build();
|
|
22
|
+
return generatedBuild.extend({
|
|
23
|
+
actVersion: generatedBuild.shape.actVersion
|
|
24
|
+
.unwrap()
|
|
25
|
+
.extend({ buildTag: z.string().nullable().optional() })
|
|
26
|
+
.optional(),
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
/** Response containing Actor build data. */
|
|
30
|
+
export const BuildResponse = lazySchema(() => generated.BuildResponse().extend({ data: Build() }));
|
|
31
|
+
/**
|
|
32
|
+
* The API returns `uiState` as `null` once an API update has changed the schedule's `cronExpression` or `timezone`,
|
|
33
|
+
* which the specification types as an object.
|
|
34
|
+
*/
|
|
35
|
+
export const Schedule = lazySchema(() => generated.Schedule().extend({ uiState: generated.ScheduleUiState().nullable().optional() }));
|
|
36
|
+
/** Response containing schedule data. */
|
|
37
|
+
export const ScheduleResponse = lazySchema(() => generated.ScheduleResponse().extend({ data: Schedule() }));
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Readable } from 'node:stream';
|
|
2
|
-
import type { TypedArray } from 'type-fest';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import type { ApifyApiError } from './apify_api_error.js';
|
|
5
4
|
import { parseArgument } from '@apify/validations';
|
|
@@ -27,14 +26,6 @@ export declare function isNonArrayObject(value: unknown): value is Record<string
|
|
|
27
26
|
* @internal
|
|
28
27
|
*/
|
|
29
28
|
export declare const anyObjectSchema: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
30
|
-
/**
|
|
31
|
-
* Generic interface for objects that may contain a data property.
|
|
32
|
-
*
|
|
33
|
-
* @template R - The type of the data property
|
|
34
|
-
*/
|
|
35
|
-
export interface MaybeData<R> {
|
|
36
|
-
data?: R;
|
|
37
|
-
}
|
|
38
29
|
/**
|
|
39
30
|
* Turns a JSON API response into the value a resource method returns: unwraps the `data` envelope and validates the
|
|
40
31
|
* result against `schema`, one of the schemas generated from the OpenAPI specification. The validated copy is what
|
|
@@ -46,11 +37,6 @@ export interface MaybeData<R> {
|
|
|
46
37
|
* @internal
|
|
47
38
|
*/
|
|
48
39
|
export declare function parseResponse<R>(response: ApifyResponse, schema: z.ZodType): R;
|
|
49
|
-
/**
|
|
50
|
-
* Returns object's 'data' property or throws if parameter is not an object,
|
|
51
|
-
* or an object without a 'data' property.
|
|
52
|
-
*/
|
|
53
|
-
export declare function pluckData<R>(obj: MaybeData<R>): R;
|
|
54
40
|
/**
|
|
55
41
|
* Swallows a 404 Not Found API error and rethrows anything else.
|
|
56
42
|
*/
|
|
@@ -86,8 +72,8 @@ export declare function toBytes(value: unknown): Uint8Array | undefined;
|
|
|
86
72
|
/**
|
|
87
73
|
* Decides whether a request body with the given content type is worth compressing.
|
|
88
74
|
*
|
|
89
|
-
* Images, audio, video and archives already carry their own compression. Running them through brotli or
|
|
90
|
-
* burns CPU, holds a second full copy of the body in memory, and usually produces output slightly larger than
|
|
75
|
+
* Images, audio, video and archives already carry their own compression. Running them through brotli, gzip or
|
|
76
|
+
* zstd burns CPU, holds a second full copy of the body in memory, and usually produces output slightly larger than
|
|
91
77
|
* the input. Formats that are raw despite such a media type, for example `image/bmp` or `audio/wav`, are still
|
|
92
78
|
* compressed. A body with no content type is assumed to be compressible.
|
|
93
79
|
* @internal
|
|
@@ -114,7 +100,21 @@ export declare function splitIntoJsonArrayBatches<T extends {
|
|
|
114
100
|
maxByteLength: number;
|
|
115
101
|
}): T[][];
|
|
116
102
|
export declare function isBuffer(value: unknown): value is Buffer | ArrayBuffer | TypedArray;
|
|
103
|
+
/**
|
|
104
|
+
* Whether a value is a `Blob`, a `File` included. Unlike a stream, a blob can be read again for every attempt of a
|
|
105
|
+
* request, so a request with a blob body can be retried.
|
|
106
|
+
*/
|
|
107
|
+
export declare function isBlob(value: unknown): value is Blob;
|
|
108
|
+
/**
|
|
109
|
+
* Whether a value is a web `ReadableStream`, which is what the callers get for a streamed response and may pass
|
|
110
|
+
* on as a request body.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isWebStream(value: unknown): value is ReadableStream<Uint8Array>;
|
|
117
113
|
export declare function isStream(value: unknown): value is Readable;
|
|
114
|
+
/**
|
|
115
|
+
* Whether a value is a stream of either kind, which a request can send only once.
|
|
116
|
+
*/
|
|
117
|
+
export declare function isAnyStream(value: unknown): value is Readable | ReadableStream<Uint8Array>;
|
|
118
118
|
/**
|
|
119
119
|
* Helper class to create async iterators from paginated list endpoints.
|
|
120
120
|
*/
|
|
@@ -145,10 +145,20 @@ export interface PaginationOptions {
|
|
|
145
145
|
* limit is reached or once all items from API have been fetched.
|
|
146
146
|
*
|
|
147
147
|
* Chunk size is usually limited by API. Minimum of those two limits will be used.
|
|
148
|
+
*
|
|
149
|
+
* Without `chunkSize`, each request gets the API's default page size, capped by the remaining `limit`. Dataset
|
|
150
|
+
* items have no default limit, so iterating `DatasetClient.listItems()` without `chunkSize` loads the whole
|
|
151
|
+
* dataset, or all `limit` items, in one response. Pass `chunkSize` to iterate a large dataset.
|
|
148
152
|
* @since Added in 2.21.0
|
|
149
153
|
* */
|
|
150
154
|
chunkSize?: number;
|
|
151
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* The smaller of two page limits, for the `limit` query parameter. The API treats a `limit` of 0 as unset, so 0 here
|
|
158
|
+
* means no limit and loses to any other value.
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
|
+
export declare function minForLimitParam(a: number | undefined, b: number | undefined): number | undefined;
|
|
152
162
|
/**
|
|
153
163
|
* Schema shape of {@link PaginationOptions}, to spread into every paginating client's list schema. One
|
|
154
164
|
* copy stops it drifting from the interface.
|
|
@@ -179,7 +189,12 @@ export interface PaginatedResponse<Data> {
|
|
|
179
189
|
* @template Data - The type of items in the list
|
|
180
190
|
*/
|
|
181
191
|
export interface PaginatedList<Data> extends PaginatedResponse<Data> {
|
|
182
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* Number of entries on this page. On a page from {@link DatasetClient.listItems}, the number of dataset rows the
|
|
194
|
+
* API scanned for it, or the number of items returned when that is larger. Filters (`clean`, `skipEmpty`) can
|
|
195
|
+
* leave it above `items.length`. The next page starts at `offset + Math.min(count, limit)`; the cap matters only
|
|
196
|
+
* with `unwind`, which can return more items than the rows scanned.
|
|
197
|
+
*/
|
|
183
198
|
count: number;
|
|
184
199
|
/** Position of the first returned entry in the dataset. */
|
|
185
200
|
offset: number;
|
|
@@ -188,16 +203,6 @@ export interface PaginatedList<Data> extends PaginatedResponse<Data> {
|
|
|
188
203
|
/** Should the results be in descending order. */
|
|
189
204
|
desc: boolean;
|
|
190
205
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Key under which a page of dataset items carries the number of rows the API scanned to produce it, as a
|
|
193
|
-
* non-enumerable property that stays out of the page's public shape. The API applies `offset` and `limit` to the
|
|
194
|
-
* dataset's rows first and shapes the result afterwards: filters (`clean`, `skipEmpty`, `skipHidden`) drop items and
|
|
195
|
-
* `unwind` splits or drops them, so `items.length` can land on either side of the rows scanned. The
|
|
196
|
-
* `x-apify-pagination-count` header reports the scanned number, and the offset iterator advances and terminates by it
|
|
197
|
-
* alone. A page without the property falls back to `items.length`.
|
|
198
|
-
* @internal
|
|
199
|
-
*/
|
|
200
|
-
export declare const SCANNED_COUNT: unique symbol;
|
|
201
206
|
/**
|
|
202
207
|
* Type representing both a Promise of a paginated list and an async iterable.
|
|
203
208
|
*
|
|
@@ -243,3 +248,23 @@ export declare function toPath(path: string | string[]): string;
|
|
|
243
248
|
* @internal
|
|
244
249
|
*/
|
|
245
250
|
export declare function sleep(millis: number, signal?: AbortSignal): Promise<void>;
|
|
251
|
+
/** Any string, written so that a union with string literals keeps suggesting the literals. */
|
|
252
|
+
export type AnyString = string & {};
|
|
253
|
+
/** Any valid JSON value. */
|
|
254
|
+
export type JsonValue = string | number | boolean | null | {
|
|
255
|
+
[Key in string]: JsonValue;
|
|
256
|
+
} | JsonValue[] | readonly JsonValue[];
|
|
257
|
+
/**
|
|
258
|
+
* Any JSON object.
|
|
259
|
+
* @internal
|
|
260
|
+
*/
|
|
261
|
+
export type JsonObject = {
|
|
262
|
+
[Key in string]: JsonValue;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Any JSON array.
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
export type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
269
|
+
/** Any typed array, such as `Uint8Array` or `Float64Array`. */
|
|
270
|
+
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|