From 75b38004961afa3fd24a1f25b8c2b57ca963e9d1 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 12 Aug 2015 18:30:54 -0700 Subject: [PATCH 1/9] Account for core data types in 'log4js'. --- log4js/log4js.d.ts | 108 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 28d821377d..70059142c5 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -63,8 +63,8 @@ declare module "log4js" { */ export function shutdown(cb: Function): void; - export function configure(config: IConfig, options?: any): void; export function configure(filename: string, options?: any): void; + export function configure(config: IConfig, options?: any): void; export function setGlobalLogLevel(level: string): void; export function setGlobalLogLevel(level: Level): void; @@ -126,14 +126,112 @@ declare module "log4js" { } export interface IConfig { - appenders: IAppenderConfig[]; + appenders: AppenderConfig[]; levels?: { [category: string]: string }; replaceConsole?: boolean; } - export interface IAppenderConfig { + + export interface AppenderConfigBase { type: string; - category?: string[]; - // etc... + category?: string; } + + export interface ConsoleAppenderConfig extends AppenderConfigBase {} + + export interface FileAppenderConfig extends AppenderConfigBase { + filename: string; + } + export interface DateFileAppenderConfig extends FileAppenderConfig { + /** + * The following strings are recognised in the pattern: + * - yyyy : the full year, use yy for just the last two digits + * - MM : the month + * - dd : the day of the month + * - hh : the hour of the day (24-hour clock) + * - mm : the minute of the hour + * - ss : seconds + * - SSS : milliseconds (although I'm not sure you'd want to roll your logs every millisecond) + * - O : timezone (capital letter o) + */ + pattern: string; + alwaysIncludePattern: boolean; + } + + export interface SmtpAppenderConfig extends AppenderConfigBase { + /** Comma separated list of email recipients */ + recipients: string; + + /** Sender of all emails (defaults to transport user) */ + sender: string; + + /** Subject of all email messages (defaults to first event's message)*/ + subject: string; + + /** + * The time in seconds between sending attempts (defaults to 0). + * All events are buffered and sent in one email during this time. + * If 0 then every event sends an email + */ + sendInterval: number; + + SMTP: { + host: string; + secure: boolean; + port: number; + auth: { + user: string; + pass: string; + } + } + } + + export interface HookIoAppenderConfig extends FileAppenderConfig { + maxLogSize: number; + backup: number; + pollInterval: number; + } + + export interface GelfAppenderConfig extends AppenderConfigBase { + host: string; + hostname: string; + port: string; + facility: string; + } + + export interface MultiprocessAppenderConfig extends AppenderConfigBase { + mode: string; + loggerPort: number; + loggerHost: string; + facility: string; + appender?: AppenderConfig; + } + + export interface LogglyAppenderConfig extends AppenderConfigBase { + /** Loggly customer token - https://www.loggly.com/docs/api-sending-data/ */ + token: string; + + /** Loggly customer subdomain (use 'abc' for abc.loggly.com) */ + subdomain: string; + + /** an array of strings to help segment your data & narrow down search results in Loggly */ + tags: string[]; + + /** Enable JSON logging by setting to 'true' */ + json: boolean; + } + + export interface ClusteredAppenderConfig extends AppenderConfigBase { + appenders?: AppenderConfig[]; + } + + type CoreAppenderConfig = ConsoleAppenderConfig + | FileAppenderConfig + | DateFileAppenderConfig + | SmtpAppenderConfig + | HookIoAppenderConfig + | GelfAppenderConfig + | MultiprocessAppenderConfig + + type AppenderConfig = CoreAppenderConfig | (AppenderConfigBase & { [prop: string]: any; }); } From a1f7cb56596239b3797996cad846fc57ad418edc Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 12 Aug 2015 19:00:15 -0700 Subject: [PATCH 2/9] Added 'secondLevelDomains' to 'mailcheck'. --- mailcheck/mailcheck.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/mailcheck/mailcheck.d.ts b/mailcheck/mailcheck.d.ts index c6f28d0db8..64b5f93c40 100644 --- a/mailcheck/mailcheck.d.ts +++ b/mailcheck/mailcheck.d.ts @@ -47,6 +47,7 @@ declare module MailcheckModule { export interface IOptions { domains?: string[]; + secondLevelDomains?: string[]; topLevelDomains?: string[]; distanceFunction?: IDistanceFunction; suggested?: ISuggested | IJQuerySuggested; From 7192d685cbb16c76a1426b62ea912960a2b316c5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 12 Aug 2015 19:02:06 -0700 Subject: [PATCH 3/9] Not-so-smart lsts in 'marked'. --- marked/marked-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/marked/marked-tests.ts b/marked/marked-tests.ts index ca8b96920b..44be0f0e84 100644 --- a/marked/marked-tests.ts +++ b/marked/marked-tests.ts @@ -8,7 +8,7 @@ var options: MarkedOptions = { breaks: false, pedantic: false, sanitize: true, - smartLsts: true, + smartLists: true, silent: false, highlight: function (code: string, lang: string) { return ''; From f8d51d29b3a6f416a5fee44330844e3a153e9a23 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 12 Aug 2015 19:05:02 -0700 Subject: [PATCH 4/9] Reorder overloads in 'mCustomScrollbar'. --- mCustomScrollbar/mCustomScrollbar.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mCustomScrollbar/mCustomScrollbar.d.ts b/mCustomScrollbar/mCustomScrollbar.d.ts index 7e0a529ef6..871ed2d5ff 100644 --- a/mCustomScrollbar/mCustomScrollbar.d.ts +++ b/mCustomScrollbar/mCustomScrollbar.d.ts @@ -129,12 +129,6 @@ declare module MCustomScrollbar { } interface JQuery { - /** - * Creates a new mCustomScrollbar with the specified or default options - * - * @param options Override default options - */ - mCustomScrollbar(options?: MCustomScrollbar.CustomScrollbarOptions): JQuery; /** * Calls specified methods on the scrollbar "update", "stop", "disable", "destroy" * @@ -149,4 +143,10 @@ interface JQuery { * @param options Override default options */ mCustomScrollbar(scrollTo: string, parameter: any, options?: MCustomScrollbar.ScrollToParameterOptions): JQuery; + /** + * Creates a new mCustomScrollbar with the specified or default options + * + * @param options Override default options + */ + mCustomScrollbar(options?: MCustomScrollbar.CustomScrollbarOptions): JQuery; } \ No newline at end of file From a508d7d50c089416516933c8781041c693fc578f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Aug 2015 11:18:47 -0700 Subject: [PATCH 5/9] Add 'enable' and fix types of properties in 'mCustomScrollbar'. --- mCustomScrollbar/mCustomScrollbar.d.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/mCustomScrollbar/mCustomScrollbar.d.ts b/mCustomScrollbar/mCustomScrollbar.d.ts index 871ed2d5ff..f41aca00a1 100644 --- a/mCustomScrollbar/mCustomScrollbar.d.ts +++ b/mCustomScrollbar/mCustomScrollbar.d.ts @@ -40,6 +40,10 @@ declare module MCustomScrollbar { */ autoHideScrollbar?: boolean; scrollButtons?: { + /** + * Enable or disable scroll buttons. + */ + enable?: boolean; /** * Scroll buttons scroll type, values: "continuous" (scroll continuously while pressing the button), "pixels" (scrolls by a fixed number of pixels on each click") */ @@ -47,11 +51,11 @@ declare module MCustomScrollbar { /** * Scroll buttons continuous scrolling speed, integer value or "auto" (script calculates and sets the speed according to content length) */ - scrollSpeed?: any; + scrollSpeed?: number | string; /** - * Scroll buttons pixels scrolling amount, value in pixels + * Scroll buttons pixels scrolling amount, value in pixels or "auto" */ - scrollAmount?: number; + scrollAmount?: number | string; } advanced?: { /** @@ -94,14 +98,24 @@ declare module MCustomScrollbar { */ onScroll?: () => void; /** - * User defined callback function, triggered when scroll end-limit is reached + * A function to call when scrolling is completed and content is scrolled all the way to the end (bottom/right) + */ + onTotalScroll?: () => void; + /** + * A function to call when scrolling is completed and content is scrolled back to the beginning (top/left) */ onTotalScrollBack?: () => void; /** - * Scroll end-limit offset, value in pixels + * Set an offset for which the onTotalScroll callback is triggered. + * Its value is in pixels. */ onTotalScrollOffset?: number; /** + * Set an offset for which the onTotalScrollBack callback is triggered. + * Its value is in pixels + */ + onTotalScrollBackOffset?: number; + /** * User defined callback function, triggered while scrolling */ whileScrolling?: () => void; From e4484309b049b5c7778ede56c35fba9b2a4b36fd Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Aug 2015 12:05:30 -0700 Subject: [PATCH 6/9] Add 'mongos' property to interface in 'mongoose'. --- mongoose/mongoose.d.ts | 63 +++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 10 deletions(-) diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index ce4be964f4..e840d8e050 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -6,10 +6,10 @@ /// declare module "mongoose" { - function connect(uri: string, options?: ConnectionOption, callback?: (err: any) => void): Mongoose; + function connect(uri: string, options?: ConnectionOptions , callback?: (err: any) => void): Mongoose; function createConnection(): Connection; - function createConnection(uri: string, options?: ConnectionOption): Connection; - function createConnection(host: string, database_name: string, port?: number, options?: ConnectionOption): Connection; + function createConnection(uri: string, options?: ConnectionOptions): Connection; + function createConnection(host: string, database_name: string, port?: number, options?: ConnectionOptions): Connection; function disconnect(callback?: (err?: any) => void): Mongoose; function model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; @@ -25,10 +25,10 @@ declare module "mongoose" { var connection: Connection; export class Mongoose { - connect(uri: string, options?: ConnectionOption, callback?: (err: any) => void): Mongoose; + connect(uri: string, options?: ConnectOpenOptionsBase, callback?: (err: any) => void): Mongoose; createConnection(): Connection; createConnection(uri: string, options?: Object): Connection; - createConnection(host: string, database_name: string, port?: number, options?: ConnectionOption): Connection; + createConnection(host: string, database_name: string, port?: number, options?: ConnectOpenOptionsBase): Connection; disconnect(callback?: (err?: any) => void): Mongoose; get(key: string): any; model(name: string, schema?: Schema, collection?: string, skipInit?: boolean): Model; @@ -49,23 +49,66 @@ declare module "mongoose" { collection(name: string, options?: Object): Collection; model(name: string, schema?: Schema, collection?: string): Model; modelNames(): string[]; - open(host: string, database?: string, port?: number, options?: ConnectionOption, callback?: (err: any) => void): Connection; - openSet(uris: string, database?: string, options?: ConnectionSetOption, callback?: (err: any) => void): Connection; + open(host: string, database?: string, port?: number, options?: OpenSetConnectionOptions, callback?: (err: any) => void): Connection; + openSet(uris: string, database?: string, options?: OpenSetConnectionOptions, callback?: (err: any) => void): Connection; db: any; collections: {[index: string]: Collection}; readyState: number; } - export interface ConnectionOption { + + export interface ConnectOpenOptionsBase { db?: any; server?: any; replset?: any; + /** Username for authentication if not supplied in the URI. */ user?: string; + /** Password for authentication if not supplied in the URI. */ pass?: string; + /** Options for authentication */ auth?: any; } - export interface ConnectionSetOption extends ConnectionOption { - mongos?: boolean; + + export interface ConnectionOptions extends ConnectOpenOptionsBase { + /** Passed to the underlying driver's Mongos instance. */ + mongos?: MongosOptions; + } + + interface OpenSetConnectionOptions extends ConnectOpenOptionsBase { + /** If true, enables High Availability support for mongos */ + mongos?: boolean; + } + + interface MongosOptions { + /** Turn on high availability monitoring. (default: true) */ + ha?: boolean; + /** Time between each replicaset status check. (default: 5000) */ + haInterval?: number; + /** + * Number of connections in the connection pool for each + * server instance. (default: 5 (for legacy reasons)) */ + poolSize?: number; + /** + * Use ssl connection (needs to have a mongod server with + * ssl support). (default: false). + */ + ssl?: boolean; + /** + * Validate mongod server certificate against ca + * (needs to have a mongod server with ssl support, 2.4 or higher) + * (default: true) + */ + sslValidate?: boolean; + /** Turn on high availability monitoring. */ + sslCA?: (Buffer|string)[]; + sslKey?: Buffer|string; + sslPass?: Buffer|string; + socketOptions?: { + noDelay?: boolean; + keepAlive?: number; + connectionTimeoutMS?: number; + socketTimeoutMS?: number; + }; } export interface Collection { From f2f72772620e10138bbb380fc1edb73001db0bf7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Aug 2015 12:25:57 -0700 Subject: [PATCH 7/9] 'compressed' in 'needle' --- needle/needle-tests.ts | 2 +- needle/needle.d.ts | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/needle/needle-tests.ts b/needle/needle-tests.ts index 24d9701b51..106d46a716 100644 --- a/needle/needle-tests.ts +++ b/needle/needle-tests.ts @@ -22,7 +22,7 @@ function ResponsePipeline() { var options = { compressed: true, - follow: true, + follow: 5, rejectUnauthorized: true }; diff --git a/needle/needle.d.ts b/needle/needle.d.ts index 741cf5fe3b..e7a67387de 100644 --- a/needle/needle.d.ts +++ b/needle/needle.d.ts @@ -15,13 +15,21 @@ declare module Needle { interface RequestOptions { timeout?: number; - follow?: any; // number | string + follow?: number; + follow_max?: number; multipart?: boolean; proxy?: string; agent?: string; - headers?: any; + headers?: HttpHeaderOptions; auth?: string; // auto | digest | basic (default) json?: boolean; + + // These properties are overwritten by those in the 'headers' field + compressed?: boolean; + cookies?: { [name: string]: any; }; + // Overwritten if present in the URI + username?: string; + password?: string; } interface ResponseOptions { @@ -31,12 +39,15 @@ declare module Needle { } interface HttpHeaderOptions { + cookies?: { [name: string]: any; }; compressed?: boolean; - username?: string; - password?: string; accept?: string; connection?: string; user_agent?: string; + + // Overwritten if present in the URI + username?: string; + password?: string; } interface TLSOptions { From 4549840d3380b5183f7a934ea0e62914b151d08b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 13 Aug 2015 15:02:38 -0700 Subject: [PATCH 8/9] Added data map in 'node-gcm'. --- node-gcm/node-gcm.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts index 3272acac4e..cac54f31ac 100644 --- a/node-gcm/node-gcm.d.ts +++ b/node-gcm/node-gcm.d.ts @@ -10,6 +10,9 @@ declare module "node-gcm" { delayWhileIdle?: boolean; timeToLive?: number; dryRun?: boolean; + data: { + [key: string]: string; + }; } export class Message { @@ -20,7 +23,7 @@ declare module "node-gcm" { dryRun: boolean; addData(key: string, value: string): void; - addData(data: any): void; + addData(data: { [key: string]: string }): void; } From ceb059b2abcef0ea59486185f4cee366df07aaf8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 17 Aug 2015 14:06:50 -0700 Subject: [PATCH 9/9] Removed union types from definition files. --- jquery.uniform/jquery.uniform.d.ts | 11 ++++++++--- jqueryui/jqueryui.d.ts | 2 +- log4js/log4js.d.ts | 6 +++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/jquery.uniform/jquery.uniform.d.ts b/jquery.uniform/jquery.uniform.d.ts index e91a41c93b..d5eee3e478 100644 --- a/jquery.uniform/jquery.uniform.d.ts +++ b/jquery.uniform/jquery.uniform.d.ts @@ -5,7 +5,7 @@ /// -interface UniformOptions { +interface UniformCoreOptions { activeClass?: string; autoHide?: boolean; buttonClass?: string; @@ -34,12 +34,17 @@ interface UniformOptions { useID?: boolean; wrapperClass?: string; } + +interface UniformOptions extends UniformCoreOptions { + [option: string]: any; +} + interface Uniform { - (options?: UniformOptions & {[option: string]: any;}): JQuery; + (options?: UniformOptions): JQuery; update(elemOrSelector?: any): void; restore(elemOrSelector?: any): void; elements: JQuery[]; - defaults: UniformOptions; + defaults: UniformOptions; } interface JQueryStatic { uniform: Uniform; diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 80cda8976a..e658d0d109 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -1670,7 +1670,7 @@ interface JQuery { sortable(methodName: string): JQuery; sortable(options: JQueryUI.SortableOptions): JQuery; sortable(optionLiteral: string, optionName: string): any; - sortable(methodName: 'serialize', options: { key?: string; attribute?: string; expression?: RegExp }); + sortable(methodName: 'serialize', options: { key?: string; attribute?: string; expression?: RegExp }): string; sortable(optionLiteral: string, options: JQueryUI.SortableOptions): any; sortable(optionLiteral: string, optionName: string, optionValue: any): JQuery; diff --git a/log4js/log4js.d.ts b/log4js/log4js.d.ts index 70059142c5..5ecec0db10 100644 --- a/log4js/log4js.d.ts +++ b/log4js/log4js.d.ts @@ -232,6 +232,10 @@ declare module "log4js" { | GelfAppenderConfig | MultiprocessAppenderConfig - type AppenderConfig = CoreAppenderConfig | (AppenderConfigBase & { [prop: string]: any; }); + interface CustomAppenderConfig extends AppenderConfigBase { + [prop: string]: any; + } + + type AppenderConfig = CoreAppenderConfig | CustomAppenderConfig; }