apify-client 2.23.5-beta.25 → 2.23.5-beta.27
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/bundle.js +61 -23
- package/dist/bundle.js.map +1 -1
- package/dist/interceptors.js +6 -6
- package/dist/resource_clients/actor.d.ts +1 -1
- package/dist/resource_clients/actor.js +1 -1
- package/dist/utils.d.ts +7 -2
- package/dist/utils.js +50 -17
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -13221,13 +13221,13 @@ function ensureHeadersPrototype(config) {
|
|
|
13221
13221
|
return typeof value === 'function' ? value.toString() : value;
|
|
13222
13222
|
});
|
|
13223
13223
|
}
|
|
13224
|
-
async function
|
|
13224
|
+
async function maybeCompressRequest(config) {
|
|
13225
13225
|
if (config.headers?.['content-encoding']) return config;
|
|
13226
|
-
const
|
|
13227
|
-
if (
|
|
13226
|
+
const maybeCompressed = await (0,_utils__rspack_import_2.maybeCompressValue)(config.data);
|
|
13227
|
+
if (maybeCompressed) {
|
|
13228
13228
|
config.headers ??= {};
|
|
13229
|
-
config.headers['content-encoding'] =
|
|
13230
|
-
config.data =
|
|
13229
|
+
config.headers['content-encoding'] = maybeCompressed.encoding;
|
|
13230
|
+
config.data = maybeCompressed.data;
|
|
13231
13231
|
}
|
|
13232
13232
|
return config;
|
|
13233
13233
|
}
|
|
@@ -13253,7 +13253,7 @@ function parseResponseData(response) {
|
|
|
13253
13253
|
return response;
|
|
13254
13254
|
}
|
|
13255
13255
|
const requestInterceptors = [
|
|
13256
|
-
|
|
13256
|
+
maybeCompressRequest,
|
|
13257
13257
|
serializeRequest,
|
|
13258
13258
|
ensureHeadersPrototype
|
|
13259
13259
|
];
|
|
@@ -13514,7 +13514,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
13514
13514
|
* (e.g., `'latest'` or `'1.2.345'`). If not provided, uses the default build.
|
|
13515
13515
|
* @param options.contentType - Content type of the input. If specified, input must be a string or Buffer.
|
|
13516
13516
|
* @returns `true` if the input is valid. Invalid input causes the underlying API call to throw an `ApifyApiError`.
|
|
13517
|
-
* @see https://docs.apify.com/api/v2/act-input-
|
|
13517
|
+
* @see https://docs.apify.com/api/v2/act-validate-input-post
|
|
13518
13518
|
*
|
|
13519
13519
|
* @example
|
|
13520
13520
|
* ```javascript
|
|
@@ -17961,7 +17961,7 @@ let _computedKey;
|
|
|
17961
17961
|
const NOT_FOUND_STATUS_CODE = 404;
|
|
17962
17962
|
const RECORD_NOT_FOUND_TYPE = 'record-not-found';
|
|
17963
17963
|
const RECORD_OR_TOKEN_NOT_FOUND_TYPE = 'record-or-token-not-found';
|
|
17964
|
-
const
|
|
17964
|
+
const MIN_COMPRESS_BYTES = 1024;
|
|
17965
17965
|
/**
|
|
17966
17966
|
* Returns object's 'data' property or throws if parameter is not an object,
|
|
17967
17967
|
* or an object without a 'data' property.
|
|
@@ -18031,23 +18031,61 @@ const MIN_GZIP_BYTES = 1024;
|
|
|
18031
18031
|
}
|
|
18032
18032
|
let gzipPromisified;
|
|
18033
18033
|
/**
|
|
18034
|
-
* Gzip provided value
|
|
18035
|
-
*/ async function
|
|
18036
|
-
if (!
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18034
|
+
* Gzip-compress the provided value.
|
|
18035
|
+
*/ async function gzipValue(value) {
|
|
18036
|
+
if (!gzipPromisified) {
|
|
18037
|
+
const { promisify } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 6029, 23));
|
|
18038
|
+
const { gzip } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 1134, 23));
|
|
18039
|
+
gzipPromisified = promisify(gzip);
|
|
18040
|
+
}
|
|
18041
|
+
return gzipPromisified(value);
|
|
18042
|
+
}
|
|
18043
|
+
// null = confirmed unavailable; undefined = not yet checked
|
|
18044
|
+
let brotliCompressPromisified;
|
|
18045
|
+
/**
|
|
18046
|
+
* Brotli-compress the provided value, or return undefined if brotli is unavailable
|
|
18047
|
+
* (Node.js < v10.16.0), this is a strict defensive guard.
|
|
18048
|
+
*/ async function maybeBrotliValue(value) {
|
|
18049
|
+
if (brotliCompressPromisified === undefined) {
|
|
18050
|
+
const { promisify } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 6029, 23));
|
|
18051
|
+
const { brotliCompress, constants } = await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 1134, 23));
|
|
18052
|
+
if (typeof brotliCompress === 'function') {
|
|
18053
|
+
const compress = promisify(brotliCompress);
|
|
18054
|
+
brotliCompressPromisified = async (value)=>compress(value, {
|
|
18055
|
+
params: {
|
|
18056
|
+
[constants.BROTLI_PARAM_QUALITY]: 6
|
|
18057
|
+
}
|
|
18058
|
+
});
|
|
18059
|
+
} else {
|
|
18060
|
+
brotliCompressPromisified = null;
|
|
18046
18061
|
}
|
|
18047
|
-
|
|
18062
|
+
}
|
|
18063
|
+
if (brotliCompressPromisified !== null) {
|
|
18064
|
+
return brotliCompressPromisified(value);
|
|
18048
18065
|
}
|
|
18049
18066
|
return undefined;
|
|
18050
18067
|
}
|
|
18068
|
+
/**
|
|
18069
|
+
* Compress the passed value using brotli if available or using gzip as a fallback. Returns undefined
|
|
18070
|
+
* if the data is too small / wrong type.
|
|
18071
|
+
*/ async function maybeCompressValue(value) {
|
|
18072
|
+
if (!isNode()) return undefined;
|
|
18073
|
+
// Request compression is not that important so let's
|
|
18074
|
+
// skip it instead of throwing for unsupported types.
|
|
18075
|
+
if (typeof value !== 'string' && !Buffer.isBuffer(value)) return undefined;
|
|
18076
|
+
const areDataLargeEnough = Buffer.byteLength(value) >= MIN_COMPRESS_BYTES;
|
|
18077
|
+
if (!areDataLargeEnough) return undefined;
|
|
18078
|
+
const brotli = await maybeBrotliValue(value);
|
|
18079
|
+
if (brotli) return {
|
|
18080
|
+
data: brotli,
|
|
18081
|
+
encoding: 'br'
|
|
18082
|
+
};
|
|
18083
|
+
const gzipped = await gzipValue(value);
|
|
18084
|
+
return {
|
|
18085
|
+
data: gzipped,
|
|
18086
|
+
encoding: 'gzip'
|
|
18087
|
+
};
|
|
18088
|
+
}
|
|
18051
18089
|
/**
|
|
18052
18090
|
* Helper function slice the items from array to fit the max byte length.
|
|
18053
18091
|
*/ function sliceArrayByByteLength(array, maxByteLength, startIndex) {
|
|
@@ -18084,7 +18122,7 @@ function isStream(value) {
|
|
|
18084
18122
|
function getVersionData() {
|
|
18085
18123
|
if (true) {
|
|
18086
18124
|
return {
|
|
18087
|
-
version: "2.23.5-beta.
|
|
18125
|
+
version: "2.23.5-beta.27"
|
|
18088
18126
|
};
|
|
18089
18127
|
}
|
|
18090
18128
|
// eslint-disable-next-line
|
|
@@ -18179,7 +18217,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
18179
18217
|
isBuffer: () => (isBuffer),
|
|
18180
18218
|
isNode: () => (isNode),
|
|
18181
18219
|
isStream: () => (isStream),
|
|
18182
|
-
|
|
18220
|
+
maybeCompressValue: () => (maybeCompressValue),
|
|
18183
18221
|
parseDateFields: () => (parseDateFields),
|
|
18184
18222
|
pluckData: () => (pluckData),
|
|
18185
18223
|
sliceArrayByByteLength: () => (sliceArrayByByteLength),
|