@mherod/get-cookie 2.0.0-rc.5 → 2.0.0-rc.6
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/index.js +26 -18
- package/package.json +4 -5
- package/src/getChromeCookie.ts +19 -0
- package/src/getCookie.ts +19 -0
- package/src/getFirefoxCookie.ts +19 -0
- package/src/index.ts +11 -52
package/dist/index.js
CHANGED
|
@@ -36,9 +36,9 @@ function $parcel$interopDefault(a) {
|
|
|
36
36
|
return a && a.__esModule ? a.default : a;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
$parcel$export(module.exports, "getCookie", () => $
|
|
40
|
-
$parcel$export(module.exports, "
|
|
41
|
-
$parcel$export(module.exports, "
|
|
39
|
+
$parcel$export(module.exports, "getCookie", () => $8481e2034946cc4b$export$4be65e66cfa2648a);
|
|
40
|
+
$parcel$export(module.exports, "getChromeCookie", () => $1a92ef2038b55530$export$e5637297e9eb6f2e);
|
|
41
|
+
$parcel$export(module.exports, "getFirefoxCookie", () => $f9b70200901ad17d$export$c44c5fdef43f0941);
|
|
42
42
|
$parcel$export(module.exports, "getGroupedRenderedCookies", () => $300d8b33187a203c$export$4d2e9997e2c23417);
|
|
43
43
|
$parcel$export(module.exports, "fetchWithCookies", () => $cfc07ae4aa2c7e44$export$b24a545a0b39f491);
|
|
44
44
|
|
|
@@ -608,6 +608,29 @@ async function $7a068a32d4710f0b$export$e6d428437cf2cacb({ name: name , domain:
|
|
|
608
608
|
|
|
609
609
|
|
|
610
610
|
|
|
611
|
+
async function $8481e2034946cc4b$export$4be65e66cfa2648a(params) {
|
|
612
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
613
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
614
|
+
else throw new Error("Cookie not found");
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
async function $1a92ef2038b55530$export$e5637297e9eb6f2e(params) {
|
|
621
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
|
|
622
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
623
|
+
else throw new Error("Cookie not found");
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
async function $f9b70200901ad17d$export$c44c5fdef43f0941(params) {
|
|
630
|
+
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
|
|
631
|
+
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
632
|
+
else throw new Error("Cookie not found");
|
|
633
|
+
}
|
|
611
634
|
|
|
612
635
|
|
|
613
636
|
|
|
@@ -722,21 +745,6 @@ var $3d7e27b54f670f46$exports = {};
|
|
|
722
745
|
var $6c197c88880e045c$exports = {};
|
|
723
746
|
|
|
724
747
|
|
|
725
|
-
async function $cd1ba0160120c006$export$4be65e66cfa2648a(params) {
|
|
726
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $f72befa528c23ca7$export$2e2bcd8739ae039)());
|
|
727
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
728
|
-
else throw new Error("Cookie not found");
|
|
729
|
-
}
|
|
730
|
-
async function $cd1ba0160120c006$export$c44c5fdef43f0941(params) {
|
|
731
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $7bb7da9a77b2fd99$export$2e2bcd8739ae039)());
|
|
732
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
733
|
-
else throw new Error("Cookie not found");
|
|
734
|
-
}
|
|
735
|
-
async function $cd1ba0160120c006$export$e5637297e9eb6f2e(params) {
|
|
736
|
-
const cookies = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(params, new (0, $269fe42bfd555305$export$2e2bcd8739ae039)());
|
|
737
|
-
if (Array.isArray(cookies) && cookies.length > 0) return cookies.find((cookie)=>cookie != null);
|
|
738
|
-
else throw new Error("Cookie not found");
|
|
739
|
-
}
|
|
740
748
|
$parcel$exportWildcard(module.exports, $d5b6386167d289d2$exports);
|
|
741
749
|
$parcel$exportWildcard(module.exports, $3d7e27b54f670f46$exports);
|
|
742
750
|
$parcel$exportWildcard(module.exports, $6c197c88880e045c$exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mherod/get-cookie",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.6",
|
|
4
4
|
"description": "Node.js module for querying a local user's Chrome cookie",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"bin": "dist/cli.js",
|
|
@@ -27,14 +27,13 @@
|
|
|
27
27
|
"main": {},
|
|
28
28
|
"types": {},
|
|
29
29
|
"library": {
|
|
30
|
-
"source":
|
|
31
|
-
"src/index.ts"
|
|
32
|
-
],
|
|
30
|
+
"source": "src/index.ts",
|
|
33
31
|
"distDir": "dist",
|
|
34
32
|
"isLibrary": true,
|
|
35
33
|
"engines": {
|
|
36
34
|
"node": "16"
|
|
37
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"includeNodeModules": false
|
|
38
37
|
},
|
|
39
38
|
"cli": {
|
|
40
39
|
"source": "src/cli.ts",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import CookieSpec from "./CookieSpec";
|
|
2
|
+
import ExportedCookie from "./ExportedCookie";
|
|
3
|
+
import { queryCookies } from "./queryCookies";
|
|
4
|
+
import ChromeCookieQueryStrategy from "./browsers/ChromeCookieQueryStrategy";
|
|
5
|
+
|
|
6
|
+
export async function getChromeCookie(
|
|
7
|
+
params: CookieSpec
|
|
8
|
+
): Promise<ExportedCookie | undefined> {
|
|
9
|
+
const cookies = await queryCookies(
|
|
10
|
+
params,
|
|
11
|
+
new ChromeCookieQueryStrategy()
|
|
12
|
+
//
|
|
13
|
+
);
|
|
14
|
+
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
15
|
+
return cookies.find((cookie) => cookie != null);
|
|
16
|
+
} else {
|
|
17
|
+
throw new Error("Cookie not found");
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/getCookie.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import CookieSpec from "./CookieSpec";
|
|
2
|
+
import ExportedCookie from "./ExportedCookie";
|
|
3
|
+
import { queryCookies } from "./queryCookies";
|
|
4
|
+
import CompositeCookieQueryStrategy from "./browsers/CompositeCookieQueryStrategy";
|
|
5
|
+
|
|
6
|
+
export async function getCookie(
|
|
7
|
+
params: CookieSpec
|
|
8
|
+
): Promise<ExportedCookie | undefined> {
|
|
9
|
+
const cookies = await queryCookies(
|
|
10
|
+
params,
|
|
11
|
+
new CompositeCookieQueryStrategy()
|
|
12
|
+
//
|
|
13
|
+
);
|
|
14
|
+
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
15
|
+
return cookies.find((cookie) => cookie != null);
|
|
16
|
+
} else {
|
|
17
|
+
throw new Error("Cookie not found");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import CookieSpec from "./CookieSpec";
|
|
2
|
+
import ExportedCookie from "./ExportedCookie";
|
|
3
|
+
import { queryCookies } from "./queryCookies";
|
|
4
|
+
import FirefoxCookieQueryStrategy from "./browsers/FirefoxCookieQueryStrategy";
|
|
5
|
+
|
|
6
|
+
export async function getFirefoxCookie(
|
|
7
|
+
params: CookieSpec
|
|
8
|
+
): Promise<ExportedCookie | undefined> {
|
|
9
|
+
const cookies = await queryCookies(
|
|
10
|
+
params,
|
|
11
|
+
new FirefoxCookieQueryStrategy()
|
|
12
|
+
//
|
|
13
|
+
);
|
|
14
|
+
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
15
|
+
return cookies.find((cookie) => cookie != null);
|
|
16
|
+
} else {
|
|
17
|
+
throw new Error("Cookie not found");
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,61 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// noinspection JSUnusedGlobalSymbols
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import CompositeCookieQueryStrategy from "./browsers/CompositeCookieQueryStrategy";
|
|
8
|
-
import CookieSpec from "./CookieSpec";
|
|
9
|
-
import ExportedCookie from "./ExportedCookie";
|
|
4
|
+
import { getCookie } from "./getCookie";
|
|
5
|
+
import { getChromeCookie } from "./getChromeCookie";
|
|
6
|
+
import { getFirefoxCookie } from "./getFirefoxCookie";
|
|
10
7
|
import { getGroupedRenderedCookies } from "./getGroupedRenderedCookies";
|
|
11
8
|
import { fetchWithCookies } from "./fetchWithCookies";
|
|
12
9
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
22
|
-
return cookies.find((cookie) => cookie != null);
|
|
23
|
-
} else {
|
|
24
|
-
throw new Error("Cookie not found");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function getFirefoxCookie(
|
|
29
|
-
params: CookieSpec
|
|
30
|
-
): Promise<ExportedCookie | undefined> {
|
|
31
|
-
const cookies = await queryCookies(
|
|
32
|
-
params,
|
|
33
|
-
new FirefoxCookieQueryStrategy()
|
|
34
|
-
//
|
|
35
|
-
);
|
|
36
|
-
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
37
|
-
return cookies.find((cookie) => cookie != null);
|
|
38
|
-
} else {
|
|
39
|
-
throw new Error("Cookie not found");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export async function getChromeCookie(
|
|
44
|
-
params: CookieSpec
|
|
45
|
-
): Promise<ExportedCookie | undefined> {
|
|
46
|
-
const cookies = await queryCookies(
|
|
47
|
-
params,
|
|
48
|
-
new ChromeCookieQueryStrategy()
|
|
49
|
-
//
|
|
50
|
-
);
|
|
51
|
-
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
52
|
-
return cookies.find((cookie) => cookie != null);
|
|
53
|
-
} else {
|
|
54
|
-
throw new Error("Cookie not found");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { getGroupedRenderedCookies, fetchWithCookies };
|
|
10
|
+
export {
|
|
11
|
+
getCookie,
|
|
12
|
+
getChromeCookie,
|
|
13
|
+
getFirefoxCookie,
|
|
14
|
+
getGroupedRenderedCookies,
|
|
15
|
+
fetchWithCookies,
|
|
16
|
+
//
|
|
17
|
+
};
|
|
59
18
|
|
|
60
19
|
export * from "./CookieSpec";
|
|
61
20
|
export * from "./CookieRow";
|