diff --git a/auth0-js/auth0-js-tests.ts b/auth0-js/auth0-js-tests.ts
new file mode 100644
index 0000000000..197256ddd5
--- /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/index.d.ts b/auth0-js/index.d.ts
new file mode 100644
index 0000000000..50041bb5d1
--- /dev/null
+++ b/auth0-js/index.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 const Auth0: Auth0Static;
+
+declare module "auth0" {
+ export = Auth0
+}
diff --git a/auth0-js/tsconfig.json b/auth0-js/tsconfig.json
new file mode 100644
index 0000000000..7a0a649c3b
--- /dev/null
+++ b/auth0-js/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "auth0-js-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/auth0-lock/auth0.lock-tests.ts b/auth0-lock/auth0.lock-tests.ts
index e62cd4ba2d..bba2fc8228 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/index.d.ts b/auth0-lock/index.d.ts
index da99744841..10ee3aac0d 100644
--- a/auth0-lock/index.d.ts
+++ b/auth0-lock/index.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 79f1a2a7a7..ec5502ca7e 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/index.d.ts b/auth0.widget/index.d.ts
index ed6a2f341b..24d978ab9d 100644
--- a/auth0.widget/index.d.ts
+++ b/auth0.widget/index.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 7f48274eaf..391dee655a 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/index.d.ts b/auth0/index.d.ts
index 5ca8487f85..019d9edc38 100644
--- a/auth0/index.d.ts
+++ b/auth0/index.d.ts
@@ -1,132 +1,89 @@
-// 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 */
- token: string;
+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;
+export interface UserData {
+ connection: string;
+ email?: string;
+ username?: string;
+ password?: string;
+ phone_number?: string;
+ user_metadata?: {};
+ email_verified?: boolean;
+ app_metadata?: {};
}
-/** Represents constructor options for the Auth0 client. */
-interface Auth0ClientOptions {
- clientID: string;
- callbackURL: string;
- callbackOnLocationHash?: boolean;
- domain: string;
- forceJSONP?: 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;
}
-/** 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;
+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 an Auth0UserProfile that has a Microsoft Account as the primary identity. */
-interface MicrosoftUserProfile extends Auth0UserProfile {
- emails: string[];
+export interface Identity {
+ connection: string;
+ user_id: string;
+ provider: string;
+ isSocial: boolean;
}
-/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
-interface Office365UserProfile extends Auth0UserProfile {
- tenantid: string;
- upn: string;
+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;
}
-/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
-interface AdfsUserProfile extends Auth0UserProfile {
- issuer: string;
+export interface AuthenticationClientOptions {
+ clientId?: string;
+ domain: string;
}
-/** Represents multiple identities assigned to a user. */
-interface Auth0Identity {
- access_token: string;
- connection: string;
- isSocial: boolean;
- provider: string;
- user_id: string;
+export interface RequestChangePasswordEmailData {
+ connection: string;
+ email: string;
}
-interface Auth0DecodedHash {
- access_token: string;
- id_token: string;
- profile: Auth0UserProfile;
- state: any;
-}
+export class AuthenticationClient {
+ constructor(options: AuthenticationClientOptions);
-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
-}
+ requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise;
+ requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
+}
\ No newline at end of file
diff --git a/db-migrate-base/db-migrate-base-tests.ts b/db-migrate-base/db-migrate-base-tests.ts
new file mode 100644
index 0000000000..79d81a75f9
--- /dev/null
+++ b/db-migrate-base/db-migrate-base-tests.ts
@@ -0,0 +1,321 @@
+// Test file for db-migrate-base Definition file
+
+import * as DbMigrateBase from "db-migrate-base";
+
+// Throw together a dummy driver
+let db = {};
+
+let callback = (err: any, response: any) => {
+ // Do nothing.
+};
+
+/// createTable(tableName, columnSpec, callback)
+db.createTable('pets', {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+}, callback);
+
+db.createTable('pets', {
+ columns: {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+ },
+ ifNotExists: true
+}, callback);
+
+db.createTable('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: 'id'
+ }
+ }
+}, callback);
+
+db.createTable('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ product_id: 'id'
+ }
+ }
+ }
+}, callback);
+
+/// dropTable(tableName, [options,] callback)
+db.dropTable('pets', callback);
+
+db.dropTable('pets', { ifExists: true }, callback);
+
+/// renameTable(tableName, newTableName, callback)
+db.renameTable('pets', 'pets_OLD', callback);
+
+/// addColumn(tableName, columnName, columnSpec, callback)
+db.addColumn('pets', 'eyeColor', {
+ type: 'string',
+ length: 25,
+ notNull: true,
+}, callback);
+
+db.addColumn('pets', 'id', {
+ type: 'int',
+ primaryKey: true,
+ autoIncrement: true,
+ notNull: true,
+ unique: true
+}, callback);
+
+/// renameColumn(tableName, oldColumnName, newColumnName, callback)
+db.renameColumn('pets', 'id', 'pet_id', callback);
+
+/// changeColumn(tableName, columnName, columnSpec, callback)
+db.changeColumn('pets', 'eye_color', {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ foreignKey: {
+ name: 'pets_eye_color_id_fk',
+ table: 'eye_color',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ eye_color: 'id'
+ }
+ }
+}, callback);
+
+/// addIndex(tableName, indexName, columns, [unique,] callback)
+db.addIndex('pets', 'pets_eye_color_idx', ['eye_color'], callback);
+db.addIndex('pets', 'pets_registration_code_idx', ['registration_code'], true, callback);
+
+/// addForeignKey(tableName, referencedTableName, keyName, fieldMapping, rules, callback)
+db.addForeignKey('module_user', 'modules', 'module_user_module_id_fk',
+{
+ 'module_id': 'id'
+},
+{
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+}, callback);
+
+/// removeForeignKey(tableName, keyName, options, callback)
+db.removeForeignKey('module_user', 'module_uer_module_id_foreign', callback);
+db.removeForeignKey('module_user', 'module_user_module_id_foreign', {
+ dropIndex: true,
+}, callback);
+
+/// insert(tableName, [columnNameArray,] valueArray, callback)
+db.insert('module_user', ['first_name', 'last_name'], ['Test', 'Testerson'], callback);
+db.insert('module_user', ['Test', 'Testerson'], callback);
+
+/// removeIndex([tableName,] indexName, callback)
+db.removeIndex('pets', 'pets_eye_color_idx', callback);
+db.removeIndex('pets_eye_color_idx', callback);
+
+/// runSql(sql, [params,] callback)
+db.runSql('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [
+ 'first_name', 'last_name',
+ 'Test', 'Testerson'
+], callback);
+db.runSql('DROP TABLE `pets`', callback);
+
+/// all(sql, [params,] callback)
+db.all('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test'], callback);
+db.all('SELECT * FROM `module_user`', callback);
+
+/// =========
+/// Async
+/// =========
+
+let onResolve = (result: any) => {};
+
+/// createTableAsync(tableName, columnSpec)
+db.createTableAsync('pets', {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+}).then(onResolve);
+
+db.createTableAsync('pets', {
+ columns: {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+ },
+ ifNotExists: true
+}).then(onResolve);
+
+db.createTableAsync('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: 'id'
+ }
+ }
+}).then(onResolve);
+
+db.createTableAsync('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ product_id: 'id'
+ }
+ }
+ }
+}).then(onResolve);
+
+/// dropTableAsync(tableName, [options])
+db.dropTableAsync('pets').then(onResolve);
+db.dropTableAsync('pets', { ifExists: true }).then(onResolve);
+
+/// renameTableAsync(tableName, newTableName)
+db.renameTableAsync('pets', 'pets_OLD').then(onResolve);
+
+/// addColumnAsync(tableName, columnName, columnSpec)
+db.addColumnAsync('pets', 'eyeColor', {
+ type: 'string',
+ length: 25,
+ notNull: true,
+}).then(onResolve);
+
+db.addColumnAsync('pets', 'id', {
+ type: 'int',
+ primaryKey: true,
+ autoIncrement: true,
+ notNull: true,
+ unique: true
+}).then(onResolve);
+
+/// renameColumnAsync(tableName, oldColumnName, newColumnName)
+db.renameColumnAsync('pets', 'id', 'pet_id').then(onResolve);
+
+/// changeColumnAsync(tableName, columnName, columnSpec)
+db.changeColumnAsync('pets', 'eye_color', {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ foreignKey: {
+ name: 'pets_eye_color_id_fk',
+ table: 'eye_color',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ eye_color: 'id'
+ }
+ }
+}).then(onResolve);
+
+/// addIndexAsync(tableName, indexName, columns, [unique])
+db.addIndexAsync('pets', 'pets_eye_color_idx', ['eye_color']).then(onResolve);
+db.addIndexAsync('pets', 'pets_registration_code_idx', ['registration_code'], true).then(onResolve);
+
+/// addForeignKeyAsync(tableName, referencedTableName, keyName, fieldMapping, rules)
+db.addForeignKeyAsync('module_user', 'modules', 'module_user_module_id_fk',
+{
+ 'module_id': 'id'
+},
+{
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+}).then(onResolve);
+
+/// removeForeignKeyAsync(tableName, keyName, options)
+db.removeForeignKeyAsync('module_user', 'module_uer_module_id_foreign').then(onResolve);
+db.removeForeignKeyAsync('module_user', 'module_user_module_id_foreign', {
+ dropIndex: true,
+}).then(onResolve);
+
+/// insertAsync(tableName, [columnNameArray,] valueArray)
+db.insertAsync('module_user', ['first_name', 'last_name'], ['Test', 'Testerson']).then(onResolve);
+db.insertAsync('module_user', ['Test', 'Testerson']).then(onResolve);
+
+/// removeIndexAsync([tableName,] indexName)
+db.removeIndexAsync('pets', 'pets_eye_color_idx').then(onResolve);
+db.removeIndexAsync('pets_eye_color_idx').then(onResolve);
+
+/// runSqlAsync(sql, [params])
+db.runSqlAsync('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [
+ 'first_name', 'last_name',
+ 'Test', 'Testerson'
+]).then(onResolve);
+db.runSqlAsync('DROP TABLE `pets`').then(onResolve);
+
+/// allAsync(sql, [params])
+db.allAsync('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test']).then(onResolve);
+db.allAsync('SELECT * FROM `module_user`').then(onResolve);
\ No newline at end of file
diff --git a/db-migrate-base/index.d.ts b/db-migrate-base/index.d.ts
new file mode 100644
index 0000000000..de3a4c0812
--- /dev/null
+++ b/db-migrate-base/index.d.ts
@@ -0,0 +1,147 @@
+// Type definitions for db-migrate-base
+// Project: https://github.com/db-migrate/db-migrate-base
+// Definitions by: nickiannone
+// Definitions: https://github.com/nickiannone/DefinitelyTyped
+
+///
+
+import * as Promise from "bluebird";
+
+export interface CallbackFunction { (err: any, response: any): void; }
+
+export interface InternalModule {
+ log: any;
+ type: any;
+}
+
+export interface InternalOptions {
+ mod: InternalModule;
+}
+
+export interface ColumnSpec {
+ length?: number;
+ type: string;
+ unsigned?: boolean;
+ primaryKey?: boolean;
+ autoIncrement?: boolean;
+ notNull?: boolean;
+ unique?: boolean;
+ defaultValue?: any;
+ foreignKey?: ForeignKeySpec;
+}
+
+export interface ForeignKeySpec {
+ name: string;
+ table: string;
+ rules?: ForeignKeyRules;
+ mapping: string | any;
+}
+
+export interface ForeignKeyRules {
+ onDelete: string;
+ onUpdate: string;
+}
+
+export interface RemoveForeignKeyOptions {
+ dropIndex?: boolean;
+}
+
+export interface ColumnDef {
+ foreignKey?: any; // TODO Figure this out!
+ constraints: string;
+}
+
+export interface CreateTableOptions {
+ columns?: Array;
+ ifNotExists?: boolean;
+}
+
+export interface DropTableOptions {
+ ifExists?: boolean;
+}
+
+export class Base {
+ constructor(intern: InternalOptions);
+
+ close(callback?: CallbackFunction): void;
+ mapDataType(str: string): string;
+ truncate(tableName: string, callback: CallbackFunction): void;
+ checkDBMS(dbms: any, callback: CallbackFunction): void;
+ createDatabase(...options: any[]): void;
+ switchDatabase(...options: any[]): void;
+ dropDatabase(...options: any[]): void;
+ recurseCallbackArray(foreignKeys: Array, callback: CallbackFunction): void;
+ bindForeignKey(tableName: string, columnName: string, fkOptions: ForeignKeySpec): (callback: CallbackFunction) => void;
+ createColumnDef(name: string, spec: ColumnSpec, options?: any): ColumnDef; // TODO Figure out a type for `options`!
+ //createColumnConstraint(spec: ColumnSpec, options?: any, ...implementationDefinedOptions: any[]): string;
+ createMigrationsTable(callback: CallbackFunction): void;
+ createSeedsTable(callback: CallbackFunction): void;
+ createTable(tableName: string, options: any | CreateTableOptions, callback: CallbackFunction): void;
+ dropTable(tableName: string, optionsOrCb?: DropTableOptions | CallbackFunction, callback?: CallbackFunction): void;
+ renameTable(tableName: string, newTableName: string, callback: CallbackFunction): void;
+ addColumn(tableName: string, columnName: string, columnSpec: ColumnSpec, callback: CallbackFunction): void;
+ removeColumn(tableName: string, columnName: string, callback: CallbackFunction): void;
+ renameColumn(tableName: string, oldColumnName: string, newColumnName: string, callback: CallbackFunction): void;
+ changeColumn(tableName: string, columnName: string, columnSpec: ColumnSpec, callback: CallbackFunction): void;
+ quoteDDLArr(arr: Array): Array;
+ quoteArr(arr: Array): Array;
+ addIndex(tableName: string, indexName: string, columns: string | Array, uniqueOrCb?: boolean | CallbackFunction, callback?: CallbackFunction): void;
+ insert(tableName: string, columnNameOrValueArray: any, valueArrayOrCb?: any | CallbackFunction, callback?: CallbackFunction): void;
+ update(tableName: string, columnNameOrValueArray: any, valueArrayOrIds?: any, idsOrCb?: any | CallbackFunction, callback?: CallbackFunction): void;
+ lookup(tableName: string, column: string, id?: any, callback?: CallbackFunction): void;
+ removeIndex(tableNameOrIndexName: string, indexNameOrCb?: string | CallbackFunction, callback?: CallbackFunction): void;
+ addForeignKey(tableName: string, referencedTableName: string, keyName: string, fieldMapping: any, rules: ForeignKeyRules, callback: CallbackFunction): void;
+ removeForeignKey(tableName: string, keyName: string, optionsOrCb?: RemoveForeignKeyOptions | CallbackFunction, callback?: CallbackFunction): void;
+ normalizeColumnSpec(spec: string | ColumnSpec): ColumnSpec;
+ addMigrationRecord(name: string, callback: CallbackFunction): void;
+ addSeedRecord(name: string, callback: CallbackFunction): void;
+ startMigration(callback: CallbackFunction): void;
+ endMigration(callback: CallbackFunction): void;
+ runSql(sql?: string, paramsOrCb?: Array | CallbackFunction, callback?: CallbackFunction): void;
+ allLoadedMigrations(callback: CallbackFunction): void;
+ allLoadedSeeds(callback: CallbackFunction): void;
+ deleteMigration(migrationName: string, callback: CallbackFunction): void;
+ remove(table: string, ids: any, callback: CallbackFunction): void; // TODO Make ids match the type of ids in buildWhereClause(ids);
+ buildWhereClause(ids: any): string;
+ deleteSeed(seedName: string, callback: CallbackFunction): void;
+ all(sql: string, paramsOrCb?: Array | CallbackFunction, callback?: CallbackFunction): void;
+ escape(str: string): string;
+ escapeString(str: string): string;
+ escapeDDL(str: string): string;
+
+ // Promisified methods
+ closeAsync(): Promise;
+ truncateAsync(tableName: string): Promise;
+ checkDBMSAsync(dbms: any): Promise;
+ createDatabaseAsync(...options: any[]): Promise;
+ switchDatabaseAsync(...options: any[]): Promise;
+ dropDatabaseAsync(...options: any[]): Promise;
+ recurseCallbackArrayAsync(foreignKeys: Array): Promise;
+ createMigrationsTableAsync(): Promise;
+ createSeedsTableAsync(): Promise;
+ createTableAsync(tableName: string, options: any | CreateTableOptions): Promise;
+ dropTableAsync(tableName: string, options?: DropTableOptions): Promise;
+ renameTableAsync(tableName: string, newTableName: string): Promise;
+ addColumnAsync(tableName: string, columnName: string, columnSpec: ColumnSpec): Promise;
+ removeColumnAsync(tableName: string, columnName: string): Promise;
+ renameColumnAsync(tableName: string, oldColumnName: string, newColumnName: string): Promise;
+ changeColumnAsync(tableName: string, columnName: string, columnSpec: ColumnSpec): Promise;
+ addIndexAsync(tableName: string, indexName: string, columns: string | Array, unique?: boolean): Promise;
+ insertAsync(tableName: string, columnNameOrValueArray: any, valueArrayOrCb?: any | CallbackFunction, callback?: CallbackFunction): Promise;
+ updateAsync(tableName: string, columnNameOrValueArray: any, valueArrayOrIds?: any, idsOrCb?: any | CallbackFunction, callback?: CallbackFunction): Promise;
+ lookupAsync(tableName: string, column: string, id?: any, callback?: CallbackFunction): Promise;
+ removeIndexAsync(tableNameOrIndexName: string, indexName?: string): Promise;
+ addForeignKeyAsync(tableName: string, referencedTableName: string, keyName: string, fieldMapping: any, rules: ForeignKeyRules): Promise;
+ removeForeignKeyAsync(tableName: string, keyName: string, options?: RemoveForeignKeyOptions): Promise;
+ addMigrationRecordAsync(name: string): Promise;
+ addSeedRecordAsync(name: string): Promise;
+ startMigrationAsync(): Promise;
+ endMigrationAsync(callback: CallbackFunction): Promise;
+ runSqlAsync(sql?: string, params?: Array): Promise;
+ allLoadedMigrationsAsync(): Promise;
+ allLoadedSeedsAsync(): Promise;
+ deleteMigrationAsync(migrationName: string): Promise;
+ removeAsync(table: string, ids: any): Promise;
+ deleteSeedAsync(seedName: string): Promise;
+ allAsync(sql: string, params?: Array): Promise;
+}
\ No newline at end of file
diff --git a/db-migrate-base/tsconfig.json b/db-migrate-base/tsconfig.json
new file mode 100644
index 0000000000..9ddd2792ec
--- /dev/null
+++ b/db-migrate-base/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "db-migrate-base-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/db-migrate-pg/db-migrate-pg-tests.ts b/db-migrate-pg/db-migrate-pg-tests.ts
new file mode 100644
index 0000000000..adf2716074
--- /dev/null
+++ b/db-migrate-pg/db-migrate-pg-tests.ts
@@ -0,0 +1,410 @@
+// Test file for db-migrate-pg Definition file
+
+import * as DbMigratePg from "db-migrate-pg";
+
+// Throw together a dummy driver
+let db = {};
+
+let callback = (err: any, response: any) => {
+ // Do nothing.
+};
+
+/// createTable(tableName, columnSpec, callback)
+db.createTable('pets', {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+}, callback);
+
+db.createTable('pets', {
+ columns: {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+ },
+ ifNotExists: true
+}, callback);
+
+db.createTable('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: 'id'
+ }
+ }
+}, callback);
+
+db.createTable('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ product_id: 'id'
+ }
+ }
+ }
+}, callback);
+
+/// dropTable(tableName, [options,] callback)
+db.dropTable('pets', callback);
+
+db.dropTable('pets', { ifExists: true }, callback);
+
+/// renameTable(tableName, newTableName, callback)
+db.renameTable('pets', 'pets_OLD', callback);
+
+/// addColumn(tableName, columnName, columnSpec, callback)
+db.addColumn('pets', 'eyeColor', {
+ type: 'string',
+ length: 25,
+ notNull: true,
+}, callback);
+
+db.addColumn('pets', 'id', {
+ type: 'int',
+ primaryKey: true,
+ autoIncrement: true,
+ notNull: true,
+ unique: true
+}, callback);
+
+/// renameColumn(tableName, oldColumnName, newColumnName, callback)
+db.renameColumn('pets', 'id', 'pet_id', callback);
+
+/// changeColumn(tableName, columnName, columnSpec, callback)
+db.changeColumn('pets', 'eye_color', {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ foreignKey: {
+ name: 'pets_eye_color_id_fk',
+ table: 'eye_color',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ eye_color: 'id'
+ }
+ }
+}, callback);
+
+/// addIndex(tableName, indexName, columns, [unique,] callback)
+db.addIndex('pets', 'pets_eye_color_idx', ['eye_color'], callback);
+db.addIndex('pets', 'pets_registration_code_idx', ['registration_code'], true, callback);
+
+/// addForeignKey(tableName, referencedTableName, keyName, fieldMapping, rules, callback)
+db.addForeignKey('module_user', 'modules', 'module_user_module_id_fk',
+{
+ 'module_id': 'id'
+},
+{
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+}, callback);
+
+/// removeForeignKey(tableName, keyName, options, callback)
+db.removeForeignKey('module_user', 'module_uer_module_id_foreign', callback);
+db.removeForeignKey('module_user', 'module_user_module_id_foreign', {
+ dropIndex: true,
+}, callback);
+
+/// insert(tableName, [columnNameArray,] valueArray, callback)
+db.insert('module_user', ['first_name', 'last_name'], ['Test', 'Testerson'], callback);
+db.insert('module_user', ['Test', 'Testerson'], callback);
+
+/// removeIndex([tableName,] indexName, callback)
+db.removeIndex('pets', 'pets_eye_color_idx', callback);
+db.removeIndex('pets_eye_color_idx', callback);
+
+/// runSql(sql, [params,] callback)
+db.runSql('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [
+ 'first_name', 'last_name',
+ 'Test', 'Testerson'
+], callback);
+db.runSql('DROP TABLE `pets`', callback);
+
+/// all(sql, [params,] callback)
+db.all('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test'], callback);
+db.all('SELECT * FROM `module_user`', callback);
+
+/// =========
+/// Async
+/// =========
+
+let onResolve = (result: any) => {};
+
+/// createTableAsync(tableName, columnSpec)
+db.createTableAsync('pets', {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+}).then(onResolve);
+
+db.createTableAsync('pets', {
+ columns: {
+ id: { type: 'int', primaryKey: true, autoIncrement: true },
+ name: 'string'
+ },
+ ifNotExists: true
+}).then(onResolve);
+
+db.createTableAsync('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: 'id'
+ }
+ }
+}).then(onResolve);
+
+db.createTableAsync('product_variant',
+{
+ id: {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ primaryKey: true,
+ autoIncrement: true,
+ length: 10
+ },
+ product_id: {
+ type: 'int',
+ unsigned: true,
+ length: 10,
+ notNull: true,
+ foreignKey: {
+ name: 'product_variant_product_id_fk',
+ table: 'product',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ product_id: 'id'
+ }
+ }
+ }
+}).then(onResolve);
+
+/// dropTableAsync(tableName, [options])
+db.dropTableAsync('pets').then(onResolve);
+db.dropTableAsync('pets', { ifExists: true }).then(onResolve);
+
+/// renameTableAsync(tableName, newTableName)
+db.renameTableAsync('pets', 'pets_OLD').then(onResolve);
+
+/// addColumnAsync(tableName, columnName, columnSpec)
+db.addColumnAsync('pets', 'eyeColor', {
+ type: 'string',
+ length: 25,
+ notNull: true,
+}).then(onResolve);
+
+db.addColumnAsync('pets', 'id', {
+ type: 'int',
+ primaryKey: true,
+ autoIncrement: true,
+ notNull: true,
+ unique: true
+}).then(onResolve);
+
+/// renameColumnAsync(tableName, oldColumnName, newColumnName)
+db.renameColumnAsync('pets', 'id', 'pet_id').then(onResolve);
+
+/// changeColumnAsync(tableName, columnName, columnSpec)
+db.changeColumnAsync('pets', 'eye_color', {
+ type: 'int',
+ unsigned: true,
+ notNull: true,
+ foreignKey: {
+ name: 'pets_eye_color_id_fk',
+ table: 'eye_color',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ eye_color: 'id'
+ }
+ }
+}).then(onResolve);
+
+/// addIndexAsync(tableName, indexName, columns, [unique])
+db.addIndexAsync('pets', 'pets_eye_color_idx', ['eye_color']).then(onResolve);
+db.addIndexAsync('pets', 'pets_registration_code_idx', ['registration_code'], true).then(onResolve);
+
+/// addForeignKeyAsync(tableName, referencedTableName, keyName, fieldMapping, rules)
+db.addForeignKeyAsync('module_user', 'modules', 'module_user_module_id_fk',
+{
+ 'module_id': 'id'
+},
+{
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+}).then(onResolve);
+
+/// removeForeignKeyAsync(tableName, keyName, options)
+db.removeForeignKeyAsync('module_user', 'module_uer_module_id_foreign').then(onResolve);
+db.removeForeignKeyAsync('module_user', 'module_user_module_id_foreign', {
+ dropIndex: true,
+}).then(onResolve);
+
+/// insertAsync(tableName, [columnNameArray,] valueArray)
+db.insertAsync('module_user', ['first_name', 'last_name'], ['Test', 'Testerson']).then(onResolve);
+db.insertAsync('module_user', ['Test', 'Testerson']).then(onResolve);
+
+/// removeIndexAsync([tableName,] indexName)
+db.removeIndexAsync('pets', 'pets_eye_color_idx').then(onResolve);
+db.removeIndexAsync('pets_eye_color_idx').then(onResolve);
+
+/// runSqlAsync(sql, [params])
+db.runSqlAsync('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [
+ 'first_name', 'last_name',
+ 'Test', 'Testerson'
+]).then(onResolve);
+db.runSqlAsync('DROP TABLE `pets`').then(onResolve);
+
+/// allAsync(sql, [params])
+db.allAsync('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test']).then(onResolve);
+db.allAsync('SELECT * FROM `module_user`').then(onResolve);
+
+/// ====================
+/// PG-specific tests
+/// ====================
+
+/// createColumnConstraint(spec, options, tableName, columnName) (INTERNAL USE ONLY)
+let constraint: DbMigratePg.ColumnConstraint;
+
+constraint = db.createColumnConstraint({
+ type: 'int',
+ length: 10,
+ unsigned: true,
+ primaryKey: false,
+ autoIncrement: false,
+ notNull: true,
+ unique: false,
+ defaultValue: 0,
+ foreignKey: {
+ name: 'pets_eye_color_id_fk',
+ table: 'eye_color',
+ rules: {
+ onDelete: 'CASCADE',
+ onUpdate: 'RESTRICT'
+ },
+ mapping: {
+ 'eye_color': 'id'
+ }
+ }
+}, {
+ emitPrimaryKey: false
+}, 'pets', 'eye_color');
+
+// Print the SQL constraints
+console.log(constraint.constraints);
+
+// Invoke the foreign key builder
+constraint.foreignKey(callback);
+
+/// Public Callback Methods:
+
+/// createDatabase(dbName, [options,] callback)
+db.createDatabase('petstore', callback);
+db.createDatabase('petstore', {}, callback);
+
+/// dropDatabase(dbName, [options,] callback)
+db.dropDatabase('petstore', callback);
+db.dropDatabase('petstore', { ifExists: true }, callback);
+
+/// createSequence(sqName, [options,] callback)
+db.createSequence('pets_id_sq', callback);
+db.createSequence('pets_id_sq', { temp: true }, callback);
+
+/// switchDatabase(options, callback)
+db.switchDatabase('petstore', callback);
+db.switchDatabase({ database: 'petstore' }, callback);
+
+/// dropSequence(sqName, [options,] callback)
+db.dropSequence('pets_id_sq', callback);
+db.dropSequence('pets_id_sq', {
+ ifExists: true,
+ cascade: true,
+ restrict: true,
+}, callback);
+
+/// Public Promisified Methods:
+
+/// createDatabaseAsync(dbName, [options])
+db.createDatabaseAsync('petstore').then(onResolve);
+db.createDatabaseAsync('petstore', {}).then(onResolve);
+
+/// dropDatabaseAsync(dbName, [options])
+db.dropDatabaseAsync('petstore').then(onResolve);
+db.dropDatabaseAsync('petstore', { ifExists: true }).then(onResolve);
+
+/// createSequenceAsync(sqName, [options])
+db.createSequenceAsync('pets_id_sq').then(onResolve);
+db.createSequenceAsync('pets_id_sq', { temp: true }).then(onResolve);
+
+/// switchDatabaseAsync(options)
+db.switchDatabaseAsync('petstore').then(onResolve);
+db.switchDatabaseAsync({ database: 'petstore' }).then(onResolve);
+
+/// dropSequenceAsync(sqName, [options])
+db.dropSequenceAsync('pets_id_sq').then(onResolve);
+db.dropSequenceAsync('pets_id_sq', {
+ ifExists: true,
+ cascade: true,
+ restrict: true,
+}).then(onResolve);
diff --git a/db-migrate-pg/index.d.ts b/db-migrate-pg/index.d.ts
new file mode 100644
index 0000000000..7804f4ddad
--- /dev/null
+++ b/db-migrate-pg/index.d.ts
@@ -0,0 +1,54 @@
+// Type definitions for db-migrate-pg
+// Project: https://github.com/db-migrate/pg
+// Definitions by: nickiannone
+// Definitions: https://github.com/nickiannone/DefinitelyTyped
+
+import * as pg from "pg";
+import * as DbMigrateBase from "db-migrate-base";
+import * as Promise from "bluebird";
+
+// Yes, this is a dummy interface for now; the current implementation of the pg driver doesn't need any options.
+export interface CreateDatabaseOptions {}
+
+export interface DropDatabaseOptions {
+ ifExists?: boolean;
+}
+
+export interface CreateSequenceOptions {
+ temp?: boolean;
+}
+
+export interface SwitchDatabaseOptions {
+ database?: string;
+}
+
+export interface DropSequenceOptions {
+ ifExists?: boolean;
+ cascade?: boolean;
+ restrict?: boolean;
+}
+
+export interface ColumnConstraint {
+ foreignKey: (callback: DbMigrateBase.CallbackFunction) => void;
+ constraints: string;
+}
+
+export interface ColumnConstraintOptions {
+ emitPrimaryKey?: boolean;
+}
+
+export class PgDriver extends DbMigrateBase.Base {
+ constructor(connection: pg.Client, schema: string, intern: DbMigrateBase.InternalOptions);
+ createDatabase(dbName: string, optionsOrCb: CreateDatabaseOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void;
+ dropDatabase(dbName: string, optionsOrCb: DropDatabaseOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void;
+ createSequence(sqName: string, optionsOrCb: CreateSequenceOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void;
+ switchDatabase(options: string | SwitchDatabaseOptions, callback: DbMigrateBase.CallbackFunction): void;
+ dropSequence(dbName: string, optionsOrCb: DropSequenceOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void;
+ createColumnConstraint(spec: DbMigrateBase.ColumnSpec, options: ColumnConstraintOptions, tableName: string, columnName: string): ColumnConstraint;
+
+ createDatabaseAsync(dbName: string, options?: CreateDatabaseOptions): Promise;
+ dropDatabaseAsync(dbName: string, options?: DropDatabaseOptions): Promise;
+ createSequenceAsync(sqName: string, options?: CreateSequenceOptions): Promise;
+ switchDatabaseAsync(options: string | SwitchDatabaseOptions): Promise;
+ dropSequenceAsync(dbName: string, options?: DropSequenceOptions): Promise;
+}
diff --git a/db-migrate-pg/tsconfig.json b/db-migrate-pg/tsconfig.json
new file mode 100644
index 0000000000..e31e52d255
--- /dev/null
+++ b/db-migrate-pg/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "db-migrate-pg-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/electron-notify/electron-notify-tests.ts b/electron-notify/electron-notify-tests.ts
new file mode 100644
index 0000000000..8c1597cf78
--- /dev/null
+++ b/electron-notify/electron-notify-tests.ts
@@ -0,0 +1,24 @@
+import * as eNotify from 'electron-notify';
+
+eNotify.setConfig({
+ appIcon: 'images/otherIcon.png',
+ displayTime: 6000,
+ defaultStyleText: {
+ color: '#FF0000',
+ fontWeight: 'bold'
+ }
+});
+
+eNotify.notify({
+ title: 'Title',
+ text: 'Some text',
+ image: 'path/to/image.png',
+ url: 'http://google.de',
+ sound: 'notification.wav',
+ onClickFunc: (event) => {
+ console.log('onClick ' + event.id);
+ event.closeNotification('onClick');
+ },
+ onShowFunc: (event) => { console.log('onShow ' + event.id) },
+ onCloseFunc: (event) => { console.log('onClose ' + event.id) }
+});
\ No newline at end of file
diff --git a/electron-notify/index.d.ts b/electron-notify/index.d.ts
new file mode 100644
index 0000000000..225ab9de9e
--- /dev/null
+++ b/electron-notify/index.d.ts
@@ -0,0 +1,60 @@
+// Type definitions for electron-notify v0.1.0
+// Project: https://github.com/hankbao/electron-notify
+// Definitions by: Daniel Pereira
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+/** Nice and simple notifications for electron apps */
+export interface ICustomConfig {
+ width?: number,
+ height?: number,
+ padding?: number,
+ borderRadius?: number,
+ displayTime?: number,
+ animationSteps?: number,
+ animationStepMs?: number,
+ animateInParallel?: boolean,
+ appIcon?: string,
+ pathToModule?: string,
+ logging?: boolean,
+ defaultWindow?: Electron.BrowserWindowOptions,
+ defaultStyleContainer?: any,
+ defaultStyleAppIcon?: any,
+ defaultStyleImage?: any,
+ defaultStyleClose?: any,
+ defaultStyleText?: any
+}
+
+export interface ICloseNotificationEvent {
+ event: 'close' | 'show' | 'click',
+ id: number
+}
+
+export interface INotificationEvent extends ICloseNotificationEvent {
+ closeNotification: (reason: any) => void,
+}
+
+export interface INotification {
+ title: string,
+ text?: string,
+ image?: string,
+ url?: string,
+ sound?: string,
+ onClickFunc?: (event: INotificationEvent) => void,
+ onShowFunc?: (event: INotificationEvent) => void,
+ onCloseFunc?: (event: ICloseNotificationEvent) => void
+}
+
+/** Change some config options. Can be run multiple times, also between notify()-calls to change electron-notifys behaviour. */
+export function setConfig(customConfig: ICustomConfig): void;
+
+/** Displays new notification. */
+export function notify(notification: INotification): void;
+
+/** Clears the animation queue and closes all windows opened by electron-notify. Call this to clean up before quiting your app. */
+export function closeAll(): void;
+
+export function getTemplatePath(): string;
+
+export function setTemplatePath(path: string): void;
\ No newline at end of file
diff --git a/electron-notify/tsconfig.json b/electron-notify/tsconfig.json
new file mode 100644
index 0000000000..3c0b906028
--- /dev/null
+++ b/electron-notify/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "noImplicitAny": true,
+ "strictNullChecks": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "electron-notify-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/eventemitter2/index.d.ts b/eventemitter2/index.d.ts
index 39a349c6b6..de1be0d064 100644
--- a/eventemitter2/index.d.ts
+++ b/eventemitter2/index.d.ts
@@ -43,7 +43,7 @@ declare class EventEmitter2 {
* @param event
* @param listener
*/
- on(event: string, listener: Function): EventEmitter2;
+ on(event: string | string[], listener: Function): EventEmitter2;
/**
* Adds a listener that will be fired when any event is emitted.
@@ -128,7 +128,7 @@ declare class EventEmitter2 {
* @param event
* @param args
*/
- emit(event: string, ...args: any[]): boolean;
+ emit(event: string | string[], ...args: any[]): boolean;
/**
* Execute each of the listeners that may be listening for the specified event name in order with the list of arguments.
@@ -156,7 +156,7 @@ declare module "eventemitter2" {
* @param event
* @param listener
*/
- on(event: string, listener: Function): EventEmitter2;
+ on(event: string | string[], listener: Function): EventEmitter2;
/**
* Adds a listener that will be fired when any event is emitted.
@@ -241,7 +241,7 @@ declare module "eventemitter2" {
* @param event
* @param args
*/
- emit(event: string, ...args: any[]): boolean;
+ emit(event: string | string[], ...args: any[]): boolean;
/**
* Execute each of the listeners that may be listening for the specified event name in order with the list of arguments.
diff --git a/express-serve-static-core/index.d.ts b/express-serve-static-core/index.d.ts
index c8bfaf7f29..707b408714 100644
--- a/express-serve-static-core/index.d.ts
+++ b/express-serve-static-core/index.d.ts
@@ -22,7 +22,7 @@ declare module "express-serve-static-core" {
}
interface RequestHandler {
- (req: Request, res: Response, next: NextFunction): any;
+ (req: Request, res: Response, next?: NextFunction): any;
}
interface ErrorRequestHandler {
diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts
index 8f4f9bab9c..9c374d9948 100644
--- a/express-validator/express-validator-tests.ts
+++ b/express-validator/express-validator-tests.ts
@@ -13,19 +13,23 @@ app.post('/:urlparam', function(req: express.Request, res: express.Response) {
// Similarly checkParams only checks in req.params (URL params) and
// checkQuery only checks req.query (GET params).
req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt();
- req.checkParams('urlparam', 'Invalid urlparam').isAlpha();
+ req.checkParams('urlparam', 'Invalid urlparam').isAlpha().matches(/test?/i).matches('test?', 'i');
req.checkQuery('getparam', 'Invalid getparam').isInt();
- req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase();
- req.checkFiles('testFiles', 'Invalid testFiles').isUrl();
-
+ req.checkHeaders('testHeader', 'Invalid testHeader').isLowercase().isUppercase();
+ req.checkFiles('testFiles', 'Invalid testFiles').isURL();
// OR assert can be used to check on all 3 types of params.
// req.assert('postparam', 'Invalid postparam').notEmpty().isInt();
// req.assert('urlparam', 'Invalid urlparam').isAlpha();
// req.assert('getparam', 'Invalid getparam').isInt();
- req.sanitize('postparam').toBoolean();
req.filter('postparam').toBoolean();
+ req.sanitize('postparam').blacklist('t').blacklist(['