Merge pull request #17887 from kzay/passport-steam

Added declarations for 'passport-steam'.
This commit is contained in:
Ryan Cavanaugh
2017-07-13 14:33:34 -07:00
committed by GitHub
4 changed files with 122 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
// Type definitions for passport-steam 1.0
// Project: https://github.com/liamcurry/passport-steam
// Definitions by: Gonthier Renaud <https://github.com/kzay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = passport_steam;
declare function passport_steam(options: any, validate: any): any;
declare namespace passport_steam {
// Circular reference from passport_steam
const Strategy: any;
const version: string;
namespace prototype {
function authenticate(req: any): any;
function loadAssociation(fn: any): any;
function loadDiscoveredInfo(fn: any): any;
function loadDiscoveredInformation(fn: any): any;
function saveAssociation(fn: any): any;
function saveDiscoveredInfo(fn: any): any;
function saveDiscoveredInformation(fn: any): any;
namespace authenticate {
const prototype: {
};
}
namespace loadAssociation {
const prototype: {
};
}
namespace loadDiscoveredInfo {
const prototype: {
};
}
namespace loadDiscoveredInformation {
const prototype: {
};
}
namespace saveAssociation {
const prototype: {
};
}
namespace saveDiscoveredInfo {
const prototype: {
};
}
namespace saveDiscoveredInformation {
const prototype: {
};
}
}
}
@@ -0,0 +1,26 @@
/**
* Created by kzaY on 07/09/2017.
*/
import express = require("express");
import passport = require('passport');
import steam = require('passport-steam');
// just some test model
let User = {
findOrCreate(id: string, provider: string, callback: (err: any, user: any) => void): void {
callback(null, { username: 'james' });
}
};
passport.use(new steam.Strategy({
returnURL: process.env.PASSPORT_RETURN_URL,
realm: process.env.PASSPORT_REALM,
apiKey: process.env.PASSPORT_API_KEY,
},
(identifier: any, profile: any, done: (error: any, user?: any) => void) => {
User.findOrCreate(profile.id, profile.provider, (err, user) => {
if (err) { return done(err); }
done(null, user);
});
})
);
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"passport-steam-tests.ts"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"ban-types": false
}
}