rezo 1.0.38 → 1.0.40
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/adapters/entries/curl.d.ts +30 -23
- package/dist/adapters/entries/fetch.d.ts +30 -23
- package/dist/adapters/entries/http.d.ts +30 -23
- package/dist/adapters/entries/http2.d.ts +30 -23
- package/dist/adapters/entries/react-native.d.ts +30 -23
- package/dist/adapters/entries/xhr.d.ts +30 -23
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/core/rezo.cjs +2 -2
- package/dist/core/rezo.js +2 -2
- package/dist/crawler.d.ts +30 -23
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +30 -23
- package/dist/platform/browser.d.ts +30 -23
- package/dist/platform/bun.d.ts +30 -23
- package/dist/platform/deno.d.ts +30 -23
- package/dist/platform/node.d.ts +30 -23
- package/dist/platform/react-native.d.ts +30 -23
- package/dist/platform/worker.d.ts +30 -23
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +4 -4
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/universal/index.cjs +11 -11
- package/dist/utils/cookies.cjs +5 -6
- package/dist/utils/cookies.js +5 -6
- package/package.json +1 -1
|
@@ -192,7 +192,17 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
192
192
|
constructor(cookies: Cookie[]);
|
|
193
193
|
constructor(cookies: Cookie[], url: string);
|
|
194
194
|
private generateCookies;
|
|
195
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Get all cookies from the cookie jar.
|
|
197
|
+
*
|
|
198
|
+
* This method synchronously returns all cookies stored in the jar,
|
|
199
|
+
* including both regular and touch cookies.
|
|
200
|
+
*
|
|
201
|
+
* @returns {Cookies} An object containing arrays of all cookies,
|
|
202
|
+
* serialized representations, Netscape format strings, and set-cookie strings
|
|
203
|
+
* @see {@link getCookiesForRequest} - Get cookies for a specific request URL
|
|
204
|
+
*/
|
|
205
|
+
cookies(url?: string): Cookies;
|
|
196
206
|
parseResponseCookies(cookies: Cookie[]): Cookies;
|
|
197
207
|
static toNetscapeCookie(cookies: Cookie[] | SerializedCookie[]): string;
|
|
198
208
|
static toCookieString(cookies: Cookie[] | SerializedCookie[]): string;
|
|
@@ -4253,12 +4263,16 @@ export declare class Rezo {
|
|
|
4253
4263
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4254
4264
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4255
4265
|
/**
|
|
4256
|
-
* Get
|
|
4266
|
+
* Get cookies from the cookie jar in multiple convenient formats.
|
|
4257
4267
|
*
|
|
4258
|
-
* Returns a `Cookies` object containing
|
|
4268
|
+
* Returns a `Cookies` object containing stored cookies in various formats
|
|
4259
4269
|
* for different use cases. This provides flexible access to cookies for
|
|
4260
4270
|
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4261
4271
|
*
|
|
4272
|
+
* If a `url` is provided, only cookies valid for that URL (matching domain, path,
|
|
4273
|
+
* expiration, etc.) are returned. If no `url` is provided, all cookies in the
|
|
4274
|
+
* jar are returned.
|
|
4275
|
+
*
|
|
4262
4276
|
* The returned `Cookies` object contains:
|
|
4263
4277
|
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4264
4278
|
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
@@ -4266,37 +4280,29 @@ export declare class Rezo {
|
|
|
4266
4280
|
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4267
4281
|
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4268
4282
|
*
|
|
4283
|
+
* @param url - Optional URL to filter cookies. If provided, returns only cookies valid for this URL.
|
|
4269
4284
|
* @returns A Cookies object with cookies in multiple formats
|
|
4270
4285
|
*
|
|
4271
4286
|
* @example
|
|
4272
4287
|
* ```typescript
|
|
4273
|
-
*
|
|
4288
|
+
* // Get ALL cookies in the jar
|
|
4289
|
+
* const allCookies = rezo.getCookies();
|
|
4274
4290
|
*
|
|
4275
|
-
* //
|
|
4276
|
-
*
|
|
4277
|
-
*
|
|
4278
|
-
* }
|
|
4291
|
+
* // Get cookies valid for a specific URL
|
|
4292
|
+
* const googleCookies = rezo.getCookies('https://google.com');
|
|
4293
|
+
* console.log(googleCookies.string); // Only sends valid cookies for google.com
|
|
4279
4294
|
*
|
|
4280
|
-
* //
|
|
4281
|
-
*
|
|
4295
|
+
* // Access as Cookie instances
|
|
4296
|
+
* for (const cookie of allCookies.array) {
|
|
4297
|
+
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4298
|
+
* }
|
|
4282
4299
|
*
|
|
4283
4300
|
* // Save to Netscape cookie file
|
|
4284
|
-
* fs.writeFileSync('cookies.txt',
|
|
4301
|
+
* fs.writeFileSync('cookies.txt', allCookies.netscape);
|
|
4285
4302
|
*
|
|
4286
4303
|
* // Serialize to JSON for storage
|
|
4287
|
-
* const json = JSON.stringify(
|
|
4304
|
+
* const json = JSON.stringify(allCookies.serialized);
|
|
4288
4305
|
* localStorage.setItem('cookies', json);
|
|
4289
|
-
*
|
|
4290
|
-
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4291
|
-
* for (const setCookie of cookies.setCookiesString) {
|
|
4292
|
-
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4293
|
-
* }
|
|
4294
|
-
*
|
|
4295
|
-
* // Check cookie count
|
|
4296
|
-
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4297
|
-
*
|
|
4298
|
-
* // Find specific cookie
|
|
4299
|
-
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4300
4306
|
* ```
|
|
4301
4307
|
*
|
|
4302
4308
|
* @see {@link setCookies} - Set cookies in the jar
|
|
@@ -4304,6 +4310,7 @@ export declare class Rezo {
|
|
|
4304
4310
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4305
4311
|
*/
|
|
4306
4312
|
getCookies(): Cookies;
|
|
4313
|
+
getCookies(url: string): Cookies;
|
|
4307
4314
|
/**
|
|
4308
4315
|
* Remove all cookies from the cookie jar.
|
|
4309
4316
|
*
|
|
@@ -192,7 +192,17 @@ export declare class RezoCookieJar extends TouchCookieJar {
|
|
|
192
192
|
constructor(cookies: Cookie[]);
|
|
193
193
|
constructor(cookies: Cookie[], url: string);
|
|
194
194
|
private generateCookies;
|
|
195
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Get all cookies from the cookie jar.
|
|
197
|
+
*
|
|
198
|
+
* This method synchronously returns all cookies stored in the jar,
|
|
199
|
+
* including both regular and touch cookies.
|
|
200
|
+
*
|
|
201
|
+
* @returns {Cookies} An object containing arrays of all cookies,
|
|
202
|
+
* serialized representations, Netscape format strings, and set-cookie strings
|
|
203
|
+
* @see {@link getCookiesForRequest} - Get cookies for a specific request URL
|
|
204
|
+
*/
|
|
205
|
+
cookies(url?: string): Cookies;
|
|
196
206
|
parseResponseCookies(cookies: Cookie[]): Cookies;
|
|
197
207
|
static toNetscapeCookie(cookies: Cookie[] | SerializedCookie[]): string;
|
|
198
208
|
static toCookieString(cookies: Cookie[] | SerializedCookie[]): string;
|
|
@@ -4253,12 +4263,16 @@ export declare class Rezo {
|
|
|
4253
4263
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4254
4264
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4255
4265
|
/**
|
|
4256
|
-
* Get
|
|
4266
|
+
* Get cookies from the cookie jar in multiple convenient formats.
|
|
4257
4267
|
*
|
|
4258
|
-
* Returns a `Cookies` object containing
|
|
4268
|
+
* Returns a `Cookies` object containing stored cookies in various formats
|
|
4259
4269
|
* for different use cases. This provides flexible access to cookies for
|
|
4260
4270
|
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4261
4271
|
*
|
|
4272
|
+
* If a `url` is provided, only cookies valid for that URL (matching domain, path,
|
|
4273
|
+
* expiration, etc.) are returned. If no `url` is provided, all cookies in the
|
|
4274
|
+
* jar are returned.
|
|
4275
|
+
*
|
|
4262
4276
|
* The returned `Cookies` object contains:
|
|
4263
4277
|
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4264
4278
|
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
@@ -4266,37 +4280,29 @@ export declare class Rezo {
|
|
|
4266
4280
|
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4267
4281
|
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4268
4282
|
*
|
|
4283
|
+
* @param url - Optional URL to filter cookies. If provided, returns only cookies valid for this URL.
|
|
4269
4284
|
* @returns A Cookies object with cookies in multiple formats
|
|
4270
4285
|
*
|
|
4271
4286
|
* @example
|
|
4272
4287
|
* ```typescript
|
|
4273
|
-
*
|
|
4288
|
+
* // Get ALL cookies in the jar
|
|
4289
|
+
* const allCookies = rezo.getCookies();
|
|
4274
4290
|
*
|
|
4275
|
-
* //
|
|
4276
|
-
*
|
|
4277
|
-
*
|
|
4278
|
-
* }
|
|
4291
|
+
* // Get cookies valid for a specific URL
|
|
4292
|
+
* const googleCookies = rezo.getCookies('https://google.com');
|
|
4293
|
+
* console.log(googleCookies.string); // Only sends valid cookies for google.com
|
|
4279
4294
|
*
|
|
4280
|
-
* //
|
|
4281
|
-
*
|
|
4295
|
+
* // Access as Cookie instances
|
|
4296
|
+
* for (const cookie of allCookies.array) {
|
|
4297
|
+
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4298
|
+
* }
|
|
4282
4299
|
*
|
|
4283
4300
|
* // Save to Netscape cookie file
|
|
4284
|
-
* fs.writeFileSync('cookies.txt',
|
|
4301
|
+
* fs.writeFileSync('cookies.txt', allCookies.netscape);
|
|
4285
4302
|
*
|
|
4286
4303
|
* // Serialize to JSON for storage
|
|
4287
|
-
* const json = JSON.stringify(
|
|
4304
|
+
* const json = JSON.stringify(allCookies.serialized);
|
|
4288
4305
|
* localStorage.setItem('cookies', json);
|
|
4289
|
-
*
|
|
4290
|
-
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4291
|
-
* for (const setCookie of cookies.setCookiesString) {
|
|
4292
|
-
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4293
|
-
* }
|
|
4294
|
-
*
|
|
4295
|
-
* // Check cookie count
|
|
4296
|
-
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4297
|
-
*
|
|
4298
|
-
* // Find specific cookie
|
|
4299
|
-
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4300
4306
|
* ```
|
|
4301
4307
|
*
|
|
4302
4308
|
* @see {@link setCookies} - Set cookies in the jar
|
|
@@ -4304,6 +4310,7 @@ export declare class Rezo {
|
|
|
4304
4310
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4305
4311
|
*/
|
|
4306
4312
|
getCookies(): Cookies;
|
|
4313
|
+
getCookies(url: string): Cookies;
|
|
4307
4314
|
/**
|
|
4308
4315
|
* Remove all cookies from the cookie jar.
|
|
4309
4316
|
*
|
package/dist/plugin/index.cjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
const
|
|
6
|
-
exports.FileCacher =
|
|
7
|
-
const
|
|
8
|
-
exports.UrlStore =
|
|
9
|
-
const
|
|
10
|
-
exports.Oxylabs =
|
|
11
|
-
const
|
|
12
|
-
exports.OXYLABS_BROWSER_TYPES =
|
|
13
|
-
exports.OXYLABS_COMMON_LOCALES =
|
|
14
|
-
exports.OXYLABS_COMMON_GEO_LOCATIONS =
|
|
15
|
-
exports.OXYLABS_US_STATES =
|
|
16
|
-
exports.OXYLABS_EUROPEAN_COUNTRIES =
|
|
17
|
-
exports.OXYLABS_ASIAN_COUNTRIES =
|
|
18
|
-
exports.getRandomOxylabsBrowserType =
|
|
19
|
-
exports.getRandomOxylabsLocale =
|
|
20
|
-
exports.getRandomOxylabsGeoLocation =
|
|
21
|
-
const
|
|
22
|
-
exports.Decodo =
|
|
23
|
-
const
|
|
24
|
-
exports.DECODO_DEVICE_TYPES =
|
|
25
|
-
exports.DECODO_HEADLESS_MODES =
|
|
26
|
-
exports.DECODO_COMMON_LOCALES =
|
|
27
|
-
exports.DECODO_COMMON_COUNTRIES =
|
|
28
|
-
exports.DECODO_EUROPEAN_COUNTRIES =
|
|
29
|
-
exports.DECODO_ASIAN_COUNTRIES =
|
|
30
|
-
exports.DECODO_US_STATES =
|
|
31
|
-
exports.DECODO_COMMON_CITIES =
|
|
32
|
-
exports.getRandomDecodoDeviceType =
|
|
33
|
-
exports.getRandomDecodoLocale =
|
|
34
|
-
exports.getRandomDecodoCountry =
|
|
35
|
-
exports.getRandomDecodoCity =
|
|
36
|
-
exports.generateDecodoSessionId =
|
|
1
|
+
const _mod_7o4hj8 = require('./crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_7o4hj8.Crawler;;
|
|
3
|
+
const _mod_8skgjk = require('./crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_8skgjk.CrawlerOptions;;
|
|
5
|
+
const _mod_xzhhtv = require('../cache/file-cacher.cjs');
|
|
6
|
+
exports.FileCacher = _mod_xzhhtv.FileCacher;;
|
|
7
|
+
const _mod_q0ba3u = require('../cache/url-store.cjs');
|
|
8
|
+
exports.UrlStore = _mod_q0ba3u.UrlStore;;
|
|
9
|
+
const _mod_5jfuqk = require('./addon/oxylabs/index.cjs');
|
|
10
|
+
exports.Oxylabs = _mod_5jfuqk.Oxylabs;;
|
|
11
|
+
const _mod_9ggjyx = require('./addon/oxylabs/options.cjs');
|
|
12
|
+
exports.OXYLABS_BROWSER_TYPES = _mod_9ggjyx.OXYLABS_BROWSER_TYPES;
|
|
13
|
+
exports.OXYLABS_COMMON_LOCALES = _mod_9ggjyx.OXYLABS_COMMON_LOCALES;
|
|
14
|
+
exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_9ggjyx.OXYLABS_COMMON_GEO_LOCATIONS;
|
|
15
|
+
exports.OXYLABS_US_STATES = _mod_9ggjyx.OXYLABS_US_STATES;
|
|
16
|
+
exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_9ggjyx.OXYLABS_EUROPEAN_COUNTRIES;
|
|
17
|
+
exports.OXYLABS_ASIAN_COUNTRIES = _mod_9ggjyx.OXYLABS_ASIAN_COUNTRIES;
|
|
18
|
+
exports.getRandomOxylabsBrowserType = _mod_9ggjyx.getRandomBrowserType;
|
|
19
|
+
exports.getRandomOxylabsLocale = _mod_9ggjyx.getRandomLocale;
|
|
20
|
+
exports.getRandomOxylabsGeoLocation = _mod_9ggjyx.getRandomGeoLocation;;
|
|
21
|
+
const _mod_j5hnyr = require('./addon/decodo/index.cjs');
|
|
22
|
+
exports.Decodo = _mod_j5hnyr.Decodo;;
|
|
23
|
+
const _mod_lfgvog = require('./addon/decodo/options.cjs');
|
|
24
|
+
exports.DECODO_DEVICE_TYPES = _mod_lfgvog.DECODO_DEVICE_TYPES;
|
|
25
|
+
exports.DECODO_HEADLESS_MODES = _mod_lfgvog.DECODO_HEADLESS_MODES;
|
|
26
|
+
exports.DECODO_COMMON_LOCALES = _mod_lfgvog.DECODO_COMMON_LOCALES;
|
|
27
|
+
exports.DECODO_COMMON_COUNTRIES = _mod_lfgvog.DECODO_COMMON_COUNTRIES;
|
|
28
|
+
exports.DECODO_EUROPEAN_COUNTRIES = _mod_lfgvog.DECODO_EUROPEAN_COUNTRIES;
|
|
29
|
+
exports.DECODO_ASIAN_COUNTRIES = _mod_lfgvog.DECODO_ASIAN_COUNTRIES;
|
|
30
|
+
exports.DECODO_US_STATES = _mod_lfgvog.DECODO_US_STATES;
|
|
31
|
+
exports.DECODO_COMMON_CITIES = _mod_lfgvog.DECODO_COMMON_CITIES;
|
|
32
|
+
exports.getRandomDecodoDeviceType = _mod_lfgvog.getRandomDeviceType;
|
|
33
|
+
exports.getRandomDecodoLocale = _mod_lfgvog.getRandomLocale;
|
|
34
|
+
exports.getRandomDecodoCountry = _mod_lfgvog.getRandomCountry;
|
|
35
|
+
exports.getRandomDecodoCity = _mod_lfgvog.getRandomCity;
|
|
36
|
+
exports.generateDecodoSessionId = _mod_lfgvog.generateSessionId;;
|
package/dist/proxy/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@ const { SocksProxyAgent: RezoSocksProxy } = require("socks-proxy-agent");
|
|
|
2
2
|
const { HttpsProxyAgent: RezoHttpsSocks } = require("https-proxy-agent");
|
|
3
3
|
const { HttpProxyAgent: RezoHttpSocks } = require("http-proxy-agent");
|
|
4
4
|
const { parseProxyString } = require('./parse.cjs');
|
|
5
|
-
const
|
|
6
|
-
exports.ProxyManager =
|
|
7
|
-
const
|
|
8
|
-
exports.parseProxyString =
|
|
5
|
+
const _mod_8qkn02 = require('./manager.cjs');
|
|
6
|
+
exports.ProxyManager = _mod_8qkn02.ProxyManager;;
|
|
7
|
+
const _mod_ke5nex = require('./parse.cjs');
|
|
8
|
+
exports.parseProxyString = _mod_ke5nex.parseProxyString;;
|
|
9
9
|
function createOptions(uri, opts) {
|
|
10
10
|
if (uri instanceof URL || typeof uri === "string") {
|
|
11
11
|
return {
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_kuel9a = require('./queue.cjs');
|
|
2
|
+
exports.RezoQueue = _mod_kuel9a.RezoQueue;;
|
|
3
|
+
const _mod_mzgwbx = require('./http-queue.cjs');
|
|
4
|
+
exports.HttpQueue = _mod_mzgwbx.HttpQueue;
|
|
5
|
+
exports.extractDomain = _mod_mzgwbx.extractDomain;;
|
|
6
|
+
const _mod_74swv0 = require('./types.cjs');
|
|
7
|
+
exports.Priority = _mod_74swv0.Priority;
|
|
8
|
+
exports.HttpMethodPriority = _mod_74swv0.HttpMethodPriority;;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.UniversalEventEmitter =
|
|
3
|
-
const
|
|
4
|
-
exports.UniversalStreamResponse =
|
|
5
|
-
exports.StreamResponse =
|
|
6
|
-
const
|
|
7
|
-
exports.UniversalDownloadResponse =
|
|
8
|
-
exports.DownloadResponse =
|
|
9
|
-
const
|
|
10
|
-
exports.UniversalUploadResponse =
|
|
11
|
-
exports.UploadResponse =
|
|
1
|
+
const _mod_0fl2na = require('./event-emitter.cjs');
|
|
2
|
+
exports.UniversalEventEmitter = _mod_0fl2na.UniversalEventEmitter;;
|
|
3
|
+
const _mod_4e9ng3 = require('./stream.cjs');
|
|
4
|
+
exports.UniversalStreamResponse = _mod_4e9ng3.UniversalStreamResponse;
|
|
5
|
+
exports.StreamResponse = _mod_4e9ng3.StreamResponse;;
|
|
6
|
+
const _mod_ry8uaf = require('./download.cjs');
|
|
7
|
+
exports.UniversalDownloadResponse = _mod_ry8uaf.UniversalDownloadResponse;
|
|
8
|
+
exports.DownloadResponse = _mod_ry8uaf.DownloadResponse;;
|
|
9
|
+
const _mod_btspbf = require('./upload.cjs');
|
|
10
|
+
exports.UniversalUploadResponse = _mod_btspbf.UniversalUploadResponse;
|
|
11
|
+
exports.UploadResponse = _mod_btspbf.UploadResponse;;
|
package/dist/utils/cookies.cjs
CHANGED
|
@@ -94,7 +94,8 @@ class RezoCookieJar extends TouchCookieJar {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
generateCookies(data) {
|
|
97
|
+
generateCookies(data, url) {
|
|
98
|
+
data = !data && url ? this.getCookiesSync(url) : data;
|
|
98
99
|
const cookies = !data ? (this.toJSON()?.cookies || []).map((cookie) => new Cookie(cookie)) : data[0] instanceof Cookie ? data : data.map((cookie) => new Cookie(cookie instanceof TouchCookie ? cookie : Cookie.fromJSON(cookie)));
|
|
99
100
|
const netscape = cookies.map((cookie) => cookie.toNetscapeFormat());
|
|
100
101
|
const cookieString = cookies.map((cookie) => cookie.cookieString());
|
|
@@ -102,21 +103,19 @@ class RezoCookieJar extends TouchCookieJar {
|
|
|
102
103
|
let netscapeString = `# Netscape HTTP Cookie File
|
|
103
104
|
`;
|
|
104
105
|
netscapeString += `# This file was generated by Rezo HTTP client
|
|
105
|
-
`;
|
|
106
|
-
netscapeString += `# Based on uniqhtt cookie implementation
|
|
107
106
|
`;
|
|
108
107
|
netscapeString += netscape.join(`
|
|
109
108
|
`) || "";
|
|
110
109
|
return {
|
|
111
110
|
array: cookies,
|
|
112
|
-
serialized:
|
|
111
|
+
serialized: cookies.map((cookie) => cookie.toJSON()) || [],
|
|
113
112
|
netscape: netscapeString,
|
|
114
113
|
string: cookieString.join("; "),
|
|
115
114
|
setCookiesString
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
|
-
cookies() {
|
|
119
|
-
return this.generateCookies();
|
|
117
|
+
cookies(url) {
|
|
118
|
+
return this.generateCookies(undefined, url);
|
|
120
119
|
}
|
|
121
120
|
parseResponseCookies(cookies) {
|
|
122
121
|
return this.generateCookies(cookies);
|
package/dist/utils/cookies.js
CHANGED
|
@@ -94,7 +94,8 @@ export class RezoCookieJar extends TouchCookieJar {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
generateCookies(data) {
|
|
97
|
+
generateCookies(data, url) {
|
|
98
|
+
data = !data && url ? this.getCookiesSync(url) : data;
|
|
98
99
|
const cookies = !data ? (this.toJSON()?.cookies || []).map((cookie) => new Cookie(cookie)) : data[0] instanceof Cookie ? data : data.map((cookie) => new Cookie(cookie instanceof TouchCookie ? cookie : Cookie.fromJSON(cookie)));
|
|
99
100
|
const netscape = cookies.map((cookie) => cookie.toNetscapeFormat());
|
|
100
101
|
const cookieString = cookies.map((cookie) => cookie.cookieString());
|
|
@@ -102,21 +103,19 @@ export class RezoCookieJar extends TouchCookieJar {
|
|
|
102
103
|
let netscapeString = `# Netscape HTTP Cookie File
|
|
103
104
|
`;
|
|
104
105
|
netscapeString += `# This file was generated by Rezo HTTP client
|
|
105
|
-
`;
|
|
106
|
-
netscapeString += `# Based on uniqhtt cookie implementation
|
|
107
106
|
`;
|
|
108
107
|
netscapeString += netscape.join(`
|
|
109
108
|
`) || "";
|
|
110
109
|
return {
|
|
111
110
|
array: cookies,
|
|
112
|
-
serialized:
|
|
111
|
+
serialized: cookies.map((cookie) => cookie.toJSON()) || [],
|
|
113
112
|
netscape: netscapeString,
|
|
114
113
|
string: cookieString.join("; "),
|
|
115
114
|
setCookiesString
|
|
116
115
|
};
|
|
117
116
|
}
|
|
118
|
-
cookies() {
|
|
119
|
-
return this.generateCookies();
|
|
117
|
+
cookies(url) {
|
|
118
|
+
return this.generateCookies(undefined, url);
|
|
120
119
|
}
|
|
121
120
|
parseResponseCookies(cookies) {
|
|
122
121
|
return this.generateCookies(cookies);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rezo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|