diff --git a/auth0-js/auth0-js-tests.ts b/auth0-js/auth0-js-tests.ts
new file mode 100644
index 0000000000..c92251db91
--- /dev/null
+++ b/auth0-js/auth0-js-tests.ts
@@ -0,0 +1,23 @@
+///
+
+var auth0 = new Auth0({
+ domain: 'mine.auth0.com',
+ clientID: 'dsa7d77dsa7d7',
+ callbackURL: 'http://my-app.com/callback',
+ callbackOnLocationHash: true
+});
+
+auth0.login({
+ connection: 'google-oauth2',
+ popup: true,
+ popupOptions: {
+ width: 450,
+ height: 800
+ }
+}, (err, profile, idToken, accessToken, state) => {
+ if (err) {
+ alert("something went wrong: " + err.message);
+ return;
+ }
+ alert('hello ' + profile.name);
+ });
diff --git a/auth0-js/auth0-js.d.ts b/auth0-js/auth0-js.d.ts
new file mode 100644
index 0000000000..1ee4ab9d7c
--- /dev/null
+++ b/auth0-js/auth0-js.d.ts
@@ -0,0 +1,132 @@
+// Type definitions for Auth0.js
+// Project: https://github.com/auth0/auth0.js
+// Definitions by: Robert McLaws
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+/** Extensions to the browser Window object. */
+interface Window {
+ /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
+ token: string;
+}
+
+/** This is the interface for the main Auth0 client. */
+interface Auth0Static {
+
+ new(options: Auth0ClientOptions): Auth0Static;
+ changePassword(options: any, callback?: Function): void;
+ decodeJwt(jwt: string): any;
+ login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
+ loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
+ loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
+ loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
+ logout(query: string): void;
+ getConnections(callback?: Function): void;
+ refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
+ getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
+ getProfile(id_token: string, callback?: Function): Auth0UserProfile;
+ getSSOData(withActiveDirectories: any, callback?: Function): void;
+ parseHash(hash: string): Auth0DecodedHash;
+ signup(options: Auth0SignupOptions, callback: Function): void;
+ validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
+}
+
+/** Represents constructor options for the Auth0 client. */
+interface Auth0ClientOptions {
+ clientID: string;
+ callbackURL: string;
+ callbackOnLocationHash?: boolean;
+ domain: string;
+ forceJSONP?: boolean;
+}
+
+/** Represents a normalized UserProfile. */
+interface Auth0UserProfile {
+ email: string;
+ family_name: string;
+ gender: string;
+ given_name: string;
+ locale: string;
+ name: string;
+ nickname: string;
+ picture: string;
+ user_id: string;
+ /** Represents one or more Identities that may be associated with the User. */
+ identities: Auth0Identity[];
+ user_metadata?: any;
+ app_metadata?: any;
+}
+
+/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
+interface MicrosoftUserProfile extends Auth0UserProfile {
+ emails: string[];
+}
+
+/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
+interface Office365UserProfile extends Auth0UserProfile {
+ tenantid: string;
+ upn: string;
+}
+
+/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
+interface AdfsUserProfile extends Auth0UserProfile {
+ issuer: string;
+}
+
+/** Represents multiple identities assigned to a user. */
+interface Auth0Identity {
+ access_token: string;
+ connection: string;
+ isSocial: boolean;
+ provider: string;
+ user_id: string;
+}
+
+interface Auth0DecodedHash {
+ access_token: string;
+ id_token: string;
+ profile: Auth0UserProfile;
+ state: any;
+}
+
+interface Auth0PopupOptions {
+ width: number;
+ height: number;
+}
+
+interface Auth0LoginOptions {
+ auto_login?: boolean;
+ connection?: string;
+ email?: string;
+ username?: string;
+ password?: string;
+ popup?: boolean;
+ popupOptions?: Auth0PopupOptions;
+}
+
+interface Auth0SignupOptions extends Auth0LoginOptions {
+ auto_login: boolean;
+}
+
+interface Auth0Error {
+ code: any;
+ details: any;
+ name: string;
+ message: string;
+ status: any;
+}
+
+/** Represents the response from an API Token Delegation request. */
+interface Auth0DelegationToken {
+ /** The length of time in seconds the token is valid for. */
+ expires_in: string;
+ /** The JWT for delegated access. */
+ id_token: string;
+ /** The type of token being returned. Possible values: "Bearer" */
+ token_type: string;
+}
+
+declare var Auth0: Auth0Static;
+
+declare module "auth0" {
+ export = Auth0
+}
diff --git a/auth0.lock/auth0.lock-tests.ts b/auth0.lock/auth0.lock-tests.ts
index 07a7cf8323..d466cf5937 100644
--- a/auth0.lock/auth0.lock-tests.ts
+++ b/auth0.lock/auth0.lock-tests.ts
@@ -1,4 +1,4 @@
-///
+///
///
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
diff --git a/auth0.lock/auth0.lock.d.ts b/auth0.lock/auth0.lock.d.ts
index 7a459afd97..43d842aecc 100644
--- a/auth0.lock/auth0.lock.d.ts
+++ b/auth0.lock/auth0.lock.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Brian Caruso
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
+///
interface Auth0LockAdditionalSignUpFieldOption {
value: string;
diff --git a/auth0.widget/auth0.widget-tests.ts b/auth0.widget/auth0.widget-tests.ts
index 012e9b9769..f44601986e 100644
--- a/auth0.widget/auth0.widget-tests.ts
+++ b/auth0.widget/auth0.widget-tests.ts
@@ -1,4 +1,4 @@
-///
+///
///
var widget: Auth0WidgetStatic = new Auth0Widget({
diff --git a/auth0.widget/auth0.widget.d.ts b/auth0.widget/auth0.widget.d.ts
index 20694526c3..e36a7f868a 100644
--- a/auth0.widget/auth0.widget.d.ts
+++ b/auth0.widget/auth0.widget.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Robert McLaws
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
+///
interface Auth0WidgetStatic {
diff --git a/auth0/auth0-tests.ts b/auth0/auth0-tests.ts
index 9cd903b306..a1357246f3 100644
--- a/auth0/auth0-tests.ts
+++ b/auth0/auth0-tests.ts
@@ -1,23 +1,51 @@
-///
+///
-var auth0 = new Auth0({
- domain: 'mine.auth0.com',
- clientID: 'dsa7d77dsa7d7',
- callbackURL: 'http://my-app.com/callback',
- callbackOnLocationHash: true
+import * as auth0 from 'auth0';
+
+const management = new auth0.ManagementClient({
+ token: '{YOUR_API_V2_TOKEN}',
+ domain: '{YOUR_ACCOUNT}.auth0.com'
});
-auth0.login({
- connection: 'google-oauth2',
- popup: true,
- popupOptions: {
- width: 450,
- height: 800
- }
-}, (err, profile, idToken, accessToken, state) => {
- if (err) {
- alert("something went wrong: " + err.message);
- return;
- }
- alert('hello ' + profile.name);
- });
+const auth = new auth0.AuthenticationClient({
+ domain: '{YOUR_ACCOUNT}.auth0.com',
+ clientId: '{OPTIONAL_CLIENT_ID}'
+});
+
+// Using a callback.
+management.getUsers((err: Error, users: auth0.User[]) => {
+ if (err) {
+ // Handle error.
+ }
+ console.log(users);
+});
+
+// Using a Promise.
+management
+ .getUsers()
+ .then((users) => {
+ console.log(users);
+ })
+ .catch((err) => {
+ // Handle the error.
+ });
+
+management
+ .createUser({
+ connection: 'My-Connection',
+ email: 'hi@me.co',
+ }).then((user) => {
+ console.log(user);
+ }).catch((err) => {
+ // Handle the error.
+ });
+
+auth
+ .requestChangePasswordEmail({
+ connection: 'My-Connection',
+ email: 'hi@me.co',
+ }).then((response) => {
+ console.log(response);
+ }).catch((err) => {
+ // Handle the error.
+ });
diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts
index 5ca8487f85..e367d30411 100644
--- a/auth0/auth0.d.ts
+++ b/auth0/auth0.d.ts
@@ -1,132 +1,95 @@
-// Type definitions for Auth0.js
-// Project: http://auth0.com
-// Definitions by: Robert McLaws
+// Type definitions for auth0 v2.3.1
+// Project: https://github.com/auth0/node-auth0
+// Definitions by: Seth Westphal
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-/** Extensions to the browser Window object. */
-interface Window {
- /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
+///
+
+declare module "auth0" {
+
+ import * as Promise from 'bluebird';
+
+ export interface ManagementClientOptions {
token: string;
-}
+ domain?: string;
+ }
-/** This is the interface for the main Auth0 client. */
-interface Auth0Static {
-
- new(options: Auth0ClientOptions): Auth0Static;
- changePassword(options: any, callback?: Function): void;
- decodeJwt(jwt: string): any;
- login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
- loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
- loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
- loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
- logout(query: string): void;
- getConnections(callback?: Function): void;
- refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
- getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
- getProfile(id_token: string, callback?: Function): Auth0UserProfile;
- getSSOData(withActiveDirectories: any, callback?: Function): void;
- parseHash(hash: string): Auth0DecodedHash;
- signup(options: Auth0SignupOptions, callback: Function): void;
- validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
-}
-
-/** Represents constructor options for the Auth0 client. */
-interface Auth0ClientOptions {
- clientID: string;
- callbackURL: string;
- callbackOnLocationHash?: boolean;
- domain: string;
- forceJSONP?: boolean;
-}
-
-/** Represents a normalized UserProfile. */
-interface Auth0UserProfile {
- email: string;
- family_name: string;
- gender: string;
- given_name: string;
- locale: string;
- name: string;
- nickname: string;
- picture: string;
- user_id: string;
- /** Represents one or more Identities that may be associated with the User. */
- identities: Auth0Identity[];
- user_metadata?: any;
- app_metadata?: any;
-}
-
-/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
-interface MicrosoftUserProfile extends Auth0UserProfile {
- emails: string[];
-}
-
-/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
-interface Office365UserProfile extends Auth0UserProfile {
- tenantid: string;
- upn: string;
-}
-
-/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
-interface AdfsUserProfile extends Auth0UserProfile {
- issuer: string;
-}
-
-/** Represents multiple identities assigned to a user. */
-interface Auth0Identity {
- access_token: string;
+ export interface UserData {
connection: string;
- isSocial: boolean;
- provider: string;
- user_id: string;
-}
-
-interface Auth0DecodedHash {
- access_token: string;
- id_token: string;
- profile: Auth0UserProfile;
- state: any;
-}
-
-interface Auth0PopupOptions {
- width: number;
- height: number;
-}
-
-interface Auth0LoginOptions {
- auto_login?: boolean;
- connection?: string;
email?: string;
username?: string;
password?: string;
- popup?: boolean;
- popupOptions?: Auth0PopupOptions;
-}
+ phone_number?: string;
+ user_metadata?: {};
+ email_verified?: boolean;
+ app_metadata?: {};
+ }
-interface Auth0SignupOptions extends Auth0LoginOptions {
- auto_login: boolean;
-}
+ export interface GetUsersData {
+ per_page?: number;
+ page?: number;
+ include_totals?: boolean;
+ sort?: string;
+ connection?: string;
+ fields?: string;
+ include_fields?: boolean;
+ q?: string;
+ search_engine?: string;
+ }
-interface Auth0Error {
- code: any;
- details: any;
- name: string;
- message: string;
- status: any;
-}
+ export interface User {
+ email?: string;
+ email_verified?: boolean;
+ username?: string;
+ phone_number?: string;
+ phone_verified?: boolean;
+ user_id?: string;
+ created_at?: string;
+ updated_at?: string;
+ identities?: Identity[];
+ app_metadata?: {};
+ user_metadata?: {};
+ picture?: string;
+ name?: string;
+ nickname?: string;
+ multifactor?: string[];
+ last_ip?: string;
+ last_login?: string;
+ logins_count?: number;
+ blocked?: boolean;
+ }
-/** Represents the response from an API Token Delegation request. */
-interface Auth0DelegationToken {
- /** The length of time in seconds the token is valid for. */
- expires_in: string;
- /** The JWT for delegated access. */
- id_token: string;
- /** The type of token being returned. Possible values: "Bearer" */
- token_type: string;
-}
+ export interface Identity {
+ connection: string;
+ user_id: string;
+ provider: string;
+ isSocial: boolean;
+ }
-declare var Auth0: Auth0Static;
+ export class ManagementClient {
+ constructor(options: ManagementClientOptions);
+
+ getUsers(params?: GetUsersData): Promise;
+ getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
+ createUser(data: UserData): Promise;
+ createUser(data: UserData, cb: (err: Error, data: User) => void): void;
+ }
+
+ export interface AuthenticationClientOptions {
+ clientId?: string;
+ domain: string;
+ }
+
+ export interface RequestChangePasswordEmailData {
+ connection: string;
+ email: string;
+ }
+
+ export class AuthenticationClient {
+ constructor(options: AuthenticationClientOptions);
+
+ requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise;
+ requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
+ }
-declare module "auth0" {
- export = Auth0
}
diff --git a/redis-rate-limiter/redis-rate-limiter-tests.ts b/redis-rate-limiter/redis-rate-limiter-tests.ts
new file mode 100644
index 0000000000..8fb68941ac
--- /dev/null
+++ b/redis-rate-limiter/redis-rate-limiter-tests.ts
@@ -0,0 +1,41 @@
+///
+///
+///
+
+import * as express from 'express';
+import * as redis from 'redis';
+import * as rateLimiter from 'redis-rate-limiter';
+
+var num: number;
+var str: string;
+var options: redis.ClientOpts;
+var redisClient = redis.createClient(num, str, options);
+
+var limit = rateLimiter.create({
+ redis: redisClient,
+ key: function(x) { return x.ip },
+ rate: '100/minute'
+});
+
+var request = {} as express.Request;
+limit(request, function(err, rate) {
+ if (err) {
+ console.warn('Rate limiting not available');
+ } else {
+ console.log('Rate window: ' + rate.window); // 60
+ console.log('Rate limit: ' + rate.limit); // 100
+ console.log('Rate current: ' + rate.current); // 74
+ if (rate.over) {
+ console.error('Over the limit!');
+ }
+ }
+});
+
+var middleware = rateLimiter.middleware({
+ redis: redisClient,
+ key: 'ip',
+ rate: '100/minute'
+});
+
+var app = express();
+app.use(middleware);
diff --git a/redis-rate-limiter/redis-rate-limiter.d.ts b/redis-rate-limiter/redis-rate-limiter.d.ts
new file mode 100644
index 0000000000..6fa9998a0a
--- /dev/null
+++ b/redis-rate-limiter/redis-rate-limiter.d.ts
@@ -0,0 +1,44 @@
+// Type definitions for redis-rate-limiter 1.0.3
+// Project: https://github.com/TabDigital/redis-rate-limiter
+// Definitions by: Seth Westphal
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+declare module "redis-rate-limiter" {
+
+ import * as express from 'express';
+ import * as redis from 'redis';
+
+ class RedisRateLimiter {
+
+ public static create(options: RedisRateLimiter.Options):
+ (req: express.Request, callback: (err: Error, res: RedisRateLimiter.Response) => void) => void;
+ public static middleware(options: RedisRateLimiter.Options): express.RequestHandler;
+
+ }
+
+ namespace RedisRateLimiter {
+
+ export interface Options {
+ redis: redis.RedisClient;
+ key: 'ip' | ((req: express.Request) => string);
+ window?: number;
+ limit?: number;
+ rate?: string;
+ }
+
+ export interface Response {
+ key: string;
+ current: number;
+ limit: number;
+ window: number;
+ over: boolean;
+ }
+
+ }
+
+ export = RedisRateLimiter;
+
+}
diff --git a/redis-scripto/redis-scripto-tests.ts b/redis-scripto/redis-scripto-tests.ts
new file mode 100644
index 0000000000..235ebeb819
--- /dev/null
+++ b/redis-scripto/redis-scripto-tests.ts
@@ -0,0 +1,37 @@
+///
+///
+
+import * as redis from 'redis';
+import * as Scripto from 'redis-scripto';
+
+var num: number;
+var str: string;
+var options: redis.ClientOpts;
+var redisClient = redis.createClient(num, str, options);
+
+var scriptManager = new Scripto(redisClient);
+scriptManager.loadFromDir('/path/to/lua/scripts');
+
+var keys = ['keyOne', 'keyTwo'];
+var values = [10, 20];
+scriptManager.run('your-script', keys, values, function(err, result) {
+
+});
+
+scriptManager.eval('your-script', keys, values, function(err, result) {
+
+});
+
+scriptManager.loadFromFile('script-one', '/path/to/the/file');
+scriptManager.run('script-one', [], [], function(err, result) {
+
+});
+
+var scripts: Scripto.Scripts = {
+ 'script-two': 'return 1000'
+};
+
+scriptManager.load(scripts);
+scriptManager.run('script-two', [], [], function(err, result) {
+
+});
diff --git a/redis-scripto/redis-scripto.d.ts b/redis-scripto/redis-scripto.d.ts
new file mode 100644
index 0000000000..e62e239210
--- /dev/null
+++ b/redis-scripto/redis-scripto.d.ts
@@ -0,0 +1,39 @@
+// Type definitions for redis-scripto 0.1.3
+// Project: https://github.com/arunoda/node-redis-scripto
+// Definitions by: Seth Westphal
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare module "redis-scripto" {
+
+ import * as redis from 'redis';
+
+ class Scripto {
+
+ constructor(redisClient: redis.RedisClient);
+
+ eval(scriptName: string, keys: string[], args: any[], callback: (err: Error, result: any) => void): void;
+ evalSha(scriptName: string, keys: string[], args: any[], callback: (err: Error, result: any) => void): void;
+
+ load(scripts: Scripto.Scripts): void;
+ loadFromDir(scriptsDir: string): void;
+ loadFromFile(name: string, filepath: string): void;
+
+ run(scriptName: string, keys: string[], args: any[], callback: (err: Error, result: any) => void): void;
+
+ }
+
+ namespace Scripto {
+
+ export type Script = string;
+
+ export interface Scripts {
+ [scriptName: string]: Script;
+ }
+
+ }
+
+ export = Scripto;
+
+}