1 | export class CookieAccessInfo {
|
2 | |
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | constructor(domain: string, path?: string, secure?: boolean, script?: boolean);
|
10 |
|
11 | static All: CookieAccessInfo;
|
12 | domain: string; // domain to match
|
13 | path: string; // path to match
|
14 | secure: boolean; // access is secure (ssl generally)
|
15 | script: boolean; // access is from a script
|
16 | }
|
17 |
|
18 | export class Cookie {
|
19 | name: string;
|
20 | value: string;
|
21 | domain: string;
|
22 | explicit_domain: boolean;
|
23 | path: string;
|
24 | explicit_path: boolean;
|
25 | noscript: boolean;
|
26 | secure: boolean;
|
27 | expiration_date: number;
|
28 |
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | constructor(cookie: string | Cookie, requestDomain?: string, requestPath?: string);
|
42 |
|
43 | /**
|
44 | * the set-cookie: string for this cookie
|
45 | */
|
46 | toString(): string;
|
47 |
|
48 | /**
|
49 | * the cookie: string for this cookie
|
50 | */
|
51 | toValueString(): string;
|
52 |
|
53 | /**
|
54 | * parses the string onto this cookie or a new one if called directly
|
55 | * @param cookie string to be parsed into a Cookie
|
56 | * @param requestDomain string definind the requesting domain
|
57 | * @param requestPath string defining the requesting path
|
58 | */
|
59 | parse(cookie: string, requestDomain?: string, requestPath?: string): Cookie;
|
60 |
|
61 | /**
|
62 | * returns true if the access_info allows retrieval of this cookie
|
63 | * @param accessInfo CookieAccessInfo
|
64 | */
|
65 | matches(accessInfo: CookieAccessInfo): boolean;
|
66 |
|
67 | /**
|
68 | * returns true if the cookies cannot exist in the same space
|
69 | * (domain and path match)
|
70 | * @param cookie Cookie
|
71 | */
|
72 | collidesWith(cookie: Cookie): boolean;
|
73 | }
|
74 |
|
75 | export class CookieJar {
|
76 | |
77 |
|
78 |
|
79 | constructor();
|
80 |
|
81 | /**
|
82 | * modify (or add if not already-existing) a cookie to the jar
|
83 | * @param cookie string | Cookie
|
84 | * @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string
|
85 | * @param requestPath string argument is used to set the path if it is not explicit in a cookie String
|
86 | */
|
87 | setCookie(cookie: string | Cookie, requestDomain?: string, requestPath?: string): Cookie | false;
|
88 |
|
89 | /**
|
90 | * modify (or add if not already-existing) a large number of cookies to the
|
91 | * jar
|
92 | * @param cookie string or list of strings defining cookies
|
93 | * @param requestDomain string argument is used to default the domain if it is not explicit in the cookie string
|
94 | * @param requestPath string argument is used to set the path if it is not explicit in a cookie String
|
95 | */
|
96 | setCookies(cookie: string | readonly string[], requestDomain?: string, requestPath?: string): Cookie[];
|
97 |
|
98 | /**
|
99 | * get a cookie with the name and access_info matching
|
100 | * @param cookieName string to be parsed into a Cookie
|
101 | * @param accessInfo CookieAccessInfo
|
102 | */
|
103 | getCookie(cookieName: string, accessInfo: CookieAccessInfo): Cookie | undefined;
|
104 |
|
105 | /**
|
106 | * grab all cookies matching this access_info
|
107 | * @param accessInfo CookieAccessInfo
|
108 | */
|
109 | getCookies(accessInfo: CookieAccessInfo): readonly Cookie[] & { toValueString(): string };
|
110 | }
|