@mherod/get-cookie 2.0.0-rc.11 → 2.0.0-rc.12

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "toolchains": []
3
+ }
package/.prettierrc.json CHANGED
@@ -1 +1 @@
1
- {}
1
+ {}
package/dist/index.js CHANGED
@@ -46,8 +46,13 @@ $parcel$export(module.exports, "getGroupedRenderedCookies", () => $300d8b33187a2
46
46
  $parcel$export(module.exports, "fetchWithCookies", () => $cfc07ae4aa2c7e44$export$b24a545a0b39f491);
47
47
 
48
48
 
49
+
49
50
  const $ef3d5dc2fd8022f5$export$6f4ae1207c703045 = process.argv ?? [];
50
- const $ef3d5dc2fd8022f5$export$c348dfaf65040d9b = (0, ($parcel$interopDefault($7oI3p$minimist)))($ef3d5dc2fd8022f5$export$6f4ae1207c703045.slice(2));
51
+ const $ef3d5dc2fd8022f5$var$minimistArgs = (0, ($parcel$interopDefault($7oI3p$minimist)))($ef3d5dc2fd8022f5$export$6f4ae1207c703045.slice(2));
52
+ const $ef3d5dc2fd8022f5$var$defaultOptions = {
53
+ verbose: false
54
+ };
55
+ const $ef3d5dc2fd8022f5$export$c348dfaf65040d9b = (0, $7oI3p$lodash.merge)($ef3d5dc2fd8022f5$var$defaultOptions, $ef3d5dc2fd8022f5$var$minimistArgs);
51
56
 
52
57
 
53
58
 
@@ -371,12 +376,20 @@ async function $269fe42bfd555305$export$bd52b72df8d0d261({ file: file , sql: sql
371
376
 
372
377
 
373
378
 
379
+ function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain }) {
380
+ const wildcardRegexp = /^([*%])$/i;
381
+ return {
382
+ specifiedName: name.match(wildcardRegexp) == null,
383
+ specifiedDomain: domain.match(wildcardRegexp) == null
384
+ };
385
+ }
386
+
374
387
 
375
388
 
376
389
 
377
390
 
378
- async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
379
- if (!file || file && !$7oI3p$fs.existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
391
+ async function $7bb7da9a77b2fd99$export$f19f611d1fa7c6f3({ file: file , sql: sql , rowTransform: rowTransform }) {
392
+ if (!file || file && !(0, ($parcel$interopDefault($7oI3p$fs))).existsSync(file)) throw new Error(`doSqliteQuery1: file ${file} does not exist`);
380
393
  const db = new $7oI3p$sqlite3.Database(file);
381
394
  return new Promise((resolve, reject)=>{
382
395
  db.all(sql, (err, rows)=>{
@@ -409,22 +422,12 @@ async function $a085b524d8ee9fce$export$f19f611d1fa7c6f3({ file: file , sql: sql
409
422
  });
410
423
  });
411
424
  }
412
-
413
-
414
- function $b744d19cc39f964e$export$da22813e5a2ec500({ name: name , domain: domain }) {
415
- const wildcardRegexp = /^([*%])$/i;
416
- return {
417
- specifiedName: name.match(wildcardRegexp) == null,
418
- specifiedDomain: domain.match(wildcardRegexp) == null
419
- };
420
- }
421
-
422
-
423
425
  class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
424
426
  browserName = "Firefox";
425
427
  async queryCookies(name, domain) {
426
- if (process.platform !== "darwin") throw new Error("This only works on macOS");
427
- if ((0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3).CHROME_ONLY) return [];
428
+ if (process.platform !== "darwin") // TODO: implement
429
+ return [];
430
+ if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b).browser !== "firefox") return [];
428
431
  const cookies = await this.#getFirefoxCookie({
429
432
  name: name,
430
433
  domain: domain
@@ -448,6 +451,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
448
451
  return await this.#queryCookiesDb(file, name, domain);
449
452
  };
450
453
  const all = await Promise.all(files.map(fn));
454
+ // flatten
451
455
  return all.flat();
452
456
  }
453
457
  async #queryCookiesDb(file, name1, domain1) {
@@ -477,7 +481,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
477
481
  };
478
482
  };
479
483
  try {
480
- return await (0, $a085b524d8ee9fce$export$f19f611d1fa7c6f3)({
484
+ return await $7bb7da9a77b2fd99$export$f19f611d1fa7c6f3({
481
485
  file: file,
482
486
  sql: sql,
483
487
  rowTransform: rowTransform
@@ -493,6 +497,7 @@ class $7bb7da9a77b2fd99$export$2e2bcd8739ae039 {
493
497
  class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
494
498
  browserName = "Safari";
495
499
  async queryCookies(name, domain) {
500
+ // TODO: implement
496
501
  return [];
497
502
  }
498
503
  }
@@ -502,8 +507,11 @@ class $fad6f51bd5c7bae2$export$2e2bcd8739ae039 {
502
507
 
503
508
 
504
509
 
510
+
505
511
  var $53a3bcc99a05dfcf$require$FileCookieStore = $7oI3p$toughcookiefilestore.FileCookieStore;
506
- const $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new $53a3bcc99a05dfcf$require$FileCookieStore(`${(0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`);
512
+ let $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8;
513
+ if ((0, $ef3d5dc2fd8022f5$export$c348dfaf65040d9b)["cs"] == "memory") $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new (0, $7oI3p$toughcookie.MemoryCookieStore)();
514
+ else $53a3bcc99a05dfcf$export$6c62df16f2e9c7e8 = new $53a3bcc99a05dfcf$require$FileCookieStore(`${(0, $fac425c10fbbada5$export$a7b6bc01c63cdfc3)["HOME"]}/cookie-star.json`);
507
515
  const $53a3bcc99a05dfcf$export$928a906645f9d018 = new (0, $7oI3p$toughcookie.CookieJar)($53a3bcc99a05dfcf$export$6c62df16f2e9c7e8);
508
516
 
509
517
 
@@ -714,11 +722,10 @@ function $9c43c2ed82e63570$export$9abc0a414b0d8b8f(results) {
714
722
  async function $8ef2ebdbd659489d$export$a65902517ae87ba8(cookieSpec) {
715
723
  const cookies = [];
716
724
  if (Array.isArray(cookieSpec)) {
717
- const cookieSpecs = cookieSpec;
718
- for (const cookieSpec1 of cookieSpecs){
719
- const cookies1 = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(cookieSpec1);
720
- cookies.push(...cookies1);
721
- }
725
+ const results = await Promise.all(cookieSpec.map((cs)=>{
726
+ return (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(cs);
727
+ }));
728
+ for (const exportedCookie of results.flat())cookies.push(exportedCookie);
722
729
  } else {
723
730
  const singleQuery = await (0, $7a068a32d4710f0b$export$e6d428437cf2cacb)(cookieSpec);
724
731
  cookies.push(...singleQuery);