@mherod/get-cookie 4.4.2 → 4.5.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/README.md +26 -5
- package/dist/bun.cjs +77 -0
- package/dist/bun.cjs.map +1 -0
- package/dist/bun.d.cts +3 -0
- package/dist/bun.d.ts +3 -0
- package/dist/bun.js +77 -0
- package/dist/bun.js.map +1 -0
- package/dist/cli.cjs +14 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -37
- package/dist/index.d.ts +103 -37
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +77 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +3 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.js +77 -0
- package/dist/node.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -14
- package/.claude/settings.local.json +0 -3
- package/.dependency-cruiser.js +0 -277
- package/.env.example +0 -5
- package/.husky/commit-msg +0 -19
- package/.husky/pre-commit +0 -29
- package/.husky/pre-push +0 -21
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/get-cookie.iml +0 -13
- package/.idea/git_toolbox_prj.xml +0 -15
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -9
- package/.idea/runConfigurations/build.xml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.nvmrc +0 -1
- package/biome.json +0 -117
- package/commitlint.config.js +0 -12
- package/eslint.config.js +0 -255
- package/examples/README.md +0 -71
- package/examples/advanced-usage.ts +0 -56
- package/examples/auth-tokens.ts +0 -143
- package/examples/basic-usage.ts +0 -43
- package/examples/cli-examples.sh +0 -51
- package/examples/comprehensive-demo.ts +0 -202
- package/examples/curl-integration.sh +0 -311
- package/examples/features-demo.sh +0 -260
- package/examples/github-auth.sh +0 -295
- package/examples/quick-start.sh +0 -115
- package/jest.setup.js +0 -34
- package/tsconfig.build.json +0 -9
- package/tsconfig.cli.json +0 -16
- package/tsconfig.tsup.json +0 -12
- package/tsup.cli.ts +0 -59
- package/tsup.lib.ts +0 -46
- package/typedoc.json +0 -17
package/dist/index.d.cts
CHANGED
|
@@ -98,6 +98,7 @@ declare const ExportedCookieSchema: z.ZodObject<{
|
|
|
98
98
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
99
99
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
100
100
|
path: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
101
|
+
containerId: z.ZodOptional<z.ZodNumber>;
|
|
101
102
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
102
103
|
}, z.core.$strict>;
|
|
103
104
|
/**
|
|
@@ -270,6 +271,21 @@ declare class CompositeCookieQueryStrategy implements CookieQueryStrategy {
|
|
|
270
271
|
queryCookies(name: string, domain: string, store?: string, force?: boolean): Promise<ExportedCookie[]>;
|
|
271
272
|
}
|
|
272
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Chromium browser configuration and path management
|
|
276
|
+
* Supports Chrome, Chromium, Brave, Edge, Opera, Vivaldi, and Whale browsers
|
|
277
|
+
* across Windows, macOS, and Linux platforms
|
|
278
|
+
*/
|
|
279
|
+
/**
|
|
280
|
+
* Supported Chromium-based browsers
|
|
281
|
+
*/
|
|
282
|
+
declare const CHROMIUM_BASED_BROWSERS: readonly ["chrome", "chromium", "brave", "edge", "arc", "opera", "opera-gx", "vivaldi", "whale"];
|
|
283
|
+
/**
|
|
284
|
+
* Type representing all supported Chromium-based browsers.
|
|
285
|
+
* This includes Chrome, Edge, Brave, Arc, Opera, and other Chromium derivatives.
|
|
286
|
+
*/
|
|
287
|
+
type ChromiumBrowser = (typeof CHROMIUM_BASED_BROWSERS)[number];
|
|
288
|
+
|
|
273
289
|
/**
|
|
274
290
|
* Base class for cookie query strategies.
|
|
275
291
|
* Provides common functionality and standardized error handling for browser-specific implementations.
|
|
@@ -437,21 +453,6 @@ declare class BrowserLockHandler {
|
|
|
437
453
|
relaunchBrowser(): Promise<void>;
|
|
438
454
|
}
|
|
439
455
|
|
|
440
|
-
/**
|
|
441
|
-
* Chromium browser configuration and path management
|
|
442
|
-
* Supports Chrome, Chromium, Brave, Edge, Opera, Vivaldi, and Whale browsers
|
|
443
|
-
* across Windows, macOS, and Linux platforms
|
|
444
|
-
*/
|
|
445
|
-
/**
|
|
446
|
-
* Supported Chromium-based browsers
|
|
447
|
-
*/
|
|
448
|
-
declare const CHROMIUM_BASED_BROWSERS: readonly ["chrome", "chromium", "brave", "edge", "arc", "opera", "opera-gx", "vivaldi", "whale"];
|
|
449
|
-
/**
|
|
450
|
-
* Type representing all supported Chromium-based browsers.
|
|
451
|
-
* This includes Chrome, Edge, Brave, Arc, Opera, and other Chromium derivatives.
|
|
452
|
-
*/
|
|
453
|
-
type ChromiumBrowser = (typeof CHROMIUM_BASED_BROWSERS)[number];
|
|
454
|
-
|
|
455
456
|
interface DecryptionContext {
|
|
456
457
|
file: string;
|
|
457
458
|
password: string | Buffer;
|
|
@@ -463,6 +464,13 @@ interface DecryptionContext {
|
|
|
463
464
|
* This abstract class provides shared logic for Chrome, Chromium, Brave, Edge, etc.
|
|
464
465
|
*/
|
|
465
466
|
declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
467
|
+
/**
|
|
468
|
+
* Maximum number of profile cookie files read concurrently in a single batch
|
|
469
|
+
* query. Bounds the number of simultaneously open SQLite handles; kept in line
|
|
470
|
+
* with the DatabaseConnectionManager default pool size (`maxConnections: 5`)
|
|
471
|
+
* so a full batch fits the pool without forcing it to open extra connections.
|
|
472
|
+
*/
|
|
473
|
+
private static readonly MAX_CONCURRENT_PROFILE_READS;
|
|
466
474
|
protected lockHandler: BrowserLockHandler;
|
|
467
475
|
protected browserDisplayName: string;
|
|
468
476
|
protected browserType: ChromiumBrowser;
|
|
@@ -473,6 +481,12 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
473
481
|
* @param browserType - The Chromium browser type for password retrieval
|
|
474
482
|
*/
|
|
475
483
|
constructor(strategyName: string, browserName: string, browserType?: ChromiumBrowser);
|
|
484
|
+
/**
|
|
485
|
+
* Returns the SQL browser type for this strategy.
|
|
486
|
+
* Falls back to "chrome" for Chromium variants not yet in SqlBrowserType
|
|
487
|
+
* (e.g. vivaldi, whale), which all share Chrome's cookie schema.
|
|
488
|
+
*/
|
|
489
|
+
private get sqlBrowserType();
|
|
476
490
|
/**
|
|
477
491
|
* Batch query cookies for multiple specs
|
|
478
492
|
* Optimized to execute combined SQL queries per database file
|
|
@@ -581,52 +595,98 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
581
595
|
}
|
|
582
596
|
|
|
583
597
|
/**
|
|
584
|
-
* Strategy for querying cookies from Chrome
|
|
585
|
-
* This class extends the BaseChromiumCookieQueryStrategy with
|
|
598
|
+
* Strategy for querying cookies from Chromium-based browsers (Chrome, Brave, Edge, etc.)
|
|
599
|
+
* This class extends the BaseChromiumCookieQueryStrategy with browser-specific path discovery
|
|
600
|
+
* and optional profile-name filtering.
|
|
586
601
|
* @example
|
|
587
602
|
* ```typescript
|
|
588
|
-
* const strategy = new
|
|
603
|
+
* const strategy = new ChromiumCookieQueryStrategy('brave');
|
|
604
|
+
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
605
|
+
*
|
|
606
|
+
* // With profile filtering
|
|
607
|
+
* const strategy = new ChromiumCookieQueryStrategy('chrome', 'Work');
|
|
589
608
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
590
609
|
* ```
|
|
591
610
|
*/
|
|
592
|
-
declare class
|
|
611
|
+
declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrategy {
|
|
612
|
+
private readonly browser;
|
|
593
613
|
private readonly profileName?;
|
|
594
614
|
/**
|
|
595
|
-
* Creates a new instance of
|
|
615
|
+
* Creates a new instance of ChromiumCookieQueryStrategy
|
|
616
|
+
* @param browser - The Chromium-based browser to query (chrome, brave, edge, etc.)
|
|
596
617
|
* @param profileName - Optional specific profile name to target
|
|
597
618
|
*/
|
|
598
|
-
constructor(profileName?: string);
|
|
619
|
+
constructor(browser?: ChromiumBrowser, profileName?: string);
|
|
599
620
|
/**
|
|
600
|
-
* Get
|
|
621
|
+
* Get browser-specific cookie file paths, with optional profile filtering
|
|
601
622
|
* @param store - Optional specific store path
|
|
602
623
|
* @returns Array of cookie file paths
|
|
603
624
|
*/
|
|
604
625
|
protected getCookieFilePaths(store?: string): string[];
|
|
626
|
+
/**
|
|
627
|
+
* Filter cookie file paths to only include those matching the target profile name.
|
|
628
|
+
* Reads the browser's Local State file to map profile display names to directories.
|
|
629
|
+
* @param paths - Array of cookie file paths to filter
|
|
630
|
+
* @returns Filtered array of cookie file paths
|
|
631
|
+
*/
|
|
632
|
+
private filterByProfileName;
|
|
605
633
|
}
|
|
606
634
|
|
|
607
635
|
/**
|
|
608
|
-
* Strategy for querying cookies from
|
|
609
|
-
*
|
|
636
|
+
* Strategy for querying cookies from Chrome browser.
|
|
637
|
+
* Extends ChromiumCookieQueryStrategy with Chrome as the target browser.
|
|
638
|
+
* Supports optional profile-name filtering via the profileName constructor parameter.
|
|
610
639
|
* @example
|
|
611
640
|
* ```typescript
|
|
612
|
-
* const strategy = new
|
|
641
|
+
* const strategy = new ChromeCookieQueryStrategy();
|
|
642
|
+
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
643
|
+
*
|
|
644
|
+
* // With profile filtering
|
|
645
|
+
* const strategy = new ChromeCookieQueryStrategy('Work');
|
|
613
646
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
614
647
|
* ```
|
|
615
648
|
*/
|
|
616
|
-
declare class
|
|
617
|
-
private readonly browser;
|
|
649
|
+
declare class ChromeCookieQueryStrategy extends ChromiumCookieQueryStrategy {
|
|
618
650
|
/**
|
|
619
|
-
* Creates a new instance of
|
|
620
|
-
* @param
|
|
651
|
+
* Creates a new instance of ChromeCookieQueryStrategy
|
|
652
|
+
* @param profileName - Optional specific profile name to target
|
|
621
653
|
*/
|
|
622
|
-
constructor(
|
|
654
|
+
constructor(profileName?: string);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Information about a discovered Chromium browser profile.
|
|
659
|
+
*/
|
|
660
|
+
interface ChromiumProfile {
|
|
623
661
|
/**
|
|
624
|
-
*
|
|
625
|
-
* @param store - Optional specific store path
|
|
626
|
-
* @returns Array of cookie file paths
|
|
662
|
+
* Display name of the profile (e.g. "Default", "Person 1", "Work")
|
|
627
663
|
*/
|
|
628
|
-
|
|
664
|
+
name: string;
|
|
665
|
+
/**
|
|
666
|
+
* Profile directory name inside the User Data folder (e.g. "Default", "Profile 1")
|
|
667
|
+
*/
|
|
668
|
+
directory: string;
|
|
669
|
+
/**
|
|
670
|
+
* Absolute path to the profile directory
|
|
671
|
+
*/
|
|
672
|
+
path: string;
|
|
673
|
+
/**
|
|
674
|
+
* Associated email or account user name if available (e.g. "user@example.com")
|
|
675
|
+
*/
|
|
676
|
+
userName?: string;
|
|
677
|
+
/**
|
|
678
|
+
* Browser name/type (e.g. "chrome", "edge", "brave")
|
|
679
|
+
*/
|
|
680
|
+
browser: string;
|
|
629
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* Enumerates installed profiles for a Chromium-based browser (or all Chromium-based browsers).
|
|
684
|
+
*
|
|
685
|
+
* @param targetBrowser - Optional browser name (e.g. "chrome", "edge", "brave") or path to User Data dir.
|
|
686
|
+
* If omitted, enumerates profiles across all supported Chromium browsers on the current OS.
|
|
687
|
+
* @returns Array of discovered ChromiumProfile entries
|
|
688
|
+
*/
|
|
689
|
+
declare function getChromiumProfiles(targetBrowser?: string): ChromiumProfile[];
|
|
630
690
|
|
|
631
691
|
/**
|
|
632
692
|
* Strategy for querying cookies from Firefox browser.
|
|
@@ -644,10 +704,14 @@ declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrateg
|
|
|
644
704
|
*/
|
|
645
705
|
declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
646
706
|
private readonly lockHandler;
|
|
707
|
+
private readonly profileName?;
|
|
708
|
+
private readonly container?;
|
|
647
709
|
/**
|
|
648
710
|
* Creates a new instance of FirefoxCookieQueryStrategy
|
|
711
|
+
* @param profileName - Optional specific profile name to target (matches Name in profiles.ini)
|
|
712
|
+
* @param container - Optional container name, ID, or "none" to filter by
|
|
649
713
|
*/
|
|
650
|
-
constructor();
|
|
714
|
+
constructor(profileName?: string, container?: string | number);
|
|
651
715
|
/**
|
|
652
716
|
* Creates the query parameters for cookie extraction using the new query builder
|
|
653
717
|
* @param name - The cookie name to search for
|
|
@@ -725,10 +789,12 @@ declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
|
725
789
|
*/
|
|
726
790
|
declare class SafariCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
727
791
|
private readonly lockHandler;
|
|
792
|
+
private readonly profileName?;
|
|
728
793
|
/**
|
|
729
794
|
* Creates a new instance of SafariCookieQueryStrategy
|
|
795
|
+
* @param profileName - Ignored; Safari does not support profile filtering
|
|
730
796
|
*/
|
|
731
|
-
constructor();
|
|
797
|
+
constructor(profileName?: string);
|
|
732
798
|
/**
|
|
733
799
|
* Gets the path to Safari's cookie database
|
|
734
800
|
* @param home - The user's home directory
|
|
@@ -1012,4 +1078,4 @@ declare function batchGetCookies(specs: CookieSpec[], options?: BatchGetCookiesO
|
|
|
1012
1078
|
*/
|
|
1013
1079
|
declare function batchGetCookiesWithResults(specs: CookieSpec[], options?: Omit<BatchGetCookiesOptions, "deduplicate">): Promise<BatchCookieResult[]>;
|
|
1014
1080
|
|
|
1015
|
-
export { type BatchCookieResult, type BatchGetCookiesOptions, type BrowserName, ChromeCookieQueryStrategy, ChromiumCookieQueryStrategy, CompositeCookieQueryStrategy, type CookieQueryStrategy, type CookieSpec, type ExportedCookie, FirefoxCookieQueryStrategy, type MultiCookieSpec, type RenderOptions, SafariCookieQueryStrategy, batchGetCookies, batchGetCookiesWithResults, getCookie };
|
|
1081
|
+
export { type BatchCookieResult, type BatchGetCookiesOptions, type BrowserName, ChromeCookieQueryStrategy, ChromiumCookieQueryStrategy, type ChromiumProfile, CompositeCookieQueryStrategy, type CookieQueryStrategy, type CookieSpec, type ExportedCookie, FirefoxCookieQueryStrategy, type MultiCookieSpec, type RenderOptions, SafariCookieQueryStrategy, batchGetCookies, batchGetCookiesWithResults, getChromiumProfiles, getCookie };
|
package/dist/index.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ declare const ExportedCookieSchema: z.ZodObject<{
|
|
|
98
98
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
99
99
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
100
100
|
path: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
101
|
+
containerId: z.ZodOptional<z.ZodNumber>;
|
|
101
102
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
102
103
|
}, z.core.$strict>;
|
|
103
104
|
/**
|
|
@@ -270,6 +271,21 @@ declare class CompositeCookieQueryStrategy implements CookieQueryStrategy {
|
|
|
270
271
|
queryCookies(name: string, domain: string, store?: string, force?: boolean): Promise<ExportedCookie[]>;
|
|
271
272
|
}
|
|
272
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Chromium browser configuration and path management
|
|
276
|
+
* Supports Chrome, Chromium, Brave, Edge, Opera, Vivaldi, and Whale browsers
|
|
277
|
+
* across Windows, macOS, and Linux platforms
|
|
278
|
+
*/
|
|
279
|
+
/**
|
|
280
|
+
* Supported Chromium-based browsers
|
|
281
|
+
*/
|
|
282
|
+
declare const CHROMIUM_BASED_BROWSERS: readonly ["chrome", "chromium", "brave", "edge", "arc", "opera", "opera-gx", "vivaldi", "whale"];
|
|
283
|
+
/**
|
|
284
|
+
* Type representing all supported Chromium-based browsers.
|
|
285
|
+
* This includes Chrome, Edge, Brave, Arc, Opera, and other Chromium derivatives.
|
|
286
|
+
*/
|
|
287
|
+
type ChromiumBrowser = (typeof CHROMIUM_BASED_BROWSERS)[number];
|
|
288
|
+
|
|
273
289
|
/**
|
|
274
290
|
* Base class for cookie query strategies.
|
|
275
291
|
* Provides common functionality and standardized error handling for browser-specific implementations.
|
|
@@ -437,21 +453,6 @@ declare class BrowserLockHandler {
|
|
|
437
453
|
relaunchBrowser(): Promise<void>;
|
|
438
454
|
}
|
|
439
455
|
|
|
440
|
-
/**
|
|
441
|
-
* Chromium browser configuration and path management
|
|
442
|
-
* Supports Chrome, Chromium, Brave, Edge, Opera, Vivaldi, and Whale browsers
|
|
443
|
-
* across Windows, macOS, and Linux platforms
|
|
444
|
-
*/
|
|
445
|
-
/**
|
|
446
|
-
* Supported Chromium-based browsers
|
|
447
|
-
*/
|
|
448
|
-
declare const CHROMIUM_BASED_BROWSERS: readonly ["chrome", "chromium", "brave", "edge", "arc", "opera", "opera-gx", "vivaldi", "whale"];
|
|
449
|
-
/**
|
|
450
|
-
* Type representing all supported Chromium-based browsers.
|
|
451
|
-
* This includes Chrome, Edge, Brave, Arc, Opera, and other Chromium derivatives.
|
|
452
|
-
*/
|
|
453
|
-
type ChromiumBrowser = (typeof CHROMIUM_BASED_BROWSERS)[number];
|
|
454
|
-
|
|
455
456
|
interface DecryptionContext {
|
|
456
457
|
file: string;
|
|
457
458
|
password: string | Buffer;
|
|
@@ -463,6 +464,13 @@ interface DecryptionContext {
|
|
|
463
464
|
* This abstract class provides shared logic for Chrome, Chromium, Brave, Edge, etc.
|
|
464
465
|
*/
|
|
465
466
|
declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
467
|
+
/**
|
|
468
|
+
* Maximum number of profile cookie files read concurrently in a single batch
|
|
469
|
+
* query. Bounds the number of simultaneously open SQLite handles; kept in line
|
|
470
|
+
* with the DatabaseConnectionManager default pool size (`maxConnections: 5`)
|
|
471
|
+
* so a full batch fits the pool without forcing it to open extra connections.
|
|
472
|
+
*/
|
|
473
|
+
private static readonly MAX_CONCURRENT_PROFILE_READS;
|
|
466
474
|
protected lockHandler: BrowserLockHandler;
|
|
467
475
|
protected browserDisplayName: string;
|
|
468
476
|
protected browserType: ChromiumBrowser;
|
|
@@ -473,6 +481,12 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
473
481
|
* @param browserType - The Chromium browser type for password retrieval
|
|
474
482
|
*/
|
|
475
483
|
constructor(strategyName: string, browserName: string, browserType?: ChromiumBrowser);
|
|
484
|
+
/**
|
|
485
|
+
* Returns the SQL browser type for this strategy.
|
|
486
|
+
* Falls back to "chrome" for Chromium variants not yet in SqlBrowserType
|
|
487
|
+
* (e.g. vivaldi, whale), which all share Chrome's cookie schema.
|
|
488
|
+
*/
|
|
489
|
+
private get sqlBrowserType();
|
|
476
490
|
/**
|
|
477
491
|
* Batch query cookies for multiple specs
|
|
478
492
|
* Optimized to execute combined SQL queries per database file
|
|
@@ -581,52 +595,98 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
581
595
|
}
|
|
582
596
|
|
|
583
597
|
/**
|
|
584
|
-
* Strategy for querying cookies from Chrome
|
|
585
|
-
* This class extends the BaseChromiumCookieQueryStrategy with
|
|
598
|
+
* Strategy for querying cookies from Chromium-based browsers (Chrome, Brave, Edge, etc.)
|
|
599
|
+
* This class extends the BaseChromiumCookieQueryStrategy with browser-specific path discovery
|
|
600
|
+
* and optional profile-name filtering.
|
|
586
601
|
* @example
|
|
587
602
|
* ```typescript
|
|
588
|
-
* const strategy = new
|
|
603
|
+
* const strategy = new ChromiumCookieQueryStrategy('brave');
|
|
604
|
+
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
605
|
+
*
|
|
606
|
+
* // With profile filtering
|
|
607
|
+
* const strategy = new ChromiumCookieQueryStrategy('chrome', 'Work');
|
|
589
608
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
590
609
|
* ```
|
|
591
610
|
*/
|
|
592
|
-
declare class
|
|
611
|
+
declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrategy {
|
|
612
|
+
private readonly browser;
|
|
593
613
|
private readonly profileName?;
|
|
594
614
|
/**
|
|
595
|
-
* Creates a new instance of
|
|
615
|
+
* Creates a new instance of ChromiumCookieQueryStrategy
|
|
616
|
+
* @param browser - The Chromium-based browser to query (chrome, brave, edge, etc.)
|
|
596
617
|
* @param profileName - Optional specific profile name to target
|
|
597
618
|
*/
|
|
598
|
-
constructor(profileName?: string);
|
|
619
|
+
constructor(browser?: ChromiumBrowser, profileName?: string);
|
|
599
620
|
/**
|
|
600
|
-
* Get
|
|
621
|
+
* Get browser-specific cookie file paths, with optional profile filtering
|
|
601
622
|
* @param store - Optional specific store path
|
|
602
623
|
* @returns Array of cookie file paths
|
|
603
624
|
*/
|
|
604
625
|
protected getCookieFilePaths(store?: string): string[];
|
|
626
|
+
/**
|
|
627
|
+
* Filter cookie file paths to only include those matching the target profile name.
|
|
628
|
+
* Reads the browser's Local State file to map profile display names to directories.
|
|
629
|
+
* @param paths - Array of cookie file paths to filter
|
|
630
|
+
* @returns Filtered array of cookie file paths
|
|
631
|
+
*/
|
|
632
|
+
private filterByProfileName;
|
|
605
633
|
}
|
|
606
634
|
|
|
607
635
|
/**
|
|
608
|
-
* Strategy for querying cookies from
|
|
609
|
-
*
|
|
636
|
+
* Strategy for querying cookies from Chrome browser.
|
|
637
|
+
* Extends ChromiumCookieQueryStrategy with Chrome as the target browser.
|
|
638
|
+
* Supports optional profile-name filtering via the profileName constructor parameter.
|
|
610
639
|
* @example
|
|
611
640
|
* ```typescript
|
|
612
|
-
* const strategy = new
|
|
641
|
+
* const strategy = new ChromeCookieQueryStrategy();
|
|
642
|
+
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
643
|
+
*
|
|
644
|
+
* // With profile filtering
|
|
645
|
+
* const strategy = new ChromeCookieQueryStrategy('Work');
|
|
613
646
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
614
647
|
* ```
|
|
615
648
|
*/
|
|
616
|
-
declare class
|
|
617
|
-
private readonly browser;
|
|
649
|
+
declare class ChromeCookieQueryStrategy extends ChromiumCookieQueryStrategy {
|
|
618
650
|
/**
|
|
619
|
-
* Creates a new instance of
|
|
620
|
-
* @param
|
|
651
|
+
* Creates a new instance of ChromeCookieQueryStrategy
|
|
652
|
+
* @param profileName - Optional specific profile name to target
|
|
621
653
|
*/
|
|
622
|
-
constructor(
|
|
654
|
+
constructor(profileName?: string);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Information about a discovered Chromium browser profile.
|
|
659
|
+
*/
|
|
660
|
+
interface ChromiumProfile {
|
|
623
661
|
/**
|
|
624
|
-
*
|
|
625
|
-
* @param store - Optional specific store path
|
|
626
|
-
* @returns Array of cookie file paths
|
|
662
|
+
* Display name of the profile (e.g. "Default", "Person 1", "Work")
|
|
627
663
|
*/
|
|
628
|
-
|
|
664
|
+
name: string;
|
|
665
|
+
/**
|
|
666
|
+
* Profile directory name inside the User Data folder (e.g. "Default", "Profile 1")
|
|
667
|
+
*/
|
|
668
|
+
directory: string;
|
|
669
|
+
/**
|
|
670
|
+
* Absolute path to the profile directory
|
|
671
|
+
*/
|
|
672
|
+
path: string;
|
|
673
|
+
/**
|
|
674
|
+
* Associated email or account user name if available (e.g. "user@example.com")
|
|
675
|
+
*/
|
|
676
|
+
userName?: string;
|
|
677
|
+
/**
|
|
678
|
+
* Browser name/type (e.g. "chrome", "edge", "brave")
|
|
679
|
+
*/
|
|
680
|
+
browser: string;
|
|
629
681
|
}
|
|
682
|
+
/**
|
|
683
|
+
* Enumerates installed profiles for a Chromium-based browser (or all Chromium-based browsers).
|
|
684
|
+
*
|
|
685
|
+
* @param targetBrowser - Optional browser name (e.g. "chrome", "edge", "brave") or path to User Data dir.
|
|
686
|
+
* If omitted, enumerates profiles across all supported Chromium browsers on the current OS.
|
|
687
|
+
* @returns Array of discovered ChromiumProfile entries
|
|
688
|
+
*/
|
|
689
|
+
declare function getChromiumProfiles(targetBrowser?: string): ChromiumProfile[];
|
|
630
690
|
|
|
631
691
|
/**
|
|
632
692
|
* Strategy for querying cookies from Firefox browser.
|
|
@@ -644,10 +704,14 @@ declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrateg
|
|
|
644
704
|
*/
|
|
645
705
|
declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
646
706
|
private readonly lockHandler;
|
|
707
|
+
private readonly profileName?;
|
|
708
|
+
private readonly container?;
|
|
647
709
|
/**
|
|
648
710
|
* Creates a new instance of FirefoxCookieQueryStrategy
|
|
711
|
+
* @param profileName - Optional specific profile name to target (matches Name in profiles.ini)
|
|
712
|
+
* @param container - Optional container name, ID, or "none" to filter by
|
|
649
713
|
*/
|
|
650
|
-
constructor();
|
|
714
|
+
constructor(profileName?: string, container?: string | number);
|
|
651
715
|
/**
|
|
652
716
|
* Creates the query parameters for cookie extraction using the new query builder
|
|
653
717
|
* @param name - The cookie name to search for
|
|
@@ -725,10 +789,12 @@ declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
|
725
789
|
*/
|
|
726
790
|
declare class SafariCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
727
791
|
private readonly lockHandler;
|
|
792
|
+
private readonly profileName?;
|
|
728
793
|
/**
|
|
729
794
|
* Creates a new instance of SafariCookieQueryStrategy
|
|
795
|
+
* @param profileName - Ignored; Safari does not support profile filtering
|
|
730
796
|
*/
|
|
731
|
-
constructor();
|
|
797
|
+
constructor(profileName?: string);
|
|
732
798
|
/**
|
|
733
799
|
* Gets the path to Safari's cookie database
|
|
734
800
|
* @param home - The user's home directory
|
|
@@ -1012,4 +1078,4 @@ declare function batchGetCookies(specs: CookieSpec[], options?: BatchGetCookiesO
|
|
|
1012
1078
|
*/
|
|
1013
1079
|
declare function batchGetCookiesWithResults(specs: CookieSpec[], options?: Omit<BatchGetCookiesOptions, "deduplicate">): Promise<BatchCookieResult[]>;
|
|
1014
1080
|
|
|
1015
|
-
export { type BatchCookieResult, type BatchGetCookiesOptions, type BrowserName, ChromeCookieQueryStrategy, ChromiumCookieQueryStrategy, CompositeCookieQueryStrategy, type CookieQueryStrategy, type CookieSpec, type ExportedCookie, FirefoxCookieQueryStrategy, type MultiCookieSpec, type RenderOptions, SafariCookieQueryStrategy, batchGetCookies, batchGetCookiesWithResults, getCookie };
|
|
1081
|
+
export { type BatchCookieResult, type BatchGetCookiesOptions, type BrowserName, ChromeCookieQueryStrategy, ChromiumCookieQueryStrategy, type ChromiumProfile, CompositeCookieQueryStrategy, type CookieQueryStrategy, type CookieSpec, type ExportedCookie, FirefoxCookieQueryStrategy, type MultiCookieSpec, type RenderOptions, SafariCookieQueryStrategy, batchGetCookies, batchGetCookiesWithResults, getChromiumProfiles, getCookie };
|