@mherod/get-cookie 4.0.4 → 4.2.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/.env.example +5 -0
- package/.husky/commit-msg +6 -2
- package/.husky/pre-commit +6 -4
- package/.husky/pre-push +6 -4
- package/dist/chunk-GVQTX3C5.js +2 -0
- package/dist/chunk-GVQTX3C5.js.map +1 -0
- package/dist/cli.cjs +1 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/getChromePassword-6XZINNNO.js +2 -0
- package/dist/{getChromePassword-GTIXL733.js.map → getChromePassword-6XZINNNO.js.map} +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +228 -49
- package/dist/index.d.ts +228 -49
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/eslint.config.js +2 -17
- package/examples/README.md +37 -0
- package/examples/advanced-usage.ts +56 -0
- package/examples/basic-usage.ts +44 -0
- package/examples/cli-examples.sh +51 -0
- package/package.json +22 -26
- package/tsconfig.build.json +2 -2
- package/tsconfig.cli.json +12 -0
- package/tsconfig.tsup.json +12 -0
- package/tsup.cli.ts +1 -0
- package/tsup.lib.ts +1 -0
- package/dist/chunk-56Z35D5R.js +0 -2
- package/dist/chunk-56Z35D5R.js.map +0 -1
- package/dist/chunk-5FUMK7M3.js +0 -4
- package/dist/chunk-5FUMK7M3.js.map +0 -1
- package/dist/chunk-A6MIB6FP.js +0 -2
- package/dist/chunk-A6MIB6FP.js.map +0 -1
- package/dist/chunk-CFMK2YSL.js +0 -2
- package/dist/chunk-CFMK2YSL.js.map +0 -1
- package/dist/chunk-IRERRCUF.js +0 -2
- package/dist/chunk-IRERRCUF.js.map +0 -1
- package/dist/chunk-UPNW543B.js +0 -2
- package/dist/chunk-UPNW543B.js.map +0 -1
- package/dist/chunk-VMBA4NVU.js +0 -2
- package/dist/chunk-VMBA4NVU.js.map +0 -1
- package/dist/getChromeCookie-CL3SRRWX.js +0 -2
- package/dist/getChromeCookie-CL3SRRWX.js.map +0 -1
- package/dist/getChromePassword-GTIXL733.js +0 -2
- package/dist/getCookie-WV5KDZN7.js +0 -2
- package/dist/getCookie-WV5KDZN7.js.map +0 -1
- package/dist/getFirefoxCookie-BXQ2GXAW.js +0 -2
- package/dist/getFirefoxCookie-BXQ2GXAW.js.map +0 -1
- package/dist/getGroupedRenderedCookies-FNJ6FQVQ.js +0 -2
- package/dist/getGroupedRenderedCookies-FNJ6FQVQ.js.map +0 -1
- package/dist/getMergedRenderedCookies-PNC2LHSD.js +0 -2
- package/dist/getMergedRenderedCookies-PNC2LHSD.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ import { z } from 'zod';
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
declare const CookieSpecSchema: z.ZodObject<{
|
|
30
|
-
name: z.ZodString
|
|
31
|
-
domain: z.ZodString
|
|
30
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
31
|
+
domain: z.ZodEffects<z.ZodString, string, string>;
|
|
32
32
|
}, "strict", z.ZodTypeAny, {
|
|
33
33
|
name: string;
|
|
34
34
|
domain: string;
|
|
@@ -91,9 +91,9 @@ type CookieSpec = z.infer<typeof CookieSpecSchema>;
|
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
93
|
declare const ExportedCookieSchema: z.ZodObject<{
|
|
94
|
-
domain: z.ZodString
|
|
95
|
-
name: z.ZodString
|
|
96
|
-
value: z.ZodString
|
|
94
|
+
domain: z.ZodEffects<z.ZodString, string, string>;
|
|
95
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
96
|
+
value: z.ZodPipeline<z.ZodEffects<z.ZodString, unknown, string>, z.ZodAny>;
|
|
97
97
|
expiry: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Infinity">, z.ZodDate, z.ZodNumber]>>;
|
|
98
98
|
meta: z.ZodOptional<z.ZodObject<{
|
|
99
99
|
file: z.ZodOptional<z.ZodString>;
|
|
@@ -101,26 +101,26 @@ declare const ExportedCookieSchema: z.ZodObject<{
|
|
|
101
101
|
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
102
102
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
103
103
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
-
path: z.ZodOptional<z.ZodString
|
|
104
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
105
105
|
}, "strict", z.ZodUnknown, z.objectOutputType<{
|
|
106
106
|
file: z.ZodOptional<z.ZodString>;
|
|
107
107
|
browser: z.ZodOptional<z.ZodString>;
|
|
108
108
|
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
109
109
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
110
110
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
-
path: z.ZodOptional<z.ZodString
|
|
111
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
112
112
|
}, z.ZodUnknown, "strict">, z.objectInputType<{
|
|
113
113
|
file: z.ZodOptional<z.ZodString>;
|
|
114
114
|
browser: z.ZodOptional<z.ZodString>;
|
|
115
115
|
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
116
116
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
117
117
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
118
|
-
path: z.ZodOptional<z.ZodString
|
|
118
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
119
119
|
}, z.ZodUnknown, "strict">>>;
|
|
120
120
|
}, "strict", z.ZodTypeAny, {
|
|
121
121
|
name: string;
|
|
122
122
|
domain: string;
|
|
123
|
-
value
|
|
123
|
+
value?: any;
|
|
124
124
|
expiry?: number | Date | "Infinity" | undefined;
|
|
125
125
|
meta?: z.objectOutputType<{
|
|
126
126
|
file: z.ZodOptional<z.ZodString>;
|
|
@@ -128,12 +128,12 @@ declare const ExportedCookieSchema: z.ZodObject<{
|
|
|
128
128
|
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
129
129
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
130
130
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
-
path: z.ZodOptional<z.ZodString
|
|
131
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
132
132
|
}, z.ZodUnknown, "strict"> | undefined;
|
|
133
133
|
}, {
|
|
134
134
|
name: string;
|
|
135
|
-
domain: string;
|
|
136
135
|
value: string;
|
|
136
|
+
domain: string;
|
|
137
137
|
expiry?: number | Date | "Infinity" | undefined;
|
|
138
138
|
meta?: z.objectInputType<{
|
|
139
139
|
file: z.ZodOptional<z.ZodString>;
|
|
@@ -141,7 +141,7 @@ declare const ExportedCookieSchema: z.ZodObject<{
|
|
|
141
141
|
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
142
142
|
secure: z.ZodOptional<z.ZodBoolean>;
|
|
143
143
|
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
-
path: z.ZodOptional<z.ZodString
|
|
144
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
145
145
|
}, z.ZodUnknown, "strict"> | undefined;
|
|
146
146
|
}>;
|
|
147
147
|
/**
|
|
@@ -196,69 +196,248 @@ declare const RenderOptionsSchema: z.ZodObject<{
|
|
|
196
196
|
* Type definition for render options
|
|
197
197
|
*/
|
|
198
198
|
type RenderOptions = z.infer<typeof RenderOptionsSchema>;
|
|
199
|
+
/**
|
|
200
|
+
* Schema for browser names
|
|
201
|
+
*/
|
|
202
|
+
declare const BrowserNameSchema: z.ZodEnum<["Chrome", "Firefox", "Safari", "internal", "unknown"]>;
|
|
203
|
+
/**
|
|
204
|
+
* Type definition for browser names
|
|
205
|
+
*/
|
|
206
|
+
type BrowserName = z.infer<typeof BrowserNameSchema>;
|
|
207
|
+
/**
|
|
208
|
+
* Schema for cookie query strategy
|
|
209
|
+
*/
|
|
210
|
+
declare const CookieQueryStrategySchema: z.ZodObject<{
|
|
211
|
+
browserName: z.ZodEnum<["Chrome", "Firefox", "Safari", "internal", "unknown"]>;
|
|
212
|
+
queryCookies: z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodString], z.ZodUnknown>, z.ZodPromise<z.ZodArray<z.ZodObject<{
|
|
213
|
+
domain: z.ZodEffects<z.ZodString, string, string>;
|
|
214
|
+
name: z.ZodEffects<z.ZodString, string, string>;
|
|
215
|
+
value: z.ZodPipeline<z.ZodEffects<z.ZodString, unknown, string>, z.ZodAny>;
|
|
216
|
+
expiry: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Infinity">, z.ZodDate, z.ZodNumber]>>;
|
|
217
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
file: z.ZodOptional<z.ZodString>;
|
|
219
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
220
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
221
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
222
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
223
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
224
|
+
}, "strict", z.ZodUnknown, z.objectOutputType<{
|
|
225
|
+
file: z.ZodOptional<z.ZodString>;
|
|
226
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
227
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
229
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
231
|
+
}, z.ZodUnknown, "strict">, z.objectInputType<{
|
|
232
|
+
file: z.ZodOptional<z.ZodString>;
|
|
233
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
234
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
235
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
236
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
237
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
238
|
+
}, z.ZodUnknown, "strict">>>;
|
|
239
|
+
}, "strict", z.ZodTypeAny, {
|
|
240
|
+
name: string;
|
|
241
|
+
domain: string;
|
|
242
|
+
value?: any;
|
|
243
|
+
expiry?: number | Date | "Infinity" | undefined;
|
|
244
|
+
meta?: z.objectOutputType<{
|
|
245
|
+
file: z.ZodOptional<z.ZodString>;
|
|
246
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
247
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
250
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
251
|
+
}, z.ZodUnknown, "strict"> | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
name: string;
|
|
254
|
+
value: string;
|
|
255
|
+
domain: string;
|
|
256
|
+
expiry?: number | Date | "Infinity" | undefined;
|
|
257
|
+
meta?: z.objectInputType<{
|
|
258
|
+
file: z.ZodOptional<z.ZodString>;
|
|
259
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
260
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
261
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
262
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
263
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
264
|
+
}, z.ZodUnknown, "strict"> | undefined;
|
|
265
|
+
}>, "many">>>;
|
|
266
|
+
}, "strict", z.ZodTypeAny, {
|
|
267
|
+
browserName: "unknown" | "Chrome" | "Firefox" | "Safari" | "internal";
|
|
268
|
+
queryCookies: (args_0: string, args_1: string, ...args: unknown[]) => Promise<{
|
|
269
|
+
name: string;
|
|
270
|
+
domain: string;
|
|
271
|
+
value?: any;
|
|
272
|
+
expiry?: number | Date | "Infinity" | undefined;
|
|
273
|
+
meta?: z.objectOutputType<{
|
|
274
|
+
file: z.ZodOptional<z.ZodString>;
|
|
275
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
276
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
278
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
279
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
280
|
+
}, z.ZodUnknown, "strict"> | undefined;
|
|
281
|
+
}[]>;
|
|
282
|
+
}, {
|
|
283
|
+
browserName: "unknown" | "Chrome" | "Firefox" | "Safari" | "internal";
|
|
284
|
+
queryCookies: (args_0: string, args_1: string, ...args: unknown[]) => Promise<{
|
|
285
|
+
name: string;
|
|
286
|
+
value: string;
|
|
287
|
+
domain: string;
|
|
288
|
+
expiry?: number | Date | "Infinity" | undefined;
|
|
289
|
+
meta?: z.objectInputType<{
|
|
290
|
+
file: z.ZodOptional<z.ZodString>;
|
|
291
|
+
browser: z.ZodOptional<z.ZodString>;
|
|
292
|
+
decrypted: z.ZodOptional<z.ZodBoolean>;
|
|
293
|
+
secure: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
+
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
+
path: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>>;
|
|
296
|
+
}, z.ZodUnknown, "strict"> | undefined;
|
|
297
|
+
}[]>;
|
|
298
|
+
}>;
|
|
299
|
+
/**
|
|
300
|
+
* Type definition for cookie query strategy
|
|
301
|
+
*/
|
|
302
|
+
type CookieQueryStrategy = z.infer<typeof CookieQueryStrategySchema>;
|
|
303
|
+
/**
|
|
304
|
+
* Type representing either a single cookie specification or an array of specifications.
|
|
305
|
+
* Useful when you need to query multiple cookies in a single operation.
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* // Single cookie spec
|
|
309
|
+
* const single: MultiCookieSpec = {
|
|
310
|
+
* domain: "example.com",
|
|
311
|
+
* name: "sessionId"
|
|
312
|
+
* };
|
|
313
|
+
*
|
|
314
|
+
* // Multiple cookie specs
|
|
315
|
+
* const multiple: MultiCookieSpec = [
|
|
316
|
+
* { domain: "example.com", name: "sessionId" },
|
|
317
|
+
* { domain: "api.example.com", name: "authToken" }
|
|
318
|
+
* ];
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
type MultiCookieSpec = CookieSpec | CookieSpec[];
|
|
199
322
|
|
|
200
323
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* @
|
|
324
|
+
* Retrieves browser cookies that match the specified cookie name and domain criteria.
|
|
325
|
+
* This function provides a way to search and filter cookies based on given specifications.
|
|
326
|
+
* @param cookieSpec - The cookie specification containing search criteria
|
|
327
|
+
* @param cookieSpec.name - The name of the cookie to search for
|
|
328
|
+
* @param cookieSpec.domain - (optional) The domain to filter cookies by
|
|
329
|
+
* @returns An array of ExportedCookie objects that match the specification
|
|
330
|
+
* @throws Will catch and handle any errors during cookie querying, logging a warning
|
|
331
|
+
* to the console without throwing to the caller
|
|
204
332
|
* @example
|
|
205
333
|
* ```typescript
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* //
|
|
334
|
+
* import { getCookie } from "@mherod/get-cookie";
|
|
335
|
+
*
|
|
336
|
+
* // Get all cookies named "sessionId"
|
|
337
|
+
* const cookies = await getCookie({ name: "sessionId" });
|
|
338
|
+
* // Returns: [{ name: "sessionId", value: "abc123", domain: ".example.com", ... }]
|
|
339
|
+
*
|
|
340
|
+
* // Get cookies named "userPref" from specific domain
|
|
341
|
+
* const domainCookies = await getCookie({
|
|
342
|
+
* name: "userPref",
|
|
343
|
+
* domain: "example.com"
|
|
344
|
+
* });
|
|
345
|
+
* // Returns: [{ name: "userPref", value: "darkMode", domain: "example.com", ... }]
|
|
209
346
|
* ```
|
|
210
347
|
*/
|
|
211
|
-
declare
|
|
348
|
+
declare function getCookie(cookieSpec: CookieSpec): Promise<ExportedCookie[]>;
|
|
349
|
+
|
|
212
350
|
/**
|
|
213
|
-
*
|
|
214
|
-
* @
|
|
215
|
-
* @
|
|
351
|
+
* Retrieves cookies from Chrome browser storage that match the specified criteria.
|
|
352
|
+
* @param cookieSpec - The cookie specification containing search criteria
|
|
353
|
+
* @param cookieSpec.name - The name of the cookie to search for
|
|
354
|
+
* @param cookieSpec.domain - (optional) The domain to filter cookies by
|
|
355
|
+
* @returns An array of ExportedCookie objects that match the specification
|
|
356
|
+
* @throws Will catch and handle any errors during cookie querying, logging a warning
|
|
357
|
+
* to the console without throwing to the caller
|
|
216
358
|
* @example
|
|
217
359
|
* ```typescript
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* //
|
|
360
|
+
* import { getChromeCookie } from "@mherod/get-cookie";
|
|
361
|
+
*
|
|
362
|
+
* // Get all cookies named "sessionId" from Chrome
|
|
363
|
+
* const cookies = await getChromeCookie({ name: "sessionId" });
|
|
364
|
+
*
|
|
365
|
+
* // Get cookies named "userPref" from specific domain in Chrome
|
|
366
|
+
* const domainCookies = await getChromeCookie({
|
|
367
|
+
* name: "userPref",
|
|
368
|
+
* domain: "example.com"
|
|
369
|
+
* });
|
|
221
370
|
* ```
|
|
222
371
|
*/
|
|
223
|
-
declare
|
|
372
|
+
declare function getChromeCookie(cookieSpec: CookieSpec): Promise<ExportedCookie[]>;
|
|
373
|
+
|
|
224
374
|
/**
|
|
225
|
-
*
|
|
226
|
-
* @
|
|
227
|
-
* @
|
|
375
|
+
* Retrieves cookies from Firefox browser storage that match the specified criteria.
|
|
376
|
+
* @param cookieSpec - The cookie specification containing search criteria
|
|
377
|
+
* @param cookieSpec.name - The name of the cookie to search for
|
|
378
|
+
* @param cookieSpec.domain - (optional) The domain to filter cookies by
|
|
379
|
+
* @returns An array of ExportedCookie objects that match the specification
|
|
380
|
+
* @throws Will catch and handle any errors during cookie querying, logging a warning
|
|
381
|
+
* to the console without throwing to the caller
|
|
228
382
|
* @example
|
|
229
383
|
* ```typescript
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* //
|
|
384
|
+
* import { getFirefoxCookie } from "@mherod/get-cookie";
|
|
385
|
+
*
|
|
386
|
+
* // Get all cookies named "sessionId" from Firefox
|
|
387
|
+
* const cookies = await getFirefoxCookie({ name: "sessionId" });
|
|
388
|
+
*
|
|
389
|
+
* // Get cookies named "userPref" from specific domain in Firefox
|
|
390
|
+
* const domainCookies = await getFirefoxCookie({
|
|
391
|
+
* name: "userPref",
|
|
392
|
+
* domain: "example.com"
|
|
393
|
+
* });
|
|
233
394
|
* ```
|
|
234
395
|
*/
|
|
235
|
-
declare
|
|
396
|
+
declare function getFirefoxCookie(cookieSpec: CookieSpec): Promise<ExportedCookie[]>;
|
|
397
|
+
|
|
236
398
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @
|
|
239
|
-
* @
|
|
399
|
+
* Retrieves and renders cookies in a grouped format based on their source files.
|
|
400
|
+
* @param cookieSpec - The cookie specification containing search criteria
|
|
401
|
+
* @param cookieSpec.name - The name of the cookie to search for
|
|
402
|
+
* @param cookieSpec.domain - (optional) The domain to filter cookies by
|
|
403
|
+
* @param options - Options for rendering the cookies
|
|
404
|
+
* @param options.showFilePaths - Whether to include file paths in the output
|
|
405
|
+
* @param options.separator - Custom separator for cookie values
|
|
406
|
+
* @returns An array of strings, each representing a group of cookies from a source file
|
|
240
407
|
* @example
|
|
241
408
|
* ```typescript
|
|
242
|
-
*
|
|
243
|
-
* const
|
|
244
|
-
*
|
|
409
|
+
* // Basic usage - get all cookies named "sessionId" grouped by source file
|
|
410
|
+
* const cookies = await getGroupedRenderedCookies({ name: "sessionId" });
|
|
411
|
+
*
|
|
412
|
+
* // Get cookies with domain filter and custom rendering options
|
|
413
|
+
* const domainCookies = await getGroupedRenderedCookies(
|
|
414
|
+
* {
|
|
415
|
+
* name: "userPref",
|
|
416
|
+
* domain: "example.com"
|
|
417
|
+
* },
|
|
418
|
+
* {
|
|
419
|
+
* showFilePaths: true,
|
|
420
|
+
* separator: " | "
|
|
421
|
+
* }
|
|
422
|
+
* );
|
|
245
423
|
* ```
|
|
246
424
|
*/
|
|
247
|
-
declare
|
|
425
|
+
declare function getGroupedRenderedCookies(cookieSpec: CookieSpec, options?: Omit<RenderOptions, "format">): Promise<string[]>;
|
|
426
|
+
|
|
248
427
|
/**
|
|
249
|
-
*
|
|
250
|
-
* @
|
|
251
|
-
* @
|
|
428
|
+
* Retrieves and renders cookies in a merged format
|
|
429
|
+
* @param cookieSpec - The cookie specification to query
|
|
430
|
+
* @param options - Optional rendering options
|
|
431
|
+
* @returns Promise resolving to rendered cookie string
|
|
252
432
|
* @example
|
|
253
433
|
* ```typescript
|
|
254
|
-
* const
|
|
255
|
-
*
|
|
256
|
-
* { domain: 'example.com' },
|
|
434
|
+
* const cookieString = await getMergedRenderedCookies(
|
|
435
|
+
* { name: 'session', domain: 'example.com' },
|
|
257
436
|
* { separator: '; ' }
|
|
258
437
|
* );
|
|
259
|
-
* //
|
|
438
|
+
* console.log(cookieString); // "session=abc123; auth=xyz789"
|
|
260
439
|
* ```
|
|
261
440
|
*/
|
|
262
|
-
declare
|
|
441
|
+
declare function getMergedRenderedCookies(cookieSpec: CookieSpec, options?: Omit<RenderOptions, "format">): Promise<string>;
|
|
263
442
|
|
|
264
|
-
export { getChromeCookie, getCookie, getFirefoxCookie, getGroupedRenderedCookies, getMergedRenderedCookies };
|
|
443
|
+
export { type BrowserName, type CookieQueryStrategy, type CookieSpec, type ExportedCookie, type MultiCookieSpec, type RenderOptions, getChromeCookie, getCookie, getFirefoxCookie, getGroupedRenderedCookies, getMergedRenderedCookies };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-VMBA4NVU.js";var o=()=>import("./getCookie-WV5KDZN7.js").then(e=>e.getCookie),i=()=>import("./getChromeCookie-CL3SRRWX.js").then(e=>e.getChromeCookie),r=()=>import("./getFirefoxCookie-BXQ2GXAW.js").then(e=>e.getFirefoxCookie),t=()=>import("./getGroupedRenderedCookies-FNJ6FQVQ.js").then(e=>e.getGroupedRenderedCookies),p=()=>import("./getMergedRenderedCookies-PNC2LHSD.js").then(e=>e.getMergedRenderedCookies);export{i as getChromeCookie,o as getCookie,r as getFirefoxCookie,t as getGroupedRenderedCookies,p as getMergedRenderedCookies};
|
|
1
|
+
import{a as u,b as _,c as l,d as y,e as U,f as d}from"./chunk-GVQTX3C5.js";import{existsSync as ie}from"fs";import{join as D}from"path";import se from"fast-glob";import{homedir as Y}from"os";import{join as ee}from"path";var C=(()=>{let t=Y();if(!t)throw new Error("Unable to determine user home directory");return ee(t,"Library","Application Support","Google","Chrome")})();import oe from"better-sqlite3";function re(t){try{return new oe(t,{readonly:!0,fileMustExist:!0})}catch(e){throw l("Database open failed",e,{file:t}),e}}function te(t){try{return t.close(),Promise.resolve()}catch(e){return l("Database close failed",e),Promise.reject(e instanceof Error?e:new Error("Failed to close database: Unknown error"))}}async function R({file:t,sql:e,params:o,rowFilter:r,rowTransform:s}){let i;try{i=re(t);let c=i.prepare(e).all(o),f=r?c.filter(r):c;return s?f.map(s):f}catch(n){throw l("Database query failed",n,{file:t,sql:e}),n}finally{i&&await te(i)}}function ne(t){if(typeof t!="string")return!1;let e=t.trim();return e.length===0?!1:ie(e)}async function ae(){let t=[D(C,"Default/Cookies"),D(C,"Profile */Cookies"),D(C,"Profile Default/Cookies")],e=[];for(let o of t){let r=await se(o);e.push(...r)}return y("ChromeCookies","Found cookie files",{count:e.length,files:e}),e}function fe(t,e){let o=t==="%",r=o?"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE host_key LIKE ?":"SELECT name, encrypted_value, host_key, expires_utc FROM cookies WHERE name = ? AND host_key LIKE ?",s=o?[`%${e}%`]:[t,`%${e}%`];return{sql:r,params:s}}async function ce(t,e,o){try{let{sql:r,params:s}=fe(e,o);y("ChromeCookies","Executing query",{sql:r,params:s});let i=await R({file:t,sql:r,params:s,rowTransform:n=>({name:n.name,domain:n.host_key,value:n.encrypted_value,expiry:n.expires_utc})});return _("QueryCookies",!0,{file:t,count:i.length}),i}catch(r){return l("Failed to read cookie file",r,{file:t}),[]}}async function z({name:t,domain:e,file:o}){let r=typeof o=="string"&&o.length>0?[o]:await ae();if(r.length===0)return y("ChromeCookies","No cookie files found"),[];let s=[];for(let i of r){if(!ne(i)){y("ChromeCookies","Cookie file missing or invalid",{file:i});continue}let n=await ce(i,t,e);s.push(...n)}return y("ChromeCookies","Query complete",{totalCookies:s.length}),s}import{readFileSync as We}from"fs";import{join as Je}from"path";import me from"fast-glob";var le=u.withTag("listChromeProfiles");function A(){let t=me.sync("./**/Cookies",{cwd:C,absolute:!0});return le.debug("Found cookie files:",t),t}import{createDecipheriv as pe,pbkdf2 as ue}from"crypto";import{memoize as Q}from"lodash-es";var de=Q(t=>t.length>=3&&t[0]===118&&t[1]===49&&t[2]===48?t.slice(3):t,t=>t.toString("hex")),ge=Q(t=>{let e=t[t.length-1];return e&&e<=16?t.slice(0,-e):t},t=>t.toString("hex"));function ye(t){let e=[/.*?0t(.+)$/,/.*?1e`(.+)$/,/.*?[`'](.+)$/,/[^\x20-\x7E]*([\x20-\x7E].+)$/];for(let o of e){let s=t.match(o)?.[1]??"";if(s.length>0)return s}return t}async function N(t,e){if(typeof e!="string")throw new Error("password must be a string");if(!Buffer.isBuffer(t))throw new Error("encryptedData must be a Buffer");return new Promise((o,r)=>{ue(e,"saltysalt",1003,16,"sha1",(s,i)=>{try{if(s){r(new Error("Failed to derive key: "+s.message));return}let n=de(t);if(n.length%16!==0){r(new Error("Encrypted data length is not a multiple of 16"));return}let c=Buffer.alloc(16," "),f=pe("aes-128-cbc",i,c);f.setAutoPadding(!1);let m=f.update(n);try{f.final()}catch(g){r(new Error("Failed to finalize decryption: "+g.message));return}m=ge(m);let p=m.toString("utf8");o(ye(p))}catch(n){r(new Error("Decryption failed: "+n.message))}})})}import{memoize as ke}from"lodash-es";var $=ke(async()=>{if(process.platform!=="darwin")throw l("Chrome password retrieval failed",new Error("This only works on macOS"),{platform:process.platform}),new Error("This only works on macOS");try{let{getChromePassword:t}=await import("./getChromePassword-6XZINNNO.js"),e=await t();return y("ChromePassword","Retrieved password successfully",{platform:"macOS"}),e}catch(t){throw l("Chrome password retrieval failed",t,{platform:"macOS"}),t}});function he(t){return typeof t!="number"||t<=0?"Infinity":new Date(t)}function M(t,e,o,r,s,i){return{domain:t,name:e,value:o,expiry:he(r),meta:{file:s,browser:"Chrome",decrypted:i}}}var w=class{constructor(){this.logger=U("ChromeCookieQueryStrategy");this.browserName="Chrome"}async queryCookies(e,o){try{if(this.logger.info("Querying cookies",{name:e,domain:o}),process.platform!=="darwin")return this.logger.warn("Platform not supported",{platform:process.platform}),[];let r=A();if(r.length===0)return this.logger.warn("No Chrome cookie files found"),[];let s=await $();return(await Promise.all(r.map(n=>this.processFile(n,e,o,s)))).flat()}catch(r){return r instanceof Error?l("Failed to query cookies",r,{name:e,domain:o}):l("Failed to query cookies",new Error(String(r)),{name:e,domain:o}),[]}}async processFile(e,o,r,s){try{let i=await z({name:o,domain:r,file:e}),n={file:e,password:s};return(await Promise.allSettled(i.map(f=>this.processCookie(f,n)))).map(f=>f.status==="fulfilled"?f.value:null).filter(f=>f!==null)}catch(i){return i instanceof Error?this.logger.error("Failed to process cookie file",{error:i,file:e}):this.logger.error("Failed to process cookie file",{error:String(i),file:e}),[]}}async processCookie(e,o){try{let r=Buffer.isBuffer(e.value)?e.value:Buffer.from(String(e.value)),s=await N(r,o.password);return M(e.domain,e.name,s,e.expiry,o.file,!0)}catch(r){return r instanceof Error?this.logger.warn("Failed to decrypt cookie",{error:r}):this.logger.warn("Failed to decrypt cookie",{error:String(r)}),M(e.domain,e.name,e.value.toString("utf-8"),e.expiry,o.file,!1)}}};import{homedir as Ce}from"os";import{join as j}from"path";import we from"fast-glob";function be(){let t=Ce();if(!t)return d("FirefoxCookieQuery","Failed to get home directory"),[];let e=[j(t,"Library/Application Support/Firefox/Profiles/*/cookies.sqlite"),j(t,".mozilla/firefox/*/cookies.sqlite")],o=[];for(let r of e){let s=we.sync(r);o.push(...s)}return y("FirefoxCookieQuery","Found Firefox cookie files",{files:o}),o}var b=class{constructor(){this.browserName="Firefox"}async queryCookies(e,o){let r=be(),s=[];for(let i of r)try{let n=await R({file:i,sql:"SELECT name, value, host as domain, expiry FROM moz_cookies WHERE name = ? AND host LIKE ?",params:[e,`%${o}%`],rowTransform:c=>({name:c.name,value:c.value,domain:c.domain,expiry:c.expiry>0?new Date(c.expiry*1e3):"Infinity",meta:{file:i,browser:"Firefox",decrypted:!1}})});s.push(...n)}catch(n){n instanceof Error?d("FirefoxCookieQuery",`Error reading Firefox cookie file ${i}`,{error:n.message}):d("FirefoxCookieQuery",`Error reading Firefox cookie file ${i}`)}return s}};import{homedir as Oe}from"os";import{join as Fe}from"path";import{Buffer as ve}from"buffer";import{readFileSync as Re}from"fs";import{homedir as Be}from"os";import{join as Pe}from"path";import{Buffer as L}from"buffer";import xe from"destr";import{z as a}from"zod";var B=a.string().trim().min(1,"Domain cannot be empty").refine(t=>/^\.?[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(t),"Invalid domain format"),P=a.string().trim().min(1,"Cookie name cannot be empty").refine(t=>t==="%"||/^[!#$%&'()*+\-.:0-9A-Z \^_`a-z|~]+$/.test(t),"Invalid cookie name format - must contain only valid characters (letters, numbers, and certain symbols) or be '%' for wildcard"),V=a.string().trim().min(1,"Path cannot be empty").refine(t=>t.startsWith("/"),"Path must start with /").refine(t=>/^\/[!#$%&'()*+,\-./:=@\w~]*$/.test(t),"Invalid path format - must contain only valid URL path characters").default("/"),H=a.string().trim().transform(t=>xe(t)).pipe(a.any()),W=a.object({name:P,value:H,domain:B,path:V,expiry:a.number().int(),creation:a.number().int(),flags:a.number().optional(),version:a.number().int().optional(),port:a.number().int().optional(),comment:a.string().optional(),commentURL:a.string().optional()}),bo=a.object({name:P,domain:B}).strict(),Ee=a.object({file:a.string().trim().min(1,"File path cannot be empty").optional(),browser:a.string().trim().optional(),decrypted:a.boolean().optional(),secure:a.boolean().optional(),httpOnly:a.boolean().optional(),path:V.optional()}).catchall(a.unknown()).strict(),S=a.object({domain:B,name:P,value:H,expiry:a.union([a.literal("Infinity"),a.date(),a.number().int().positive("Expiry must be a positive number")]).optional(),meta:Ee.optional()}).strict(),xo=a.object({expiry:a.number().int().optional(),domain:B,name:P,value:a.union([a.string(),a.instanceof(Buffer)])}).strict(),Eo=a.object({format:a.enum(["merged","grouped"]).optional(),separator:a.string().optional(),showFilePaths:a.boolean().optional()}).strict(),Se=a.enum(["Chrome","Firefox","Safari","internal","unknown"]),So=a.object({browserName:Se,queryCookies:a.function().args(a.string(),a.string()).returns(a.promise(a.array(S)))}).strict();var O=class{constructor(e){this.version=0;this.url="";this.name="";this.path="";this.value="";this.flags={isSecure:!1,isHTTPOnly:!1,unknown1:!1,unknown2:!1};this.expiration=0;this.creation=0;let o={offset:0,buffer:e};this.decode(o)}decodeUrlValue(e){let o=e,r;do{r=o;try{o=decodeURIComponent(o)}catch{return r}}while(o!==r&&o.includes("%"));return o}decodeJwtPayload(e){let o=e.split(".");if(o.length!==3)return null;try{let r=L.from(o[1],"base64").toString("utf8"),s=JSON.parse(r);return JSON.stringify(s)}catch{return null}}parseJsonValue(e){try{let o=JSON.parse(e);return JSON.stringify(o)}catch{return null}}processValue(e){let o=this.decodeUrlValue(e);if(o.match(/^ey[A-Za-z0-9_-]+\.ey[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/)){let r=this.decodeJwtPayload(o);if(typeof r=="string"&&r.length>0)return r}if(o.startsWith("{")||o.startsWith("[")){let r=this.parseJsonValue(o);if(typeof r=="string"&&r.length>0)return r}return o}toCookieRow(){try{let e=this.convertFlags(),o=this.url.replace(/^https?:\/\//,"").replace(/\/.*$/,"")||"uk";return W.parse({name:this.name.replace(/^: /,""),value:this.processValue(this.value)||"",domain:o,path:this.path||"/",expiry:this.expiration,creation:this.creation,flags:e,version:this.version,port:this.port,comment:this.comment,commentURL:this.commentURL})}catch{return null}}readNullTerminatedString(e,o){let r=o;for(;r<e.buffer.length&&e.buffer[r]!==0;)r++;return e.buffer.toString("utf8",o,r)||""}readHeader(e){let o=e.buffer.readUInt32LE(e.offset);e.offset+=4,e.offset+=4;let r=e.buffer.readUInt32LE(e.offset);e.offset+=4,this.flags={isSecure:(r&1)!==0,isHTTPOnly:(r&4)!==0,unknown1:(r&8)!==0,unknown2:(r&16)!==0};let s=e.buffer.readUInt32LE(e.offset);e.offset+=4;let i={urlOffset:e.buffer.readUInt32LE(e.offset),nameOffset:e.buffer.readUInt32LE(e.offset+4),pathOffset:e.buffer.readUInt32LE(e.offset+8),valueOffset:e.buffer.readUInt32LE(e.offset+12),commentOffset:e.buffer.readUInt32LE(e.offset+16),commentURLOffset:e.buffer.readUInt32LE(e.offset+20)};return{size:o,hasPort:s,offsets:i}}readTimestamps(e){let o=L.alloc(8);for(let n=0;n<8;n++)o[n]=e.buffer[e.offset+n];let r=o.readDoubleLE(0);e.offset+=8;let s=L.alloc(8);for(let n=0;n<8;n++)s[n]=e.buffer[e.offset+n];let i=s.readDoubleLE(0);e.offset+=8,this.expiration=r,this.creation=i}readStrings(e,o,r){let i=[{field:"url",offset:r.urlOffset},{field:"name",offset:r.nameOffset},{field:"path",offset:r.pathOffset},{field:"value",offset:r.valueOffset},{field:"comment",offset:r.commentOffset}].filter(n=>n.offset>0).sort((n,c)=>n.offset-c.offset);for(let n=0;n<i.length;n++){let{field:c,offset:f}=i[n],p=(n<i.length-1?i[n+1].offset:o)-f,g=0+f;for(;g<0+f+p&&e.buffer[g]!==0;)g++;let h=e.buffer.toString("utf8",0+f,g);switch(c){case"url":this.url=h;break;case"name":this.name=h;break;case"path":this.path=h;break;case"value":this.value=h;break;case"comment":this.comment=h;break}}}decode(e){let{size:o,hasPort:r,offsets:s}=this.readHeader(e),i=e.offset;e.offset=i+24,this.readTimestamps(e),r>0&&(this.port=e.buffer.readUInt16LE(e.offset),e.offset+=2),e.offset=i,this.readStrings(e,o,s)}convertFlags(){return(this.flags.isSecure?1:0)|(this.flags.isHTTPOnly?4:0)|(this.flags.unknown1?8:0)|(this.flags.unknown2?16:0)}};var x=class x{constructor(e){this.cookies=[];let o={offset:0,buffer:e};this.decode(o)}toCookieRows(){let e=[];for(let o of this.cookies)try{let r=o.toCookieRow();r!==null&&e.push(r)}catch(r){let s=r instanceof Error?r.message:String(r);d("BinaryCookies","Error converting cookie",{error:s})}return e}decode(e){let o=e.buffer.readUInt32BE(e.offset);if(e.offset+=4,o!==x.HEADER)throw new Error("Invalid page header");let r=e.buffer.readUInt32LE(e.offset);e.offset+=4;let s=e.offset-8,i=[];for(let c=0;c<r;c++){let f=e.buffer.readUInt32LE(e.offset);i.push(f),e.offset+=4}let n=e.buffer.readUInt32BE(e.offset);if(e.offset+=4,n!==x.FOOTER)throw new Error("Invalid page footer");for(let c=0;c<r;c++)try{let f=i[c],m=s+f,p=e.buffer.readUInt32LE(m);if(p<48){d("BinaryCookies",`Invalid cookie size ${p} at index ${c}`);continue}if(m+p>e.buffer.length){d("BinaryCookies",`Cookie size ${p} at index ${c} would exceed buffer length`);continue}let g=e.buffer.subarray(m,m+p),h=new O(g);this.cookies.push(h)}catch(f){let m=f instanceof Error?f.message:String(f);d("BinaryCookies",`Error decoding cookie at index ${c}`,{error:m})}}};x.HEADER=256,x.FOOTER=0;var F=x;var k=class k{constructor(e){let o={offset:0,buffer:e};this.pages=[],this.metadata={},this.decode(o)}static fromFile(e){let o=Re(e);return new k(o)}static fromDefaultPath(){return k.fromFile(k.DEFAULT_COOKIE_PATH)}toCookieRows(){let e=[];for(let o of this.pages)try{let r=o.toCookieRows();Array.isArray(r)&&e.push(...r)}catch(r){let s=r instanceof Error?r.message:String(r);d("BinaryCookies","Error converting page cookies",{error:s})}return e}decode(e){try{let o=e.buffer.subarray(e.offset,e.offset+4);if(e.offset+=4,!o.equals(k.MAGIC))throw new Error("Missing magic value");let r=e.buffer.readUInt32BE(e.offset);e.offset+=4;let s=[];for(let m=0;m<r;m++)s.push(e.buffer.readUInt32BE(e.offset)),e.offset+=4;let i=e.offset;for(let m of s)try{let p=e.buffer.subarray(i,i+m),g=new F(p);this.pages.push(g),i+=m}catch(p){let g=p instanceof Error?p.message:String(p);d("BinaryCookies","Error decoding page",{error:g}),i+=m}e.offset=i;let n=e.buffer.readUInt32BE(e.offset);e.offset+=4;let c=e.buffer.readBigUInt64BE(e.offset);e.offset+=8,c!==k.FOOTER&&d("BinaryCookies","Invalid cookie file format: wrong footer");let f=e.buffer.subarray(e.offset);this.metadata={}}catch(o){let r=o instanceof Error?o.message:String(o);throw d("BinaryCookies","Error decoding binary cookies file",{error:r}),o}}};k.MAGIC=ve.from("cook","utf8"),k.FOOTER=BigInt("0x071720050000004b"),k.DEFAULT_COOKIE_PATH=Pe(Be(),"Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies");var T=k;function Z(t){return T.fromFile(t).toCookieRows()}var I=class{constructor(){this.browserName="Safari"}getCookieDbPath(e){return Fe(e,"Library","Containers","com.apple.Safari","Data","Library","Cookies","Cookies.binarycookies")}decodeCookies(e,o,r){try{return Z(e).filter(i=>(o==="%"||i.name===o)&&(r==="%"||i.domain.includes(r))).map(i=>({domain:i.domain,name:i.name,value:Buffer.isBuffer(i.value)?i.value.toString():String(i.value),expiry:typeof i.expiry=="number"&&i.expiry>0?new Date(i.expiry*1e3):"Infinity",meta:{file:e,browser:"Safari",decrypted:!1}}))}catch(s){return s instanceof Error?l("SafariCookieQueryStrategy",`Error decoding ${e}`,{error:s,name:o,domain:r}):l("SafariCookieQueryStrategy",`Error decoding ${e}`,{error:"Unknown error",name:o,domain:r}),[]}}async queryCookies(e,o){let r=Oe();if(typeof r!="string"||r.length===0)return l("SafariCookieQueryStrategy","Failed to get home directory"),Promise.resolve([]);let s=this.getCookieDbPath(r);return Promise.resolve(this.decodeCookies(s,e||"%",o||"%"))}};async function q(t){if(!t.name||!t.domain)return[];let{name:e,domain:o}=t;if(typeof e!="string"||typeof o!="string")return[];let r=[new w,new b,new I];return(await Promise.allSettled(r.map(i=>i.queryCookies(e,o)))).filter(i=>i.status==="fulfilled").flatMap(i=>i.value)}async function E(t){try{return await q(t)}catch(e){return u.warn("Error querying cookies:",e instanceof Error?e.message:String(e)),[]}}async function J(t){try{return await new w().queryCookies(t.name,t.domain)}catch(e){return u.warn("Error querying Chrome cookies:",e),[]}}async function G(t){try{return await new b().queryCookies(t.name,t.domain)}catch(e){return u.warn("Error querying Firefox cookies:",e instanceof Error?e.message:String(e)),[]}}import{groupBy as Te}from"lodash-es";function v(t,e={}){let{format:o="merged",showFilePaths:r=!0,separator:s="; "}=e;if(t.length===0)return o==="merged"?"":[];if(o==="merged")return t.map(n=>n.value).join(s);let i=Te(t,n=>n.meta?.file??"unknown");return Object.entries(i).map(([n,c])=>{let f=c.map(m=>m.value).join(s);return r?`${n}: ${f}`:f})}async function K(t,e={}){try{let o=await E(t);if(!Array.isArray(o))return[];let r=o.filter(s=>{let i=S.safeParse(s);return i.success?!0:(u.warn("Invalid cookie format:",i.error.format()),!1)});return v(r,{...e,format:"grouped"})}catch(o){return u.warn("Error getting grouped rendered cookies:",o instanceof Error?o.message:String(o)),[]}}async function X(t,e){try{let o=await E(t);if(!Array.isArray(o))return"";let r=o.filter(i=>{let n=S.safeParse(i);return n.success?!0:(u.warn("Invalid cookie format:",n.error.format()),!1)}),s=v(r,{...e,format:"merged"});return typeof s=="string"?s:""}catch(o){return u.warn("Error getting merged rendered cookies:",o instanceof Error?o.message:String(o)),""}}export{J as getChromeCookie,E as getCookie,G as getFirefoxCookie,K as getGroupedRenderedCookies,X as getMergedRenderedCookies};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|