diff --git a/auth0-lock/auth0.lock-tests.ts b/auth0-lock/auth0.lock-tests.ts index e62cd4ba2d..bba2fc8228 100644 --- a/auth0-lock/auth0.lock-tests.ts +++ b/auth0-lock/auth0.lock-tests.ts @@ -1,4 +1,4 @@ -/// +/// const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID"; diff --git a/auth0-lock/index.d.ts b/auth0-lock/index.d.ts index da99744841..10ee3aac0d 100644 --- a/auth0-lock/index.d.ts +++ b/auth0-lock/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Brian Caruso // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface Auth0LockAdditionalSignUpFieldOption { value: string; diff --git a/auth0.widget/auth0.widget-tests.ts b/auth0.widget/auth0.widget-tests.ts index 79f1a2a7a7..ec5502ca7e 100644 --- a/auth0.widget/auth0.widget-tests.ts +++ b/auth0.widget/auth0.widget-tests.ts @@ -1,4 +1,4 @@ -/// +/// var widget: Auth0WidgetStatic = new Auth0Widget({ diff --git a/auth0.widget/index.d.ts b/auth0.widget/index.d.ts index ed6a2f341b..24d978ab9d 100644 --- a/auth0.widget/index.d.ts +++ b/auth0.widget/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface Auth0WidgetStatic { diff --git a/auth0/auth0-tests.ts b/auth0/auth0-tests.ts index 7f48274eaf..391dee655a 100644 --- a/auth0/auth0-tests.ts +++ b/auth0/auth0-tests.ts @@ -1,23 +1,51 @@ /// -var auth0 = new Auth0({ - domain: 'mine.auth0.com', - clientID: 'dsa7d77dsa7d7', - callbackURL: 'http://my-app.com/callback', - callbackOnLocationHash: true +import * as auth0 from 'auth0'; + +const management = new auth0.ManagementClient({ + token: '{YOUR_API_V2_TOKEN}', + domain: '{YOUR_ACCOUNT}.auth0.com' }); -auth0.login({ - connection: 'google-oauth2', - popup: true, - popupOptions: { - width: 450, - height: 800 - } -}, (err, profile, idToken, accessToken, state) => { - if (err) { - alert("something went wrong: " + err.message); - return; - } - alert('hello ' + profile.name); - }); +const auth = new auth0.AuthenticationClient({ + domain: '{YOUR_ACCOUNT}.auth0.com', + clientId: '{OPTIONAL_CLIENT_ID}' +}); + +// Using a callback. +management.getUsers((err: Error, users: auth0.User[]) => { + if (err) { + // Handle error. + } + console.log(users); +}); + +// Using a Promise. +management + .getUsers() + .then((users) => { + console.log(users); + }) + .catch((err) => { + // Handle the error. + }); + +management + .createUser({ + connection: 'My-Connection', + email: 'hi@me.co', + }).then((user) => { + console.log(user); + }).catch((err) => { + // Handle the error. + }); + +auth + .requestChangePasswordEmail({ + connection: 'My-Connection', + email: 'hi@me.co', + }).then((response) => { + console.log(response); + }).catch((err) => { + // Handle the error. + }); diff --git a/auth0/index.d.ts b/auth0/index.d.ts index 5ca8487f85..e367d30411 100644 --- a/auth0/index.d.ts +++ b/auth0/index.d.ts @@ -1,132 +1,95 @@ -// Type definitions for Auth0.js -// Project: http://auth0.com -// Definitions by: Robert McLaws +// Type definitions for auth0 v2.3.1 +// Project: https://github.com/auth0/node-auth0 +// Definitions by: Seth Westphal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/** Extensions to the browser Window object. */ -interface Window { - /** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */ +/// + +declare module "auth0" { + + import * as Promise from 'bluebird'; + + export interface ManagementClientOptions { token: string; -} + domain?: string; + } -/** This is the interface for the main Auth0 client. */ -interface Auth0Static { - - new(options: Auth0ClientOptions): Auth0Static; - changePassword(options: any, callback?: Function): void; - decodeJwt(jwt: string): any; - login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; - loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; - loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void; - loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; - logout(query: string): void; - getConnections(callback?: Function): void; - refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; - getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; - getProfile(id_token: string, callback?: Function): Auth0UserProfile; - getSSOData(withActiveDirectories: any, callback?: Function): void; - parseHash(hash: string): Auth0DecodedHash; - signup(options: Auth0SignupOptions, callback: Function): void; - validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void; -} - -/** Represents constructor options for the Auth0 client. */ -interface Auth0ClientOptions { - clientID: string; - callbackURL: string; - callbackOnLocationHash?: boolean; - domain: string; - forceJSONP?: boolean; -} - -/** Represents a normalized UserProfile. */ -interface Auth0UserProfile { - email: string; - family_name: string; - gender: string; - given_name: string; - locale: string; - name: string; - nickname: string; - picture: string; - user_id: string; - /** Represents one or more Identities that may be associated with the User. */ - identities: Auth0Identity[]; - user_metadata?: any; - app_metadata?: any; -} - -/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */ -interface MicrosoftUserProfile extends Auth0UserProfile { - emails: string[]; -} - -/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */ -interface Office365UserProfile extends Auth0UserProfile { - tenantid: string; - upn: string; -} - -/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */ -interface AdfsUserProfile extends Auth0UserProfile { - issuer: string; -} - -/** Represents multiple identities assigned to a user. */ -interface Auth0Identity { - access_token: string; + export interface UserData { connection: string; - isSocial: boolean; - provider: string; - user_id: string; -} - -interface Auth0DecodedHash { - access_token: string; - id_token: string; - profile: Auth0UserProfile; - state: any; -} - -interface Auth0PopupOptions { - width: number; - height: number; -} - -interface Auth0LoginOptions { - auto_login?: boolean; - connection?: string; email?: string; username?: string; password?: string; - popup?: boolean; - popupOptions?: Auth0PopupOptions; -} + phone_number?: string; + user_metadata?: {}; + email_verified?: boolean; + app_metadata?: {}; + } -interface Auth0SignupOptions extends Auth0LoginOptions { - auto_login: boolean; -} + export interface GetUsersData { + per_page?: number; + page?: number; + include_totals?: boolean; + sort?: string; + connection?: string; + fields?: string; + include_fields?: boolean; + q?: string; + search_engine?: string; + } -interface Auth0Error { - code: any; - details: any; - name: string; - message: string; - status: any; -} + export interface User { + email?: string; + email_verified?: boolean; + username?: string; + phone_number?: string; + phone_verified?: boolean; + user_id?: string; + created_at?: string; + updated_at?: string; + identities?: Identity[]; + app_metadata?: {}; + user_metadata?: {}; + picture?: string; + name?: string; + nickname?: string; + multifactor?: string[]; + last_ip?: string; + last_login?: string; + logins_count?: number; + blocked?: boolean; + } -/** Represents the response from an API Token Delegation request. */ -interface Auth0DelegationToken { - /** The length of time in seconds the token is valid for. */ - expires_in: string; - /** The JWT for delegated access. */ - id_token: string; - /** The type of token being returned. Possible values: "Bearer" */ - token_type: string; -} + export interface Identity { + connection: string; + user_id: string; + provider: string; + isSocial: boolean; + } -declare var Auth0: Auth0Static; + export class ManagementClient { + constructor(options: ManagementClientOptions); + + getUsers(params?: GetUsersData): Promise; + getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void; + createUser(data: UserData): Promise; + createUser(data: UserData, cb: (err: Error, data: User) => void): void; + } + + export interface AuthenticationClientOptions { + clientId?: string; + domain: string; + } + + export interface RequestChangePasswordEmailData { + connection: string; + email: string; + } + + export class AuthenticationClient { + constructor(options: AuthenticationClientOptions); + + requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise; + requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void; + } -declare module "auth0" { - export = Auth0 } diff --git a/eventemitter2/index.d.ts b/eventemitter2/index.d.ts index 39a349c6b6..de1be0d064 100644 --- a/eventemitter2/index.d.ts +++ b/eventemitter2/index.d.ts @@ -43,7 +43,7 @@ declare class EventEmitter2 { * @param event * @param listener */ - on(event: string, listener: Function): EventEmitter2; + on(event: string | string[], listener: Function): EventEmitter2; /** * Adds a listener that will be fired when any event is emitted. @@ -128,7 +128,7 @@ declare class EventEmitter2 { * @param event * @param args */ - emit(event: string, ...args: any[]): boolean; + emit(event: string | string[], ...args: any[]): boolean; /** * Execute each of the listeners that may be listening for the specified event name in order with the list of arguments. @@ -156,7 +156,7 @@ declare module "eventemitter2" { * @param event * @param listener */ - on(event: string, listener: Function): EventEmitter2; + on(event: string | string[], listener: Function): EventEmitter2; /** * Adds a listener that will be fired when any event is emitted. @@ -241,7 +241,7 @@ declare module "eventemitter2" { * @param event * @param args */ - emit(event: string, ...args: any[]): boolean; + emit(event: string | string[], ...args: any[]): boolean; /** * Execute each of the listeners that may be listening for the specified event name in order with the list of arguments. diff --git a/express-serve-static-core/index.d.ts b/express-serve-static-core/index.d.ts index c8bfaf7f29..707b408714 100644 --- a/express-serve-static-core/index.d.ts +++ b/express-serve-static-core/index.d.ts @@ -22,7 +22,7 @@ declare module "express-serve-static-core" { } interface RequestHandler { - (req: Request, res: Response, next: NextFunction): any; + (req: Request, res: Response, next?: NextFunction): any; } interface ErrorRequestHandler { diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts index 8f4f9bab9c..9c374d9948 100644 --- a/express-validator/express-validator-tests.ts +++ b/express-validator/express-validator-tests.ts @@ -13,19 +13,23 @@ app.post('/:urlparam', function(req: express.Request, res: express.Response) { // Similarly checkParams only checks in req.params (URL params) and // checkQuery only checks req.query (GET params). req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt(); - req.checkParams('urlparam', 'Invalid urlparam').isAlpha(); + req.checkParams('urlparam', 'Invalid urlparam').isAlpha().matches(/test?/i).matches('test?', 'i'); req.checkQuery('getparam', 'Invalid getparam').isInt(); - req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); - req.checkFiles('testFiles', 'Invalid testFiles').isUrl(); - + req.checkHeaders('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); + req.checkFiles('testFiles', 'Invalid testFiles').isURL(); // OR assert can be used to check on all 3 types of params. // req.assert('postparam', 'Invalid postparam').notEmpty().isInt(); // req.assert('urlparam', 'Invalid urlparam').isAlpha(); // req.assert('getparam', 'Invalid getparam').isInt(); - req.sanitize('postparam').toBoolean(); req.filter('postparam').toBoolean(); + req.sanitize('postparam').blacklist('t').blacklist(['']).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); diff --git a/express-validator/index.d.ts b/express-validator/index.d.ts index 151bf16d97..0416b4db44 100644 --- a/express-validator/index.d.ts +++ b/express-validator/index.d.ts @@ -1,11 +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 , Jonathan Häberle +// Definitions by: Nathan Ridley , Jonathan Häberle , Peter Harris // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - // Add RequestValidation Interface on to Express's Request Interface. declare namespace Express { interface Request extends ExpressValidator.RequestValidation {} @@ -32,25 +31,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 { [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[]; + validationErrors(mapped?: boolean): Dictionary | MappedError[]; + validationErrors(mapped?: boolean): Dictionary | T[]; + asyncValidationErrors(mapped?: boolean): Promise>; + asyncValidationErrors(mapped?: boolean): Promise>; } export interface Validator { @@ -62,12 +69,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 */ @@ -75,8 +83,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; /** @@ -86,7 +107,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; @@ -94,10 +115,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) @@ -105,12 +128,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 */ @@ -118,7 +142,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) */ @@ -138,17 +162,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 */ @@ -156,7 +183,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 { @@ -166,40 +196,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 + * True unless str = '0', 'false', or str.length == 0. In strict mode only '1' and 'true' return true. */ - toBoolean(): Sanitizer; + toBoolean(strict?: boolean): Sanitizer; + /** - * False unless str = '1' or 'true' - */ - toBooleanStrict(): Sanitizer; - /** - * Decode HTML entities - */ - - /** - * 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; + } } diff --git a/express/express-tests.ts b/express/express-tests.ts index fddb54a9a3..66747b7b41 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -1,3 +1,4 @@ +/// import * as express from './'; var app = express(); @@ -89,3 +90,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); diff --git a/gulp-rename/gulp-rename-tests.ts b/gulp-rename/gulp-rename-tests.ts index 4d3e713234..b4c81296f1 100644 --- a/gulp-rename/gulp-rename-tests.ts +++ b/gulp-rename/gulp-rename-tests.ts @@ -1,6 +1,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")) @@ -24,4 +27,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 \ No newline at end of file + .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md diff --git a/hapi/index.d.ts b/hapi/index.d.ts index e032afc41d..7b8348d720 100644 --- a/hapi/index.d.ts +++ b/hapi/index.d.ts @@ -5,7 +5,6 @@ //Note/Disclaimer: This .d.ts was created against hapi v8.x but has been incrementally upgraded to 13.x. Some newer features/changes may be missing. YMMV. - /// import http = require("http"); @@ -1605,6 +1604,9 @@ export class ServerConnection extends Events.EventEmitter { info: IServerConnectionInfo; } +export type RequestExtPoints = "onRequest" | "onPreResponse" | "onPreAuth" | "onPostAuth" | "onPreHandler" | "onPostHandler" | "onPreResponse"; +export 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). Server events @@ -2038,9 +2040,10 @@ export class Server extends Events.EventEmitter { 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(event: string, method: (request: Request, reply: IStrictReply, 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(event: RequestExtPoints, method: (request: Request, reply: IStrictReply, 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: name - string name for the handler being registered. Cannot override the built-in handler types (directory, file, proxy, and view) or any previously registered type. diff --git a/jasmine-node/index.d.ts b/jasmine-node/index.d.ts index e932a3529f..152c8eec4d 100644 --- a/jasmine-node/index.d.ts +++ b/jasmine-node/index.d.ts @@ -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; + } +} + interface ExecuteSpecsOptions { specFolders: string[], onComplete?: (runner:jasmine.Runner) => void, diff --git a/kendo-ui/index.d.ts b/kendo-ui/index.d.ts index 2eed98f846..f755559c49 100644 --- a/kendo-ui/index.d.ts +++ b/kendo-ui/index.d.ts @@ -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; diff --git a/lodash/index.d.ts b/lodash/index.d.ts index 822ba91fc8..4add7b0db8 100644 --- a/lodash/index.d.ts +++ b/lodash/index.d.ts @@ -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; } } diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index aa9987698f..bacb77f6af 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -1794,7 +1794,7 @@ declare namespace __MaterialUI { focus(): void; select(): void; getValue(): string; - getInputNode(): Element; + getInputNode(): HTMLInputElement; } interface TimePickerProps extends React.Props { diff --git a/multer/index.d.ts b/multer/index.d.ts index 9208d65642..4c6ce93226 100644 --- a/multer/index.d.ts +++ b/multer/index.d.ts @@ -52,14 +52,18 @@ declare namespace multer { } interface Instance { - /** Accept a single file with the name fieldname. The single file will be stored in req.file. */ - single(fieldame: string): 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. */ - any(): 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 */ + 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; + /** 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; } } diff --git a/node/index.d.ts b/node/index.d.ts index 5e6bd54da5..ecefadc50d 100644 --- a/node/index.d.ts +++ b/node/index.d.ts @@ -502,6 +502,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; @@ -691,6 +694,7 @@ declare module "http" { */ statusMessage?: string; socket: net.Socket; + destroy(error?: Error): void; } /** * @deprecated Use IncomingMessage @@ -1391,8 +1395,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; @@ -2187,6 +2192,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" { diff --git a/node/node-tests.ts b/node/node-tests.ts index 7cd2c4ea77..e73ce7b243 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -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]); @@ -507,9 +515,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 diff --git a/parse/index.d.ts b/parse/index.d.ts index 190b3d68dd..6852fad1c2 100644 --- a/parse/index.d.ts +++ b/parse/index.d.ts @@ -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(name: string, data?: any, options?: RunOptions): Promise; 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. diff --git a/parse5/index.d.ts b/parse5/index.d.ts index fe6e511747..9b0624c0e8 100644 --- a/parse5/index.d.ts +++ b/parse5/index.d.ts @@ -1,11 +1,10 @@ -// Type definitions for parse5 2.1.5 +// Type definitions for parse5 2.2.0 // Project: https://github.com/inikulin/parse5 -// Definitions by: Nico Jansen +// Definitions by: Nico Jansen , Meirion Hughes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - import * as stream from "stream"; import * as events from "events"; @@ -45,6 +44,7 @@ export declare function serialize(node: ASTNode, options?: SerializerOptions): s export interface ASTAttribute { name: string; value: string; + prefix?: string; } export interface Attribute { @@ -126,10 +126,10 @@ export declare class SAXParser extends stream.Transform { /** * 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: diff --git a/parse5/parse5-tests.ts b/parse5/parse5-tests.ts index af2f5b7703..b2c12a7ae7 100644 --- a/parse5/parse5-tests.ts +++ b/parse5/parse5-tests.ts @@ -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 +// Definitions by: Nico Jansen , Meirion Hughes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,33 +8,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(''); + +if(!_wasCalled) + throw "parser.on 'startTag' wasn't called"; + // parse5.parse() -parse5.parse('html', { locationInfo: true, treeAdapter: parse5.treeAdapters.default }); +parse5.parse('', { 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(""); + 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('
'); +fragment = parse5.parseFragment('
', {locationInfo: true}); // parse5.ASTNode fragment.quirksMode = true; fragment.namespaceURI = ''; fragment.nodeName = ''; fragment.value = ''; -fragment = fragment.parentNode; fragment = fragment.childNodes[0]; +fragment = fragment.parentNode; diff --git a/react-dnd/index.d.ts b/react-dnd/index.d.ts index 470df308dc..41b0e33eb6 100644 --- a/react-dnd/index.d.ts +++ b/react-dnd/index.d.ts @@ -45,16 +45,16 @@ declare module __ReactDnd { spec: DropTargetSpec

