mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[express-mysql-session] Improve typings (#43436)
* [express-mysql-session] Improve typings * [express-mysql-session] Revert unneeded changes * [express-mysql-session] Update version header * Revert "[express-mysql-session] Update version header" This reverts commit a6a15b97f6496603370df36dfdcdffb5ad0a601f. * [express-mysql-session] Use better name in all() callback
This commit is contained in:
parent
ff1063a5ee
commit
d08665f370
@ -9,8 +9,15 @@ const options = {
|
||||
user: 'root',
|
||||
password: '',
|
||||
database: 'session_test',
|
||||
schema: {
|
||||
columnNames: {
|
||||
data: 'content',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const sessionStore = new MySQLStore(options);
|
||||
|
||||
sessionStore.close();
|
||||
sessionStore.get('my-session-id', (error, session) => {});
|
||||
sessionStore.all();
|
||||
|
||||
24
types/express-mysql-session/index.d.ts
vendored
24
types/express-mysql-session/index.d.ts
vendored
@ -1,6 +1,8 @@
|
||||
// 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>
|
||||
// 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';
|
||||
@ -20,17 +22,19 @@ declare namespace MySQLStore {
|
||||
expiration?: number;
|
||||
createDatabaseTable?: boolean;
|
||||
connectionLimit?: number;
|
||||
schema?: Schema;
|
||||
schema?: Partial<Schema>;
|
||||
}
|
||||
interface Schema {
|
||||
tableName: string;
|
||||
columnNames: ColumnNames;
|
||||
columnNames: Partial<ColumnNames>;
|
||||
}
|
||||
interface ColumnNames {
|
||||
session_id: string;
|
||||
expires: string;
|
||||
data: string;
|
||||
}
|
||||
|
||||
type MySQLStore = MySQLStoreClass;
|
||||
}
|
||||
|
||||
declare class MySQLStoreClass {
|
||||
@ -38,6 +42,10 @@ declare class MySQLStoreClass {
|
||||
|
||||
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;
|
||||
@ -50,19 +58,17 @@ declare class MySQLStoreClass {
|
||||
|
||||
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;
|
||||
|
||||
default(object: any, defaultValues: any, options?: any): void;
|
||||
|
||||
clone(object: any): void;
|
||||
|
||||
isObject(value: any): void;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user