mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-03 16:50:15 +00:00
committed by
GitHub
parent
49186d5fcc
commit
7cba407dbd
@@ -606,6 +606,12 @@
|
||||
"sourceRepoURL": "https://github.com/allipierre/Type-definitions-for-jquery-confirm/tree/master/types/confirmDialog-js",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "connect-mongo",
|
||||
"typingsPackageName": "connect-mongo",
|
||||
"sourceRepoURL": "https://github.com/jdesboeufs/connect-mongo",
|
||||
"asOfVersion": "3.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "consola",
|
||||
"typingsPackageName": "consola",
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
import express = require('express');
|
||||
import * as mongoose from 'mongoose';
|
||||
import session = require('express-session');
|
||||
import connectMongo = require('connect-mongo');
|
||||
import * as mongodb from 'mongodb';
|
||||
|
||||
var app = express();
|
||||
|
||||
/// Create MongoStore
|
||||
var MongoStore = connectMongo(session);
|
||||
|
||||
/// Use MongoStore
|
||||
|
||||
var url = 'mongodb://localhost/test';
|
||||
|
||||
// MongoUrlOptions
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({url})
|
||||
}));
|
||||
|
||||
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({
|
||||
url,
|
||||
collection: "test-sessions",
|
||||
ttl: 30 * 24 * 60 * 60 // = 30 days
|
||||
})
|
||||
}));
|
||||
|
||||
// MongooseConnectionOptions
|
||||
mongoose.connect(url)
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({mongooseConnection: mongoose.connection})
|
||||
}));
|
||||
|
||||
// NativeMongoOptions
|
||||
var MongoClient = mongodb.MongoClient;
|
||||
MongoClient.connect(url, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
}).then(client => {
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({ client })
|
||||
}));
|
||||
});
|
||||
|
||||
// NativeMongoPromiseOptions
|
||||
var Client = mongodb.MongoClient;
|
||||
var clientPromise = Client.connect(url);
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({ clientPromise })
|
||||
}));
|
||||
118
types/connect-mongo/index.d.ts
vendored
118
types/connect-mongo/index.d.ts
vendored
@@ -1,118 +0,0 @@
|
||||
// Type definitions for connect-mongo 3.0
|
||||
// Project: https://github.com/kcbanner/connect-mongo
|
||||
// Definitions by: Mizuki Yamamoto <https://github.com/Syati>
|
||||
// Guy Ellis <https://github.com/guyellis>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
/// <reference types="express-session" />
|
||||
|
||||
import * as express from 'express';
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongodb from 'mongodb';
|
||||
import * as session from 'express-session';
|
||||
|
||||
declare function connectMongo(connect: (options?: session.SessionOptions) => express.RequestHandler): connectMongo.MongoStoreFactory;
|
||||
|
||||
declare namespace connectMongo {
|
||||
|
||||
export interface DefaultOptions {
|
||||
/**
|
||||
* The hostname of the database you are connecting to.
|
||||
* (Default: '127.0.0.1')
|
||||
*/
|
||||
host?: string;
|
||||
|
||||
/**
|
||||
* The port number to connect to.
|
||||
* (Default: 27017)
|
||||
*/
|
||||
port?: string;
|
||||
|
||||
/**
|
||||
* (Default: false)
|
||||
*/
|
||||
autoReconnect?: boolean;
|
||||
|
||||
/**
|
||||
* (Default: true)
|
||||
*/
|
||||
ssl?: boolean;
|
||||
|
||||
/**
|
||||
* (Default: 1)
|
||||
*/
|
||||
w?: number;
|
||||
|
||||
/**
|
||||
* The colletion of the database you are connecting to.
|
||||
* (Default: sessions)
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Serialize sessions using JSON.stringify and deserialize them with JSON.parse.
|
||||
* (Default: true)
|
||||
*/
|
||||
stringify?: boolean;
|
||||
|
||||
/**
|
||||
* Default: false
|
||||
*/
|
||||
hash?: boolean;
|
||||
|
||||
/**
|
||||
* Default: 14 days (60 * 60 * 24 * 14)
|
||||
*/
|
||||
ttl?: number;
|
||||
|
||||
/**
|
||||
* Automatically remove expired sessions.
|
||||
* (Default: 'native')
|
||||
*/
|
||||
autoRemove?: string;
|
||||
|
||||
/**
|
||||
* (Default: 10)
|
||||
*/
|
||||
autoRemoveInterval?: number;
|
||||
|
||||
/**
|
||||
* don't save session if unmodified
|
||||
*/
|
||||
touchAfter?: number;
|
||||
}
|
||||
|
||||
export interface MongoUrlOptions extends DefaultOptions {
|
||||
url: string;
|
||||
mongoOptions?: mongoose.ConnectionOptions;
|
||||
}
|
||||
|
||||
export interface MongooseConnectionOptions extends DefaultOptions {
|
||||
mongooseConnection: mongoose.Connection;
|
||||
}
|
||||
|
||||
export interface NativeMongoOptions extends DefaultOptions {
|
||||
client: mongodb.MongoClient;
|
||||
}
|
||||
|
||||
export interface NativeMongoPromiseOptions extends DefaultOptions {
|
||||
clientPromise: Promise<mongodb.MongoClient>;
|
||||
}
|
||||
|
||||
export interface MongoStoreFactory {
|
||||
new(options: MongoUrlOptions | MongooseConnectionOptions | NativeMongoOptions | NativeMongoPromiseOptions): MongoStore;
|
||||
}
|
||||
|
||||
export class MongoStore extends session.Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.SessionData | null) => void) => void;
|
||||
set: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback?: (err: any) => void) => void;
|
||||
length: (callback: (err: any, length: number) => void) => void;
|
||||
clear: (callback?: (err?: any) => void) => void;
|
||||
touch: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void;
|
||||
close: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = connectMongo;
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"connect-mongo-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
6
types/passport.socketio/package.json
Normal file
6
types/passport.socketio/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"connect-mongo": "^3.1.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user