apify-client 2.25.1-beta.7 → 3.0.0-beta.0
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/dist/apify_client.js +34 -30
- package/dist/argument_validation_error.d.ts +17 -0
- package/dist/argument_validation_error.js +157 -0
- package/dist/base/api_client.d.ts +2 -2
- package/dist/base/api_client.js +13 -10
- package/dist/bundle.js +66 -28147
- package/dist/bundle.js.LICENSE.txt +33 -0
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/resource_clients/actor.js +60 -55
- package/dist/resource_clients/actor_collection.js +13 -11
- package/dist/resource_clients/actor_env_var.js +2 -3
- package/dist/resource_clients/actor_env_var_collection.js +3 -3
- package/dist/resource_clients/actor_version.js +5 -4
- package/dist/resource_clients/actor_version_collection.js +3 -3
- package/dist/resource_clients/build.js +7 -10
- package/dist/resource_clients/build_collection.js +8 -8
- package/dist/resource_clients/dataset.d.ts +6 -4
- package/dist/resource_clients/dataset.js +66 -57
- package/dist/resource_clients/dataset_collection.js +14 -12
- package/dist/resource_clients/key_value_store.d.ts +3 -2
- package/dist/resource_clients/key_value_store.js +66 -50
- package/dist/resource_clients/key_value_store_collection.js +14 -12
- package/dist/resource_clients/request_queue.js +83 -89
- package/dist/resource_clients/request_queue_collection.js +12 -11
- package/dist/resource_clients/run.js +39 -40
- package/dist/resource_clients/run_collection.js +12 -11
- package/dist/resource_clients/schedule.js +1 -3
- package/dist/resource_clients/schedule_collection.js +10 -9
- package/dist/resource_clients/store_collection.js +13 -13
- package/dist/resource_clients/task.js +36 -33
- package/dist/resource_clients/task_collection.js +9 -9
- package/dist/resource_clients/webhook.js +1 -3
- package/dist/resource_clients/webhook_collection.js +10 -9
- package/dist/resource_clients/webhook_dispatch_collection.js +8 -8
- package/dist/statistics.js +4 -3
- package/dist/utils.d.ts +51 -5
- package/dist/utils.js +94 -12
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -27,5 +27,6 @@ export * from './resource_clients/webhook_collection';
|
|
|
27
27
|
export * from './resource_clients/webhook_dispatch';
|
|
28
28
|
export * from './resource_clients/webhook_dispatch_collection';
|
|
29
29
|
export * from './apify_api_error';
|
|
30
|
+
export * from './argument_validation_error';
|
|
30
31
|
export { InvalidResponseBodyError } from './interceptors';
|
|
31
32
|
export type { PaginatedList, Dictionary } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -31,5 +31,6 @@ tslib_1.__exportStar(require("./resource_clients/webhook_collection"), exports);
|
|
|
31
31
|
tslib_1.__exportStar(require("./resource_clients/webhook_dispatch"), exports);
|
|
32
32
|
tslib_1.__exportStar(require("./resource_clients/webhook_dispatch_collection"), exports);
|
|
33
33
|
tslib_1.__exportStar(require("./apify_api_error"), exports);
|
|
34
|
+
tslib_1.__exportStar(require("./argument_validation_error"), exports);
|
|
34
35
|
var interceptors_1 = require("./interceptors");
|
|
35
36
|
Object.defineProperty(exports, "InvalidResponseBodyError", { enumerable: true, get: function () { return interceptors_1.InvalidResponseBodyError; } });
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ export const ActorVersionClient = mod.ActorVersionClient;
|
|
|
11
11
|
export const ActorVersionCollectionClient = mod.ActorVersionCollectionClient;
|
|
12
12
|
export const ApifyApiError = mod.ApifyApiError;
|
|
13
13
|
export const ApifyClient = mod.ApifyClient;
|
|
14
|
+
export const ArgumentValidationError = mod.ArgumentValidationError;
|
|
14
15
|
export const BuildClient = mod.BuildClient;
|
|
15
16
|
export const BuildCollectionClient = mod.BuildCollectionClient;
|
|
16
17
|
export const DatasetClient = mod.DatasetClient;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
4
|
+
const zod_1 = require("zod");
|
|
6
5
|
const consts_1 = require("@apify/consts");
|
|
7
6
|
const log_1 = require("@apify/log");
|
|
8
7
|
const resource_client_1 = require("../base/resource_client");
|
|
@@ -14,6 +13,46 @@ const build_collection_1 = require("./build_collection");
|
|
|
14
13
|
const run_1 = require("./run");
|
|
15
14
|
const run_collection_1 = require("./run_collection");
|
|
16
15
|
const webhook_collection_1 = require("./webhook_collection");
|
|
16
|
+
const startOptionsSchema = zod_1.z.strictObject({
|
|
17
|
+
build: zod_1.z.string().optional(),
|
|
18
|
+
contentType: zod_1.z.string().optional(),
|
|
19
|
+
memory: zod_1.z.number().optional(),
|
|
20
|
+
timeout: zod_1.z.number().optional(),
|
|
21
|
+
waitForFinish: zod_1.z.number().optional(),
|
|
22
|
+
webhooks: zod_1.z.array(utils_1.anyObjectSchema).optional(),
|
|
23
|
+
maxItems: zod_1.z.number().min(0).optional(),
|
|
24
|
+
maxTotalChargeUsd: zod_1.z.number().min(0).optional(),
|
|
25
|
+
restartOnError: zod_1.z.boolean().optional(),
|
|
26
|
+
forcePermissionLevel: zod_1.z.enum(consts_1.ACTOR_PERMISSION_LEVEL).optional(),
|
|
27
|
+
});
|
|
28
|
+
const callOptionsSchema = zod_1.z.strictObject({
|
|
29
|
+
build: zod_1.z.string().optional(),
|
|
30
|
+
contentType: zod_1.z.string().optional(),
|
|
31
|
+
memory: zod_1.z.number().optional(),
|
|
32
|
+
timeout: zod_1.z.number().min(0).optional(),
|
|
33
|
+
waitSecs: zod_1.z.number().min(0).optional(),
|
|
34
|
+
webhooks: zod_1.z.array(utils_1.anyObjectSchema).optional(),
|
|
35
|
+
maxItems: zod_1.z.number().min(0).optional(),
|
|
36
|
+
maxTotalChargeUsd: zod_1.z.number().min(0).optional(),
|
|
37
|
+
log: zod_1.z.union([zod_1.z.null(), zod_1.z.instanceof(log_1.Log), zod_1.z.literal('default')]).optional(),
|
|
38
|
+
restartOnError: zod_1.z.boolean().optional(),
|
|
39
|
+
forcePermissionLevel: zod_1.z.enum(consts_1.ACTOR_PERMISSION_LEVEL).optional(),
|
|
40
|
+
});
|
|
41
|
+
const validateInputOptionsSchema = zod_1.z.strictObject({
|
|
42
|
+
build: zod_1.z.string().optional(),
|
|
43
|
+
contentType: zod_1.z.string().optional(),
|
|
44
|
+
});
|
|
45
|
+
const versionNumberSchema = zod_1.z.string();
|
|
46
|
+
const buildOptionsSchema = zod_1.z.strictObject({
|
|
47
|
+
betaPackages: zod_1.z.boolean().optional(),
|
|
48
|
+
tag: zod_1.z.string().optional(),
|
|
49
|
+
useCache: zod_1.z.boolean().optional(),
|
|
50
|
+
waitForFinish: zod_1.z.number().optional(),
|
|
51
|
+
});
|
|
52
|
+
const lastRunOptionsSchema = zod_1.z.strictObject({
|
|
53
|
+
status: zod_1.z.enum(consts_1.ACTOR_JOB_STATUSES).optional(),
|
|
54
|
+
origin: zod_1.z.enum(consts_1.META_ORIGINS).optional(),
|
|
55
|
+
});
|
|
17
56
|
/**
|
|
18
57
|
* Client for managing a specific Actor.
|
|
19
58
|
*
|
|
@@ -61,7 +100,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
61
100
|
* @see https://docs.apify.com/api/v2/act-put
|
|
62
101
|
*/
|
|
63
102
|
async update(newFields) {
|
|
64
|
-
(0,
|
|
103
|
+
(0, utils_1.parseArgument)(newFields, utils_1.anyObjectSchema);
|
|
65
104
|
return this._update(newFields);
|
|
66
105
|
}
|
|
67
106
|
/**
|
|
@@ -109,25 +148,14 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
109
148
|
async start(input, options = {}) {
|
|
110
149
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
111
150
|
// then it will process input as a buffer.
|
|
112
|
-
(0,
|
|
113
|
-
|
|
114
|
-
contentType: ow_1.default.optional.string,
|
|
115
|
-
memory: ow_1.default.optional.number,
|
|
116
|
-
timeout: ow_1.default.optional.number,
|
|
117
|
-
waitForFinish: ow_1.default.optional.number,
|
|
118
|
-
webhooks: ow_1.default.optional.array.ofType(ow_1.default.object),
|
|
119
|
-
maxItems: ow_1.default.optional.number.not.negative,
|
|
120
|
-
maxTotalChargeUsd: ow_1.default.optional.number.not.negative,
|
|
121
|
-
restartOnError: ow_1.default.optional.boolean,
|
|
122
|
-
forcePermissionLevel: ow_1.default.optional.string.oneOf(Object.values(consts_1.ACTOR_PERMISSION_LEVEL)),
|
|
123
|
-
}));
|
|
124
|
-
const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel, } = options;
|
|
151
|
+
const parsed = (0, utils_1.parseArgument)(options, startOptionsSchema, 'ActorStartOptions');
|
|
152
|
+
const { waitForFinish, timeout, memory, build, maxItems, maxTotalChargeUsd, restartOnError, forcePermissionLevel, } = parsed;
|
|
125
153
|
const params = {
|
|
126
154
|
waitForFinish,
|
|
127
155
|
timeout,
|
|
128
156
|
memory,
|
|
129
157
|
build,
|
|
130
|
-
webhooks: (0, utils_1.stringifyWebhooksToBase64)(
|
|
158
|
+
webhooks: (0, utils_1.stringifyWebhooksToBase64)(parsed.webhooks),
|
|
131
159
|
maxItems,
|
|
132
160
|
maxTotalChargeUsd,
|
|
133
161
|
restartOnError,
|
|
@@ -142,9 +170,9 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
142
170
|
// to stringify functions to JSON, instead of omitting them.
|
|
143
171
|
stringifyFunctions: true,
|
|
144
172
|
};
|
|
145
|
-
if (
|
|
173
|
+
if (parsed.contentType) {
|
|
146
174
|
request.headers = {
|
|
147
|
-
'content-type':
|
|
175
|
+
'content-type': parsed.contentType,
|
|
148
176
|
};
|
|
149
177
|
}
|
|
150
178
|
const response = await this.httpClient.call(request);
|
|
@@ -190,26 +218,14 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
190
218
|
async call(input, options = {}) {
|
|
191
219
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
192
220
|
// then it will process input as a buffer.
|
|
193
|
-
(0,
|
|
194
|
-
|
|
195
|
-
contentType: ow_1.default.optional.string,
|
|
196
|
-
memory: ow_1.default.optional.number,
|
|
197
|
-
timeout: ow_1.default.optional.number.not.negative,
|
|
198
|
-
waitSecs: ow_1.default.optional.number.not.negative,
|
|
199
|
-
webhooks: ow_1.default.optional.array.ofType(ow_1.default.object),
|
|
200
|
-
maxItems: ow_1.default.optional.number.not.negative,
|
|
201
|
-
maxTotalChargeUsd: ow_1.default.optional.number.not.negative,
|
|
202
|
-
log: ow_1.default.optional.any(ow_1.default.null, ow_1.default.object.instanceOf(log_1.Log), ow_1.default.string.equals('default')),
|
|
203
|
-
restartOnError: ow_1.default.optional.boolean,
|
|
204
|
-
forcePermissionLevel: ow_1.default.optional.string.oneOf(Object.values(consts_1.ACTOR_PERMISSION_LEVEL)),
|
|
205
|
-
}));
|
|
206
|
-
const { waitSecs, log, ...startOptions } = options;
|
|
221
|
+
const parsed = (0, utils_1.parseArgument)(options, callOptionsSchema, 'ActorCallOptions');
|
|
222
|
+
const { waitSecs, log, ...startOptions } = parsed;
|
|
207
223
|
const { id } = await this.start(input, startOptions);
|
|
208
224
|
// Calling root client because we need access to top level API.
|
|
209
225
|
// Creating a new instance of RunClient here would only allow
|
|
210
226
|
// setting it up as a nested route under actor API.
|
|
211
227
|
const newRunClient = this.apifyClient.run(id);
|
|
212
|
-
const streamedLog = await newRunClient.getStreamedLog({ toLog:
|
|
228
|
+
const streamedLog = await newRunClient.getStreamedLog({ toLog: log });
|
|
213
229
|
streamedLog?.start();
|
|
214
230
|
return this.apifyClient
|
|
215
231
|
.run(id)
|
|
@@ -252,22 +268,19 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
252
268
|
async validateInput(input, options = {}) {
|
|
253
269
|
// input can be anything, so no point in validating it. E.g. if you set content-type to application/pdf
|
|
254
270
|
// then it will process input as a buffer.
|
|
255
|
-
(0,
|
|
256
|
-
build: ow_1.default.optional.string,
|
|
257
|
-
contentType: ow_1.default.optional.string,
|
|
258
|
-
}));
|
|
271
|
+
const parsed = (0, utils_1.parseArgument)(options, validateInputOptionsSchema, 'ActorValidateInputOptions');
|
|
259
272
|
const request = {
|
|
260
273
|
url: this._url('validate-input'),
|
|
261
274
|
method: 'POST',
|
|
262
275
|
data: input,
|
|
263
|
-
params: this._params({ build:
|
|
276
|
+
params: this._params({ build: parsed.build }),
|
|
264
277
|
// Apify internal property. Tells the request serialization interceptor
|
|
265
278
|
// to stringify functions to JSON, instead of omitting them.
|
|
266
279
|
stringifyFunctions: true,
|
|
267
280
|
};
|
|
268
|
-
if (
|
|
281
|
+
if (parsed.contentType) {
|
|
269
282
|
request.headers = {
|
|
270
|
-
'content-type':
|
|
283
|
+
'content-type': parsed.contentType,
|
|
271
284
|
};
|
|
272
285
|
}
|
|
273
286
|
const response = await this.httpClient.call(request);
|
|
@@ -303,19 +316,14 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
303
316
|
* ```
|
|
304
317
|
*/
|
|
305
318
|
async build(versionNumber, options = {}) {
|
|
306
|
-
(0,
|
|
307
|
-
(0,
|
|
308
|
-
betaPackages: ow_1.default.optional.boolean,
|
|
309
|
-
tag: ow_1.default.optional.string,
|
|
310
|
-
useCache: ow_1.default.optional.boolean,
|
|
311
|
-
waitForFinish: ow_1.default.optional.number,
|
|
312
|
-
}));
|
|
319
|
+
(0, utils_1.parseArgument)(versionNumber, versionNumberSchema);
|
|
320
|
+
const parsed = (0, utils_1.parseArgument)(options, buildOptionsSchema, 'ActorBuildOptions');
|
|
313
321
|
const response = await this.httpClient.call({
|
|
314
322
|
url: this._url('builds'),
|
|
315
323
|
method: 'POST',
|
|
316
324
|
params: this._params({
|
|
317
325
|
version: versionNumber,
|
|
318
|
-
...
|
|
326
|
+
...parsed,
|
|
319
327
|
}),
|
|
320
328
|
});
|
|
321
329
|
return (0, utils_1.cast)((0, utils_1.parseDateFields)((0, utils_1.pluckData)(response.data)));
|
|
@@ -378,13 +386,10 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
378
386
|
* ```
|
|
379
387
|
*/
|
|
380
388
|
lastRun(options = {}) {
|
|
381
|
-
(0,
|
|
382
|
-
status: ow_1.default.optional.string.oneOf(Object.values(consts_1.ACTOR_JOB_STATUSES)),
|
|
383
|
-
origin: ow_1.default.optional.string.oneOf(Object.values(consts_1.META_ORIGINS)),
|
|
384
|
-
}));
|
|
389
|
+
const parsed = (0, utils_1.parseArgument)(options, lastRunOptionsSchema, 'ActorLastRunOptions');
|
|
385
390
|
return new run_1.RunClient(this._subResourceOptions({
|
|
386
391
|
id: 'last',
|
|
387
|
-
params: this._params(
|
|
392
|
+
params: this._params(parsed),
|
|
388
393
|
resourcePath: 'runs',
|
|
389
394
|
}));
|
|
390
395
|
}
|
|
@@ -418,7 +423,7 @@ class ActorClient extends resource_client_1.ResourceClient {
|
|
|
418
423
|
* @see https://docs.apify.com/api/v2/act-version-get
|
|
419
424
|
*/
|
|
420
425
|
version(versionNumber) {
|
|
421
|
-
(0,
|
|
426
|
+
(0, utils_1.parseArgument)(versionNumber, versionNumberSchema);
|
|
422
427
|
return new actor_version_1.ActorVersionClient(this._subResourceOptions({
|
|
423
428
|
id: versionNumber,
|
|
424
429
|
}));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorListSortBy = exports.ActorCollectionClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
4
|
+
const zod_1 = require("zod");
|
|
6
5
|
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const actorCreateSchema = utils_1.anyObjectSchema.optional();
|
|
7
8
|
/**
|
|
8
9
|
* Client for managing the collection of Actors in your account.
|
|
9
10
|
*
|
|
@@ -58,14 +59,8 @@ class ActorCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
58
59
|
* @see https://docs.apify.com/api/v2/acts-get
|
|
59
60
|
*/
|
|
60
61
|
list(options = {}) {
|
|
61
|
-
(0,
|
|
62
|
-
|
|
63
|
-
limit: ow_1.default.optional.number.not.negative,
|
|
64
|
-
offset: ow_1.default.optional.number.not.negative,
|
|
65
|
-
desc: ow_1.default.optional.boolean,
|
|
66
|
-
sortBy: ow_1.default.optional.string.oneOf(Object.values(ActorListSortBy)),
|
|
67
|
-
}));
|
|
68
|
-
return this._listPaginated(options);
|
|
62
|
+
const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'ActorCollectionListOptions');
|
|
63
|
+
return this._listPaginated(parsed);
|
|
69
64
|
}
|
|
70
65
|
/**
|
|
71
66
|
* Creates a new Actor.
|
|
@@ -75,7 +70,7 @@ class ActorCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
75
70
|
* @see https://docs.apify.com/api/v2/acts-post
|
|
76
71
|
*/
|
|
77
72
|
async create(actor) {
|
|
78
|
-
(0,
|
|
73
|
+
(0, utils_1.parseArgument)(actor, actorCreateSchema);
|
|
79
74
|
return this._create(actor);
|
|
80
75
|
}
|
|
81
76
|
}
|
|
@@ -88,3 +83,10 @@ var ActorListSortBy;
|
|
|
88
83
|
ActorListSortBy["CREATED_AT"] = "createdAt";
|
|
89
84
|
ActorListSortBy["LAST_RUN_STARTED_AT"] = "stats.lastRunStartedAt";
|
|
90
85
|
})(ActorListSortBy || (exports.ActorListSortBy = ActorListSortBy = {}));
|
|
86
|
+
// Declared below `ActorListSortBy` because it references it at module load time.
|
|
87
|
+
const listOptionsSchema = zod_1.z.strictObject({
|
|
88
|
+
my: zod_1.z.boolean().optional(),
|
|
89
|
+
...utils_1.paginationOptionsShape,
|
|
90
|
+
desc: zod_1.z.boolean().optional(),
|
|
91
|
+
sortBy: zod_1.z.enum(ActorListSortBy).optional(),
|
|
92
|
+
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorEnvVarClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
6
4
|
const resource_client_1 = require("../base/resource_client");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
7
6
|
/**
|
|
8
7
|
* Client for managing a specific Actor environment variable.
|
|
9
8
|
*
|
|
@@ -54,7 +53,7 @@ class ActorEnvVarClient extends resource_client_1.ResourceClient {
|
|
|
54
53
|
* @see https://docs.apify.com/api/v2/act-version-env-var-put
|
|
55
54
|
*/
|
|
56
55
|
async update(actorEnvVar) {
|
|
57
|
-
(0,
|
|
56
|
+
(0, utils_1.parseArgument)(actorEnvVar, utils_1.anyObjectSchema);
|
|
58
57
|
return this._update(actorEnvVar);
|
|
59
58
|
}
|
|
60
59
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorEnvVarCollectionClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
6
4
|
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const actorEnvVarSchema = utils_1.anyObjectSchema.optional();
|
|
7
7
|
/**
|
|
8
8
|
* Client for managing the collection of environment variables for an Actor version.
|
|
9
9
|
*
|
|
@@ -71,7 +71,7 @@ class ActorEnvVarCollectionClient extends resource_collection_client_1.ResourceC
|
|
|
71
71
|
* @see https://docs.apify.com/api/v2/act-version-env-vars-post
|
|
72
72
|
*/
|
|
73
73
|
async create(actorEnvVar) {
|
|
74
|
-
(0,
|
|
74
|
+
(0, utils_1.parseArgument)(actorEnvVar, actorEnvVarSchema);
|
|
75
75
|
return this._create(actorEnvVar);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorSourceType = exports.ActorVersionClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
4
|
+
const zod_1 = require("zod");
|
|
6
5
|
const resource_client_1 = require("../base/resource_client");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
7
|
const actor_env_var_1 = require("./actor_env_var");
|
|
8
8
|
const actor_env_var_collection_1 = require("./actor_env_var_collection");
|
|
9
|
+
const envVarNameSchema = zod_1.z.string();
|
|
9
10
|
/**
|
|
10
11
|
* Client for managing a specific Actor version.
|
|
11
12
|
*
|
|
@@ -54,7 +55,7 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
54
55
|
* @see https://docs.apify.com/api/v2/act-version-put
|
|
55
56
|
*/
|
|
56
57
|
async update(newFields) {
|
|
57
|
-
(0,
|
|
58
|
+
(0, utils_1.parseArgument)(newFields, utils_1.anyObjectSchema);
|
|
58
59
|
return this._update(newFields);
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -74,7 +75,7 @@ class ActorVersionClient extends resource_client_1.ResourceClient {
|
|
|
74
75
|
* @since Added in 2.1.0
|
|
75
76
|
*/
|
|
76
77
|
envVar(envVarName) {
|
|
77
|
-
(0,
|
|
78
|
+
(0, utils_1.parseArgument)(envVarName, envVarNameSchema);
|
|
78
79
|
return new actor_env_var_1.ActorEnvVarClient(this._subResourceOptions({
|
|
79
80
|
id: envVarName,
|
|
80
81
|
}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorVersionCollectionClient = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
6
4
|
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const actorVersionSchema = utils_1.anyObjectSchema.optional();
|
|
7
7
|
/**
|
|
8
8
|
* Client for managing the collection of Actor versions.
|
|
9
9
|
*
|
|
@@ -68,7 +68,7 @@ class ActorVersionCollectionClient extends resource_collection_client_1.Resource
|
|
|
68
68
|
* @see https://docs.apify.com/api/v2/act-versions-post
|
|
69
69
|
*/
|
|
70
70
|
async create(actorVersion) {
|
|
71
|
-
(0,
|
|
71
|
+
(0, utils_1.parseArgument)(actorVersion, actorVersionSchema);
|
|
72
72
|
return this._create(actorVersion);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuildClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
4
|
+
const zod_1 = require("zod");
|
|
6
5
|
const resource_client_1 = require("../base/resource_client");
|
|
7
6
|
const utils_1 = require("../utils");
|
|
8
7
|
const log_1 = require("./log");
|
|
8
|
+
const getOptionsSchema = zod_1.z.strictObject({ waitForFinish: zod_1.z.number().optional() });
|
|
9
|
+
const waitForFinishOptionsSchema = zod_1.z.strictObject({ waitSecs: zod_1.z.number().optional() });
|
|
9
10
|
/**
|
|
10
11
|
* Client for managing a specific Actor build.
|
|
11
12
|
*
|
|
@@ -58,10 +59,8 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
61
|
async get(options = {}) {
|
|
61
|
-
(0,
|
|
62
|
-
|
|
63
|
-
}));
|
|
64
|
-
return this._get(options);
|
|
62
|
+
const parsed = (0, utils_1.parseArgument)(options, getOptionsSchema, 'BuildClientGetOptions');
|
|
63
|
+
return this._get(parsed);
|
|
65
64
|
}
|
|
66
65
|
/**
|
|
67
66
|
* Aborts the Actor build.
|
|
@@ -139,10 +138,8 @@ class BuildClient extends resource_client_1.ResourceClient {
|
|
|
139
138
|
* ```
|
|
140
139
|
*/
|
|
141
140
|
async waitForFinish(options = {}) {
|
|
142
|
-
(0,
|
|
143
|
-
|
|
144
|
-
}));
|
|
145
|
-
return this._waitForFinish(options);
|
|
141
|
+
const parsed = (0, utils_1.parseArgument)(options, waitForFinishOptionsSchema, 'BuildClientWaitForFinishOptions');
|
|
142
|
+
return this._waitForFinish(parsed);
|
|
146
143
|
}
|
|
147
144
|
/**
|
|
148
145
|
* Returns a client for accessing the log of this Actor build.
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BuildCollectionClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
4
|
+
const zod_1 = require("zod");
|
|
6
5
|
const resource_collection_client_1 = require("../base/resource_collection_client");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const listOptionsSchema = zod_1.z.strictObject({
|
|
8
|
+
...utils_1.paginationOptionsShape,
|
|
9
|
+
desc: zod_1.z.boolean().optional(),
|
|
10
|
+
});
|
|
7
11
|
/**
|
|
8
12
|
* Client for managing the collection of Actor builds.
|
|
9
13
|
*
|
|
@@ -56,12 +60,8 @@ class BuildCollectionClient extends resource_collection_client_1.ResourceCollect
|
|
|
56
60
|
* @see https://docs.apify.com/api/v2/actor-builds-get
|
|
57
61
|
*/
|
|
58
62
|
list(options = {}) {
|
|
59
|
-
(0,
|
|
60
|
-
|
|
61
|
-
offset: ow_1.default.optional.number.not.negative,
|
|
62
|
-
desc: ow_1.default.optional.boolean,
|
|
63
|
-
}));
|
|
64
|
-
return this._listPaginated(options);
|
|
63
|
+
const parsed = (0, utils_1.parseArgument)(options, listOptionsSchema, 'BuildCollectionClientListOptions');
|
|
64
|
+
return this._listPaginated(parsed);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
exports.BuildCollectionClient = BuildCollectionClient;
|
|
@@ -315,10 +315,11 @@ export interface DatasetClientListItemOptions extends PaginationOptions {
|
|
|
315
315
|
/**
|
|
316
316
|
* Options for creating a public URL to access dataset items.
|
|
317
317
|
*
|
|
318
|
-
* Extends {@link DatasetClientListItemOptions} with URL expiration control
|
|
318
|
+
* Extends {@link DatasetClientListItemOptions} with URL expiration control, minus `chunkSize` (it only
|
|
319
|
+
* sizes a client-side iteration) and `signature` (this method produces one).
|
|
319
320
|
* @since Added in 2.16.0
|
|
320
321
|
*/
|
|
321
|
-
export interface DatasetClientCreateItemsUrlOptions extends DatasetClientListItemOptions {
|
|
322
|
+
export interface DatasetClientCreateItemsUrlOptions extends Omit<DatasetClientListItemOptions, 'chunkSize' | 'signature'> {
|
|
322
323
|
expiresInSecs?: number;
|
|
323
324
|
}
|
|
324
325
|
/**
|
|
@@ -336,9 +337,10 @@ export declare enum DownloadItemsFormat {
|
|
|
336
337
|
/**
|
|
337
338
|
* Options for downloading dataset items in a specific format.
|
|
338
339
|
*
|
|
339
|
-
* Extends {@link DatasetClientListItemOptions} with format-specific options
|
|
340
|
+
* Extends {@link DatasetClientListItemOptions} with format-specific options, minus `chunkSize` - this
|
|
341
|
+
* downloads the whole range in one request, so there is nothing to size.
|
|
340
342
|
*/
|
|
341
|
-
export interface DatasetClientDownloadItemsOptions extends DatasetClientListItemOptions {
|
|
343
|
+
export interface DatasetClientDownloadItemsOptions extends Omit<DatasetClientListItemOptions, 'chunkSize'> {
|
|
342
344
|
attachment?: boolean;
|
|
343
345
|
bom?: boolean;
|
|
344
346
|
delimiter?: string;
|