@types/express-mysql-session
Advanced tools
Comparing version 2.1.3 to 3.0.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for express-mysql-session 2.1 | ||
// Type definitions for express-mysql-session 3.0 | ||
// Project: https://github.com/chill117/express-mysql-session#readme | ||
@@ -9,2 +9,3 @@ // Definitions by: Akim95 <https://github.com/Akim95> | ||
import * as expressSession from 'express-session'; | ||
import { Connection, Pool, PoolOptions } from 'mysql2'; | ||
@@ -16,12 +17,63 @@ export = MySQLStore; | ||
declare namespace MySQLStore { | ||
interface Options { | ||
interface Options | ||
extends Pick<PoolOptions, 'waitForConnections' | 'connectionLimit' | 'maxIdle' | 'idleTimeout' | 'queueLimit'> { | ||
/** | ||
* Host name for database connection | ||
*/ | ||
host?: string | undefined; | ||
/** | ||
* Port number for database connection | ||
*/ | ||
port?: number | undefined; | ||
/** | ||
* Database user | ||
*/ | ||
user?: string | undefined; | ||
/** | ||
* Password for the above database user | ||
*/ | ||
password?: string | undefined; | ||
/** | ||
* Database name | ||
*/ | ||
database?: string | undefined; | ||
/** | ||
* Whether or not to automatically check for and clear expired sessions | ||
*/ | ||
clearExpired?: boolean | undefined; | ||
/** | ||
* How frequently expired sessions will be cleared; milliseconds | ||
*/ | ||
checkExpirationInterval?: number | undefined; | ||
/** | ||
* The maximum age of a valid session; milliseconds | ||
*/ | ||
expiration?: number | undefined; | ||
/** | ||
* Whether or not to create the sessions database table, if one does not already exist | ||
*/ | ||
createDatabaseTable?: boolean | undefined; | ||
connectionLimit?: number | undefined; | ||
/** | ||
* Whether or not to end the database connection when the store is closed. | ||
* The default value of this option depends on whether or not a connection was passed to the constructor. | ||
* If a connection object is passed to the constructor, the default value for this option is false. | ||
*/ | ||
endConnectionOnClose?: boolean | undefined; | ||
/** | ||
* Whether or not to disable touch | ||
*/ | ||
disableTouch?: boolean | undefined; | ||
charset?: string | undefined; | ||
schema?: Partial<Schema> | undefined; | ||
@@ -43,29 +95,73 @@ } | ||
declare class MySQLStoreClass extends expressSession.Store { | ||
constructor(options: MySQLStore.Options, connection?: any, callback?: (error: any) => void); | ||
constructor(options?: MySQLStore.Options, connection?: Connection | Pool); | ||
setDefaultOptions(): void; | ||
state: 'UNINITIALIZED' | 'INITIALIZING' | 'INITIALIZED' | 'CLOSING' | 'CLOSED'; | ||
setOptions(options: MySQLStore.Options): void; | ||
defaultOptions: MySQLStore.Options; | ||
connection: Connection | Pool; | ||
onReadyPromises: Array<{ | ||
resolve: () => void; | ||
reject: (reason?: any) => void; | ||
}>; | ||
options: MySQLStore.Options; | ||
private _expirationInterval?: NodeJS.Timer | null; | ||
onReady(): Promise<void>; | ||
resolveReadyPromises(): void; | ||
rejectReadyPromises(error: Error): void; | ||
prepareOptionsForMySQL2( | ||
options: MySQLStore.Options, | ||
): Pick< | ||
MySQLStore.Options, | ||
| 'host' | ||
| 'port' | ||
| 'user' | ||
| 'password' | ||
| 'database' | ||
| 'waitForConnections' | ||
| 'connectionLimit' | ||
| 'maxIdle' | ||
| 'idleTimeout' | ||
| 'queueLimit' | ||
>; | ||
createPool(options: MySQLStore.Options): Pool; | ||
setOptions(options?: MySQLStore.Options): void; | ||
validateOptions(options: MySQLStore.Options): void; | ||
createDatabaseTable(callback?: (error: any) => void): void; | ||
createDatabaseTable(): Promise<void>; | ||
get(sessionId: string, callback?: (error: any, session: any) => void): void; | ||
get(sessionId: string, callback: (error: any, session: any) => void): void; | ||
get(sessionId: string): Promise<any>; | ||
set(sessionId: string, data: any, callback?: (error: any) => void): void; | ||
set(sessionId: string, data: any, callback: (error: any) => void): void; | ||
set(sessionId: string, data: any): Promise<void>; | ||
touch(sessionId: string, data: any, callback?: (error: any) => void): void; | ||
touch(sessionId: string, data: any, callback: (error: any) => void): void; | ||
touch(sessionId: string, data: any): Promise<void>; | ||
destroy(sessionId: string, callback?: (error: any) => void): void; | ||
destroy(sessionId: string, callback: (error: any) => void): void; | ||
destroy(sessionId: string): Promise<void>; | ||
length(callback?: (error: any, count: any) => void): void; | ||
length(callback: (error: any, count: number) => void): void; | ||
length(): Promise<number>; | ||
all(callback?: (error: any, sessions: any) => void): void; | ||
all(callback: (error: any, sessions: Record<string, any>) => void): void; | ||
all(): Promise<Record<string, any>>; | ||
clear(callback?: (error: any) => void): void; | ||
clear(callback: (error: any) => void): void; | ||
clear(): Promise<void>; | ||
clearExpiredSessions(callback?: (error: any) => void): void; | ||
clearExpiredSessions(): Promise<void>; | ||
query(sql: string, params: any, callback?: (error: any, rows: any, fields: any) => void): void; | ||
query(sql: string, params: any): Promise<any>; | ||
@@ -76,3 +172,4 @@ setExpirationInterval(interval: number): void; | ||
close(callback?: () => void): void; | ||
close(callback: () => void): void; | ||
close(): Promise<void>; | ||
} |
{ | ||
"name": "@types/express-mysql-session", | ||
"version": "2.1.3", | ||
"version": "3.0.0", | ||
"description": "TypeScript definitions for express-mysql-session", | ||
@@ -33,6 +33,7 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-mysql-session", | ||
"dependencies": { | ||
"@types/express-session": "*" | ||
"@types/express-session": "*", | ||
"mysql2": "3.2.0" | ||
}, | ||
"typesPublisherContentHash": "9d9d01d168c774b4f31d7c2cb6a24615369d5b03ea4a2abf546975591376b67f", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "11803302001eb8813c934c965b4576b828babe7fced6f682efd1516c331ce575", | ||
"typeScriptVersion": "4.3" | ||
} |
@@ -9,84 +9,6 @@ # Installation | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-mysql-session. | ||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/express-mysql-session/index.d.ts) | ||
````ts | ||
// Type definitions for express-mysql-session 2.1 | ||
// Project: https://github.com/chill117/express-mysql-session#readme | ||
// Definitions by: Akim95 <https://github.com/Akim95> | ||
// Sebastian Krüger <https://github.com/mathe42> | ||
// Ionaru <https://github.com/Ionaru> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
import * as expressSession from 'express-session'; | ||
export = MySQLStore; | ||
declare function MySQLStore(session: typeof expressSession): typeof MySQLStoreClass; | ||
declare namespace MySQLStore { | ||
interface Options { | ||
host?: string | undefined; | ||
port?: number | undefined; | ||
user?: string | undefined; | ||
password?: string | undefined; | ||
database?: string | undefined; | ||
checkExpirationInterval?: number | undefined; | ||
expiration?: number | undefined; | ||
createDatabaseTable?: boolean | undefined; | ||
connectionLimit?: number | undefined; | ||
schema?: Partial<Schema> | undefined; | ||
} | ||
interface Schema { | ||
tableName: string; | ||
columnNames: Partial<ColumnNames>; | ||
} | ||
interface ColumnNames { | ||
session_id: string; | ||
expires: string; | ||
data: string; | ||
} | ||
type MySQLStore = MySQLStoreClass; | ||
} | ||
declare class MySQLStoreClass extends expressSession.Store { | ||
constructor(options: MySQLStore.Options, connection?: any, callback?: (error: any) => void); | ||
setDefaultOptions(): void; | ||
setOptions(options: MySQLStore.Options): void; | ||
validateOptions(options: MySQLStore.Options): void; | ||
createDatabaseTable(callback?: (error: any) => void): void; | ||
get(sessionId: string, callback?: (error: any, session: any) => void): void; | ||
set(sessionId: string, data: any, callback?: (error: any) => void): void; | ||
touch(sessionId: string, data: any, callback?: (error: any) => void): void; | ||
destroy(sessionId: string, callback?: (error: any) => void): void; | ||
length(callback?: (error: any, count: any) => void): void; | ||
all(callback?: (error: any, sessions: any) => void): void; | ||
clear(callback?: (error: any) => void): void; | ||
clearExpiredSessions(callback?: (error: any) => void): void; | ||
query(sql: string, params: any, callback?: (error: any, rows: any, fields: any) => void): void; | ||
setExpirationInterval(interval: number): void; | ||
clearExpirationInterval(): void; | ||
close(callback?: () => void): void; | ||
} | ||
```` | ||
### Additional Details | ||
* Last updated: Thu, 08 Jul 2021 12:01:20 GMT | ||
* Dependencies: [@types/express-session](https://npmjs.com/package/@types/express-session) | ||
* Last updated: Fri, 23 Jun 2023 20:32:42 GMT | ||
* Dependencies: [@types/express-session](https://npmjs.com/package/@types/express-session), [@types/mysql2](https://npmjs.com/package/@types/mysql2) | ||
* Global values: none | ||
@@ -93,0 +15,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7988
127
2
17
+ Addedmysql2@3.2.0
+ Addeddenque@2.1.0(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedlong@5.2.3(transitive)
+ Addedlru-cache@7.18.3(transitive)
+ Addedmysql2@3.2.0(transitive)
+ Addednamed-placeholders@1.1.3(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedseq-queue@0.0.5(transitive)
+ Addedsqlstring@2.3.3(transitive)