, collect: DropTargetCollector, options?: DndOptions

- ): (componentClass: React.ComponentClass

) => DndComponentClass

; + ): (componentClass: React.ComponentClass

| React.StatelessComponent

) => DndComponentClass

; export function DragDropContext

( backend: Backend - ): (componentClass: React.ComponentClass

) => ContextComponentClass

; + ):

(componentClass: React.ComponentClass

| React.StatelessComponent

) => ContextComponentClass

; export function DragLayer

( collect: DragLayerCollector, options?: DndOptions

- ): (componentClass: React.ComponentClass

) => DndComponentClass

; + ): (componentClass: React.ComponentClass

| React.StatelessComponent

) => DndComponentClass

; type DragSourceCollector = (connect: DragSourceConnector, monitor: DragSourceMonitor) => Object; type DropTargetCollector = (connect: DropTargetConnector, monitor: DropTargetMonitor) => Object; diff --git a/react-helmet/index.d.ts b/react-helmet/index.d.ts index b9b48089ea..c44639e0d0 100644 --- a/react-helmet/index.d.ts +++ b/react-helmet/index.d.ts @@ -17,6 +17,7 @@ export = Helmet; declare namespace ReactHelmet { interface HelmetProps { base?: any; + defaultTitle?: string; htmlAttributes?: any; link?: Array; meta?: Array; diff --git a/react-tabs/index.d.ts b/react-tabs/index.d.ts index 43a0095402..ebb5ae644b 100644 --- a/react-tabs/index.d.ts +++ b/react-tabs/index.d.ts @@ -23,6 +23,8 @@ declare namespace ReactTabs { interface TabListProps { className?: string; + activeTabClassName?: string; + disabledTabClassName?: string; } interface TabList extends React.ComponentClass {} diff --git a/react/index.d.ts b/react/index.d.ts index 7449d1e9c6..cb1b567a62 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -200,7 +200,7 @@ declare namespace React { type SFC

= StatelessComponent

; interface StatelessComponent

{ - (props?: P, context?: any): ReactElement; + (props: P, context?: any): ReactElement; propTypes?: ValidationMap

; contextTypes?: ValidationMap; defaultProps?: P; @@ -279,9 +279,11 @@ declare namespace React { isTrusted: boolean; nativeEvent: Event; preventDefault(): void; + isDefaultPrevented(): boolean; stopPropagation(): void; - target: EventTarget & T; + isPropagationStopped(): boolean; persist(): void; + target: EventTarget; timeStamp: Date; type: string; } diff --git a/redis/index.d.ts b/redis/index.d.ts index fe9ec5e65a..f1b4b6e11b 100644 --- a/redis/index.d.ts +++ b/redis/index.d.ts @@ -108,7 +108,7 @@ export interface RedisClient extends NodeJS.EventEmitter { "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", @@ -253,6 +253,8 @@ export interface RedisClient extends NodeJS.EventEmitter { hmget(...args: any[]): boolean; hincrby(args: any[], callback?: ResCallbackT): boolean; hincrby(...args: any[]): boolean; + hincrbyfloat(args:any[], callback?:ResCallbackT): boolean; + hincrbyfloat(...args:any[]): boolean; hdel(args: any[], callback?: ResCallbackT): boolean; hdel(...args: any[]): boolean; hlen(args: any[], callback?: ResCallbackT): boolean; diff --git a/slickgrid/SlickGrid-tests.ts b/slickgrid/SlickGrid-tests.ts index f77f3dc017..e6570c2985 100644 --- a/slickgrid/SlickGrid-tests.ts +++ b/slickgrid/SlickGrid-tests.ts @@ -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) => { + let cell: Slick.Cell = args.grid.getCellFromEvent(e); + if (!cell) { return; } +}); diff --git a/slickgrid/index.d.ts b/slickgrid/index.d.ts index 507247c675..feab55043d 100644 --- a/slickgrid/index.d.ts +++ b/slickgrid/index.d.ts @@ -92,14 +92,16 @@ declare namespace Slick { * @method subscribe * @param fn {Function} Event handler. */ - public subscribe(fn: (eventData: EventData, data: T) => any ): void; + public subscribe(fn: (e: EventData, data: T) => any): void; + public subscribe(fn: (e: DOMEvent, data: T) => any): void; /*** * Removes an event handler added with subscribe(fn). * @method unsubscribe * @param fn {Function} Event handler to be removed. */ - public unsubscribe(fn: (eventData: EventData, data: T) => any ): void; + public unsubscribe(fn: (e: EventData, data: T) => any): void; + public unsubscribe(fn: (e: DOMEvent, data: T) => any): void; /*** * Fires an event notifying all subscribers. @@ -1037,7 +1039,7 @@ declare namespace Slick { * @param e A standard W3C/jQuery event. * @return **/ - public getCellFromEvent(e: Event): Cell; // todo: !! Unsure on return type !! + public getCellFromEvent(e: DOMEvent): Cell; /** * Returns a hash containing row and cell indexes. Coordinates are relative to the top left corner of the grid beginning with the first row (not including the column headers). @@ -1045,7 +1047,7 @@ declare namespace Slick { * @param y A y coordinate. * @return **/ - public getCellFromPoint(x: number, y: number): Cell; // todo: !! Unsure on return type !! + public getCellFromPoint(x: number, y: number): Cell; /** * Returns a DOM element containing a cell at a given row and cell. diff --git a/ui-grid/index.d.ts b/ui-grid/index.d.ts index 257d0753e9..7d646dbbf8 100644 --- a/ui-grid/index.d.ts +++ b/ui-grid/index.d.ts @@ -838,6 +838,11 @@ declare namespace uiGrid { * @default false */ useExternalFiltering?: boolean; + /** + * Disables client side sorting. When true, handle the sortChanged event and do the sorting there + * @default false + */ + useExternalSorting?: boolean; /** * Default time in milliseconds to throttle scroll events to, defaults to 70ms * @default 70 @@ -3564,7 +3569,7 @@ declare namespace uiGrid { * Algorithm to use for sorting this column. Takes 'a' and 'b' parameters * like any normal sorting function with additional 'rowA', 'rowB', and 'direction' * parameters that are the row objects and the current direction of the sort - * respectively. + * respectively. */ sortingAlgorithm?: (a: any, b: any, rowA: IGridRowOf, rowB: IGridRowOf, direction: string) => number; /** Column width */ @@ -3799,7 +3804,7 @@ declare namespace uiGrid { * Algorithm to use for sorting this column. Takes 'a' and 'b' parameters * like any normal sorting function with additional 'rowA', 'rowB', and 'direction' * parameters that are the row objects and the current direction of the sort - * respectively. + * respectively. */ sortingAlgorithm?: (a: any, b: any, rowA: IGridRowOf, rowB: IGridRowOf, direction: string) => number; /** diff --git a/wallabyjs/index.d.ts b/wallabyjs/index.d.ts index 4f90762c2b..7b791e44ff 100644 --- a/wallabyjs/index.d.ts +++ b/wallabyjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for WallabyJS // Project: http://wallabyjs.com -// Definitions by: Andrew Connell +// Definitions by: Andrew Connell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'wallabyjs' { @@ -24,7 +24,7 @@ declare module 'wallabyjs' { * @see {@link https://wallabyjs.com/docs/config/overview.html} for details. */ export interface IWallabyConfig { - comilers?: IWallabyCompiler; + comilers?: IWallabyCompilers; debug?: boolean; env?: IWallabyEnvironment; files: string[] | IWallabyFilePattern[]; @@ -36,16 +36,60 @@ declare module 'wallabyjs' { } /** - * Wallaby compiler configuration. + * Wallaby compilers. * + * @export * @interface IWallabyCompiler * * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. */ - export interface IWallabyCompiler { + export interface IWallabyCompilers { [pattern: string]: any } + /** + * Wallaby built in compiler options. These are name-value pairs passed into each compiler. + * + * @export + * @interface IWallabyCompilerOptions + * + * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. + */ + export interface IWallabyBuiltInCompilerOptions { + [option: string]: string; + } + + /** + * Wallaby build in compilers. + * + * @export + * @interface IWallabyBuiltInCompilers + * + * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. + */ + export interface IWallabyBuiltInCompilers { + babel(compilerOptions?: IWallabyBuiltInCompilerOptions): IWallabyCompilerResult; + coffeeScript(compilerOptions?: IWallabyBuiltInCompilerOptions): IWallabyCompilerResult; + typeScript(compilerOptions?: IWallabyBuiltInCompilerOptions): IWallabyCompilerResult; + } + + /** + * Wallaby compiler result entity. + * + * @export + * @interface IWallabyCompilerResult + * + * @property {string} map - Source map. + * @property {string} code - Code transformed to JavaScript. + * @property {any} ranges - All converable ranges of the original file. + * + * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. + */ + export interface IWallabyCompilerResult { + map: string; + code: string; + ranges: any; + } /** * Wallaby processor used in pre & post processors. @@ -149,7 +193,7 @@ declare module 'wallabyjs' { * * @property {string=} localProjectDir - String property which returns the project local folder. * @property {string=} projectCacheDir - String property which returns the project cache folder. - * @property {IWallabyCompiler=} compilers - Property which allows you to access the built-in TypeScript, CoffeeScript and Babel compilers. + * @property {IWallabyBuiltInCompilers=} compilers - Property which allows you to access the built-in TypeScript, CoffeeScript and Babel compilers. * @property {object=} defaults - Property which allows you to set the default values for file object properties. * * @see {@link https://wallabyjs.com/docs/config/overview.html} for details. @@ -157,7 +201,7 @@ declare module 'wallabyjs' { export interface IWallaby { localProjectDir?: string; projectCacheDir?: string; - compilers?: IWallabyCompiler; + compilers?: IWallabyBuiltInCompilers; defaults?: any; } } diff --git a/wallabyjs/wallabyjs-tests.ts b/wallabyjs/wallabyjs-tests.ts index b76ec39f47..5fd8344797 100644 --- a/wallabyjs/wallabyjs-tests.ts +++ b/wallabyjs/wallabyjs-tests.ts @@ -11,7 +11,7 @@ export class WallabyConfig implements wallabyjs.IWallabyConfig { 'src/**/*.spec.ts' ]; - public compilers: wallabyjs.IWallabyCompiler = { + public compilers: wallabyjs.IWallabyCompilers = { 'src/**/*.js': this.wallaby.compilers.babel({}), 'src/**/*.ts': this.wallaby.compilers.typeScript({}) }; @@ -34,5 +34,5 @@ export class WallabyConfig implements wallabyjs.IWallabyConfig { } }; - constructor(private wallaby: any) { } + constructor(private wallaby: wallabyjs.IWallaby) { } } diff --git a/xrm/index.d.ts b/xrm/index.d.ts index 3d536669b2..8d1f94b113 100644 --- a/xrm/index.d.ts +++ b/xrm/index.d.ts @@ -786,7 +786,7 @@ declare namespace Xrm * * @return The event source. */ - getEventSource(): Attribute | Entity; + getEventSource(): Attribute | Control | Entity; /** * Gets the shared variable with the specified key. @@ -1726,7 +1726,7 @@ declare namespace Xrm * * @param {Function} handler The handler. */ - addPreSearch( handler: () => void ): void; + addPreSearch( handler: ContextSensitiveHandler ): void; /** * Adds an additional custom filter to the lookup, with the "AND" filter operator.