apify-client 3.0.0-beta.3 → 3.0.0-beta.30
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 +13 -3
- package/dist/apify_api_error.d.ts +62 -21
- package/dist/apify_api_error.js +96 -23
- package/dist/apify_client.d.ts +114 -9
- package/dist/apify_client.js +133 -48
- package/dist/base/api_client.d.ts +7 -7
- package/dist/base/api_client.js +24 -16
- package/dist/base/resource_client.d.ts +23 -9
- package/dist/base/resource_client.js +57 -29
- package/dist/base/resource_collection_client.d.ts +8 -4
- package/dist/base/resource_collection_client.js +26 -15
- package/dist/body_parser.d.ts +3 -4
- package/dist/body_parser.js +19 -26
- package/dist/bundle.js +29 -22
- package/dist/bundle.js.map +1 -1
- package/dist/generated/api.d.ts +287 -214
- package/dist/generated/schemas.d.ts +6699 -0
- package/dist/generated/schemas.js +1521 -0
- package/dist/http_clients/axios.d.ts +60 -0
- package/dist/http_clients/axios.js +117 -0
- package/dist/http_clients/base.d.ts +333 -0
- package/dist/http_clients/base.js +563 -0
- package/dist/http_clients/index.d.ts +4 -0
- package/dist/http_clients/index.js +2 -0
- package/dist/http_compressors/base.d.ts +40 -0
- package/dist/http_compressors/base.js +9 -0
- package/dist/http_compressors/brotli.d.ts +33 -0
- package/dist/http_compressors/brotli.js +39 -0
- package/dist/http_compressors/gzip.d.ts +33 -0
- package/dist/http_compressors/gzip.js +39 -0
- package/dist/http_compressors/index.d.ts +6 -0
- package/dist/http_compressors/index.js +2 -0
- package/dist/http_compressors/resolve.d.ts +23 -0
- package/dist/http_compressors/resolve.js +27 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -1
- package/dist/invalid_response_body_error.d.ts +13 -0
- package/dist/invalid_response_body_error.js +17 -0
- package/dist/lazy_schema.d.ts +8 -0
- package/dist/lazy_schema.js +11 -0
- package/dist/models.d.ts +32 -52
- package/dist/resource_clients/actor.d.ts +46 -31
- package/dist/resource_clients/actor.js +78 -58
- package/dist/resource_clients/actor_collection.d.ts +9 -5
- package/dist/resource_clients/actor_collection.js +12 -3
- package/dist/resource_clients/actor_env_var.d.ts +10 -3
- package/dist/resource_clients/actor_env_var.js +17 -6
- package/dist/resource_clients/actor_env_var_collection.d.ts +14 -18
- package/dist/resource_clients/actor_env_var_collection.js +18 -11
- package/dist/resource_clients/actor_version.d.ts +18 -3
- package/dist/resource_clients/actor_version.js +20 -9
- package/dist/resource_clients/actor_version_collection.d.ts +16 -17
- package/dist/resource_clients/actor_version_collection.js +20 -11
- package/dist/resource_clients/build.d.ts +18 -6
- package/dist/resource_clients/build.js +37 -17
- package/dist/resource_clients/build_collection.d.ts +3 -1
- package/dist/resource_clients/build_collection.js +5 -1
- package/dist/resource_clients/dataset.d.ts +30 -18
- package/dist/resource_clients/dataset.js +85 -60
- package/dist/resource_clients/dataset_collection.d.ts +6 -2
- package/dist/resource_clients/dataset_collection.js +14 -2
- package/dist/resource_clients/key_value_store.d.ts +58 -16
- package/dist/resource_clients/key_value_store.js +80 -41
- package/dist/resource_clients/key_value_store_collection.d.ts +6 -2
- package/dist/resource_clients/key_value_store_collection.js +14 -2
- package/dist/resource_clients/log.d.ts +11 -19
- package/dist/resource_clients/log.js +64 -46
- package/dist/resource_clients/request_queue.d.ts +56 -26
- package/dist/resource_clients/request_queue.js +197 -116
- package/dist/resource_clients/request_queue_collection.d.ts +6 -2
- package/dist/resource_clients/request_queue_collection.js +10 -3
- package/dist/resource_clients/run.d.ts +52 -18
- package/dist/resource_clients/run.js +93 -47
- package/dist/resource_clients/run_collection.d.ts +3 -1
- package/dist/resource_clients/run_collection.js +5 -1
- package/dist/resource_clients/schedule.d.ts +16 -7
- package/dist/resource_clients/schedule.js +32 -21
- package/dist/resource_clients/schedule_collection.d.ts +6 -2
- package/dist/resource_clients/schedule_collection.js +10 -3
- package/dist/resource_clients/store_collection.d.ts +3 -1
- package/dist/resource_clients/store_collection.js +5 -1
- package/dist/resource_clients/task.d.ts +28 -10
- package/dist/resource_clients/task.js +71 -46
- package/dist/resource_clients/task_collection.d.ts +6 -2
- package/dist/resource_clients/task_collection.js +10 -3
- package/dist/resource_clients/user.d.ts +17 -8
- package/dist/resource_clients/user.js +43 -39
- package/dist/resource_clients/webhook.d.ts +14 -5
- package/dist/resource_clients/webhook.js +31 -22
- package/dist/resource_clients/webhook_collection.d.ts +6 -2
- package/dist/resource_clients/webhook_collection.js +10 -3
- package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
- package/dist/resource_clients/webhook_dispatch.js +8 -2
- package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
- package/dist/resource_clients/webhook_dispatch_collection.js +5 -1
- package/dist/response_validation_error.d.ts +26 -0
- package/dist/response_validation_error.js +37 -0
- package/dist/runtime/node.d.ts +6 -0
- package/dist/runtime/node.js +49 -0
- package/dist/runtime/types.d.ts +52 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/web.d.ts +5 -0
- package/dist/runtime/web.js +18 -0
- package/dist/schemas.d.ts +15 -0
- package/dist/schemas.js +15 -0
- package/dist/statistics.d.ts +1 -6
- package/dist/statistics.js +2 -2
- package/dist/timeouts.d.ts +84 -0
- package/dist/timeouts.js +37 -0
- package/dist/timezones.d.ts +1 -1
- package/dist/utils.d.ts +86 -46
- package/dist/utils.js +218 -164
- package/package.json +42 -38
- package/dist/http_client.d.ts +0 -88
- package/dist/http_client.js +0 -255
- package/dist/interceptors.d.ts +0 -19
- package/dist/interceptors.js +0 -105
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runtime } from '#runtime';
|
|
3
|
+
import { parseArgument } from '../utils.js';
|
|
4
|
+
/** Lowest valid brotli quality, the fastest with the least compression. */
|
|
5
|
+
const MIN_QUALITY = 0;
|
|
6
|
+
/** Highest valid brotli quality, the slowest with the best compression. */
|
|
7
|
+
const MAX_QUALITY = 11;
|
|
8
|
+
/** Middle of the range, where brotli already beats gzip at a comparable CPU cost. */
|
|
9
|
+
const DEFAULT_QUALITY = 6;
|
|
10
|
+
const optionsSchema = z.strictObject({
|
|
11
|
+
quality: z.int().min(MIN_QUALITY).max(MAX_QUALITY).default(DEFAULT_QUALITY),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Compresses request bodies using brotli.
|
|
15
|
+
*
|
|
16
|
+
* Built on the `node:zlib` module, so it works wherever the client runs on Node.js.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```javascript
|
|
20
|
+
* import { ApifyClient, BrotliHttpCompressor } from 'apify-client';
|
|
21
|
+
*
|
|
22
|
+
* const client = new ApifyClient({ token: 'my-token', compression: new BrotliHttpCompressor({ quality: 11 }) });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class BrotliHttpCompressor {
|
|
26
|
+
contentEncoding = 'br';
|
|
27
|
+
#quality;
|
|
28
|
+
/**
|
|
29
|
+
* @param options - Compressor options.
|
|
30
|
+
* @throws {ArgumentValidationError} If `quality` is out of the valid range.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
const { quality } = parseArgument(options, optionsSchema, 'BrotliHttpCompressorOptions');
|
|
34
|
+
this.#quality = quality;
|
|
35
|
+
}
|
|
36
|
+
async compress(data) {
|
|
37
|
+
return runtime.compress(data, { algorithm: 'br', quality: this.#quality });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HttpCompressor } from './base.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compresses request bodies using gzip.
|
|
4
|
+
*
|
|
5
|
+
* Built on the `node:zlib` module, so it works wherever the client runs on Node.js.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* import { ApifyClient, GzipHttpCompressor } from 'apify-client';
|
|
10
|
+
*
|
|
11
|
+
* const client = new ApifyClient({ token: 'my-token', compression: new GzipHttpCompressor({ quality: 1 }) });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class GzipHttpCompressor implements HttpCompressor {
|
|
15
|
+
#private;
|
|
16
|
+
readonly contentEncoding = "gzip";
|
|
17
|
+
/**
|
|
18
|
+
* @param options - Compressor options.
|
|
19
|
+
* @throws {ArgumentValidationError} If `quality` is out of the valid range.
|
|
20
|
+
*/
|
|
21
|
+
constructor(options?: GzipHttpCompressorOptions);
|
|
22
|
+
compress(data: Buffer): Promise<Buffer>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Options for {@link GzipHttpCompressor}.
|
|
26
|
+
*/
|
|
27
|
+
export interface GzipHttpCompressorOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Compression level, from `1` (the fastest) to `9` (the best compression).
|
|
30
|
+
* @default 6
|
|
31
|
+
*/
|
|
32
|
+
quality?: number;
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { runtime } from '#runtime';
|
|
3
|
+
import { parseArgument } from '../utils.js';
|
|
4
|
+
/** Lowest valid gzip quality, the fastest with the least compression. */
|
|
5
|
+
const MIN_QUALITY = 1;
|
|
6
|
+
/** Highest valid gzip quality, the slowest with the best compression. */
|
|
7
|
+
const MAX_QUALITY = 9;
|
|
8
|
+
/** zlib's own default. The levels above it roughly double the CPU cost for about a percent fewer bytes. */
|
|
9
|
+
const DEFAULT_QUALITY = 6;
|
|
10
|
+
const optionsSchema = z.strictObject({
|
|
11
|
+
quality: z.int().min(MIN_QUALITY).max(MAX_QUALITY).default(DEFAULT_QUALITY),
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Compresses request bodies using gzip.
|
|
15
|
+
*
|
|
16
|
+
* Built on the `node:zlib` module, so it works wherever the client runs on Node.js.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```javascript
|
|
20
|
+
* import { ApifyClient, GzipHttpCompressor } from 'apify-client';
|
|
21
|
+
*
|
|
22
|
+
* const client = new ApifyClient({ token: 'my-token', compression: new GzipHttpCompressor({ quality: 1 }) });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class GzipHttpCompressor {
|
|
26
|
+
contentEncoding = 'gzip';
|
|
27
|
+
#quality;
|
|
28
|
+
/**
|
|
29
|
+
* @param options - Compressor options.
|
|
30
|
+
* @throws {ArgumentValidationError} If `quality` is out of the valid range.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
const { quality } = parseArgument(options, optionsSchema, 'GzipHttpCompressorOptions');
|
|
34
|
+
this.#quality = quality;
|
|
35
|
+
}
|
|
36
|
+
async compress(data) {
|
|
37
|
+
return runtime.compress(data, { algorithm: 'gzip', quality: this.#quality });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { HttpCompressor } from './base.js';
|
|
2
|
+
export { BrotliHttpCompressor } from './brotli.js';
|
|
3
|
+
export type { BrotliHttpCompressorOptions } from './brotli.js';
|
|
4
|
+
export { GzipHttpCompressor } from './gzip.js';
|
|
5
|
+
export type { GzipHttpCompressorOptions } from './gzip.js';
|
|
6
|
+
export type { HttpCompressionAlgorithm } from './resolve.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { HttpCompressor } from './base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compression algorithms the `compression` option of {@link ApifyClient} accepts by name. Each name selects the
|
|
5
|
+
* matching built-in compressor with its default quality: `'brotli'` a {@link BrotliHttpCompressor}, `'gzip'` a
|
|
6
|
+
* {@link GzipHttpCompressor}. The Apify API also accepts `deflate` and `identity`, which a custom
|
|
7
|
+
* {@link HttpCompressor} covers.
|
|
8
|
+
*/
|
|
9
|
+
export type HttpCompressionAlgorithm = 'brotli' | 'gzip';
|
|
10
|
+
/**
|
|
11
|
+
* Schema of the `compression` option: an algorithm name or an {@link HttpCompressor}.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const compressionSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
15
|
+
brotli: "brotli";
|
|
16
|
+
gzip: "gzip";
|
|
17
|
+
}>, z.ZodCustom<HttpCompressor, HttpCompressor>]>;
|
|
18
|
+
/**
|
|
19
|
+
* Turns the `compression` option into a ready-to-use {@link HttpCompressor}: a name into the matching built-in
|
|
20
|
+
* compressor with its default quality, a compressor into itself.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveCompressor(compression: HttpCompressionAlgorithm | HttpCompressor): HttpCompressor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { httpCompressorSchema } from './base.js';
|
|
3
|
+
import { BrotliHttpCompressor } from './brotli.js';
|
|
4
|
+
import { GzipHttpCompressor } from './gzip.js';
|
|
5
|
+
/**
|
|
6
|
+
* Schema of the `compression` option: an algorithm name or an {@link HttpCompressor}.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export const compressionSchema = z.union([
|
|
10
|
+
z.enum(['brotli', 'gzip']),
|
|
11
|
+
httpCompressorSchema,
|
|
12
|
+
]);
|
|
13
|
+
/**
|
|
14
|
+
* Turns the `compression` option into a ready-to-use {@link HttpCompressor}: a name into the matching built-in
|
|
15
|
+
* compressor with its default quality, a compressor into itself.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export function resolveCompressor(compression) {
|
|
19
|
+
if (typeof compression !== 'string')
|
|
20
|
+
return compression;
|
|
21
|
+
switch (compression) {
|
|
22
|
+
case 'gzip':
|
|
23
|
+
return new GzipHttpCompressor();
|
|
24
|
+
case 'brotli':
|
|
25
|
+
return new BrotliHttpCompressor();
|
|
26
|
+
}
|
|
27
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,5 +28,9 @@ export * from './resource_clients/webhook_dispatch.js';
|
|
|
28
28
|
export * from './resource_clients/webhook_dispatch_collection.js';
|
|
29
29
|
export * from './apify_api_error.js';
|
|
30
30
|
export { ArgumentValidationError } from '@apify/validations';
|
|
31
|
-
export
|
|
31
|
+
export * from './response_validation_error.js';
|
|
32
|
+
export * from './invalid_response_body_error.js';
|
|
33
|
+
export * from './http_clients/index.js';
|
|
34
|
+
export * from './http_compressors/index.js';
|
|
32
35
|
export type { PaginatedList, Dictionary } from './utils.js';
|
|
36
|
+
export type { Timeout, TimeoutOptions, TimeoutTier } from './timeouts.js';
|
package/dist/index.js
CHANGED
|
@@ -28,4 +28,7 @@ export * from './resource_clients/webhook_dispatch.js';
|
|
|
28
28
|
export * from './resource_clients/webhook_dispatch_collection.js';
|
|
29
29
|
export * from './apify_api_error.js';
|
|
30
30
|
export { ArgumentValidationError } from '@apify/validations';
|
|
31
|
-
export
|
|
31
|
+
export * from './response_validation_error.js';
|
|
32
|
+
export * from './invalid_response_body_error.js';
|
|
33
|
+
export * from './http_clients/index.js';
|
|
34
|
+
export * from './http_compressors/index.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HttpResponse } from './http_clients/base.js';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when a response body does not parse as its content type claims, typically a JSON document cut short by a
|
|
4
|
+
* connection dropped mid-response. The client retries such requests, so the error surfaces once the retries are
|
|
5
|
+
* exhausted.
|
|
6
|
+
*/
|
|
7
|
+
export declare class InvalidResponseBodyError extends Error {
|
|
8
|
+
code: string;
|
|
9
|
+
/** The response whose body did not parse, with the body as the transport returned it. */
|
|
10
|
+
response: HttpResponse;
|
|
11
|
+
cause: Error;
|
|
12
|
+
constructor(response: HttpResponse, cause: Error);
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when a response body does not parse as its content type claims, typically a JSON document cut short by a
|
|
3
|
+
* connection dropped mid-response. The client retries such requests, so the error surfaces once the retries are
|
|
4
|
+
* exhausted.
|
|
5
|
+
*/
|
|
6
|
+
export class InvalidResponseBodyError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
/** The response whose body did not parse, with the body as the transport returned it. */
|
|
9
|
+
response;
|
|
10
|
+
constructor(response, cause) {
|
|
11
|
+
super(`Response body could not be parsed.\nCause:${cause.message}`);
|
|
12
|
+
this.name = this.constructor.name;
|
|
13
|
+
this.code = 'invalid-response-body';
|
|
14
|
+
this.response = response;
|
|
15
|
+
this.cause = cause;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps the construction of a zod schema so it runs on the first call and only once.
|
|
3
|
+
*
|
|
4
|
+
* The generated response schemas are exported this way: a couple of hundred `z.looseObject()` calls at import time
|
|
5
|
+
* would cost more than importing zod itself, so each schema is built by the first response validated against it and
|
|
6
|
+
* kept for the rest of the process.
|
|
7
|
+
*/
|
|
8
|
+
export declare function lazySchema<T>(build: () => T): () => T;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps the construction of a zod schema so it runs on the first call and only once.
|
|
3
|
+
*
|
|
4
|
+
* The generated response schemas are exported this way: a couple of hundred `z.looseObject()` calls at import time
|
|
5
|
+
* would cost more than importing zod itself, so each schema is built by the first response validated against it and
|
|
6
|
+
* kept for the rest of the process.
|
|
7
|
+
*/
|
|
8
|
+
export function lazySchema(build) {
|
|
9
|
+
let schema;
|
|
10
|
+
return () => (schema ??= build());
|
|
11
|
+
}
|
package/dist/models.d.ts
CHANGED
|
@@ -48,6 +48,12 @@ export declare enum WebhookDispatchStatus {
|
|
|
48
48
|
Succeeded = "SUCCEEDED",
|
|
49
49
|
Failed = "FAILED"
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Machine-readable type of an error returned by the Apify API, carried by `ApifyApiError.type`.
|
|
53
|
+
*
|
|
54
|
+
* Declared here, next to the other spec-derived types, and re-exported from `./apify_api_error`.
|
|
55
|
+
*/
|
|
56
|
+
export type ApifyApiErrorType = Schemas['ErrorType'];
|
|
51
57
|
/**
|
|
52
58
|
* Fields the API returns on a dataset that the OpenAPI spec does not describe yet.
|
|
53
59
|
*
|
|
@@ -59,9 +65,9 @@ export interface DatasetSpecGaps {
|
|
|
59
65
|
}
|
|
60
66
|
export interface DatasetRePointed {
|
|
61
67
|
stats?: DatasetStats;
|
|
68
|
+
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
62
69
|
}
|
|
63
70
|
export interface DatasetSpecNarrowings {
|
|
64
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
65
71
|
consoleUrl?: string;
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
@@ -145,8 +151,6 @@ export interface KeyValueStoreSpecGaps {
|
|
|
145
151
|
}
|
|
146
152
|
export interface KeyValueStoreRePointed {
|
|
147
153
|
stats?: KeyValueStoreStats;
|
|
148
|
-
}
|
|
149
|
-
export interface KeyValueStoreSpecNarrowings {
|
|
150
154
|
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
151
155
|
}
|
|
152
156
|
/**
|
|
@@ -155,7 +159,7 @@ export interface KeyValueStoreSpecNarrowings {
|
|
|
155
159
|
* Key-value stores are used to store arbitrary data records or files. Each record is identified
|
|
156
160
|
* by a unique key and can contain any data - JSON objects, strings, binary files, etc.
|
|
157
161
|
*/
|
|
158
|
-
export interface KeyValueStore extends Omit<Schemas['KeyValueStore'], keyof KeyValueStoreRePointed
|
|
162
|
+
export interface KeyValueStore extends Omit<Schemas['KeyValueStore'], keyof KeyValueStoreRePointed>, KeyValueStoreRePointed, KeyValueStoreSpecGaps {
|
|
159
163
|
}
|
|
160
164
|
/** Statistics about Key-Value Store usage and storage. */
|
|
161
165
|
export interface KeyValueStoreStats extends GeneratedKeyValueStoreStats {
|
|
@@ -215,7 +219,7 @@ export interface ActorVersionRePointed {
|
|
|
215
219
|
envVars?: ActorEnvironmentVariable[] | null;
|
|
216
220
|
}
|
|
217
221
|
export interface ActorVersionClientNarrowings {
|
|
218
|
-
sourceType: ActorSourceType
|
|
222
|
+
sourceType: `${ActorSourceType}`;
|
|
219
223
|
}
|
|
220
224
|
/**
|
|
221
225
|
* Fields every Actor version carries, whatever its source type.
|
|
@@ -224,26 +228,26 @@ export interface ActorVersionClientNarrowings {
|
|
|
224
228
|
* keeps a union discriminated on `sourceType` instead, because that narrows the source location down
|
|
225
229
|
* to the single field which applies -- so the four are dropped here and reinstated per variant.
|
|
226
230
|
*/
|
|
227
|
-
export interface BaseActorVersion<SourceType extends ActorSourceType
|
|
231
|
+
export interface BaseActorVersion<SourceType extends `${ActorSourceType}`> extends Omit<GeneratedVersion, keyof ActorVersionClientNarrowings | keyof ActorVersionRePointed | ActorVersionSourceLocation>, ActorVersionRePointed {
|
|
228
232
|
sourceType: SourceType;
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
235
|
* An Actor version whose source code is stored on the Apify platform.
|
|
232
236
|
* @since Added in 2.6.1
|
|
233
237
|
*/
|
|
234
|
-
export interface ActorVersionSourceFiles extends BaseActorVersion
|
|
238
|
+
export interface ActorVersionSourceFiles extends BaseActorVersion<`${ActorSourceType.SourceFiles}`> {
|
|
235
239
|
sourceFiles: (ActorVersionSourceFile | ActorVersionSourceFolder)[];
|
|
236
240
|
}
|
|
237
241
|
/** An Actor version built from a Git repository. */
|
|
238
|
-
export interface ActorVersionGitRepo extends BaseActorVersion
|
|
242
|
+
export interface ActorVersionGitRepo extends BaseActorVersion<`${ActorSourceType.GitRepo}`> {
|
|
239
243
|
gitRepoUrl: NonNullable<GeneratedVersion['gitRepoUrl']>;
|
|
240
244
|
}
|
|
241
245
|
/** An Actor version built from a downloadable tarball or ZIP archive. */
|
|
242
|
-
export interface ActorVersionTarball extends BaseActorVersion
|
|
246
|
+
export interface ActorVersionTarball extends BaseActorVersion<`${ActorSourceType.Tarball}`> {
|
|
243
247
|
tarballUrl: NonNullable<GeneratedVersion['tarballUrl']>;
|
|
244
248
|
}
|
|
245
249
|
/** An Actor version built from a GitHub Gist. */
|
|
246
|
-
export interface ActorVersionGitHubGist extends BaseActorVersion
|
|
250
|
+
export interface ActorVersionGitHubGist extends BaseActorVersion<`${ActorSourceType.GitHubGist}`> {
|
|
247
251
|
gitHubGistUrl: NonNullable<GeneratedVersion['gitHubGistUrl']>;
|
|
248
252
|
}
|
|
249
253
|
/**
|
|
@@ -252,7 +256,7 @@ export interface ActorVersionGitHubGist extends BaseActorVersion<ActorSourceType
|
|
|
252
256
|
* It carries no source location of its own, so it adds nothing to `BaseActorVersion`; the variant
|
|
253
257
|
* exists so that `SOURCE_CODE`, which both the spec and `@apify/consts` list, is representable.
|
|
254
258
|
*/
|
|
255
|
-
export interface ActorVersionSourceCode extends BaseActorVersion
|
|
259
|
+
export interface ActorVersionSourceCode extends BaseActorVersion<`${ActorSourceType.SourceCode}`> {
|
|
256
260
|
}
|
|
257
261
|
/** A version of an Actor, discriminated on where its source code comes from. */
|
|
258
262
|
export type ActorVersion = ActorVersionSourceFiles | ActorVersionGitRepo | ActorVersionTarball | ActorVersionGitHubGist | ActorVersionSourceCode;
|
|
@@ -310,11 +314,7 @@ export interface ActorDefinitionSpecGaps {
|
|
|
310
314
|
*/
|
|
311
315
|
output?: object | null;
|
|
312
316
|
}
|
|
313
|
-
|
|
314
|
-
readme?: string | null;
|
|
315
|
-
input?: object | null;
|
|
316
|
-
changelog?: string | null;
|
|
317
|
-
}
|
|
317
|
+
type GeneratedActorDefinition = Schemas['ActorDefinition'];
|
|
318
318
|
/**
|
|
319
319
|
* Actor definition from the `.actor/actor.json` file.
|
|
320
320
|
*
|
|
@@ -322,7 +322,7 @@ export interface ActorDefinitionSpecNarrowings {
|
|
|
322
322
|
* @see https://docs.apify.com/platform/actors/development/actor-definition/actor-json
|
|
323
323
|
* @since Added in 2.11.0
|
|
324
324
|
*/
|
|
325
|
-
export interface ActorDefinition extends
|
|
325
|
+
export interface ActorDefinition extends GeneratedActorDefinition, ActorDefinitionSpecGaps {
|
|
326
326
|
}
|
|
327
327
|
export interface ActorChargeEventRePointed {
|
|
328
328
|
eventTieredPricingUsd?: TieredPricingPerEvent;
|
|
@@ -571,6 +571,7 @@ export interface ActorRun extends Omit<Schemas['Run'], keyof ActorRunRePointed |
|
|
|
571
571
|
}
|
|
572
572
|
type GeneratedTaskStats = Schemas['TaskStats'];
|
|
573
573
|
type GeneratedTaskOptions = Schemas['TaskOptions'];
|
|
574
|
+
type GeneratedTaskPublicConfig = Schemas['TaskPublicConfig'];
|
|
574
575
|
type GeneratedCurrentPricingInfo = Schemas['CurrentPricingInfo'];
|
|
575
576
|
/** Statistics about Actor task usage. */
|
|
576
577
|
export interface TaskStats extends GeneratedTaskStats {
|
|
@@ -586,14 +587,7 @@ export interface TaskOptions extends GeneratedTaskOptions {
|
|
|
586
587
|
* {@apilink TaskClient.unpublish} to change the publication state.
|
|
587
588
|
* @since Added in 2.25.0
|
|
588
589
|
*/
|
|
589
|
-
export interface TaskPublicConfig {
|
|
590
|
-
publishedAt: Date | null;
|
|
591
|
-
seoTitle?: string | null;
|
|
592
|
-
seoDescription?: string | null;
|
|
593
|
-
categorization?: string | null;
|
|
594
|
-
inputSchemaFields?: string[] | null;
|
|
595
|
-
datasetName?: string | null;
|
|
596
|
-
datasetView?: string | null;
|
|
590
|
+
export interface TaskPublicConfig extends GeneratedTaskPublicConfig {
|
|
597
591
|
}
|
|
598
592
|
/**
|
|
599
593
|
* Fields the API returns on a task that the OpenAPI spec does not describe yet.
|
|
@@ -602,23 +596,12 @@ export interface TaskPublicConfig {
|
|
|
602
596
|
*/
|
|
603
597
|
export interface TaskSpecGaps {
|
|
604
598
|
description?: string;
|
|
605
|
-
/**
|
|
606
|
-
* Whether the task is published on its public landing page. Derived from
|
|
607
|
-
* `publicConfig.publishedAt` -- set it on update to publish or unpublish the task.
|
|
608
|
-
* @since Added in 2.25.0
|
|
609
|
-
*/
|
|
610
|
-
isPublic?: boolean;
|
|
611
|
-
/**
|
|
612
|
-
* @since Added in 2.25.0
|
|
613
|
-
*/
|
|
614
|
-
publicConfig?: TaskPublicConfig | null;
|
|
615
599
|
}
|
|
616
600
|
export interface TaskRePointed {
|
|
617
601
|
stats?: TaskStats | null;
|
|
618
602
|
options?: TaskOptions | null;
|
|
619
603
|
actorStandby?: ActorStandby | null;
|
|
620
|
-
|
|
621
|
-
export interface TaskSpecNarrowings {
|
|
604
|
+
publicConfig?: TaskPublicConfig | null;
|
|
622
605
|
input?: Dictionary | Dictionary[] | null;
|
|
623
606
|
}
|
|
624
607
|
/**
|
|
@@ -627,7 +610,7 @@ export interface TaskSpecNarrowings {
|
|
|
627
610
|
* Tasks are saved Actor configurations with input and settings that can be executed
|
|
628
611
|
* repeatedly without having to specify the full input each time.
|
|
629
612
|
*/
|
|
630
|
-
export interface Task extends Omit<Schemas['Task'], keyof TaskRePointed
|
|
613
|
+
export interface Task extends Omit<Schemas['Task'], keyof TaskRePointed>, TaskRePointed, TaskSpecGaps {
|
|
631
614
|
}
|
|
632
615
|
export interface TaskListRePointed {
|
|
633
616
|
stats?: TaskStats | null;
|
|
@@ -756,7 +739,7 @@ export interface ScheduledActorRunInput extends GeneratedScheduleActionRunInput
|
|
|
756
739
|
export interface ScheduledActorRunOptions extends GeneratedTaskOptions {
|
|
757
740
|
}
|
|
758
741
|
export interface ScheduleActionRunActorRePointed {
|
|
759
|
-
type: ScheduleActions.RunActor
|
|
742
|
+
type: `${ScheduleActions.RunActor}`;
|
|
760
743
|
runInput?: ScheduledActorRunInput | null;
|
|
761
744
|
runOptions?: ScheduledActorRunOptions | null;
|
|
762
745
|
}
|
|
@@ -764,13 +747,17 @@ export interface ScheduleActionRunActorRePointed {
|
|
|
764
747
|
export interface ScheduleActionRunActor extends Omit<Schemas['ScheduleActionRunActor'], keyof ScheduleActionRunActorRePointed>, ScheduleActionRunActorRePointed {
|
|
765
748
|
}
|
|
766
749
|
export interface ScheduleActionRunActorTaskRePointed {
|
|
767
|
-
type: ScheduleActions.RunActorTask
|
|
750
|
+
type: `${ScheduleActions.RunActorTask}`;
|
|
768
751
|
}
|
|
769
752
|
/** Scheduled action to run an Actor task. */
|
|
770
753
|
export interface ScheduleActionRunActorTask extends Omit<Schemas['ScheduleActionRunActorTask'], keyof ScheduleActionRunActorTaskRePointed>, ScheduleActionRunActorTaskRePointed {
|
|
771
754
|
}
|
|
772
755
|
/** Union type representing all possible scheduled actions. */
|
|
773
756
|
export type ScheduleAction = ScheduleActionRunActor | ScheduleActionRunActorTask;
|
|
757
|
+
type GeneratedScheduleInvoked = Schemas['ScheduleInvoked'];
|
|
758
|
+
/** One entry of a schedule's log: an invocation of the schedule and how it went. */
|
|
759
|
+
export interface ScheduleInvoked extends GeneratedScheduleInvoked {
|
|
760
|
+
}
|
|
774
761
|
export interface ScheduleRePointed {
|
|
775
762
|
actions: ScheduleAction[];
|
|
776
763
|
}
|
|
@@ -850,11 +837,8 @@ export interface UserPlan extends Omit<Schemas['Plan'], keyof UserPlanRePointed>
|
|
|
850
837
|
export interface UserRePointed {
|
|
851
838
|
profile?: UserProfile;
|
|
852
839
|
proxy?: UserProxy;
|
|
853
|
-
}
|
|
854
|
-
export interface UserSpecNarrowings {
|
|
855
840
|
plan?: UserPlan;
|
|
856
841
|
effectivePlatformFeatures?: EffectivePlatformFeatures;
|
|
857
|
-
isPaying?: boolean;
|
|
858
842
|
}
|
|
859
843
|
/**
|
|
860
844
|
* A user account.
|
|
@@ -862,7 +846,7 @@ export interface UserSpecNarrowings {
|
|
|
862
846
|
* The private fields are only populated for `GET /v2/users/me`, which needs a token; the public
|
|
863
847
|
* endpoint returns the username and profile alone.
|
|
864
848
|
*/
|
|
865
|
-
export interface User extends Omit<Schemas['UserPrivateInfo'], keyof UserRePointed
|
|
849
|
+
export interface User extends Omit<Schemas['UserPrivateInfo'], keyof UserRePointed>, UserRePointed {
|
|
866
850
|
}
|
|
867
851
|
/**
|
|
868
852
|
* The start and end of a billing cycle.
|
|
@@ -897,11 +881,8 @@ export interface ServiceUsage {
|
|
|
897
881
|
export interface DailyServiceUsageRePointed {
|
|
898
882
|
serviceUsage: ServiceUsage;
|
|
899
883
|
}
|
|
900
|
-
export interface DailyServiceUsageClientConversions {
|
|
901
|
-
date: Date;
|
|
902
|
-
}
|
|
903
884
|
/** A single day's usage within a monthly cycle. The spec names this schema `DailyServiceUsages`. */
|
|
904
|
-
export interface DailyServiceUsage extends Omit<Schemas['DailyServiceUsages'], keyof DailyServiceUsageRePointed
|
|
885
|
+
export interface DailyServiceUsage extends Omit<Schemas['DailyServiceUsages'], keyof DailyServiceUsageRePointed>, DailyServiceUsageRePointed {
|
|
905
886
|
}
|
|
906
887
|
export interface MonthlyUsageRePointed {
|
|
907
888
|
usageCycle: UsageCycle;
|
|
@@ -954,21 +935,20 @@ export interface RequestQueueStats extends GeneratedRequestQueueStats {
|
|
|
954
935
|
/**
|
|
955
936
|
* Fields the API returns on a request queue that the OpenAPI spec does not describe yet.
|
|
956
937
|
*
|
|
957
|
-
* The spec does carry `username`
|
|
958
|
-
*
|
|
938
|
+
* The spec does carry `username` on `RequestQueueShort`, the listing shape, and simply omits it from the
|
|
939
|
+
* full `RequestQueue` schema. `title` is absent from either.
|
|
959
940
|
*
|
|
960
941
|
* TODO: Remove once the spec covers them.
|
|
961
942
|
*/
|
|
962
943
|
export interface RequestQueueSpecGaps {
|
|
963
944
|
title?: string;
|
|
964
945
|
username?: string;
|
|
965
|
-
expireAt?: Date;
|
|
966
946
|
}
|
|
967
947
|
export interface RequestQueueRePointed {
|
|
968
948
|
stats?: RequestQueueStats;
|
|
949
|
+
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
969
950
|
}
|
|
970
951
|
export interface RequestQueueSpecNarrowings {
|
|
971
|
-
generalAccess?: STORAGE_GENERAL_ACCESS | null;
|
|
972
952
|
consoleUrl?: string;
|
|
973
953
|
}
|
|
974
954
|
/**
|