rezo 1.0.9 → 1.0.10
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 +77 -24
- package/dist/adapters/entries/fetch.d.ts +77 -24
- package/dist/adapters/entries/http.d.ts +77 -24
- package/dist/adapters/entries/http2.d.ts +77 -24
- package/dist/adapters/entries/react-native.d.ts +77 -24
- package/dist/adapters/entries/xhr.d.ts +77 -24
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +13 -13
- package/dist/core/rezo.cjs +3 -0
- package/dist/core/rezo.js +3 -0
- package/dist/crawler.d.ts +77 -24
- package/dist/entries/crawler.cjs +5 -5
- package/dist/index.cjs +24 -24
- package/dist/index.d.ts +77 -24
- package/dist/platform/browser.d.ts +77 -24
- package/dist/platform/bun.d.ts +77 -24
- package/dist/platform/deno.d.ts +77 -24
- package/dist/platform/node.d.ts +77 -24
- package/dist/platform/react-native.d.ts +77 -24
- package/dist/platform/worker.d.ts +77 -24
- package/dist/plugin/index.cjs +36 -36
- package/dist/proxy/index.cjs +2 -2
- package/dist/queue/index.cjs +8 -8
- package/package.json +1 -1
|
@@ -4219,48 +4219,101 @@ export declare class Rezo {
|
|
|
4219
4219
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4220
4220
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4221
4221
|
/**
|
|
4222
|
-
* Get all cookies from the cookie jar.
|
|
4222
|
+
* Get all cookies from the cookie jar in multiple convenient formats.
|
|
4223
4223
|
*
|
|
4224
|
-
* Returns a `Cookies` object
|
|
4225
|
-
*
|
|
4226
|
-
*
|
|
4224
|
+
* Returns a `Cookies` object containing all stored cookies in various formats
|
|
4225
|
+
* for different use cases. This provides flexible access to cookies for
|
|
4226
|
+
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4227
4227
|
*
|
|
4228
|
-
*
|
|
4228
|
+
* The returned `Cookies` object contains:
|
|
4229
|
+
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4230
|
+
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
4231
|
+
* - **netscape**: `string` - Netscape cookie file format for file-based storage
|
|
4232
|
+
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4233
|
+
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4234
|
+
*
|
|
4235
|
+
* @returns A Cookies object with cookies in multiple formats
|
|
4229
4236
|
*
|
|
4230
4237
|
* @example
|
|
4231
4238
|
* ```typescript
|
|
4232
|
-
* // Get all cookies
|
|
4233
4239
|
* const cookies = rezo.getCookies();
|
|
4234
4240
|
*
|
|
4235
|
-
* // Access
|
|
4236
|
-
* const
|
|
4237
|
-
*
|
|
4238
|
-
* for (const cookie of exampleCookies) {
|
|
4239
|
-
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4240
|
-
* }
|
|
4241
|
+
* // Access as Cookie instances for programmatic use
|
|
4242
|
+
* for (const cookie of cookies.array) {
|
|
4243
|
+
* console.log(`${cookie.key}=${cookie.value} (expires: ${cookie.expires})`);
|
|
4241
4244
|
* }
|
|
4242
4245
|
*
|
|
4243
|
-
* //
|
|
4244
|
-
*
|
|
4245
|
-
*
|
|
4246
|
+
* // Get cookie header string for manual HTTP requests
|
|
4247
|
+
* console.log(cookies.string); // "session=abc123; user=john"
|
|
4248
|
+
*
|
|
4249
|
+
* // Save to Netscape cookie file
|
|
4250
|
+
* fs.writeFileSync('cookies.txt', cookies.netscape);
|
|
4246
4251
|
*
|
|
4247
|
-
* //
|
|
4248
|
-
* const
|
|
4249
|
-
*
|
|
4250
|
-
*
|
|
4252
|
+
* // Serialize to JSON for storage
|
|
4253
|
+
* const json = JSON.stringify(cookies.serialized);
|
|
4254
|
+
* localStorage.setItem('cookies', json);
|
|
4255
|
+
*
|
|
4256
|
+
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4257
|
+
* for (const setCookie of cookies.setCookiesString) {
|
|
4258
|
+
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4259
|
+
* }
|
|
4251
4260
|
*
|
|
4252
|
-
* //
|
|
4253
|
-
*
|
|
4261
|
+
* // Check cookie count
|
|
4262
|
+
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4254
4263
|
*
|
|
4255
|
-
* //
|
|
4256
|
-
* const
|
|
4257
|
-
* ?.some(c => c.key === 'session');
|
|
4264
|
+
* // Find specific cookie
|
|
4265
|
+
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4258
4266
|
* ```
|
|
4259
4267
|
*
|
|
4260
4268
|
* @see {@link setCookies} - Set cookies in the jar
|
|
4269
|
+
* @see {@link clearCookies} - Remove all cookies from the jar
|
|
4261
4270
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4262
4271
|
*/
|
|
4263
4272
|
getCookies(): Cookies;
|
|
4273
|
+
/**
|
|
4274
|
+
* Remove all cookies from the cookie jar.
|
|
4275
|
+
*
|
|
4276
|
+
* This method synchronously clears the entire cookie store, removing all
|
|
4277
|
+
* cookies regardless of domain, path, or expiration. Useful for:
|
|
4278
|
+
* - Logging out users and clearing session state
|
|
4279
|
+
* - Resetting the client to a clean state between test runs
|
|
4280
|
+
* - Implementing "clear cookies" functionality in applications
|
|
4281
|
+
* - Starting fresh before authenticating with different credentials
|
|
4282
|
+
*
|
|
4283
|
+
* This operation is immediate and cannot be undone. If you need to preserve
|
|
4284
|
+
* certain cookies, use {@link getCookies} to save them before clearing,
|
|
4285
|
+
* then restore specific ones with {@link setCookies}.
|
|
4286
|
+
*
|
|
4287
|
+
* @example
|
|
4288
|
+
* ```typescript
|
|
4289
|
+
* // Simple logout - clear all cookies
|
|
4290
|
+
* rezo.clearCookies();
|
|
4291
|
+
*
|
|
4292
|
+
* // Save cookies before clearing (if needed)
|
|
4293
|
+
* const savedCookies = rezo.getCookies();
|
|
4294
|
+
* rezo.clearCookies();
|
|
4295
|
+
* // Later, restore specific cookies if needed
|
|
4296
|
+
* const importantCookies = savedCookies.array.filter(c => c.key === 'preferences');
|
|
4297
|
+
* rezo.setCookies(importantCookies);
|
|
4298
|
+
*
|
|
4299
|
+
* // Clear and re-authenticate
|
|
4300
|
+
* rezo.clearCookies();
|
|
4301
|
+
* await rezo.post('https://api.example.com/login', {
|
|
4302
|
+
* username: 'newuser',
|
|
4303
|
+
* password: 'newpass'
|
|
4304
|
+
* });
|
|
4305
|
+
*
|
|
4306
|
+
* // Use in test teardown
|
|
4307
|
+
* afterEach(() => {
|
|
4308
|
+
* rezo.clearCookies(); // Clean state for next test
|
|
4309
|
+
* });
|
|
4310
|
+
* ```
|
|
4311
|
+
*
|
|
4312
|
+
* @see {@link getCookies} - Get all cookies before clearing
|
|
4313
|
+
* @see {@link setCookies} - Restore or set new cookies after clearing
|
|
4314
|
+
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more control
|
|
4315
|
+
*/
|
|
4316
|
+
clearCookies(): void;
|
|
4264
4317
|
}
|
|
4265
4318
|
/**
|
|
4266
4319
|
* Extended Rezo instance with Axios-compatible static helpers.
|
|
@@ -4219,48 +4219,101 @@ export declare class Rezo {
|
|
|
4219
4219
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4220
4220
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4221
4221
|
/**
|
|
4222
|
-
* Get all cookies from the cookie jar.
|
|
4222
|
+
* Get all cookies from the cookie jar in multiple convenient formats.
|
|
4223
4223
|
*
|
|
4224
|
-
* Returns a `Cookies` object
|
|
4225
|
-
*
|
|
4226
|
-
*
|
|
4224
|
+
* Returns a `Cookies` object containing all stored cookies in various formats
|
|
4225
|
+
* for different use cases. This provides flexible access to cookies for
|
|
4226
|
+
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4227
4227
|
*
|
|
4228
|
-
*
|
|
4228
|
+
* The returned `Cookies` object contains:
|
|
4229
|
+
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4230
|
+
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
4231
|
+
* - **netscape**: `string` - Netscape cookie file format for file-based storage
|
|
4232
|
+
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4233
|
+
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4234
|
+
*
|
|
4235
|
+
* @returns A Cookies object with cookies in multiple formats
|
|
4229
4236
|
*
|
|
4230
4237
|
* @example
|
|
4231
4238
|
* ```typescript
|
|
4232
|
-
* // Get all cookies
|
|
4233
4239
|
* const cookies = rezo.getCookies();
|
|
4234
4240
|
*
|
|
4235
|
-
* // Access
|
|
4236
|
-
* const
|
|
4237
|
-
*
|
|
4238
|
-
* for (const cookie of exampleCookies) {
|
|
4239
|
-
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4240
|
-
* }
|
|
4241
|
+
* // Access as Cookie instances for programmatic use
|
|
4242
|
+
* for (const cookie of cookies.array) {
|
|
4243
|
+
* console.log(`${cookie.key}=${cookie.value} (expires: ${cookie.expires})`);
|
|
4241
4244
|
* }
|
|
4242
4245
|
*
|
|
4243
|
-
* //
|
|
4244
|
-
*
|
|
4245
|
-
*
|
|
4246
|
+
* // Get cookie header string for manual HTTP requests
|
|
4247
|
+
* console.log(cookies.string); // "session=abc123; user=john"
|
|
4248
|
+
*
|
|
4249
|
+
* // Save to Netscape cookie file
|
|
4250
|
+
* fs.writeFileSync('cookies.txt', cookies.netscape);
|
|
4246
4251
|
*
|
|
4247
|
-
* //
|
|
4248
|
-
* const
|
|
4249
|
-
*
|
|
4250
|
-
*
|
|
4252
|
+
* // Serialize to JSON for storage
|
|
4253
|
+
* const json = JSON.stringify(cookies.serialized);
|
|
4254
|
+
* localStorage.setItem('cookies', json);
|
|
4255
|
+
*
|
|
4256
|
+
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4257
|
+
* for (const setCookie of cookies.setCookiesString) {
|
|
4258
|
+
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4259
|
+
* }
|
|
4251
4260
|
*
|
|
4252
|
-
* //
|
|
4253
|
-
*
|
|
4261
|
+
* // Check cookie count
|
|
4262
|
+
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4254
4263
|
*
|
|
4255
|
-
* //
|
|
4256
|
-
* const
|
|
4257
|
-
* ?.some(c => c.key === 'session');
|
|
4264
|
+
* // Find specific cookie
|
|
4265
|
+
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4258
4266
|
* ```
|
|
4259
4267
|
*
|
|
4260
4268
|
* @see {@link setCookies} - Set cookies in the jar
|
|
4269
|
+
* @see {@link clearCookies} - Remove all cookies from the jar
|
|
4261
4270
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4262
4271
|
*/
|
|
4263
4272
|
getCookies(): Cookies;
|
|
4273
|
+
/**
|
|
4274
|
+
* Remove all cookies from the cookie jar.
|
|
4275
|
+
*
|
|
4276
|
+
* This method synchronously clears the entire cookie store, removing all
|
|
4277
|
+
* cookies regardless of domain, path, or expiration. Useful for:
|
|
4278
|
+
* - Logging out users and clearing session state
|
|
4279
|
+
* - Resetting the client to a clean state between test runs
|
|
4280
|
+
* - Implementing "clear cookies" functionality in applications
|
|
4281
|
+
* - Starting fresh before authenticating with different credentials
|
|
4282
|
+
*
|
|
4283
|
+
* This operation is immediate and cannot be undone. If you need to preserve
|
|
4284
|
+
* certain cookies, use {@link getCookies} to save them before clearing,
|
|
4285
|
+
* then restore specific ones with {@link setCookies}.
|
|
4286
|
+
*
|
|
4287
|
+
* @example
|
|
4288
|
+
* ```typescript
|
|
4289
|
+
* // Simple logout - clear all cookies
|
|
4290
|
+
* rezo.clearCookies();
|
|
4291
|
+
*
|
|
4292
|
+
* // Save cookies before clearing (if needed)
|
|
4293
|
+
* const savedCookies = rezo.getCookies();
|
|
4294
|
+
* rezo.clearCookies();
|
|
4295
|
+
* // Later, restore specific cookies if needed
|
|
4296
|
+
* const importantCookies = savedCookies.array.filter(c => c.key === 'preferences');
|
|
4297
|
+
* rezo.setCookies(importantCookies);
|
|
4298
|
+
*
|
|
4299
|
+
* // Clear and re-authenticate
|
|
4300
|
+
* rezo.clearCookies();
|
|
4301
|
+
* await rezo.post('https://api.example.com/login', {
|
|
4302
|
+
* username: 'newuser',
|
|
4303
|
+
* password: 'newpass'
|
|
4304
|
+
* });
|
|
4305
|
+
*
|
|
4306
|
+
* // Use in test teardown
|
|
4307
|
+
* afterEach(() => {
|
|
4308
|
+
* rezo.clearCookies(); // Clean state for next test
|
|
4309
|
+
* });
|
|
4310
|
+
* ```
|
|
4311
|
+
*
|
|
4312
|
+
* @see {@link getCookies} - Get all cookies before clearing
|
|
4313
|
+
* @see {@link setCookies} - Restore or set new cookies after clearing
|
|
4314
|
+
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more control
|
|
4315
|
+
*/
|
|
4316
|
+
clearCookies(): void;
|
|
4264
4317
|
}
|
|
4265
4318
|
/**
|
|
4266
4319
|
* Extended Rezo instance with Axios-compatible static helpers.
|
|
@@ -4219,48 +4219,101 @@ export declare class Rezo {
|
|
|
4219
4219
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4220
4220
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4221
4221
|
/**
|
|
4222
|
-
* Get all cookies from the cookie jar.
|
|
4222
|
+
* Get all cookies from the cookie jar in multiple convenient formats.
|
|
4223
4223
|
*
|
|
4224
|
-
* Returns a `Cookies` object
|
|
4225
|
-
*
|
|
4226
|
-
*
|
|
4224
|
+
* Returns a `Cookies` object containing all stored cookies in various formats
|
|
4225
|
+
* for different use cases. This provides flexible access to cookies for
|
|
4226
|
+
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4227
4227
|
*
|
|
4228
|
-
*
|
|
4228
|
+
* The returned `Cookies` object contains:
|
|
4229
|
+
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4230
|
+
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
4231
|
+
* - **netscape**: `string` - Netscape cookie file format for file-based storage
|
|
4232
|
+
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4233
|
+
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4234
|
+
*
|
|
4235
|
+
* @returns A Cookies object with cookies in multiple formats
|
|
4229
4236
|
*
|
|
4230
4237
|
* @example
|
|
4231
4238
|
* ```typescript
|
|
4232
|
-
* // Get all cookies
|
|
4233
4239
|
* const cookies = rezo.getCookies();
|
|
4234
4240
|
*
|
|
4235
|
-
* // Access
|
|
4236
|
-
* const
|
|
4237
|
-
*
|
|
4238
|
-
* for (const cookie of exampleCookies) {
|
|
4239
|
-
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4240
|
-
* }
|
|
4241
|
+
* // Access as Cookie instances for programmatic use
|
|
4242
|
+
* for (const cookie of cookies.array) {
|
|
4243
|
+
* console.log(`${cookie.key}=${cookie.value} (expires: ${cookie.expires})`);
|
|
4241
4244
|
* }
|
|
4242
4245
|
*
|
|
4243
|
-
* //
|
|
4244
|
-
*
|
|
4245
|
-
*
|
|
4246
|
+
* // Get cookie header string for manual HTTP requests
|
|
4247
|
+
* console.log(cookies.string); // "session=abc123; user=john"
|
|
4248
|
+
*
|
|
4249
|
+
* // Save to Netscape cookie file
|
|
4250
|
+
* fs.writeFileSync('cookies.txt', cookies.netscape);
|
|
4246
4251
|
*
|
|
4247
|
-
* //
|
|
4248
|
-
* const
|
|
4249
|
-
*
|
|
4250
|
-
*
|
|
4252
|
+
* // Serialize to JSON for storage
|
|
4253
|
+
* const json = JSON.stringify(cookies.serialized);
|
|
4254
|
+
* localStorage.setItem('cookies', json);
|
|
4255
|
+
*
|
|
4256
|
+
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4257
|
+
* for (const setCookie of cookies.setCookiesString) {
|
|
4258
|
+
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4259
|
+
* }
|
|
4251
4260
|
*
|
|
4252
|
-
* //
|
|
4253
|
-
*
|
|
4261
|
+
* // Check cookie count
|
|
4262
|
+
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4254
4263
|
*
|
|
4255
|
-
* //
|
|
4256
|
-
* const
|
|
4257
|
-
* ?.some(c => c.key === 'session');
|
|
4264
|
+
* // Find specific cookie
|
|
4265
|
+
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4258
4266
|
* ```
|
|
4259
4267
|
*
|
|
4260
4268
|
* @see {@link setCookies} - Set cookies in the jar
|
|
4269
|
+
* @see {@link clearCookies} - Remove all cookies from the jar
|
|
4261
4270
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4262
4271
|
*/
|
|
4263
4272
|
getCookies(): Cookies;
|
|
4273
|
+
/**
|
|
4274
|
+
* Remove all cookies from the cookie jar.
|
|
4275
|
+
*
|
|
4276
|
+
* This method synchronously clears the entire cookie store, removing all
|
|
4277
|
+
* cookies regardless of domain, path, or expiration. Useful for:
|
|
4278
|
+
* - Logging out users and clearing session state
|
|
4279
|
+
* - Resetting the client to a clean state between test runs
|
|
4280
|
+
* - Implementing "clear cookies" functionality in applications
|
|
4281
|
+
* - Starting fresh before authenticating with different credentials
|
|
4282
|
+
*
|
|
4283
|
+
* This operation is immediate and cannot be undone. If you need to preserve
|
|
4284
|
+
* certain cookies, use {@link getCookies} to save them before clearing,
|
|
4285
|
+
* then restore specific ones with {@link setCookies}.
|
|
4286
|
+
*
|
|
4287
|
+
* @example
|
|
4288
|
+
* ```typescript
|
|
4289
|
+
* // Simple logout - clear all cookies
|
|
4290
|
+
* rezo.clearCookies();
|
|
4291
|
+
*
|
|
4292
|
+
* // Save cookies before clearing (if needed)
|
|
4293
|
+
* const savedCookies = rezo.getCookies();
|
|
4294
|
+
* rezo.clearCookies();
|
|
4295
|
+
* // Later, restore specific cookies if needed
|
|
4296
|
+
* const importantCookies = savedCookies.array.filter(c => c.key === 'preferences');
|
|
4297
|
+
* rezo.setCookies(importantCookies);
|
|
4298
|
+
*
|
|
4299
|
+
* // Clear and re-authenticate
|
|
4300
|
+
* rezo.clearCookies();
|
|
4301
|
+
* await rezo.post('https://api.example.com/login', {
|
|
4302
|
+
* username: 'newuser',
|
|
4303
|
+
* password: 'newpass'
|
|
4304
|
+
* });
|
|
4305
|
+
*
|
|
4306
|
+
* // Use in test teardown
|
|
4307
|
+
* afterEach(() => {
|
|
4308
|
+
* rezo.clearCookies(); // Clean state for next test
|
|
4309
|
+
* });
|
|
4310
|
+
* ```
|
|
4311
|
+
*
|
|
4312
|
+
* @see {@link getCookies} - Get all cookies before clearing
|
|
4313
|
+
* @see {@link setCookies} - Restore or set new cookies after clearing
|
|
4314
|
+
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more control
|
|
4315
|
+
*/
|
|
4316
|
+
clearCookies(): void;
|
|
4264
4317
|
}
|
|
4265
4318
|
/**
|
|
4266
4319
|
* Extended Rezo instance with Axios-compatible static helpers.
|
|
@@ -4219,48 +4219,101 @@ export declare class Rezo {
|
|
|
4219
4219
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4220
4220
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4221
4221
|
/**
|
|
4222
|
-
* Get all cookies from the cookie jar.
|
|
4222
|
+
* Get all cookies from the cookie jar in multiple convenient formats.
|
|
4223
4223
|
*
|
|
4224
|
-
* Returns a `Cookies` object
|
|
4225
|
-
*
|
|
4226
|
-
*
|
|
4224
|
+
* Returns a `Cookies` object containing all stored cookies in various formats
|
|
4225
|
+
* for different use cases. This provides flexible access to cookies for
|
|
4226
|
+
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4227
4227
|
*
|
|
4228
|
-
*
|
|
4228
|
+
* The returned `Cookies` object contains:
|
|
4229
|
+
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4230
|
+
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
4231
|
+
* - **netscape**: `string` - Netscape cookie file format for file-based storage
|
|
4232
|
+
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4233
|
+
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4234
|
+
*
|
|
4235
|
+
* @returns A Cookies object with cookies in multiple formats
|
|
4229
4236
|
*
|
|
4230
4237
|
* @example
|
|
4231
4238
|
* ```typescript
|
|
4232
|
-
* // Get all cookies
|
|
4233
4239
|
* const cookies = rezo.getCookies();
|
|
4234
4240
|
*
|
|
4235
|
-
* // Access
|
|
4236
|
-
* const
|
|
4237
|
-
*
|
|
4238
|
-
* for (const cookie of exampleCookies) {
|
|
4239
|
-
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4240
|
-
* }
|
|
4241
|
+
* // Access as Cookie instances for programmatic use
|
|
4242
|
+
* for (const cookie of cookies.array) {
|
|
4243
|
+
* console.log(`${cookie.key}=${cookie.value} (expires: ${cookie.expires})`);
|
|
4241
4244
|
* }
|
|
4242
4245
|
*
|
|
4243
|
-
* //
|
|
4244
|
-
*
|
|
4245
|
-
*
|
|
4246
|
+
* // Get cookie header string for manual HTTP requests
|
|
4247
|
+
* console.log(cookies.string); // "session=abc123; user=john"
|
|
4248
|
+
*
|
|
4249
|
+
* // Save to Netscape cookie file
|
|
4250
|
+
* fs.writeFileSync('cookies.txt', cookies.netscape);
|
|
4246
4251
|
*
|
|
4247
|
-
* //
|
|
4248
|
-
* const
|
|
4249
|
-
*
|
|
4250
|
-
*
|
|
4252
|
+
* // Serialize to JSON for storage
|
|
4253
|
+
* const json = JSON.stringify(cookies.serialized);
|
|
4254
|
+
* localStorage.setItem('cookies', json);
|
|
4255
|
+
*
|
|
4256
|
+
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4257
|
+
* for (const setCookie of cookies.setCookiesString) {
|
|
4258
|
+
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4259
|
+
* }
|
|
4251
4260
|
*
|
|
4252
|
-
* //
|
|
4253
|
-
*
|
|
4261
|
+
* // Check cookie count
|
|
4262
|
+
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4254
4263
|
*
|
|
4255
|
-
* //
|
|
4256
|
-
* const
|
|
4257
|
-
* ?.some(c => c.key === 'session');
|
|
4264
|
+
* // Find specific cookie
|
|
4265
|
+
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4258
4266
|
* ```
|
|
4259
4267
|
*
|
|
4260
4268
|
* @see {@link setCookies} - Set cookies in the jar
|
|
4269
|
+
* @see {@link clearCookies} - Remove all cookies from the jar
|
|
4261
4270
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4262
4271
|
*/
|
|
4263
4272
|
getCookies(): Cookies;
|
|
4273
|
+
/**
|
|
4274
|
+
* Remove all cookies from the cookie jar.
|
|
4275
|
+
*
|
|
4276
|
+
* This method synchronously clears the entire cookie store, removing all
|
|
4277
|
+
* cookies regardless of domain, path, or expiration. Useful for:
|
|
4278
|
+
* - Logging out users and clearing session state
|
|
4279
|
+
* - Resetting the client to a clean state between test runs
|
|
4280
|
+
* - Implementing "clear cookies" functionality in applications
|
|
4281
|
+
* - Starting fresh before authenticating with different credentials
|
|
4282
|
+
*
|
|
4283
|
+
* This operation is immediate and cannot be undone. If you need to preserve
|
|
4284
|
+
* certain cookies, use {@link getCookies} to save them before clearing,
|
|
4285
|
+
* then restore specific ones with {@link setCookies}.
|
|
4286
|
+
*
|
|
4287
|
+
* @example
|
|
4288
|
+
* ```typescript
|
|
4289
|
+
* // Simple logout - clear all cookies
|
|
4290
|
+
* rezo.clearCookies();
|
|
4291
|
+
*
|
|
4292
|
+
* // Save cookies before clearing (if needed)
|
|
4293
|
+
* const savedCookies = rezo.getCookies();
|
|
4294
|
+
* rezo.clearCookies();
|
|
4295
|
+
* // Later, restore specific cookies if needed
|
|
4296
|
+
* const importantCookies = savedCookies.array.filter(c => c.key === 'preferences');
|
|
4297
|
+
* rezo.setCookies(importantCookies);
|
|
4298
|
+
*
|
|
4299
|
+
* // Clear and re-authenticate
|
|
4300
|
+
* rezo.clearCookies();
|
|
4301
|
+
* await rezo.post('https://api.example.com/login', {
|
|
4302
|
+
* username: 'newuser',
|
|
4303
|
+
* password: 'newpass'
|
|
4304
|
+
* });
|
|
4305
|
+
*
|
|
4306
|
+
* // Use in test teardown
|
|
4307
|
+
* afterEach(() => {
|
|
4308
|
+
* rezo.clearCookies(); // Clean state for next test
|
|
4309
|
+
* });
|
|
4310
|
+
* ```
|
|
4311
|
+
*
|
|
4312
|
+
* @see {@link getCookies} - Get all cookies before clearing
|
|
4313
|
+
* @see {@link setCookies} - Restore or set new cookies after clearing
|
|
4314
|
+
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more control
|
|
4315
|
+
*/
|
|
4316
|
+
clearCookies(): void;
|
|
4264
4317
|
}
|
|
4265
4318
|
/**
|
|
4266
4319
|
* Extended Rezo instance with Axios-compatible static helpers.
|
|
@@ -4219,48 +4219,101 @@ export declare class Rezo {
|
|
|
4219
4219
|
setCookies(setCookieArray: string[], url: string, startNew?: boolean): void;
|
|
4220
4220
|
setCookies(setCookieArray: string[], url: string | undefined, startNew: boolean): void;
|
|
4221
4221
|
/**
|
|
4222
|
-
* Get all cookies from the cookie jar.
|
|
4222
|
+
* Get all cookies from the cookie jar in multiple convenient formats.
|
|
4223
4223
|
*
|
|
4224
|
-
* Returns a `Cookies` object
|
|
4225
|
-
*
|
|
4226
|
-
*
|
|
4224
|
+
* Returns a `Cookies` object containing all stored cookies in various formats
|
|
4225
|
+
* for different use cases. This provides flexible access to cookies for
|
|
4226
|
+
* HTTP headers, file storage, serialization, or programmatic manipulation.
|
|
4227
4227
|
*
|
|
4228
|
-
*
|
|
4228
|
+
* The returned `Cookies` object contains:
|
|
4229
|
+
* - **array**: `Cookie[]` - Array of Cookie class instances for programmatic access
|
|
4230
|
+
* - **serialized**: `SerializedCookie[]` - Plain objects for JSON serialization/storage
|
|
4231
|
+
* - **netscape**: `string` - Netscape cookie file format for file-based storage
|
|
4232
|
+
* - **string**: `string` - Cookie header format (`key=value; key2=value2`) for HTTP requests
|
|
4233
|
+
* - **setCookiesString**: `string[]` - Array of Set-Cookie header strings
|
|
4234
|
+
*
|
|
4235
|
+
* @returns A Cookies object with cookies in multiple formats
|
|
4229
4236
|
*
|
|
4230
4237
|
* @example
|
|
4231
4238
|
* ```typescript
|
|
4232
|
-
* // Get all cookies
|
|
4233
4239
|
* const cookies = rezo.getCookies();
|
|
4234
4240
|
*
|
|
4235
|
-
* // Access
|
|
4236
|
-
* const
|
|
4237
|
-
*
|
|
4238
|
-
* for (const cookie of exampleCookies) {
|
|
4239
|
-
* console.log(`${cookie.key}=${cookie.value}`);
|
|
4240
|
-
* }
|
|
4241
|
+
* // Access as Cookie instances for programmatic use
|
|
4242
|
+
* for (const cookie of cookies.array) {
|
|
4243
|
+
* console.log(`${cookie.key}=${cookie.value} (expires: ${cookie.expires})`);
|
|
4241
4244
|
* }
|
|
4242
4245
|
*
|
|
4243
|
-
* //
|
|
4244
|
-
*
|
|
4245
|
-
*
|
|
4246
|
+
* // Get cookie header string for manual HTTP requests
|
|
4247
|
+
* console.log(cookies.string); // "session=abc123; user=john"
|
|
4248
|
+
*
|
|
4249
|
+
* // Save to Netscape cookie file
|
|
4250
|
+
* fs.writeFileSync('cookies.txt', cookies.netscape);
|
|
4246
4251
|
*
|
|
4247
|
-
* //
|
|
4248
|
-
* const
|
|
4249
|
-
*
|
|
4250
|
-
*
|
|
4252
|
+
* // Serialize to JSON for storage
|
|
4253
|
+
* const json = JSON.stringify(cookies.serialized);
|
|
4254
|
+
* localStorage.setItem('cookies', json);
|
|
4255
|
+
*
|
|
4256
|
+
* // Get Set-Cookie headers (useful for proxying responses)
|
|
4257
|
+
* for (const setCookie of cookies.setCookiesString) {
|
|
4258
|
+
* console.log(setCookie); // "session=abc123; Domain=example.com; Path=/; HttpOnly"
|
|
4259
|
+
* }
|
|
4251
4260
|
*
|
|
4252
|
-
* //
|
|
4253
|
-
*
|
|
4261
|
+
* // Check cookie count
|
|
4262
|
+
* console.log(`Total cookies: ${cookies.array.length}`);
|
|
4254
4263
|
*
|
|
4255
|
-
* //
|
|
4256
|
-
* const
|
|
4257
|
-
* ?.some(c => c.key === 'session');
|
|
4264
|
+
* // Find specific cookie
|
|
4265
|
+
* const sessionCookie = cookies.array.find(c => c.key === 'session');
|
|
4258
4266
|
* ```
|
|
4259
4267
|
*
|
|
4260
4268
|
* @see {@link setCookies} - Set cookies in the jar
|
|
4269
|
+
* @see {@link clearCookies} - Remove all cookies from the jar
|
|
4261
4270
|
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more methods
|
|
4262
4271
|
*/
|
|
4263
4272
|
getCookies(): Cookies;
|
|
4273
|
+
/**
|
|
4274
|
+
* Remove all cookies from the cookie jar.
|
|
4275
|
+
*
|
|
4276
|
+
* This method synchronously clears the entire cookie store, removing all
|
|
4277
|
+
* cookies regardless of domain, path, or expiration. Useful for:
|
|
4278
|
+
* - Logging out users and clearing session state
|
|
4279
|
+
* - Resetting the client to a clean state between test runs
|
|
4280
|
+
* - Implementing "clear cookies" functionality in applications
|
|
4281
|
+
* - Starting fresh before authenticating with different credentials
|
|
4282
|
+
*
|
|
4283
|
+
* This operation is immediate and cannot be undone. If you need to preserve
|
|
4284
|
+
* certain cookies, use {@link getCookies} to save them before clearing,
|
|
4285
|
+
* then restore specific ones with {@link setCookies}.
|
|
4286
|
+
*
|
|
4287
|
+
* @example
|
|
4288
|
+
* ```typescript
|
|
4289
|
+
* // Simple logout - clear all cookies
|
|
4290
|
+
* rezo.clearCookies();
|
|
4291
|
+
*
|
|
4292
|
+
* // Save cookies before clearing (if needed)
|
|
4293
|
+
* const savedCookies = rezo.getCookies();
|
|
4294
|
+
* rezo.clearCookies();
|
|
4295
|
+
* // Later, restore specific cookies if needed
|
|
4296
|
+
* const importantCookies = savedCookies.array.filter(c => c.key === 'preferences');
|
|
4297
|
+
* rezo.setCookies(importantCookies);
|
|
4298
|
+
*
|
|
4299
|
+
* // Clear and re-authenticate
|
|
4300
|
+
* rezo.clearCookies();
|
|
4301
|
+
* await rezo.post('https://api.example.com/login', {
|
|
4302
|
+
* username: 'newuser',
|
|
4303
|
+
* password: 'newpass'
|
|
4304
|
+
* });
|
|
4305
|
+
*
|
|
4306
|
+
* // Use in test teardown
|
|
4307
|
+
* afterEach(() => {
|
|
4308
|
+
* rezo.clearCookies(); // Clean state for next test
|
|
4309
|
+
* });
|
|
4310
|
+
* ```
|
|
4311
|
+
*
|
|
4312
|
+
* @see {@link getCookies} - Get all cookies before clearing
|
|
4313
|
+
* @see {@link setCookies} - Restore or set new cookies after clearing
|
|
4314
|
+
* @see {@link cookieJar} - Access the underlying RezoCookieJar for more control
|
|
4315
|
+
*/
|
|
4316
|
+
clearCookies(): void;
|
|
4264
4317
|
}
|
|
4265
4318
|
/**
|
|
4266
4319
|
* Extended Rezo instance with Axios-compatible static helpers.
|