| 155 | * } |
| 156 | */ |
| 157 | export interface SessionConfig { |
| 158 | /** |
| 159 | * Whether session management is enabled for the application |
| 160 | */ |
| 161 | enabled: boolean |
| 162 | |
| 163 | /** |
| 164 | * Name of the cookie used to store the session ID |
| 165 | */ |
| 166 | cookieName: string |
| 167 | |
| 168 | /** |
| 169 | * Maximum age of the session data and session ID cookie. |
| 170 | * Session data is automatically cleaned up after this duration of inactivity. |
| 171 | * Value can be a time expression (e.g. '2 hours') or number of seconds. |
| 172 | * Cookie duration is also set to this value unless clearWithBrowser is enabled. |
| 173 | */ |
| 174 | age: string | number |
| 175 | |
| 176 | /** |
| 177 | * Additional cookie options for the session ID cookie. |
| 178 | * Excludes maxAge and expires as they're controlled by age and clearWithBrowser. |
| 179 | */ |
| 180 | cookie: Partial<CookieOptions> |
| 181 | |
| 182 | /** |
| 183 | * Whether to give a new session ID when the cookie names a session |
| 184 | * the store does not have (expired or destroyed). Defaults to false. |
| 185 | * |
| 186 | * When true, the ID of an ended session is never used again, so a |
| 187 | * late request that read the old session cannot write it back. The |
| 188 | * session is "fresh". A session without data then gets a new ID on |
| 189 | * each request, so do not use `session.sessionId` as a stable key |
| 190 | * for a session without data. |
| 191 | */ |
| 192 | renewMissingSessionId?: boolean |
| 193 | |
| 194 | /** |
| 195 | * Whether to send the session ID cookie on every response, which |
| 196 | * refreshes its Max-Age. Defaults to true. |
| 197 | * |
| 198 | * When false, the cookie is only sent when the session ID changes |
| 199 | * (new session, regenerate) or the browser did not send one. A late |
| 200 | * response then cannot put back in the browser a session ID it has |
| 201 | * left, e.g. the guest ID after a login that regenerated the session. |
| 202 | * |
| 203 | * The cookie Max-Age is no longer refreshed, so the browser drops the |
| 204 | * cookie `age` after the session started. Pair it with |
| 205 | * `clearWithBrowser` and let the store expire inactive sessions. |
| 206 | */ |
| 207 | refreshCookie?: boolean |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Configuration for file-based session storage. |
nothing calls this directly
no outgoing calls
no test coverage detected