DefinitelyTyped/types/documentdb-session/index.d.ts
Alexandre f8d0b72ff4 Allow typing Express body, params, query and cookies through generics (#20820)
* Allow typing express body, params, query and cookies through generics

* Increase minor version

* Add ts version comment

* Fix ts requirement comment typo

* Bump all ts version packages

* Bump Morgan package
2017-10-23 17:23:31 -07:00

64 lines
2.7 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Type definitions for documentdb-session 1.0
// Project: https://github.com/dwhieb/documentdb-session#readme
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import session = require("express-session");
export = DocumentDBSession;
declare function DocumentDBSession(expressSession: typeof session): DocumentDBStoreConstructor;
interface DocumentDBStoreConstructor {
new (options: Options): session.Store;
}
interface Options {
/**
* The ID of the collection where the session data should be stored.
* If the collection does not exist, it will be created when the session store initializes.
* The collection may contain other data, or it may be a dedicated collection just for sessions.
*
* @default `"sessions"`
*/
collection?: string;
/**
* The ID of the database where the session data should be stored.
* If the database does not exist, it will be creaed when the session store initializes.
*
* @default `"sessionstore"`
*/
database?: string;
/**
* By default, `documentdb-session` sets a `"type"` attribute on each session document with a value of `"session"`,
* to distinguish session documents from other documents in the collection.
* If you would like a different attribute or value to be used to discriminate session documents from other documents,
* enter that as an attribute-value pair in an object here, e.g. `{site:"mysite.com"}` or `{_type:"session"}`.
*
* @default `{type:"session"}`
*/
discriminator?: object;
/**
* The URL / hostname of your DocumentDB database account, usually of the form `https://mydbaccount.documents.azure.com:443/`.
* You can also provide this in an environment variable, (`DOCUMENTDB_URL`) instead.
*/
host: string;
/**
* The primary key for your DocumentDB account.
* A primary key is required because `documentdb-session` may create a new database for your account, if none exists.
* You can also provide this in an environment variable (`DOCUMENTDB_KEY`) instead.
*/
key: string;
/**
* The TTL (time-to-live or expiration time) for your sessions, in seconds.
* After this time has elapsed since the last change to the session data, the session will be deleted.
* A session's TTL is extended each time session data is changed, restarting the timer.
* See more on [**Configuring TTL**](https://github.com/dwhieb/documentdb-session#configuring-ttl-time-to-live-or-expiration-time).
* *Enabling TTL is strongly recommended.*
*/
ttl?: number;
}