apify-client 3.0.0-beta.21 → 3.0.0-beta.23
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.d.ts +9 -0
- package/dist/apify_client.js +4 -1
- package/dist/bundle.js +11 -11
- package/dist/bundle.js.map +1 -1
- package/dist/http_client.d.ts +7 -0
- package/dist/http_client.js +8 -2
- 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 +1 -0
- package/dist/index.js +1 -0
- package/dist/interceptors.d.ts +8 -1
- package/dist/interceptors.js +43 -13
- package/dist/resource_clients/dataset.d.ts +8 -10
- package/dist/resource_clients/dataset.js +8 -10
- package/dist/runtime/node.js +10 -19
- package/dist/runtime/types.d.ts +12 -10
- package/dist/runtime/web.js +4 -3
- package/dist/utils.d.ts +13 -6
- package/dist/utils.js +9 -15
- package/package.json +1 -1
package/dist/apify_client.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { SetStatusMessageOptions } from '@crawlee/types';
|
|
2
2
|
import type { Log } from '@apify/log';
|
|
3
3
|
import { HttpClient } from './http_client.js';
|
|
4
|
+
import type { HttpCompressor } from './http_compressors/base.js';
|
|
5
|
+
import type { HttpCompressionAlgorithm } from './http_compressors/resolve.js';
|
|
4
6
|
import type { RequestInterceptorFunction } from './interceptors.js';
|
|
5
7
|
import { ActorClient } from './resource_clients/actor.js';
|
|
6
8
|
import { ActorCollectionClient } from './resource_clients/actor_collection.js';
|
|
@@ -353,6 +355,13 @@ export declare class ApifyClient {
|
|
|
353
355
|
export interface ApifyClientOptions {
|
|
354
356
|
/** @default https://api.apify.com */
|
|
355
357
|
baseUrl?: string;
|
|
358
|
+
/**
|
|
359
|
+
* Compression of request bodies: the name of a built-in algorithm, or an {@link HttpCompressor} for a custom
|
|
360
|
+
* quality or algorithm. Bodies are compressed only in Node.js, and only when they are large enough to benefit
|
|
361
|
+
* and their content type does not already carry its own compression.
|
|
362
|
+
* @default 'brotli'
|
|
363
|
+
*/
|
|
364
|
+
compression?: HttpCompressionAlgorithm | HttpCompressor;
|
|
356
365
|
/**
|
|
357
366
|
* @default https://api.apify.com
|
|
358
367
|
* @since Added in 2.17.0
|
package/dist/apify_client.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ACTOR_ENV_VARS, ME_USER_NAME_PLACEHOLDER } from '@apify/consts';
|
|
3
3
|
import logger from '@apify/log';
|
|
4
4
|
import { HttpClient } from './http_client.js';
|
|
5
|
+
import { compressionSchema, resolveCompressor } from './http_compressors/resolve.js';
|
|
5
6
|
import { ActorClient } from './resource_clients/actor.js';
|
|
6
7
|
import { ActorCollectionClient } from './resource_clients/actor_collection.js';
|
|
7
8
|
import { BuildClient } from './resource_clients/build.js';
|
|
@@ -30,6 +31,7 @@ import { DEFAULT_TIMEOUT_LONG_SECS, DEFAULT_TIMEOUT_MAX_SECS, DEFAULT_TIMEOUT_ME
|
|
|
30
31
|
import { getEnv, parseArgument } from './utils.js';
|
|
31
32
|
const clientOptionsSchema = z.strictObject({
|
|
32
33
|
baseUrl: z.string().default('https://api.apify.com'),
|
|
34
|
+
compression: compressionSchema.default('brotli'),
|
|
33
35
|
publicBaseUrl: z.string().default('https://api.apify.com'),
|
|
34
36
|
maxRetries: z.number().default(8),
|
|
35
37
|
minDelayBetweenRetriesMillis: z.number().default(500),
|
|
@@ -79,7 +81,7 @@ export class ApifyClient {
|
|
|
79
81
|
httpClient;
|
|
80
82
|
constructor(options = {}) {
|
|
81
83
|
const parsed = parseArgument(options, clientOptionsSchema, 'ApifyClientOptions');
|
|
82
|
-
const { baseUrl, publicBaseUrl, maxRetries, minDelayBetweenRetriesMillis, requestInterceptors, timeoutShortSecs, timeoutMediumSecs, timeoutLongSecs, timeoutMaxSecs, token, } = parsed;
|
|
84
|
+
const { baseUrl, compression, publicBaseUrl, maxRetries, minDelayBetweenRetriesMillis, requestInterceptors, timeoutShortSecs, timeoutMediumSecs, timeoutLongSecs, timeoutMaxSecs, token, } = parsed;
|
|
83
85
|
const tempBaseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, baseUrl.length - 1) : baseUrl;
|
|
84
86
|
this.baseUrl = `${tempBaseUrl}/v2`;
|
|
85
87
|
const tempPublicBaseUrl = publicBaseUrl.endsWith('/')
|
|
@@ -94,6 +96,7 @@ export class ApifyClient {
|
|
|
94
96
|
maxRetries,
|
|
95
97
|
minDelayBetweenRetriesMillis,
|
|
96
98
|
requestInterceptors,
|
|
99
|
+
httpCompressor: resolveCompressor(compression),
|
|
97
100
|
timeoutShortSecs,
|
|
98
101
|
timeoutMediumSecs,
|
|
99
102
|
timeoutLongSecs,
|