apify 3.0.0-alpha.2 → 3.0.0-alpha.20

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/actor.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actor.js","sourceRoot":"","sources":["../src/actor.ts"],"names":[],"mappings":";;;;AAAA,oDAAoB;AACpB,0CAA2D;AAC3D,6DAA6B;AAC7B,+CAA2J;AAC3J,wCAeuB;AACvB,0CAAoH;AACpH,mCAAiE;AACjE,qEAAgE;AAChE,+DAAsF;AAEtF;;;;GAIG;AACH,MAAa,KAAK;IAwBd,YAAY,UAAgC,EAAE;QApB9C;;;WAGG;QACH;;;;;WAA+B;QAE/B;;;WAGG;QACH;;;;;WAAkC;QAElC;;;WAGG;QACH;;;;;WAAoC;QAEpC;;;;mBAAmC,IAAI,GAAG,EAA+B;WAAC;QAGtE,oFAAoF;QACpF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAa,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,IAAI,oBAAa,CAAC,OAAO,CAAC,CAAC;QAC/G,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACpC,IAAI,CAAC,YAAY,GAAG,IAAI,6CAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgEG;IACH,IAAI,CAAI,QAAkB,EAAE,OAAqB;QAC7C,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,6DAA6D,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,QAAQ,KAAK,CAAC,CAAC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AAC,kBAAkB,CAAI,YAAY,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;IAEO,kBAAkB,CAAqB,YAA4B;QACvE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACzC,MAAM,OAAO,GAAG,IAAI,qBAAc,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YAC9D,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;SACnD;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,YAAY,CAAsB,CAAC;IACvE,CAAC;CACJ;AA9uCD,sBA8uCC;AAuJD;;;;;GAKG;AACU,QAAA,UAAU,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,yBAAyB,EAAE,EAAE;IAC7B,aAAa,EAAE,EAAE;CACpB,CAAC"}
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './actor';
2
+ export * from './proxy_configuration';
3
+ export * from './platform_event_manager';
4
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./actor"), exports);
5
+ tslib_1.__exportStar(require("./proxy_configuration"), exports);
6
+ tslib_1.__exportStar(require("./platform_event_manager"), exports);
7
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,gEAAsC;AACtC,mEAAyC"}
package/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import mod from "./index.js";
2
+
3
+ export default mod;
4
+ export const Actor = mod.Actor;
5
+ export const EXIT_CODES = mod.EXIT_CODES;
6
+ export const PlatformEventManager = mod.PlatformEventManager;
7
+ export const ProxyConfiguration = mod.ProxyConfiguration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apify",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.20",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
@@ -39,9 +39,6 @@
39
39
  "url": "https://github.com/apify/apify-js/issues"
40
40
  },
41
41
  "homepage": "https://sdk.apify.com/",
42
- "files": [
43
- "dist"
44
- ],
45
42
  "scripts": {
46
43
  "build": "npm run clean && npm run compile && npm run copy && npm run fixApifyExport",
47
44
  "clean": "rimraf ./dist",
@@ -53,21 +50,9 @@
53
50
  "access": "public"
54
51
  },
55
52
  "dependencies": {
56
- "@crawlee/core": "^3.0.0-alpha.2",
57
- "@crawlee/utils": "^3.0.0-alpha.2",
53
+ "@crawlee/core": "^3.0.0-alpha.20",
54
+ "@crawlee/utils": "^3.0.0-alpha.20",
58
55
  "semver": "^7.3.5",
59
56
  "apify-client": "^2.2.1-beta.5"
60
- },
61
- "peerDependencies": {
62
- "playwright": "^1.11.0",
63
- "puppeteer": ">= 9.x <= 13.x"
64
- },
65
- "peerDependenciesMeta": {
66
- "playwright": {
67
- "optional": true
68
- },
69
- "puppeteer": {
70
- "optional": true
71
- }
72
57
  }
73
58
  }
