apify-client 2.22.1 → 2.22.2-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/bundle.js +155 -188
- package/dist/bundle.js.map +1 -1
- package/dist/http_client.d.ts +4 -0
- package/dist/http_client.d.ts.map +1 -1
- package/dist/http_client.js +72 -47
- package/dist/http_client.js.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +12 -2
- package/dist/utils.js.map +1 -1
- package/package.json +112 -104
package/dist/bundle.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object') {
|
|
4
|
-
module.exports = factory(
|
|
4
|
+
module.exports = factory();
|
|
5
5
|
}else if(typeof define === 'function' && define.amd) {
|
|
6
6
|
|
|
7
|
-
define([
|
|
7
|
+
define([], factory);
|
|
8
8
|
|
|
9
9
|
} else if(typeof exports === 'object'){
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports["Apify"] = factory(
|
|
12
|
+
exports["Apify"] = factory();
|
|
13
13
|
|
|
14
14
|
} else {
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
root["Apify"] = factory(
|
|
17
|
+
root["Apify"] = factory();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
})(this, (
|
|
20
|
+
})(this, () => {
|
|
21
21
|
return (() => {
|
|
22
22
|
var __webpack_modules__ = ({
|
|
23
23
|
"./node_modules/ansi-colors/index.js"(module, __unused_rspack_exports, __webpack_require__) {
|
|
@@ -5203,59 +5203,6 @@ function stubFalse() {
|
|
|
5203
5203
|
module.exports = isEqual;
|
|
5204
5204
|
|
|
5205
5205
|
|
|
5206
|
-
},
|
|
5207
|
-
"./node_modules/os-browserify/browser.js"(__unused_rspack_module, exports) {
|
|
5208
|
-
exports.endianness = function () { return 'LE' };
|
|
5209
|
-
|
|
5210
|
-
exports.hostname = function () {
|
|
5211
|
-
if (typeof location !== 'undefined') {
|
|
5212
|
-
return location.hostname
|
|
5213
|
-
}
|
|
5214
|
-
else return '';
|
|
5215
|
-
};
|
|
5216
|
-
|
|
5217
|
-
exports.loadavg = function () { return [] };
|
|
5218
|
-
|
|
5219
|
-
exports.uptime = function () { return 0 };
|
|
5220
|
-
|
|
5221
|
-
exports.freemem = function () {
|
|
5222
|
-
return Number.MAX_VALUE;
|
|
5223
|
-
};
|
|
5224
|
-
|
|
5225
|
-
exports.totalmem = function () {
|
|
5226
|
-
return Number.MAX_VALUE;
|
|
5227
|
-
};
|
|
5228
|
-
|
|
5229
|
-
exports.cpus = function () { return [] };
|
|
5230
|
-
|
|
5231
|
-
exports.type = function () { return 'Browser' };
|
|
5232
|
-
|
|
5233
|
-
exports.release = function () {
|
|
5234
|
-
if (typeof navigator !== 'undefined') {
|
|
5235
|
-
return navigator.appVersion;
|
|
5236
|
-
}
|
|
5237
|
-
return '';
|
|
5238
|
-
};
|
|
5239
|
-
|
|
5240
|
-
exports.networkInterfaces
|
|
5241
|
-
= exports.getNetworkInterfaces
|
|
5242
|
-
= function () { return {} };
|
|
5243
|
-
|
|
5244
|
-
exports.arch = function () { return 'javascript' };
|
|
5245
|
-
|
|
5246
|
-
exports.platform = function () { return 'browser' };
|
|
5247
|
-
|
|
5248
|
-
exports.tmpdir = exports.tmpDir = function () {
|
|
5249
|
-
return '/tmp';
|
|
5250
|
-
};
|
|
5251
|
-
|
|
5252
|
-
exports.EOL = '\n';
|
|
5253
|
-
|
|
5254
|
-
exports.homedir = function () {
|
|
5255
|
-
return '/'
|
|
5256
|
-
};
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
5206
|
},
|
|
5260
5207
|
"./node_modules/ow/dist/argument-error.js"(__unused_rspack_module, exports, __webpack_require__) {
|
|
5261
5208
|
"use strict";
|
|
@@ -11934,6 +11881,23 @@ module.exports = function (str) {
|
|
|
11934
11881
|
};
|
|
11935
11882
|
|
|
11936
11883
|
|
|
11884
|
+
},
|
|
11885
|
+
"./src lazy recursive"(module) {
|
|
11886
|
+
function webpackEmptyAsyncContext(req) {
|
|
11887
|
+
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
|
11888
|
+
// uncaught exception popping up in devtools
|
|
11889
|
+
return Promise.resolve().then(function() {
|
|
11890
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
11891
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
11892
|
+
throw e;
|
|
11893
|
+
});
|
|
11894
|
+
}
|
|
11895
|
+
webpackEmptyAsyncContext.keys = () => ([]);
|
|
11896
|
+
webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
|
|
11897
|
+
webpackEmptyAsyncContext.id = "./src lazy recursive";
|
|
11898
|
+
module.exports = webpackEmptyAsyncContext;
|
|
11899
|
+
|
|
11900
|
+
|
|
11937
11901
|
},
|
|
11938
11902
|
"./src/apify_api_error.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11939
11903
|
"use strict";
|
|
@@ -12930,17 +12894,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12930
12894
|
__webpack_require__.d(__webpack_exports__, {
|
|
12931
12895
|
HttpClient: () => (HttpClient)
|
|
12932
12896
|
});
|
|
12933
|
-
/* import */ var
|
|
12934
|
-
/* import */ var
|
|
12935
|
-
/* import */ var
|
|
12936
|
-
/* import */ var
|
|
12937
|
-
/* import */ var
|
|
12938
|
-
/* import */ var
|
|
12939
|
-
/* import */ var
|
|
12940
|
-
/* import */ var
|
|
12941
|
-
/* import */ var _apify_api_error__rspack_import_4 = __webpack_require__("./src/apify_api_error.ts");
|
|
12942
|
-
/* import */ var _interceptors__rspack_import_5 = __webpack_require__("./src/interceptors.ts");
|
|
12943
|
-
/* import */ var _utils__rspack_import_6 = __webpack_require__("./src/utils.ts");
|
|
12897
|
+
/* import */ var _swc_helpers_define_property__rspack_import_5 = __webpack_require__("./node_modules/@swc/helpers/esm/_define_property.js");
|
|
12898
|
+
/* import */ var async_retry__rspack_import_0 = __webpack_require__("./node_modules/async-retry/lib/index.js");
|
|
12899
|
+
/* import */ var async_retry__rspack_import_0_default = /*#__PURE__*/__webpack_require__.n(async_retry__rspack_import_0);
|
|
12900
|
+
/* import */ var axios__rspack_import_6 = __webpack_require__("./node_modules/axios/index.js");
|
|
12901
|
+
/* import */ var _apify_consts__rspack_import_1 = __webpack_require__("./node_modules/@apify/consts/esm/index.mjs");
|
|
12902
|
+
/* import */ var _apify_api_error__rspack_import_2 = __webpack_require__("./src/apify_api_error.ts");
|
|
12903
|
+
/* import */ var _interceptors__rspack_import_3 = __webpack_require__("./src/interceptors.ts");
|
|
12904
|
+
/* import */ var _utils__rspack_import_4 = __webpack_require__("./src/utils.ts");
|
|
12944
12905
|
/* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js");
|
|
12945
12906
|
|
|
12946
12907
|
|
|
@@ -12949,15 +12910,69 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
12949
12910
|
|
|
12950
12911
|
|
|
12951
12912
|
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
const { version } = (0,_utils__rspack_import_6.getVersionData)();
|
|
12913
|
+
const { version } = (0,_utils__rspack_import_4.getVersionData)();
|
|
12955
12914
|
const RATE_LIMIT_EXCEEDED_STATUS_CODE = 429;
|
|
12956
12915
|
class HttpClient {
|
|
12916
|
+
async ensureNodeInit() {
|
|
12917
|
+
if (!(0,_utils__rspack_import_4.isNode)()) return;
|
|
12918
|
+
this.nodeInitPromise ?? (this.nodeInitPromise = this.initNode());
|
|
12919
|
+
return this.nodeInitPromise;
|
|
12920
|
+
}
|
|
12921
|
+
async initNode() {
|
|
12922
|
+
if (!(0,_utils__rspack_import_4.isNode)()) return;
|
|
12923
|
+
const [{ ProxyAgent }, os] = await Promise.all([
|
|
12924
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
12925
|
+
(0,_utils__rspack_import_4.dynamicNodeImport)('proxy-agent'),
|
|
12926
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
12927
|
+
(0,_utils__rspack_import_4.dynamicNodeImport)('node:os')
|
|
12928
|
+
]);
|
|
12929
|
+
// We want to keep sockets alive for better performance.
|
|
12930
|
+
// Enhanced agent configuration based on agentkeepalive best practices:
|
|
12931
|
+
// - Nagle's algorithm disabled for lower latency
|
|
12932
|
+
// - Free socket timeout to prevent socket leaks
|
|
12933
|
+
// - LIFO scheduling to reuse recent sockets
|
|
12934
|
+
// - Socket TTL for connection freshness
|
|
12935
|
+
const agentOptions = {
|
|
12936
|
+
keepAlive: true,
|
|
12937
|
+
// Timeout for inactive sockets
|
|
12938
|
+
// Prevents socket leaks from idle connections
|
|
12939
|
+
timeout: this.timeoutMillis,
|
|
12940
|
+
// Keep alive timeout for free sockets (15 seconds)
|
|
12941
|
+
// Node.js will close unused sockets after this period
|
|
12942
|
+
keepAliveMsecs: 15000,
|
|
12943
|
+
// Maximum number of sockets per host
|
|
12944
|
+
maxSockets: 256,
|
|
12945
|
+
maxFreeSockets: 256,
|
|
12946
|
+
// LIFO scheduling - reuse most recently used sockets for better performance
|
|
12947
|
+
scheduling: 'lifo'
|
|
12948
|
+
};
|
|
12949
|
+
// Use ProxyAgent which automatically detects proxy from environment variables
|
|
12950
|
+
// and supports CONNECT tunneling
|
|
12951
|
+
const proxyAgent = new ProxyAgent(agentOptions);
|
|
12952
|
+
this.httpAgent = proxyAgent;
|
|
12953
|
+
this.httpsAgent = proxyAgent;
|
|
12954
|
+
// Disable Nagle's algorithm for lower latency
|
|
12955
|
+
// This sends data immediately instead of buffering small packets
|
|
12956
|
+
const setNoDelay = (socket)=>{
|
|
12957
|
+
socket.setNoDelay(true);
|
|
12958
|
+
};
|
|
12959
|
+
this.httpAgent.on('socket', setNoDelay);
|
|
12960
|
+
this.httpsAgent.on('socket', setNoDelay);
|
|
12961
|
+
this.axios.defaults.httpAgent = this.httpAgent;
|
|
12962
|
+
this.axios.defaults.httpsAgent = this.httpsAgent;
|
|
12963
|
+
// Works only in Node. Cannot be set in browser
|
|
12964
|
+
const isAtHome = !!process.env[_apify_consts__rspack_import_1.APIFY_ENV_VARS.IS_AT_HOME];
|
|
12965
|
+
let userAgent = `ApifyClient/${version} (${os.type()}; Node/${process.version}); isAtHome/${isAtHome}`;
|
|
12966
|
+
if (this.userAgentSuffix) {
|
|
12967
|
+
userAgent += `; ${(0,_utils__rspack_import_4.asArray)(this.userAgentSuffix).join('; ')}`;
|
|
12968
|
+
}
|
|
12969
|
+
this.axios.defaults.headers['User-Agent'] = userAgent;
|
|
12970
|
+
}
|
|
12957
12971
|
async call(config) {
|
|
12972
|
+
await this.ensureNodeInit();
|
|
12958
12973
|
this.stats.calls++;
|
|
12959
12974
|
const makeRequest = this._createRequestHandler(config);
|
|
12960
|
-
return
|
|
12975
|
+
return async_retry__rspack_import_0_default()(makeRequest, {
|
|
12961
12976
|
retries: this.maxRetries,
|
|
12962
12977
|
minTimeout: this.minDelayBetweenRetriesMillis,
|
|
12963
12978
|
onRetry: this._onRequestRetry
|
|
@@ -12975,7 +12990,7 @@ class HttpClient {
|
|
|
12975
12990
|
const makeRequest = async (stopTrying, attempt)=>{
|
|
12976
12991
|
this.stats.requests++;
|
|
12977
12992
|
let response;
|
|
12978
|
-
const requestIsStream = (0,
|
|
12993
|
+
const requestIsStream = (0,_utils__rspack_import_4.isStream)(config.data);
|
|
12979
12994
|
try {
|
|
12980
12995
|
if (requestIsStream) {
|
|
12981
12996
|
// Handling redirects is not possible without buffering - part of the stream has already been sent and can't be recovered
|
|
@@ -12991,12 +13006,12 @@ class HttpClient {
|
|
|
12991
13006
|
response = await this.axios.request(config);
|
|
12992
13007
|
if (this._isStatusOk(response.status)) return response;
|
|
12993
13008
|
} catch (err) {
|
|
12994
|
-
return (0,
|
|
13009
|
+
return (0,_utils__rspack_import_4.cast)(this._handleRequestError(err, config, stopTrying));
|
|
12995
13010
|
}
|
|
12996
13011
|
if (response.status === RATE_LIMIT_EXCEEDED_STATUS_CODE) {
|
|
12997
13012
|
this.stats.addRateLimitError(attempt);
|
|
12998
13013
|
}
|
|
12999
|
-
const apiError = new
|
|
13014
|
+
const apiError = new _apify_api_error__rspack_import_2.ApifyApiError(response, attempt);
|
|
13000
13015
|
if (this._isStatusCodeRetryable(response.status)) {
|
|
13001
13016
|
if (requestIsStream) {
|
|
13002
13017
|
this._informAboutStreamNoRetry();
|
|
@@ -13021,7 +13036,7 @@ class HttpClient {
|
|
|
13021
13036
|
return stopTrying(err);
|
|
13022
13037
|
}
|
|
13023
13038
|
if (this._isRetryableError(err)) {
|
|
13024
|
-
if ((0,
|
|
13039
|
+
if ((0,_utils__rspack_import_4.isStream)(config.data)) {
|
|
13025
13040
|
this._informAboutStreamNoRetry();
|
|
13026
13041
|
} else {
|
|
13027
13042
|
throw err;
|
|
@@ -13048,7 +13063,7 @@ class HttpClient {
|
|
|
13048
13063
|
* a response, the request often does not fail, but simply contains
|
|
13049
13064
|
* an incomplete response. This can often be fixed by retrying.
|
|
13050
13065
|
*/ _isResponseBodyInvalid(err) {
|
|
13051
|
-
return err instanceof
|
|
13066
|
+
return err instanceof _interceptors__rspack_import_3.InvalidResponseBodyError;
|
|
13052
13067
|
}
|
|
13053
13068
|
/**
|
|
13054
13069
|
* When a network request is attempted by axios and fails,
|
|
@@ -13074,16 +13089,18 @@ class HttpClient {
|
|
|
13074
13089
|
}
|
|
13075
13090
|
}
|
|
13076
13091
|
constructor(options){
|
|
13077
|
-
(0,
|
|
13078
|
-
(0,
|
|
13079
|
-
(0,
|
|
13080
|
-
(0,
|
|
13081
|
-
(0,
|
|
13082
|
-
(0,
|
|
13083
|
-
(0,
|
|
13084
|
-
(0,
|
|
13085
|
-
(0,
|
|
13086
|
-
(0,
|
|
13092
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "stats", void 0);
|
|
13093
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "maxRetries", void 0);
|
|
13094
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "minDelayBetweenRetriesMillis", void 0);
|
|
13095
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "userProvidedRequestInterceptors", void 0);
|
|
13096
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "logger", void 0);
|
|
13097
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "timeoutMillis", void 0);
|
|
13098
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "httpAgent", void 0);
|
|
13099
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "httpsAgent", void 0);
|
|
13100
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "axios", void 0);
|
|
13101
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "workflowKey", void 0);
|
|
13102
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "nodeInitPromise", void 0);
|
|
13103
|
+
(0,_swc_helpers_define_property__rspack_import_5._)(this, "userAgentSuffix", void 0);
|
|
13087
13104
|
const { token } = options;
|
|
13088
13105
|
this.stats = options.apifyClientStats;
|
|
13089
13106
|
this.maxRetries = options.maxRetries;
|
|
@@ -13091,45 +13108,10 @@ class HttpClient {
|
|
|
13091
13108
|
this.userProvidedRequestInterceptors = options.requestInterceptors;
|
|
13092
13109
|
this.timeoutMillis = options.timeoutSecs * 1000;
|
|
13093
13110
|
this.logger = options.logger;
|
|
13094
|
-
this.workflowKey = options.workflowKey || process.env[
|
|
13111
|
+
this.workflowKey = options.workflowKey || process.env[_apify_consts__rspack_import_1.APIFY_ENV_VARS.WORKFLOW_KEY];
|
|
13112
|
+
this.userAgentSuffix = options.userAgentSuffix;
|
|
13095
13113
|
this._onRequestRetry = this._onRequestRetry.bind(this);
|
|
13096
|
-
|
|
13097
|
-
// We want to keep sockets alive for better performance.
|
|
13098
|
-
// Enhanced agent configuration based on agentkeepalive best practices:
|
|
13099
|
-
// - Nagle's algorithm disabled for lower latency
|
|
13100
|
-
// - Free socket timeout to prevent socket leaks
|
|
13101
|
-
// - LIFO scheduling to reuse recent sockets
|
|
13102
|
-
// - Socket TTL for connection freshness
|
|
13103
|
-
const agentOptions = {
|
|
13104
|
-
keepAlive: true,
|
|
13105
|
-
// Timeout for inactive sockets
|
|
13106
|
-
// Prevents socket leaks from idle connections
|
|
13107
|
-
timeout: this.timeoutMillis,
|
|
13108
|
-
// Keep alive timeout for free sockets (15 seconds)
|
|
13109
|
-
// Node.js will close unused sockets after this period
|
|
13110
|
-
keepAliveMsecs: 15000,
|
|
13111
|
-
// Maximum number of sockets per host
|
|
13112
|
-
maxSockets: 256,
|
|
13113
|
-
maxFreeSockets: 256,
|
|
13114
|
-
// LIFO scheduling - reuse most recently used sockets for better performance
|
|
13115
|
-
scheduling: 'lifo'
|
|
13116
|
-
};
|
|
13117
|
-
// Use ProxyAgent which automatically detects proxy from environment variables
|
|
13118
|
-
// and supports CONNECT tunneling
|
|
13119
|
-
const proxyAgent = new proxy_agent__rspack_import_2.ProxyAgent(agentOptions);
|
|
13120
|
-
this.httpAgent = proxyAgent;
|
|
13121
|
-
this.httpsAgent = proxyAgent;
|
|
13122
|
-
// Disable Nagle's algorithm for lower latency
|
|
13123
|
-
// This sends data immediately instead of buffering small packets
|
|
13124
|
-
const setNoDelay = (socket)=>{
|
|
13125
|
-
socket.setNoDelay(true);
|
|
13126
|
-
};
|
|
13127
|
-
this.httpAgent.on('socket', setNoDelay);
|
|
13128
|
-
this.httpsAgent.on('socket', setNoDelay);
|
|
13129
|
-
}
|
|
13130
|
-
this.axios = axios__rspack_import_8["default"].create({
|
|
13131
|
-
httpAgent: this.httpAgent,
|
|
13132
|
-
httpsAgent: this.httpsAgent,
|
|
13114
|
+
this.axios = axios__rspack_import_6["default"].create({
|
|
13133
13115
|
// Disable axios's built-in proxy handling since we're using custom agents
|
|
13134
13116
|
proxy: false,
|
|
13135
13117
|
paramsSerializer: (params)=>{
|
|
@@ -13166,27 +13148,18 @@ class HttpClient {
|
|
|
13166
13148
|
maxContentLength: -1
|
|
13167
13149
|
});
|
|
13168
13150
|
// Clean all default headers because they only make a mess and their merging is difficult to understand and buggy.
|
|
13169
|
-
this.axios.defaults.headers = new
|
|
13151
|
+
this.axios.defaults.headers = new axios__rspack_import_6.AxiosHeaders();
|
|
13170
13152
|
// If workflow key is available, pass it as a header
|
|
13171
13153
|
if (this.workflowKey) {
|
|
13172
13154
|
this.axios.defaults.headers['X-Apify-Workflow-Key'] = this.workflowKey;
|
|
13173
13155
|
}
|
|
13174
|
-
if ((0,_utils__rspack_import_6.isNode)()) {
|
|
13175
|
-
// Works only in Node. Cannot be set in browser
|
|
13176
|
-
const isAtHome = !!process.env[_apify_consts__rspack_import_3.APIFY_ENV_VARS.IS_AT_HOME];
|
|
13177
|
-
let userAgent = `ApifyClient/${version} (${node_os__rspack_import_0.type()}; Node/${process.version}); isAtHome/${isAtHome}`;
|
|
13178
|
-
if (options.userAgentSuffix) {
|
|
13179
|
-
userAgent += `; ${(0,_utils__rspack_import_6.asArray)(options.userAgentSuffix).join('; ')}`;
|
|
13180
|
-
}
|
|
13181
|
-
this.axios.defaults.headers['User-Agent'] = userAgent;
|
|
13182
|
-
}
|
|
13183
13156
|
// Attach Authorization header for all requests if token was provided
|
|
13184
13157
|
if (token) {
|
|
13185
13158
|
this.axios.defaults.headers.Authorization = `Bearer ${token}`;
|
|
13186
13159
|
}
|
|
13187
|
-
|
|
13160
|
+
_interceptors__rspack_import_3.requestInterceptors.forEach((i)=>this.axios.interceptors.request.use(i));
|
|
13188
13161
|
this.userProvidedRequestInterceptors.forEach((i)=>this.axios.interceptors.request.use(i));
|
|
13189
|
-
|
|
13162
|
+
_interceptors__rspack_import_3.responseInterceptors.forEach((i)=>this.axios.interceptors.response.use(i));
|
|
13190
13163
|
}
|
|
13191
13164
|
}
|
|
13192
13165
|
|
|
@@ -18068,6 +18041,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
18068
18041
|
asArray: () => (asArray),
|
|
18069
18042
|
cast: () => (cast),
|
|
18070
18043
|
catchNotFoundOrThrow: () => (catchNotFoundOrThrow),
|
|
18044
|
+
dynamicNodeImport: () => (dynamicNodeImport),
|
|
18071
18045
|
getVersionData: () => (getVersionData),
|
|
18072
18046
|
isBuffer: () => (isBuffer),
|
|
18073
18047
|
isNode: () => (isNode),
|
|
@@ -18168,8 +18142,10 @@ let gzipPromisified;
|
|
|
18168
18142
|
const areDataLargeEnough = Buffer.byteLength(value) >= MIN_GZIP_BYTES;
|
|
18169
18143
|
if (areDataLargeEnough) {
|
|
18170
18144
|
if (!gzipPromisified) {
|
|
18171
|
-
|
|
18172
|
-
const {
|
|
18145
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
18146
|
+
const { promisify } = await dynamicNodeImport('node:util');
|
|
18147
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
18148
|
+
const { gzip } = await dynamicNodeImport('node:zlib');
|
|
18173
18149
|
gzipPromisified = promisify(gzip);
|
|
18174
18150
|
}
|
|
18175
18151
|
return gzipPromisified(value);
|
|
@@ -18201,6 +18177,12 @@ let gzipPromisified;
|
|
|
18201
18177
|
function isNode() {
|
|
18202
18178
|
return !!(typeof process !== 'undefined' && process.versions && process.versions.node);
|
|
18203
18179
|
}
|
|
18180
|
+
/**
|
|
18181
|
+
* Dynamic import wrapper that prevents bundlers from statically analyzing the import specifier.
|
|
18182
|
+
* Use this for Node.js-only modules that should not be included in browser bundles.
|
|
18183
|
+
*/ async function dynamicNodeImport(specifier) {
|
|
18184
|
+
return await __webpack_require__("./src lazy recursive")(specifier);
|
|
18185
|
+
}
|
|
18204
18186
|
function isBuffer(value) {
|
|
18205
18187
|
return ow__rspack_import_0_default().isValid(value, ow__rspack_import_0_default().any((ow__rspack_import_0_default().buffer), (ow__rspack_import_0_default().arrayBuffer), (ow__rspack_import_0_default().typedArray)));
|
|
18206
18188
|
}
|
|
@@ -18210,7 +18192,7 @@ function isStream(value) {
|
|
|
18210
18192
|
function getVersionData() {
|
|
18211
18193
|
if (true) {
|
|
18212
18194
|
return {
|
|
18213
|
-
version: "2.22.
|
|
18195
|
+
version: "2.22.2-beta.0"
|
|
18214
18196
|
};
|
|
18215
18197
|
}
|
|
18216
18198
|
// eslint-disable-next-line
|
|
@@ -18280,24 +18262,9 @@ function asArray(value) {
|
|
|
18280
18262
|
|
|
18281
18263
|
|
|
18282
18264
|
},
|
|
18283
|
-
"
|
|
18284
|
-
"use strict";
|
|
18285
|
-
module.exports = __rspack_external_crypto;
|
|
18286
|
-
|
|
18287
|
-
},
|
|
18288
|
-
"node:util"(module) {
|
|
18289
|
-
"use strict";
|
|
18290
|
-
module.exports = __rspack_external_node_util;
|
|
18291
|
-
|
|
18292
|
-
},
|
|
18293
|
-
"node:zlib"(module) {
|
|
18265
|
+
"?1358"() {
|
|
18294
18266
|
"use strict";
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
},
|
|
18298
|
-
"proxy-agent"(module) {
|
|
18299
|
-
"use strict";
|
|
18300
|
-
module.exports = __rspack_external_proxy_agent;
|
|
18267
|
+
/* (ignored) */
|
|
18301
18268
|
|
|
18302
18269
|
},
|
|
18303
18270
|
"?a13f"() {
|
|
@@ -19630,10 +19597,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
19630
19597
|
unescapePropertyName: () => (unescapePropertyName),
|
|
19631
19598
|
weightedAverage: () => (weightedAverage)
|
|
19632
19599
|
});
|
|
19633
|
-
/* import */ var
|
|
19634
|
-
/* import */ var
|
|
19635
|
-
/* import */ var
|
|
19636
|
-
/* import */ var
|
|
19600
|
+
/* import */ var crypto__rspack_import_3 = __webpack_require__("?1358");
|
|
19601
|
+
/* import */ var _apify_consts__rspack_import_0 = __webpack_require__("./node_modules/@apify/consts/esm/index.mjs");
|
|
19602
|
+
/* import */ var _apify_log__rspack_import_1 = __webpack_require__("./node_modules/@apify/log/esm/index.mjs");
|
|
19603
|
+
/* import */ var stream__rspack_import_2 = __webpack_require__("./node_modules/stream-browserify/index.js");
|
|
19637
19604
|
/* provided dependency */ var Buffer = __webpack_require__("./node_modules/buffer/index.js")["Buffer"];
|
|
19638
19605
|
var __defProp = Object.defineProperty;
|
|
19639
19606
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -19652,7 +19619,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
19652
19619
|
|
|
19653
19620
|
function cryptoRandomObjectId(length = 17) {
|
|
19654
19621
|
const chars = "abcdefghijklmnopqrstuvwxyzABCEDFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
19655
|
-
const bytes =
|
|
19622
|
+
const bytes = crypto__rspack_import_3.randomBytes(length);
|
|
19656
19623
|
let str = "";
|
|
19657
19624
|
for (let i = bytes.length - 1; i >= 0; i--) {
|
|
19658
19625
|
str += chars[(bytes[i] | 0) % chars.length];
|
|
@@ -19661,7 +19628,7 @@ function cryptoRandomObjectId(length = 17) {
|
|
|
19661
19628
|
}
|
|
19662
19629
|
__name(cryptoRandomObjectId, "cryptoRandomObjectId");
|
|
19663
19630
|
function deterministicUniqueId(key, length = 17) {
|
|
19664
|
-
return
|
|
19631
|
+
return crypto__rspack_import_3.createHash("sha256").update(key).digest("base64").replace(/(\+|\/|=)/g, "x").substr(0, length);
|
|
19665
19632
|
}
|
|
19666
19633
|
__name(deterministicUniqueId, "deterministicUniqueId");
|
|
19667
19634
|
function getRandomInt(maxExcluded) {
|
|
@@ -19701,7 +19668,7 @@ function http404Route(req, res) {
|
|
|
19701
19668
|
}
|
|
19702
19669
|
__name(http404Route, "http404Route");
|
|
19703
19670
|
function expressErrorHandler(err, req, res, next) {
|
|
19704
|
-
|
|
19671
|
+
_apify_log__rspack_import_1["default"].warning("Client HTTP request failed", { url: req.url, errMsg: err.message });
|
|
19705
19672
|
if (res.headersSent) {
|
|
19706
19673
|
next(err);
|
|
19707
19674
|
return;
|
|
@@ -19736,7 +19703,7 @@ function betterClearInterval(intervalID) {
|
|
|
19736
19703
|
try {
|
|
19737
19704
|
intervalID._betterClearInterval();
|
|
19738
19705
|
} catch (e) {
|
|
19739
|
-
|
|
19706
|
+
_apify_log__rspack_import_1["default"].exception(e, "_betterClearInterval() threw an exception!?");
|
|
19740
19707
|
}
|
|
19741
19708
|
}
|
|
19742
19709
|
}
|
|
@@ -20593,9 +20560,9 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
|
|
|
20593
20560
|
"yoursite",
|
|
20594
20561
|
"yourusername"
|
|
20595
20562
|
];
|
|
20596
|
-
var FORBIDDEN_REGEXP = new RegExp(`^(${
|
|
20563
|
+
var FORBIDDEN_REGEXP = new RegExp(`^(${_apify_consts__rspack_import_0.ANONYMOUS_USERNAME}|${FORBIDDEN_USERNAMES_REGEXPS.join("|")})$`, "i");
|
|
20597
20564
|
function isForbiddenUsername(username) {
|
|
20598
|
-
return !!username.match(
|
|
20565
|
+
return !!username.match(_apify_consts__rspack_import_0.APIFY_ID_REGEX) || !!username.match(FORBIDDEN_REGEXP);
|
|
20599
20566
|
}
|
|
20600
20567
|
__name(isForbiddenUsername, "isForbiddenUsername");
|
|
20601
20568
|
async function sequentializePromises(promises) {
|
|
@@ -20639,11 +20606,11 @@ __name(promisifyServerListen, "promisifyServerListen");
|
|
|
20639
20606
|
function configureLogger(givenLog, isProduction) {
|
|
20640
20607
|
if (isProduction) {
|
|
20641
20608
|
givenLog.setOptions({
|
|
20642
|
-
level:
|
|
20643
|
-
logger: new
|
|
20609
|
+
level: _apify_log__rspack_import_1.LogLevel.INFO,
|
|
20610
|
+
logger: new _apify_log__rspack_import_1.LoggerJson()
|
|
20644
20611
|
});
|
|
20645
20612
|
} else {
|
|
20646
|
-
givenLog.setOptions({ level:
|
|
20613
|
+
givenLog.setOptions({ level: _apify_log__rspack_import_1.LogLevel.DEBUG });
|
|
20647
20614
|
}
|
|
20648
20615
|
}
|
|
20649
20616
|
__name(configureLogger, "configureLogger");
|
|
@@ -20813,10 +20780,10 @@ function markedDecreaseHeadsLevel(text, level) {
|
|
|
20813
20780
|
__name(markedDecreaseHeadsLevel, "markedDecreaseHeadsLevel");
|
|
20814
20781
|
function buildOrVersionNumberIntToStr(int) {
|
|
20815
20782
|
if (typeof int !== "number" || !(int >= 0)) return null;
|
|
20816
|
-
const major = Math.floor(int /
|
|
20817
|
-
const remainder = int %
|
|
20818
|
-
const minor = Math.floor(remainder /
|
|
20819
|
-
const build = remainder %
|
|
20783
|
+
const major = Math.floor(int / _apify_consts__rspack_import_0.VERSION_INT_MAJOR_BASE);
|
|
20784
|
+
const remainder = int % _apify_consts__rspack_import_0.VERSION_INT_MAJOR_BASE;
|
|
20785
|
+
const minor = Math.floor(remainder / _apify_consts__rspack_import_0.VERSION_INT_MINOR_BASE);
|
|
20786
|
+
const build = remainder % _apify_consts__rspack_import_0.VERSION_INT_MINOR_BASE;
|
|
20820
20787
|
let str = `${major}.${minor}`;
|
|
20821
20788
|
if (build > 0) str += `.${build}`;
|
|
20822
20789
|
return str;
|
|
@@ -20951,7 +20918,7 @@ function splitFullName(fullName) {
|
|
|
20951
20918
|
}
|
|
20952
20919
|
__name(splitFullName, "splitFullName");
|
|
20953
20920
|
function isUrlRelative(url) {
|
|
20954
|
-
return
|
|
20921
|
+
return _apify_consts__rspack_import_0.RELATIVE_URL_REGEX.test(url);
|
|
20955
20922
|
}
|
|
20956
20923
|
__name(isUrlRelative, "isUrlRelative");
|
|
20957
20924
|
|
|
@@ -20994,7 +20961,7 @@ async function retryWithExpBackoff(params = {}) {
|
|
|
20994
20961
|
const rand = /* @__PURE__ */ __name((from, to) => from + Math.floor(Math.random() * (to - from + 1)), "rand");
|
|
20995
20962
|
const randomizedWaitMillis = rand(waitMillis, waitMillis * 2);
|
|
20996
20963
|
if (i === Math.round(expBackoffMaxRepeats / 2)) {
|
|
20997
|
-
|
|
20964
|
+
_apify_log__rspack_import_1["default"].warning(`Retry failed ${i} times and will be repeated in ${randomizedWaitMillis}ms`, {
|
|
20998
20965
|
originalError: error.error.message,
|
|
20999
20966
|
errorDetails: Reflect.get(error.error, "details")
|
|
21000
20967
|
});
|
|
@@ -21113,7 +21080,7 @@ var HealthChecker = _HealthChecker;
|
|
|
21113
21080
|
|
|
21114
21081
|
// src/parse_jsonl_stream.ts
|
|
21115
21082
|
|
|
21116
|
-
var _ParseJsonlStream = class _ParseJsonlStream extends
|
|
21083
|
+
var _ParseJsonlStream = class _ParseJsonlStream extends stream__rspack_import_2.Transform {
|
|
21117
21084
|
constructor() {
|
|
21118
21085
|
super(...arguments);
|
|
21119
21086
|
__publicField(this, "pendingChunk", null);
|
|
@@ -21393,13 +21360,13 @@ var ENCRYPTION_AUTH_TAG_LENGTH = 16;
|
|
|
21393
21360
|
function publicEncrypt({ publicKey, value }) {
|
|
21394
21361
|
const key = cryptoRandomObjectId(ENCRYPTION_KEY_LENGTH);
|
|
21395
21362
|
const initVector = cryptoRandomObjectId(ENCRYPTION_IV_LENGTH);
|
|
21396
|
-
const cipher =
|
|
21363
|
+
const cipher = crypto__rspack_import_3.createCipheriv(ENCRYPTION_ALGORITHM, key, initVector);
|
|
21397
21364
|
const bufferFromValue = Buffer.from(value, "utf-8");
|
|
21398
21365
|
const bufferFromKey = Buffer.from(key, "utf-8");
|
|
21399
21366
|
const bufferFromInitVector = Buffer.from(initVector, "utf-8");
|
|
21400
21367
|
const passwordBuffer = Buffer.concat([bufferFromKey, bufferFromInitVector]);
|
|
21401
21368
|
const encryptedValue = Buffer.concat([cipher.update(bufferFromValue), cipher.final(), cipher.getAuthTag()]);
|
|
21402
|
-
const encryptedPassword =
|
|
21369
|
+
const encryptedPassword = crypto__rspack_import_3.publicEncrypt(publicKey, passwordBuffer);
|
|
21403
21370
|
return {
|
|
21404
21371
|
encryptedPassword: encryptedPassword.toString("base64"),
|
|
21405
21372
|
encryptedValue: encryptedValue.toString("base64")
|
|
@@ -21413,7 +21380,7 @@ function privateDecrypt({
|
|
|
21413
21380
|
}) {
|
|
21414
21381
|
const encryptedValueBuffer = Buffer.from(encryptedValue, "base64");
|
|
21415
21382
|
const encryptedPasswordBuffer = Buffer.from(encryptedPassword, "base64");
|
|
21416
|
-
const passwordBuffer =
|
|
21383
|
+
const passwordBuffer = crypto__rspack_import_3.privateDecrypt(privateKey, encryptedPasswordBuffer);
|
|
21417
21384
|
if (passwordBuffer.length !== ENCRYPTION_KEY_LENGTH + ENCRYPTION_IV_LENGTH) {
|
|
21418
21385
|
throw new Error("privateDecrypt: Decryption failed, invalid password length!");
|
|
21419
21386
|
}
|
|
@@ -21421,7 +21388,7 @@ function privateDecrypt({
|
|
|
21421
21388
|
const encryptedDataBuffer = encryptedValueBuffer.slice(0, encryptedValueBuffer.length - ENCRYPTION_AUTH_TAG_LENGTH);
|
|
21422
21389
|
const encryptionKeyBuffer = passwordBuffer.slice(0, ENCRYPTION_KEY_LENGTH);
|
|
21423
21390
|
const initVectorBuffer = passwordBuffer.slice(ENCRYPTION_KEY_LENGTH);
|
|
21424
|
-
const decipher =
|
|
21391
|
+
const decipher = crypto__rspack_import_3.createDecipheriv(ENCRYPTION_ALGORITHM, encryptionKeyBuffer, initVectorBuffer);
|
|
21425
21392
|
decipher.setAuthTag(authTagBuffer);
|
|
21426
21393
|
return Buffer.concat([decipher.update(encryptedDataBuffer), decipher.final()]).toString("utf-8");
|
|
21427
21394
|
}
|
|
@@ -21471,7 +21438,7 @@ var _CodeHashManager = class _CodeHashManager {
|
|
|
21471
21438
|
const data = JSON.parse(this.fromBase64(parts[1]).toString());
|
|
21472
21439
|
const signature = this.fromBase64(parts[2]);
|
|
21473
21440
|
const expectedSignature = this.generateSignature(dataToSign);
|
|
21474
|
-
const isSignatureValid = (0,
|
|
21441
|
+
const isSignatureValid = (0,crypto__rspack_import_3.timingSafeEqual)(signature, expectedSignature);
|
|
21475
21442
|
return {
|
|
21476
21443
|
data,
|
|
21477
21444
|
meta: {
|
|
@@ -21488,7 +21455,7 @@ var _CodeHashManager = class _CodeHashManager {
|
|
|
21488
21455
|
return Buffer.from(encoded, "base64url");
|
|
21489
21456
|
}
|
|
21490
21457
|
generateSignature(data) {
|
|
21491
|
-
return (0,
|
|
21458
|
+
return (0,crypto__rspack_import_3.createHmac)("sha256", this.secret).update(data).digest();
|
|
21492
21459
|
}
|
|
21493
21460
|
};
|
|
21494
21461
|
__name(_CodeHashManager, "CodeHashManager");
|
|
@@ -21512,7 +21479,7 @@ function encodeBase62(num) {
|
|
|
21512
21479
|
}
|
|
21513
21480
|
__name(encodeBase62, "encodeBase62");
|
|
21514
21481
|
function createHmacSignature(secretKey, message) {
|
|
21515
|
-
const signature =
|
|
21482
|
+
const signature = crypto__rspack_import_3.createHmac("sha256", secretKey).update(message).digest("hex").substring(0, 30);
|
|
21516
21483
|
return encodeBase62(BigInt(`0x${signature}`));
|
|
21517
21484
|
}
|
|
21518
21485
|
__name(createHmacSignature, "createHmacSignature");
|
|
@@ -21525,7 +21492,7 @@ async function ensureSubtleCryptoExists() {
|
|
|
21525
21492
|
} catch {
|
|
21526
21493
|
}
|
|
21527
21494
|
try {
|
|
21528
|
-
subtleCrypto = (await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, "
|
|
21495
|
+
subtleCrypto = (await Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, "?1358", 19)))?.webcrypto?.subtle;
|
|
21529
21496
|
} catch {
|
|
21530
21497
|
}
|
|
21531
21498
|
if (!subtleCrypto) {
|
|
@@ -26409,7 +26376,7 @@ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
|
26409
26376
|
},
|
|
26410
26377
|
"./package.json"(module) {
|
|
26411
26378
|
"use strict";
|
|
26412
|
-
module.exports = JSON.parse('{"name":"apify-client","version":"2.22.
|
|
26379
|
+
module.exports = JSON.parse('{"name":"apify-client","version":"2.22.2-beta.0","description":"Apify API client for JavaScript","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","browser":"dist/bundle.js","unpkg":"dist/bundle.js","exports":{"./package.json":"./package.json","./browser":"./dist/bundle.js",".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts","browser":"./dist/bundle.js"}},"keywords":["apify","api","apifier","crawler","scraper"],"author":{"name":"Apify","email":"support@apify.com","url":"https://apify.com"},"contributors":["Jan Curn <jan@apify.com>","Marek Trunkát <marek@apify.com>","Ondra Urban <ondra@apify.com>","Jakub Drobník <jakub.drobnik@apify.com>"],"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/apify/apify-client-js"},"bugs":{"url":"https://github.com/apify/apify-client-js/issues"},"homepage":"https://docs.apify.com/api/client/js/","files":["dist","!dist/*.tsbuildinfo"],"scripts":{"build":"npm run clean && npm run build:node && npm run build:browser","postbuild":"gen-esm-wrapper dist/index.js dist/index.mjs","prepublishOnly":"(test $CI || (echo \\"Publishing is reserved to CI!\\"; exit 1))","clean":"rimraf dist","test":"npm run build && vitest run","test:bundling":"npm run build && npm --prefix=./test/bundling run bundle:all","lint":"eslint","lint:fix":"eslint --fix","tsc-check-tests":"tsc --noEmit --project test/tsconfig.json","format":"prettier --write .","format:check":"prettier --check .","build:node":"tsc","build:browser":"rsbuild build"},"dependencies":{"@apify/consts":"^2.50.0","@apify/log":"^2.2.6","@apify/utilities":"^2.23.2","@crawlee/types":"^3.3.0","ansi-colors":"^4.1.1","async-retry":"^1.3.3","axios":"^1.6.7","content-type":"^1.0.5","ow":"^0.28.2","proxy-agent":"^6.5.0","tslib":"^2.5.0","type-fest":"^4.0.0"},"devDependencies":{"@apify/eslint-config":"^1.0.0","@apify/tsconfig":"^0.1.1","@crawlee/puppeteer":"^3.2.2","@rsbuild/core":"^1.3.6","@rsbuild/plugin-node-polyfill":"^1.3.0","@rspack/cli":"^1.7.6","@rspack/core":"^1.7.6","@stylistic/eslint-plugin-ts":"^4.2.0","@types/async-retry":"^1.4.5","@types/compression":"^1.8.1","@types/content-type":"^1.1.5","@types/express":"^5.0.0","@types/node":"^24.0.0","ajv":"^8.17.1","body-parser":"^2.0.0","compression":"^1.7.4","esbuild":"0.27.3","eslint":"^9.24.0","eslint-config-prettier":"^10.1.2","express":"^5.0.0","gen-esm-wrapper":"^1.1.2","globals":"^17.0.0","prettier":"^3.5.3","puppeteer":"^24.0.0","rimraf":"^6.0.0","rolldown":"^1.0.0-rc.4","typescript":"^5.8.3","typescript-eslint":"^8.29.1","vitest":"^4.0.16","webpack":"^5.105.2","webpack-cli":"^6.0.1"},"packageManager":"npm@10.9.2"}')
|
|
26413
26380
|
|
|
26414
26381
|
},
|
|
26415
26382
|
|
|
@@ -26532,7 +26499,7 @@ __webpack_require__.hu = (chunkId) => ('' + chunkId + '.' + __webpack_require__.
|
|
|
26532
26499
|
})();
|
|
26533
26500
|
// webpack/runtime/get_full_hash
|
|
26534
26501
|
(() => {
|
|
26535
|
-
__webpack_require__.h = () => ("
|
|
26502
|
+
__webpack_require__.h = () => ("e5e3d9e8d5d9d40a")
|
|
26536
26503
|
})();
|
|
26537
26504
|
// webpack/runtime/get_main_filename/update manifest
|
|
26538
26505
|
(() => {
|