@mherod/get-cookie 2.0.0-beta.4 → 2.0.0-beta.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/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +67 -52
- package/dist/main.js.map +1 -1
- package/dist/module.js +63 -54
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +15 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/CookieRequest.ts +5 -0
- package/src/CookieRow.ts +1 -16
- package/src/ExportedCookie.ts +6 -0
- package/src/IsCookieRow.ts +5 -0
- package/src/IsExportedCookie.ts +5 -0
- package/src/argv.ts +1 -1
- package/src/browsers/ChromeCookieQueryStrategy.ts +6 -3
- package/src/browsers/CompositeCookieQueryStrategy.ts +3 -4
- package/src/browsers/CookieQueryStrategy.ts +5 -0
- package/src/browsers/FirefoxCookieQueryStrategy.ts +3 -3
- package/src/browsers/SafariCookieQueryStrategy.ts +7 -2
- package/src/cli.ts +4 -7
- package/src/doSqliteQuery1.ts +33 -39
- package/src/getGroupedRenderedCookies.ts +32 -0
- package/src/index.ts +8 -0
- package/src/queryCookies.ts +7 -9
- package/src/resultsRendered.ts +8 -0
- package/src/utils.ts +0 -62
- package/src/browsers/AbstractCookieQueryStrategy.ts +0 -10
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
interface CookieRequest {
|
|
3
|
+
name: string;
|
|
4
|
+
domain: string;
|
|
5
|
+
}
|
|
6
|
+
declare function getGroupedRenderedCookies({ name, domain }: CookieRequest): Promise<string[]>;
|
|
2
7
|
export function getCookie(params: {
|
|
3
8
|
name: string;
|
|
4
9
|
domain: string;
|
|
5
|
-
}): Promise<import("
|
|
10
|
+
}): Promise<import("ExportedCookie").default | undefined>;
|
|
6
11
|
/**
|
|
7
12
|
*
|
|
8
13
|
* @param params
|
|
@@ -11,7 +16,7 @@ export function getCookie(params: {
|
|
|
11
16
|
export function getFirefoxCookie(params: {
|
|
12
17
|
name: string;
|
|
13
18
|
domain: string;
|
|
14
|
-
}): Promise<import("
|
|
19
|
+
}): Promise<import("ExportedCookie").default | undefined>;
|
|
15
20
|
/**
|
|
16
21
|
*
|
|
17
22
|
* @param params
|
|
@@ -20,6 +25,13 @@ export function getFirefoxCookie(params: {
|
|
|
20
25
|
export function getChromeCookie(params: {
|
|
21
26
|
name: string;
|
|
22
27
|
domain: string;
|
|
23
|
-
}): Promise<import("
|
|
28
|
+
}): Promise<import("ExportedCookie").default | undefined>;
|
|
29
|
+
declare const _default: {
|
|
30
|
+
getCookie: typeof getCookie;
|
|
31
|
+
getFirefoxCookie: typeof getFirefoxCookie;
|
|
32
|
+
getChromeCookie: typeof getChromeCookie;
|
|
33
|
+
getGroupedRenderedCookies: typeof getGroupedRenderedCookies;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
24
36
|
|
|
25
37
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";
|
|
1
|
+
{"mappings":";AcAA;IACE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AGID,2CAEE,EACE,IAAI,EACJ,MAAM,EAEP,EAAE,aAAa,GAEf,OAAO,CAAC,MAAM,EAAE,CAAC,CAgBnB;ACtBD,0BAAgC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAE,yDAWxE;AAED;;;;GAIG;AACH,iCAAuC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAE,yDAW/E;AAED;;;;GAIG;AACH,gCAAsC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAAE,yDAW9E;;;;;;;AAED,wBAKC","sources":["src/src/global.ts","src/src/ExportedCookie.ts","src/src/browsers/CookieQueryStrategy.ts","src/src/utils.ts","src/src/findAllFiles.ts","src/src/CookieRow.ts","src/src/doSqliteQuery1.ts","src/src/IsCookieRow.ts","src/src/IsExportedCookie.ts","src/src/browsers/ChromeCookieQueryStrategy.ts","src/src/browsers/FirefoxCookieQueryStrategy.ts","src/src/browsers/SafariCookieQueryStrategy.ts","src/src/browsers/CompositeCookieQueryStrategy.ts","src/src/isValidJwt.ts","src/src/CookieRequest.ts","src/src/queryCookies.ts","src/src/resultsRendered.ts","src/src/getGroupedRenderedCookies.ts","src/src/index.ts","src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"#!/usr/bin/env node\n// noinspection JSUnusedGlobalSymbols\n\nimport { queryCookies } from \"./queryCookies\";\nimport FirefoxCookieQueryStrategy from \"./browsers/FirefoxCookieQueryStrategy\";\nimport ChromeCookieQueryStrategy from \"./browsers/ChromeCookieQueryStrategy\";\nimport CompositeCookieQueryStrategy from \"./browsers/CompositeCookieQueryStrategy\";\nimport { getGroupedRenderedCookies } from \"./getGroupedRenderedCookies\";\n\nexport async function getCookie(params: { name: string; domain: string; }) {\n const cookies = await queryCookies(\n params,\n new CompositeCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\n/**\n *\n * @param params\n * @returns {Promise<*>}\n */\nexport async function getFirefoxCookie(params: { name: string; domain: string; }) {\n const cookies = await queryCookies(\n params,\n new FirefoxCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\n/**\n *\n * @param params\n * @returns {Promise<*>}\n */\nexport async function getChromeCookie(params: { name: string; domain: string; }) {\n const cookies = await queryCookies(\n params,\n new ChromeCookieQueryStrategy()\n //\n );\n if (Array.isArray(cookies) && cookies.length > 0) {\n return cookies.find((cookie) => cookie != null);\n } else {\n throw new Error(\"Cookie not found\");\n }\n}\n\nexport default {\n getCookie,\n getFirefoxCookie,\n getChromeCookie,\n getGroupedRenderedCookies,\n}\n"],"names":[],"version":3,"file":"types.d.ts.map","sourceRoot":"../"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mherod/get-cookie",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.6",
|
|
4
4
|
"description": "Node.js module for querying a local user's Chrome cookie",
|
|
5
|
+
"source": "src/index.ts",
|
|
5
6
|
"bin": "dist/cli.js",
|
|
6
7
|
"main": "dist/main.js",
|
|
7
8
|
"module": "dist/module.js",
|
package/src/CookieRow.ts
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
export interface CookieRow {
|
|
1
|
+
export default interface CookieRow {
|
|
2
2
|
domain: string;
|
|
3
3
|
name: string;
|
|
4
4
|
value: Buffer;
|
|
5
5
|
meta?: any;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
export function isCookieRow(obj: any): obj is CookieRow {
|
|
9
|
-
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ExportedCookie {
|
|
13
|
-
domain: string;
|
|
14
|
-
name: string;
|
|
15
|
-
value: string;
|
|
16
|
-
meta?: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function isExportedCookie(obj: any): obj is ExportedCookie {
|
|
20
|
-
return obj.domain !== undefined && obj.name !== undefined && obj.value !== undefined;
|
|
21
|
-
}
|
package/src/argv.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const argv = process.argv ?? [];
|
|
1
|
+
export const argv: string[] = process.argv ?? [];
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CookieQueryStrategy from "./CookieQueryStrategy";
|
|
2
2
|
import { execSimple } from "../utils";
|
|
3
3
|
import { env, HOME } from "../global";
|
|
4
4
|
import { existsSync } from "fs";
|
|
5
5
|
import { findAllFiles } from "../findAllFiles";
|
|
6
6
|
import * as crypto from "crypto";
|
|
7
7
|
import * as path from "path";
|
|
8
|
-
import
|
|
8
|
+
import CookieRow from "../CookieRow";
|
|
9
|
+
import ExportedCookie from "../ExportedCookie";
|
|
9
10
|
import { doSqliteQuery1 } from "../doSqliteQuery1";
|
|
10
11
|
import { merge } from "lodash";
|
|
12
|
+
import { isCookieRow } from "../IsCookieRow";
|
|
13
|
+
import { isExportedCookie } from "../IsExportedCookie";
|
|
11
14
|
|
|
12
|
-
export default class ChromeCookieQueryStrategy
|
|
15
|
+
export default class ChromeCookieQueryStrategy implements CookieQueryStrategy {
|
|
13
16
|
async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {
|
|
14
17
|
if (process.platform !== "darwin") {
|
|
15
18
|
throw new Error("This only works on macOS");
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import ChromeCookieQueryStrategy from "./ChromeCookieQueryStrategy";
|
|
2
2
|
import FirefoxCookieQueryStrategy from "./FirefoxCookieQueryStrategy";
|
|
3
3
|
import SafariCookieQueryStrategy from "./SafariCookieQueryStrategy";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import CookieQueryStrategy from "./CookieQueryStrategy";
|
|
5
|
+
import ExportedCookie from "../ExportedCookie";
|
|
6
6
|
|
|
7
|
-
export default class CompositeCookieQueryStrategy
|
|
7
|
+
export default class CompositeCookieQueryStrategy implements CookieQueryStrategy {
|
|
8
8
|
#strategies;
|
|
9
9
|
|
|
10
10
|
constructor() {
|
|
11
|
-
super();
|
|
12
11
|
this.#strategies = [
|
|
13
12
|
ChromeCookieQueryStrategy,
|
|
14
13
|
FirefoxCookieQueryStrategy,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CookieQueryStrategy from "./CookieQueryStrategy";
|
|
2
2
|
import { env, HOME } from "../global";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
4
|
import { toStringOrNull } from "../utils";
|
|
5
5
|
import { findAllFiles } from "../findAllFiles";
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import { doSqliteQuery1 } from "../doSqliteQuery1";
|
|
8
|
-
import
|
|
8
|
+
import ExportedCookie from "../ExportedCookie";
|
|
9
9
|
|
|
10
|
-
export default class FirefoxCookieQueryStrategy
|
|
10
|
+
export default class FirefoxCookieQueryStrategy implements CookieQueryStrategy {
|
|
11
11
|
async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {
|
|
12
12
|
if (process.platform !== "darwin") {
|
|
13
13
|
throw new Error("This only works on macOS");
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CookieQueryStrategy from "./CookieQueryStrategy";
|
|
2
|
+
import ExportedCookie from "../ExportedCookie";
|
|
2
3
|
|
|
3
|
-
export default class SafariCookieQueryStrategy
|
|
4
|
+
export default class SafariCookieQueryStrategy implements CookieQueryStrategy {
|
|
5
|
+
async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
import { env } from "./global";
|
|
4
4
|
import { queryCookies } from "./queryCookies";
|
|
5
5
|
import { argv } from "./argv";
|
|
6
|
-
import { groupBy
|
|
6
|
+
import { groupBy } from "lodash";
|
|
7
7
|
import { blue, green } from "colorette";
|
|
8
|
-
import
|
|
8
|
+
import ExportedCookie from "./ExportedCookie";
|
|
9
|
+
import { resultsRendered } from "./resultsRendered";
|
|
9
10
|
|
|
10
11
|
function combinedString(results: ExportedCookie[]) {
|
|
11
|
-
return blue(
|
|
12
|
-
uniqBy(results, (r) => r.name)
|
|
13
|
-
.map((r) => r.name + "=" + r.value)
|
|
14
|
-
.join("; ")
|
|
15
|
-
);
|
|
12
|
+
return blue(resultsRendered(results));
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
async function cliQueryCookies(name: string, domain: string) {
|
package/src/doSqliteQuery1.ts
CHANGED
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as sqlite3 from "sqlite3";
|
|
3
|
-
import
|
|
3
|
+
import CookieRow from "./CookieRow";
|
|
4
4
|
|
|
5
5
|
export async function doSqliteQuery1(file: string, sql: string): Promise<CookieRow[]> {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
if (!fs.existsSync(file)) {
|
|
7
|
+
throw new Error(`doSqliteQuery1: file ${file} does not exist`);
|
|
8
|
+
}
|
|
9
|
+
const db = new sqlite3.Database(file);
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
db.all(sql, (err: Error, rows: any[]) => {
|
|
12
|
+
if (err) {
|
|
13
|
+
reject(err);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const rows1: any[] = rows;
|
|
17
|
+
if (rows1 == null || rows1.length === 0) {
|
|
18
|
+
resolve([]);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(rows1)) {
|
|
22
|
+
const cookieRows: CookieRow[] = rows1.map((row) => {
|
|
23
|
+
return {
|
|
24
|
+
domain: row["host_key"],
|
|
25
|
+
name: row["name"],
|
|
26
|
+
value: row["encrypted_value"],
|
|
27
|
+
meta: {
|
|
28
|
+
file: file
|
|
18
29
|
}
|
|
19
|
-
|
|
20
|
-
if (rows1 == null || rows1.length === 0) {
|
|
21
|
-
if (process.env.VERBOSE) {
|
|
22
|
-
console.log(`doSqliteQuery1: no rows`);
|
|
23
|
-
}
|
|
24
|
-
resolve([]);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (Array.isArray(rows1)) {
|
|
28
|
-
const cookieRows: CookieRow[] = rows1.map((row) => {
|
|
29
|
-
return {
|
|
30
|
-
domain: row["host_key"],
|
|
31
|
-
name: row["name"],
|
|
32
|
-
value: row["encrypted_value"],
|
|
33
|
-
meta: {
|
|
34
|
-
file: file
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
resolve(cookieRows);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (process.env.VERBOSE) {
|
|
42
|
-
console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
43
|
-
}
|
|
44
|
-
resolve([rows1]);
|
|
30
|
+
};
|
|
45
31
|
});
|
|
32
|
+
resolve(cookieRows);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (process.env.VERBOSE) {
|
|
36
|
+
console.log(`doSqliteQuery1: rows ${JSON.stringify(rows1)}`);
|
|
37
|
+
}
|
|
38
|
+
resolve([rows1]);
|
|
46
39
|
});
|
|
40
|
+
});
|
|
47
41
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ExportedCookie from "./ExportedCookie";
|
|
2
|
+
import { queryCookies } from "./queryCookies";
|
|
3
|
+
import CompositeCookieQueryStrategy from "./browsers/CompositeCookieQueryStrategy";
|
|
4
|
+
import { groupBy } from "lodash";
|
|
5
|
+
import { resultsRendered } from "./resultsRendered";
|
|
6
|
+
import CookieRequest from "./CookieRequest";
|
|
7
|
+
|
|
8
|
+
export async function getGroupedRenderedCookies(
|
|
9
|
+
//
|
|
10
|
+
{
|
|
11
|
+
name,
|
|
12
|
+
domain
|
|
13
|
+
//
|
|
14
|
+
}: CookieRequest
|
|
15
|
+
//
|
|
16
|
+
): Promise<string[]> {
|
|
17
|
+
const cookies: ExportedCookie[] = await queryCookies(
|
|
18
|
+
{ name, domain },
|
|
19
|
+
new CompositeCookieQueryStrategy()
|
|
20
|
+
//
|
|
21
|
+
);
|
|
22
|
+
if (Array.isArray(cookies) && cookies.length > 0) {
|
|
23
|
+
const results: ExportedCookie[] = await queryCookies({ name, domain });
|
|
24
|
+
const groupedByFile = groupBy(results, (r) => r.meta?.file);
|
|
25
|
+
return Object.keys(groupedByFile).map((file: string) => {
|
|
26
|
+
const results: ExportedCookie[] = groupedByFile[file];
|
|
27
|
+
return resultsRendered(results);
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
throw new Error("Cookie not found");
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { queryCookies } from "./queryCookies";
|
|
|
5
5
|
import FirefoxCookieQueryStrategy from "./browsers/FirefoxCookieQueryStrategy";
|
|
6
6
|
import ChromeCookieQueryStrategy from "./browsers/ChromeCookieQueryStrategy";
|
|
7
7
|
import CompositeCookieQueryStrategy from "./browsers/CompositeCookieQueryStrategy";
|
|
8
|
+
import { getGroupedRenderedCookies } from "./getGroupedRenderedCookies";
|
|
8
9
|
|
|
9
10
|
export async function getCookie(params: { name: string; domain: string; }) {
|
|
10
11
|
const cookies = await queryCookies(
|
|
@@ -54,3 +55,10 @@ export async function getChromeCookie(params: { name: string; domain: string; })
|
|
|
54
55
|
throw new Error("Cookie not found");
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
getCookie,
|
|
61
|
+
getFirefoxCookie,
|
|
62
|
+
getChromeCookie,
|
|
63
|
+
getGroupedRenderedCookies,
|
|
64
|
+
}
|
package/src/queryCookies.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import CompositeCookieQueryStrategy from "./browsers/CompositeCookieQueryStrategy";
|
|
2
|
-
import { uniqBy } from "lodash";
|
|
3
1
|
import { env } from "./global";
|
|
2
|
+
import { uniqBy } from "lodash";
|
|
3
|
+
import CompositeCookieQueryStrategy from "./browsers/CompositeCookieQueryStrategy";
|
|
4
|
+
import CookieQueryStrategy from "./browsers/CookieQueryStrategy";
|
|
4
5
|
import isValidJwt from "./isValidJwt";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
6
|
+
import ExportedCookie from "./ExportedCookie";
|
|
7
|
+
import CookieRequest from "./CookieRequest";
|
|
7
8
|
|
|
8
9
|
export async function queryCookies(
|
|
9
10
|
{
|
|
10
11
|
name,
|
|
11
12
|
domain
|
|
12
|
-
}:
|
|
13
|
-
|
|
14
|
-
domain: string;
|
|
15
|
-
},
|
|
16
|
-
strategy: AbstractCookieQueryStrategy = new CompositeCookieQueryStrategy()
|
|
13
|
+
}: CookieRequest,
|
|
14
|
+
strategy: CookieQueryStrategy = new CompositeCookieQueryStrategy()
|
|
17
15
|
) {
|
|
18
16
|
const results: ExportedCookie[] = await strategy.queryCookies(name, domain);
|
|
19
17
|
const results1: ExportedCookie[] = uniqBy(results, JSON.stringify);
|
package/src/utils.ts
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
import {exec, ExecException} from "child_process";
|
|
4
4
|
|
|
5
5
|
export async function execSimple(command: string): Promise<string> {
|
|
6
|
-
if (process.env.VERBOSE) {
|
|
7
|
-
console.log(command);
|
|
8
|
-
}
|
|
9
6
|
return new Promise((resolve, reject) => {
|
|
10
7
|
exec(
|
|
11
8
|
command,
|
|
@@ -27,65 +24,6 @@ export async function execSimple(command: string): Promise<string> {
|
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
// export async function execAsBuffer(command: string) {
|
|
31
|
-
// if (process.env.VERBOSE) {
|
|
32
|
-
// console.log(command);
|
|
33
|
-
// }
|
|
34
|
-
// return await new Promise((resolve, reject) => {
|
|
35
|
-
// exec(
|
|
36
|
-
// command,
|
|
37
|
-
// { encoding: "binary", maxBuffer: 5 * 1024 },
|
|
38
|
-
// (error: ExecException | null, stdout: string, stderr: string) => {
|
|
39
|
-
// if (error) {
|
|
40
|
-
// reject(error);
|
|
41
|
-
// return;
|
|
42
|
-
// }
|
|
43
|
-
// if (stderr) {
|
|
44
|
-
// reject(error);
|
|
45
|
-
// return;
|
|
46
|
-
// }
|
|
47
|
-
// let stdoutAsBuffer: string = stdout;
|
|
48
|
-
// if (typeof stdoutAsBuffer === "string" && stdoutAsBuffer.length > 0) {
|
|
49
|
-
// // noinspection JSCheckFunctionSignatures
|
|
50
|
-
// stdoutAsBuffer = Buffer.from(stdoutAsBuffer, "binary").slice(0, -1);
|
|
51
|
-
// }
|
|
52
|
-
// if (stdoutAsBuffer && stdoutAsBuffer.length > 0) {
|
|
53
|
-
// resolve(stdoutAsBuffer);
|
|
54
|
-
// }
|
|
55
|
-
// }
|
|
56
|
-
// );
|
|
57
|
-
// });
|
|
58
|
-
// }
|
|
59
|
-
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
export function toStringValue(r: any): string {
|
|
62
|
-
if (process.env.VERBOSE) {
|
|
63
|
-
console.log("Printing value", r);
|
|
64
|
-
}
|
|
65
|
-
if (r) {
|
|
66
|
-
if (typeof r === "string") {
|
|
67
|
-
return r;
|
|
68
|
-
} else if (r.toString) {
|
|
69
|
-
// noinspection JSCheckFunctionSignatures
|
|
70
|
-
return r.toString("utf8");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function printStringValue(r: any) {
|
|
76
|
-
if (process.env.VERBOSE) {
|
|
77
|
-
console.log("Printing value", r);
|
|
78
|
-
}
|
|
79
|
-
if (r) {
|
|
80
|
-
if (typeof r === "string") {
|
|
81
|
-
console.log(r);
|
|
82
|
-
} else if (r.toString) {
|
|
83
|
-
// noinspection JSCheckFunctionSignatures
|
|
84
|
-
console.log(r.toString("utf8"));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
27
|
/**
|
|
90
28
|
*
|
|
91
29
|
* @param result
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {ExportedCookie} from "../CookieRow";
|
|
2
|
-
|
|
3
|
-
export default class AbstractCookieQueryStrategy {
|
|
4
|
-
async queryCookies(name: string, domain: string): Promise<ExportedCookie[]> {
|
|
5
|
-
if (process.env.NODE_ENV === "development") {
|
|
6
|
-
console.log("queryCookie", name, domain);
|
|
7
|
-
}
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
}
|