From 2f258dcc12977e20c24d329bab2fcd901473cde0 Mon Sep 17 00:00:00 2001 From: adamjmcgrath Date: Wed, 28 Oct 2020 14:32:13 +0000 Subject: [PATCH 1/3] Fix cookie params TS defs --- index.d.ts | 77 +++++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/index.d.ts b/index.d.ts index a2cecbf6..e74d632a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -384,41 +384,7 @@ interface ConfigParams { }; } -/** - * Configuration parameters used for the application session. - */ -interface SessionConfigParams { - /** - * String value for the cookie name used for the internal session. - * This value must only include letters, numbers, and underscores. - * Default is `appSession`. - */ - name?: string; - - /** - * If you want your session duration to be rolling, eg reset everytime the - * user is active on your site, set this to a `true`. If you want the session - * duration to be absolute, where the user is logged out a fixed time after login, - * regardless of activity, set this to `false` - * Default is `true`. - */ - rolling?: boolean; - - /** - * Integer value, in seconds, for application session rolling duration. - * The amount of time for which the user must be idle for then to be logged out. - * Default is 86400 seconds (1 day). - */ - rollingDuration?: number; - - /** - * Integer value, in seconds, for application absolute rolling duration. - * The amount of time after the user has logged in that they will be logged out. - * Set this to `false` if you don't want an absolute duration on your session. - * Default is 604800 seconds (7 days). - */ - absoluteDuration?: boolean | number; - +interface CookieConfigParams { /** * Domain name for the cookie. * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `domain` @@ -459,6 +425,47 @@ interface SessionConfigParams { sameSite?: string; } +/** + * Configuration parameters used for the application session. + */ +interface SessionConfigParams { + /** + * String value for the cookie name used for the internal session. + * This value must only include letters, numbers, and underscores. + * Default is `appSession`. + */ + name?: string; + + /** + * If you want your session duration to be rolling, eg reset everytime the + * user is active on your site, set this to a `true`. If you want the session + * duration to be absolute, where the user is logged out a fixed time after login, + * regardless of activity, set this to `false` + * Default is `true`. + */ + rolling?: boolean; + + /** + * Integer value, in seconds, for application session rolling duration. + * The amount of time for which the user must be idle for then to be logged out. + * Default is 86400 seconds (1 day). + */ + rollingDuration?: number; + + /** + * Integer value, in seconds, for application absolute rolling duration. + * The amount of time after the user has logged in that they will be logged out. + * Set this to `false` if you don't want an absolute duration on your session. + * Default is 604800 seconds (7 days). + */ + absoluteDuration?: boolean | number; + + /** + * Properties for the session cookie and transient cookies. + */ + cookie?: CookieConfigParams; +} + interface AccessToken { /** * The access token itself, can be an opaque string, JWT, or non-JWT token. From 8d07e21b0b86b35b4d6b2a830207ed6c4cfbd0aa Mon Sep 17 00:00:00 2001 From: adamjmcgrath Date: Fri, 30 Oct 2020 13:05:51 +0000 Subject: [PATCH 2/3] better diff --- index.d.ts | 85 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/index.d.ts b/index.d.ts index e6abc5c8..4d526dd7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -384,47 +384,6 @@ interface ConfigParams { }; } -interface CookieConfigParams { - /** - * Domain name for the cookie. - * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `domain` - */ - domain?: string; - - /** - * Path for the cookie. - * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `path` - */ - path?: string; - - /** - * Set to true to use a transient cookie (cookie without an explicit expiration). - * Default is `false` - */ - transient?: boolean; - - /** - * Flags the cookie to be accessible only by the web server. - * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `httponly`. - * Defaults to `true`. - */ - httpOnly?: boolean; - - /** - * Marks the cookie to be used over secure channels only. - * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `secure`. - * Defaults to {@link Request.secure}. - */ - secure?: boolean; - - /** - * Value of the SameSite Set-Cookie attribute. - * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `samesite`. - * Defaults to "Lax" but will be adjusted based on {@link AuthorizationParameters.response_type}. - */ - sameSite?: string; -} - /** * Configuration parameters used for the application session. */ @@ -466,6 +425,50 @@ interface SessionConfigParams { cookie?: CookieConfigParams; } +/** + * Configuration parameters used for the session cookie and transient cookies. + */ +interface CookieConfigParams { + /** + * Domain name for the cookie. + * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `domain` + */ + domain?: string; + + /** + * Path for the cookie. + * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `path` + */ + path?: string; + + /** + * Set to true to use a transient cookie (cookie without an explicit expiration). + * Default is `false` + */ + transient?: boolean; + + /** + * Flags the cookie to be accessible only by the web server. + * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `httponly`. + * Defaults to `true`. + */ + httpOnly?: boolean; + + /** + * Marks the cookie to be used over secure channels only. + * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `secure`. + * Defaults to {@link Request.secure}. + */ + secure?: boolean; + + /** + * Value of the SameSite Set-Cookie attribute. + * Passed to the [Response cookie](https://expressjs.com/en/api.html#res.cookie) as `samesite`. + * Defaults to "Lax" but will be adjusted based on {@link AuthorizationParameters.response_type}. + */ + sameSite?: string; +} + interface AccessToken { /** * The access token itself, can be an opaque string, JWT, or non-JWT token. From e0b1a7ecef3cb28c71f745f2ad48e255a8d6588e Mon Sep 17 00:00:00 2001 From: adamjmcgrath Date: Fri, 30 Oct 2020 13:07:14 +0000 Subject: [PATCH 3/3] better diff --- index.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.d.ts b/index.d.ts index 4d526dd7..ff764946 100644 --- a/index.d.ts +++ b/index.d.ts @@ -420,14 +420,11 @@ interface SessionConfigParams { absoluteDuration?: boolean | number; /** - * Properties for the session cookie and transient cookies. + * Configuration parameters used for the session cookie and transient cookies. */ cookie?: CookieConfigParams; } -/** - * Configuration parameters used for the session cookie and transient cookies. - */ interface CookieConfigParams { /** * Domain name for the cookie.