@types/cookie
Advanced tools
Comparing version 0.3.3 to 0.4.0
@@ -1,9 +0,17 @@ | ||
// Type definitions for cookie 0.3 | ||
// Type definitions for cookie 0.4 | ||
// Project: https://github.com/jshttp/cookie | ||
// Definitions by: Pine Mizune <https://github.com/pine> | ||
// Piotr Błażejewicz <https://github.com/peterblazejewicz> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
/** | ||
* Basic HTTP cookie parser and serializer for HTTP servers. | ||
*/ | ||
/** | ||
* Additional serialization options | ||
*/ | ||
export interface CookieSerializeOptions { | ||
/** | ||
* Specifies the value for the Domain Set-Cookie attribute. By default, no | ||
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.3|Domain Set-Cookie attribute}. By default, no | ||
* domain is set, and most clients will consider the cookie to apply to only | ||
@@ -24,12 +32,11 @@ * the current domain. | ||
*/ | ||
encode?(val: string): string; | ||
encode?(value: string): string; | ||
/** | ||
* Specifies the `Date` object to be the value for the `Expires` | ||
* `Set-Cookie` attribute. By default, no expiration is set, and most | ||
* clients will consider this a "non-persistent cookie" and will delete it | ||
* on a condition like exiting a web browser application. | ||
* Specifies the `Date` object to be the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.1|`Expires` `Set-Cookie` attribute}. By default, | ||
* no expiration is set, and most clients will consider this a "non-persistent cookie" and will delete | ||
* it on a condition like exiting a web browser application. | ||
* | ||
* *Note* the cookie storage model specification states that if both | ||
* `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is | ||
* *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification} | ||
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is | ||
* possible not all clients by obey this, so if both are set, they should | ||
@@ -40,3 +47,3 @@ * point to the same date and time. | ||
/** | ||
* Specifies the boolean value for the `HttpOnly` `Set-Cookie` attribute. | ||
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.6|`HttpOnly` `Set-Cookie` attribute}. | ||
* When truthy, the `HttpOnly` attribute is set, otherwise it is not. By | ||
@@ -54,4 +61,4 @@ * default, the `HttpOnly` attribute is not set. | ||
* | ||
* *Note* the cookie storage model specification states that if both | ||
* `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is | ||
* *Note* the {@link https://tools.ietf.org/html/rfc6265#section-5.3|cookie storage model specification} | ||
* states that if both `expires` and `maxAge` are set, then `maxAge` takes precedence, but it is | ||
* possible not all clients by obey this, so if both are set, they should | ||
@@ -62,9 +69,8 @@ * point to the same date and time. | ||
/** | ||
* Specifies the value for the `Path` `Set-Cookie` attribute. By default, | ||
* the path is considered the "default path". | ||
* Specifies the value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.4|`Path` `Set-Cookie` attribute}. | ||
* By default, the path is considered the "default path". | ||
*/ | ||
path?: string; | ||
/** | ||
* Specifies the boolean or string to be the value for the `SameSite` | ||
* `Set-Cookie` attribute. | ||
* Specifies the boolean or string to be the value for the {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|`SameSite` `Set-Cookie` attribute}. | ||
* | ||
@@ -80,8 +86,11 @@ * - `true` will set the `SameSite` attribute to `Strict` for strict same | ||
* cross-site cookie. | ||
* | ||
* More information about the different enforcement levels can be found in {@link https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7|the specification}. | ||
* | ||
* *note* This is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it. | ||
*/ | ||
sameSite?: boolean | 'lax' | 'strict' | 'none'; | ||
sameSite?: true | false | 'lax' | 'strict' | 'none'; | ||
/** | ||
* Specifies the boolean value for the `Secure` `Set-Cookie` attribute. When | ||
* truthy, the `Secure` attribute is set, otherwise it is not. By default, | ||
* the `Secure` attribute is not set. | ||
* Specifies the boolean value for the {@link https://tools.ietf.org/html/rfc6265#section-5.2.5|`Secure` `Set-Cookie` attribute}. When truthy, the | ||
* `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. | ||
* | ||
@@ -95,2 +104,5 @@ * *Note* be careful when setting this to `true`, as compliant clients will | ||
/** | ||
* Additional parsing options | ||
*/ | ||
export interface CookieParseOptions { | ||
@@ -109,3 +121,3 @@ /** | ||
*/ | ||
decode?(val: string): string; | ||
decode?(value: string): string; | ||
} | ||
@@ -118,3 +130,3 @@ | ||
* @param str the string representing a `Cookie` header value | ||
* @param options object containing parsing options | ||
* @param [options] object containing parsing options | ||
*/ | ||
@@ -127,5 +139,6 @@ export function parse(str: string, options?: CookieParseOptions): { [key: string]: string }; | ||
* @param name the name for the cookie | ||
* @param val value to set the cookie to | ||
* @param options object containing serialization options | ||
* @param value value to set the cookie to | ||
* @param [options] object containing serialization options | ||
* @throws {TypeError} when `maxAge` options is invalid | ||
*/ | ||
export function serialize(name: string, val: string, options?: CookieSerializeOptions): string; | ||
export function serialize(name: string, value: string, options?: CookieSerializeOptions): string; |
{ | ||
"name": "@types/cookie", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "TypeScript definitions for cookie", | ||
@@ -11,6 +11,11 @@ "license": "MIT", | ||
"githubUsername": "pine" | ||
}, | ||
{ | ||
"name": "Piotr Błażejewicz", | ||
"url": "https://github.com/peterblazejewicz", | ||
"githubUsername": "peterblazejewicz" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -23,4 +28,4 @@ "type": "git", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "91d338d129123c21e5858874d1ca8a6bd114c1a8b1850728bb034b2b863547e1", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "16f378b41a83402d78b875cb82a69c45ef888ee03788db1e6bcd4515daca6aab", | ||
"typeScriptVersion": "2.9" | ||
} |
@@ -5,9 +5,9 @@ # Installation | ||
# Summary | ||
This package contains type definitions for cookie ( https://github.com/jshttp/cookie ). | ||
This package contains type definitions for cookie (https://github.com/jshttp/cookie). | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cookie. | ||
Additional Details | ||
* Last updated: Fri, 24 May 2019 21:00:58 GMT | ||
### Additional Details | ||
* Last updated: Wed, 13 May 2020 15:49:11 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Pine Mizune <https://github.com/pine>. | ||
These definitions were written by [Pine Mizune](https://github.com/pine), and [Piotr Błażejewicz](https://github.com/peterblazejewicz). |
Sorry, the diff of this file is not supported yet
8804
128