@@ -0,0 +1,55 @@
1
+ import { EventManager } from '@crawlee/core';
2
+ /**
3
+ * Gets an instance of a Node.js'
4
+ * [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
5
+ * class that emits various events from the SDK or the Apify platform.
6
+ * The event emitter is initialized by calling the {@link Actor.main} function.
7
+ *
8
+ * **Example usage:**
9
+ *
10
+ * ```javascript
11
+ * Actor.on('cpuInfo', (data) => {
12
+ * if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');
13
+ * });
14
+ * ```
15
+ *
16
+ * The following events are emitted:
17
+ *
18
+ * - `cpuInfo`: `{ "isCpuOverloaded": Boolean }`
19
+ * The event is emitted approximately every second
20
+ * and it indicates whether the actor is using the maximum of available CPU resources.
21
+ * If that's the case, the actor should not add more workload.
22
+ * For example, this event is used by the {@link AutoscaledPool} class.
23
+ * - `migrating`: `void`
24
+ * Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon.
25
+ * You can use it to persist the state of the actor and abort the run, to speed up migration.
26
+ * For example, this is used by the {@link RequestList} class.
27
+ * - `aborting`: `void`
28
+ * When a user aborts an actor run on the Apify platform, they can choose to abort gracefully to allow
29
+ * the actor some time before getting killed. This graceful abort emits the `aborting` event which the SDK
30
+ * uses to gracefully stop running crawls and you can use it to do your own cleanup as well.
31
+ * - `persistState`: `{ "isMigrating": Boolean }`
32
+ * Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is time to persist
33
+ * their state, in order to avoid repeating all work when the actor restarts.
34
+ * This event is automatically emitted together with the `migrating` event,
35
+ * in which case the `isMigrating` flag is set to `true`. Otherwise the flag is `false`.
36
+ * Note that the `persistState` event is provided merely for user convenience,
37
+ * you can achieve the same effect using `setInterval()` and listening for the `migrating` event.
38
+ */
39
+ export declare class PlatformEventManager extends EventManager {
40
+ /** Websocket connection to actor events. */
41
+ private eventsWs?;
42
+ /**
43
+ * Initializes `Actor.events` event emitter by creating a connection to a websocket that provides them.
44
+ * This is an internal function that is automatically called by `Actor.main()`.
45
+ */
46
+ init(): Promise<void>;
47
+ private createWebSocketConnection;
48
+ /**
49
+ * Closes websocket providing events from Actor infrastructure and also stops sending internal events
50
+ * of Apify package such as `persistState`.
51
+ * This is automatically called at the end of `Actor.main()`.
52
+ */
53
+ close(): Promise<void>;
54
+ }
55
+ //# sourceMappingURL=platform_event_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform_event_manager.d.ts","sourceRoot":"","sources":["../src/platform_event_manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,YAAY,EAAE,MAAM,eAAe,CAAC;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IAClD,4CAA4C;IAC5C,OAAO,CAAC,QAAQ,CAAC,CAAY;IAE7B;;;OAGG;IACY,IAAI;IAiBnB,OAAO,CAAC,yBAAyB;IAgCjC;;;;OAIG;IACY,KAAK;CAQvB"}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatformEventManager = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const consts_1 = require("@apify/consts");
6
+ const ws_1 = tslib_1.__importDefault(require("ws"));
7
+ const core_1 = require("@crawlee/core");
8
+ const utilities_1 = require("@apify/utilities");
9
+ /**
10
+ * Gets an instance of a Node.js'
11
+ * [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
12
+ * class that emits various events from the SDK or the Apify platform.
13
+ * The event emitter is initialized by calling the {@link Actor.main} function.
14
+ *
15
+ * **Example usage:**
16
+ *
17
+ * ```javascript
18
+ * Actor.on('cpuInfo', (data) => {
19
+ * if (data.isCpuOverloaded) console.log('Oh no, the CPU is overloaded!');
20
+ * });
21
+ * ```
22
+ *
23
+ * The following events are emitted:
24
+ *
25
+ * - `cpuInfo`: `{ "isCpuOverloaded": Boolean }`
26
+ * The event is emitted approximately every second
27
+ * and it indicates whether the actor is using the maximum of available CPU resources.
28
+ * If that's the case, the actor should not add more workload.
29
+ * For example, this event is used by the {@link AutoscaledPool} class.
30
+ * - `migrating`: `void`
31
+ * Emitted when the actor running on the Apify platform is going to be migrated to another worker server soon.
32
+ * You can use it to persist the state of the actor and abort the run, to speed up migration.
33
+ * For example, this is used by the {@link RequestList} class.
34
+ * - `aborting`: `void`
35
+ * When a user aborts an actor run on the Apify platform, they can choose to abort gracefully to allow
36
+ * the actor some time before getting killed. This graceful abort emits the `aborting` event which the SDK
37
+ * uses to gracefully stop running crawls and you can use it to do your own cleanup as well.
38
+ * - `persistState`: `{ "isMigrating": Boolean }`
39
+ * Emitted in regular intervals (by default 60 seconds) to notify all components of Apify SDK that it is time to persist
40
+ * their state, in order to avoid repeating all work when the actor restarts.
41
+ * This event is automatically emitted together with the `migrating` event,
42
+ * in which case the `isMigrating` flag is set to `true`. Otherwise the flag is `false`.
43
+ * Note that the `persistState` event is provided merely for user convenience,
44
+ * you can achieve the same effect using `setInterval()` and listening for the `migrating` event.
45
+ */
46
+ class PlatformEventManager extends core_1.EventManager {
47
+ constructor() {
48
+ super(...arguments);
49
+ /** Websocket connection to actor events. */
50
+ Object.defineProperty(this, "eventsWs", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: void 0
55
+ });
56
+ }
57
+ /**
58
+ * Initializes `Actor.events` event emitter by creating a connection to a websocket that provides them.
59
+ * This is an internal function that is automatically called by `Actor.main()`.
60
+ */
61
+ async init() {
62
+ if (this.initialized) {
63
+ return;
64
+ }
65
+ await super.init();
66
+ const eventsWsUrl = process.env[consts_1.ENV_VARS.ACTOR_EVENTS_WS_URL];
67
+ // Locally there is no web socket to connect, so just print a log message.
68
+ if (!eventsWsUrl) {
69
+ this.log.debug(`Environment variable ${consts_1.ENV_VARS.ACTOR_EVENTS_WS_URL} is not set, no events from Apify platform will be emitted.`);
70
+ return;
71
+ }
72
+ this.createWebSocketConnection(eventsWsUrl);
73
+ }
74
+ createWebSocketConnection(eventsWsUrl) {
75
+ this.eventsWs = new ws_1.default(eventsWsUrl);
76
+ this.eventsWs.on('message', (message) => {
77
+ if (!message)
78
+ return;
79
+ try {
80
+ const { name, data, } = JSON.parse(String(message));
81
+ this.events.emit(name, data);
82
+ if (name === consts_1.ACTOR_EVENT_NAMES.MIGRATING) {
83
+ (0, utilities_1.betterClearInterval)(this.persistStateInterval); // Don't send any other persist state event.
84
+ this.events.emit("persistState" /* PERSIST_STATE */, { isMigrating: true });
85
+ }
86
+ }
87
+ catch (err) {
88
+ this.log.exception(err, 'Cannot parse actor event');
89
+ }
90
+ });
91
+ this.eventsWs.on('error', (err) => {
92
+ // Don't print this error as this happens in the case of very short Actor.main().
93
+ if (err.message === 'WebSocket was closed before the connection was established')
94
+ return;
95
+ this.log.exception(err, 'web socket connection failed');
96
+ });
97
+ this.eventsWs.on('close', () => {
98
+ this.log.warning('web socket has been closed');
99
+ this.eventsWs = undefined;
100
+ });
101
+ }
102
+ /**
103
+ * Closes websocket providing events from Actor infrastructure and also stops sending internal events
104
+ * of Apify package such as `persistState`.
105
+ * This is automatically called at the end of `Actor.main()`.
106
+ */
107
+ async close() {
108
+ if (!this.initialized) {
109
+ return;
110
+ }
111
+ await super.close();
112
+ this.eventsWs?.close();
113
+ }
114
+ }
115
+ exports.PlatformEventManager = PlatformEventManager;
116
+ //# sourceMappingURL=platform_event_manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform_event_manager.js","sourceRoot":"","sources":["../src/platform_event_manager.ts"],"names":[],"mappings":";;;;AAAA,0CAA4D;AAC5D,oDAA2B;AAC3B,wCAAwD;AACxD,gDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAa,oBAAqB,SAAQ,mBAAY;IAAtD;;QACI,4CAA4C;QAC5C;;;;;WAA6B;IAoEjC,CAAC;IAlEG;;;OAGG;IACM,KAAK,CAAC,IAAI;QACf,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,OAAO;SACV;QAED,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAQ,CAAC,mBAAmB,CAAC,CAAC;QAE9D,0EAA0E;QAC1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Q,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC3B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;YAC/C,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACnB,OAAO;SACV;QAED,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;CACJ;AAtED,oDAsEC"}
@@ -0,0 +1,210 @@
1
+ import { Configuration, ProxyConfiguration as CoreProxyConfiguration, ProxyConfigurationOptions as CoreProxyConfigurationOptions, ProxyInfo as CoreProxyInfo } from '@crawlee/core';
2
+ export interface ProxyConfigurationOptions extends CoreProxyConfigurationOptions {
3
+ /**
4
+ * User's password for the proxy. By default, it is taken from the `APIFY_PROXY_PASSWORD`
5
+ * environment variable, which is automatically set by the system when running the actors.
6
+ */
7
+ password?: string;
8
+ /**
9
+ * An array of proxy groups to be used by the [Apify Proxy](https://docs.apify.com/proxy).
10
+ * If not provided, the proxy will select the groups automatically.
11
+ */
12
+ groups?: string[];
13
+ /**
14
+ * If set and relevant proxies are available in your Apify account, all proxied requests will
15
+ * use IP addresses that are geolocated to the specified country. For example `GB` for IPs
16
+ * from Great Britain. Note that online services often have their own rules for handling
17
+ * geolocation and thus the country selection is a best attempt at geolocation, rather than
18
+ * a guaranteed hit. This parameter is optional, by default, each proxied request is assigned
19
+ * an IP address from a random country. The country code needs to be a two letter ISO country code. See the
20
+ * [full list of available country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).
21
+ * This parameter is optional, by default, the proxy uses all available proxy servers from all countries.
22
+ * on the Apify cloud, or when using the [Apify CLI](https://github.com/apify/apify-cli).
23
+ */
24
+ countryCode?: string;
25
+ /**
26
+ * Same option as `groups` which can be used to
27
+ * configurate the proxy by UI input schema. You should use the `groups` option in your crawler code.
28
+ */
29
+ apifyProxyGroups?: string[];
30
+ /**
31
+ * Same option as `countryCode` which can be used to
32
+ * configurate the proxy by UI input schema. You should use the `countryCode` option in your crawler code.
33
+ */
34
+ apifyProxyCountry?: string;
35
+ }
36
+ /**
37
+ * The main purpose of the ProxyInfo object is to provide information
38
+ * about the current proxy connection used by the crawler for the request.
39
+ * Outside of crawlers, you can get this object by calling {@link ProxyConfiguration.newProxyInfo}.
40
+ *
41
+ * **Example usage:**
42
+ *
43
+ * ```javascript
44
+ *
45
+ * const proxyConfiguration = await Actor.createProxyConfiguration({
46
+ * groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups
47
+ * countryCode: 'US',
48
+ * });
49
+ *
50
+ * // Getting proxyInfo object by calling class method directly
51
+ * const proxyInfo = proxyConfiguration.newProxyInfo();
52
+ *
53
+ * // In crawler
54
+ * const crawler = new CheerioCrawler({
55
+ * // ...
56
+ * proxyConfiguration,
57
+ * handlePageFunction: ({ proxyInfo }) => {
58
+ * // Getting used proxy URL
59
+ * const proxyUrl = proxyInfo.url;
60
+ *
61
+ * // Getting ID of used Session
62
+ * const sessionIdentifier = proxyInfo.sessionId;
63
+ * }
64
+ * })
65
+ *
66
+ * ```
67
+ */
68
+ export interface ProxyInfo extends CoreProxyInfo {
69
+ /**
70
+ * An array of proxy groups to be used by the [Apify Proxy](https://docs.apify.com/proxy).
71
+ * If not provided, the proxy will select the groups automatically.
72
+ */
73
+ groups: string[];
74
+ /**
75
+ * If set and relevant proxies are available in your Apify account, all proxied requests will
76
+ * use IP addresses that are geolocated to the specified country. For example `GB` for IPs
77
+ * from Great Britain. Note that online services often have their own rules for handling
78
+ * geolocation and thus the country selection is a best attempt at geolocation, rather than
79
+ * a guaranteed hit. This parameter is optional, by default, each proxied request is assigned
80
+ * an IP address from a random country. The country code needs to be a two letter ISO country code. See the
81
+ * [full list of available country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements).
82
+ * This parameter is optional, by default, the proxy uses all available proxy servers from all countries.
83
+ */
84
+ countryCode?: string;
85
+ /**
86
+ * User's password for the proxy. By default, it is taken from the `APIFY_PROXY_PASSWORD`
87
+ * environment variable, which is automatically set by the system when running the actors
88
+ * on the Apify cloud, or when using the [Apify CLI](https://github.com/apify/apify-cli).
89
+ */
90
+ password: string;
91
+ }
92
+ /**
93
+ * Configures connection to a proxy server with the provided options. Proxy servers are used to prevent target websites from blocking
94
+ * your crawlers based on IP address rate limits or blacklists. Setting proxy configuration in your crawlers automatically configures
95
+ * them to use the selected proxies for all connections. You can get information about the currently used proxy by inspecting
96
+ * the {@link ProxyInfo} property in your crawler's page function. There, you can inspect the proxy's URL and other attributes.
97
+ *
98
+ * The proxy servers are managed by [Apify Proxy](https://docs.apify.com/proxy). To be able to use Apify Proxy,
99
+ * you need an Apify account and access to the selected proxies. If you provide no configuration option,
100
+ * the proxies will be managed automatically using a smart algorithm.
101
+ *
102
+ * If you want to use your own proxies, use the {@link ProxyConfigurationOptions.proxyUrls} option. Your list of proxy URLs will
103
+ * be rotated by the configuration if this option is provided.
104
+ *
105
+ * **Example usage:**
106
+ *
107
+ * ```javascript
108
+ *
109
+ * const proxyConfiguration = await Actor.createProxyConfiguration({
110
+ * groups: ['GROUP1', 'GROUP2'] // List of Apify Proxy groups
111
+ * countryCode: 'US',
112
+ * });
113
+ *
114
+ * const crawler = new CheerioCrawler({
115
+ * // ...
116
+ * proxyConfiguration,
117
+ * handlePageFunction: ({ proxyInfo }) => {
118
+ * const usedProxyUrl = proxyInfo.url; // Getting the proxy URL
119
+ * }
120
+ * })
121
+ *
122
+ * ```
123
+ * @category Scaling
124
+ */
125
+ export declare class ProxyConfiguration extends CoreProxyConfiguration {
126
+ private groups;
127
+ private countryCode?;
128
+ private password?;
129
+ private hostname;
130
+ private port?;
131
+ private usesApifyProxy?;
132
+ /**
133
+ * @internal
134
+ */
135
+ constructor(options?: ProxyConfigurationOptions, config?: Configuration);
136
+ /**
137
+ * Loads proxy password if token is provided and checks access to Apify Proxy and provided proxy groups
138
+ * if Apify Proxy configuration is used.
139
+ * Also checks if country has access to Apify Proxy groups if the country code is provided.
140
+ *
141
+ * You should use the {@link createProxyConfiguration} function to create a pre-initialized
142
+ * `ProxyConfiguration` instance instead of calling this manually.
143
+ */
144
+ initialize(): Promise<void>;
145
+ /**
146
+ * This function creates a new {@link ProxyInfo} info object.
147
+ * It is used by CheerioCrawler and PuppeteerCrawler to generate proxy URLs and also to allow the user to inspect
148
+ * the currently used proxy via the handlePageFunction parameter: proxyInfo.
149
+ * Use it if you want to work with a rich representation of a proxy URL.
150
+ * If you need the URL string only, use {@link ProxyConfiguration.newUrl}.
151
+ * @param [sessionId]
152
+ * Represents the identifier of user {@link Session} that can be managed by the {@link SessionPool} or
153
+ * you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.
154
+ * When the provided sessionId is a number, it's converted to a string. Property sessionId of
155
+ * {@link ProxyInfo} is always returned as a type string.
156
+ *
157
+ * All the HTTP requests going through the proxy with the same session identifier
158
+ * will use the same target proxy server (i.e. the same IP address).
159
+ * The identifier must not be longer than 50 characters and include only the following: `0-9`, `a-z`, `A-Z`, `"."`, `"_"` and `"~"`.
160
+ * @return Represents information about used proxy and its configuration.
161
+ */
162
+ newProxyInfo(sessionId?: string | number): Promise<ProxyInfo>;
163
+ /**
164
+ * Returns a new proxy URL based on provided configuration options and the `sessionId` parameter.
165
+ * @param [sessionId]
166
+ * Represents the identifier of user {@link Session} that can be managed by the {@link SessionPool} or
167
+ * you can use the Apify Proxy [Session](https://docs.apify.com/proxy#sessions) identifier.
168
+ * When the provided sessionId is a number, it's converted to a string.
169
+ *
170
+ * All the HTTP requests going through the proxy with the same session identifier
171
+ * will use the same target proxy server (i.e. the same IP address).
172
+ * The identifier must not be longer than 50 characters and include only the following: `0-9`, `a-z`, `A-Z`, `"."`, `"_"` and `"~"`.
173
+ * @return A string with a proxy URL, including authentication credentials and port number.
174
+ * For example, `http://bob:password123@proxy.example.com:8000`
175
+ */
176
+ newUrl(sessionId?: string | number): Promise<string>;
177
+ /**
178
+ * Returns proxy username.
179
+ */
180
+ protected _getUsername(sessionId?: string): string;
181
+ /**
182
+ * Checks if Apify Token is provided in env and gets the password via API and sets it to env
183
+ */
184
+ protected _setPasswordIfToken(): Promise<void>;
185
+ /**
186
+ * Checks whether the user has access to the proxies specified in the provided ProxyConfigurationOptions.
187
+ * If the check can not be made, it only prints a warning and allows the program to continue. This is to
188
+ * prevent program crashes caused by short downtimes of Proxy.
189
+ */
190
+ protected _checkAccess(): Promise<void>;
191
+ /**
192
+ * Apify Proxy can be down for a second or a minute, but this should not crash processes.
193
+ */
194
+ protected _fetchStatus(): Promise<{
195
+ connected: boolean;
196
+ connectionError: string;
197
+ isManInTheMiddle: boolean;
198
+ } | undefined>;
199
+ /**
200
+ * Throws Apify Proxy is not connected
201
+ * @internal
202
+ */
203
+ protected _throwApifyProxyConnectionError(errorMessage: string): void;
204
+ /**
205
+ * Throws cannot combine custom proxies with Apify Proxy
206
+ * @internal
207
+ */
208
+ protected _throwCannotCombineCustomWithApify(): void;
209
+ }
210
+ //# sourceMappingURL=proxy_configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy_configuration.d.ts","sourceRoot":"","sources":["../src/proxy_configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,aAAa,EACb,kBAAkB,IAAI,sBAAsB,EAC5C,yBAAyB,IAAI,6BAA6B,EAC1D,SAAS,IAAI,aAAa,EAC7B,MAAM,eAAe,CAAC;AAUvB,MAAM,WAAW,yBAA0B,SAAQ,6BAA6B;IAC5E;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;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