@mherod/get-cookie 4.4.3 → 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 +21 -3
- 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 +98 -38
- package/dist/index.d.ts +98 -38
- 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;
|
|
@@ -476,7 +484,7 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
476
484
|
/**
|
|
477
485
|
* Returns the SQL browser type for this strategy.
|
|
478
486
|
* Falls back to "chrome" for Chromium variants not yet in SqlBrowserType
|
|
479
|
-
* (e.g.
|
|
487
|
+
* (e.g. vivaldi, whale), which all share Chrome's cookie schema.
|
|
480
488
|
*/
|
|
481
489
|
private get sqlBrowserType();
|
|
482
490
|
/**
|
|
@@ -587,52 +595,98 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
587
595
|
}
|
|
588
596
|
|
|
589
597
|
/**
|
|
590
|
-
* Strategy for querying cookies from Chrome
|
|
591
|
-
* 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.
|
|
592
601
|
* @example
|
|
593
602
|
* ```typescript
|
|
594
|
-
* 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');
|
|
595
608
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
596
609
|
* ```
|
|
597
610
|
*/
|
|
598
|
-
declare class
|
|
611
|
+
declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrategy {
|
|
612
|
+
private readonly browser;
|
|
599
613
|
private readonly profileName?;
|
|
600
614
|
/**
|
|
601
|
-
* 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.)
|
|
602
617
|
* @param profileName - Optional specific profile name to target
|
|
603
618
|
*/
|
|
604
|
-
constructor(profileName?: string);
|
|
619
|
+
constructor(browser?: ChromiumBrowser, profileName?: string);
|
|
605
620
|
/**
|
|
606
|
-
* Get
|
|
621
|
+
* Get browser-specific cookie file paths, with optional profile filtering
|
|
607
622
|
* @param store - Optional specific store path
|
|
608
623
|
* @returns Array of cookie file paths
|
|
609
624
|
*/
|
|
610
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;
|
|
611
633
|
}
|
|
612
634
|
|
|
613
635
|
/**
|
|
614
|
-
* Strategy for querying cookies from
|
|
615
|
-
*
|
|
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.
|
|
616
639
|
* @example
|
|
617
640
|
* ```typescript
|
|
618
|
-
* 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');
|
|
619
646
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
620
647
|
* ```
|
|
621
648
|
*/
|
|
622
|
-
declare class
|
|
623
|
-
private readonly browser;
|
|
649
|
+
declare class ChromeCookieQueryStrategy extends ChromiumCookieQueryStrategy {
|
|
624
650
|
/**
|
|
625
|
-
* Creates a new instance of
|
|
626
|
-
* @param
|
|
651
|
+
* Creates a new instance of ChromeCookieQueryStrategy
|
|
652
|
+
* @param profileName - Optional specific profile name to target
|
|
653
|
+
*/
|
|
654
|
+
constructor(profileName?: string);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Information about a discovered Chromium browser profile.
|
|
659
|
+
*/
|
|
660
|
+
interface ChromiumProfile {
|
|
661
|
+
/**
|
|
662
|
+
* Display name of the profile (e.g. "Default", "Person 1", "Work")
|
|
627
663
|
*/
|
|
628
|
-
|
|
664
|
+
name: string;
|
|
629
665
|
/**
|
|
630
|
-
*
|
|
631
|
-
* @param store - Optional specific store path
|
|
632
|
-
* @returns Array of cookie file paths
|
|
666
|
+
* Profile directory name inside the User Data folder (e.g. "Default", "Profile 1")
|
|
633
667
|
*/
|
|
634
|
-
|
|
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;
|
|
635
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[];
|
|
636
690
|
|
|
637
691
|
/**
|
|
638
692
|
* Strategy for querying cookies from Firefox browser.
|
|
@@ -650,10 +704,14 @@ declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrateg
|
|
|
650
704
|
*/
|
|
651
705
|
declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
652
706
|
private readonly lockHandler;
|
|
707
|
+
private readonly profileName?;
|
|
708
|
+
private readonly container?;
|
|
653
709
|
/**
|
|
654
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
|
|
655
713
|
*/
|
|
656
|
-
constructor();
|
|
714
|
+
constructor(profileName?: string, container?: string | number);
|
|
657
715
|
/**
|
|
658
716
|
* Creates the query parameters for cookie extraction using the new query builder
|
|
659
717
|
* @param name - The cookie name to search for
|
|
@@ -731,10 +789,12 @@ declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
|
731
789
|
*/
|
|
732
790
|
declare class SafariCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
733
791
|
private readonly lockHandler;
|
|
792
|
+
private readonly profileName?;
|
|
734
793
|
/**
|
|
735
794
|
* Creates a new instance of SafariCookieQueryStrategy
|
|
795
|
+
* @param profileName - Ignored; Safari does not support profile filtering
|
|
736
796
|
*/
|
|
737
|
-
constructor();
|
|
797
|
+
constructor(profileName?: string);
|
|
738
798
|
/**
|
|
739
799
|
* Gets the path to Safari's cookie database
|
|
740
800
|
* @param home - The user's home directory
|
|
@@ -1018,4 +1078,4 @@ declare function batchGetCookies(specs: CookieSpec[], options?: BatchGetCookiesO
|
|
|
1018
1078
|
*/
|
|
1019
1079
|
declare function batchGetCookiesWithResults(specs: CookieSpec[], options?: Omit<BatchGetCookiesOptions, "deduplicate">): Promise<BatchCookieResult[]>;
|
|
1020
1080
|
|
|
1021
|
-
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;
|
|
@@ -476,7 +484,7 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
476
484
|
/**
|
|
477
485
|
* Returns the SQL browser type for this strategy.
|
|
478
486
|
* Falls back to "chrome" for Chromium variants not yet in SqlBrowserType
|
|
479
|
-
* (e.g.
|
|
487
|
+
* (e.g. vivaldi, whale), which all share Chrome's cookie schema.
|
|
480
488
|
*/
|
|
481
489
|
private get sqlBrowserType();
|
|
482
490
|
/**
|
|
@@ -587,52 +595,98 @@ declare abstract class BaseChromiumCookieQueryStrategy extends BaseCookieQuerySt
|
|
|
587
595
|
}
|
|
588
596
|
|
|
589
597
|
/**
|
|
590
|
-
* Strategy for querying cookies from Chrome
|
|
591
|
-
* 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.
|
|
592
601
|
* @example
|
|
593
602
|
* ```typescript
|
|
594
|
-
* 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');
|
|
595
608
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
596
609
|
* ```
|
|
597
610
|
*/
|
|
598
|
-
declare class
|
|
611
|
+
declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrategy {
|
|
612
|
+
private readonly browser;
|
|
599
613
|
private readonly profileName?;
|
|
600
614
|
/**
|
|
601
|
-
* 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.)
|
|
602
617
|
* @param profileName - Optional specific profile name to target
|
|
603
618
|
*/
|
|
604
|
-
constructor(profileName?: string);
|
|
619
|
+
constructor(browser?: ChromiumBrowser, profileName?: string);
|
|
605
620
|
/**
|
|
606
|
-
* Get
|
|
621
|
+
* Get browser-specific cookie file paths, with optional profile filtering
|
|
607
622
|
* @param store - Optional specific store path
|
|
608
623
|
* @returns Array of cookie file paths
|
|
609
624
|
*/
|
|
610
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;
|
|
611
633
|
}
|
|
612
634
|
|
|
613
635
|
/**
|
|
614
|
-
* Strategy for querying cookies from
|
|
615
|
-
*
|
|
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.
|
|
616
639
|
* @example
|
|
617
640
|
* ```typescript
|
|
618
|
-
* 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');
|
|
619
646
|
* const cookies = await strategy.queryCookies('session', 'example.com');
|
|
620
647
|
* ```
|
|
621
648
|
*/
|
|
622
|
-
declare class
|
|
623
|
-
private readonly browser;
|
|
649
|
+
declare class ChromeCookieQueryStrategy extends ChromiumCookieQueryStrategy {
|
|
624
650
|
/**
|
|
625
|
-
* Creates a new instance of
|
|
626
|
-
* @param
|
|
651
|
+
* Creates a new instance of ChromeCookieQueryStrategy
|
|
652
|
+
* @param profileName - Optional specific profile name to target
|
|
653
|
+
*/
|
|
654
|
+
constructor(profileName?: string);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Information about a discovered Chromium browser profile.
|
|
659
|
+
*/
|
|
660
|
+
interface ChromiumProfile {
|
|
661
|
+
/**
|
|
662
|
+
* Display name of the profile (e.g. "Default", "Person 1", "Work")
|
|
627
663
|
*/
|
|
628
|
-
|
|
664
|
+
name: string;
|
|
629
665
|
/**
|
|
630
|
-
*
|
|
631
|
-
* @param store - Optional specific store path
|
|
632
|
-
* @returns Array of cookie file paths
|
|
666
|
+
* Profile directory name inside the User Data folder (e.g. "Default", "Profile 1")
|
|
633
667
|
*/
|
|
634
|
-
|
|
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;
|
|
635
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[];
|
|
636
690
|
|
|
637
691
|
/**
|
|
638
692
|
* Strategy for querying cookies from Firefox browser.
|
|
@@ -650,10 +704,14 @@ declare class ChromiumCookieQueryStrategy extends BaseChromiumCookieQueryStrateg
|
|
|
650
704
|
*/
|
|
651
705
|
declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
652
706
|
private readonly lockHandler;
|
|
707
|
+
private readonly profileName?;
|
|
708
|
+
private readonly container?;
|
|
653
709
|
/**
|
|
654
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
|
|
655
713
|
*/
|
|
656
|
-
constructor();
|
|
714
|
+
constructor(profileName?: string, container?: string | number);
|
|
657
715
|
/**
|
|
658
716
|
* Creates the query parameters for cookie extraction using the new query builder
|
|
659
717
|
* @param name - The cookie name to search for
|
|
@@ -731,10 +789,12 @@ declare class FirefoxCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
|
731
789
|
*/
|
|
732
790
|
declare class SafariCookieQueryStrategy extends BaseCookieQueryStrategy {
|
|
733
791
|
private readonly lockHandler;
|
|
792
|
+
private readonly profileName?;
|
|
734
793
|
/**
|
|
735
794
|
* Creates a new instance of SafariCookieQueryStrategy
|
|
795
|
+
* @param profileName - Ignored; Safari does not support profile filtering
|
|
736
796
|
*/
|
|
737
|
-
constructor();
|
|
797
|
+
constructor(profileName?: string);
|
|
738
798
|
/**
|
|
739
799
|
* Gets the path to Safari's cookie database
|
|
740
800
|
* @param home - The user's home directory
|
|
@@ -1018,4 +1078,4 @@ declare function batchGetCookies(specs: CookieSpec[], options?: BatchGetCookiesO
|
|
|
1018
1078
|
*/
|
|
1019
1079
|
declare function batchGetCookiesWithResults(specs: CookieSpec[], options?: Omit<BatchGetCookiesOptions, "deduplicate">): Promise<BatchCookieResult[]>;
|
|
1020
1080
|
|
|
1021
|
-
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 };
|