mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Merge branch 'master' of https://github.com/DmitryEfimenko/DefinitelyTyped
This commit is contained in:
Vendored
+1
@@ -238,6 +238,7 @@ declare namespace angular {
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive(name: string, inlineAnnotatedFunction: any[]): IModule;
|
||||
directive(name: string, injectionFunction: Function): IModule;
|
||||
directive(object: Object): IModule;
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="auth0-js.d.ts" />
|
||||
|
||||
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);
|
||||
});
|
||||
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
// Type definitions for Auth0.js
|
||||
// Project: https://github.com/auth0/auth0.js
|
||||
// Definitions by: Robert McLaws <https://github.com/advancedrei>
|
||||
// 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-js" {
|
||||
export = Auth0
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="../auth0-js/auth0-js.d.ts" />
|
||||
/// <reference path="auth0.lock.d.ts" />
|
||||
|
||||
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Brian Caruso <https://github.com/carusology>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="../auth0-js/auth0-js.d.ts" />
|
||||
|
||||
interface Auth0LockAdditionalSignUpFieldOption {
|
||||
value: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="../auth0-js/auth0-js.d.ts" />
|
||||
/// <reference path="auth0.widget.d.ts" />
|
||||
|
||||
var widget: Auth0WidgetStatic = new Auth0Widget({
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Robert McLaws <https://github.com/advancedrei>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="../auth0-js/auth0-js.d.ts" />
|
||||
|
||||
|
||||
interface Auth0WidgetStatic {
|
||||
|
||||
+48
-20
@@ -1,23 +1,51 @@
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="auth0.d.ts" />
|
||||
|
||||
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.
|
||||
});
|
||||
|
||||
Vendored
+81
-118
@@ -1,132 +1,95 @@
|
||||
// Type definitions for Auth0.js
|
||||
// Project: http://auth0.com
|
||||
// Definitions by: Robert McLaws <https://github.com/advancedrei>
|
||||
// Type definitions for auth0 v2.3.1
|
||||
// Project: https://github.com/auth0/node-auth0
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// 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 */
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
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<User[]>;
|
||||
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
|
||||
createUser(data: UserData): Promise<User>;
|
||||
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<string>;
|
||||
requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
|
||||
}
|
||||
|
||||
declare module "auth0" {
|
||||
export = Auth0
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ var kinesis: lambda.Kinesis;
|
||||
var recordsList: lambda.Record[];
|
||||
var anyObj: any;
|
||||
var num: number;
|
||||
var identity: lambda.Identity;
|
||||
var error: Error;
|
||||
|
||||
/* Records */
|
||||
var records: lambda.Records;
|
||||
@@ -46,4 +48,19 @@ context.succeed(str);
|
||||
context.succeed(anyObj);
|
||||
context.succeed(str, anyObj);
|
||||
str = context.awsRequestId;
|
||||
num = context.getRemainingTimeInMillis();
|
||||
num = context.getRemainingTimeInMillis();
|
||||
identity = context.identity;
|
||||
|
||||
/* Identity */
|
||||
var identity: lambda.Identity;
|
||||
|
||||
str = identity.cognitoIdentityId;
|
||||
str = identity.cognitoIdentityPoolId;
|
||||
|
||||
/* Callback */
|
||||
function callback(cb: lambda.Callback) {
|
||||
cb();
|
||||
cb(null);
|
||||
cb(error);
|
||||
cb(null, anyObj);
|
||||
}
|
||||
Vendored
+13
-1
@@ -36,8 +36,20 @@ declare module "aws-lambda" {
|
||||
succeed(message: string, object: any): void;
|
||||
awsRequestId: string;
|
||||
getRemainingTimeInMillis(): number;
|
||||
/** Information about the Amazon Cognito identity provider when invoked through the AWS Mobile SDK. It can be null. */
|
||||
identity?: Identity;
|
||||
}
|
||||
|
||||
interface Identity {
|
||||
cognitoIdentityId: string;
|
||||
cognitoIdentityPoolId: string;
|
||||
}
|
||||
|
||||
export type Callback = (error?: Error, message?: string) => void;
|
||||
/**
|
||||
* Optional callback parameter.
|
||||
*
|
||||
* @param error – an optional parameter that you can use to provide results of the failed Lambda function execution.
|
||||
* @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
|
||||
*/
|
||||
export type Callback = (error?: Error, result?: any) => void;
|
||||
}
|
||||
@@ -0,0 +1,773 @@
|
||||
///<reference path="blessed.d.ts" />
|
||||
|
||||
import * as blessed from 'blessed';
|
||||
|
||||
let screen: blessed.Widgets.Screen = null;
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-autopad.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/autopad.log',
|
||||
smartCSR: true,
|
||||
autoPadding: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var box1 = blessed.box({
|
||||
parent: screen,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line'
|
||||
});
|
||||
|
||||
var box2 = blessed.box({
|
||||
parent: box1,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line'
|
||||
});
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-bigtext.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/bigtext.log',
|
||||
smartCSR: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var box = blessed.bigtext({
|
||||
parent: screen,
|
||||
content: 'Hello',
|
||||
shrink: true,
|
||||
width: '80%',
|
||||
// height: '80%',
|
||||
height: 'shrink',
|
||||
// width: 'shrink',
|
||||
border: 'line',
|
||||
fch: ' ',
|
||||
ch: '\u2592',
|
||||
style: {
|
||||
fg: 'red',
|
||||
bg: 'blue',
|
||||
bold: false
|
||||
}
|
||||
});
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-csr.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/csr.log',
|
||||
smartCSR: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var lorem = require('fs').readFileSync(__dirname + '/git.diff', 'utf8');
|
||||
|
||||
var cleanSides = screen.cleanSides;
|
||||
function expectClean(value: any) {
|
||||
screen.cleanSides = function(el: blessed.widget.Element) {
|
||||
var ret = cleanSides.apply(this, arguments);
|
||||
if (ret !== value) {
|
||||
throw new Error('Failed. Expected '
|
||||
+ value + ' from cleanSides. Got '
|
||||
+ ret + '.');
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
var btext = blessed.box({
|
||||
parent: screen,
|
||||
left: 'center',
|
||||
top: 'center',
|
||||
width: '80%',
|
||||
height: '80%',
|
||||
style: {
|
||||
bg: 'green'
|
||||
},
|
||||
border: 'line',
|
||||
content: 'CSR should still work.'
|
||||
});
|
||||
let _oscroll = btext.scroll;
|
||||
btext.scroll = function(offset, always) {
|
||||
expectClean(true);
|
||||
return _oscroll(offset, always);
|
||||
};
|
||||
|
||||
var text = blessed.scrollabletext({
|
||||
parent: screen,
|
||||
content: lorem,
|
||||
border: 'line',
|
||||
left: 'center',
|
||||
top: 'center',
|
||||
draggable: true,
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
mouse: true,
|
||||
keys: true,
|
||||
vi: true
|
||||
});
|
||||
|
||||
_oscroll = text.scroll;
|
||||
text.scroll = function(offset, always) {
|
||||
var el = this;
|
||||
var value = true;
|
||||
if (el.left < 0) value = true;
|
||||
if (el.top < 0) value = false;
|
||||
if (el.left + el.width > screen.width) value = true;
|
||||
if (el.top + el.height > screen.height) value = false;
|
||||
expectClean(value);
|
||||
return _oscroll(offset, always);
|
||||
};
|
||||
|
||||
text.focus();
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-dock-noborder.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/dock.log',
|
||||
smartCSR: true,
|
||||
dockBorders: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
blessed.box({
|
||||
parent: screen,
|
||||
left: -1,
|
||||
top: -1,
|
||||
width: '50%+1',
|
||||
height: '50%+1',
|
||||
border: 'line',
|
||||
content: 'Foo'
|
||||
});
|
||||
|
||||
blessed.box({
|
||||
parent: screen,
|
||||
left: '50%-1',
|
||||
top: -1,
|
||||
width: '50%+3',
|
||||
height: '50%+1',
|
||||
content: 'Bar',
|
||||
border: 'line'
|
||||
});
|
||||
|
||||
blessed.box({
|
||||
parent: screen,
|
||||
left: -1,
|
||||
top: '50%-1',
|
||||
width: '50%+1',
|
||||
height: '50%+3',
|
||||
border: 'line',
|
||||
content: 'Foo'
|
||||
});
|
||||
|
||||
blessed.listtable({
|
||||
parent: screen,
|
||||
left: '50%-1',
|
||||
top: '50%-1',
|
||||
width: '50%+3',
|
||||
height: '50%+3',
|
||||
border: 'line',
|
||||
align: 'center',
|
||||
tags: true,
|
||||
keys: true,
|
||||
vi: true,
|
||||
mouse: true,
|
||||
style: {
|
||||
header: {
|
||||
fg: 'blue',
|
||||
bold: true
|
||||
},
|
||||
cell: {
|
||||
fg: 'magenta',
|
||||
selected: {
|
||||
bg: 'blue'
|
||||
}
|
||||
}
|
||||
},
|
||||
data: [
|
||||
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
|
||||
[ 'Elephant', 'Apple', '1:00am', 'One' ],
|
||||
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
|
||||
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
|
||||
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
|
||||
]
|
||||
}).focus();
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://raw.githubusercontent.com/chjj/blessed/master/example/simple-form.js
|
||||
|
||||
var form = blessed.form({
|
||||
parent: screen,
|
||||
keys: true,
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 30,
|
||||
height: 4,
|
||||
bg: 'green',
|
||||
content: 'Submit or cancel?'
|
||||
});
|
||||
|
||||
var submit = blessed.button({
|
||||
parent: form,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
padding: {
|
||||
left: 1,
|
||||
right: 1
|
||||
},
|
||||
left: 10,
|
||||
top: 2,
|
||||
shrink: true,
|
||||
name: 'submit',
|
||||
content: 'submit',
|
||||
style: {
|
||||
bg: 'blue',
|
||||
focus: {
|
||||
bg: 'red'
|
||||
},
|
||||
hover: {
|
||||
bg: 'red'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var cancel = blessed.button({
|
||||
parent: form,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
padding: {
|
||||
left: 1,
|
||||
right: 1
|
||||
},
|
||||
left: 20,
|
||||
top: 2,
|
||||
shrink: true,
|
||||
name: 'cancel',
|
||||
content: 'cancel',
|
||||
style: {
|
||||
bg: 'blue',
|
||||
focus: {
|
||||
bg: 'red'
|
||||
},
|
||||
hover: {
|
||||
bg: 'red'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-layout.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/layout.log',
|
||||
smartCSR: true,
|
||||
autoPadding: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var layout = blessed.layout({
|
||||
parent: screen,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
border: 'line',
|
||||
layout: process.argv[2] === 'grid' ? 'grid' : 'inline',
|
||||
style: {
|
||||
bg: 'red',
|
||||
border: {
|
||||
fg: 'blue'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var box1 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '1'
|
||||
});
|
||||
|
||||
var box2 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '2'
|
||||
});
|
||||
|
||||
var box3 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '3'
|
||||
});
|
||||
|
||||
var box4 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '4'
|
||||
});
|
||||
|
||||
var box5 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '5'
|
||||
});
|
||||
|
||||
var box6 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '6'
|
||||
});
|
||||
|
||||
var box7 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '7'
|
||||
});
|
||||
|
||||
var box8 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '8'
|
||||
});
|
||||
|
||||
var box9 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '9'
|
||||
});
|
||||
|
||||
var box10 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '10'
|
||||
});
|
||||
|
||||
var box11 = blessed.box({
|
||||
parent: layout,
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 10,
|
||||
height: 5,
|
||||
border: 'line',
|
||||
content: '11'
|
||||
});
|
||||
|
||||
var box12 = blessed.box({
|
||||
parent: layout,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
width: 20,
|
||||
height: 10,
|
||||
border: 'line',
|
||||
content: '12'
|
||||
});
|
||||
|
||||
if (process.argv[2] !== 'grid') {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
blessed.box({
|
||||
parent: layout,
|
||||
// width: i % 2 === 0 ? 10 : 20,
|
||||
// height: i % 2 === 0 ? 5 : 10,
|
||||
width: Math.random() > 0.5 ? 10 : 20,
|
||||
height: Math.random() > 0.5 ? 5 : 10,
|
||||
border: 'line',
|
||||
content: (i + 1 + 12) + ''
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-form.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/form.log',
|
||||
warnings: true
|
||||
});
|
||||
|
||||
type FormData = {
|
||||
radio1: boolean;
|
||||
radio2: boolean;
|
||||
text: string;
|
||||
check: boolean;
|
||||
};
|
||||
|
||||
var form2 = blessed.form<FormData>({
|
||||
parent: screen,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
vi: true,
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: '100%',
|
||||
//height: 12,
|
||||
style: {
|
||||
bg: 'green',
|
||||
border: {
|
||||
inverse: true
|
||||
},
|
||||
scrollbar: {
|
||||
inverse: true
|
||||
}
|
||||
},
|
||||
content: 'foobar',
|
||||
scrollable: true,
|
||||
scrollbar: {
|
||||
ch: ' '
|
||||
}
|
||||
//alwaysScroll: true
|
||||
});
|
||||
|
||||
form2.on('submit', (data) => {
|
||||
output.setContent(JSON.stringify(data, null, 2));
|
||||
screen.render();
|
||||
});
|
||||
|
||||
form2.key('d', function() {
|
||||
form2.scroll(1, true);
|
||||
screen.render();
|
||||
});
|
||||
|
||||
form2.key('u', function() {
|
||||
form2.scroll(-1, true);
|
||||
screen.render();
|
||||
});
|
||||
|
||||
var set = blessed.radioset({
|
||||
parent: form2,
|
||||
left: 1,
|
||||
top: 1,
|
||||
shrink: true,
|
||||
//padding: 1,
|
||||
//content: 'f',
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
}
|
||||
});
|
||||
|
||||
var radio1 = blessed.radiobutton({
|
||||
parent: set,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 0,
|
||||
top: 0,
|
||||
name: 'radio1',
|
||||
content: 'radio1'
|
||||
});
|
||||
|
||||
var radio2 = blessed.radiobutton({
|
||||
parent: set,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 15,
|
||||
top: 0,
|
||||
name: 'radio2',
|
||||
content: 'radio2'
|
||||
});
|
||||
|
||||
var text2 = blessed.textbox({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
style: {
|
||||
bg: 'blue'
|
||||
},
|
||||
height: 1,
|
||||
width: 20,
|
||||
left: 1,
|
||||
top: 3,
|
||||
name: 'text'
|
||||
});
|
||||
|
||||
text2.on('focus', function() {
|
||||
text2.readInput();
|
||||
});
|
||||
|
||||
var check = blessed.checkbox({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 28,
|
||||
top: 1,
|
||||
name: 'check',
|
||||
content: 'check'
|
||||
});
|
||||
|
||||
var check2 = blessed.checkbox({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
},
|
||||
height: 1,
|
||||
left: 28,
|
||||
top: 14,
|
||||
name: 'foooooooo2',
|
||||
content: 'foooooooo2'
|
||||
});
|
||||
|
||||
var submit = blessed.button({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
shrink: true,
|
||||
padding: {
|
||||
left: 1,
|
||||
right: 1
|
||||
},
|
||||
left: 29,
|
||||
top: 3,
|
||||
name: 'submit',
|
||||
content: 'submit',
|
||||
style: {
|
||||
bg: 'blue',
|
||||
focus: {
|
||||
bg: 'red'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
submit.on('press', function() {
|
||||
form2.submit();
|
||||
});
|
||||
|
||||
var box1 = blessed.box({
|
||||
parent: form2,
|
||||
left: 1,
|
||||
top: 10,
|
||||
height: 10,
|
||||
width: 10,
|
||||
content: 'one',
|
||||
style: {
|
||||
bg: 'cyan'
|
||||
}
|
||||
});
|
||||
|
||||
var box2 = blessed.box({
|
||||
parent: box1,
|
||||
left: 1,
|
||||
top: 2,
|
||||
height: 8,
|
||||
width: 9,
|
||||
content: 'two',
|
||||
style: {
|
||||
bg: 'magenta'
|
||||
}
|
||||
});
|
||||
|
||||
var box3 = blessed.box({
|
||||
parent: box2,
|
||||
left: 1,
|
||||
top: 2,
|
||||
height: 6,
|
||||
width: 8,
|
||||
content: 'three',
|
||||
style: {
|
||||
bg: 'yellow'
|
||||
}
|
||||
});
|
||||
|
||||
var box4 = blessed.box({
|
||||
parent: box3,
|
||||
left: 1,
|
||||
top: 2,
|
||||
height: 4,
|
||||
width: 7,
|
||||
content: 'four',
|
||||
style: {
|
||||
bg: 'blue'
|
||||
}
|
||||
});
|
||||
|
||||
var output = blessed.scrollabletext({
|
||||
parent: form2,
|
||||
mouse: true,
|
||||
keys: true,
|
||||
left: 0,
|
||||
top: 20,
|
||||
height: 5,
|
||||
right: 0,
|
||||
style: {
|
||||
bg: 'red'
|
||||
},
|
||||
content: 'foobar'
|
||||
});
|
||||
|
||||
var bottom = blessed.line({
|
||||
parent: form2,
|
||||
type: 'line',
|
||||
orientation: 'horizontal',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 50,
|
||||
style: {
|
||||
fg: 'blue'
|
||||
}
|
||||
});
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
form2.focus();
|
||||
|
||||
form2.submit();
|
||||
|
||||
screen.render();
|
||||
|
||||
// https://github.com/chjj/blessed/blob/master/test/widget-table.js
|
||||
|
||||
screen = blessed.screen({
|
||||
dump: __dirname + '/logs/table.log',
|
||||
autoPadding: false,
|
||||
fullUnicode: true,
|
||||
warnings: true
|
||||
});
|
||||
|
||||
var DU = '杜';
|
||||
var JUAN = '鹃';
|
||||
|
||||
var table = blessed.table({
|
||||
//parent: screen,
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
data: null,
|
||||
border: 'line',
|
||||
align: 'center',
|
||||
tags: true,
|
||||
//width: '80%',
|
||||
width: 'shrink',
|
||||
style: {
|
||||
border: {
|
||||
fg: 'red'
|
||||
},
|
||||
header: {
|
||||
fg: 'blue',
|
||||
bold: true
|
||||
},
|
||||
cell: {
|
||||
fg: 'magenta'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var data1 = [
|
||||
[ 'Animals', 'Foods', 'Times' ],
|
||||
[ 'Elephant', 'Apple', '1:00am' ],
|
||||
[ 'Bird', 'Orange', '2:15pm' ],
|
||||
[ 'T-Rex', 'Taco', '8:45am' ],
|
||||
[ 'Mouse', 'Cheese', '9:05am' ]
|
||||
];
|
||||
|
||||
data1[1][0] = '{red-fg}' + data1[1][0] + '{/red-fg}';
|
||||
data1[2][0] += ' (' + DU + JUAN + ')';
|
||||
|
||||
var data2 = [
|
||||
[ 'Animals', 'Foods', 'Times', 'Numbers' ],
|
||||
[ 'Elephant', 'Apple', '1:00am', 'One' ],
|
||||
[ 'Bird', 'Orange', '2:15pm', 'Two' ],
|
||||
[ 'T-Rex', 'Taco', '8:45am', 'Three' ],
|
||||
[ 'Mouse', 'Cheese', '9:05am', 'Four' ]
|
||||
];
|
||||
|
||||
data2[1][0] = '{red-fg}' + data2[1][0] + '{/red-fg}';
|
||||
data2[2][0] += ' (' + DU + JUAN + ')';
|
||||
|
||||
screen.key('q', function() {
|
||||
return screen.destroy();
|
||||
});
|
||||
|
||||
table.setData(data2);
|
||||
screen.append(table);
|
||||
screen.render();
|
||||
|
||||
setTimeout(function() {
|
||||
table.setData(data1);
|
||||
screen.render();
|
||||
}, 3000);
|
||||
Vendored
+2812
-1247
File diff suppressed because it is too large
Load Diff
Vendored
+5
-1
@@ -11,7 +11,7 @@ interface JQuery {
|
||||
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
|
||||
}
|
||||
|
||||
declare module daterangepicker {
|
||||
declare namespace daterangepicker {
|
||||
|
||||
interface DatepickerEventObject extends JQueryEventObject {
|
||||
date: Date;
|
||||
@@ -164,3 +164,7 @@ declare module daterangepicker {
|
||||
monthNames?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
declare module "daterangepicker" {
|
||||
export = daterangepicker;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,322 @@
|
||||
// Test file for db-migrate-base Definition file
|
||||
/// <reference path="db-migrate-base.d.ts" />
|
||||
|
||||
import * as DbMigrateBase from "db-migrate-base";
|
||||
|
||||
// Throw together a dummy driver
|
||||
let db = <DbMigrateBase.Base>{};
|
||||
|
||||
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);
|
||||
Vendored
+152
@@ -0,0 +1,152 @@
|
||||
// Type definitions for db-migrate-base
|
||||
// Project: https://github.com/db-migrate/db-migrate-base
|
||||
// Definitions by: nickiannone <https://github.com/nickiannone>
|
||||
// Definitions: https://github.com/nickiannone/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts"/>
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "db-migrate-base" {
|
||||
|
||||
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<ColumnSpec>;
|
||||
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<string>, 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<string>): Array<string>;
|
||||
quoteArr(arr: Array<string>): Array<string>;
|
||||
addIndex(tableName: string, indexName: string, columns: string | Array<string>, 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<any> | 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<any> | CallbackFunction, callback?: CallbackFunction): void;
|
||||
escape(str: string): string;
|
||||
escapeString(str: string): string;
|
||||
escapeDDL(str: string): string;
|
||||
|
||||
// Promisified methods
|
||||
closeAsync(): Promise<any>;
|
||||
truncateAsync(tableName: string): Promise<any>;
|
||||
checkDBMSAsync(dbms: any): Promise<any>;
|
||||
createDatabaseAsync(...options: any[]): Promise<any>;
|
||||
switchDatabaseAsync(...options: any[]): Promise<any>;
|
||||
dropDatabaseAsync(...options: any[]): Promise<any>;
|
||||
recurseCallbackArrayAsync(foreignKeys: Array<string>): Promise<any>;
|
||||
createMigrationsTableAsync(): Promise<any>;
|
||||
createSeedsTableAsync(): Promise<any>;
|
||||
createTableAsync(tableName: string, options: any | CreateTableOptions): Promise<any>;
|
||||
dropTableAsync(tableName: string, options?: DropTableOptions): Promise<any>;
|
||||
renameTableAsync(tableName: string, newTableName: string): Promise<any>;
|
||||
addColumnAsync(tableName: string, columnName: string, columnSpec: ColumnSpec): Promise<any>;
|
||||
removeColumnAsync(tableName: string, columnName: string): Promise<any>;
|
||||
renameColumnAsync(tableName: string, oldColumnName: string, newColumnName: string): Promise<any>;
|
||||
changeColumnAsync(tableName: string, columnName: string, columnSpec: ColumnSpec): Promise<any>;
|
||||
addIndexAsync(tableName: string, indexName: string, columns: string | Array<string>, unique?: boolean): Promise<any>;
|
||||
insertAsync(tableName: string, columnNameOrValueArray: any, valueArrayOrCb?: any | CallbackFunction, callback?: CallbackFunction): Promise<any>;
|
||||
updateAsync(tableName: string, columnNameOrValueArray: any, valueArrayOrIds?: any, idsOrCb?: any | CallbackFunction, callback?: CallbackFunction): Promise<any>;
|
||||
lookupAsync(tableName: string, column: string, id?: any, callback?: CallbackFunction): Promise<any>;
|
||||
removeIndexAsync(tableNameOrIndexName: string, indexName?: string): Promise<any>;
|
||||
addForeignKeyAsync(tableName: string, referencedTableName: string, keyName: string, fieldMapping: any, rules: ForeignKeyRules): Promise<any>;
|
||||
removeForeignKeyAsync(tableName: string, keyName: string, options?: RemoveForeignKeyOptions): Promise<any>;
|
||||
addMigrationRecordAsync(name: string): Promise<any>;
|
||||
addSeedRecordAsync(name: string): Promise<any>;
|
||||
startMigrationAsync(): Promise<any>;
|
||||
endMigrationAsync(callback: CallbackFunction): Promise<any>;
|
||||
runSqlAsync(sql?: string, params?: Array<any>): Promise<any>;
|
||||
allLoadedMigrationsAsync(): Promise<any>;
|
||||
allLoadedSeedsAsync(): Promise<any>;
|
||||
deleteMigrationAsync(migrationName: string): Promise<any>;
|
||||
removeAsync(table: string, ids: any): Promise<any>;
|
||||
deleteSeedAsync(seedName: string): Promise<any>;
|
||||
allAsync(sql: string, params?: Array<any>): Promise<any>;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,411 @@
|
||||
// Test file for db-migrate-pg Definition file
|
||||
/// <reference path="db-migrate-pg.d.ts" />
|
||||
|
||||
import * as DbMigratePg from "db-migrate-pg";
|
||||
|
||||
// Throw together a dummy driver
|
||||
let db = <DbMigratePg.PgDriver>{};
|
||||
|
||||
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);
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for db-migrate-pg
|
||||
// Project: https://github.com/db-migrate/pg
|
||||
// Definitions by: nickiannone <http://github.com/nickiannone>
|
||||
// Definitions: https://github.com/nickiannone/DefinitelyTyped
|
||||
|
||||
/// <reference path="../db-migrate-base/db-migrate-base.d.ts"/>
|
||||
/// <reference path="../pg/pg.d.ts" />
|
||||
|
||||
declare module "db-migrate-pg" {
|
||||
|
||||
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<any>;
|
||||
dropDatabaseAsync(dbName: string, options?: DropDatabaseOptions): Promise<any>;
|
||||
createSequenceAsync(sqName: string, options?: CreateSequenceOptions): Promise<any>;
|
||||
switchDatabaseAsync(options: string | SwitchDatabaseOptions): Promise<any>;
|
||||
dropSequenceAsync(dbName: string, options?: DropSequenceOptions): Promise<any>;
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
@@ -89,7 +89,7 @@ declare module "dustjs-linkedin" {
|
||||
* Registers an event listener. Streams accept a single listener for a given event.
|
||||
* @param evt the event. Possible values are data, end, error (maybe more, look in the source).
|
||||
*/
|
||||
on(evt: string, callback: (data?: any) => any);
|
||||
on(evt: string, callback: (data?: any) => any): this;
|
||||
|
||||
pipe(stream: Stream): Stream;
|
||||
}
|
||||
@@ -126,8 +126,8 @@ declare module "dustjs-linkedin" {
|
||||
* @param name the template name.
|
||||
* @param context a plain object or an instance of dust.Context.
|
||||
*/
|
||||
export function render(name: string, context: any, callback: (err: any, out: string) => any);
|
||||
export function render(name: string, context: Context, callback: (err: any, out: string) => any);
|
||||
export function render(name: string, context: any, callback: (err: any, out: string) => any): void;
|
||||
export function render(name: string, context: Context, callback: (err: any, out: string) => any): void;
|
||||
|
||||
/**
|
||||
* Compiles and renders source, invoking callback on completion. If no callback is supplied this function returns a Stream object. Use this function when precompilation is not required.
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="./electron-notify.d.ts" />
|
||||
|
||||
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) }
|
||||
});
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
// Type definitions for electron-notify v0.1.0
|
||||
// Project: https://github.com/hankbao/electron-notify
|
||||
// Definitions by: Daniel Pereira <https://github.com/djpereira>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../github-electron/github-electron.d.ts" />
|
||||
|
||||
/** Nice and simple notifications for electron apps */
|
||||
declare module 'electron-notify' {
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
Vendored
+4
-4
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
@@ -117,7 +117,7 @@ declare module "express-serve-static-core" {
|
||||
interface CookieOptions {
|
||||
maxAge?: number;
|
||||
signed?: boolean;
|
||||
expires?: Date;
|
||||
expires?: Date | boolean;
|
||||
httpOnly?: boolean;
|
||||
path?: string;
|
||||
domain?: string;
|
||||
|
||||
Vendored
+1
-1
@@ -30,7 +30,7 @@ declare namespace Express {
|
||||
secure?: boolean;
|
||||
httpOnly: boolean;
|
||||
domain?: string;
|
||||
expires: Date;
|
||||
expires: Date | boolean;
|
||||
serialize: (name: string, value: string) => string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,19 +15,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(['<script', '</script>']).whitelist('hello').whitelist(['h', 'e', 'l']);
|
||||
req.sanitizeBody('postvar').trim().stripLow().escape();
|
||||
req.sanitizeQuery('queryvar').toDate();
|
||||
req.sanitizeParams('urlparam').toFloat().toInt().toInt(10);
|
||||
req.sanitizeHeaders('header').normalizeEmail();
|
||||
|
||||
|
||||
var errors = req.validationErrors();
|
||||
var mappedErrors = req.validationErrors(true);
|
||||
|
||||
+88
-47
@@ -1,9 +1,10 @@
|
||||
// Type definitions for express-validator 2.9.0
|
||||
// Type definitions for express-validator 2.20.4
|
||||
// Project: https://github.com/ctavan/express-validator
|
||||
// Definitions by: Nathan Ridley <https://github.com/axefrog/>, Jonathan Häberle <http://dreampulse.de>
|
||||
// Definitions by: Nathan Ridley <https://github.com/axefrog/>, Jonathan Häberle <http://dreampulse.de>, Peter Harris <https://github.com/codeanimal/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
// Add RequestValidation Interface on to Express's Request Interface.
|
||||
declare namespace Express {
|
||||
@@ -31,25 +32,33 @@ declare namespace ExpressValidator {
|
||||
param: string;
|
||||
}
|
||||
|
||||
interface ValidatorFunction { (item: string, message: string): Validator; }
|
||||
interface ValidatorFunction { (item: string | {}, message?: string): Validator; }
|
||||
interface ValidatorExtraFunction extends ValidatorFunction { (matchIndex: number, message?: string): Validator; }
|
||||
interface SanitizerFunction { (item: string): Sanitizer; }
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
|
||||
export interface RequestValidation {
|
||||
assert: ValidatorFunction;
|
||||
check: ValidatorFunction;
|
||||
assert: ValidatorExtraFunction;
|
||||
validate: ValidatorExtraFunction;
|
||||
check: ValidatorExtraFunction;
|
||||
checkBody: ValidatorFunction;
|
||||
checkFiles: ValidatorFunction;
|
||||
checkHeader: ValidatorFunction;
|
||||
checkHeaders: ValidatorFunction;
|
||||
checkParams: ValidatorFunction;
|
||||
checkQuery: ValidatorFunction;
|
||||
validate: ValidatorFunction;
|
||||
|
||||
|
||||
filter: SanitizerFunction;
|
||||
sanitize: SanitizerFunction;
|
||||
|
||||
sanitizeBody: SanitizerFunction;
|
||||
sanitizeQuery: SanitizerFunction;
|
||||
sanitizeParams: SanitizerFunction;
|
||||
sanitizeHeaders: SanitizerFunction;
|
||||
|
||||
onValidationError(errback: (msg: string) => void): void;
|
||||
validationErrors(mapped?: boolean): Dictionary<any> | any[];
|
||||
validationErrors(mapped?: boolean): Dictionary<MappedError> | MappedError[];
|
||||
validationErrors<T>(mapped?: boolean): Dictionary<T> | T[];
|
||||
asyncValidationErrors(mapped?: boolean): Promise<MappedError[] | Dictionary<MappedError>>;
|
||||
asyncValidationErrors<T>(mapped?: boolean): Promise<T[] | Dictionary<T>>;
|
||||
}
|
||||
|
||||
export interface Validator {
|
||||
@@ -61,12 +70,13 @@ declare namespace ExpressValidator {
|
||||
* Alias for notRegex()
|
||||
*/
|
||||
not(): Validator;
|
||||
isEmail(): Validator;
|
||||
isEmail(options?:{}): Validator;
|
||||
/**
|
||||
* Accepts http, https, ftp
|
||||
*/
|
||||
isUrl(): Validator;
|
||||
|
||||
isURL(): Validator;
|
||||
isFQDN(options?: MinMaxOptions): Validator;
|
||||
|
||||
/**
|
||||
* Combines isIPv4 and isIPv6
|
||||
*/
|
||||
@@ -74,8 +84,21 @@ declare namespace ExpressValidator {
|
||||
isIPv4(): Validator;
|
||||
isIPv6(): Validator;
|
||||
isMACAddress(): Validator;
|
||||
isAlpha(): Validator;
|
||||
isAlphanumeric(): Validator;
|
||||
isISBN(version?: number): Validator;
|
||||
isISIN(): Validator;
|
||||
isISO8601(): Validator;
|
||||
isMobilePhone(locale: string): Validator;
|
||||
isMongoId(): Validator;
|
||||
isMultibyte(): Validator;
|
||||
isAlpha(locale?: string): Validator;
|
||||
isAlphanumeric(locale?: string): Validator;
|
||||
isAscii(): Validator;
|
||||
isBase64(): Validator;
|
||||
isBoolean(): Validator;
|
||||
isByteLength(options: MinMaxOptions): Validator;
|
||||
isCurrency(options: {}): Validator;
|
||||
isDataURI(): Validator;
|
||||
isDivisibleBy(num: number): Validator;
|
||||
isNumeric(): Validator;
|
||||
isHexadecimal(): Validator;
|
||||
/**
|
||||
@@ -85,7 +108,7 @@ declare namespace ExpressValidator {
|
||||
/**
|
||||
* isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't
|
||||
*/
|
||||
isInt(): Validator;
|
||||
isInt(options?: MinMaxOptions): Validator;
|
||||
isLowercase(): Validator;
|
||||
isUppercase(): Validator;
|
||||
isDecimal(): Validator;
|
||||
@@ -93,10 +116,12 @@ declare namespace ExpressValidator {
|
||||
* Alias for isDecimal
|
||||
*/
|
||||
isFloat(): Validator;
|
||||
isFullWidth(): Validator;
|
||||
isHalfWidth(): Validator;
|
||||
isVariableWidth(): Validator;
|
||||
/**
|
||||
* Check if length is 0
|
||||
*/
|
||||
notNull(): Validator;
|
||||
isNull(): Validator;
|
||||
/**
|
||||
* Not just whitespace (input.trim().length !== 0)
|
||||
@@ -104,12 +129,13 @@ declare namespace ExpressValidator {
|
||||
notEmpty(): Validator;
|
||||
equals(equals:any): Validator;
|
||||
contains(str:string): Validator;
|
||||
notContains(str:string): Validator;
|
||||
|
||||
/**
|
||||
* Usage: regex(/[a-z]/i) or regex('[a-z]','i')
|
||||
* Usage: matches(/[a-z]/i) or matches('[a-z]','i')
|
||||
*/
|
||||
regex(pattern:string, modifiers:string): Validator;
|
||||
notRegex(pattern:string, modifiers:string): Validator;
|
||||
matches(pattern:string, modifiers?:string): Validator;
|
||||
matches(pattern: RegExp): Validator;
|
||||
|
||||
/**
|
||||
* max is optional
|
||||
*/
|
||||
@@ -117,7 +143,7 @@ declare namespace ExpressValidator {
|
||||
/**
|
||||
* Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier
|
||||
*/
|
||||
isUUID(version:number): Validator;
|
||||
isUUID(version?:number): Validator;
|
||||
/**
|
||||
* Alias for isUUID(3)
|
||||
*/
|
||||
@@ -137,17 +163,20 @@ declare namespace ExpressValidator {
|
||||
/**
|
||||
* Argument is optional and defaults to today. Comparison is non-inclusive
|
||||
*/
|
||||
isAfter(date:Date): Validator;
|
||||
isAfter(date?:Date): Validator;
|
||||
/**
|
||||
* Argument is optional and defaults to today. Comparison is non-inclusive
|
||||
*/
|
||||
isBefore(date:Date): Validator;
|
||||
isBefore(date?:Date): Validator;
|
||||
isIn(options:string): Validator;
|
||||
isIn(options:string[]): Validator;
|
||||
notIn(options:string): Validator;
|
||||
notIn(options:string[]): Validator;
|
||||
max(val:string): Validator;
|
||||
min(val:string): Validator;
|
||||
isJSON(): Validator;
|
||||
isLength(options: MinMaxOptions): Validator;
|
||||
isWhitelisted(chars: string): Validator;
|
||||
/**
|
||||
* Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats
|
||||
*/
|
||||
@@ -155,7 +184,10 @@ declare namespace ExpressValidator {
|
||||
/**
|
||||
* Check an input only when the input exists
|
||||
*/
|
||||
optional(): Validator;
|
||||
isSurrogatePar(): Validator;
|
||||
|
||||
optional(options?: { checkFalsy?: boolean }): Validator;
|
||||
withMessage(message: string): Validator;
|
||||
}
|
||||
|
||||
interface Sanitizer {
|
||||
@@ -165,40 +197,49 @@ declare namespace ExpressValidator {
|
||||
trim(...chars:string[]): Sanitizer;
|
||||
ltrim(...chars:string[]): Sanitizer;
|
||||
rtrim(...chars:string[]): Sanitizer;
|
||||
ifNull(replace:any): Sanitizer;
|
||||
stripLow(keep_new_lines?: boolean): Sanitizer;
|
||||
toFloat(): Sanitizer;
|
||||
toInt(): Sanitizer;
|
||||
toInt(radix?: number): Sanitizer;
|
||||
/**
|
||||
* True unless str = '0', 'false', or str.length == 0
|
||||
*/
|
||||
toBoolean(): Sanitizer;
|
||||
/**
|
||||
* False unless str = '1' or 'true'
|
||||
*/
|
||||
toBooleanStrict(): Sanitizer;
|
||||
/**
|
||||
* Decode HTML entities
|
||||
* True unless str = '0', 'false', or str.length == 0. In strict mode only '1' and 'true' return true.
|
||||
*/
|
||||
toBoolean(strict?: boolean): Sanitizer;
|
||||
|
||||
/**
|
||||
* Convert the input string to a date, or null if the input is not a date.
|
||||
*/
|
||||
toDate(): Sanitizer;
|
||||
|
||||
entityDecode(): Sanitizer;
|
||||
entityEncode(): Sanitizer;
|
||||
* Convert the input string to a date, or null if the input is not a date.
|
||||
*/
|
||||
toDate(): Sanitizer;
|
||||
|
||||
/**
|
||||
* Escape &, <, >, and "
|
||||
*/
|
||||
escape(): Sanitizer;
|
||||
|
||||
/**
|
||||
* Remove common XSS attack vectors from user-supplied HTML
|
||||
* Replaces HTML encoded entities with <, >, &, ', " and /.
|
||||
*/
|
||||
xss(): Sanitizer;
|
||||
unescape(): Sanitizer;
|
||||
|
||||
blacklist(chars: string): Sanitizer;
|
||||
blacklist(chars: string[]): Sanitizer;
|
||||
whitelist(chars: string): Sanitizer;
|
||||
whitelist(chars: string[]): Sanitizer;
|
||||
|
||||
normalizeEmail(options?: { lowercase?: boolean; remove_dots?: boolean; remove_extensions?: boolean }): Sanitizer;
|
||||
|
||||
/**
|
||||
* Remove common XSS attack vectors from images
|
||||
* !!! XSS sanitization was removed from the library (see: https://github.com/chriso/validator.js#xss-sanitization)
|
||||
*/
|
||||
xss(fromImages:boolean): Sanitizer;
|
||||
}
|
||||
|
||||
|
||||
interface MappedError {
|
||||
param: string;
|
||||
msg: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface MinMaxOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/// <reference path="express.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import * as express from 'express';
|
||||
var app = express();
|
||||
@@ -91,3 +92,10 @@ app.listen(3000);
|
||||
|
||||
const next: express.NextFunction = () => {};
|
||||
const nextWithArgument: express.NextFunction = (err: any) => {};
|
||||
|
||||
/**
|
||||
* The express.Application is compatible with http.createServer
|
||||
*/
|
||||
|
||||
import * as http from 'http';
|
||||
http.createServer(app);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="electron-prebuilt.d.ts" />
|
||||
/// <reference path="electron.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import electron = require('electron-prebuilt');
|
||||
import electron = require('electron');
|
||||
import child_process = require('child_process');
|
||||
|
||||
child_process.spawn(electron);
|
||||
@@ -1,9 +1,9 @@
|
||||
// Type definitions for electron-prebuilt 0.30.1
|
||||
// Project: https://github.com/mafintosh/electron-prebuilt
|
||||
// Type definitions for electron 1.3.3
|
||||
// Project: https://github.com/electron-userland/electron-prebuilt
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'electron-prebuilt' {
|
||||
declare module 'electron' {
|
||||
var electron: string;
|
||||
export = electron;
|
||||
}
|
||||
Vendored
+4
@@ -4766,6 +4766,10 @@ declare namespace Electron {
|
||||
* @returns Whether the web page is destroyed.
|
||||
*/
|
||||
isDestroyed(): boolean;
|
||||
/**
|
||||
* @returns Whether the web page is focused.
|
||||
*/
|
||||
isFocused(): boolean;
|
||||
/**
|
||||
* @returns Whether guest page is still loading resources.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/// <reference path="google-earth.d.ts" />
|
||||
|
||||
google.load("earth", "1", {"other_params":"sensor=true_or_false"});
|
||||
|
||||
google.earth.createInstance("map3d", initCB, failureCB);
|
||||
|
||||
function failureCB(error: any) {}
|
||||
|
||||
function initCB(ge: google.earth.GEPlugin) {
|
||||
|
||||
ge.getWindow().setVisibility(true);
|
||||
|
||||
|
||||
// Create the placemark.
|
||||
var placemark = ge.createPlacemark('');
|
||||
placemark.setName("placemark");
|
||||
|
||||
// Set the placemark's location.
|
||||
var point = ge.createPoint('');
|
||||
point.setLatitude(12.345);
|
||||
point.setLongitude(54.321);
|
||||
placemark.setGeometry(point);
|
||||
|
||||
// Create a style map.
|
||||
var styleMap = ge.createStyleMap('');
|
||||
|
||||
// Create normal style for style map.
|
||||
var normalStyle = ge.createStyle('');
|
||||
var normalIcon = ge.createIcon('');
|
||||
normalIcon.setHref('http://maps.google.com/mapfiles/kml/paddle/red-circle.png');
|
||||
normalStyle.getIconStyle().setIcon(normalIcon);
|
||||
|
||||
// Create highlight style for style map.
|
||||
var highlightStyle = ge.createStyle('');
|
||||
var highlightIcon = ge.createIcon('');
|
||||
highlightIcon.setHref('http://google-maps-icons.googlecode.com/files/girlfriend.png');
|
||||
highlightStyle.getIconStyle().setIcon(highlightIcon);
|
||||
highlightStyle.getIconStyle().setScale(5.0);
|
||||
|
||||
styleMap.setNormalStyle(normalStyle);
|
||||
styleMap.setHighlightStyle(highlightStyle);
|
||||
|
||||
// Apply stylemap to a placemark.
|
||||
placemark.setStyleSelector(styleMap);
|
||||
|
||||
//Add the placemark to Earth.
|
||||
ge.getFeatures().appendChild(placemark);
|
||||
|
||||
|
||||
// balloons
|
||||
var balloon = ge.createHtmlDivBalloon('');
|
||||
balloon.setFeature(placemark);
|
||||
var div = document.createElement('DIV');
|
||||
div.innerHTML = 'Any <em>HTML</em>, CSS, or JavaScript goes here.';
|
||||
balloon.setContentDiv(div);
|
||||
ge.setBalloon(balloon);
|
||||
|
||||
// Create the ScreenOverlay
|
||||
var screenOverlay = ge.createScreenOverlay('');
|
||||
|
||||
// Specify a path to the image and set as the icon
|
||||
var icon = ge.createIcon('');
|
||||
icon.setHref('http://www.google.com/intl/en_ALL/images/logo.gif');
|
||||
screenOverlay.setIcon(icon);
|
||||
|
||||
// Set the ScreenOverlay's position in the window
|
||||
screenOverlay.getOverlayXY().setXUnits(ge.UNITS_PIXELS);
|
||||
screenOverlay.getOverlayXY().setYUnits(ge.UNITS_PIXELS);
|
||||
screenOverlay.getOverlayXY().setX(200);
|
||||
screenOverlay.getOverlayXY().setY(200);
|
||||
|
||||
// Set the overlay's size in pixels
|
||||
screenOverlay.getSize().setXUnits(ge.UNITS_PIXELS);
|
||||
screenOverlay.getSize().setYUnits(ge.UNITS_PIXELS);
|
||||
screenOverlay.getSize().setX(250);
|
||||
screenOverlay.getSize().setY(75);
|
||||
|
||||
// Specify the point in the image around which to rotate
|
||||
screenOverlay.getRotationXY().setXUnits(ge.UNITS_FRACTION);
|
||||
screenOverlay.getRotationXY().setYUnits(ge.UNITS_FRACTION);
|
||||
screenOverlay.getRotationXY().setX(0.5);
|
||||
screenOverlay.getRotationXY().setY(0.5);
|
||||
|
||||
// Rotate the overlay
|
||||
screenOverlay.setRotation(25);
|
||||
|
||||
// Add the ScreenOverlay to Earth
|
||||
ge.getFeatures().appendChild(screenOverlay);
|
||||
|
||||
|
||||
// network link
|
||||
var link = ge.createLink('');
|
||||
var href = 'http://code.google.com/'
|
||||
+ 'apis/earth/documentation/samples/kml_example.kml'
|
||||
link.setHref(href);
|
||||
|
||||
var networkLink = ge.createNetworkLink('');
|
||||
networkLink.set(link, true, true); // Sets the link, refreshVisibility, and flyToView
|
||||
|
||||
ge.getFeatures().appendChild(networkLink);
|
||||
|
||||
// Get the current view.
|
||||
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
|
||||
|
||||
// Set new latitude and longitude values.
|
||||
lookAt.setLatitude(36.584207);
|
||||
lookAt.setLongitude(-121.754322);
|
||||
|
||||
// Update the view in Google Earth.
|
||||
ge.getView().setAbstractView(lookAt);
|
||||
|
||||
// time
|
||||
ge.getTime().getControl().setVisibility(ge.VISIBILITY_SHOW);
|
||||
ge.getTime().setHistoricalImageryEnabled(true);
|
||||
var extents = ge.getTime().getControl().getExtents();
|
||||
var begin = extents.getBegin().get();
|
||||
var end = extents.getEnd().get();
|
||||
|
||||
// tour
|
||||
ge.getTourPlayer().play();
|
||||
|
||||
|
||||
// controls
|
||||
ge.getNavigationControl().getScreenXY().setXUnits(ge.UNITS_INSET_PIXELS);
|
||||
ge.getNavigationControl().getScreenXY().setYUnits(ge.UNITS_PIXELS);
|
||||
|
||||
|
||||
// sky
|
||||
ge.getOptions().setMapType(ge.MAP_TYPE_SKY);
|
||||
ge.getOptions().setMapType(ge.MAP_TYPE_EARTH);
|
||||
}
|
||||
Vendored
+3978
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,9 @@
|
||||
import gulp = require("gulp");
|
||||
import rename = require("gulp-rename");
|
||||
|
||||
// Test that new import syntax works
|
||||
import * as newRename from 'gulp-rename';
|
||||
|
||||
// rename via string
|
||||
gulp.src("./src/main/text/hello.txt")
|
||||
.pipe(rename("main/text/ciao/goodbye.md"))
|
||||
@@ -26,4 +29,4 @@ gulp.src("./src/main/text/hello.txt", { base: process.cwd() })
|
||||
suffix: "-hola",
|
||||
extname: ".md"
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md
|
||||
|
||||
Vendored
+8
-1
@@ -20,5 +20,12 @@ declare module "gulp-rename" {
|
||||
function rename(name: string): NodeJS.ReadWriteStream;
|
||||
function rename(callback: (path: ParsedPath) => any): NodeJS.ReadWriteStream;
|
||||
function rename(opts: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* This is required as per:
|
||||
* https://github.com/Microsoft/TypeScript/issues/5073
|
||||
*/
|
||||
namespace rename {}
|
||||
|
||||
export = rename;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="./halfred.d.ts" />
|
||||
|
||||
// run test with: $ tsc --noImplicitAny --target es6 --module commonjs halfred-tests.ts
|
||||
import { parse } from 'halfred'; // require('halfred');
|
||||
let resource = parse({foo: "bar", "_links": { "self": { href: "fooo" }}});
|
||||
console.log(resource);
|
||||
|
||||
let allLinks = resource.allLinks();
|
||||
for (let key in allLinks) {
|
||||
let link = allLinks[key];
|
||||
|
||||
console.log(link[0].href);
|
||||
}
|
||||
Vendored
+247
@@ -0,0 +1,247 @@
|
||||
// Type definitions for Halfred v1.0.0
|
||||
// Project: https://github.com/basti1302/halfred
|
||||
// Definitions by: David Herges <https://github.com/dherges>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "halfred" {
|
||||
|
||||
/**
|
||||
* halfred.parse(object) returns a Resource object.
|
||||
*
|
||||
* @see https://github.com/basti1302/halfred#usage
|
||||
*/
|
||||
export function parse(object: any): Resource;
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#enabledisable-validation */
|
||||
export function enableValidation(flag: boolean): void;
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#enabledisable-validation */
|
||||
export function disableValidation(): void;
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#resource-api */
|
||||
export interface Resource {
|
||||
|
||||
/**
|
||||
* Returns an object which has an array for each link that was present in the source object.
|
||||
* See below why each link is represented as an array.
|
||||
*/
|
||||
allLinkArrays(): LinkCollection;
|
||||
|
||||
/** Alias for allLinkArrays() */
|
||||
allLinks(): LinkCollection;
|
||||
|
||||
/**
|
||||
* Returns the array of links for the given key, or null if there are no links for this key.
|
||||
*/
|
||||
linkArray(key: string): Link[];
|
||||
|
||||
/**
|
||||
* Returns the first element of the array of links for the given key or null if there are no
|
||||
* links for this key.
|
||||
*/
|
||||
link(key: string): Link;
|
||||
|
||||
/**
|
||||
* Returns an object which has an array for each embedded resource that was present in the
|
||||
* source object.
|
||||
* See below why each embedded resource is represented as an array. Each element of any of
|
||||
* this arrays is in turn a Resource object.
|
||||
*/
|
||||
allEmbeddedResourceArrays(): ResourceCollection;
|
||||
|
||||
/** Alias for allEmbeddedResourceArrays() */
|
||||
allEmbeddedArrays(): ResourceCollection;
|
||||
|
||||
/** Alias for allEmbeddedResourceArrays() */
|
||||
allEmbeddedResources(): ResourceCollection;
|
||||
|
||||
/**
|
||||
* Returns the array of embedded resources for the given key, or null if there are no embedded
|
||||
* resources for this key. Each element of this arrays is in turn a Resource object.
|
||||
*/
|
||||
embeddedResourceArray(key: string): Resource[];
|
||||
|
||||
/** Alias for embeddedResourceArray() */
|
||||
embeddedArray(key: string): Resource[];
|
||||
|
||||
/**
|
||||
* Returns the first element of the array of embedded resources for the given key or null if
|
||||
* there are no embedded resources for this key. The returend object is a Resource object.
|
||||
*/
|
||||
embeddedResource(key: string): Resource;
|
||||
|
||||
/** Alias for embeddedResource(key) */
|
||||
embedded(key: string): Resource;
|
||||
|
||||
/**
|
||||
* Returns the unmodified, original object that was parsed to this resource. This is rather
|
||||
* uninteresting for the source object you give to the parse method (because you probably
|
||||
* still have a reference to the source object) but it is a convenient way to get the part of
|
||||
* the source object that corresponds to an embedded resource.
|
||||
*/
|
||||
original(): any;
|
||||
|
||||
/**
|
||||
* Returns true if the resource has any CURIEs (Compact URIs).
|
||||
*
|
||||
* @see http://www.w3.org/TR/2010/NOTE-curie-20101216/
|
||||
*/
|
||||
hasCuries(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the array of CURIEs. Each object in the array is a link object, which means it
|
||||
* can be templated etc. See below for the link object API.
|
||||
*/
|
||||
curieArray(): Link[];
|
||||
|
||||
/**
|
||||
* Returns the curie with the given name, if any. The returned object is a link object, which
|
||||
* means it can be templated etc. See below for link object API.
|
||||
*/
|
||||
curie(name: string): Link;
|
||||
|
||||
/**
|
||||
* Returns the compact URI for the given full URL, if any
|
||||
*/
|
||||
reverseResolveCurie(fullUrl: string): string;
|
||||
|
||||
/**
|
||||
* Returns all validation issues. Validation issues are only gathered if validation has been
|
||||
* turned on by calling ``halfred.enableValidation()`` before calling ``halfred.parse``.
|
||||
*/
|
||||
validationIssues(): any;
|
||||
|
||||
/**
|
||||
* Alias for validationIssues()
|
||||
*/
|
||||
validation(): any;
|
||||
|
||||
/*
|
||||
XX ... think we should NOT try to represent these things in TypeScript.
|
||||
|
||||
In addition to the methods mentioned here, resource has all properties of the source object.
|
||||
This is also true for embedded Resource objects. The non-HAL properties (that is, any
|
||||
property except _links and _embedded) are copied over to the Resource object. This is always
|
||||
a shallow copy, so modifying the a non-HAL property in the Resource object might also alter
|
||||
the source object and vice versa.
|
||||
|
||||
The Resource object also has the properties _links and _embedded but they might differ from
|
||||
the _links/_embedded properties in the source object (Halfred applies some normalization to
|
||||
them). These are not intended to be accessed by clients directly, instead, use the provided
|
||||
methods to work with links and embedded resources.
|
||||
*/
|
||||
}
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#links-and-embedded-resources */
|
||||
interface ResourceCollection {
|
||||
[key: string]: Resource[];
|
||||
}
|
||||
|
||||
/** @see https://github.com/basti1302/halfred#links-and-embedded-resources */
|
||||
interface LinkCollection {
|
||||
[rel: string]: Link[]
|
||||
}
|
||||
|
||||
/**
|
||||
* A Link Object represents a hyperlink from the containing resource to a URI.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5
|
||||
*/
|
||||
interface Link {
|
||||
|
||||
/**
|
||||
* The "href" property is REQUIRED.
|
||||
*
|
||||
* Its value is either a URI [RFC3986] or a URI Template [RFC6570].
|
||||
*
|
||||
* If the value is a URI Template then the Link Object SHOULD have a
|
||||
* "templated" attribute whose value is true.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.1
|
||||
*/
|
||||
href: string;
|
||||
|
||||
/**
|
||||
* The "templated" property is OPTIONAL.
|
||||
*
|
||||
* Its value is boolean and SHOULD be true when the Link Object's "href"
|
||||
* property is a URI Template.
|
||||
*
|
||||
* Its value SHOULD be considered false if it is undefined or any other
|
||||
* value than true.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.2
|
||||
*/
|
||||
templated?: boolean;
|
||||
|
||||
/**
|
||||
* The "type" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string used as a hint to indicate the media type
|
||||
* expected when dereferencing the target resource.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.3
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* The "deprecation" property is OPTIONAL.
|
||||
*
|
||||
* Its presence indicates that the link is to be deprecated (i.e.
|
||||
* removed) at a future date. Its value is a URL that SHOULD provide
|
||||
* further information about the deprecation.
|
||||
*
|
||||
* A client SHOULD provide some notification (for example, by logging a
|
||||
* warning message) whenever it traverses over a link that has this
|
||||
* property. The notification SHOULD include the deprecation property's
|
||||
* value so that a client manitainer can easily find information about
|
||||
* the deprecation.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.4
|
||||
*/
|
||||
deprecation?: string;
|
||||
|
||||
/**
|
||||
* The "name" property is OPTIONAL.
|
||||
*
|
||||
* Its value MAY be used as a secondary key for selecting Link Objects
|
||||
* which share the same relation type.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.5
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The "profile" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string which is a URI that hints about the profile (as
|
||||
* defined by [I-D.wilde-profile-link]) of the target resource.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.6
|
||||
*/
|
||||
profile?: string;
|
||||
|
||||
/**
|
||||
* The "title" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string and is intended for labelling the link with a
|
||||
* human-readable identifier (as defined by [RFC5988]).
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.7
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* The "hreflang" property is OPTIONAL.
|
||||
*
|
||||
* Its value is a string and is intended for indicating the language of
|
||||
* the target resource (as defined by [RFC5988]).
|
||||
*
|
||||
* @see https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.8
|
||||
*/
|
||||
hreflang?: string;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+6
-2
@@ -1605,6 +1605,9 @@ declare module "hapi" {
|
||||
addEventListener: any;
|
||||
info: IServerConnectionInfo;
|
||||
}
|
||||
|
||||
type RequestExtPoints = "onRequest" | "onPreResponse" | "onPreAuth" | "onPostAuth" | "onPreHandler" | "onPostHandler" | "onPreResponse";
|
||||
type ServerExtPoints = "onPreStart" | "onPostStart" | "onPreStop" | "onPostStop";
|
||||
|
||||
/** Server http://hapijs.com/api#server
|
||||
rver object is the main application container. The server manages all incoming connections along with all the facilities provided by the framework. A server can contain more than one connection (e.g. listen to port 80 and 8080).
|
||||
@@ -2039,8 +2042,9 @@ declare module "hapi" {
|
||||
server.route({ method: 'GET', path: '/test', handler: handler });
|
||||
server.start();
|
||||
// All requests will get routed to '/test'*/
|
||||
ext(event: string, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
|
||||
ext<T>(event: string, method: (request: Request, reply: IStrictReply<T>, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
|
||||
ext(event: RequestExtPoints, method: (request: Request, reply: IReply, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
|
||||
ext<T>(event: RequestExtPoints, method: (request: Request, reply: IStrictReply<T>, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
|
||||
ext(event: ServerExtPoints, method: (server: Server, next: (err?: any) => void, bind?: any) => void, options?: { before: string | string[]; after: string | string[]; bind?: any }): void;
|
||||
|
||||
/** server.handler(name, method)
|
||||
Registers a new handler type to be used in routes where:
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for Highcharts 4.2.6 (exporting module)
|
||||
// Project: http://www.highcharts.com/
|
||||
// Definitions by: Maciej Suchecki <http://github.com/mc-suchecki>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="highcharts.d.ts" />
|
||||
|
||||
declare var HighchartsExporting: (H: HighchartsStatic) => HighchartsStatic;
|
||||
|
||||
declare module "highcharts/modules/exporting" {
|
||||
export = HighchartsExporting;
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for Highcharts 4.2.6
|
||||
// Project: http://www.highcharts.com/
|
||||
// Definitions by: Maciej Suchecki <http://github.com/mc-suchecki>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="highcharts.d.ts" />
|
||||
|
||||
declare var HighchartsMore: (H: HighchartsStatic) => HighchartsStatic;
|
||||
|
||||
declare module "highcharts/highcharts-more" {
|
||||
export = HighchartsMore;
|
||||
}
|
||||
Vendored
+38
-38
@@ -240,7 +240,7 @@ interface HighchartsPlotBands {
|
||||
* Border color for the plot band. Also requires borderWidth to be set.
|
||||
* @default null
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* Border width for the plot band. Also requires borderColor to be set.
|
||||
* @default 0
|
||||
@@ -471,7 +471,7 @@ interface HighchartsAxisOptions {
|
||||
/**
|
||||
* Configure a crosshair that follows either the mouse pointer or the hovered point.
|
||||
*/
|
||||
crosshair?: HighchartsCrosshairObject;
|
||||
crosshair?: HighchartsCrosshairObject | boolean;
|
||||
/**
|
||||
* For a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default
|
||||
* string representations used for each unit. For an overview of the replacement codes, see dateFormat.
|
||||
@@ -556,7 +556,7 @@ interface HighchartsAxisOptions {
|
||||
* The color of the line marking the axis itself.
|
||||
* @default '#C0D0E0'.
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the line marking the axis itself.
|
||||
* @default 1
|
||||
@@ -820,7 +820,7 @@ interface HighchartsAxisOptions {
|
||||
interface HighchartsColorAxisDataClass {
|
||||
from?: number;
|
||||
to?: number;
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
@@ -906,7 +906,7 @@ interface HighchartsColorAxisOptions {
|
||||
* The color of the line marking the axis itself.
|
||||
* @default '#C0D0E0'
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the line marking the axis itself.
|
||||
* @default 0
|
||||
@@ -926,7 +926,7 @@ interface HighchartsColorAxisOptions {
|
||||
* The color of the marker.
|
||||
* @default 'gray'
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
};
|
||||
/**
|
||||
* The maximum value of the axis in terms of map point values. If null, the max value is automatically calculated.
|
||||
@@ -1382,7 +1382,7 @@ interface HighchartsShadow {
|
||||
/**
|
||||
* @default 'black'
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* @default 1
|
||||
*/
|
||||
@@ -1491,7 +1491,7 @@ interface HighchartsChartOptions {
|
||||
* The color of the outer chart border.
|
||||
* @default '#4572A7'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The corner radius of the outer chart border.
|
||||
* @default 0
|
||||
@@ -1721,7 +1721,7 @@ interface HighchartsChartOptions {
|
||||
interface HighchartsCSSObject {
|
||||
background?: string;
|
||||
border?: string;
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
cursor?: string;
|
||||
font?: string;
|
||||
fontFamily?: string;
|
||||
@@ -2429,7 +2429,7 @@ interface HighchartsLegendOptions {
|
||||
* The color of the drawn border around the legend.
|
||||
* @default '#909090'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border corner radius of the legend.
|
||||
* @default 0
|
||||
@@ -2724,7 +2724,7 @@ interface HighchartsPaneBackground {
|
||||
/**
|
||||
* @default 'silver'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* @default 1
|
||||
*/
|
||||
@@ -2803,7 +2803,7 @@ interface HighchartsDataLabels {
|
||||
* The border color for the data label.
|
||||
* @since 2.2.1
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border radius in pixels for the data label.
|
||||
* @default 0
|
||||
@@ -2820,7 +2820,7 @@ interface HighchartsDataLabels {
|
||||
* The text color for the data labels.
|
||||
* @default null
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot
|
||||
* area according to the overflow option.
|
||||
@@ -3066,7 +3066,7 @@ interface HighchartsMarkerState {
|
||||
* The color of the point marker's outline. When null, the series' or point's color is used.
|
||||
* @default '#FFFFFF', '#000000' for select state
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the point marker's outline.
|
||||
* @default 0
|
||||
@@ -3276,7 +3276,7 @@ interface HighchartsAreaZone {
|
||||
* Defines the color of the series.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* A name for the dash style to use for the graph.
|
||||
* @since 4.1.0
|
||||
@@ -3321,7 +3321,7 @@ interface HighchartsRangeDataLabels {
|
||||
* @default undefined
|
||||
* @since 2.2.1
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border radius in pixels for the data label.
|
||||
* @default 0
|
||||
@@ -3338,7 +3338,7 @@ interface HighchartsRangeDataLabels {
|
||||
* The text color for the data labels.
|
||||
* @default null
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Whether to hide data labels that are outside the plot area. By default, the data label is moved inside the plot
|
||||
* area according to the overflow option.
|
||||
@@ -3471,7 +3471,7 @@ interface HighchartsDial {
|
||||
* @default 'black'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
backgroundColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The length of the dial's base part, relative to the total radius or length of the dial.
|
||||
* @default '70%'.
|
||||
@@ -3490,7 +3490,7 @@ interface HighchartsDial {
|
||||
* @default 'silver'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the gauge dial border in pixels.
|
||||
* @default 0
|
||||
@@ -3524,14 +3524,14 @@ interface HighchartsPivot {
|
||||
* @default 'black'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
backgroundColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border or stroke color of the pivot. In able to change this, the borderWidth must also be set to something
|
||||
* other than the default 0.
|
||||
* @default 'silver'
|
||||
* @since 2.3.0
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The border or stroke width of the pivot.
|
||||
* @default 0
|
||||
@@ -3554,7 +3554,7 @@ interface HighchartsTreeMapLevel {
|
||||
* Can set borderColor on all points which lies on the same level.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* et the dash style of the border of all the point which lies on the level.
|
||||
* @since 4.1.0
|
||||
@@ -3569,7 +3569,7 @@ interface HighchartsTreeMapLevel {
|
||||
* Can set a color on all points which lies on the same level.
|
||||
* @since 4.1.0
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Can set the options of dataLabels on each point which lies on the level.
|
||||
* @default undefined
|
||||
@@ -3594,7 +3594,7 @@ interface HighchartsTreeMapLevel {
|
||||
}
|
||||
|
||||
/**
|
||||
* General options for all series types
|
||||
* General options for all series types.
|
||||
*/
|
||||
interface HighchartsSeriesChart {
|
||||
/**
|
||||
@@ -3615,7 +3615,7 @@ interface HighchartsSeriesChart {
|
||||
* specified. In bar type series it applies to the bars unless a color is specified per point. The default value is
|
||||
* pulled from the options.colors array.
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Polar charts only. Whether to connect the ends of a line series plot across the extremes.
|
||||
* @default true
|
||||
@@ -3860,7 +3860,7 @@ interface HighchartsAreaChart extends HighchartsSeriesChart {
|
||||
* A separate color for the graph line. By default the line takes the color of the series, but the lineColor setting
|
||||
* allows setting a separate color for the line without altering the fillColor.
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* A separate color for the negative part of the area.
|
||||
* @since 3.0
|
||||
@@ -3902,7 +3902,7 @@ interface HighchartsBarChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each column or bar.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The corner radius of the border surrounding each column or bar.
|
||||
* @default 0
|
||||
@@ -4263,7 +4263,7 @@ interface HighchartsFunnelChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each column or bar.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each column or bar.
|
||||
* @default 1
|
||||
@@ -4385,7 +4385,7 @@ interface HighchartsHeatMapChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each column or bar.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The corner radius of the border surrounding each column or bar.
|
||||
* @default 0
|
||||
@@ -4468,7 +4468,7 @@ interface HighchartsPieChart extends HighchartsSeriesChart {
|
||||
* borderless pies.
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each column or bar.
|
||||
* @default 1
|
||||
@@ -4573,7 +4573,7 @@ interface HighchartsPyramidChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each slice
|
||||
* @default '#FFFFFF'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each slice
|
||||
* @default 1
|
||||
@@ -4688,7 +4688,7 @@ interface HighchartsTreeMapChart extends HighchartsSeriesChart {
|
||||
* The color of the border surrounding each tree map item.
|
||||
* @default '#E0E0E0'
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The width of the border surrounding each column or bar.
|
||||
* @default 1
|
||||
@@ -4783,7 +4783,7 @@ interface HighchartsWaterFallChart extends HighchartsBarChart {
|
||||
* @default '#333333'
|
||||
* @since 3.0
|
||||
*/
|
||||
lineColor?: string;
|
||||
lineColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The color used specifically for positive point columns. When not specified, the general series color is used.
|
||||
*/
|
||||
@@ -4834,7 +4834,7 @@ interface HighchartsIndividualSeriesOptions {
|
||||
* specified. In bar type series it applies to the bars unless a color is specified per point. The default
|
||||
* value is pulled from the options.colors array.
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user
|
||||
* that the points and lines can be clicked.
|
||||
@@ -4949,7 +4949,7 @@ interface HighchartsDataPoint {
|
||||
* Individual color for the point. By default the color is pulled from the global colors array.
|
||||
* @default undefined
|
||||
*/
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Serves a purpose only if a colorAxis object is defined in the chart options. This value will decide which color
|
||||
* the point gets from the scale of the colorAxis.
|
||||
@@ -5173,7 +5173,7 @@ interface HighchartsTitleOptions {
|
||||
}
|
||||
|
||||
interface HighchartsCrosshairObject {
|
||||
color?: string;
|
||||
color?: string | HighchartsGradient;
|
||||
width?: number;
|
||||
dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot
|
||||
zIndex?: number;
|
||||
@@ -5200,7 +5200,7 @@ interface HighchartsTooltipOptions extends HighchartsSeriesTooltipOptions {
|
||||
* The color of the tooltip border. When null, the border takes the color of the corresponding series or point.
|
||||
* @default null
|
||||
*/
|
||||
borderColor?: string;
|
||||
borderColor?: string | HighchartsGradient;
|
||||
/**
|
||||
* The radius of the rounded border corners.
|
||||
* @default 3
|
||||
@@ -5602,7 +5602,7 @@ interface HighchartsAxisObject {
|
||||
* @param {boolean | HighchartsAnimation} animation When true, the resize will be animated with default animation options. The animation can also be a configuration object with properties duration and easing.
|
||||
* @since 1.2.0
|
||||
*/
|
||||
setExtremes(min?: number, max?: number, redraw?: boolean, animation?: boolean | HighchartsAnimation): void;
|
||||
setExtremes(min?: number, max?: number, redraw?: boolean, animation?: boolean | HighchartsAnimation, eventArguments?: any): void;
|
||||
/**
|
||||
* Update the title of the axis after render time.
|
||||
* @param {HighchartsAxisTitle} title The new title options on the same format as given in xAxis.title.
|
||||
|
||||
Vendored
+6
@@ -7,6 +7,12 @@
|
||||
|
||||
declare function it(expectation:string, assertion:(done:(err?:any) => void) => void, timeout?:number):void;
|
||||
|
||||
declare namespace jasmine {
|
||||
interface Env {
|
||||
defaultTimeoutInterval: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "jasmine-node" {
|
||||
interface ExecuteSpecsOptions {
|
||||
specFolders: string[],
|
||||
|
||||
Vendored
+2
-2
@@ -39,7 +39,7 @@ type JSONEditorOptions<TValue> = {
|
||||
/**
|
||||
* The icon library to use for the editor.
|
||||
*/
|
||||
iconlib?: boolean;
|
||||
iconlib?: "bootstrap2" | "bootstrap3" | "foundation2" | "foundation3" | "jqueryui" | "fontawesome3" | "fontawesome4";
|
||||
/**
|
||||
* If true, objects can only contain properties defined with the properties keyword.
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ type JSONEditorOptions<TValue> = {
|
||||
/**
|
||||
* The CSS theme to use.
|
||||
*/
|
||||
theme?: string;
|
||||
theme?: "barebones" | "html" | "bootstrap2" | "bootstrap3" | "foundation3" | "foundation4" | "foundation5" | "foundation6" | "jqueryui";
|
||||
/**
|
||||
* If true, only required properties will be included by default.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="karma-fixture.d.ts" />
|
||||
|
||||
fixture.setBase('fixtures/base/path');
|
||||
fixture.load('test1.html', 'test1.json', false);
|
||||
fixture.load('test1.html', 'test2.html', 'test1.json');
|
||||
fixture.set('<em></em>', true);
|
||||
fixture.set('<em></em>', '<strong><strong/>');
|
||||
fixture.cleanup();
|
||||
fixture.el.firstChild;
|
||||
JSON.stringify(fixture.json[0]);
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for karma-fixture 0.2.6
|
||||
// Project: https://github.com/billtrik/karma-fixture
|
||||
// Definitions by: Ezekiel Victor <https://github.com/evictor/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module fixture {
|
||||
var el: HTMLElement;
|
||||
var json: any[];
|
||||
|
||||
function load(...files: string[]): any;
|
||||
function load(file1: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, file3: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, file3: string, file4: string, append?: boolean): any;
|
||||
function load(file1: string, file2: string, file3: string, file4: string, file5: string, append?: boolean): any;
|
||||
|
||||
function set(...htmlStrs: string[]): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
function set(htmlStr1: string, htmlStr2: string, htmlStr3: string, htmlStr4: string, htmlStr5: string, append?: boolean): HTMLElement|HTMLElement[];
|
||||
|
||||
function cleanup(): void;
|
||||
|
||||
function setBase(fixtureBasePath: string): void;
|
||||
}
|
||||
Vendored
+62
-56
@@ -89,40 +89,10 @@ declare namespace kendo {
|
||||
};
|
||||
};
|
||||
|
||||
var cultures: {[culture: string] : {
|
||||
name?: string;
|
||||
calendar?: {
|
||||
AM: string[];
|
||||
PM: string[];
|
||||
days: {
|
||||
names: string[];
|
||||
namesAbbr: string[];
|
||||
namesShort: string[];
|
||||
firstDay: number;
|
||||
};
|
||||
months: {
|
||||
names: string[];
|
||||
namesAbbr: string[];
|
||||
};
|
||||
patterns: {
|
||||
D: string;
|
||||
F: string;
|
||||
G: string;
|
||||
M: string;
|
||||
T: string;
|
||||
Y: string;
|
||||
d: string;
|
||||
g: string;
|
||||
m: string;
|
||||
s: string;
|
||||
t: string;
|
||||
u: string;
|
||||
y: string;
|
||||
};
|
||||
twoDigitYearMax: number;
|
||||
};
|
||||
calendars?: {
|
||||
standard: {
|
||||
var cultures: {
|
||||
[culture: string]: {
|
||||
name?: string;
|
||||
calendar?: {
|
||||
AM: string[];
|
||||
PM: string[];
|
||||
days: {
|
||||
@@ -152,25 +122,57 @@ declare namespace kendo {
|
||||
};
|
||||
twoDigitYearMax: number;
|
||||
};
|
||||
};
|
||||
numberFormat?: {
|
||||
currency: {
|
||||
calendars?: {
|
||||
standard: {
|
||||
AM: string[];
|
||||
PM: string[];
|
||||
days: {
|
||||
names: string[];
|
||||
namesAbbr: string[];
|
||||
namesShort: string[];
|
||||
firstDay: number;
|
||||
};
|
||||
months: {
|
||||
names: string[];
|
||||
namesAbbr: string[];
|
||||
};
|
||||
patterns: {
|
||||
D: string;
|
||||
F: string;
|
||||
G: string;
|
||||
M: string;
|
||||
T: string;
|
||||
Y: string;
|
||||
d: string;
|
||||
g: string;
|
||||
m: string;
|
||||
s: string;
|
||||
t: string;
|
||||
u: string;
|
||||
y: string;
|
||||
};
|
||||
twoDigitYearMax: number;
|
||||
};
|
||||
};
|
||||
numberFormat?: {
|
||||
currency: {
|
||||
decimals: number;
|
||||
groupSize: number[];
|
||||
pattern: string[];
|
||||
symbol: string;
|
||||
};
|
||||
decimals: number;
|
||||
groupSize: number[];
|
||||
pattern: string[];
|
||||
symbol: string;
|
||||
percent: {
|
||||
decimals: number;
|
||||
groupSize: number[];
|
||||
pattern: string[];
|
||||
symbol: string;
|
||||
};
|
||||
};
|
||||
decimals: number;
|
||||
groupSize: number[];
|
||||
pattern: string[];
|
||||
percent: {
|
||||
decimals: number;
|
||||
groupSize: number[];
|
||||
pattern: string[];
|
||||
symbol: string;
|
||||
};
|
||||
};
|
||||
}};
|
||||
}
|
||||
};
|
||||
|
||||
function format(format: string, ...values: any[]): string;
|
||||
|
||||
@@ -488,8 +490,8 @@ declare namespace kendo.data {
|
||||
change(e: Object): void;
|
||||
start(source: kendo.Observable): void;
|
||||
stop(source: kendo.Observable): void;
|
||||
get (): any;
|
||||
set (value: any): void;
|
||||
get(): any;
|
||||
set(value: any): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
@@ -500,7 +502,7 @@ declare namespace kendo.data {
|
||||
}
|
||||
|
||||
class EventBinding extends Binding {
|
||||
get (): void;
|
||||
get(): void;
|
||||
}
|
||||
|
||||
class TemplateBinding extends Binding {
|
||||
@@ -531,7 +533,7 @@ declare namespace kendo.data {
|
||||
interface BinderOptions {
|
||||
}
|
||||
|
||||
class ObservableObject extends Observable{
|
||||
class ObservableObject extends Observable {
|
||||
constructor(value?: any);
|
||||
uid: string;
|
||||
init(value?: any): void;
|
||||
@@ -571,6 +573,7 @@ declare namespace kendo.data {
|
||||
isAllDay?: boolean;
|
||||
id?: any;
|
||||
start?: Date;
|
||||
taskId?: number;
|
||||
startTimezone?: string;
|
||||
recurrenceId?: any;
|
||||
recurrenceRule?: string;
|
||||
@@ -583,7 +586,7 @@ declare namespace kendo.data {
|
||||
static fields: DataSourceSchemaModelFields;
|
||||
|
||||
constructor(data?: SchedulerEventData);
|
||||
|
||||
taskId: number;
|
||||
description: string;
|
||||
end: Date;
|
||||
endTimezone: string;
|
||||
@@ -2653,7 +2656,7 @@ declare namespace kendo.ui {
|
||||
separator?: string;
|
||||
suggest?: boolean;
|
||||
headerTemplate?: string|Function;
|
||||
template?: string|Function;
|
||||
template?: string | Function;
|
||||
valuePrimitive?: boolean;
|
||||
virtual?: boolean|AutoCompleteVirtual;
|
||||
change?(e: AutoCompleteChangeEvent): void;
|
||||
@@ -4471,6 +4474,7 @@ declare namespace kendo.ui {
|
||||
width?: string|number;
|
||||
values?: any;
|
||||
menu?: boolean;
|
||||
type?: any;
|
||||
}
|
||||
|
||||
interface GridEditable {
|
||||
@@ -5890,6 +5894,7 @@ declare namespace kendo.ui {
|
||||
destroy(): void;
|
||||
enable(enable: boolean): void;
|
||||
value(): any;
|
||||
values(): any;
|
||||
value(selectionStart: number, selectionEnd: number): void;
|
||||
resize(): void;
|
||||
|
||||
@@ -8834,6 +8839,7 @@ declare namespace kendo.dataviz.ui {
|
||||
type?: string;
|
||||
visible?: boolean;
|
||||
weekStartDay?: number;
|
||||
axisCrossingValues?: number[];
|
||||
notes?: ChartCategoryAxisItemNotes;
|
||||
}
|
||||
|
||||
@@ -10599,6 +10605,7 @@ declare namespace kendo.dataviz.ui {
|
||||
autoBind?: boolean;
|
||||
axisDefaults?: ChartAxisDefaults;
|
||||
categoryAxis?: ChartCategoryAxisItem[];
|
||||
valueAxis?: ChartValueAxisItem[];
|
||||
chartArea?: ChartChartArea;
|
||||
dataSource?: any|any|kendo.data.DataSource;
|
||||
legend?: ChartLegend;
|
||||
@@ -10614,7 +10621,6 @@ declare namespace kendo.dataviz.ui {
|
||||
title?: ChartTitle;
|
||||
tooltip?: ChartTooltip;
|
||||
transitions?: boolean;
|
||||
valueAxis?: ChartValueAxisItem[];
|
||||
xAxis?: ChartXAxisItem[];
|
||||
yAxis?: ChartYAxisItem[];
|
||||
zoomable?: boolean|ChartZoomable;
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ declare module "knex" {
|
||||
|
||||
type Callback = Function;
|
||||
type Client = Function;
|
||||
type Value = string|number|boolean|Date|Array<string>|Array<number>|Array<Date>|Array<boolean>;
|
||||
type Value = string|number|boolean|Date|Array<string>|Array<number>|Array<Date>|Array<boolean>|Buffer;
|
||||
type ColumnName = string|Knex.Raw|Knex.QueryBuilder;
|
||||
type TableName = string|Knex.Raw|Knex.QueryBuilder;
|
||||
|
||||
|
||||
@@ -9658,6 +9658,25 @@ namespace TestSnakeCase {
|
||||
}
|
||||
}
|
||||
|
||||
// _.split
|
||||
namespace TestSplit {
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<string>;
|
||||
|
||||
result = _('a-b-c').split();
|
||||
result = _('a-b-c').split('-');
|
||||
result = _('a-b-c').split('-', 2);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<string>;
|
||||
|
||||
result = _('a-b-c').chain().split();
|
||||
result = _('a-b-c').chain().split('-');
|
||||
result = _('a-b-c').chain().split('-', 2);
|
||||
}
|
||||
}
|
||||
|
||||
// _.startCase
|
||||
namespace TestStartCase {
|
||||
{
|
||||
|
||||
Vendored
+21
@@ -14720,6 +14720,27 @@ declare module _ {
|
||||
snakeCase(): LoDashExplicitWrapper<string>;
|
||||
}
|
||||
|
||||
//_.split
|
||||
interface LoDashImplicitWrapper<T> {
|
||||
/**
|
||||
* Splits string by separator.
|
||||
*
|
||||
* Note: This method is based on String#split.
|
||||
*
|
||||
* @param separator The separator pattern to split by.
|
||||
* @param limit The length to truncate results to.
|
||||
* @return Returns the new array with the terms splitted.
|
||||
*/
|
||||
split(separator?: RegExp|string, limit?: number): LoDashImplicitArrayWrapper<string>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<T> {
|
||||
/**
|
||||
* @see _.split
|
||||
*/
|
||||
split(separator?: RegExp|string, limit?: number): LoDashImplicitArrayWrapper<string>;
|
||||
}
|
||||
|
||||
//_.startCase
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Vendored
+8
-7
@@ -172,6 +172,7 @@ Other changes
|
||||
- [x] Ensured _.range preserves the sign of start of -0
|
||||
- [x] Ensured _.reduce & _.reduceRight use getIteratee in their array branch
|
||||
- [x] Fixed rounding issue with the precision param of _.floor
|
||||
- [x] Added flush method to debounced & throttled functions
|
||||
|
||||
** LATER **
|
||||
Misc:
|
||||
@@ -185,7 +186,6 @@ Misc:
|
||||
- [ ] _.extend as an alias of _.assignIn
|
||||
- [ ] _.extendWith as an alias of _.assignInWith
|
||||
- [ ] Added clear method to _.memoize.Cache
|
||||
- [ ] Added flush method to debounced & throttled functions
|
||||
- [ ] Added support for ES6 maps, sets, & symbols to _.clone, _.isEqual, & _.toArray
|
||||
- [ ] Enabled _.flow & _.flowRight to accept an array of functions
|
||||
- [ ] Ensured “Collection” methods treat functions as objects
|
||||
@@ -10132,9 +10132,9 @@ declare module _ {
|
||||
/**
|
||||
* Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since
|
||||
* the last time the debounced function was invoked. The debounced function comes with a cancel method to
|
||||
* cancel delayed invocations. Provide an options object to indicate that func should be invoked on the
|
||||
* leading and/or trailing edge of the wait timeout. Subsequent calls to the debounced function return the
|
||||
* result of the last func invocation.
|
||||
* cancel delayed invocations and a flush method to immediately invoke them. Provide an options object to
|
||||
* indicate that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent
|
||||
* calls to the debounced function return the result of the last func invocation.
|
||||
*
|
||||
* Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only
|
||||
* if the the debounced function is invoked more than once during the wait timeout.
|
||||
@@ -10755,9 +10755,9 @@ declare module _ {
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a throttled function that only invokes func at most once per every wait milliseconds. The throttled
|
||||
* function comes with a cancel method to cancel delayed invocations. Provide an options object to indicate
|
||||
* that func should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls to
|
||||
* the throttled function return the result of the last func call.
|
||||
* function comes with a cancel method to cancel delayed invocations and a flush method to immediately invoke
|
||||
* them. Provide an options object to indicate that func should be invoked on the leading and/or trailing edge
|
||||
* of the wait timeout. Subsequent calls to the throttled function return the result of the last func call.
|
||||
*
|
||||
* Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only if
|
||||
* the the throttled function is invoked more than once during the wait timeout.
|
||||
@@ -19159,6 +19159,7 @@ declare module _ {
|
||||
|
||||
interface Cancelable {
|
||||
cancel(): void;
|
||||
flush(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1712,7 +1712,7 @@ declare namespace __MaterialUI {
|
||||
focus(): void;
|
||||
select(): void;
|
||||
getValue(): string;
|
||||
getInputNode(): Element;
|
||||
getInputNode(): HTMLInputElement;
|
||||
}
|
||||
|
||||
interface TimePickerProps extends React.Props<TimePicker> {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/// <reference path="mock-require.d.ts" />
|
||||
|
||||
import mock = require('mock-require');
|
||||
|
||||
function testMock() {
|
||||
mock('http', {
|
||||
request: function () {
|
||||
console.log('http.request called');
|
||||
}
|
||||
});
|
||||
|
||||
const http = require('http');
|
||||
http.request(); // 'http.request called'
|
||||
}
|
||||
|
||||
function testStop() {
|
||||
mock('fs', { mockedFS: true });
|
||||
|
||||
const fs1 = require('fs');
|
||||
mock.stop('fs');
|
||||
|
||||
const fs2 = require('fs');
|
||||
fs1 === fs2; // false
|
||||
}
|
||||
|
||||
function testStopAll() {
|
||||
mock('fs', {});
|
||||
mock('path', {});
|
||||
|
||||
const fs1 = require('fs');
|
||||
const path1 = require('path');
|
||||
|
||||
mock.stopAll();
|
||||
|
||||
const fs2 = require('fs');
|
||||
const path2 = require('path');
|
||||
|
||||
fs1 === fs2; // false
|
||||
path1 === path2; // false
|
||||
}
|
||||
|
||||
function testReRequire() {
|
||||
const fs = require('fs');
|
||||
let fileToTest = require('./fileToTest');
|
||||
mock('fs', {}); // fileToTest is still using the unmocked fs module
|
||||
fileToTest = mock.reRequire('./fileToTest'); // fileToTest is now using your mock
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for mock-require v1.3.0
|
||||
// Project: https://github.com/boblauer/mock-require
|
||||
// Definitions by: Daniel Pereira <https://github.com/djpereira>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
/** Simple, intuitive mocking of Node.js modules. */
|
||||
declare module 'mock-require' {
|
||||
|
||||
interface Mock {
|
||||
|
||||
/**
|
||||
* @param {string} path The module you that you want to mock.
|
||||
* @param {any} mockExport The function or object you want to be returned from require, instead of the path module's exports, or the module you want to be returned from require, instead of the path module's export.
|
||||
*/
|
||||
(path: string, mockExport: any | Function | string): void;
|
||||
|
||||
/**
|
||||
* @param {string} path The module you that you want to stop mocking.
|
||||
*/
|
||||
stop(path: string): void;
|
||||
|
||||
/** This function can be used to remove all registered mocks without the need to remove them individually using mock.stop(). */
|
||||
stopAll(): void;
|
||||
|
||||
/**
|
||||
* @param {string} path The file whose cache you want to refresh.
|
||||
*/
|
||||
reRequire(path: string): void;
|
||||
}
|
||||
|
||||
const myModule: Mock;
|
||||
export = myModule;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/// <reference path="./mongoose-paginate.d.ts" />
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
/**
|
||||
* Created by Linus Brolin <https://github.com/linusbrolin/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Schema,
|
||||
model,
|
||||
PaginateModel,
|
||||
PaginateOptions,
|
||||
PaginateResult
|
||||
} from 'mongoose';
|
||||
import * as mongoosePaginate from 'mongoose-paginate';
|
||||
import { Router, Request, Response } from 'express';
|
||||
|
||||
|
||||
//#region Test Models
|
||||
interface User {
|
||||
email: string;
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
const UserSchema: Schema = new Schema({
|
||||
email: String,
|
||||
username: String,
|
||||
password: String
|
||||
});
|
||||
|
||||
UserSchema.plugin(mongoosePaginate);
|
||||
|
||||
type UserModel<T> = _UserModel<T> & PaginateModel<T>;
|
||||
interface _UserModel<T> {}
|
||||
|
||||
let UserModel: UserModel<User> = model<User>('User', UserSchema) as UserModel<User>;
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Test Paginate
|
||||
let router: Router = Router();
|
||||
|
||||
router.get('/users.json', function(req: Request, res: Response) {
|
||||
let descending: boolean = true;
|
||||
let options: PaginateOptions = <PaginateOptions>{};
|
||||
options.select = 'email username';
|
||||
options.sort = { 'username': (descending ? -1 : 1) };
|
||||
options.populate = '';
|
||||
options.lean = true;
|
||||
options.leanWithId = false;
|
||||
options.offset = 0;
|
||||
options.page = 1;
|
||||
options.limit = 10;
|
||||
|
||||
UserModel
|
||||
.paginate({}, options, (err: any, value: PaginateResult<User>) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return res.status(500).send(err);
|
||||
}
|
||||
|
||||
console.log('total: ' + value.total);
|
||||
console.log('limit: ' + value.limit);
|
||||
console.log('page: ' + value.page);
|
||||
console.log('pages: ' + value.pages);
|
||||
console.log('offset: ' + value.offset);
|
||||
console.log('docs: ');
|
||||
console.dir(value.docs);
|
||||
return res.json(value);
|
||||
});
|
||||
|
||||
});
|
||||
//#endregion
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
// Type definitions for mongoose-paginate 5.0.0
|
||||
// Project: https://github.com/edwardhotchkiss/mongoose-paginate
|
||||
// Definitions by: Linus Brolin <https://github.com/linusbrolin/>, simonxca <https://github.com/simonxca/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
|
||||
declare module 'mongoose' {
|
||||
export interface PaginateOptions {
|
||||
select?: Object | string;
|
||||
sort?: Object | string;
|
||||
populate?: Array<Object> | Array<string> | Object | string;
|
||||
lean?: boolean;
|
||||
leanWithId?: boolean;
|
||||
offset?: number;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface PaginateResult<T> {
|
||||
docs: Array<T>;
|
||||
total: number;
|
||||
limit: number;
|
||||
page?: number;
|
||||
pages?: number;
|
||||
offset?: number;
|
||||
}
|
||||
|
||||
export type PaginateModel<T> = _PaginateModel<T> & Model<T>;
|
||||
interface _PaginateModel<T> {
|
||||
paginate(query?: Object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult<T>) => void): Promise<PaginateResult<T>>;
|
||||
}
|
||||
|
||||
export function model<T extends Document, Statics>(
|
||||
name: string,
|
||||
schema?: Schema,
|
||||
collection?: string,
|
||||
skipInit?: boolean): Statics & PaginateModel<T>;
|
||||
}
|
||||
|
||||
declare module 'mongoose-paginate' {
|
||||
import mongoose = require('mongoose');
|
||||
var _: (schema: mongoose.Schema) => void;
|
||||
export = _;
|
||||
}
|
||||
Vendored
+5
-1
@@ -87,13 +87,17 @@ declare module "multer" {
|
||||
}
|
||||
|
||||
interface Instance {
|
||||
/** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */
|
||||
single(): express.RequestHandler;
|
||||
/** Accept a single file with the name fieldname. The single file will be stored in req.file. */
|
||||
single(fieldame: string): express.RequestHandler;
|
||||
/** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */
|
||||
array(): express.RequestHandler;
|
||||
/** Accept an array of files, all with the name fieldname. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */
|
||||
array(fieldame: string, maxCount?: number): express.RequestHandler;
|
||||
/** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */
|
||||
fields(fields: Field[]): express.RequestHandler;
|
||||
/** Accepts all files that comes over the wire. An array of files will be stored in req.files. */
|
||||
/** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */
|
||||
any(): express.RequestHandler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -826,3 +826,17 @@ namespace vm_tests {
|
||||
Debug.scripts().forEach(function(script: any) { console.log(script.name); });
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Errors Tests : https://nodejs.org/dist/latest-v4.x/docs/api/errors.html ///
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace errors_tests {
|
||||
{
|
||||
Error.stackTraceLimit = Infinity;
|
||||
}
|
||||
{
|
||||
const myObject = {};
|
||||
Error.captureStackTrace(myObject);
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -13,6 +13,10 @@ interface Error {
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
interface ErrorConstructor {
|
||||
captureStackTrace(targetObject: Object, constructorOpt?: Function): void;
|
||||
stackTraceLimit: number;
|
||||
}
|
||||
|
||||
// compat for TypeScript 1.8
|
||||
// if you use with --target es3 or --target es5 and use below definitions,
|
||||
@@ -632,6 +636,7 @@ declare module "http" {
|
||||
*/
|
||||
statusMessage?: string;
|
||||
socket: net.Socket;
|
||||
destroy(error?: Error): void;
|
||||
}
|
||||
/**
|
||||
* @deprecated Use IncomingMessage
|
||||
@@ -2397,3 +2402,7 @@ declare module "constants" {
|
||||
export var X_OK: number;
|
||||
export var UV_UDP_REUSEADDR: number;
|
||||
}
|
||||
|
||||
declare module "process" {
|
||||
export = process;
|
||||
}
|
||||
|
||||
@@ -183,6 +183,14 @@ function bufferTests() {
|
||||
var result1 = Buffer.concat([utf8Buffer, base64Buffer]);
|
||||
var result2 = Buffer.concat([utf8Buffer, base64Buffer], 9999999);
|
||||
|
||||
// Class Methods: Buffer.swap16(), Buffer.swa32(), Buffer.swap64()
|
||||
{
|
||||
const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
|
||||
buf.swap16();
|
||||
buf.swap32();
|
||||
buf.swap64();
|
||||
}
|
||||
|
||||
// Class Method: Buffer.from(array)
|
||||
{
|
||||
const buf: Buffer = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);
|
||||
@@ -236,10 +244,21 @@ function bufferTests() {
|
||||
let index: number;
|
||||
index = buffer.indexOf("23");
|
||||
index = buffer.indexOf("23", 1);
|
||||
index = buffer.indexOf("23", 1, "utf8");
|
||||
index = buffer.indexOf(23);
|
||||
index = buffer.indexOf(buffer);
|
||||
}
|
||||
|
||||
{
|
||||
let buffer = new Buffer('123');
|
||||
let index: number;
|
||||
index = buffer.lastIndexOf("23");
|
||||
index = buffer.lastIndexOf("23", 1);
|
||||
index = buffer.lastIndexOf("23", 1, "utf8");
|
||||
index = buffer.lastIndexOf(23);
|
||||
index = buffer.lastIndexOf(buffer);
|
||||
}
|
||||
|
||||
// Imported Buffer from buffer module works properly
|
||||
{
|
||||
let b = new ImportedBuffer('123');
|
||||
@@ -507,9 +526,12 @@ namespace tty_tests {
|
||||
|
||||
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
|
||||
});
|
||||
ds.bind();
|
||||
ds.bind(41234);
|
||||
var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///Querystring tests : https://nodejs.org/api/querystring.html
|
||||
|
||||
Vendored
+15
-3
@@ -485,6 +485,9 @@ interface NodeBuffer extends Uint8Array {
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
swap16(): Buffer;
|
||||
swap32(): Buffer;
|
||||
swap64(): Buffer;
|
||||
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
||||
@@ -500,8 +503,8 @@ interface NodeBuffer extends Uint8Array {
|
||||
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
||||
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
||||
fill(value: any, offset?: number, end?: number): this;
|
||||
// TODO: encoding param
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number): number;
|
||||
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
||||
// TODO: entries
|
||||
// TODO: includes
|
||||
// TODO: keys
|
||||
@@ -670,6 +673,7 @@ declare module "http" {
|
||||
*/
|
||||
statusMessage?: string;
|
||||
socket: net.Socket;
|
||||
destroy(error?: Error): void;
|
||||
}
|
||||
/**
|
||||
* @deprecated Use IncomingMessage
|
||||
@@ -1370,8 +1374,9 @@ declare module "dgram" {
|
||||
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
||||
|
||||
interface Socket extends events.EventEmitter {
|
||||
send(buf: Buffer, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
|
||||
send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
|
||||
bind(port: number, address?: string, callback?: () => void): void;
|
||||
bind(port?: number, address?: string, callback?: () => void): void;
|
||||
close(): void;
|
||||
address(): AddressInfo;
|
||||
setBroadcast(flag: boolean): void;
|
||||
@@ -2166,6 +2171,9 @@ declare module "crypto" {
|
||||
}
|
||||
export function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer
|
||||
export function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer
|
||||
export function getCiphers(): string[];
|
||||
export function getCurves(): string[];
|
||||
export function getHashes(): string[];
|
||||
}
|
||||
|
||||
declare module "stream" {
|
||||
@@ -2617,3 +2625,7 @@ declare module "constants" {
|
||||
export var X_OK: number;
|
||||
export var UV_UDP_REUSEADDR: number;
|
||||
}
|
||||
|
||||
declare module "process" {
|
||||
export = process;
|
||||
}
|
||||
@@ -1,17 +1,79 @@
|
||||
/// <reference path="object-assign.d.ts" />
|
||||
import objectAssign = require("object-assign");
|
||||
|
||||
function assign1() {
|
||||
var result = objectAssign({hello: "world"});
|
||||
return result;
|
||||
interface Target {
|
||||
hellow: string;
|
||||
}
|
||||
|
||||
function assign2() {
|
||||
var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"});
|
||||
return result;
|
||||
interface Source1 {
|
||||
source1: string;
|
||||
}
|
||||
|
||||
function assign3() {
|
||||
var result = objectAssign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"});
|
||||
return result;
|
||||
interface Result extends Target, Source1 {
|
||||
|
||||
}
|
||||
|
||||
interface Source2 {
|
||||
source2: string;
|
||||
}
|
||||
|
||||
interface Result2 extends Result, Source2 {
|
||||
|
||||
}
|
||||
|
||||
interface Source3 {
|
||||
source3: string;
|
||||
}
|
||||
|
||||
interface Result3 extends Result2, Source3 {
|
||||
|
||||
}
|
||||
|
||||
interface Source4 {
|
||||
source4: string;
|
||||
}
|
||||
|
||||
interface Result4 extends Result3, Source4 {
|
||||
|
||||
}
|
||||
|
||||
interface Source5 {
|
||||
source5: string;
|
||||
}
|
||||
|
||||
interface Result5 extends Result4, Source5 {
|
||||
|
||||
}
|
||||
|
||||
function assign1(): Result {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"});
|
||||
}
|
||||
|
||||
function assign2(): Result2 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"});
|
||||
}
|
||||
|
||||
function assign3(): Result3 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"});
|
||||
}
|
||||
|
||||
function assign4(): Result4 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"});
|
||||
}
|
||||
|
||||
function assign5(): Result5 {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"});
|
||||
}
|
||||
|
||||
function assign() {
|
||||
return objectAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}, {
|
||||
hellow: "hellow",
|
||||
source1: "source1",
|
||||
source2: "source2",
|
||||
source3: "source3",
|
||||
source4: "source4",
|
||||
source5: "source5",
|
||||
generic: "any"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
@@ -4,6 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "object-assign" {
|
||||
function objectAssign<T, U>(target: T, source: U): T & U;
|
||||
function objectAssign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
function objectAssign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
function objectAssign<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
|
||||
function objectAssign<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
|
||||
function objectAssign(target: any, ...sources: any[]): any;
|
||||
export = objectAssign;
|
||||
}
|
||||
|
||||
Vendored
+3114
-519
File diff suppressed because it is too large
Load Diff
Vendored
+16
-13
@@ -45,6 +45,9 @@ declare namespace Parse {
|
||||
useMasterKey?: boolean;
|
||||
}
|
||||
|
||||
interface ScopeOptions extends SessionTokenOption, UseMasterKeyOption {
|
||||
}
|
||||
|
||||
interface SilentOption {
|
||||
/**
|
||||
* Set to true to avoid firing the event.
|
||||
@@ -363,15 +366,15 @@ declare namespace Parse {
|
||||
}
|
||||
|
||||
namespace Object {
|
||||
interface DestroyOptions extends SuccessFailureOptions, WaitOption, UseMasterKeyOption { }
|
||||
interface DestroyOptions extends SuccessFailureOptions, WaitOption, ScopeOptions { }
|
||||
|
||||
interface DestroyAllOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface DestroyAllOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
|
||||
interface FetchOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface FetchOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
|
||||
interface SaveOptions extends SuccessFailureOptions, SilentOption, UseMasterKeyOption, WaitOption { }
|
||||
interface SaveOptions extends SuccessFailureOptions, SilentOption, ScopeOptions, WaitOption { }
|
||||
|
||||
interface SaveAllOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface SaveAllOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
|
||||
interface SetOptions extends ErrorOption, SilentOption {
|
||||
promise?: any;
|
||||
@@ -462,10 +465,10 @@ declare namespace Parse {
|
||||
at?: number;
|
||||
}
|
||||
|
||||
interface CreateOptions extends SuccessFailureOptions, WaitOption, SilentOption, UseMasterKeyOption {
|
||||
interface CreateOptions extends SuccessFailureOptions, WaitOption, SilentOption, ScopeOptions {
|
||||
}
|
||||
|
||||
interface FetchOptions extends SuccessFailureOptions, SilentOption, UseMasterKeyOption { }
|
||||
interface FetchOptions extends SuccessFailureOptions, SilentOption, ScopeOptions { }
|
||||
|
||||
interface RemoveOptions extends SilentOption { }
|
||||
|
||||
@@ -623,11 +626,11 @@ declare namespace Parse {
|
||||
}
|
||||
|
||||
namespace Query {
|
||||
interface EachOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface CountOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface FindOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface FirstOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface GetOptions extends SuccessFailureOptions, UseMasterKeyOption { }
|
||||
interface EachOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
interface CountOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
interface FindOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
interface FirstOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
interface GetOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -893,7 +896,7 @@ declare namespace Parse {
|
||||
function run<T>(name: string, data?: any, options?: RunOptions): Promise<T>;
|
||||
function useMasterKey(): void;
|
||||
|
||||
interface RunOptions extends SuccessFailureOptions, UseMasterKeyOption, SessionTokenOption { }
|
||||
interface RunOptions extends SuccessFailureOptions, ScopeOptions { }
|
||||
|
||||
/**
|
||||
* To use this Cloud Module in Cloud Code, you must require 'buffer' in your JavaScript file.
|
||||
|
||||
+30
-7
@@ -1,6 +1,6 @@
|
||||
// Type definitions for parse5 2.1.5
|
||||
// Type definitions for parse5 2.2.0
|
||||
// Project: https://github.com/inikulin/parse5
|
||||
// Definitions by: Nico Jansen <https://github.com/nicojs>
|
||||
// Definitions by: Nico Jansen <https://github.com/nicojs>, Meirion Hughes <https://github.com/MeirionHughes>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="./parse5.d.ts" />
|
||||
@@ -9,33 +9,56 @@ import * as parse5 from 'parse5';
|
||||
|
||||
// parse5.SAXParser()
|
||||
var parser = new parse5.SAXParser({ locationInfo: true });
|
||||
|
||||
var _wasCalled = false;
|
||||
|
||||
parser.on('startTag', (name, attrs, selfClosing, location) => {
|
||||
console.log(name, attrs, selfClosing, location);
|
||||
console.log(attrs[0].name);
|
||||
console.log(attrs[0].prefix);
|
||||
console.log(attrs[0].value);
|
||||
|
||||
if(name == "use")
|
||||
if(attrs[0].prefix === undefined)
|
||||
throw "prefix wasn't defined on known attr"
|
||||
|
||||
_wasCalled = true;
|
||||
});
|
||||
|
||||
parser.on('text', (text, location) => {
|
||||
console.log(text, location);
|
||||
});
|
||||
|
||||
parser.write('some text');
|
||||
parser.write('<svg class="icon"><use xlink:href="icons.svg#some_selector"></use></svg>');
|
||||
|
||||
if(!_wasCalled)
|
||||
throw "parser.on 'startTag' wasn't called";
|
||||
|
||||
// parse5.parse()
|
||||
parse5.parse('html', { locationInfo: true, treeAdapter: parse5.treeAdapters.default });
|
||||
parse5.parse('<html></html>', { locationInfo: true, treeAdapter: parse5.treeAdapters.default });
|
||||
parse5.parse('html', {});
|
||||
parse5.parse('html');
|
||||
parse5.parse('');
|
||||
|
||||
// parse5.ParserStream()
|
||||
var parserStream = new parse5.ParserStream({ locationInfo: true, treeAdapter: parse5.treeAdapters.htmlparser2 });
|
||||
parserStream = new parse5.ParserStream({ });
|
||||
parserStream = new parse5.ParserStream();
|
||||
|
||||
parserStream.write("<html></html>");
|
||||
|
||||
var node = parserStream.document.childNodes[0];
|
||||
|
||||
node.parentNode.attrs = [{name: '', value: ''}];
|
||||
|
||||
// parse5.parseFragment()
|
||||
var fragment = parse5.parseFragment('');
|
||||
fragment = parse5.parseFragment('', {locationInfo: true});
|
||||
var fragment = parse5.parseFragment('<div></div>');
|
||||
fragment = parse5.parseFragment('<div></div>', {locationInfo: true});
|
||||
|
||||
// parse5.ASTNode
|
||||
fragment.quirksMode = true;
|
||||
fragment.namespaceURI = '';
|
||||
fragment.nodeName = '';
|
||||
fragment.value = '';
|
||||
fragment = fragment.parentNode;
|
||||
fragment = fragment.childNodes[0];
|
||||
fragment = fragment.parentNode;
|
||||
|
||||
Vendored
+5
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for parse5 2.1.5
|
||||
// Type definitions for parse5 2.2.0
|
||||
// Project: https://github.com/inikulin/parse5
|
||||
// Definitions by: Nico Jansen <https://github.com/nicojs>
|
||||
// Definitions by: Nico Jansen <https://github.com/nicojs>, Meirion Hughes <https://github.com/MeirionHughes>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
@@ -45,6 +45,7 @@ declare module 'parse5' {
|
||||
export interface ASTAttribute {
|
||||
name: string;
|
||||
value: string;
|
||||
prefix?: string;
|
||||
}
|
||||
|
||||
export interface Attribute {
|
||||
@@ -126,10 +127,10 @@ declare module 'parse5' {
|
||||
/**
|
||||
* Raised when the parser encounters a start tag.
|
||||
* Listener function has 4 parameters:
|
||||
* Tag name, List of attributes in the { key: String, value: String } form, selfClosing boolean
|
||||
* Tag name, List of attributes in the { name: String, value: String, prefix?: String } form, selfClosing boolean
|
||||
* and start tag source code location info. Available if location info is enabled in SAXParserOptions.
|
||||
*/
|
||||
on(event: 'startTag', listener: (name: string, attrs: Attribute[], selfClosing: boolean, location?: StartTagLocationInfo) => void): this;
|
||||
on(event: 'startTag', listener: (name: string, attrs: ASTAttribute[], selfClosing: boolean, location?: StartTagLocationInfo) => void): this;
|
||||
/**
|
||||
* Raised when parser encounters an end tag.
|
||||
* Listener function has 2 parameters:
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
/// <reference path="./passport-local-mongoose.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../passport/passport.d.ts" />
|
||||
/// <reference path="../passport-local/passport-local.d.ts" />
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
|
||||
/**
|
||||
* Created by Linus Brolin <https://github.com/linusbrolin/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Schema,
|
||||
model,
|
||||
PassportLocalDocument,
|
||||
PassportLocalSchema,
|
||||
PassportLocalModel,
|
||||
PassportLocalOptions,
|
||||
PassportLocalErrorMessages
|
||||
} from 'mongoose';
|
||||
import * as passportLocalMongoose from 'passport-local-mongoose';
|
||||
|
||||
import { Router, Request, Response } from 'express';
|
||||
import * as passport from 'passport';
|
||||
import { Strategy as LocalStrategy } from 'passport-local';
|
||||
|
||||
|
||||
//#region Test Models
|
||||
interface User extends PassportLocalDocument {
|
||||
_id: string;
|
||||
username: string;
|
||||
hash: string;
|
||||
salt: string;
|
||||
attempts: number;
|
||||
last: Date;
|
||||
}
|
||||
|
||||
const UserSchema: PassportLocalSchema = <PassportLocalSchema>new Schema({
|
||||
username: String,
|
||||
hash: String,
|
||||
salt: String,
|
||||
attempts: Number,
|
||||
last: Date
|
||||
});
|
||||
|
||||
let options: PassportLocalOptions = <PassportLocalOptions>{};
|
||||
options.iterations = 25000;
|
||||
options.keylen = 512;
|
||||
options.digestAlgorithm = 'sha256';
|
||||
options.interval = 100;
|
||||
options.usernameField = 'username';
|
||||
options.usernameUnique = true;
|
||||
options.usernameLowerCase = true;
|
||||
options.hashField = 'hash';
|
||||
options.saltField = 'salt';
|
||||
options.saltlen = 32;
|
||||
options.attemptsField = 'attempts';
|
||||
options.lastLoginField = 'last';
|
||||
options.selectFields = 'undefined';
|
||||
options.populateFields = 'undefined';
|
||||
options.encoding = 'hex';
|
||||
options.limitAttempts = false;
|
||||
options.maxAttempts = Infinity;
|
||||
options.passwordValidator = function(password: string, cb: (err: any) => void): void {};
|
||||
options.usernameQueryFields = [];
|
||||
|
||||
let errorMessages: PassportLocalErrorMessages = {};
|
||||
errorMessages.MissingPasswordError = 'No password was given';
|
||||
errorMessages.AttemptTooSoonError = 'Account is currently locked. Try again later';
|
||||
errorMessages.TooManyAttemptsError = 'Account locked due to too many failed login attempts';
|
||||
errorMessages.NoSaltValueStoredError = 'Authentication not possible. No salt value stored';
|
||||
errorMessages.IncorrectPasswordError = 'Password or username are incorrect';
|
||||
errorMessages.IncorrectUsernameError = 'Password or username are incorrect';
|
||||
errorMessages.MissingUsernameError = 'No username was given';
|
||||
errorMessages.UserExistsError = 'A user with the given username is already registered';
|
||||
|
||||
options.errorMessages = errorMessages;
|
||||
|
||||
UserSchema.plugin(passportLocalMongoose, options);
|
||||
|
||||
type UserModel<T extends PassportLocalDocument> = _UserModel<T> & PassportLocalModel<T>;
|
||||
interface _UserModel<T extends PassportLocalDocument> {}
|
||||
|
||||
let UserModel: UserModel<User> = model<User>('User', UserSchema) as UserModel<User>;
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Test Passport/Passport-Local
|
||||
passport.use(UserModel.createStrategy());
|
||||
|
||||
passport.use('login', new LocalStrategy({
|
||||
passReqToCallback: true,
|
||||
usernameField: 'username',
|
||||
passwordField: 'password'
|
||||
},
|
||||
(req: any, username: string, password: string, done: (err: any, res: any, msg?: any) => void) => {
|
||||
process.nextTick(() => {
|
||||
UserModel
|
||||
.findOne({ 'username': username })
|
||||
.exec((err: any, user: model<User>) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return done(err, null);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
console.log(errorMessages.IncorrectUsernameError);
|
||||
return done(null, false, errorMessages.IncorrectUsernameError);
|
||||
}
|
||||
|
||||
user.authenticate(password, function(autherr: any, authuser: User, autherrmsg: any) {
|
||||
if (autherr) {
|
||||
console.log(autherr);
|
||||
return done(autherr, null);
|
||||
}
|
||||
|
||||
if (!authuser) {
|
||||
console.log(errorMessages.IncorrectPasswordError);
|
||||
return done(null, false, errorMessages.IncorrectPasswordError);
|
||||
}
|
||||
|
||||
return done(null, authuser);
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
passport.serializeUser(UserModel.serializeUser());
|
||||
passport.deserializeUser(UserModel.deserializeUser());
|
||||
|
||||
let router: Router = Router();
|
||||
|
||||
router.post('/login', passport.authenticate('local'), function(req: Request, res: Response) {
|
||||
res.redirect('/');
|
||||
});
|
||||
//#endregion
|
||||
@@ -0,0 +1,91 @@
|
||||
// Type definitions for passport-local-mongoose 4.0.0
|
||||
// Project: https://github.com/saintedlama/passport-local-mongoose
|
||||
// Definitions by: Linus Brolin <https://github.com/linusbrolin/>, simonxca <https://github.com/simonxca/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../mongoose/mongoose.d.ts" />
|
||||
/// <reference path="../passport-local/passport-local.d.ts" />
|
||||
|
||||
declare module 'mongoose' {
|
||||
import passportLocal = require('passport-local');
|
||||
|
||||
// methods
|
||||
export interface PassportLocalDocument {
|
||||
setPassword(password: string, cb: (err: any, res: any) => void): void;
|
||||
authenticate(password: string, cb: (err: any, res: any, error: any) => void): void;
|
||||
}
|
||||
|
||||
// statics
|
||||
export type PassportLocalModel<T extends PassportLocalDocument> = _PassportLocalModel<T> & Model<T>;
|
||||
interface _PassportLocalModel<T extends PassportLocalDocument> {
|
||||
authenticate(): (username: string, password: string, cb: (err: any, res: T, error: any) => void) => void;
|
||||
serializeUser(): (user: PassportLocalModel<T>, cb: (err: any) => void) => void;
|
||||
deserializeUser(): (username: string, cb: (err: any) => void) => void;
|
||||
register(user: PassportLocalModel<T>, password: string, cb: (err: any) => void): void;
|
||||
findByUsername(username: string, selectHashSaltFields: boolean, cb: (err: any) => void): any;
|
||||
createStrategy(): passportLocal.Strategy;
|
||||
}
|
||||
|
||||
// error messages
|
||||
export interface PassportLocalErrorMessages {
|
||||
MissingPasswordError?: string;
|
||||
AttemptTooSoonError?: string;
|
||||
TooManyAttemptsError?: string;
|
||||
NoSaltValueStoredError?: string;
|
||||
IncorrectPasswordError?: string;
|
||||
IncorrectUsernameError?: string;
|
||||
MissingUsernameError?: string;
|
||||
UserExistsError?: string;
|
||||
}
|
||||
|
||||
// plugin options
|
||||
export interface PassportLocalOptions {
|
||||
saltlen?: number;
|
||||
iterations?: number;
|
||||
keylen?: number;
|
||||
encoding?: string;
|
||||
digestAlgorithm?: string;
|
||||
passwordValidator?: (password: string, cb: (err: any) => void) => void;
|
||||
|
||||
usernameField?: string;
|
||||
usernameUnique?: boolean;
|
||||
|
||||
usernameQueryFields: Array<string>;
|
||||
|
||||
selectFields?: string;
|
||||
populateFields?: string;
|
||||
|
||||
usernameLowerCase?: boolean;
|
||||
|
||||
hashField?: string;
|
||||
saltField?: string;
|
||||
|
||||
limitAttempts?: boolean;
|
||||
lastLoginField?: string;
|
||||
attemptsField?: string;
|
||||
interval?: number;
|
||||
maxInterval?: number;
|
||||
maxAttempts?: number;
|
||||
|
||||
errorMessages?: PassportLocalErrorMessages;
|
||||
}
|
||||
|
||||
export interface PassportLocalSchema extends Schema {
|
||||
plugin(
|
||||
plugin: (schema: PassportLocalSchema, options?: PassportLocalOptions) => void,
|
||||
options?: PassportLocalOptions
|
||||
): this;
|
||||
}
|
||||
|
||||
export function model<T extends PassportLocalDocument, Statics>(
|
||||
name: string,
|
||||
schema?: PassportLocalSchema,
|
||||
collection?: string,
|
||||
skipInit?: boolean): Statics & PassportLocalModel<T>;
|
||||
}
|
||||
|
||||
declare module 'passport-local-mongoose' {
|
||||
import mongoose = require('mongoose');
|
||||
var _: (schema: mongoose.Schema, options?: Object) => void;
|
||||
export = _;
|
||||
}
|
||||
@@ -25,6 +25,16 @@ function renderPage(pageNum: number) {
|
||||
var context = canvas.getContext('2d');
|
||||
canvas.height = viewport.height;
|
||||
canvas.width = viewport.width;
|
||||
|
||||
//
|
||||
// test viewport conversion methods
|
||||
// convertToViewportRectangle and normalizeRect are used in the acroforms example:
|
||||
// https://github.com/mozilla/pdf.js/blob/master/examples/acroforms/forms.js
|
||||
//
|
||||
const rect = viewport.convertToViewportRectangle([100,100,0,0]);
|
||||
const normalizedRect = PDFJS.Util.normalizeRect(rect);
|
||||
const point = viewport.convertToViewportPoint(100, 100);
|
||||
const pdfPoint = viewport.convertToPdfPoint(100, 100);
|
||||
|
||||
//
|
||||
// Render PDF page into canvas context
|
||||
|
||||
Vendored
+18
-3
@@ -156,9 +156,9 @@ interface PDFPageViewport {
|
||||
transforms: number[];
|
||||
|
||||
clone(options: PDFPageViewportOptions): PDFPageViewport;
|
||||
convertToViewportPoint(): number[]; // [x, y]
|
||||
convertToViewportRectangle(): number[]; // [x1, y1, x2, y2]
|
||||
convertToPdfPoint(): number[]; // [x, y]
|
||||
convertToViewportPoint(x: number, y: number): number[]; // [x, y]
|
||||
convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2]
|
||||
convertToPdfPoint(x: number, y: number): number[]; // [x, y]
|
||||
}
|
||||
|
||||
interface PDFAnnotationData {
|
||||
@@ -300,6 +300,19 @@ interface PDFObjects {
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
interface PDFJSUtilStatic {
|
||||
/**
|
||||
* Normalize rectangle so that (x1,y1) < (x2,y2)
|
||||
* @param {number[]} rect - the rectangle with [x1,y1,x2,y2]
|
||||
*
|
||||
* For coordinate systems whose origin lies in the bottom-left, this
|
||||
* means normalization to (BL,TR) ordering. For systems with origin in the
|
||||
* top-left, this means (TL,BR) ordering.
|
||||
**/
|
||||
normalizeRect(rect:number[]): number[];
|
||||
}
|
||||
|
||||
|
||||
interface PDFJSStatic {
|
||||
|
||||
/**
|
||||
@@ -424,6 +437,8 @@ interface PDFJSStatic {
|
||||
*/
|
||||
isEvalSupported: boolean;
|
||||
|
||||
Util: PDFJSUtilStatic;
|
||||
|
||||
/**
|
||||
* This is the main entry point for loading a PDF and interacting with it.
|
||||
* NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)
|
||||
|
||||
Vendored
+1
@@ -1456,6 +1456,7 @@ declare namespace PIXI {
|
||||
global: Point;
|
||||
target: DisplayObject;
|
||||
originalEvent: Event;
|
||||
identifier: number;
|
||||
|
||||
getLocalPosition(displayObject: DisplayObject, point?: Point, globalPos?: Point): Point;
|
||||
|
||||
|
||||
@@ -38,6 +38,16 @@ namespace PouchDBCoreTests {
|
||||
});
|
||||
}
|
||||
|
||||
function testCompact() {
|
||||
const db = new PouchDB<{}>();
|
||||
// Promise version
|
||||
db.compact().then( (res: PouchDB.Core.Response) => {});
|
||||
// Promise version with optional options
|
||||
db.compact({interval: 300}).then( (res: PouchDB.Core.Response) => {});
|
||||
// Options with a callback
|
||||
db.compact({interval: 300}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testDestroy() {
|
||||
const db = new PouchDB<{}>();
|
||||
|
||||
@@ -75,4 +85,31 @@ namespace PouchDBCoreTests {
|
||||
db.info({ ajax: { cache: true }}, (error, result) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testRemove() {
|
||||
type MyModel = { rev: 'rev', property: 'someProperty '};
|
||||
let model: PouchDB.Core.Document<MyModel>;
|
||||
const id = 'model';
|
||||
const rev = 'rev';
|
||||
|
||||
const db = new PouchDB<MyModel>();
|
||||
|
||||
// Promise version with doc
|
||||
db.remove(model).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with doc and options
|
||||
db.remove(model, {}).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with docId and rev
|
||||
db.remove(id, rev).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with docId and rev and options
|
||||
db.remove(id, rev, {}).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Callback version with doc
|
||||
db.remove(model, {}, (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Callback version with docId and rev
|
||||
db.remove(id, rev, {}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+23
@@ -164,6 +164,10 @@ declare namespace PouchDB {
|
||||
interface PostOptions extends PutOptions {
|
||||
}
|
||||
|
||||
interface CompactOptions extends Core.Options {
|
||||
interval?: number;
|
||||
}
|
||||
|
||||
interface InfoOptions extends Options {
|
||||
}
|
||||
}
|
||||
@@ -264,6 +268,11 @@ declare namespace PouchDB {
|
||||
allDocs(options?: Core.AllDocsOptions):
|
||||
Promise<Core.AllDocsResponse<Content>>;
|
||||
|
||||
/** Compact the database */
|
||||
compact(options?: Core.CompactOptions): Promise<Core.Response>;
|
||||
compact(options: Core.CompactOptions,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
|
||||
/** Destroy the database */
|
||||
destroy(options: Core.DestroyOptions | void,
|
||||
callback: Core.AnyCallback): void;
|
||||
@@ -319,6 +328,20 @@ declare namespace PouchDB {
|
||||
revision?: Core.RevisionId,
|
||||
options?: Core.PutOptions): Promise<Core.Response>;
|
||||
|
||||
/** Remove a doc from the database */
|
||||
remove(doc: Core.Document<Content>,
|
||||
options: Core.Options,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
remove(docId: Core.DocumentId,
|
||||
revision: Core.RevisionId,
|
||||
options: Core.Options,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
remove(doc: Core.Document<Content>,
|
||||
options?: Core.Options): Promise<Core.Response>;
|
||||
remove(docId: Core.DocumentId,
|
||||
revision: Core.RevisionId,
|
||||
options?: Core.Options): Promise<Core.Response>;
|
||||
|
||||
/** Get database information */
|
||||
info(options: Core.InfoOptions | void,
|
||||
callback: Core.Callback<any, Core.DatabaseInfo>): void;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/// <reference path="./pouchdb-upsert.d.ts" />
|
||||
|
||||
import * as pouchdbUpsert from 'pouchdb-upsert';
|
||||
PouchDB.plugin(pouchdbUpsert);
|
||||
|
||||
namespace PouchDBUpsertTests {
|
||||
type UpsertDocModel = { _id: 'test-doc1', name: 'test' };
|
||||
let docToUpsert: PouchDB.Core.Document<UpsertDocModel>;
|
||||
const db = new PouchDB<UpsertDocModel>();
|
||||
|
||||
function testUpsert_WithPromise_AndReturnDoc() {
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return doc;
|
||||
}).then((res: PouchDB.Core.Response) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testUpsert_WithPromise_AndReturnBoolean() {
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return false;
|
||||
}).then((res: PouchDB.Core.Response) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testUpsert_WithCallback_AndReturnDoc() {
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return doc;
|
||||
}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testUpsert_WithCallback_AndReturnBoolean() {
|
||||
// callback return boolean
|
||||
db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document<UpsertDocModel>) => {
|
||||
// Make some updates....
|
||||
return false;
|
||||
}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testPutIfNotExists_WithPromise() {
|
||||
db.putIfNotExists(docToUpsert).then( (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testPutIfNotExists_WithCallback() {
|
||||
db.putIfNotExists(docToUpsert, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
}
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for pouchdb-upsert v2.0.1
|
||||
// Project: https://github.com/pouchdb/upsert
|
||||
// Definitions by: Keith D. Moore <https://github.com/keithdmoore>, Andrew Mitchell <https://github.com/hotforfeature>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../pouchdb-core/pouchdb-core.d.ts" />
|
||||
|
||||
declare namespace PouchDB {
|
||||
|
||||
interface Database<Content extends Core.Encodable> {
|
||||
/**
|
||||
* Perform an upsert (update or insert) operation. Returns a Promise.
|
||||
*
|
||||
* @param docId - the _id of the document.
|
||||
* @param diffFun - function that takes the existing doc as input and returns an updated doc.
|
||||
* If this diffFunc returns falsey, then the update won't be performed (as an optimization).
|
||||
* If the document does not already exist, then {} will be the input to diffFunc.
|
||||
*
|
||||
*/
|
||||
upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback<Content>): Promise<Core.Response>;
|
||||
|
||||
/**
|
||||
* Perform an upsert (update or insert) operation. If a callback is not provided, the Promise based version
|
||||
* of this function will be called.
|
||||
*
|
||||
* @param docId - the _id of the document.
|
||||
* @param diffFun - function that takes the existing doc as input and returns an updated doc.
|
||||
* If this diffFunc returns falsey, then the update won't be performed (as an optimization).
|
||||
* If the document does not already exist, then {} will be the input to diffFunc.
|
||||
* @param callback - called with the results after operation is completed.
|
||||
*/
|
||||
upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback<Content>,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
|
||||
/**
|
||||
* Put a new document with the given docId, if it doesn't already exist. Returns a Promise.
|
||||
*
|
||||
* @param doc - the document to insert. Should contain an _id if docId is not specified
|
||||
* If the document already exists, then the Promise will just resolve immediately.
|
||||
*/
|
||||
putIfNotExists(doc: Core.Document<Content>): Promise<Core.Response>;
|
||||
|
||||
//
|
||||
/**
|
||||
* Put a new document with the given docId, if it doesn't already exist. If a callback is not provided,
|
||||
* the Promise based version of this function will be called.
|
||||
*
|
||||
* @param doc - the document to insert. Should contain an _id if docId is not specified
|
||||
* If the document already exists, then the Promise will just resolve immediately.
|
||||
* @param callback - called with the results after operation is completed.
|
||||
* If you don't specify a callback, then the Promise version of this function will be invoked and it
|
||||
* will return a Promise.
|
||||
*/
|
||||
putIfNotExists(doc: Core.Document<Content>,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
}
|
||||
|
||||
interface UpsertDiffCallback<Content extends Core.Encodable> {
|
||||
(doc: Core.Document<Content>): Core.Document<Content>|boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'pouchdb-upsert' {
|
||||
const plugin: PouchDB.Plugin;
|
||||
export = plugin;
|
||||
}
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ declare module "pusher-js" {
|
||||
config: Config; //TODO: add GlobalConfig typings
|
||||
channels: any; //TODO: Type this
|
||||
global_emitter: EventsDispatcher;
|
||||
sessionId: number;
|
||||
sessionID: number;
|
||||
timeline: any; //TODO: Type this
|
||||
connection: ConnectionManager;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+1807
File diff suppressed because it is too large
Load Diff
Vendored
+13
-9
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Raven.js
|
||||
// Project: https://github.com/getsentry/raven-js
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, Benjamin Pannell <http://github.com/spartan563>
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, Benjamin Pannell <http://github.com/spartan563>, Gary Blackwood <http://github.com/Garee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var Raven: RavenStatic;
|
||||
@@ -10,15 +10,15 @@ declare module 'raven-js' {
|
||||
}
|
||||
|
||||
interface RavenOptions {
|
||||
/** The log level associated with this event. Default: error */
|
||||
level?: string;
|
||||
|
||||
/** The name of the logger used by Sentry. Default: javascript */
|
||||
logger?: string;
|
||||
|
||||
/** The release version of the application you are monitoring with Sentry */
|
||||
release?: string;
|
||||
|
||||
/** The environment in which the application is running. */
|
||||
environment?: string;
|
||||
|
||||
/** The name of the server or device that the client is running on */
|
||||
serverName?: string;
|
||||
|
||||
@@ -39,11 +39,6 @@ interface RavenOptions {
|
||||
[id: string]: string;
|
||||
};
|
||||
|
||||
extra?: any;
|
||||
|
||||
/** In some cases you may see issues where Sentry groups multiple events together when they should be separate entities. In other cases, Sentry simply doesn’t group events together because they’re so sporadic that they never look the same. */
|
||||
fingerprint?: string[];
|
||||
|
||||
/** A function which allows mutation of the data payload right before being sent to Sentry */
|
||||
dataCallback?: (data: any) => any;
|
||||
|
||||
@@ -53,8 +48,17 @@ interface RavenOptions {
|
||||
/** By default, Raven does not truncate messages. If you need to truncate characters for whatever reason, you may set this to limit the length. */
|
||||
maxMessageLength?: number;
|
||||
|
||||
/** Enables/disables automatic collection of breadcrumbs. Default: true. */
|
||||
autoBreadcrumbs?: any;
|
||||
|
||||
/** The max number of breadcrumb captures. Default: 100. */
|
||||
maxBreadcrumbs?: number;
|
||||
|
||||
/** Override the default HTTP data transport handler. */
|
||||
transport?: (options: RavenTransportOptions) => void;
|
||||
|
||||
/** Allow the use of a Sentry DSN with a private key. Default: false. */
|
||||
allowSecretKey?: boolean;
|
||||
}
|
||||
|
||||
interface RavenStatic {
|
||||
|
||||
Vendored
+3
-3
@@ -47,16 +47,16 @@ declare module __ReactDnd {
|
||||
spec: DropTargetSpec<P>,
|
||||
collect: DropTargetCollector,
|
||||
options?: DndOptions<P>
|
||||
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
|
||||
): (componentClass: React.ComponentClass<P> | React.StatelessComponent<P>) => DndComponentClass<P>;
|
||||
|
||||
export function DragDropContext<P>(
|
||||
backend: Backend
|
||||
): (componentClass: React.ComponentClass<P>) => ContextComponentClass<P>;
|
||||
): <P>(componentClass: React.ComponentClass<P> | React.StatelessComponent<P>) => ContextComponentClass<P>;
|
||||
|
||||
export function DragLayer<P>(
|
||||
collect: DragLayerCollector,
|
||||
options?: DndOptions<P>
|
||||
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
|
||||
): (componentClass: React.ComponentClass<P> | React.StatelessComponent<P>) => DndComponentClass<P>;
|
||||
|
||||
type DragSourceCollector = (connect: DragSourceConnector, monitor: DragSourceMonitor) => Object;
|
||||
type DropTargetCollector = (connect: DropTargetConnector, monitor: DropTargetMonitor) => Object;
|
||||
|
||||
@@ -19,6 +19,8 @@ class Test extends React.Component<any, any> {
|
||||
style={{ borderStyle: "dashed" }}
|
||||
activeStyle={{ borderStyle: "dotted" }}
|
||||
className="regular"
|
||||
minSize={2000}
|
||||
maxSize={Infinity}
|
||||
activeClassName="active"
|
||||
rejectClassName="reject"
|
||||
disableClick={true}
|
||||
|
||||
Vendored
+8
@@ -22,6 +22,14 @@ declare namespace ReactDropzone {
|
||||
* Clicking the <Dropzone> brings up the browser file picker. To disable, set to true.
|
||||
*/
|
||||
disableClick?: boolean;
|
||||
/**
|
||||
* Min file size accepted
|
||||
*/
|
||||
minSize?: number;
|
||||
/**
|
||||
* Max file size accepted
|
||||
*/
|
||||
maxSize?: number;
|
||||
/**
|
||||
* To accept only a single file, set this to false.
|
||||
*/
|
||||
|
||||
Vendored
+4
-3
@@ -7,9 +7,10 @@
|
||||
|
||||
declare namespace ReactHelmet {
|
||||
import React = __React;
|
||||
|
||||
|
||||
interface HelmetProps {
|
||||
base?: any;
|
||||
defaultTitle?: string;
|
||||
htmlAttributes?: any;
|
||||
link?: Array<any>;
|
||||
meta?: Array<any>;
|
||||
@@ -27,7 +28,7 @@ declare namespace ReactHelmet {
|
||||
script: HelmetDatum;
|
||||
title: HelmetDatum;
|
||||
}
|
||||
|
||||
|
||||
interface HelmetDatum {
|
||||
toString(): string;
|
||||
toComponent(): React.Component<any, any>;
|
||||
@@ -41,6 +42,6 @@ declare module "react-helmet" {
|
||||
(): ReactHelmet.HelmetComponent
|
||||
rewind(): ReactHelmet.HelmetData
|
||||
}
|
||||
|
||||
|
||||
export = Helmet;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ declare namespace NotificationSystem {
|
||||
noAnimation?: boolean;
|
||||
ref?: string;
|
||||
style?: Style | boolean;
|
||||
allowHTML?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,8 +233,8 @@ connect(mapStateToProps3)(TodoApp);
|
||||
// return { todos: state.todos };
|
||||
//}
|
||||
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState {
|
||||
return objectAssign({}, ownProps, {
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps {
|
||||
return objectAssign({}, ownProps, dispatchProps, {
|
||||
todos: stateProps.todos[ownProps.userId],
|
||||
addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text)
|
||||
});
|
||||
|
||||
@@ -268,8 +268,8 @@ connect(mapStateToProps3)(TodoApp);
|
||||
// return { todos: state.todos };
|
||||
//}
|
||||
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState {
|
||||
return objectAssign({}, ownProps, {
|
||||
function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProps: TodoProps): DispatchProps & TodoState & TodoProps {
|
||||
return objectAssign({}, ownProps, dispatchProps, {
|
||||
todos: stateProps.todos[ownProps.userId],
|
||||
addTodo: (text: string) => dispatchProps.addTodo(ownProps.userId, text)
|
||||
});
|
||||
|
||||
Vendored
+2
@@ -21,6 +21,8 @@ declare namespace ReactTabs {
|
||||
|
||||
interface TabListProps {
|
||||
className?: string;
|
||||
activeTabClassName?: string;
|
||||
disabledTabClassName?: string;
|
||||
}
|
||||
|
||||
interface TabList extends __React.ComponentClass<TabListProps> {}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="react.d.ts" />
|
||||
import React = require("react");
|
||||
|
||||
interface SCProps {
|
||||
foo?: number;
|
||||
}
|
||||
|
||||
var StatelessComponent: React.SFC<SCProps> = ({ foo }: SCProps) => {
|
||||
return <div>{ foo }</div>;
|
||||
};
|
||||
StatelessComponent.displayName = "StatelessComponent3";
|
||||
StatelessComponent.defaultProps = {
|
||||
foo: 42
|
||||
};
|
||||
|
||||
<StatelessComponent />;
|
||||
Vendored
+3
-1
@@ -197,7 +197,7 @@ declare namespace __React {
|
||||
|
||||
type SFC<P> = StatelessComponent<P>;
|
||||
interface StatelessComponent<P> {
|
||||
(props?: P, context?: any): ReactElement<any>;
|
||||
(props: P, context?: any): ReactElement<any>;
|
||||
propTypes?: ValidationMap<P>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
defaultProps?: P;
|
||||
@@ -276,7 +276,9 @@ declare namespace __React {
|
||||
isTrusted: boolean;
|
||||
nativeEvent: Event;
|
||||
preventDefault(): void;
|
||||
isDefaultPrevented(): boolean;
|
||||
stopPropagation(): void;
|
||||
isPropagationStopped(): boolean;
|
||||
persist(): void;
|
||||
target: EventTarget;
|
||||
timeStamp: Date;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
/// <reference path="redis-rate-limiter.d.ts" />
|
||||
|
||||
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);
|
||||
+44
@@ -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 <https://github.com/westy92>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
/// <reference path="redis-scripto.d.ts" />
|
||||
|
||||
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) {
|
||||
|
||||
});
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for redis-scripto 0.1.3
|
||||
// Project: https://github.com/arunoda/node-redis-scripto
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
Vendored
+3
-1
@@ -109,7 +109,7 @@ declare module "redis" {
|
||||
"lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore",
|
||||
"sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore",
|
||||
"zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx",
|
||||
"hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx",
|
||||
"hget", "hmset", "hmget", "hincrby", "hincrbyfloat", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx",
|
||||
"randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave",
|
||||
"bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl",
|
||||
"persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster",
|
||||
@@ -254,6 +254,8 @@ declare module "redis" {
|
||||
hmget(...args:any[]): boolean;
|
||||
hincrby(args:any[], callback?:ResCallbackT<any>): boolean;
|
||||
hincrby(...args:any[]): boolean;
|
||||
hincrbyfloat(args:any[], callback?:ResCallbackT<any>): boolean;
|
||||
hincrbyfloat(...args:any[]): boolean;
|
||||
hdel(args:any[], callback?:ResCallbackT<any>): boolean;
|
||||
hdel(...args:any[]): boolean;
|
||||
hlen(args:any[], callback?:ResCallbackT<any>): boolean;
|
||||
|
||||
@@ -33,14 +33,28 @@ rest.post("http://user:pass@service.com/action", {
|
||||
}
|
||||
});
|
||||
|
||||
// post JSON
|
||||
// post JSON with no options
|
||||
var jsonData = { id: 334 };
|
||||
rest.postJson("http://example.com/action", jsonData).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
// put JSON
|
||||
// put JSON with no options
|
||||
var jsonData = { id: 334 };
|
||||
rest.putJson("http://example.com/action", jsonData).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
// post JSON with options
|
||||
var jsonData = { id: 334 };
|
||||
var options = { query: {"api-version": "1.0"}};
|
||||
rest.postJson("http://example.com/action", jsonData, options).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
// put JSON with options
|
||||
var jsonData = { id: 334 };
|
||||
var options = { query: {"api-version": "1.0"}};
|
||||
rest.putJson("http://example.com/action", jsonData, options).on("complete", function(data, response) {
|
||||
// handle response
|
||||
});
|
||||
|
||||
Vendored
+8
-4
@@ -40,10 +40,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via GET method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
json(url: string, options?: RestlerOptions): RestlerResult;
|
||||
json(url: string, data?: any, options?: RestlerOptions, method?: string): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a PATCH request.
|
||||
@@ -56,10 +57,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via PATCH method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
patchJson(url: string, options?: RestlerOptions): RestlerResult;
|
||||
patchJson(url: string, data?: any, options?: RestlerOptions): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a POST request.
|
||||
@@ -72,10 +74,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via POST method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
postJson(url: string, options?: RestlerOptions): RestlerResult;
|
||||
postJson(url: string, data?: any, options?: RestlerOptions): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a PUT request.
|
||||
@@ -88,10 +91,11 @@ declare module "restler" {
|
||||
/**
|
||||
* Send json data via PUT method.
|
||||
* @param {string} url A url address.
|
||||
* @param {any} data JSON body
|
||||
* @param {RestlerOptions} options Options.
|
||||
* @return {RestlerResult} Result.
|
||||
*/
|
||||
putJson(url: string, options?: RestlerOptions): RestlerResult;
|
||||
putJson(url: string, data?: any, options?: RestlerOptions): RestlerResult;
|
||||
|
||||
/**
|
||||
* Create a PUT request.
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path="./set-cookie-parser.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import * as assert from "assert";
|
||||
import * as http from "http";
|
||||
import * as setCookie from "set-cookie-parser";
|
||||
|
||||
// Call parse function on imported object
|
||||
var input = "foo=bar;";
|
||||
var cookies = setCookie.parse(input);
|
||||
assert.equal(cookies.length, 1);
|
||||
assert.equal(cookies[0].name, "foo");
|
||||
assert.equal(cookies[0].value, "bar");
|
||||
|
||||
// Required properties only test
|
||||
var requiredOnly = "foo=bar;";
|
||||
cookies = setCookie(requiredOnly);
|
||||
assert.equal(cookies.length, 1);
|
||||
assert.equal(cookies[0].name, "foo");
|
||||
assert.equal(cookies[0].value, "bar");
|
||||
|
||||
// Optional properties included test
|
||||
var optionalIncluded = "foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure";
|
||||
cookies = setCookie(optionalIncluded);
|
||||
assert.equal(cookies.length, 1);
|
||||
assert.equal(cookies[0].name, "foo");
|
||||
assert.equal(cookies[0].value, "bar");
|
||||
assert.equal(cookies[0].domain, ".example.com");
|
||||
assert.equal(cookies[0].path, "/");
|
||||
assert.deepEqual(cookies[0].expires, new Date('Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)'));
|
||||
assert.equal(cookies[0].maxAge, 1000);
|
||||
assert.equal(cookies[0].httpOnly, true);
|
||||
assert.equal(cookies[0].secure, true);
|
||||
|
||||
// Array of strings test
|
||||
var arrayOfCookies = ["bam=baz", "foo=bar"];
|
||||
cookies = setCookie(arrayOfCookies);
|
||||
assert.equal(cookies.length, 2);
|
||||
assert.equal(cookies[0].name, "bam");
|
||||
assert.equal(cookies[0].value, "baz");
|
||||
assert.equal(cookies[1].name, "foo");
|
||||
assert.equal(cookies[1].value, "bar");
|
||||
|
||||
// HTTP response message test
|
||||
var message = <http.IncomingMessage>{};
|
||||
message.headers = { "set-cookie": ["bam=baz", "foo=bar"] };
|
||||
cookies = setCookie(message);
|
||||
assert.equal(cookies.length, 2);
|
||||
assert.equal(cookies[0].name, "bam");
|
||||
assert.equal(cookies[0].value, "baz");
|
||||
assert.equal(cookies[1].name, "foo");
|
||||
assert.equal(cookies[1].value, "bar");
|
||||
|
||||
// Create new cookie with only required properties
|
||||
var requiredOnlyCookie: setCookie.Cookie = {
|
||||
name: "Foo",
|
||||
value: "Bar"
|
||||
}
|
||||
|
||||
// Create new cookie with all properties included optional ones
|
||||
var optionalIncludedCookie: setCookie.Cookie = {
|
||||
name: "Bam",
|
||||
value: "Baz",
|
||||
domain: ".example.com",
|
||||
path: "/",
|
||||
expires: new Date("Tue Jul 01 2025 06:01:11 GMT-0400 (EDT)"),
|
||||
maxAge: 1000,
|
||||
httpOnly: true,
|
||||
secure: true
|
||||
};
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for set-cookie-parser
|
||||
// Project: https://github.com/nfriedly/set-cookie-parser
|
||||
// Definitions by: Nick Paddock <https://github.com/nickp10>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "set-cookie-parser" {
|
||||
import http = require("http");
|
||||
|
||||
function SetCookieParser(input: string | string[] | http.IncomingMessage): SetCookieParser.Cookie[];
|
||||
|
||||
namespace SetCookieParser {
|
||||
function parse(input: string | string[] | http.IncomingMessage): Cookie[];
|
||||
|
||||
interface Cookie {
|
||||
name: string;
|
||||
value: string;
|
||||
path?: string;
|
||||
expires?: Date;
|
||||
maxAge?: number;
|
||||
domain?: string;
|
||||
secure?: boolean;
|
||||
httpOnly?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = SetCookieParser;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/// <reference path="simple-assign.d.ts" />
|
||||
import simpleAssign = require("simple-assign");
|
||||
|
||||
interface Target {
|
||||
hellow: string;
|
||||
}
|
||||
|
||||
interface Source1 {
|
||||
source1: string;
|
||||
}
|
||||
|
||||
interface Result extends Target, Source1 {
|
||||
|
||||
}
|
||||
|
||||
interface Source2 {
|
||||
source2: string;
|
||||
}
|
||||
|
||||
interface Result2 extends Result, Source2 {
|
||||
|
||||
}
|
||||
|
||||
interface Source3 {
|
||||
source3: string;
|
||||
}
|
||||
|
||||
interface Result3 extends Result2, Source3 {
|
||||
|
||||
}
|
||||
|
||||
interface Source4 {
|
||||
source4: string;
|
||||
}
|
||||
|
||||
interface Result4 extends Result3, Source4 {
|
||||
|
||||
}
|
||||
|
||||
interface Source5 {
|
||||
source5: string;
|
||||
}
|
||||
|
||||
interface Result5 extends Result4, Source5 {
|
||||
|
||||
}
|
||||
|
||||
function assign1(): Result {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"});
|
||||
}
|
||||
|
||||
function assign2(): Result2 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"});
|
||||
}
|
||||
|
||||
function assign3(): Result3 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"});
|
||||
}
|
||||
|
||||
function assign4(): Result4 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"});
|
||||
}
|
||||
|
||||
function assign5(): Result5 {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"});
|
||||
}
|
||||
|
||||
function assign() {
|
||||
return simpleAssign({hellow: "world"}, {source1: "U"}, {source2: "V"}, {source3: "W"}, {source4: "Q"}, {source5: "R"}, {
|
||||
hellow: "hellow",
|
||||
source1: "source1",
|
||||
source2: "source2",
|
||||
source3: "source3",
|
||||
source4: "source4",
|
||||
source5: "source5",
|
||||
generic: "any"
|
||||
});
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for simple-assign 0.1.0
|
||||
// Project: https://github.com/newoga/simple-assign
|
||||
// Definitions by: Ivo Stratev <https://github.com/NoHomey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "simple-assign" {
|
||||
function simpleAssign<T, U>(target: T, source: U): T & U;
|
||||
function simpleAssign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
|
||||
function simpleAssign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
|
||||
function simpleAssign<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
|
||||
function simpleAssign<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
|
||||
function simpleAssign(target: any, ...sources: any[]): any;
|
||||
export = simpleAssign;
|
||||
}
|
||||
@@ -155,8 +155,6 @@ grid.getCellCssStyles("test")[0]["number_column"];
|
||||
|
||||
grid.getCellEditor();
|
||||
|
||||
grid.getCellFromEvent(new Slick.Event());
|
||||
|
||||
grid.getCellFromPoint(5, 10);
|
||||
|
||||
grid.getCellNode(5, 10);
|
||||
@@ -210,3 +208,8 @@ columns.forEach(column => {
|
||||
grid.onSort.subscribe((e, args) => {
|
||||
var sortCol:string = args.sortCols[0].sortCol.field;
|
||||
});
|
||||
|
||||
grid.onMouseEnter.subscribe((e: DOMEvent, args: Slick.OnMouseEnterEventArgs<MyData>) => {
|
||||
let cell: Slick.Cell = args.grid.getCellFromEvent(e);
|
||||
if (!cell) { return; }
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user