From 4e00b9e8dc11eef0b7ef4bd2f1bbfb91f3e2cc2f Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Thu, 12 May 2016 22:24:49 +0100 Subject: [PATCH 001/203] Update to version 2.20.4 Update methods from node-validator (https://github.com/chriso/validator.js) and update express-validator methods to adhere to the latest api. --- express-validator/express-validator-tests.ts | 14 +- express-validator/express-validator.d.ts | 136 ++++++++++++------- 2 files changed, 99 insertions(+), 51 deletions(-) diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts index 74bd277e46..ebd61d6cfc 100644 --- a/express-validator/express-validator-tests.ts +++ b/express-validator/express-validator-tests.ts @@ -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(['']).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/express-validator.d.ts b/express-validator/express-validator.d.ts index 52792a391f..cb15aebf8f 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -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 , 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 { @@ -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 { [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 { @@ -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,13 @@ declare namespace ExpressValidator { * Alias for isDecimal */ isFloat(): Validator; + isFullWidth(): Validator; + isHalfWidth(): Validator; + isVariableWidth(): Validator; /** * Check if length is 0 */ - notNull(): Validator; + //notNull(): Validator; // I don't see this in the documentation or code anywhere. isNull(): Validator; /** * Not just whitespace (input.trim().length !== 0) @@ -104,12 +130,14 @@ declare namespace ExpressValidator { notEmpty(): Validator; equals(equals:any): Validator; contains(str:string): Validator; - notContains(str:string): Validator; + //notContains(str:string): Validator; // I don't see this in the documentation or code anywhere. + matches(pattern:string, modifiers?:string): Validator; + matches(pattern: RegExp): Validator; /** * Usage: regex(/[a-z]/i) or regex('[a-z]','i') */ - regex(pattern:string, modifiers:string): Validator; - notRegex(pattern:string, modifiers:string): Validator; + //regex(pattern:string, modifiers:string): Validator; // I don't see this in the documentation or code anywhere. + //notRegex(pattern:string, modifiers:string): Validator; // I don't see this in the documentation or code anywhere. /** * max is optional */ @@ -117,7 +145,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 +165,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); /** * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats */ @@ -155,7 +186,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 +199,50 @@ 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; + //ifNull(replace:any): Sanitizer; // I don't see this in the documentation or code anywhere. 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; + } } From 396e37eb8b17cace44ba2bce0f2aa59a88d17fd0 Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Thu, 12 May 2016 22:38:26 +0100 Subject: [PATCH 002/203] Remove ambient semicolon --- express-validator/express-validator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index cb15aebf8f..583ffbf6e8 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -33,7 +33,7 @@ declare namespace ExpressValidator { } interface ValidatorFunction { (item: string | {}, message?: string): Validator; } - interface ValidatorExtraFunction extends ValidatorFunction { (matchIndex: number, message?: string): Validator; }; + interface ValidatorExtraFunction extends ValidatorFunction { (matchIndex: number, message?: string): Validator; } interface SanitizerFunction { (item: string): Sanitizer; } interface Dictionary { [key: string]: T; } From 10bc473fe57df9c5acb2926faf785ece99beb37f Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Thu, 12 May 2016 22:44:39 +0100 Subject: [PATCH 003/203] Add return type to isWhitelisted method. --- express-validator/express-validator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 583ffbf6e8..71797efce2 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -178,7 +178,7 @@ declare namespace ExpressValidator { min(val:string): Validator; isJSON(): Validator; isLength(options: MinMaxOptions): Validator; - isWhitelisted(chars: string); + isWhitelisted(chars: string): Validator; /** * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats */ From c8d5f64ef86cd7c3227bef1d412c034db8bbaf6d Mon Sep 17 00:00:00 2001 From: Gayan Ranasinghe Date: Mon, 4 Jul 2016 16:20:28 +0530 Subject: [PATCH 004/203] added some fields --- kendo-ui/kendo-ui.d.ts | 1425 ++++++++++++++++++++-------------------- 1 file changed, 717 insertions(+), 708 deletions(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index 934a8cd8b1..b8aea8a61a 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -3,7 +3,7 @@ // Definitions by: Telerik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// + declare namespace kendo { function culture(): { @@ -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; @@ -300,7 +302,7 @@ declare namespace kendo { } class ViewContainer extends Observable { - view: View; + view: View; } class Layout extends View { @@ -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 { @@ -508,7 +510,8 @@ declare namespace kendo.data { render(value: Object): string; } - namespace binders { } + module binders { } + export var binders; interface Bindings { [key: string]: Binding; @@ -531,7 +534,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 +574,8 @@ declare namespace kendo.data { isAllDay?: boolean; id?: any; start?: Date; + ownerId?: number; + taskId?: number; startTimezone?: string; recurrenceId?: any; recurrenceRule?: string; @@ -583,7 +588,8 @@ declare namespace kendo.data { static fields: DataSourceSchemaModelFields; constructor(data?: SchedulerEventData); - + ownerId: number; + taskId: number; description: string; end: Date; endTimezone: string; @@ -839,7 +845,7 @@ declare namespace kendo.data { columns: PivotSchemaColumnAxis; } - interface PivotSchema extends DataSourceSchema{ + interface PivotSchema extends DataSourceSchema { axes?: any; catalogs?: any; cubes?: any; @@ -948,7 +954,7 @@ declare namespace kendo.data { } interface DataSourceSchemaWithConstructorModel extends DataSourceSchema { - model?: typeof Model; + model?: typeof Model; } interface DataSourceSchemaModel { @@ -996,7 +1002,7 @@ declare namespace kendo.data { every(callback: (item: Object, index: number, source: ObservableArray) => boolean): boolean; filter(callback: (item: Object, index: number, source: ObservableArray) => boolean): any[]; find(callback: (item: Object, index: number, source: ObservableArray) => boolean): any; - forEach(callback: (item: Object, index: number, source: ObservableArray) => void ): void; + forEach(callback: (item: Object, index: number, source: ObservableArray) => void): void; indexOf(item: any): number; join(separator: string): string; map(callback: (item: Object, index: number, source: ObservableArray) => any): any[]; @@ -1022,7 +1028,7 @@ declare namespace kendo.data { items?: kendo.data.Model[]; } - class DataSource extends Observable{ + class DataSource extends Observable { options: DataSourceOptions; static create(options?: DataSourceOptions): DataSource; @@ -1242,7 +1248,7 @@ declare namespace kendo.data { sort?: any; transport?: DataSourceTransport; type?: string; - change? (e: DataSourceChangeEvent): void; + change?(e: DataSourceChangeEvent): void; error?(e: DataSourceErrorEvent): void; sync?(e: DataSourceEvent): void; requestStart?(e: DataSourceRequestStartEvent): void; @@ -1325,7 +1331,7 @@ declare namespace kendo.ui { function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.dataviz.ui, prefix?: String): void; function plugin(widget: any, register?: typeof kendo.dataviz.ui, prefix?: String): void; - class Draggable extends kendo.ui.Widget{ + class Draggable extends kendo.ui.Widget { element: JQuery; currentTarget: JQuery; constructor(element: Element, options?: DraggableOptions); @@ -1336,7 +1342,7 @@ declare namespace kendo.ui { sender?: Draggable; } - class DropTarget extends kendo.ui.Widget{ + class DropTarget extends kendo.ui.Widget { element: JQuery; constructor(element: Element, options?: DropTargetOptions); options: DropTargetOptions; @@ -1366,7 +1372,7 @@ declare namespace kendo.ui { draggable?: kendo.ui.Draggable; } - class DropTargetArea extends kendo.ui.Widget{ + class DropTargetArea extends kendo.ui.Widget { element: JQuery; constructor(element: Element, options?: DropTargetAreaOptions); options: DropTargetAreaOptions; @@ -1517,7 +1523,7 @@ declare namespace kendo.dataviz.map.layer { declare namespace kendo.drawing.pdf { function saveAs(group: kendo.drawing.Group, fileName: string, - proxyUrl?: string, callback?: Function): void; + proxyUrl?: string, callback?: Function): void; } declare namespace kendo.geometry { @@ -1690,7 +1696,7 @@ declare namespace kendo.geometry { origin: kendo.geometry.Point; size: kendo.geometry.Size; - constructor(origin: kendo.geometry.Point|any, size: kendo.geometry.Size|any); + constructor(origin: kendo.geometry.Point | any, size: kendo.geometry.Size | any); static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; @@ -1916,7 +1922,7 @@ declare namespace kendo.drawing { } - interface FillOptions { + interface FillOptions { @@ -2215,7 +2221,7 @@ declare namespace kendo.drawing { } - interface PDFOptions { + interface PDFOptions { @@ -2319,7 +2325,7 @@ declare namespace kendo.drawing { interface RadialGradientOptions { name?: string; - center?: any|kendo.geometry.Point; + center?: any | kendo.geometry.Point; radius?: number; stops?: any; } @@ -2403,7 +2409,7 @@ declare namespace kendo.drawing { } - interface StrokeOptions { + interface StrokeOptions { @@ -2457,8 +2463,8 @@ declare namespace kendo.drawing { } interface SurfaceTooltip { - animation?: boolean|SurfaceTooltipAnimation; - appendTo?: string|JQuery; + animation?: boolean | SurfaceTooltipAnimation; + appendTo?: string | JQuery; } interface SurfaceOptions { @@ -2553,20 +2559,20 @@ declare namespace kendo.drawing { } - interface TooltipOptions { + interface TooltipOptions { autoHide?: boolean; - content?: string|Function; + content?: string | Function; position?: string; - height?: number|string; + height?: number | string; hideDelay?: number; offset?: number; shared?: boolean; showAfter?: number; showOn?: string; - width?: number|string; + width?: number | string; @@ -2636,14 +2642,14 @@ declare namespace kendo.ui { interface AutoCompleteOptions { name?: string; - animation?: boolean|AutoCompleteAnimation; - dataSource?: any|any|kendo.data.DataSource; + animation?: boolean | AutoCompleteAnimation; + dataSource?: any | any | kendo.data.DataSource; dataTextField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string|Function; - groupTemplate?: string|Function; + fixedGroupTemplate?: string | Function; + groupTemplate?: string | Function; height?: number; highlightFirst?: boolean; ignoreCase?: boolean; @@ -2652,10 +2658,11 @@ declare namespace kendo.ui { popup?: any; separator?: string; suggest?: boolean; - headerTemplate?: string|Function; - template?: string|Function; + value?: any; + headerTemplate?: string | Function; + template?: string | Function; valuePrimitive?: boolean; - virtual?: boolean|AutoCompleteVirtual; + virtual?: boolean | AutoCompleteVirtual; change?(e: AutoCompleteChangeEvent): void; close?(e: AutoCompleteCloseEvent): void; dataBound?(e: AutoCompleteDataBoundEvent): void; @@ -2773,8 +2780,8 @@ declare namespace kendo.ui { culture?: string; dates?: any; depth?: string; - disableDates?: any|Function; - footer?: string|Function; + disableDates?: any | Function; + footer?: string | Function; format?: string; max?: Date; min?: Date; @@ -2821,7 +2828,7 @@ declare namespace kendo.ui { interface ColorPaletteOptions { name?: string; - palette?: string|any; + palette?: string | any; columns?: number; tileSize?: ColorPaletteTileSize; value?: string; @@ -2876,7 +2883,7 @@ declare namespace kendo.ui { columns?: number; tileSize?: ColorPickerTileSize; messages?: ColorPickerMessages; - palette?: string|any; + palette?: string | any; opacity?: boolean; preview?: boolean; toolIcon?: string; @@ -2976,14 +2983,14 @@ declare namespace kendo.ui { autoBind?: boolean; cascadeFrom?: string; cascadeFromField?: string; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataTextField?: string; dataValueField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string|Function; - groupTemplate?: string|Function; + fixedGroupTemplate?: string | Function; + groupTemplate?: string | Function; height?: number; highlightFirst?: boolean; ignoreCase?: boolean; @@ -2992,12 +2999,12 @@ declare namespace kendo.ui { placeholder?: string; popup?: ComboBoxPopup; suggest?: boolean; - headerTemplate?: string|Function; - template?: string|Function; + headerTemplate?: string | Function; + template?: string | Function; text?: string; value?: string; valuePrimitive?: boolean; - virtual?: boolean|ComboBoxVirtual; + virtual?: boolean | ComboBoxVirtual; change?(e: ComboBoxChangeEvent): void; close?(e: ComboBoxCloseEvent): void; dataBound?(e: ComboBoxDataBoundEvent): void; @@ -3092,16 +3099,16 @@ declare namespace kendo.ui { interface ContextMenuOptions { name?: string; alignToAnchor?: boolean; - animation?: boolean|ContextMenuAnimation; + animation?: boolean | ContextMenuAnimation; closeOnClick?: boolean; - dataSource?: any|any; + dataSource?: any | any; direction?: string; filter?: string; hoverDelay?: number; orientation?: string; popupCollision?: string; showOn?: string; - target?: string|JQuery; + target?: string | JQuery; close?(e: ContextMenuCloseEvent): void; open?(e: ContextMenuOpenEvent): void; activate?(e: ContextMenuActivateEvent): void; @@ -3202,13 +3209,13 @@ declare namespace kendo.ui { interface DatePickerOptions { name?: string; - animation?: boolean|DatePickerAnimation; + animation?: boolean | DatePickerAnimation; ARIATemplate?: string; culture?: string; dates?: any; depth?: string; - disableDates?: any|Function; - footer?: string|Function; + disableDates?: any | Function; + footer?: string | Function; format?: string; max?: Date; min?: Date; @@ -3292,12 +3299,12 @@ declare namespace kendo.ui { interface DateTimePickerOptions { name?: string; - animation?: boolean|DateTimePickerAnimation; + animation?: boolean | DateTimePickerAnimation; ARIATemplate?: string; culture?: string; dates?: any; depth?: string; - disableDates?: any|Function; + disableDates?: any | Function; footer?: string; format?: string; interval?: number; @@ -3403,32 +3410,32 @@ declare namespace kendo.ui { interface DropDownListOptions { name?: string; - animation?: boolean|DropDownListAnimation; + animation?: boolean | DropDownListAnimation; autoBind?: boolean; cascadeFrom?: string; cascadeFromField?: string; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataTextField?: string; dataValueField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string|Function; - groupTemplate?: string|Function; + fixedGroupTemplate?: string | Function; + groupTemplate?: string | Function; height?: number; ignoreCase?: boolean; index?: number; minLength?: number; popup?: DropDownListPopup; - optionLabel?: string|any; - optionLabelTemplate?: string|Function; - headerTemplate?: string|Function; - template?: string|Function; - valueTemplate?: string|Function; + optionLabel?: string | any; + optionLabelTemplate?: string | Function; + headerTemplate?: string | Function; + template?: string | Function; + valueTemplate?: string | Function; text?: string; value?: string; valuePrimitive?: boolean; - virtual?: boolean|DropDownListVirtual; + virtual?: boolean | DropDownListVirtual; change?(e: DropDownListChangeEvent): void; close?(e: DropDownListCloseEvent): void; dataBound?(e: DropDownListDataBoundEvent): void; @@ -3550,32 +3557,32 @@ declare namespace kendo.ui { interface EditorFileBrowserTransportCreate { contentType?: string; - data?: any|string|Function; + data?: any | string | Function; dataType?: string; type?: string; - url?: string|Function; + url?: string | Function; } interface EditorFileBrowserTransportDestroy { contentType?: string; - data?: any|string|Function; + data?: any | string | Function; dataType?: string; type?: string; - url?: string|Function; + url?: string | Function; } interface EditorFileBrowserTransportRead { contentType?: string; - data?: any|string|Function; + data?: any | string | Function; dataType?: string; type?: string; - url?: string|Function; + url?: string | Function; } interface EditorFileBrowserTransport { read?: EditorFileBrowserTransportRead; uploadUrl?: string; - fileUrl?: string|Function; + fileUrl?: string | Function; destroy?: EditorFileBrowserTransportDestroy; create?: EditorFileBrowserTransportCreate; } @@ -3632,33 +3639,33 @@ declare namespace kendo.ui { interface EditorImageBrowserTransportCreate { contentType?: string; - data?: any|string|Function; + data?: any | string | Function; dataType?: string; type?: string; - url?: string|Function; + url?: string | Function; } interface EditorImageBrowserTransportDestroy { contentType?: string; - data?: any|string|Function; + data?: any | string | Function; dataType?: string; type?: string; - url?: string|Function; + url?: string | Function; } interface EditorImageBrowserTransportRead { contentType?: string; - data?: any|string|Function; + data?: any | string | Function; dataType?: string; type?: string; - url?: string|Function; + url?: string | Function; } interface EditorImageBrowserTransport { read?: EditorImageBrowserTransportRead; - thumbnailUrl?: string|Function; + thumbnailUrl?: string | Function; uploadUrl?: string; - imageUrl?: string|Function; + imageUrl?: string | Function; destroy?: EditorImageBrowserTransportDestroy; create?: EditorImageBrowserTransportCreate; } @@ -3747,15 +3754,15 @@ declare namespace kendo.ui { } interface EditorPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface EditorPdf { author?: string; - avoidLinks?: boolean|string; + avoidLinks?: boolean | string; creator?: string; date?: Date; fileName?: string; @@ -3763,7 +3770,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: EditorPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -3814,7 +3821,7 @@ declare namespace kendo.ui { messages?: EditorMessages; pasteCleanup?: EditorPasteCleanup; pdf?: EditorPdf; - resizable?: boolean|EditorResizable; + resizable?: boolean | EditorResizable; serialization?: EditorSerialization; stylesheets?: any; tools?: EditorTool[]; @@ -3930,7 +3937,7 @@ declare namespace kendo.ui { interface FilterMenuOptions { name?: string; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; extra?: boolean; field?: string; messages?: FilterMenuMessages; @@ -4034,7 +4041,7 @@ declare namespace kendo.ui { } interface GanttAssignments { - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataResourceIdField?: string; dataTaskIdField?: string; dataValueField?: string; @@ -4044,7 +4051,7 @@ declare namespace kendo.ui { field?: string; title?: string; format?: string; - width?: string|number; + width?: string | number; editable?: boolean; sortable?: boolean; } @@ -4055,7 +4062,7 @@ declare namespace kendo.ui { interface GanttEditable { confirmation?: boolean; - template?: string|Function; + template?: string | Function; } interface GanttMessagesActions { @@ -4102,15 +4109,15 @@ declare namespace kendo.ui { } interface GanttPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface GanttPdf { author?: string; - avoidLinks?: boolean|string; + avoidLinks?: boolean | string; creator?: string; date?: Date; fileName?: string; @@ -4118,7 +4125,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: GanttPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -4128,31 +4135,31 @@ declare namespace kendo.ui { interface GanttResources { dataFormatField?: string; dataColorField?: string; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataTextField?: string; field?: string; } interface GanttToolbarItem { name?: string; - template?: string|Function; + template?: string | Function; text?: string; } interface GanttTooltip { - template?: string|Function; + template?: string | Function; visible?: boolean; } interface GanttView { type?: string; selected?: boolean; - slotSize?: number|string; - timeHeaderTemplate?: string|Function; - dayHeaderTemplate?: string|Function; - weekHeaderTemplate?: string|Function; - monthHeaderTemplate?: string|Function; - yearHeaderTemplate?: string|Function; + slotSize?: number | string; + timeHeaderTemplate?: string | Function; + dayHeaderTemplate?: string | Function; + weekHeaderTemplate?: string | Function; + monthHeaderTemplate?: string | Function; + yearHeaderTemplate?: string | Function; resizeTooltipFormat?: string; } @@ -4162,10 +4169,10 @@ declare namespace kendo.ui { autoBind?: boolean; columnResizeHandleWidth?: number; columns?: GanttColumn[]; - currentTimeMarker?: boolean|GanttCurrentTimeMarker; - dataSource?: any|any|kendo.data.GanttDataSource; - dependencies?: any|any|kendo.data.GanttDependencyDataSource; - editable?: boolean|GanttEditable; + currentTimeMarker?: boolean | GanttCurrentTimeMarker; + dataSource?: any | any | kendo.data.GanttDataSource; + dependencies?: any | any | kendo.data.GanttDependencyDataSource; + editable?: boolean | GanttEditable; navigatable?: boolean; workDayStart?: Date; workDayEnd?: Date; @@ -4173,20 +4180,20 @@ declare namespace kendo.ui { workWeekEnd?: number; hourSpan?: number; snap?: boolean; - height?: number|string; - listWidth?: string|number; + height?: number | string; + listWidth?: string | number; messages?: GanttMessages; pdf?: GanttPdf; resizable?: boolean; selectable?: boolean; showWorkDays?: boolean; showWorkHours?: boolean; - taskTemplate?: string|Function; + taskTemplate?: string | Function; toolbar?: GanttToolbarItem[]; tooltip?: GanttTooltip; views?: GanttView[]; resources?: GanttResources; - rowHeight?: number|string; + rowHeight?: number | string; dataBinding?(e: GanttDataBindingEvent): void; dataBound?(e: GanttDataBoundEvent): void; add?(e: GanttAddEvent): void; @@ -4380,7 +4387,7 @@ declare namespace kendo.ui { } interface GridAllowCopy { - delimeter?: string|any; + delimeter?: string | any; } interface GridColumnMenuMessages { @@ -4416,7 +4423,7 @@ declare namespace kendo.ui { } interface GridColumnFilterableCell { - dataSource?: any|kendo.data.DataSource; + dataSource?: any | kendo.data.DataSource; dataTextField?: string; delay?: number; inputWidth?: number; @@ -4431,13 +4438,13 @@ declare namespace kendo.ui { interface GridColumnFilterable { cell?: GridColumnFilterableCell; multi?: boolean; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; checkAll?: boolean; itemTemplate?: Function; operators?: any; search?: boolean; ignoreCase?: boolean; - ui?: string|Function; + ui?: string | Function; } interface GridColumnSortable { @@ -4451,35 +4458,36 @@ declare namespace kendo.ui { command?: GridColumnCommandItem[]; encoded?: boolean; field?: string; - filterable?: boolean|GridColumnFilterable; + filterable?: boolean | GridColumnFilterable; footerAttributes?: any; - footerTemplate?: string|Function; + footerTemplate?: string | Function; format?: string; groupable?: boolean; - groupHeaderTemplate?: string|Function; - groupFooterTemplate?: string|Function; + groupHeaderTemplate?: string | Function; + groupFooterTemplate?: string | Function; headerAttributes?: any; - headerTemplate?: string|Function; + headerTemplate?: string | Function; hidden?: boolean; locked?: boolean; lockable?: boolean; minScreenWidth?: number; - sortable?: boolean|GridColumnSortable; - template?: string|Function; + sortable?: boolean | GridColumnSortable; + template?: string | Function; title?: string; - width?: string|number; + width?: string | number; values?: any; menu?: boolean; + type?: any; } interface GridEditable { - confirmation?: boolean|string|Function; + confirmation?: boolean | string | Function; cancelDelete?: string; confirmDelete?: string; createAt?: string; destroy?: boolean; mode?: string; - template?: string|Function; + template?: string | Function; update?: boolean; window?: any; } @@ -4592,7 +4600,7 @@ declare namespace kendo.ui { } interface GridNoRecords { - template?: string|Function; + template?: string | Function; } interface GridPageableMessages { @@ -4615,23 +4623,23 @@ declare namespace kendo.ui { numeric?: boolean; buttonCount?: number; input?: boolean; - pageSizes?: boolean|any; + pageSizes?: boolean | any; refresh?: boolean; info?: boolean; messages?: GridPageableMessages; } interface GridPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface GridPdf { allPages?: boolean; author?: string; - avoidLinks?: boolean|string; + avoidLinks?: boolean | string; creator?: string; date?: Date; fileName?: string; @@ -4639,7 +4647,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: GridPdfMargin; - paperSize?: string|any; + paperSize?: string | any; template?: string; repeatHeaders?: boolean; scale?: number; @@ -4660,38 +4668,38 @@ declare namespace kendo.ui { interface GridToolbarItem { name?: string; - template?: string|Function; + template?: string | Function; text?: string; } interface GridOptions { name?: string; - allowCopy?: boolean|GridAllowCopy; - altRowTemplate?: string|Function; + allowCopy?: boolean | GridAllowCopy; + altRowTemplate?: string | Function; autoBind?: boolean; columnResizeHandleWidth?: number; columns?: GridColumn[]; - columnMenu?: boolean|GridColumnMenu; - dataSource?: any|any|kendo.data.DataSource; - detailTemplate?: string|Function; - editable?: boolean|GridEditable; + columnMenu?: boolean | GridColumnMenu; + dataSource?: any | any | kendo.data.DataSource; + detailTemplate?: string | Function; + editable?: boolean | GridEditable; excel?: GridExcel; - filterable?: boolean|GridFilterable; - groupable?: boolean|GridGroupable; - height?: number|string; + filterable?: boolean | GridFilterable; + groupable?: boolean | GridGroupable; + height?: number | string; messages?: GridMessages; - mobile?: boolean|string; + mobile?: boolean | string; navigatable?: boolean; - noRecords?: boolean|GridNoRecords; - pageable?: boolean|GridPageable; + noRecords?: boolean | GridNoRecords; + pageable?: boolean | GridPageable; pdf?: GridPdf; reorderable?: boolean; resizable?: boolean; - rowTemplate?: string|Function; - scrollable?: boolean|GridScrollable; - selectable?: boolean|string; - sortable?: boolean|GridSortable; - toolbar?: string | ((...args:any[]) => string) | GridToolbarItem[]; + rowTemplate?: string | Function; + scrollable?: boolean | GridScrollable; + selectable?: boolean | string; + sortable?: boolean | GridSortable; + toolbar?: string | ((...args: any[]) => string) | GridToolbarItem[]; cancel?(e: GridCancelEvent): void; change?(e: GridChangeEvent): void; columnHide?(e: GridColumnHideEvent): void; @@ -4865,10 +4873,10 @@ declare namespace kendo.ui { interface ListViewOptions { name?: string; autoBind?: boolean; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; editTemplate?: Function; navigatable?: boolean; - selectable?: boolean|string; + selectable?: boolean | string; template?: Function; altTemplate?: Function; cancel?(e: ListViewCancelEvent): void; @@ -5007,9 +5015,9 @@ declare namespace kendo.ui { interface MenuOptions { name?: string; - animation?: boolean|MenuAnimation; + animation?: boolean | MenuAnimation; closeOnClick?: boolean; - dataSource?: any|any; + dataSource?: any | any; direction?: string; hoverDelay?: number; openOnClick?: boolean; @@ -5114,17 +5122,17 @@ declare namespace kendo.ui { interface MultiSelectOptions { name?: string; - animation?: boolean|MultiSelectAnimation; + animation?: boolean | MultiSelectAnimation; autoBind?: boolean; autoClose?: boolean; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataTextField?: string; dataValueField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string|Function; - groupTemplate?: string|Function; + fixedGroupTemplate?: string | Function; + groupTemplate?: string | Function; height?: number; highlightFirst?: boolean; ignoreCase?: boolean; @@ -5132,13 +5140,13 @@ declare namespace kendo.ui { maxSelectedItems?: number; placeholder?: string; popup?: MultiSelectPopup; - headerTemplate?: string|Function; - itemTemplate?: string|Function; + headerTemplate?: string | Function; + itemTemplate?: string | Function; tagTemplate?: string; tagMode?: string; value?: any; valuePrimitive?: boolean; - virtual?: boolean|MultiSelectVirtual; + virtual?: boolean | MultiSelectVirtual; change?(e: MultiSelectChangeEvent): void; close?(e: MultiSelectCloseEvent): void; dataBound?(e: MultiSelectDataBoundEvent): void; @@ -5227,16 +5235,16 @@ declare namespace kendo.ui { interface NotificationOptions { name?: string; allowHideAfter?: number; - animation?: any|boolean; - appendTo?: string|JQuery; + animation?: any | boolean; + appendTo?: string | JQuery; autoHideAfter?: number; button?: boolean; - height?: number|string; + height?: number | string; hideOnClick?: boolean; position?: NotificationPosition; stacking?: string; templates?: NotificationTemplate[]; - width?: number|string; + width?: number | string; hide?(e: NotificationHideEvent): void; show?(e: NotificationShowEvent): void; } @@ -5361,13 +5369,13 @@ declare namespace kendo.ui { name?: string; autoBind?: boolean; buttonCount?: number; - dataSource?: any|kendo.data.DataSource; + dataSource?: any | kendo.data.DataSource; selectTemplate?: string; linkTemplate?: string; info?: boolean; input?: boolean; numeric?: boolean; - pageSizes?: boolean|any; + pageSizes?: boolean | any; previousNext?: boolean; refresh?: boolean; messages?: PagerMessages; @@ -5475,9 +5483,9 @@ declare namespace kendo.ui { interface PanelBarOptions { name?: string; - animation?: boolean|PanelBarAnimation; + animation?: boolean | PanelBarAnimation; contentUrls?: any; - dataSource?: any|any; + dataSource?: any | any; expandMode?: string; activate?(e: PanelBarActivateEvent): void; collapse?(e: PanelBarCollapseEvent): void; @@ -5581,10 +5589,10 @@ declare namespace kendo.ui { interface PivotConfiguratorOptions { name?: string; - dataSource?: any|kendo.data.PivotDataSource; + dataSource?: any | kendo.data.PivotDataSource; filterable?: boolean; - sortable?: boolean|PivotConfiguratorSortable; - height?: number|string; + sortable?: boolean | PivotConfiguratorSortable; + height?: number | string; messages?: PivotConfiguratorMessages; } interface PivotConfiguratorEvent { @@ -5660,15 +5668,15 @@ declare namespace kendo.ui { } interface PivotGridPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface PivotGridPdf { author?: string; - avoidLinks?: boolean|string; + avoidLinks?: boolean | string; creator?: string; date?: Date; fileName?: string; @@ -5676,7 +5684,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: PivotGridPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -5689,20 +5697,20 @@ declare namespace kendo.ui { interface PivotGridOptions { name?: string; - dataSource?: any|kendo.data.PivotDataSource; + dataSource?: any | kendo.data.PivotDataSource; autoBind?: boolean; reorderable?: boolean; excel?: PivotGridExcel; pdf?: PivotGridPdf; filterable?: boolean; - sortable?: boolean|PivotGridSortable; + sortable?: boolean | PivotGridSortable; columnWidth?: number; - height?: number|string; - columnHeaderTemplate?: string|Function; - dataCellTemplate?: string|Function; - kpiStatusTemplate?: string|Function; - kpiTrendTemplate?: string|Function; - rowHeaderTemplate?: string|Function; + height?: number | string; + columnHeaderTemplate?: string | Function; + dataCellTemplate?: string | Function; + kpiStatusTemplate?: string | Function; + kpiTrendTemplate?: string | Function; + rowHeaderTemplate?: string | Function; messages?: PivotGridMessages; dataBinding?(e: PivotGridDataBindingEvent): void; dataBound?(e: PivotGridDataBoundEvent): void; @@ -5784,9 +5792,9 @@ declare namespace kendo.ui { interface PopupOptions { name?: string; adjustSize?: any; - animation?: boolean|PopupAnimation; - anchor?: string|JQuery; - appendTo?: string|JQuery; + animation?: boolean | PopupAnimation; + anchor?: string | JQuery; + appendTo?: string | JQuery; collision?: string; origin?: string; position?: string; @@ -5889,6 +5897,7 @@ declare namespace kendo.ui { destroy(): void; enable(enable: boolean): void; value(): any; + values(): any; value(selectionStart: number, selectionEnd: number): void; resize(): void; @@ -6017,19 +6026,19 @@ declare namespace kendo.ui { } interface SchedulerEditable { - confirmation?: boolean|string; + confirmation?: boolean | string; create?: boolean; destroy?: boolean; editRecurringMode?: string; move?: boolean; resize?: boolean; - template?: string|Function; + template?: string | Function; update?: boolean; window?: any; } interface SchedulerFooter { - command?: string|boolean; + command?: string | boolean; } interface SchedulerGroup { @@ -6166,15 +6175,15 @@ declare namespace kendo.ui { } interface SchedulerPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface SchedulerPdf { author?: string; - avoidLinks?: boolean|string; + avoidLinks?: boolean | string; creator?: string; date?: Date; fileName?: string; @@ -6182,7 +6191,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: SchedulerPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -6191,7 +6200,7 @@ declare namespace kendo.ui { interface SchedulerResource { dataColorField?: string; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataTextField?: string; dataValueField?: string; field?: string; @@ -6216,26 +6225,26 @@ declare namespace kendo.ui { } interface SchedulerView { - allDayEventTemplate?: string|Function; + allDayEventTemplate?: string | Function; allDaySlot?: boolean; - allDaySlotTemplate?: string|Function; + allDaySlotTemplate?: string | Function; columnWidth?: number; - dateHeaderTemplate?: string|Function; - dayTemplate?: string|Function; - editable?: boolean|SchedulerViewEditable; + dateHeaderTemplate?: string | Function; + dayTemplate?: string | Function; + editable?: boolean | SchedulerViewEditable; endTime?: Date; eventHeight?: number; - eventTemplate?: string|Function; - eventTimeTemplate?: string|Function; + eventTemplate?: string | Function; + eventTimeTemplate?: string | Function; group?: SchedulerViewGroup; majorTick?: number; - majorTimeHeaderTemplate?: string|Function; + majorTimeHeaderTemplate?: string | Function; minorTickCount?: number; - minorTimeHeaderTemplate?: string|Function; + minorTimeHeaderTemplate?: string | Function; selected?: boolean; selectedDateFormat?: string; showWorkHours?: boolean; - slotTemplate?: string|Function; + slotTemplate?: string | Function; startTime?: Date; title?: string; type?: string; @@ -6253,27 +6262,27 @@ declare namespace kendo.ui { interface SchedulerOptions { name?: string; - allDayEventTemplate?: string|Function; + allDayEventTemplate?: string | Function; allDaySlot?: boolean; autoBind?: boolean; - currentTimeMarker?: boolean|SchedulerCurrentTimeMarker; - dataSource?: any|any|kendo.data.SchedulerDataSource; + currentTimeMarker?: boolean | SchedulerCurrentTimeMarker; + dataSource?: any | any | kendo.data.SchedulerDataSource; date?: Date; - dateHeaderTemplate?: string|Function; - editable?: boolean|SchedulerEditable; + dateHeaderTemplate?: string | Function; + editable?: boolean | SchedulerEditable; endTime?: Date; - eventTemplate?: string|Function; - footer?: boolean|SchedulerFooter; + eventTemplate?: string | Function; + footer?: boolean | SchedulerFooter; group?: SchedulerGroup; - height?: number|string; + height?: number | string; majorTick?: number; - majorTimeHeaderTemplate?: string|Function; + majorTimeHeaderTemplate?: string | Function; max?: Date; messages?: SchedulerMessages; min?: Date; minorTickCount?: number; - minorTimeHeaderTemplate?: string|Function; - mobile?: boolean|string; + minorTimeHeaderTemplate?: string | Function; + mobile?: boolean | string; pdf?: SchedulerPdf; resources?: SchedulerResource[]; selectable?: boolean; @@ -6283,8 +6292,8 @@ declare namespace kendo.ui { timezone?: string; toolbar?: SchedulerToolbarItem[]; views?: SchedulerView[]; - groupHeaderTemplate?: string|Function; - width?: number|string; + groupHeaderTemplate?: string | Function; + width?: number | string; workDayStart?: Date; workDayEnd?: Date; workWeekStart?: number; @@ -6480,17 +6489,17 @@ declare namespace kendo.ui { name?: string; axis?: string; autoScroll?: boolean; - container?: string|JQuery; + container?: string | JQuery; connectWith?: string; cursor?: string; cursorOffset?: SortableCursorOffset; disabled?: string; filter?: string; handler?: string; - hint?: Function|string|JQuery; + hint?: Function | string | JQuery; holdToDrag?: boolean; ignore?: string; - placeholder?: Function|string|JQuery; + placeholder?: Function | string | JQuery; start?(e: SortableStartEvent): void; move?(e: SortableMoveEvent): void; end?(e: SortableEndEvent): void; @@ -6677,10 +6686,10 @@ declare namespace kendo.ui { } interface SpreadsheetPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface SpreadsheetPdf { @@ -6696,7 +6705,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: SpreadsheetPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -6720,7 +6729,7 @@ declare namespace kendo.ui { index?: number; logic?: string; type?: string; - value?: number|string|Date; + value?: number | string | Date; values?: any; } @@ -6778,7 +6787,7 @@ declare namespace kendo.ui { link?: string; textAlign?: string; underline?: boolean; - value?: number|string|boolean|Date; + value?: number | string | boolean | Date; validation?: SpreadsheetSheetRowCellValidation; verticalAlign?: string; wrap?: boolean; @@ -6816,9 +6825,9 @@ declare namespace kendo.ui { } interface SpreadsheetToolbar { - home?: boolean|any; - insert?: boolean|any; - data?: boolean|any; + home?: boolean | any; + insert?: boolean | any; + data?: boolean | any; } interface SpreadsheetInsertSheetOptions { @@ -6845,7 +6854,7 @@ declare namespace kendo.ui { rows?: number; sheets?: SpreadsheetSheet[]; sheetsbar?: boolean; - toolbar?: boolean|SpreadsheetToolbar; + toolbar?: boolean | SpreadsheetToolbar; change?(e: SpreadsheetChangeEvent): void; render?(e: SpreadsheetRenderEvent): void; excelExport?(e: SpreadsheetExcelExportEvent): void; @@ -6871,7 +6880,7 @@ declare namespace kendo.ui { } interface SpreadsheetExcelImportEvent extends SpreadsheetEvent { - file?: Blob|File; + file?: Blob | File; progress?: JQueryPromise; } @@ -6971,18 +6980,18 @@ declare namespace kendo.ui { interface TabStripOptions { name?: string; - animation?: boolean|TabStripAnimation; + animation?: boolean | TabStripAnimation; collapsible?: boolean; contentUrls?: any; dataContentField?: string; dataContentUrlField?: string; dataImageUrlField?: string; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; dataSpriteCssClass?: string; dataTextField?: string; dataUrlField?: string; navigatable?: boolean; - scrollable?: boolean|TabStripScrollable; + scrollable?: boolean | TabStripScrollable; tabPosition?: string; value?: string; activate?(e: TabStripActivateEvent): void; @@ -7073,7 +7082,7 @@ declare namespace kendo.ui { interface TimePickerOptions { name?: string; - animation?: boolean|TimePickerAnimation; + animation?: boolean | TimePickerAnimation; culture?: string; dates?: any; format?: string; @@ -7179,13 +7188,13 @@ declare namespace kendo.ui { imageUrl?: string; menuButtons?: ToolBarItemMenuButton[]; overflow?: string; - overflowTemplate?: string|Function; + overflowTemplate?: string | Function; primary?: boolean; selected?: boolean; showIcon?: string; showText?: string; spriteCssClass?: string; - template?: string|Function; + template?: string | Function; text?: string; togglable?: boolean; toggle?: Function; @@ -7280,7 +7289,7 @@ declare namespace kendo.ui { interface TooltipOptions { name?: string; autoHide?: boolean; - animation?: boolean|TooltipAnimation; + animation?: boolean | TooltipAnimation; content?: TooltipContent; callout?: boolean; filter?: string; @@ -7505,7 +7514,7 @@ declare namespace kendo.ui { } interface TreeListColumnFilterable { - ui?: string|Function; + ui?: string | Function; } interface TreeListColumnSortable { @@ -7518,16 +7527,16 @@ declare namespace kendo.ui { encoded?: boolean; expandable?: boolean; field?: string; - filterable?: boolean|TreeListColumnFilterable; - footerTemplate?: string|Function; + filterable?: boolean | TreeListColumnFilterable; + footerTemplate?: string | Function; format?: string; headerAttributes?: any; - headerTemplate?: string|Function; + headerTemplate?: string | Function; minScreenWidth?: number; - sortable?: boolean|TreeListColumnSortable; - template?: string|Function; + sortable?: boolean | TreeListColumnSortable; + template?: string | Function; title?: string; - width?: string|number; + width?: string | number; hidden?: boolean; menu?: boolean; locked?: boolean; @@ -7537,7 +7546,7 @@ declare namespace kendo.ui { interface TreeListEditable { mode?: string; move?: boolean; - template?: string|Function; + template?: string | Function; window?: any; } @@ -7586,15 +7595,15 @@ declare namespace kendo.ui { } interface TreeListPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface TreeListPdf { author?: string; - avoidLinks?: boolean|string; + avoidLinks?: boolean | string; creator?: string; date?: Date; fileName?: string; @@ -7602,7 +7611,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: TreeListPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -7625,17 +7634,17 @@ declare namespace kendo.ui { columns?: TreeListColumn[]; resizable?: boolean; reorderable?: boolean; - columnMenu?: boolean|TreeListColumnMenu; - dataSource?: any|any|kendo.data.TreeListDataSource; - editable?: boolean|TreeListEditable; + columnMenu?: boolean | TreeListColumnMenu; + dataSource?: any | any | kendo.data.TreeListDataSource; + editable?: boolean | TreeListEditable; excel?: TreeListExcel; - filterable?: boolean|TreeListFilterable; - height?: number|string; + filterable?: boolean | TreeListFilterable; + height?: number | string; messages?: TreeListMessages; pdf?: TreeListPdf; - scrollable?: boolean|any; - selectable?: boolean|string; - sortable?: boolean|TreeListSortable; + scrollable?: boolean | any; + selectable?: boolean | string; + sortable?: boolean | TreeListSortable; toolbar?: TreeListToolbarItem[]; cancel?(e: TreeListCancelEvent): void; change?(e: TreeListChangeEvent): void; @@ -7850,14 +7859,14 @@ declare namespace kendo.ui { } interface TreeViewAnimation { - collapse?: boolean|TreeViewAnimationCollapse; - expand?: boolean|TreeViewAnimationExpand; + collapse?: boolean | TreeViewAnimationCollapse; + expand?: boolean | TreeViewAnimationExpand; } interface TreeViewCheckboxes { checkChildren?: boolean; name?: string; - template?: string|Function; + template?: string | Function; } interface TreeViewMessages { @@ -7868,19 +7877,19 @@ declare namespace kendo.ui { interface TreeViewOptions { name?: string; - animation?: boolean|TreeViewAnimation; + animation?: boolean | TreeViewAnimation; autoBind?: boolean; autoScroll?: boolean; - checkboxes?: boolean|TreeViewCheckboxes; + checkboxes?: boolean | TreeViewCheckboxes; dataImageUrlField?: string; - dataSource?: any|any|kendo.data.HierarchicalDataSource; + dataSource?: any | any | kendo.data.HierarchicalDataSource; dataSpriteCssClassField?: string; - dataTextField?: string|any; + dataTextField?: string | any; dataUrlField?: string; dragAndDrop?: boolean; loadOnDemand?: boolean; messages?: TreeViewMessages; - template?: string|Function; + template?: string | Function; change?(e: TreeViewEvent): void; check?(e: TreeViewCheckEvent): void; collapse?(e: TreeViewCollapseEvent): void; @@ -8013,7 +8022,7 @@ declare namespace kendo.ui { localization?: UploadLocalization; multiple?: boolean; showFileList?: boolean; - template?: string|Function; + template?: string | Function; cancel?(e: UploadCancelEvent): void; complete?(e: UploadEvent): void; error?(e: UploadErrorEvent): void; @@ -8167,8 +8176,8 @@ declare namespace kendo.ui { } interface WindowPosition { - top?: number|string; - left?: number|string; + top?: number | string; + left?: number | string; } interface WindowRefreshOptions { @@ -8183,13 +8192,13 @@ declare namespace kendo.ui { interface WindowOptions { name?: string; actions?: any; - animation?: boolean|WindowAnimation; - appendTo?: any|string; + animation?: boolean | WindowAnimation; + appendTo?: any | string; autoFocus?: boolean; content?: WindowContent; draggable?: boolean; iframe?: boolean; - height?: number|string; + height?: number | string; maxHeight?: number; maxWidth?: number; minHeight?: number; @@ -8199,9 +8208,9 @@ declare namespace kendo.ui { position?: WindowPosition; resizable?: boolean; scrollable?: boolean; - title?: string|boolean; + title?: string | boolean; visible?: boolean; - width?: number|string; + width?: number | string; activate?(e: WindowEvent): void; close?(e: WindowCloseEvent): void; deactivate?(e: WindowEvent): void; @@ -8371,7 +8380,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartAxisDefaultsCrosshairTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -8399,7 +8408,7 @@ declare namespace kendo.dataviz.ui { interface ChartAxisDefaultsLabelsRotation { align?: string; - angle?: number|string; + angle?: number | string; } interface ChartAxisDefaultsLabels { @@ -8411,7 +8420,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartAxisDefaultsLabelsRotation; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; visual?: Function; } @@ -8549,7 +8558,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartCategoryAxisItemCrosshairTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -8591,7 +8600,7 @@ declare namespace kendo.dataviz.ui { interface ChartCategoryAxisItemLabelsRotation { align?: string; - angle?: number|string; + angle?: number | string; } interface ChartCategoryAxisItemLabels { @@ -8608,7 +8617,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartCategoryAxisItemLabelsRotation; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; visual?: Function; } @@ -8680,7 +8689,7 @@ declare namespace kendo.dataviz.ui { border?: ChartCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -8726,7 +8735,7 @@ declare namespace kendo.dataviz.ui { border?: ChartCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -8804,7 +8813,7 @@ declare namespace kendo.dataviz.ui { interface ChartCategoryAxisItem { autoBaseUnitSteps?: ChartCategoryAxisItemAutoBaseUnitSteps; - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; background?: string; baseUnit?: string; baseUnitStep?: any; @@ -8833,6 +8842,7 @@ declare namespace kendo.dataviz.ui { type?: string; visible?: boolean; weekStartDay?: number; + axisCrossingValues?: number[]; notes?: ChartCategoryAxisItemNotes; } @@ -8867,7 +8877,7 @@ declare namespace kendo.dataviz.ui { interface ChartLegendInactiveItemsLabels { color?: string; font?: string; - template?: string|Function; + template?: string | Function; } interface ChartLegendInactiveItems { @@ -8898,7 +8908,7 @@ declare namespace kendo.dataviz.ui { font?: string; margin?: ChartLegendLabelsMargin; padding?: ChartLegendLabelsPadding; - template?: string|Function; + template?: string | Function; } interface ChartLegendMargin { @@ -8996,10 +9006,10 @@ declare namespace kendo.dataviz.ui { } interface ChartPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface ChartPdf { @@ -9011,7 +9021,7 @@ declare namespace kendo.dataviz.ui { keywords?: string; landscape?: boolean; margin?: ChartPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -9047,10 +9057,10 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemBorder { - color?: string|Function; - dashType?: string|Function; - opacity?: number|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + opacity?: number | Function; + width?: number | Function; } interface ChartSeriesItemConnectors { @@ -9065,26 +9075,26 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemErrorBars { - value?: string|number|any|Function; + value?: string | number | any | Function; visual?: Function; - xValue?: string|number|any|Function; - yValue?: string|number|any|Function; + xValue?: string | number | any | Function; + yValue?: string | number | any | Function; endCaps?: boolean; color?: string; line?: ChartSeriesItemErrorBarsLine; } interface ChartSeriesItemExtremesBorder { - color?: string|Function; - width?: number|Function; + color?: string | Function; + width?: number | Function; } interface ChartSeriesItemExtremes { - background?: string|Function; + background?: string | Function; border?: ChartSeriesItemExtremesBorder; - size?: number|Function; - type?: string|Function; - rotation?: number|Function; + size?: number | Function; + type?: string | Function; + rotation?: number | Function; } interface ChartSeriesItemHighlightBorder { @@ -9110,15 +9120,15 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface ChartSeriesItemLabelsFromBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface ChartSeriesItemLabelsFromMargin { @@ -9136,16 +9146,16 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsFrom { - background?: string|Function; + background?: string | Function; border?: ChartSeriesItemLabelsFromBorder; - color?: string|Function; - font?: string|Function; - format?: string|Function; + color?: string | Function; + font?: string | Function; + format?: string | Function; margin?: ChartSeriesItemLabelsFromMargin; padding?: ChartSeriesItemLabelsFromPadding; - position?: string|Function; - template?: string|Function; - visible?: boolean|Function; + position?: string | Function; + template?: string | Function; + visible?: boolean | Function; } interface ChartSeriesItemLabelsMargin { @@ -9163,9 +9173,9 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsToBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface ChartSeriesItemLabelsToMargin { @@ -9183,31 +9193,31 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsTo { - background?: string|Function; + background?: string | Function; border?: ChartSeriesItemLabelsToBorder; - color?: string|Function; - font?: string|Function; - format?: string|Function; + color?: string | Function; + font?: string | Function; + format?: string | Function; margin?: ChartSeriesItemLabelsToMargin; padding?: ChartSeriesItemLabelsToPadding; - position?: string|Function; - template?: string|Function; - visible?: boolean|Function; + position?: string | Function; + template?: string | Function; + visible?: boolean | Function; } interface ChartSeriesItemLabels { align?: string; - background?: string|Function; + background?: string | Function; border?: ChartSeriesItemLabelsBorder; - color?: string|Function; + color?: string | Function; distance?: number; - font?: string|Function; - format?: string|Function; + font?: string | Function; + format?: string | Function; margin?: ChartSeriesItemLabelsMargin; padding?: ChartSeriesItemLabelsPadding; - position?: string|Function; - template?: string|Function; - visible?: boolean|Function; + position?: string | Function; + template?: string | Function; + visible?: boolean | Function; visual?: Function; from?: ChartSeriesItemLabelsFrom; to?: ChartSeriesItemLabelsTo; @@ -9228,18 +9238,18 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemMarkersBorder { - color?: string|Function; - width?: number|Function; + color?: string | Function; + width?: number | Function; } interface ChartSeriesItemMarkers { - background?: string|Function; + background?: string | Function; border?: ChartSeriesItemMarkersBorder; - size?: number|Function; - type?: string|Function; - visible?: boolean|Function; + size?: number | Function; + type?: string | Function; + visible?: boolean | Function; visual?: Function; - rotation?: number|Function; + rotation?: number | Function; } interface ChartSeriesItemNegativeValues { @@ -9271,7 +9281,7 @@ declare namespace kendo.dataviz.ui { border?: ChartSeriesItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -9293,16 +9303,16 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemOutliersBorder { - color?: string|Function; - width?: number|Function; + color?: string | Function; + width?: number | Function; } interface ChartSeriesItemOutliers { - background?: string|Function; + background?: string | Function; border?: ChartSeriesItemOutliersBorder; - size?: number|Function; - type?: string|Function; - rotation?: number|Function; + size?: number | Function; + type?: string | Function; + rotation?: number | Function; } interface ChartSeriesItemOverlay { @@ -9315,18 +9325,18 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemTargetBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface ChartSeriesItemTargetLine { - width?: any|Function; + width?: any | Function; } interface ChartSeriesItemTarget { border?: ChartSeriesItemTargetBorder; - color?: string|Function; + color?: string | Function; line?: ChartSeriesItemTargetLine; } @@ -9349,23 +9359,23 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartSeriesItemTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } interface ChartSeriesItem { - aggregate?: string|Function; + aggregate?: string | Function; axis?: string; border?: ChartSeriesItemBorder; categoryField?: string; closeField?: string; - color?: string|Function; + color?: string | Function; colorField?: string; connectors?: ChartSeriesItemConnectors; currentField?: string; dashType?: string; data?: any; - downColor?: string|Function; + downColor?: string | Function; downColorField?: string; segmentSpacing?: number; summaryField?: string; @@ -9416,7 +9426,7 @@ declare namespace kendo.dataviz.ui { size?: number; sizeField?: string; spacing?: number; - stack?: boolean|ChartSeriesItemStack; + stack?: boolean | ChartSeriesItemStack; startAngle?: number; target?: ChartSeriesItemTarget; targetField?: string; @@ -9475,7 +9485,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: ChartSeriesDefaultsLabelsFromMargin; padding?: ChartSeriesDefaultsLabelsFromPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -9521,7 +9531,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: ChartSeriesDefaultsLabelsToMargin; padding?: ChartSeriesDefaultsLabelsToPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -9533,7 +9543,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: ChartSeriesDefaultsLabelsMargin; padding?: ChartSeriesDefaultsLabelsPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; visual?: Function; from?: ChartSeriesDefaultsLabelsFrom; @@ -9564,7 +9574,7 @@ declare namespace kendo.dataviz.ui { border?: ChartSeriesDefaultsNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -9611,7 +9621,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartSeriesDefaultsTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -9632,7 +9642,7 @@ declare namespace kendo.dataviz.ui { scatter?: any; scatterLine?: any; spacing?: number; - stack?: boolean|ChartSeriesDefaultsStack; + stack?: boolean | ChartSeriesDefaultsStack; type?: string; tooltip?: ChartSeriesDefaultsTooltip; verticalArea?: any; @@ -9695,8 +9705,8 @@ declare namespace kendo.dataviz.ui { opacity?: number; padding?: ChartTooltipPadding; shared?: boolean; - sharedTemplate?: string|Function; - template?: string|Function; + sharedTemplate?: string | Function; + template?: string | Function; visible?: boolean; } @@ -9720,7 +9730,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartValueAxisItemCrosshairTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -9754,7 +9764,7 @@ declare namespace kendo.dataviz.ui { interface ChartValueAxisItemLabelsRotation { align?: string; - angle?: number|string; + angle?: number | string; } interface ChartValueAxisItemLabels { @@ -9769,7 +9779,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartValueAxisItemLabelsRotation; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; visual?: Function; } @@ -9842,7 +9852,7 @@ declare namespace kendo.dataviz.ui { border?: ChartValueAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -9888,7 +9898,7 @@ declare namespace kendo.dataviz.ui { border?: ChartValueAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -9952,7 +9962,7 @@ declare namespace kendo.dataviz.ui { } interface ChartValueAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; background?: string; color?: string; crosshair?: ChartValueAxisItemCrosshair; @@ -9997,7 +10007,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartXAxisItemCrosshairTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -10039,7 +10049,7 @@ declare namespace kendo.dataviz.ui { interface ChartXAxisItemLabelsRotation { align?: string; - angle?: number|string; + angle?: number | string; } interface ChartXAxisItemLabels { @@ -10056,7 +10066,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartXAxisItemLabelsRotation; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; visual?: Function; } @@ -10128,7 +10138,7 @@ declare namespace kendo.dataviz.ui { border?: ChartXAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -10174,7 +10184,7 @@ declare namespace kendo.dataviz.ui { border?: ChartXAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -10238,7 +10248,7 @@ declare namespace kendo.dataviz.ui { } interface ChartXAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; background?: string; baseUnit?: string; color?: string; @@ -10285,7 +10295,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartYAxisItemCrosshairTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -10344,7 +10354,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartYAxisItemLabelsRotation; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; visual?: Function; } @@ -10416,7 +10426,7 @@ declare namespace kendo.dataviz.ui { border?: ChartYAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -10462,7 +10472,7 @@ declare namespace kendo.dataviz.ui { border?: ChartYAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -10526,7 +10536,7 @@ declare namespace kendo.dataviz.ui { } interface ChartYAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; background?: string; baseUnit?: string; color?: string; @@ -10562,8 +10572,8 @@ declare namespace kendo.dataviz.ui { } interface ChartZoomable { - mousewheel?: boolean|ChartZoomableMousewheel; - selection?: boolean|ChartZoomableSelection; + mousewheel?: boolean | ChartZoomableMousewheel; + selection?: boolean | ChartZoomableSelection; } interface ChartExportImageOptions { @@ -10596,13 +10606,13 @@ declare namespace kendo.dataviz.ui { interface ChartOptions { name?: string; autoBind?: boolean; - axisDefaults?: ChartAxisDefaults; + axisDefaults?: any; categoryAxis?: ChartCategoryAxisItem[]; + valueAxis?: ChartValueAxisItem[]; chartArea?: ChartChartArea; - dataSource?: any|any|kendo.data.DataSource; + dataSource?: any; legend?: ChartLegend; panes?: ChartPane[]; - pannable?: boolean|ChartPannable; pdf?: ChartPdf; plotArea?: ChartPlotArea; renderAs?: string; @@ -10613,10 +10623,8 @@ declare namespace kendo.dataviz.ui { title?: ChartTitle; tooltip?: ChartTooltip; transitions?: boolean; - valueAxis?: ChartValueAxisItem[]; xAxis?: ChartXAxisItem[]; yAxis?: ChartYAxisItem[]; - zoomable?: boolean|ChartZoomable; axisLabelClick?(e: ChartAxisLabelClickEvent): void; legendItemClick?(e: ChartLegendItemClickEvent): void; legendItemHover?(e: ChartLegendItemHoverEvent): void; @@ -10627,13 +10635,14 @@ declare namespace kendo.dataviz.ui { noteClick?(e: ChartNoteClickEvent): void; noteHover?(e: ChartNoteHoverEvent): void; plotAreaClick?(e: ChartPlotAreaClickEvent): void; - plotAreaHover?(e: ChartPlotAreaHoverEvent): void; + pannable?:any; render?(e: ChartEvent): void; select?(e: ChartSelectEvent): void; selectEnd?(e: ChartSelectEndEvent): void; selectStart?(e: ChartSelectStartEvent): void; seriesClick?(e: ChartSeriesClickEvent): void; seriesHover?(e: ChartSeriesHoverEvent): void; + zoomable?:any; zoom?(e: ChartZoomEvent): void; zoomEnd?(e: ChartZoomEndEvent): void; zoomStart?(e: ChartZoomStartEvent): void; @@ -10866,7 +10875,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string|Function; + template?: string | Function; text?: string; visual?: Function; } @@ -10947,7 +10956,7 @@ declare namespace kendo.dataviz.ui { interface DiagramConnectionDefaults { content?: DiagramConnectionDefaultsContent; - editable?: boolean|DiagramConnectionDefaultsEditable; + editable?: boolean | DiagramConnectionDefaultsEditable; endCap?: DiagramConnectionDefaultsEndCap; fromConnector?: string; hover?: DiagramConnectionDefaultsHover; @@ -10965,7 +10974,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string|Function; + template?: string | Function; text?: string; visual?: Function; } @@ -11059,7 +11068,7 @@ declare namespace kendo.dataviz.ui { interface DiagramConnection { content?: DiagramConnectionContent; - editable?: boolean|DiagramConnectionEditable; + editable?: boolean | DiagramConnectionEditable; endCap?: DiagramConnectionEndCap; from?: DiagramConnectionFrom; fromConnector?: string; @@ -11078,7 +11087,7 @@ declare namespace kendo.dataviz.ui { } interface DiagramEditableDrag { - snap?: boolean|DiagramEditableDragSnap; + snap?: boolean | DiagramEditableDragSnap; } interface DiagramEditableResizeHandlesFill { @@ -11141,12 +11150,12 @@ declare namespace kendo.dataviz.ui { } interface DiagramEditable { - connectionTemplate?: string|Function; - drag?: boolean|DiagramEditableDrag; + connectionTemplate?: string | Function; + drag?: boolean | DiagramEditableDrag; remove?: boolean; - resize?: boolean|DiagramEditableResize; - rotate?: boolean|DiagramEditableRotate; - shapeTemplate?: string|Function; + resize?: boolean | DiagramEditableResize; + rotate?: boolean | DiagramEditableRotate; + shapeTemplate?: string | Function; tools?: DiagramEditableTool[]; } @@ -11182,10 +11191,10 @@ declare namespace kendo.dataviz.ui { } interface DiagramPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface DiagramPdf { @@ -11197,7 +11206,7 @@ declare namespace kendo.dataviz.ui { keywords?: string; landscape?: boolean; margin?: DiagramPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -11294,7 +11303,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string|Function; + template?: string | Function; text?: string; } @@ -11354,7 +11363,7 @@ declare namespace kendo.dataviz.ui { connectors?: DiagramShapeDefaultsConnector[]; connectorDefaults?: DiagramShapeDefaultsConnectorDefaults; content?: DiagramShapeDefaultsContent; - editable?: boolean|DiagramShapeDefaultsEditable; + editable?: boolean | DiagramShapeDefaultsEditable; fill?: DiagramShapeDefaultsFill; height?: number; hover?: DiagramShapeDefaultsHover; @@ -11452,7 +11461,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string|Function; + template?: string | Function; text?: string; } @@ -11510,7 +11519,7 @@ declare namespace kendo.dataviz.ui { connectors?: DiagramShapeConnector[]; connectorDefaults?: DiagramShapeConnectorDefaults; content?: DiagramShapeContent; - editable?: boolean|DiagramShapeEditable; + editable?: boolean | DiagramShapeEditable; fill?: DiagramShapeFill; height?: number; hover?: DiagramShapeHover; @@ -11547,16 +11556,16 @@ declare namespace kendo.dataviz.ui { autoBind?: boolean; connectionDefaults?: DiagramConnectionDefaults; connections?: DiagramConnection[]; - connectionsDataSource?: any|any|kendo.data.DataSource; - dataSource?: any|any|kendo.data.DataSource; - editable?: boolean|DiagramEditable; + connectionsDataSource?: any | any | kendo.data.DataSource; + dataSource?: any | any | kendo.data.DataSource; + editable?: boolean | DiagramEditable; layout?: DiagramLayout; - pannable?: boolean|DiagramPannable; + pannable?: boolean | DiagramPannable; pdf?: DiagramPdf; - selectable?: boolean|DiagramSelectable; + selectable?: boolean | DiagramSelectable; shapeDefaults?: DiagramShapeDefaults; shapes?: DiagramShape[]; - template?: string|Function; + template?: string | Function; zoom?: number; zoomMax?: number; zoomMin?: number; @@ -11764,7 +11773,7 @@ declare namespace kendo.dataviz.ui { interface LinearGaugePointerItem { border?: LinearGaugePointerItemBorder; color?: string; - margin?: number|any; + margin?: number | any; opacity?: number; shape?: string; size?: number; @@ -11800,7 +11809,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: LinearGaugeScaleLabelsMargin; padding?: LinearGaugeScaleLabelsPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -11932,9 +11941,9 @@ declare namespace kendo.dataviz.ui { } interface MapControls { - attribution?: boolean|MapControlsAttribution; - navigator?: boolean|MapControlsNavigator; - zoom?: boolean|MapControlsZoom; + attribution?: boolean | MapControlsAttribution; + navigator?: boolean | MapControlsNavigator; + zoom?: boolean | MapControlsZoom; } interface MapLayerDefaultsBing { @@ -11968,7 +11977,7 @@ declare namespace kendo.dataviz.ui { maxSize?: number; minSize?: number; style?: MapLayerDefaultsBubbleStyle; - symbol?: string|Function; + symbol?: string | Function; } interface MapLayerDefaultsMarkerTooltipAnimationClose { @@ -12102,8 +12111,8 @@ declare namespace kendo.dataviz.ui { interface MapLayer { attribution?: string; autoBind?: boolean; - dataSource?: any|any|kendo.data.DataSource; - extent?: any|kendo.dataviz.map.Extent; + dataSource?: any | any | kendo.data.DataSource; + extent?: any | kendo.dataviz.map.Extent; key?: string; imagerySet?: string; culture?: string; @@ -12116,7 +12125,7 @@ declare namespace kendo.dataviz.ui { minSize?: number; opacity?: number; subdomains?: any; - symbol?: string|Function; + symbol?: string | Function; type?: string; style?: MapLayerStyle; urlTemplate?: string; @@ -12196,7 +12205,7 @@ declare namespace kendo.dataviz.ui { } interface MapMarker { - location?: any|kendo.dataviz.map.Location; + location?: any | kendo.dataviz.map.Location; shape?: string; title?: string; tooltip?: MapMarkerTooltip; @@ -12204,7 +12213,7 @@ declare namespace kendo.dataviz.ui { interface MapOptions { name?: string; - center?: any|kendo.dataviz.map.Location; + center?: any | kendo.dataviz.map.Location; controls?: MapControls; layerDefaults?: MapLayerDefaults; layers?: MapLayer[]; @@ -12369,8 +12378,8 @@ declare namespace kendo.dataviz.ui { errorCorrection?: string; padding?: number; renderAs?: string; - size?: number|string; - value?: number|string; + size?: number | string; + value?: number | string; } interface QRCodeEvent { sender: QRCode; @@ -12470,7 +12479,7 @@ declare namespace kendo.dataviz.ui { margin?: RadialGaugeScaleLabelsMargin; padding?: RadialGaugeScaleLabelsPadding; position?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -12575,8 +12584,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -12601,13 +12610,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; + margin?: number | any; mirror?: boolean; - padding?: number|any; + padding?: number | any; rotation?: number; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; culture?: string; dateFormats?: any; @@ -12680,7 +12689,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -12726,7 +12735,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -12765,7 +12774,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineCategoryAxisItemTitleBorder; color?: string; font?: string; - margin?: number|any; + margin?: number | any; position?: string; rotation?: number; text?: string; @@ -12773,7 +12782,7 @@ declare namespace kendo.dataviz.ui { } interface SparklineCategoryAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; categories?: any; color?: string; field?: string; @@ -12813,7 +12822,7 @@ declare namespace kendo.dataviz.ui { opacity?: number; border?: SparklineChartAreaBorder; height?: number; - margin?: number|any; + margin?: number | any; width?: number; } @@ -12827,14 +12836,14 @@ declare namespace kendo.dataviz.ui { background?: string; opacity?: number; border?: SparklinePlotAreaBorder; - margin?: number|any; + margin?: number | any; } interface SparklineSeriesItemBorder { - color?: string|Function; - dashType?: string|Function; - opacity?: number|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + opacity?: number | Function; + width?: number | Function; } interface SparklineSeriesItemConnectors { @@ -12857,24 +12866,24 @@ declare namespace kendo.dataviz.ui { } interface SparklineSeriesItemLabelsBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface SparklineSeriesItemLabels { align?: string; - background?: string|Function; + background?: string | Function; border?: SparklineSeriesItemLabelsBorder; - color?: string|Function; + color?: string | Function; distance?: number; - font?: string|Function; - format?: string|Function; - margin?: number|any; - padding?: number|any; - position?: string|Function; - template?: string|Function; - visible?: boolean|Function; + font?: string | Function; + format?: string | Function; + margin?: number | any; + padding?: number | any; + position?: string | Function; + template?: string | Function; + visible?: boolean | Function; } interface SparklineSeriesItemLine { @@ -12885,17 +12894,17 @@ declare namespace kendo.dataviz.ui { } interface SparklineSeriesItemMarkersBorder { - color?: string|Function; - width?: number|Function; + color?: string | Function; + width?: number | Function; } interface SparklineSeriesItemMarkers { - background?: string|Function; + background?: string | Function; border?: SparklineSeriesItemMarkersBorder; - size?: number|Function; - type?: string|Function; - visible?: boolean|Function; - rotation?: number|Function; + size?: number | Function; + type?: string | Function; + visible?: boolean | Function; + rotation?: number | Function; } interface SparklineSeriesItemNotesIconBorder { @@ -12922,7 +12931,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineSeriesItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -12952,18 +12961,18 @@ declare namespace kendo.dataviz.ui { } interface SparklineSeriesItemTargetBorder { - color?: string|Function; - dashType?: string|Function; + color?: string | Function; + dashType?: string | Function; width?: number; } interface SparklineSeriesItemTargetLine { - width?: any|Function; + width?: any | Function; } interface SparklineSeriesItemTarget { line?: SparklineSeriesItemTargetLine; - color?: string|Function; + color?: string | Function; border?: SparklineSeriesItemTargetBorder; } @@ -12978,8 +12987,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -12993,11 +13002,11 @@ declare namespace kendo.dataviz.ui { field?: string; name?: string; highlight?: SparklineSeriesItemHighlight; - aggregate?: string|Function; + aggregate?: string | Function; axis?: string; border?: SparklineSeriesItemBorder; categoryField?: string; - color?: string|Function; + color?: string | Function; colorField?: string; connectors?: SparklineSeriesItemConnectors; gap?: number; @@ -13013,7 +13022,7 @@ declare namespace kendo.dataviz.ui { size?: number; startAngle?: number; spacing?: number; - stack?: boolean|SparklineSeriesItemStack; + stack?: boolean | SparklineSeriesItemStack; tooltip?: SparklineSeriesItemTooltip; width?: number; target?: SparklineSeriesItemTarget; @@ -13039,9 +13048,9 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; - padding?: number|any; - template?: string|Function; + margin?: number | any; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -13060,8 +13069,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -13076,7 +13085,7 @@ declare namespace kendo.dataviz.ui { overlay?: any; pie?: any; spacing?: number; - stack?: boolean|SparklineSeriesDefaultsStack; + stack?: boolean | SparklineSeriesDefaultsStack; type?: string; tooltip?: SparklineSeriesDefaultsTooltip; } @@ -13092,8 +13101,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; shared?: boolean; sharedTemplate?: string; @@ -13110,8 +13119,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -13136,13 +13145,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; + margin?: number | any; mirror?: boolean; - padding?: number|any; + padding?: number | any; rotation?: number; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -13212,7 +13221,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineValueAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -13258,7 +13267,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineValueAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -13297,8 +13306,8 @@ declare namespace kendo.dataviz.ui { border?: SparklineValueAxisItemTitleBorder; color?: string; font?: string; - margin?: number|any; - padding?: number|any; + margin?: number | any; + padding?: number | any; position?: string; rotation?: number; text?: string; @@ -13306,7 +13315,7 @@ declare namespace kendo.dataviz.ui { } interface SparklineValueAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; color?: string; labels?: SparklineValueAxisItemLabels; line?: SparklineValueAxisItemLine; @@ -13502,8 +13511,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -13528,13 +13537,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; + margin?: number | any; mirror?: boolean; - padding?: number|any; + padding?: number | any; rotation?: number; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; culture?: string; dateFormats?: any; @@ -13607,7 +13616,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -13653,7 +13662,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -13705,7 +13714,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartCategoryAxisItemTitleBorder; color?: string; font?: string; - margin?: number|any; + margin?: number | any; position?: string; rotation?: number; text?: string; @@ -13713,7 +13722,7 @@ declare namespace kendo.dataviz.ui { } interface StockChartCategoryAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; categories?: any; color?: string; field?: string; @@ -13756,7 +13765,7 @@ declare namespace kendo.dataviz.ui { opacity?: number; border?: StockChartChartAreaBorder; height?: number; - margin?: number|any; + margin?: number | any; width?: number; } @@ -13797,10 +13806,10 @@ declare namespace kendo.dataviz.ui { border?: StockChartLegendBorder; item?: StockChartLegendItem; labels?: StockChartLegendLabels; - margin?: number|any; + margin?: number | any; offsetX?: number; offsetY?: number; - padding?: number|any; + padding?: number | any; position?: string; reverse?: boolean; visible?: boolean; @@ -13837,7 +13846,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: StockChartNavigatorCategoryAxisItemCrosshairTooltipPadding; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -13891,7 +13900,7 @@ declare namespace kendo.dataviz.ui { rotation?: number; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -13962,7 +13971,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartNavigatorCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -14008,7 +14017,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartNavigatorCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -14071,7 +14080,7 @@ declare namespace kendo.dataviz.ui { interface StockChartNavigatorCategoryAxisItem { autoBaseUnitSteps?: StockChartNavigatorCategoryAxisItemAutoBaseUnitSteps; - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; background?: string; baseUnit?: string; baseUnitStep?: any; @@ -14100,7 +14109,7 @@ declare namespace kendo.dataviz.ui { interface StockChartNavigatorHint { visible?: boolean; - template?: string|Function; + template?: string | Function; format?: string; } @@ -14201,10 +14210,10 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; - padding?: number|any; + margin?: number | any; + padding?: number | any; position?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -14222,7 +14231,7 @@ declare namespace kendo.dataviz.ui { interface StockChartNavigatorSeriesItemMarkers { background?: string; border?: StockChartNavigatorSeriesItemMarkersBorder; - rotation?: number|Function; + rotation?: number | Function; size?: number; type?: string; visible?: boolean; @@ -14248,8 +14257,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -14262,7 +14271,7 @@ declare namespace kendo.dataviz.ui { categoryField?: string; name?: string; highlight?: StockChartNavigatorSeriesItemHighlight; - aggregate?: string|Function; + aggregate?: string | Function; axis?: string; border?: StockChartNavigatorSeriesItemBorder; closeField?: string; @@ -14281,7 +14290,7 @@ declare namespace kendo.dataviz.ui { openField?: string; overlay?: StockChartNavigatorSeriesItemOverlay; spacing?: number; - stack?: boolean|StockChartNavigatorSeriesItemStack; + stack?: boolean | StockChartNavigatorSeriesItemStack; tooltip?: StockChartNavigatorSeriesItemTooltip; width?: number; } @@ -14315,7 +14324,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartPaneTitleBorder; color?: string; font?: string; - margin?: number|any; + margin?: number | any; position?: string; text?: string; visible?: boolean; @@ -14323,8 +14332,8 @@ declare namespace kendo.dataviz.ui { interface StockChartPane { name?: string; - margin?: number|any; - padding?: number|any; + margin?: number | any; + padding?: number | any; background?: string; border?: StockChartPaneBorder; clip?: boolean; @@ -14333,10 +14342,10 @@ declare namespace kendo.dataviz.ui { } interface StockChartPdfMargin { - bottom?: number|string; - left?: number|string; - right?: number|string; - top?: number|string; + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; } interface StockChartPdf { @@ -14348,7 +14357,7 @@ declare namespace kendo.dataviz.ui { keywords?: string; landscape?: boolean; margin?: StockChartPdfMargin; - paperSize?: string|any; + paperSize?: string | any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -14365,14 +14374,14 @@ declare namespace kendo.dataviz.ui { background?: string; opacity?: number; border?: StockChartPlotAreaBorder; - margin?: number|any; + margin?: number | any; } interface StockChartSeriesItemBorder { - color?: string|Function; - dashType?: string|Function; - opacity?: number|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + opacity?: number | Function; + width?: number | Function; } interface StockChartSeriesItemHighlightBorder { @@ -14396,22 +14405,22 @@ declare namespace kendo.dataviz.ui { } interface StockChartSeriesItemLabelsBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface StockChartSeriesItemLabels { - background?: string|Function; + background?: string | Function; border?: StockChartSeriesItemLabelsBorder; - color?: string|Function; - font?: string|Function; - format?: string|Function; - margin?: number|any; - padding?: number|any; - position?: string|Function; - template?: string|Function; - visible?: boolean|Function; + color?: string | Function; + font?: string | Function; + format?: string | Function; + margin?: number | any; + padding?: number | any; + position?: string | Function; + template?: string | Function; + visible?: boolean | Function; } interface StockChartSeriesItemLine { @@ -14422,17 +14431,17 @@ declare namespace kendo.dataviz.ui { } interface StockChartSeriesItemMarkersBorder { - color?: string|Function; - width?: number|Function; + color?: string | Function; + width?: number | Function; } interface StockChartSeriesItemMarkers { - background?: string|Function; + background?: string | Function; border?: StockChartSeriesItemMarkersBorder; - size?: number|Function; - rotation?: number|Function; - type?: string|Function; - visible?: boolean|Function; + size?: number | Function; + rotation?: number | Function; + type?: string | Function; + visible?: boolean | Function; } interface StockChartSeriesItemNotesIconBorder { @@ -14459,7 +14468,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartSeriesItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -14489,18 +14498,18 @@ declare namespace kendo.dataviz.ui { } interface StockChartSeriesItemTargetBorder { - color?: string|Function; - dashType?: string|Function; - width?: number|Function; + color?: string | Function; + dashType?: string | Function; + width?: number | Function; } interface StockChartSeriesItemTargetLine { - width?: any|Function; + width?: any | Function; } interface StockChartSeriesItemTarget { line?: StockChartSeriesItemTargetLine; - color?: string|Function; + color?: string | Function; border?: StockChartSeriesItemTargetBorder; } @@ -14515,8 +14524,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -14531,13 +14540,13 @@ declare namespace kendo.dataviz.ui { targetField?: string; name?: string; highlight?: StockChartSeriesItemHighlight; - aggregate?: string|Function; + aggregate?: string | Function; axis?: string; border?: StockChartSeriesItemBorder; closeField?: string; - color?: string|Function; + color?: string | Function; colorField?: string; - downColor?: string|Function; + downColor?: string | Function; downColorField?: string; gap?: number; labels?: StockChartSeriesItemLabels; @@ -14551,7 +14560,7 @@ declare namespace kendo.dataviz.ui { openField?: string; overlay?: StockChartSeriesItemOverlay; spacing?: number; - stack?: boolean|StockChartSeriesItemStack; + stack?: boolean | StockChartSeriesItemStack; tooltip?: StockChartSeriesItemTooltip; visibleInLegend?: boolean; width?: number; @@ -14578,9 +14587,9 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; - padding?: number|any; - template?: string|Function; + margin?: number | any; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -14599,8 +14608,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -14616,7 +14625,7 @@ declare namespace kendo.dataviz.ui { overlay?: any; pie?: any; spacing?: number; - stack?: boolean|StockChartSeriesDefaultsStack; + stack?: boolean | StockChartSeriesDefaultsStack; type?: string; tooltip?: StockChartSeriesDefaultsTooltip; } @@ -14633,8 +14642,8 @@ declare namespace kendo.dataviz.ui { border?: StockChartTitleBorder; font?: string; color?: string; - margin?: number|any; - padding?: number|any; + margin?: number | any; + padding?: number | any; position?: string; text?: string; visible?: boolean; @@ -14651,8 +14660,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; shared?: boolean; sharedTemplate?: string; @@ -14669,8 +14678,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number|any; - template?: string|Function; + padding?: number | any; + template?: string | Function; visible?: boolean; } @@ -14695,13 +14704,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number|any; + margin?: number | any; mirror?: boolean; - padding?: number|any; + padding?: number | any; rotation?: number; skip?: number; step?: number; - template?: string|Function; + template?: string | Function; visible?: boolean; } @@ -14771,7 +14780,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartValueAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -14817,7 +14826,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartValueAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string|Function; + template?: string | Function; visible?: boolean; rotation?: number; format?: string; @@ -14856,8 +14865,8 @@ declare namespace kendo.dataviz.ui { border?: StockChartValueAxisItemTitleBorder; color?: string; font?: string; - margin?: number|any; - padding?: number|any; + margin?: number | any; + padding?: number | any; position?: string; rotation?: number; text?: string; @@ -14865,7 +14874,7 @@ declare namespace kendo.dataviz.ui { } interface StockChartValueAxisItem { - axisCrossingValue?: any|Date|any; + axisCrossingValue?: any | Date | any; background?: string; color?: string; labels?: StockChartValueAxisItemLabels; @@ -15106,14 +15115,14 @@ declare namespace kendo.dataviz.ui { interface TreeMapOptions { name?: string; - dataSource?: any|any|kendo.data.HierarchicalDataSource; + dataSource?: any | any | kendo.data.HierarchicalDataSource; autoBind?: boolean; type?: string; theme?: string; valueField?: string; colorField?: string; textField?: string; - template?: string|Function; + template?: string | Function; colors?: any; itemCreated?(e: TreeMapItemCreatedEvent): void; dataBound?(e: TreeMapDataBoundEvent): void; @@ -15125,7 +15134,7 @@ declare namespace kendo.dataviz.ui { } interface TreeMapItemCreatedEvent extends TreeMapEvent { - element?: JQuery|Element; + element?: JQuery | Element; } interface TreeMapDataBoundEvent extends TreeMapEvent { @@ -15170,7 +15179,7 @@ declare namespace kendo.dataviz.map { nw: kendo.dataviz.map.Location; se: kendo.dataviz.map.Location; - constructor(nw: kendo.dataviz.map.Location|any, se: kendo.dataviz.map.Location|any); + constructor(nw: kendo.dataviz.map.Location | any, se: kendo.dataviz.map.Location | any); static create(a: kendo.dataviz.map.Location, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; static create(a: kendo.dataviz.map.Location, b?: any): kendo.dataviz.map.Extent; @@ -15310,7 +15319,7 @@ declare namespace kendo.dataviz.map { interface MarkerOptions { name?: string; - location?: any|kendo.dataviz.map.Location; + location?: any | kendo.dataviz.map.Location; shape?: string; title?: string; tooltip?: MarkerTooltip; @@ -15538,7 +15547,7 @@ declare namespace kendo.dataviz.diagram { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string|Function; + template?: string | Function; text?: string; visual?: Function; } @@ -16235,7 +16244,7 @@ declare namespace kendo.dataviz.diagram { interface ShapeOptions { name?: string; id?: string; - editable?: boolean|ShapeEditable; + editable?: boolean | ShapeEditable; path?: string; stroke?: ShapeStroke; type?: string; @@ -16335,10 +16344,10 @@ declare namespace kendo { namespace drawing { function align(elements: any, rect: kendo.geometry.Rect, alignment: string): void; - function drawDOM(element: JQuery, options: any): JQueryPromise; - function exportImage(group: kendo.drawing.Group, options: any): JQueryPromise; - function exportPDF(group: kendo.drawing.Group, options: kendo.drawing.PDFOptions): JQueryPromise; - function exportSVG(group: kendo.drawing.Group, options: any): JQueryPromise; + function drawDOM(element: JQuery, options?: any): JQueryPromise; + function exportImage(group: kendo.drawing.Group, options?: any): JQueryPromise; + function exportPDF(group: kendo.drawing.Group, options?: kendo.drawing.PDFOptions): JQueryPromise; + function exportSVG(group: kendo.drawing.Group, options?: any): JQueryPromise; function fit(element: kendo.drawing.Element, rect: kendo.geometry.Rect): void; function stack(elements: any): void; function vAlign(elements: any, rect: kendo.geometry.Rect, alignment: string): void; @@ -16354,40 +16363,40 @@ declare namespace kendo { function transformOrigin(firstElement: HTMLElement, secondElement: HTMLElement): any; } - function antiForgeryTokens(): any; - function bind(element: string, viewModel: any, namespace?: any): void; - function bind(element: string, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function bind(element: JQuery, viewModel: any, namespace?: any): void; - function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function bind(element: Element, viewModel: any, namespace?: any): void; - function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function observableHierarchy(array: any): void; - function culture(culture: string): void; - function destroy(element: string): void; - function destroy(element: JQuery): void; - function destroy(element: Element): void; - function htmlEncode(value: string): string; - function parseDate(value: string, formats?: string, culture?: string): Date; - function parseDate(value: string, formats?: any, culture?: string): Date; - function parseFloat(value: string, culture?: string): number; - function parseInt(value: string, culture?: string): number; - function parseColor(color: string, noerror: boolean): kendo.Color; - function proxyModelSetters(): void; - function proxyModelSetters(data: kendo.data.Model): void; - function resize(element: string, force: boolean): void; - function resize(element: JQuery, force: boolean): void; - function resize(element: Element, force: boolean): void; - function saveAs(options: any): void; - function stringify(value: any): string; - function throttle(fn: Function, timeout: number): void; - function touchScroller(element: string): void; - function touchScroller(element: JQuery): void; - function touchScroller(element: Element): void; - function toString(value: Date, format: string, culture?: string): string; - function toString(value: number, format: string, culture?: string): string; - function unbind(element: string): void; - function unbind(element: JQuery): void; - function unbind(element: Element): void; + function antiForgeryTokens(): any; + function bind(element: string, viewModel: any, namespace?: any): void; + function bind(element: string, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: JQuery, viewModel: any, namespace?: any): void; + function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: Element, viewModel: any, namespace?: any): void; + function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function observableHierarchy(array: any): void; + function culture(culture: string): void; + function destroy(element: string): void; + function destroy(element: JQuery): void; + function destroy(element: Element): void; + function htmlEncode(value: string): string; + function parseDate(value: string, formats?: string, culture?: string): Date; + function parseDate(value: string, formats?: any, culture?: string): Date; + function parseFloat(value: string, culture?: string): number; + function parseInt(value: string, culture?: string): number; + function parseColor(color: string, noerror: boolean): kendo.Color; + function proxyModelSetters(): void; + function proxyModelSetters(data: kendo.data.Model): void; + function resize(element: string, force: boolean): void; + function resize(element: JQuery, force: boolean): void; + function resize(element: Element, force: boolean): void; + function saveAs(options: any): void; + function stringify(value: any): string; + function throttle(fn: Function, timeout: number): void; + function touchScroller(element: string): void; + function touchScroller(element: JQuery): void; + function touchScroller(element: Element): void; + function toString(value: Date, format: string, culture?: string): string; + function toString(value: number, format: string, culture?: string): string; + function unbind(element: string): void; + function unbind(element: JQuery): void; + function unbind(element: Element): void; namespace pdf { function defineFont(map: any): void; @@ -16639,9 +16648,9 @@ declare namespace kendo.mobile.ui { } interface ActionSheetPopup { - direction?: number|string; - height?: number|string; - width?: number|string; + direction?: number | string; + height?: number | string; + width?: number | string; } interface ActionSheetOptions { @@ -17009,18 +17018,18 @@ declare namespace kendo.mobile.ui { name?: string; appendOnRefresh?: boolean; autoBind?: boolean; - dataSource?: kendo.data.DataSource|any; + dataSource?: kendo.data.DataSource | any; endlessScroll?: boolean; fixedHeaders?: boolean; - headerTemplate?: string|Function; + headerTemplate?: string | Function; loadMore?: boolean; messages?: ListViewMessages; pullToRefresh?: boolean; pullParameters?: Function; style?: string; - template?: string|Function; + template?: string | Function; type?: string; - filterable?: boolean|ListViewFilterable; + filterable?: boolean | ListViewFilterable; virtualViewSize?: number; click?(e: ListViewClickEvent): void; dataBound?(e: ListViewEvent): void; @@ -17232,8 +17241,8 @@ declare namespace kendo.mobile.ui { } interface PopOverPopup { - height?: number|string; - width?: number|string; + height?: number | string; + width?: number | string; } interface PopOverOptions { @@ -17289,8 +17298,8 @@ declare namespace kendo.mobile.ui { name?: string; autoBind?: boolean; bounceVelocityThreshold?: number; - contentHeight?: number|string; - dataSource?: kendo.data.DataSource|any; + contentHeight?: number | string; + dataSource?: kendo.data.DataSource | any; duration?: number; emptyTemplate?: string; enablePager?: boolean; @@ -17669,7 +17678,7 @@ declare namespace kendo.ooxml { wrap?: boolean; vAlign?: string; verticalAlign?: string; - value?: Date|number|string|boolean; + value?: Date | number | string | boolean; } interface WorkbookSheetRow { @@ -17875,7 +17884,7 @@ declare namespace kendo.dataviz.geometry { origin: kendo.geometry.Point; size: kendo.geometry.Size; - constructor(origin: kendo.geometry.Point|any, size: kendo.geometry.Size|any); + constructor(origin: kendo.geometry.Point | any, size: kendo.geometry.Size | any); static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; @@ -18101,7 +18110,7 @@ declare namespace kendo.dataviz.drawing { } - interface FillOptions { + interface FillOptions { @@ -18400,7 +18409,7 @@ declare namespace kendo.dataviz.drawing { } - interface PDFOptions { + interface PDFOptions { @@ -18504,7 +18513,7 @@ declare namespace kendo.dataviz.drawing { interface RadialGradientOptions { name?: string; - center?: any|kendo.geometry.Point; + center?: any | kendo.geometry.Point; radius?: number; stops?: any; } @@ -18588,7 +18597,7 @@ declare namespace kendo.dataviz.drawing { } - interface StrokeOptions { + interface StrokeOptions { @@ -18642,8 +18651,8 @@ declare namespace kendo.dataviz.drawing { } interface SurfaceTooltip { - animation?: boolean|SurfaceTooltipAnimation; - appendTo?: string|JQuery; + animation?: boolean | SurfaceTooltipAnimation; + appendTo?: string | JQuery; } interface SurfaceOptions { @@ -18738,20 +18747,20 @@ declare namespace kendo.dataviz.drawing { } - interface TooltipOptions { + interface TooltipOptions { autoHide?: boolean; - content?: string|Function; + content?: string | Function; position?: string; - height?: number|string; + height?: number | string; hideDelay?: number; offset?: number; shared?: boolean; showAfter?: number; showOn?: string; - width?: number|string; + width?: number | string; From fdb47e573f9c4d593094069136c1f12a0c17edd4 Mon Sep 17 00:00:00 2001 From: Gayan Ranasinghe Date: Mon, 4 Jul 2016 16:22:02 +0530 Subject: [PATCH 005/203] jquery reference --- kendo-ui/kendo-ui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index b8aea8a61a..9d99d0bbfe 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -2,7 +2,7 @@ // Project: http://www.telerik.com/kendo-ui // Definitions by: Telerik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +/// declare namespace kendo { From 96817eace15d945f7202b8dc6ba00f4b7fe5f5dd Mon Sep 17 00:00:00 2001 From: Gayan Ranasinghe Date: Mon, 4 Jul 2016 16:27:55 +0530 Subject: [PATCH 006/203] removed implicitly has an 'any' type --- kendo-ui/kendo-ui.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index 9d99d0bbfe..9974c78775 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -511,7 +511,6 @@ declare namespace kendo.data { } module binders { } - export var binders; interface Bindings { [key: string]: Binding; From 02925c82b29fd4415d788014227c1b96ad721eb2 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Thu, 21 Jul 2016 13:05:31 -0500 Subject: [PATCH 007/203] github-electron: Add AutoUpdater.getFeedURL() --- github-electron/github-electron.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index b5cd642811..babe66774d 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -504,6 +504,8 @@ declare namespace Electron { * Set the url and initialize the auto updater. */ setFeedURL(url: string, requestHeaders?: Headers): void; + /** Returns the current update feed URL. */ + getFeedURL():string; /** * Ask the server whether there is an update, you have to call setFeedURL * before using this API From 8d035199c97f702694149092dfb49041a3de6d8f Mon Sep 17 00:00:00 2001 From: DmitryEfimenko Date: Fri, 22 Jul 2016 10:15:08 -0700 Subject: [PATCH 008/203] Agenda missing props/methods --- agenda/agenda.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/agenda/agenda.d.ts b/agenda/agenda.d.ts index 463ba43d2e..8dd58fdd80 100644 --- a/agenda/agenda.d.ts +++ b/agenda/agenda.d.ts @@ -319,6 +319,11 @@ declare module "agenda" { * The date/time the job last failed. */ failedAt: Date; + + /** + * Job's state + */ + disabled: boolean } /** @@ -409,6 +414,11 @@ declare module "agenda" { * @param cb Called after the job has been saved to the database. */ touch(cb?: Callback): void; + + /** + * Calculates next time the job should run + */ + computeNextRunAt(): Job; } interface JobOptions { From 950ce5c6c168a26b1e18ea0aa9f9354a27ccaaf9 Mon Sep 17 00:00:00 2001 From: Gayan Ranasinghe Date: Mon, 25 Jul 2016 10:22:19 +0530 Subject: [PATCH 009/203] remove formatting --- kendo-ui/kendo-ui.d.ts | 1302 ++++++++++++++++++++-------------------- 1 file changed, 651 insertions(+), 651 deletions(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index 6fd787863f..941a432d81 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -2,6 +2,7 @@ // Project: http://www.telerik.com/kendo-ui // Definitions by: Telerik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + /// @@ -302,7 +303,7 @@ declare namespace kendo { } class ViewContainer extends Observable { - view: View; + view: View; } class Layout extends View { @@ -573,7 +574,6 @@ declare namespace kendo.data { isAllDay?: boolean; id?: any; start?: Date; - ownerId?: number; taskId?: number; startTimezone?: string; recurrenceId?: any; @@ -587,7 +587,6 @@ declare namespace kendo.data { static fields: DataSourceSchemaModelFields; constructor(data?: SchedulerEventData); - ownerId: number; taskId: number; description: string; end: Date; @@ -844,7 +843,7 @@ declare namespace kendo.data { columns: PivotSchemaColumnAxis; } - interface PivotSchema extends DataSourceSchema { + interface PivotSchema extends DataSourceSchema{ axes?: any; catalogs?: any; cubes?: any; @@ -953,7 +952,7 @@ declare namespace kendo.data { } interface DataSourceSchemaWithConstructorModel extends DataSourceSchema { - model?: typeof Model; + model?: typeof Model; } interface DataSourceSchemaModel { @@ -1001,7 +1000,7 @@ declare namespace kendo.data { every(callback: (item: Object, index: number, source: ObservableArray) => boolean): boolean; filter(callback: (item: Object, index: number, source: ObservableArray) => boolean): any[]; find(callback: (item: Object, index: number, source: ObservableArray) => boolean): any; - forEach(callback: (item: Object, index: number, source: ObservableArray) => void): void; + forEach(callback: (item: Object, index: number, source: ObservableArray) => void ): void; indexOf(item: any): number; join(separator: string): string; map(callback: (item: Object, index: number, source: ObservableArray) => any): any[]; @@ -1027,7 +1026,7 @@ declare namespace kendo.data { items?: kendo.data.Model[]; } - class DataSource extends Observable { + class DataSource extends Observable{ options: DataSourceOptions; static create(options?: DataSourceOptions): DataSource; @@ -1247,7 +1246,7 @@ declare namespace kendo.data { sort?: any; transport?: DataSourceTransport; type?: string; - change?(e: DataSourceChangeEvent): void; + change? (e: DataSourceChangeEvent): void; error?(e: DataSourceErrorEvent): void; sync?(e: DataSourceEvent): void; requestStart?(e: DataSourceRequestStartEvent): void; @@ -1330,7 +1329,7 @@ declare namespace kendo.ui { function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.dataviz.ui, prefix?: String): void; function plugin(widget: any, register?: typeof kendo.dataviz.ui, prefix?: String): void; - class Draggable extends kendo.ui.Widget { + class Draggable extends kendo.ui.Widget{ element: JQuery; currentTarget: JQuery; constructor(element: Element, options?: DraggableOptions); @@ -1341,7 +1340,7 @@ declare namespace kendo.ui { sender?: Draggable; } - class DropTarget extends kendo.ui.Widget { + class DropTarget extends kendo.ui.Widget{ element: JQuery; constructor(element: Element, options?: DropTargetOptions); options: DropTargetOptions; @@ -1371,7 +1370,7 @@ declare namespace kendo.ui { draggable?: kendo.ui.Draggable; } - class DropTargetArea extends kendo.ui.Widget { + class DropTargetArea extends kendo.ui.Widget{ element: JQuery; constructor(element: Element, options?: DropTargetAreaOptions); options: DropTargetAreaOptions; @@ -1522,7 +1521,7 @@ declare namespace kendo.dataviz.map.layer { declare namespace kendo.drawing.pdf { function saveAs(group: kendo.drawing.Group, fileName: string, - proxyUrl?: string, callback?: Function): void; + proxyUrl?: string, callback?: Function): void; } declare namespace kendo.geometry { @@ -1695,7 +1694,7 @@ declare namespace kendo.geometry { origin: kendo.geometry.Point; size: kendo.geometry.Size; - constructor(origin: kendo.geometry.Point | any, size: kendo.geometry.Size | any); + constructor(origin: kendo.geometry.Point|any, size: kendo.geometry.Size|any); static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; @@ -1921,7 +1920,7 @@ declare namespace kendo.drawing { } - interface FillOptions { + interface FillOptions { @@ -2220,7 +2219,7 @@ declare namespace kendo.drawing { } - interface PDFOptions { + interface PDFOptions { @@ -2324,7 +2323,7 @@ declare namespace kendo.drawing { interface RadialGradientOptions { name?: string; - center?: any | kendo.geometry.Point; + center?: any|kendo.geometry.Point; radius?: number; stops?: any; } @@ -2408,7 +2407,7 @@ declare namespace kendo.drawing { } - interface StrokeOptions { + interface StrokeOptions { @@ -2462,8 +2461,8 @@ declare namespace kendo.drawing { } interface SurfaceTooltip { - animation?: boolean | SurfaceTooltipAnimation; - appendTo?: string | JQuery; + animation?: boolean|SurfaceTooltipAnimation; + appendTo?: string|JQuery; } interface SurfaceOptions { @@ -2558,20 +2557,20 @@ declare namespace kendo.drawing { } - interface TooltipOptions { + interface TooltipOptions { autoHide?: boolean; - content?: string | Function; + content?: string|Function; position?: string; - height?: number | string; + height?: number|string; hideDelay?: number; offset?: number; shared?: boolean; showAfter?: number; showOn?: string; - width?: number | string; + width?: number|string; @@ -2641,14 +2640,14 @@ declare namespace kendo.ui { interface AutoCompleteOptions { name?: string; - animation?: boolean | AutoCompleteAnimation; - dataSource?: any | any | kendo.data.DataSource; + animation?: boolean|AutoCompleteAnimation; + dataSource?: any|any|kendo.data.DataSource; dataTextField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string | Function; - groupTemplate?: string | Function; + fixedGroupTemplate?: string|Function; + groupTemplate?: string|Function; height?: number; highlightFirst?: boolean; ignoreCase?: boolean; @@ -2657,11 +2656,11 @@ declare namespace kendo.ui { popup?: any; separator?: string; suggest?: boolean; - value?: any; + headerTemplate?: string|Function; headerTemplate?: string | Function; template?: string | Function; valuePrimitive?: boolean; - virtual?: boolean | AutoCompleteVirtual; + virtual?: boolean|AutoCompleteVirtual; change?(e: AutoCompleteChangeEvent): void; close?(e: AutoCompleteCloseEvent): void; dataBound?(e: AutoCompleteDataBoundEvent): void; @@ -2779,8 +2778,8 @@ declare namespace kendo.ui { culture?: string; dates?: any; depth?: string; - disableDates?: any | Function; - footer?: string | Function; + disableDates?: any|Function; + footer?: string|Function; format?: string; max?: Date; min?: Date; @@ -2827,7 +2826,7 @@ declare namespace kendo.ui { interface ColorPaletteOptions { name?: string; - palette?: string | any; + palette?: string|any; columns?: number; tileSize?: ColorPaletteTileSize; value?: string; @@ -2882,7 +2881,7 @@ declare namespace kendo.ui { columns?: number; tileSize?: ColorPickerTileSize; messages?: ColorPickerMessages; - palette?: string | any; + palette?: string|any; opacity?: boolean; preview?: boolean; toolIcon?: string; @@ -2982,14 +2981,14 @@ declare namespace kendo.ui { autoBind?: boolean; cascadeFrom?: string; cascadeFromField?: string; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataTextField?: string; dataValueField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string | Function; - groupTemplate?: string | Function; + fixedGroupTemplate?: string|Function; + groupTemplate?: string|Function; height?: number; highlightFirst?: boolean; ignoreCase?: boolean; @@ -2998,12 +2997,12 @@ declare namespace kendo.ui { placeholder?: string; popup?: ComboBoxPopup; suggest?: boolean; - headerTemplate?: string | Function; - template?: string | Function; + headerTemplate?: string|Function; + template?: string|Function; text?: string; value?: string; valuePrimitive?: boolean; - virtual?: boolean | ComboBoxVirtual; + virtual?: boolean|ComboBoxVirtual; change?(e: ComboBoxChangeEvent): void; close?(e: ComboBoxCloseEvent): void; dataBound?(e: ComboBoxDataBoundEvent): void; @@ -3098,16 +3097,16 @@ declare namespace kendo.ui { interface ContextMenuOptions { name?: string; alignToAnchor?: boolean; - animation?: boolean | ContextMenuAnimation; + animation?: boolean|ContextMenuAnimation; closeOnClick?: boolean; - dataSource?: any | any; + dataSource?: any|any; direction?: string; filter?: string; hoverDelay?: number; orientation?: string; popupCollision?: string; showOn?: string; - target?: string | JQuery; + target?: string|JQuery; close?(e: ContextMenuCloseEvent): void; open?(e: ContextMenuOpenEvent): void; activate?(e: ContextMenuActivateEvent): void; @@ -3208,13 +3207,13 @@ declare namespace kendo.ui { interface DatePickerOptions { name?: string; - animation?: boolean | DatePickerAnimation; + animation?: boolean|DatePickerAnimation; ARIATemplate?: string; culture?: string; dates?: any; depth?: string; - disableDates?: any | Function; - footer?: string | Function; + disableDates?: any|Function; + footer?: string|Function; format?: string; max?: Date; min?: Date; @@ -3298,12 +3297,12 @@ declare namespace kendo.ui { interface DateTimePickerOptions { name?: string; - animation?: boolean | DateTimePickerAnimation; + animation?: boolean|DateTimePickerAnimation; ARIATemplate?: string; culture?: string; dates?: any; depth?: string; - disableDates?: any | Function; + disableDates?: any|Function; footer?: string; format?: string; interval?: number; @@ -3409,32 +3408,32 @@ declare namespace kendo.ui { interface DropDownListOptions { name?: string; - animation?: boolean | DropDownListAnimation; + animation?: boolean|DropDownListAnimation; autoBind?: boolean; cascadeFrom?: string; cascadeFromField?: string; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataTextField?: string; dataValueField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string | Function; - groupTemplate?: string | Function; + fixedGroupTemplate?: string|Function; + groupTemplate?: string|Function; height?: number; ignoreCase?: boolean; index?: number; minLength?: number; popup?: DropDownListPopup; - optionLabel?: string | any; - optionLabelTemplate?: string | Function; - headerTemplate?: string | Function; - template?: string | Function; - valueTemplate?: string | Function; + optionLabel?: string|any; + optionLabelTemplate?: string|Function; + headerTemplate?: string|Function; + template?: string|Function; + valueTemplate?: string|Function; text?: string; value?: string; valuePrimitive?: boolean; - virtual?: boolean | DropDownListVirtual; + virtual?: boolean|DropDownListVirtual; change?(e: DropDownListChangeEvent): void; close?(e: DropDownListCloseEvent): void; dataBound?(e: DropDownListDataBoundEvent): void; @@ -3556,32 +3555,32 @@ declare namespace kendo.ui { interface EditorFileBrowserTransportCreate { contentType?: string; - data?: any | string | Function; + data?: any|string|Function; dataType?: string; type?: string; - url?: string | Function; + url?: string|Function; } interface EditorFileBrowserTransportDestroy { contentType?: string; - data?: any | string | Function; + data?: any|string|Function; dataType?: string; type?: string; - url?: string | Function; + url?: string|Function; } interface EditorFileBrowserTransportRead { contentType?: string; - data?: any | string | Function; + data?: any|string|Function; dataType?: string; type?: string; - url?: string | Function; + url?: string|Function; } interface EditorFileBrowserTransport { read?: EditorFileBrowserTransportRead; uploadUrl?: string; - fileUrl?: string | Function; + fileUrl?: string|Function; destroy?: EditorFileBrowserTransportDestroy; create?: EditorFileBrowserTransportCreate; } @@ -3638,33 +3637,33 @@ declare namespace kendo.ui { interface EditorImageBrowserTransportCreate { contentType?: string; - data?: any | string | Function; + data?: any|string|Function; dataType?: string; type?: string; - url?: string | Function; + url?: string|Function; } interface EditorImageBrowserTransportDestroy { contentType?: string; - data?: any | string | Function; + data?: any|string|Function; dataType?: string; type?: string; - url?: string | Function; + url?: string|Function; } interface EditorImageBrowserTransportRead { contentType?: string; - data?: any | string | Function; + data?: any|string|Function; dataType?: string; type?: string; - url?: string | Function; + url?: string|Function; } interface EditorImageBrowserTransport { read?: EditorImageBrowserTransportRead; - thumbnailUrl?: string | Function; + thumbnailUrl?: string|Function; uploadUrl?: string; - imageUrl?: string | Function; + imageUrl?: string|Function; destroy?: EditorImageBrowserTransportDestroy; create?: EditorImageBrowserTransportCreate; } @@ -3753,15 +3752,15 @@ declare namespace kendo.ui { } interface EditorPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface EditorPdf { author?: string; - avoidLinks?: boolean | string; + avoidLinks?: boolean|string; creator?: string; date?: Date; fileName?: string; @@ -3769,7 +3768,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: EditorPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -3820,7 +3819,7 @@ declare namespace kendo.ui { messages?: EditorMessages; pasteCleanup?: EditorPasteCleanup; pdf?: EditorPdf; - resizable?: boolean | EditorResizable; + resizable?: boolean|EditorResizable; serialization?: EditorSerialization; stylesheets?: any; tools?: EditorTool[]; @@ -3936,7 +3935,7 @@ declare namespace kendo.ui { interface FilterMenuOptions { name?: string; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; extra?: boolean; field?: string; messages?: FilterMenuMessages; @@ -4040,7 +4039,7 @@ declare namespace kendo.ui { } interface GanttAssignments { - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataResourceIdField?: string; dataTaskIdField?: string; dataValueField?: string; @@ -4050,7 +4049,7 @@ declare namespace kendo.ui { field?: string; title?: string; format?: string; - width?: string | number; + width?: string|number; editable?: boolean; sortable?: boolean; } @@ -4061,7 +4060,7 @@ declare namespace kendo.ui { interface GanttEditable { confirmation?: boolean; - template?: string | Function; + template?: string|Function; } interface GanttMessagesActions { @@ -4108,15 +4107,15 @@ declare namespace kendo.ui { } interface GanttPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface GanttPdf { author?: string; - avoidLinks?: boolean | string; + avoidLinks?: boolean|string; creator?: string; date?: Date; fileName?: string; @@ -4124,7 +4123,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: GanttPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -4134,31 +4133,31 @@ declare namespace kendo.ui { interface GanttResources { dataFormatField?: string; dataColorField?: string; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataTextField?: string; field?: string; } interface GanttToolbarItem { name?: string; - template?: string | Function; + template?: string|Function; text?: string; } interface GanttTooltip { - template?: string | Function; + template?: string|Function; visible?: boolean; } interface GanttView { type?: string; selected?: boolean; - slotSize?: number | string; - timeHeaderTemplate?: string | Function; - dayHeaderTemplate?: string | Function; - weekHeaderTemplate?: string | Function; - monthHeaderTemplate?: string | Function; - yearHeaderTemplate?: string | Function; + slotSize?: number|string; + timeHeaderTemplate?: string|Function; + dayHeaderTemplate?: string|Function; + weekHeaderTemplate?: string|Function; + monthHeaderTemplate?: string|Function; + yearHeaderTemplate?: string|Function; resizeTooltipFormat?: string; } @@ -4168,10 +4167,10 @@ declare namespace kendo.ui { autoBind?: boolean; columnResizeHandleWidth?: number; columns?: GanttColumn[]; - currentTimeMarker?: boolean | GanttCurrentTimeMarker; - dataSource?: any | any | kendo.data.GanttDataSource; - dependencies?: any | any | kendo.data.GanttDependencyDataSource; - editable?: boolean | GanttEditable; + currentTimeMarker?: boolean|GanttCurrentTimeMarker; + dataSource?: any|any|kendo.data.GanttDataSource; + dependencies?: any|any|kendo.data.GanttDependencyDataSource; + editable?: boolean|GanttEditable; navigatable?: boolean; workDayStart?: Date; workDayEnd?: Date; @@ -4179,20 +4178,20 @@ declare namespace kendo.ui { workWeekEnd?: number; hourSpan?: number; snap?: boolean; - height?: number | string; - listWidth?: string | number; + height?: number|string; + listWidth?: string|number; messages?: GanttMessages; pdf?: GanttPdf; resizable?: boolean; selectable?: boolean; showWorkDays?: boolean; showWorkHours?: boolean; - taskTemplate?: string | Function; + taskTemplate?: string|Function; toolbar?: GanttToolbarItem[]; tooltip?: GanttTooltip; views?: GanttView[]; resources?: GanttResources; - rowHeight?: number | string; + rowHeight?: number|string; dataBinding?(e: GanttDataBindingEvent): void; dataBound?(e: GanttDataBoundEvent): void; add?(e: GanttAddEvent): void; @@ -4386,7 +4385,7 @@ declare namespace kendo.ui { } interface GridAllowCopy { - delimeter?: string | any; + delimeter?: string|any; } interface GridColumnMenuMessages { @@ -4423,7 +4422,7 @@ declare namespace kendo.ui { } interface GridColumnFilterableCell { - dataSource?: any | kendo.data.DataSource; + dataSource?: any|kendo.data.DataSource; dataTextField?: string; delay?: number; inputWidth?: number; @@ -4438,13 +4437,13 @@ declare namespace kendo.ui { interface GridColumnFilterable { cell?: GridColumnFilterableCell; multi?: boolean; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; checkAll?: boolean; itemTemplate?: Function; operators?: any; search?: boolean; ignoreCase?: boolean; - ui?: string | Function; + ui?: string|Function; } interface GridColumnSortable { @@ -4458,36 +4457,36 @@ declare namespace kendo.ui { command?: GridColumnCommandItem[]; encoded?: boolean; field?: string; - filterable?: boolean | GridColumnFilterable; + filterable?: boolean|GridColumnFilterable; footerAttributes?: any; - footerTemplate?: string | Function; + footerTemplate?: string|Function; format?: string; groupable?: boolean; - groupHeaderTemplate?: string | Function; - groupFooterTemplate?: string | Function; + groupHeaderTemplate?: string|Function; + groupFooterTemplate?: string|Function; headerAttributes?: any; - headerTemplate?: string | Function; + headerTemplate?: string|Function; hidden?: boolean; locked?: boolean; lockable?: boolean; minScreenWidth?: number; - sortable?: boolean | GridColumnSortable; - template?: string | Function; + sortable?: boolean|GridColumnSortable; + template?: string|Function; title?: string; - width?: string | number; + width?: string|number; values?: any; menu?: boolean; type?: any; } interface GridEditable { - confirmation?: boolean | string | Function; + confirmation?: boolean|string|Function; cancelDelete?: string; confirmDelete?: string; createAt?: string; destroy?: boolean; mode?: string; - template?: string | Function; + template?: string|Function; update?: boolean; window?: any; } @@ -4600,7 +4599,7 @@ declare namespace kendo.ui { } interface GridNoRecords { - template?: string | Function; + template?: string|Function; } interface GridPageableMessages { @@ -4623,23 +4622,23 @@ declare namespace kendo.ui { numeric?: boolean; buttonCount?: number; input?: boolean; - pageSizes?: boolean | any; + pageSizes?: boolean|any; refresh?: boolean; info?: boolean; messages?: GridPageableMessages; } interface GridPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface GridPdf { allPages?: boolean; author?: string; - avoidLinks?: boolean | string; + avoidLinks?: boolean|string; creator?: string; date?: Date; fileName?: string; @@ -4647,7 +4646,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: GridPdfMargin; - paperSize?: string | any; + paperSize?: string|any; template?: string; repeatHeaders?: boolean; scale?: number; @@ -4668,38 +4667,38 @@ declare namespace kendo.ui { interface GridToolbarItem { name?: string; - template?: string | Function; + template?: string|Function; text?: string; } interface GridOptions { name?: string; - allowCopy?: boolean | GridAllowCopy; - altRowTemplate?: string | Function; + allowCopy?: boolean|GridAllowCopy; + altRowTemplate?: string|Function; autoBind?: boolean; columnResizeHandleWidth?: number; columns?: GridColumn[]; - columnMenu?: boolean | GridColumnMenu; - dataSource?: any | any | kendo.data.DataSource; - detailTemplate?: string | Function; - editable?: boolean | GridEditable; + columnMenu?: boolean|GridColumnMenu; + dataSource?: any|any|kendo.data.DataSource; + detailTemplate?: string|Function; + editable?: boolean|GridEditable; excel?: GridExcel; - filterable?: boolean | GridFilterable; - groupable?: boolean | GridGroupable; - height?: number | string; + filterable?: boolean|GridFilterable; + groupable?: boolean|GridGroupable; + height?: number|string; messages?: GridMessages; - mobile?: boolean | string; + mobile?: boolean|string; navigatable?: boolean; - noRecords?: boolean | GridNoRecords; - pageable?: boolean | GridPageable; + noRecords?: boolean|GridNoRecords; + pageable?: boolean|GridPageable; pdf?: GridPdf; reorderable?: boolean; resizable?: boolean; - rowTemplate?: string | Function; - scrollable?: boolean | GridScrollable; - selectable?: boolean | string; - sortable?: boolean | GridSortable; - toolbar?: string | ((...args: any[]) => string) | GridToolbarItem[]; + rowTemplate?: string|Function; + scrollable?: boolean|GridScrollable; + selectable?: boolean|string; + sortable?: boolean|GridSortable; + toolbar?: string | ((...args:any[]) => string) | GridToolbarItem[]; cancel?(e: GridCancelEvent): void; change?(e: GridChangeEvent): void; columnHide?(e: GridColumnHideEvent): void; @@ -4873,10 +4872,10 @@ declare namespace kendo.ui { interface ListViewOptions { name?: string; autoBind?: boolean; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; editTemplate?: Function; navigatable?: boolean; - selectable?: boolean | string; + selectable?: boolean|string; template?: Function; altTemplate?: Function; cancel?(e: ListViewCancelEvent): void; @@ -5015,9 +5014,9 @@ declare namespace kendo.ui { interface MenuOptions { name?: string; - animation?: boolean | MenuAnimation; + animation?: boolean|MenuAnimation; closeOnClick?: boolean; - dataSource?: any | any; + dataSource?: any|any; direction?: string; hoverDelay?: number; openOnClick?: boolean; @@ -5122,17 +5121,17 @@ declare namespace kendo.ui { interface MultiSelectOptions { name?: string; - animation?: boolean | MultiSelectAnimation; + animation?: boolean|MultiSelectAnimation; autoBind?: boolean; autoClose?: boolean; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataTextField?: string; dataValueField?: string; delay?: number; enable?: boolean; filter?: string; - fixedGroupTemplate?: string | Function; - groupTemplate?: string | Function; + fixedGroupTemplate?: string|Function; + groupTemplate?: string|Function; height?: number; highlightFirst?: boolean; ignoreCase?: boolean; @@ -5140,13 +5139,13 @@ declare namespace kendo.ui { maxSelectedItems?: number; placeholder?: string; popup?: MultiSelectPopup; - headerTemplate?: string | Function; - itemTemplate?: string | Function; + headerTemplate?: string|Function; + itemTemplate?: string|Function; tagTemplate?: string; tagMode?: string; value?: any; valuePrimitive?: boolean; - virtual?: boolean | MultiSelectVirtual; + virtual?: boolean|MultiSelectVirtual; change?(e: MultiSelectChangeEvent): void; close?(e: MultiSelectCloseEvent): void; dataBound?(e: MultiSelectDataBoundEvent): void; @@ -5235,16 +5234,16 @@ declare namespace kendo.ui { interface NotificationOptions { name?: string; allowHideAfter?: number; - animation?: any | boolean; - appendTo?: string | JQuery; + animation?: any|boolean; + appendTo?: string|JQuery; autoHideAfter?: number; button?: boolean; - height?: number | string; + height?: number|string; hideOnClick?: boolean; position?: NotificationPosition; stacking?: string; templates?: NotificationTemplate[]; - width?: number | string; + width?: number|string; hide?(e: NotificationHideEvent): void; show?(e: NotificationShowEvent): void; } @@ -5369,13 +5368,13 @@ declare namespace kendo.ui { name?: string; autoBind?: boolean; buttonCount?: number; - dataSource?: any | kendo.data.DataSource; + dataSource?: any|kendo.data.DataSource; selectTemplate?: string; linkTemplate?: string; info?: boolean; input?: boolean; numeric?: boolean; - pageSizes?: boolean | any; + pageSizes?: boolean|any; previousNext?: boolean; refresh?: boolean; messages?: PagerMessages; @@ -5483,9 +5482,9 @@ declare namespace kendo.ui { interface PanelBarOptions { name?: string; - animation?: boolean | PanelBarAnimation; + animation?: boolean|PanelBarAnimation; contentUrls?: any; - dataSource?: any | any; + dataSource?: any|any; expandMode?: string; activate?(e: PanelBarActivateEvent): void; collapse?(e: PanelBarCollapseEvent): void; @@ -5589,10 +5588,10 @@ declare namespace kendo.ui { interface PivotConfiguratorOptions { name?: string; - dataSource?: any | kendo.data.PivotDataSource; + dataSource?: any|kendo.data.PivotDataSource; filterable?: boolean; - sortable?: boolean | PivotConfiguratorSortable; - height?: number | string; + sortable?: boolean|PivotConfiguratorSortable; + height?: number|string; messages?: PivotConfiguratorMessages; } interface PivotConfiguratorEvent { @@ -5668,15 +5667,15 @@ declare namespace kendo.ui { } interface PivotGridPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface PivotGridPdf { author?: string; - avoidLinks?: boolean | string; + avoidLinks?: boolean|string; creator?: string; date?: Date; fileName?: string; @@ -5684,7 +5683,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: PivotGridPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -5697,20 +5696,20 @@ declare namespace kendo.ui { interface PivotGridOptions { name?: string; - dataSource?: any | kendo.data.PivotDataSource; + dataSource?: any|kendo.data.PivotDataSource; autoBind?: boolean; reorderable?: boolean; excel?: PivotGridExcel; pdf?: PivotGridPdf; filterable?: boolean; - sortable?: boolean | PivotGridSortable; + sortable?: boolean|PivotGridSortable; columnWidth?: number; - height?: number | string; - columnHeaderTemplate?: string | Function; - dataCellTemplate?: string | Function; - kpiStatusTemplate?: string | Function; - kpiTrendTemplate?: string | Function; - rowHeaderTemplate?: string | Function; + height?: number|string; + columnHeaderTemplate?: string|Function; + dataCellTemplate?: string|Function; + kpiStatusTemplate?: string|Function; + kpiTrendTemplate?: string|Function; + rowHeaderTemplate?: string|Function; messages?: PivotGridMessages; dataBinding?(e: PivotGridDataBindingEvent): void; dataBound?(e: PivotGridDataBoundEvent): void; @@ -5792,9 +5791,9 @@ declare namespace kendo.ui { interface PopupOptions { name?: string; adjustSize?: any; - animation?: boolean | PopupAnimation; - anchor?: string | JQuery; - appendTo?: string | JQuery; + animation?: boolean|PopupAnimation; + anchor?: string|JQuery; + appendTo?: string|JQuery; collision?: string; origin?: string; position?: string; @@ -6026,19 +6025,19 @@ declare namespace kendo.ui { } interface SchedulerEditable { - confirmation?: boolean | string; + confirmation?: boolean|string; create?: boolean; destroy?: boolean; editRecurringMode?: string; move?: boolean; resize?: boolean; - template?: string | Function; + template?: string|Function; update?: boolean; window?: any; } interface SchedulerFooter { - command?: string | boolean; + command?: string|boolean; } interface SchedulerGroup { @@ -6175,15 +6174,15 @@ declare namespace kendo.ui { } interface SchedulerPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface SchedulerPdf { author?: string; - avoidLinks?: boolean | string; + avoidLinks?: boolean|string; creator?: string; date?: Date; fileName?: string; @@ -6191,7 +6190,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: SchedulerPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -6200,7 +6199,7 @@ declare namespace kendo.ui { interface SchedulerResource { dataColorField?: string; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataTextField?: string; dataValueField?: string; field?: string; @@ -6225,26 +6224,26 @@ declare namespace kendo.ui { } interface SchedulerView { - allDayEventTemplate?: string | Function; + allDayEventTemplate?: string|Function; allDaySlot?: boolean; - allDaySlotTemplate?: string | Function; + allDaySlotTemplate?: string|Function; columnWidth?: number; - dateHeaderTemplate?: string | Function; - dayTemplate?: string | Function; - editable?: boolean | SchedulerViewEditable; + dateHeaderTemplate?: string|Function; + dayTemplate?: string|Function; + editable?: boolean|SchedulerViewEditable; endTime?: Date; eventHeight?: number; - eventTemplate?: string | Function; - eventTimeTemplate?: string | Function; + eventTemplate?: string|Function; + eventTimeTemplate?: string|Function; group?: SchedulerViewGroup; majorTick?: number; - majorTimeHeaderTemplate?: string | Function; + majorTimeHeaderTemplate?: string|Function; minorTickCount?: number; - minorTimeHeaderTemplate?: string | Function; + minorTimeHeaderTemplate?: string|Function; selected?: boolean; selectedDateFormat?: string; showWorkHours?: boolean; - slotTemplate?: string | Function; + slotTemplate?: string|Function; startTime?: Date; title?: string; type?: string; @@ -6262,27 +6261,27 @@ declare namespace kendo.ui { interface SchedulerOptions { name?: string; - allDayEventTemplate?: string | Function; + allDayEventTemplate?: string|Function; allDaySlot?: boolean; autoBind?: boolean; - currentTimeMarker?: boolean | SchedulerCurrentTimeMarker; - dataSource?: any | any | kendo.data.SchedulerDataSource; + currentTimeMarker?: boolean|SchedulerCurrentTimeMarker; + dataSource?: any|any|kendo.data.SchedulerDataSource; date?: Date; - dateHeaderTemplate?: string | Function; - editable?: boolean | SchedulerEditable; + dateHeaderTemplate?: string|Function; + editable?: boolean|SchedulerEditable; endTime?: Date; - eventTemplate?: string | Function; - footer?: boolean | SchedulerFooter; + eventTemplate?: string|Function; + footer?: boolean|SchedulerFooter; group?: SchedulerGroup; - height?: number | string; + height?: number|string; majorTick?: number; - majorTimeHeaderTemplate?: string | Function; + majorTimeHeaderTemplate?: string|Function; max?: Date; messages?: SchedulerMessages; min?: Date; minorTickCount?: number; - minorTimeHeaderTemplate?: string | Function; - mobile?: boolean | string; + minorTimeHeaderTemplate?: string|Function; + mobile?: boolean|string; pdf?: SchedulerPdf; resources?: SchedulerResource[]; selectable?: boolean; @@ -6292,8 +6291,8 @@ declare namespace kendo.ui { timezone?: string; toolbar?: SchedulerToolbarItem[]; views?: SchedulerView[]; - groupHeaderTemplate?: string | Function; - width?: number | string; + groupHeaderTemplate?: string|Function; + width?: number|string; workDayStart?: Date; workDayEnd?: Date; workWeekStart?: number; @@ -6489,17 +6488,17 @@ declare namespace kendo.ui { name?: string; axis?: string; autoScroll?: boolean; - container?: string | JQuery; + container?: string|JQuery; connectWith?: string; cursor?: string; cursorOffset?: SortableCursorOffset; disabled?: string; filter?: string; handler?: string; - hint?: Function | string | JQuery; + hint?: Function|string|JQuery; holdToDrag?: boolean; ignore?: string; - placeholder?: Function | string | JQuery; + placeholder?: Function|string|JQuery; start?(e: SortableStartEvent): void; move?(e: SortableMoveEvent): void; end?(e: SortableEndEvent): void; @@ -6686,10 +6685,10 @@ declare namespace kendo.ui { } interface SpreadsheetPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface SpreadsheetPdf { @@ -6705,7 +6704,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: SpreadsheetPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -6729,7 +6728,7 @@ declare namespace kendo.ui { index?: number; logic?: string; type?: string; - value?: number | string | Date; + value?: number|string|Date; values?: any; } @@ -6787,7 +6786,7 @@ declare namespace kendo.ui { link?: string; textAlign?: string; underline?: boolean; - value?: number | string | boolean | Date; + value?: number|string|boolean|Date; validation?: SpreadsheetSheetRowCellValidation; verticalAlign?: string; wrap?: boolean; @@ -6825,9 +6824,9 @@ declare namespace kendo.ui { } interface SpreadsheetToolbar { - home?: boolean | any; - insert?: boolean | any; - data?: boolean | any; + home?: boolean|any; + insert?: boolean|any; + data?: boolean|any; } interface SpreadsheetInsertSheetOptions { @@ -6854,7 +6853,7 @@ declare namespace kendo.ui { rows?: number; sheets?: SpreadsheetSheet[]; sheetsbar?: boolean; - toolbar?: boolean | SpreadsheetToolbar; + toolbar?: boolean|SpreadsheetToolbar; change?(e: SpreadsheetChangeEvent): void; render?(e: SpreadsheetRenderEvent): void; excelExport?(e: SpreadsheetExcelExportEvent): void; @@ -6880,7 +6879,7 @@ declare namespace kendo.ui { } interface SpreadsheetExcelImportEvent extends SpreadsheetEvent { - file?: Blob | File; + file?: Blob|File; progress?: JQueryPromise; } @@ -6980,18 +6979,18 @@ declare namespace kendo.ui { interface TabStripOptions { name?: string; - animation?: boolean | TabStripAnimation; + animation?: boolean|TabStripAnimation; collapsible?: boolean; contentUrls?: any; dataContentField?: string; dataContentUrlField?: string; dataImageUrlField?: string; - dataSource?: any | any | kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; dataSpriteCssClass?: string; dataTextField?: string; dataUrlField?: string; navigatable?: boolean; - scrollable?: boolean | TabStripScrollable; + scrollable?: boolean|TabStripScrollable; tabPosition?: string; value?: string; activate?(e: TabStripActivateEvent): void; @@ -7082,7 +7081,7 @@ declare namespace kendo.ui { interface TimePickerOptions { name?: string; - animation?: boolean | TimePickerAnimation; + animation?: boolean|TimePickerAnimation; culture?: string; dates?: any; format?: string; @@ -7188,13 +7187,13 @@ declare namespace kendo.ui { imageUrl?: string; menuButtons?: ToolBarItemMenuButton[]; overflow?: string; - overflowTemplate?: string | Function; + overflowTemplate?: string|Function; primary?: boolean; selected?: boolean; showIcon?: string; showText?: string; spriteCssClass?: string; - template?: string | Function; + template?: string|Function; text?: string; togglable?: boolean; toggle?: Function; @@ -7289,7 +7288,7 @@ declare namespace kendo.ui { interface TooltipOptions { name?: string; autoHide?: boolean; - animation?: boolean | TooltipAnimation; + animation?: boolean|TooltipAnimation; content?: TooltipContent; callout?: boolean; filter?: string; @@ -7514,7 +7513,7 @@ declare namespace kendo.ui { } interface TreeListColumnFilterable { - ui?: string | Function; + ui?: string|Function; } interface TreeListColumnSortable { @@ -7527,16 +7526,16 @@ declare namespace kendo.ui { encoded?: boolean; expandable?: boolean; field?: string; - filterable?: boolean | TreeListColumnFilterable; - footerTemplate?: string | Function; + filterable?: boolean|TreeListColumnFilterable; + footerTemplate?: string|Function; format?: string; headerAttributes?: any; - headerTemplate?: string | Function; + headerTemplate?: string|Function; minScreenWidth?: number; - sortable?: boolean | TreeListColumnSortable; - template?: string | Function; + sortable?: boolean|TreeListColumnSortable; + template?: string|Function; title?: string; - width?: string | number; + width?: string|number; hidden?: boolean; menu?: boolean; locked?: boolean; @@ -7546,7 +7545,7 @@ declare namespace kendo.ui { interface TreeListEditable { mode?: string; move?: boolean; - template?: string | Function; + template?: string|Function; window?: any; } @@ -7595,15 +7594,15 @@ declare namespace kendo.ui { } interface TreeListPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface TreeListPdf { author?: string; - avoidLinks?: boolean | string; + avoidLinks?: boolean|string; creator?: string; date?: Date; fileName?: string; @@ -7611,7 +7610,7 @@ declare namespace kendo.ui { keywords?: string; landscape?: boolean; margin?: TreeListPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -7634,17 +7633,17 @@ declare namespace kendo.ui { columns?: TreeListColumn[]; resizable?: boolean; reorderable?: boolean; - columnMenu?: boolean | TreeListColumnMenu; - dataSource?: any | any | kendo.data.TreeListDataSource; - editable?: boolean | TreeListEditable; + columnMenu?: boolean|TreeListColumnMenu; + dataSource?: any|any|kendo.data.TreeListDataSource; + editable?: boolean|TreeListEditable; excel?: TreeListExcel; - filterable?: boolean | TreeListFilterable; - height?: number | string; + filterable?: boolean|TreeListFilterable; + height?: number|string; messages?: TreeListMessages; pdf?: TreeListPdf; - scrollable?: boolean | any; - selectable?: boolean | string; - sortable?: boolean | TreeListSortable; + scrollable?: boolean|any; + selectable?: boolean|string; + sortable?: boolean|TreeListSortable; toolbar?: TreeListToolbarItem[]; cancel?(e: TreeListCancelEvent): void; change?(e: TreeListChangeEvent): void; @@ -7859,14 +7858,14 @@ declare namespace kendo.ui { } interface TreeViewAnimation { - collapse?: boolean | TreeViewAnimationCollapse; - expand?: boolean | TreeViewAnimationExpand; + collapse?: boolean|TreeViewAnimationCollapse; + expand?: boolean|TreeViewAnimationExpand; } interface TreeViewCheckboxes { checkChildren?: boolean; name?: string; - template?: string | Function; + template?: string|Function; } interface TreeViewMessages { @@ -7877,19 +7876,19 @@ declare namespace kendo.ui { interface TreeViewOptions { name?: string; - animation?: boolean | TreeViewAnimation; + animation?: boolean|TreeViewAnimation; autoBind?: boolean; autoScroll?: boolean; - checkboxes?: boolean | TreeViewCheckboxes; + checkboxes?: boolean|TreeViewCheckboxes; dataImageUrlField?: string; - dataSource?: any | any | kendo.data.HierarchicalDataSource; + dataSource?: any|any|kendo.data.HierarchicalDataSource; dataSpriteCssClassField?: string; - dataTextField?: string | any; + dataTextField?: string|any; dataUrlField?: string; dragAndDrop?: boolean; loadOnDemand?: boolean; messages?: TreeViewMessages; - template?: string | Function; + template?: string|Function; change?(e: TreeViewEvent): void; check?(e: TreeViewCheckEvent): void; collapse?(e: TreeViewCollapseEvent): void; @@ -8022,7 +8021,7 @@ declare namespace kendo.ui { localization?: UploadLocalization; multiple?: boolean; showFileList?: boolean; - template?: string | Function; + template?: string|Function; cancel?(e: UploadCancelEvent): void; complete?(e: UploadEvent): void; error?(e: UploadErrorEvent): void; @@ -8176,8 +8175,8 @@ declare namespace kendo.ui { } interface WindowPosition { - top?: number | string; - left?: number | string; + top?: number|string; + left?: number|string; } interface WindowRefreshOptions { @@ -8192,13 +8191,13 @@ declare namespace kendo.ui { interface WindowOptions { name?: string; actions?: any; - animation?: boolean | WindowAnimation; - appendTo?: any | string; + animation?: boolean|WindowAnimation; + appendTo?: any|string; autoFocus?: boolean; content?: WindowContent; draggable?: boolean; iframe?: boolean; - height?: number | string; + height?: number|string; maxHeight?: number; maxWidth?: number; minHeight?: number; @@ -8208,9 +8207,9 @@ declare namespace kendo.ui { position?: WindowPosition; resizable?: boolean; scrollable?: boolean; - title?: string | boolean; + title?: string|boolean; visible?: boolean; - width?: number | string; + width?: number|string; activate?(e: WindowEvent): void; close?(e: WindowCloseEvent): void; deactivate?(e: WindowEvent): void; @@ -8380,7 +8379,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartAxisDefaultsCrosshairTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -8408,7 +8407,7 @@ declare namespace kendo.dataviz.ui { interface ChartAxisDefaultsLabelsRotation { align?: string; - angle?: number | string; + angle?: number|string; } interface ChartAxisDefaultsLabels { @@ -8420,7 +8419,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartAxisDefaultsLabelsRotation; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; visual?: Function; } @@ -8558,7 +8557,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartCategoryAxisItemCrosshairTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -8600,7 +8599,7 @@ declare namespace kendo.dataviz.ui { interface ChartCategoryAxisItemLabelsRotation { align?: string; - angle?: number | string; + angle?: number|string; } interface ChartCategoryAxisItemLabels { @@ -8617,7 +8616,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartCategoryAxisItemLabelsRotation; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; visual?: Function; } @@ -8689,7 +8688,7 @@ declare namespace kendo.dataviz.ui { border?: ChartCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -8735,7 +8734,7 @@ declare namespace kendo.dataviz.ui { border?: ChartCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -8813,7 +8812,7 @@ declare namespace kendo.dataviz.ui { interface ChartCategoryAxisItem { autoBaseUnitSteps?: ChartCategoryAxisItemAutoBaseUnitSteps; - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; background?: string; baseUnit?: string; baseUnitStep?: any; @@ -8877,7 +8876,7 @@ declare namespace kendo.dataviz.ui { interface ChartLegendInactiveItemsLabels { color?: string; font?: string; - template?: string | Function; + template?: string|Function; } interface ChartLegendInactiveItems { @@ -8908,7 +8907,7 @@ declare namespace kendo.dataviz.ui { font?: string; margin?: ChartLegendLabelsMargin; padding?: ChartLegendLabelsPadding; - template?: string | Function; + template?: string|Function; } interface ChartLegendMargin { @@ -9006,10 +9005,10 @@ declare namespace kendo.dataviz.ui { } interface ChartPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface ChartPdf { @@ -9021,7 +9020,7 @@ declare namespace kendo.dataviz.ui { keywords?: string; landscape?: boolean; margin?: ChartPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -9057,10 +9056,10 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemBorder { - color?: string | Function; - dashType?: string | Function; - opacity?: number | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + opacity?: number|Function; + width?: number|Function; } interface ChartSeriesItemConnectors { @@ -9075,26 +9074,26 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemErrorBars { - value?: string | number | any | Function; + value?: string|number|any|Function; visual?: Function; - xValue?: string | number | any | Function; - yValue?: string | number | any | Function; + xValue?: string|number|any|Function; + yValue?: string|number|any|Function; endCaps?: boolean; color?: string; line?: ChartSeriesItemErrorBarsLine; } interface ChartSeriesItemExtremesBorder { - color?: string | Function; - width?: number | Function; + color?: string|Function; + width?: number|Function; } interface ChartSeriesItemExtremes { - background?: string | Function; + background?: string|Function; border?: ChartSeriesItemExtremesBorder; - size?: number | Function; - type?: string | Function; - rotation?: number | Function; + size?: number|Function; + type?: string|Function; + rotation?: number|Function; } interface ChartSeriesItemHighlightBorder { @@ -9120,15 +9119,15 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface ChartSeriesItemLabelsFromBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface ChartSeriesItemLabelsFromMargin { @@ -9146,16 +9145,16 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsFrom { - background?: string | Function; + background?: string|Function; border?: ChartSeriesItemLabelsFromBorder; - color?: string | Function; - font?: string | Function; - format?: string | Function; + color?: string|Function; + font?: string|Function; + format?: string|Function; margin?: ChartSeriesItemLabelsFromMargin; padding?: ChartSeriesItemLabelsFromPadding; - position?: string | Function; - template?: string | Function; - visible?: boolean | Function; + position?: string|Function; + template?: string|Function; + visible?: boolean|Function; } interface ChartSeriesItemLabelsMargin { @@ -9173,9 +9172,9 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsToBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface ChartSeriesItemLabelsToMargin { @@ -9193,31 +9192,31 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemLabelsTo { - background?: string | Function; + background?: string|Function; border?: ChartSeriesItemLabelsToBorder; - color?: string | Function; - font?: string | Function; - format?: string | Function; + color?: string|Function; + font?: string|Function; + format?: string|Function; margin?: ChartSeriesItemLabelsToMargin; padding?: ChartSeriesItemLabelsToPadding; - position?: string | Function; - template?: string | Function; - visible?: boolean | Function; + position?: string|Function; + template?: string|Function; + visible?: boolean|Function; } interface ChartSeriesItemLabels { align?: string; - background?: string | Function; + background?: string|Function; border?: ChartSeriesItemLabelsBorder; - color?: string | Function; + color?: string|Function; distance?: number; - font?: string | Function; - format?: string | Function; + font?: string|Function; + format?: string|Function; margin?: ChartSeriesItemLabelsMargin; padding?: ChartSeriesItemLabelsPadding; - position?: string | Function; - template?: string | Function; - visible?: boolean | Function; + position?: string|Function; + template?: string|Function; + visible?: boolean|Function; visual?: Function; from?: ChartSeriesItemLabelsFrom; to?: ChartSeriesItemLabelsTo; @@ -9238,18 +9237,18 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemMarkersBorder { - color?: string | Function; - width?: number | Function; + color?: string|Function; + width?: number|Function; } interface ChartSeriesItemMarkers { - background?: string | Function; + background?: string|Function; border?: ChartSeriesItemMarkersBorder; - size?: number | Function; - type?: string | Function; - visible?: boolean | Function; + size?: number|Function; + type?: string|Function; + visible?: boolean|Function; visual?: Function; - rotation?: number | Function; + rotation?: number|Function; } interface ChartSeriesItemNegativeValues { @@ -9281,7 +9280,7 @@ declare namespace kendo.dataviz.ui { border?: ChartSeriesItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -9303,16 +9302,16 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemOutliersBorder { - color?: string | Function; - width?: number | Function; + color?: string|Function; + width?: number|Function; } interface ChartSeriesItemOutliers { - background?: string | Function; + background?: string|Function; border?: ChartSeriesItemOutliersBorder; - size?: number | Function; - type?: string | Function; - rotation?: number | Function; + size?: number|Function; + type?: string|Function; + rotation?: number|Function; } interface ChartSeriesItemOverlay { @@ -9325,18 +9324,18 @@ declare namespace kendo.dataviz.ui { } interface ChartSeriesItemTargetBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface ChartSeriesItemTargetLine { - width?: any | Function; + width?: any|Function; } interface ChartSeriesItemTarget { border?: ChartSeriesItemTargetBorder; - color?: string | Function; + color?: string|Function; line?: ChartSeriesItemTargetLine; } @@ -9359,23 +9358,23 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartSeriesItemTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } interface ChartSeriesItem { - aggregate?: string | Function; + aggregate?: string|Function; axis?: string; border?: ChartSeriesItemBorder; categoryField?: string; closeField?: string; - color?: string | Function; + color?: string|Function; colorField?: string; connectors?: ChartSeriesItemConnectors; currentField?: string; dashType?: string; data?: any; - downColor?: string | Function; + downColor?: string|Function; downColorField?: string; segmentSpacing?: number; summaryField?: string; @@ -9426,7 +9425,7 @@ declare namespace kendo.dataviz.ui { size?: number; sizeField?: string; spacing?: number; - stack?: boolean | ChartSeriesItemStack; + stack?: boolean|ChartSeriesItemStack; startAngle?: number; target?: ChartSeriesItemTarget; targetField?: string; @@ -9485,7 +9484,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: ChartSeriesDefaultsLabelsFromMargin; padding?: ChartSeriesDefaultsLabelsFromPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -9531,7 +9530,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: ChartSeriesDefaultsLabelsToMargin; padding?: ChartSeriesDefaultsLabelsToPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -9543,7 +9542,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: ChartSeriesDefaultsLabelsMargin; padding?: ChartSeriesDefaultsLabelsPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; visual?: Function; from?: ChartSeriesDefaultsLabelsFrom; @@ -9574,7 +9573,7 @@ declare namespace kendo.dataviz.ui { border?: ChartSeriesDefaultsNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -9621,7 +9620,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartSeriesDefaultsTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -9642,7 +9641,7 @@ declare namespace kendo.dataviz.ui { scatter?: any; scatterLine?: any; spacing?: number; - stack?: boolean | ChartSeriesDefaultsStack; + stack?: boolean|ChartSeriesDefaultsStack; type?: string; tooltip?: ChartSeriesDefaultsTooltip; verticalArea?: any; @@ -9705,8 +9704,8 @@ declare namespace kendo.dataviz.ui { opacity?: number; padding?: ChartTooltipPadding; shared?: boolean; - sharedTemplate?: string | Function; - template?: string | Function; + sharedTemplate?: string|Function; + template?: string|Function; visible?: boolean; } @@ -9730,7 +9729,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartValueAxisItemCrosshairTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -9764,7 +9763,7 @@ declare namespace kendo.dataviz.ui { interface ChartValueAxisItemLabelsRotation { align?: string; - angle?: number | string; + angle?: number|string; } interface ChartValueAxisItemLabels { @@ -9779,7 +9778,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartValueAxisItemLabelsRotation; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; visual?: Function; } @@ -9852,7 +9851,7 @@ declare namespace kendo.dataviz.ui { border?: ChartValueAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -9898,7 +9897,7 @@ declare namespace kendo.dataviz.ui { border?: ChartValueAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -9962,7 +9961,7 @@ declare namespace kendo.dataviz.ui { } interface ChartValueAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; background?: string; color?: string; crosshair?: ChartValueAxisItemCrosshair; @@ -10007,7 +10006,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartXAxisItemCrosshairTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -10049,7 +10048,7 @@ declare namespace kendo.dataviz.ui { interface ChartXAxisItemLabelsRotation { align?: string; - angle?: number | string; + angle?: number|string; } interface ChartXAxisItemLabels { @@ -10066,7 +10065,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartXAxisItemLabelsRotation; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; visual?: Function; } @@ -10138,7 +10137,7 @@ declare namespace kendo.dataviz.ui { border?: ChartXAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -10184,7 +10183,7 @@ declare namespace kendo.dataviz.ui { border?: ChartXAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -10248,7 +10247,7 @@ declare namespace kendo.dataviz.ui { } interface ChartXAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; background?: string; baseUnit?: string; color?: string; @@ -10295,7 +10294,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: ChartYAxisItemCrosshairTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -10354,7 +10353,7 @@ declare namespace kendo.dataviz.ui { rotation?: ChartYAxisItemLabelsRotation; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; visual?: Function; } @@ -10426,7 +10425,7 @@ declare namespace kendo.dataviz.ui { border?: ChartYAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -10472,7 +10471,7 @@ declare namespace kendo.dataviz.ui { border?: ChartYAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -10536,7 +10535,7 @@ declare namespace kendo.dataviz.ui { } interface ChartYAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; background?: string; baseUnit?: string; color?: string; @@ -10572,8 +10571,8 @@ declare namespace kendo.dataviz.ui { } interface ChartZoomable { - mousewheel?: boolean | ChartZoomableMousewheel; - selection?: boolean | ChartZoomableSelection; + mousewheel?: boolean|ChartZoomableMousewheel; + selection?: boolean|ChartZoomableSelection; } interface ChartExportImageOptions { @@ -10606,13 +10605,14 @@ declare namespace kendo.dataviz.ui { interface ChartOptions { name?: string; autoBind?: boolean; - axisDefaults?: any; + axisDefaults?: ChartAxisDefaults; categoryAxis?: ChartCategoryAxisItem[]; valueAxis?: ChartValueAxisItem[]; chartArea?: ChartChartArea; - dataSource?: any; + dataSource?: any|any|kendo.data.DataSource; legend?: ChartLegend; panes?: ChartPane[]; + pannable?: boolean|ChartPannable; pdf?: ChartPdf; plotArea?: ChartPlotArea; renderAs?: string; @@ -10625,6 +10625,7 @@ declare namespace kendo.dataviz.ui { transitions?: boolean; xAxis?: ChartXAxisItem[]; yAxis?: ChartYAxisItem[]; + zoomable?: boolean|ChartZoomable; axisLabelClick?(e: ChartAxisLabelClickEvent): void; legendItemClick?(e: ChartLegendItemClickEvent): void; legendItemHover?(e: ChartLegendItemHoverEvent): void; @@ -10635,14 +10636,13 @@ declare namespace kendo.dataviz.ui { noteClick?(e: ChartNoteClickEvent): void; noteHover?(e: ChartNoteHoverEvent): void; plotAreaClick?(e: ChartPlotAreaClickEvent): void; - pannable?:any; + plotAreaHover?(e: ChartPlotAreaHoverEvent): void; render?(e: ChartEvent): void; select?(e: ChartSelectEvent): void; selectEnd?(e: ChartSelectEndEvent): void; selectStart?(e: ChartSelectStartEvent): void; seriesClick?(e: ChartSeriesClickEvent): void; seriesHover?(e: ChartSeriesHoverEvent): void; - zoomable?:any; zoom?(e: ChartZoomEvent): void; zoomEnd?(e: ChartZoomEndEvent): void; zoomStart?(e: ChartZoomStartEvent): void; @@ -10875,7 +10875,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string | Function; + template?: string|Function; text?: string; visual?: Function; } @@ -10956,7 +10956,7 @@ declare namespace kendo.dataviz.ui { interface DiagramConnectionDefaults { content?: DiagramConnectionDefaultsContent; - editable?: boolean | DiagramConnectionDefaultsEditable; + editable?: boolean|DiagramConnectionDefaultsEditable; endCap?: DiagramConnectionDefaultsEndCap; fromConnector?: string; hover?: DiagramConnectionDefaultsHover; @@ -10974,7 +10974,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string | Function; + template?: string|Function; text?: string; visual?: Function; } @@ -11068,7 +11068,7 @@ declare namespace kendo.dataviz.ui { interface DiagramConnection { content?: DiagramConnectionContent; - editable?: boolean | DiagramConnectionEditable; + editable?: boolean|DiagramConnectionEditable; endCap?: DiagramConnectionEndCap; from?: DiagramConnectionFrom; fromConnector?: string; @@ -11087,7 +11087,7 @@ declare namespace kendo.dataviz.ui { } interface DiagramEditableDrag { - snap?: boolean | DiagramEditableDragSnap; + snap?: boolean|DiagramEditableDragSnap; } interface DiagramEditableResizeHandlesFill { @@ -11150,12 +11150,12 @@ declare namespace kendo.dataviz.ui { } interface DiagramEditable { - connectionTemplate?: string | Function; - drag?: boolean | DiagramEditableDrag; + connectionTemplate?: string|Function; + drag?: boolean|DiagramEditableDrag; remove?: boolean; - resize?: boolean | DiagramEditableResize; - rotate?: boolean | DiagramEditableRotate; - shapeTemplate?: string | Function; + resize?: boolean|DiagramEditableResize; + rotate?: boolean|DiagramEditableRotate; + shapeTemplate?: string|Function; tools?: DiagramEditableTool[]; } @@ -11191,10 +11191,10 @@ declare namespace kendo.dataviz.ui { } interface DiagramPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface DiagramPdf { @@ -11206,7 +11206,7 @@ declare namespace kendo.dataviz.ui { keywords?: string; landscape?: boolean; margin?: DiagramPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -11303,7 +11303,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string | Function; + template?: string|Function; text?: string; } @@ -11363,7 +11363,7 @@ declare namespace kendo.dataviz.ui { connectors?: DiagramShapeDefaultsConnector[]; connectorDefaults?: DiagramShapeDefaultsConnectorDefaults; content?: DiagramShapeDefaultsContent; - editable?: boolean | DiagramShapeDefaultsEditable; + editable?: boolean|DiagramShapeDefaultsEditable; fill?: DiagramShapeDefaultsFill; height?: number; hover?: DiagramShapeDefaultsHover; @@ -11461,7 +11461,7 @@ declare namespace kendo.dataviz.ui { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string | Function; + template?: string|Function; text?: string; } @@ -11519,7 +11519,7 @@ declare namespace kendo.dataviz.ui { connectors?: DiagramShapeConnector[]; connectorDefaults?: DiagramShapeConnectorDefaults; content?: DiagramShapeContent; - editable?: boolean | DiagramShapeEditable; + editable?: boolean|DiagramShapeEditable; fill?: DiagramShapeFill; height?: number; hover?: DiagramShapeHover; @@ -11556,16 +11556,16 @@ declare namespace kendo.dataviz.ui { autoBind?: boolean; connectionDefaults?: DiagramConnectionDefaults; connections?: DiagramConnection[]; - connectionsDataSource?: any | any | kendo.data.DataSource; - dataSource?: any | any | kendo.data.DataSource; - editable?: boolean | DiagramEditable; + connectionsDataSource?: any|any|kendo.data.DataSource; + dataSource?: any|any|kendo.data.DataSource; + editable?: boolean|DiagramEditable; layout?: DiagramLayout; - pannable?: boolean | DiagramPannable; + pannable?: boolean|DiagramPannable; pdf?: DiagramPdf; - selectable?: boolean | DiagramSelectable; + selectable?: boolean|DiagramSelectable; shapeDefaults?: DiagramShapeDefaults; shapes?: DiagramShape[]; - template?: string | Function; + template?: string|Function; zoom?: number; zoomMax?: number; zoomMin?: number; @@ -11773,7 +11773,7 @@ declare namespace kendo.dataviz.ui { interface LinearGaugePointerItem { border?: LinearGaugePointerItemBorder; color?: string; - margin?: number | any; + margin?: number|any; opacity?: number; shape?: string; size?: number; @@ -11809,7 +11809,7 @@ declare namespace kendo.dataviz.ui { format?: string; margin?: LinearGaugeScaleLabelsMargin; padding?: LinearGaugeScaleLabelsPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -11941,9 +11941,9 @@ declare namespace kendo.dataviz.ui { } interface MapControls { - attribution?: boolean | MapControlsAttribution; - navigator?: boolean | MapControlsNavigator; - zoom?: boolean | MapControlsZoom; + attribution?: boolean|MapControlsAttribution; + navigator?: boolean|MapControlsNavigator; + zoom?: boolean|MapControlsZoom; } interface MapLayerDefaultsBing { @@ -11977,7 +11977,7 @@ declare namespace kendo.dataviz.ui { maxSize?: number; minSize?: number; style?: MapLayerDefaultsBubbleStyle; - symbol?: string | Function; + symbol?: string|Function; } interface MapLayerDefaultsMarkerTooltipAnimationClose { @@ -12111,8 +12111,8 @@ declare namespace kendo.dataviz.ui { interface MapLayer { attribution?: string; autoBind?: boolean; - dataSource?: any | any | kendo.data.DataSource; - extent?: any | kendo.dataviz.map.Extent; + dataSource?: any|any|kendo.data.DataSource; + extent?: any|kendo.dataviz.map.Extent; key?: string; imagerySet?: string; culture?: string; @@ -12125,7 +12125,7 @@ declare namespace kendo.dataviz.ui { minSize?: number; opacity?: number; subdomains?: any; - symbol?: string | Function; + symbol?: string|Function; type?: string; style?: MapLayerStyle; urlTemplate?: string; @@ -12205,7 +12205,7 @@ declare namespace kendo.dataviz.ui { } interface MapMarker { - location?: any | kendo.dataviz.map.Location; + location?: any|kendo.dataviz.map.Location; shape?: string; title?: string; tooltip?: MapMarkerTooltip; @@ -12213,7 +12213,7 @@ declare namespace kendo.dataviz.ui { interface MapOptions { name?: string; - center?: any | kendo.dataviz.map.Location; + center?: any|kendo.dataviz.map.Location; controls?: MapControls; layerDefaults?: MapLayerDefaults; layers?: MapLayer[]; @@ -12378,8 +12378,8 @@ declare namespace kendo.dataviz.ui { errorCorrection?: string; padding?: number; renderAs?: string; - size?: number | string; - value?: number | string; + size?: number|string; + value?: number|string; } interface QRCodeEvent { sender: QRCode; @@ -12479,7 +12479,7 @@ declare namespace kendo.dataviz.ui { margin?: RadialGaugeScaleLabelsMargin; padding?: RadialGaugeScaleLabelsPadding; position?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -12584,8 +12584,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -12610,13 +12610,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; + margin?: number|any; mirror?: boolean; - padding?: number | any; + padding?: number|any; rotation?: number; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; culture?: string; dateFormats?: any; @@ -12689,7 +12689,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -12735,7 +12735,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -12774,7 +12774,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineCategoryAxisItemTitleBorder; color?: string; font?: string; - margin?: number | any; + margin?: number|any; position?: string; rotation?: number; text?: string; @@ -12782,7 +12782,7 @@ declare namespace kendo.dataviz.ui { } interface SparklineCategoryAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; categories?: any; color?: string; field?: string; @@ -12822,7 +12822,7 @@ declare namespace kendo.dataviz.ui { opacity?: number; border?: SparklineChartAreaBorder; height?: number; - margin?: number | any; + margin?: number|any; width?: number; } @@ -12836,14 +12836,14 @@ declare namespace kendo.dataviz.ui { background?: string; opacity?: number; border?: SparklinePlotAreaBorder; - margin?: number | any; + margin?: number|any; } interface SparklineSeriesItemBorder { - color?: string | Function; - dashType?: string | Function; - opacity?: number | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + opacity?: number|Function; + width?: number|Function; } interface SparklineSeriesItemConnectors { @@ -12866,24 +12866,24 @@ declare namespace kendo.dataviz.ui { } interface SparklineSeriesItemLabelsBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface SparklineSeriesItemLabels { align?: string; - background?: string | Function; + background?: string|Function; border?: SparklineSeriesItemLabelsBorder; - color?: string | Function; + color?: string|Function; distance?: number; - font?: string | Function; - format?: string | Function; - margin?: number | any; - padding?: number | any; - position?: string | Function; - template?: string | Function; - visible?: boolean | Function; + font?: string|Function; + format?: string|Function; + margin?: number|any; + padding?: number|any; + position?: string|Function; + template?: string|Function; + visible?: boolean|Function; } interface SparklineSeriesItemLine { @@ -12894,17 +12894,17 @@ declare namespace kendo.dataviz.ui { } interface SparklineSeriesItemMarkersBorder { - color?: string | Function; - width?: number | Function; + color?: string|Function; + width?: number|Function; } interface SparklineSeriesItemMarkers { - background?: string | Function; + background?: string|Function; border?: SparklineSeriesItemMarkersBorder; - size?: number | Function; - type?: string | Function; - visible?: boolean | Function; - rotation?: number | Function; + size?: number|Function; + type?: string|Function; + visible?: boolean|Function; + rotation?: number|Function; } interface SparklineSeriesItemNotesIconBorder { @@ -12931,7 +12931,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineSeriesItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -12961,18 +12961,18 @@ declare namespace kendo.dataviz.ui { } interface SparklineSeriesItemTargetBorder { - color?: string | Function; - dashType?: string | Function; + color?: string|Function; + dashType?: string|Function; width?: number; } interface SparklineSeriesItemTargetLine { - width?: any | Function; + width?: any|Function; } interface SparklineSeriesItemTarget { line?: SparklineSeriesItemTargetLine; - color?: string | Function; + color?: string|Function; border?: SparklineSeriesItemTargetBorder; } @@ -12987,8 +12987,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -13002,11 +13002,11 @@ declare namespace kendo.dataviz.ui { field?: string; name?: string; highlight?: SparklineSeriesItemHighlight; - aggregate?: string | Function; + aggregate?: string|Function; axis?: string; border?: SparklineSeriesItemBorder; categoryField?: string; - color?: string | Function; + color?: string|Function; colorField?: string; connectors?: SparklineSeriesItemConnectors; gap?: number; @@ -13022,7 +13022,7 @@ declare namespace kendo.dataviz.ui { size?: number; startAngle?: number; spacing?: number; - stack?: boolean | SparklineSeriesItemStack; + stack?: boolean|SparklineSeriesItemStack; tooltip?: SparklineSeriesItemTooltip; width?: number; target?: SparklineSeriesItemTarget; @@ -13048,9 +13048,9 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; - padding?: number | any; - template?: string | Function; + margin?: number|any; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -13069,8 +13069,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -13085,7 +13085,7 @@ declare namespace kendo.dataviz.ui { overlay?: any; pie?: any; spacing?: number; - stack?: boolean | SparklineSeriesDefaultsStack; + stack?: boolean|SparklineSeriesDefaultsStack; type?: string; tooltip?: SparklineSeriesDefaultsTooltip; } @@ -13101,8 +13101,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; shared?: boolean; sharedTemplate?: string; @@ -13119,8 +13119,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -13145,13 +13145,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; + margin?: number|any; mirror?: boolean; - padding?: number | any; + padding?: number|any; rotation?: number; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -13221,7 +13221,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineValueAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -13267,7 +13267,7 @@ declare namespace kendo.dataviz.ui { border?: SparklineValueAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -13306,8 +13306,8 @@ declare namespace kendo.dataviz.ui { border?: SparklineValueAxisItemTitleBorder; color?: string; font?: string; - margin?: number | any; - padding?: number | any; + margin?: number|any; + padding?: number|any; position?: string; rotation?: number; text?: string; @@ -13315,7 +13315,7 @@ declare namespace kendo.dataviz.ui { } interface SparklineValueAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; color?: string; labels?: SparklineValueAxisItemLabels; line?: SparklineValueAxisItemLine; @@ -13511,8 +13511,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -13537,13 +13537,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; + margin?: number|any; mirror?: boolean; - padding?: number | any; + padding?: number|any; rotation?: number; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; culture?: string; dateFormats?: any; @@ -13616,7 +13616,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -13662,7 +13662,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -13714,7 +13714,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartCategoryAxisItemTitleBorder; color?: string; font?: string; - margin?: number | any; + margin?: number|any; position?: string; rotation?: number; text?: string; @@ -13722,7 +13722,7 @@ declare namespace kendo.dataviz.ui { } interface StockChartCategoryAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; categories?: any; color?: string; field?: string; @@ -13765,7 +13765,7 @@ declare namespace kendo.dataviz.ui { opacity?: number; border?: StockChartChartAreaBorder; height?: number; - margin?: number | any; + margin?: number|any; width?: number; } @@ -13806,10 +13806,10 @@ declare namespace kendo.dataviz.ui { border?: StockChartLegendBorder; item?: StockChartLegendItem; labels?: StockChartLegendLabels; - margin?: number | any; + margin?: number|any; offsetX?: number; offsetY?: number; - padding?: number | any; + padding?: number|any; position?: string; reverse?: boolean; visible?: boolean; @@ -13846,7 +13846,7 @@ declare namespace kendo.dataviz.ui { font?: string; format?: string; padding?: StockChartNavigatorCategoryAxisItemCrosshairTooltipPadding; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -13900,7 +13900,7 @@ declare namespace kendo.dataviz.ui { rotation?: number; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -13971,7 +13971,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartNavigatorCategoryAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -14017,7 +14017,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartNavigatorCategoryAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -14080,7 +14080,7 @@ declare namespace kendo.dataviz.ui { interface StockChartNavigatorCategoryAxisItem { autoBaseUnitSteps?: StockChartNavigatorCategoryAxisItemAutoBaseUnitSteps; - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; background?: string; baseUnit?: string; baseUnitStep?: any; @@ -14109,7 +14109,7 @@ declare namespace kendo.dataviz.ui { interface StockChartNavigatorHint { visible?: boolean; - template?: string | Function; + template?: string|Function; format?: string; } @@ -14210,10 +14210,10 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; - padding?: number | any; + margin?: number|any; + padding?: number|any; position?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -14231,7 +14231,7 @@ declare namespace kendo.dataviz.ui { interface StockChartNavigatorSeriesItemMarkers { background?: string; border?: StockChartNavigatorSeriesItemMarkersBorder; - rotation?: number | Function; + rotation?: number|Function; size?: number; type?: string; visible?: boolean; @@ -14257,8 +14257,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -14271,7 +14271,7 @@ declare namespace kendo.dataviz.ui { categoryField?: string; name?: string; highlight?: StockChartNavigatorSeriesItemHighlight; - aggregate?: string | Function; + aggregate?: string|Function; axis?: string; border?: StockChartNavigatorSeriesItemBorder; closeField?: string; @@ -14290,7 +14290,7 @@ declare namespace kendo.dataviz.ui { openField?: string; overlay?: StockChartNavigatorSeriesItemOverlay; spacing?: number; - stack?: boolean | StockChartNavigatorSeriesItemStack; + stack?: boolean|StockChartNavigatorSeriesItemStack; tooltip?: StockChartNavigatorSeriesItemTooltip; width?: number; } @@ -14324,7 +14324,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartPaneTitleBorder; color?: string; font?: string; - margin?: number | any; + margin?: number|any; position?: string; text?: string; visible?: boolean; @@ -14332,8 +14332,8 @@ declare namespace kendo.dataviz.ui { interface StockChartPane { name?: string; - margin?: number | any; - padding?: number | any; + margin?: number|any; + padding?: number|any; background?: string; border?: StockChartPaneBorder; clip?: boolean; @@ -14342,10 +14342,10 @@ declare namespace kendo.dataviz.ui { } interface StockChartPdfMargin { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; + bottom?: number|string; + left?: number|string; + right?: number|string; + top?: number|string; } interface StockChartPdf { @@ -14357,7 +14357,7 @@ declare namespace kendo.dataviz.ui { keywords?: string; landscape?: boolean; margin?: StockChartPdfMargin; - paperSize?: string | any; + paperSize?: string|any; proxyURL?: string; proxyTarget?: string; subject?: string; @@ -14374,14 +14374,14 @@ declare namespace kendo.dataviz.ui { background?: string; opacity?: number; border?: StockChartPlotAreaBorder; - margin?: number | any; + margin?: number|any; } interface StockChartSeriesItemBorder { - color?: string | Function; - dashType?: string | Function; - opacity?: number | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + opacity?: number|Function; + width?: number|Function; } interface StockChartSeriesItemHighlightBorder { @@ -14405,22 +14405,22 @@ declare namespace kendo.dataviz.ui { } interface StockChartSeriesItemLabelsBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface StockChartSeriesItemLabels { - background?: string | Function; + background?: string|Function; border?: StockChartSeriesItemLabelsBorder; - color?: string | Function; - font?: string | Function; - format?: string | Function; - margin?: number | any; - padding?: number | any; - position?: string | Function; - template?: string | Function; - visible?: boolean | Function; + color?: string|Function; + font?: string|Function; + format?: string|Function; + margin?: number|any; + padding?: number|any; + position?: string|Function; + template?: string|Function; + visible?: boolean|Function; } interface StockChartSeriesItemLine { @@ -14431,17 +14431,17 @@ declare namespace kendo.dataviz.ui { } interface StockChartSeriesItemMarkersBorder { - color?: string | Function; - width?: number | Function; + color?: string|Function; + width?: number|Function; } interface StockChartSeriesItemMarkers { - background?: string | Function; + background?: string|Function; border?: StockChartSeriesItemMarkersBorder; - size?: number | Function; - rotation?: number | Function; - type?: string | Function; - visible?: boolean | Function; + size?: number|Function; + rotation?: number|Function; + type?: string|Function; + visible?: boolean|Function; } interface StockChartSeriesItemNotesIconBorder { @@ -14468,7 +14468,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartSeriesItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -14498,18 +14498,18 @@ declare namespace kendo.dataviz.ui { } interface StockChartSeriesItemTargetBorder { - color?: string | Function; - dashType?: string | Function; - width?: number | Function; + color?: string|Function; + dashType?: string|Function; + width?: number|Function; } interface StockChartSeriesItemTargetLine { - width?: any | Function; + width?: any|Function; } interface StockChartSeriesItemTarget { line?: StockChartSeriesItemTargetLine; - color?: string | Function; + color?: string|Function; border?: StockChartSeriesItemTargetBorder; } @@ -14524,8 +14524,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -14540,13 +14540,13 @@ declare namespace kendo.dataviz.ui { targetField?: string; name?: string; highlight?: StockChartSeriesItemHighlight; - aggregate?: string | Function; + aggregate?: string|Function; axis?: string; border?: StockChartSeriesItemBorder; closeField?: string; - color?: string | Function; + color?: string|Function; colorField?: string; - downColor?: string | Function; + downColor?: string|Function; downColorField?: string; gap?: number; labels?: StockChartSeriesItemLabels; @@ -14560,7 +14560,7 @@ declare namespace kendo.dataviz.ui { openField?: string; overlay?: StockChartSeriesItemOverlay; spacing?: number; - stack?: boolean | StockChartSeriesItemStack; + stack?: boolean|StockChartSeriesItemStack; tooltip?: StockChartSeriesItemTooltip; visibleInLegend?: boolean; width?: number; @@ -14587,9 +14587,9 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; - padding?: number | any; - template?: string | Function; + margin?: number|any; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -14608,8 +14608,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -14625,7 +14625,7 @@ declare namespace kendo.dataviz.ui { overlay?: any; pie?: any; spacing?: number; - stack?: boolean | StockChartSeriesDefaultsStack; + stack?: boolean|StockChartSeriesDefaultsStack; type?: string; tooltip?: StockChartSeriesDefaultsTooltip; } @@ -14642,8 +14642,8 @@ declare namespace kendo.dataviz.ui { border?: StockChartTitleBorder; font?: string; color?: string; - margin?: number | any; - padding?: number | any; + margin?: number|any; + padding?: number|any; position?: string; text?: string; visible?: boolean; @@ -14660,8 +14660,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; shared?: boolean; sharedTemplate?: string; @@ -14678,8 +14678,8 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - padding?: number | any; - template?: string | Function; + padding?: number|any; + template?: string|Function; visible?: boolean; } @@ -14704,13 +14704,13 @@ declare namespace kendo.dataviz.ui { color?: string; font?: string; format?: string; - margin?: number | any; + margin?: number|any; mirror?: boolean; - padding?: number | any; + padding?: number|any; rotation?: number; skip?: number; step?: number; - template?: string | Function; + template?: string|Function; visible?: boolean; } @@ -14780,7 +14780,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartValueAxisItemNotesDataItemLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -14826,7 +14826,7 @@ declare namespace kendo.dataviz.ui { border?: StockChartValueAxisItemNotesLabelBorder; color?: string; font?: string; - template?: string | Function; + template?: string|Function; visible?: boolean; rotation?: number; format?: string; @@ -14865,8 +14865,8 @@ declare namespace kendo.dataviz.ui { border?: StockChartValueAxisItemTitleBorder; color?: string; font?: string; - margin?: number | any; - padding?: number | any; + margin?: number|any; + padding?: number|any; position?: string; rotation?: number; text?: string; @@ -14874,7 +14874,7 @@ declare namespace kendo.dataviz.ui { } interface StockChartValueAxisItem { - axisCrossingValue?: any | Date | any; + axisCrossingValue?: any|Date|any; background?: string; color?: string; labels?: StockChartValueAxisItemLabels; @@ -15115,14 +15115,14 @@ declare namespace kendo.dataviz.ui { interface TreeMapOptions { name?: string; - dataSource?: any | any | kendo.data.HierarchicalDataSource; + dataSource?: any|any|kendo.data.HierarchicalDataSource; autoBind?: boolean; type?: string; theme?: string; valueField?: string; colorField?: string; textField?: string; - template?: string | Function; + template?: string|Function; colors?: any; itemCreated?(e: TreeMapItemCreatedEvent): void; dataBound?(e: TreeMapDataBoundEvent): void; @@ -15134,7 +15134,7 @@ declare namespace kendo.dataviz.ui { } interface TreeMapItemCreatedEvent extends TreeMapEvent { - element?: JQuery | Element; + element?: JQuery|Element; } interface TreeMapDataBoundEvent extends TreeMapEvent { @@ -15179,7 +15179,7 @@ declare namespace kendo.dataviz.map { nw: kendo.dataviz.map.Location; se: kendo.dataviz.map.Location; - constructor(nw: kendo.dataviz.map.Location | any, se: kendo.dataviz.map.Location | any); + constructor(nw: kendo.dataviz.map.Location|any, se: kendo.dataviz.map.Location|any); static create(a: kendo.dataviz.map.Location, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; static create(a: kendo.dataviz.map.Location, b?: any): kendo.dataviz.map.Extent; @@ -15319,7 +15319,7 @@ declare namespace kendo.dataviz.map { interface MarkerOptions { name?: string; - location?: any | kendo.dataviz.map.Location; + location?: any|kendo.dataviz.map.Location; shape?: string; title?: string; tooltip?: MarkerTooltip; @@ -15547,7 +15547,7 @@ declare namespace kendo.dataviz.diagram { fontSize?: number; fontStyle?: string; fontWeight?: string; - template?: string | Function; + template?: string|Function; text?: string; visual?: Function; } @@ -16244,7 +16244,7 @@ declare namespace kendo.dataviz.diagram { interface ShapeOptions { name?: string; id?: string; - editable?: boolean | ShapeEditable; + editable?: boolean|ShapeEditable; path?: string; stroke?: ShapeStroke; type?: string; @@ -16344,10 +16344,10 @@ declare namespace kendo { namespace drawing { function align(elements: any, rect: kendo.geometry.Rect, alignment: string): void; - function drawDOM(element: JQuery, options?: any): JQueryPromise; - function exportImage(group: kendo.drawing.Group, options?: any): JQueryPromise; - function exportPDF(group: kendo.drawing.Group, options?: kendo.drawing.PDFOptions): JQueryPromise; - function exportSVG(group: kendo.drawing.Group, options?: any): JQueryPromise; + function drawDOM(element: JQuery, options: any): JQueryPromise; + function exportImage(group: kendo.drawing.Group, options: any): JQueryPromise; + function exportPDF(group: kendo.drawing.Group, options: kendo.drawing.PDFOptions): JQueryPromise; + function exportSVG(group: kendo.drawing.Group, options: any): JQueryPromise; function fit(element: kendo.drawing.Element, rect: kendo.geometry.Rect): void; function stack(elements: any): void; function vAlign(elements: any, rect: kendo.geometry.Rect, alignment: string): void; @@ -16363,40 +16363,40 @@ declare namespace kendo { function transformOrigin(firstElement: HTMLElement, secondElement: HTMLElement): any; } - function antiForgeryTokens(): any; - function bind(element: string, viewModel: any, namespace?: any): void; - function bind(element: string, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function bind(element: JQuery, viewModel: any, namespace?: any): void; - function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function bind(element: Element, viewModel: any, namespace?: any): void; - function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; - function observableHierarchy(array: any): void; - function culture(culture: string): void; - function destroy(element: string): void; - function destroy(element: JQuery): void; - function destroy(element: Element): void; - function htmlEncode(value: string): string; - function parseDate(value: string, formats?: string, culture?: string): Date; - function parseDate(value: string, formats?: any, culture?: string): Date; - function parseFloat(value: string, culture?: string): number; - function parseInt(value: string, culture?: string): number; - function parseColor(color: string, noerror: boolean): kendo.Color; - function proxyModelSetters(): void; - function proxyModelSetters(data: kendo.data.Model): void; - function resize(element: string, force: boolean): void; - function resize(element: JQuery, force: boolean): void; - function resize(element: Element, force: boolean): void; - function saveAs(options: any): void; - function stringify(value: any): string; - function throttle(fn: Function, timeout: number): void; - function touchScroller(element: string): void; - function touchScroller(element: JQuery): void; - function touchScroller(element: Element): void; - function toString(value: Date, format: string, culture?: string): string; - function toString(value: number, format: string, culture?: string): string; - function unbind(element: string): void; - function unbind(element: JQuery): void; - function unbind(element: Element): void; + function antiForgeryTokens(): any; + function bind(element: string, viewModel: any, namespace?: any): void; + function bind(element: string, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: JQuery, viewModel: any, namespace?: any): void; + function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: Element, viewModel: any, namespace?: any): void; + function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function observableHierarchy(array: any): void; + function culture(culture: string): void; + function destroy(element: string): void; + function destroy(element: JQuery): void; + function destroy(element: Element): void; + function htmlEncode(value: string): string; + function parseDate(value: string, formats?: string, culture?: string): Date; + function parseDate(value: string, formats?: any, culture?: string): Date; + function parseFloat(value: string, culture?: string): number; + function parseInt(value: string, culture?: string): number; + function parseColor(color: string, noerror: boolean): kendo.Color; + function proxyModelSetters(): void; + function proxyModelSetters(data: kendo.data.Model): void; + function resize(element: string, force: boolean): void; + function resize(element: JQuery, force: boolean): void; + function resize(element: Element, force: boolean): void; + function saveAs(options: any): void; + function stringify(value: any): string; + function throttle(fn: Function, timeout: number): void; + function touchScroller(element: string): void; + function touchScroller(element: JQuery): void; + function touchScroller(element: Element): void; + function toString(value: Date, format: string, culture?: string): string; + function toString(value: number, format: string, culture?: string): string; + function unbind(element: string): void; + function unbind(element: JQuery): void; + function unbind(element: Element): void; namespace pdf { function defineFont(map: any): void; @@ -16648,9 +16648,9 @@ declare namespace kendo.mobile.ui { } interface ActionSheetPopup { - direction?: number | string; - height?: number | string; - width?: number | string; + direction?: number|string; + height?: number|string; + width?: number|string; } interface ActionSheetOptions { @@ -17018,18 +17018,18 @@ declare namespace kendo.mobile.ui { name?: string; appendOnRefresh?: boolean; autoBind?: boolean; - dataSource?: kendo.data.DataSource | any; + dataSource?: kendo.data.DataSource|any; endlessScroll?: boolean; fixedHeaders?: boolean; - headerTemplate?: string | Function; + headerTemplate?: string|Function; loadMore?: boolean; messages?: ListViewMessages; pullToRefresh?: boolean; pullParameters?: Function; style?: string; - template?: string | Function; + template?: string|Function; type?: string; - filterable?: boolean | ListViewFilterable; + filterable?: boolean|ListViewFilterable; virtualViewSize?: number; click?(e: ListViewClickEvent): void; dataBound?(e: ListViewEvent): void; @@ -17241,8 +17241,8 @@ declare namespace kendo.mobile.ui { } interface PopOverPopup { - height?: number | string; - width?: number | string; + height?: number|string; + width?: number|string; } interface PopOverOptions { @@ -17298,8 +17298,8 @@ declare namespace kendo.mobile.ui { name?: string; autoBind?: boolean; bounceVelocityThreshold?: number; - contentHeight?: number | string; - dataSource?: kendo.data.DataSource | any; + contentHeight?: number|string; + dataSource?: kendo.data.DataSource|any; duration?: number; emptyTemplate?: string; enablePager?: boolean; @@ -17678,7 +17678,7 @@ declare namespace kendo.ooxml { wrap?: boolean; vAlign?: string; verticalAlign?: string; - value?: Date | number | string | boolean; + value?: Date|number|string|boolean; } interface WorkbookSheetRow { @@ -17884,7 +17884,7 @@ declare namespace kendo.dataviz.geometry { origin: kendo.geometry.Point; size: kendo.geometry.Size; - constructor(origin: kendo.geometry.Point | any, size: kendo.geometry.Size | any); + constructor(origin: kendo.geometry.Point|any, size: kendo.geometry.Size|any); static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; @@ -18110,7 +18110,7 @@ declare namespace kendo.dataviz.drawing { } - interface FillOptions { + interface FillOptions { @@ -18409,7 +18409,7 @@ declare namespace kendo.dataviz.drawing { } - interface PDFOptions { + interface PDFOptions { @@ -18513,7 +18513,7 @@ declare namespace kendo.dataviz.drawing { interface RadialGradientOptions { name?: string; - center?: any | kendo.geometry.Point; + center?: any|kendo.geometry.Point; radius?: number; stops?: any; } @@ -18597,7 +18597,7 @@ declare namespace kendo.dataviz.drawing { } - interface StrokeOptions { + interface StrokeOptions { @@ -18651,8 +18651,8 @@ declare namespace kendo.dataviz.drawing { } interface SurfaceTooltip { - animation?: boolean | SurfaceTooltipAnimation; - appendTo?: string | JQuery; + animation?: boolean|SurfaceTooltipAnimation; + appendTo?: string|JQuery; } interface SurfaceOptions { @@ -18747,20 +18747,20 @@ declare namespace kendo.dataviz.drawing { } - interface TooltipOptions { + interface TooltipOptions { autoHide?: boolean; - content?: string | Function; + content?: string|Function; position?: string; - height?: number | string; + height?: number|string; hideDelay?: number; offset?: number; shared?: boolean; showAfter?: number; showOn?: string; - width?: number | string; + width?: number|string; From 41827bc8172dd4443e138a8d34e4ab90bfadd0e1 Mon Sep 17 00:00:00 2001 From: Gayan Ranasinghe Date: Mon, 25 Jul 2016 10:24:56 +0530 Subject: [PATCH 010/203] remove duplicates --- kendo-ui/kendo-ui.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index 941a432d81..ab09a8882f 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -2657,7 +2657,6 @@ declare namespace kendo.ui { separator?: string; suggest?: boolean; headerTemplate?: string|Function; - headerTemplate?: string | Function; template?: string | Function; valuePrimitive?: boolean; virtual?: boolean|AutoCompleteVirtual; From 2690241ec7714c9fa72a652980d21a389e948ef4 Mon Sep 17 00:00:00 2001 From: David Newell Date: Thu, 28 Jul 2016 11:28:31 -0400 Subject: [PATCH 011/203] Adding a couple missing highcharts properites --- highcharts/highcharts-tests.ts | 1 + highcharts/highcharts.d.ts | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts index 499dfc9494..72cc86b4d4 100644 --- a/highcharts/highcharts-tests.ts +++ b/highcharts/highcharts-tests.ts @@ -2258,6 +2258,7 @@ function test_PointObject() { var point = $('#container').highcharts().get('point1'); var category = point.category; var percentage = point.percentage; + point.index; point.remove(); point.remove(false); point.remove(false, {duration: 50}); diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 45f69a0bda..8fe94b955e 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Highcharts 4.1.9 +// Type definitions for Highcharts 4.2.5 // Project: http://www.highcharts.com/ // Definitions by: Damiano Gambarotto , Dan Lewi Harkestad // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -4817,6 +4817,17 @@ interface HighchartsPlotOptions { */ interface HighchartsIndividualSeriesOptions { type?: string; + /** + * The main color or the series. In line type series it applies to the line and the point markers unless otherwise + * 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; + /** + * 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. + */ + cursor?: string; /** * An array of data points for the series. For the area series type, points can be given in the following ways: * @@ -4867,6 +4878,11 @@ interface HighchartsIndividualSeriesOptions { * The name of the series as shown in the legend, tooltip etc. */ name?: string; + /** + * A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from + * the pointPadding and groupPadding. + */ + pointWidth?: number; /** * This option allows grouping series in a stacked chart. The stack option can be a string or a number or anything * else, as long as the grouped series' stack options match each other. @@ -5472,12 +5488,12 @@ interface HighchartsOptions { * The X axis or category axis. Normally this is the horizontal axis, though if the chart is inverted this is the * vertical axis. In case of multiple axes, the xAxis node is an array of configuration objects. */ - xAxis?: HighchartsAxisOptions | HighchartsAxisOptions[]; + xAxis?: HighchartsAxisOptions[] | HighchartsAxisOptions; /** * The Y axis or value axis. Normally this is the vertical axis, though if the chart is inverted this is the * horizontal axis. In case of multiple axes, the yAxis node is an array of configuration objects. */ - yAxis?: HighchartsAxisOptions | HighchartsAxisOptions[]; + yAxis?: HighchartsAxisOptions[] | HighchartsAxisOptions; } interface HighchartsGlobalOptions extends HighchartsOptions { @@ -6098,6 +6114,7 @@ interface HighchartsPointObject { */ category: string | number; name: string; + index: number; /** * The percentage for points in a stacked series or pies. * @since 1.2.0 From 1ad718c4c95735d849ad22d4a9bd9c76b4845d07 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 30 Jul 2016 00:07:09 +0300 Subject: [PATCH 012/203] Added gulp-help-doc definitions --- gulp-help-doc/gulp-help-doc-tests.ts | 24 ++++++++++++ gulp-help-doc/gulp-help-doc.d.ts | 57 ++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 gulp-help-doc/gulp-help-doc-tests.ts create mode 100644 gulp-help-doc/gulp-help-doc.d.ts diff --git a/gulp-help-doc/gulp-help-doc-tests.ts b/gulp-help-doc/gulp-help-doc-tests.ts new file mode 100644 index 0000000000..6e69a88e5b --- /dev/null +++ b/gulp-help-doc/gulp-help-doc-tests.ts @@ -0,0 +1,24 @@ +/// +/// +/// + +import gulp = require('gulp'); +import usage = require('gulp-help-doc'); + +/** + * Demo task + * + * @task {demo} + * @arg {env} environment + */ +gulp.task('demo', function() {}); + +var logger = { + output: '', + log: msg => logger.output += msg + '\n' +}; + +usage(gulp, { + logger: logger, + gulpfile: __filename +}).then(() => console.log(logger.output)); diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/gulp-help-doc.d.ts new file mode 100644 index 0000000000..de2983b878 --- /dev/null +++ b/gulp-help-doc/gulp-help-doc.d.ts @@ -0,0 +1,57 @@ +// Type definitions for gulp-help-doc +// Project: https://github.com/Mikhus/gulp-help-doc +// Definitions by: Mikhus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "gulp-help-doc" { + + import gulp = require('gulp'); + import promise = require('es6-promise'); + + namespace usage { + + interface UsageOptions { + /** + * Defines max line width for the printed output lines + * (by default is 80 characters long) + */ + lineWidth?: number, + + /** + * Defines max width of the column width tasks or args names + * (by default is 20 characters long) + */ + keysColumnWidth?: number, + + /** + * Defines number of empty characters for left-padding of the output + */ + padding?: number, + + /** + * Printing engine (by default is console). Accepted any device + * which has log() function defined to do output. + */ + logger?: { log: Function }, + + /** + * Path to a gulpfile (default is gulpfile.js) + * Normally, there is no need to change this option. It may be used + * for some special cases, like mocking gulpfile for testing. + */ + gulpfile?: string + } + + interface Usage { + (gulp: gulp.Gulp, options?: UsageOptions): promise.Promise + } + + } + + var usage: usage.Usage; + + export = usage; +} From 830ccbe8372172aca14a08ae041c2d0adc3ef6ff Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 30 Jul 2016 00:14:48 +0300 Subject: [PATCH 013/203] Fixed declaration and tests --- gulp-help-doc/gulp-help-doc-tests.ts | 5 ++++- gulp-help-doc/gulp-help-doc.d.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gulp-help-doc/gulp-help-doc-tests.ts b/gulp-help-doc/gulp-help-doc-tests.ts index 6e69a88e5b..a3eca8ecae 100644 --- a/gulp-help-doc/gulp-help-doc-tests.ts +++ b/gulp-help-doc/gulp-help-doc-tests.ts @@ -13,7 +13,10 @@ import usage = require('gulp-help-doc'); */ gulp.task('demo', function() {}); -var logger = { +let logger: { + output: string, + log(msg: string) +} = { output: '', log: msg => logger.output += msg + '\n' }; diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/gulp-help-doc.d.ts index de2983b878..a6c1377b26 100644 --- a/gulp-help-doc/gulp-help-doc.d.ts +++ b/gulp-help-doc/gulp-help-doc.d.ts @@ -5,11 +5,12 @@ /// /// +/// declare module "gulp-help-doc" { import gulp = require('gulp'); - import promise = require('es6-promise'); + import Promise = require('es6-promise'); namespace usage { From fb2f5a4e232995bcc3bb70c5a4d44eb0d7d5822b Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 30 Jul 2016 00:18:47 +0300 Subject: [PATCH 014/203] Fixed declaration and tests --- gulp-help-doc/gulp-help-doc-tests.ts | 2 +- gulp-help-doc/gulp-help-doc.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gulp-help-doc/gulp-help-doc-tests.ts b/gulp-help-doc/gulp-help-doc-tests.ts index a3eca8ecae..f06c25e55c 100644 --- a/gulp-help-doc/gulp-help-doc-tests.ts +++ b/gulp-help-doc/gulp-help-doc-tests.ts @@ -15,7 +15,7 @@ gulp.task('demo', function() {}); let logger: { output: string, - log(msg: string) + log(msg: string): any } = { output: '', log: msg => logger.output += msg + '\n' diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/gulp-help-doc.d.ts index a6c1377b26..aa15e1cf17 100644 --- a/gulp-help-doc/gulp-help-doc.d.ts +++ b/gulp-help-doc/gulp-help-doc.d.ts @@ -10,7 +10,7 @@ declare module "gulp-help-doc" { import gulp = require('gulp'); - import Promise = require('es6-promise'); + import promise = require('es6-promise'); namespace usage { From 214f14e2b350c0a36d701a370f1231172299edee Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 30 Jul 2016 00:21:06 +0300 Subject: [PATCH 015/203] Definition fixed --- gulp-help-doc/gulp-help-doc.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/gulp-help-doc.d.ts index aa15e1cf17..31aa0d764a 100644 --- a/gulp-help-doc/gulp-help-doc.d.ts +++ b/gulp-help-doc/gulp-help-doc.d.ts @@ -5,12 +5,10 @@ /// /// -/// declare module "gulp-help-doc" { import gulp = require('gulp'); - import promise = require('es6-promise'); namespace usage { @@ -47,7 +45,7 @@ declare module "gulp-help-doc" { } interface Usage { - (gulp: gulp.Gulp, options?: UsageOptions): promise.Promise + (gulp: gulp.Gulp, options?: UsageOptions): Promise } } From 8a623bc76e2462bc7b50467cb346fa4343711fa0 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 30 Jul 2016 00:26:00 +0300 Subject: [PATCH 016/203] Declaration fixed --- gulp-help-doc/gulp-help-doc.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/gulp-help-doc.d.ts index 31aa0d764a..80d4922774 100644 --- a/gulp-help-doc/gulp-help-doc.d.ts +++ b/gulp-help-doc/gulp-help-doc.d.ts @@ -45,7 +45,7 @@ declare module "gulp-help-doc" { } interface Usage { - (gulp: gulp.Gulp, options?: UsageOptions): Promise + (gulp: gulp.Gulp, options?: UsageOptions): Promise } } From c80a0222639890181395715c21c3e2b6ba86347c Mon Sep 17 00:00:00 2001 From: Maxim Samoilov Date: Tue, 2 Aug 2016 20:25:07 +0700 Subject: [PATCH 017/203] Fix StatelessComponent interface Props always pass to StatelessComponent even if we pass no props. Example: ```js function Test(props) { return
props: {JSON.stringify(props)}
} React.render(, document.body) ``` will render into `props: {}` [jsfiddle](https://jsfiddle.net/LL25c28c/) We need to fix this because otherwise we have error: `Property 'propName' does not exist on type 'IntrinsicAttributes & (IMyInterface | undefined)'.` for that code: ```js const MyComponent: React.SFC = ({ propName }: IMyInterface) => { // ... } ``` --- react/react.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react/react.d.ts b/react/react.d.ts index da99fc737a..919b16d386 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -197,7 +197,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; From 0bb3ec00dd31d85a43695aca33b72ff69c444ee5 Mon Sep 17 00:00:00 2001 From: Diullei Date: Fri, 8 Jul 2016 00:44:30 -0300 Subject: [PATCH 018/203] improved - blessedjs typings --- blessed/blessed-tests.ts | 773 ++++++++ blessed/blessed.d.ts | 4059 ++++++++++++++++++++++++++------------ 2 files changed, 3585 insertions(+), 1247 deletions(-) create mode 100644 blessed/blessed-tests.ts diff --git a/blessed/blessed-tests.ts b/blessed/blessed-tests.ts new file mode 100644 index 0000000000..4e7f7002e6 --- /dev/null +++ b/blessed/blessed-tests.ts @@ -0,0 +1,773 @@ +/// + +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({ + 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); diff --git a/blessed/blessed.d.ts b/blessed/blessed.d.ts index 6746afe5f5..cb9bd393ed 100644 --- a/blessed/blessed.d.ts +++ b/blessed/blessed.d.ts @@ -1,1256 +1,155 @@ -// Type definitions for blessed 0.1.5 +// Type definitions for blessed 0.1.81 // Project: https://github.com/chjj/blessed -// Definitions by: bryn austin bellomy +// Definitions by: bryn austin bellomy , Diullei Gomes // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// -declare module "blessed" -{ - import events = require('events'); - import buffer = require('buffer'); - import child_process = require('child_process'); +declare module "blessed" { + import {EventEmitter} from 'events'; + import * as stream from "stream" + import * as child_process from "child_process"; - module Blessed - { - export var colors: Colors; + export class BlessedProgram { + hideCursor: () => void; + move: any; + showCursor: any; + } - export interface GenericCallback { - (...args:any[]): void; + export module Widgets { + + export module Types { + + export type TTopLeft = string | number | "center"; + + export type TPosition = string | number; + + export type TMouseAction = "mousedown" | "mouseup" | "mousemove"; + + export type TStyle = { + type?: string; + bg?: string; + fg?: string; + ch?: string; + bold?: boolean; + underline?: boolean; + blink?: boolean; + inverse?: boolean; + invisible?: boolean; + transparent?: boolean; + border?: "line" | "bg" | TBorder; + hover?: boolean; + focus?: boolean; + label?: string; + track?: {bg?: string; fg?: string;}; + scrollbar?: {bg?: string; fg?: string;}; + } + + export type TBorder = { + /** + * Type of border (line or bg). bg by default. + */ + type?: "line" | "bg"; + /** + * Character to use if bg type, default is space. + */ + ch?: string; + /** + * Border foreground and background, must be numbers (-1 for default). + */ + bg?: number; + fg?: number; + /** + * Border attributes. + */ + bold?: string; + underline?: string; + } + + export type TCursor = { + /** + * Have blessed draw a custom cursor and hide the terminal cursor (experimental). + */ + artificial: boolean; + /** + * Shape of the cursor. Can be: block, underline, or line. + */ + shape: boolean; + /** + * Whether the cursor blinks. + */ + blink: boolean; + /** + * Color of the color. Accepts any valid color value (null is default). + */ + color: string; + } + + export type TAlign = "left" | "center" | "right"; + + export type ListbarCommand = { + key: string; + callback: () => void; + }; + + export type TImage = { + /** + * Pixel width. + */ + width: number; + /** + * Pixel height. + */ + height: number; + /** + * Image bitmap. + * */ + bmp: any; + /** + * Image cellmap (bitmap scaled down to cell size). + */ + cellmap: any; + }; + + export type Cursor = { + /** + * Have blessed draw a custom cursor and hide the terminal cursor (experimental). + */ + artificial: boolean; + /** + * Shape of the cursor. Can be: block, underline, or line. + */ + shape: boolean; + /** + * Whether the cursor blinks. + */ + blink: boolean; + /** + * Color of the color. Accepts any valid color value (null is default). + */ + color: string; + } } - export interface ColorPair { - /** background, must be number (-1 for default). */ - bg?: number; - /** foreground, must be number (-1 for default). */ - fg?: number; - } - - export interface Style extends ColorPair { - bold?: boolean; - underline?: boolean; - border: Border; - hover: ColorPair; - } - - export interface Border extends ColorPair { - /** type of border ('line' or 'bg'). */ - type?: string; //'line'|'bg'; - /** character to use if bg type, default is space. */ - ch?: string; - } - - export interface Padding { - top?:number; - right?:number; - bottom?:number; - left?:number; - } - - export interface Position { - /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */ - top?:number|string; - /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */ - right?:number|string; - /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */ - bottom?:number|string; - /** offsets of the element relative to its parent. can be a number, percentage (0-100%), or keyword (center). right and bottom do not accept keywords. */ - left?:number|string; - /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */ - width?:number|string; - /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */ - height?:number|string; - } - - export interface KeyCode { - name: string; - ctrl: boolean; - meta: boolean; - shift: boolean; - sequence: string; - full: string; - } - - export class Program - { - /** - Wrap the given text in terminal formatting codes corresponding to the given attribute - name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255 - integer color number. - */ - text (text:string, attr:string): string; - } - - export interface Colors { - /** Either pass a hex string, an array of 3 numbers, or three separate numbers representing an RGB value. This returns the 0-255 color number for that color. */ - match (r:string|number[]|number, g?:number, b?:number): number; - - /** An array of the 255 colors as hex strings. */ - colors: string[]; - } - - export interface NodeOptions - { - screen?: Screen; - parent?: Node; - children?: Node[]; - } - - export class Node extends events.EventEmitter - { - constructor(options?:NodeOptions); - - type : string; - options : NodeOptions; - parent : Node; - screen : Screen; - children : Node[]; - data : any; - _ : any; - $ : any; - index : number; - - // on(event:string, callback:() => void); - // on(event:'adopt', callback:() => void); - // on(event:'remove', callback:() => void); - // on(event:'reparent', callback:() => void); - // on(event:'attach', callback:() => void); - // on(event:'detach', callback:() => void); - - prepend(node:Node): void; - append(node:Node): void; - remove(node:Node): void; - insert(node:Node, index:number): void; - insertBefore(node:Node, refNode:Node): void; - insertAfter(node:Node, refNode:Node): void; - detach(): void; - // emitDescendants(): void; - // get(key:string): any; - // get(key:string, default:any): any; - // set(key:string, value:any): void; - } - - export interface ScreenOptions extends NodeOptions - { - /** the blessed Program to be associated with. will be automatically instantiated if none is provided. */ - program?: any; - /** attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with uniform cells to their sides). this is known to cause flickering with elements that are not full-width, however, it is more optimal for terminal rendering. */ - smartCSR?: boolean; - /** do CSR on any element within 20 cols of the screen edge on either side. faster than smartCSR, but may cause flickering depending on what is on each side of the element. */ - fastCSR?: boolean; - /** attempt to perform back_color_erase optimizations for terminals that support it. it will also work with terminals that don't support it, but only on lines with the default background color. as it stands with the current implementation, it's uncertain how much terminal performance this adds at the cost of overhead within node. */ - useBCE?: boolean; - /** amount of time (in ms) to redraw the screen after the terminal is resized (default: 300). */ - resizeTimeout?: number; - /** the width of tabs within an element's content. */ - tabSize?: number; - /** automatically position child elements with border and padding in mind. */ - autoPadding?: boolean; - /** the name of the logfile to use. if specified but the file does not exist, it will be created. see log method. */ - log?: string; - /** dump all output and input to desired file. can be used together with log option if set as a boolean. */ - dump?: any; - /** debug mode. enables usage of the `debug` method. also creates a debug console which will display when pressing F12. it will display all log and debug messages. */ - debug?: boolean; - /** Array of keys in their full format (e.g. C-c) to ignore when keys are locked. Useful for creating a key that will always exit no matter whether the keys are locked. */ - ignoreLocked?: string[]; - - /** Do not clear the screen, only scroll down enough to make room for the elements on the screen. do not use the alternate screenbuffer. useful for writing a CLI tool or some kind of prompt (experimental - see test/widget-noalt.js) */ - noAlt?: boolean; - - /** Options for the cursor. */ - cursor?: CursorOptions; - } - - export interface CursorOptions { - /** have blessed draw a custom cursor and hide the terminal cursor (experimental). */ - artificial?: boolean; - /** shape of the artificial cursor. can be: block, underline, or line. */ - shape?: string; //'block'|'underline'|'line'; - /** whether the artificial cursor blinks. */ - blink?: boolean; - /** color of the artificial cursor. accepts any valid color value (null is default). */ - color?: string; - } - - export interface ScreenEventCallback { - (character:string, keyCode:KeyCode): void; - } - - export class Screen extends Node - { - constructor(options?:ScreenOptions); - - /** the blessed Program object. */ - program: any; - /** the blessed Tput object (only available if you passed tput: true to the Program constructor.) */ - tput: any; - /** top of the focus history stack. */ - focused: any; - /** width of the screen (same as program.cols). */ - width: number; - /** height of the screen (same as program.rows). */ - height: number; - /** same as screen.width. */ - cols: number; - /** same as screen.height. */ - rows: number; - - /** calculated relative left offset. */ - left: number; - /** calculated relative right offset. */ - right: number; - /** calculated relative top offset. */ - top: number; - /** calculated relative bottom offset. */ - bottom: number; - /** calculated absolute left offset. */ - aleft: number; - /** calculated absolute right offset. */ - aright: number; - /** calculated absolute top offset. */ - atop: number; - /** calculated absolute bottom offset. */ - abottom: number; - - - /** whether the focused element grabs all keypresses. */ - grabKeys: boolean; - /** prevent keypresses from being received by any element. */ - lockKeys: boolean; - /** the currently hovered element. only set if mouse events are bound. */ - hover: Element; - /** set or get window title. */ - title: string; - - /** write string to the log file if one was created. */ - log(...msg:any[]): void; - /** same as the log method, but only gets called if the debug option was set. */ - debug(...msg:string[]): void; - /** allocate a new pending screen buffer and a new output screen buffer. */ - alloc(): void; - /** draw the screen based on the contents of the screen buffer. */ - draw(start:number, end:number): void; - /** render all child elements, writing all data to the screen buffer and drawing the screen. */ - render(): void; - /** clear any region on the screen. */ - clearRegion(x1:number, x2:number, y1:number, y2:number): void; - /** fill any region with a character of a certain attribute. */ - fillRegion(attr:number, ch:string, x1:number, x2:number, y1:number, y2:number): void; - /** focus element by offset of focusable elements. */ - focusOffset(offset:number): void; - /** focus previous element in the index. */ - focusPrevious(): void; - /** focus next element in the index. */ - focusNext(): void; - /** push element on the focus stack (equivalent to screen.focused = el). */ - focusPush(element:Element): void; - /** pop element off the focus stack. */ - focusPop(): void; - /** save the focused element. */ - saveFocus(): void; - /** restore the saved focused element. */ - restoreFocus(): void; - /** "rewind" focus to the last visible and attached element. */ - rewindFocus(): void; - /** bind a keypress listener for a specific key. */ - key(keyEvents:string|string[], callback:ScreenEventCallback): void; - /** bind a keypress listener for a specific key once. */ - onceKey(keyEvents:string|string[], callback:ScreenEventCallback): void; - /** remove a keypress listener for a specific key. */ - unkey(name:string, listener:ScreenEventCallback): void; - /** spawn a process in the foreground, return to blessed app after exit. */ - spawn(file:string, args:string[], options:NodeChildProcessExecOptions): child_process.ChildProcess; - /** spawn a process in the foreground, return to blessed app after exit. executes callback on error or exit. */ - exec(file:string, args:string[], options:NodeChildProcessExecOptions, callback:GenericCallback): child_process.ChildProcess; - /** read data from text editor. */ - readEditor(options:{}, callback:GenericCallback): void; - /** set effects based on two events and attributes. */ - setEffects(el:Element, fel:Element, over:string, out:string, effects:Style, temp?:string): void; - /** insert a line into the screen (using csr: this bypasses the output buffer). */ - insertLine(n:number, y:number, top:number, bottom:number): void; - /** delete a line from the screen (using csr: this bypasses the output buffer). */ - deleteLine(n:number, y:number, top:number, bottom:number): void; - /** insert a line at the bottom of the screen. */ - insertBottom(top:number, bottom:number): void; - /** insert a line at the top of the screen. */ - insertTop(top:number, bottom:number): void; - /** delete a line at the bottom of the screen. */ - deleteBottom(top:number, bottom:number): void; - /** delete a line at the top of the screen. */ - deleteTop(top:number, bottom:number): void; - - /** enable mouse events for the screen and optionally an element (automatically called when a form of on('mouse') is bound). */ - enableMouse(el?:Element): void; - /** enable keypress events for the screen and optionally an element (automatically called when a form of on('keypress') is bound). */ - enableKeys(el?:Element): void; - /** enable key and mouse events. calls bot enableMouse and enableKeys. */ - enableInput(el?:Element): void; - - /** attempt to copy text to clipboard using iTerm2's propriety sequence. returns true if successful. */ - copyToClipboard(text:string): boolean; - /** attempt to change cursor shape. will not work in all terminals (see artificial cursors for a solution to this). returns true if successful. */ - cursorShape(shape:string, blink:boolean): boolean; - /** attempt to change cursor color. returns true if successful. */ - cursorColor(color: string): boolean; - /** attempt to reset cursor. returns true if successful. */ - cursorReset(): boolean; - - } - - export interface ElementOptions extends NodeOptions - { - fg?: string; - bg?: string; - scrollbar?: ColorPair; - focus?: Style; - hover?: Style; - - /** border object, see below. */ - border?: Border; - /** positioning options. */ - position?: Position; - /** amount of padding on the inside of the element. can be a number or an object containing the properties: left, right, top, and bottom. */ - padding?: number|Padding; - /** element's text content. */ - content?: string; - /** element is clickable. */ - clickable?: boolean; - /** element is focusable and can receive key input. */ - input?: boolean; - /** element is focused. */ - focused?: boolean; - /** whether the element is hidden. */ - hidden?: boolean; - /** a simple text label for the element. */ - label?: string; - /** a floating text label for the element which appears on mouseover. */ - hoverText?: string; - /** text alignment: left, center, or right. */ - align?: string; - /** vertical text alignment: top, middle, or bottom. */ - valign?: string; - /** shrink/flex/grow to content and child elements. width/height during render. */ - shrink?: any; - /** width of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */ - width?: number|string; - /** height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). */ - height?: number|string; - /** whether the element is scrollable or not. */ - scrollable?: boolean; - /** background character (default is whitespace ). */ - ch?: string; - /** allow the element to be dragged with the mouse. */ - draggable?: boolean; - } - - export class Element extends Node - { - constructor(options?:ElementOptions); - - /** name of the element. useful for form submission. */ - name: string; - /** border object. */ - border: Border; - /** contains attributes (e.g. fg/bg/underline). see above. */ - style: Style; - /** raw width, height, and offsets. */ - position: Position; - /** type of border (line or bg). bg by default. */ - type: string; //'line'|'bg'; - /** character to use if bg type, default is space. */ - ch: string; - /** raw text content. */ - content: string; - /** whether the element is hidden or not. */ - hidden: boolean; - /** whether the element is visible or not. */ - visible: boolean; - /** whether the element is attached to a screen in its ancestry somewhere. */ - detached: boolean; - /** calculated width. */ - width: number; - /** calculated height. */ - height: number; - /** whether the element is draggable. set to true to allow dragging. */ - draggable: boolean; - - - - /** calculated relative left offset. */ - left: number; - /** calculated relative right offset. */ - right: number; - /** calculated relative top offset. */ - top: number; - /** calculated relative bottom offset. */ - bottom: number; - /** calculated absolute left offset. */ - aleft: number; - /** calculated absolute right offset. */ - aright: number; - /** calculated absolute top offset. */ - atop: number; - /** calculated absolute bottom offset. */ - abottom: number; - - - /** write content and children to the screen buffer. */ - render(): void; - /** hide element. */ - hide(): void; - /** show element. */ - show(): void; - /** toggle hidden/shown. */ - toggle(): void; - /** focus element. */ - focus(): void; - /** bind a keypress listener for a specific key. */ - key(name:string|string[], listener:(character?:any, keyCode?:any) => void): void; - /** bind a keypress listener for a specific key once. */ - onceKey(name:string, listener:() => void): void; - /** remove a keypress listener for a specific key. */ - unkey(name:string, listener:() => void): void; - /** same as el.on('screen', ...) except this will automatically cleanup listeners after the element is detached. */ - onScreenEvent(event:string, listener:(...args:any[]) => void): void; - /** set the z-index of the element (changes rendering order). */ - setIndex(z:number): void; - /** put the element in front of its siblings. */ - setFront(): void; - /** put the element in back of its siblings. */ - setBack(): void; - /** set the label text for the top-left corner. example options: {text:'foo',side:'left'} */ - setLabel(textOrOptions:string|{}): void; - /** remove the label completely. */ - removeLabel(): void; - /** set the hover text for the bottom-right corner. example options: {text:'foo'} */ - setHover(textOrOptions:string|{}): void; - /** remove the hover label completely. */ - removeHover(): void; - /** set the content. note: when text is input, it will be stripped of all non-SGR escape codes, tabs will be replaced with 8 spaces, and tags will be replaced with SGR codes (if enabled). */ - setContent(text:string): void; - /** return content, slightly different from el.content. assume the above formatting. */ - getContent(): void; - /** similar to setContent, but ignore tags and remove escape codes. */ - setText(text:string): void; - /** similar to getContent, but return content with tags and escape codes removed. */ - getText(): void; - /** insert a line into the box's content. */ - insertLine(index:number, lines:string|string[]): void; - /** delete a line from the box's content. */ - deleteLine(index:number, numLines:number): void; - /** get a line from the box's content. */ - getLine(index:number): void; - /** get a line from the box's content from the visible top. */ - getBaseLine(index:number): void; - /** set a line in the box's content. */ - setLine(index:number, line:string): void; - /** set a line in the box's content from the visible top. */ - setBaseLine(index:number, line:string): void; - /** clear a line from the box's content. */ - clearLine(index:number): void; - /** clear a line from the box's content from the visible top. */ - clearBaseLine(index:number): void; - /** insert a line at the top of the box. */ - insertTop(lines:string|string[]): void; - /** insert a line at the bottom of the box. */ - insertBottom(lines:string|string[]): void; - /** delete a line at the top of the box. */ - deleteTop(): void; - /** delete a line at the bottom of the box. */ - deleteBottom(): void; - /** unshift a line onto the top of the content. */ - unshiftLine(lines:string|string[]): void; - /** shift a line off the top of the content. */ - shiftLine(index:number): void; - /** push a line onto the bottom of the content. */ - pushLine(lines:string|string[]): void; - /** pop a line off the bottom of the content. */ - popLine(index:number): void; - /** an array containing the content lines. */ - getLines(): void; - /** an array containing the lines as they are displayed on the screen. */ - getScreenLines(): void; - /** get a string's real length, taking into account tags. */ - textLength(text:string): number; - - /** enable dragging of the element. */ - enableDrag(): void; - /** disable dragging of the element. */ - disableDrag(): void; - } - - - // - // Box - // - - export interface BoxOptions extends ElementOptions { - // intentionally empty - } - - export class Box extends Element { - constructor(options?:BoxOptions); - // intentionally empty - } - - - // - // ScrollableBox - // - - export interface ScrollableBoxOptions extends BoxOptions { - /** a limit to the childBase. default is `Infinity`. */ - baseLimit: number; - /** a option which causes the ignoring of `childOffset`. this in turn causes the childBase to change every time the element is scrolled. */ - alwaysScroll: boolean; - /** object enabling a scrollbar. */ - scrollbar: ScrollBar; - } - - /** A box with scrollable content. */ - export class ScrollableBox extends Box { - constructor(options?:ScrollableBoxOptions); - - /** the offset of the top of the scroll content. */ - childBase: number; - /** the offset of the chosen item/line. */ - childOffset: number; - /** scroll the content by a relative offset. */ - scroll(offset:number): void; - /** scroll the content to an absolute index. */ - scrollTo(index:number): void; - /** same as `scrollTo`. */ - setScroll(index:number): void; - /** set the current scroll index in percentage (0-100). */ - setScrollPerc(perc:number): void; - /** get the current scroll index in lines. */ - getScroll(): number; - /** get the actual height of the scrolling area. */ - getScrollHeight(): number; - /** get the current scroll index in percentage. */ - getScrollPerc(): number; - /** reset the scroll index to its initial state. */ - resetScroll(): void; - - } - - export interface ScrollBar { - /** style of the scrollbar. */ - style: Style; - /** style of the scrollbar track if present (takes regular style options). */ - track: Style; - } - - - // - // ScrollableText - // - - export interface ScrollableTextOptions extends ScrollableBoxOptions { - /** whether to enable automatic mouse support for this element. */ - mouse: boolean; - /** use predefined keys for navigating the text. */ - keys: boolean; - /** use vi keys with the `keys` option. */ - vi: boolean; - } - - /** __DEPRECATED__ - Use Box with the `scrollable` and `alwaysScroll` options instead. A scrollable text box which can display and scroll text, as well as handle pre-existing newlines and escape codes. */ - export class ScrollableText extends ScrollableBox { - constructor(options?:ScrollableTextOptions); - } - - - - // - // Text - // - - export interface TextOptions extends ElementOptions { - align?: string; //'left'|'center'|'right'; - } - - export class Text extends Element { - constructor(options?:TextOptions); - // intentionally empty - } - - - // - // Line - // - - export interface LineOptions extends BoxOptions { - orientation?: string; //'vertical'|'horizontal'; - style?: Style; - } - - export class Line extends Box { - constructor(options?:LineOptions); - // intentionally empty - } - - - // - // List - // - - export interface ListStyle extends Style { - selected?: Style; - item?: Style; - } - - export interface ListOptions extends BoxOptions - { - style?: ListStyle; - - /** whether to automatically enable mouse support for this list (allows clicking items). */ - mouse?: boolean; - /** use predefined keys for navigating the list. */ - keys?: any; - /** use vi keys with the keys option. */ - vi?: boolean; - /** an array of strings which become the list's items. */ - items?: string[]; - /** a function that is called when vi mode is enabled and the key / is pressed. This function accepts a callback function which should be called with the search string. The search string is then used to jump to an item that is found in items. */ - search?: (callback:(searchString:string) => void) => void; - /** whether the list is interactive and can have items selected (default: true). */ - interactive?: boolean; - } - - export class List extends Box - { - constructor(options?:ListOptions); - - /** The text of the currently selected item. */ - value:string; - /** The items in the list. */ - items:string[]; - /** The items in the list. */ - ritems:string[]; - /** The index of the current selection. */ - selected:number; - - /** add an item based on a string. */ - addItem(text:string): void; - /** returns the item index from the list. child can be an element, index, or string. */ - getItemIndex(child:Element|number|string): void; - /** returns the item element. child can be an element, index, or string. */ - getItem(child:Element|number|string): void; - /** removes an item from the list. child can be an element, index, or string. */ - removeItem(child:Element|number|string): void; - /** clears all items from the list. */ - clearItems(): void; - /** sets the list items to multiple strings. */ - setItems(items:string[]): void; - /** Sets the current selection by absolute index. */ - select(index:number): void; - /** Changes the current selection based on current offset. */ - move(offset:number): void; - /** select item above selected. */ - up(amount:number): void; - /** select item below selected. */ - down(amount:number): void; - /** show/focus list and pick an item. the callback is executed with the result. */ - pick(cwd:string, callback:(err:any, file:string) => void): void; - - /** show/focus list and pick an item. the callback is executed with the result. */ - pick(callback:(err:any, file:string) => void): void; - } - - // - // Input - // - - export interface InputOptions extends BoxOptions { - // intentionally empty - } - - export class Input extends Box { - constructor(options?:InputOptions); - // intentionally empty - } - - export interface InputOptions extends BoxOptions { - // intentionally empty - } - - // - // Textarea - // - - export interface TextareaOptions extends InputOptions - { - /** use pre-defined keys (`i` or `enter` for insert, `e` for editor, `C-e` for editor while inserting). */ - keys?: boolean; - /** use pre-defined mouse events (right-click for editor). */ - mouse?: boolean; - /** call `readInput()` when the element is focused. automatically unfocus. */ - inputOnFocus?: boolean; - } - - /** A box which allows multiline text input. */ - export class Textarea extends Input - { - constructor(options?:TextareaOptions); - - /** the input text. __read-only__. */ - value: string; - - /** submit the textarea (emits `submit`). */ - submit(): void; - /** cancel the textarea (emits `cancel`). */ - cancel(): void; - /** grab key events and start reading text from the keyboard. takes a callback which receives the final value. */ - readInput(callback:GenericCallback): void; - /** open text editor in `$EDITOR`, read the output from the resulting file. takes a callback which receives the final value. */ - readEditor(callback:GenericCallback): void; - /** the same as `this.value`, for now. */ - getValue(): string; - /** clear input. */ - clearValue(): void; - /** set value. */ - setValue(text:string): void; - } - - - // - // Textbox - // - - export interface TextboxOptions extends TextareaOptions { - /** completely hide text. */ - secret?: boolean; - /** replace text with asterisks (`*`). */ - censor?: boolean; - } - - /** A box which allows text input. */ - export class Textbox extends Textarea { - constructor(options?:TextboxOptions); - - /** completely hide text. */ - secret: boolean; - /** replace text with asterisks (`*`). */ - censor: boolean; - } - - - // - // Button - // - - export interface ButtonOptions extends InputOptions { - } - - /** A button which can be focused and allows key and mouse input. */ - export class Button extends Input { - constructor(options?:ButtonOptions); - - // on(event:string, callback:() => void): void; - // on(event:'press', callback:() => void); - - /** press button. emits 'press'. */ - press(): void; - } - - - // - // ProgressBar - // - - export interface ProgressBarOptions extends InputOptions { - /** can be `horizontal` or `vertical`. */ - orientation: string; - /** the character to fill the bar with (default is space). */ - pch: string; - /** the amount filled (0 - 100). */ - filled: number; - /** same as `filled`. */ - value: number; - /** enable key support. */ - keys: boolean; - /** enable mouse support. */ - mouse: boolean; - - /** contains the extra key 'bar', which defines the style of the bar contents itself. */ - style: ProgressBarStyle; - } - - export interface ProgressBarStyle extends Style { - /** style of the bar contents itself. */ - bar: Style; - } - - - export class ProgressBar extends Input { - constructor(options?:ProgressBarOptions); - - /** progress the bar by a fill amount. */ - progress(amount:number): void; - /** set progress to specific amount. */ - setProgress(amount:number): void; - /** reset the bar. */ - reset(): void; - } - - // - // Checkbox - // - - export interface CheckboxOptions extends InputOptions { - /** whether the element is checked or not. */ - checked: boolean; - /** enable mouse support. */ - mouse: boolean; + export module Events { + + export interface IMouseEventArg { + x: number; + y: number; + action: Types.TMouseAction; + } + + export interface IKeyEventArg { + full: string; + name: string; + shift: boolean; + ctrl: boolean; + meta: boolean; + sequence: string; + } } - - /** A checkbox which can be used in a form element. */ - export class Checkbox extends Input - { - constructor(options?:CheckboxOptions); - - /** the text next to the checkbox (do not use setcontent, use `check.text = ''`). */ - text: string; - /** whether the element is checked or not. */ - checked: boolean; - /** same as `checked`. */ - value: boolean; - - /** check the element. */ - check(): void; - /** uncheck the element. */ - uncheck(): void; - /** toggle checked state. */ - toggle(): void; - } - - - // - // RadioSet - // - - export interface RadioSetOptions extends BoxOptions { - } - - - export class RadioSet extends Box { - constructor(options?:RadioSetOptions); - } - - - // - // RadioButton - // - - export interface RadioButtonOptions extends CheckboxOptions { - } - - - /** A radio button which can be used in a form element. */ - export class RadioButton extends Checkbox { - constructor(options?:RadioButtonOptions); - } - - - - // - // Prompt - // - - export interface PromptOptions extends BoxOptions { - } - - - /** A prompt box containing a text input, okay, and cancel buttons (automatically hidden). */ - export class Prompt extends Box - { - constructor(options?:PromptOptions); - - /** show the prompt and wait for the result of the textbox. set text and initial value */ - input(text:string, value:any, callback:(val:any) => void): void; - /** show the prompt and wait for the result of the textbox. set text and initial value */ - setInput(text:string, value:any, callback:(val:any) => void): void; - /** show the prompt and wait for the result of the textbox. set text and initial value */ - readInput(text:string, value:any, callback:(val:any) => void): void; - } - - - // - // Question - // - - export interface QuestionOptions extends BoxOptions { - } - - - /** A question box containing okay and cancel buttons (automatically hidden). */ - export class Question extends Box - { - constructor(options?:QuestionOptions); - - /** ask a `question`. `callback` will yield the result. */ - ask(question:string, callback:(result:any) => void): void; - } - - - // - // Message - // - - export interface MessageOptions extends BoxOptions { - } - - - /** A box containing a message to be displayed (automatically hidden). */ - export class Message extends Box - { - constructor(options?:MessageOptions); - - /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */ - log(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void; - /** display a message for a time (default is 3 seconds). set time to 0 for a perpetual message that is dismissed on keypress. */ - display(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void; - /** display an error in the same way. */ - error(text:string, timeOrCallback:number|MessageCallback, callback?:MessageCallback): void; - } - - export interface MessageCallback { - (): void; - } - - - // - // Loading - // - - export interface LoadingOptions extends BoxOptions { - } - - /** A box with a spinning line to denote loading (automatically hidden). */ - export class Loading extends Box - { - constructor(options?:LoadingOptions); - - /** display the loading box with a message. will lock keys until `stop` is called. */ - load(text:string): void; - /** hide loading box. unlock keys. */ - stop(): void; - } - - - // - // Listbar - // - - export interface ListbarOptions extends BoxOptions - { - /** Listbar's `style` object includes sub-styles for `selected` and `item`. */ - style?: ListbarStyle; - - /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */ - items?: ListbarItemSet; - /** set buttons using an object with keys as titles of buttons, containing of objects containing keys of `keys` and `callback`. */ - commands?: ListbarItemSet; - /** automatically bind list buttons to keys 0-9. */ - autoCommandKeys?: boolean; - } - - export interface ListbarItemSet { - [name: string]: ListbarItem; - } - - export interface ListbarItem { - keys: string[]; - callback: GenericCallback; - } - - export interface ListbarStyle extends Style - { - /** style for a selected item. */ - selected: Style; - /** style for an unselected item. */ - item: Style; - } - - /** A horizontal list. Useful for a main menu bar. */ - export class Listbar extends Box - { - constructor(options?:ListbarOptions); - - /** append an item to the bar. */ - add(item:ListbarItem, callback:GenericCallback): void; - /** append an item to the bar. */ - addItem(item:ListbarItem, callback:GenericCallback): void; - /** append an item to the bar. */ - appendItem(item:ListbarItem, callback:GenericCallback): void; - - /** select button and execute its callback. */ - selectTab(index: number): void; - - /** set commands (see `commands` option above). */ - setItems(commands: ListbarItemSet): void; - /** select an item on the bar. */ - select(offset: number): void; - /** remove item from the bar. */ - removeItem(child:ListbarItem): void; - /** move focus relatively across the bar. */ - move(offset: number): void; - /** move focus left relatively across the bar. */ - moveLeft(offset: number): void; - /** move focus right relatively across the bar. */ - moveRight(offset: number): void; - } - - - // - // Log - // - - export interface LogOptions extends ScrollableTextOptions { - /** amount of scrollback allowed. default: Infinity. */ - scrollback?: number; - /** scroll to bottom on input even if the user has scrolled up. default: false. */ - scrollOnInput?: boolean; - } - - - /** A log permanently scrolled to the bottom. */ - export class Log extends ScrollableText - { - constructor(options?:LogOptions); - - /** amount of scrollback allowed. default: Infinity. */ - scrollback: number; - /** scroll to bottom on input even if the user has scrolled up. default: false. */ - scrollOnInput: boolean; - - /** add a log line. */ - log(text:string): void; - /** add a log line. */ - add(text:string): void; - } - - - // - // Table - // - - export interface TableOptions extends BoxOptions - { - /** array of array of strings representing rows (same as `data`). */ - rows?: string[][]; - /** array of array of strings representing rows (same as `rows`). */ - data?: string[][]; - /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */ - pad?: number; - /** do not draw inner cells. */ - noCellBorders?: boolean; - /** fill cell borders with the adjacent background color. */ - fillCellBorders?: boolean; - - /** includes `header` and `cell` substyles. */ - style?: TableStyle; - } - - export interface TableStyle extends Style { - /** header style. */ - header: Style; - /** cell style. */ - cell: Style; - } - - /** A stylized table of text elements. */ - export class Table extends Box - { - /** includes `header` and `cell` substyles. */ - style: TableStyle; - - /** set rows in table. array of arrays of strings. */ - setData(rows: string[][]): void; - /** set rows in table. array of arrays of strings. */ - setRows(rows: string[][]): void; - } - - - // - // ListTable - // - - export interface ListTableOptions extends ListOptions - { - /** array of array of strings representing rows (same as `data`). */ - rows?: string[][]; - /** array of array of strings representing rows (same as `rows`). */ - data?: string[][]; - /** spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). */ - pad?: number; - - /** do not draw inner cells. */ - noCellBorders?: boolean; - - /** includes `header` and `cell` substyles. */ - style?: TableStyle; - } - - export interface ListTableStyle extends TableStyle { - } - - - /** A stylized table of text elements with a list. */ - export class ListTable extends List - { - constructor(options?:ListTableOptions); - - /** set rows in table. array of arrays of strings. */ - setData(rows: string[][]): void; - /** set rows in table. array of arrays of strings. */ - setRows(rows: string[][]): void; - } - - // - // Image - // - - export interface ImageOptions extends BoxOptions { - /** path to image. */ - file: string; - /** path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. */ - w3m: string; - } - - - /** Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. */ - export class Image extends Box - { - constructor(options?:ImageOptions); - - /** set the image in the box to a new path. */ - setImage (img:string, callback:GenericCallback): void; - /** clear the current image. */ - clearImage (callback:GenericCallback): void; - /** get the size of an image file in pixels. */ - imageSize (img:string, callback:GenericCallback): void; - /** get the size of the terminal in pixels. */ - termSize (callback:GenericCallback): void; - /** get the pixel to cell ratio for the terminal. */ - getPixelRatio (callback:GenericCallback): void; - } - - - // - // Form - // - - export interface FormOptions extends BoxOptions { - /** allow default keys (tab, vi keys, enter). */ - keys?:boolean; - /** allow vi keys. */ - vi?:boolean; - } - - export class Form extends Box - { - constructor(options?:FormOptions); - - /** last submitted data. */ - submission: any; - - // on(event:string, callback:() => void): void; - // on(event:'submit', callback:(data) => void): void; - // on(event:'cancel', callback:() => void): void; - // on(event:'reset', callback:() => void): void; - - next(): void; - previous(): void; - - resetSelected(): void; - /** focus first form element. */ - focusFirst(): void; - /** focus last form element. */ - focusLast(): void; - /** focus next form element. */ - focusNext(): void; - /** focus previous form element. */ - focusPrevious(): void; - /** submit the form. */ - submit(): void; - /** discard the form. */ - cancel(): void; - /** clear the form. */ - reset(): void; - } - - - // - // FileManager - // - - export interface FileManagerOptions extends ListOptions { - cwd?: string; - } - - export interface DirectoryEntry { - name: string; - text: string; - dir: boolean; - symlink: boolean; - } - - export class FileManager extends List - { - constructor(options?:FileManagerOptions); - - cwd: string; - - useFormatter (formatterFn:(entry:DirectoryEntry) => DirectoryEntry): void; - - /** refresh the file list (perform a readdir on cwd and update the list items). */ - refresh (cwd?:string, callback?:() => void): void; - - /** refresh the file list. */ - refresh (callback?:() => void): void; - - /** reset back to original cwd. */ - reset (cwd?:string, callback?:() => void): void; - } - - - // - // Terminal - // - - export interface TerminalOptions extends BoxOptions - { - /** handler for input data. */ - handler?: (userInput:Buffer) => void; - /** name of shell. $SHELL by default. */ - shell?:string; - /** args for shell. */ - args?:any; - /** can be line, underline, and block. */ - cursor?:string; //'line'|'underline'|'block'; - } - - export class Terminal extends Box - { - /** reference to the headless term.js terminal. */ - term: any; - /** reference to the pty.js pseudo terminal. */ - pty: any; - - /** write data to the terminal. */ - write(data:string): void; - - /** nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. */ - screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string; - } - - - export interface NodeChildProcessExecOptions - { + export interface NodeChildProcessExecOptions { cwd?: string; stdio?: any; customFds?: any; @@ -1260,10 +159,2676 @@ declare module "blessed" maxBuffer?: number; killSignal?: string; } + + export interface IDestroyable { + destroy(): void; + } + + export interface IOptions { + } + + export interface IHasOptions { + options: T; + } + + export interface TputsOptions extends IOptions { + terminal?: string; + extended?: boolean; + debug?: boolean; + termcap?: string; + terminfoFile?: string; + terminfoPrefix?: string; + termcapFile?: string; + } + + export class Tput implements IHasOptions { + constructor(opts: TputsOptions); + + // ** properties ** // + + /** + * Original options object. + */ + options: TputsOptions; + + debug: boolean; + padding: boolean; + extended: boolean; + printf: boolean; + termcap: string; + terminfoPrefix: string; + terminfoFile: string; + termcapFile: string; + error: Error; + terminal: string; + + setup(): void; + term(is: any): boolean; + readTerminfo(term: string): string; + parseTerminfo(data: any, file: string): { + header: { + dataSize: number; + headerSize: number; + magicNumber: boolean; + namesSize: number; + boolCount: number; + numCount: number; + strCount: number; + strTableSize: number; + extended: { + dataSize: number; + headerSize: number; + boolCount: number; + numCount: number; + strCount: number; + strTableSize: number; + lastStrTableOffset: number; + } + } + name: string; + names: string[]; + desc: string; + bools: Object; + numbers: Object; + strings: Object; + }; + } + + export interface IDestroyable { + destroy(): void; + } + + export interface INodeOptions extends IOptions { + name?: string; + screen?: Screen; + parent?: Node; + children?: Node[]; + focusable?: boolean; + } + + export abstract class Node extends EventEmitter implements IHasOptions, IDestroyable { + constructor(options: INodeOptions); + + // ** properties ** // + + focusable: boolean; + + /** + * Original options object. + */ + options: INodeOptions; + + /** + * An object for any miscellanous user data. + */ + data: {[index: string]: any;}; + /** + * An object for any miscellanous user data. + */ + _: {[index: string]: any;}; + /** + * An object for any miscellanous user data. + */ + $: {[index: string]: any;}; + /** + * Type of the node (e.g. box). + */ + type: string; + /** + * Render index (document order index) of the last render call. + */ + index: number; + /** + * Parent screen. + */ + screen: Screen; + /** + * Parent node. + */ + parent: Node; + /** + * Array of node's children. + */ + children: Node[]; + + // ** methods ** // + + /** + * Prepend a node to this node's children. + */ + prepend(node: Node): void; + /** + * Append a node to this node's children. + */ + append(node: Node): void; + /** + * Remove child node from node. + */ + remove(node: Node): void; + /** + * Insert a node to this node's children at index i. + */ + insert(node: Node, index: number): void; + /** + * Insert a node to this node's children before the reference node. + */ + insertBefore(node: Node, refNode: Node): void; + /** + * Insert a node from node after the reference node. + */ + insertAfter(node: Node, refNode: Node): void; + /** + * Remove node from its parent. + */ + detach(): void; + /** + * Remove node from its parent. + */ + free(): void; + /** + * Remove node from its parent. + */ + forDescendants(iter: Function, s: any): void; + /** + * Remove node from its parent. + */ + forAncestors(iter: Function, s: any): void; + /** + * Remove node from its parent. + */ + collectDescendants(s: any): void; + /** + * Remove node from its parent. + */ + collectAncestors(s: any): void; + /** + * Remove node from its parent. + */ + emitDescendants(): void; + /** + * Remove node from its parent. + */ + emitAncestors(): void; + /** + * Remove node from its parent. + */ + hasDescendant(target: Node): void; + /** + * Remove node from its parent. + */ + hasAncestor(target: Node): boolean; + /** + * Remove node from its parent. + */ + destroy(): void; + /** + * Emit event for element, and recursively emit same event for all descendants. + */ + emitDescendants(type: string, ...args: any[]): void; + /** + * Get user property with a potential default value. + */ + get(name: string, def: T): T; + /** + * Set user property to value. + */ + set(name: string, value: T): void; + + // ** events ** // + + on(event: string, listener: Function): this; + /** + * Received when node is added to a parent. + */ + on(event: "adopt", callback: (arg: Node) => void): this; + /** + * Received when node is removed from it's current parent. + */ + on(event: "remove", callback: (arg: Node) => void): this; + /** + * Received when node gains a new parent. + */ + on(event: "reparent", callback: (arg: Node) => void): this; + /** + * Received when node is attached to the screen directly or somewhere in its ancestry. + */ + on(event: "attach", callback: (arg: Node) => void): this; + /** + * Received when node is detached from the screen directly or somewhere in its ancestry. + */ + on(event: "detach", callback: (arg: Node) => void): this; + } + + export class NodeWithEvents extends Node { + // ** methods ** // + + /** + * Bind a keypress listener for a specific key. + */ + key(name: string | string[], listener: Function): void; + /** + * Bind a keypress listener for a specific key once. + */ + onceKey(name: string, listener: Function): void; + /** + * Remove a keypress listener for a specific key. + */ + unkey(name: string, listener: Function): void; + removeKey(name: string, listener: Function): void; + + // ** events ** // + + on(event: string, listener: Function): this; + /** + * Received on screen resize. + */ + on(event: "resize", callback: () => void): this; + /** + * Received on mouse events. + */ + on(event: "mouse", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "mouseout", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "mouseover", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "mousedown", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "mouseup", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "mousewheel", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "wheeldown", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "wheelup", callback: (arg: Events.IMouseEventArg) => void): this; + on(event: "mousemove", callback: (arg: Events.IMouseEventArg) => void): this; + /** + * Received on key events. + */ + on(event: "keypress", callback: (ch: string, key: Events.IKeyEventArg) => void): this; + /** + * Global events received for all elements. + */ + on(event: "element click", callback: (arg: Screen) => void): this; + on(event: "element mouseover", callback: (arg: Screen) => void): this; + on(event: "element mouseout", callback: (arg: Screen) => void): this; + on(event: "element mouseup", callback: (arg: Screen) => void): this; + /** + * Received on key event for [name]. + */ + //on(event: "key", callback: (arg: BlessedScreen) => void): this; + /** + * Received when the terminal window focuses/blurs. Requires a terminal supporting the + * focus protocol and focus needs to be passed to program.enableMouse(). + */ + on(event: "focus", callback: (arg: Screen) => void): this; + /** + * Received when the terminal window focuses/blurs. Requires a terminal supporting the + * focus protocol and focus needs to be passed to program.enableMouse(). + */ + on(event: "blur", callback: (arg: Screen) => void): this; + /** + * Received before render. + */ + on(event: "prerender", callback: () => void): this; + /** + * Received on render. + */ + on(event: "render", callback: () => void): this; + /** + * Received when blessed notices something untoward (output is not a tty, terminfo not found, etc). + */ + on(event: "warning", callback: (text: string) => void): this; + /** + * Received when the screen is destroyed (only useful when using multiple screens). + */ + on(event: "destroy", callback: () => void): this; + /** + * Received when the element is moved. + */ + on(event: "move", callback: () => void): this; + /** + * Element was clicked (slightly smarter than mouseup). + */ + on(event: "click", callback: (arg: Screen) => void): this; + /** + * Received when element is shown. + */ + on(event: "show", callback: () => void): this; + /** + * Received when element becomes hidden. + */ + on(event: "hide", callback: () => void): this; + + on(event: "set content", callback: () => void): this; + on(event: "parsed content", callback: () => void): this; + } + + export interface IScreenOptions extends INodeOptions { + /** + * The blessed Program to be associated with. Will be automatically instantiated if none is provided. + */ + program?: BlessedProgram; + /** + * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with + * uniform cells to their sides). This is known to cause flickering with elements that are not full-width, + * however, it is more optimal for terminal rendering. + */ + smartCSR?: boolean; + /** + * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, + * but may cause flickering depending on what is on each side of the element. + */ + fastCSR?: boolean; + /** + * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work + * with terminals that don't support it, but only on lines with the default background color. As it + * stands with the current implementation, it's uncertain how much terminal performance this adds at + * the cost of overhead within node. + */ + useBCE?: boolean; + /** + * Amount of time (in ms) to redraw the screen after the terminal is resized (Default: 300). + */ + resizeTimeout?: number; + /** + * The width of tabs within an element's content. + */ + tabSize?: number; + /** + * Automatically position child elements with border and padding in mind (NOTE: this is a recommended + * option. It may become default in the future). + */ + autoPadding?: boolean; + + cursor?: Types.TCursor; + + /** + * Create a log file. See log method. + */ + log?: (...msg: any[]) => void; + /** + * Dump all output and input to desired file. Can be used together with log option if set as a boolean. + */ + dump?: string; + /** + * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when + * pressing F12. It will display all log and debug messages. + */ + debug?: (...msg: string[]) => void; + /** + * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful + * for creating a key that will always exit no matter whether the keys are locked. + */ + ignoreLocked?: boolean; + /** + * Automatically "dock" borders with other elements instead of overlapping, depending on position + * (experimental). For example: These border-overlapped elements: + */ + dockBorders?: boolean; + /** + * Normally, dockable borders will not dock if the colors or attributes are different. This option + * will allow them to dock regardless. It may produce some odd looking multi-colored borders though. + */ + ignoreDockContrast?: boolean; + /** + * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode + * combining characters. This allows you to display text above the basic multilingual plane. This + * is behind an option because it may affect performance slightly negatively. Without this option + * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', + * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply + * removes them from an element's content if iTerm2 is detected). + */ + fullUnicode?: boolean; + /** + * Send focus events after mouse is enabled. + */ + sendFocus?: boolean; + /** + * Display warnings (such as the output not being a TTY, similar to ncurses). + */ + warnings?: boolean; + /** + * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. + * If value is true unicode is forced. If value is false non-unicode is forced (default: null). + */ + forceUnicode?: boolean; + /** + * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * net.Socket if you want to make a program that runs over telnet or something of that nature. + * */ + input?: stream.Writable; + /** + * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * net.Socket if you want to make a program that runs over telnet or something of that nature. + * */ + output?: stream.Readable; + /** + * The blessed Tput object (only available if you passed tput: true to the Program constructor.) + */ + tput?: Tput; + /** + * Top of the focus history stack. + */ + focused?: BlessedElement; + /** + * Width of the screen (same as program.cols). + */ + width?: Types.TPosition; + /** + * Height of the screen (same as program.rows). + */ + height?: Types.TPosition; + /** + * Same as screen.width. + */ + cols?: number; + /** + * Same as screen.height. + */ + rows?: number; + /** + * Relative top offset, always zero. + */ + top?: Types.TTopLeft; + /** + * Relative left offset, always zero. + */ + left?: Types.TTopLeft; + /** + * Relative right offset, always zero. + */ + right?: Types.TPosition; + /** + * Relative bottom offset, always zero. + */ + bottom?: Types.TPosition; + /** + * Absolute top offset, always zero. + */ + atop?: Types.TTopLeft; + /** + * Absolute left offset, always zero. + */ + aleft?: Types.TTopLeft; + /** + * Absolute right offset, always zero. + */ + aright?: Types.TPosition; + /** + * Absolute bottom offset, always zero. + */ + abottom?: Types.TPosition; + /** + * Whether the focused element grabs all keypresses. + */ + grabKeys?: any; + /** + * Prevent keypresses from being received by any element. + */ + lockKeys?: boolean; + /** + * The currently hovered element. Only set if mouse events are bound. + */ + hover?: any; + /** + * Set or get terminal name. Set calls screen.setTerminal() internally. + */ + terminal?: string; + /** + * Set or get window title. + */ + title?: string; + } + + export class Screen extends NodeWithEvents implements IHasOptions { + constructor(opts: IScreenOptions); + + // ** properties ** // + cleanSides: any; + + /** + * Original options object. + */ + options: IScreenOptions; + + /** + * The blessed Program to be associated with. Will be automatically instantiated if none is provided. + */ + program: BlessedProgram; + /** + * Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with + * uniform cells to their sides). This is known to cause flickering with elements that are not full-width, + * however, it is more optimal for terminal rendering. + */ + smartCSR: boolean; + /** + * Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, + * but may cause flickering depending on what is on each side of the element. + */ + fastCSR: boolean; + /** + * Attempt to perform back_color_erase optimizations for terminals that support it. It will also work + * with terminals that don't support it, but only on lines with the default background color. As it + * stands with the current implementation, it's uncertain how much terminal performance this adds at + * the cost of overhead within node. + */ + useBCE: boolean; + /** + * Amount of time (in ms) to redraw the screen after the terminal is resized (Default: 300). + */ + resizeTimeout: number; + /** + * The width of tabs within an element's content. + */ + tabSize: number; + /** + * Automatically position child elements with border and padding in mind (NOTE: this is a recommended + * option. It may become default in the future). + */ + autoPadding: boolean; + + cursor: Types.TCursor; + + /** + * Dump all output and input to desired file. Can be used together with log option if set as a boolean. + */ + dump: string; + /** + * Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful + * for creating a key that will always exit no matter whether the keys are locked. + */ + ignoreLocked: boolean; + /** + * Automatically "dock" borders with other elements instead of overlapping, depending on position + * (experimental). For example: These border-overlapped elements: + */ + dockBorders: boolean; + /** + * Normally, dockable borders will not dock if the colors or attributes are different. This option + * will allow them to dock regardless. It may produce some odd looking multi-colored borders though. + */ + ignoreDockContrast: boolean; + /** + * Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode + * combining characters. This allows you to display text above the basic multilingual plane. This + * is behind an option because it may affect performance slightly negatively. Without this option + * enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', + * '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply + * removes them from an element's content if iTerm2 is detected). + */ + fullUnicode: boolean; + /** + * Send focus events after mouse is enabled. + */ + sendFocus: boolean; + /** + * Display warnings (such as the output not being a TTY, similar to ncurses). + */ + warnings: boolean; + /** + * Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. + * If value is true unicode is forced. If value is false non-unicode is forced (default: null). + */ + forceUnicode: boolean; + /** + * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * net.Socket if you want to make a program that runs over telnet or something of that nature. + * */ + input: stream.Writable; + /** + * Input and output streams. process.stdin/process.stdout by default, however, it could be a + * net.Socket if you want to make a program that runs over telnet or something of that nature. + * */ + output: stream.Readable; + /** + * The blessed Tput object (only available if you passed tput: true to the Program constructor.) + */ + tput: Tput; + /** + * Top of the focus history stack. + */ + focused: BlessedElement; + /** + * Width of the screen (same as program.cols). + */ + width: Types.TPosition; + /** + * Height of the screen (same as program.rows). + */ + height: Types.TPosition; + /** + * Same as screen.width. + */ + cols: number; + /** + * Same as screen.height. + */ + rows: number; + /** + * Relative top offset, always zero. + */ + top: Types.TTopLeft; + /** + * Relative left offset, always zero. + */ + left: Types.TTopLeft; + /** + * Relative right offset, always zero. + */ + right: Types.TPosition; + /** + * Relative bottom offset, always zero. + */ + bottom: Types.TPosition; + /** + * Absolute top offset, always zero. + */ + atop: Types.TTopLeft; + /** + * Absolute left offset, always zero. + */ + aleft: Types.TTopLeft; + /** + * Absolute right offset, always zero. + */ + aright: Types.TPosition; + /** + * Absolute bottom offset, always zero. + */ + abottom: Types.TPosition; + /** + * Whether the focused element grabs all keypresses. + */ + grabKeys: any; + /** + * Prevent keypresses from being received by any element. + */ + lockKeys: boolean; + /** + * The currently hovered element. Only set if mouse events are bound. + */ + hover: any; + /** + * Set or get terminal name. Set calls screen.setTerminal() internally. + */ + terminal: string; + /** + * Set or get window title. + */ + title: string; + + // ** methods ** // + + /** + * Write string to the log file if one was created. + */ + log(...msg: any[]): void; + /** + * Same as the log method, but only gets called if the debug option was set. + */ + debug(...msg: string[]): void; + /** + * Allocate a new pending screen buffer and a new output screen buffer. + */ + alloc(): void; + /** + * Reallocate the screen buffers and clear the screen. + */ + realloc(): void; + /** + * Draw the screen based on the contents of the screen buffer. + */ + draw(start: number, end: number): void; + /** + * Render all child elements, writing all data to the screen buffer and drawing the screen. + */ + render(): void; + /** + * Clear any region on the screen. + */ + clearRegion(x1: number, x2: number, y1: number, y2: number): void; + /** + * Fill any region with a character of a certain attribute. + */ + fillRegion(attr: string, ch: string, x1: number, x2: number, y1: number, y2: number): void; + /** + * Focus element by offset of focusable elements. + */ + focusOffset(offset: number): any; + /** + * Focus previous element in the index. + */ + focusPrevious(): void; + /** + * Focus next element in the index. + */ + focusNext(): void; + /** + * Push element on the focus stack (equivalent to screen.focused = el). + */ + focusPush(element: BlessedElement): void; + /** + * Pop element off the focus stack. + */ + focusPop(): BlessedElement; + /** + * Save the focused element. + */ + saveFocus(): BlessedElement; + /** + * Restore the saved focused element. + */ + restoreFocus(): BlessedElement; + /** + * "Rewind" focus to the last visible and attached element. + */ + rewindFocus(): BlessedElement; + /** + * Spawn a process in the foreground, return to blessed app after exit. + */ + spawn(file: string, args: string[], options: NodeChildProcessExecOptions): child_process.ChildProcess; + /** + * Spawn a process in the foreground, return to blessed app after exit. Executes callback on error or exit. + */ + exec(file: string, args: string[], options: NodeChildProcessExecOptions, callback: Function): child_process.ChildProcess; + /** + * Read data from text editor. + */ + readEditor(options: any, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + readEditor(callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + /** + * Set effects based on two events and attributes. + */ + setEffects(el: BlessedElement, fel: BlessedElement, over: any, out: any, effects: any, temp: any): void; + /** + * Insert a line into the screen (using csr: this bypasses the output buffer). + */ + insertLine(n: number, y: number, top: number, bottom: number): void; + /** + * Delete a line from the screen (using csr: this bypasses the output buffer). + */ + deleteLine(n: number, y: number, top: number, bottom: number): void; + /** + * Insert a line at the bottom of the screen. + */ + insertBottom(top: number, bottom: number): void; + /** + * Insert a line at the top of the screen. + */ + insertTop(top: number, bottom: number): void; + /** + * Delete a line at the bottom of the screen. + */ + deleteBottom(top: number, bottom: number): void; + /** + * Delete a line at the top of the screen. + */ + deleteTop(top: number, bottom: number): void; + /** + * Enable mouse events for the screen and optionally an element (automatically called when a form of + * on('mouse') is bound). + */ + enableMouse(el: BlessedElement): void; + enableMouse(): void; + /** + * Enable keypress events for the screen and optionally an element (automatically called when a form of + * on('keypress') is bound). + */ + enableKeys(el: BlessedElement): void; + enableKeys(): void; + /** + * Enable key and mouse events. Calls bot enableMouse and enableKeys. + */ + enableInput(el: BlessedElement): void; + enableInput(): void; + /** + * Attempt to copy text to clipboard using iTerm2's proprietary sequence. Returns true if successful. + */ + copyToClipboard(text: string): void; + /** + * Attempt to change cursor shape. Will not work in all terminals (see artificial cursors for a solution + * to this). Returns true if successful. + */ + cursorShape(shape: boolean, blink: boolean): any; + /** + * Attempt to change cursor color. Returns true if successful. + */ + cursorColor(color: string): void; + /** + * Attempt to reset cursor. Returns true if successful. + */ + cursorReset(): void; + /** + * Take an SGR screenshot of the screen within the region. Returns a string containing only + * characters and SGR codes. Can be displayed by simply echoing it in a terminal. + */ + screenshot(xi: number, xl: number, yi: number, yl: number): string; + screenshot(): void; + /** + * Destroy the screen object and remove it from the global list. Also remove all global events relevant + * to the screen object. If all screen objects are destroyed, the node process is essentially reset + * to its initial state. + */ + destroy(): void; + /** + * Reset the terminal to term. Reloads terminfo. + */ + setTerminal(term: string): void; + } + + export interface Padding { + left?: number; + right?: number; + top?: number; + bottom?: number; + } + + export class PositionCoords { + xi: number; + xl: number; + yi: number; + yl: number; + } + + export interface Position { + left: number | string; + right: number | string; + top: number | string; + bottom: number | string; + } + + export interface Border { + /** + * Type of border (line or bg). bg by default. + */ + type?: "line" | "bg"; + /** + * Character to use if bg type, default is space. + */ + ch?: string; + /** + * Border foreground and background, must be numbers (-1 for default). + */ + bg?: number; + fg?: number; + /** + * Border attributes. + */ + bold?: string; + underline?: string; + } + + export interface ElementOptions extends INodeOptions { + tags?: boolean; + + fg?: string; + bg?: string; + bold?: string; + underline?: string; + + style?: any; + /** + * Border object, see below. + */ + border?: Border | "line" | "bg"; + /** + * Element's text content. + */ + content?: string; + /** + * Element is clickable. + */ + clickable?: boolean; + /** + * Element is focusable and can receive key input. + */ + input?: boolean; + keyable?: boolean; + /** + * Element is focused. + */ + focused?: BlessedElement; + /** + * Whether the element is hidden. + */ + hidden?: boolean; + /** + * A simple text label for the element. + */ + label?: string; + /** + * A floating text label for the element which appears on mouseover. + */ + hoverText?: string; + /** + * Text alignment: left, center, or right. + */ + align?: "left" | "center" | "right"; + /** + * Vertical text alignment: top, middle, or bottom. + */ + valign?: "top" | "middle" | "bottom"; + /** + * Shrink/flex/grow to content and child elements. Width/height during render. + */ + shrink?: boolean; + /** + * Amount of padding on the inside of the element. Can be a number or an object containing + * the properties: left, right, top, and bottom. + */ + padding?: number | Padding; + + top?: Types.TTopLeft; + left?: Types.TTopLeft; + right?: Types.TPosition; + bottom?: Types.TPosition; + + /** + * Width/height of the element, can be a number, percentage (0-100%), or keyword (half or shrink). + * Percentages can also have offsets (50%+1, 50%-1). + */ + width?: number | string; + /** + * Offsets of the element relative to its parent. Can be a number, percentage (0-100%), or + * keyword (center). right and bottom do not accept keywords. Percentages can also have + * offsets (50%+1, 50%-1). + */ + height?: number | string; + /** + * Can contain the above options. + */ + position?: Position; + /** + * Whether the element is scrollable or not. + */ + scrollable?: boolean; + /** + * Background character (default is whitespace ). + */ + ch?: string; + /** + * Allow the element to be dragged with the mouse. + */ + draggable?: boolean; + /** + * Draw a translucent offset shadow behind the element. + */ + shadow?: boolean; + } + + export interface Coords { + xl: number; + xi: number; + yl: number; + yi: number; + base: number; + _contentEnd: {x: number; y: number;}; + notop: Types.TTopLeft; + noleft: Types.TTopLeft; + noright: Types.TPosition; + nobot: Types.TPosition; + } + + export interface LabelOptions { + text: string; + side: Types.TAlign; + } + + // TODO: scrollable - Note: If the scrollable option is enabled, Element inherits all methods from ScrollableBox. + export abstract class BlessedElement extends NodeWithEvents implements IHasOptions { + constructor(opts: ElementOptions); + + // ** properties ** // + + /** + * Original options object. + */ + options: ElementOptions; + /** + * Name of the element. Useful for form submission. + */ + name: string; + /** + * Border object. + */ + border: Border; + + style: any; + position: Position; + content: string; + hidden: boolean; + visible: boolean; + detached: boolean; + /** + * Border foreground and background, must be numbers (-1 for default). + */ + bg: number; + fg: number; + /** + * Border attributes. + */ + bold: string; + underline: string; + /** + * Calculated width. + */ + width: number | string; + /** + * Calculated height. + */ + height: number | string; + /** + * Calculated relative top offset.*/ + top: Types.TTopLeft; + /** + * Calculated relative left offset. + */ + left: Types.TTopLeft; + /** + * Calculated relative right offset. + */ + right: Types.TPosition; + /** + * Calculated relative bottom offset. + */ + bottom: Types.TPosition; + /** + * Calculated absolute top offset. + */ + atop: Types.TTopLeft; + /** + * Calculated absolute left offset. + */ + aleft: Types.TTopLeft; + /** + * Calculated absolute right offset. + */ + aright: Types.TPosition; + /** + * Calculated absolute bottom offset. + */ + abottom: Types.TPosition; + + /** + * Whether the element is draggable. Set to true to allow dragging. + */ + draggable: boolean; + + itop: Types.TTopLeft; + ileft: Types.TTopLeft; + iheight: Types.TPosition; + iwidth: Types.TPosition; + + /** + * Calculated relative top offset. + */ + rtop: Types.TTopLeft; + /** + * Calculated relative left offset. + */ + rleft: Types.TTopLeft; + /** + * Calculated relative right offset. + */ + rright: Types.TPosition; + /** + * Calculated relative bottom offset. + */ + rbottom: Types.TPosition; + + lpos: PositionCoords; + + // ** methods ** // + + /** + * Write content and children to the screen buffer. + */ + render(): Coords; + /** + * Hide element.*/ + hide(): void; + /** + * Show element. + */ + show(): void; + /** + * Toggle hidden/shown. + */ + toggle(): void; + /** + * Focus element. + */ + focus(): void; + /** + * Same asel.on('screen', ...) except this will automatically keep track of which listeners + * are bound to the screen object. For use with removeScreenEvent(), free(), and destroy(). + */ + onScreenEvent(type: string, handler: Function): void; + /** + * Same asel.removeListener('screen', ...) except this will automatically keep track of which + * listeners are bound to the screen object. For use with onScreenEvent(), free(), and destroy(). + */ + removeScreenEvent(type: string, handler: Function): void; + /** + * Free up the element. Automatically unbind all events that may have been bound to the screen + * object. This prevents memory leaks. For use with onScreenEvent(), removeScreenEvent(), + * and destroy(). + */ + free(): void; + /** + * Same as the detach() method, except this will automatically call free() and unbind any screen + * events to prevent memory leaks. for use with onScreenEvent(), removeScreenEvent(), and free(). + */ + destroy(): void; + /** + * Set the z-index of the element (changes rendering order). + */ + setIndex(z: number): void; + /** + * Put the element in front of its siblings.*/ + setFront(): void; + /** + * Put the element in back of its siblings. + */ + setBack(): void; + /** + * text/options - Set the label text for the top-left corner. Example options: {text:'foo',side:'left'} + */ + setLabel(arg: string | LabelOptions): void; + /** + * Remove the label completely. + */ + removeLabel(): any; + /** + * text/options - Set a hover text box to follow the cursor. Similar to the "title" DOM attribute + * in the browser. Example options: {text:'foo'} + */ + setHover(arg: string | LabelOptions): void; + /** + * Remove the hover label completely. + */ + removeHover(): void; + /** + * Enable mouse events for the element (automatically called when a form of on('mouse') is bound). + */ + enableMouse(): void; + /** + * Enable keypress events for the element (automatically called when a form of on('keypress') is bound). + */ + enableKeys(): void; + /** + * Enable key and mouse events. Calls bot enableMouse and enableKeys. + */ + enableInput(): void; + /** + * Enable dragging of the element. + */ + enableDrag(): void; + /** + * Disable dragging of the element. + */ + disableDrag(): void; + /** + * Take an SGR screenshot of the screen within the region. Returns a string containing only + * characters and SGR codes. Can be displayed by simply echoing it in a terminal. + */ + screenshot(xi: number, xl: number, yi: number, yl: number): string; + screenshot(): void; + + /* + Content Methods + + Methods for dealing with text content, line by line. Useful for writing a text editor, + irc client, etc. + + Note: All of these methods deal with pre-aligned, pre-wrapped text. If you use deleteTop() + on a box with a wrapped line at the top, it may remove 3-4 "real" lines (rows) depending + on how long the original line was. + + The lines parameter can be a string or an array of strings. The line parameter must + be a string. + */ + + /** + * Set the content. Note: When text is input, it will be stripped of all non-SGR + * escape codes, tabs will be replaced with 8 spaces, and tags will be replaced + * with SGR codes (if enabled). + */ + setContent(text: string): void; + /** + * Return content, slightly different from el.content. Assume the above formatting. + */ + getContent(): string; + /** + * Similar to setContent, but ignore tags and remove escape codes. + */ + setText(text: string): void; + /** + * Similar to getContent, but return content with tags and escape codes removed. + */ + getText(): string; + /** + * Insert a line into the box's content. + */ + insertLine(i: number, lines: string | string[]): void; + /** + * Delete a line from the box's content. + */ + deleteLine(i: number): void; + /** + * Get a line from the box's content. + */ + getLine(i: number): string; + /** + * Get a line from the box's content from the visible top. + */ + getBaseLine(i: number): string; + /** + * Set a line in the box's content. + */ + setLine(i: number, line: string | string[]): void; + /** + * Set a line in the box's content from the visible top. + */ + setBaseLine(i: number, line: string | string[]): void; + /** + * Clear a line from the box's content. + */ + clearLine(i: number): void; + /** + * Clear a line from the box's content from the visible top. + */ + clearBaseLine(i: number): void; + /** + * Insert a line at the top of the box. + */ + insertTop(lines: string | string[]): void; + /** + * Insert a line at the bottom of the box. + */ + insertBottom(lines: string | string[]): void; + /** + * Delete a line at the top of the box. + */ + deleteTop(): void; + /** + * Delete a line at the bottom of the box. + */ + deleteBottom(): void; + /** + * Unshift a line onto the top of the content. + */ + unshiftLine(lines: string | string[]): void; + /** + * Shift a line off the top of the content. + */ + shiftLine(i: number): void; + /** + * Push a line onto the bottom of the content. + */ + pushLine(lines: string | string[]): void; + /** + * Pop a line off the bottom of the content. + */ + popLine(i: number): string; + /** + * An array containing the content lines. + */ + getLines(): string[]; + /** + * An array containing the lines as they are displayed on the screen. + */ + getScreenLines(): string[]; + /** + * Get a string's displayed width, taking into account double-width, surrogate pairs, + * combining characters, tags, and SGR escape codes. + */ + strWidth(text: string): string; + + // ** events ** // + } + + export interface ScrollableBoxOptions extends ElementOptions { + /** + * A limit to the childBase. Default is Infinity. + */ + baseLimit?: number; + /** + * A option which causes the ignoring of childOffset. This in turn causes the + * childBase to change every time the element is scrolled. + */ + alwaysScroll?: boolean; + /** + * Object enabling a scrollbar. + * Style of the scrollbar track if present (takes regular style options). + */ + scrollbar?: { style?: any; track?: any; ch?: string; } + } + + export interface ScrollableTextOptions extends ScrollableBoxOptions { + /** + * Whether to enable automatic mouse support for this element. + * Use pre-defined mouse events (right-click for editor). + */ + mouse?: boolean | (() => void); + /** + * Use pre-defined keys (i or enter for insert, e for editor, C-e for editor while inserting). + */ + keys?: string | string[] | boolean; + /** + * Use vi keys with the keys option. + */ + vi?: boolean; + } + + export interface BoxOptions extends ScrollableTextOptions { + bindings?: any; + } + + /** + * DEPRECATED - Use Box with the scrollable option instead. A box with scrollable content. + */ + export class ScrollableBoxElement extends BlessedElement { + /** + * The offset of the top of the scroll content. + */ + childBase: number; + /** + * The offset of the chosen item/line. + */ + childOffset: number; + + /** + * Scroll the content by a relative offset. + */ + scroll(offset: number, always?: boolean): void; + /** + * Scroll the content to an absolute index. + */ + scrollTo(index: number): void; + /** + * Same as scrollTo. + */ + setScroll(index: number): void; + /** + * Set the current scroll index in percentage (0-100). + */ + setScrollPerc(perc: number): void; + /** + * Get the current scroll index in lines. + */ + getScroll(): void; + /** + * Get the actual height of the scrolling area. + */ + getScrollHeight(): void; + /** + * Get the current scroll index in percentage. + */ + getScrollPerc(): void; + /** + * Reset the scroll index to its initial state. + */ + resetScroll(): void; + + on(event: string, listener: Function): this; + /** + * Received when the element is scrolled. + */ + on(event: "scroll", callback: () => void): this; + } + + /** + * DEPRECATED - Use Box with the scrollable and alwaysScroll options instead. + * A scrollable text box which can display and scroll text, as well as handle + * pre-existing newlines and escape codes. + */ + export class ScrollableTextElement extends ScrollableBoxElement { + } + + /** + * A box element which draws a simple box containing content or other elements. + */ + export class BoxElement extends ScrollableTextElement implements IHasOptions { + constructor(opts: BoxOptions); + + /** + * Original options object. + */ + options: BoxOptions; + } + + export interface TextOptions extends ElementOptions { + /** + * Fill the entire line with chosen bg until parent bg ends, even if there + * is not enough text to fill the entire width. + */ + fill?: boolean; + /** + * Text alignment: left, center, or right. + */ + align?: Types.TAlign; + } + + /** + * An element similar to Box, but geared towards rendering simple text elements. + */ + export class TextElement extends BlessedElement implements IHasOptions { + constructor(opts: TextOptions); + + /** + * Original options object. + */ + options: TextOptions; + } + + /** + * A simple line which can be line or bg styled. + */ + export interface LineOptions extends BoxOptions { + /** + * Can be vertical or horizontal. + */ + orientation?: "vertical" | "horizontal"; + /** + * Treated the same as a border object. (attributes can be contained in style). + */ + type?: string; + bg?: string; + fg?: string; + ch?: string; + } + + /** + * A simple line which can be line or bg styled. + */ + export class LineElement extends BoxElement implements IHasOptions { + constructor(opts: LineOptions); + + /** + * Original options object. + */ + options: LineOptions; + } + + export interface BigTextOptions extends BoxOptions { + /** + * bdf->json font file to use (see ttystudio for instructions on compiling BDFs to JSON). + */ + font?: string; + /** + * bdf->json bold font file to use (see ttystudio for instructions on compiling BDFs to JSON). + */ + fontBold?: string; + /** + * foreground character. (default: ' ') + */ + fch?: string; + } + + /** + * A box which can render content drawn as 8x14 cell characters using the terminus font. + */ + export class BigTextElement extends BoxElement implements IHasOptions { + constructor(opts: BigTextOptions); + + /** + * Original options object. + */ + options: BigTextOptions; + } + + export interface ListElementStyle { + selected?: any; + item?: any; + } + + export interface ListOptions extends BoxOptions { + /** + * Style for a selected item. Style for an unselected item. + */ + style?: TStyle; + /** + * An array of strings which become the list's items. + */ + items?: string[]; + /** + * A function that is called when vi mode is enabled and the key / is pressed. This function accepts a + * callback function which should be called with the search string. The search string is then used to + * jump to an item that is found in items. + */ + search?: () => void; + /** + * Whether the list is interactive and can have items selected (Default: true). + */ + interactive?: boolean; + /** + * Whether to automatically override tags and invert fg of item when selected (Default: true). + */ + invertSelected?: boolean; + } + + export class ListElement extends BoxElement implements IHasOptions> { + constructor(opts: ListOptions); + + /** + * Original options object. + */ + options: ListOptions; + + /** + * Add an item based on a string. + */ + add(text: string): void; + /** + * Add an item based on a string. + */ + addItem(text: string): void; + /** + * Removes an item from the list. Child can be an element, index, or string. + */ + removeItem(child: BlessedElement): BlessedElement; + /** + * Push an item onto the list. + * */ + pushItem(child: BlessedElement): number; + /** + * Pop an item off the list. + * */ + popItem(): BlessedElement; + /** + * Unshift an item onto the list. + */ + unshiftItem(child: BlessedElement): number; + /** + * Shift an item off the list. + * */ + shiftItem(): BlessedElement; + /** + * Inserts an item to the list. Child can be an element, index, or string. + */ + insertItem(i: number, child: BlessedElement): void; + /** + * Returns the item element. Child can be an element, index, or string. + */ + getItem(child: BlessedElement): BlessedElement; + /** + * Set item to content. + */ + setItem(child: BlessedElement, content: BlessedElement | string): void; + /** + * Remove and insert items to the list. + * */ + spliceItem(i: number, n: number, ...items: BlessedElement[]): void; + /** + * Clears all items from the list. + * */ + clearItems(): void; + /** + * Sets the list items to multiple strings. + */ + setItems(items: BlessedElement[]): void; + /** + * Returns the item index from the list. Child can be an element, index, or string. + */ + getItemIndex(child: BlessedElement): number; + /** + * Select an index of an item. + * */ + select(index: number): void; + /** + * Select item based on current offset. + * */ + move(offset: number): void; + /** + * Select item above selected. + * */ + up(amount: number): void; + /** + * Select item below selected. + */ + down(amount: number): void; + /** + * Show/focus list and pick an item. The callback is executed with the result. + */ + pick(callback: () => void): void; + /** + * Find an item based on its text content. + */ + fuzzyFind(arg: string | RegExp | (() => void)): void; + + // ** events ** // + + on(event: string, listener: Function): this; + /** + * Received when an item is selected. + */ + on(event: "select", callback: (item: BoxElement, index: number) => void): this; + /** + * List was canceled (when esc is pressed with the keys option). + */ + on(event: "cancel", callback: () => void): this; + /** + * Either a select or a cancel event was received. + */ + on(event: "action", callback: () => void): this; + + on(event: "create item", callback: () => void): this; + on(event: "add item", callback: () => void): this; + on(event: "remove item", callback: () => void): this; + on(event: "insert item", callback: () => void): this; + on(event: "set items", callback: () => void): this; + on(event: "select item", callback: (item: BlessedElement, index: number) => void): this; + } + + export interface FileManagerOptions extends ListOptions { + /** + * Current working directory. + */ + cwd?: string; + } + + export class FileManagerElement extends ListElement implements IHasOptions { + constructor(opts: FileManagerOptions); + + /** + * Original options object. + */ + options: FileManagerOptions; + /** + * Current working directory. + */ + cwd: string; + + /** + * Refresh the file list (perform a readdir on cwd and update the list items). + */ + refresh(cwd:string, callback: () => void): void; + refresh(callback: () => void): void; + refresh(): void; + /** + * Pick a single file and return the path in the callback. + */ + pick(cwd:string, callback: () => void): void; + pick(callback: () => void): void; + /** + * Reset back to original cwd. + */ + reset(cwd:string, callback: () => void): void; + reset(callback: () => void): void; + reset(): void; + + // ** events ** // + + on(event: string, listener: Function): this; + /** + * Received when an item is selected. + */ + on(event: "cd", callback: (file: string, cwd: string) => void): this; + /** + * Received when an item is selected. + */ + on(event: "file", callback: (file: string) => void): this; + + on(event: "error", callback: (err: any, file: string) => void): this; + on(event: "refresh", callback: () => void): this; + } + + export interface StyleListTable extends ListElementStyle { + /** + * Header style. + */ + header?: any; + /** + * Cell style. + */ + cell?: any; + } + + export interface ListTableOptions extends ListOptions { + /** + * Array of array of strings representing rows. + */ + rows?: string[]; + data?: string[][]; + /** + * Spaces to attempt to pad on the sides of each cell. 2 by default: one space on each side + * (only useful if the width is shrunken). + */ + pad?: number; + /** + * Do not draw inner cells. + */ + noCellBorders?: boolean; + + style?: StyleListTable; + } + + export class ListTableElement extends ListElement implements IHasOptions { + constructor(opts: ListTableOptions); + + /** + * Original options object. + */ + options: ListTableOptions; + + /** + * Set rows in table. Array of arrays of strings. + * @example: + * + * table.setData([ + [ 'Animals', 'Foods' ], + [ 'Elephant', 'Apple' ], + [ 'Bird', 'Orange' ] + ]); + */ + setRows(rows: string[][]): void; + /** + * Set rows in table. Array of arrays of strings. + * @example: + * + * table.setData([ + [ 'Animals', 'Foods' ], + [ 'Elephant', 'Apple' ], + [ 'Bird', 'Orange' ] + ]); + */ + setData(rows: string[][]): void; + } + + export interface ListbarOptions extends BoxOptions { + style?: ListElementStyle; + /** + * Set buttons using an object with keys as titles of buttons, containing of objects + * containing keys of keys and callback. + */ + commands: Types.ListbarCommand[]; + items: Types.ListbarCommand[]; + /** + * Automatically bind list buttons to keys 0-9. + */ + autoCommandKeys: boolean; + } + + export class ListbarElement extends BoxElement implements IHasOptions { + constructor(opts: ListbarOptions); + + /** + * Original options object. + */ + options: ListbarOptions; + + /** + * Set commands (see commands option above). + */ + setItems(commands: Types.ListbarCommand[]): void; + /** + * Append an item to the bar. + */ + add(item: Types.ListbarCommand, callback: () => void): void; + /** + * Append an item to the bar. + */ + addItem(item: Types.ListbarCommand, callback: () => void): void; + /** + * Append an item to the bar. + */ + appendItem(item: Types.ListbarCommand, callback: () => void): void; + /** + * Select an item on the bar. + */ + select(offset: number): void; + /** + * Remove item from the bar. + */ + removeItem(child: BlessedElement): void; + /** + * Move relatively across the bar. + */ + move(offset: number): void; + /** + * Move left relatively across the bar. + */ + moveLeft(offset: number): void; + /** + * Move right relatively across the bar. + */ + moveRight(offset: number): void; + /** + * Select button and execute its callback. + */ + selectTab(index: number): void; + + // ** events ** // + + on(event: string, listener: Function): this; + + on(event: "set items", callback: () => void): this; + on(event: "remove item", callback: () => void): this; + on(event: "select tab", callback: () => void): this; + } + + export interface FormOptions extends BoxOptions { + /** + * Allow default keys (tab, vi keys, enter). + */ + keys?: any; + /** + * Allow vi keys. + */ + vi?: boolean; + } + + export class FormElement extends BoxElement implements IHasOptions { + constructor(opts: FormOptions); + + /** + * Original options object. + */ + options: FormOptions; + /** + * Last submitted data. + */ + submission: TFormData; + + /** + * Focus next form element. + */ + focusNext(): void; + /** + * Focus previous form element. + */ + focusPrevious(): void; + /** + * Submit the form. + */ + submit(): void; + /** + * Discard the form. + */ + cancel(): void; + /** + * Clear the form. + */ + reset(): void; + + // ** events ** // + + on(event: string, listener: Function): this; + /** + * Form is submitted. Receives a data object. + */ + on(event: "submit", callback: (out: TFormData) => void): this; + /** + * Form is discarded. + */ + on(event: "cancel", callback: () => void): this; + /** + * Form is cleared. + */ + on(event: "reset", callback: () => void): this; + } + + export interface InputOptions extends BoxOptions { } + + export abstract class InputElement extends BoxElement { + constructor(opts: InputOptions); + } + + /** + * A box which allows multiline text input. + */ + export interface TextareaOptions extends InputOptions { + /** + * Call readInput() when the element is focused. Automatically unfocus. + */ + inputOnFocus?: boolean; + } + + export class TextareaElement extends InputElement implements IHasOptions { + constructor(opts: TextareaOptions); + + /** + * Original options object. + */ + options: TextareaOptions; + + /** + * The input text. read-only. + */ + value: string; + + /** + * Submit the textarea (emits submit). + */ + submit(): void; + /** + * Cancel the textarea (emits cancel). + */ + cancel(): void; + /** + * Grab key events and start reading text from the keyboard. Takes a callback which receives + * the final value. + */ + readInput(callback?: (err: any, value?: string) => void): void; + /** + * Grab key events and start reading text from the keyboard. Takes a callback which receives + * the final value. + */ + input(callback: (err: any, value?: string) => void): void; + /** + * Grab key events and start reading text from the keyboard. Takes a callback which receives + * the final value. + */ + setInput(callback: (err: any, value?: string) => void): void; + /** + * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which + * receives the final value. + */ + readEditor(callback: (err: any, value?: string) => void): void; + /** + * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which + * receives the final value. + */ + editor(callback: (err: any, value?: string) => void): void; + /** + * Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which + * receives the final value. + */ + setEditor(callback: (err: any, value?: string) => void): void; + /** + * The same as this.value, for now. + */ + getValue(): string; + /** + * Clear input. + */ + clearValue(): void; + /** + * Set value. + */ + setValue(text: string): void; + + // ** events ** // + + on(event: string, listener: Function): this; + + on(event: "error", callback: (err: any) => void): this; + + /** + * Value is submitted (enter). + */ + on(event: "submit", callback: (value: any) => void): this; + /** + * Value is discared (escape). + */ + on(event: "cancel", callback: (value: any) => void): this; + /** + * Either submit or cancel. + */ + on(event: "action", callback: (value: any) => void): this; + } + + export interface TextboxOptions extends TextareaOptions { + /** + * Completely hide text. + */ + secret?: boolean; + /** + * Replace text with asterisks (*). + */ + censor?: boolean; + } + + export class TextboxElement extends TextareaElement implements IHasOptions { + constructor(opts: TextboxOptions); + + /** + * Original options object. + */ + options: TextboxOptions; + + /** + * Completely hide text. + */ + secret: boolean; + /** + * Replace text with asterisks (*). + */ + censor: boolean; + } + + export interface ButtonOptions extends BoxOptions { } + + export class ButtonElement extends InputElement implements IHasOptions { + constructor(opts: ButtonOptions); + + /** + * Original options object. + */ + options: ButtonOptions; + + /** + * Press button. Emits press. + */ + press(): void; + + on(event: string, listener: Function): this; + + on(event: "press", callback: () => void): this; + } + + export interface CheckboxOptions extends BoxOptions { + /** + * whether the element is checked or not. + * */ + checked?: boolean; + /** + * enable mouse support. + * */ + mouse?: boolean; + } + + /** + * A checkbox which can be used in a form element. + * */ + export class CheckboxElement extends InputElement implements IHasOptions { + constructor(options?: CheckboxOptions); + + /** + * Original options object. + */ + options: CheckboxOptions; + + /** + * the text next to the checkbox (do not use setcontent, use `check.text = ''`). + * */ + text: string; + /** + * whether the element is checked or not. + * */ + checked: boolean; + /** + * same as `checked`. + * */ + value: boolean; + + /** + * check the element. + * */ + check(): void; + /** + * uncheck the element. + * */ + uncheck(): void; + /** + * toggle checked state. + * */ + toggle(): void; + } + + export interface RadioSetOptions extends BoxOptions { } + + /** + * An element wrapping RadioButtons. RadioButtons within this element will be mutually exclusive + * with each other. + * */ + export abstract class RadioSetElement extends BoxElement { + constructor(opts: RadioSetOptions); + } + + export interface RadioButtonOptions extends BoxOptions { } + + /** + * A radio button which can be used in a form element. + */ + export abstract class RadioButtonElement extends CheckboxElement { + constructor(opts: RadioButtonOptions); + } + + export interface PromptOptions extends BoxOptions { } + + /** + * A prompt box containing a text input, okay, and cancel buttons (automatically hidden). + */ + export class PromptElement extends BoxElement implements IHasOptions { + constructor(opts: PromptOptions); + + options: PromptOptions; + + /** + * Show the prompt and wait for the result of the textbox. Set text and initial value. + */ + input(text: string, value: string, callback: (err: any, value: string) => void): void; + setInput(text: string, value: string, callback: (err: any, value: string) => void): void; + readInput(text: string, value: string, callback: (err: any, value: string) => void): void; + } + + export interface QuestionOptions extends BoxOptions { } + + /** + * A question box containing okay and cancel buttons (automatically hidden). + */ + export class QuestionElement extends BoxElement implements IHasOptions { + constructor(opts: QuestionOptions); + + options: QuestionOptions; + + /** + * Ask a question. callback will yield the result. + */ + ask(question: string, callback: (err: any, value: string) => void): void; + } + + export interface MessageOptions extends BoxOptions { } + + /** + * A box containing a message to be displayed (automatically hidden). + */ + export class MessageElement extends BoxElement implements IHasOptions { + constructor(opts: MessageOptions); + + options: MessageOptions; + + /** + * Display a message for a time (default is 3 seconds). Set time to 0 for a perpetual message that is dismissed on keypress. + */ + log(text: string, time: number, callback: (err: any) => void): void; + log(text: string, callback: (err: any) => void): void; + display(text: string, time: number, callback: (err: any) => void): void; + display(text: string, callback: (err: any) => void): void; + + /** + * Display an error in the same way. + */ + error(text: string, time: number, callback: () => void): void; + error(text: string, callback: () => void): void; + } + + export interface LoadingOptions extends BoxOptions { } + + /** + * A box with a spinning line to denote loading (automatically hidden). + */ + export class LoadingElement extends BoxElement implements IHasOptions { + constructor(opts: LoadingOptions); + + options: LoadingOptions; + + /** + * Display the loading box with a message. Will lock keys until stop is called. + */ + load(text: string): void; + /** + * Hide loading box. Unlock keys. + */ + stop(): void; + } + + export interface ProgressBarOptions extends BoxOptions { + /** + * can be `horizontal` or `vertical`. + * */ + orientation: string; + /** + * the character to fill the bar with (default is space). + * */ + pch: string; + /** + * the amount filled (0 - 100). + * */ + filled: number; + /** + * same as `filled`. + * */ + value: number; + /** + * enable key support. + * */ + keys: boolean; + /** + * enable mouse support. + * */ + mouse: boolean; + } + + /** + * A progress bar allowing various styles. This can also be used as a form input. + */ + export class ProgressBarElement extends InputElement implements IHasOptions { + constructor(options?: ProgressBarOptions); + + options: ProgressBarOptions; + + /** + * progress the bar by a fill amount. + * */ + progress(amount:number): void; + /** + * set progress to specific amount. + * */ + setProgress(amount:number): void; + /** + * reset the bar. + * */ + reset(): void; + + on(event: string, listener: Function): this; + /** + * Bar was reset. + */ + on(event: "reset", callback: () => void): this; + /** + * Bar has completely filled. + */ + on(event: "complete", callback: () => void): this; + } + + export interface LogOptions extends ScrollableTextOptions { + /** + * amount of scrollback allowed. default: Infinity. + * */ + scrollback?: number; + /** + * scroll to bottom on input even if the user has scrolled up. default: false. + * */ + scrollOnInput?: boolean; + } + + /** + * A log permanently scrolled to the bottom. + * */ + export class Log extends ScrollableTextElement implements IHasOptions { + constructor(options?: LogOptions); + + options: LogOptions; + + /** + * amount of scrollback allowed. default: Infinity. + * */ + scrollback: number; + /** + * scroll to bottom on input even if the user has scrolled up. default: false. + * */ + scrollOnInput: boolean; + + /** + * add a log line. + * */ + log(text:string): void; + /** + * add a log line. + * */ + add(text:string): void; + } + + export interface TableOptions extends BoxOptions { + /** + * array of array of strings representing rows (same as `data`). + * */ + rows?: string[][]; + /** + * array of array of strings representing rows (same as `rows`). + * */ + data?: string[][]; + /** + * spaces to attempt to pad on the sides of each cell. `2` by default: one space on each side (only useful if the width is shrunken). + * */ + pad?: number; + /** + * do not draw inner cells. + * */ + noCellBorders?: boolean; + /** + * fill cell borders with the adjacent background color. + * */ + fillCellBorders?: boolean; + } + + /** + * A stylized table of text elements. + * */ + export class TableElement extends BoxElement implements IHasOptions { + constructor(opts: TableOptions); + + options: TableOptions; + + /** + * set rows in table. array of arrays of strings. + * */ + setData(rows: string[][]): void; + /** + * set rows in table. array of arrays of strings. + * */ + setRows(rows: string[][]): void; + } + + export interface TerminalOptions extends BoxOptions { + /** + * handler for input data. + * */ + handler?: (userInput:Buffer) => void; + /** + * name of shell. $SHELL by default. + * */ + shell?:string; + /** + * args for shell. + * */ + args?:any; + /** + * can be line, underline, and block. + * */ + cursor?: 'line'|'underline'|'block'; + + terminal?: string; + + /** + * Object for process env. + */ + env?: any; + } + + export class TerminalElement extends BoxElement implements IHasOptions { + constructor(opts: TerminalOptions); + + options: TerminalOptions; + + /** + * reference to the headless term.js terminal. + * */ + term: any; + /** + * reference to the pty.js pseudo terminal. + * */ + pty: any; + + /** + * write data to the terminal. + * */ + write(data:string): void; + + /** + * nearly identical to `element.screenshot`, however, the specified region includes the terminal's _entire_ scrollback, rather than just what is visible on the screen. + * */ + screenshot(xi?:number, xl?:number, yi?:number, yl?:number): string; + } + + export interface ImageOptions extends BoxOptions { + /** + * path to image. + * */ + file: string; + /** + * path to w3mimgdisplay. if a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. + * */ + type: "ansi" | "overlay" | "w3m"; + } + + /** + * Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals. + * */ + export class ImageElement extends BoxElement implements IHasOptions { + constructor(options?: ImageOptions); + + options: ImageOptions; + } + + export interface ANSIImageOptions extends BoxOptions { + /** + * URL or path to PNG/GIF file. Can also be a buffer. + * */ + file: string; + /** + * Scale cellmap down (0-1.0) from its original pixel width/height (Default: 1.0). + * */ + scale: number; + + /** + * This differs from other element's width or height in that only one of them is needed: blessed will maintain the aspect ratio of the image as it scales down to the proper number of cells. NOTE: PNG/GIF's are always automatically shrunken to size (based on scale) if a width or height is not given. + * */ + width: number | string; + height: number | string; + + /** + * Add various "density" ASCII characters over the rendering to give the image more detail, similar to libcaca/libcucul (the library mplayer uses to display videos in the terminal). + */ + ascii: string; + + /** + * Whether to animate if the image is an APNG/animating GIF. If false, only display the first frame or IDAT (Default: true). + */ + animate: boolean; + + /** + * Set the speed of animation. Slower: 0.0-1.0. Faster: 1-1000. It cannot go faster than 1 frame per millisecond, so 1000 is the fastest. (Default: 1.0) + */ + speed: number; + + /** + * mem or cpu. If optimizing for memory, animation frames will be rendered to bitmaps as the animation plays, using less memory. Optimizing for cpu will precompile all bitmaps beforehand, which may be faster, but might also OOM the process on large images. (Default: mem). + */ + optimization: "mem" | "cpu"; + } + + /** + * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element. + * */ + export class ANSIImageElement extends BoxElement implements IHasOptions { + constructor(options?:ANSIImageOptions); + + options: ANSIImageOptions; + + /** + * Image object from the png reader. + */ + img: Types.TImage; + + /** + * set the image in the box to a new path. + * */ + setImage(img: string, callback: () => void): void; + /** + * clear the current image. + * */ + clearImage(callback: () => void): void; + /** + * Play animation if it has been paused or stopped. + */ + play(): void; + /** + * Pause animation. + */ + pause(): void; + /** + * Stop animation. + */ + stop(): void; + } + + export interface OverlayImageOptions extends BoxOptions { + /** + * Path to image. + */ + file: string; + /** + * Render the file as ANSI art instead of using w3m to overlay Internally uses the ANSIImage element. See the ANSIImage element for more information/options. (Default: true). + */ + ansi: boolean; + /** + * Path to w3mimgdisplay. If a proper w3mimgdisplay path is not given, blessed will search the entire disk for the binary. + */ + w3m: string; + /** + * Whether to search /usr, /bin, and /lib for w3mimgdisplay (Default: true). + */ + search: string; + } + + /** + * Convert any .png file (or .gif, see below) to an ANSI image and display it as an element. + * */ + export class OverlayImageElement extends BoxElement implements IHasOptions { + constructor(options?: OverlayImageOptions); + + options: OverlayImageOptions; + + /** + * set the image in the box to a new path. + * */ + setImage(img: string, callback: () => void): void; + /** + * clear the current image. + * */ + clearImage(callback: () => void): void; + /** + * get the size of an image file in pixels. + * */ + imageSize(img:string, callback: () => void): void; + /** + * get the size of the terminal in pixels. + * */ + termSize(callback: () => void): void; + /** + * get the pixel to cell ratio for the terminal. + * */ + getPixelRatio(callback: () => void): void; + } + + export interface VideoOptions extends BoxOptions { + /** + * Video to play. + */ + file: string; + /** + * Start time in seconds. + */ + start: number; + } + + export class VideoElement extends BoxElement implements IHasOptions { + constructor(options?: VideoOptions); + + options: VideoOptions; + + /** + * The terminal element running mplayer or mpv. + */ + tty: any; + } + + export interface LayoutOptions extends ElementOptions { + /** + * A callback which is called right before the children are iterated over to be rendered. Should return an + * iterator callback which is called on each child element: iterator(el, i). + */ + renderer?: () => void; + + /** + * Using the default renderer, it provides two layouts: inline, and grid. inline is the default and will render + * akin to inline-block. grid will create an automatic grid based on element dimensions. The grid cells' + * width and height are always determined by the largest children in the layout. + */ + layout: "inline" | "inline-block" | "grid"; + } + + export class LayoutElement extends BlessedElement implements IHasOptions { + constructor(options?: LayoutOptions); + + options: LayoutOptions; + + /** + * A callback which is called right before the children are iterated over to be rendered. Should return an + * iterator callback which is called on each child element: iterator(el, i). + */ + renderer(coords: PositionCoords): void; + /** + * Check to see if a previous child element has been rendered and is visible on screen. This is only useful + * for checking child elements that have already been attempted to be rendered! see the example below. + */ + isRendered(el: BlessedElement): boolean; + /** + * Get the last rendered and visible child element based on an index. This is useful for basing the position + * of the current child element on the position of the last child element. + */ + getLast(i: number): Element; + /** + * Get the last rendered and visible child element coords based on an index. This is useful for basing the position + * of the current child element on the position of the last child element. See the example below. + */ + getLastCoords(i: number): PositionCoords; + } + + export class Program { + /** + Wrap the given text in terminal formatting codes corresponding to the given attribute + name. The `attr` string can be of the form `red fg` or `52 bg` where `52` is a 0-255 + integer color number. + */ + text (text:string, attr:string): string; + } } - export = Blessed; + export module widget { + export class Element extends Widgets.BlessedElement { } + export class Node extends Widgets.Node { } + export class Screen extends Widgets.Screen { } + + export class Box extends Widgets.BoxElement { } + export class ScrollableBox extends Widgets.ScrollableBoxElement { } + export class ScrollableText extends Widgets.ScrollableTextElement { } + export class Text extends Widgets.BoxElement { } + export class Line extends Widgets.LineElement { } + export class BigText extends Widgets.BigTextElement { } + export class List extends Widgets.ListElement { } + export class FileManager extends Widgets.FileManagerElement { } + export class ListTable extends Widgets.ListTableElement { } + export class ListBar extends Widgets.ListbarElement { } + export class Form extends Widgets.FormElement { } + export class Textarea extends Widgets.TextareaElement { } + export class Button extends Widgets.ButtonElement { } + export class Checkbox extends Widgets.CheckboxElement { } + export class RadioSet extends Widgets.RadioSetElement { } + export class RadioButton extends Widgets.RadioButtonElement { } + + export class Prompt extends Widgets.PromptElement { } + export class question extends Widgets.QuestionElement { } + export class Message extends Widgets.MessageElement { } + export class Loading extends Widgets.LoadingElement { } + + export class ProgressBar extends Widgets.ProgressBarElement { } + export class Terminal extends Widgets.TerminalElement { } + } + + export function screen(options?: Widgets.IScreenOptions): Widgets.Screen; + + export function box(options?: Widgets.BoxOptions): Widgets.BoxElement; + export function text(options?: Widgets.TextOptions): Widgets.TextElement; + export function line(options?: Widgets.LineOptions): Widgets.LineElement; + export function scrollablebox(options?: Widgets.BoxOptions): Widgets.BoxElement; + export function scrollabletext(options?: Widgets.BoxOptions): Widgets.BoxElement; + export function bigtext(options?: Widgets.BigTextOptions): Widgets.BigTextElement; + export function list(options?: Widgets.ListOptions): Widgets.ListElement; + export function filemanager(options?: Widgets.FileManagerOptions): Widgets.FileManagerElement; + export function listtable(options?: Widgets.ListTableOptions): Widgets.ListTableElement; + export function listbar(options?: Widgets.ListbarOptions): Widgets.ListbarElement; + export function form(options?: Widgets.FormOptions): Widgets.FormElement; + export function input(options?: Widgets.InputOptions): Widgets.InputElement; + export function textarea(options?: Widgets.TextareaOptions): Widgets.TextareaElement; + export function textbox(options?: Widgets.TextboxOptions): Widgets.TextboxElement; + export function button(options?: Widgets.ButtonOptions): Widgets.ButtonElement; + export function checkbox(options?: Widgets.CheckboxOptions): Widgets.CheckboxElement; + export function radioset(options?: Widgets.RadioSetOptions): Widgets.RadioSetElement; + export function radiobutton(options?: Widgets.RadioButtonOptions): Widgets.RadioButtonElement; + + export function table(options?: Widgets.TableOptions): Widgets.TableElement; + + export function prompt(options?: Widgets.PromptOptions): Widgets.PromptElement; + export function question(options?: Widgets.QuestionOptions): Widgets.QuestionElement; + export function message(options?: Widgets.MessageOptions): Widgets.MessageElement; + export function loading(options?: Widgets.LoadingOptions): Widgets.LoadingElement; + + export function progressbar(options?: Widgets.ProgressBarOptions): Widgets.ProgressBarElement; + export function terminal(options?: Widgets.TerminalOptions): Widgets.TerminalElement; + + export function layout(options?: Widgets.LayoutOptions): Widgets.LayoutElement; + + export function escape(item: any): any; + export const colors: { + match: (hexColor: string) => string + } } - - - From cef1aab3400c1bec327573860d21e4b89622a593 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 13:40:48 +0200 Subject: [PATCH 019/203] Typings for the mongoose-paginate plugin --- mongoose-paginate/mongoose-paginate.d.ts | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 mongoose-paginate/mongoose-paginate.d.ts diff --git a/mongoose-paginate/mongoose-paginate.d.ts b/mongoose-paginate/mongoose-paginate.d.ts new file mode 100644 index 0000000000..48b0282bb4 --- /dev/null +++ b/mongoose-paginate/mongoose-paginate.d.ts @@ -0,0 +1,40 @@ +/// + +declare module 'mongoose' { + export interface PaginateOptions { + select?: Object | string; + sort?: Object | string; + populate?: Array | Array | Object | string; + lean?: boolean; + leanWithId?: boolean; + offset?: number; + page?: number; + limit?: number; + } + + export interface PaginateResult { + docs: Array; + total: number; + limit: number; + page?: number; + pages?: number; + offset?: number; + } + + export type PaginateModel = _PaginateModel & Model; + interface _PaginateModel { + paginate(query?: Object, options?: PaginateOptions, callback?: (err: any, result: PaginateResult) => void): Promise>; + } + + export function model( + name: string, + schema?: Schema, + collection?: string, + skipInit?: boolean): Statics & PaginateModel; +} + +declare module 'mongoose-paginate' { + import mongoose = require('mongoose'); + var _: (schema: mongoose.Schema) => void; + export = _; +} From ab34ec01c15dedbaec3de23400e73df593b4c043 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 13:46:21 +0200 Subject: [PATCH 020/203] Typings for the passport-local-mongoose plugin --- .../passport-local-mongoose.d.ts | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 passport-local-mongoose/passport-local-mongoose.d.ts diff --git a/passport-local-mongoose/passport-local-mongoose.d.ts b/passport-local-mongoose/passport-local-mongoose.d.ts new file mode 100644 index 0000000000..c0fd0bf6de --- /dev/null +++ b/passport-local-mongoose/passport-local-mongoose.d.ts @@ -0,0 +1,83 @@ +/// +/// + +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 = _PassportLocalModel & Model; + interface _PassportLocalModel { + authenticate(): (username: string, password: string, cb: (err: any, res: T, error: any) => void) => void; + serializeUser(): (user: PassportLocalModel, cb: (err: any) => void) => void; + deserializeUser(): (username: string, cb: (err: any) => void) => void; + register(user: PassportLocalModel, 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; + + 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( + name: string, + schema?: PassportLocalSchema, + collection?: string, + skipInit?: boolean): Statics & PassportLocalModel; +} + +declare module 'passport-local-mongoose' { + import mongoose = require('mongoose'); + var _: (schema: mongoose.Schema, options?: Object) => void; + export = _; +} From c33fce7326815671fae64b7b300a2ecd4b0a0727 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 13:55:15 +0200 Subject: [PATCH 021/203] Added header --- mongoose-paginate/mongoose-paginate.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mongoose-paginate/mongoose-paginate.d.ts b/mongoose-paginate/mongoose-paginate.d.ts index 48b0282bb4..9b90c1012e 100644 --- a/mongoose-paginate/mongoose-paginate.d.ts +++ b/mongoose-paginate/mongoose-paginate.d.ts @@ -1,3 +1,7 @@ +// Type definitions for mongoose-paginate 5.0.0 +// Project: https://github.com/edwardhotchkiss/mongoose-paginate +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + /// declare module 'mongoose' { From 0bb4aa560e9838fccc2a8bbac2d8b0f834e57e2c Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 13:59:13 +0200 Subject: [PATCH 022/203] Added more information to header --- mongoose-paginate/mongoose-paginate.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/mongoose-paginate/mongoose-paginate.d.ts b/mongoose-paginate/mongoose-paginate.d.ts index 9b90c1012e..5481c42775 100644 --- a/mongoose-paginate/mongoose-paginate.d.ts +++ b/mongoose-paginate/mongoose-paginate.d.ts @@ -1,5 +1,6 @@ // Type definitions for mongoose-paginate 5.0.0 // Project: https://github.com/edwardhotchkiss/mongoose-paginate +// Definitions by: Linus Brolin , simonxca // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 096eda0b3d8fd58b96f727150ce2d58e43554f70 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 14:03:19 +0200 Subject: [PATCH 023/203] Added header --- passport-local-mongoose/passport-local-mongoose.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/passport-local-mongoose/passport-local-mongoose.d.ts b/passport-local-mongoose/passport-local-mongoose.d.ts index c0fd0bf6de..8830a927ff 100644 --- a/passport-local-mongoose/passport-local-mongoose.d.ts +++ b/passport-local-mongoose/passport-local-mongoose.d.ts @@ -1,3 +1,8 @@ +// Type definitions for passport-local-mongoose 4.0.0 +// Project: https://github.com/saintedlama/passport-local-mongoose +// Definitions by: Linus Brolin , simonxca +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + /// /// From 276a66f8e0bc20135ae5bf89733c556407b33070 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 15:22:45 +0200 Subject: [PATCH 024/203] Added tests --- .../passport-local-mongoose-tests.ts | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 passport-local-mongoose/passport-local-mongoose-tests.ts diff --git a/passport-local-mongoose/passport-local-mongoose-tests.ts b/passport-local-mongoose/passport-local-mongoose-tests.ts new file mode 100644 index 0000000000..8bdf0dded5 --- /dev/null +++ b/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -0,0 +1,133 @@ +/// + +/** + * Created by Linus Brolin . + */ + +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 = new Schema({ + username: String, + hash: String, + salt: String, + attempts: Number, + last: Date +}); + +let options: 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'; +// TODO: +// 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 = _UserModel & PassportLocalModel; +interface _UserModel {} + +let UserModel: UserModel = model('User', UserSchema) as UserModel; +//#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) => { + 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 From a8ad49221dbae4b50c0bdf0ba523c1ac69184802 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 16:01:27 +0200 Subject: [PATCH 025/203] Added reference paths --- passport-local-mongoose/passport-local-mongoose-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/passport-local-mongoose/passport-local-mongoose-tests.ts b/passport-local-mongoose/passport-local-mongoose-tests.ts index 8bdf0dded5..24e2bb9076 100644 --- a/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -1,4 +1,7 @@ /// +/// +/// +/// /** * Created by Linus Brolin . From d482fccde9bf30517fa5729760e4f1d56d66c3c2 Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 16:44:02 +0200 Subject: [PATCH 026/203] Added tests --- mongoose-paginate/mongoose-paginate-tests.ts | 75 ++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 mongoose-paginate/mongoose-paginate-tests.ts diff --git a/mongoose-paginate/mongoose-paginate-tests.ts b/mongoose-paginate/mongoose-paginate-tests.ts new file mode 100644 index 0000000000..7857ffda33 --- /dev/null +++ b/mongoose-paginate/mongoose-paginate-tests.ts @@ -0,0 +1,75 @@ +/// +/// +/// + +/** + * Created by Linus Brolin . + */ + +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 = _UserModel & PaginateModel; +interface _UserModel {} + +let UserModel: UserModel = model('User', UserSchema) as UserModel; +//#endregion + + +//#region Test Paginate +let router: Router = Router(); + +router.get('/users.json', function(req: Request, res: Response) { + let descending: boolean = true; + let options: 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) => { + 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 From 17765b050ae21b11066b5f6c9cf8d5726af69c8b Mon Sep 17 00:00:00 2001 From: linusbrolin Date: Tue, 9 Aug 2016 16:52:31 +0200 Subject: [PATCH 027/203] Added options for selectFields and populateFields, and mongoose reference --- passport-local-mongoose/passport-local-mongoose-tests.ts | 6 +++--- passport-local-mongoose/passport-local-mongoose.d.ts | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/passport-local-mongoose/passport-local-mongoose-tests.ts b/passport-local-mongoose/passport-local-mongoose-tests.ts index 24e2bb9076..cf41176f08 100644 --- a/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -2,6 +2,7 @@ /// /// /// +/// /** * Created by Linus Brolin . @@ -54,9 +55,8 @@ options.saltField = 'salt'; options.saltlen = 32; options.attemptsField = 'attempts'; options.lastLoginField = 'last'; -// TODO: -// options.selectFields = 'undefined'; -// options.populateFields = 'undefined'; +options.selectFields = 'undefined'; +options.populateFields = 'undefined'; options.encoding = 'hex'; options.limitAttempts = false; options.maxAttempts = Infinity; diff --git a/passport-local-mongoose/passport-local-mongoose.d.ts b/passport-local-mongoose/passport-local-mongoose.d.ts index 8830a927ff..8e4a6bb777 100644 --- a/passport-local-mongoose/passport-local-mongoose.d.ts +++ b/passport-local-mongoose/passport-local-mongoose.d.ts @@ -52,6 +52,9 @@ declare module 'mongoose' { usernameQueryFields: Array; + selectFields?: string; + populateFields?: string; + usernameLowerCase?: boolean; hashField?: string; From 60e569b7a2efbba308d4b6a0e03d26691936ed70 Mon Sep 17 00:00:00 2001 From: snebjorn Date: Tue, 9 Aug 2016 17:19:18 +0200 Subject: [PATCH 028/203] Rename name property from ng.IDirective Rename name property from ng.IDirective as there is no mention of this property in the official API documentation (https://docs.angularjs.org/api/ng/service/$compile) and it was causing issues with directives made as classes like so: class MyDirective implements ng.IDirective { public template = "
{{ test }}
"; public scope = { test: "=" }; public static name = "myDirective"; public static $inject: string[] = ["$http"]; constructor(private $http: ng.IHttpService) { } public link(scope: IDirectiveScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) { } } angular.module("app") .directive(MyDirective.name, DirectiveFactory.getFactoryFor(UserProjectRoles)); See http://stackoverflow.com/questions/38853868/typeerror-when-class-has-static-member-name for more details. Changing it to another non-reserved name fixes the issue. --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index e64496604f..3c13fd6cf3 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1825,7 +1825,7 @@ declare namespace angular { bindToController?: boolean | Object; link?: IDirectiveLinkFn | IDirectivePrePost; multiElement?: boolean; - name?: string; + directiveName?: string; priority?: number; /** * @deprecated From 3e18cac5fc60ccb0091bce3115e64890865253d9 Mon Sep 17 00:00:00 2001 From: Garth Kidd Date: Wed, 10 Aug 2016 10:28:40 +1000 Subject: [PATCH 029/203] Add new type definition for xmlpoke --- xmlpoke/xmlpoke-tests.ts | 83 ++++++++++++++++++++++++++++++++++++++++ xmlpoke/xmlpoke.d.ts | 45 ++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 xmlpoke/xmlpoke-tests.ts create mode 100644 xmlpoke/xmlpoke.d.ts diff --git a/xmlpoke/xmlpoke-tests.ts b/xmlpoke/xmlpoke-tests.ts new file mode 100644 index 0000000000..b77463f164 --- /dev/null +++ b/xmlpoke/xmlpoke-tests.ts @@ -0,0 +1,83 @@ +/// +/// + +// tsc xmlpoke-tests.ts && node xmlpoke-tests.js + +import * as xmlpoke from 'xmlpoke'; +import * as assert from 'assert'; + +let result: string; + +// add with xpath, value +result = xmlpoke('', xml => xml.add('/a/b', 'c')); +assert.equal(result, 'c'); + +// add with xpath, Transform +const addfn: XmlPoke.Transform = (node, value) => 'c'; +result = xmlpoke('', xml => xml.add('/a/b', addfn)); +assert.equal(result, 'c'); + +// add with xpath, CDataValue +const cdataval: XmlPoke.CDataValue = new xmlpoke.CDataValue('c'); +result = xmlpoke('', xml => xml.add('/a/b', cdataval)); +assert.equal(result, ''); + +// add with xpath, XMLVal +const xmlval = new xmlpoke.XmlString(''); +result = xmlpoke('', xml => xml.add('/a/b', xmlval)); +assert.equal(result, ''); + +// add with map +result = xmlpoke('', xml => xml.add({ + '/a/b': 'c' +})); +assert.equal(result, 'c'); + +// set with xpath, value +result = xmlpoke('b', xml => xml.set('/a', 'c')); +assert.equal(result, 'c'); + +// set with map +result = xmlpoke('b', xml => xml.set({ + '/a': 'c' +})); +assert.equal(result, 'c'); + +// set with xpath that doesn't exist (no-op) +result = xmlpoke('bval', xml => xml.set('/a/c', 'cval')); +assert.equal(result, 'bval'); + +// setOrAdd with xpath, value +result = xmlpoke('', xml => xml.setOrAdd('/a/b', 'c')); +assert.equal(result, 'c'); + +// setOrAdd with map +result = xmlpoke('', xml => xml.setOrAdd({ + '/a/b': 'c' +})); +assert.equal(result, 'c'); + +// setOrAdd with xpath that doesn't exist: add +result = xmlpoke('bval', xml => xml.setOrAdd('/a/c', 'cval')); +assert.equal(result, 'bvalcval'); + +// remove +result = xmlpoke('', xml => xml.remove('//b')); +assert.equal(result, ''); + +// clear +result = xmlpoke('', xml => xml.clear('/a')); +assert.equal(result, ''); + +// withBasePath, addNamespace, errorOnNoMatches +result = xmlpoke('', xml => + xml.withBasePath('/test') + .addNamespace('x', 'http://example.com/x') + .errorOnNoMatches() + .set('/x', (node, value) => { + assert.equal(typeof node, 'object'); + assert.equal((node.constructor as any).name, 'Element'); + assert.equal(value, 'hello'); + return 'y'; + })); +assert.equal(result, 'y'); diff --git a/xmlpoke/xmlpoke.d.ts b/xmlpoke/xmlpoke.d.ts new file mode 100644 index 0000000000..4b8868be98 --- /dev/null +++ b/xmlpoke/xmlpoke.d.ts @@ -0,0 +1,45 @@ +// Type definitions for xmlpoke 0.1.12 +// Project: https://github.com/mikeobrien/node-xmlpoke +// Definitions by: Garth Kidd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module XmlPoke { // ghost module + interface Transform { + (node: Node, value: string): Value; + } + type Value = string | boolean | number | XmlValue | CDataValue | PathToValueMap | Transform; + type PathToValueMap = { + [xpath: string]: Value; + } + interface API { + add(xpath: string, value: Value): API; + add(map: PathToValueMap): API; + set(xpath: string, value: Value): API; + set(map: PathToValueMap): API; + setOrAdd(xpath: string, value: Value): API; + setOrAdd(map: PathToValueMap): API; + remove(xpath: string): API; + clear(xpath: string): API; + withBasePath(xpath: string): API; + addNamespace(prefix: string, uri: string): API; + errorOnNoMatches(): API; + } + interface CDataValue { + value: string; + } + interface XmlValue { + value: string; + } +} + +declare module 'xmlpoke' { + const xmlpoke: { + (xml: string, modify: (api: XmlPoke.API) => void): string; + CDataValue: new (value: string) => XmlPoke.CDataValue; + XmlString: new (value: string) => XmlPoke.XmlValue; + }; + namespace xmlpoke {} + export = xmlpoke; +} From 04a5bdef672a7d5b35dec420c256d5e04659a6ea Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Wed, 10 Aug 2016 16:20:48 +0200 Subject: [PATCH 030/203] Typings for epub --- epub/epub-tests.ts | 9 +++++++ epub/epub.d.ts | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 epub/epub-tests.ts create mode 100644 epub/epub.d.ts diff --git a/epub/epub-tests.ts b/epub/epub-tests.ts new file mode 100644 index 0000000000..6e61a26634 --- /dev/null +++ b/epub/epub-tests.ts @@ -0,0 +1,9 @@ +/// +import EPub = require("epub"); + +var epub = new EPub("./file.epub"); +epub.on("end", function(){ + epub.getChapter("chapter_id", function(err: Error, text: string) {}); +}); + +epub.parse(); diff --git a/epub/epub.d.ts b/epub/epub.d.ts new file mode 100644 index 0000000000..7c813e003d --- /dev/null +++ b/epub/epub.d.ts @@ -0,0 +1,66 @@ +// Type definitions for epub +// Project: https://github.com/julien-c/epub +// Definitions by: Julien Chaumond +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * new EPub(fname[, imageroot][, linkroot]) + * - fname (String): filename for the ebook + * - imageroot (String): URL prefix for images + * - linkroot (String): URL prefix for links + * + * Creates an Event Emitter type object for parsing epub files + * + * var epub = new EPub("book.epub"); + * epub.on("end", function () { + * console.log(epub.spine); + * }); + * epub.on("error", function (error) { ... }); + * epub.parse(); + * + * Image and link URL format is: + * + * imageroot + img_id + img_zip_path + * + * So an image "logo.jpg" which resides in "OPT/" in the zip archive + * and is listed in the manifest with id "logo_img" will have the + * following url (providing that imageroot is "/images/"): + * + * /images/logo_img/OPT/logo.jpg + **/ +declare module "epub" { + + import {EventEmitter} from "events"; + + interface TocElement { + level: number; + order: number; + title: string; + id: string; + href?: string; + } + + class EPub extends EventEmitter { + constructor(epubfile: string, imagewebroot?: string, chapterwebroot?: string); + + metadata: Object; + manifest: Object; + spine: Object; + flow: Array; + toc: Array; + + parse(): void; + + getChapter(chapterId: string, callback: (error: Error, text: string) => void): void; + + getChapterRaw(chapterId: string, callback: (error: Error, text: string) => void): void; + + getImage(id: string, callback: (error: Error, data: Buffer, mimeType: string) => void): void; + + getFile(id: string, callback: (error: Error, data: Buffer, mimeType: string) => void): void; + } + + export = EPub; +} From 97451842992e45af0534b67b2efbc43e36b597a9 Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Thu, 11 Aug 2016 13:12:56 +0200 Subject: [PATCH 031/203] Added Bluebird 3.0 definitions --- bluebird/bluebird-2.0-tests.ts | 1404 ++++++++++++++++++++++++++++++ bluebird/bluebird-2.0.d.ts | 773 +++++++++++++++++ bluebird/bluebird-tests.ts | 133 +-- bluebird/bluebird.d.ts | 1460 ++++++++++++++++---------------- 4 files changed, 2914 insertions(+), 856 deletions(-) create mode 100644 bluebird/bluebird-2.0-tests.ts create mode 100644 bluebird/bluebird-2.0.d.ts diff --git a/bluebird/bluebird-2.0-tests.ts b/bluebird/bluebird-2.0-tests.ts new file mode 100644 index 0000000000..3a8ddaa383 --- /dev/null +++ b/bluebird/bluebird-2.0-tests.ts @@ -0,0 +1,1404 @@ +/// + +// Tests by: Bart van der Schoor + +// Note: replicate changes to all overloads in both definition and test file +// Note: keep both static and instance members inline (so similar) + +// Note: try to maintain the ordering and separators, and keep to the pattern + +var obj: Object; +var bool: boolean; +var num: number; +var str: string; +var err: Error; +var x: any; +var f: Function; +var func: Function; +var arr: any[]; +var exp: RegExp; +var anyArr: any[]; +var strArr: string[]; +var numArr: number[]; +var voidVar: void; + +// - - - - - - - - - - - - - - - - - + +var value: any; +var reason: any; +var insanity: any; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +interface Foo { + foo(): string; +} +interface Bar { + bar(): string; +} +interface Baz { + baz(): string; +} + +// - - - - - - - - - - - - - - - - - + +interface StrFooMap { + [key:string]:Foo; +} + +interface StrBarMap { + [key:string]:Bar; +} + +// - - - - - - - - - - - - - - - - - + +interface StrFooArrMap { + [key:string]:Foo[]; +} + +interface StrBarArrMap { + [key:string]:Bar[]; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +var foo: Foo; +var bar: Bar; +var baz: Baz; + +var fooArr: Foo[]; +var barArr: Bar[]; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +var numProm: Promise; +var strProm: Promise; +var anyProm: Promise; +var boolProm: Promise; +var objProm: Promise; +var voidProm: Promise; + +var fooProm: Promise; +var barProm: Promise; +var fooOrBarProm: Promise; +var bazProm: Promise; + +// - - - - - - - - - - - - - - - - - + +var numThen: PromiseLike; +var strThen: PromiseLike; +var anyThen: PromiseLike; +var boolThen: PromiseLike; +var objThen: PromiseLike; +var voidThen: PromiseLike; + +var fooThen: PromiseLike; +var barThen: PromiseLike; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +var numArrProm: Promise; +var strArrProm: Promise; +var anyArrProm: Promise; + +var fooArrProm: Promise; +var barArrProm: Promise; + +// - - - - - - - - - - - - - - - - - + +var numArrThen: PromiseLike; +var strArrThen: PromiseLike; +var anyArrThen: PromiseLike; + +var fooArrThen: PromiseLike; +var barArrThen: PromiseLike; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +var numPromArr: Promise[]; +var strPromArr: Promise[]; +var anyPromArr: Promise[]; + +var fooPromArr: Promise[]; +var barPromArr: Promise[]; + +// - - - - - - - - - - - - - - - - - + +var numThenArr: PromiseLike[]; +var strThenArr: PromiseLike[]; +var anyThenArr: PromiseLike[]; + +var fooThenArr: PromiseLike[]; +var barThenArr: PromiseLike[]; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// booya! +var fooThenArrThen: PromiseLike[]>; +var barThenArrThen: PromiseLike[]>; + +var fooResolver: Promise.Resolver; +var barResolver: Promise.Resolver; + +var fooInspection: Promise.Inspection; +var barInspection: Promise.Inspection; + +var fooInspectionArrProm: Promise[]>; +var barInspectionArrProm: Promise[]>; + +var BlueBird: typeof Promise; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +var nodeCallbackFunc = (callback: (err: any, result: string) => void) => {} +var nodeCallbackFuncErrorOnly = (callback: (err: any) => void) => {} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooThen = fooProm; +barThen = barProm; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = new Promise((resolve: (value: Foo) => void, reject: (reason: any) => void) => { + if (bool) { + resolve(foo); + } + else { + reject(new Error(str)); + } +}); +fooProm = new Promise((resolve: (value: Foo) => void) => { + if (bool) { + resolve(foo); + } +}); + +// - - - - - - - - - - - - - - - - - - - - - - - + +// needs a hint when used untyped? +fooProm = new Promise((resolve, reject) => { + if (bool) { + resolve(fooThen); + } + else { + reject(new Error(str)); + } +}); +fooProm = new Promise((resolve) => { + resolve(fooThen); +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooResolver.resolve(foo); + +fooResolver.reject(err); + +fooResolver.progress(bar); + +fooResolver.callback = (err: any, value: Foo) => { + +}; + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +bool = fooInspection.isFulfilled(); + +bool = fooInspection.isRejected(); + +bool = fooInspection.isPending(); + +foo = fooInspection.value(); + +x = fooInspection.reason(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooProm.then((value: Foo) => { + return bar; +}, (reason: any) => { + return bar; +}, (note: any) => { + return bar; +}); +barProm = fooProm.then((value: Foo) => { + return bar; +}, (reason: any) => { + return bar; +}); +barProm = fooProm.then((value: Foo) => { + return bar; +}, (reason: any) => { + return barProm; +}); +barProm = fooProm.then((value: Foo) => { + return bar; +}, (reason: any) => { + return; +}); +barProm = fooProm.then((value: Foo) => { + return bar; +}, (reason: any) => { + return voidProm; +}); +barProm = fooProm.then((value: Foo) => { + return bar; +}); +barProm = barProm.then((value: Bar) => { + if (value) return value; + var b:Bar; + return Promise.resolve(b); +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.catch((reason: any) => { + return; +}); + +fooProm = fooProm.caught((reason: any) => { + return; +}); +fooProm = fooProm.catch((error: any) => { + return true; +}, (reason: any) => { + return; +}); +fooProm = fooProm.caught((error: any) => { + return true; +}, (reason: any) => { + return; +}); + +fooProm = fooProm.catch((reason: any) => { + return voidProm; +}); + +fooProm = fooProm.caught((reason: any) => { + return voidProm; +}); +fooProm = fooProm.catch((error: any) => { + return true; +}, (reason: any) => { + return voidProm; +}); +fooProm = fooProm.caught((error: any) => { + return true; +}, (reason: any) => { + return voidProm; +}); + +fooProm = fooProm.catch((reason: any) => { + //handle multiple valid return types simultaneously + if (foo === null) { + return; + } else if (!reason) { + return voidProm; + } else if (foo) { + return foo; + } +}); + +fooOrBarProm = fooProm.catch((reason: any) => { + return bar; +}); +fooOrBarProm = fooProm.caught((reason: any) => { + return bar; +}); + +fooOrBarProm = fooProm.catch((error: any) => { + return true; +}, (reason: any) => { + return bar; +}); +fooOrBarProm = fooProm.caught((error: any) => { + return true; +}, (reason: any) => { + return bar; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.catch(Error, (reason: any) => { + return; +}); +fooProm = fooProm.catch(Promise.CancellationError, (reason: any) => { + return; +}); +fooProm = fooProm.caught(Error, (reason: any) => { + return; +}); +fooProm = fooProm.caught(Promise.CancellationError, (reason: any) => { + return; +}); + +fooOrBarProm = fooProm.catch(Error, (reason: any) => { + return bar; +}); +fooOrBarProm = fooProm.catch(Promise.CancellationError, (reason: any) => { + return bar; +}); +fooOrBarProm = fooProm.caught(Error, (reason: any) => { + return bar; +}); +fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => { + return bar; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooProm.error((reason: any) => { + return bar; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.finally(() => { + // non-Thenable return is ignored + return "foo"; +}); +fooProm = fooProm.finally(() => { + return fooThen; +}); +fooProm = fooProm.finally(() => { + // non-Thenable return is ignored +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.lastly(() => { + // non-Thenable return is ignored + return "foo"; +}); +fooProm = fooProm.lastly(() => { + return fooThen; +}); +fooProm = fooProm.lastly(() => { + // non-Thenable return is ignored +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.bind(obj); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +voidVar = fooProm.done((value: Foo) => { + return bar; +}, (reason: any) => { + return bar; +}, (note: any) => { + +}); +voidVar = fooProm.done((value: Foo) => { + return bar; +}, (reason: any) => { + return bar; +}); +voidVar = fooProm.done((value: Foo) => { + return bar; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +voidVar = fooProm.done((value: Foo) => { + return barThen; +}, (reason: any) => { + return barThen; +}, (note: any) => { + +}); +voidVar = fooProm.done((value: Foo) => { + return barThen; +}, (reason: any) => { + return barThen; +}); +voidVar = fooProm.done((value: Foo) => { + return barThen; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.tap((value: Foo) => { + // non-Thenable return is ignored + return "foo"; +}); +fooProm = fooProm.tap((value: Foo) => { + return fooThen; +}); +fooProm = fooProm.tap((value: Foo) => { + return voidThen; +}); +fooProm = fooProm.tap(() => { + // non-Thenable return is ignored +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.progressed((note: any) => { + return foo; +}); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.delay(num); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.timeout(num); +fooProm = fooProm.timeout(num, str); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm.nodeify(); +fooProm = fooProm.nodeify((err: any) => { }); +fooProm = fooProm.nodeify((err: any, foo?: Foo) => { }); + +fooProm.nodeify({ spread: true }); +fooProm = fooProm.nodeify((err: any) => { }, { spread: true }); +fooProm = fooProm.nodeify((err: any, foo?: Foo) => { }, { spread: true }); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooProm.fork((value: Foo) => { + return bar; +}, (reason: any) => { + return bar; +}, (note: any) => { + +}); +barProm = fooProm.fork((value: Foo) => { + return bar; +}, (reason: any) => { + return bar; +}); +barProm = fooProm.fork((value: Foo) => { + return bar; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooProm.fork((value: Foo) => { + return barThen; +}, (reason: any) => { + return barThen; +}, (note: any) => { + +}); +barProm = fooProm.fork((value: Foo) => { + return barThen; +}, (reason: any) => { + return barThen; +}); +barProm = fooProm.fork((value: Foo) => { + return barThen; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooProm.cancel(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = fooProm.cancellable(); +fooProm = fooProm.uncancellable(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +bool = fooProm.isCancellable(); +bool = fooProm.isFulfilled(); +bool = fooProm.isRejected(); +bool = fooProm.isPending(); +bool = fooProm.isResolved(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooInspection = fooProm.inspect(); + +anyProm = fooProm.call(str); +anyProm = fooProm.call(str, 1, 2, 3); + +//TODO enable get() test when implemented +// barProm = fooProm.get(str); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooProm.return(bar); +barProm = fooProm.thenReturn(bar); + +voidProm = fooProm.return(); +voidProm = fooProm.thenReturn(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooProm +fooProm = fooProm.throw(err); +fooProm = fooProm.thenThrow(err); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +str = fooProm.toString(); + +obj = fooProm.toJSON(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooArrProm.spread((one: Foo, two: Bar) => { + return bar; +}, (reason: any) => { + return bar; +}); +barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { + return bar; +}); + +// - - - - - - - - - - - - - - - - - + +barProm = fooArrProm.spread((one: Foo, two: Bar) => { + return barThen; +}, (reason: any) => { + return barThen; +}); +barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { + return barThen; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO fix collection inference + +barArrProm = fooProm.all(); + +objProm = fooProm.props(); + +barInspectionArrProm = fooProm.settle(); + +barProm = fooProm.any(); + +barArrProm = fooProm.some(num); + +barProm = fooProm.race(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +Promise.all([fooProm, barProm]).then(result => { + result[0].foo(); + result[1].bar(); +}); + +Promise.all([fooProm, fooProm]).then(result => { + result[0].foo(); + result[1].foo(); +}); + +Promise.all([fooProm, barProm, bazProm]).then(result => { + result[0].foo(); + result[1].bar(); + result[2].baz(); +}); + +Promise.all([fooProm, barProm, fooProm]).then(result => { + result[0].foo(); + result[1].bar(); + result[2].foo(); +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO fix collection inference + +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = fooArrProm.map((item: Foo) => { + return bar; +}); + +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = fooArrProm.map((item: Foo) => { + return bar; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barArrProm = fooArrProm.mapSeries((item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = fooArrProm.mapSeries((item: Foo) => { + return bar; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooArrProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { + return memo; +}); +barProm = fooArrProm.reduce((memo: Bar, item: Foo) => { + return memo; +}, bar); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { + return bool; +}); +fooArrProm = fooArrProm.filter((item: Foo) => { + return bool; +}); + +fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = fooArrProm.filter((item: Foo) => { + return bool; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooArrProm = fooArrProm.each((item: Foo): Bar => bar); +fooArrProm = fooArrProm.each((item: Foo, index: number): Bar => index ? bar : null); +fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Bar => bar); +fooArrProm = fooArrProm.each((item: Foo, index: number, arrayLength: number): Promise => barProm); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +function getMaybePromise(): Foo|Promise { + return foo; +} + +fooProm = Promise.try(() => { + return getMaybePromise(); +}); +fooProm = Promise.try(() => { + return getMaybePromise(); +}); +fooProm = Promise.try(() => { + return foo; +}); +fooProm = Promise.try(() => { + return foo; +}, arr); +fooProm = Promise.try(() => { + return foo; +}, arr, x); + +// - - - - - - - - - - - - - - - - - + +fooProm = Promise.try(() => { + return fooThen; +}); +fooProm = Promise.try(() => { + return fooThen; +}, arr); +fooProm = Promise.try(() => { + return fooThen; +}, arr, x); + +// - - - - - - - - - - - - - - - - - + +fooProm = Promise.try(() => { + if (fooProm) { + return fooProm; + } + return foo; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = Promise.attempt(() => { + return getMaybePromise(); +}); +fooProm = Promise.attempt(() => { + return getMaybePromise(); +}); +fooProm = Promise.attempt(() => { + return foo; +}); +fooProm = Promise.attempt(() => { + return foo; +}, arr); +fooProm = Promise.attempt(() => { + return foo; +}, arr, x); + +// - - - - - - - - - - - - - - - - - + +fooProm = Promise.attempt(() => { + if (fooProm) { + return fooProm; + } + return foo; +}); + +// - - - - - - - - - - - - - - - - - + +fooProm = Promise.attempt(() => { + return fooThen; +}); +fooProm = Promise.attempt(() => { + return fooThen; +}, arr); +fooProm = Promise.attempt(() => { + return fooThen; +}, arr, x); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +func = Promise.method(function () { + +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = Promise.resolve(foo); +fooProm = Promise.resolve(fooThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +voidProm = Promise.reject(reason); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooResolver = Promise.defer(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooProm = Promise.cast(foo); +fooProm = Promise.cast(fooThen); + +voidProm = Promise.bind(x); + +bool = Promise.is(value); + +Promise.longStackTraces(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO enable delay + +fooProm = Promise.delay(num, fooThen); +fooProm = Promise.delay(num, foo); +voidProm = Promise.delay(num); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +func = Promise.promisify(f); +func = Promise.promisify(f, obj); + +obj = Promise.promisifyAll(obj); +anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback)); +anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback)); +anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback), {multiArgs : true}); +anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true}); + +anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback)); +anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback)); +anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback), {multiArgs : true}); +anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +declare var util: any; + +function defaultFilter(name: string, func: Function) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + !util.isClass(func); +} + +function DOMPromisifier(originalMethod: Function) { + // return a function + return function promisified() { + var args = [].slice.call(arguments); + // Needed so that the original method can be called with the correct receiver + var self = this; + // which returns a promise + return new Promise(function(resolve, reject) { + args.push(resolve, reject); + originalMethod.apply(self, args); + }); + }; +} + +obj = Promise.promisifyAll(obj, { + suffix: "", + filter: defaultFilter, + promisifier: DOMPromisifier +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO enable generator +/* + func = Promise.coroutine(f); + + barProm = Promise.spawn(f); + */ +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +BlueBird = Promise.noConflict(); + +Promise.onPossiblyUnhandledRejection((reason: any) => { + +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO expand tests to overloads +fooArrProm = Promise.all(fooThenArrThen); +fooArrProm = Promise.all(fooArrProm); +fooArrProm = Promise.all(fooThenArr); +fooArrProm = Promise.all(fooArr); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +objProm = Promise.props(objProm); +objProm = Promise.props(obj); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO expand tests to overloads +fooInspectionArrProm = Promise.settle(fooThenArrThen); +fooInspectionArrProm = Promise.settle(fooArrProm); +fooInspectionArrProm = Promise.settle(fooThenArr); +fooInspectionArrProm = Promise.settle(fooArr); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO expand tests to overloads +fooProm = Promise.any(fooThenArrThen); +fooProm = Promise.any(fooArrProm); +fooProm = Promise.any(fooThenArr); +fooProm = Promise.any(fooArr); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO expand tests to overloads +fooProm = Promise.race(fooThenArrThen); +fooProm = Promise.race(fooArrProm); +fooProm = Promise.race(fooThenArr); +fooProm = Promise.race(fooArr); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +//TODO expand tests to overloads +fooArrProm = Promise.some(fooThenArrThen, num); +fooArrProm = Promise.some(fooArrThen, num); +fooArrProm = Promise.some(fooThenArr, num); +fooArrProm = Promise.some(fooArr, num); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +fooArrProm = Promise.join(foo, foo, foo); +fooArrProm = Promise.join(fooThen, fooThen, fooThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// map() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +barArrProm = Promise.map(fooThenArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +barArrProm = Promise.map(fooThenArrThen, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +barArrProm = Promise.map(fooArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.map(fooArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +barArrProm = Promise.map(fooArrThen, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArrThen, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +barArrProm = Promise.map(fooThenArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.map(fooThenArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +barArrProm = Promise.map(fooThenArr, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArr, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +barArrProm = Promise.map(fooArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.map(fooArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +barArrProm = Promise.map(fooArr, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArr, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// mapSeries() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +barArrProm = Promise.mapSeries(fooArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// reduce() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo) => { + return memo; +}, bar); +barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo) => { + return barThen; +}, bar); +barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return memo; +}, bar); +barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return barThen; +}, bar); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo) => { + return memo; +}, bar); +barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo) => { + return barThen; +}, bar); +barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return memo; +}, bar); +barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return barThen; +}, bar); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo) => { + return memo; +}, bar); +barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo) => { + return barThen; +}, bar); +barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return memo; +}, bar); +barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return barThen; +}, bar); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo) => { + return memo; +}, bar); +barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo) => { + return barThen; +}, bar); +barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return memo; +}, bar); +barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => { + return barThen; +}, bar); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// filter() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => { + return bool; +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => { + return boolThen; +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bool; +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}); + +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +fooArrProm = Promise.filter(fooArrThen, (item: Foo) => { + return bool; +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo) => { + return boolThen; +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bool; +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}); + +fooArrProm = Promise.filter(fooArrThen, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +fooArrProm = Promise.filter(fooThenArr, (item: Foo) => { + return bool; +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo) => { + return boolThen; +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bool; +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}); + +fooArrProm = Promise.filter(fooThenArr, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +fooArrProm = Promise.filter(fooArr, (item: Foo) => { + return bool; +}); +fooArrProm = Promise.filter(fooArr, (item: Foo) => { + return boolThen; +}); +fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bool; +}); +fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}); + +fooArrProm = Promise.filter(fooArr, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArr, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// each() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +fooArrThen = Promise.each(fooThenArrThen, (item: Foo) => bar); +fooArrThen = Promise.each(fooThenArrThen, (item: Foo) => barThen); +fooArrThen = Promise.each(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +fooArrThen = Promise.each(fooArrThen, (item: Foo) => bar); +fooArrThen = Promise.each(fooArrThen, (item: Foo) => barThen); +fooArrThen = Promise.each(fooArrThen, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooArrThen, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +fooArrThen = Promise.each(fooThenArr, (item: Foo) => bar); +fooArrThen = Promise.each(fooThenArr, (item: Foo) => barThen); +fooArrThen = Promise.each(fooThenArr, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooThenArr, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +fooArrThen = Promise.each(fooArr, (item: Foo) => bar); +fooArrThen = Promise.each(fooArr, (item: Foo) => barThen); +fooArrThen = Promise.each(fooArr, (item: Foo, index: number, arrayLength: number) => bar); +fooArrThen = Promise.each(fooArr, (item: Foo, index: number, arrayLength: number) => barThen); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluebird/bluebird-2.0.d.ts b/bluebird/bluebird-2.0.d.ts new file mode 100644 index 0000000000..34659859cb --- /dev/null +++ b/bluebird/bluebird-2.0.d.ts @@ -0,0 +1,773 @@ +// Type definitions for bluebird 2.0.0 +// Project: https://github.com/petkaantonov/bluebird +// Definitions by: Bart van der Schoor , falsandtru +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts +// By: Campredon + +// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code): +// - https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1563 + +// Note: replicate changes to all overloads in both definition and test file +// Note: keep both static and instance members inline (so similar) + +// TODO fix remaining TODO annotations in both definition and test + +// TODO verify support to have no return statement in handlers to get a Promise (more overloads?) + +declare var Promise: PromiseConstructor; + +interface PromiseCancelHandlerSetter { + (handler: () => void): void; +} + +interface PromiseConstructor { + /** + * Create a new promise. The passed in function will receive functions + * `resolve` and `reject` as its arguments which can be called to seal the + * fate of the created promise. + * + * If configured appropriately, it will also receive an `onCancel` + * function that can be used to configure a promise cancellation handler. + */ + new (callback: ( + resolve: (thenableOrResult?: T | PromiseLike) => void, + reject: (error: any) => void, + onCancel?: PromiseCancelHandlerSetter + ) => void): Promise; + + config(options: { + warnings?: boolean | {wForgottenReturn?: boolean}; + longStackTraces?: boolean; + cancellation?: boolean; + monitoring?: boolean; + }): void; + + // Ideally, we'd define e.g. "export class RangeError extends Error {}", + // but as Error is defined as an interface (not a class), TypeScript doesn't + // allow extending Error, only implementing it. + // However, if we want to catch() only a specific error type, we need to pass + // a constructor function to it. So, as a workaround, we define them here as such. + RangeError(): RangeError; + CancellationError(): Promise.CancellationError; + TimeoutError(): Promise.TimeoutError; + TypeError(): Promise.TypeError; + RejectionError(): Promise.RejectionError; + OperationalError(): Promise.OperationalError; + + /** + * Changes how bluebird schedules calls a-synchronously. + * + * @param scheduler Should be a function that asynchronously schedules + * the calling of the passed in function + */ + setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; + + /** + * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. + * + * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. + * + * Alias for `attempt();` for compatibility with earlier ECMAScript version. + */ + try(fn: () => T | PromiseLike, args?: any[], ctx?: any): Promise; + + attempt(fn: () => T | PromiseLike, args?: any[], ctx?: any): Promise; + + /** + * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. + * This method is convenient when a function can sometimes return synchronously or throw synchronously. + */ + method(fn: Function): Function; + + /** + * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. + */ + resolve(value: T | PromiseLike): Promise; + resolve(): Promise; + + /** + * Create a promise that is rejected with the given `reason`. + */ + reject(reason: any): Promise; + reject(reason: any): Promise; + + /** + * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). + */ + defer(): Promise.Resolver; + + /** + * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. + */ + cast(value: T | PromiseLike): Promise; + + /** + * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. + */ + bind(thisArg: any): Promise; + + /** + * See if `value` is a trusted Promise. + */ + is(value: any): boolean; + + /** + * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. + */ + longStackTraces(): void; + + /** + * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. + */ + // TODO enable more overloads + delay(ms: number, value: T | PromiseLike): Promise; + delay(ms: number): Promise; + + /** + * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. + * + * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. + * + * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. + */ + promisify(func: (callback: (err: any, result: T) => void) => void, receiver?: any): () => Promise; + promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise; + promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise; + promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise; + promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise; + promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise; + promisify(nodeFunction: Function, receiver?: any): Function; + + /** + * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. + * + * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. + */ + // TODO how to model promisifyAll? + promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; + + + /** + * Returns a promise that is resolved by a node style callback function. + */ + fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; + fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; + + /** + * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + */ + // TODO fix coroutine GeneratorFunction + coroutine(generatorFunction: Function): Function; + + /** + * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + */ + // TODO fix spawn GeneratorFunction + spawn(generatorFunction: Function): Promise; + + /** + * This is relevant to browser environments with no module loader. + * + * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. + */ + noConflict(): typeof Promise; + + /** + * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. + * + * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. + */ + onPossiblyUnhandledRejection(handler: (reason: any) => any): void; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. + */ + // TODO enable more overloads + // promise of array with promises of value + all(values: PromiseLike[]>): Promise; + // promise of array with values + all(values: PromiseLike): Promise; + // array with promises of value + all(values: PromiseLike[]): Promise; + // array with promises of different types + all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4]>; + all(values: [PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3]>; + all(values: [PromiseLike, PromiseLike]): Promise<[T1, T2]>; + // array with values + all(values: T[]): Promise; + + /** + * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. + * + * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. + * + * *The original object is not modified.* + */ + // TODO verify this is correct + // trusted promise for object + props(object: Promise): Promise; + // object + props(object: Object): Promise; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array. + * + * *original: The array is not modified. The input array sparsity is retained in the resulting array.* + */ + // promise of array with promises of value + settle(values: PromiseLike[]>): Promise[]>; + // promise of array with values + settle(values: PromiseLike): Promise[]>; + // array with promises of value + settle(values: PromiseLike[]): Promise[]>; + // array with values + settle(values: T[]): Promise[]>; + + /** + * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. + */ + // promise of array with promises of value + any(values: PromiseLike[]>): Promise; + // promise of array with values + any(values: PromiseLike): Promise; + // array with promises of value + any(values: PromiseLike[]): Promise; + // array with values + any(values: T[]): Promise; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. + * + * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. + */ + // promise of array with promises of value + race(values: PromiseLike[]>): Promise; + // promise of array with values + race(values: PromiseLike): Promise; + // array with promises of value + race(values: PromiseLike[]): Promise; + // array with values + race(values: T[]): Promise; + + /** + * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. + * + * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + some(values: PromiseLike[]>, count: number): Promise; + // promise of array with values + some(values: PromiseLike, count: number): Promise; + // array with promises of value + some(values: PromiseLike[], count: number): Promise; + // array with values + some(values: T[], count: number): Promise; + + /** + * Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments. + */ + // variadic array with promises of value + join(...values: PromiseLike[]): Promise; + // variadic array with values + join(...values: T[]): Promise; + + /** + * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + map(values: PromiseLike[]>, mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; + + // promise of array with values + map(values: PromiseLike, mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; + + // array with promises of value + map(values: PromiseLike[], mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; + + // array with values + map(values: T[], mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; + + /** + * Similar to `map` with concurrency set to 1 but guaranteed to execute in sequential order + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + mapSeries(values: PromiseLike[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; + + // promise of array with values + mapSeries(values: PromiseLike, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; + + // array with promises of value + mapSeries(values: PromiseLike[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; + + // array with values + mapSeries(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; + + + /** + * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + * + * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* + */ + // promise of array with promises of value + reduce(values: PromiseLike[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; + + // promise of array with values + reduce(values: PromiseLike, reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; + + // array with promises of value + reduce(values: PromiseLike[], reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; + + // array with values + reduce(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; + + /** + * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. + * + * *The original array is not modified. + */ + // promise of array with promises of value + filter(values: PromiseLike[]>, filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; + + // promise of array with values + filter(values: PromiseLike, filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; + + // array with promises of value + filter(values: PromiseLike[], filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; + + // array with values + filter(values: T[], filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; + + /** + * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. + * + * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + */ + // promise of array with promises of value + each(values: PromiseLike[]>, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; + // array with promises of value + each(values: PromiseLike[], iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; + // array with values OR promise of array with values + each(values: T[] | PromiseLike, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; +} + +interface Promise extends PromiseLike, Promise.Inspection { + /** + * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. + */ + then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): Promise; + then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => void | PromiseLike, onProgress?: (note: any) => any): Promise; + + /** + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + caught(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + + catch(onReject?: (error: any) => U | PromiseLike): Promise; + caught(onReject?: (error: any) => U | PromiseLike): Promise; + + /** + * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * + * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + caught(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + + catch(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; + caught(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; + + catch(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + caught(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; + + catch(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; + caught(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; + + + /** + * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. + */ + error(onReject: (reason: any) => PromiseLike): Promise; + error(onReject: (reason: any) => U): Promise; + + /** + * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. + * + * Alias `.lastly();` for compatibility with earlier ECMAScript version. + */ + finally(handler: () => U | PromiseLike): Promise; + + lastly(handler: () => U | PromiseLike): Promise; + + /** + * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. + */ + bind(thisArg: any): Promise; + + /** + * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. + */ + done(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): void; + done(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): void; + + /** + * Like `.finally()`, but not called for rejections. + */ + tap(onFulFill: (value: T) => U | PromiseLike): Promise; + + /** + * Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. + */ + progressed(handler: (note: any) => any): Promise; + + /** + * Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + delay(ms: number): Promise; + + /** + * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance. + * + * You may specify a custom error message with the `message` parameter. + */ + timeout(ms: number, message?: string): Promise; + + /** + * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. + * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. + */ + nodeify(callback: (err: any, value?: T) => void, options?: Promise.SpreadOption): Promise; + nodeify(...sink: any[]): Promise; + + /** + * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. + */ + cancellable(): Promise; + + /** + * Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending. + * + * That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason. + * + * In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`. + * + * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. + */ + // TODO what to do with this? + cancel(reason?: any): Promise; + + /** + * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. + */ + fork(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): Promise; + + /** + * Create an uncancellable promise based on this promise. + */ + uncancellable(): Promise; + + /** + * See if this promise can be cancelled. + */ + isCancellable(): boolean; + + /** + * See if this `promise` has been fulfilled. + */ + isFulfilled(): boolean; + + /** + * See if this `promise` has been rejected. + */ + isRejected(): boolean; + + /** + * See if this `promise` is still defer. + */ + isPending(): boolean; + + /** + * See if this `promise` is resolved -> either fulfilled or rejected. + */ + isResolved(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. + * + * throws `TypeError` + */ + value(): T; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. + * + * throws `TypeError` + */ + reason(): any; + + /** + * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`. + */ + inspect(): Promise.Inspection; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName].call(obj, arg...); + * }); + * + */ + call(propertyName: string, ...args: any[]): Promise; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName]; + * }); + * + */ + // TODO find way to fix get() + // get(propertyName: string): Promise; + + /** + * Convenience method for: + * + * + * .then(function() { + * return value; + * }); + * + * + * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` + * + * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. + */ + return(): Promise; + thenReturn(): Promise; + return(value: U): Promise; + thenReturn(value: U): Promise; + + /** + * Convenience method for: + * + * + * .then(function() { + * throw reason; + * }); + * + * Same limitations apply as with `.return()`. + * + * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. + */ + throw(reason: Error): Promise; + thenThrow(reason: Error): Promise; + + /** + * Convert to String. + */ + toString(): string; + + /** + * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. + */ + toJSON(): Object; + + /** + * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. + */ + // TODO how to model instance.spread()? like Q? + spread(onFulfill: Function, onReject?: (reason: any) => U | PromiseLike): Promise; + /* + // TODO or something like this? + spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => PromiseLike): Promise; + spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => U): Promise; + spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => PromiseLike): Promise; + spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise; + */ + /** + * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + all(): Promise; + + /** + * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO how to model instance.props()? + props(): Promise; + + /** + * Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + settle(): Promise[]>; + + /** + * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + any(): Promise; + + /** + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + some(count: number): Promise; + + /** + * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + race(): Promise; + + /** + * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + map(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; + + /** + * Same as `Promise.mapSeries(thisPromise, mapper)`. + */ + // TODO type inference from array-resolving promise? + mapSeries(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike): Promise; + + /** + * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; + + /** + * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + filter(filterer: (item: U, index: number, arrayLength: number) => boolean | PromiseLike, options?: Promise.ConcurrencyOption): Promise; + + /** + * Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + each(iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; +} + +/** + * Don't use variable namespace such as variables, functions, and classes. + * If you use this namespace, it will conflict in es6. + */ +declare namespace Promise { + export interface RangeError extends Error { + } + export interface CancellationError extends Error { + } + export interface TimeoutError extends Error { + } + export interface TypeError extends Error { + } + export interface RejectionError extends Error { + } + export interface OperationalError extends Error { + } + + export interface ConcurrencyOption { + concurrency: number; + } + export interface SpreadOption { + spread: boolean; + } + export interface PromisifyAllOptions { + suffix?: string; + filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; + // The promisifier gets a reference to the original method and should return a function which returns a promise + promisifier?: (originalMethod: Function) => () => PromiseLike; + } + + export interface Resolver { + /** + * Returns a reference to the controlled promise that can be passed to clients. + */ + promise: Promise; + + /** + * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. + */ + resolve(value: T): void; + resolve(): void; + + /** + * Reject the underlying promise with `reason` as the rejection reason. + */ + reject(reason: any): void; + + /** + * Progress the underlying promise with `value` as the progression value. + */ + progress(value: any): void; + + /** + * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. + * + * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. + */ + // TODO specify resolver callback + callback: (err: any, value: T, ...values: T[]) => void; + } + + export interface Inspection { + /** + * See if the underlying promise was fulfilled at the creation time of this inspection object. + */ + isFulfilled(): boolean; + + /** + * See if the underlying promise was rejected at the creation time of this inspection object. + */ + isRejected(): boolean; + + /** + * See if the underlying promise was defer at the creation time of this inspection object. + */ + isPending(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. + * + * throws `TypeError` + */ + value(): T; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. + * + * throws `TypeError` + */ + reason(): any; + } +} + +declare module 'bluebird' { + export = Promise; +} diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index a24cdfd7ee..59cef89b1a 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -7,6 +7,8 @@ // Note: try to maintain the ordering and separators, and keep to the pattern +import Promise = require("bluebird"); + var obj: Object; var bool: boolean; var num: number; @@ -141,7 +143,7 @@ var fooResolver: Promise.Resolver; var barResolver: Promise.Resolver; var fooInspection: Promise.Inspection; -var barInspection: Promise.Inspection; +var fooInspectionPromise: Promise>; var fooInspectionArrProm: Promise[]>; var barInspectionArrProm: Promise[]>; @@ -195,8 +197,6 @@ fooResolver.resolve(foo); fooResolver.reject(err); -fooResolver.progress(bar); - fooResolver.callback = (err: any, value: Foo) => { }; @@ -204,24 +204,13 @@ fooResolver.callback = (err: any, value: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool = fooInspection.isFulfilled(); - bool = fooInspection.isRejected(); - bool = fooInspection.isPending(); - foo = fooInspection.value(); - x = fooInspection.reason(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooProm.then((value: Foo) => { - return bar; -}, (reason: any) => { - return bar; -}, (note: any) => { - return bar; -}); barProm = fooProm.then((value: Foo) => { return bar; }, (reason: any) => { @@ -384,13 +373,6 @@ fooProm = fooProm.bind(obj); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -voidVar = fooProm.done((value: Foo) => { - return bar; -}, (reason: any) => { - return bar; -}, (note: any) => { - -}); voidVar = fooProm.done((value: Foo) => { return bar; }, (reason: any) => { @@ -402,13 +384,6 @@ voidVar = fooProm.done((value: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -voidVar = fooProm.done((value: Foo) => { - return barThen; -}, (reason: any) => { - return barThen; -}, (note: any) => { - -}); voidVar = fooProm.done((value: Foo) => { return barThen; }, (reason: any) => { @@ -436,11 +411,6 @@ fooProm = fooProm.tap(() => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooProm = fooProm.progressed((note: any) => { - return foo; -}); -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fooProm = fooProm.delay(num); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -460,52 +430,11 @@ fooProm = fooProm.nodeify((err: any, foo?: Foo) => { }, { spread: true }); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooProm.fork((value: Foo) => { - return bar; -}, (reason: any) => { - return bar; -}, (note: any) => { - -}); -barProm = fooProm.fork((value: Foo) => { - return bar; -}, (reason: any) => { - return bar; -}); -barProm = fooProm.fork((value: Foo) => { - return bar; -}); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooProm.fork((value: Foo) => { - return barThen; -}, (reason: any) => { - return barThen; -}, (note: any) => { - -}); -barProm = fooProm.fork((value: Foo) => { - return barThen; -}, (reason: any) => { - return barThen; -}); -barProm = fooProm.fork((value: Foo) => { - return barThen; -}); +voidVar = fooProm.cancel(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooProm.cancel(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooProm = fooProm.cancellable(); -fooProm = fooProm.uncancellable(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool = fooProm.isCancellable(); +bool = fooProm.isCancelled(); bool = fooProm.isFulfilled(); bool = fooProm.isRejected(); bool = fooProm.isPending(); @@ -513,8 +442,6 @@ bool = fooProm.isResolved(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fooInspection = fooProm.inspect(); - anyProm = fooProm.call(str); anyProm = fooProm.call(str, 1, 2, 3); @@ -543,22 +470,12 @@ obj = fooProm.toJSON(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooArrProm.spread((one: Foo, two: Bar) => { - return bar; -}, (reason: any) => { - return bar; -}); barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { return bar; }); // - - - - - - - - - - - - - - - - - -barProm = fooArrProm.spread((one: Foo, two: Bar) => { - return barThen; -}, (reason: any) => { - return barThen; -}); barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { return barThen; }); @@ -568,15 +485,10 @@ barProm = fooArrProm.spread((one: Foo, two: Bar, twotwo: Foo) => { //TODO fix collection inference barArrProm = fooProm.all(); - objProm = fooProm.props(); - -barInspectionArrProm = fooProm.settle(); - +fooInspectionPromise = fooProm.reflect(); barProm = fooProm.any(); - barArrProm = fooProm.some(num); - barProm = fooProm.race(); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -686,24 +598,12 @@ fooProm = Promise.try(() => { fooProm = Promise.try(() => { return foo; }); -fooProm = Promise.try(() => { - return foo; -}, arr); -fooProm = Promise.try(() => { - return foo; -}, arr, x); // - - - - - - - - - - - - - - - - - fooProm = Promise.try(() => { return fooThen; }); -fooProm = Promise.try(() => { - return fooThen; -}, arr); -fooProm = Promise.try(() => { - return fooThen; -}, arr, x); // - - - - - - - - - - - - - - - - - @@ -725,12 +625,6 @@ fooProm = Promise.attempt(() => { fooProm = Promise.attempt(() => { return foo; }); -fooProm = Promise.attempt(() => { - return foo; -}, arr); -fooProm = Promise.attempt(() => { - return foo; -}, arr, x); // - - - - - - - - - - - - - - - - - @@ -746,12 +640,6 @@ fooProm = Promise.attempt(() => { fooProm = Promise.attempt(() => { return fooThen; }); -fooProm = Promise.attempt(() => { - return fooThen; -}, arr); -fooProm = Promise.attempt(() => { - return fooThen; -}, arr, x); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -847,6 +735,7 @@ obj = Promise.promisifyAll(obj, { */ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +BlueBird = Promise.getNewLibraryCopy(); BlueBird = Promise.noConflict(); Promise.onPossiblyUnhandledRejection((reason: any) => { @@ -868,14 +757,6 @@ objProm = Promise.props(obj); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//TODO expand tests to overloads -fooInspectionArrProm = Promise.settle(fooThenArrThen); -fooInspectionArrProm = Promise.settle(fooArrProm); -fooInspectionArrProm = Promise.settle(fooThenArr); -fooInspectionArrProm = Promise.settle(fooArr); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //TODO expand tests to overloads fooProm = Promise.any(fooThenArrThen); fooProm = Promise.any(fooArrProm); diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 34659859cb..042347f096 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -1,773 +1,773 @@ -// Type definitions for bluebird 2.0.0 +// Type definitions for bluebird 3.0.0 // Project: https://github.com/petkaantonov/bluebird -// Definitions by: Bart van der Schoor , falsandtru +// Definitions by: Leonard Hecker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts -// By: Campredon +/*! + * The code following this comment originates from: + * https://github.com/types/npm-bluebird + * + * Licensed under: + * The MIT License (MIT) + * + * Copyright (c) 2016 unional + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ -// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code): -// - https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1563 +// Generated by typings +// Source: bluebird.d.ts +declare module 'bluebird' { +// Type definitions for Bluebird v3.x.x +// Project: http://bluebirdjs.com -// Note: replicate changes to all overloads in both definition and test file -// Note: keep both static and instance members inline (so similar) +class Bluebird implements Bluebird.Thenable, Bluebird.Inspection { + /** + * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. + * If promise cancellation is enabled, passed in function will receive one more function argument `onCancel` that allows to register an optional cancellation callback. + */ + constructor(callback: (resolve: (thenableOrResult?: R | Bluebird.Thenable) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void); -// TODO fix remaining TODO annotations in both definition and test + /** + * Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. + */ + then(onFulfill: (value: R) => U | Bluebird.Thenable, onReject?: (error: any) => U | Bluebird.Thenable): Bluebird; + then(onFulfill: (value: R) => U | Bluebird.Thenable, onReject?: (error: any) => void | Bluebird.Thenable): Bluebird; -// TODO verify support to have no return statement in handlers to get a Promise (more overloads?) + /** + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(onReject?: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + caught(onReject?: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + catch(onReject?: (error: any) => U | Bluebird.Thenable): Bluebird; + caught(onReject?: (error: any) => U | Bluebird.Thenable): Bluebird; -declare var Promise: PromiseConstructor; + /** + * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * + * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + caught(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + catch(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + caught(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + catch(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + caught(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + catch(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + caught(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + catch(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + caught(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + catch(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + caught(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; -interface PromiseCancelHandlerSetter { - (handler: () => void): void; + /** + * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. + */ + error(onReject: (reason: any) => U | Bluebird.Thenable): Bluebird; + + /** + * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. + * + * Alias `.lastly();` for compatibility with earlier ECMAScript version. + */ + finally(handler: () => U | Bluebird.Thenable): Bluebird; + + lastly(handler: () => U | Bluebird.Thenable): Bluebird; + + /** + * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. + */ + bind(thisArg: any): Bluebird; + + /** + * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. + */ + done(onFulfilled?: (value: R) => U | Bluebird.Thenable, onRejected?: (error: any) => U | Bluebird.Thenable): void; + + /** + * Like `.finally()`, but not called for rejections. + */ + tap(onFulFill: (value: R) => Bluebird.Thenable): Bluebird; + tap(onFulfill: (value: R) => U): Bluebird; + + /** + * Same as calling `Promise.delay(ms, this)`. + */ + delay(ms: number): Bluebird; + + /** + * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. + * However, if this promise is not fulfilled or rejected within ms milliseconds, the returned promise + * is rejected with a TimeoutError or the error as the reason. + * + * You may specify a custom error message with the `message` parameter. + */ + timeout(ms: number, message?: string | Error): Bluebird; + + /** + * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. + * If the `callback` argument is not a function, this method does not do anything. + */ + nodeify(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this; + nodeify(...sink: any[]): this; + asCallback(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this; + asCallback(...sink: any[]): this; + + /** + * See if this `promise` has been fulfilled. + */ + isFulfilled(): boolean; + + /** + * See if this `promise` has been rejected. + */ + isRejected(): boolean; + + /** + * See if this `promise` is still defer. + */ + isPending(): boolean; + + /** + * See if this `promise` has been cancelled. + */ + isCancelled(): boolean; + + /** + * See if this `promise` is resolved -> either fulfilled or rejected. + */ + isResolved(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. + * + * throws `TypeError` + */ + value(): R; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. + * + * throws `TypeError` + */ + reason(): any; + + /** + * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of + * the promise as snapshotted at the time of calling `.reflect()`. + */ + reflect(): Bluebird>; + reflect(): Bluebird>; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName].call(obj, arg...); + * }); + * + */ + call(propertyName: string, ...args: any[]): Bluebird; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName]; + * }); + * + */ + // TODO: Use "type property type" once it's there + // @see https://github.com/Microsoft/TypeScript/issues/1295 + get(key: string | number): Bluebird; + + /** + * Convenience method for: + * + * + * .then(function() { + * return value; + * }); + * + * + * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` + * + * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. + */ + return(): Bluebird; + thenReturn(): Bluebird; + return(value: U): Bluebird; + thenReturn(value: U): Bluebird; + + /** + * Convenience method for: + * + * + * .then(function() { + * throw reason; + * }); + * + * Same limitations apply as with `.return()`. + * + * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. + */ + throw(reason: Error): Bluebird; + thenThrow(reason: Error): Bluebird; + + /** + * Convert to String. + */ + toString(): string; + + /** + * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. + */ + toJSON(): Object; + + /** + * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. + */ + spread(fulfilledHandler: (...values: W[]) => U | Bluebird.Thenable): Bluebird; + spread(fulfilledHandler: Function): Bluebird; + + /** + * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + all(): Bluebird; + + /** + * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO how to model instance.props()? + props(): Bluebird; + + /** + * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + any(): Bluebird; + + /** + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + some(count: number): Bluebird; + + /** + * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + race(): Bluebird; + + /** + * Same as calling `Bluebird.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + map(mapper: (item: Q, index: number, arrayLength: number) => U | Bluebird.Thenable, options?: Bluebird.ConcurrencyOption): Bluebird; + + /** + * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | Bluebird.Thenable, initialValue?: U): Bluebird; + + /** + * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + // TODO type inference from array-resolving promise? + filter(filterer: (item: U, index: number, arrayLength: number) => boolean | Bluebird.Thenable, options?: Bluebird.ConcurrencyOption): Bluebird; + + /** + * Same as calling ``Bluebird.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + each(iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable): Bluebird; + + /** + * Same as calling ``Bluebird.mapSeries(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + mapSeries(iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable): Bluebird; + + /** + * Cancel this `promise`. Will not do anything if this promise is already settled or if the cancellation feature has not been enabled + */ + cancel(): void; + + /** + * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. + * + * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. + * + * Alias for `attempt();` for compatibility with earlier ECMAScript version. + */ + static try(fn: () => R | Bluebird.Thenable): Bluebird; + static attempt(fn: () => R | Bluebird.Thenable): Bluebird; + + /** + * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. + * This method is convenient when a function can sometimes return synchronously or throw synchronously. + */ + static method(fn: Function): Function; + + /** + * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. + */ + static resolve(): Bluebird; + static resolve(value: R | Bluebird.Thenable): Bluebird; + + /** + * Create a promise that is rejected with the given `reason`. + */ + static reject(reason: any): Bluebird; + static reject(reason: any): Bluebird; + + /** + * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). + */ + static defer(): Bluebird.Resolver; + + /** + * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. + */ + static cast(value: R | Bluebird.Thenable): Bluebird; + + /** + * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. + */ + static bind(thisArg: any): Bluebird; + + /** + * See if `value` is a trusted Promise. + */ + static is(value: any): boolean; + + /** + * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. + */ + static longStackTraces(): void; + + /** + * Returns a promise that will be resolved with value (or undefined) after given ms milliseconds. + * If value is a promise, the delay will start counting down when it is fulfilled and the returned + * promise will be fulfilled with the fulfillment value of the value promise. + */ + static delay(ms: number, value: R | Bluebird.Thenable): Bluebird; + static delay(ms: number): Bluebird; + + /** + * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. + * + * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. + * + * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. + */ + static promisify(func: (callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): () => Bluebird; + static promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1) => Bluebird; + static promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2) => Bluebird; + static promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3) => Bluebird; + static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird; + static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird; + static promisify(nodeFunction: Function, options?: Bluebird.PromisifyOptions): Function; + + /** + * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. + * + * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. + */ + // TODO how to model promisifyAll? + static promisifyAll(target: Object, options?: Bluebird.PromisifyAllOptions): Object; + + /** + * Returns a promise that is resolved by a node style callback function. + */ + static fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options?: Bluebird.FromNodeOptions): Bluebird; + static fromNode(resolver: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.FromNodeOptions): Bluebird; + static fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options?: Bluebird.FromNodeOptions): Bluebird; + static fromCallback(resolver: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.FromNodeOptions): Bluebird; + + /** + * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + */ + // TODO fix coroutine GeneratorFunction + static coroutine(generatorFunction: Function): Function; + + /** + * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. + * + * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. + */ + static onPossiblyUnhandledRejection(handler: (reason: any) => any): void; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. + */ + // TODO enable more overloads + // array with promises of different types + static all(values: [Bluebird.Thenable | T1, Bluebird.Thenable | T2, Bluebird.Thenable | T3, Bluebird.Thenable | T4, Bluebird.Thenable | T5]): Bluebird<[T1, T2, T3, T4, T5]>; + static all(values: [Bluebird.Thenable | T1, Bluebird.Thenable | T2, Bluebird.Thenable | T3, Bluebird.Thenable | T4]): Bluebird<[T1, T2, T3, T4]>; + static all(values: [Bluebird.Thenable | T1, Bluebird.Thenable | T2, Bluebird.Thenable | T3]): Bluebird<[T1, T2, T3]>; + static all(values: [Bluebird.Thenable | T1, Bluebird.Thenable | T2]): Bluebird<[T1, T2]>; + static all(values: [Bluebird.Thenable | T1]): Bluebird<[T1]>; + // array with values + static all(values: Bluebird.Thenable<(Bluebird.Thenable | R)[]> | (Bluebird.Thenable | R)[]): Bluebird; + + /** + * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. + * + * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. + * + * *The original object is not modified.* + */ + // TODO verify this is correct + // trusted promise for object + static props(object: Bluebird): Bluebird; + // object + static props(object: Object): Bluebird; + + /** + * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. + */ + static any(values: Bluebird.Thenable<(Bluebird.Thenable | R)[]> | (Bluebird.Thenable | R)[]): Bluebird; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. + * + * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. + */ + static race(values: Bluebird.Thenable<(Bluebird.Thenable | R)[]> | (Bluebird.Thenable | R)[]): Bluebird; + + /** + * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. + * + * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + static some(values: Bluebird.Thenable[]>, count: number): Bluebird; + // promise of array with values + static some(values: Bluebird.Thenable, count: number): Bluebird; + // array with promises of value + static some(values: Bluebird.Thenable[], count: number): Bluebird; + // array with values + static some(values: R[], count: number): Bluebird; + + /** + * Promise.join( + * Promise|any values..., + * function handler + * ) -> Promise + * For coordinating multiple concurrent discrete promises. + * + * Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply + */ + static join(arg1: A1 | Bluebird.Thenable, handler: (arg1?: A1) => R | Bluebird.Thenable): Bluebird; + static join(arg1: A1 | Bluebird.Thenable, arg2: A2 | Bluebird.Thenable, handler: (arg1?: A1, arg2?: A2) => R | Bluebird.Thenable): Bluebird; + static join(arg1: A1 | Bluebird.Thenable, arg2: A2 | Bluebird.Thenable, arg3: A3 | Bluebird.Thenable, handler: (arg1?: A1, arg2?: A2, arg3?: A3) => R | Bluebird.Thenable): Bluebird; + static join(arg1: A1 | Bluebird.Thenable, arg2: A2 | Bluebird.Thenable, arg3: A3 | Bluebird.Thenable, arg4: A4 | Bluebird.Thenable, handler: (arg1?: A1, arg2?: A2, arg3?: A3, arg4?: A4) => R | Bluebird.Thenable): Bluebird; + static join(arg1: A1 | Bluebird.Thenable, arg2: A2 | Bluebird.Thenable, arg3: A3 | Bluebird.Thenable, arg4: A4 | Bluebird.Thenable, arg5: A5 | Bluebird.Thenable, handler: (arg1?: A1, arg2?: A2, arg3?: A3, arg4?: A4, arg5?: A5) => R | Bluebird.Thenable): Bluebird; + + // variadic array + /** @deprecated use .all instead */ + static join(...values: (R | Bluebird.Thenable)[]): Bluebird; + + /** + * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + static map(values: Bluebird.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable, options?: Bluebird.ConcurrencyOption): Bluebird; + + // promise of array with values + static map(values: Bluebird.Thenable, mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable, options?: Bluebird.ConcurrencyOption): Bluebird; + + // array with promises of value + static map(values: Bluebird.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable, options?: Bluebird.ConcurrencyOption): Bluebird; + + // array with values + static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable, options?: Bluebird.ConcurrencyOption): Bluebird; + + /** + * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + * + * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* + */ + // promise of array with promises of value + static reduce(values: Bluebird.Thenable[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable, initialValue?: U): Bluebird; + + // promise of array with values + static reduce(values: Bluebird.Thenable, reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable, initialValue?: U): Bluebird; + + // array with promises of value + static reduce(values: Bluebird.Thenable[], reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable, initialValue?: U): Bluebird; + + // array with values + static reduce(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable, initialValue?: U): Bluebird; + + /** + * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * + * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. + * + * *The original array is not modified. + */ + // promise of array with promises of value + static filter(values: Bluebird.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable, option?: Bluebird.ConcurrencyOption): Bluebird; + + // promise of array with values + static filter(values: Bluebird.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable, option?: Bluebird.ConcurrencyOption): Bluebird; + + // array with promises of value + static filter(values: Bluebird.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable, option?: Bluebird.ConcurrencyOption): Bluebird; + + // array with values + static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable, option?: Bluebird.ConcurrencyOption): Bluebird; + + /** + * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. + * + * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + */ + // promise of array with promises of value + static each(values: Bluebird.Thenable[]>, iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable): Bluebird; + // array with promises of value + static each(values: Bluebird.Thenable[], iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable): Bluebird; + // array with values OR promise of array with values + static each(values: R[] | Bluebird.Thenable, iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable): Bluebird; + + /** + * Given an Iterable(arrays are Iterable), or a promise of an Iterable, which produces promises (or a mix of promises and values), iterate over all the values in the Iterable into an array and iterate over the array serially, in-order. + * + * Returns a promise for an array that contains the values returned by the iterator function in their respective positions. The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled. This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach. + * + * If any promise in the input array is rejected or any promise returned by the iterator function is rejected, the result will be rejected as well. + */ + static mapSeries(values: (R | Bluebird.Thenable)[] | Bluebird.Thenable<(R | Bluebird.Thenable)[]>, iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable): Bluebird; + + /** + * A meta method used to specify the disposer method that cleans up a resource when using `Promise.using`. + * + * Returns a Disposer object which encapsulates both the resource as well as the method to clean it up. + * The user can pass this object to `Promise.using` to get access to the resource when it becomes available, + * as well as to ensure its automatically cleaned up. + * + * The second argument passed to a disposer is the result promise of the using block, which you can + * inspect synchronously. + */ + disposer(disposeFn: (arg: R, promise: Bluebird) => void | Bluebird.Thenable): Bluebird.Disposer; + + /** + * In conjunction with `.disposer`, using will make sure that no matter what, the specified disposer + * will be called when the promise returned by the callback passed to using has settled. The disposer is + * necessary because there is no standard interface in node for disposing resources. + */ + static using(disposer: Bluebird.Disposer, executor: (transaction: R) => Bluebird.Thenable): Bluebird; + static using(disposer: Bluebird.Disposer, disposer2: Bluebird.Disposer, executor: (transaction1: R1, transaction2: R2) => Bluebird.Thenable): Bluebird; + static using(disposer: Bluebird.Disposer, disposer2: Bluebird.Disposer, disposer3: Bluebird.Disposer, executor: (transaction1: R1, transaction2: R2, transaction3: R3) => Bluebird.Thenable): Bluebird; + + /** + * Add handler as the handler to call when there is a possibly unhandled rejection. + * The default handler logs the error stack to stderr or console.error in browsers. + * + * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. + * + * Note: this hook is specific to the bluebird instance its called on, application developers should use global rejection events. + */ + static onPossiblyUnhandledRejection(handler?: (error: Error, promise: Bluebird) => void): void; + + /** + * Configure long stack traces, warnings, monitoring and cancellation. + * Note that even though false is the default here, a development environment might be detected which automatically + * enables long stack traces and warnings. + */ + static config(options: { + /** Enable warnings */ + warnings?: boolean | { + /** Enables all warnings except forgotten return statements. */ + wForgottenReturn: boolean; + }; + /** Enable long stack traces */ + longStackTraces?: boolean; + /** Enable cancellation */ + cancellation?: boolean; + /** Enable monitoring */ + monitoring?: boolean; + }): void; } -interface PromiseConstructor { +namespace Bluebird { + export interface ConcurrencyOption { + concurrency: number; + } + export interface SpreadOption { + spread: boolean; + } + export interface FromNodeOptions { + multiArgs?: boolean; + } + export interface PromisifyOptions { + context?: any; + multiArgs?: boolean; + } + export interface PromisifyAllOptions extends PromisifyOptions { + suffix?: string; + filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; + // The promisifier gets a reference to the original method and should return a function which returns a promise + promisifier?: (originalMethod: Function) => () => Thenable; + } + + /** + * Represents an error is an explicit promise rejection as opposed to a thrown error. + * For example, if an error is errbacked by a callback API promisified through undefined or undefined + * and is not a typed error, it will be converted to a `OperationalError` which has the original error in + * the `.cause` property. + * + * `OperationalError`s are caught in `.error` handlers. + */ + export class OperationalError extends Error { } + + /** + * Signals that an operation has timed out. Used as a custom cancellation reason in `.timeout`. + */ + export class TimeoutError extends Error { } + + /** + * Signals that an operation has been aborted or cancelled. The default reason used by `.cancel`. + */ + export class CancellationError extends Error {} + + /** + * A collection of errors. `AggregateError` is an array-like object, with numeric indices and a `.length` property. + * It supports all generic array methods such as `.forEach` directly. + * + * `AggregateError`s are caught in `.error` handlers, even if the contained errors are not operational. + * + * `Promise.some` and `Promise.any` use `AggregateError` as rejection reason when they fail. + */ + export class AggregateError extends Error {} + + /** + * returned by `Bluebird.disposer()`. + */ + export class Disposer { + } + + export interface Thenable { + then(onFulfilled: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled: (value: R) => U | Thenable, onRejected?: (error: any) => void | Thenable): Thenable; + } + + export interface Resolver { /** - * Create a new promise. The passed in function will receive functions - * `resolve` and `reject` as its arguments which can be called to seal the - * fate of the created promise. + * Returns a reference to the controlled promise that can be passed to clients. + */ + promise: Bluebird; + + /** + * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. + */ + resolve(value: R): void; + resolve(): void; + + /** + * Reject the underlying promise with `reason` as the rejection reason. + */ + reject(reason: any): void; + + /** + * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. * - * If configured appropriately, it will also receive an `onCancel` - * function that can be used to configure a promise cancellation handler. + * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. */ - new (callback: ( - resolve: (thenableOrResult?: T | PromiseLike) => void, - reject: (error: any) => void, - onCancel?: PromiseCancelHandlerSetter - ) => void): Promise; - - config(options: { - warnings?: boolean | {wForgottenReturn?: boolean}; - longStackTraces?: boolean; - cancellation?: boolean; - monitoring?: boolean; - }): void; - - // Ideally, we'd define e.g. "export class RangeError extends Error {}", - // but as Error is defined as an interface (not a class), TypeScript doesn't - // allow extending Error, only implementing it. - // However, if we want to catch() only a specific error type, we need to pass - // a constructor function to it. So, as a workaround, we define them here as such. - RangeError(): RangeError; - CancellationError(): Promise.CancellationError; - TimeoutError(): Promise.TimeoutError; - TypeError(): Promise.TypeError; - RejectionError(): Promise.RejectionError; - OperationalError(): Promise.OperationalError; + // TODO specify resolver callback + callback: (err: any, value: R, ...values: R[]) => void; + } + export interface Inspection { /** - * Changes how bluebird schedules calls a-synchronously. - * - * @param scheduler Should be a function that asynchronously schedules - * the calling of the passed in function - */ - setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; - - /** - * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. - * - * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. - * - * Alias for `attempt();` for compatibility with earlier ECMAScript version. - */ - try(fn: () => T | PromiseLike, args?: any[], ctx?: any): Promise; - - attempt(fn: () => T | PromiseLike, args?: any[], ctx?: any): Promise; - - /** - * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. - * This method is convenient when a function can sometimes return synchronously or throw synchronously. - */ - method(fn: Function): Function; - - /** - * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. - */ - resolve(value: T | PromiseLike): Promise; - resolve(): Promise; - - /** - * Create a promise that is rejected with the given `reason`. - */ - reject(reason: any): Promise; - reject(reason: any): Promise; - - /** - * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). - */ - defer(): Promise.Resolver; - - /** - * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. - */ - cast(value: T | PromiseLike): Promise; - - /** - * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. - */ - bind(thisArg: any): Promise; - - /** - * See if `value` is a trusted Promise. - */ - is(value: any): boolean; - - /** - * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. - */ - longStackTraces(): void; - - /** - * Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise. - */ - // TODO enable more overloads - delay(ms: number, value: T | PromiseLike): Promise; - delay(ms: number): Promise; - - /** - * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. - * - * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. - * - * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. - */ - promisify(func: (callback: (err: any, result: T) => void) => void, receiver?: any): () => Promise; - promisify(func: (arg1: A1, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1) => Promise; - promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2) => Promise; - promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3) => Promise; - promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Promise; - promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, receiver?: any): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Promise; - promisify(nodeFunction: Function, receiver?: any): Function; - - /** - * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. - * - * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. - */ - // TODO how to model promisifyAll? - promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; - - - /** - * Returns a promise that is resolved by a node style callback function. - */ - fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; - fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise; - - /** - * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix coroutine GeneratorFunction - coroutine(generatorFunction: Function): Function; - - /** - * Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. - */ - // TODO fix spawn GeneratorFunction - spawn(generatorFunction: Function): Promise; - - /** - * This is relevant to browser environments with no module loader. - * - * Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. - */ - noConflict(): typeof Promise; - - /** - * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. - * - * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. - */ - onPossiblyUnhandledRejection(handler: (reason: any) => any): void; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. - */ - // TODO enable more overloads - // promise of array with promises of value - all(values: PromiseLike[]>): Promise; - // promise of array with values - all(values: PromiseLike): Promise; - // array with promises of value - all(values: PromiseLike[]): Promise; - // array with promises of different types - all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; - all(values: [PromiseLike, PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3, T4]>; - all(values: [PromiseLike, PromiseLike, PromiseLike]): Promise<[T1, T2, T3]>; - all(values: [PromiseLike, PromiseLike]): Promise<[T1, T2]>; - // array with values - all(values: T[]): Promise; - - /** - * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. - * - * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. - * - * *The original object is not modified.* - */ - // TODO verify this is correct - // trusted promise for object - props(object: Promise): Promise; - // object - props(object: Object): Promise; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array. - * - * *original: The array is not modified. The input array sparsity is retained in the resulting array.* - */ - // promise of array with promises of value - settle(values: PromiseLike[]>): Promise[]>; - // promise of array with values - settle(values: PromiseLike): Promise[]>; - // array with promises of value - settle(values: PromiseLike[]): Promise[]>; - // array with values - settle(values: T[]): Promise[]>; - - /** - * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. - */ - // promise of array with promises of value - any(values: PromiseLike[]>): Promise; - // promise of array with values - any(values: PromiseLike): Promise; - // array with promises of value - any(values: PromiseLike[]): Promise; - // array with values - any(values: T[]): Promise; - - /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. - * - * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. - */ - // promise of array with promises of value - race(values: PromiseLike[]>): Promise; - // promise of array with values - race(values: PromiseLike): Promise; - // array with promises of value - race(values: PromiseLike[]): Promise; - // array with values - race(values: T[]): Promise; - - /** - * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. - * - * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - some(values: PromiseLike[]>, count: number): Promise; - // promise of array with values - some(values: PromiseLike, count: number): Promise; - // array with promises of value - some(values: PromiseLike[], count: number): Promise; - // array with values - some(values: T[], count: number): Promise; - - /** - * Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments. - */ - // variadic array with promises of value - join(...values: PromiseLike[]): Promise; - // variadic array with values - join(...values: T[]): Promise; - - /** - * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - map(values: PromiseLike[]>, mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; - - // promise of array with values - map(values: PromiseLike, mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; - - // array with promises of value - map(values: PromiseLike[], mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; - - // array with values - map(values: T[], mapper: (item: T, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; - - /** - * Similar to `map` with concurrency set to 1 but guaranteed to execute in sequential order - * - * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. - * - * *The original array is not modified.* - */ - // promise of array with promises of value - mapSeries(values: PromiseLike[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - // promise of array with values - mapSeries(values: PromiseLike, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - // array with promises of value - mapSeries(values: PromiseLike[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - // array with values - mapSeries(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike): Promise; - - - /** - * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - * - * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* - */ - // promise of array with promises of value - reduce(values: PromiseLike[]>, reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; - - // promise of array with values - reduce(values: PromiseLike, reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; - - // array with promises of value - reduce(values: PromiseLike[], reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; - - // array with values - reduce(values: T[], reducer: (total: U, current: T, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; - - /** - * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. - * - * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. - * - * *The original array is not modified. - */ - // promise of array with promises of value - filter(values: PromiseLike[]>, filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; - - // promise of array with values - filter(values: PromiseLike, filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; - - // array with promises of value - filter(values: PromiseLike[], filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; - - // array with values - filter(values: T[], filterer: (item: T, index: number, arrayLength: number) => boolean | PromiseLike, option?: Promise.ConcurrencyOption): Promise; - - /** - * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. - * - * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. - */ - // promise of array with promises of value - each(values: PromiseLike[]>, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; - // array with promises of value - each(values: PromiseLike[], iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; - // array with values OR promise of array with values - each(values: T[] | PromiseLike, iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; -} - -interface Promise extends PromiseLike, Promise.Inspection { - /** - * Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. - */ - then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): Promise; - then(onFulfill: (value: T) => U | PromiseLike, onReject?: (error: any) => void | PromiseLike, onProgress?: (note: any) => any): Promise; - - /** - * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - caught(onReject?: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - - catch(onReject?: (error: any) => U | PromiseLike): Promise; - caught(onReject?: (error: any) => U | PromiseLike): Promise; - - /** - * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. - * - * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. - * - * Alias `.caught();` for compatibility with earlier ECMAScript version. - */ - catch(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - - catch(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; - caught(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - caught(ErrorClass: Function, onReject: (error: any) => T | PromiseLike | void | PromiseLike): Promise; - - catch(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; - caught(ErrorClass: Function, onReject: (error: any) => U | PromiseLike): Promise; - - - /** - * Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections. - */ - error(onReject: (reason: any) => PromiseLike): Promise; - error(onReject: (reason: any) => U): Promise; - - /** - * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. - * - * Alias `.lastly();` for compatibility with earlier ECMAScript version. - */ - finally(handler: () => U | PromiseLike): Promise; - - lastly(handler: () => U | PromiseLike): Promise; - - /** - * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. - */ - bind(thisArg: any): Promise; - - /** - * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. - */ - done(onFulfilled?: (value: T) => PromiseLike, onRejected?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): void; - done(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): void; - - /** - * Like `.finally()`, but not called for rejections. - */ - tap(onFulFill: (value: T) => U | PromiseLike): Promise; - - /** - * Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise. - */ - progressed(handler: (note: any) => any): Promise; - - /** - * Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - delay(ms: number): Promise; - - /** - * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance. - * - * You may specify a custom error message with the `message` parameter. - */ - timeout(ms: number, message?: string): Promise; - - /** - * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. - * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. - */ - nodeify(callback: (err: any, value?: T) => void, options?: Promise.SpreadOption): Promise; - nodeify(...sink: any[]): Promise; - - /** - * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. - */ - cancellable(): Promise; - - /** - * Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending. - * - * That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason. - * - * In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`. - * - * Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable. - */ - // TODO what to do with this? - cancel(reason?: any): Promise; - - /** - * Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors. - */ - fork(onFulfilled?: (value: T) => U | PromiseLike, onRejected?: (error: any) => U | PromiseLike, onProgress?: (note: any) => any): Promise; - - /** - * Create an uncancellable promise based on this promise. - */ - uncancellable(): Promise; - - /** - * See if this promise can be cancelled. - */ - isCancellable(): boolean; - - /** - * See if this `promise` has been fulfilled. + * See if the underlying promise was fulfilled at the creation time of this inspection object. */ isFulfilled(): boolean; /** - * See if this `promise` has been rejected. + * See if the underlying promise was rejected at the creation time of this inspection object. */ isRejected(): boolean; /** - * See if this `promise` is still defer. + * See if the underlying promise was cancelled at the creation time of this inspection object. + */ + isCancelled(): boolean; + + /** + * See if the underlying promise was defer at the creation time of this inspection object. */ isPending(): boolean; /** - * See if this `promise` is resolved -> either fulfilled or rejected. - */ - isResolved(): boolean; - - /** - * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. + * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. * * throws `TypeError` */ - value(): T; + value(): R; /** - * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. + * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. * * throws `TypeError` */ reason(): any; + } - /** - * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`. - */ - inspect(): Promise.Inspection; + /** + * Returns a new independent copy of the Bluebird library. + * + * This method should be used before you use any of the methods which would otherwise alter the global Bluebird object - to avoid polluting global state. + */ + export function getNewLibraryCopy(): typeof Bluebird; - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName].call(obj, arg...); - * }); - * - */ - call(propertyName: string, ...args: any[]): Promise; + /** + * This is relevant to browser environments with no module loader. + * + * Release control of the Promise namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. + */ + export function noConflict(): typeof Bluebird; - /** - * This is a convenience method for doing: - * - * - * promise.then(function(obj){ - * return obj[propertyName]; - * }); - * - */ - // TODO find way to fix get() - // get(propertyName: string): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * return value; - * }); - * - * - * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` - * - * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. - */ - return(): Promise; - thenReturn(): Promise; - return(value: U): Promise; - thenReturn(value: U): Promise; - - /** - * Convenience method for: - * - * - * .then(function() { - * throw reason; - * }); - * - * Same limitations apply as with `.return()`. - * - * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. - */ - throw(reason: Error): Promise; - thenThrow(reason: Error): Promise; - - /** - * Convert to String. - */ - toString(): string; - - /** - * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. - */ - toJSON(): Object; - - /** - * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. - */ - // TODO how to model instance.spread()? like Q? - spread(onFulfill: Function, onReject?: (reason: any) => U | PromiseLike): Promise; - /* - // TODO or something like this? - spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => PromiseLike): Promise; - spread(onFulfill: (...values: W[]) => PromiseLike, onReject?: (reason: any) => U): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => PromiseLike): Promise; - spread(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise; - */ - /** - * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - all(): Promise; - - /** - * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO how to model instance.props()? - props(): Promise; - - /** - * Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - settle(): Promise[]>; - - /** - * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - any(): Promise; - - /** - * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - some(count: number): Promise; - - /** - * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - race(): Promise; - - /** - * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - map(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike, options?: Promise.ConcurrencyOption): Promise; - - /** - * Same as `Promise.mapSeries(thisPromise, mapper)`. - */ - // TODO type inference from array-resolving promise? - mapSeries(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike): Promise; - - /** - * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - reduce(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Promise; - - /** - * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - // TODO type inference from array-resolving promise? - filter(filterer: (item: U, index: number, arrayLength: number) => boolean | PromiseLike, options?: Promise.ConcurrencyOption): Promise; - - /** - * Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. - */ - each(iterator: (item: T, index: number, arrayLength: number) => U | PromiseLike): Promise; + /** + * Changes how bluebird schedules calls a-synchronously. + * + * @param scheduler Should be a function that asynchronously schedules + * the calling of the passed in function + */ + export function setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; } -/** - * Don't use variable namespace such as variables, functions, and classes. - * If you use this namespace, it will conflict in es6. - */ -declare namespace Promise { - export interface RangeError extends Error { - } - export interface CancellationError extends Error { - } - export interface TimeoutError extends Error { - } - export interface TypeError extends Error { - } - export interface RejectionError extends Error { - } - export interface OperationalError extends Error { - } - - export interface ConcurrencyOption { - concurrency: number; - } - export interface SpreadOption { - spread: boolean; - } - export interface PromisifyAllOptions { - suffix?: string; - filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; - // The promisifier gets a reference to the original method and should return a function which returns a promise - promisifier?: (originalMethod: Function) => () => PromiseLike; - } - - export interface Resolver { - /** - * Returns a reference to the controlled promise that can be passed to clients. - */ - promise: Promise; - - /** - * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. - */ - resolve(value: T): void; - resolve(): void; - - /** - * Reject the underlying promise with `reason` as the rejection reason. - */ - reject(reason: any): void; - - /** - * Progress the underlying promise with `value` as the progression value. - */ - progress(value: any): void; - - /** - * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. - * - * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. - */ - // TODO specify resolver callback - callback: (err: any, value: T, ...values: T[]) => void; - } - - export interface Inspection { - /** - * See if the underlying promise was fulfilled at the creation time of this inspection object. - */ - isFulfilled(): boolean; - - /** - * See if the underlying promise was rejected at the creation time of this inspection object. - */ - isRejected(): boolean; - - /** - * See if the underlying promise was defer at the creation time of this inspection object. - */ - isPending(): boolean; - - /** - * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. - * - * throws `TypeError` - */ - value(): T; - - /** - * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. - * - * throws `TypeError` - */ - reason(): any; - } -} - -declare module 'bluebird' { - export = Promise; +export = Bluebird; } From 568ec4378d010bb901a61bd9686be49077e54d5f Mon Sep 17 00:00:00 2001 From: Leonard Hecker Date: Thu, 11 Aug 2016 13:13:12 +0200 Subject: [PATCH 032/203] Fixed references to Bluebird 2.0 --- acl/acl.d.ts | 2 +- .../anydb-sql-migrations.d.ts | 4 +- asana/asana.d.ts | 2 +- blue-tape/blue-tape-tests.ts | 2 +- bluebird-retry/bluebird-retry-tests.ts | 4 +- bluebird-retry/bluebird-retry.d.ts | 2 +- bookshelf/bookshelf.d.ts | 2 +- consolidate/consolidate.d.ts | 2 +- fs-extra-promise/fs-extra-promise.d.ts | 2 +- inline-css/inline-css.d.ts | 2 +- inversify/inversify.d.ts | 66 +- java/java-tests.ts | 2 +- karma/karma.d.ts | 2 +- knex/knex.d.ts | 2 +- libxmljs/libxmljs-tests.ts | 2 +- mz/mz.d.ts | 2 +- .../node-mysql-wrapper-tests.ts | 44 +- node-mysql-wrapper/node-mysql-wrapper.d.ts | 170 +- nodemailer/nodemailer.d.ts | 6 +- orientjs/orientjs.d.ts | 2 +- pify/pify-tests.ts | 4 +- project-oxford/project-oxford-tests.ts | 2 +- project-oxford/project-oxford.d.ts | 4 +- redlock/redlock.d.ts | 14 +- request-promise/request-promise.d.ts | 2 +- rethinkdb/rethinkdb.d.ts | 2 +- sequelize/sequelize.d.ts | 2 +- stamplay-js-sdk/stamplay-js-sdk.d.ts | 2 +- stripe-node/stripe-node.d.ts | 2778 ++++++++--------- umzug/umzug.d.ts | 2 +- 30 files changed, 1567 insertions(+), 1567 deletions(-) diff --git a/acl/acl.d.ts b/acl/acl.d.ts index 06defa2449..d222f9ebb6 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -3,7 +3,7 @@ // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// /// diff --git a/anydb-sql-migrations/anydb-sql-migrations.d.ts b/anydb-sql-migrations/anydb-sql-migrations.d.ts index 9ab421c3ac..98961266a9 100644 --- a/anydb-sql-migrations/anydb-sql-migrations.d.ts +++ b/anydb-sql-migrations/anydb-sql-migrations.d.ts @@ -3,7 +3,7 @@ // Definitions by: Gorgi Kosev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare module "anydb-sql-migrations" { @@ -31,4 +31,4 @@ declare module "anydb-sql-migrations" { items: MigrationTask[]; }) => any) => Promise; }; -} \ No newline at end of file +} diff --git a/asana/asana.d.ts b/asana/asana.d.ts index 61cb54d26f..8b618b81a3 100644 --- a/asana/asana.d.ts +++ b/asana/asana.d.ts @@ -3,7 +3,7 @@ // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare module "asana" { diff --git a/blue-tape/blue-tape-tests.ts b/blue-tape/blue-tape-tests.ts index a01675a1c5..fc931aeed5 100644 --- a/blue-tape/blue-tape-tests.ts +++ b/blue-tape/blue-tape-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// /// import tape = require('blue-tape'); diff --git a/bluebird-retry/bluebird-retry-tests.ts b/bluebird-retry/bluebird-retry-tests.ts index 5d8c32dfcb..e42b5457df 100644 --- a/bluebird-retry/bluebird-retry-tests.ts +++ b/bluebird-retry/bluebird-retry-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// import Promise = require('bluebird'); import retry = require('bluebird-retry'); @@ -32,4 +32,4 @@ var options:retry.Options = { interval: 500 }; -retry(logFail, options); \ No newline at end of file +retry(logFail, options); diff --git a/bluebird-retry/bluebird-retry.d.ts b/bluebird-retry/bluebird-retry.d.ts index 1210bf3b53..b63a3cf131 100644 --- a/bluebird-retry/bluebird-retry.d.ts +++ b/bluebird-retry/bluebird-retry.d.ts @@ -3,7 +3,7 @@ // Definitions by: Pascal Vomhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare module "bluebird-retry" { import Promise = require('bluebird'); diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index 0ca3a1ebcd..34f58d62ed 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -3,7 +3,7 @@ // Definitions by: Andrew Schurman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// /// /// diff --git a/consolidate/consolidate.d.ts b/consolidate/consolidate.d.ts index ff54a83a8e..aa07150f20 100644 --- a/consolidate/consolidate.d.ts +++ b/consolidate/consolidate.d.ts @@ -6,7 +6,7 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts /// -/// +/// declare module "consolidate" { var cons: Consolidate; diff --git a/fs-extra-promise/fs-extra-promise.d.ts b/fs-extra-promise/fs-extra-promise.d.ts index 2243a4d1c5..bdf8360b77 100644 --- a/fs-extra-promise/fs-extra-promise.d.ts +++ b/fs-extra-promise/fs-extra-promise.d.ts @@ -6,7 +6,7 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts via TSD fs-extra definition /// -/// +/// declare module "fs-extra-promise" { import stream = require("stream"); diff --git a/inline-css/inline-css.d.ts b/inline-css/inline-css.d.ts index 478f25226b..41511097c7 100644 --- a/inline-css/inline-css.d.ts +++ b/inline-css/inline-css.d.ts @@ -3,7 +3,7 @@ // Definitions by: Philip Spain // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare module 'inline-css' { import Promise = require('bluebird'); diff --git a/inversify/inversify.d.ts b/inversify/inversify.d.ts index 41200ae470..0c77d9d82f 100644 --- a/inversify/inversify.d.ts +++ b/inversify/inversify.d.ts @@ -3,7 +3,7 @@ // Definitions by: inversify // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// interface Symbol { toString(): string; @@ -31,9 +31,9 @@ declare namespace inversify { export interface Newable { new(...args: any[]): T; } - + export type ServiceIdentifier = (string|Symbol|Newable); - + export interface Binding extends Clonable> { guid: string; moduleId: string; @@ -49,66 +49,66 @@ declare namespace inversify { scope: number; // BindingScope type: number; // BindingType } - + export interface Factory extends Function { (...args: any[]): (((...args: any[]) => T)|T); } - + export interface FactoryCreator extends Function { (context: Context): Factory; } - + export interface Provider extends Function { (): Promise; } - + export interface ProviderCreator extends Function { (context: Context): Provider; } - + export interface PlanAndResolve { (args: PlanAndResolveArgs): T[]; } - + export interface PlanAndResolveArgs { multiInject: boolean; serviceIdentifier: ServiceIdentifier; target: Target; contextInterceptor: (contexts: Context) => Context; } - + export interface Middleware extends Function { (next: PlanAndResolve): PlanAndResolve; } - + export interface Context { guid: string; kernel: Kernel; plan: Plan; addPlan(plan: Plan): void; } - + export interface ReflectResult { [key: string]: Metadata[]; } - + export interface Metadata { key: string; value: any; } - + export interface Plan { parentContext: Context; rootRequest: Request; } - + export interface Planner { createContext(kernel: Kernel): Context; createPlan(parentContext: Context, binding: Binding, target: Target): Plan; getBindings(kernel: Kernel, serviceIdentifier: ServiceIdentifier): Binding[]; getActiveBindings(parentRequest: Request, target: Target): Binding[]; } - + export interface QueryableString { startsWith(searchString: string): boolean; endsWith(searchString: string): boolean; @@ -116,7 +116,7 @@ declare namespace inversify { equals(compareString: string): boolean; value(): string; } - + export interface Request { guid: string; serviceIdentifier: ServiceIdentifier; @@ -131,7 +131,7 @@ declare namespace inversify { target: Target ): Request; } - + export interface Target { guid: string; serviceIdentifier: ServiceIdentifier; @@ -145,11 +145,11 @@ declare namespace inversify { matchesNamedTag(name: string): boolean; matchesTag(key: string): (value: any) => boolean; } - + export interface Resolver { resolve(context: Context): T; } - + export interface Kernel { guid: string; bind(serviceIdentifier: ServiceIdentifier): BindingToSyntax; @@ -167,25 +167,25 @@ declare namespace inversify { snapshot(): void; restore(): void; } - + export interface Bind extends Function { (serviceIdentifier: ServiceIdentifier): BindingToSyntax; } - + export interface KernelModule { guid: string; registry: (bind: Bind) => void; } - + export interface KernelSnapshot { bindings: Lookup>; middleware: PlanAndResolve; } - + export interface Clonable { clone(): T; } - + export interface Lookup extends Clonable> { add(serviceIdentifier: ServiceIdentifier, value: T): void; get(serviceIdentifier: ServiceIdentifier): Array; @@ -193,22 +193,22 @@ declare namespace inversify { removeByModuleId(moduleId: string): void; hasKey(serviceIdentifier: ServiceIdentifier): boolean; } - + export interface KeyValuePair { serviceIdentifier: ServiceIdentifier; value: Array; } - + export interface BindingInSyntax { inSingletonScope(): BindingWhenOnSyntax; } - + export interface BindingInWhenOnSyntax extends BindingInSyntax, BindingWhenOnSyntax {} - + export interface BindingOnSyntax { onActivation(fn: (context: Context, injectable: T) => T): BindingWhenSyntax; } - + export interface BindingToSyntax { to(constructor: { new(...args: any[]): T; }): BindingInWhenOnSyntax; toConstantValue(value: T): BindingWhenOnSyntax; @@ -219,9 +219,9 @@ declare namespace inversify { toAutoFactory(serviceIdentifier: ServiceIdentifier): BindingWhenOnSyntax; toProvider(provider: ProviderCreator): BindingWhenOnSyntax; } - + export interface BindingWhenOnSyntax extends BindingWhenSyntax, BindingOnSyntax {} - + export interface BindingWhenSyntax { when(constraint: (request: Request) => boolean): BindingOnSyntax; whenTargetNamed(name: string): BindingOnSyntax; @@ -238,7 +238,7 @@ declare namespace inversify { whenAnyAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax; whenNoAncestorMatches(constraint: (request: Request) => boolean): BindingOnSyntax; } - + } export var Kernel: interfaces.KernelConstructor; diff --git a/java/java-tests.ts b/java/java-tests.ts index 568bd35a8c..7f5ff7874a 100644 --- a/java/java-tests.ts +++ b/java/java-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// import java = require('java'); import BluePromise = require('bluebird'); diff --git a/karma/karma.d.ts b/karma/karma.d.ts index 95c1baede4..c6f9bc0043 100644 --- a/karma/karma.d.ts +++ b/karma/karma.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// /// diff --git a/knex/knex.d.ts b/knex/knex.d.ts index a8501f2e51..5d240d926d 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -3,7 +3,7 @@ // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare module "knex" { diff --git a/libxmljs/libxmljs-tests.ts b/libxmljs/libxmljs-tests.ts index fbc8628185..8a11481bee 100644 --- a/libxmljs/libxmljs-tests.ts +++ b/libxmljs/libxmljs-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// var libxmljs = require("libxmljs"); diff --git a/mz/mz.d.ts b/mz/mz.d.ts index 8c3206c714..8bbf5b4a34 100644 --- a/mz/mz.d.ts +++ b/mz/mz.d.ts @@ -5,7 +5,7 @@ // Modified from the node.js definitions https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/node/node.d.ts -/// +/// /// diff --git a/node-mysql-wrapper/node-mysql-wrapper-tests.ts b/node-mysql-wrapper/node-mysql-wrapper-tests.ts index 3d26b6e8bc..9819484fb6 100644 --- a/node-mysql-wrapper/node-mysql-wrapper-tests.ts +++ b/node-mysql-wrapper/node-mysql-wrapper-tests.ts @@ -1,6 +1,6 @@ /// /// -/// +/// var express = require('express'); var app = express(); @@ -40,7 +40,7 @@ db.ready(() => { var usersDb = db.table("users"); - + //or var usersDb = db.table("users"); if you don't want intel auto complete from your ide/editor usersDb.findById(16, (_user) => { @@ -65,7 +65,7 @@ db.ready(() => { orderByDesc: "commentId" //give me the first 50 comments ordered by -commentId (DESC) from table 'comments' and put them at 'myComments' property inside the result object. } } - }).then(_user=> { // to get this promise use : .promise() + }).then(_user=> { // to get this promise use : .promise() console.log("\n-------------TEST 2 ------------\n"); console.log(_user.username + " with "); console.log(_user.myComments.length + " comments "); @@ -103,7 +103,7 @@ db.ready(() => { } }, (_users) => { - + console.log("---------------TEST 6----------------------------------------"); _users.forEach(_user=> { console.log(_user.userId + " " + _user.username + " found with " + _user.comments.length + " comments"); @@ -112,55 +112,55 @@ db.ready(() => { }); //if no rules setted to find method it's uses the table's rules ( if exists) - - - + + + let _criteriaFromBuilder = usersDb.criteria .except("password") // or .exclude(...columns). the only column you cannot except/exclude is the primary key (because it is used at where clause), be careful. .where("userId", 24) - .joinAs("info", "userInfos", "userId") + .joinAs("info", "userInfos", "userId") .at("info") .limit(1) //because we make it limit 1 it will return this result as object not as array. .parent() - .joinAs("myComments", "comments", "userId") + .joinAs("myComments", "comments", "userId") .at("myComments").limit(2) .joinAs("likes", "commentLikes", "commentId") .original().orderBy("userId", true).build(); - + /* console.dir(_criteriaFromBuilder); prints this object: ( of course you can create your own in order to pass it on .find table methods ) { userId:23, - + myComments:{ userId: '=', - + tableRules:{ table: 'comments', limit:2 - + }, - + likes:{ commentId: '=', - + tableRules:{ table: 'commentLikes' } - + } }, - - tableRules:{ + + tableRules:{ orderByDesc: 'userId', except: ['password'] } - + } - - + + */ - + usersDb.find(_criteriaFromBuilder).then(_users=> { diff --git a/node-mysql-wrapper/node-mysql-wrapper.d.ts b/node-mysql-wrapper/node-mysql-wrapper.d.ts index 2eb489f079..791ab68ade 100644 --- a/node-mysql-wrapper/node-mysql-wrapper.d.ts +++ b/node-mysql-wrapper/node-mysql-wrapper.d.ts @@ -3,8 +3,8 @@ // Definitions by: Makis Maropoulos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -/// +/// +/// /// @@ -53,26 +53,26 @@ declare module "node-mysql-wrapper" { class Helper { - /** + /** * Callback like forEach * @name valueCallback * @function - * @param {T} the value of the object's key + * @param {T} the value of the object's key * @returnTye {U} * @return {U} */ - + /** * Callback like forEach * @name keyCallback * @function - * @param {string} the name of the object's key + * @param {string} the name of the object's key * @returnTye {U} * @return {U} */ constructor(); - + /** * Create and return a copy of an object. * @param {T} object the object you want to copy. @@ -80,7 +80,7 @@ declare module "node-mysql-wrapper" { * @return {T} */ static copyObject(object: T): T; - + /** * Converts any_string to anyString and returns it. * @param {string} columnKey the string you want to convert. @@ -88,7 +88,7 @@ declare module "node-mysql-wrapper" { * @return {string} */ static toObjectProperty(columnKey: string): string; - + /** * Converts anyString to any_string and returns it. * @param {string} objectKey the string you want to convert. @@ -96,7 +96,7 @@ declare module "node-mysql-wrapper" { * @return {string} */ static toRowProperty(objectKey: string): string; - + /** * Iterate object's keys and return their values to the callback. * @param {} map the object. @@ -115,14 +115,14 @@ declare module "node-mysql-wrapper" { */ static forEachKey(map: Map, callback: (key: string) => U): U; - + /** * Checks if anything is a function. * @param {functionToCheck} the object or function to pass * @return boolean */ static isFunction(functionToCheck: any): boolean; - + /** * Checks if an object has 'tableRules' property. * @param {obj} the object to pass @@ -145,24 +145,24 @@ declare module "node-mysql-wrapper" { class CriteriaParts implements ICriteriaParts { - + /** * The raw format of the criteria eg: {yearsOld:22}. */ rawCriteriaObject: any; - + /** * Which tables to search after the find method of the proto table finish. */ tables: TableToSearchPart[]; - + /** * The properties of the criteria which don't belong to the database's table. */ noDatabaseProperties: string[]; - + /** - * The converted/exported where clause. + * The converted/exported where clause. */ whereClause: string; @@ -174,7 +174,7 @@ declare module "node-mysql-wrapper" { class CriteriaDivider { private _table; constructor(table: Table); - + /** * Builds the criteria raw object to Criteria object. * @param {any} rawCriteriaObject the criteria at raw format you pass eg: {yearsOld:18}. @@ -198,7 +198,7 @@ declare module "node-mysql-wrapper" { static build(): SelectQueryRules; private last(propertyClauseName); except(...columns: string[]): SelectQueryRules; - + /** * Same as .except(...columns) */ @@ -236,7 +236,7 @@ declare module "node-mysql-wrapper" { constructor(primaryTable: Table, tablePropertyName?: string, parentBuilder?: CriteriaBuilder); except(...columns: string[]): CriteriaBuilder; - + /** * Same as .except(...columns) */ @@ -259,7 +259,7 @@ declare module "node-mysql-wrapper" { parent(): CriteriaBuilder; original(): CriteriaBuilder; - + /** * Auto kanei kuklous mexri na paei sto primary table kai ekei na epistrepsei to sunoliko raw criteria gia execute i kati allo. */ @@ -270,7 +270,7 @@ declare module "node-mysql-wrapper" { } class SelectQuery implements IQuery { // T for Table's result type. - + _table: Table constructor(_table: Table); @@ -315,7 +315,7 @@ declare module "node-mysql-wrapper" { static RESERVED_PROPERTY_NAMES: string[]; private propertyChangedListeners: PropertyChangedCallback[]; - + /** Make the obj observable. Used in constructor or extend this class and use it. */ private makeObservable(obj: any): void; @@ -324,7 +324,7 @@ declare module "node-mysql-wrapper" { /**Add a listener/observer to watch for changes in this object's properties */ onPropertyChanged(listener: PropertyChangedCallback): void; - + /** If developer wants manualy notify for property changed */ notifyPropertyChanged(propertyName: string, oldValue: any): void; @@ -388,7 +388,7 @@ declare module "node-mysql-wrapper" { findById(id: number | string, callback?: (result: T) => any): Promise; findAll(tableRules?: RawRules, callback?: (_results: T[]) => any): Promise; - + /** * .insert() and .update() do the same thing: .save(); */ @@ -399,7 +399,7 @@ declare module "node-mysql-wrapper" { save(criteriaRawJsObject: any, callback?: (_result: any) => any): Promise; remove(criteriaOrID: any | number | string, callback?: (_result: DeleteAnswer) => any): Promise; - + /** * same thing as .remove(); */ @@ -423,7 +423,7 @@ declare module "node-mysql-wrapper" { fillAll(): void; fillOne(criteriaRawJsObject: any): void; - + //ONLY MONGO/METEOR COLLECTION METHODS START allow(options: { insert?: (userId: string, doc: T) => boolean; @@ -457,36 +457,36 @@ declare module "node-mysql-wrapper" { reactive?: boolean; transform?: Function; }): T; - + //ONLY MONGO/METEOR COLLECTION METHODS FINISH. } class Connection extends EventEmitter { - + /** * The real database connection socket. */ connection: Mysql.IConnection; - + /** * Collection of the supported event types for the tables. */ eventTypes: string[]; - + /** - * Force to fetch ONLY these Database table names {array of string}. + * Force to fetch ONLY these Database table names {array of string}. */ tableNamesToUseOnly: any[]; - + /** * All tables {MysqlTable} inside this connection's database. */ tables: Table[]; constructor(connection: string | Mysql.IConnection | Mysql.IConnectionConfig); - + /** * Creates the MysqlConnection from the connection url or the real connection object. * @param {string | Mysql.IConnection | Mysql.IConnectionConfig} connection the connection url or the real connection object. @@ -494,36 +494,36 @@ declare module "node-mysql-wrapper" { * @return {nothing} */ create(connection: string | Mysql.IConnection | Mysql.IConnectionConfig): void; - + /** * Attach a real connection. * @param {Mysql.IConnection} connection the real connection object. * @returnType {nothing} - * @return {nothing} + * @return {nothing} */ attach(connection: Mysql.IConnection): void; - + /** * Close the entire real connection and remove all event's listeners (if exist). * @param {function} callback If error occurs when closing the connection, this callback has the responsibility to catch it. * @returnType {nothing} - * @return {nothing} + * @return {nothing} */ end(callback?: (error: any) => void): void; - + /** * Close the entire real connection and remove all event's listeners (if exist). - * the difference from the 'end' is that this method doesn't care about errors so no callback passing here. + * the difference from the 'end' is that this method doesn't care about errors so no callback passing here. */ destroy(): void; - + /** * Clear all binary logs from the whole database. * When finish returns a promise, use it with .then(function(){}); * @return Promise */ clearBinaryLogs(): Promise; - + /** * Link the real connection with this MysqlConnection object. * @param {function} readyCallback when the link operation is done this callback is executed. @@ -531,7 +531,7 @@ declare module "node-mysql-wrapper" { * @return {Promise} */ link(readyCallback?: () => void): Promise; - + /** * Force to use/fetch information from only certain of database's tables, otherwise all database's tables information will be fetched. * @param {Array} tables the array of the tables {string} @@ -539,22 +539,22 @@ declare module "node-mysql-wrapper" { * @return {nothing} */ useOnly(...tables: any[]): void; - + /** * This method has the resposibility of fetching the correct tables from the database ( table = columns' names, primary key name). * @returnType {Promise} * @return {Promise} */ fetchDatabaseInformation(): Promise; - + /** * Escape the query column's value and return it. - * @param {string} val the value which will be escaped. + * @param {string} val the value which will be escaped. * @returnType {string} * @return {string} */ escape(val: string): string; - + /** * Call when must notify the Database events, SAVE(INSERT,UPDATE), REMOVE(DELETE). * @param {string} tableWhichCalled the table name which event is coming from. @@ -564,40 +564,40 @@ declare module "node-mysql-wrapper" { * @return {nothing} */ notice(tableWhichCalled: string, queryStr: string, rawRows: any[]): void; - + /** * Adds an event listener/watcher on a table for a 'database event'. * @param {string} tableName the table name which you want to add the event listener. * @param {string or string[]} evtType the event(s) type you want to watch, one of these(string) or an array of them(string[]): ["INSERT", "UPDATE", "REMOVE", "SAVE"]. - * @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawRows (results after query executed and before parsed to object(s)). + * @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawRows (results after query executed and before parsed to object(s)). * @returnType {nothing} * @return {nothing} */ watch(tableName: string, evtType: any, callback: (rawRows: any[]) => void): void; - + /** * Removes an event listener/watcher from a table for a specific event type. - * @param {string} tableName the table name which you want to remove the event listener. + * @param {string} tableName the table name which you want to remove the event listener. * @param {string} evtType the Event type you want to remove, one of these: "INSERT", "UPDATE", "REMOVE", "SAVE". * @param {function} callbackToRemove the callback that you were used for watch this event type. * @returnType {nothing} * @return {nothing} */ unwatch(tableName: string, evtType: string, callbackToRemove: (rawResults: any[]) => void): void; - + /** * Executes a database query. * @param {string} queryStr the query text/string to be executed. * @param {function} callback the function will be called and fill the one and only parameter when an errors occurs. * @param {any[]} queryArguments (optional) the query arguments you want to pass into query. ['arg1','arg2']... * @returnType {nothing} - * @return {nothing} + * @return {nothing} */ query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void; - + /** * Returns a MysqlTable object from the database factory. (Note: this method doesn't create anything, just finds and returns the correct table, you don't have to create anything at all. Tables are fetched by the library itself.) - * If you are using typescript you can pass a class (generic) in order to use the auto completion assistance on table's results methods(find,findById,findAll,save,remove,safeRemove). + * If you are using typescript you can pass a class (generic) in order to use the auto completion assistance on table's results methods(find,findById,findAll,save,remove,safeRemove). * @param {string} tableName the table name which you want to get, on the form of: 'anyDatabaseTable' OR 'any_database_table' (possible your real table name into your database). * @returnType {MysqlTable} * @return {MysqlTable} @@ -606,7 +606,7 @@ declare module "node-mysql-wrapper" { } class Table { - /** Private keywords here are useless but I put them. + /** Private keywords here are useless but I put them. * If the developer wants to see the properties of the Table class, he/she just comes here. */ @@ -622,55 +622,55 @@ declare module "node-mysql-wrapper" { constructor(tableName: string, connection: Connection); - + /** * An array of all columns' names inside this table. */ columns: string[]; - + /** * The name of the primary key column which this table is using. */ primaryKey: string; - + /** - * The MysqlConnection object which this MysqlTable belongs. + * The MysqlConnection object which this MysqlTable belongs. */ connection: Connection; - + /** - * The real database name of the table. Autofilled by library. + * The real database name of the table. Autofilled by library. */ name: string; - + /** - * Set of the query rules that will be applied after the 'where clause' on each select query executed by this table. + * Set of the query rules that will be applied after the 'where clause' on each select query executed by this table. * @return {SelectQueryRules} */ rules: SelectQueryRules; - + /** * Returns this table's criteria divider class. * @return {CriteriaDivider} */ criteriaDivider: CriteriaDivider; - + /** * Returns new Criteria Builder each time. * Helps you to make criteria raw js objects ready to use in find,remove and save methods. * @return {CriteriaBuilder} */ criteria: CriteriaBuilder; - + /** * Adds or turn on an event listener/watcher on a table for a 'database event'. * @param {string} evtType the event type you want to watch, one of these: ["INSERT", "UPDATE", "REMOVE", "SAVE"]. - * @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawResults (results after query executed and before exports to object(s)). + * @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawResults (results after query executed and before exports to object(s)). * @returnType {nothing} * @return {nothing} */ on(evtType: string, callback: (rawResults: any[]) => void): void; - + /** * Removes or turn off an event listener/watcher from a table for a specific event type. * @param {string} evtType the Event type you want to remove, one of these: "INSERT", "UPDATE", "REMOVE", "SAVE". @@ -679,7 +679,7 @@ declare module "node-mysql-wrapper" { * @return {nothing} */ off(evtType: string, callbackToRemove: (rawResults: any[]) => void): void; - + /** * Use it when you want to check if extended function is exists here. * @param {string} extendedFunctionName the name of the function you want to check. @@ -687,16 +687,16 @@ declare module "node-mysql-wrapper" { * @return {boolean} */ has(extendedFunctionName: string): boolean; - + /** * Extends this table's capabilities with a function. * @param {string} functionName the function name you want to use, this is used when you want to call this function later. * @param {function} theFunction the function with any optional parameters you want to pass along. * @returnType {nothing} - * @return {nothing} + * @return {nothing} */ extend(functionName: string, theFunction: (...args: any[]) => any): void; - + /** * Converts and returns an object from this form: { a_property:'dsda', other_property:something, any_property_name:true } to { aProperty:..., otherProperty...,anyPropertyName...} * @param {any} row the raw row object. @@ -704,7 +704,7 @@ declare module "node-mysql-wrapper" { * @return {any} */ objectFromRow(row: any): any; - + /** * Converts and returns an object from this form: { aProperty:'dsda', otherProperty:something, anyPropertyName:true } to { a_property:..., other_property...,any_property_name...} * @param {any} row the raw row object. @@ -712,7 +712,7 @@ declare module "node-mysql-wrapper" { * @return {any} */ rowFromObject(obj: any): any; - + /** * Returns and array of [columns[],values[]] * @param {any} jsObject the raw row object. @@ -720,7 +720,7 @@ declare module "node-mysql-wrapper" { * @return {array} */ getRowAsArray(jsObject: any): Array; - + /** * Returns the primary key's value from an object. * @param {any} jsObject the object which you want to find and return the value of the primary key. @@ -728,11 +728,11 @@ declare module "node-mysql-wrapper" { * @return {number | string} */ getPrimaryKeyValue(jsObject: any): number | string; - + /** - * + * */ - find(criteriaRawJsObject: any): Promise; // only criteria + find(criteriaRawJsObject: any): Promise; // only criteria find(criteriaRawJsObject: any, callback: ((_results: T[]) => any)): Promise; // criteria and callback find(criteriaRawJsObject: any, callback?: (_results: T[]) => any): Promise; @@ -778,7 +778,7 @@ declare module "node-mysql-wrapper" { constructor(connection?: Connection); static when(..._promises: Promise[]): Promise; setConnection(connection: Connection): void; - + /** * Force to use/fetch information from only certain of database's tables, otherwise all database's tables information will be fetched. * @param {Array} tables the array of the tables {string} @@ -793,18 +793,18 @@ declare module "node-mysql-wrapper" { noticeReady(): void; removeReadyListener(callback: () => void): void; query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void; - + /** * Close the entire real connection and remove all event's listeners (if exist). - * the difference from the 'end' is that this method doesn't care about errors so no callback passing here. + * the difference from the 'end' is that this method doesn't care about errors so no callback passing here. */ destroy(): void; - + /** * Close the entire real connection and remove all event's listeners (if exist). * @param {function} maybeAcallbackError If error occurs when closing the connection, this callback has the responsibility to catch it. * @returnType {nothing} - * @return {nothing} + * @return {nothing} */ end(maybeAcallbackError: (err: any) => void): void; @@ -820,7 +820,7 @@ declare module "node-mysql-wrapper" { } function wrap(mysqlUrlOrObjectOrMysqlAlreadyConnection: Mysql.IConnection | string, ...useTables: any[]): Database; - + /** For meteor js only * Same as wrap but it's sync mode - autoconnect to the database without need to use database.ready(callback). */ diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index cd30f2acdc..a0d20a92f0 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -3,7 +3,7 @@ // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// /// /// @@ -45,7 +45,7 @@ declare module "nodemailer" { * Send mail using a template. */ templateSender(template?: any, defaults?: any): (mailData: any, context: any) => Promise; - + /** * Send mail using a template with a callback. */ @@ -59,7 +59,7 @@ declare module "nodemailer" { * @param pluginFunc is a function that takes two arguments: the mail object and a callback function */ use(step: string, plugin: Plugin): void; - + /** * Verifies connection with server */ diff --git a/orientjs/orientjs.d.ts b/orientjs/orientjs.d.ts index 3edca67ba7..c528990a67 100644 --- a/orientjs/orientjs.d.ts +++ b/orientjs/orientjs.d.ts @@ -5,7 +5,7 @@ // Developed with love in www.nowcando.com /// -/// +/// /* =================== USAGE =================== diff --git a/pify/pify-tests.ts b/pify/pify-tests.ts index b80657df76..f166901d3e 100644 --- a/pify/pify-tests.ts +++ b/pify/pify-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// import * as pify from 'pify'; import * as Bluebird from 'bluebird'; @@ -28,4 +28,4 @@ const fsP = pify(fs); fsP.readFile('foo.txt').then((result: string) => assert(result, 'foo')); pify(fs.readFile)('foo.txt').then((result: string) => assert(result, 'foo')); -pify(fs.readFile, Bluebird)('bar.txt').then((result: string) => assert(result, 'bar')); \ No newline at end of file +pify(fs.readFile, Bluebird)('bar.txt').then((result: string) => assert(result, 'bar')); diff --git a/project-oxford/project-oxford-tests.ts b/project-oxford/project-oxford-tests.ts index 896d407b8d..9d25a8a233 100644 --- a/project-oxford/project-oxford-tests.ts +++ b/project-oxford/project-oxford-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// /// /// diff --git a/project-oxford/project-oxford.d.ts b/project-oxford/project-oxford.d.ts index 012ec82113..18ccdee1d3 100644 --- a/project-oxford/project-oxford.d.ts +++ b/project-oxford/project-oxford.d.ts @@ -3,8 +3,8 @@ // Definitions by: Scott Southwood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -/// +/// +/// declare module "project-oxford" { import Promise = require("bluebird"); diff --git a/redlock/redlock.d.ts b/redlock/redlock.d.ts index 94ee8f3c7a..f0225d6c71 100644 --- a/redlock/redlock.d.ts +++ b/redlock/redlock.d.ts @@ -3,23 +3,23 @@ // Definitions by: Ilya Mochalov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare module "redlock" { import * as redis from 'redis'; - import * as Promise from 'bluebird'; - + import * as Promise from 'bluebird'; + namespace Redlock { - + interface Callback { (err: any, value?: T): void; } interface Lock { - + redlock: Redlock; resource: string; value: any; @@ -38,7 +38,7 @@ declare module "redlock" { interface LockError extends Error {} } - + class Redlock { driftFactor: number; @@ -59,6 +59,6 @@ declare module "redlock" { extend(lock: Redlock.Lock, ttl: number, callback?: Redlock.Callback): Promise; } - + export = Redlock; } diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index a9d6cae855..5a5927284f 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -/// +/// declare module 'request-promise' { import request = require('request'); diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index 7161e42060..0ac674977a 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Reference: http://www.rethinkdb.com/api/#js // TODO: Document manipulation and below -/// +/// declare module "rethinkdb" { diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 4cf94ce77d..00351328f0 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -6,7 +6,7 @@ // Based on original work by: samuelneff /// -/// +/// /// declare module "sequelize" { diff --git a/stamplay-js-sdk/stamplay-js-sdk.d.ts b/stamplay-js-sdk/stamplay-js-sdk.d.ts index 952ed78ea0..1f2ec68500 100644 --- a/stamplay-js-sdk/stamplay-js-sdk.d.ts +++ b/stamplay-js-sdk/stamplay-js-sdk.d.ts @@ -3,7 +3,7 @@ // Definitions by: Riderman de Sousa Barbosa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare namespace Stamplay { diff --git a/stripe-node/stripe-node.d.ts b/stripe-node/stripe-node.d.ts index 1e3d2caca7..cd2d41bf51 100644 --- a/stripe-node/stripe-node.d.ts +++ b/stripe-node/stripe-node.d.ts @@ -3,7 +3,7 @@ // Definitions by: William Johnston , Peter Harris // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare module 'stripe' { @@ -16,7 +16,7 @@ declare namespace StripeNode { new (apiKey: string, version?: string): Stripe; (apiKey: string, version?: string): Stripe; } - + interface StripeStatic { DEFAULT_HOST: string; DEFAULT_PORT: string; @@ -37,11 +37,11 @@ declare namespace StripeNode { resources: typeof resources; StripeResource: typeof StripeResource; } - - // Helper + + // Helper type IBankAccount = bankAccounts.IBankAccount; type ICard = cards.ICard; - + interface Stripe extends StripeStatic { accounts: resources.Accounts; balance: resources.Balance; @@ -72,11 +72,11 @@ declare namespace StripeNode { orders: resources.Orders; products: resources.Products; skus: resources.SKUs; - + setHost(host: string): void; setHost(host: string, port: string|number): void; setHost(host: string, port: string|number, protocol: string): void; - + setProtocol(protocol: string): void; setPort(port: string|number): void; setApiVersion(version?: string): void; @@ -86,274 +86,274 @@ declare namespace StripeNode { getConstant(c: string): any; getClientUserAgent(response: (userAgent: string) => void): void; } - - namespace accounts { + + namespace accounts { interface IAccount extends IResourceObject, IAccountShared { /** * Value is "account" */ object: string; - + /** * Whether or not the account can create live charges */ charges_enabled: boolean; - + /** * The country of the account */ country: string; - + /** - * Whether or not account details have been submitted yet. Standalone + * Whether or not account details have been submitted yet. Standalone * accounts cannot receive transfers before this is true. */ details_submitted: boolean; - + /** - * The display name for this account. This is used on the Stripe dashboard to + * The display name for this account. This is used on the Stripe dashboard to * help you differentiate between accounts. */ display_name: string; - + /** - * Whether or not Stripe will send automatic transfers for this account. This - * is only false when Stripe is waiting for additional information from the + * Whether or not Stripe will send automatic transfers for this account. This + * is only false when Stripe is waiting for additional information from the * account holder. */ transfers_enabled: boolean; - + /** - * The state of the account’s information requests, including what + * The state of the account’s information requests, including what * information is needed and by when it must be provided. */ verification: { /** - * A string describing the reason for this account being unable to charge - * and/or transfer, if that is the case. Possible values are "rejected.fraud", - * "rejected.terms_of_service", "rejected.listed", "rejected.other", + * A string describing the reason for this account being unable to charge + * and/or transfer, if that is the case. Possible values are "rejected.fraud", + * "rejected.terms_of_service", "rejected.listed", "rejected.other", * "fields_needed", "listed", or "other". */ disabled_reason: string; - + /** - * At what time the fields_needed must be provided. If this date is in - * the past, the account is already in bad standing, and providing - * fields_needed is necessary to re-enable transfers and prevent other - * consequences. If this date is in the future, fields_needed must be + * At what time the fields_needed must be provided. If this date is in + * the past, the account is already in bad standing, and providing + * fields_needed is necessary to re-enable transfers and prevent other + * consequences. If this date is in the future, fields_needed must be * provided to ensure the account remains in good standing. */ due_by: number; - + /** - * Field names that need to be provided for the account to remain in good - * standing. Nested fields are separated by "." (for example, + * Field names that need to be provided for the account to remain in good + * standing. Nested fields are separated by "." (for example, * "legal_entity.first_name"). */ fields_needed: Array; } } - + interface IAccountCreationOptions extends IAccountUpdateOptions { /** - * The country the account holder resides in or that the business is legally - * established in. For example, if you are in the United States and the - * business you’re creating an account for is legally represented in Canada, + * The country the account holder resides in or that the business is legally + * established in. For example, if you are in the United States and the + * business you’re creating an account for is legally represented in Canada, * you would use “CA” as the country for the account being created. */ country?: string; - + /** - * The email address of the account holder. For standalone accounts, Stripe - * will email your user with instructions for how to set up their account. For - * managed accounts, this is only to make the account easier to identify to + * The email address of the account holder. For standalone accounts, Stripe + * will email your user with instructions for how to set up their account. For + * managed accounts, this is only to make the account easier to identify to * you: Stripe will never directly reach out to your users. */ email: string; - + /** - * Whether you'd like to create a managed or standalone account. Managed - * accounts have extra parameters available to them, and require that you, - * the platform, handle all communication with the account holder. - * Standalone accounts are normal Stripe accounts: Stripe will email the - * account holder to setup a username and password, and handle all account + * Whether you'd like to create a managed or standalone account. Managed + * accounts have extra parameters available to them, and require that you, + * the platform, handle all communication with the account holder. + * Standalone accounts are normal Stripe accounts: Stripe will email the + * account holder to setup a username and password, and handle all account * management directly with them. */ managed?: boolean; } - + interface IAccountShared { business_logo?: string; - + /** * The publicly sharable name for this account */ business_name?: string; - + /** - * A CSS hex color value representing the primary branding color for this + * A CSS hex color value representing the primary branding color for this * account */ business_primary_color?: string; - + /** * The URL that best shows the service or product provided for this account */ business_url?: string; - + /** - * A boolean for whether or not Stripe should try to reclaim negative - * balances from the account holder’s bank account. See our managed + * A boolean for whether or not Stripe should try to reclaim negative + * balances from the account holder’s bank account. See our managed * account bank transfer guide for more information */ debit_negative_balances?: boolean; - + /** - * Account-level settings to automatically decline certain types of charges + * Account-level settings to automatically decline certain types of charges * regardless of the bank’s decision. */ decline_charge_on?: { /** - * Whether or not Stripe should automatically decline charges with an - * incorrect zip/postal code. This setting only applies if a card includes a + * Whether or not Stripe should automatically decline charges with an + * incorrect zip/postal code. This setting only applies if a card includes a * zip code and the bank specifically marks it as failed. */ avs_failure?: boolean; - + /** - * Whether or not Stripe should automatically decline charges with an - * incorrect CVC. This setting only applies if a card includes a CVC and the + * Whether or not Stripe should automatically decline charges with an + * incorrect CVC. This setting only applies if a card includes a CVC and the * bank specifically marks it as failed. */ cvc_failure?: boolean; }; - + /** - * Three-letter ISO currency code representing the default currency for the - * account. This must be a currency that Stripe supports in the account’s + * Three-letter ISO currency code representing the default currency for the + * account. This must be a currency that Stripe supports in the account’s * country. */ default_currency?: string; - + /** - * Email address of the account holder. For standalone accounts, this is used - * to email them asking them to claim their Stripe account. For managed - * accounts, this is only to make the account easier to identify to you: Stripe + * Email address of the account holder. For standalone accounts, this is used + * to email them asking them to claim their Stripe account. For managed + * accounts, this is only to make the account easier to identify to you: Stripe * will not email the account holder. */ email?: string; - + /** - * Information about the holder of this account, i.e. the user receiving funds + * Information about the holder of this account, i.e. the user receiving funds * from this account */ legal_entity?: {}; //TODO: Implement this type definition. - + /** - * A set of key/value pairs that you can attach to an account object. It can be - * useful for storing additional information about the account in a structured + * A set of key/value pairs that you can attach to an account object. It can be + * useful for storing additional information about the account in a structured * format. This can be unset by updating the value to null and then saving. */ metadata?: IMetadata; - + /** - * Internal-only description of the product being sold or service being - * provided by this account. It’s used by Stripe for risk and underwriting + * Internal-only description of the product being sold or service being + * provided by this account. It’s used by Stripe for risk and underwriting * purposes. */ product_description?: string; - + /** - * The text that will appear on credit card statements by default if a charge is + * The text that will appear on credit card statements by default if a charge is * being made directly on the account. */ statement_descriptor?: string; - + /** - * A publicly shareable email address that can be reached for support for this + * A publicly shareable email address that can be reached for support for this * account */ support_email?: string; - + /** - * A publicly shareable phone number that can be reached for support for + * A publicly shareable phone number that can be reached for support for * this account */ support_phone?: string; - + /** * A publicly shareable URL that can be reached for support for this account */ support_url?: string; - + /** - * Details on who accepted the Stripe terms of service, and when they - * accepted it. See our updating managed accounts guide for more + * Details on who accepted the Stripe terms of service, and when they + * accepted it. See our updating managed accounts guide for more * information */ tos_acceptance?: { /** - * The unix timestamp that Stripe’s terms of service were agreed to by the + * The unix timestamp that Stripe’s terms of service were agreed to by the * account holder */ date: number; - + /** * The IP address from which Stripe’s terms of service were agreed to by the account holder */ ip?: string; - + /** - * The user agent of the browser from which Stripe’s terms of service + * The user agent of the browser from which Stripe’s terms of service * were agreed to by the account holder */ user_agent?: string; }; - + /** - * Details on when this account will make funds from charges available, and - * when they will be paid out to the account holder’s bank account. See our + * Details on when this account will make funds from charges available, and + * when they will be paid out to the account holder’s bank account. See our * managed account bank transfer guide for more information */ transfer_schedule?: { /** - * The number of days charges for the account will be held before being - * paid out. May also be the string “minimum” for the lowest available - * value (based on country). Default is “minimum”. Does not apply when + * The number of days charges for the account will be held before being + * paid out. May also be the string “minimum” for the lowest available + * value (based on country). Default is “minimum”. Does not apply when * interval is “manual”. */ delay_days?: number | string; - + /** - * How frequently funds will be paid out. One of "manual" (for only + * How frequently funds will be paid out. One of "manual" (for only * triggered via API call), "daily", "weekly", or "monthly". Default is "daily". */ interval?: string; - + /** - * The day of the month funds will be paid out. Required and available + * The day of the month funds will be paid out. Required and available * only if interval is "monthly". */ monthly_anchor?: number; - + /** - * The day of the week funds will be paid out, of the style ‘monday’, + * The day of the week funds will be paid out, of the style ‘monday’, * ‘tuesday’, etc. Required and available only if interval is weekly. */ weekly_anchor?: string; } } - + interface IAccountUpdateOptions extends IDataOptions, IAccountShared { /** - * A card or bank account to attach to the account. You can provide either a - * token, like the ones returned by Stripe.js, or a dictionary as documented in - * the external_account parameter for either card or bank account creation. - * - * This will create a new external account object, make it the new default - * external account for its currency, and delete the old default if one exists. If - * you want to add additional external accounts instead of replacing the - * existing default for this currency, use the bank account or card creation + * A card or bank account to attach to the account. You can provide either a + * token, like the ones returned by Stripe.js, or a dictionary as documented in + * the external_account parameter for either card or bank account creation. + * + * This will create a new external account object, make it the new default + * external account for its currency, and delete the old default if one exists. If + * you want to add additional external accounts instead of replacing the + * existing default for this currency, use the bank account or card creation * API. */ external_account?: { @@ -361,241 +361,241 @@ declare namespace StripeNode { * The type of external account. Should be "bank_account". */ object: string; - + /** - * The account number for the bank account in string form. Must be a + * The account number for the bank account in string form. Must be a * checking account. */ account_number: string; - + /** * The country the bank account is in. */ country: string; - + /** - * The currency the bank account is in. This must be a country/currency + * The currency the bank account is in. This must be a country/currency * pairing that Stripe supports. */ currency: string; - + /** - * The name of the person or business that owns the bank account. This + * The name of the person or business that owns the bank account. This * field is required when attaching the bank account to a customer object. */ account_holder_name?: string; - + /** - * The type of entity that holds the account. This can be either - * "individual" or "company". This field is required when attaching the + * The type of entity that holds the account. This can be either + * "individual" or "company". This field is required when attaching the * bank account to a customer object. */ account_holder_type?: string; - + /** - * The routing number, sort code, or other country-appropriate institution - * number for the bank account. For US bank accounts, this is required - * and should be the ACH routing number, not the wire routing number. If - * you are providing an IBAN for account_number, this field is not + * The routing number, sort code, or other country-appropriate institution + * number for the bank account. For US bank accounts, this is required + * and should be the ACH routing number, not the wire routing number. If + * you are providing an IBAN for account_number, this field is not * required. */ routing_number?: string; } } - + interface IExternalAccountCreationOptions extends IDataOptionsWithMetadata { /** - * When adding a card to a customer, the parameter name is source. When - * adding to an account, the parameter name is external_account. The - * value can either be a token, like the ones returned by our Stripe.js, or a - * dictionary containing a user’s credit card details (with the options shown + * When adding a card to a customer, the parameter name is source. When + * adding to an account, the parameter name is external_account. The + * value can either be a token, like the ones returned by our Stripe.js, or a + * dictionary containing a user’s credit card details (with the options shown * below). Stripe will automatically validate the card. */ external_account: string ; - + /** - * Only applicable on accounts (not customers or recipients). If you set this to true (or if this is the first external account being added + * Only applicable on accounts (not customers or recipients). If you set this to true (or if this is the first external account being added * in this currency) this card will become the default external account for its currency. */ default_for_currency?: boolean; } - + interface IExternalAccountUpdateOptions extends IDataOptionsWithMetadata { /** * If set to true, this bank account will become the default external account for its currency. */ default_for_currency?: boolean; } - + interface IBankAccountListOptions extends IListOptions { object: "bank_account" } - + interface ICardListOptions extends IListOptions { object: "card" } - + interface IRejectReason { /** - * The reason for rejecting the account. May be one of "fraud", + * The reason for rejecting the account. May be one of "fraud", * "terms_of_service", or "other". */ reason: "fraud" | "terms_of_service" | "other" ; } } - - namespace applicationFees { + + namespace applicationFees { interface IApplicationFee extends IResourceObject { /** * Value is "application_fee" */ object: string; - + /** * ID of the Stripe account this fee was taken from. [Expandable] */ account: string | accounts.IAccount; - + /** * Amount earned, in cents/pence. */ amount: number; - + /** * Positive integer or zero */ amount_refunded: number; - + /** * ID of the Connect Application that earned the fee. [Expandable] */ application: string; //TODO: Implement IApplication interface and reference type here for expansion:- "string | IApplication" - + /** - * Balance transaction that describes the impact of this collected application + * Balance transaction that describes the impact of this collected application * fee on your account balance (not including refunds). [Expandable] */ balance_transaction: string | balance.IBalanceTransaction; - + /** * ID of the charge that the application fee was taken from. [Expandable] */ charge: string | charges.ICharge; - + created: number; - + /** * Three-letter ISO code representing the currency of the charge. */ currency: string; - + livemode: boolean; - + /** - * ID of the corresponding charge on the platform account, if this fee was the + * ID of the corresponding charge on the platform account, if this fee was the * result of a charge using the destination parameter. [Expandable] */ originating_transaction: string; - + /** - * Whether or not the fee has been fully refunded. If the fee is only partially + * Whether or not the fee has been fully refunded. If the fee is only partially * refunded, this attribute will still be false. */ refunded: boolean; - + /** * A list of refunds that have been applied to the fee. */ refunds: IApplicationFeeRefunds; } - + interface IApplicationFeeListOptions extends IListOptionsCreated { /** * Only return application fees for the charge specified by this charge ID. */ charge: string; } - + interface IApplicationFeeRefund extends IResourceObject { /** * Value is "fee_refund" */ object:string; - + /** * Amount, in cents/pence. */ amount: number; - + /** * Balance transaction that describes the impact on your account balance. */ balance_transaction: string | balance.IBalanceTransaction; - + created: number; - + /** * Three-letter ISO code representing the currency. */ currency: string; - + /** * ID of the application fee that was refunded. */ fee: string | IApplicationFee; - + /** - * A set of key/value pairs that you can attach to the object. It can be useful + * A set of key/value pairs that you can attach to the object. It can be useful * for storing additional information in a structured format. */ metadata: IMetadata; } - + interface IApplicationFeeRefunds extends IList, resources.ApplicationFeeRefunds { } - + interface IApplicationFeeRefundCreationOptions extends IDataOptions { /** - * A positive integer in pence representing how much of this fee to refund. + * A positive integer in pence representing how much of this fee to refund. * Can only refund up to the unrefunded amount remaining of the fee. - * + * * default is entire application fee */ amount?: number; - + /** - * A set of key/value pairs that you can attach to a refund object. It can be - * useful for storing additional information about the refund in a structured - * format. You can unset an individual key by setting its value to null and + * A set of key/value pairs that you can attach to a refund object. It can be + * useful for storing additional information about the refund in a structured + * format. You can unset an individual key by setting its value to null and * then saving. To clear all keys, set metadata to null, then save. */ metadata?: IMetadata; } } - + namespace balance { interface IBalance extends IObject { /** * Value is 'balance' */ object: string; - + /** - * Funds that are available to be paid out automatically by Stripe or explicitly - * via the transfers API. The available balance for each currency and payment + * Funds that are available to be paid out automatically by Stripe or explicitly + * via the transfers API. The available balance for each currency and payment * type can be found in the source_types property. */ available: Array; - + livemode: boolean; - + /** - * Funds that are not available in the balance yet, due to the 7-day rolling pay - * cycle. The pending balance for each currency and payment type can be + * Funds that are not available in the balance yet, due to the 7-day rolling pay + * cycle. The pending balance for each currency and payment type can be * found in the source_types property */ pending: Array; } - + interface ISourceType { currency: string; amount: number; @@ -606,7 +606,7 @@ declare namespace StripeNode { alipay_account?: number; } } - + interface IBalanceTransaction extends IResourceObject { /** * Value is 'balance_transaction' @@ -622,16 +622,16 @@ declare namespace StripeNode { * The date the transaction's net funds will become available in the Stripe balance. */ available_on: number; - + created: number; /** * Three-letter ISO currency code representing the currency. */ currency: string; - + description?: string; - + /** * Fee (in cents/pence) paid for this transaction */ @@ -643,14 +643,14 @@ declare namespace StripeNode { fee_details: Array<{ amount: number; application: string; - + /** * Three-letter ISO currency code representing the currency of the amount that was disputed. */ currency: string; - + description: string; - + /** * Type of the fee, one of: "application_fee", "stripe_fee"" or "tax". */ @@ -661,50 +661,50 @@ declare namespace StripeNode { * Net amount of the transaction, in cents. */ net: number; - + /** * The Stripe object this transaction is related to. [Expandable] */ source: string | IResourceObject; - + /** * The transfers (if any) for which source is a source_transaction. */ source_transfers: IList; - + /** * If the transaction's net funds are available in the Stripe balance yet. Either "available" or "pending". */ status: string; /** - * Transaction type: "adjustment", "application_fee", - * "application_fee_refund", "charge", "payment", "payment_refund", - * "refund", "transfer", "transfer_cancel", "transfer_failure", or + * Transaction type: "adjustment", "application_fee", + * "application_fee_refund", "charge", "payment", "payment_refund", + * "refund", "transfer", "transfer_cancel", "transfer_failure", or * "transfer_refund". */ type: string; } - + interface IBalanceListOptions extends IListOptions { available_on?: string | IDateFilter; currency?: string; - + /** - * Only returns transactions that are related to the specified Stripe object ID + * Only returns transactions that are related to the specified Stripe object ID * (e.g. filtering by a charge ID will return all related charge transactions). */ source?: string; - + /** - * For automatic Stripe transfers only, only returns transactions that were + * For automatic Stripe transfers only, only returns transactions that were * transferred out on the specified transfer ID. */ transfer?: string; - + /** - * Only returns transactions of the given type. One of: "charge", "refund", - * "adjustment", "application_fee", "application_fee_refund", "transfer", + * Only returns transactions of the given type. One of: "charge", "refund", + * "adjustment", "application_fee", "application_fee_refund", "transfer", * or "transfer_failure" */ type?: string; @@ -727,25 +727,25 @@ declare namespace StripeNode { * Amount charged in cents/pence, positive integer or zero. */ amount: number; - + /** - * Amount in cents/pence refunded (can be less than the amount attribute on the + * Amount in cents/pence refunded (can be less than the amount attribute on the * charge if a partial refund was issued), positive integer or zero. */ amount_refunded: number; - + /** - * The application fee (if any) for the charge. See the Connect documentation + * The application fee (if any) for the charge. See the Connect documentation * for details. [Expandable] */ application_fee?: string; - + /** - * ID of the balance transaction that describes the impact of this charge on + * ID of the balance transaction that describes the impact of this charge on * your account balance (not including refunds or disputes). [Expandable] */ balance_transaction: string | balance.IBalanceTransaction; - + /** * If the charge was created without capturing, this boolean represents whether or not it is * still uncaptured or has since been captured. @@ -755,34 +755,34 @@ declare namespace StripeNode { created: number; /** - * Three-letter ISO currency code representing the currency in which the + * Three-letter ISO currency code representing the currency in which the * charge was made. */ currency: string; - + /** * ID of the customer this charge is for if one exists. [Expandable] */ customer: string | customers.ICustomer; - + description?: string; - + /** * Details about the dispute if the charge has been disputed. */ dispute?: disputes.IDispute; - + /** * Error code explaining reason for charge failure if available (see the errors section for a list of * codes: https://stripe.com/docs/api#errors). */ failure_code: string; - + /** * Message to user further explaining reason for charge failure if available. */ failure_message: string; - + /** * Hash with information on fraud assessments for the charge. */ @@ -797,36 +797,36 @@ declare namespace StripeNode { */ stripe_report?: "fraudulent"; }; - + /** * ID of the invoice this charge is for if one exists. [Expandable] */ invoice: string | invoices.IInvoice; - + livemode: boolean; - + metadata: IMetadata; - + /** * ID of the order this charge is for if one exists. [Expandable] */ order: string | orders.IOrder; - + /** * true if the charge succeeded, or was successfully authorized for later capture. */ paid: boolean; - + /** * This is the email address that the receipt for this charge was sent to. */ receipt_email: string; - + /** * This is the transaction number that appears on email receipts sent for this charge. */ receipt_number: string; - + /** * Whether or not the charge has been fully refunded. If the charge is only partially refunded, * this attribute will still be false. @@ -837,150 +837,150 @@ declare namespace StripeNode { * A list of refunds that have been applied to the charge. */ refunds: IChargeRefunds; - + /** * Shipping information for the charge. */ shipping?: IShippingInformation; - + /** * For most Stripe users, the source of every charge is a credit or debit card. * This hash is then the card object describing that card. */ source: cards.ICard | bitcoinReceivers.IBitcoinReceiver; - + /** - * The transfer ID which created this charge. Only present if the charge came + * The transfer ID which created this charge. Only present if the charge came * from another Stripe account. See the Connect documentation for details. * [Expandable] */ source_transfer: string | transfers.ITransfer; - + /** - * Extra information about a charge. This will appear on your customer’s + * Extra information about a charge. This will appear on your customer’s * credit card statement. */ statement_descriptor: string; - + /** * The status of the payment is either "succeeded", "pending", or "failed". */ status: "succeeded" | "pending" | "failed"; - + /** - * ID of the transfer to the destination account (only applicable if the + * ID of the transfer to the destination account (only applicable if the * charge was created using the destination parameter). [Expandable] */ transfer: string | transfers.ITransfer; } - + interface IChargeCreationOptions extends IDataOptions { /** - * A positive integer in the smallest currency unit (e.g 100 cents to charge - * $1.00, or 1 to charge ¥1, a 0-decimal currency) representing how much to - * charge the card. The minimum amount is £0.50 (or equivalent in charge + * A positive integer in the smallest currency unit (e.g 100 cents to charge + * $1.00, or 1 to charge ¥1, a 0-decimal currency) representing how much to + * charge the card. The minimum amount is £0.50 (or equivalent in charge * currency). */ amount: number; - + /** * 3-letter ISO code for currency. */ currency: string; - + /** - * A fee in pence that will be applied to the charge and transferred to the - * application owner's Stripe account. To use an application fee, the request - * must be made on behalf of another account, using the Stripe-Account - * header, an OAuth key, or the destination parameter. For more + * A fee in pence that will be applied to the charge and transferred to the + * application owner's Stripe account. To use an application fee, the request + * must be made on behalf of another account, using the Stripe-Account + * header, an OAuth key, or the destination parameter. For more * information, see the application fees documentation. - * + * * Connect only. */ application_fee?: number; - + /** - * Whether or not to immediately capture the charge. When false, the charge - * issues an authorization (or pre-authorization), and will need to be - * captured later. Uncaptured charges expire in 7 days. For more information, + * Whether or not to immediately capture the charge. When false, the charge + * issues an authorization (or pre-authorization), and will need to be + * captured later. Uncaptured charges expire in 7 days. For more information, * see authorizing charges and settling later. */ capture?: boolean; - + /** - * An arbitrary string which you can attach to a charge object. It is displayed - * when in the web interface alongside the charge. Note that if you use Stripe - * to send automatic email receipts to your customers, your receipt emails + * An arbitrary string which you can attach to a charge object. It is displayed + * when in the web interface alongside the charge. Note that if you use Stripe + * to send automatic email receipts to your customers, your receipt emails * will include the description of the charge(s) that they are describing. */ description?: string; - + /** - * An account to make the charge on behalf of. If specified, the charge will be - * attributed to the destination account for tax reporting, and the funds from - * the charge will be transferred to the destination account. The ID of the - * resulting transfer will be returned in the transfer field of the response. See + * An account to make the charge on behalf of. If specified, the charge will be + * attributed to the destination account for tax reporting, and the funds from + * the charge will be transferred to the destination account. The ID of the + * resulting transfer will be returned in the transfer field of the response. See * the documentation for details. - * + * * Connect only. */ destination?: string; - + /** - * A set of key/value pairs that you can attach to a charge object. It can be - * useful for storing additional information about the customer in a - * structured format. It's often a good idea to store an email address in + * A set of key/value pairs that you can attach to a charge object. It can be + * useful for storing additional information about the customer in a + * structured format. It's often a good idea to store an email address in * metadata for tracking later. */ metadata?: IMetadata; - + /** - * The email address to send this charge's receipt to. The receipt will not be - * sent until the charge is paid. If this charge is for a customer, the email - * address specified here will override the customer's email address. - * Receipts will not be sent for test mode charges. If receipt_email is - * specified for a charge in live mode, a receipt will be sent regardless of your + * The email address to send this charge's receipt to. The receipt will not be + * sent until the charge is paid. If this charge is for a customer, the email + * address specified here will override the customer's email address. + * Receipts will not be sent for test mode charges. If receipt_email is + * specified for a charge in live mode, a receipt will be sent regardless of your * email settings. */ receipt_email?: string; - + /** - * Shipping information for the charge. Helps prevent fraud on charges for - * physical goods. For more information, see the Charge object + * Shipping information for the charge. Helps prevent fraud on charges for + * physical goods. For more information, see the Charge object * documentation. */ shipping?: IShippingInformation; - + /** * The ID of an existing customer that will be charged in this request. */ customer?: string; - + /** - * A payment source to be charged, such as a credit card. If you also pass a - * customer ID, the source must be the ID of a source belonging to the - * customer. Otherwise, if you do not pass a customer ID, the source you - * provide must either be a token, like the ones returned by Stripe.js, or a - * object containing a user's credit card details, with the options described - * below. Although not all information is required, the extra info helps + * A payment source to be charged, such as a credit card. If you also pass a + * customer ID, the source must be the ID of a source belonging to the + * customer. Otherwise, if you do not pass a customer ID, the source you + * provide must either be a token, like the ones returned by Stripe.js, or a + * object containing a user's credit card details, with the options described + * below. Although not all information is required, the extra info helps * prevent fraud. */ source?: sources.ISourceCreationOptions; - + /** - * An arbitrary string to be displayed on your customer's credit card - * statement. This may be up to 22 characters. As an example, if your - * website is RunClub and the item you're charging for is a race ticket, you - * may want to specify a statement_descriptor of - * RunClub 5K race ticket. The statement description may not include - * <>"' characters, and will appear on your customer's statement in capital - * letters. Non-ASCII characters are automatically stripped. While most - * banks display this information consistently, some may display it + * An arbitrary string to be displayed on your customer's credit card + * statement. This may be up to 22 characters. As an example, if your + * website is RunClub and the item you're charging for is a race ticket, you + * may want to specify a statement_descriptor of + * RunClub 5K race ticket. The statement description may not include + * <>"' characters, and will appear on your customer's statement in capital + * letters. Non-ASCII characters are automatically stripped. While most + * banks display this information consistently, some may display it * incorrectly or not at all. */ statement_descriptor?: string; } - + interface IChargeUpdateOptions extends IDataOptionsWithMetadata { /** * An arbitrary string which you can attach to a charge object. It is displayed when in the web interface alongside the charge. @@ -988,7 +988,7 @@ declare namespace StripeNode { * of the charge(s) that they are describing. This can be unset by updating the value to null and then saving. */ description?: string; - + /** * A set of key/value pairs you can attach to a charge giving information about its riskiness. */ @@ -1006,27 +1006,27 @@ declare namespace StripeNode { * If this field is updated, then a new email receipt will be sent to the updated address. */ receipt_email?: string; - + /** - * Shipping information for the charge. Helps prevent fraud on charges for + * Shipping information for the charge. Helps prevent fraud on charges for * physical goods. */ shipping?: IShippingInformation; } - + interface IChargeListOptions extends IListOptionsCreated { /** * Only return charges for the customer specified by this customer ID. */ customer?: string; - + /** - * A filter on the list based on the source of the charge. The value can be a + * A filter on the list based on the source of the charge. The value can be a * dictionary with the following options: */ source?: { /** - * Return charges that match this source type string. Available options are + * Return charges that match this source type string. Available options are * "all", "alipay_account", "bitcoin_receiver", or "card". */ object: "all" | "alipay_account" | "bitcoin_receiver" | "card"; @@ -1035,7 +1035,7 @@ declare namespace StripeNode { interface IChargeRefunds extends IList, resources.ChargeRefunds { } } - + namespace coupons { /** * A discount represents the actual application of a coupon to a particular customer. It contains information @@ -1046,20 +1046,20 @@ declare namespace StripeNode { * Value is 'discount' */ object: "discount"; - + /** * Hash describing the coupon applied to create this discount */ coupon: ICoupon; - + customer: string; - + /** * If the coupon has a duration of once or repeating, the date that this discount will end. If the coupon * used has a forever duration, this attribute will be null. */ end: number; - + /** * Date that the coupon was applied */ @@ -1080,36 +1080,36 @@ declare namespace StripeNode { * Value is 'coupon' */ object: "coupon"; - + /** * Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer. */ amount_off: number; - + created: number; - + /** * If amount_off has been set, the currency of the amount to take off. */ currency: string; - + /** * One of "forever", "once", and "repeating". Describes how long a customer who applies this coupon will get the discount. */ duration: "forever" | "once" | "repeating" ; - + /** * If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once. */ duration_in_months: number; - + livemode: boolean; - + /** * Maximum number of times this coupon can be redeemed, in total, before it is no longer valid. */ max_redemptions: number; - + metadata: IMetadata; /** @@ -1133,39 +1133,39 @@ declare namespace StripeNode { */ valid: boolean; } - + interface ICouponCreationOptions extends IDataOptionsWithMetadata { /** - * Unique string of your choice that will be used to identify this coupon when applying it to a customer. This is often a specific - * code you’ll give to your customer to use when signing up (e.g. FALL25OFF). If you don’t want to specify a particular code, you + * Unique string of your choice that will be used to identify this coupon when applying it to a customer. This is often a specific + * code you’ll give to your customer to use when signing up (e.g. FALL25OFF). If you don’t want to specify a particular code, you * can leave the ID blank and we’ll generate a random code for you. */ id?: string; - + /** * Specifies how long the discount will be in effect. Can be forever, once, or repeating. */ duration: "forever" | "once" | "repeating" ; - + /** * A positive integer representing the amount to subtract from an invoice total (required if percent_off is not passed) */ amount_off?: number; - + /** * Currency of the amount_off parameter (required if amount_off is passed) */ currency?: string; - + /** - * Required only if duration is repeating, in which case it must be a positive integer that specifies the number of months + * Required only if duration is repeating, in which case it must be a positive integer that specifies the number of months * the discount will be in effect. */ duration_in_months?: number; - + /** - * A positive integer specifying the number of times the coupon can be redeemed before it’s no longer valid. - * + * A positive integer specifying the number of times the coupon can be redeemed before it’s no longer valid. + * * For example, you might have a 50% off coupon that the first 20 readers of your blog can use. */ max_redemptions?: number; @@ -1176,13 +1176,13 @@ declare namespace StripeNode { percent_off?: number; /** - * Unix timestamp specifying the last time at which the coupon can be redeemed. + * Unix timestamp specifying the last time at which the coupon can be redeemed. * After the redeem_by date, the coupon can no longer be applied to new customers. */ redeem_by?: number; } } - + namespace customers { /** * Customer objects allow you to perform recurring charges and track multiple charges that are associated @@ -1194,7 +1194,7 @@ declare namespace StripeNode { * Value is 'customer' */ object: "customer"; - + /** * Current balance, if any, being stored on the customer's account. If negative, the customer has credit to apply to * the next invoice. If positive, the customer has an amount owed that will be added to the next invoice. The balance @@ -1202,9 +1202,9 @@ declare namespace StripeNode { * to any invoice. This balance is only taken into account for recurring charges. */ account_balance?: number; - + created: number; - + /** * The currency the customer can be charged in for recurring billing purposes (subscriptions, invoices, invoice items). */ @@ -1219,40 +1219,40 @@ declare namespace StripeNode { * Whether or not the latest charge for the customer's latest invoice has failed */ delinquent: boolean; - + description?: string; - + /** * Describes the current discount active on the customer, if there is one. */ discount?: coupons.IDiscount; - + email?: string; - + livemode: boolean; - + metadata?: IMetadata; - + /** * Shipping information associated with the customer. */ shipping: IShippingInformation; - + /** * The customer’s payment sources, if any */ sources?: IList; - + cards?: resources.CustomerCards; - + /** * The customer's current subscriptions, if any */ subscriptions: ICustomerSubscriptions; } - + interface ICustomerSubscriptions extends IList, resources.CustomerSubscriptions {} - + interface ICustomerCreationOptions extends IDataOptionsWithMetadata { /** * An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that @@ -1277,7 +1277,7 @@ declare namespace StripeNode { * This can be unset by updating the value to null and then saving. */ email?: string; - + /** * The identifier of the plan to subscribe the customer to. If provided, the returned customer object will have a list of subscriptions * that the customer is currently subscribed to. If you subscribe a customer to a plan without a free trial, the customer must have a @@ -1291,24 +1291,24 @@ declare namespace StripeNode { * (5 x 10 cents) monthly. Defaults to 1 if not set. Only applies when the plan parameter is also provided. */ quantity?: number; - + shipping?: IShippingInformation; - + /** - * The source can either be a token, like the ones returned by our Stripe.js, or + * The source can either be a token, like the ones returned by our Stripe.js, or * a dictionary containing a user’s credit card details. */ source?: sources.ISourceCreationOptionsExtended; - + /** - * A positive decimal (with at most two decimal places) between 1 and 100. - * This represents the percentage of the subscription invoice subtotal that - * will be calculated and added as tax to the final amount each billing period. - * For example, a plan which charges $10/month with a tax_percent of 20.0 + * A positive decimal (with at most two decimal places) between 1 and 100. + * This represents the percentage of the subscription invoice subtotal that + * will be calculated and added as tax to the final amount each billing period. + * For example, a plan which charges $10/month with a tax_percent of 20.0 * will charge $12 per invoice. Can only be used if a plan is provided. */ tax_percent?: number; - + /** * Unix timestamp representing the end of the trial period the customer will get before being charged. If set, trial_end will * override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to @@ -1316,7 +1316,7 @@ declare namespace StripeNode { */ trial_end?: number; } - + interface ICustomerUpdateOptions extends IDataOptionsWithMetadata { /** * An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that @@ -1329,12 +1329,12 @@ declare namespace StripeNode { * API will not have the discount. */ coupon?: string; - + /** * ID of source to make the customer’s new default for invoice payments */ default_source?: string; - + /** * An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. This can * be unset by updating the value to null and then saving. @@ -1346,45 +1346,45 @@ declare namespace StripeNode { * This can be unset by updating the value to null and then saving. */ email?: string; - + shipping?: IShippingInformation; - + /** - * The source can either be a token, like the ones returned by our Stripe.js, or - * a dictionary containing a user’s credit card details (with the options shown - * below). Passing source will create a new source object, make it the new - * customer default source, and delete the old customer default if one exists. - * If you want to add additional sources instead of replacing the existing - * default, use the card creation API. Whenever you attach a card to a + * The source can either be a token, like the ones returned by our Stripe.js, or + * a dictionary containing a user’s credit card details (with the options shown + * below). Passing source will create a new source object, make it the new + * customer default source, and delete the old customer default if one exists. + * If you want to add additional sources instead of replacing the existing + * default, use the card creation API. Whenever you attach a card to a * customer, Stripe will automatically validate the card. */ source?: sources.ISourceCreationOptionsExtended; } - + interface ICustomerSourceCreationOptions extends IDataOptionsWithMetadata { /** - * When adding a card to a customer, the parameter name is source. When - * adding to an account, the parameter name is external_account. The - * value can either be a token, like the ones returned by our Stripe.js, or a - * dictionary containing a user’s credit card details (with the options shown + * When adding a card to a customer, the parameter name is source. When + * adding to an account, the parameter name is external_account. The + * value can either be a token, like the ones returned by our Stripe.js, or a + * dictionary containing a user’s credit card details (with the options shown * below). Stripe will automatically validate the card. */ source: sources.ISourceCreationOptions; } - + interface ICustomerCardSourceCreationOptions extends ICustomerSourceCreationOptions { source: cards.ISourceCreationOptions; } - + interface IBankAccountSourceListOptions extends IListOptions { object: "bank_account" } - + interface ICardSourceListOptions extends IListOptions { object: "card" } } - + namespace disputes { /** * A dispute occurs when a customer questions your charge with their bank or credit card company. @@ -1397,24 +1397,24 @@ declare namespace StripeNode { * Value is 'dispute' */ object: "dispute"; - + /** * Disputed amount. Usually the amount of the charge, but can differ (usually because of currency * fluctuation or because only part of the order is disputed). */ amount: number; - + /** * List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your * Stripe account as a result of this dispute. */ balance_transactions: Array; - + /** * ID of the charge that was disputed. [Expandable] */ charge: string | charges.ICharge; - + /** * Date dispute was opened */ @@ -1424,12 +1424,12 @@ declare namespace StripeNode { * Three-letter ISO currency code representing the currency of the amount that was disputed. */ currency: string; - + /** * Evidence provided to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. */ evidence: IDisputeEvidence; - + /** * Information about the evidence submission. */ @@ -1439,7 +1439,7 @@ declare namespace StripeNode { * if the customer's bank or credit card company doesn't allow a response for this particular dispute. */ due_by: number; - + /** * Whether or not evidence has been saved for this dispute. */ @@ -1450,26 +1450,26 @@ declare namespace StripeNode { * if no evidence submissions have occurred. If true, then delivery of the latest evidence is not guaranteed. */ past_due: boolean; - + /** * The number of times the evidence has been submitted. You may submit evidence a maximum of 5 times */ submission_count: number; }; - + /** * If true, it is still possible to refund the disputed payment. Once the payment has been fully * refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute. */ is_charge_refundable: boolean; - + livemode: boolean; metadata: IMetadata; - + /** - * Reason given by cardholder for dispute. - * Possible values are duplicate, fraudulent, subscription_canceled, product_unacceptable, - * product_not_received, unrecognized, credit_not_processed, incorrect_account_details, + * Reason given by cardholder for dispute. + * Possible values are duplicate, fraudulent, subscription_canceled, product_unacceptable, + * product_not_received, unrecognized, credit_not_processed, incorrect_account_details, * insufficient_funds, bank_cannot_process, debit_not_authorized, general. * Read more about dispute reasons: https://stripe.com/help/disputes#reasons */ @@ -1481,7 +1481,7 @@ declare namespace StripeNode { */ status: "warning_needs_response" | "warning_under_review" | "warning_closed" | "needs_response" | "response_disabled" | "under_review" | "charge_refunded" | "won" | "lost"; } - + interface IDisputeEvidence { /** * Any server or activity logs showing proof that the customer accessed or downloaded the purchased @@ -1629,7 +1629,7 @@ declare namespace StripeNode { */ uncategorized_text?: string; } - + interface IDisputeUpdateOptions extends IDataOptionsWithMetadata { /** * Evidence to upload to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. @@ -1637,108 +1637,108 @@ declare namespace StripeNode { evidence?: disputes.IDisputeEvidence; } } - + namespace events { interface IEvent extends IResourceObject { /** * Value is "event" */ object: "event"; - + /** - * The Stripe API version used to render data. + * The Stripe API version used to render data. * Note: this property is populated for events on or after October 31, 2014. */ api_version: string; - + created: number; - + /** * Hash containing data associated with the event. */ data: { /** - * describes the object the event is about. For example, an - * invoice.created event will have a full invoice object as the value of + * describes the object the event is about. For example, an + * invoice.created event will have a full invoice object as the value of * the object key. */ object: IObject; - + /** - * + * */ previous_attributes?: {}; }; - + livemode: boolean; - + /** * Number of webhooks yet to be delivered successfully (return a 20x response) to the URLs you’ve specified. - * + * * positive integer or zero */ pending_webhooks: number; - + /** - * ID of the API request that caused the event. If null, the event was - * automatic (e.g. Stripe’s automatic subscription handling). Request logs are - * available in the dashboard but currently not in the API. Note: this property + * ID of the API request that caused the event. If null, the event was + * automatic (e.g. Stripe’s automatic subscription handling). Request logs are + * available in the dashboard but currently not in the API. Note: this property * is populated for events on or after April 23, 2013. */ request?: string; - + /** * Description of the event: e.g. invoice.created, charge.refunded, etc. */ type: string; } - + interface IEventListOptions extends IListOptionsCreated { /** - * A string containing a specific event name, or group of events using * as a - * wildcard. The list will be filtered to include only events with a matching + * A string containing a specific event name, or group of events using * as a + * wildcard. The list will be filtered to include only events with a matching * event property */ type: string; } } - + namespace fileUploads { interface IFileUpdate extends IResourceObject { /** * Value is "file_upload" */ object: "file_upload"; - + created: number; - + /** - * The purpose of the uploaded file. Possible values are "business_logo", - * "dispute_evidence", "identity_document", "incorporation_article", + * The purpose of the uploaded file. Possible values are "business_logo", + * "dispute_evidence", "identity_document", "incorporation_article", * "incorporation_document". */ purpose: IPurpose; - + /** * The size in bytes of the file upload object. */ size: number; - + /** - * The type of the file returned. Returns one of the following: + * The type of the file returned. Returns one of the following: * pdf, jpg, png. */ type: "pdf" | "jpg" | "png"; - + /** - * A read-only URL where the uploaded file can be accessed. Will be nil + * A read-only URL where the uploaded file can be accessed. Will be nil * unless the uploaded file has one of the following purposes: - * business_logo, dispute_evidence, incorporation_document. + * business_logo, dispute_evidence, incorporation_document. * Also nil if retrieved with the publishable API key. */ url: string; } - + interface IFileUploadCreationOptions extends IDataOptions { purpose: IPurpose; file: { @@ -1747,18 +1747,18 @@ declare namespace StripeNode { type: string | "application/octet-stream"; } } - + interface IFileUploadListOptions extends IListOptionsCreated { /** - * The file purpose to filter queries by. If none is provided, files will not be + * The file purpose to filter queries by. If none is provided, files will not be * filtered by purpose. */ purpose: IPurpose; } - + type IPurpose = "business_logo" | "dispute_evidence" | "identity_document" | "incorporation_article" | "incorporation_document"; } - + namespace invoices { /** * Invoices are statements of what a customer owes for a particular billing period, including subscriptions, @@ -1778,7 +1778,7 @@ declare namespace StripeNode { * Value is 'invoice' */ object: "invoice"; - + /** * Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge * amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may @@ -1787,13 +1787,13 @@ declare namespace StripeNode { * specified in amount_due. */ amount_due: number; - + /** * The fee in cents that will be applied to the invoice and transferred to the application owner's * Stripe account when the invoice is paid. */ application_fee: number; - + /** * Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any * payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt @@ -1807,30 +1807,30 @@ declare namespace StripeNode { * users. */ attempted: boolean; - + /** * ID of the latest charge generated for this invoice, if any. [Expandable] */ charge: string | charges.ICharge; - + /** * Whether or not the invoice is still trying to collect payment. An invoice is closed if it's either paid or * it has been marked closed. A closed invoice will no longer attempt to collect payment. */ closed: boolean; - + currency: string; customer: string; date: number; description: string; discount: coupons.IDiscount; - + /** * Ending customer balance after attempting to pay invoice. If the invoice has not been attempted yet, * this will be null. */ ending_balance: number; - + /** * Whether or not the invoice has been forgiven. Forgiving an invoice instructs us to update the subscription * status as if the invoice were succcessfully paid. Once an invoice has been forgiven, it cannot be unforgiven @@ -1839,20 +1839,20 @@ declare namespace StripeNode { forgiven: boolean; /** - * The individual line items that make up the invoice. - * + * The individual line items that make up the invoice. + * * lines is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any. */ lines: IList; - + livemode: boolean; metadata: IMetadata; - + /** * The time at which payment will next be attempted. */ next_payment_attempt: number; - + /** * Whether or not payment was successfully collected for this invoice. An invoice can be paid (most commonly) * with a charge or with credit from the customer's account balance. @@ -1868,56 +1868,56 @@ declare namespace StripeNode { * Start of the usage period during which invoice items were added to this invoice */ period_start: number; - + /** * This is the transaction number that appears on email receipts sent for this invoice. */ receipt_number: string; - + /** * Starting customer balance before attempting to pay invoice. If the invoice has not been attempted yet, * this will be the current customer balance. */ starting_balance: number; - + /** * Extra information about an invoice for the customer�s credit card statement. */ statement_descriptor: string; - + /** * The subscription that this invoice was prepared for, if any. */ subscription: string; - + /** * Only set for upcoming invoices that preview prorations. The time used to calculate prorations. */ subscription_proration_date: number; - + /** * Total of all subscriptions, invoice items, and prorations on the invoice before any discount is applied */ subtotal: number; - + /** * The amount of tax included in the total, calculated from tax_percent and the subtotal. If no tax_percent * is defined, this value will be null. */ tax: number; - + /** * This percentage of the subtotal has been added to the total amount of the invoice, including invoice line * items and discounts. This field is inherited from the subscription's tax_percent field, but can be changed * before the invoice is paid. This field defaults to null. */ tax_percent: number; - + /** * Total after discount */ total: number; - + /** * The time at which webhooks for this invoice were successfully delivered (if the invoice had no webhooks to * deliver, this will match date). Invoice payment is delayed until webhooks are delivered, or until all webhook @@ -1925,160 +1925,160 @@ declare namespace StripeNode { */ webhooks_delivered_at: number; } - + interface IInvoiceLineItem extends IResourceObject { /** * The ID of the source of this line item, either an invoice item or a subscription */ id: string; - + /** * Value is "line_item" */ object: "line_item"; - + /** * The amount, in cents/pence */ amount: number; - + currency: string; - + /** * A text description of the line item, if the line item is an invoice item */ description: string; - + /** * If true, discounts will apply to this line item. Always false for prorations. */ discountable: boolean; - + /** * Whether or not this is a test line item */ livemode: boolean; - + metadata: IMetadata; - + /** - * The period this line_item covers. For subscription line items, this is the subscription period. For prorations, this starts when - * the proration was calculated, and ends at the period end of the subscription. For invoice items, this is the time at which the + * The period this line_item covers. For subscription line items, this is the subscription period. For prorations, this starts when + * the proration was calculated, and ends at the period end of the subscription. For invoice items, this is the time at which the * invoice item was created, so the period start and end are the same time. */ period: IPeriod; - + /** * The plan of the subscription, if the line item is a subscription or a proration */ plan: plans.IPlan; - + /** * Whether or not this is a proration */ proration: boolean; - + /** * The quantity of the subscription, if the line item is a subscription or a proration */ quantity: number; - + /** * When type is invoiceitem, the subscription that the invoice item pertains to, if any. Left blank when * type is already subscription, as it'd be redundant with id. */ subscription: string; - + /** * A string identifying the type of the source of this line item, either an invoiceitem or a subscription */ type: "invoiceitem" | "subscription"; } - + interface IInvoiceCreationOptions extends IDataOptionsWithMetadata { customer: string; - + /** - * A fee in pence that will be applied to the invoice and transferred to the application owner’s Stripe account. - * The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. + * A fee in pence that will be applied to the invoice and transferred to the application owner’s Stripe account. + * The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. * For more information, see the application fees documentation. */ application_fee?: number; - + description?: string; - + /** * Extra information about a charge for the customer’s credit card statement. */ statement_descriptor?: string - + /** - * The ID of the subscription to invoice. If not set, the created invoice will include all pending invoice items for + * The ID of the subscription to invoice. If not set, the created invoice will include all pending invoice items for * the customer. If set, the created invoice will exclude pending invoice items that pertain to other subscriptions. */ subscription?: string; - + /** * The percent tax rate applied to the invoice, represented as a decimal number. */ tax_percent?: number; } - + interface IInvoiceUpdateOptions extends IDataOptionsWithMetadata { /** - * A fee in pence that will be applied to the invoice and transferred to the application owner’s Stripe account. - * The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. + * A fee in pence that will be applied to the invoice and transferred to the application owner’s Stripe account. + * The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. * For more information, see the application fees documentation. */ application_fee?: number; - + /** * Boolean representing whether an invoice is closed or not. To close an invoice, pass true. */ closed?: boolean; - + description?: string; - + /** - * Boolean representing whether an invoice is forgiven or not. To forgive an invoice, pass true. Forgiving an invoice - * instructs us to update the subscription status as if the invoice were successfully paid. Once an invoice has been + * Boolean representing whether an invoice is forgiven or not. To forgive an invoice, pass true. Forgiving an invoice + * instructs us to update the subscription status as if the invoice were successfully paid. Once an invoice has been * forgiven, it cannot be unforgiven or reopened. */ forgiven?: boolean; - + /** * Extra information about a charge for the customer’s credit card statement. */ statement_descriptor?: string - + /** * The percent tax rate applied to the invoice, represented as a decimal number. */ tax_percent?: number; } - + interface IInvoiceListOptions extends IListOptions { /** * The identifier of the customer whose invoices to return. If none is provided, all invoices will be returned. */ customer?: string; - + date?: IDateFilter; } - + interface IInvoiceLineItemRetrievalOptions extends IListOptions { coupon?: string; - + /** * In the case of upcoming invoices, the customer of the upcoming invoice is required. In other cases it is ignored. */ customer?: string; - + /** * In the case of upcoming invoices, the subscription of the upcoming invoice is optional. In other cases it is ignored. */ subscription?: string; - + subscription_plan?: string; subscription_prorate?: boolean; subscription_proration_date?: number; @@ -2088,53 +2088,53 @@ declare namespace StripeNode { interface IInvoiceUpcomingOptions extends IDataOptions { /** - * The code of the coupon to apply. If a subscription or subscription_plan is provided, the invoice returned will preview updating - * or creating a subscription with that coupon. Otherwise, it will preview applying that coupon to the customer for the next upcoming + * The code of the coupon to apply. If a subscription or subscription_plan is provided, the invoice returned will preview updating + * or creating a subscription with that coupon. Otherwise, it will preview applying that coupon to the customer for the next upcoming * invoice from among the customer’s subscriptions. */ coupon?: string; - + /** - * The identifier of the subscription for which you’d like to retrieve the upcoming invoice. If not provided, but a subscription_plan - * is provided, you will preview creating a subscription to that plan. If neither subscription nor subscription_plan is provided, you + * The identifier of the subscription for which you’d like to retrieve the upcoming invoice. If not provided, but a subscription_plan + * is provided, you will preview creating a subscription to that plan. If neither subscription nor subscription_plan is provided, you * will retrieve the next upcoming invoice from among the customer’s subscriptions. */ subscription?: string; - + /** - * If set, the invoice returned will preview updating the subscription given to this plan, or creating a new subscription to this plan + * If set, the invoice returned will preview updating the subscription given to this plan, or creating a new subscription to this plan * if no subscription is given. */ subscription_plan?: string; - + /** - * If previewing an update to a subscription, this decides whether the preview will show the result of applying prorations or not. If - * set, one of subscription_plan or subscription, and one of subscription_plan, subscription_quantity or subscription_trial_end are + * If previewing an update to a subscription, this decides whether the preview will show the result of applying prorations or not. If + * set, one of subscription_plan or subscription, and one of subscription_plan, subscription_quantity or subscription_trial_end are * required. */ subscription_prorate?: boolean; - + /** - * If previewing an update to a subscription, and doing proration, subscription_proration_date forces the proration to be calculated as - * though the update was done at the specified time. The time given must be within the current subscription period, and cannot be - * before the subscription was on its current plan.If set, subscription, and one of subscription_plan, subscription_quantity or + * If previewing an update to a subscription, and doing proration, subscription_proration_date forces the proration to be calculated as + * though the update was done at the specified time. The time given must be within the current subscription period, and cannot be + * before the subscription was on its current plan.If set, subscription, and one of subscription_plan, subscription_quantity or * subscription_trial_end are required. Also, subscription_proration cannot be set to false. */ subscription_proration_date?: number; - + /** - * If provided, the invoice returned will preview updating or creating a subscription with that quantity. If set, one of subscription_plan + * If provided, the invoice returned will preview updating or creating a subscription with that quantity. If set, one of subscription_plan * or subscription is required. */ subscription_quantity?: number; - + /** - * If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of subscription_plan + * If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of subscription_plan * or subscription is required. */ subscription_trial_end?: number; } - + interface IPeriod { /** * The period start date @@ -2152,109 +2152,109 @@ declare namespace StripeNode { * Value is "invoiceitem" */ object: "invoiceitem"; - + amount: number; currency: string; customer: string; date: number; description: string; - + /** * If true, discounts will apply to this invoice item. Always false for prorations. */ discountable: boolean; - + invoice: string; livemode: boolean; metadata: IMetadata; - + period: invoices.IPeriod; - + /** * If the invoice item is a proration, the plan of the subscription that the proration was computed for. */ plan: plans.IPlan; - + /** * Whether or not the invoice item was created automatically as a proration adjustment when the customer switched plans */ proration: boolean; - + /** * If the invoice item is a proration, the quantity of the subscription that the proration was computed for. */ quantity: number; - + /** * The subscription that this invoice item has been created for, if any. */ subscription: string; } - + interface InvoiceItemCreationOptions extends IDataOptionsWithMetadata { /** - * The integer amount in cents of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer’s + * The integer amount in cents of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer’s * account, pass a negative amount. */ amount: number; - + /** * 3-letter ISO code for currency. */ currency: string; - + /** * The ID of the customer who will be billed when this invoice item is billed. */ customer: string; - + /** - * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. + * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. * This can be unset by updating the value to null and then saving. */ description?: string; - + /** - * Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for + * Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for * all other invoice items. */ discountable?: boolean; - + /** - * The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming - * scheduled invoice. Use this when adding invoice items in response to an invoice.created webhook. You cannot add an invoice item + * The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming + * scheduled invoice. Use this when adding invoice items in response to an invoice.created webhook. You cannot add an invoice item * to an invoice that has already been paid, attempted or closed. */ invoice?: string; - + /** - * The ID of a subscription to add this invoice item to. When left blank, the invoice item will be be added to the next upcoming - * scheduled invoice. When set, scheduled invoices for subscriptions other than the specified subscription will ignore the invoice + * The ID of a subscription to add this invoice item to. When left blank, the invoice item will be be added to the next upcoming + * scheduled invoice. When set, scheduled invoices for subscriptions other than the specified subscription will ignore the invoice * item. Use this when you want to express that an invoice item has been accrued within the context of a particular subscription. */ subscription?: string; } - + interface InvoiceItemUpdateOptions extends IDataOptionsWithMetadata { /** - * The integer amount in cents/pence of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer's + * The integer amount in cents/pence of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer's * account, pass a negative amount. */ amount?: number; - + /** - * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. This can be + * An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. This can be * unset by updating the value to null and then saving. */ description?: string; - + /** - * Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other + * Controls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other * invoice items. Cannot be set to true for prorations. */ discountable?: boolean; } - + interface InvoiceItemListOptions extends IListOptionsCreated { /** * The identifier of the customer whose invoice items to return. If none is provided, all invoice items will be returned. @@ -2262,79 +2262,79 @@ declare namespace StripeNode { customer?: string; } } - + namespace orders { interface IOrder extends IResourceObject { /** * Value is "order" */ object: "order"; - + /** - * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal * currency) representing the total amount for the order. */ amount: number; - + /** * ID of the Connect Application that created the order. */ application: string; - + application_fee: number; - + /** * The ID of the payment used to pay for the order. Present if the order status is paid, fulfilled, or refunded. [Expandable] */ charge: string | charges.ICharge; - + created: number; - + /** * 3-letter ISO code representing the currency in which the order was made. */ currency: string; - + /** * The customer used for the order. [Expandable] */ customer: string | customers.ICustomer; - + /** * The email address of the customer placing the order. */ email: string; - + external_coupon_code: string; - + /** * List of items constituting the order. */ items: Array; - + livemode: boolean; metadata: IMetadata; - + /** - * The shipping method that is currently selected for this order, if any. If present, it is equal to one of the ids of shipping methods - * in the shipping_methods array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected + * The shipping method that is currently selected for this order, if any. If present, it is equal to one of the ids of shipping methods + * in the shipping_methods array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected * the first method. */ selected_shipping_method: string; - + /** * The shipping address for the order. Present if the order is for goods to be shipped. */ shipping: IShippingInformation; - + /** - * A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or + * A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or * when paying it. */ shipping_methods: Array; - + status: OrderStatus; - + /** * The timestamps at which the order status was updated */ @@ -2344,225 +2344,225 @@ declare namespace StripeNode { paid: number; returned: number; }; - + updated: number; } - + interface IOrderItem extends IObject { /** * value is "order_item" */ object: "order_item"; - + /** - * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) * representing the total amount for the line item. */ amount: number; - + /** * 3-letter ISO code representing the currency of the line item. */ currency: string; - + /** * Description of the line item, meant to be displayable to the user (e.g., "Express shipping"). */ description: string; - + /** * The ID of the associated object for this line item. Expandable if not null (e.g., expandable to a SKU). [Expandable] */ parent: string | skus.ISku; - + /** - * A positive integer representing the number of instances of parent that are included in this order item. + * A positive integer representing the number of instances of parent that are included in this order item. * Applicable/present only if type is sku. */ quantity: number; - + /** * The type of line item. One of "sku", "tax", "shipping", or "discount". */ type: "sku" | "tax" | "shipping" | "discount" ; } - + interface IOrderCreationOptions extends IDataOptionsWithMetadata { /** - * 3-letter ISO code representing the currency in which the order should be made. Stripe will validate that all entries in items match + * 3-letter ISO code representing the currency in which the order should be made. Stripe will validate that all entries in items match * the currency specified here. */ currency: string; - + /** * A coupon code that represents a discount to be applied to this order. Must be one-time duration and in same currency as the order. */ coupon?: string; - + /** - * The ID of an existing customer to use for this order. If provided, the customer email and shipping address will be used to create - * the order. Subsequently, the customer will also be charged to pay the order. If email or shipping are also provided, they will + * The ID of an existing customer to use for this order. If provided, the customer email and shipping address will be used to create + * the order. Subsequently, the customer will also be charged to pay the order. If email or shipping are also provided, they will * override the values retrieved from the customer object. */ customer?: string; - + /** * The email address of the customer placing the order. */ email?: string; - + /** * List of items constituting the order. */ items?: Array; - + /** * Shipping address for the order. Required if any of the SKUs are for products that have shippable set to true. */ shipping?: IShippingInformation; } - + interface IOrderUpdateOptions extends IDataOptionsWithMetadata { /** * A coupon code that represents a discount to be applied to this order. Must be one-time duration and in same currency as the order. */ coupon?: string; - + /** - * The shipping method to select for fulfilling this order. If specified, must be one of the ids of a shipping method in the + * The shipping method to select for fulfilling this order. If specified, must be one of the ids of a shipping method in the * shipping_methods array. If specified, will overwrite the existing selected shipping method, updating items as necessary. */ selected_shipping_method?: string; - + status: OrderStatus; } - + interface IOrderPayOptions extends IDataOptionsWithMetadata { /** * The ID of an existing customer that will be charged in this request. - * + * * Either customer or source is required */ customer?: string; - + /** - * A payment source to be charged, such as a credit card. If you also pass a customer ID, the source must be the ID of a source belonging - * to the customer. Otherwise, if you do not pass a customer ID, the source you provide must either be a token, like the ones returned - * by Stripe.js, or a object containing a user's credit card details, with the options described below. Although not all information is + * A payment source to be charged, such as a credit card. If you also pass a customer ID, the source must be the ID of a source belonging + * to the customer. Otherwise, if you do not pass a customer ID, the source you provide must either be a token, like the ones returned + * by Stripe.js, or a object containing a user's credit card details, with the options described below. Although not all information is * required, the extra info helps prevent fraud. - * + * * Either source or customer is required */ source?: sources.ISourceCreationOptions; - + /** - * A fee in cents/pence that will be applied to the order and transferred to the application owner's Stripe account. To use an application - * fee, the request must be made on behalf of another account, using the Stripe-Account header or OAuth key. For more information, see + * A fee in cents/pence that will be applied to the order and transferred to the application owner's Stripe account. To use an application + * fee, the request must be made on behalf of another account, using the Stripe-Account header or OAuth key. For more information, see * the application fees documentation. */ application_fee?: number; - + /** * The email address of the customer placing the order. If a customer is specified, that customer's email address will be used. - * + * * Optional, but required if not previously specified. */ email?: string; } - + interface IOrderListOptions extends IListOptionsCreated { /** * Only return orders for the given customer */ customer?: string; - + /** * Only return orders with the given IDs */ ids?: Array; - + /** * Only return orders that have the given status. One of "created", "paid", "fulfilled", or "refunded". */ status: OrderStatus; - + /** * Filter orders based on when they were "paid", "fulfilled", "canceled", or "returned" */ status_transitions?: { /** - * A filter on the list based on the object canceled field. The value can be a string with an integer Unix timestamp, + * A filter on the list based on the object canceled field. The value can be a string with an integer Unix timestamp, * or it can be a dictionary with the following options: */ canceled?: IDateFilter; - + /** - * A filter on the list based on the object fulfilled field. The value can be a string with an integer Unix timestamp, + * A filter on the list based on the object fulfilled field. The value can be a string with an integer Unix timestamp, * or it can be a dictionary with the following options: */ fulfilled?: IDateFilter; - + /** - * A filter on the list based on the object paid field. The value can be a string with an integer Unix timestamp, + * A filter on the list based on the object paid field. The value can be a string with an integer Unix timestamp, * or it can be a dictionary with the following options: */ paid?: IDateFilter; - + /** - * A filter on the list based on the object returned field. The value can be a string with an integer Unix timestamp, + * A filter on the list based on the object returned field. The value can be a string with an integer Unix timestamp, * or it can be a dictionary with the following options: */ returned?: IDateFilter; } } - + interface IOrderItemCreationHash { /** - * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) * representing the total amount for the line item. */ amount?: number; - + /** * 3-letter ISO code representing the currency of the line item. */ currency?: string; - + /** * Description of the line item, meant to be displayable to the user (e.g., "Express shipping"). */ description?: string; - + /** * The ID of the SKU being ordered. */ parent: string; - + /** * The quantity of this order item. When type is sku, this is the number of instances of the SKU to be ordered. */ quantity?: number; - + /** * The type of line item. One of "sku", "tax", "shipping", or "discount". */ type?: "sku" | "tax" | "shipping" | "discount" ; } - + interface IShippingMethod { id: string; - + /** - * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) + * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal currency) * representing the total amount for the line item. */ amount: number; - + /** * 3-letter ISO code representing the currency of the line item. */ currency: string; - + /** * The estimated delivery date for the given shipping method. Can be either a specific date or a range. */ @@ -2571,35 +2571,35 @@ declare namespace StripeNode { * If type is "exact", date will be the expected delivery date in the format YYYY-MM-DD */ date: string; - + /** * If type is "range", earliest will be be the earliest delivery date in the format YYYY-MM-DD */ earliest: string; - + /** * If type is "range", latest will be the latest delivery date in the format YYYY-MM-DD */ latest: string; - + /** * The type of estimate. Must be either "range" or "exact" */ type: "range" | "exact"; }; - + /** * Description of the line item, meant to be displayable to the user (e.g., "Express shipping"). */ description: string; } - + /** * Current order status. One of created, paid, canceled, fulfilled, or returned. More detail in the Relay API Overview. */ type OrderStatus = "created" | "paid" | "canceled" | "fulfilled" | "returned"; } - + namespace plans { /** * A subscription plan contains the pricing information for different products and feature levels on your site. @@ -2610,12 +2610,12 @@ declare namespace StripeNode { * Value is "plan" */ object: "plan"; - + /** * The amount in cents to be charged on the interval specified */ amount: number; - + created: number; /** @@ -2627,290 +2627,290 @@ declare namespace StripeNode { * One of "day", "week", "month" or "year". The frequency with which a subscription should be billed. */ interval: IntervalUnit; - + /** * The number of intervals (specified in the interval property) between each subscription billing. For example, * interval=month and interval_count=3 bills every 3 months. */ interval_count: number; - + livemode: boolean; metadata: IMetadata; - + /** * Display name of the plan */ name: string; - + /** * Extra information about a charge for the customer's credit card statement. */ statement_descriptor: string; - + /** * Number of trial period days granted when subscribing a customer to this plan. Null if the plan has no trial period. */ trial_period_days: number; } - + interface IPlanCreationOptions extends IDataOptionsWithMetadata { /** - * Unique string of your choice that will be used to identify this plan when subscribing a customer. This could be an identifier + * Unique string of your choice that will be used to identify this plan when subscribing a customer. This could be an identifier * like "gold" or a primary key from your own database. */ id: string; - + /** * A positive integer in cents/pence (or 0 for a free plan) representing how much to charge (on a recurring basis). */ amount: number; - + /** * 3-letter ISO code for currency. */ currency: string; - + /** * Specifies billing frequency. Either "day", "week", "month" or "year". */ interval: IntervalUnit; - + /** * Name of the plan, to be displayed on invoices and in the web interface. */ name: string; - + /** - * The number of intervals between each subscription billing. For example, interval=month and interval_count=3 bills every 3 months. + * The number of intervals between each subscription billing. For example, interval=month and interval_count=3 bills every 3 months. * Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). */ interval_count?: number; - + /** - * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. As an example, if your website - * is RunClub and the item you’re charging for is your Silver Plan, you may want to specify a statement_descriptor of RunClub Silver Plan. - * The statement description may not include <>"' characters, and will appear on your customer’s statement in capital letters. Non-ASCII + * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. As an example, if your website + * is RunClub and the item you’re charging for is your Silver Plan, you may want to specify a statement_descriptor of RunClub Silver Plan. + * The statement description may not include <>"' characters, and will appear on your customer’s statement in capital letters. Non-ASCII * characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. */ statement_descriptor?: string; - + /** - * Specifies a trial period in (an integer number of) days. If you include a trial period, the customer won't be billed for the first time + * Specifies a trial period in (an integer number of) days. If you include a trial period, the customer won't be billed for the first time * until the trial period ends. If the customer cancels before the trial period is over, she'll never be billed at all. */ trial_period_days?: number; } - + interface IPlanUpdateOptions extends IDataOptionsWithMetadata { /** * Name of the plan, to be displayed on invoices and in the web interface. */ name?: string; - + /** - * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. As an example, if your website - * is RunClub and the item you’re charging for is your Silver Plan, you may want to specify a statement_descriptor of RunClub Silver Plan. - * The statement description may not include <>"' characters, and will appear on your customer’s statement in capital letters. Non-ASCII + * An arbitrary string to be displayed on your customer’s credit card statement. This may be up to 22 characters. As an example, if your website + * is RunClub and the item you’re charging for is your Silver Plan, you may want to specify a statement_descriptor of RunClub Silver Plan. + * The statement description may not include <>"' characters, and will appear on your customer’s statement in capital letters. Non-ASCII * characters are automatically stripped. While most banks display this information consistently, some may display it incorrectly or not at all. */ statement_descriptor?: string; } - + type IntervalUnit = "day" | "week" | "month" | "year"; } - + namespace products { interface IProduct extends IResourceObject { /** * Value is "product" */ object: "product"; - + /** * Whether or not the product is currently available for purchase. */ active: boolean; - + /** * A list of up to 5 attributes that each SKU can provide values for (e.g. ["color", "size"]). */ attributes: Array; - + /** * A short one-line description of the product, meant to be displayable to the customer. */ caption: string; - + created: number; - + /** * An array of connect application identifiers that cannot purchase this product. */ deactivated_on: Array; - + /** * The product’s description, meant to be displayable to the customer. */ description: string; - + /** * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. */ images: Array; - + livemode: boolean; metadata: IMetadata; - + /** * The product’s name, meant to be displayable to the customer. */ name: string; - + package_dimensions: IPackageDimensions; - + /** * Whether this product is a shipped good. */ shippable: boolean; - + /** * A sublist of active SKUs associated with this product. */ skus: IList; - + updated: number; - + /** * A URL of a publicly-accessible webpage for this product. */ url: string; } - + interface IProductCreationOptions extends IDataOptionsWithMetadata { /** * The identifier for the product. Must be unique. If not provided, an identifier will be randomly generated. */ id?: string; - + /** * The product’s name, meant to be displayable to the customer. */ name: string; - + /** * Whether or not the product is currently available for purchase. Defaults to true. */ active?: boolean; - + /** * A list of up to 5 alphanumeric attributes that each SKU can provide values for (e.g. ["color", "size"]). */ attribute?: Array; - + /** * A short one-line description of the product, meant to be displayable to the customer. */ caption?: string; - + /** * An array of Connect application names or identifiers that should not be able to order the SKUs for this product. */ deactivate_on?: Array; - + /** * The product’s description, meant to be displayable to the customer. */ description?: string; - + /** * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. */ images?: Array; - + package_dimensions?: IPackageDimensions; - + /** * Whether this product is shipped (i.e. physical goods). Defaults to true. */ shippable?: boolean; - + /** * A URL of a publicly-accessible webpage for this product. */ url?: string; } - + interface IProductUpdateOptions extends IDataOptionsWithMetadata { /** - * Whether or not the product is available for purchase. Setting this to false also deactivates any active, related SKUs. Setting this to + * Whether or not the product is available for purchase. Setting this to false also deactivates any active, related SKUs. Setting this to * true does not automatically activate any deactivated, related SKUs. */ active?: boolean; - + /** * A short one-line description of the product, meant to be displayable to the customer. */ caption?: string; - + /** - * An array of Connect application names or identifiers that should not be able to order the SKUs for this product. This can be unset + * An array of Connect application names or identifiers that should not be able to order the SKUs for this product. This can be unset * by updating the value to null and then saving. */ deactivate_on?: Array; - + /** * The product’s description, meant to be displayable to the customer. */ description?: string; - + /** - * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. This can be unset by updating the value to + * A list of up to 8 URLs of images for this product, meant to be displayable to the customer. This can be unset by updating the value to * null and then saving. */ images?: Array; - + /** * The product’s name, meant to be displayable to the customer. */ name?: string; - + package_dimensions?: IPackageDimensions; - + /** * Whether this product is shipped (i.e. physical goods). Defaults to true. */ shippable?: boolean; - + /** * A URL of a publicly-accessible webpage for this product. */ url?: string; } - + interface IProductListOptions extends IListOptions { /** * Only return products that are active or inactive (e.g. pass false to list all inactive products). */ active?: boolean; - + /** * Only return products with the given IDs. */ ids?: Array; - + /** * Only return products that can be shipped (i.e., physical, not digital products). */ shippable?: boolean; - + /** * Only return products with the given url */ url?: string; } - + /** - * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its + * The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its * own package_dimensions */ interface IPackageDimensions { @@ -2932,277 +2932,277 @@ declare namespace StripeNode { width: number; } } - + namespace recipientCards { } - + namespace recipients { - interface IRecipient extends IResourceObject { - + interface IRecipient extends IResourceObject { + } } - + namespace skus { interface ISku extends IResourceObject { /** * Value is "sku" */ object: "sku"; - + /** * Whether or not the SKU is available for purchase. */ active: boolean; - + attributes: ISkuAttributes; created: number; - + /** * 3-letter ISO code for currency. */ currency: string; - + /** * The URL of an image for this SKU, meant to be displayable to the customer. */ image: string; - + inventory: IInventory; livemode: boolean; metadata: IMetadata; - + /** * The dimensions of this SKU for shipping purposes. */ package_dimensions: products.IPackageDimensions; - + /** - * The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 1 to charge ¥1, + * The cost of the item as a positive integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 1 to charge ¥1, * Japanese Yen being a 0-decimal currency). */ price: number; - + /** * The ID of the product this SKU is associated with. The product must be currently active. [Expandable] */ product: string | products.IProduct; - + updated: number; } - + interface ISkuCreationOptions extends IDataOptionsWithMetadata { /** * The identifier for the SKU. Must be unique. If not provided, an identifier will be randomly generated. */ id?: string; - + /** * 3-letter ISO code for currency. */ currency: string; - + inventory: IInventory; - + /** - * The cost of the item as a nonnegative integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 1 to charge ¥1, + * The cost of the item as a nonnegative integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 1 to charge ¥1, * Japanese Yen being a 0-decimal currency). */ price: number; - + /** * The ID of the product this SKU is associated with. */ product: string; - + /** * Whether or not the SKU is available for purchase. Default to true. */ active?: boolean; - + attributes?: ISkuAttributes; - + /** * The URL of an image for this SKU, meant to be displayable to the customer. */ image?: string; - + /** * The dimensions of this SKU for shipping purposes. */ package_dimensions?: products.IPackageDimensions; } - + interface ISkuUpdateOptions extends IDataOptionsWithMetadata { /** * Whether or not the SKU is available for purchase. */ active?: boolean; - + /** * 3-letter ISO code for currency. */ currency?: string; - + /** - * The URL of an image for this SKU, meant to be displayable to the customer. + * The URL of an image for this SKU, meant to be displayable to the customer. * This can be unset by updating the value to null and then saving. */ image?: string; - + inventory?: IInventory; - + /** * The dimensions of this SKU for shipping purposes. */ package_dimensions?: products.IPackageDimensions; - + /** - * The cost of the item as a nonnegative integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 1 to charge ¥1, + * The cost of the item as a nonnegative integer in the smallest currency unit (that is, 100 cents to charge $1.00, or 1 to charge ¥1, * Japanese Yen being a 0-decimal currency). */ price?: number; - + /** * The ID of the product this SKU is associated with. */ product?: string; } - + interface ISkuListOptions extends IListOptions { /** * Only return SKUs that are active or inactive (e.g. pass false to list all inactive products). */ active?: boolean; - + /** - * Only return SKUs that have the specified key/value pairs in this partially constructed dictionary. - * Can be specified only if product is also supplied. For instance, if the associated product has - * attributes ["color", "size"], passing in attributes[color]=red returns all the SKUs for this product + * Only return SKUs that have the specified key/value pairs in this partially constructed dictionary. + * Can be specified only if product is also supplied. For instance, if the associated product has + * attributes ["color", "size"], passing in attributes[color]=red returns all the SKUs for this product * that have color set to red. */ attributes?: ISkuAttributes; - + /** * Only return SKUs with the given IDs. */ ids?: Array; - + /** - * Only return SKUs that are either in stock or out of stock (e.g. pass false to list all SKUs that are out of stock). + * Only return SKUs that are either in stock or out of stock (e.g. pass false to list all SKUs that are out of stock). * If no value is provided, all SKUs are returned. */ in_stock?: boolean; - + /** * The ID of the product whose SKUs will be retrieved. */ product?: string; } - + /** * Description of the SKU’s inventory. */ interface IInventory { /** * The count of inventory available. Will be present if and only if type is "finite". - * + * * Positive integer or zero */ quantity?: number; - + /** * Inventory type. Possible values are "finite", "bucket"" (not quantified), and "infinite". */ type: "finite" | "bucket" | "infinite" ; - + /** - * An indicator of the inventory available. Possible values are "in_stock", "limited", and "out_of_stock". + * An indicator of the inventory available. Possible values are "in_stock", "limited", and "out_of_stock". * Will be present if and only if type is "bucket". */ value?: "in_stock" | "limited" | "out_of_stock"; } - + /** - * A dictionary of attributes and values for the attributes defined by the product. - * If, for example, a product’s attributes are ["size", "gender"], + * A dictionary of attributes and values for the attributes defined by the product. + * If, for example, a product’s attributes are ["size", "gender"], * a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}. */ interface ISkuAttributes {} } - - namespace tokens { + + namespace tokens { interface IToken extends ICardToken, IBankAccountToken { } - + interface ICardToken extends ITokenBase { /** * Hash describing the card used to make the charge */ card?: cards.ICardHash; } - + interface IBankAccountToken extends ITokenBase { /** * Hash describing the bank account */ bank_account?: bankAccounts.IBankAccountHash; } - + interface ITokenBase extends IResourceObject { /** * Value is "token"" */ object: "token" ; - + /** * IP address of the client that generated the token */ client_ip: string; - + created: number; livemode: boolean; - + /** * Type of the token: card or bank_account */ type: "card" | "bank_account" ; - + /** * Whether or not this token has already been used (tokens can be used only once) */ used: boolean; } - + interface ITokenCreationOptionsBase extends IDataOptions { /** - * The customer (owned by the application's account) to create a - * token for. For use with Stripe Connect only; this can only be used - * with an OAuth access token or Stripe-Account header. For more + * The customer (owned by the application's account) to create a + * token for. For use with Stripe Connect only; this can only be used + * with an OAuth access token or Stripe-Account header. For more * details, see the shared customers documentation. - * + * * Stripe connect only */ customer?: string; } - + interface ICardTokenCreationOptions extends ITokenCreationOptionsBase { /** - * The card this token will represent. If you also pass in a customer, - * the card must be the ID of a card belonging to the customer. - * Otherwise, if you do not pass a customer, a object containing a + * The card this token will represent. If you also pass in a customer, + * the card must be the ID of a card belonging to the customer. + * Otherwise, if you do not pass a customer, a object containing a * user's credit card details, with the options described below. */ card: sources.ISourceCreationOptions; } - + interface IBankAccountTokenCreationOptions extends ITokenCreationOptionsBase { /** - * The card this token will represent. If you also pass in a customer, - * the card must be the ID of a card belonging to the customer. - * Otherwise, if you do not pass a customer, a object containing a + * The card this token will represent. If you also pass in a customer, + * the card must be the ID of a card belonging to the customer. + * Otherwise, if you do not pass a customer, a object containing a * user's credit card details, with the options described below. */ bank_account: bankAccounts.ISourceCreationOptions; } - + interface IPiiTokenCreationOptions extends IDataOptions { pii: { /** @@ -3212,31 +3212,31 @@ declare namespace StripeNode { } } } - + namespace transfers { interface ITransfer extends IResourceObject { /** * Value is "transfer" */ object: "transfer"; - + /** * Amount (in cents) to be transferred to your bank account */ amount: number; - + /** * Amount in cents reversed (can be less than the amount attribute on the transfer if a partial reversal was issued). */ amount_reversed: number; - + application_fee: string; - + /** * Balance transaction that describes the impact of this transfer on your account balance. [Expandable] */ balance_transaction: string | balance.IBalanceTransaction; - + /** * Time that this record of the transfer was first created. */ @@ -3256,193 +3256,193 @@ declare namespace StripeNode { * Internal-only description of the transfer */ description: string; - + /** * ID of the bank account, card, or Stripe account the transfer was sent to. [Expandable] */ destination: string | bankAccounts.IBankAccount | cards.ICardHash | accounts.IAccount; - + /** - * If the destination is a Stripe account, this will be the ID of the + * If the destination is a Stripe account, this will be the ID of the * payment that the destination account received for the transfer. [Expandable] */ destination_payment: string; - + /** * Error code explaining reason for transfer failure if available. See Types of transfer failures for a * list of failure codes: https://stripe.com/docs/api#transfer_failures */ failure_code: string; - + /** * Message to user further explaining reason for transfer failure if available. */ failure_message: string; - + livemode: boolean; metadata: IMetadata; - + /** * A list of reversals that have been applied to the transfer. */ reversals: ITransferReversals; - + /** * Whether or not the transfer has been fully reversed. If the transfer is only partially reversed, this attribute * will still be false. */ reversed: boolean; - + /** - * ID of the charge (or other transaction) that was used to fund the - * transfer. If null, the transfer was funded from the available + * ID of the charge (or other transaction) that was used to fund the + * transfer. If null, the transfer was funded from the available * balance. [Expandable] */ source_transaction: string | charges.ICharge; - + /** - * The source balance this transfer came from. + * The source balance this transfer came from. * One of card, bank_account, bitcoin_receiver, or alipay_account */ source_type: SourceTypes; - + /** * Extra information about a transfer to be displayed on the user's bank statement. */ statement_descriptor: string; - + /** - * Current status of the transfer (paid, pending, in_transit, canceled or failed). - * A transfer will be pending until it is submitted to the bank, at which point - * it becomes in_transit. It will then change to paid if the transaction goes - * through. If it does not go through successfully, its status will change to + * Current status of the transfer (paid, pending, in_transit, canceled or failed). + * A transfer will be pending until it is submitted to the bank, at which point + * it becomes in_transit. It will then change to paid if the transaction goes + * through. If it does not go through successfully, its status will change to * failed or canceled. */ status: Statuses; - + /** * Can be card, bank_account, or stripe_account. */ type: "card" | "bank_account" | "stripe_account" ; } - + interface ITransferReversals extends IList, resources.TransferReversals {} - + interface ITransferCreationOptions extends IDataOptionsWithMetadata { /** * A positive integer in cents/pence representing how much to transfer. */ amount: number; - + /** * 3-letter ISO code for currency. */ currency: string; - + /** - * The id of a bank account or a card to send the transfer to, or the - * string "default_for_currency" to use the default external - * account for the specified currency. - * - * If you use Stripe Connect, this can be the the id of a connected - * Stripe account; see the details about when such transfers are + * The id of a bank account or a card to send the transfer to, or the + * string "default_for_currency" to use the default external + * account for the specified currency. + * + * If you use Stripe Connect, this can be the the id of a connected + * Stripe account; see the details about when such transfers are * permitted. */ destination: string; - + /** - * An arbitrary string which you can attach to a transfer object. It is + * An arbitrary string which you can attach to a transfer object. It is * displayed when in the web interface alongside the transfer. */ description?: string - + /** - * You can use this parameter to transfer funds from a charge (or - * other transaction) before they are added to your available - * balance. A pending balance will transfer immediately but the - * funds will not become available until the original charge + * You can use this parameter to transfer funds from a charge (or + * other transaction) before they are added to your available + * balance. A pending balance will transfer immediately but the + * funds will not become available until the original charge * becomes available. See the Connect documentation for details. */ source_transaction?: string; - + /** - * A string to be displayed on the recipient's bank or card - * statement. This may be at most 22 characters. Attempting to use - * a statement_descriptor longer than 22 characters will return - * an error. Note: Most banks will truncate this information and/or + * A string to be displayed on the recipient's bank or card + * statement. This may be at most 22 characters. Attempting to use + * a statement_descriptor longer than 22 characters will return + * an error. Note: Most banks will truncate this information and/or * display it inconsistently. Some may not display it at all. */ statement_descriptor?: string; - + /** - * The source balance to draw this transfer from. Balances for - * different payment sources are kept separately. You can find the - * amounts with the balances API. Valid options are: + * The source balance to draw this transfer from. Balances for + * different payment sources are kept separately. You can find the + * amounts with the balances API. Valid options are: * "alipay_account", "bank_account", "bitcoin_receiver", and "card". */ source_type?: SourceTypes; } - + interface ITransferUpdateOptions extends IDataOptionsWithMetadata { /** - * An arbitrary string which you can attach to a transfer object. It is - * displayed when in the web interface alongside the transfer. This + * An arbitrary string which you can attach to a transfer object. It is + * displayed when in the web interface alongside the transfer. This * can be unset by updating the value to null and then saving. */ description?: string; } - + interface ITransferListOptions extends IListOptionsCreated { date?: IDateFilter; - + /** - * Only return transfers for the destination specified by this + * Only return transfers for the destination specified by this * account ID. */ destination?: string; - + /** - * Only return transfers for the recipient specified by this + * Only return transfers for the recipient specified by this * recipient ID. */ recipient?: string; - + /** - * Only return transfers that have the given status: + * Only return transfers that have the given status: * pending, paid, failed, in_transit, or canceled. */ status: Statuses; } - + type SourceTypes = "alipay_account" | "bank_account" | "bitcoin_receiver" | "card"; - + type Statuses = "pending" | "paid" | "failed" | "in_transit" | "canceled"; } - + namespace transferReversals { interface IReversal extends IResourceObject { /** * Value is 'transfer_reversal' */ object: "transfer_reversal"; - + /** * Amount reversed, in cents/pence. */ amount: number; - + /** * Balance transaction that describes the impact of this reversal on your account balance. [Expandable] */ balance_transaction: string | balance.IBalanceTransaction; - + created: number; /** * Three-letter ISO currency code representing the currency. */ currency: string; - + metadata: IMetadata; /** @@ -3450,76 +3450,76 @@ declare namespace StripeNode { */ transfer: string | transfers.ITransfer; } - + interface IReversalCreationOptions extends IDataOptionsWithMetadata { /** - * A positive integer in cents/pence representing how much of this transfer to reverse. Can only reverse up to the unreversed amount + * A positive integer in cents/pence representing how much of this transfer to reverse. Can only reverse up to the unreversed amount * remaining of the transfer. Partial transfer reversals are only allowed for transfers to Stripe Accounts. */ amount?: number; - + /** - * An arbitrary string which you can attach to a reversal object. It is displayed alongside the reversal in the dashboard. This will + * An arbitrary string which you can attach to a reversal object. It is displayed alongside the reversal in the dashboard. This will * be unset if you POST an empty value. */ description?: string; - + /** - * Boolean indicating whether the application fee should be refunded when reversing this transfer. If a full transfer reversal is - * given, the full application fee will be refunded. Otherwise, the application fee will be refunded with an amount proportional to + * Boolean indicating whether the application fee should be refunded when reversing this transfer. If a full transfer reversal is + * given, the full application fee will be refunded. Otherwise, the application fee will be refunded with an amount proportional to * the amount of the transfer reversed. */ refund_application_fee?: boolean; } - + interface IReversalUpdateOptions extends IDataOptionsWithMetadata { /** - * An arbitrary string which you can attach to a reversal object. It is displayed when in the web interface alongside the + * An arbitrary string which you can attach to a reversal object. It is displayed when in the web interface alongside the * reversal. This can be unset by updating the value to null and then saving. */ description?: string; } } - + namespace bankAccounts { interface IBankAccount extends IBankAccountHash { account: string; - + /** * This indicates whether or not this bank account is the default external account for its currency. */ default_for_currency: boolean; - + /** - * A set of key/value pairs that you can attach to a bank account object. It - * can be useful for storing additional information about the bank account in + * A set of key/value pairs that you can attach to a bank account object. It + * can be useful for storing additional information about the bank account in * a structured format. */ metadata: IMetadata; } - + interface IBankAccountHash extends IResourceObject { /** * value is "customer_bank_account" */ object: "customer_bank_account"; - + /** * The name of the person or business that owns the bank account. */ account_holder_name: string; - + /** - * The type of entity that holds the account. This can be either + * The type of entity that holds the account. This can be either * "individual"" or "company". */ account_holder_type: string; - + /** * Name of the bank associated with the routing number, e.g. WELLS FARGO. */ bank_name: string; - + /** * Two-letter ISO code representing the country the bank account is located in. */ @@ -3529,90 +3529,90 @@ declare namespace StripeNode { * Three-letter ISO currency code representing the currency paid out to the bank account. */ currency: string; - + /** - * Uniquely identifies this particular bank account. You can use this attribute + * Uniquely identifies this particular bank account. You can use this attribute * to check whether two bank accounts are the same. */ fingerprint: string; - + last4: string; - + /** * The routing transit number for the bank account. */ routing_number: string; - + /** - * Possible values are "new", "validated", "verified", "verification_failed", - * or "errored". A bank account that hasn’t had any activity or validation - * performed is "new". If Stripe can determine that the bank account exists, its - * status will be "validated". Note that there often isn’t enough information - * to know (e.g. for smaller credit unions), and the validation is not always - * run. If customer bank account verification has succeeded, the bank - * account status will be "verified". If the verification failed for any reason, - * such as microdeposit failure, the status will be "verification_failed". If a - * transfer sent to this bank account fails, we’ll set the status to "errored"" + * Possible values are "new", "validated", "verified", "verification_failed", + * or "errored". A bank account that hasn’t had any activity or validation + * performed is "new". If Stripe can determine that the bank account exists, its + * status will be "validated". Note that there often isn’t enough information + * to know (e.g. for smaller credit unions), and the validation is not always + * run. If customer bank account verification has succeeded, the bank + * account status will be "verified". If the verification failed for any reason, + * such as microdeposit failure, the status will be "verification_failed". If a + * transfer sent to this bank account fails, we’ll set the status to "errored"" * and will not continue to send transfers until the bank details are updated. */ status: "new" | "validated" | "verified" | "verification_failed" | "error" ; } - + interface ISourceCreationOptions { /** - * The account number for the bank account in string form. + * The account number for the bank account in string form. * Must be a checking account. */ account_number: string; - + /** * The country the bank account is in. */ country: string; - + /** - * The currency the bank account is in. This must be a + * The currency the bank account is in. This must be a * country/currency pairing that Stripe supports. */ currency: string; - + /** - * The routing number, sort code, or other country-appropriate - * institution number for the bank account. For US bank - * accounts, this is required and should be the ACH routing - * number, not the wire routing number. If you are providing an + * The routing number, sort code, or other country-appropriate + * institution number for the bank account. For US bank + * accounts, this is required and should be the ACH routing + * number, not the wire routing number. If you are providing an * IBAN for account_number, this field is not required. */ routing_number?: string; - + /** - * The name of the person or business that owns the bank - * account. This field is required when attaching the bank + * The name of the person or business that owns the bank + * account. This field is required when attaching the bank * account to a customer object. */ account_holder_name?: string; - + /** - * The type of entity that holds the account. This can be either - * "individual" or "company". This field is required when + * The type of entity that holds the account. This can be either + * "individual" or "company". This field is required when * attaching the bank account to a customer object. */ account_holder_type?: "individual" | "company" ; } - + interface IBankAccountUpdateOptions extends IDataOptionsWithMetadata { /** * The name of the person or business that owns the bank account. */ account_holder_name?: string; - + /** * The type of entity that holds the account. This can be either "individual" or "company". */ account_holder_type?: "individual" | "company"; } } - + namespace bitcoinReceivers { /** * A Bitcoin receiver wraps a Bitcoin address so that a customer can push a payment to you. This guide describes how to use @@ -3654,22 +3654,22 @@ declare namespace StripeNode { * This URI can be displayed to the customer as a clickable link (to activate their bitcoin client) or as a QR code (for mobile wallets). */ bitcoin_uri: number; - + created: number; /** * Three-letter ISO currency code representing the currency to which the bitcoin will be converted. */ currency: string; - + customer: string; description: string; - + /** * The customer's email address, set by the API call that creates the receiver. */ email: string; - + /** * This flag is initially false and updates to true when the customer sends the bitcoin_amount to this receiver. */ @@ -3679,20 +3679,20 @@ declare namespace StripeNode { * A bitcoin address that is specific to this receiver. The customer can send bitcoin to this address to fill the receiver. */ inbound_address: string; - + livemode: boolean; metadata: IMetadata; - + /** * The ID of the payment created from the receiver, if any. Hidden when viewing the receiver with a publishable key. */ payment: string; - + /** * The refund address for these bitcoin, if communicated by the customer. */ refund_address: string; - + /** * A list with one entry for each time that the customer sent bitcoin to the receiver. Hidden when viewing the * receiver with a publishable key. @@ -3703,7 +3703,7 @@ declare namespace StripeNode { * This receiver contains uncaptured funds that can be used for a payment or refunded. */ uncaptured_funds: boolean; - + used_for_payment: boolean; } @@ -3722,7 +3722,7 @@ declare namespace StripeNode { * The amount of bitcoin contained in the transaction. */ bitcoin_amount: number; - + created: number; /** @@ -3735,91 +3735,91 @@ declare namespace StripeNode { */ receiver: string; } - + interface IBitcoinReceiverCreationOptions extends IDataOptionsWithMetadata { /** * The amount of currency that you will be paid. */ amount: number; - + /** * The currency to which the bitcoin will be converted. You will be paid out in this currency. Only USD is currently supported. */ currency: string; - + /** * The email address of the customer. */ email: string; - + description?: string; - + /** * A flag that indicates whether you would like Stripe to automatically handle refunds for any mispayments to the receiver. */ refund_mispayments?: boolean; } - + interface IBitcoinReceiverListOptions extends IListOptions { /** * Filter for active receivers. */ active?: boolean; - + /** * Filter for filled receivers. */ filled?: boolean; - + /** * Filter for receivers with uncaptured funds. */ uncaptured_funds?: boolean; } } - - namespace cards { + + namespace cards { /** * You can store multiple cards on a customer in order to charge the customer later. You * can also store multiple debit cards on a recipient in order to transfer to those cards later. */ interface ICard extends ICardHash { /** - * The account this card belongs to. This attribute will not be in the + * The account this card belongs to. This attribute will not be in the * card object if the card belongs to a customer or recipient instead. * [Expandable] */ account?: string | accounts.IAccount; - + /** - * Only applicable on accounts (not customers or recipients). The - * card can be used as a transfer destination for funds in this + * Only applicable on accounts (not customers or recipients). The + * card can be used as a transfer destination for funds in this * currency. */ currency?: string; - + /** - * The customer that this card belongs to. This attribute will not be - * in the card object if the card belongs to an account or recipient + * The customer that this card belongs to. This attribute will not be + * in the card object if the card belongs to an account or recipient * instead. */ customer?: customers.ICustomer; - + /** - * Only applicable on accounts (not customers or recipients). This - * indicates whether or not this card is the default external account + * Only applicable on accounts (not customers or recipients). This + * indicates whether or not this card is the default external account * for its currency. */ default_for_currency?: boolean; - + /** - * The recipient that this card belongs to. This attribute will not be - * in the card object if the card belongs to a customer or account + * The recipient that this card belongs to. This attribute will not be + * in the card object if the card belongs to a customer or account * instead. [Expandable] */ recipient?: string | recipients.IRecipient; } - + /** * Hash describing the card used to make the charge */ @@ -3838,7 +3838,7 @@ declare namespace StripeNode { * The card number */ number: number; - + /** * Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown. */ @@ -3866,18 +3866,18 @@ declare namespace StripeNode { address_line2: string; address_state: string; address_zip: string; - + /** * If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked. */ address_zip_check: "pass" | "fail" | "unavailable" | "unchecked" ; - + /** * Two-letter ISO code representing the country of the card. You could use this * attribute to get a sense of the international breakdown of cards you've collected. */ country: string; - + /** * If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked */ @@ -3892,22 +3892,22 @@ declare namespace StripeNode { * Cardholder name */ name: string; - + /** * Uniquely identifies this particular card number. You can use this attribute to check * whether two customers who've signed up with you are using the same card number, for example. */ fingerprint: string; - + metadata?: IMetadata; - + /** - * If the card number is tokenized, this is the method that was + * If the card number is tokenized, this is the method that was * used. Can be "apple_pay" or "android_pay". */ tokenization_method: "apple_pay" | "android_pay"; } - + interface ICardUpdateOptions extends IDataOptionsWithMetadata { address_city?: string; address_country?: string; @@ -3915,85 +3915,85 @@ declare namespace StripeNode { address_line2?: string; address_state?: string; address_zip?: string; - + /** - * Only applicable on accounts (not customers or recipients). - * If set to true, this card will become the default external + * Only applicable on accounts (not customers or recipients). + * If set to true, this card will become the default external * account for its currency. - * + * * Managed accounts only */ default_for_currency?: boolean; - + exp_month?: number; exp_year?: number; - + /** * Cardholder name */ name?: string; } - + interface ISourceCreationOptions { /** * he type of payment source. Should be "card". */ object: "card"; - + /** * Two digit number representing the card's expiration month. */ exp_month: number; - + /** * Two or four digit number representing the card's expiration year. */ exp_year: number; - + /** * The card number, as a string without any separators. */ number: number; - + /** - * Card security code. Required unless your account is registered in - * Australia, Canada, or the United States. Highly recommended to always + * Card security code. Required unless your account is registered in + * Australia, Canada, or the United States. Highly recommended to always * include this value. */ cvc?: number; - + /** * Cardholder's full name. */ name?: string; - + address_city?: string; address_country?: string; address_line1?: string; address_line2?: string; address_state?: string; address_zip?: string; - + metadata?: IMetadata; } - + interface ISourceCreationOptionsExtended extends ISourceCreationOptions { /** - * Required when adding a card to an account (not applicable to a - * customers or recipients). The card (which must be a debit card) can be - * used as a transfer destination for funds in this currency. Currently, the + * Required when adding a card to an account (not applicable to a + * customers or recipients). The card (which must be a debit card) can be + * used as a transfer destination for funds in this currency. Currently, the * only supported currency for debit card transfers is usd. - * + * * Managed accounts only. */ currency?: string; - + /** - * Only applicable on accounts (not customers or recipients). If you set - * this to true (or if this is the first external account being added in this - * currency) this card will become the default external account for its + * Only applicable on accounts (not customers or recipients). If you set + * this to true (or if this is the first external account being added in this + * currency) this card will become the default external account for its * currency. - * + * * Managed accounts only. */ default_for_currency?: boolean; @@ -4010,70 +4010,70 @@ declare namespace StripeNode { * Value is "subscription" */ object: "subscription"; - + /** * A positive decimal that represents the fee percentage of the subscription invoice amount that will be transferred to * the application owner's Stripe account each billing period. */ application_fee_percent: number; - + /** * If the subscription has been canceled with the at_period_end flag set to true, cancel_at_period_end on the * subscription will be true. You can use this attribute to determine whether a subscription that has a status * of active is scheduled to be canceled at the end of the current period. */ cancel_at_period_end: boolean; - + /** * If the subscription has been canceled, the date of that cancellation. If the subscription was canceled with * cancel_at_period_end, canceled_at will still reflect the date of the initial cancellation request, not the end of the * subscription period when the subscription is automatically moved to a canceled state. */ canceled_at: number; - + created: number; - + /** * End of the current period that the subscription has been invoiced for. At the end of this period, a new invoice will be created. */ current_period_end: number; - + /** * Start of the current period that the subscription has been invoiced for */ current_period_start: number; - + customer: string; - + /** * Describes the current discount applied to this subscription, if there is one. When billing, a discount applied to a * subscription overrides a discount applied on a customer-wide basis. */ discount: coupons.IDiscount; - + /** * If the subscription has ended (either because it was canceled or because the customer was switched to a subscription * to a new plan), the date the subscription ended */ ended_at: number; - + metadata: IMetadata; - + /** * Hash describing the plan the customer is subscribed to */ plan: plans.IPlan; - + /** * The number of subscriptions for the associated plan */ quantity: number; - + /** * Date the subscription started */ start: number; - + /** * Possible values are "trialing", "active", "past_due", "canceled", or "unpaid". A subscription still in its trial period is trialing * and moves to active when the trial period is over. When payment to renew the subscription fails, the subscription becomes @@ -4084,145 +4084,145 @@ declare namespace StripeNode { * you may choose to reopen and pay their closed invoices. */ status: "trialing" | "active" | "past_due" | "canceled" | "unpaid"; - + /** * If provided, each invoice created by this subscription will apply the tax rate, increasing the amount billed to the customer. */ tax_percent: number; - + /** * If the subscription has a trial, the end of that trial. */ trial_end: number; - + /** * If the subscription has a trial, the beginning of that trial. */ trial_start: number; } - + interface ISubscriptionCustCreationOptions extends IDataOptionsWithMetadata { /** * The identifier of the plan to subscribe the customer to. */ plan: string; - + /** - * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice - * subtotal that will be transferred to the application owner’s Stripe account. The request must be made with an OAuth key in order + * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice + * subtotal that will be transferred to the application owner’s Stripe account. The request must be made with an OAuth key in order * to set an application fee percentage. For more information, see the application fees documentation. */ application_fee_percent?: number; - + /** - * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that + * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that * particular subscription. */ coupon?: string; - + source?: sources.ISourceCreationOptions; - + /** - * The quantity you'd like to apply to the subscription you're creating. For example, if your plan is £10/user/month, and your customer - * has 5 users, you could pass 5 as the quantity to have the customer charged £50 (5 x £10) monthly. If you update a subscription but - * don't change the plan ID (e.g. changing only the trial_end), the subscription will inherit the old subscription's quantity attribute - * unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new subscription will not inherit + * The quantity you'd like to apply to the subscription you're creating. For example, if your plan is £10/user/month, and your customer + * has 5 users, you could pass 5 as the quantity to have the customer charged £50 (5 x £10) monthly. If you update a subscription but + * don't change the plan ID (e.g. changing only the trial_end), the subscription will inherit the old subscription's quantity attribute + * unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new subscription will not inherit * the quantity attribute and will default to 1 unless you pass a quantity parameter. */ quantity?: number; - + /** - * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice - * subtotal that will be calculated and added as tax to the final amount each billing period. For example, a plan which charges $10/month + * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice + * subtotal that will be calculated and added as tax to the final amount each billing period. For example, a plan which charges $10/month * with a tax_percent of 20.0 will charge $12 per invoice. */ tax_percent?: number; - + /** - * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end - * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the + * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end + * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the * customer's trial immediately. */ trial_end?: number; } - + interface ISubscriptionCreationOptions extends ISubscriptionCustCreationOptions { /*** * The identifier of the customer to subscribe. */ customer: string; - } - + } + interface ISubscriptionUpdateOptions extends IDataOptionsWithMetadata { /** - * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice - * subtotal that will be transferred to the application owner’s Stripe account. The request must be made with an OAuth key in order + * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice + * subtotal that will be transferred to the application owner’s Stripe account. The request must be made with an OAuth key in order * to set an application fee percentage. For more information, see the application fees documentation. */ application_fee_percent?: number; - + /** - * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that + * The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that * particular subscription. */ coupon?: string; - + /** * The identifier of the plan to update the subscription to. If omitted, the subscription will not change plans. */ plan?: string; - + /** * Flag telling us whether to prorate switching plans during a billing cycle. */ prorate?: boolean; - + /** - * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the - * same proration that was previewed with upcoming invoice endpoint. It can also be used to implement custom proration logic, such as + * If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the + * same proration that was previewed with upcoming invoice endpoint. It can also be used to implement custom proration logic, such as * prorating by day instead of by second, by providing the time that you wish to use for proration calculations. */ proration_date?: number; - + /** - * The quantity you'd like to apply to the subscription you're creating. For example, if your plan is £10/user/month, and your customer - * has 5 users, you could pass 5 as the quantity to have the customer charged £50 (5 x £10) monthly. If you update a subscription but - * don't change the plan ID (e.g. changing only the trial_end), the subscription will inherit the old subscription's quantity attribute - * unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new subscription will not inherit + * The quantity you'd like to apply to the subscription you're creating. For example, if your plan is £10/user/month, and your customer + * has 5 users, you could pass 5 as the quantity to have the customer charged £50 (5 x £10) monthly. If you update a subscription but + * don't change the plan ID (e.g. changing only the trial_end), the subscription will inherit the old subscription's quantity attribute + * unless you pass a new quantity parameter. If you update a subscription and change the plan ID, the new subscription will not inherit * the quantity attribute and will default to 1 unless you pass a quantity parameter. */ quantity?: number; - + source?: sources.ISourceCreationOptions; - + /** - * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice - * subtotal that will be calculated and added as tax to the final amount each billing period. For example, a plan which charges $10/month + * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice + * subtotal that will be calculated and added as tax to the final amount each billing period. For example, a plan which charges $10/month * with a tax_percent of 20.0 will charge $12 per invoice. */ tax_percent?: number; - + /** - * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end - * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the + * Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end + * will override the default trial period of the plan the customer is being subscribed to. The special value now can be provided to end the * customer's trial immediately. */ trial_end?: number; } - + interface ISubscriptionCancellationOptions extends IDataOptions { /** * A flag that if set to true will delay the cancellation of the subscription until the end of the current period. */ at_period_end?: boolean; } - + interface ISubscriptionListOptions extends IListOptionsCreated { /** * The ID of the customer whose subscriptions will be retrieved */ customer?: string; - + /** * The ID of the plan whose subscriptions will be retrieved */ @@ -4243,28 +4243,28 @@ declare namespace StripeNode { * Amount in cents/pence. */ amount: number; - + /** * Balance transaction that describes the impact of this reversal on your account balance. */ balance_transaction: string; - + /** * ID of the charge that was refunded. [Expandable] */ charge: string | charges.ICharge; - + created: number; /** * Three-letter ISO currency code representing the currency in which the charge was made. */ currency: string; - + description: string; - + /** - * A set of key/value pairs that you can attach to the object. It can be useful + * A set of key/value pairs that you can attach to the object. It can be useful * for storing additional information in a structured format. */ metadata: IMetadata; @@ -4279,63 +4279,63 @@ declare namespace StripeNode { */ receipt_number: string; } - + interface IRefundCreationOptions extends IDataOptions { /** - * A positive integer in cents/pence representing how much of this charge to - * refund. Can only refund up to the unrefunded amount remaining of the + * A positive integer in cents/pence representing how much of this charge to + * refund. Can only refund up to the unrefunded amount remaining of the * charge. - * + * * default is entire charge */ amount?: number; - + /** - * A set of key/value pairs that you can attach to a refund object. It can be - * useful for storing additional information about the refund in a structured - * format. You can unset an individual key by setting its value to null and + * A set of key/value pairs that you can attach to a refund object. It can be + * useful for storing additional information about the refund in a structured + * format. You can unset an individual key by setting its value to null and * then saving. To clear all keys, set metadata to null, then save. */ metadata?: IMetadata; - + /** - * String indicating the reason for the refund. If set, possible values are - * "duplicate", "fraudulent", and "requested_by_customer". Specifying - * "fraudulent" as the reason when you believe the charge to be fraudulent + * String indicating the reason for the refund. If set, possible values are + * "duplicate", "fraudulent", and "requested_by_customer". Specifying + * "fraudulent" as the reason when you believe the charge to be fraudulent * will help us improve our fraud detection algorithms. */ reason?: string; - + /** - * Boolean indicating whether the application fee should be refunded when - * refunding this charge. If a full charge refund is given, the full application - * fee will be refunded. Else, the application fee will be refunded with an + * Boolean indicating whether the application fee should be refunded when + * refunding this charge. If a full charge refund is given, the full application + * fee will be refunded. Else, the application fee will be refunded with an * amount proportional to the amount of the charge refunded. - * An application fee can only be refunded by the application that created the + * An application fee can only be refunded by the application that created the * charge. - * + * * Connect only, default is false. */ refund_application_fee?: boolean; - + /** - * Boolean indicating whether the transfer should be reversed when - * refunding this charge. The transfer will be reversed for the same amount + * Boolean indicating whether the transfer should be reversed when + * refunding this charge. The transfer will be reversed for the same amount * being refunded (either the entire or partial amount). * A transfer can only be reversed by the application that created the charge. - * + * * Connect only, default is false. */ reverse_transfer?: boolean; } - + interface IRefundCreationOptionsWithCharge extends IRefundCreationOptions { /** * The identifier of the charge to refund. */ charge: string; } - + interface IRefundListOptions extends IListOptions { /** * Only return refunds for the charge specified by this charge ID. @@ -4343,71 +4343,71 @@ declare namespace StripeNode { charge?: string; } } - + namespace sources { /** - * The source can either be a token, like the ones returned by our - * Stripe.js, or a object containing a user's credit card details (with - * the options shown below). You must provide a source if the - * customer does not already have a valid source attached, and you - * are subscribing the customer for a plan that is not free. Passing - * source will create a new source object, make it the customer - * default source, and delete the old customer default if one exists. - * If you want to add an additional source to use with subscriptions, - * instead use the card creation API to add the card and then the - * customer update API to set it as the default. Whenever you - * attach a card to a customer, Stripe will automatically validate the + * The source can either be a token, like the ones returned by our + * Stripe.js, or a object containing a user's credit card details (with + * the options shown below). You must provide a source if the + * customer does not already have a valid source attached, and you + * are subscribing the customer for a plan that is not free. Passing + * source will create a new source object, make it the customer + * default source, and delete the old customer default if one exists. + * If you want to add an additional source to use with subscriptions, + * instead use the card creation API to add the card and then the + * customer update API to set it as the default. Whenever you + * attach a card to a customer, Stripe will automatically validate the * card. */ type ISourceCreationOptions = string | cards.ISourceCreationOptions; - + /** - * The source can either be a token, like the ones returned by our - * Stripe.js, or a object containing a user's credit card details (with - * the options shown below). You must provide a source if the - * customer does not already have a valid source attached, and you - * are subscribing the customer for a plan that is not free. Passing - * source will create a new source object, make it the customer - * default source, and delete the old customer default if one exists. - * If you want to add an additional source to use with subscriptions, - * instead use the card creation API to add the card and then the - * customer update API to set it as the default. Whenever you - * attach a card to a customer, Stripe will automatically validate the + * The source can either be a token, like the ones returned by our + * Stripe.js, or a object containing a user's credit card details (with + * the options shown below). You must provide a source if the + * customer does not already have a valid source attached, and you + * are subscribing the customer for a plan that is not free. Passing + * source will create a new source object, make it the customer + * default source, and delete the old customer default if one exists. + * If you want to add an additional source to use with subscriptions, + * instead use the card creation API to add the card and then the + * customer update API to set it as the default. Whenever you + * attach a card to a customer, Stripe will automatically validate the * card. */ type ISourceCreationOptionsExtended = string | cards.ISourceCreationOptionsExtended; } - + namespace countrySpecs { interface ICountrySpec extends IResourceObject { /** * Value is "country_spec" */ object: "country_spec"; - + /** * The default currency for this country. This applies to both payment methods and bank accounts. */ default_currency: string; - + /** * Currencies that can be accepted in the specific country (for transfers). */ supported_bank_account_currencies: {}; - + /** * Currencies that can be accepted in the specified country (for payments). */ supported_payment_currencies: Array; - + /** - * Payment methods available in the specified country. You will need to enable bitcoin and ACH payments on your account for those methods to + * Payment methods available in the specified country. You will need to enable bitcoin and ACH payments on your account for those methods to * appear in this list. The stripe payment method refers to charging through your platform. */ supported_payment_methods: Array; - + /** - * Lists the types of verification data needed to keep an account open. Includes 'minimum' fields, which every account must eventually + * Lists the types of verification data needed to keep an account open. Includes 'minimum' fields, which every account must eventually * provide, as well as a 'additional' fields, which are only required for some merchants. */ verification_fields: { @@ -4422,11 +4422,11 @@ declare namespace StripeNode { } } } - + class StripeResource { constructor(stripe: Stripe, urlData: any); } - + namespace resources { class Accounts extends StripeResource { /** @@ -4434,7 +4434,7 @@ declare namespace StripeNode { */ create(data: accounts.IAccountCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: accounts.IAccountCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the details of the account. */ @@ -4444,38 +4444,38 @@ declare namespace StripeNode { retrieve(id: string, response?: IResponseFn): Promise; retrieve(options: HeaderOptions, response?: IResponseFn): Promise; retrieve(response?: IResponseFn): Promise; - + /** * Updates an account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. - * - * You may only update accounts that you manage. To update your own account, you can currently only do so via the dashboard. + * + * You may only update accounts that you manage. To update your own account, you can currently only do so via the dashboard. * For more information on updating managed accounts, see our guide. */ update(id: string, data: accounts.IAccountUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(id: string, data: accounts.IAccountUpdateOptions, response?: IResponseFn): Promise; - + /** * With Connect, you may delete Stripe accounts you manage. - * - * Managed accounts created using test-mode keys can be deleted at any time. Managed accounts created using live-mode keys may only be + * + * Managed accounts created using test-mode keys can be deleted at any time. Managed accounts created using live-mode keys may only be * deleted once all balances are zero. - * + * * If you are looking to close your own account, use the data tab in your account settings instead. */ del(id: string, options: HeaderOptions, response?: IResponseFn): Promise; del(id: string, response?: IResponseFn): Promise; del(options: HeaderOptions, response?: IResponseFn): Promise; del(response?: IResponseFn): Promise; - + /** * With Connect, you may flag managed accounts as suspicious. - * - * Managed accounts created using test-mode keys can be rejected at any time. Managed accounts created using live-mode keys may only be + * + * Managed accounts created using test-mode keys can be rejected at any time. Managed accounts created using live-mode keys may only be * rejected once all balances are zero. */ reject(id: string, data: accounts.IRejectReason, options: HeaderOptions, response?: IResponseFn): Promise; reject(id: string, data: accounts.IRejectReason, response?: IResponseFn): Promise; - + /** * Returns a list of accounts connected to your platform via Connect. If you’re not a platform, the list will be empty. */ @@ -4483,103 +4483,103 @@ declare namespace StripeNode { list(data: IListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * When you create a new bank account or credit card, you must specify a managed account to create it on. - * - * If the bank account's owner has no other external account in the bank account's currency, the new bank account will become the - * default for that currency. However, if the owner already has a bank account for that currency, the new account will only become + * + * If the bank account's owner has no other external account in the bank account's currency, the new bank account will become the + * default for that currency. However, if the owner already has a bank account for that currency, the new account will only become * the default if the default_for_currency parameter is set to true. - * - * If the account has no default destination card, then the new card will become the default. However, if the owner already has a - * default then it will not change. To change the default, you should set default_for_currency to true when creating a card for a + * + * If the account has no default destination card, then the new card will become the default. However, if the owner already has a + * default then it will not change. To change the default, you should set default_for_currency to true when creating a card for a * managed account. */ createExternalAccount(accId: string, data: accounts.IExternalAccountCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; createExternalAccount(accId: string, data: accounts.IExternalAccountCreationOptions, response?: IResponseFn): Promise; - + /** - * By default, you can see the 10 most recent bank accounts stored on a managed account directly on the object, but you can also + * By default, you can see the 10 most recent bank accounts stored on a managed account directly on the object, but you can also * retrieve details about a specific bank account stored on the Stripe account. */ retrieveExternalAccount(accId: string, bankAccId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveExternalAccount(accId: string, bankAccId: string, response?: IResponseFn): Promise; /** - * You can always see the 10 most recent cards directly on a managed account; this method lets you retrieve details about a specific + * You can always see the 10 most recent cards directly on a managed account; this method lets you retrieve details about a specific * card stored on the account. */ retrieveCard(accId: string, cardId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveCard(accId: string, cardId: string, response?: IResponseFn): Promise; - + /** - * Updates the metadata of a bank account belonging to a managed account, and optionally sets it as the default for its currency. + * Updates the metadata of a bank account belonging to a managed account, and optionally sets it as the default for its currency. * Other bank account details are not editable by design. */ updateExternalAccount(accId: string, bankAccId: string, data: accounts.IExternalAccountUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateExternalAccount(accId: string, bankAccId: string, data: accounts.IExternalAccountUpdateOptions, response?: IResponseFn): Promise; /** - * If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the - * full card details. Stripe also works directly with card networks so that your customers can continue using your service without + * If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the + * full card details. Stripe also works directly with card networks so that your customers can continue using your service without * interruption. - * + * * When you update a card, Stripe will automatically validate the card. */ updateExternalAccount(accId: string, cardId: string, data: cards.ICardUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateExternalAccount(accId: string, cardId: string, data: cards.ICardUpdateOptions, response?: IResponseFn): Promise; - + /** - * You can delete destination bank accounts and cards from a managed account. If a bank account is the default external account for its currency - * or card's default_for_currency property is true, it can only be deleted if it is the only external account for that currency, and the - * currency is not the Stripe account's default currency. Otherwise, you must set another external account to be the default for the currency + * You can delete destination bank accounts and cards from a managed account. If a bank account is the default external account for its currency + * or card's default_for_currency property is true, it can only be deleted if it is the only external account for that currency, and the + * currency is not the Stripe account's default currency. Otherwise, you must set another external account to be the default for the currency * before deleting it. */ deleteExternalAccount(accId: string, id: string, options: HeaderOptions, response?: IResponseFn): Promise; deleteExternalAccount(accId: string, id: string, response?: IResponseFn): Promise; - + /** - * You can see a list of the bank accounts belonging to a managed account. Note that the 10 most recent external accounts are always - * available by default on the corresponding Stripe object. If you need more than those 10, you can use this API method and the limit + * You can see a list of the bank accounts belonging to a managed account. Note that the 10 most recent external accounts are always + * available by default on the corresponding Stripe object. If you need more than those 10, you can use this API method and the limit * and starting_after parameters to page through additional bank accounts. */ listExternalAccounts(accId: string, data: accounts.IBankAccountListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; listExternalAccounts(accId: string, data: accounts.IBankAccountListOptions, response?: IResponseFn>): Promise>; - + /** - * You can see a list of the cards belonging to a managed account. Note that the 10 most recent external accounts are available on the - * account object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page + * You can see a list of the cards belonging to a managed account. Note that the 10 most recent external accounts are available on the + * account object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page * through additional cards. */ listExternalAccounts(accId: string, data: accounts.ICardListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; listExternalAccounts(accId: string, data: accounts.ICardListOptions, response?: IResponseFn>): Promise>; } - + class ApplicationFees extends StripeResource { /** - * Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the + * Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the * application fee. */ retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - + /** - * Returns a list of application fees you’ve previously collected. The application fees are returned in sorted order, with the most + * Returns a list of application fees you’ve previously collected. The application fees are returned in sorted order, with the most * recent fees appearing first. */ list(data: applicationFees.IApplicationFeeListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; list(data: applicationFees.IApplicationFeeListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** - * Refunds an application fee that has previously been collected but not yet refunded. Funds will be refunded to the Stripe account that + * Refunds an application fee that has previously been collected but not yet refunded. Funds will be refunded to the Stripe account that * the fee was originally collected from. - * + * * You can optionally refund only part of an application fee. You can do so as many times as you wish until the entire fee has been refunded. - * - * Once entirely refunded, an application fee can't be refunded again. This method will throw an error when called on an already-refunded + * + * Once entirely refunded, an application fee can't be refunded again. This method will throw an error when called on an already-refunded * application fee, or when trying to refund more money than is left on an application fee. */ refund(feeId: string, data: applicationFees.IApplicationFeeRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; @@ -4588,38 +4588,38 @@ declare namespace StripeNode { refund(feeId: string, response?: IResponseFn): Promise; /** - * Refunds an application fee that has previously been collected but not yet refunded. Funds will be refunded to the Stripe account that + * Refunds an application fee that has previously been collected but not yet refunded. Funds will be refunded to the Stripe account that * the fee was originally collected from. - * + * * You can optionally refund only part of an application fee. You can do so as many times as you wish until the entire fee has been refunded. - * - * Once entirely refunded, an application fee can't be refunded again. This method will throw an error when called on an already-refunded + * + * Once entirely refunded, an application fee can't be refunded again. This method will throw an error when called on an already-refunded * application fee, or when trying to refund more money than is left on an application fee. */ createRefund(feeId: string, data: applicationFees.IApplicationFeeRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; createRefund(feeId: string, data: applicationFees.IApplicationFeeRefundCreationOptions, response?: IResponseFn): Promise; createRefund(feeId: string, response?: IResponseFn): Promise; createRefund(feeId: string, options: HeaderOptions, response?: IResponseFn): Promise; - + /** - * By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details + * By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details * about a specific refund stored on the application fee. */ retreiveRefund(feeId: string, refundId: string, options: HeaderOptions, response?: IResponseFn): Promise; retreiveRefund(feeId: string, refundId: string, response?: IResponseFn): Promise; - + /** - * Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left + * Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left * unchanged. - * + * * This request only accepts metadata as an argument. */ updateRefund(feeId: string, refundId: string, data: { metadata?: IMetadata }, options: HeaderOptions, response?: IResponseFn): Promise; updateRefund(feeId: string, refundId: string, data: { metadata?: IMetadata }, response?: IResponseFn): Promise; - + /** - * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available - * by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after + * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available + * by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after * parameters to page through additional refunds. */ listRefunds(feeId: string, data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; @@ -4627,44 +4627,44 @@ declare namespace StripeNode { listRefunds(feeId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; listRefunds(feeId: string, response?: IResponseFn>): Promise>; } - + class ApplicationFeeRefunds extends StripeResource { /** - * Refunds an application fee that has previously been collected but not yet refunded. Funds will be refunded to the Stripe account that + * Refunds an application fee that has previously been collected but not yet refunded. Funds will be refunded to the Stripe account that * the fee was originally collected from. - * + * * You can optionally refund only part of an application fee. You can do so as many times as you wish until the entire fee has been refunded. - * - * Once entirely refunded, an application fee can't be refunded again. This method will throw an error when called on an already-refunded + * + * Once entirely refunded, an application fee can't be refunded again. This method will throw an error when called on an already-refunded * application fee, or when trying to refund more money than is left on an application fee. */ create(data: applicationFees.IApplicationFeeRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: applicationFees.IApplicationFeeRefundCreationOptions, response?: IResponseFn): Promise; create(options: HeaderOptions, response?: IResponseFn): Promise; create(response?: IResponseFn): Promise; - + /** - * By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details + * By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details * about a specific refund stored on the application fee. */ retrieve(refundId: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(refundId: string, options: IDataOptions, response?: IResponseFn): Promise; retrieve(refundId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(refundId: string, response?: IResponseFn): Promise; - - + + /** - * Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left + * Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left * unchanged. - * + * * This request only accepts metadata as an argument. */ update(refundId: string, data: { metadata?: IMetadata }, options: HeaderOptions, response?: IResponseFn): Promise; update(refundId: string, data: { metadata?: IMetadata }, response?: IResponseFn): Promise; - + /** - * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available - * by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after + * You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available + * by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after * parameters to page through additional refunds. */ list(data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; @@ -4672,28 +4672,28 @@ declare namespace StripeNode { list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; } - + class Balance extends StripeResource { retrieve(options: HeaderOptions, response?: IResponseFn): Promise; retrieve(response?: IResponseFn): Promise; - + retrieveTransaction(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveTransaction(id: string, response?: IResponseFn): Promise; - + listTransactions(data: balance.IBalanceListOptions, options: HeaderOptions, response?: IResponseFn): Promise>; listTransactions(data: balance.IBalanceListOptions, response?: IResponseFn): Promise>; listTransactions(options: HeaderOptions, response?: IResponseFn): Promise>; listTransactions(response?: IResponseFn): Promise>; } - + class BitcoinReceivers extends StripeResource { /** - * Creates a Bitcoin receiver object that can be used to accept bitcoin payments from your customer. The receiver exposes a Bitcoin address + * Creates a Bitcoin receiver object that can be used to accept bitcoin payments from your customer. The receiver exposes a Bitcoin address * and is created with a bitcoin to USD exchange rate that is valid for 10 minutes. */ create(data: bitcoinReceivers.IBitcoinReceiverCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: bitcoinReceivers.IBitcoinReceiverCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the Bitcoin receiver with the given ID. */ @@ -4701,16 +4701,16 @@ declare namespace StripeNode { retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - - + + /** * Returns a list of your receivers. Receivers are returned sorted by creation date, with the most recently created receivers appearing first. */ list(data: bitcoinReceivers.IBitcoinReceiverListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; list(data: bitcoinReceivers.IBitcoinReceiverListOptions, response?: IResponseFn>): Promise>; - + //update(id: string): void; // This does seem to be a method in the library (https://github.com/stripe/stripe-node/blob/master/lib/resources/BitcoinReceivers.js#L12), but isn't in the API documentation. - + setMetadata(): void; //TODO: Implement placeholder method getMetadata(): void; //TODO: Implement placeholder method } @@ -4744,8 +4744,8 @@ declare namespace StripeNode { retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - - + + /** * Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged. * This request accepts only the description, metadata, receipt_emailand fraud_details as arguments. @@ -4779,7 +4779,7 @@ declare namespace StripeNode { list(data: charges.IChargeListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * When you create a new refund, you must specify a charge to create it on. * Creating a new refund will refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged. The fees you were originally charged are also refunded. @@ -4790,7 +4790,7 @@ declare namespace StripeNode { refund(chargeId: string, data: refunds.IRefundCreationOptions, response?: IResponseFn): Promise; refund(chargeId: string, options: HeaderOptions, response?: IResponseFn): Promise; refund(chargeId: string, response?: IResponseFn): Promise; - + /** * When you create a new refund, you must specify a charge to create it on. Creating a new refund will refund a charge that has previously * been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged. The fees you were @@ -4804,7 +4804,7 @@ declare namespace StripeNode { * @param id The identifier of the charge to be refunded. * @param data Options for specifying reasons and refund amount * @param response The refund. - * + * * @deprecated According to source code (https://github.com/stripe/stripe-node/blob/master/lib/resources/Charges.js#L43) */ createRefund(id: string, data: refunds.IRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; @@ -4849,7 +4849,7 @@ declare namespace StripeNode { listRefunds(chargeId: string, data: IListOptions, response?: IResponseFn>): Promise>; listRefunds(chargeId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; listRefunds(chargeId: string, response?: IResponseFn>): Promise>; - + markAsSafe(chargeId: string, response?: IResponseFn): Promise; markAsFraudulent(chargeId: string, response?: IResponseFn): Promise; } @@ -4857,15 +4857,15 @@ declare namespace StripeNode { class ChargeRefunds extends StripeResource { /** * When you create a new refund, you must specify a charge to create it on. - * - * Creating a new refund will refund a charge that has previously been created but not yet refunded. - * Funds will be refunded to the credit or debit card that was originally charged. + * + * Creating a new refund will refund a charge that has previously been created but not yet refunded. + * Funds will be refunded to the credit or debit card that was originally charged. * The fees you were originally charged are also refunded. - * - * You can optionally refund only part of a charge. + * + * You can optionally refund only part of a charge. * You can do so as many times as you wish until the entire charge has been refunded. - * - * Once entirely refunded, a charge can't be refunded again. + * + * Once entirely refunded, a charge can't be refunded again. * This method will throw an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge. */ create(data: refunds.IRefundCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; @@ -4885,15 +4885,15 @@ declare namespace StripeNode { /** * Updates the specified refund by setting the values of the parameters passed. * Any parameters not provided will be left unchanged. - * + * * This request only accepts metadata as an argument. */ update(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; update(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; /** - * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, - * with the most recent refunds appearing first. + * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, + * with the most recent refunds appearing first. * For convenience, the 10 most recent refunds are always available by default on the charge object. */ list(data: refunds.IRefundListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; @@ -4916,7 +4916,7 @@ declare namespace StripeNode { */ create(data: coupons.ICouponCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: coupons.ICouponCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the coupon with the given ID. * @@ -4928,8 +4928,8 @@ declare namespace StripeNode { retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - - + + /** * Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable. * @@ -4941,7 +4941,7 @@ declare namespace StripeNode { */ update(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; update(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; - + /** * You can delete coupons via the coupon management page of the Stripe dashboard. However, deleting a coupon does not affect any * customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons @@ -4954,7 +4954,7 @@ declare namespace StripeNode { */ del(id: string, options: HeaderOptions, response?: IResponseFn): Promise; del(id: string, response?: IResponseFn): Promise; - + /** * Returns a list of your coupons. * @@ -4985,7 +4985,7 @@ declare namespace StripeNode { create(data: { card?: sources.ISourceCreationOptionsExtended; }, response?: IResponseFn): Promise; - + /** * You can see a list of the cards belonging to a customer or recipient. Note that the 10 most recent * cards are always available by default on the customer or recipient object. If you need more than @@ -5001,7 +5001,7 @@ declare namespace StripeNode { list(data: IListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the * full card details. Stripe also works directly with card networks so that your customers can continue using your service without @@ -5013,7 +5013,7 @@ declare namespace StripeNode { */ update(cardId: string, data: cards.ICardUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(cardId: string, data: cards.ICardUpdateOptions, response?: IResponseFn): Promise; - + /** * By default, you can see the 10 most recent cards stored on a customer or recipient directly on the customer or recipient object, but * you can also retrieve details about a specific card stored on the customer or recipient. @@ -5024,7 +5024,7 @@ declare namespace StripeNode { */ retrieve(cardId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(cardId: string, response?: IResponseFn): Promise; - + /** * You can delete cards from a customer or recipient. If you delete a card that is currently the * default source on a customer, then the most recently added source will become the new default. @@ -5042,7 +5042,7 @@ declare namespace StripeNode { del(cardId: string, options: HeaderOptions, response?: IResponseFn): Promise; del(cardId: string, response?: IResponseFn): Promise; } - + class Customers extends StripeResource { /** * Creates a new customer object. @@ -5057,7 +5057,7 @@ declare namespace StripeNode { */ create(data: customers.ICustomerCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: customers.ICustomerCreationOptions, response?: IResponseFn): Promise; - + /** * Returns a list of your customers. The customers are returned sorted by creation date, with the most recently created customers * appearing first. @@ -5073,7 +5073,7 @@ declare namespace StripeNode { list(data: IListOptionsCreated, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. * For example, if you pass the card parameter, that becomes the customer's active card to be used for all charges in the future. @@ -5085,7 +5085,7 @@ declare namespace StripeNode { * * @returns Returns the customer object if the update succeeded. Throws an error if update parameters are invalid (e.g. specifying * an invalid coupon or an invalid card). - * + * * @param id The identifier of the customer to be retrieved. */ update(id: string, data: customers.ICustomerUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; @@ -5104,7 +5104,7 @@ declare namespace StripeNode { retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - + /** * Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer. * @@ -5116,9 +5116,9 @@ declare namespace StripeNode { */ del(id: string, options: HeaderOptions, response?: IResponseFn): Promise; del(id: string, response?: IResponseFn): Promise; - - - + + + /** * When you create a new credit card, you must specify a customer or recipient to create it on. If the card's owner has no default card, * then the new card will become the default. However, if the owner already has a default then it will not change. To change the default, @@ -5127,7 +5127,7 @@ declare namespace StripeNode { * @returns Returns the card object. * * @param customerId The customer ID to which to add the card. - * + * * @deprecated */ createCard(customerId: string, data: { @@ -5136,7 +5136,7 @@ declare namespace StripeNode { createCard(customerId: string, data: { card?: sources.ISourceCreationOptionsExtended; }, response?: IResponseFn): Promise; - + /** * By default, you can see the 10 most recent cards stored on a customer or recipient directly on the customer or recipient object, but * you can also retrieve details about a specific card stored on the customer or recipient. @@ -5148,7 +5148,7 @@ declare namespace StripeNode { */ retrieveCard(customerId: string, cardId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveCard(customerId: string, cardId: string, response?: IResponseFn): Promise; - + /** * If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the * full card details. Stripe also works directly with card networks so that your customers can continue using your service without @@ -5161,7 +5161,7 @@ declare namespace StripeNode { */ updateCard(customerId: string, cardId: string, data: cards.ICardUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateCard(customerId: string, cardId: string, data: cards.ICardUpdateOptions, response?: IResponseFn): Promise; - + /** * You can delete cards from a customer or recipient. If you delete a card that is currently the * default source on a customer, then the most recently added source will become the new default. @@ -5179,7 +5179,7 @@ declare namespace StripeNode { */ deleteCard(customerId: string, cardId: string, options: HeaderOptions, response?: IResponseFn): Promise; deleteCard(customerId: string, cardId: string, response?: IResponseFn): Promise; - + /** * You can see a list of the cards belonging to a customer or recipient. Note that the 10 most recent * cards are always available by default on the customer or recipient object. If you need more than @@ -5197,13 +5197,13 @@ declare namespace StripeNode { listCards(customerId: string, data: IListOptions, response?: IResponseFn>): Promise>; listCards(customerId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; listCards(customerId: string, response?: IResponseFn>): Promise>; - - + + /** - * When adding a card to a customer, the parameter name is source. When - * adding to an account, the parameter name is external_account. The - * value can either be a token, like the ones returned by our Stripe.js, or a - * dictionary containing a user's credit card details. + * When adding a card to a customer, the parameter name is source. When + * adding to an account, the parameter name is external_account. The + * value can either be a token, like the ones returned by our Stripe.js, or a + * dictionary containing a user's credit card details. * Stripe will automatically validate the card. * * @returns Returns the card object. @@ -5213,10 +5213,10 @@ declare namespace StripeNode { createSource(customerId: string, data: customers.ICustomerCardSourceCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; createSource(customerId: string, data: customers.ICustomerCardSourceCreationOptions, response?: IResponseFn): Promise; /** - * When adding a card to a customer, the parameter name is source. When - * adding to an account, the parameter name is external_account. The - * value can either be a token, like the ones returned by our Stripe.js, or a - * dictionary containing a user’s credit card details. + * When adding a card to a customer, the parameter name is source. When + * adding to an account, the parameter name is external_account. The + * value can either be a token, like the ones returned by our Stripe.js, or a + * dictionary containing a user’s credit card details. * Stripe will automatically validate the card. * * @returns Returns the card or bank account object. @@ -5225,7 +5225,7 @@ declare namespace StripeNode { */ createSource(customerId: string, data: customers.ICustomerSourceCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; createSource(customerId: string, data: customers.ICustomerSourceCreationOptions, response?: IResponseFn): Promise; - + /** * You can see a list of the cards belonging to a customer or recipient. Note that the 10 most recent * cards are always available by default on the customer or recipient object. If you need more than @@ -5256,7 +5256,7 @@ declare namespace StripeNode { */ listSource(customerId: string, data: customers.IBankAccountSourceListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; listSource(customerId: string, data: customers.IBankAccountSourceListOptions, response?: IResponseFn>): Promise>; - + /** * By default, you can see the 10 most recent cards/bank accounts stored on a customer or recipient directly on the customer or recipient object, but * you can also retrieve details about a specific card/bank account stored on the customer or recipient. @@ -5268,7 +5268,7 @@ declare namespace StripeNode { */ retrieveSource(customerId: string, sourceId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveSource(customerId: string, sourceId: string, response?: IResponseFn): Promise; - + /** * If you need to update only some card details, like the billing address or expiration date, you can do so without having to re-enter the * full card details. Stripe also works directly with card networks so that your customers can continue using your service without @@ -5281,9 +5281,9 @@ declare namespace StripeNode { */ updateSource(customerId: string, sourceId: string, data: cards.ICardUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateSource(customerId: string, sourceId: string, data: cards.ICardUpdateOptions, response?: IResponseFn): Promise; - + /** - * Updates the metadata, account_holder_name, and account_holder_type of a bank account belonging to a Customer. Other bank account details + * Updates the metadata, account_holder_name, and account_holder_type of a bank account belonging to a Customer. Other bank account details * are not editable by design. * * @returns Returns the bank account object. @@ -5293,7 +5293,7 @@ declare namespace StripeNode { */ updateSource(customerId: string, sourceId: string, data: bankAccounts.IBankAccountUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateSource(customerId: string, sourceId: string, data: bankAccounts.IBankAccountUpdateOptions, response?: IResponseFn): Promise; - + /** * You can delete cards or bank accounts from a customer or recipient. If you delete a card or bank account that is currently the * default source on a customer, then the most recently added source will become the new default. @@ -5315,8 +5315,8 @@ declare namespace StripeNode { verifySource(customerId: string, sourceId: string, options: HeaderOptions): Promise<{}>; //TODO: This still needs properly implementing. verifySource(customerId: string, sourceId: string): Promise<{}>; //TODO: This still needs properly implementing. - - + + /** * Creates a new subscription on an existing customer. * @@ -5329,7 +5329,7 @@ declare namespace StripeNode { */ createSubscription(customerId: string, data: subscriptions.ISubscriptionCustCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; createSubscription(customerId: string, data: subscriptions.ISubscriptionCustCreationOptions, response?: IResponseFn): Promise; - + /** * By default, you can see the 10 most recent active subscriptions stored on a customer directly on the customer * object, but you can also retrieve details about a specific active subscription for a customer. @@ -5341,7 +5341,7 @@ declare namespace StripeNode { */ retrieveSubscription(customerId: string, subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveSubscription(customerId: string, subscriptionId: string, response?: IResponseFn): Promise; - + /** * Updates an existing subscription on a customer to match the specified parameters. When changing plans or quantities, * we will optionally prorate the price we charge next month to make up for any price changes. @@ -5369,7 +5369,7 @@ declare namespace StripeNode { */ updateSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, response?: IResponseFn): Promise; - + /** * Cancels a customer's subscription. If you set the at_period_end parameter to true, the subscription will remain active until * the end of the period, at which point it will be canceled and not renewed. By default, the subscription is terminated @@ -5392,7 +5392,7 @@ declare namespace StripeNode { cancelSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, options: HeaderOptions, response?: IResponseFn): Promise; cancelSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, response?: IResponseFn): Promise; cancelSubscription(customerId: string, subscriptionId: string, response?: IResponseFn): Promise; - + /** * You can see a list of the customer's active subscriptions. Note that the 10 most recent active subscriptions are always available * by default on the customer object. If you need more than those 10, you can use the limit and starting_after parameters to page @@ -5408,8 +5408,8 @@ declare namespace StripeNode { listSubscriptions(customerId: string, data: IListOptions, response?: IResponseFn>): Promise>; listSubscriptions(customerId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; listSubscriptions(customerId: string, response?: IResponseFn>): Promise>; - - + + /** * Removes the currently applied discount on a customer. * @@ -5420,7 +5420,7 @@ declare namespace StripeNode { */ deleteDiscount(customerId: string, options: HeaderOptions, response?: IResponseFn): Promise;; deleteDiscount(customerId: string, response?: IResponseFn): Promise;; - + /** * Removes the currently applied discount on a subscription. * @@ -5445,7 +5445,7 @@ declare namespace StripeNode { */ retrieve(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(subscriptionId: string, response?: IResponseFn): Promise; - + /** * Updates an existing subscription on a customer to match the specified parameters. When changing plans or quantities, * we will optionally prorate the price we charge next month to make up for any price changes. @@ -5472,7 +5472,7 @@ declare namespace StripeNode { */ update(subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, response?: IResponseFn): Promise; - + /** * Cancels a customer's subscription. If you set the at_period_end parameter to true, the subscription will remain active until * the end of the period, at which point it will be canceled and not renewed. By default, the subscription is terminated @@ -5495,7 +5495,7 @@ declare namespace StripeNode { del(subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, response?: IResponseFn): Promise; del(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; del(subscriptionId: string, response?: IResponseFn): Promise; - + /** * You can see a list of the customer's active subscriptions. Note that the 10 most recent active subscriptions are always available * by default on the customer object. If you need more than those 10, you can use the limit and starting_after parameters to page @@ -5510,7 +5510,7 @@ declare namespace StripeNode { list(data: subscriptions.ISubscriptionListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * Removes the currently applied discount on a subscription. * @@ -5522,7 +5522,7 @@ declare namespace StripeNode { deleteDiscount(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise;; deleteDiscount(subscriptionId: string, response?: IResponseFn): Promise;; } - + class Subscriptions extends SubscriptionsBase { /** * Creates a new subscription on an existing customer. @@ -5549,7 +5549,7 @@ declare namespace StripeNode { create(data: subscriptions.ISubscriptionCustCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: subscriptions.ISubscriptionCustCreationOptions, response?: IResponseFn): Promise; } - + class Disputes extends StripeResource { /** * Retrieves the dispute with the given ID. @@ -5558,8 +5558,8 @@ declare namespace StripeNode { retrieve(disputeId: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(disputeId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(disputeId: string, response?: IResponseFn): Promise; - - + + /** * When you get a dispute, contacting your customer is always the best first step. If that doesn't work, you can submit evidence in * order to help us resolve the dispute in your favor. You can do this in your dashboard, but if you prefer, you can use the API to @@ -5571,18 +5571,18 @@ declare namespace StripeNode { */ update(disputeId: string, data: disputes.IDisputeUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(disputeId: string, data: disputes.IDisputeUpdateOptions, response?: IResponseFn): Promise; - + /** - * Closing the dispute for a charge indicates that you do not have any evidence to submit and are + * Closing the dispute for a charge indicates that you do not have any evidence to submit and are * essentially ‘dismissing’ the dispute, acknowledging it as lost - * - * The status of the dispute will change from needs_response to lost. - * + * + * The status of the dispute will change from needs_response to lost. + * * *Closing a dispute is irreversible!* */ close(disputeId: string, options: HeaderOptions, response?: IResponseFn): Promise; close(disputeId: string, response?: IResponseFn): Promise; - + /** * Returns a list of your disputes. */ @@ -5590,22 +5590,22 @@ declare namespace StripeNode { list(data: IListOptionsCreated, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + setMetadata(): void; //TODO: Implement placeholder method getMetadata(): void; //TODO: Implement placeholder method } - + class Events extends StripeResource { /** - * Retrieves the details of an event. Supply the unique identifier of the event, which you might have + * Retrieves the details of an event. Supply the unique identifier of the event, which you might have * received in a webhook. */ retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - - + + /** * List events, going back up to 30 days. */ @@ -5617,25 +5617,25 @@ declare namespace StripeNode { class FileUploads extends StripeResource { /** - * To upload a file to Stripe, you’ll need to send a request of type multipart/form-data. + * To upload a file to Stripe, you’ll need to send a request of type multipart/form-data. * The request should contain the file you would like to upload, as well as the parameters for creating a file. - * + * * All of Stripe’s officially supported API libraries should have support for sending multipart/form-data. */ create(data: fileUploads.IFileUploadCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: fileUploads.IFileUploadCreationOptions, response?: IResponseFn): Promise; - + /** - * Retrieves the details of an existing file object. + * Retrieves the details of an existing file object. * Supply the unique file upload ID from a file creation request, and Stripe will return the corresponding transfer information. */ retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - + /** - * Returns a list of the files that you have uploaded to Stripe. + * Returns a list of the files that you have uploaded to Stripe. * The file uploads are returned sorted by creation date, with the most recently created file uploads appearing first. */ list(data: fileUploads.IFileUploadListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; @@ -5658,7 +5658,7 @@ declare namespace StripeNode { */ create(data: invoices.IInvoiceCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: invoices.IInvoiceCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the invoice with the given ID. The invoice object contains a * lines hash that contains information about the subscriptions and invoice items that have been applied to the @@ -5681,7 +5681,7 @@ declare namespace StripeNode { retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - + /** * When retrieving an invoice, you'll get a lines property containing the total count of line items and the first * handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. @@ -5695,7 +5695,7 @@ declare namespace StripeNode { retrieveLines(id: string, data: invoices.IInvoiceLineItemRetrievalOptions, response?: IResponseFn>): Promise; retrieveLines(id: string, options: HeaderOptions, response?: IResponseFn>): Promise; retrieveLines(id: string, response?: IResponseFn>): Promise; - + /** * At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, * including subscription renewal charges, invoice item charges, etc. It will also show you any discount that is applicable @@ -5712,7 +5712,7 @@ declare namespace StripeNode { retrieveUpcoming(id: string, data: invoices.IInvoiceUpcomingOptions, response?: IResponseFn): Promise; retrieveUpcoming(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveUpcoming(id: string, response?: IResponseFn): Promise; - + /** * Until an invoice is paid, it is marked as open (closed=false). If you'd like to stop Stripe from automatically attempting * payment on an invoice or would simply like to close the invoice out as no longer owed by the customer, you can update the @@ -5725,7 +5725,7 @@ declare namespace StripeNode { */ update(id: string, data: invoices.IInvoiceUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(id: string, data: invoices.IInvoiceUpdateOptions, response?: IResponseFn): Promise; - + /** * Stripe automatically creates and then attempts to pay invoices for customers on subscriptions. We'll also retry unpaid * invoices according to your retry settings. However, if you'd like to attempt to collect payment on an invoice out of the @@ -5737,7 +5737,7 @@ declare namespace StripeNode { */ pay(id: string, options: HeaderOptions, response?: IResponseFn): Promise; pay(id: string, response?: IResponseFn): Promise; - + /** * You can list all invoices, or list the invoices for a specific customer. The invoices are returned * sorted by creation date, with the most recently created invoices appearing first. @@ -5751,44 +5751,44 @@ declare namespace StripeNode { list(data: invoices.IInvoiceListOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; } - + class InvoiceItems extends StripeResource { /** * Adds an arbitrary charge or credit to the customer’s upcoming invoice. */ create(data: invoiceItems.InvoiceItemCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: invoiceItems.InvoiceItemCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the invoice item with the given ID. */ retrieve(invoiceItemId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(invoiceItemId: string, response?: IResponseFn): Promise; - + /** - * Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the + * Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the * invoice it's attached to is closed. */ update(invoiceItemId: string, data: invoiceItems.InvoiceItemUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(invoiceItemId: string, data: invoiceItems.InvoiceItemUpdateOptions, response?: IResponseFn): Promise; - + /** - * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice + * Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice * items appearing first. */ list(data: invoiceItems.InvoiceItemListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; list(data: invoiceItems.InvoiceItemListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** - * Removes an invoice item from the upcoming invoice. Removing an invoice item is only possible before the invoice it's attached + * Removes an invoice item from the upcoming invoice. Removing an invoice item is only possible before the invoice it's attached * to is closed. */ del(invoiceItemId: string, options: HeaderOptions, response?: IResponseFn): Promise; del(invoiceItemId: string, response?: IResponseFn): Promise; } - + class Plans extends StripeResource { /** * You can create plans easily via the plan management page of the Stripe dashboard. Plan creation is also @@ -5800,7 +5800,7 @@ declare namespace StripeNode { */ create(data: plans.IPlanCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: plans.IPlanCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the plan with the given ID. * @@ -5810,7 +5810,7 @@ declare namespace StripeNode { */ retrieve(planName: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(planName: string, response?: IResponseFn): Promise; - + /** * Updates the name of a plan. Other plan details (price, interval, etc.) are, by design, not editable. * @@ -5821,7 +5821,7 @@ declare namespace StripeNode { */ update(planName: string, data: plans.IPlanUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(planName: string, data: plans.IPlanUpdateOptions, response?: IResponseFn): Promise; - + /** * You can delete plans via the plan management page of the Stripe dashboard. However, deleting a plan does not affect * any current subscribers to the plan; it merely means that new subscribers can't be added to that plan. You can also @@ -5833,7 +5833,7 @@ declare namespace StripeNode { */ del(planName: string, options: HeaderOptions, response?: IResponseFn): Promise; del(planName: string, response?: IResponseFn): Promise; - + /** * Returns a list of your plans. * @@ -5847,7 +5847,7 @@ declare namespace StripeNode { list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; } - + /** * @deprecated */ @@ -5901,24 +5901,24 @@ declare namespace StripeNode { */ del(id: string): void; } - + class Refunds extends StripeResource { /** * When you create a new refund, you must specify a charge to create it on. - * - * Creating a new refund will refund a charge that has previously been created but not yet refunded. - * Funds will be refunded to the credit or debit card that was originally charged. + * + * Creating a new refund will refund a charge that has previously been created but not yet refunded. + * Funds will be refunded to the credit or debit card that was originally charged. * The fees you were originally charged are also refunded. - * - * You can optionally refund only part of a charge. + * + * You can optionally refund only part of a charge. * You can do so as many times as you wish until the entire charge has been refunded. - * - * Once entirely refunded, a charge can't be refunded again. + * + * Once entirely refunded, a charge can't be refunded again. * This method will throw an error when called on an already-refunded charge, or when trying to refund more money than is left on a charge. */ create(data: refunds.IRefundCreationOptionsWithCharge, options: HeaderOptions, response?: IResponseFn): Promise; create(data: refunds.IRefundCreationOptionsWithCharge, response?: IResponseFn): Promise; - + /** * Retrieves the details of an existing refund. */ @@ -5926,20 +5926,20 @@ declare namespace StripeNode { retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - - + + /** * Updates the specified refund by setting the values of the parameters passed. * Any parameters not provided will be left unchanged. - * + * * This request only accepts metadata as an argument. */ update(id: string, data: IDataOptionsWithMetadata, options: HeaderOptions, response?: IResponseFn): Promise; update(id: string, data: IDataOptionsWithMetadata, response?: IResponseFn): Promise; - + /** - * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, - * with the most recent refunds appearing first. + * Returns a list of all refunds you’ve previously created. The refunds are returned in sorted order, + * with the most recent refunds appearing first. * For convenience, the 10 most recent refunds are always available by default on the charge object. */ list(data: refunds.IRefundListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; @@ -5947,32 +5947,32 @@ declare namespace StripeNode { list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; } - + class Tokens extends StripeResource { /** - * Creates a single use token that wraps the details of a credit card. This token can be used - * in place of a credit card object with any API method. These tokens can only be used once: + * Creates a single use token that wraps the details of a credit card. This token can be used + * in place of a credit card object with any API method. These tokens can only be used once: * by creating a new charge object, or attaching them to a customer. */ create(data: tokens.ICardTokenCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: tokens.ICardTokenCreationOptions, response?: IResponseFn): Promise; - + /** - * Creates a single use token that wraps the details of a bank account. This token can be used - * in place of a bank account object with any API method. These tokens can only be used once: + * Creates a single use token that wraps the details of a bank account. This token can be used + * in place of a bank account object with any API method. These tokens can only be used once: * by attaching them to a recipient or managed account. */ create(data: tokens.IBankAccountTokenCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: tokens.IBankAccountTokenCreationOptions, response?: IResponseFn): Promise; - + /** - * Creates a single use token that wraps the details of personally identifiable information (PII). - * This token can be used in place of a personal_id_number in the Account Update API method. + * Creates a single use token that wraps the details of personally identifiable information (PII). + * This token can be used in place of a personal_id_number in the Account Update API method. * These tokens can only be used once. */ create(data: tokens.IPiiTokenCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: tokens.IPiiTokenCreationOptions, response?: IResponseFn): Promise; - + /** * Retrieves the token with the given ID. */ @@ -5980,155 +5980,155 @@ declare namespace StripeNode { retrieve(tokenId: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(tokenId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(tokenId: string, response?: IResponseFn): Promise; - + } class Transfers extends StripeResource { /** - * To send funds from your Stripe account to a third-party recipient or to your own bank account, you create a new transfer + * To send funds from your Stripe account to a third-party recipient or to your own bank account, you create a new transfer * object. Your Stripe balance must be able to cover the transfer amount, or you'll receive an "Insufficient Funds" error. - * + * * If your API key is in test mode, money won't actually be sent, though everything else will occur as if in live mode. - * - * If you are creating a manual transfer or a special case transfer on a Stripe account that uses multiple payment source - * types, you'll need to specify the source type balance that the transfer should draw from. The balance object details + * + * If you are creating a manual transfer or a special case transfer on a Stripe account that uses multiple payment source + * types, you'll need to specify the source type balance that the transfer should draw from. The balance object details * available and pending amounts by source type. */ create(data: transfers.ITransferCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: transfers.ITransferCreationOptions, response?: IResponseFn): Promise; - + /** - * Retrieves the details of an existing transfer. Supply the unique transfer ID from either a transfer creation request or + * Retrieves the details of an existing transfer. Supply the unique transfer ID from either a transfer creation request or * the transfer list, and Stripe will return the corresponding transfer information. */ retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; - - + + /** - * Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left + * Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left * unchanged. - * + * * This request accepts only the description and metadata as arguments. */ update(id: string, data: transfers.ITransferUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(id: string, data: transfers.ITransferUpdateOptions, response?: IResponseFn): Promise; - + /** - * Returns a list of existing transfers sent to third-party bank accounts or that Stripe has sent you. The transfers are + * Returns a list of existing transfers sent to third-party bank accounts or that Stripe has sent you. The transfers are * returned in sorted order, with the most recently created transfers appearing first. */ list(data: transfers.ITransferListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; list(data: transfers.ITransferListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + cancel(id: string, options: HeaderOptions, response?: IResponseFn): Promise; cancel(id: string, response?: IResponseFn): Promise; - + listTransactions(options: HeaderOptions, response?: IResponseFn>): Promise>; //TODO: Not sure if this should be a list of balance transactions or charges. listTransactions(response?: IResponseFn>): Promise>; //TODO: Not sure if this should be a list of balance transactions or charges. - + /** * When you create a new reversal, you must specify a transfer to create it on. - * - * Creating a new reversal on a transfer that has previously been created but not paid out will return the funds to your available balance + * + * Creating a new reversal on a transfer that has previously been created but not paid out will return the funds to your available balance * and refund the fees you were originally charged on the transfer. You may not reverse automatic Stripe transfers. - * - * When reversing transfers to Stripe accounts, you can optionally reverse part of the transfer. You can do so as many times as you wish + * + * When reversing transfers to Stripe accounts, you can optionally reverse part of the transfer. You can do so as many times as you wish * until the entire transfer has been reversed. - * - * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, + * + * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, * or when trying to reverse more money than is left on a transfer. */ reverse(id: string, data: transferReversals.IReversalCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; reverse(id: string, options: HeaderOptions, response?: IResponseFn): Promise; reverse(id: string, response?: IResponseFn): Promise; - + /** * When you create a new reversal, you must specify a transfer to create it on. - * - * Creating a new reversal on a transfer that has previously been created but not paid out will return the funds to your available balance + * + * Creating a new reversal on a transfer that has previously been created but not paid out will return the funds to your available balance * and refund the fees you were originally charged on the transfer. You may not reverse automatic Stripe transfers. - * - * When reversing transfers to Stripe accounts, you can optionally reverse part of the transfer. You can do so as many times as you wish + * + * When reversing transfers to Stripe accounts, you can optionally reverse part of the transfer. You can do so as many times as you wish * until the entire transfer has been reversed. - * - * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, + * + * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, * or when trying to reverse more money than is left on a transfer. */ createReverse(transferId: string, data: transferReversals.IReversalCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; createReverse(transferId: string, options: HeaderOptions, response?: IResponseFn): Promise; createReverse(transferId: string, response?: IResponseFn): Promise; - + /** - * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a + * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a * specific reversal stored on the transfer. */ retrieveReversal(transferId: string, reversalId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveReversal(transferId: string, reversalId: string, response?: IResponseFn): Promise; - + /** * Updates the specified reversal by setting the values of the parameters passed. Any parameters not provided will be left unchanged. - * + * * This request only accepts metadata and description as arguments. */ updateReversal(transferId: string, reversalId: string, data: transferReversals.IReversalUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; updateReversal(transferId: string, reversalId: string, data: transferReversals.IReversalUpdateOptions, response?: IResponseFn): Promise; - + /** - * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by - * default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after + * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by + * default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after * parameters to page through additional reversals. */ listReversals(transferId: string, data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; listReversals(transferId: string, data: IListOptions, response?: IResponseFn>): Promise>; listReversals(transferId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; listReversals(transferId: string, response?: IResponseFn>): Promise>; - + setMetadata(): void; //TODO: Implement placeholder method getMetadata(): void; //TODO: Implement placeholder method } - + class TransferReversals extends StripeResource { /** * When you create a new reversal, you must specify a transfer to create it on. - * - * Creating a new reversal on a transfer that has previously been created but not paid out will return the funds to your available balance + * + * Creating a new reversal on a transfer that has previously been created but not paid out will return the funds to your available balance * and refund the fees you were originally charged on the transfer. You may not reverse automatic Stripe transfers. - * - * When reversing transfers to Stripe accounts, you can optionally reverse part of the transfer. You can do so as many times as you wish + * + * When reversing transfers to Stripe accounts, you can optionally reverse part of the transfer. You can do so as many times as you wish * until the entire transfer has been reversed. - * - * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, + * + * Once entirely reversed, a transfer can't be reversed again. This method will return an error when called on an already-reversed transfer, * or when trying to reverse more money than is left on a transfer. */ create(data: transferReversals.IReversalCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(options: HeaderOptions, response?: IResponseFn): Promise; create(response?: IResponseFn): Promise; - + /** - * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a + * By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a * specific reversal stored on the transfer. */ retrieve(reversalId: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(reversalId: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(reversalId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(reversalId: string, response?: IResponseFn): Promise; - + /** * Updates the specified reversal by setting the values of the parameters passed. Any parameters not provided will be left unchanged. - * + * * This request only accepts metadata and description as arguments. */ update(reversalId: string, data: transferReversals.IReversalUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(reversalId: string, data: transferReversals.IReversalUpdateOptions, response?: IResponseFn): Promise; - + /** - * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by - * default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after + * You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by + * default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after * parameters to page through additional reversals. */ list(data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; @@ -6136,7 +6136,7 @@ declare namespace StripeNode { list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; } - + class CountrySpecs extends StripeResource { /** * Lists all Country Spec objects available in the API. @@ -6145,10 +6145,10 @@ declare namespace StripeNode { list(data: IListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * Returns a Country Spec for a given Country code. - * + * * @param retrieve An ISO country code. Available country codes can be listed with the List Country Specs endpoint. */ retrieve(id: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; @@ -6156,36 +6156,36 @@ declare namespace StripeNode { retrieve(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(id: string, response?: IResponseFn): Promise; } - + class Orders { /** * Creates a new order object. */ create(data: orders.IOrderCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: orders.IOrderCreationOptions, response?: IResponseFn): Promise; - + /** - * Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, + * Retrieves the details of an existing order. Supply the unique order ID from either an order creation request or the order list, * and Stripe will return the corresponding order information. */ retrieve(orderId: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(orderId: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(orderId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(orderId: string, response?: IResponseFn): Promise; - + /** - * Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged. + * Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged. * This request accepts only the metadata, and status as arguments. */ update(orderId: string, data: orders.IOrderUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(orderId: string, data: orders.IOrderUpdateOptions, response?: IResponseFn): Promise; - + /** * Pay an order by providing a source to create a payment. */ pay(orderId: string, data: orders.IOrderPayOptions, options: HeaderOptions, response?: IResponseFn): Promise; pay(orderId: string, data: orders.IOrderPayOptions, response?: IResponseFn): Promise; - + /** * Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first. */ @@ -6194,32 +6194,32 @@ declare namespace StripeNode { list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; } - + class Products { /** * Creates a new product object. */ create(data: products.IProductCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: products.IProductCreationOptions, response?: IResponseFn): Promise; - + /** - * Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product + * Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product * list, and Stripe will return the corresponding product information. */ retrieve(productId: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(productId: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(productId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(productId: string, response?: IResponseFn): Promise; - + /** * Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged. - * - * Note that a product's attributes are not editable. Instead, you would need to deactivate the existing product and create a new one + * + * Note that a product's attributes are not editable. Instead, you would need to deactivate the existing product and create a new one * with the new attribute values. */ update(productId: string, data: products.IProductUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(productId: string, data: products.IProductUpdateOptions, response?: IResponseFn): Promise; - + /** * Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first. */ @@ -6227,39 +6227,39 @@ declare namespace StripeNode { list(data: products.IProductListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * Delete a product. Deleting a product is only possible if it has no SKUs associated with it. */ del(productId: string, options: HeaderOptions, response?: IResponseFn): Promise; del(productId: string, response?: IResponseFn): Promise; } - + class SKUs { /** * Creates a new SKU associated with a product. */ create(data: skus.ISkuCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; create(data: skus.ISkuCreationOptions, response?: IResponseFn): Promise; - + /** - * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU creation request or from the + * Retrieves the details of an existing SKU. Supply the unique SKU identifier from either a SKU creation request or from the * product, and Stripe will return the corresponding SKU information. */ retrieve(skuId: string, data: IDataOptions, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(skuId: string, data: IDataOptions, response?: IResponseFn): Promise; retrieve(skuId: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieve(skuId: string, response?: IResponseFn): Promise; - + /** * Updates the specific SKU by setting the values of the parameters passed. Any parameters not provided will be left unchanged. - * - * Note that a SKU's attributes are not editable. Instead, you would need to deactivate the existing SKU and create a new one with + * + * Note that a SKU's attributes are not editable. Instead, you would need to deactivate the existing SKU and create a new one with * the new attribute values. */ update(skuId: string, data: skus.ISkuUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; update(skuId: string, data: skus.ISkuUpdateOptions, response?: IResponseFn): Promise; - + /** * Returns a list of your SKUs. The SKUs are returned sorted by creation date, with the most recently created SKUs appearing first. */ @@ -6267,7 +6267,7 @@ declare namespace StripeNode { list(data: skus.ISkuListOptions, response?: IResponseFn>): Promise>; list(options: HeaderOptions, response?: IResponseFn>): Promise>; list(response?: IResponseFn>): Promise>; - + /** * Delete a SKU. Deleting a SKU is only possible until it has been used in an order. */ @@ -6275,24 +6275,24 @@ declare namespace StripeNode { del(skuId: string, response?: IResponseFn): Promise; } } - + interface IObject { object: string; } - + interface IResourceObject extends IObject { id: string; } - + interface IResponseFn { (err: IStripeError, value: R): void; } - + interface IDeleteConfirmation { id: string; deleted: boolean; } - + /** - * A filter on the list based on this object field. The value can - * be a string with an integer Unix timestamp, or it can be a + * A filter on the list based on this object field. The value can + * be a string with an integer Unix timestamp, or it can be a * dictionary with the following options: */ type IDateFilter = string | { @@ -6387,12 +6387,12 @@ declare namespace StripeNode { * Value is 'list' */ object: string; - + /** * An array containing the actual response elements, paginated by any request parameters. */ data: Array; - + /** * Whether or not there are more elements available after this set. If false, this set comprises the end of the list. */ @@ -6437,22 +6437,22 @@ declare namespace StripeNode { */ created?: string | IDateFilter; } - + interface IDataOptions { expand?: Array; include?: Array; } - + interface IDataOptionsWithMetadata extends IDataOptions { /** - * A set of key/value pairs that you can attach to an object. It can be - * useful for storing additional information about the object in a structured - * format. You can unset an individual key by setting its value to null and + * A set of key/value pairs that you can attach to an object. It can be + * useful for storing additional information about the object in a structured + * format. You can unset an individual key by setting its value to null and * then saving. To clear all keys, set metadata to null, then save. */ metadata?: IMetadata; } - + interface IHeaderOptions { /** * To safely retry an API request without accidentally performing the same operation twice, @@ -6464,18 +6464,18 @@ declare namespace StripeNode { * with different request parameters. The keys expire after 24 hours. */ idempotency_key?: string; - + stripe_account?: string; - + api_key?: string; } - + /** - * Header options can either be a Connect Account Secret Key, + * Header options can either be a Connect Account Secret Key, * or a hash with one or more of these keys: idempotency_key, stripe_account, api_key */ type HeaderOptions = IHeaderOptions | string; - + /** * Stripe uses conventional HTTP response codes to indicate success or failure of an API request. * In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that diff --git a/umzug/umzug.d.ts b/umzug/umzug.d.ts index c15b165b4a..c02beed19f 100644 --- a/umzug/umzug.d.ts +++ b/umzug/umzug.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ivan Drinchev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// /// declare module "umzug" { From f4efd4d3629874cbf4461a41ad5e5d39860c1112 Mon Sep 17 00:00:00 2001 From: Hedley Luna Date: Fri, 12 Aug 2016 05:35:16 -0300 Subject: [PATCH 033/203] Adding the sorter function to the options. This function is called when append is called (#10576) --- select2/select2-tests.ts | 8 ++++++++ select2/select2.d.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/select2/select2-tests.ts b/select2/select2-tests.ts index 5712fc2d3e..545deedd83 100644 --- a/select2/select2-tests.ts +++ b/select2/select2-tests.ts @@ -34,6 +34,7 @@ $("#e5").select2({ } } }); + $("#e19").select2({ maximumSelectionSize: 3 }); $("#e10").select2({ data: [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }] @@ -121,6 +122,13 @@ $("#e7").select2({ dropdownCssClass: "bigdrop" }); +function sort(elements) { + return elements.sort(); +} +$("#e20").select2({ + sorter: sort +}); + $("#e8").select2(); $("#e8_get").click(function () { alert("Selected value is: " + $("#e8").select2("val")); }); $("#e8_set").click(function () { $("#e8").select2("val", "CA"); }); diff --git a/select2/select2.d.ts b/select2/select2.d.ts index c1d119df1e..1741395620 100644 --- a/select2/select2.d.ts +++ b/select2/select2.d.ts @@ -80,6 +80,7 @@ interface Select2Options { templateResult?: (object: Select2SelectionObject) => any; language?: string | string[] | {}; selectOnClose?: boolean; + sorter?: (data: any[]) => any[]; } interface Select2JQueryEventObject extends JQueryEventObject { From 0cba063650e6cd578c6db1e987a37f0da2bbd886 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Fri, 12 Aug 2016 17:35:48 +0900 Subject: [PATCH 034/203] TypeScript-STL v1.0 & Samchon-Framework v2.0 Beta (#10577) * Sleep * TypeScript-STL & Samchon Framework * TypeScript-STL & Samchon Framework --- samchon-framework/samchon-framework.d.ts | 4554 +++++++++++++++++----- typescript-stl/typescript-stl-tests.ts | 2 +- typescript-stl/typescript-stl.d.ts | 1357 +++---- 3 files changed, 4371 insertions(+), 1542 deletions(-) diff --git a/samchon-framework/samchon-framework.d.ts b/samchon-framework/samchon-framework.d.ts index c81a9d1e5b..a6d03758dd 100644 --- a/samchon-framework/samchon-framework.d.ts +++ b/samchon-framework/samchon-framework.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Samchon Framework v1.2.0 +// Type definitions for Samchon Framework v2.0.0-beta.1 // Project: https://github.com/samchon/framework // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,28 +11,59 @@ declare module "samchon-framework" } /** - * Samchon Framework, A SDN framework. + *

Samchon-Framework

* + *

+ *

+ * + *

Samchon, a SDN (Software Defined Network) framework.

+ * + *

With Samchon Framework, you can implement distributed processing system within framework of OOD like + * handling S/W objects (classes). You can realize cloud and distributed system very easily with provided + * system templates and even integration with C++ is possible.

+ * + *

The goal, ultimate utilization model of Samchon Framework is, building cloud system with NodeJS and + * takING heavy works to C++ distributed systems with provided modules (those are system templates).

+ * + * @git https://github.com/samchon/framework * @author Jeongho Nam */ declare namespace samchon { -} -declare namespace samchon.library { -} -declare namespace samchon.collection { -} -declare namespace samchon.protocol { -} -declare namespace samchon.protocol.service { -} -declare namespace samchon.protocol.master { -} -declare namespace samchon.protocol.slave { + /** + *

Running on Node.

+ * + *

Test whether the JavaScript is running on Node.

+ * + * @references http://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser + */ + function is_node(): boolean; } declare namespace samchon.collection { /** * A {@link Vector} who can detect element I/O events. * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
    • {@link push_back}
    • + *
    • {@link unshift}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
    • {@link pop_back}
    • + *
    • {@link shift}
    • + *
    • {@link pop}
    • + *
    • {@link splice}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link sort}
    • + *
  • + *
+ * * @author Jeongho Nam */ class ArrayCollection extends std.Vector implements ICollection { @@ -80,38 +111,46 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.VectorIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.VectorIterator, last: std.VectorIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ @@ -132,12 +171,9 @@ declare namespace samchon.collection { } declare namespace samchon.library { /** - * An event class. - * - *
    - *
  • Comments from - https://developer.mozilla.org/en-US/docs/Web/API/Event/
  • - *
+ * A basic event class of Samchon Framework. * + * @reference https://developer.mozilla.org/en-US/docs/Web/API/Event * @author Jeongho Nam */ class BasicEvent implements Event { @@ -231,51 +267,78 @@ declare namespace samchon.library { } declare namespace samchon.collection { /** - * Type of function pointer for {@link CollectionEvent CollectionEvents}. + * Type of function pointer for listener of {@link CollectionEvent CollectionEvents}. */ interface CollectionEventListener extends EventListener { (event: CollectionEvent): void; } +} +declare namespace samchon.collection { /** - * + * @author Jeongho Nam */ class CollectionEvent extends library.BasicEvent { - static INSERT: string; - static ERASE: string; /** - * + * @hidden */ private first_; /** - * + * @hidden */ private last_; /** + * Initialization Constructor. * - * - * @param type + * @param type Type of collection event. * @param first * @param last */ constructor(type: string, first: std.Iterator, last: std.Iterator); + constructor(type: "insert", first: std.Iterator, last: std.Iterator); + constructor(type: "erase", first: std.Iterator, last: std.Iterator); + constructor(type: "refresh", first: std.Iterator, last: std.Iterator); /** - * + * Get associative container. */ container: ICollection; /** - * + * Get range of the first. */ first: std.Iterator; /** - * + * Get range of the last. */ last: std.Iterator; } } +declare namespace samchon.collection.CollectionEvent { + const INSERT: string; + const ERASE: string; + const REFRESH: string; +} declare namespace samchon.collection { /** * A {@link Deque} who can detect element I/O events. * + *

Below are list of methods who are dispatching {@link CollectionEvent}:

+ * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
    • {@link push_front}
    • + *
    • {@link push_back}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
    • {@link pop_front}
    • + *
    • {@link pop_back}
    • + *
  • + *
+ * * @author Jeongho Nam */ class DequeCollection extends std.Deque implements ICollection { @@ -323,44 +386,72 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.DequeIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.DequeIterator, last: std.DequeIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } declare namespace samchon.collection { /** * A {@link HashMap} who can detect element I/O events. * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
    • {@link set}
    • + *
    • {@link insert_or_assign}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
    • {@link extract}
    • + *
  • + *
  • refresh typed events:
      + *
    • {@link set}
    • + *
    • {@link insert_or_assign}
    • + *
  • + *
+ * * @author Jeongho Nam */ class HashMapCollection extends std.HashMap implements ICollection> { @@ -384,42 +475,65 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.MapIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.MapIterator, last: std.MapIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener>): void; + addEventListener(type: "erase", listener: CollectionEventListener>): void; + addEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener>): void; + removeEventListener(type: "erase", listener: CollectionEventListener>): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; } +} +declare namespace samchon.collection { /** * A {@link HashMultiMap} who can detect element I/O events. * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
  • + *
+ * * @author Jeongho Nam */ class HashMultiMapCollection extends std.HashMap implements ICollection> { @@ -443,47 +557,143 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.MapIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.MapIterator, last: std.MapIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener>): void; + addEventListener(type: "erase", listener: CollectionEventListener>): void; + addEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener>): void; + removeEventListener(type: "erase", listener: CollectionEventListener>): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link HashMultiSet} who can detect element I/O events. + * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
  • + *
+ * + * @author Jeongho Nam + */ + class HashMultiSetCollection extends std.HashMultiSet implements ICollection { + /** + * A chain object taking responsibility of dispatching events. + */ + private event_dispatcher_; /** * @inheritdoc */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + hasEventListener(type: string): boolean; /** * @inheritdoc */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.SetIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } declare namespace samchon.collection { /** * A {@link HashSet} who can detect element I/O events. * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
    • {@link extract}
    • + *
  • + *
+ * * @author Jeongho Nam */ - class HashSetCollection extends std.TreeSet implements ICollection { + class HashSetCollection extends std.HashSet implements ICollection { /** * A chain object taking responsibility of dispatching events. */ @@ -507,216 +717,175 @@ declare namespace samchon.collection { /** * @inheritdoc */ - addEventListener(type: string, listener: EventListener): void; + refresh(): void; /** * @inheritdoc */ - addEventListener(type: string, listener: EventListener, thisArg: Object): void; + refresh(it: std.SetIterator): void; /** * @inheritdoc */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: string, listener: EventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; - } - class HashMultiSetCollection extends std.TreeMultiSet implements ICollection { - /** - * A chain object taking responsibility of dispatching events. - */ - private event_dispatcher_; - /** - * @inheritdoc - */ - hasEventListener(type: string): boolean; - /** - * @inheritdoc - */ - dispatchEvent(event: Event): boolean; + refresh(first: std.SetIterator, last: std.SetIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } declare namespace samchon.collection { /** * An interface for {@link IContainer containers} who can detect element I/O events. * + *

Below are list of methods who are dispatching {@link CollectionEvent}:

+ * + *
    + *
  • insert typed events:
      + *
    • {@link assign}
    • + *
    • {@link insert}
    • + *
    • {@link push}
    • + *
  • + *
  • erase typed events:
      + *
    • {@link assign}
    • + *
    • {@link clear}
    • + *
    • {@link erase}
    • + *
  • + * * @author Jeongho Nam */ interface ICollection extends std.base.IContainer, library.IEventDispatcher { + /** + *

    Dispatch a {@link CollectionEvent} with refresh typed.

    + * + *

    {@link ICollection} dispatches {@link CollectionEvent} typed insert or erase whenever + * elements I/O has occured. However, unlike those elements I/O events, content change in element level can't be + * detected. There's no way to detect those events automatically by {@link IContainer}.

    + * + *

    If you want to dispatch those typed events (notifying change on contents in element level), you've to + * dispatch refresh typed event manually, by yourself. Call {@link refresh refresh()} with specified + * iterators who're pointing the elements whose content have changed. Then a {@link CollectionEvent} with + * refresh typed will be dispatched.

    + * + *

    If you don't specify any iterator, then the range of the refresh event will be all elements in this + * {@link ICollection collection}; {@link begin begin()} to {@link end end()}.

    + */ + refresh(): void; + /** + *

    Dispatch a {@link CollectionEvent} with refresh typed.

    + * + *

    {@link ICollection} dispatches {@link CollectionEvent} typed insert or erase whenever + * elements I/O has occured. However, unlike those elements I/O events, content change in element level can't be + * detected. There's no way to detect those events automatically by {@link IContainer}.

    + * + *

    If you want to dispatch those typed events (notifying change on contents in element level), you've to + * dispatch refresh typed event manually, by yourself. Call {@link refresh refresh()} with specified + * iterators who're pointing the elements whose content have changed. Then a {@link CollectionEvent} with + * refresh typed will be dispatched.

    + * + * @param it An iterator targeting the content changed element. + */ + refresh(it: std.Iterator): void; + /** + *

    Dispatch a {@link CollectionEvent} with refresh typed.

    + * + *

    {@link ICollection} dispatches {@link CollectionEvent} typed insert or erase whenever + * elements I/O has occured. However, unlike those elements I/O events, content change in element level can't be + * detected. There's no way to detect those events automatically by {@link IContainer}.

    + * + *

    If you want to dispatch those typed events (notifying change on contents in element level), you've to + * dispatch refresh typed event manually, by yourself. Call {@link refresh refresh()} with specified + * iterators who're pointing the elements whose content have changed. Then a {@link CollectionEvent} with + * refresh typed will be dispatched.

    + * + * @param first An Iterator to the initial position in a sequence of the content changed elmeents. + * @param last An {@link Iterator} to the final position in a sequence of the content changed elements. The range + * used is [first, last), which contains all the elements between first and + * last, including the element pointed by first but not the element pointed by + * last. + */ + refresh(first: std.Iterator, last: std.Iterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - *

    Registers an event listener object with an EventDispatcher object so that the listener - * receives notification of an event. You can register event listeners on all nodes in the display - * list for a specific type of event, phase, and priority. - * - *

    After you successfully register an event listener, you cannot change its priority through - * additional calls to addEventListener(). To change a listener's priority, you must first call - * removeEventListener(). Then you can register the listener again with the new priority level.

    - * - *

    Keep in mind that after the listener is registered, subsequent calls to addEventListener() - * with a different type or useCapture value result in the creation of a separate listener - * registration. For example, if you first register a listener with useCapture set to true, - * it listens only during the capture phase. If you call addEventListener() again using the same - * listener object, but with useCapture set to false, you have two separate listeners: one that - * listens during the capture phase and another that listens during the target and bubbling phases.

    - * - *

    You cannot register an event listener for only the target phase or the bubbling phase. - * Those phases are coupled during registration because bubbling applies only to the ancestors of - * the target node.

    - * - *

    If you no longer need an event listener, remove it by calling removeEventListener(), or - * memory problems could result. Event listeners are not automatically removed from memory because - * the garbage collector does not remove the listener as long as the dispatching object exists - * (unless the useWeakReference parameter is set to true).

    - * - *

    Copying an EventDispatcher instance does not copy the event listeners attached to it. (If - * your newly created node needs an event listener, you must attach the listener after creating - * the node.) However, if you move an EventDispatcher instance, the event listeners attached to - * it move along with it.

    - * - *

    If the event listener is being registered on a node while an event is also being processed - * on this node, the event listener is not triggered during the current phase but may be triggered - * during a later phase in the event flow, such as the bubbling phase.

    - * - *

    If an event listener is removed from a node while an event is being processed on the node, - * it is still triggered by the current actions. After it is removed, the event listener is never - * invoked again (unless it is registered again for future processing).

    - * - * @param event The type of event; {@link CollectionEvent.INSERT} or {@link CollectionEvent.ERASE}. - * @param listener The listener function that processes the event. - * This function must accept an Event object as its only parameter and must return - * nothing. - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - *

    Registers an event listener object with an EventDispatcher object so that the listener - * receives notification of an event. You can register event listeners on all nodes in the display - * list for a specific type of event, phase, and priority. - * - *

    After you successfully register an event listener, you cannot change its priority through - * additional calls to addEventListener(). To change a listener's priority, you must first call - * removeEventListener(). Then you can register the listener again with the new priority level.

    - * - *

    Keep in mind that after the listener is registered, subsequent calls to addEventListener() - * with a different type or useCapture value result in the creation of a separate listener - * registration. For example, if you first register a listener with useCapture set to true, - * it listens only during the capture phase. If you call addEventListener() again using the same - * listener object, but with useCapture set to false, you have two separate listeners: one that - * listens during the capture phase and another that listens during the target and bubbling phases.

    - * - *

    You cannot register an event listener for only the target phase or the bubbling phase. - * Those phases are coupled during registration because bubbling applies only to the ancestors of - * the target node.

    - * - *

    If you no longer need an event listener, remove it by calling removeEventListener(), or - * memory problems could result. Event listeners are not automatically removed from memory because - * the garbage collector does not remove the listener as long as the dispatching object exists - * (unless the useWeakReference parameter is set to true).

    - * - *

    Copying an EventDispatcher instance does not copy the event listeners attached to it. (If - * your newly created node needs an event listener, you must attach the listener after creating - * the node.) However, if you move an EventDispatcher instance, the event listeners attached to - * it move along with it.

    - * - *

    If the event listener is being registered on a node while an event is also being processed - * on this node, the event listener is not triggered during the current phase but may be triggered - * during a later phase in the event flow, such as the bubbling phase.

    - * - *

    If an event listener is removed from a node while an event is being processed on the node, - * it is still triggered by the current actions. After it is removed, the event listener is never - * invoked again (unless it is registered again for future processing).

    - * - * @param event The type of event; {@link CollectionEvent.INSERT} or {@link CollectionEvent.ERASE}. - * @param listener The listener function that processes the event. - * This function must accept an Event object as its only parameter and must return - * nothing. - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * Removes a listener from the EventDispatcher object. If there is no matching listener registered - * with the EventDispatcher object, a call to this method has no effect. - * - * @param type The type of event; {@link CollectionEvent.INSERT} or {@link CollectionEvent.ERASE}. - * @param listener The listener object to remove. - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * Removes a listener from the EventDispatcher object. If there is no matching listener registered - * with the EventDispatcher object, a call to this method has no effect. - * - * @param type The type of event; {@link CollectionEvent.INSERT} or {@link CollectionEvent.ERASE}. - * @param listener The listener object to remove. - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } declare namespace samchon.collection { /** * A {@link List} who can detect element I/O events. * + *
      + *
    • insert typed events:
        + *
      • {@link assign}
      • + *
      • {@link insert}
      • + *
      • {@link push}
      • + *
      • {@link push_front}
      • + *
      • {@link push_back}
      • + *
      • {@link merge}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link assign}
      • + *
      • {@link clear}
      • + *
      • {@link erase}
      • + *
      • {@link pop_front}
      • + *
      • {@link pop_back}
      • + *
      • {@link unique}
      • + *
      • {@link remove}
      • + *
      • {@link remove_if}
      • + *
      • {@link splice}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link sort}
      • + *
    • + *
    + * * @author Jeongho Nam */ class ListCollection extends std.List implements ICollection { @@ -772,47 +941,75 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.ListIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.ListIterator, last: std.ListIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } declare namespace samchon.collection { /** * A {@link TreeMap} who can detect element I/O events. * + *
      + *
    • insert typed events:
        + *
      • {@link assign}
      • + *
      • {@link insert}
      • + *
      • {@link push}
      • + *
      • {@link set}
      • + *
      • {@link insert_or_assign}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link assign}
      • + *
      • {@link clear}
      • + *
      • {@link erase}
      • + *
      • {@link extract}
      • + *
    • + *
    • refresh typed events:
        + *
      • {@link set}
      • + *
      • {@link insert_or_assign}
      • + *
    • + *
    + * * @author Jeongho Nam */ - class TreeMapCollection extends std.HashMap implements ICollection> { + class TreeMapCollection extends std.TreeMap implements ICollection> { /** * A chain object taking responsibility of dispatching events. */ @@ -833,45 +1030,68 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.MapIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.MapIterator, last: std.MapIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener>): void; + addEventListener(type: "erase", listener: CollectionEventListener>): void; + addEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener>): void; + removeEventListener(type: "erase", listener: CollectionEventListener>): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; } +} +declare namespace samchon.collection { /** * A {@link TreeMultiMap} who can detect element I/O events. * + *
      + *
    • insert typed events:
        + *
      • {@link assign}
      • + *
      • {@link insert}
      • + *
      • {@link push}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link assign}
      • + *
      • {@link clear}
      • + *
      • {@link erase}
      • + *
    • + *
    + * * @author Jeongho Nam */ - class TreeMultiMapCollection extends std.HashMap implements ICollection> { + class TreeMultiMapCollection extends std.TreeMultiMap implements ICollection> { /** * A chain object taking responsibility of dispatching events. */ @@ -892,95 +1112,65 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.MapIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.MapIterator, last: std.MapIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener>): void; + addEventListener(type: "erase", listener: CollectionEventListener>): void; + addEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener>): void; + removeEventListener(type: "erase", listener: CollectionEventListener>): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener>, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener>, thisArg: Object): void; } } declare namespace samchon.collection { - /** - * A {@link TreeMap} who can detect element I/O events. - * - * @author Jeongho Nam - */ - class TreeSetCollection extends std.TreeSet implements ICollection { - /** - * A chain object taking responsibility of dispatching events. - */ - private event_dispatcher_; - /** - * @inheritdoc - */ - hasEventListener(type: string): boolean; - /** - * @inheritdoc - */ - dispatchEvent(event: Event): boolean; - /** - * @inheritdoc - */ - addEventListener(type: string, listener: EventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: string, listener: EventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; - } /** * A {@link TreeMultiSet} who can detect element I/O events. * + *
      + *
    • insert typed events:
        + *
      • {@link assign}
      • + *
      • {@link insert}
      • + *
      • {@link push}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link assign}
      • + *
      • {@link clear}
      • + *
      • {@link erase}
      • + *
    • + *
    + * * @author Jeongho Nam */ class TreeMultiSetCollection extends std.TreeMultiSet implements ICollection { @@ -1004,38 +1194,121 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.SetIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.SetIterator, last: std.SetIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; + } +} +declare namespace samchon.collection { + /** + * A {@link TreeMap} who can detect element I/O events. + * + *
      + *
    • insert typed events:
        + *
      • {@link assign}
      • + *
      • {@link insert}
      • + *
      • {@link push}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link assign}
      • + *
      • {@link clear}
      • + *
      • {@link erase}
      • + *
      • {@link extract}
      • + *
    • + *
    + * + * @author Jeongho Nam + */ + class TreeSetCollection extends std.TreeSet implements ICollection { + /** + * A chain object taking responsibility of dispatching events. + */ + private event_dispatcher_; /** * @inheritdoc */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; + hasEventListener(type: string): boolean; /** * @inheritdoc */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.SetIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.SetIterator, last: std.SetIterator): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + addEventListener(type: string, listener: EventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; + /** + * @inheritdoc + */ + removeEventListener(type: string, listener: EventListener, thisArg: Object): void; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } declare namespace samchon.library { @@ -1373,7 +1646,7 @@ declare namespace samchon.library { * * @author Jeongho Nam */ - class XMLList extends std.Vector { + class XMLList extends std.Deque { getTag(): string; /** *

    Convert XMLList to string.

    @@ -1390,6 +1663,30 @@ declare namespace samchon.library { } } declare namespace samchon.collection { + /** + * An {@link XMLList} who can detect element I/O events. + * + *

    Below are list of methods who are dispatching {@link CollectionEvent}:

    + * + *
      + *
    • insert typed events:
        + *
      • {@link assign}
      • + *
      • {@link insert}
      • + *
      • {@link push}
      • + *
      • {@link push_front}
      • + *
      • {@link push_back}
      • + *
    • + *
    • erase typed events:
        + *
      • {@link assign}
      • + *
      • {@link clear}
      • + *
      • {@link erase}
      • + *
      • {@link pop_front}
      • + *
      • {@link pop_back}
      • + *
    • + *
    + * + * @author Jeongho Nam + */ class XMLListCollection extends library.XMLList implements ICollection { /** * A chain object taking responsibility of dispatching events. @@ -1406,11 +1703,11 @@ declare namespace samchon.collection { /** * @hidden */ - protected insert_by_repeating_val(position: std.VectorIterator, n: number, val: library.XML): std.VectorIterator; + protected insert_by_repeating_val(position: std.DequeIterator, n: number, val: library.XML): std.DequeIterator; /** * @hidden */ - protected insert_by_range>(position: std.VectorIterator, begin: InputIterator, end: InputIterator): std.VectorIterator; + protected insert_by_range>(position: std.DequeIterator, begin: InputIterator, end: InputIterator): std.DequeIterator; /** * @inheritdoc */ @@ -1418,7 +1715,7 @@ declare namespace samchon.collection { /** * @hidden */ - protected erase_by_range(first: std.VectorIterator, last: std.VectorIterator): std.VectorIterator; + protected erase_by_range(first: std.DequeIterator, last: std.DequeIterator): std.DequeIterator; /** * @hidden */ @@ -1435,71 +1732,57 @@ declare namespace samchon.collection { * @inheritdoc */ dispatchEvent(event: Event): boolean; + /** + * @inheritdoc + */ + refresh(): void; + /** + * @inheritdoc + */ + refresh(it: std.DequeIterator): void; + /** + * @inheritdoc + */ + refresh(first: std.DequeIterator, last: std.DequeIterator): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener): void; + addEventListener(type: "insert", listener: CollectionEventListener): void; + addEventListener(type: "erase", listener: CollectionEventListener): void; + addEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - addEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + addEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener): void; + removeEventListener(type: "insert", listener: CollectionEventListener): void; + removeEventListener(type: "erase", listener: CollectionEventListener): void; + removeEventListener(type: "refresh", listener: CollectionEventListener): void; /** * @inheritdoc */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener): void; - /** - * @inheritdoc - */ - removeEventListener(type: "insert" | "erase", listener: CollectionEventListener, thisArg: Object): void; - /** - * @inheritdoc - */ - unshift(...items: U[]): number; - /** - * @inheritdoc - */ - pop(): library.XML; - /** - * @inheritdoc - */ - splice(start: number): library.XML[]; - /** - * @inheritdoc - */ - splice(start: number, deleteCount: number, ...items: library.XML[]): library.XML[]; + removeEventListener(type: "insert", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "erase", listener: CollectionEventListener, thisArg: Object): void; + removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.example { - function test_file_reference(): void; -} -declare namespace samchon.example { - function test_web_client(): void; -} declare namespace samchon.library { /** *

    Case generator.

    * - *

    CaseGenerator is an abstract case generator using like a matrix.

    + *

    {@link CaseGenerator} is an abstract case generator being used like a matrix.

    *
      - *
    • nTTr(n^r) -> CombinedPermutationGenerator
    • - *
    • nPr -> PermutationGenerator
    • - *
    • n! -> FactorialGenerator
    • + *
    • n��r(n^r) -> {@link CombinedPermutationGenerator}
    • + *
    • nPr -> {@link PermutationGenerator}
    • + *
    • n! -> {@link FactorialGenerator}
    • *
    * * @author Jeongho Nam @@ -1544,13 +1827,13 @@ declare namespace samchon.library { * @param index Index number * @return The row of the index'th in combined permuation case */ - abstract at(index: number): Array; + abstract at(index: number): number[]; } /** *

    A combined-permutation case generator.

    - *

    nTTr

    * - * @inheritdoc + *

    n��r

    + * * @author Jeongho Nam */ class CombinedPermutationGenerator extends CaseGenerator { @@ -1565,14 +1848,14 @@ declare namespace samchon.library { * @param r Size of elements of each case. */ constructor(n: number, r: number); - at(index: number): Array; + at(index: number): number[]; } /** *

    A permutation case generator.

    - *

    nPr

    + * + *

    nPr

    * * @author Jeongho Nam - * @inheritdoc */ class PermuationGenerator extends CaseGenerator { /** @@ -1585,8 +1868,15 @@ declare namespace samchon.library { /** * @inheritdoc */ - at(index: number): Array; + at(index: number): number[]; } + /** + *

    Factorial case generator.

    + * + *

    n! = nPn

    + * + * @author Jeongho Nam + */ class FactorialGenerator extends PermuationGenerator { /** * Construct from factorial size N. @@ -1602,8 +1892,8 @@ declare namespace samchon.library { * whether specific types of event listeners are registered, and dispatches events.

    * *

    Event targets are an important part of the Flash�� Player and Adobe AIR event model. The event - * target serves as the focal point for how events flow through the display list hierarchy. When an - * event such as a mouse click or a keypress occurs, an event object is dispatched into the event flow + * target serves as the local point for how events flow through the display list hierarchy. When an + * event such as a mouse click or a key press occurs, an event object is dispatched into the event flow * from the root of the display list. The event object makes a round-trip journey to the event target, * which is conceptually divided into three phases: the capture phase includes the journey from the * root to the last node before the event target's node; the target phase includes only the event @@ -1728,6 +2018,7 @@ declare namespace samchon.library { * @param listener The listener function that processes the event. * This function must accept an Event object as its only parameter and must return * nothing. + * @param thisArg The object to be used as the this object. */ addEventListener(type: string, listener: EventListener, thisArg: Object): void; /** @@ -1744,6 +2035,7 @@ declare namespace samchon.library { * * @param type The type of event. * @param listener The listener object to remove. + * @param thisArg The object to be used as the this object. */ removeEventListener(type: string, listener: EventListener, thisArg: Object): void; } @@ -1795,11 +2087,11 @@ declare namespace samchon.library { /** * The origin object who issuing events. */ - protected target: IEventDispatcher; + protected event_dispatcher_: IEventDispatcher; /** * Container of listeners. */ - protected listeners: std.HashMap>>; + protected event_listeners_: std.HashMap>>; /** * Default Constructor. */ @@ -1807,9 +2099,9 @@ declare namespace samchon.library { /** * Construct from the origin event dispatcher. * - * @param target The origin object who issuing events. + * @param dispatcher The origin object who issuing events. */ - constructor(target: IEventDispatcher); + constructor(dispatcher: IEventDispatcher); /** * @inheritdoc */ @@ -2011,6 +2303,31 @@ declare namespace samchon.library { * @param fileName File name to be saved. */ save(data: string, fileName: string): void; + /** + *

    Save a file to local filesystem.

    + * + *

    {@link FileReference.save} implemented the save function by downloading a file from a hidden anchor tag. + * However, the plan, future's {@link FileReference} will follow such rule:

    + * + *

    Opens a dialog box that lets the user save a file to the local filesystem.

    + * + *

    The {@link save save()} method first opens an browser-system dialog box that asks the user to enter a + * filename and select a location on the local computer to save the file. When the user selects a location and + * confirms the save operation (for example, by clicking Save), the save process begins. Listeners receive events + * to indicate the progress, success, or failure of the save operation. To ascertain the status of the dialog box + * and the save operation after calling {@link save save()}, your code must listen for events such as cancel, + * open, progress, and complete.

    + * + *

    When the file is saved successfully, the properties of the {@link FileReference} object are populated with + * the properties of the local file. The complete event is dispatched if the save is successful.

    + * + *

    Only one {@link browse browse()} or {@link save()} session can be performed at a time (because only one + * dialog box can be invoked at a time).

    + * + * @param data The data to be saved. The data can be in one of several formats, and will be treated appropriately. + * @param fileName File name to be saved. + */ + static save(data: string, fileName: string): void; } /** *

    The {@link FileReferenceList} class provides a means to let users select one or more files for @@ -2081,10 +2398,251 @@ declare namespace samchon.library { browse(...typeFilter: string[]): void; } } +declare namespace samchon.library { + /** + *

    A genetic algorithm class.

    + * + * @details + *

    In the field of artificial intelligence, a genetic algorithm (GA) is a search heuristic that mimics the + * process of natural selection. This heuristic (also sometimes called a metaheuristic) is routinely used to generate + * useful solutions to optimization and search problems.

    + * + *

    Genetic algorithms belong to the larger class of evolutionary algorithms (EA), which generate solutions to + * optimization problems using techniques inspired by natural evolution, such as inheritance, {@link mutate mutation}, + * {@link selection}, and {@link crossover}.

    + * + * @reference https://en.wikipedia.org/wiki/Genetic_algorithm + * @author Jeongho Nam + */ + class GeneticAlgorithm { + /** + * Whether each element (Gene) is unique in their GeneArray. + */ + private unique; + /** + * Rate of mutation. + * + * The {@link mutation_rate} determines the percentage of occurence of mutation in GeneArray. + * + *
      + *
    • When {@link mutation_rate} is too high, it is hard to ancitipate studying on genetic algorithm.
    • + *
    • + * When {@link mutation_rate} is too low and initial set of genes (GeneArray) is far away from optimal, the + * evolution tends to wandering outside of he optimal. + *
    • + *
    + */ + private mutation_rate; + /** + * Number of tournaments in selection. + */ + private tournament; + /** + * Initialization Constructor. + * + * @param unique Whether each Gene is unique in their GeneArray. + * @param mutation_rate Rate of mutation. + * @param tournament Number of tournaments in selection. + */ + constructor(unique?: boolean, mutation_rate?: number, tournament?: number); + /** + *

    Evolove GeneArray.

    + * + *

    Convenient method accessing to {@link evolvePopulation evolvePopulation()}.

    + * + * @param individual An initial set of genes; sequence listing. + * @param population Size of population in a generation. + * @param generation Size of generation in evolution. + * @param compare A comparison function returns whether left gene is more optimal. + * + * @return An evolved GeneArray, optimally. + * + * @see {@link GAPopulation.compare} + */ + evolveGeneArray>(individual: GeneArray, population: number, generation: number, compare?: (left: T, right: T) => boolean): GeneArray; + /** + * Evolve population, a mass of GeneArraies. + * + * @param population An initial population. + * @param compare A comparison function returns whether left gene is more optimal. + * + * @return An evolved population. + * + * @see {@link GAPopulation.compare} + */ + evolvePopulation>(population: GAPopulation, compare?: (left: T, right: T) => boolean): GAPopulation; + /** + *

    Select the best GeneArray in population from tournament.

    + * + *

    {@link selection Selection} is the stage of a genetic algorithm in which individual genomes are chosen + * from a population for later breeding (using {@linlk crossover} operator). A generic {@link selection} + * procedure may be implemented as follows:

    + * + *
      + *
    1. + * The fitness function is evaluated for each individual, providing fitness values, which are then + * normalized. ization means dividing the fitness value of each individual by the sum of all fitness + * values, so that the sum of all resulting fitness values equals 1. + *
    2. + *
    3. The population is sorted by descending fitness values.
    4. + *
    5. + * Accumulated normalized fitness values are computed (the accumulated fitness value of an individual is the + * sum of its own fitness value plus the fitness values of all the previous individuals). The accumulated + * fitness of the last individual should be 1 (otherwise something went wrong in the normalization step). + *
    6. + *
    7. A random number R between 0 and 1 is chosen.
    8. + *
    9. The selected individual is the first one whose accumulated normalized value is greater than R.
    10. + *
    + * + * @param population The target of tournament. + * @return The best genes derived by the tournament. + * + * @reference https://en.wikipedia.org/wiki/Selection_(genetic_algorithm) + */ + private selection(population); + /** + *

    Create a new GeneArray by crossing over two GeneArray(s).

    + * + *

    {@link crossover} is a genetic operator used to vary the programming of a chromosome or chromosomes from + * one generation to the next. It is analogous to reproduction and biological crossover, upon which genetic + * algorithms are based.

    + * + *

    {@link crossover Cross over} is a process of taking more than one parent solutions and producing a child + * solution from them. There are methods for selection of the chromosomes.

    + * + * @param parent1 A parent sequence listing + * @param parent2 A parent sequence listing + * + * @reference https://en.wikipedia.org/wiki/Crossover_(genetic_algorithm) + */ + private crossover(parent1, parent2); + /** + *

    Cause a mutation on the GeneArray.

    + * + *

    {@link mutate Mutation} is a genetic operator used to maintain genetic diversity from one generation of a + * population of genetic algorithm chromosomes to the next. It is analogous to biological mutation.

    + * + *

    {@link mutate Mutation} alters one or more gene values in a chromosome from its initial state. In + * {@link mutate mutation}, the solution may change entirely from the previous solution. Hence GA can come to + * better solution by using {@link mutate mutation}.

    + * + *

    {@link mutate Mutation} occurs during evolution according to a user-definable mutation probability. This + * probability should be set low. If it is set too high, the search will turn into a primitive random search.

    + * + *

    Note

    + *

    Muttion is pursuing diversity. Mutation is useful for avoiding the following problem.

    + * + *

    When initial set of genes(GeneArray) is far away from optimail, without mutation (only with selection and + * crossover), the genetic algorithm has a tend to wandering outside of the optimal.

    + * + *

    Genes in the GeneArray will be swapped following percentage of the {@link mutation_rate}.

    + * + * @param individual A container of genes to mutate + * + * @reference https://en.wikipedia.org/wiki/Mutation_(genetic_algorithm) + * @see {@link mutation_rate} + */ + private mutate(individual); + } + /** + *

    A population in a generation.

    + * + *

    {@link GAPopulation} is a class representing population of candidate genes (sequence listing) having an array + * of GeneArray as a member. {@link GAPopulation} also manages initial set of genes and handles fitting test direclty + * by the method {@link fitTest fitTest()}.

    + * + *

    The success of evolution of genetic algorithm is depend on the {@link GAPopulation}'s initial set and fitting + * test. (GeneArray and {@link compare}.)

    + * + *

    Warning

    + *

    Be careful for the mistakes of direction or position of the {@link compare}.

    + *

    Most of logical errors failed to access optimal solution are occured from those mistakes.

    + * + * @param Type of gene elements. + * @param An array containing genes as elments; sequnce listing. + * + * @author Jeongho Nam + */ + class GAPopulation> { + /** + * Genes representing the population. + */ + private children; + /** + *

    A comparison function returns whether left gene is more optimal, greater.

    + * + *

    Default value of this {@link compare} is {@link std.greater}. It means to compare two array + * (GeneArray must be a type of {@link std.base.IArrayContainer}). Thus, you've to keep follwing rule.

    + * + *
      + *
    • GeneArray is implemented from {@link std.base.IArrayContainer}.
    • + *
        + *
      • {@link std.Vector}
      • + *
      • {@link std.Deque}
      • + *
      + *
    • GeneArray has custom public less(obj: T): boolean; function.
    • + *
    + * + *

    If you don't want to follow the rule or want a custom comparison function, you have to realize a + * comparison function.

    + */ + private compare; + /** + *

    Private constructor with population.

    + * + *

    Private constructor of GAPopulation does not create {@link children}. (candidate genes) but only assigns + * null repeatedly following the population size.

    + * + *

    This private constructor is designed only for {@link GeneticAlgorithm}. Don't create {@link GAPopulation} + * with this constructor, by yourself.

    + * + * @param size Size of the population. + */ + constructor(size: number); + /** + *

    Construct from a {@link GeneArray} and size of the population.

    + * + *

    This public constructor creates GeneArray(s) as population (size) having shuffled genes which are + * came from the initial set of genes (geneArray). It uses {@link std.greater} as default comparison function. + *

    + * + * @param geneArray An initial sequence listing. + * @param size The size of population to have as children. + */ + constructor(geneArray: GeneArray, size: number); + /** + *

    Constructor from a GeneArray, size of the poluation and custom comparison function.

    + * + *

    This public constructor creates GeneArray(s) as population (size) having shuffled genes which are + * came from the initial set of genes (geneArray). The compare is used for comparison function. + *

    + * + * @param geneArray An initial sequence listing. + * @param size The size of population to have as children. + * @param compare A comparison function returns whether left gene is more optimal. + */ + constructor(geneArray: GeneArray, size: number, compare: (left: GeneArray, right: GeneArray) => boolean); + /** + * Test fitness of each GeneArray in the {@link population}. + * + * @return The best GeneArray in the {@link population}. + */ + fitTest(): GeneArray; + /** + * @hidden + */ + private clone(obj); + } +} declare namespace samchon.library { /** *

    A utility class supporting static methods of string.

    * + *

    The {@link StringUtil} utility class is an all-static class with methods for working with string objects within + * Samchon Framework. You do not create instances of {@link StringUtil}; instead you call methods such as the + * StringUtil.substitute() method.

    + * + * @reference http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/utils/StringUtil.html * @author Jeongho Nam */ class StringUtil { @@ -2105,11 +2663,11 @@ declare namespace samchon.library { *
  • If start and end are all omitted, returns str, itself.
  • *
* - * @param str Target string to be applied between - * @param start A string for separating substring at the front - * @param end A string for separating substring at the end + * @param str Target string to be applied between. + * @param start A string for separating substring at the front. + * @param end A string for separating substring at the end. * - * @return substring by specified terms + * @return substring by specified terms. */ static between(str: string, start?: string, end?: string): string; /** @@ -2124,12 +2682,12 @@ declare namespace samchon.library { *
  • If startStr and endStar are all omitted, returns str.
  • * * - * @param str Target string to split by between + * @param str Target string to split by between. * @param start A string for separating substring at the front. - * If omitted, it's same with split(end) not having last item + * If omitted, it's same with split(end) not having last item. * @param end A string for separating substring at the end. - * If omitted, it's same with split(start) not having first item - * @return An array of substrings + * If omitted, it's same with split(start) not having first item. + * @return An array of substrings. */ static betweens(str: string, start?: string, end?: string): Array; /** @@ -2195,20 +2753,74 @@ declare namespace samchon.library { * @return A string specified words are replaced */ static replaceAll(str: string, ...pairs: std.Pair[]): string; - /** - *

    Get a tabbed string by specified size.

    - */ - static tab(size: number): string; - /** - *

    Get a tabbed HTLM string by specified size.

    - */ - static htmlTab(size: number): string; /** * Replace all HTML spaces to a literal space. * * @param str Target string to replace. */ static removeHTMLSpaces(str: string): string; + /** + *

    Repeat a string.

    + * + *

    Returns a string consisting of a specified string concatenated with itself a specified number of times.

    + * + * @param str The string to be repeated. + * @param n The repeat count. + * + * @return The repeated string. + */ + static repeat(str: string, n: number): string; + /** + *

    Number to formatted string with "," sign.

    + * + *

    Returns a string converted from the number rounded off from specified precision with "," symbols.

    + * + * @param val A number wants to convert to string. + * @param precision Target precision of round off. + * + * @return A string who represents the number with roundoff and "," symbols. + */ + static numberFormat(val: number, precision?: number): string; + static percentFormat(val: number, precision?: number): string; + } +} +declare namespace samchon.library { + /** + *

    URLVariables class is for representing variables of HTTP.

    + * + *

    URLVariables class allows you to transfer variables between an application and server. + * When transfering, URLVariables will be converted to a URI string.

    + * + *
      + *
    • URI: Uniform Resource Identifier
    • + *
    + * + * @reference http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLVariables.html + * @author Migrated by Jeongho Nam + */ + class URLVariables extends std.HashMap { + /** + * Default Constructor. + */ + constructor(); + /** + *

    Construct from a URL-encoded string.

    + * + *

    The {@link decode decode()} method is automatically called to convert the string to properties of the {@link URLVariables} object.

    + * + * @param str A URL-encoded string containing name/value pairs. + */ + constructor(str: string); + /** + * Converts the variable string to properties of the specified URLVariables object. + * + * @param str A URL-encoded query string containing name/value pairs. + */ + decode(str: string): void; + /** + * Returns a string containing all enumerable variables, in the MIME content encoding application/x-www-form-urlencoded. + */ + toString(): string; } } declare namespace samchon.protocol { @@ -2247,20 +2859,31 @@ declare namespace samchon.protocol { * * @param xml An xml used to contruct data of entity. */ - construct(xml: library.XML): any; + construct(xml: library.XML): void; /** *

    Get a key that can identify the Entity uniquely.

    * - *

    If identifier of the Entity is not atomic value, returns a string or paired object + *

    If identifier of the Entity is not atomic value, returns a paired or tuple object * that can represents the composite identifier.

    + * + * + * class Point extends Entity + * { + * private x: number; + * private y: number; + * + * public key(): std.Pair + * { + * return std.make_pair(this.x, this.y); + * } + * } + * */ key(): any; /** *

    A tag name when represented by XML.

    * - *
      - *
    • - *
    + * */ TAG(): string; /** @@ -2345,6 +2968,593 @@ declare namespace samchon.protocol { toXML(): library.XML; } } +declare namespace samchon.protocol { + /** + *

    An interface taking full charge of network communication.

    + * + *

    {@link ICommunicator} is an interface for communicator classes who take full charge of network communication + * with external system, without reference to whether the external system is a server or a client.

    + * + *

    Whenever a replied message comes from the external system, the message will be converted to an + * {@link Invoke} class and will be shifted to the {@link WebCommunicator.listener listener}'s + * {@link IProtocol.replyData replyData()} method.

    + * + * + interface ICommmunicator + { + private socket: SomeSocketClass; + + // LISTENER LISTENS INVOKE MESSAGE BY IT'S IProtocol.replyData() METHOD + protected listener: IProtocol; + + // YOU CAN DETECT DISCONNECTION BY ENROLLING FUNCTION POINTER TO HERE. + public onClose: Function; + + public sendData(invoke: Invoke): void + { + this.socket.write(invoke); + } + public replyData(invoke: Invoke): void + { + // WHENEVER COMMUNICATOR GETS MESSAGE, THEN SHIFT IT TO LISTENER'S replyData() METHOD. + this.listener.replyData(invoke); + } + } + * + * + *

    + * + *

    + * + * + *

    Basic Components

    + *

    What Basic Components are

    + *

    Basic Components are the smallest unit of network communication in this Samchon Framework. With + * Basic Components, you can construct any type of network system, even how the network system is enormously + * scaled and complicated, by just combinating the Basic Components.

    + * + *

    All the system templates in this framework are also being implemented by utilization of the + * Basic Compoonents.

    + * + *
      + *
    • {@link service Service} + *
    • {@link external External System} + *
    • {@link parallel Parallel System} + *
    • {@link distributed Distributed System} + *
    + * + *

    Note that, whatever the network system what you've to construct is, just concentrate on role of each system + * and attach matched Basic Components to the role, within framework of the Object-Oriented Design. + * Then construction of the network system will be much easier.

    + * + *
      + *
    • A system is a server, then use {@link IServer} or {@link IServerBase}.
    • + *
    • A server wants to handle a client has connected, then use {@link IClientDriver}.
    • + *
    • A system is a client connecting to an external server, then use {@link IServerConnector}.
    • + *
    • + *
    + * + *

    Example - System Templates

    + *

    Learning and understanding Basic Components of Samchon Framework, reading source codes and design of + * System Templates' modules will be very helpful.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Name Source API Documents
    Cloud Service protocol/service {@link protocol.service}
    External System protocol/external {@link protocol.external}
    Parallel System protocol/parallel {@link protocol.parallel}
    Distributed System protocol/distributed {@link protocol.distributed}
    Slave System protocol/slave {@link protocol.slave}
    + * + *

    Example - Projects

    + * + * + * @see {@link IClientDriver}, {@link IServerConnector} + * @handbook Basic Components - ICommunicator + * @author Jeongho Nam + */ + interface ICommunicator extends IProtocol { + /** + * Callback function for connection closed. + */ + onClose: Function; + /** + * Close connection. + */ + close(): any; + sendData(invoke: protocol.Invoke): void; + replyData(invoke: protocol.Invoke): void; + } +} +declare namespace samchon.protocol { + abstract class CommunicatorBase implements ICommunicator { + /** + * @hidden + */ + protected listener: IProtocol; + /** + * @inheritdoc + */ + onClose: Function; + /** + * @hidden + */ + private binary_invoke; + /** + * @hidden + */ + private binary_parameters; + /** + * @hidden + */ + private unhandled_invokes; + /** + * Default Constructor. + */ + constructor(); + constructor(listener: IProtocol); + /** + * @inheritdoc + */ + abstract close(): void; + protected is_binary_invoke(): boolean; + abstract sendData(invoke: Invoke): void; + replyData(invoke: Invoke): void; + protected handle_string(str: string): void; + protected handle_binary(binary: Uint8Array): void; + } +} +declare namespace samchon.protocol { + class Communicator extends CommunicatorBase { + /** + * @hidden + */ + protected socket: socket.socket; + /** + * @hidden + */ + private header_bytes; + /** + * @hidden + */ + private data; + /** + * @hidden + */ + private data_index; + /** + * @hidden + */ + private listening; + /** + * @inheritdoc + */ + close(): void; + /** + * @hidden + */ + protected start_listen(): void; + /** + * @hidden + */ + private handle_error(); + /** + * @hidden + */ + private handle_close(); + /** + * @inheritdoc + */ + sendData(invoke: Invoke): void; + /** + * @hidden + */ + private listen_piece(piece); + /** + * @hidden + */ + private listen_header(piece, piece_index); + /** + * @hidden + */ + private listen_data(piece, piece_index); + } +} +declare namespace samchon.protocol { + /** + *

    Base class for web-communicator, {@link WebClientDriver} and {@link WebServerConnector}.

    + * + *

    This class {@link WebCommunicatorBase} subrogates network communication for web-communicator classes, + * {@link WebClinetDriver} and {@link WebServerConnector}. The web-communicator and this class + * {@link WebCommunicatorBase} share same interface {@link IProtocol} and have a chain of responsibily + * relationship.

    + * + *

    When an {@link Invoke} message was delivered from the connected remote system, then this class calls + * web-communicator's {@link WebServerConnector.replyData replyData()} method. Also, when called web-communicator's + * {@link WebClientDriver.sendData sendData()}, then {@link sendData sendData()} of this class will be caleed.

    + * + *
      + *
    • this.replyData() -> communicator.replyData()
    • + *
    • communicator.sendData() -> this.sendData()
    • + *
    + * + * @author Jeongho Nam + */ + class WebCommunicator extends CommunicatorBase { + /** + * Connection driver, a socket for web-socket. + */ + protected connection: websocket.connection; + /** + * Close the connection. + */ + close(): void; + /** + * @inheritdoc + */ + sendData(invoke: Invoke): void; + /** + *

    Handle raw-data received from the remote system.

    + * + *

    Queries raw-data received from the remote system. When the raw-data represents an formal {@link Invoke} + * message, then it will be sent to the {@link replyData}.

    + * + * @param message A raw-data received from the remote system. + */ + protected handle_message(message: websocket.IMessage): void; + protected handle_close(): void; + } +} +declare namespace samchon.protocol { + class SharedWorkerCommunicator extends CommunicatorBase { + protected port: MessagePort; + close(): void; + /** + * @inheritdoc + */ + sendData(invoke: Invoke): void; + protected handle_message(event: MessageEvent): void; + } +} +declare namespace samchon.protocol { + /** + *

    An interface for communicator with connected client.

    + * + *

    {@link IClientDriver} is a type of {@link ICommunicator}, specified for communication with connected client + * in a server. It takes full charge of network communication with the connected client.

    + * + *

    {@link IClientDriver} is created in {@link IServer} and delivered via + * {@link IServer.addClient IServer.addClient()}. Those are derived types from this {@link IClientDriver}, being + * created by matched {@link IServer} object.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Derived Type Created By
    {@link ClientDrvier} {@link Server}
    {@link WebClientDrvier} {@link WebServer}
    {@link SharedWorkerClientDrvier} {@link SharedWorkerServer}
    + * + *

    + * + *

    + * + *

    When you've got an {@link IClientDriver} object from the {@link IServer.addClient IServer.addClient()}, then + * specify {@link CommunicatorBase.listener listener} with {@link IClient.listen IClient.listen()}. Below codes are + * an example specifying and managing the {@link CommunicatorBase.listener listener} objects.

    + * + * + /// + /// + + // IMPORTS + import std = require("typescript-stl"); + import samchon = require("samchon-framework"); + + // SHORTCUTS + import library = samchon.library; + import protocol = samchon.protocol; + + class CalculatorServer extends protocol.Server + { + private clients: std.HashSet; + + // WHEN A CLIENT HAS CONNECTED + public addClient(driver: IClientDriver): void + { + let client: CalculatorClient = new CalculatorClient(this, driver); + this.clients.insert(client); + } + } + + class CalculatorClient extends protocol.IProtocol + { + // PARENT SERVER INSTANCE + private server: CalculatorServer; + + // COMMUNICATOR, SENDS AND RECEIVES NETWORK MESSAGE WITH CONNECTED CLIENT + private driver: protocol.IClientDriver; + + ///// + // CONSTRUCTORS + ///// + public constructor(server: CalculatorServer, driver: protocol.IClientDriver) + { + this.server = server; + this.driver = driver; + + // START LISTENING AND RESPOND CLOSING EVENT + this.driver.listen(this); // INVOKE MESSAGE WILL COME TO HERE + this.driver.onClose = this.destructor.bind(this); // DISCONNECTED HANDLER + } + public destructor(): void + { + // WHEN DISCONNECTED, THEN ERASE THIS OBJECT FROM CalculatorServer.clients. + this.server["clients"].erase(this); + } + + ///// + // INVOKE MESSAGE CHAIN + ///// + public sendData(invoke: protocol.Invoke): void + { + // CALL ICommunicator.sendData(), WHO PHYSICALLY SEND NETWORK MESSAGE + this.driver.sendData(invoke); + } + public replyData(invoke: protocol.Invoke): void + { + // FIND MATCHED MEMBER FUNCTION NAMED EQUAL TO THE invoke.getListener() + invoke.apply(this); + } + } + * + * + * + *

    Basic Components

    + *

    What Basic Components are

    + *

    Basic Components are the smallest unit of network communication in this Samchon Framework. With + * Basic Components, you can construct any type of network system, even how the network system is enormously + * scaled and complicated, by just combinating the Basic Components.

    + * + *

    All the system templates in this framework are also being implemented by utilization of the + * Basic Compoonents.

    + * + *
      + *
    • {@link service Service} + *
    • {@link external External System} + *
    • {@link parallel Parallel System} + *
    • {@link distributed Distributed System} + *
    + * + *

    Note that, whatever the network system what you've to construct is, just concentrate on role of each system + * and attach matched Basic Components to the role, within framework of the Object-Oriented Design. + * Then construction of the network system will be much easier.

    + * + *
      + *
    • A system is a server, then use {@link IServer} or {@link IServerBase}.
    • + *
    • A server wants to handle a client has connected, then use {@link IClientDriver}.
    • + *
    • A system is a client connecting to an external server, then use {@link IServerConnector}.
    • + *
    • + *
    + * + *

    Example - System Templates

    + *

    Learning and understanding Basic Components of Samchon Framework, reading source codes and design of + * System Templates' modules will be very helpful.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Name Source API Documents
    Cloud Service protocol/service {@link protocol.service}
    External System protocol/external {@link protocol.external}
    Parallel System protocol/parallel {@link protocol.parallel}
    Distributed System protocol/distributed {@link protocol.distributed}
    Slave System protocol/slave {@link protocol.slave}
    + * + *

    Example - Projects

    + * + * + * @see {@link IServer} + * @handbook Basic Components - IClientDriver + * @author Jeongho Nam + */ + interface IClientDriver extends ICommunicator { + /** + *

    Listen message from the newly connected client.

    + * + *

    Starts listening message from the newly connected client. Replied message from the connected client will + * be converted to {@link Invoke} classes and shifted to the listener's + * {@link IProtocol.replyData replyData()} method.

    + * + * @param listener A listener object to listen replied message from newly connected client in + * {@link IProtocol.replyData replyData()} as an {@link Invoke} message. + */ + listen(listener: IProtocol): void; + } +} +declare namespace samchon.protocol { + class ClientDriver extends Communicator implements IClientDriver { + constructor(socket: socket.socket); + /** + * @inheritdoc + */ + listen(listener: IProtocol): void; + } +} +declare namespace samchon.protocol { + class WebClientDriver extends WebCommunicator implements IClientDriver { + /** + * Requested path. + */ + private path; + /** + * Session ID, an identifier of the remote client. + */ + private session_id; + private listening; + /** + * Initialization Constructor. + * + * @param connection Connection driver, a socket for web-socket. + * @param path Requested path. + * @param session_id Session ID, an identifier of the remote client. + */ + constructor(connection: websocket.connection, path: string, session_id: string); + /** + * @inheritdoc + */ + listen(listener: IProtocol): void; + /** + * Get requested path. + */ + getPath(): string; + /** + * Get session ID, an identifier of the remote client. + */ + getSessionID(): string; + } +} +declare namespace samchon.protocol { + class SharedWorkerClientDriver extends SharedWorkerCommunicator implements IClientDriver { + private listening; + constructor(port: MessagePort); + /** + * @inheritdoc + */ + listen(listener: IProtocol): void; + } +} +declare namespace samchon.protocol { + abstract class DedicatedWorker implements IProtocol { + private communicator_; + /** + * Default Constructor. + */ + constructor(); + abstract replyData(invoke: protocol.Invoke): void; + sendData(invoke: Invoke): void; + } +} +declare namespace samchon.protocol { + class DedicatedWorkerConnector extends CommunicatorBase implements IServerConnector { + private worker; + /** + * @inheritdoc + */ + onConnect: Function; + /** + * @inheritdoc + */ + onClose: Function; + constructor(listener: IProtocol); + /** + * @inheritdoc + */ + connect(jsFile: string): void; + /** + * @inheritdoc + */ + close(): void; + sendData(invoke: Invoke): void; + replyData(invoke: Invoke): void; + private handle_message(event); + } +} declare namespace samchon.protocol { interface IEntityGroup extends IEntity, std.base.IContainer { /** @@ -2368,7 +3578,6 @@ declare namespace samchon.protocol { * * @return A new child Entity belongs to EntityArray. */ - createChild(xml: library.XML): T; /** *

    Get iterator to element.

    * @@ -2444,9 +3653,15 @@ declare namespace samchon.protocol { */ construct(xml: library.XML): void; /** - * @inheritdoc + *

    Factory method of a child Entity.

    + * + *

    EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

    + * + * @return A new child Entity belongs to EntityArray. */ - abstract createChild(xml: library.XML): T; + protected abstract createChild(xml: library.XML): T; /** * @inheritdoc */ @@ -2488,9 +3703,15 @@ declare namespace samchon.protocol { */ construct(xml: library.XML): void; /** - * @inheritdoc + *

    Factory method of a child Entity.

    + * + *

    EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

    + * + * @return A new child Entity belongs to EntityArray. */ - abstract createChild(xml: library.XML): T; + protected abstract createChild(xml: library.XML): T; /** * @inheritdoc */ @@ -2532,9 +3753,15 @@ declare namespace samchon.protocol { */ construct(xml: library.XML): void; /** - * @inheritdoc + *

    Factory method of a child Entity.

    + * + *

    EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

    + * + * @return A new child Entity belongs to EntityArray. */ - abstract createChild(xml: library.XML): T; + protected abstract createChild(xml: library.XML): T; /** * @inheritdoc */ @@ -2583,9 +3810,15 @@ declare namespace samchon.protocol { */ construct(xml: library.XML): void; /** - * @inheritdoc + *

    Factory method of a child Entity.

    + * + *

    EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

    + * + * @return A new child Entity belongs to EntityArray. */ - abstract createChild(xml: library.XML): T; + protected abstract createChild(xml: library.XML): T; /** * @inheritdoc */ @@ -2627,9 +3860,15 @@ declare namespace samchon.protocol { */ construct(xml: library.XML): void; /** - * @inheritdoc + *

    Factory method of a child Entity.

    + * + *

    EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

    + * + * @return A new child Entity belongs to EntityArray. */ - abstract createChild(xml: library.XML): T; + protected abstract createChild(xml: library.XML): T; /** * @inheritdoc */ @@ -2671,9 +3910,15 @@ declare namespace samchon.protocol { */ construct(xml: library.XML): void; /** - * @inheritdoc + *

    Factory method of a child Entity.

    + * + *

    EntityArray::createChild() is a factory method creating a new child Entity which is belonged + * to the EntityArray. This method is called by EntityArray::construct(). The children construction + * methods Entity::construct() will be called by abstract method of the EntityArray::construct().

    + * + * @return A new child Entity belongs to EntityArray. */ - abstract createChild(xml: library.XML): T; + protected abstract createChild(xml: library.XML): T; /** * @inheritdoc */ @@ -2709,203 +3954,238 @@ declare namespace samchon.protocol { } declare namespace samchon.protocol { /** - *

    A network driver for an external system.

    + *

    An interface for {@link Invoke} message chain.

    * - *

    ExternalSystem is a boundary class interacting with an external system by network communication. - * Also, ExternalSystem is an abstract class that a network role, which one is server and which one is - * client, is not determined yet.

    + *

    {@link IProtocol} is an interface for {@link Invoke} message, which is standard message of network I/O in + * Samchon Framework, chain. The {@link IProtocol} interface is used to network drivers and some classes + * which are in a relationship of Chain of Responsibility Pattern with those network drivers.

    * - *

    The ExternalSystem has ExternalSystemRole(s) groupped methods, handling Invoke message - * interacting with the external system, by subject or unit of a moudle. The ExternalSystemRole is - * categorized in a 'control'.

    + *

    Implements {@link IProtocol} if the class sends and handles {@link Invoke} message. Looking around source + * codes of Samchon Framework, especially System Templates, you can find out that all the classes and + * modules handling {@link Invoke} messages are always implementing this {@link IProtocol} . Yes, {@link IProtocol}, + * this is the main role you've to follow in this Samchon Framework.

    * - *

    Note

    - *

    The ExternalSystem class takes a role of interaction with external system in network level. - * However, within a framework of Samchon Framework, a boundary class like the ExternalSystem is - * not such important. You can find some evidence in a relationship between ExternalSystemArray, - * ExternalSystem and ExternalSystemRole.

    + *

    + * + *

    * - *

    Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, if you - * access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a belonged - * ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem is - * related in, it's called "Proxy pattern". * - *

    Like the explanation of "Proxy pattern", you can utilize an ExternalSystemRole as a proxy - * of an ExternalSystem. With the pattern, you can only concentrate on ExternalSystemRole itself, - * what to do with Invoke message, irrespective of the ExternalSystemRole is belonged to which - * ExternalSystem.

    - * - * @author Jeongho Nam - */ - abstract class ExternalSystem extends EntityArray implements IProtocol { - /** - *

    A driver for interacting with (real, physical) external system.

    - */ - protected driver: ServerConnector; - /** - *

    A name can identify an external system.

    - * - *

    The name must be unique in ExternalSystemArray.

    - */ - protected name: string; - /** - *

    An ip address of an external system.

    - */ - protected ip: string; - /** - *

    A port number of an external system.

    - */ - protected port: number; - /** - *

    Default Constructor.

    - */ - constructor(); - /** - *

    Start interaction.

    - *

    An abstract method starting interaction with an external system.

    - * - *

    If an external systems are a server, starts connection and listening Inovoke message, - * else clients, just starts listening only. You also can addict your own procudures of starting - * the driver, but if you directly override method of abstract ExternalSystem, be careful about - * virtual inheritance.

    - */ - start(): void; - key(): any; - /** - *

    Get name.

    - */ - getName(): string; - /** - *

    Get ip address of the external system.

    - */ - getIP(): string; - /** - *

    Get port number of the external system.

    - */ - getPort(): number; - sendData(invoke: Invoke): void; - replyData(invoke: Invoke): void; - TAG(): string; - CHILD_TAG(): string; - } -} -declare namespace samchon.protocol { - /** - *

    An array of ExternalSystem(s).

    - * - *

    ExternalSystemArray is an abstract class containing and managing external system drivers.

    - * - *

    Also, ExternalSystemArray can access to ExternalSystemRole(s) directly. With the method, you - * can use an ExternalSystemRole as "logical proxy" of an ExternalSystem. Of course, the - * ExternalSystemRole is belonged to an ExternalSystem. However, if you access an ExternalSystemRole - * from an ExternalSystemArray directly, not passing by a belonged ExternalSystem, and send an Invoke - * message even you're not knowing which ExternalSystem is related in, the ExternalSystemRole acted - * a role of proxy.

    - * - *

    It's called as "Proxy pattern". With the pattern, you can only concentrate on - * ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole - * is belonged to which ExternalSystem.

    + *

    Utilization Case

    + *

    Below pseudo code and class diagram represents {@link service Service Module}, who can build a cloud server. + * All the classes in the pseudo code are implementing the {@link IProtocol} because all of them are handling + * {@link Invoke} message.

    * *
      - *
    • ExternalSystemArray::getRole("something")->sendData(invoke);
    • + *
    • Server: Represents a server literally
    • + *
    • User: Represents an user being identified by its session id. User contains multiple Client objects.
    • + *
        + *
      • In browser, an user can open multiple windows. + *
          + *
        • User: A browser (like IE, Chrome and Safari). + *
        • Client: An internet browser window + *
        + *
      • + *
      + *
    • Client: Represents a browser window and it takes role of network communication with it.
    • + *
    • Service: Represents a service, domain logic.
    • *
    * - * @author Jeongho Nam - */ - abstract class ExternalSystemArray extends EntityArray implements IProtocol { - /** - * Default Constructor. - */ - constructor(); - /** - *

    Start interaction.

    - *

    An abstract method starting interaction with external systems.

    - * - *

    If external systems are servers, starts connection to them, else clients, opens a server - * and accepts the external systems. You can addict your own procudures of starting drivers, but - * if you directly override method of abstract ExternalSystemArray, be careful about virtual - * inheritance.

    - */ - start(): void; - /** - *

    Test whether has a role.

    - * - * @param name Name of an ExternalSystemRole. - * @return Whether has or not. - */ - hasRole(key: string): boolean; - /** - *

    Get a role.

    - * - * @param name Name of an ExternalSystemRole - * @return A shared pointer of specialized role - */ - getRole(key: string): ExternalSystemRole; - sendData(invoke: Invoke): void; - replyData(invoke: Invoke): void; - TAG(): string; - CHILD_TAG(): string; + *

    + * + *

    + * + * + /// + /// + + // IMPORTS + import std = require("typescript-stl"); + import samchon = require("samchon-framework"); + + // SHORTCUTS + import library = samchon.library; + import collection = samchon.collection; + import protocol = samchon.protocol; + + namespace service + { + export class Server extends protocol.WebServer implements IProtocol + { + // SERVER HAS MULTIPLE USER OBJECTS + private session_map: std.HashMap; + + //------------------------ + // MESSAGE CHAIN + //------------------------ + public sendData(invoke: protocol.Invoke): void + { + // SEND INVOKE MESSAGE TO ALL USER OBJECTS + for (let it = this.session_map.begin(); !it.equal_to(this.session_map.end()); it = it.next()) + it.second.sendData(invoke); + } + public replyData(invoke: protocol.Invoke): void + { + invoke.apply(this); // HANDLE INVOKE MESSAGE BY ITSELF + } + } + + export class User extends + collection.HashMapCollection // USER HAS MULTIPLE CLIENT OBJECTS + implements IProtocol + { + private server: Server; // USER REFRES SERVER + + //------------------------ + // MESSAGE CHAIN + //------------------------ + public sendData(invoke: protocol.Invoke): void + { + // SEND INVOKE MESSAGE TO ALL CLIENT OBJECTS + for (let it = this.begin(); !it.equal_to(this.end()); it = it.next()) + it.second.sendData(invoke); + } + public replyData(invoke: protocol.Invoke): void + { + invoke.apply(this); // HANDLE INOVKE MESSAGE BY ITSELF + this.server.replyData(invoke); // OR VIA SERVER + } + } + + export class Client implements IProtocol + { + private user: User; // CLIENT REFERS USER + private service: Service; // CLIENT HAS A SERVICE OBJECT + + private driver: WebClientDriver; + + //------------------------ + // MESSAGE CHAIN + //------------------------ + public sendData(invoke: protocol.Invoke): void + { + // SEND INVOKE MESSAGE VIA driver: WebClientDriver + this.driver.sendData(invoke); + } + public replyData(invoke: protocol.Invoke): void + { + invoke.apply(this); // HANDLE INOVKE MEESAGE BY ITSELF + this.user.replyData(invoke); // OR VIA USER + + if (this.service != null) // OR VIA SERVICE + this.service.replyData(invoke); + } + } + + export class Service implements IProtocol + { + private client: Client; // SERVICE REFRES CLIENT + + //------------------------ + // MESSAGE CHAIN + //------------------------ + public sendData(invoke: protocol.Invoke): void + { + // SEND INVOKE MESSAGE VIA CLIENT + return this.client.sendData(invoke); + } + public replyData(invoke: protocol.Invoke): void + { + invoke.apply(this); // HANDLE INVOKE MESSAGE BY ITSELF + } + } } -} -declare namespace samchon.protocol { - /** - *

    A role belongs to an external system.

    + *
    * - *

    ExternalSystemRole is a 'control' class groupping methods, handling Invoke messages - * interacting with an external system that the ExternalSystemRole is belonged to, by a subject or - * unit of a module.

    * - *

    ExternalSystemRole can be a "logical proxy" for an ExternalSystem which is containing the - * ExternalSystemRole. Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, - * if you access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a - * belonged ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem - * is related in, the ExternalSystemRole acted a role of proxy.

    + *

    Basic Components

    + *

    What Basic Components are

    + *

    Basic Components are the smallest unit of network communication in this Samchon Framework. With + * Basic Components, you can construct any type of network system, even how the network system is enormously + * scaled and complicated, by just combinating the Basic Components.

    * - *

    It's called as "Proxy pattern". With the pattern, you can only concentrate on - * ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole - * is belonged to which ExternalSystem.

    + *

    All the system templates in this framework are also being implemented by utilization of the + * Basic Compoonents.

    * - * @author Jeongho Nam - */ - class ExternalSystemRole extends Entity implements IProtocol { - /** - *

    A driver of external system containing the ExternalSystemRole.

    - */ - protected system: ExternalSystem; - /** - *

    A name representing the role.

    - */ - protected name: string; - protected sendListeners: std.HashSet; - /** - *

    Construct from external system driver.

    - * - * @param system A driver of external system the ExternalSystemRole is belonged to. - */ - constructor(system: ExternalSystem); - construct(xml: library.XML): void; - getName(): string; - hasSendListener(key: string): boolean; - sendData(invoke: Invoke): void; - replyData(invoke: Invoke): void; - TAG(): string; - toXML(): library.XML; - } -} -declare namespace samchon.protocol { - /** - *

    An interface for Invoke message chain.

    + *
      + *
    • {@link service Service} + *
    • {@link external External System} + *
    • {@link parallel Parallel System} + *
    • {@link distributed Distributed System} + *
    * - *

    IProtocol is an interface for Invoke message, which is standard message of network I/O - * in Samchon Framework, chain. The IProtocol interface is used to network drivers and some - * classes which are in a relationship of chain of responsibility with those network drivers.

    + *

    Note that, whatever the network system what you've to construct is, just concentrate on role of each system + * and attach matched Basic Components to the role, within framework of the Object-Oriented Design. + * Then construction of the network system will be much easier.

    * - *

    In Samchon Framework, server side, IProtocol is one of the basic 3 + 1 components that - * can make any type of network system in Samchon Framework with IServer and IClient. Following - * the "chain of responsibility" pa1ttern, looking around classes in Samchon Framework, you - * can see all related classes with network I/O are implemented from the IProtocol.

    + *
      + *
    • A system is a server, then use {@link IServer} or {@link IServerBase}.
    • + *
    • A server wants to handle a client has connected, then use {@link IClientDriver}.
    • + *
    • A system is a client connecting to an external server, then use {@link IServerConnector}.
    • + *
    • + *
    * - * @see Invoke + *

    Example - System Templates

    + *

    Learning and understanding Basic Components of Samchon Framework, reading source codes and design of + * System Templates' modules will be very helpful.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Name Source API Documents
    Cloud Service protocol/service {@link protocol.service}
    External System protocol/external {@link protocol.external}
    Parallel System protocol/parallel {@link protocol.parallel}
    Distributed System protocol/distributed {@link protocol.distributed}
    Slave System protocol/slave {@link protocol.slave}
    + * + *

    Example - Projects

    + * + * + * @see {@link Invoke} + * @handbook Basic Components - IProtocol * @author Jeongho Nam */ interface IProtocol { @@ -2920,7 +4200,7 @@ declare namespace samchon.protocol { *

    Handling replied message.

    *

    Handles replied message or shifts the responsibility to chain.

    * - * @param invoke Replied invoke message + * @param invoke An {@link Invoke} message has received. */ sendData(invoke: Invoke): void; } @@ -2928,7 +4208,8 @@ declare namespace samchon.protocol { declare namespace samchon.protocol { /** *

    Standard message of network I/O.

    - *

    Invoke is a class used in network I/O in protocol package of Samchon Framework.

    + * + *

    {@link Invoke} is a class used in network I/O in protocol package of Samchon Framework.

    * *

    The Invoke message has an XML structure like the result screen of provided example in below. * We can enjoy lots of benefits by the normalized and standardized message structure used in @@ -2940,8 +4221,8 @@ declare namespace samchon.protocol { * like a object (class) in OOD. And those relationships can be easily designed by using design * pattern.

    * - *

    In Samchon Framework, you can make any type of network system with basic 3 + 1 componenets - * (IProtocol, IServer and IClient + ServerConnector), by implemens or inherits them, like designing + *

    In Samchon Framework, you can make any type of network system with basic componenets + * (IProtocol, IServer and ICommunicator) by implemens or inherits them, like designing * classes of S/W architecture.

    * * @see IProtocol @@ -2952,6 +4233,10 @@ declare namespace samchon.protocol { *

    Listener, represent function's name.

    */ protected listener: string; + /** + * Default Constructor. + */ + constructor(); constructor(listener: string); /** * Copy Constructor. @@ -2959,13 +4244,17 @@ declare namespace samchon.protocol { * @param invoke */ constructor(invoke: Invoke); - constructor(xml: library.XML); - constructor(listener: string, begin: std.VectorIterator, end: std.VectorIterator); - constructor(listener: string, ...parameters: any[]); + /** + * Construct from listener and parametric values. + * + * @param listener + * @param parameters + */ + constructor(listener: string, ...parameters: Array); /** * @inheritdoc */ - createChild(xml: library.XML): InvokeParameter; + protected createChild(xml: library.XML): InvokeParameter; /** * Get listener. */ @@ -2990,93 +4279,10 @@ declare namespace samchon.protocol { CHILD_TAG(): string; } } -declare namespace samchon.protocol { - /** - *

    A history of an Invoke message.

    - * - *

    InvokeHistory is a class for reporting history log of an Invoke message with elapsed time - * from a slave to its master.

    - * - *

    With the elapsed time, consumed time for a process of handling the Invoke message, - * InvokeHistory is reported to the master. The master utilizies the elapsed time to estimating - * performances of each slave system. With the estimated performan index, master retrives the - * optimal solution of distributing processes.

    - * - * @author Jeongho Nam - */ - class InvokeHistory extends Entity { - /** - *

    An identifier.

    - */ - protected uid: number; - /** - *

    A listener of the Invoke message.

    - * - *

    InvokeHistory does not archive entire data of an Invoke message. InvokeHistory only - * archives its listener. The first, formal reason is to save space, avoid wasting spaces.

    - * - *

    The second, complicate reason is on an aspect of which systems are using the - * InvokeHistory class. InvokeHistory is designed to let slave reports to master elapsed time - * of a process used to handling the Invoke message. If you want to archive entire history log - * of Invoke messages, then the subject should be master, not the slave using InvokeHistory - * classes.

    - */ - protected listener: string; - /** - *

    Start time of the history.

    - * - *

    Means start time of a process handling the Invoke message. The start time not only - * has ordinary arguments represented Datetime (year to seconds), but also has very precise - * values under seconds, which is expressed as nano seconds (10^-9).

    - * - *

    The precise start time will be used to calculate elapsed time with end time.

    - */ - protected startTime: Date; - /** - *

    End time of the history.

    - * - * @details - *

    Means end time of a process handling the Invoke message. The end time not only - * has ordinary arguments represented Datetime (year to seconds), but also has very precise - * values under seconds, which is expressed as nano seconds (10^-9).

    - * - *

    The precise end time will be used to calculate elapsed time with start time.

    - */ - protected endTime: Date; - /** - *

    Construct from an Invoke message.

    - * - *

    InvokeHistory does not archive entire Invoke message, only archives its listener.

    - * - * @param invoke A message to archive its history log - */ - constructor(invoke: Invoke); - /** - *

    Notify end of the process.

    - * - *

    Notifies end of a process handling the matched Invoke message to InvokeHistory.

    - *

    InvokeHistory archives the end datetime and calculates elapsed time as nanoseconds.

    - */ - notifyEnd(): void; - TAG(): string; - toXML(): library.XML; - /** - *

    Get an Invoke message.

    - * - *

    Returns an Invoke message to report to a master that how much time was elapsed on a - * process handling the Invoke message. In master, those reports are used to estimate - * performance of each slave system.

    - * - * @return An Invoke message to report master. - */ - toInvoke(): Invoke; - } -} declare namespace samchon.protocol { /** * A parameter belongs to an Invoke. * - * @see Invoke * @author Jeongho Nam */ class InvokeParameter extends Entity { @@ -3093,31 +4299,33 @@ declare namespace samchon.protocol { /** *

    Value of the parameter.

    */ - protected value: any; + protected value: string | number | library.XML | Uint8Array; /** * Default Constructor. */ constructor(); + constructor(val: number); + constructor(val: string); + constructor(val: library.XML); + constructor(val: Uint8Array); /** - * Initialization Constructor without type specification. + * Construct from variable name and number value. * * @param name * @param val */ - constructor(name: string, val: any); - /** - * Initialization Constructor. - * - * @param name - * @param type - * @param val - */ - constructor(name: string, type: string, val: any); + constructor(name: string, val: number); + constructor(name: string, val: string); + constructor(name: string, val: library.XML); + constructor(name: string, val: Uint8Array); /** * @inheritdoc */ construct(xml: library.XML): void; - setValue(value: any): void; + setValue(value: number): any; + setValue(value: string): any; + setValue(value: library.XML): any; + setValue(value: Uint8Array): any; /** * @inheritdoc */ @@ -3145,193 +4353,1781 @@ declare namespace samchon.protocol { } } declare namespace samchon.protocol { - /** - *

    A server connector for a physical client.

    - * - *

    ServerConnector is a class for a physical client connecting a server. If you want to connect - * to a server, then implements this ServerConnector and just override some methods like - * getIP(), getPort() and replyData(). That's all.

    - * - *

    In Samchon Framework, package protocol, There are basic 3 + 1 components that can make any - * type of network system in Samchon Framework. The basic 3 components are IProtocol, IServer and - * IClient. The last, surplus one is the ServerConnector. Looking around classes in - * Samchon Framework, especially module master and slave which are designed for realizing - * distributed processing systems and parallel processing systems, physical client classes are all - * derived from this ServerConnector.

    - * - * - * - * @author Jeongho Nam - */ - class ServerConnector implements IProtocol { + class InvokeHistory extends Entity { /** - *

    A parent object who listens and sends Invoke message.

    * - *
      - *
    • ServerConnector.replyData(Invoke) -> parent.replyData(Invoke)
    • - *
    */ - private parent; + private uid; /** - *

    A socket for network I/O.

    + * @see {@link Invoke.listener} */ - private socket; - private binary_invoke; + private listener; /** - *

    An open-event listener.

    - */ - onopen: Function; - /** - *

    Constructor with parent.

    - */ - constructor(parent: IProtocol); - /** - *

    Connects to a cloud server with specified host and port.

    * - *

    If the connection fails immediately, either an event is dispatched or an exception is thrown: - * an error event is dispatched if a host was specified, and an exception is thrown if no host - * was specified. Otherwise, the status of the connection is reported by an event. - * If the socket is already connected, the existing connection is closed first.

    + */ + private startTime; + /** * - * @param ip - * The name or IP address of the host to connect to. - * If no host is specified, the host that is contacted is the host where the calling - * file resides. If you do not specify a host, use an event listener to determine whether - * the connection was successful. - * @param port - * The port number to connect to. - * - * @throws IOError - * No host was specified and the connection failed. - * @throws SecurityError - * This error occurs in SWF content for the following reasons: - * Local untrusted SWF files may not communicate with the Internet. You can work around - * this limitation by reclassifying the file as local-with-networking or as trusted. */ - connect(ip: string, port: number, path?: string): void; + private endTime; /** - *

    Send data to the server.

    + * Default Constructor. */ - sendData(invoke: Invoke): void; - /** - *

    Shift responsiblity of handling message to parent.

    - */ - replyData(invoke: Invoke): void; - private handleConnect(event); - /** - *

    Handling replied message.

    - */ - private handleReply(event); + constructor(); + constructor(invoke: Invoke); + construct(xml: library.XML): void; + notifyEnd(): void; + key(): number; + getUID(): number; + getListener(): string; + getStartTime(): Date; + getEndTime(): Date; + computeElapsedTime(): number; + TAG(): string; + toXML(): library.XML; + toInvoke(): Invoke; } } -declare namespace samchon.protocol.service { +declare namespace samchon.protocol { /** - *

    An application, the top class in JS-UI.

    + *

    An interface for a physical server.

    + * + *

    {@link IServer} provides methods for opening a server. Extends one of them who are derived from this + * {@link IServer} and open the server with method {@link open IServer.open()}. Override + * {@link addClient IServer.addClient()} who accepts a newly connected client with {@link IClientDriver}. + * If you're embarrased because your class already extended another one, then use {@link IServerBase}.

    * - *

    The Application is separated to three part, TopMenu, Movie and ServerConnector.

    *
      - *
    • TopMenu: Menu on the top. It's not an essential component.
    • - *
    • Movie: Correspond with Service in Server. Movie has domain UI components(Movie) for the matched Service.
    • - *
    • ServerConnector: The socket connecting to the Server.
    • + *
    • {@link Server}
    • + *
    • {@link WebServer}
    • + *
    • {@link SharedWorkerServer}
    • *
    * - *

    The Application and its UI-layout is not fixed, essential component for Samchon Framework in Flex, - * so it's okay to do not use the provided Application and make your custom Application. - * But the custom Application, your own, has to contain the Movie and keep the construction routine.

    + *

    + * + *

    * - *

    + *

    Basic Components

    + *

    What Basic Components are

    + *

    Basic Components are the smallest unit of network communication in this Samchon Framework. With + * Basic Components, you can construct any type of network system, even how the network system is enormously + * scaled and complicated, by just combinating the Basic Components.

    + * + *

    All the system templates in this framework are also being implemented by utilization of the + * Basic Compoonents.

    * - *

    THE CONSTRUCTION ROUTINE

    *
      - *
    • Socket Connection
    • - *
        - *
      • Connect to the CPP-Server
      • - *
      - *
    • Fetch authority
    • - *
        - *
      • Send a request to fetching authority
      • - *
      • The window can be navigated to other page by the authority
      • - *
      - *
    • Construct Movie
    • - *
        - *
      • Determine a Movie by URLVariables::movie and construct it
      • - *
      - *
    • All the routines are done
    • + *
    • {@link service Service} + *
    • {@link external External System} + *
    • {@link parallel Parallel System} + *
    • {@link distributed Distributed System} *
    * + *

    Note that, whatever the network system what you've to construct is, just concentrate on role of each system + * and attach matched Basic Components to the role, within framework of the Object-Oriented Design. + * Then construction of the network system will be much easier.

    + * + *
      + *
    • A system is a server, then use {@link IServer} or {@link IServerBase}.
    • + *
    • A server wants to handle a client has connected, then use {@link IClientDriver}.
    • + *
    • A system is a client connecting to an external server, then use {@link IServerConnector}.
    • + *
    • + *
    + * + *

    Example - System Templates

    + *

    Learning and understanding Basic Components of Samchon Framework, reading source codes and design of + * System Templates' modules will be very helpful.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Name Source API Documents
    Cloud Service protocol/service {@link protocol.service}
    External System protocol/external {@link protocol.external}
    Parallel System protocol/parallel {@link protocol.parallel}
    Distributed System protocol/distributed {@link protocol.distributed}
    Slave System protocol/slave {@link protocol.slave}
    + * + *

    Example - Projects

    + * + * + * @see {@link IClientDriver} + * @handbook Basic Components - IServer * @author Jeongho Nam */ - class Application implements IProtocol { - /** - *

    Invoke Socket.

    - */ - protected socket: ServerConnector; - /** - *

    A movie.

    - */ - protected movie: Movie; - /** - *

    Construct from arguments.

    - * - * @param movie A movie represents a service. - * @param ip An ip address of cloud server to connect. - * @param port A port number of cloud server to connect. - */ - constructor(movie: Movie, ip: string, port: number); - private handleConnect(event); - /** - *

    Handle replied message or shift the responsibility.

    - */ - replyData(invoke: Invoke): void; - /** - *

    Send a data to server.

    - */ - sendData(invoke: Invoke): void; + interface IServer { + open(port: number): void; + close(): void; + addClient(clientDriver: IClientDriver): void; } } -declare namespace samchon.protocol.service { - /** - * A movie belonged to an Application. - */ - class Movie implements IProtocol { +declare namespace samchon.protocol { + abstract class Server implements IServer { + private server; /** - *

    An application the movie is belonged to + * @inheritdoc */ - protected application: Application; + abstract addClient(driver: ClientDriver): void; /** - * Handle replied data. + * @inheritdoc */ - replyData(invoke: Invoke): void; + open(port: number): void; /** - * Send data to server. + * @inheritdoc */ - sendData(invoke: Invoke): void; + close(): void; + private handle_connect(socket); } } -declare namespace samchon.protocol.service { -} -declare namespace samchon.protocol.slave { - /** - * @brief A slave system. - * - * @details - *

    SlaveSystem, literally, means a slave system belongs to a maste system.

    - * - *

    The SlaveSystem class is used in opposite side system of master::DistributedSystem - * and master::ParallelSystem and reports elapsed time of each commmand (by Invoke message) - * for estimation of its performance.

    - * - * @inheritdoc - * @author Jeongho Nam - */ - abstract class SlaveSystem extends ExternalSystem { +declare namespace samchon.protocol { + abstract class WebServer implements IServer { /** - *

    Default Constructor.

    + * A server handler. + */ + private http_server; + /** + * Sequence number for issuing session id. + */ + private sequence; + /** + * @hidden + */ + private my_port; + /** + * Default Constructor. */ constructor(); /** * @inheritdoc */ + open(port: number): void; + /** + * @inheritdoc + */ + close(): void; + /** + * @inheritdoc + */ + abstract addClient(driver: WebClientDriver): void; + /** + *

    Handle request from a client system.

    + * + *

    This method {@link handle_request} will be called when a client is connected. It will call an abstract + * method method {@link addClient addClient()} who handles an accepted client. If the newly connected client + * doesn't have its own session id, then a new session id will be issued.

    + * + * @param request Requested header. + */ + private handle_request(request); + /** + *

    Get session id from a newly connected.

    + * + *

    Queries ordinary session id from cookies of a newly connected client. If the client has not, a new + * session id will be issued.

    + * + * @param cookies Cookies from the remote client. + */ + private get_session_id(cookies); + /** + * Issue a new session id. + */ + private issue_session_id(); + } +} +declare namespace samchon.protocol { + abstract class SharedWorkerServer implements IServer { + /** + * @inheritdoc + */ + abstract addClient(driver: SharedWorkerClientDriver): void; + /** + * @inheritdoc + */ + open(): void; + /** + * @inheritdoc + */ + close(): void; + private handle_connect(event); + } +} +declare namespace samchon.protocol { + /** + *

    An interface for substitute server classes.

    + * + *

    {@link IServerBase} is an interface for substitue server classes who subrogate server's role.

    + * + *

    The easiest way to defining a server class is to extending one of them, who are derived from the + * {@link IServer}.

    + * + *
      + *
    • {@link Server}
    • + *
    • {@link WebServer}
    • + *
    • {@link SharedWorkerServer}
    • + *
    + * + *

    However, it is impossible (that is, if the class is already extending another class), you can instead implement + * the {@link IServer} interface, create an {@link IServerBase} member, and write simple hooks to route calls into the + * aggregated {@link IServerBase}.

    + * + *

    {@link ExternalClientArray} can be a good example using this {@link IServerBase}.

    + *
      + *
    • https://github.com/samchon/framework/blob/master/ts/src/samchon/protocol/external/ExternalClientArray.ts
    • + *
    + * + * + class MyServer extends Something implements IServer + { + private server_base: IServerBase = new WebServerBase(this); + + public addClient(driver: IClientDriver): void + { + // WHAT TO DO WHEN A CLIENT HAS CONNECTED + } + + public open(port: number): void + { + this.server_base.open(); + } + public close(): void + { + this.server_base.close(); + } + } + * + * + * @see {@link IServer} + * @handbook Basic Components - IServerBase + * @author Jeongho Nam + */ + interface IServerBase extends IServer { + } +} +declare namespace samchon.protocol { + /** + *

    A substitute {@link Server}.

    + * + *

    {@link ServerBase} is a substitute class who subrogates {@link Server}'s responsibility.

    + * + *

    The easiest way to defning a server class following normal protocol of Samchon Framework is to extending + * {@link Server}. However, it is impossible (that is, if the class is already extending another class), you can + * instead implement the {@link IServer} interface, create a {@link ServerBase} member, and write simple hooks + * to route calls into the aggregated {@link ServerBase}.

    + * + *

    {@link ExternalClientArray} can be a good example using this {@link IServerBase}.

    + *
      + *
    • https://github.com/samchon/framework/blob/master/ts/src/samchon/protocol/external/ExternalClientArray.ts
    • + *
    + * + * + class MyServer extends Something implements IServer + { + private server_base: ServerBase = new ServerBase(this); + + public addClient(driver: ClientDriver): void + { + // WHAT TO DO WHEN A CLIENT HAS CONNECTED + } + + public open(port: number): void + { + this.server_base.open(); + } + public close(): void + { + this.server_base.close(); + } + } + * + * + * @author Jeongho Nam + */ + class ServerBase extends Server implements IServerBase { + private target; + constructor(target: IServer); + addClient(driver: IClientDriver): void; + } +} +declare namespace samchon.protocol { + /** + *

    A substitute {@link WebServer}.

    + * + *

    {@link WebServerBase} is a substitute class who subrogates {@link WebServer}'s responsibility.

    + * + *

    The easiest way to defning a server class following normal protocol of Samchon Framework is to extending + * {@link WebServer}. However, it is impossible (that is, if the class is already extending another class), you can + * instead implement the {@link IServer} interface, create a {@link WebServerBase} member, and write simple hooks to + * route calls into the aggregated {@link WebServerBase}.

    + * + *

    {@link ExternalClientArray} can be a good example using this {@link IServerBase}.

    + *
      + *
    • https://github.com/samchon/framework/blob/master/ts/src/samchon/protocol/external/ExternalClientArray.ts
    • + *
    + * + * + class MyServer extends Something implements IServer + { + private server_base: WebServerBase = new WebServerBase(this); + + public addClient(driver: WebClientDriver): void + { + // WHAT TO DO WHEN A CLIENT HAS CONNECTED + } + + public open(port: number): void + { + this.server_base.open(); + } + public close(): void + { + this.server_base.close(); + } + } + * + * + * @author Jeongho Nam + */ + class WebServerBase extends WebServer implements IServerBase { + private target; + constructor(target: IServer); + addClient(driver: IClientDriver): void; + } +} +declare namespace samchon.protocol { + /** + *

    A substitute {@link SharedWorkerServer}.

    + * + *

    {@link SharedWorkerServerBase} is a substitute class who subrogates {@link SharedWorkerServer}'s + * responsibility.

    + * + *

    The easiest way to defning a server class following normal protocol of Samchon Framework is to extending + * {@link SharedWorkerServer}. However, it is impossible (that is, if the class is already extending another class), + * you can instead implement the {@link IServer} interface, create a {@link SharedWorkerServerBase} member, and write + * simple hooks to route calls into the aggregated {@link SharedWorkerServerBase}.

    + * + *

    {@link ExternalClientArray} can be a good example using this {@link IServerBase}.

    + *
      + *
    • https://github.com/samchon/framework/blob/master/ts/src/samchon/protocol/external/ExternalClientArray.ts
    • + *
    + * + * + class MyServer extends Something implements IServer + { + private server_base: SharedWorkerServerBase = new SharedWorkerServerBase(this); + + public addClient(driver: SharedWorkerClientDriver): void + { + // WHAT TO DO WHEN A CLIENT HAS CONNECTED + } + + public open(port: number): void + { + this.server_base.open(); + } + public close(): void + { + this.server_base.close(); + } + } + * + * + * @author Jeongho Nam + */ + class SharedWorkerServerBase extends SharedWorkerServer implements IServerBase { + private target; + constructor(target: IServer); + addClient(driver: IClientDriver): void; + } +} +declare namespace samchon.protocol { + /** + *

    An interface for server connector.

    + * + *

    {@link IServerConnector} is an interface for server connector classes who ca connect to an external server + * as a client.

    + * + *

    Of course, {@link IServerConnector} is extended from the {@link ICommunicator}, thus, it also takes full + * charge of network communication and delivers replied message to {@link WebCommunicator.listener listener}'s + * {@link IProtocol.replyData replyData()} method.

    + * + * @handbook Basic Components - IServerConnector + * @author Jeongho Nam + */ + interface IServerConnector extends ICommunicator { + /** + * Callback function for connection completed. + */ + onConnect: Function; + /** + *

    Connect to a server.

    + * + *

    Connects to a server with specified host address and port number. After the connection has + * succeeded, callback function {@link onConnect} is called. Listening data from the connected server also begins. + * Replied messages from the connected server will be converted to {@link Invoke} classes and will be shifted to + * the {@link WebCommunicator.listener listener}'s {@link IProtocol.replyData replyData()} method.

    + * + *

    If the connection fails immediately, either an event is dispatched or an exception is thrown: an error + * event is dispatched if a host was specified, and an exception is thrown if no host was specified. Otherwise, + * the status of the connection is reported by an event. If the socket is already connected, the existing + * connection is closed first.

    + * + * @param ip The name or IP address of the host to connect to. + * If no host is specified, the host that is contacted is the host where the calling file resides. + * If you do not specify a host, use an event listener to determine whether the connection was + * successful. + * @param port The port number to connect to. + */ + connect(ip: string, port: number): void; + } +} +declare namespace samchon.protocol { + class ServerConnector extends Communicator implements IServerConnector { + /** + * @inheritdoc + */ + onConnect: Function; + constructor(listener: IProtocol); + /** + * @inheritdoc + */ + connect(ip: string, port: number): void; + private handle_connect(...arg); + } +} +declare namespace samchon.protocol { + /** + *

    A server connector for web-socket protocol.

    + * + * @author Jeongho Nam + */ + class WebServerConnector extends WebCommunicator implements IServerConnector { + /** + *

    A socket for network I/O.

    + * + *

    Note that, {@link socket} is only used in web-browser environment.

    + */ + private browser_socket; + /** + *

    A driver for server connection.

    + * + *

    Note that, {@link node_client} is only used in NodeJS environment.

    + */ + private node_client; + /** + * @inheritdoc + */ + onConnect: Function; + constructor(listener: IProtocol); + /** + * @inheritdoc + */ + connect(ip: string, port: number, path?: string): void; + /** + * @inheritdoc + */ + close(): void; + /** + * @inheritdoc + */ + sendData(invoke: Invoke): void; + private handle_browser_connect(event); + private handle_browser_message(event); + private handle_node_connect(connection); + } +} +declare namespace samchon.protocol { + class SharedWorkerServerConnector extends SharedWorkerCommunicator implements IServerConnector { + /** + * @inheritdoc + */ + onConnect: Function; + constructor(listener: IProtocol); + connect(jsFile: string): void; + } +} +declare namespace samchon.protocol { + namespace socket { + type socket = any; + type server = any; + type http_server = any; + } + namespace websocket { + type connection = any; + type request = any; + type IMessage = any; + type ICookie = any; + type client = any; + } +} +declare namespace samchon.protocol.external { + /** + *

    An external system driver.

    + * + *

    The {@link ExternalSystem} class represents an external system, connected and interact with this system. + * {@link ExternalSystem} takes full charge of network communication with external system have connected. + * Replied {@link Invoke messages} from the external system is shifted to and processed in, children elements of this + * class, {@link ExternalSystemRole} objects.

    + * + *

    + * + *

    + * + *

    Bridge & Proxy Pattern

    + *

    The {@link ExternalSystem} class can be a bridge for logical proxy. In framework within user, + * which {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Bridge Pattern and Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalSystem extends EntityDequeCollection implements IProtocol { + /** + * A network communicator with external system. + */ + /** + * A network communicator with external system. + */ + protected communicator: ICommunicator; + /** + * The name represents external system have connected. + */ + protected name: string; + /** + * Default Constructor. + */ + constructor(); + /** + * Construct from an IClientDriver object. + * + * @param driver + */ + constructor(driver: IClientDriver); + /** + * Default Destructor. + */ + destructor(): void; + /** + * Identifier of {@link ExternalSystem} is its {@link name}. + */ + key(): string; + /** + * Get {@link name}. + */ + getName(): string; + close(): void; + /** + * Send {@link Invoke} message to external system. + * + * @param invoke An {@link Invoke} message to send. + */ + sendData(invoke: Invoke): void; + /** + * Handle an {@Invoke} message have received. + * + * @param invoke An {@link Invoke} message have received. + */ + replyData(invoke: Invoke): void; + /** + * Tag name of the {@link ExternalSytem} in {@link XML}. + * + * @return system. + */ + TAG(): string; + /** + * Tag name of {@link ExternalSystemRole children elements} belonged to the {@link ExternalSytem} in {@link XML}. + * + * @return role. + */ + CHILD_TAG(): string; + /** + * @inheritdoc + */ + toXML(): library.XML; + /** + * @hidden + */ + private communicator_; + /** + * @hidden + */ + private external_system_array_; + /** + * @hidden + */ + private erasing_; + /** + * @hidden + */ + private external_system_array; + /** + * @hidden + */ + private handle_close(); + } +} +declare namespace samchon.protocol.parallel { + /** + *

    An external parallel system driver.

    + * + * + * + * @author Jeongho Nam + */ + abstract class ParallelSystem extends external.ExternalSystem { + /** + * A manager containing this {@link ParallelSystem} object. + */ + private systemArray; + /** + * A list of {@link Invoke} messages on process. + * + * @see {@link performance} + */ + private progress_list; + /** + * A list of {@link Invoke} messages had processed. + * + * @see {@link performance} + */ + private history_list; + /** + *

    Performance index.

    + * + *

    A performance index that indicates how much fast the connected parallel system is.

    + * + *

    If this {@link ParallelSystem parallel system} hasn't any {@link Invoke} message + * {@link history_list had handled}, then the {@link performance performance index} will be 1, which means + * default and average value between all {@link ParallelSystem} instances (belonged to a same + * {@link ParallelSystemArray} object).

    + * + *

    You can specify this {@link performance} by yourself, but notice that, if the + * {@link performance performance index} is higher then other {@link ParallelSystem} objects, then this + * {@link ParallelSystem parallel system} will ordered to handle more processes than other {@link ParallelSystem} + * objects. Otherwise, the {@link performance performance index) is lower than others, of course, less processes + * will be delivered.

    + * + *

    This {@link performance index} is always re-calculated whenever {@link ParallelSystemArray} calls one of + * them below.

    + * + *
      + *
    • {@link ParallelSystemArray.sendSegmentData ParallelSystemArray.sendSegmentData()}
    • + *
    • {@link ParallelSystemArray.sendPieceData ParallelSystemArray.sendPieceData()}
    • + *
    + * + *

    If this class is a type of {@link DistributedSystem}, a derived class from the {@link ParallelSystem}, + * then {@link DistributedSystemRole.sendData DistributedSystem.sendData()} also cause the re-calculation.

    + * + * @see {@link progress_list}, {@link history_list} + */ + protected performance: number; + /** + * Construct from a {@link ParallelSystemArray}. + * + * @param systemArray A manager containing this {@link ParallelSystem} object. + * @param communicator A communicator who takes full charge of network communication with the external + * parallel system. + */ + constructor(systemArray: ParallelSystemArray, communicator?: ICommunicator); + /** + * Get manager of this object, {@link systemArray}. + * + * @return A manager containing this {@link ParallelSystem} object. + */ + getSystemArray(): ParallelSystemArray; + /** + * Get {@link performant performance index}. + * + * A performance index that indicates how much fast the connected parallel system is. + */ + getPerformance(): number; + /** + * Send an {@link Invoke} message with index of segmentation. + * + * @param invoke An invoke message requesting parallel process. + * @param first Initial piece's index in a section. + * @param last Final piece's index in a section. The ranged used is [first, last), which contains + * all the pieces' indices between first and last, including the piece pointed by index + * first, but not the piece pointed by the index last. + * + * @see {@link ParallelSystemArray.sendPieceData} + */ + private send_piece_data(invoke, first, last); + /** + * + * + * @param xml + * + * @see {@link ParallelSystemArray.notify_end} + */ + private report_invoke_history(xml); + } +} +declare namespace samchon.protocol.distributed { + abstract class DistributedSystem extends parallel.ParallelSystem { + } +} +declare namespace samchon.protocol.external { + /** + *

    An array and manager of {@link ExternalSystem external systems}.

    + * + *

    {@link ExternalSystemArray} is an abstract class contains and manages external system drivers, + * {@link ExternalSystem} objects. You can specify this {@link ExternalSystemArray} to be a server accepting + * {@link ExternalSystem external clients} or a client connecting to {@link IExternalServer external servers}. Even + * both of them is also possible.

    + * + *
      + *
    • A server accepting external clients: {@link IExternalClientArray}
    • + *
    • A client connecting to external servers: {@link IExternalServerArray}
    • + *
    • + * Accepts external clients & Connects to external servers at the same time: + * {@link IExternalServerClientArray} + *
    • + *
    + * + *

    + * + *

    + * + *

    Proxy Pattern

    + *

    The {@link ExternalSystemArray} class can use Proxy Pattern. In framework within user, which + * {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalSystemArray extends EntityArrayCollection implements IProtocol { + /** + * Default Constructor. + */ + constructor(); + /** + * @hidden + */ + private handle_system_insert(event); + /** + * @hidden + */ + private handle_system_erase(event); + /** + * @hidden + */ + protected handle_system_close(system: ExternalSystem): void; + /** + * Test whether this system array has the role. + * + * @param name Name, identifier of target {@link ExternalSystemRole role}. + * + * @return Whether the role has or not. + */ + hasRole(name: string): boolean; + /** + * Get a role. + * + * @param name Name, identifier of target {@link ExternalSystemRole role}. + * + * @return The specified role. + */ + getRole(name: string): ExternalSystemRole; + /** + *

    Send an {@link Invoke} message.

    + * + * @param invoke An {@link Invoke} message to send. + */ + sendData(invoke: Invoke): void; + /** + *

    Handle an {@Invoke} message have received.

    + * + * @param invoke An {@link Invoke} message have received. + */ + replyData(invoke: Invoke): void; + /** + * Tag name of the {@link ExternalSytemArray} in {@link XML}. + * + * @return systemArray. + */ + TAG(): string; + /** + * Tag name of {@link ExternalSystem children elements} belonged to the {@link ExternalSytemArray} in {@link XML}. + * + * @return system. + */ + CHILD_TAG(): string; + } +} +declare namespace samchon.protocol.parallel { + /** + *

    A manager containing {@link ParallelSystem} objects.

    + * + * + * + * @author Jeongho Nam + */ + abstract class ParallelSystemArray extends external.ExternalSystemArray { + /** + * @see {@link ParallelSystem.progress_list}, {@link ParallelSystem.history_list} + */ + private history_sequence; + /** + * Default Constructor. + */ + constructor(); + /** + * + * @param invoke An invoke message requesting parallel process. + * @param size Number of pieces. + */ + sendSegmentData(invoke: Invoke, size: number): void; + /** + * + * + * @param invoke An invoke message requesting parallel process. + * @param first Initial piece's index in a section. + * @param last Final piece's index in a section. The ranged used is [first, last), which contains + * all the pieces' indices between first and last, including the piece pointed by index + * first, but not the piece pointed by the index last. + */ + sendPieceData(invoke: Invoke, first: number, last: number): void; + /** + * + * @param history + * + * @return Whether the processes with same uid are all fininsed. + * + * @see {@link ParallelSystem.report_invoke_history}, {@link normalize_performance} + */ + protected notify_end(history: PRInvokeHistory): boolean; + /** + * @see {@link ParallelSystem.performance} + */ + private normalize_performance(); + } +} +declare namespace samchon.protocol.distributed { + abstract class DistributedSystemArray extends parallel.ParallelSystemArray { + protected roles: std.HashMap; + } +} +declare namespace samchon.protocol.external { + /** + *

    A role of an external system.

    + * + *

    The {@link ExternalSystemRole} class represents a role, what to do in an {@link ExternalSystem}. + * Extends this class and writes some methods related to the role.

    + * + *

    + * + *

    + * + *

    Proxy Pattern

    + *

    The {@link ExternalSystemRole} class can be an logical proxy. In framework within user, which + * {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalSystemRole extends Entity implements IProtocol { + /** + * An {@link ExternalSystem external system} containing this {@link ExternalSystemRole role}. + */ + private system; + /** + *

    A name, represents and identifies this {@link ExternalSystemRole role}.

    + * + *

    This {@link name} is an identifier represents this {@link ExternalSystemRole role}. This {@link name} is + * used in {@link ExternalSystemArray.getRole} and {@link ExternalSystem.get}, as a key elements. Thus, this + * {@link name} should be unique in an {@link ExternalSystemArray}. + */ + private name; + /** + * Constructor from a system. + * + * @param system An external system containing this role. + */ + constructor(system: ExternalSystem); + /** + * Identifier of {@link ExternalSystemRole} is its {@link name}. + */ + key(): string; + /** + * Get external system, this role is belonged to. + */ + getSystem(): ExternalSystem; + /** + * Get name, who represents and identifies this role. + */ + getName(): string; + /** + * Send an {@link Invoke} message to the external system via {@link system}. + * + * @param invoke An {@link Invoke} message to send to the external system. + */ + sendData(invoke: Invoke): void; + /** + *

    Handle replied {@link Invoke message} from the {@link system external system} belonged to.

    + * + *

    This {@link replyData replyData()} will call a member method named following {@link Invoke.listener}. + * in the invoke.

    + * + * @param invoke An {@link Invoke} message received from the {@link system external system}. + */ + replyData(invoke: Invoke): void; + /** + * Tag name of the {@link ExternalSytemRole} in {@link XML}. + * + * @return role. + */ + TAG(): string; + } +} +declare namespace samchon.protocol.distributed { + abstract class DistributedSystemRole extends external.ExternalSystemRole { + private systems; + } +} +declare namespace samchon.protocol.external { + /** + *

    An interface for an {@link ExternalSystemArray} accepts {@link ExternalSystem external clients} as a + * {@link IServer server}.

    + * + *

    The easiest way to defining an {@link ExternalSystemArray} who opens server and accepts + * {@link ExternalSystem external clients} is to extending one of below, who are derived from this interface + * {@link IExternalClientArray}. However, if you can't specify an {@link ExternalSystemArray} to be whether server or + * client, then make a class (let's name it as BaseSystemArray) extending {@link ExternalSystemArray} and make + * a new class (now, I name it BaseClientArray) extending BaseSystemArray and implementing this + * interface {@link IExternalClientArray}. Define the BaseClientArray following those codes on below: + * + *

    + * + * @author Jeongho Nam + */ + interface IExternalClientArray extends ExternalSystemArray, IServer { + } + /** + *

    An {@link ExternalSystemArray} acceepts {@link ExternalSystem external clients} as a {@link IServer server}.

    + * + *

    {@link ExternalServerArray} is an abstract class contains, manages and accepts external server drivers, + * {@link IExternalServer} objects, as a {@link IServer server}.

    + * + *

    + * + *

    + * + *

    Proxy Pattern

    + *

    The {@link ExternalSystemArray} class can use Proxy Pattern. In framework within user, which + * {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalClientArray extends ExternalSystemArray implements IExternalClientArray { + /** + * A subrogator of {@link IServer server}'s role instead of this {@link ExternalClientArray}. + */ + private server_base; + /** + * Default Constructor. + */ + constructor(); + /** + *

    Factory method creating {@link IServerBase} object.

    + * + *

    This method {@link createServerBase createServerBase()} determines which protocol is used in this server, + * {@link ExternalClientArray}. If the protocol is determined, then {@link ExternalSystem external clients} who + * may connect to {@link ExternalClientArray this server} must follow the specified protocol.

    + * + *

    Creates and returns one of them:

    + *
      + *
    • {@link ServerBase}
    • + *
    • {@link WebServerBase}
    • + *
    • {@link SharedWorkerServerBase}
    • + *
    + * + * @return A new {@link IServerBase} object. + */ + protected abstract createServerBase(): IServerBase; + addClient(driver: IClientDriver): void; + /** + * This method is deprecated. Don't use and override this. + * + * @return null. + */ + protected createChild(xml: library.XML): ExternalSystem; + /** + * Factory method creating {@link ExternalSystem} object. + * + * @param driver A communicator with connected client. + * @return A newly created {@link ExternalSystem} object. + */ + protected abstract createExternalClient(driver: IClientDriver): ExternalSystem; + /** + * @inheritdoc + */ + open(port: number): void; + /** + * @inheritdoc + */ + close(): void; + } +} +declare namespace samchon.protocol.external { + /** + *

    An interface for an external server driver.

    + * + *

    The easiest way to defining an external server driver is to extending one of below, who are derived from this + * interface {@link IExternalServer}. However, if you've to interact with an external system who can be both server + * and client, then make a class (let's name it as BaseSystem) extending {@link ExternalSystem} and make a + * new class (now, I name it BaseServer) extending BaseSystem and implementing this interface + * {@link IExternalServer}. Define the BaseServer following those codes on below: + * + *

    + * + * @author Jeongho Nam + */ + interface IExternalServer extends ExternalSystem { + /** + * Connect to the external system. + */ + connect(): void; + /** + * Get ip address. + */ + getIP(): string; + /** + * Get port number. + */ + getPort(): number; + } + /** + *

    An external server driver.

    + * + *

    The {@link ExternalServer} class represents an external server, connected and interact with this system. + * {@link ExternalServer} takes full charge of network communication with external server have connected. + * Replied {@link Invoke messages} from the external system is shifted to and processed in, children elements of this + * class, {@link ExternalSystemRole} objects.

    + * + *

    + * + *

    + * + *

    Bridge & Proxy Pattern

    + *

    The {@link ExternalSystem} class can be a bridge for logical proxy. In framework within user, + * which {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Bridge Pattern and Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalServer extends ExternalSystem implements IExternalServer { + /** + * IP address of target external system to connect. + */ + protected ip: string; + /** + * Port number of target external system to connect. + */ + protected port: number; + /** + * Default Constructor. + */ + constructor(); + /** + * Factory method creating server connector. + */ + protected abstract createServerConnector(): IServerConnector; + /** + * @inheritdoc + */ + connect(): void; + /** + * @inheritdoc + */ + getIP(): string; + /** + * @inheritdoc + */ + getPort(): number; + } +} +declare namespace samchon.protocol.external { + /** + *

    An interface for an {@link ExternalSystemArray} connects to {@link IExternalServer external servers} as a + * client.

    + * + *

    The easiest way to defining an {@link ExternalSystemArray} who connects to + * {@link IExternalServer external servers} is to extending one of below, who are derived from this interface + * {@link IExternalServerArray}. However, if you can't specify an {@link ExternalSystemArray} to be whether server or + * client, then make a class (let's name it as BaseSystemArray) extending {@link ExternalSystemArray} and make + * a new class (now, I name it BaseServerArray) extending BaseSystemArray and implementing this + * interface {@link IExternalServerArray}. Define the BaseServerArray following those codes on below: + * + *

    + * + * @author Jeongho Nam + */ + interface IExternalServerArray extends ExternalSystemArray { + /** + *

    Connect to {@link IExternalServer external servers}.

    + * + *

    This method calls children elements' method {@link IExternalServer.connect} gradually.

    + */ + connect(): void; + } + /** + *

    An {@link ExternalSystemArray} connecting to {@link IExternalServer external servers} as a client.

    + * + *

    {@link ExternalServerArray} is an abstract class contains, manages and connects to external server drivers, + * {@link IExternalServer} objects, as a client.

    + * + *

    + * + *

    + * + *

    Proxy Pattern

    + *

    The {@link ExternalSystemArray} class can use Proxy Pattern. In framework within user, which + * {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalServerArray extends ExternalSystemArray { + /** + * Default Constructor. + */ + constructor(); + /** + * @inheritdoc + */ + connect(): void; + } +} +declare namespace samchon.protocol.external { + /** + *

    An interface for an {@link ExternalSystemArray} accepts {@link ExternalSystem external clients} as a + * {@link IServer server} and connects to {@link IExternalServer} as client, at the same time.

    + * + *

    The easiest way to defining an {@link IExternalServerClientArray} who opens server, accepts + * {@link ExternalSystem external clients} and connects to {@link IExternalServer external servers} is to extending + * one of below, who are derived from this interface {@link IExternalServerClientArray}. However, if you can't + * specify an {@link ExternalSystemArray} to be whether server or client or even can both them, then make a class + * (let's name it as BaseSystemArray) extending {@link ExternalSystemArray} and make a new class (now, I name + * it BaseServerClientArray) extending BaseSystemArray and implementing this interface + * {@link IExternalServerClientArray}. Define the BaseServerClientArray following those codes on below: + * + *

    + * + * @author Jeongho Nam + */ + interface IExternalServerClientArray extends IExternalServerArray, IExternalClientArray { + } + /** + *

    An {@link ExternalSystemArray} connecting to {@link IExternalServer external servers} as a client and + * accepts {@link ExternalSystem external clients} as a {@link IServer server}.

    + * + *

    {@link ExternalServerArray} is an abstract class contains, manages and connects to external server drivers, + * {@link IExternalServer} objects and accepts external client drivers {@link ExternalSyste} obejcts as a + * client and a {@link IServer server} at the same time.

    + * + *

    + * + *

    + * + *

    Proxy Pattern

    + *

    The {@link ExternalSystemArray} class can use Proxy Pattern. In framework within user, which + * {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not + * important. Only interested in user's perspective is which can be done.

    + * + *

    By using the logical proxy, user dont't need to know which {@link ExternalSystemRole role} is belonged + * to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}. + * Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.

    + * + *
      + *
    • + * {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring + * from {@link ExternalSystem}, with {@link ExternalSystemArray.getRole}. + *
    • + *
    • + * When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call + * {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the + * external system. + *
    • + *
    • Those strategy is called Proxy Pattern.
    • + *
    + * + * @author Jeongho Nam + */ + abstract class ExternalServerClientArray extends ExternalClientArray implements IExternalServerClientArray { + /** + * Default Constructor. + */ + constructor(); + /** + *

    Factory method of a child Entity.

    + * + *

    This method is migrated to {@link createExternalServer createExternalServer()}. Override the + * {@link createExternalServer createExternalServer()}.

    + * + * @param xml An {@link XML} object represents child element, so that can identify the type of child to create. + * + * @return A new child Entity via {@link createExternalServer createExternalServer()}. + */ + protected createChild(xml: library.XML): ExternalSystem; + /** + * Factory method creating an {@link IExternalServer} object. + * + * @param xml An {@link XML} object represents child element, so that can identify the type of child to create. + * + * @return A newly created {@link IExternalServer} object. + */ + protected abstract createExternalServer(xml: library.XML): IExternalServer; + /** + * @inheritdoc + */ + connect(): void; + } +} +declare namespace samchon.protocol.slave { + abstract class SlaveSystem extends external.ExternalSystem { + /** + * Default Constructor. + */ + constructor(); replyData(invoke: Invoke): void; } } +declare namespace samchon.protocol.external { + abstract class MediatorSystem extends slave.SlaveSystem { + private system_array; + private progress_list; + constructor(systemArray: ExternalSystemArray); + abstract start(): void; + /** + * @hidden + */ + protected createChild(xml: library.XML): ExternalSystemRole; + private notify_end(uid); + replyData(invoke: protocol.Invoke): void; + } +} +declare namespace samchon.protocol.external { + class MediatorServer extends MediatorSystem implements IServer { + private server_base; + private port; + constructor(systemArray: ExternalSystemArray, port: number); + protected createServerBase(): IServerBase; + addClient(driver: IClientDriver): void; + start(): void; + open(port: number): void; + close(): void; + } + class MediatorWebServer extends MediatorServer { + protected createServerBase(): IServerBase; + } + class MediatorSharedWorkerServer extends MediatorServer { + protected createServerBase(): IServerBase; + } +} +declare namespace samchon.protocol.external { + class MediatorClient extends MediatorSystem implements IExternalServer { + protected ip: string; + protected port: number; + constructor(systemArray: ExternalSystemArray, ip: string, port: number); + protected createServerConnector(): IServerConnector; + getIP(): string; + getPort(): number; + start(): void; + connect(): void; + } + class MediatorWebClient extends MediatorClient { + /** + * @inheritdoc + */ + protected createServerConnector(): IServerConnector; + } + class MediatorSharedWorkerClient extends MediatorClient { + /** + * @inheritdoc + */ + protected createServerConnector(): IServerConnector; + } +} +declare namespace samchon.protocol.parallel { + class PRInvokeHistory extends InvokeHistory { + /** + * Index number of initial piece. + */ + private first; + /** + * Index number of final piece. + */ + private last; + /** + * Default Constructor. + */ + constructor(); + /** + * Construct from an Invoke message. + * + * @param invoke + */ + constructor(invoke: Invoke); + getFirst(): number; + getLast(): number; + /** + * Compute number of allocated pieces. + */ + computeSize(): number; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelClientArray extends ParallelSystemArray implements external.IExternalClientArray { + /** + * A subrogator of {@link IServer server}'s role instead of this {@link ExternalClientArray}. + */ + private server_base; + /** + * Default Constructor. + */ + constructor(); + /** + *

    Factory method creating {@link IServerBase} object.

    + * + *

    This method {@link createServerBase createServerBase()} determines which protocol is used in this server, + * {@link ExternalClientArray}. If the protocol is determined, then {@link ExternalSystem external clients} who + * may connect to {@link ExternalClientArray this server} must follow the specified protocol.

    + * + *

    Creates and returns one of them:

    + *
      + *
    • {@link ServerBase}
    • + *
    • {@link WebServerBase}
    • + *
    • {@link SharedWorkerServerBase}
    • + *
    + * + * @return A new {@link IServerBase} object. + */ + protected abstract createServerBase(): IServerBase; + addClient(driver: IClientDriver): void; + protected createChild(xml: library.XML): ParallelSystem; + protected abstract createExternalClient(driver: IClientDriver): ParallelSystem; + /** + * @inheritdoc + */ + open(port: number): void; + /** + * @inheritdoc + */ + close(): void; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelSystemArrayMediator extends ParallelSystemArray { + protected mediator: external.MediatorSystem; + /** + * Default Constructor. + */ + constructor(); + protected abstract createMediator(): external.MediatorSystem; + protected start_mediator(): void; + sendData(invoke: protocol.Invoke): void; + sendPieceData(invoke: protocol.Invoke, first: number, last: number): void; + protected notify_end(history: PRInvokeHistory): boolean; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelClientArrayMediator extends ParallelSystemArrayMediator implements external.IExternalClientArray { + /** + * A subrogator of {@link IServer server}'s role instead of this {@link ExternalClientArray}. + */ + private server_base; + /** + * Default Constructor. + */ + constructor(); + /** + *

    Factory method creating {@link IServerBase} object.

    + * + *

    This method {@link createServerBase createServerBase()} determines which protocol is used in this server, + * {@link ExternalClientArray}. If the protocol is determined, then {@link ExternalSystem external clients} who + * may connect to {@link ExternalClientArray this server} must follow the specified protocol.

    + * + *

    Creates and returns one of them:

    + *
      + *
    • {@link ServerBase}
    • + *
    • {@link WebServerBase}
    • + *
    • {@link SharedWorkerServerBase}
    • + *
    + * + * @return A new {@link IServerBase} object. + */ + protected abstract createServerBase(): IServerBase; + addClient(driver: IClientDriver): void; + protected createChild(xml: library.XML): ParallelSystem; + protected abstract createExternalClient(driver: IClientDriver): ParallelSystem; + /** + * @inheritdoc + */ + open(port: number): void; + /** + * @inheritdoc + */ + close(): void; + } +} +declare namespace samchon.protocol.parallel { + interface IParallelServer extends ParallelSystem, external.IExternalServer { + } + abstract class ParallelServer extends ParallelSystem implements IParallelServer { + protected ip: string; + protected port: number; + constructor(systemArray: ParallelSystemArray); + protected abstract createServerConnector(): IServerConnector; + connect(): void; + getIP(): string; + getPort(): number; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelServerArray extends ParallelSystemArray implements external.IExternalServerArray { + constructor(); + connect(): void; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelServerArrayMediator extends ParallelSystemArrayMediator implements external.IExternalServerArray { + constructor(); + connect(): void; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelServerClientArray extends ParallelClientArray implements external.IExternalServerClientArray { + /** + * Default Constructor. + */ + constructor(); + protected createChild(xml: library.XML): ParallelSystem; + protected abstract createExternalServer(xml: library.XML): IParallelServer; + connect(): void; + } +} +declare namespace samchon.protocol.parallel { + abstract class ParallelServerClientArrayMediator extends ParallelClientArrayMediator implements external.IExternalServerClientArray { + /** + * Default Constructor. + */ + constructor(); + protected createChild(xml: library.XML): ParallelSystem; + protected abstract createExternalServer(xml: library.XML): IParallelServer; + /** + * @inheritdoc + */ + connect(): void; + } +} +declare namespace samchon.protocol.service { + abstract class Client implements protocol.IProtocol { + private user; + private service; + private driver; + private no; + /** + * Construct from an User and WebClientDriver. + */ + constructor(user: User, driver: WebClientDriver); + protected abstract createService(path: string): Service; + close(): void; + getUser(): User; + getService(): Service; + sendData(invoke: protocol.Invoke): void; + replyData(invoke: protocol.Invoke): void; + protected changeService(path: string): void; + } +} +declare namespace samchon.protocol.service { + abstract class Server extends protocol.WebServer implements IProtocol { + private session_map; + private account_map; + /** + * Default Constructor. + */ + constructor(); + /** + * Factory method creating {@link User} object. + * + * @return A newly created {@link User} object. + */ + protected abstract createUser(): User; + has(account: string): boolean; + get(account: string): User; + sendData(invoke: protocol.Invoke): void; + replyData(invoke: protocol.Invoke): void; + addClient(driver: WebClientDriver): void; + private erase_user(user); + } +} +declare namespace samchon.protocol.service { + abstract class Service implements protocol.IProtocol { + private client; + private path; + /** + * Default Constructor. + */ + constructor(client: Client, path: string); + destructor(): void; + /** + * Get client. + */ + getClient(): Client; + /** + * Get path. + */ + getPath(): string; + sendData(invoke: protocol.Invoke): void; + replyData(invoke: protocol.Invoke): void; + } +} +declare namespace samchon.protocol.service { + abstract class User extends collection.HashMapCollection implements protocol.IProtocol { + private server; + private session_id; + private sequence; + private account_id; + private authority; + /** + * Construct from a Server. + */ + constructor(server: Server); + protected abstract createClient(driver: WebClientDriver): Client; + private handle_erase_client(event); + getServer(): Server; + getAccountID(): string; + getAuthority(): number; + setAccount(id: string, authority: number): void; + sendData(invoke: protocol.Invoke): void; + replyData(invoke: protocol.Invoke): void; + } +} +declare namespace samchon.protocol.slave { + abstract class SlaveClient extends SlaveSystem { + constructor(); + protected abstract createServerConnector(): IServerConnector; + connect(ip: string, port: number): void; + } +} +declare namespace samchon.protocol.slave { + abstract class SlaveServer extends SlaveSystem implements IServer { + private server_base; + constructor(); + protected abstract createServerBase(): IServerBase; + addClient(driver: IClientDriver): void; + open(port: number): void; + close(): void; + } +} diff --git a/typescript-stl/typescript-stl-tests.ts b/typescript-stl/typescript-stl-tests.ts index cc684cde7e..d83a9ffc5a 100644 --- a/typescript-stl/typescript-stl-tests.ts +++ b/typescript-stl/typescript-stl-tests.ts @@ -1,4 +1,4 @@ /// import std = require("typescript-stl"); -std.example.test_all(); \ No newline at end of file +console.log(std); \ No newline at end of file diff --git a/typescript-stl/typescript-stl.d.ts b/typescript-stl/typescript-stl.d.ts index a0f92b88b6..5a83a405cd 100644 --- a/typescript-stl/typescript-stl.d.ts +++ b/typescript-stl/typescript-stl.d.ts @@ -1,4 +1,4 @@ -// Type definitions for TypeScript-STL v1.0.0-rc.3 +// Type definitions for TypeScript-STL v1.0.0 // Project: https://github.com/samchon/typescript-stl // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -117,13 +117,6 @@ declare namespace std { */ declare namespace std.base { } -/** - * Examples for supporting developers who use STL library. - * - * @author Jeongho Nam - */ -declare namespace std.example { -} declare namespace std { /** *

    Apply function to range.

    @@ -2751,8 +2744,8 @@ declare namespace std.base { /** *

    An abstract container.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -2872,8 +2865,8 @@ declare namespace std { *

    There is not a single type of {@link Iterator bidirectional iterator}: {@link IContainer Each container} * may define its own specific iterator type able to iterate through it and access its elements.

    * - *

    - * + *

    + * *

    * * @reference http://www.cplusplus.com/reference/iterator/BidirectionalIterator @@ -2958,18 +2951,45 @@ declare namespace std { * first element in a range is reversed, the reversed iterator points to the element before the first element (this * would be the past-the-end element of the reversed range).

    * - *

    - * + *

    + * *

    * * @reference http://www.cplusplus.com/reference/iterator/reverse_iterator * @author Jeongho Nam */ abstract class ReverseIterator, This extends ReverseIterator> extends Iterator { + /** + * @hidden + */ protected base_: Base; + /** + * Construct from base iterator. + * + * @param base A reference of the base iterator, which iterates in the opposite direction. + */ constructor(base: Base); + /** + *

    Return base iterator.

    + * + *

    Return a reference of the base iteraotr.

    + * + *

    The base iterator is an iterator of the same type as the one used to construct the {@link ReverseIterator}, + * but pointing to the element next to the one the {@link ReverseIterator} is currently pointing to + * (a {@link ReverseIterator} has always an offset of -1 with respect to its base iterator). + * + * @return A reference of the base iterator, which iterates in the opposite direction. + */ base(): Base; + /** + * @hidden + */ protected abstract create_neighbor(): This; + /** + *

    Get value of the iterator is pointing.

    + * + * @return A value of the reverse iterator. + */ value: T; /** * @inheritdoc @@ -3194,8 +3214,8 @@ declare namespace std { * the end, {@link Deque Deques} perform worse and have less consistent iterators and references than * {@link List Lists}.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -3217,66 +3237,27 @@ declare namespace std { */ class Deque extends base.Container implements base.IArrayContainer, base.IDequeContainer { /** - *

    Row size of the {@link matrix_ matrix} which contains elements.

    - * - *

    Note that the {@link ROW} affects on time complexity of accessing and inserting element. - * Accessing element is {@link ROW} times slower than ordinary {@link Vector} and inserting element - * in middle position is {@link ROW} times faster than ordinary {@link Vector}.

    - * - *

    When the {@link ROW} returns 8, time complexity of accessing element is O(8) and inserting - * element in middle position is O(N/8). ({@link Vector}'s time complexity of accessement is O(1) - * and inserting element is O(N)).

    + * @hidden */ private static ROW; /** - *

    Minimum {@link capacity}.

    - * - *

    Although a {@link Deque} has few elements, even no element is belonged to, the {@link Deque} - * keeps the minimum {@link capacity} at least.

    + * @hidden */ private static MIN_CAPACITY; /** - *

    A matrix containing elements.

    - * - *

    This {@link matrix_} is the biggest difference one between {@link Vector} and {@link Deque}. - * Its number of rows follows {@link ROW} and number of columns follows {@link get_col_size} which - * returns divide of {@link capacity} and {@link ROW}.

    - * - * By separating segment of elements (segment: row, elements in a segment: col), {@link Deque} takes - * advantage of time complexity on inserting element in middle position. {@link Deque} is {@link ROW} - * times faster than {@link Vector} when inserting elements in middle position.

    - * - *

    However, separating segment of elements from matrix, {@link Deque} also takes disadvantage of - * time complexity on accessing element. {@link Deque} is {@link ROW} times slower than {@link Vector} - * when accessing element.

    + * @hidden */ private matrix_; /** - * Number of elements in the {@link Deque}. + * @hidden */ private size_; /** - *

    Size of allocated storage capacity.

    - * - *

    The {@link capacity_ capacity} is size of the storage space currently allocated for the - * {@link Deque container}, expressed in terms of elements.

    - * - *

    This {@link capacity_ capacity} is not necessarily equal to the {@link Deque container} - * {@link size}. It can be equal or greater, with the extra space allowing to accommodate for growth - * without the need to reallocate on each insertion.

    - * - *

    Notice that this {@link capacity_ capacity} does not suppose a limit on the {@link size} of - * the {@link Deque container}. When this {@link capacity} is exhausted and more is needed, it is - * automatically expanded by the {@link Deque container} (reallocating it storage space). - * The theoretical limit on the {@link size} of a {@link Deque container} is given by member - * {@link max_size}.

    - * - *

    The {@link capacity_ capacity} of a {@link Deque container} can be explicitly altered by - * calling member {@link Deque.reserve}.

    + * @hidden */ private capacity_; /** - * Get column size; {@link capacity_ capacity} / {@link ROW row}. + * @hidden */ private get_col_size(); /** @@ -3480,8 +3461,8 @@ declare namespace std { /** *

    An iterator of {@link Deque}.

    * - *

    - * + *

    + * *

    * * @author Jeongho Nam @@ -3509,6 +3490,11 @@ declare namespace std { /** * @inheritdoc */ + /** + * Set value of the iterator is pointing to. + * + * @param val Value to set. + */ value: T; /** * @inheritdoc @@ -3552,8 +3538,8 @@ declare namespace std { /** *

    A reverse-iterator of Deque.

    * - *

    - * + *

    + * *

    * * @param Type of the elements. @@ -3561,13 +3547,20 @@ declare namespace std { * @author Jeongho Nam */ class DequeReverseIterator extends ReverseIterator, DequeReverseIterator> implements base.IArrayIterator { + /** + * Construct from base iterator. + * + * @param base A reference of the base iterator, which iterates in the opposite direction. + */ constructor(base: DequeIterator); /** - * @inheritdoc + * @hidden */ protected create_neighbor(): DequeReverseIterator; /** - * Set value. + * Set value of the iterator is pointing to. + * + * @param val Value to set. */ value: T; /** @@ -3629,8 +3622,8 @@ declare namespace std { *

    All objects thrown by components of the standard library are derived from this class. * Therefore, all standard exceptions can be caught by catching this type by reference.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/exception/exception * @author Jeongho Nam @@ -3678,8 +3671,8 @@ declare namespace std { * *

    It is used as a base class for several logical error exceptions.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/logic_error * @author Jeongho Nam @@ -3704,8 +3697,8 @@ declare namespace std { *

    No component of the standard library throws exceptions of this type. It is designed as a standard * exception to be thrown by programs.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/domain_error * @author Jeongho Nam @@ -3726,8 +3719,8 @@ declare namespace std { *

    It is a standard exception that can be thrown by programs. Some components of the standard library * also throw exceptions of this type to signal invalid arguments.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/invalid_argument * @author Jeongho Nam @@ -3748,8 +3741,8 @@ declare namespace std { *

    It is a standard exception that can be thrown by programs. Some components of the standard library, * such as vector and string also throw exceptions of this type to signal errors resizing.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/length_error * @author Jeongho Nam @@ -3771,8 +3764,8 @@ declare namespace std { * such as vector, deque, string and bitset also throw exceptions of this type to signal arguments * out of range.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/out_of_range * @author Jeongho Nam @@ -3793,8 +3786,8 @@ declare namespace std { * *

    It is used as a base class for several runtime error exceptions.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/runtime_error * @author Jeongho Nam @@ -3815,8 +3808,8 @@ declare namespace std { *

    It is a standard exception that can be thrown by programs. Some components of the standard library * also throw exceptions of this type to signal range errors.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/overflow_error * @author Jeongho Nam @@ -3837,8 +3830,8 @@ declare namespace std { *

    No component of the standard library throws exceptions of this type. It is designed as a standard * exception to be thrown by programs.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/underflow_error * @author Jeongho Nam @@ -3860,8 +3853,8 @@ declare namespace std { *

    It is a standard exception that can be thrown by programs. Some components of the standard library * also throw exceptions of this type to signal range errors.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/stdexcept/range_error * @author Jeongho Nam @@ -4422,8 +4415,8 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -4820,8 +4813,8 @@ declare namespace std { /** *

    An iterator of {@link MapContainer map container}.

    * - *

    - *

    + *

    + *

    * * @author Jeongho Nam */ @@ -4891,13 +4884,21 @@ declare namespace std { /** *

    A reverse-iterator of {@link MapContainer map container}.

    * - *

    - *

    + *

    + *

    * * @author Jeongho Nam */ class MapReverseIterator extends ReverseIterator, MapIterator, MapReverseIterator> { + /** + * Construct from base iterator. + * + * @param base A reference of the base iterator, which iterates in the opposite direction. + */ constructor(base: MapIterator); + /** + * @hidden + */ protected create_neighbor(): MapReverseIterator; /** * Get first, key element. @@ -4931,8 +4932,8 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -5198,8 +5199,8 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -5311,8 +5312,8 @@ declare namespace std { *

    {@link HashMap} containers are faster than {@link TreeMap} containers to access individual elements by their * key, although they are generally less efficient for range iteration through a subset of their elements.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -5342,6 +5343,9 @@ declare namespace std { * @author Jeongho Nam */ class HashMap extends base.UniqueMap implements base.IHashMap { + /** + * @hidden + */ private hash_buckets_; /** * @hidden @@ -5473,8 +5477,8 @@ declare namespace std { *

    Elements with equivalent keys are grouped together in the same bucket and in such a way that * an iterator can iterate through all of them. Iterators in the container are doubly linked iterators.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -5505,7 +5509,7 @@ declare namespace std { */ class HashMultiMap extends base.MultiMap { /** - * + * @hidden */ private hash_buckets_; /** @@ -5633,8 +5637,8 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -5910,8 +5914,8 @@ declare namespace std { /** *

    An iterator of a Set.

    * - *

    - *

    + *

    + *

    * * @author Jeongho Nam */ @@ -5969,146 +5973,26 @@ declare namespace std { /** *

    A reverse-iterator of Set.

    * - *

    - *

    + *

    + *

    * * @param Type of the elements. * * @author Jeongho Nam */ class SetReverseIterator extends ReverseIterator, SetReverseIterator> { + /** + * Construct from base iterator. + * + * @param base A reference of the base iterator, which iterates in the opposite direction. + */ constructor(base: SetIterator); /** - * @inheritdoc + * @hidden */ protected create_neighbor(): SetReverseIterator; } } -declare namespace std.base { - /** - *

    An abstract set.

    - * - *

    {@link SetContainer SetContainers} are containers that store elements allowing fast retrieval of - * individual elements based on their value.

    - * - *

    In an {@link SetContainer}, the value of an element is at the same time its key, used to uniquely - * identify it. Keys are immutable, therefore, the elements in an {@link SetContainer} cannot be modified - * once in the container - they can be inserted and removed, though.

    - * - *

    {@link SetContainer} stores elements, keeps sequence and enables indexing by inserting elements into a - * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index - * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    - * - *

    - *

    - * - *

    Container properties

    - *
    - *
    Associative
    - *
    - * Elements in associative containers are referenced by their key and not by their absolute - * position in the container. - *
    - * - *
    Set
    - *
    The value of an element is also the key used to identify it.
    - * - *
    Unique keys
    - *
    No two elements in the container can have equivalent keys.
    - *
    - * - * @param Type of the elements. Each element in a {@link SetContainer} container is also identified - * by this value (each value is itself also the element's key). - * - * @author Jeongho Nam - */ - abstract class UniqueSet extends SetContainer { - /** - * @inheritdoc - */ - count(key: T): number; - /** - *

    Extract an element.

    - * - *

    Extracts the element pointed to by val and erases it from the {@link UniqueSet}.

    - * - * @param val Value to be extracted. - * - * @return A value. - */ - extract(val: T): T; - /** - *

    Extract an element.

    - * - *

    Extracts the element pointed to by key and erases it from the {@link UniqueMap}.

    - * - * @param it An iterator pointing an element to extract. - * - * @return An iterator pointing to the element immediately following it prior to the element being - * erased. If no such element exists,returns {@link end end()}. - */ - extract(it: SetIterator): SetIterator; - /** - *

    Extract an element.

    - * - *

    Extracts the element pointed to by key and erases it from the {@link UniqueMap}.

    - * - * @param it An iterator pointing an element to extract. - * - * @return An iterator pointing to the element immediately following it prior to the element being - * erased. If no such element exists,returns {@link end end()}. - */ - extract(it: SetReverseIterator): SetReverseIterator; - /** - * @hidden - */ - private extract_by_key(val); - /** - * @hidden - */ - private extract_by_iterator(it); - /** - * @hidden - */ - private extract_by_reverse_iterator(it); - /** - *

    Insert an element.

    - * - *

    Extends the container by inserting new elements, effectively increasing the container {@link size} by - * the number of element inserted (zero or one).

    - * - *

    Because elements in a {@link UniqueSet UniqueSets} are unique, the insertion operation checks whether - * each inserted element is equivalent to an element already in the container, and if so, the element is not - * inserted, returning an iterator to this existing element (if the function returns a value).

    - * - *

    For a similar container allowing for duplicate elements, see {@link MultiSet}.

    - * - * @param key Value to be inserted as an element. - * - * @return A {@link Pair}, with its member {@link Pair.first} set to an iterator pointing to either the newly - * inserted element or to the equivalent element already in the {@link UniqueSet}. The - * {@link Pair.second} element in the {@link Pair} is set to true if a new element was inserted or - * false if an equivalent element already existed. - */ - insert(val: T): Pair, boolean>; - /** - * @inheritdoc - */ - insert(hint: SetIterator, val: T): SetIterator; - /** - * @inheritdoc - */ - insert(hint: SetReverseIterator, val: T): SetReverseIterator; - /** - * @inheritdoc - */ - insert>(begin: InputIterator, end: InputIterator): void; - /** - * @inheritdoc - */ - swap(obj: UniqueSet): void; - } -} declare namespace std.base { /** *

    An abstract set.

    @@ -6124,8 +6008,8 @@ declare namespace std.base { * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -6177,163 +6061,6 @@ declare namespace std.base { swap(obj: MultiSet): void; } } -declare namespace std.HashSet { - type iterator = std.SetIterator; - type reverse_iterator = std.SetReverseIterator; -} -declare namespace std { - /** - *

    Hashed, unordered set.

    - * - *

    {@link HashSet}s are containers that store unique elements in no particular order, and which - * allow for fast retrieval of individual elements based on their value.

    - * - *

    In an {@link HashSet}, the value of an element is at the same time its key, that - * identifies it uniquely. Keys are immutable, therefore, the elements in an {@link HashSet} cannot be - * modified once in the container - they can be inserted and removed, though.

    - * - *

    Internally, the elements in the {@link HashSet} are not sorted in any particular order, but - * organized into buckets depending on their hash values to allow for fast access to individual elements - * directly by their values (with a constant average time complexity on average).

    - * - *

    {@link HashSet} containers are faster than {@link TreeSet} containers to access individual - * elements by their key, although they are generally less efficient for range iteration through a - * subset of their elements.

    - * - *

    - *

    - * - *

    Container properties

    - *
    - *
    Associative
    - *
    Elements in associative containers are referenced by their key and not by their absolute - * position in the container.
    - * - *
    Hashed
    - *
    Hashed containers organize their elements using hash tables that allow for fast access to elements - * by their key.
    - * - *
    Set
    - *
    The value of an element is also the key used to identify it.
    - * - *
    Unique keys
    - *
    No two elements in the container can have equivalent keys.
    - *
    - * - * @param Type of the elements. - * Each element in an {@link HashSet} is also uniquely identified by this value. - * - * @reference http://www.cplusplus.com/reference/unordered_set/unordered_set - * @author Jeongho Nam - */ - class HashSet extends base.UniqueSet { - private hash_buckets_; - /** - * @hidden - */ - protected init(): void; - /** - * @hidden - */ - protected construct_from_array(items: Array): void; - /** - * @inheritdoc - */ - clear(): void; - /** - * @inheritdoc - */ - find(key: T): SetIterator; - /** - * @inheritdoc - */ - begin(): SetIterator; - /** - * @inheritdoc - */ - begin(index: number): SetIterator; - /** - * @inheritdoc - */ - end(): SetIterator; - /** - * @inheritdoc - */ - end(index: number): SetIterator; - /** - * @inheritdoc - */ - rbegin(): SetReverseIterator; - /** - * @inheritdoc - */ - rbegin(index: number): SetReverseIterator; - /** - * @inheritdoc - */ - rend(): SetReverseIterator; - /** - * @inheritdoc - */ - rend(index: number): SetReverseIterator; - /** - * @inheritdoc - */ - bucket_count(): number; - /** - * @inheritdoc - */ - bucket_size(n: number): number; - /** - * @inheritdoc - */ - max_load_factor(): number; - /** - * @inheritdoc - */ - max_load_factor(z: number): void; - /** - * @inheritdoc - */ - bucket(key: T): number; - /** - * @inheritdoc - */ - reserve(n: number): void; - /** - * @inheritdoc - */ - rehash(n: number): void; - /** - * @hidden - */ - protected insert_by_val(val: T): any; - /** - * @hidden - */ - protected insert_by_hint(hint: SetIterator, val: T): SetIterator; - /** - * @hidden - */ - protected insert_by_range>(first: InputIterator, last: InputIterator): void; - /** - * @inheritdoc - */ - protected handle_insert(first: SetIterator, last: SetIterator): void; - /** - * @inheritdoc - */ - protected handle_erase(first: SetIterator, last: SetIterator): void; - /** - * @inheritdoc - */ - swap(obj: base.UniqueSet): void; - /** - * @hidden - */ - private swap_tree_set(obj); - } -} declare namespace std.HashMultiSet { type iterator = std.SetIterator; type reverse_iterator = std.SetReverseIterator; @@ -6357,8 +6084,8 @@ declare namespace std { *

    Elements with equivalent values are grouped together in the same bucket and in such a way that an * iterator can iterate through all of them. Iterators in the container are doubly linked iterators.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -6384,6 +6111,9 @@ declare namespace std { * @author Jeongho Nam */ class HashMultiSet extends base.MultiSet { + /** + * @hidden + */ private hash_buckets_; /** * @hidden @@ -6495,6 +6225,291 @@ declare namespace std { private swap_tree_set(obj); } } +declare namespace std.base { + /** + *

    An abstract set.

    + * + *

    {@link SetContainer SetContainers} are containers that store elements allowing fast retrieval of + * individual elements based on their value.

    + * + *

    In an {@link SetContainer}, the value of an element is at the same time its key, used to uniquely + * identify it. Keys are immutable, therefore, the elements in an {@link SetContainer} cannot be modified + * once in the container - they can be inserted and removed, though.

    + * + *

    {@link SetContainer} stores elements, keeps sequence and enables indexing by inserting elements into a + * {@link List} and registering {@link ListIterator iterators} of the {@link data_ list container} to an index + * table like {@link RBTree tree} or {@link HashBuckets hash-table}.

    + * + *

    + *

    + * + *

    Container properties

    + *
    + *
    Associative
    + *
    + * Elements in associative containers are referenced by their key and not by their absolute + * position in the container. + *
    + * + *
    Set
    + *
    The value of an element is also the key used to identify it.
    + * + *
    Unique keys
    + *
    No two elements in the container can have equivalent keys.
    + *
    + * + * @param Type of the elements. Each element in a {@link SetContainer} container is also identified + * by this value (each value is itself also the element's key). + * + * @author Jeongho Nam + */ + abstract class UniqueSet extends SetContainer { + /** + * @inheritdoc + */ + count(key: T): number; + /** + *

    Extract an element.

    + * + *

    Extracts the element pointed to by val and erases it from the {@link UniqueSet}.

    + * + * @param val Value to be extracted. + * + * @return A value. + */ + extract(val: T): T; + /** + *

    Extract an element.

    + * + *

    Extracts the element pointed to by key and erases it from the {@link UniqueMap}.

    + * + * @param it An iterator pointing an element to extract. + * + * @return An iterator pointing to the element immediately following it prior to the element being + * erased. If no such element exists,returns {@link end end()}. + */ + extract(it: SetIterator): SetIterator; + /** + *

    Extract an element.

    + * + *

    Extracts the element pointed to by key and erases it from the {@link UniqueMap}.

    + * + * @param it An iterator pointing an element to extract. + * + * @return An iterator pointing to the element immediately following it prior to the element being + * erased. If no such element exists,returns {@link end end()}. + */ + extract(it: SetReverseIterator): SetReverseIterator; + /** + * @hidden + */ + private extract_by_key(val); + /** + * @hidden + */ + private extract_by_iterator(it); + /** + * @hidden + */ + private extract_by_reverse_iterator(it); + /** + *

    Insert an element.

    + * + *

    Extends the container by inserting new elements, effectively increasing the container {@link size} by + * the number of element inserted (zero or one).

    + * + *

    Because elements in a {@link UniqueSet UniqueSets} are unique, the insertion operation checks whether + * each inserted element is equivalent to an element already in the container, and if so, the element is not + * inserted, returning an iterator to this existing element (if the function returns a value).

    + * + *

    For a similar container allowing for duplicate elements, see {@link MultiSet}.

    + * + * @param key Value to be inserted as an element. + * + * @return A {@link Pair}, with its member {@link Pair.first} set to an iterator pointing to either the newly + * inserted element or to the equivalent element already in the {@link UniqueSet}. The + * {@link Pair.second} element in the {@link Pair} is set to true if a new element was inserted or + * false if an equivalent element already existed. + */ + insert(val: T): Pair, boolean>; + /** + * @inheritdoc + */ + insert(hint: SetIterator, val: T): SetIterator; + /** + * @inheritdoc + */ + insert(hint: SetReverseIterator, val: T): SetReverseIterator; + /** + * @inheritdoc + */ + insert>(begin: InputIterator, end: InputIterator): void; + /** + * @inheritdoc + */ + swap(obj: UniqueSet): void; + } +} +declare namespace std.HashSet { + type iterator = std.SetIterator; + type reverse_iterator = std.SetReverseIterator; +} +declare namespace std { + /** + *

    Hashed, unordered set.

    + * + *

    {@link HashSet}s are containers that store unique elements in no particular order, and which + * allow for fast retrieval of individual elements based on their value.

    + * + *

    In an {@link HashSet}, the value of an element is at the same time its key, that + * identifies it uniquely. Keys are immutable, therefore, the elements in an {@link HashSet} cannot be + * modified once in the container - they can be inserted and removed, though.

    + * + *

    Internally, the elements in the {@link HashSet} are not sorted in any particular order, but + * organized into buckets depending on their hash values to allow for fast access to individual elements + * directly by their values (with a constant average time complexity on average).

    + * + *

    {@link HashSet} containers are faster than {@link TreeSet} containers to access individual + * elements by their key, although they are generally less efficient for range iteration through a + * subset of their elements.

    + * + *

    + *

    + * + *

    Container properties

    + *
    + *
    Associative
    + *
    Elements in associative containers are referenced by their key and not by their absolute + * position in the container.
    + * + *
    Hashed
    + *
    Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their key.
    + * + *
    Set
    + *
    The value of an element is also the key used to identify it.
    + * + *
    Unique keys
    + *
    No two elements in the container can have equivalent keys.
    + *
    + * + * @param Type of the elements. + * Each element in an {@link HashSet} is also uniquely identified by this value. + * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_set + * @author Jeongho Nam + */ + class HashSet extends base.UniqueSet { + /** + * @hidden + */ + private hash_buckets_; + /** + * @hidden + */ + protected init(): void; + /** + * @hidden + */ + protected construct_from_array(items: Array): void; + /** + * @inheritdoc + */ + clear(): void; + /** + * @inheritdoc + */ + find(key: T): SetIterator; + /** + * @inheritdoc + */ + begin(): SetIterator; + /** + * @inheritdoc + */ + begin(index: number): SetIterator; + /** + * @inheritdoc + */ + end(): SetIterator; + /** + * @inheritdoc + */ + end(index: number): SetIterator; + /** + * @inheritdoc + */ + rbegin(): SetReverseIterator; + /** + * @inheritdoc + */ + rbegin(index: number): SetReverseIterator; + /** + * @inheritdoc + */ + rend(): SetReverseIterator; + /** + * @inheritdoc + */ + rend(index: number): SetReverseIterator; + /** + * @inheritdoc + */ + bucket_count(): number; + /** + * @inheritdoc + */ + bucket_size(n: number): number; + /** + * @inheritdoc + */ + max_load_factor(): number; + /** + * @inheritdoc + */ + max_load_factor(z: number): void; + /** + * @inheritdoc + */ + bucket(key: T): number; + /** + * @inheritdoc + */ + reserve(n: number): void; + /** + * @inheritdoc + */ + rehash(n: number): void; + /** + * @hidden + */ + protected insert_by_val(val: T): any; + /** + * @hidden + */ + protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + /** + * @hidden + */ + protected insert_by_range>(first: InputIterator, last: InputIterator): void; + /** + * @inheritdoc + */ + protected handle_insert(first: SetIterator, last: SetIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: SetIterator, last: SetIterator): void; + /** + * @inheritdoc + */ + swap(obj: base.UniqueSet): void; + /** + * @hidden + */ + private swap_tree_set(obj); + } +} declare namespace std.List { type iterator = std.ListIterator; type reverse_iterator = std.ListReverseIterator; @@ -6523,8 +6538,8 @@ declare namespace std { * distance between these. They also consume some extra memory to keep the linking information associated to each * element (which may be an important factor for large lists of small-sized elements).

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -6546,15 +6561,15 @@ declare namespace std { */ class List extends base.Container implements base.IDequeContainer { /** - * An iterator of beginning. + * @hidden */ protected begin_: ListIterator; /** - * An iterator of end. + * @hidden */ protected end_: ListIterator; /** - * Number of elements in the {@link List}. + * @hidden */ protected size_: number; /** @@ -7096,8 +7111,8 @@ declare namespace std { /** *

    An iterator, node of a List.

    * - *

    - * + *

    + * *

    * * @author Jeongho Nam @@ -7143,6 +7158,11 @@ declare namespace std { /** * @inheritdoc */ + /** + * Set value of the iterator is pointing to. + * + * @param val Value to set. + */ value: T; /** * @inheritdoc @@ -7158,8 +7178,8 @@ declare namespace std { /** *

    A reverse-iterator of List.

    * - *

    - * + *

    + * *

    * * @param Type of the elements. @@ -7167,13 +7187,20 @@ declare namespace std { * @author Jeongho Nam */ class ListReverseIterator extends ReverseIterator, ListReverseIterator> { + /** + * Construct from base iterator. + * + * @param base A reference of the base iterator, which iterates in the opposite direction. + */ constructor(base: ListIterator); /** - * @inheritdoc + * @hidden */ protected create_neighbor(): ListReverseIterator; /** - * @inheritdoc + * Set value of the iterator is pointing to. + * + * @param val Value to set. */ value: T; } @@ -7208,8 +7235,8 @@ declare namespace std { * By default, if no container class is specified for a particular {@link Queue} class instantiation, the standard * container {@link List} is used.

    * - *

    - * + *

    + * *

    * * @param Type of elements. @@ -7540,8 +7567,8 @@ declare namespace std { * By default, if no container class is specified for a particular {@link Stack} class instantiation, the standard * container {@link List} is used.

    * - *

    - * + *

    + * *

    * * @param Type of elements. @@ -7651,18 +7678,18 @@ declare namespace std.base { * so that they can be interpreted when needed as more abstract (and portable) * {@link ErrorCondition error conditions}.

    * - *

    - *

    + *

    + *

    * * @author Jeongho Nam */ abstract class ErrorInstance { /** - * A reference to an {@link ErrorCategory} object. + * @hidden */ protected category_: ErrorCategory; /** - * A numerical value identifying an error instance. + * @hidden */ protected value_: number; /** @@ -7761,15 +7788,15 @@ declare namespace std { *

    The class inherits from {@link RuntimeError}, to which it adds an {@link ErrorCode} as * member code (and defines a specialized what member).

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/system_error/system_error * @author Jeongho Nam */ class SystemError extends RuntimeError { /** - * Error code. + * @hidden */ protected code_: ErrorCode; /** @@ -7827,8 +7854,8 @@ declare namespace std { * passed by reference. As such, only one object of each of these types shall exist, each uniquely identifying its own * category: all error codes and conditions of a same category shall return a reference to same object.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/system_error/error_category * @author Jeongho Nam @@ -7955,8 +7982,8 @@ declare namespace std { *

    The {@link ErrorCategory categories} associated with the {@link ErrorCondition} and the * {@link ErrorCode} define the equivalences between them.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/system_error/error_condition * @author Jeongho Nam @@ -7988,8 +8015,8 @@ declare namespace std { *

    Objects of this class associate such numerical codes to {@link ErrorCategory error categories}, so that they * can be interpreted when needed as more abstract (and portable) {@link ErrorCondition error conditions}.

    * - *

    - *

    + *

    + *

    * * @reference http://www.cplusplus.com/reference/system_error/error_code * @author Jeongho Nam @@ -8034,8 +8061,8 @@ declare namespace std { * *

    {@link TreeMap}s are typically implemented as binary search trees.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -8063,7 +8090,7 @@ declare namespace std { */ class TreeMap extends base.UniqueMap implements base.ITreeMap { /** - * RB-Tree+ object for implemeting the {@link TreeMap}. + * @hidden */ private tree_; /** @@ -8216,8 +8243,8 @@ declare namespace std { * *

    {@link TreeMultiMap TreeMultiMaps} are typically implemented as binary search trees.

    * - *

    < - * img src="http://samchon.github.io/typescript-stl/api/assets/images/design/map_containers.png" style="max-width: 100%" />

    + *

    < + * img src="http://samchon.github.io/typescript-stl/images/design/class_diagram/map_containers.png" style="max-width: 100%" />

    * *

    Container properties

    *
    @@ -8250,6 +8277,9 @@ declare namespace std { * @author Jeongho Nam */ class TreeMultiMap extends base.MultiMap implements base.ITreeMap { + /** + * @hidden + */ private tree_; /** * Default Constructor. @@ -8377,169 +8407,6 @@ declare namespace std { private swap_tree_multimap(obj); } } -declare namespace std.TreeSet { - type iterator = std.SetIterator; - type reverse_iterator = std.SetReverseIterator; -} -declare namespace std { - /** - *

    Tree-structured set, std::set of STL.

    - * - *

    {@link TreeSet}s are containers that store unique elements following a specific order.

    - * - *

    In a {@link TreeSet}, the value of an element also identifies it (the value is itself the - * key, of type T), and each value must be unique. The value of the elements in a - * {@link TreeSet} cannot be modified once in the container (the elements are always const), but they - * can be inserted or removed from the

    - * - *

    Internally, the elements in a {@link TreeSet} are always sorted following a specific strict weak - * ordering criterion indicated by its internal comparison method (of {@link less}).

    - * - *

    {@link TreeSet} containers are generally slower than {@link HashSet} containers to access - * individual elements by their key, but they allow the direct iteration on subsets based on their - * order.

    - * - *

    {@link TreeSet}s are typically implemented as binary search trees.

    - * - *

    - *

    - * - *

    Container properties

    - *
    - *
    Associative
    - *
    - * Elements in associative containers are referenced by their key and not by their absolute - * position in the container. - *
    - * - *
    Ordered
    - *
    - * The elements in the container follow a strict order at all times. All inserted elements are - * given a position in this order. - *
    - * - *
    Set
    - *
    The value of an element is also the key used to identify it.
    - * - *
    Unique keys
    - *
    No two elements in the container can have equivalent keys.
    - *
    - * - * @param Type of the elements. - * Each element in an {@link TreeSet} is also uniquely identified by this value. - * - * @reference http://www.cplusplus.com/reference/set/set - * @author Jeongho Nam - */ - class TreeSet extends base.UniqueSet implements base.ITreeSet { - /** - * RB-Tree+ object for implemeting the {@link TreeSet}. - */ - private tree_; - /** - * Default Constructor. - */ - constructor(); - /** - * Construct from compare. - * - * @param compare A binary predicate determines order of elements. - */ - constructor(compare: (x: T, y: T) => boolean); - /** - * Contruct from elements. - * - * @param array Elements to be contained. - */ - constructor(array: Array); - /** - * Contruct from elements with compare. - * - * @param array Elements to be contained. - * @param compare A binary predicate determines order of elements. - */ - constructor(array: Array, compare: (x: T, y: T) => boolean); - /** - * Copy Constructor. - */ - constructor(container: base.IContainer); - /** - * Copy Constructor with compare. - * - * @param container A container to be copied. - * @param compare A binary predicate determines order of elements. - */ - constructor(container: base.IContainer, compare: (x: T, y: T) => boolean); - /** - * Range Constructor. - * - * @param begin Input interator of the initial position in a sequence. - * @param end Input interator of the final position in a sequence. - */ - constructor(begin: Iterator, end: Iterator); - /** - * Range Constructor with compare. - * - * @param begin Input interator of the initial position in a sequence. - * @param end Input interator of the final position in a sequence. - * @param compare A binary predicate determines order of elements. - */ - constructor(begin: Iterator, end: Iterator, compare: (x: T, y: T) => boolean); - /** - * @inheritdoc - */ - clear(): void; - /** - * @inheritdoc - */ - find(val: T): SetIterator; - /** - * @inheritdoc - */ - key_comp(): (x: T, y: T) => boolean; - /** - * @inheritdoc - */ - value_comp(): (x: T, y: T) => boolean; - /** - * @inheritdoc - */ - lower_bound(val: T): SetIterator; - /** - * @inheritdoc - */ - upper_bound(val: T): SetIterator; - /** - * @inheritdoc - */ - equal_range(val: T): Pair, SetIterator>; - /** - * @hidden - */ - protected insert_by_val(val: T): any; - protected insert_by_hint(hint: SetIterator, val: T): SetIterator; - /** - * @hidden - */ - protected insert_by_range>(first: InputIterator, last: InputIterator): void; - /** - * @inheritdoc - */ - protected handle_insert(first: SetIterator, last: SetIterator): void; - /** - * @inheritdoc - */ - protected handle_erase(first: SetIterator, last: SetIterator): void; - /** - * @inheritdoc - */ - swap(obj: base.UniqueSet): void; - /** - * @hidden - */ - private swap_tree_set(obj); - } -} declare namespace std.TreeMultiSet { type iterator = std.SetIterator; type reverse_iterator = std.SetReverseIterator; @@ -8565,8 +8432,8 @@ declare namespace std { * *

    {@link TreeMultiSet TreeMultiSets} are typically implemented as binary search trees.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -8597,7 +8464,7 @@ declare namespace std { */ class TreeMultiSet extends base.MultiSet implements base.ITreeSet { /** - * RB-Tree+ object for implemeting the {@link TreeMultiSet}. + * @hidden */ private tree_; /** @@ -8711,6 +8578,169 @@ declare namespace std { private swap_tree_set(obj); } } +declare namespace std.TreeSet { + type iterator = std.SetIterator; + type reverse_iterator = std.SetReverseIterator; +} +declare namespace std { + /** + *

    Tree-structured set, std::set of STL.

    + * + *

    {@link TreeSet}s are containers that store unique elements following a specific order.

    + * + *

    In a {@link TreeSet}, the value of an element also identifies it (the value is itself the + * key, of type T), and each value must be unique. The value of the elements in a + * {@link TreeSet} cannot be modified once in the container (the elements are always const), but they + * can be inserted or removed from the

    + * + *

    Internally, the elements in a {@link TreeSet} are always sorted following a specific strict weak + * ordering criterion indicated by its internal comparison method (of {@link less}).

    + * + *

    {@link TreeSet} containers are generally slower than {@link HashSet} containers to access + * individual elements by their key, but they allow the direct iteration on subsets based on their + * order.

    + * + *

    {@link TreeSet}s are typically implemented as binary search trees.

    + * + *

    + *

    + * + *

    Container properties

    + *
    + *
    Associative
    + *
    + * Elements in associative containers are referenced by their key and not by their absolute + * position in the container. + *
    + * + *
    Ordered
    + *
    + * The elements in the container follow a strict order at all times. All inserted elements are + * given a position in this order. + *
    + * + *
    Set
    + *
    The value of an element is also the key used to identify it.
    + * + *
    Unique keys
    + *
    No two elements in the container can have equivalent keys.
    + *
    + * + * @param Type of the elements. + * Each element in an {@link TreeSet} is also uniquely identified by this value. + * + * @reference http://www.cplusplus.com/reference/set/set + * @author Jeongho Nam + */ + class TreeSet extends base.UniqueSet implements base.ITreeSet { + /** + * @hidden + */ + private tree_; + /** + * Default Constructor. + */ + constructor(); + /** + * Construct from compare. + * + * @param compare A binary predicate determines order of elements. + */ + constructor(compare: (x: T, y: T) => boolean); + /** + * Contruct from elements. + * + * @param array Elements to be contained. + */ + constructor(array: Array); + /** + * Contruct from elements with compare. + * + * @param array Elements to be contained. + * @param compare A binary predicate determines order of elements. + */ + constructor(array: Array, compare: (x: T, y: T) => boolean); + /** + * Copy Constructor. + */ + constructor(container: base.IContainer); + /** + * Copy Constructor with compare. + * + * @param container A container to be copied. + * @param compare A binary predicate determines order of elements. + */ + constructor(container: base.IContainer, compare: (x: T, y: T) => boolean); + /** + * Range Constructor. + * + * @param begin Input interator of the initial position in a sequence. + * @param end Input interator of the final position in a sequence. + */ + constructor(begin: Iterator, end: Iterator); + /** + * Range Constructor with compare. + * + * @param begin Input interator of the initial position in a sequence. + * @param end Input interator of the final position in a sequence. + * @param compare A binary predicate determines order of elements. + */ + constructor(begin: Iterator, end: Iterator, compare: (x: T, y: T) => boolean); + /** + * @inheritdoc + */ + clear(): void; + /** + * @inheritdoc + */ + find(val: T): SetIterator; + /** + * @inheritdoc + */ + key_comp(): (x: T, y: T) => boolean; + /** + * @inheritdoc + */ + value_comp(): (x: T, y: T) => boolean; + /** + * @inheritdoc + */ + lower_bound(val: T): SetIterator; + /** + * @inheritdoc + */ + upper_bound(val: T): SetIterator; + /** + * @inheritdoc + */ + equal_range(val: T): Pair, SetIterator>; + /** + * @hidden + */ + protected insert_by_val(val: T): any; + protected insert_by_hint(hint: SetIterator, val: T): SetIterator; + /** + * @hidden + */ + protected insert_by_range>(first: InputIterator, last: InputIterator): void; + /** + * @inheritdoc + */ + protected handle_insert(first: SetIterator, last: SetIterator): void; + /** + * @inheritdoc + */ + protected handle_erase(first: SetIterator, last: SetIterator): void; + /** + * @inheritdoc + */ + swap(obj: base.UniqueSet): void; + /** + * @hidden + */ + private swap_tree_set(obj); + } +} declare namespace std { /** *

    Running on Node.

    @@ -8818,8 +8848,8 @@ declare namespace std { * end, they perform worse than the others, and have less consistent iterators and references than {@link List}s. *

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -9200,8 +9230,8 @@ declare namespace std { /** *

    An iterator of Vector.

    * - *

    - * + *

    + * *

    * * @param Type of the elements. @@ -9232,7 +9262,9 @@ declare namespace std { * @inheritdoc */ /** - * Set value. + * Set value of the iterator is pointing to. + * + * @param val Value to set. */ value: T; /** @@ -9277,8 +9309,8 @@ declare namespace std { /** *

    A reverse-iterator of Vector.

    * - *

    - * + *

    + * *

    * * @param Type of the elements. @@ -9286,13 +9318,20 @@ declare namespace std { * @author Jeongho Nam */ class VectorReverseIterator extends ReverseIterator, VectorReverseIterator> implements base.IArrayIterator { + /** + * Construct from base iterator. + * + * @param base A reference of the base iterator, which iterates in the opposite direction. + */ constructor(base: VectorIterator); /** - * @inheritdoc + * @hidden */ protected create_neighbor(): VectorReverseIterator; /** - * Set value. + * Set value of the iterator is pointing to. + * + * @param val Value to set. */ value: T; /** @@ -9353,7 +9392,13 @@ declare namespace std.base { * @author Jeongho Nam */ class HashBuckets { + /** + * @hidden + */ private buckets_; + /** + * @hidden + */ private item_size_; /** * Default Constructor. @@ -9400,8 +9445,8 @@ declare namespace std.base { *

    Elements with equivalent keys are grouped together in the same bucket and in such a way that * an iterator can iterate through all of them. Iterators in the container are doubly linked iterators.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -9696,8 +9741,8 @@ declare namespace std.base { /** *

    Hash buckets storing {@link MapIterator MapIterators}.

    * - *

    - * + *

    + * *

    * * @author Jeongho Nam @@ -9727,8 +9772,8 @@ declare namespace std.base { * elements by their key, although they are generally less efficient for range iteration through a * subset of their elements.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -9951,8 +9996,8 @@ declare namespace std.base { /** *

    Hash buckets storing {@link SetIterator SetIterators}.

    * - *

    - * + *

    + * *

    * * @author Jeongho Nam @@ -9993,8 +10038,8 @@ declare namespace std.base { * beginning or the end, {@link IArray} objects perform worse and have less consistent iterators and references * than {@link List Lists}

    . * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -10107,8 +10152,8 @@ declare namespace std.base { *

    There is not a single type of {@link IArrayIterator random-access iterator}: Each container may define its * own specific iterator type able to iterate through it and access its elements.

    * - *

    - * + *

    + * *

    * * @reference http://www.cplusplus.com/reference/iterator/RandomAccessIterator @@ -10138,8 +10183,8 @@ declare namespace std.base { *

    {@link IContainer} is an interface designed for sequence containers. Sequence containers of STL * (Standard Template Library) are based on the {@link IContainer}.

    * - *

    - * + *

    + * *

    * *

    Container properties

    @@ -10330,8 +10375,8 @@ declare namespace std.base { /** *

    An interface for deque

    * - *

    - * + *

    + * *

    * * @author Jeongho Nam @@ -10360,8 +10405,8 @@ declare namespace std.base { /** *

    An interface for linear containers.

    * - *

    - * + *

    + * *

    * * @author Jeonngho Nam @@ -10522,7 +10567,7 @@ declare namespace std.base { * * * - *

    * *

    These constraints enforce a critical property of red-black trees: the path from the root to the farthest @@ -10717,7 +10762,7 @@ declare namespace std.base { * the only loop, and any rotations occur after this loop, this proves that a constant number of rotations * occur.

    * - *

    * * @param N A node to be inserted or swapped. @@ -10751,7 +10796,7 @@ declare namespace std.base { * node are black) is still violated, but now we can resolve this by * continuing to case 5.

    * - *

    * * @param N A node to be inserted or swapped. @@ -10782,7 +10827,7 @@ declare namespace std.base { * through {@link XTreeNode.parent P}. In each case, this is the only * black node of the three.

    * - *

    * * @param N A node to be inserted or swapped. @@ -10936,7 +10981,7 @@ declare namespace std.base { /** *

    {@link XTreeNode.sibling S} is red.

    * - *

    * *

    In this case we reverse the colors of {@link XTreeNode.parent P} and @@ -10958,7 +11003,7 @@ declare namespace std.base { *

    {@link XTreeNode.parent P}, {@link XTreeNode.sibling S}, and {@link XTreeNode.sibling * S}'s children are black.

    * - *

    * *

    In this case, we simply repaint {@link XTreeNode.sibling S} red. The @@ -10982,7 +11027,7 @@ declare namespace std.base { *

    {@link XTreeNode.sibling S} and {@link XTreeNode.sibling S}'s children are * black, but {@link XTreeNode.parent P} is red.

    * - *

    * *

    In this case, we simply exchange the colors of {@link XTreeNode.sibling S} and @@ -10999,7 +11044,7 @@ declare namespace std.base { * left child is red, {@link XTreeNode.sibling S}'s right child is * black, and N is the left child of its parent.

    * - *

    * *

    In this case we rotate right at {@link XTreeNode.sibling S}, so that @@ -11038,7 +11083,7 @@ declare namespace std.base { *

    Thus, the paths passing through N pass through one additional * black node.

    * - *

    * *

    Meanwhile, if a path does not go through N, then there are two possibilities:

    @@ -11122,8 +11167,8 @@ declare namespace std.base { * *

    {@link ITreeMap TreeMultiMaps} are typically implemented as binary search trees.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -11257,13 +11302,19 @@ declare namespace std.base { /** *

    A red-black tree storing {@link MapIterator MapIterators}.

    * - *

    - *

    + *

    + *

    * * @author Jeongho Nam */ class PairTree extends XTree> { + /** + * @hidden + */ private map_; + /** + * @hidden + */ private compare_; /** * Default Constructor. @@ -11409,8 +11460,8 @@ declare namespace std.base { * *

    {@link ITreeSet TreeMultiSets} are typically implemented as binary search trees.

    * - *

    - *

    + *

    + *

    * *

    Container properties

    *
    @@ -11551,13 +11602,19 @@ declare namespace std.base { /** *

    A red-black Tree storing {@link SetIterator SetIterators}.

    * - *

    - *

    + *

    + *

    * * @author Jeongho Nam */ class AtomicTree extends XTree> { + /** + * @hidden + */ private set_; + /** + * @hidden + */ private compare_; /** * Default Constructor. @@ -11738,27 +11795,3 @@ declare namespace std.base { uncle: XTreeNode; } } -declare namespace std.example { - function test_all(): void; -} -declare namespace std.example { - function test_bind(): void; -} -declare namespace std.example { - function test_deque(): void; -} -declare namespace std.example { - function test_for_each(): void; -} -declare namespace std.example { - function test_hash_map(): void; -} -declare namespace std.example { - function test_list(): void; -} -declare namespace std.example { - function sorting(): void; -} -declare namespace std.example { - function tree_set(): void; -} From 1003a9ce5250b8fe374cca07c21a19ea474622b2 Mon Sep 17 00:00:00 2001 From: jcbmln Date: Fri, 12 Aug 2016 03:36:34 -0500 Subject: [PATCH 035/203] Add type definition for koa-hbs (#10579) --- koa-hbs/koa-hbs-tests.ts | 21 +++++++++++++++ koa-hbs/koa-hbs.d.ts | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 koa-hbs/koa-hbs-tests.ts create mode 100644 koa-hbs/koa-hbs.d.ts diff --git a/koa-hbs/koa-hbs-tests.ts b/koa-hbs/koa-hbs-tests.ts new file mode 100644 index 0000000000..373c3ab8b9 --- /dev/null +++ b/koa-hbs/koa-hbs-tests.ts @@ -0,0 +1,21 @@ +/// +/// + +import * as Hbs from 'koa-hbs'; +import * as Koa from 'koa'; +import * as Path from 'path'; + +const app = new Koa(); +const hbs = new Hbs(); + +app.use(hbs.middleware({ + viewPath: Path.join(__dirname, './views') +})); + +app.use(function *(next: any) { + yield this.render('index', { + title: 'Hello World!' + }); +}); + +app.listen(3000); diff --git a/koa-hbs/koa-hbs.d.ts b/koa-hbs/koa-hbs.d.ts new file mode 100644 index 0000000000..cd8fc9c5b4 --- /dev/null +++ b/koa-hbs/koa-hbs.d.ts @@ -0,0 +1,55 @@ +// Type definitions for koa-favicon v2.x +// Project: https://github.com/gilt/koa-hbs +// Definitions by: Jacob Malone +// Definitions: https://github.com/jcbmln/DefinitelyTyped + +/* =================== USAGE =================== + + import * as Hbs from "koa-hbs"; + import * as Koa from "koa"; + + var hbs = new Hbs(); + var app = new Koa(); + + app.use(hbs.middleware({ + viewPath: __dirname + '/views' + })); + + app.use(function *() { + yield this.render('main', { + title: 'koa-hbs' + }); + }); + + =============================================== */ + +/// + +declare module "koa-hbs" { + + import * as Koa from "koa"; + + namespace Hbs { + export interface Middleware { + viewPath: Array | string, + handlebars?: Function, + templateOptions?: {}, + extname?: string, + partialsPath?: Array | string, + defaultLayout?: string, + layoutsPath?: string, + contentHelperName?: string, + blockHelperName?: string, + disableCache?: boolean + } + } + + class Hbs { + constructor(); + + middleware(opts: Hbs.Middleware): any; + } + + namespace Hbs {} + export = Hbs; +} From e4d53c60ada4ca2ba38c8271b81caa9379761cff Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 11:55:28 +0200 Subject: [PATCH 036/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 4ea165814f..451e3d248b 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -5754,6 +5754,17 @@ interface HighchartsChartObject { * @since 1.2.0 */ hideLoading(): void; + /** + * Returns true if there are data points within the plot area now + * @return {boolean} If chart has any data. + * @since 3.0.8 + */ + hasData(): boolean; + /** + * Hide the 'No data to display' message added by the no-data-to-display plugin. + * @since 3.0.8 + */ + hideNoData(): void; /** * The options structure for the chart. * @since 1.2.0 @@ -5802,6 +5813,12 @@ interface HighchartsChartObject { * @since 2.1.0 */ setTitle(title: HighchartsTitleOptions, subtitle?: HighchartsSubtitleOptions, redraw?: boolean): void; + /** + * Display a no-data message. + * @param {String} message An optional message to show in place of the default one + * @since 3.0.8 + */ + showNoData(message?: string): void; /** * Dim the chart's plot area and show a loading label text. Options for the loading screen are defined at * options.loading. A custom text can be given as a parameter for loading. From 4a76c899385aefbd0f629dad03f463d7c8b433d1 Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 12 Aug 2016 07:26:42 -0400 Subject: [PATCH 037/203] Rename bootstrap-datepicker to match npm package Fixes #10572 --- .../bootstrap-datepicker-tests.ts | 2 +- .../bootstrap-datepicker.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename bootstrap.datepicker/bootstrap.datepicker-tests.ts => bootstrap-datepicker/bootstrap-datepicker-tests.ts (98%) rename bootstrap.datepicker/bootstrap.datepicker.d.ts => bootstrap-datepicker/bootstrap-datepicker.d.ts (98%) diff --git a/bootstrap.datepicker/bootstrap.datepicker-tests.ts b/bootstrap-datepicker/bootstrap-datepicker-tests.ts similarity index 98% rename from bootstrap.datepicker/bootstrap.datepicker-tests.ts rename to bootstrap-datepicker/bootstrap-datepicker-tests.ts index b275ee25a8..d290a5b8fa 100644 --- a/bootstrap.datepicker/bootstrap.datepicker-tests.ts +++ b/bootstrap-datepicker/bootstrap-datepicker-tests.ts @@ -1,4 +1,4 @@ -/// +/// function tests_simple() { $('#datepicker').datepicker(); diff --git a/bootstrap.datepicker/bootstrap.datepicker.d.ts b/bootstrap-datepicker/bootstrap-datepicker.d.ts similarity index 98% rename from bootstrap.datepicker/bootstrap.datepicker.d.ts rename to bootstrap-datepicker/bootstrap-datepicker.d.ts index f60a0ffed6..1a2bb2124b 100644 --- a/bootstrap.datepicker/bootstrap.datepicker.d.ts +++ b/bootstrap-datepicker/bootstrap-datepicker.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bootstrap.datepicker +// Type definitions for bootstrap-datepicker // Project: https://github.com/eternicode/bootstrap-datepicker // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 123ff34937aabde67b4a3e7845a011497e193845 Mon Sep 17 00:00:00 2001 From: Teun Zengerink Date: Fri, 12 Aug 2016 14:13:19 +0200 Subject: [PATCH 038/203] Add width to IDialogOptions --- ng-dialog/ng-dialog.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index 42d7821d4a..931dbab188 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -222,6 +222,11 @@ declare namespace angular.dialog { * If specified, the first matching element is used. */ ariaDescribedBySelector?: string; + + /** + * Specifies the width of the dialog content element. Default value is null (unspecified) + */ + width?: string|number; } /** From 508e5b07915f9e97c602a48262f4f5b9e381cbb0 Mon Sep 17 00:00:00 2001 From: Teun Zengerink Date: Fri, 12 Aug 2016 14:14:21 +0200 Subject: [PATCH 039/203] Add draw to Pikaday --- pikaday/pikaday.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pikaday/pikaday.d.ts b/pikaday/pikaday.d.ts index 913ea69613..efa000fad9 100644 --- a/pikaday/pikaday.d.ts +++ b/pikaday/pikaday.d.ts @@ -102,6 +102,11 @@ declare class Pikaday { */ setEndRange(date: Date): void; + /** + * Update the HTML. + */ + draw(force: boolean): void; + /** * Returns true if the picker is visible. */ @@ -249,7 +254,7 @@ declare namespace Pikaday { * Render the month after the year in the title. Default: false. */ showMonthAfterYear?: boolean; - + /** * Render days of the calendar grid that fall in the next or previous months to the current month instead of rendering an empty table cell. Default: false. */ From 0957d02747f89a0c3d21710ff2e8a3f04f097c10 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Fri, 12 Aug 2016 15:30:00 +0300 Subject: [PATCH 040/203] domurl type defs added --- domurl/domurl-tests.ts | 80 ++++++++++++++++++++++++++++++++++++++++++ domurl/domurl.d.ts | 30 ++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 domurl/domurl-tests.ts create mode 100644 domurl/domurl.d.ts diff --git a/domurl/domurl-tests.ts b/domurl/domurl-tests.ts new file mode 100644 index 0000000000..20070b0395 --- /dev/null +++ b/domurl/domurl-tests.ts @@ -0,0 +1,80 @@ +/// + +interface UModel extends QueryString { + a: any; + b: string; +} + +interface U2Model extends QueryString { + a: any; +} + +interface U3Model extends QueryString { + foo: string; +} + +var u = new Url(); // current document URL will be used +// or we can instantiate as +var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); +// it should support relative URLs also +var u3 = new Url("/my/site/doc/path?foo=bar#baz"); + +// get the value of some query string parameter +alert(u2.query.a); +// or +alert(u3.query["foo"]); + +// Manipulating query string parameters +u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3 +u.query.b = 'woohoo'; // adds/replaces in query string param b=woohoo + +if (u.query.a instanceof Array) { // the way to add a parameter + u.query.a.push(4); // now it's "a=1&a=2&a=3&a=4&b=woohoo" +} + +else { // if not an array but scalar value here is a way how to convert to array + u.query.a = [u.query.a]; + u.query.a.push(8) +} + + +// The way to remove the parameter: +delete u.query.a; +// or: +delete u.query["a"]; + +// If you need to remove all query string params: +u.query.clear(); +alert(u); + +// Lookup URL parts: +alert( + 'protocol = ' + u.protocol + '\n' + + 'user = ' + u.user + '\n' + + 'pass = ' + u.pass + '\n' + + 'host = ' + u.host + '\n' + + 'port = ' + u.port + '\n' + + 'path = ' + u.path + '\n' + + 'query = ' + u.query + '\n' + + 'hash = ' + u.hash +); + +// Manipulating URL parts +u.path = '/some/new/path'; // the way to change URL path +u.protocol = 'https'; // the way to force https protocol on the source URL + +// inject into string +var str = 'My Cool Link'; + +// or use in DOM context +var a = document.createElement('a'); +a.href = u.toString(); +a.innerHTML = 'test'; +document.body.appendChild(a); + +// Stringify +var su1 = u + ''; +var su2 = String(u); +var su3 = u.toString(); +// NOTE, that usually it will be done automatically, so only in special +// cases direct stringify is required diff --git a/domurl/domurl.d.ts b/domurl/domurl.d.ts new file mode 100644 index 0000000000..ad1051d7fb --- /dev/null +++ b/domurl/domurl.d.ts @@ -0,0 +1,30 @@ +// Type definitions for domurl +// Project: https://github.com/Mikhus/domurl +// Definitions by: Mykhailo Stadnyk +// Definitions: https://github.com/Mikhus/DefinitelyTyped + +interface QueryString { + (qs?: string); + toString(): string; +} + +declare class Url { + constructor(url?: string); + query: T; + protocol: string; + user: string; + pass: string; + host: string; + port: string; + path: string; + hash: string; + href: string; + toString(): string; + encode(s: string): string; + decode(s: string): string; + isAbsolute(): boolean; + paths(paths?: [string]): [string]; + isEmptyQuery(): boolean; + queryLength(): number; + clearQuery(): Url; +} From 75f71e27750bd0daa5b2d7b423d1a8fe1cc4b6c0 Mon Sep 17 00:00:00 2001 From: Maksym Butsykin Date: Fri, 12 Aug 2016 15:33:43 +0300 Subject: [PATCH 041/203] Add type definition for angular-es --- angular-es/angular-es-tests.ts | 157 +++++++++++++++++++++++++++++ angular-es/angular-es.d.ts | 179 +++++++++++++++++++++++++++++++++ 2 files changed, 336 insertions(+) create mode 100644 angular-es/angular-es-tests.ts create mode 100644 angular-es/angular-es.d.ts diff --git a/angular-es/angular-es-tests.ts b/angular-es/angular-es-tests.ts new file mode 100644 index 0000000000..9565c3ef70 --- /dev/null +++ b/angular-es/angular-es-tests.ts @@ -0,0 +1,157 @@ +/// + +// +// @Component +// +import { Component } from 'angular-es'; +@Component({ + selector: '', + template: '' +}) +class MyComponentController { + +} + +// +// @Config +// +import { Config } from 'angular-es'; + +@Config +class MyConfig { + +} + +// +// @Constant +// +import { Constant } from 'angular-es'; + +@Constant('MyConstant') +class MyConstant { + foo = 'foo'; + bar = 'bar'; +} + +// +// @Controller +// +import { Controller } from 'angular-es'; + +@Controller('MyController') +class MyController { + +} + +// +// @Decorator +// +import { Decorator } from 'angular-es'; + +@Decorator('MyServiceDecorator') +class MyServiceDecorator { + +} + +// +// @Directive +// +import { Directive } from 'angular-es'; + +@Directive('MyDirective') +class MyDirective { + +} + +// +// @Factory +// +import { Factory } from 'angular-es'; + +@Factory('MyFactory') +class MyFactory { +} + +// +// @Filter +// +import { Filter } from 'angular-es'; + +@Filter('MyFilter') +class MyFilter { +} + +// +// @Inject +// +import { Inject } from 'angular-es'; + +@Inject('fooBar') +class MyService { + + @Inject('bazBar') + myMethod(bazBar) { + } + + constructor(fooBar) { + } +} + +// +// @InjectAsProperty +// +import { InjectAsProperty } from 'angular-es'; + +@InjectAsProperty('fooBar') +class MyService { + fooBar; + + myMethod() { + this.fooBar !== undefined; + } +} + +// +// @Module +// +import { Module, Service } from 'angular-es'; + +@Module('my.module') +@Service('MyService') +class MyService { +} + +// +// @Provider +// +import { Provider } from 'angular-es'; + +@Provider('MyProvider') +class MyProvider { +} + +// +// @Run +// +import { Run } from 'angular-es'; + +@Run +class MyRunBlock { +} + +// +// @Service +// +import { Service } from 'angular-es'; + +@Service('MyService') +class MyService { +} +// +// @Value +// +import { Value } from 'angular-es'; + +@Value('MyValue') +class MyValue { +} diff --git a/angular-es/angular-es.d.ts b/angular-es/angular-es.d.ts new file mode 100644 index 0000000000..dbe1c7afdd --- /dev/null +++ b/angular-es/angular-es.d.ts @@ -0,0 +1,179 @@ +// Type definitions for angular-es v0.0.3 +// Project: https://github.com/mbutsykin/angular-es +// Definitions by: mbutsykin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'angular-es' { + + /** + * Decorated target + */ + interface ngESDecorator { + target: Object|Function, + ngName?: string, + ngArguments?: Array, + ngType?: string, + injectAsProperty?: Array; + } + + /** + * Component interface + * @see https://docs.angularjs.org/guide/component + */ + interface iComponent { + template: string, + selector: string, + controllerAs?: string, + require?: string, + templateUrl?: string, + transclude?: string, + bindings?: Object + } + + /** + * Register component + * + * @param {Object} component - component config + * + * @returns {ngESDecorator} - decorated class + */ + var Component: (component: iComponent) => ngESDecorator; + + /** + * Register config block + */ + var Config: () => ngESDecorator; + + /** + * Register constant + * + * @param {string} name - constant name + * + * @returns {ngESDecorator} - decorated class + */ + var Constant: (name: string) => ngESDecorator; + + /** + * Register controller + * + * @param {string} name - controller name + * + * @returns {ngESDecorator} - decorated class + */ + var Controller: (name: string) => ngESDecorator; + + /** + * Register decorator + * + * @param {string} name - provider name to decorate + * + * @returns {ngESDecorator} - decorated class + */ + var Decorator: (name: string) => ngESDecorator; + + /** + * Register directive + * + * @param {string} name - directive selector, can be in hyphen-case + * + * @returns {ngESDecorator} - decorated class + */ + var Directive: (name: string) => ngESDecorator; + + /** + * Register factory + * + * @param {string} name - factory name + * + * @returns {ngESDecorator} - decorated class + */ + var Factory: (name: string) => ngESDecorator; + + /** + * Register filter + * + * @param {string} name - filter name + * + * @returns {ngESDecorator} - decorated class + */ + var Filter: (name: string) => ngESDecorator; + + /** + * Add $inject property to target + * + * @param {Array} dependencies - dependencies to inject + * + * @returns {ngESDecorator} - decorated class + */ + var Inject: (...dependencies: Array) => ngESDecorator; + + /** + * Inject dependencies as properties to target + * + * @param {Array} dependencies - dependencies to inject + * + * @returns {ngESDecorator} - decorated class + */ + var InjectAsProperty: (...dependencies: Array) => ngESDecorator; + + /** + * Attach target to the specified module + * + * @param {string} name - module name + * + * @returns {ngESDecorator} - decorated class + */ + var Module: (name: string) => ngESDecorator; + + /** + * Register provider + * + * @param {string} name - provider name + * + * @returns {ngESDecorator} - decorated class + */ + var Provider: (name: string) => ngESDecorator; + + /** + * Register run block + * + * @returns {ngESDecorator} - decorated class + */ + var Run: () => ngESDecorator; + + /** + * Register service + * + * @param {string} name - service name + * + * @returns {ngESDecorator} - decorated class + */ + var Service: (name: string) => ngESDecorator; + + /** + * Register value + * + * @param {string} name - value name + * + * @returns {ngESDecorator} - decorated class + */ + var Value: (name: string) => ngESDecorator; + + export { + Component, + Config, + Constant, + Controller, + Decorator, + Directive, + Factory, + Filter, + Inject, + InjectAsProperty + Module, + Provider, + Run, + Service, + Value, + } +} From fb27145ccd04b3947163cdfef4253eb92444e858 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Fri, 12 Aug 2016 15:36:54 +0300 Subject: [PATCH 042/203] Fixing defs and tests --- domurl/domurl-tests.ts | 3 +-- domurl/domurl.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/domurl/domurl-tests.ts b/domurl/domurl-tests.ts index 20070b0395..fd4895ed5f 100644 --- a/domurl/domurl-tests.ts +++ b/domurl/domurl-tests.ts @@ -44,8 +44,7 @@ delete u.query.a; delete u.query["a"]; // If you need to remove all query string params: -u.query.clear(); -alert(u); +alert(u.clearQuaery()); // Lookup URL parts: alert( diff --git a/domurl/domurl.d.ts b/domurl/domurl.d.ts index ad1051d7fb..f659ca1843 100644 --- a/domurl/domurl.d.ts +++ b/domurl/domurl.d.ts @@ -1,10 +1,10 @@ // Type definitions for domurl // Project: https://github.com/Mikhus/domurl -// Definitions by: Mykhailo Stadnyk +// Definitions by: Mikhus // Definitions: https://github.com/Mikhus/DefinitelyTyped -interface QueryString { - (qs?: string); +declare class QueryString { + constructor(qs?: string); toString(): string; } From 2f0120be92881eaac339d1dcebb928d88c072592 Mon Sep 17 00:00:00 2001 From: york yao Date: Fri, 12 Aug 2016 20:40:18 +0800 Subject: [PATCH 043/203] add types of devtools-detect --- devtools-detect/devtools-detect-tests.ts | 12 ++++++++++++ devtools-detect/devtools-detect.d.ts | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 devtools-detect/devtools-detect-tests.ts create mode 100644 devtools-detect/devtools-detect.d.ts diff --git a/devtools-detect/devtools-detect-tests.ts b/devtools-detect/devtools-detect-tests.ts new file mode 100644 index 0000000000..9cd1d2f7a7 --- /dev/null +++ b/devtools-detect/devtools-detect-tests.ts @@ -0,0 +1,12 @@ +/// + +// check if it's open +console.log('is DevTools open?', window.devtools.open); +// check it's orientation, null if not open +console.log('and DevTools orientation?', window.devtools.orientation); + +// get notified when it's opened/closed or orientation changes +window.addEventListener('devtoolschange', function (e) { + console.log('is DevTools open?', e.detail.open); + console.log('and DevTools orientation?', e.detail.orientation); +}); diff --git a/devtools-detect/devtools-detect.d.ts b/devtools-detect/devtools-detect.d.ts new file mode 100644 index 0000000000..c66d63f0fa --- /dev/null +++ b/devtools-detect/devtools-detect.d.ts @@ -0,0 +1,16 @@ +// Type definitions for ajv +// Project: https://github.com/sindresorhus/devtools-detect +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type DevTools = { + open: boolean; + orientation: "vertical" | "horizontal"; +} +interface DevToolsEvent extends Event { + detail: DevTools; +} +interface Window { + devtools: DevTools; + addEventListener(type: "devtoolschange", listener: (ev: DevToolsEvent) => any, useCapture?: boolean): void; +} From 3728283b922d017408477dd35eb6a63b66f542b1 Mon Sep 17 00:00:00 2001 From: Maksym Butsykin Date: Fri, 12 Aug 2016 15:41:15 +0300 Subject: [PATCH 044/203] Add type definition for angular-es --- angular-es/angular-es.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-es/angular-es.d.ts b/angular-es/angular-es.d.ts index dbe1c7afdd..2ecf628655 100644 --- a/angular-es/angular-es.d.ts +++ b/angular-es/angular-es.d.ts @@ -169,7 +169,7 @@ declare module 'angular-es' { Factory, Filter, Inject, - InjectAsProperty + InjectAsProperty, Module, Provider, Run, From fcf8e2aedb578db684f6aa3831656d310f05b145 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Fri, 12 Aug 2016 15:44:32 +0300 Subject: [PATCH 045/203] Fixed defs and tests --- domurl/domurl-tests.ts | 2 +- domurl/domurl.d.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/domurl/domurl-tests.ts b/domurl/domurl-tests.ts index fd4895ed5f..0b83b1c491 100644 --- a/domurl/domurl-tests.ts +++ b/domurl/domurl-tests.ts @@ -44,7 +44,7 @@ delete u.query.a; delete u.query["a"]; // If you need to remove all query string params: -alert(u.clearQuaery()); +alert(u.clearQuery()); // Lookup URL parts: alert( diff --git a/domurl/domurl.d.ts b/domurl/domurl.d.ts index f659ca1843..8c418c75cc 100644 --- a/domurl/domurl.d.ts +++ b/domurl/domurl.d.ts @@ -5,7 +5,7 @@ declare class QueryString { constructor(qs?: string); - toString(): string; + toString: () => string; } declare class Url { @@ -19,12 +19,12 @@ declare class Url { path: string; hash: string; href: string; - toString(): string; - encode(s: string): string; - decode(s: string): string; - isAbsolute(): boolean; - paths(paths?: [string]): [string]; - isEmptyQuery(): boolean; - queryLength(): number; - clearQuery(): Url; + toString: () => string; + encode: (s: string) => string; + decode: (s: string) => string; + isAbsolute: () => boolean; + paths: (paths?: [string]) => [string]; + isEmptyQuery: () => boolean; + queryLength: () => number; + clearQuery: () => Url; } From 81508371bd1173fb110086f1de433291e7cda3bb Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Fri, 12 Aug 2016 15:46:44 +0300 Subject: [PATCH 046/203] tests slightly improved --- domurl/domurl-tests.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/domurl/domurl-tests.ts b/domurl/domurl-tests.ts index 0b83b1c491..825dcdd7d0 100644 --- a/domurl/domurl-tests.ts +++ b/domurl/domurl-tests.ts @@ -20,9 +20,9 @@ var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); var u3 = new Url("/my/site/doc/path?foo=bar#baz"); // get the value of some query string parameter -alert(u2.query.a); +console.log(u2.query.a); // or -alert(u3.query["foo"]); +console.log(u3.query["foo"]); // Manipulating query string parameters u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3 @@ -44,10 +44,12 @@ delete u.query.a; delete u.query["a"]; // If you need to remove all query string params: -alert(u.clearQuery()); +console.log(u.clearQuery()); +console.log(u.queryLength()); +console.log(u.isEmptyQuery()); // Lookup URL parts: -alert( +console.log( 'protocol = ' + u.protocol + '\n' + 'user = ' + u.user + '\n' + 'pass = ' + u.pass + '\n' + From 98d68b5fa6592ac4307c48de24c7b21a79a88a63 Mon Sep 17 00:00:00 2001 From: Maksym Butsykin Date: Fri, 12 Aug 2016 15:53:02 +0300 Subject: [PATCH 047/203] Add type definition for angular-es --- angular-es/angular-es.d.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/angular-es/angular-es.d.ts b/angular-es/angular-es.d.ts index 2ecf628655..cce597eb1d 100644 --- a/angular-es/angular-es.d.ts +++ b/angular-es/angular-es.d.ts @@ -5,15 +5,23 @@ declare module 'angular-es' { + interface ClassDecorator { + (target: TFunction): TFunction|void; + } + + interface MethodDecorator { + (target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor|void; + } + /** * Decorated target */ - interface ngESDecorator { - target: Object|Function, - ngName?: string, - ngArguments?: Array, - ngType?: string, - injectAsProperty?: Array; + interface ngESDecorator extends ClassDecorator, MethodDecorator { + (target: Object|Function, + ngName?: string, + ngArguments?: Array, + ngType?: string, + injectAsProperty?: Array); } /** From e4d396d1b0192eb0777edd990de6ed9057c1ef51 Mon Sep 17 00:00:00 2001 From: Maksym Butsykin Date: Fri, 12 Aug 2016 16:01:44 +0300 Subject: [PATCH 048/203] Add type definition for angular-es --- angular-es/angular-es-tests.ts | 20 ++++++++++---------- angular-es/angular-es.d.ts | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/angular-es/angular-es-tests.ts b/angular-es/angular-es-tests.ts index 9565c3ef70..2e44d5d0a8 100644 --- a/angular-es/angular-es-tests.ts +++ b/angular-es/angular-es-tests.ts @@ -17,7 +17,7 @@ class MyComponentController { // import { Config } from 'angular-es'; -@Config +@Config() class MyConfig { } @@ -87,13 +87,13 @@ class MyFilter { import { Inject } from 'angular-es'; @Inject('fooBar') -class MyService { +class MyFooService { @Inject('bazBar') - myMethod(bazBar) { + myMethod(bazBar: Object) { } - constructor(fooBar) { + constructor(fooBar: Object) { } } @@ -103,8 +103,8 @@ class MyService { import { InjectAsProperty } from 'angular-es'; @InjectAsProperty('fooBar') -class MyService { - fooBar; +class MyFooBarService { + fooBar: Object; myMethod() { this.fooBar !== undefined; @@ -114,11 +114,11 @@ class MyService { // // @Module // -import { Module, Service } from 'angular-es'; +import { Module } from 'angular-es'; @Module('my.module') -@Service('MyService') -class MyService { +@Service('MyModuleService') +class MyModuleService { } // @@ -135,7 +135,7 @@ class MyProvider { // import { Run } from 'angular-es'; -@Run +@Run() class MyRunBlock { } diff --git a/angular-es/angular-es.d.ts b/angular-es/angular-es.d.ts index cce597eb1d..10979ae15c 100644 --- a/angular-es/angular-es.d.ts +++ b/angular-es/angular-es.d.ts @@ -21,7 +21,7 @@ declare module 'angular-es' { ngName?: string, ngArguments?: Array, ngType?: string, - injectAsProperty?: Array); + injectAsProperty?: Array): void; } /** From e8eed9cade9a0ce76fd99b66054af072f69d27a0 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 15:52:38 +0200 Subject: [PATCH 049/203] #10342 Added hideNoData/showNoData to highcharts --- ...highcharts-modules-no-data-to-display.d.ts | 22 +++++++++++++++++++ highcharts/highcharts.d.ts | 17 -------------- 2 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 highcharts/highcharts-modules-no-data-to-display.d.ts diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/highcharts-modules-no-data-to-display.d.ts new file mode 100644 index 0000000000..6b8ed03e15 --- /dev/null +++ b/highcharts/highcharts-modules-no-data-to-display.d.ts @@ -0,0 +1,22 @@ +/// +interface HighchartsChartObject { + /** + * Returns true if there are data points within the plot area now + * @return {boolean} If chart has any data. + * @since 3.0.8 + */ + hasData(): boolean; + + /** + * Hide the 'No data to display' message added by the no-data-to-display plugin. + * @since 3.0.8 + */ + hideNoData(): void; + + /** + * Display a no-data message. + * @param {String} message An optional message to show in place of the default one + * @since 3.0.8 + */ + showNoData(message?: string): void; +} diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 451e3d248b..4ea165814f 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -5754,17 +5754,6 @@ interface HighchartsChartObject { * @since 1.2.0 */ hideLoading(): void; - /** - * Returns true if there are data points within the plot area now - * @return {boolean} If chart has any data. - * @since 3.0.8 - */ - hasData(): boolean; - /** - * Hide the 'No data to display' message added by the no-data-to-display plugin. - * @since 3.0.8 - */ - hideNoData(): void; /** * The options structure for the chart. * @since 1.2.0 @@ -5813,12 +5802,6 @@ interface HighchartsChartObject { * @since 2.1.0 */ setTitle(title: HighchartsTitleOptions, subtitle?: HighchartsSubtitleOptions, redraw?: boolean): void; - /** - * Display a no-data message. - * @param {String} message An optional message to show in place of the default one - * @since 3.0.8 - */ - showNoData(message?: string): void; /** * Dim the chart's plot area and show a loading label text. Options for the loading screen are defined at * options.loading. A custom text can be given as a parameter for loading. From bba9c487953d957dc3d4a5c3b9d32bd67c5716c6 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:05:23 +0200 Subject: [PATCH 050/203] #10342 Added hideNoData/showNoData to highcharts --- .../highcharts-modules-no-data-to-display-tests.ts | 9 +++++++++ highcharts/highcharts-modules-no-data-to-display.d.ts | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 highcharts/highcharts-modules-no-data-to-display-tests.ts diff --git a/highcharts/highcharts-modules-no-data-to-display-tests.ts b/highcharts/highcharts-modules-no-data-to-display-tests.ts new file mode 100644 index 0000000000..9b1d69b8da --- /dev/null +++ b/highcharts/highcharts-modules-no-data-to-display-tests.ts @@ -0,0 +1,9 @@ +/// +/// + +function test_NoDataToDisplay() { + var chart = $("#container").highcharts(); + var chartHasData = chart.hasData(); + chart.hideNoData(); + chart.showNoData("Custom no data message"); +} diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/highcharts-modules-no-data-to-display.d.ts index 6b8ed03e15..c1429efe78 100644 --- a/highcharts/highcharts-modules-no-data-to-display.d.ts +++ b/highcharts/highcharts-modules-no-data-to-display.d.ts @@ -1,4 +1,4 @@ -/// +// interface HighchartsChartObject { /** * Returns true if there are data points within the plot area now From 6dcc2fe492f45659b4b7d5bda73530c982715c38 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:07:23 +0200 Subject: [PATCH 051/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts-modules-no-data-to-display.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/highcharts-modules-no-data-to-display.d.ts index c1429efe78..120acede4c 100644 --- a/highcharts/highcharts-modules-no-data-to-display.d.ts +++ b/highcharts/highcharts-modules-no-data-to-display.d.ts @@ -1,3 +1,7 @@ +// Type definitions for Highcharts No Data to Display +// Project: http://www.highcharts.com/ +// Definitions by: Andrey Zolotin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // interface HighchartsChartObject { /** From 1234549417e07d3fb1dbb6a269bd2c2e3ff83bb6 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:11:16 +0200 Subject: [PATCH 052/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts-modules-no-data-to-display.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/highcharts-modules-no-data-to-display.d.ts index 120acede4c..d1910675cd 100644 --- a/highcharts/highcharts-modules-no-data-to-display.d.ts +++ b/highcharts/highcharts-modules-no-data-to-display.d.ts @@ -2,7 +2,7 @@ // Project: http://www.highcharts.com/ // Definitions by: Andrey Zolotin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// +// interface HighchartsChartObject { /** * Returns true if there are data points within the plot area now From 7fe81784e0d55f8d8080c7fbb75cfdbb4af6e161 Mon Sep 17 00:00:00 2001 From: Roman Reshetnikov Date: Fri, 12 Aug 2016 17:26:20 +0300 Subject: [PATCH 053/203] DevExpress ASP.NET 16.1.5 --- devexpress-web/devexpress-web.d.ts | 847 +++++++++++++++++++---------- 1 file changed, 549 insertions(+), 298 deletions(-) diff --git a/devexpress-web/devexpress-web.d.ts b/devexpress-web/devexpress-web.d.ts index 6671a45ec4..c2e0014f85 100644 --- a/devexpress-web/devexpress-web.d.ts +++ b/devexpress-web/devexpress-web.d.ts @@ -250,6 +250,9 @@ interface ASPxClientDashboardItemWidgetCreatedEventHandler { */ (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; } +/** + * References a method that will handle the ItemWidgetUpdating event. + */ interface ASPxClientDashboardItemWidgetUpdatingEventHandler { /** * References a method that will handle the ItemWidgetUpdating event. @@ -258,6 +261,9 @@ interface ASPxClientDashboardItemWidgetUpdatingEventHandler { */ (source: S, e: ASPxClientDashboardItemWidgetEventArgs): void; } +/** + * References a method that will handle the ItemWidgetUpdated event. + */ interface ASPxClientDashboardItemWidgetUpdatedEventHandler { /** * References a method that will handle the ItemWidgetUpdated event. @@ -616,6 +622,11 @@ interface ASPxClientDashboardDesigner extends ASPxClientControl { * Occurs after a dashboard displayed in the ASPxClientDashboardDesigner is changed. */ DashboardChanged: ASPxClientEvent>; + /** + * For internal use. + */ + CustomizeMenuItems: ASPxClientEvent>; + BeforeRender: ASPxClientEvent>; /** * Switches the ASPxClientDashboardDesigner to the viewer mode. */ @@ -650,6 +661,9 @@ interface ASPxClientDashboardDesigner extends ASPxClientControl { */ SaveDashboard(): void; } +/** + * References a method that will handle the DashboardStateChanged event. + */ interface ASPxClientDashboardStateChangedEventHandler { /** * References a method that will handle the DashboardStateChanged event. @@ -668,6 +682,9 @@ interface ASPxClientDashboardStateChangedEventArgs extends ASPxClientEventArgs { */ DashboardState: string; } +/** + * References a method that will handle the DashboardChanged event. + */ interface ASPxClientDashboardChangedEventHandler { /** * References a method that will handle the DashboardChanged event. @@ -691,6 +708,26 @@ interface ASPxClientDashboardChangedEventArgs extends ASPxClientEventArgs { */ DashboardName: string; } +interface ASPxClientDashboardDesignerCustomizeMenuItemsEventHandler { + (source: S, e: ASPxClientDashboardDesignerCustomizeMenuItemsEventArgs): void; +} +interface ASPxClientDashboardDesignerMenuItem { + id: string; + title: string; + template: string; + selected: boolean; + disabled: boolean; + hasSeparator: boolean; + click: Function; + hotKey: number; +} +interface ASPxClientDashboardDesignerCustomizeMenuItemsEventArgs extends ASPxClientEventArgs { + Items: ASPxClientDashboardDesignerMenuItem[]; + FindById(itemId: string): ASPxClientDashboardDesignerMenuItem; +} +interface ASPxClientDashboardDesignerBeforeRenderEventHandler { + (source: S, e: ASPxClientEventArgs): void; +} /** * A client-side equivalent of the ASPxDashboardViewer control. */ @@ -1332,6 +1369,9 @@ interface ASPxClientDashboardActionAvailabilityChangedEventArgs extends ASPxClie */ ItemActions: ASPxClientDashboardItemAction[]; } +/** + * References a method that will handle the DataLoadingError event. + */ interface ASPxClientDashboardDataLoadingErrorEventHandler { /** * References a method that will handle the DataLoadingError event. @@ -1630,11 +1670,11 @@ interface ASPxClientBinaryImage extends ASPxClientEdit { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param parameter A string value that contains any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * Represents the client-side equivalent of the ASPxButton control. @@ -2482,8 +2522,8 @@ interface ASPxClientListEdit extends ASPxClientEdit { */ interface ASPxClientListEditItem { /** - * Gets a value that indicates whether a list box item is selected. - * Value: true if a list box item is selected; otherwise, false. + * Gets a value that indicates whether a list edit item is selected. + * Value: true if a list edit item is selected; otherwise, false. */ selected: boolean; /** @@ -3367,11 +3407,11 @@ interface ASPxClientGaugeControl extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * Represents the client ASPxGridView. @@ -6159,7 +6199,7 @@ interface ASPxClientVerticalGrid extends ASPxClientGridBase { */ RowSorting: ASPxClientEvent>; /** - * Fires on the client side before the expansion state of a row is changed via end-user interaction. + * Fires on the client side before the expansion state of a row is changed by end-user interaction. */ RowExpandedChanging: ASPxClientEvent>; /** @@ -7406,6 +7446,27 @@ interface ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments extends ASPxCli */ interface ASPxClientHtmlEditorChangeYouTubeVideoCommandArguments extends ASPxClientHtmlEditorInsertYouTubeVideoCommandArguments { } +/** + * A method that will handle the DialogInitialized client event. + */ +interface ASPxClientHtmlEditorDialogInitializedEventHandler { + /** + * A method that will handle the client DialogInitialized event. + * @param source An object representing the event's source. + * @param e An ASPxClientHtmlEditorDialogInitializedEventArgs object that contains event data. + */ + (source: S, e: ASPxClientHtmlEditorDialogInitializedEventArgs): void; +} +/** + * Provides data for the DialogInitialized client event. + */ +interface ASPxClientHtmlEditorDialogInitializedEventArgs extends ASPxClientEventArgs { + /** + * Gets the name of the dialog that has been initialized. + * Value: A string value that is the name of the initialized dialog. + */ + dialogName: string; +} /** * A method that will handle the CommandExecuting event. */ @@ -7634,6 +7695,10 @@ interface ASPxClientHtmlEditorBeforePasteEventArgs extends ASPxClientEventArgs { * Represents a client-side equivalent of the ASPxHtmlEditor control. */ interface ASPxClientHtmlEditor extends ASPxClientControl { + /** + * Occurs on the client side after a dialog has been initialized. + */ + DialogInitialized: ASPxClientEvent>; /** * Occurs before a default or custom command has been executed and allows you to cancel the action. */ @@ -7797,7 +7862,7 @@ interface ASPxClientHtmlEditor extends ASPxClientControl { */ SetToolbarDropDownItemPickerValue(commandName: string, value: string): void; /** - * Specifies the visibility of a ribbon context tab ?ategory specified by its name. + * Specifies the visibility of a ribbon context tab category specified by its name. * @param categoryName A Name property value of the required category. * @param active true to make a category visible; false to make it hidden. */ @@ -7958,11 +8023,11 @@ interface ASPxClientPivotGrid extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } /** * A method that will handle the CellDblClick event. @@ -8239,11 +8304,11 @@ interface ASPxClientRichEdit extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** * Indicates whether any unsaved changes are contained in the current document. */ @@ -9122,11 +9187,7 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ toggleTableCellBottomBorder: ToggleTableCellBottomBorderCommand; - /** - * Gets a command to toggle left borders for selected cells on/off. - * Value: A object that provides methods for executing the command and checking its state. - */ - toggleTableCellsLeftBorder: ToggleTableCellsLeftBorderCommand; + toggleTableCellLeftBorder: ToggleTableCellLeftBorderCommand; /** * Gets a command to remove the borders of the selected table cells. * Value: A object that provides methods for executing the command and checking its state. @@ -9202,6 +9263,7 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ replaceNext: ReplaceNextCommand; + openSpellingDialog: OpenSpellingDialogCommand; } /** * Serves as a base for objects that implement different client command functionalities. @@ -10814,10 +10876,10 @@ interface OpenPageMarginsDialogCommand extends CommandWithSimpleStateBase { */ interface ChangePageOrientationCommand extends CommandBase { /** - * Executes the ChangePageOrientationCommand command by applying the specified setting. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. - * @param isPortrait true to apply portrait page orientation, false to apply landscape page orientation. + * + * @param isPortrait */ - execute(isPortrait: boolean): boolean; + execute(isPortrait: any): boolean; /** * Gets information about the command state. */ @@ -11428,6 +11490,9 @@ declare enum ParagraphFirstLineIndent { Indented=1, Hanging=2 } +interface OpenSpellingDialogCommand extends CommandWithSimpleStateBase { + execute(): boolean; +} /** * A command to invoke the Insert Table dialog. */ @@ -11519,7 +11584,7 @@ interface ChangeTableColumnPreferredWidthCommand extends CommandBase { interface ChangeTableCellFormattingCommand extends CommandBase { /** * Executes the ChangeTableCellFormattingCommand command by applying the specified setting. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. - * @param settings A TableFormattingSettings object specifying ?ell formatting of the selected table elements. + * @param settings A TableFormattingSettings object specifying cell formatting of the selected table elements. */ execute(settings: TableCellFormattingSettings): boolean; /** @@ -11656,7 +11721,7 @@ interface SplitTableCellsDialogCommand extends CommandWithSimpleStateBase { /** * A command to split the selected table cells based on the specified options. */ -interface SplitTableCellsCommand extends CommandBase { +interface SplitTableCellsCommand extends CommandWithSimpleStateBase { /** * Executes the SplitTableCellsCommand command by applying the specified settings. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. * @param rowCount An integer value specifying number of rows in the splitted table cells. @@ -11664,10 +11729,6 @@ interface SplitTableCellsCommand extends CommandBase { * @param mergeBeforeSplit true to merge the selected cells before splitting; otherwise, false. */ execute(rowCount: number, columnCount: number, mergeBeforeSplit: boolean): boolean; - /** - * Gets information about the command state. - */ - getState(): SimpleCommandState; } /** * A command to insert table cells with a vertical shift into the selected table. @@ -11829,13 +11890,7 @@ interface ToggleTableCellBottomBorderCommand extends CommandWithBooleanStateBase */ execute(): boolean; } -/** - * A command to toggle left borders for selected cells on/off. - */ -interface ToggleTableCellsLeftBorderCommand extends CommandWithBooleanStateBase { - /** - * Executes the ToggleTableCellsLeftBorderCommand command by imitating the corresponding end-user action made in the RichEdit's UI. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. - */ +interface ToggleTableCellLeftBorderCommand extends CommandWithBooleanStateBase { execute(): boolean; } /** @@ -12202,10 +12257,6 @@ interface TableHeightUnit { * Value: An integer value specifying the table height. */ value: number; - /** - * Gets or sets the unit type for the table height. - * Value: One of the values. - */ type: any; } declare enum TableHeightUnitType { @@ -12816,18 +12867,42 @@ interface ASPxClientAppointment { * A client point object. */ interface ASPxClientPoint { + /** + * Gets the point's X-coordinate. + */ GetX(): number; + /** + * Gets the point's Y-coordinate. + */ GetY(): number; } /** * A client rectangle object. */ interface ASPxClientRect { + /** + * Gets the X-coordinate of the rectangle's left edge. + */ GetLeft(): number; + /** + * Gets the X-coordinate of the rectangle's right edge. + */ GetRight(): number; + /** + * Gets the Y-coordinate of the rectangle's top edge. + */ GetTop(): number; + /** + * Gets the Y-coordinate of the rectangle's bottom edge. + */ GetBottom(): number; + /** + * Gets the rectangle's width. + */ GetWidth(): number; + /** + * Gets the rectangle's height. + */ GetHeight(): number; } /** @@ -13078,10 +13153,13 @@ interface ASPxClientWeekOfMonth { * Represents a client-side equivalent of the WeekDaysCheckEdit control. */ interface ASPxClientWeekDaysCheckEdit extends ASPxClientControl { + /** + * Gets the selection state of the week day check boxes. + */ GetValue(): ASPxClientWeekDays; /** - * - * @param value + * Gets the selection state of the week day check boxes. + * @param value An ASPxClientWeekDays object specifying the selection state of the week day check boxes. */ SetValue(value: ASPxClientWeekDays): void; } @@ -13089,22 +13167,31 @@ interface ASPxClientWeekDaysCheckEdit extends ASPxClientControl { * Represents a client-side equivalent of the RecurrenceRangeControl. */ interface ASPxClientRecurrenceRangeControl extends ASPxClientControl { + /** + * Gets the type of the recurrence range. + */ GetRange(): ASPxClientRecurrenceRange; + /** + * Gets how many times the appointment occurs. + */ GetOccurrenceCount(): number; + /** + * Gets the recurrence end date. + */ GetEndDate(): Date; /** - * - * @param range + * Sets the type of the recurrence range. + * @param range An ASPxClientRecurrenceRangeenumeration value that specifies the recurrence range type. */ SetRange(range: ASPxClientRecurrenceRange): void; /** - * - * @param occurrenceCount + * Sets how many times the appointment occurs. + * @param occurrenceCount An integer value that specifies how many times the appointment occurs. */ SetOccurrenceCount(occurrenceCount: number): void; /** - * - * @param date + * Sets the recurrence end date. + * @param date A JavaScript Date object that specifies the end date for the recurrence. */ SetEndDate(date: Date): void; } @@ -13112,10 +13199,13 @@ interface ASPxClientRecurrenceRangeControl extends ASPxClientControl { * A base for client equivalents of recurrence controls available in the XtraScheduler library. */ interface ASPxClientRecurrenceControlBase extends ASPxClientControl { + /** + * Returns an object providing access to the ASPxClientRecurrenceControlBase control's editor values. + */ CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; /** - * - * @param recurrenceInfo + * Updates values of editors displayed by the ASPxClientRecurrenceControlBase control. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. */ Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; } @@ -13123,10 +13213,13 @@ interface ASPxClientRecurrenceControlBase extends ASPxClientControl { * Represents a client-side equivalent of the DailyRecurrenceControl - a control for specifying the daily recurrence. */ interface ASPxClientDailyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientDailyRecurrenceControl's editor values. + */ CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; /** - * - * @param recurrenceInfo + * Updates values of editors displayed by the ASPxClientDailyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. */ Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; } @@ -13134,10 +13227,13 @@ interface ASPxClientDailyRecurrenceControl extends ASPxClientRecurrenceControlBa * Represents a client-side equivalent of the WeeklyRecurrenceControl. */ interface ASPxClientWeeklyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientWeeklyRecurrenceControl's editor values. + */ CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; /** - * - * @param recurrenceInfo + * Updates values of editors displayed by the ASPxClientWeeklyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. */ Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; } @@ -13145,10 +13241,13 @@ interface ASPxClientWeeklyRecurrenceControl extends ASPxClientRecurrenceControlB * Represents a client-side equivalent of the MonthlyRecurrenceControl. */ interface ASPxClientMonthlyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientMonthlyRecurrenceControl's editor values. + */ CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; /** - * - * @param recurrenceInfo + * Updates values of editors displayed by the ASPxClientMonthlyRecurrenceControll. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. */ Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; } @@ -13156,55 +13255,139 @@ interface ASPxClientMonthlyRecurrenceControl extends ASPxClientRecurrenceControl * Represents a client-side equivalent of the YearlyRecurrenceControl. */ interface ASPxClientYearlyRecurrenceControl extends ASPxClientRecurrenceControlBase { + /** + * Returns an object providing access to the ASPxClientYearlyRecurrenceControl's editor values. + */ CreateValueAccessor(): DefaultRecurrenceRuleValuesAccessor; /** - * - * @param recurrenceInfo + * Updates values of editors displayed by the ASPxClientYearlyRecurrenceControl. + * @param recurrenceInfo An ASPxClientRecurrenceInfo object containing new editor values. */ Update(recurrenceInfo: ASPxClientRecurrenceInfo): void; } +/** + * An object providing access to an ASPxClientRecurrenceControlBase control's editor values. + */ interface DefaultRecurrenceRuleValuesAccessor { + /** + * Get the frequency with which the appointment occurs with respect to the appointment's recurrence type. + */ GetPeriodicity(): number; + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ GetDayNumber(): number; + /** + * Gets or sets the month's number. + */ GetMonth(): number; + /** + * Gets the days of the week to which a weekly recurrent appointment is scheduled. + */ GetWeekDays(): ASPxClientWeekDays; + /** + * Gets the number of the week in a month when an appointment is scheduled. + */ GetWeekOfMonth(): ASPxClientWeekOfMonth; } +/** + * An object providing access to an ASPxClientDailyRecurrenceControl's editor values. + */ interface DailyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of days between appointment occurrences. + */ GetPeriodicity(): number; + /** + * Gets the days of the week to which a daily recurrent appointment is scheduled. + */ GetWeekDays(): ASPxClientWeekDays; } +/** + * An object providing access to an ASPxClientWeeklyRecurrenceControl's editor values. + */ interface WeeklyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of weeks between appointment occurrences. + */ GetPeriodicity(): number; + /** + * Gets the days of the week to which a weekly recurrent appointment is scheduled. + */ GetWeekDays(): ASPxClientWeekDays; } +/** + * An object providing access to an ASPxClientMonthlyRecurrenceControl's editor values. + */ interface MonthlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ GetDayNumber(): number; + /** + * Gets the number of months between appointment occurrences. + */ GetPeriodicity(): number; + /** + * Gets the days of the week to which a monthly recurrent appointment is scheduled. + */ GetWeekDays(): ASPxClientWeekDays; + /** + * Gets the number of the week in a month when an appointment is scheduled. + */ GetWeekOfMonth(): ASPxClientWeekOfMonth; } +/** + * An object providing access to an ASPxClientYearlyRecurrenceControl's editor values. + */ interface YearlyRecurrenceValuesAccessor extends DefaultRecurrenceRuleValuesAccessor { + /** + * Gets the number of the month's day in which the appointment is scheduled. + */ GetDayNumber(): number; + /** + * Gets or sets the month's number. + */ GetMonth(): number; + /** + * Gets the days of the week to which a yearly recurrent appointment is scheduled. + */ GetWeekDays(): ASPxClientWeekDays; + /** + * Gets or sets the number of a week in a month when an appointment is scheduled. + */ GetWeekOfMonth(): ASPxClientWeekOfMonth; } +/** + * Provides base functionality for ASPxClientScheduler's forms. + */ interface ASPxClientFormBase { + /** + * Occurs when the form has been closed. + */ FormClosed: ASPxClientEvent>; + /** + * Closes the form. + */ Close(): void; /** - * - * @param element - * @param isVisible + * Sets the visibility state of the specified form element. + * @param element An object specifying the element whose visibility state should be changed. + * @param isVisible true to display the element; false to hide the element. */ SetVisibleCore(element: Object, isVisible: boolean): void; } +/** + * Represents a client-side equivalent of the RecurrenceTypeEdit. + */ interface ASPxClientRecurrenceTypeEdit extends ASPxClientRadioButtonList { + /** + * Gets the selected recurrence type. + */ GetRecurrenceType(): ASPxClientRecurrenceType; /** - * - * @param recurrenceType + * Sets the selected recurrence type. + * @param recurrenceType An ASPxClientRecurrenceType enumeration value. */ SetRecurrenceType(recurrenceType: ASPxClientRecurrenceType): void; } @@ -13227,10 +13410,13 @@ interface AppointmentPropertyNames { * Represents the client-side equivalent of the TimeInterval class. */ interface ASPxClientTimeInterval { + /** + * Gets a value indicating if the time interval is All-Day. + */ GetAllDay(): boolean; /** - * - * @param allDayValue + * Sets a value specifying if the time interval is All-Day. + * @param allDayValue true, if this is an all-day time interval; otherwise, false. */ SetAllDay(allDayValue: boolean): void; /** @@ -13908,23 +14094,44 @@ interface ASPxClientAppointmentResizeEventArgs extends ASPxClientEventArgs { */ operation: ASPxClientAppointmentOperation; } +/** + * Contains information about a client tooltip. + */ interface ASPxClientSchedulerToolTipData { + /** + * Returns the client appointment for which the tooltip is displayed. + */ GetAppointment(): ASPxClientAppointment; + /** + * Returns the client time interval for which the tooltip is displayed. + */ GetInterval(): ASPxClientTimeInterval; + /** + * Returns the resources associated with the appointment for which the tooltip is displayed. + */ GetResources(): Object[]; } +/** + * A client-side equivalent of the ASPxSchedulerToolTipBase control. + */ interface ASPxClientToolTipBase { + /** + * Returns the value that indicates whether or not the tooltip can be displayed. + */ CanShowToolTip(): boolean; /** - * - * @param toolTipData + * Ends updating the tooltip content. + * @param toolTipData An ASPxClientSchedulerToolTipData object providing data required to update the tooltip content. */ FinalizeUpdate(toolTipData: ASPxClientSchedulerToolTipData): void; /** - * - * @param toolTipData + * Updates the tooltip content. + * @param toolTipData An ASPxClientSchedulerToolTipData object providing data required to update the tooltip content. */ Update(toolTipData: ASPxClientSchedulerToolTipData): void; + /** + * Closes the tooltip. + */ Close(): void; /** * @@ -13932,18 +14139,18 @@ interface ASPxClientToolTipBase { */ CalculatePosition(bounds: Object): ASPxClientPoint; /** - * - * @param eventObject + * Displays the Appointment Menu in the position of the tooltip. + * @param eventObject An object containing information about the event on which the menu is displayed. */ ShowAppointmentMenu(eventObject: Object): void; /** - * - * @param eventObject + * Displays the View Menu in the position of the tooltip. + * @param eventObject An object containing information about the event on which the menu is displayed. */ ShowViewMenu(eventObject: Object): void; /** - * - * @param interval + * Returns the string representation of the specified interval. + * @param interval An ASPxClientTimeInterval object to convert. */ ConvertIntervalToString(interval: ASPxClientTimeInterval): string; } @@ -14222,11 +14429,11 @@ interface ASPxClientSpreadsheet extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side DocumentCallback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side DocumentCallback event. @@ -14373,6 +14580,7 @@ interface ASPxClientTreeList extends ASPxClientControl { * Sets input focus to the ASPxTreeList. */ Focus(): void; + GetPopupEditForm(): ASPxClientPopupControl; /** * Returns the focused node's key value. */ @@ -14430,11 +14638,11 @@ interface ASPxClientTreeList extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. * @param arg A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. @@ -15011,22 +15219,22 @@ interface MVCxClientCallbackPanel extends ASPxClientCallbackPanel { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the Callback Panel by processing the passed information on the server, in an Action specified by the Callback Panel's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the CardView extension. @@ -15042,11 +15250,11 @@ interface MVCxClientCardView extends ASPxClientCardView { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the CardView by processing the passed information on the server, in an Action specified via the CardView's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CardView's CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the CardView's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the CardView. * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. @@ -15079,22 +15287,22 @@ interface MVCxClientChart extends ASPxClientWebChartControl { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update a Chart by processing the passed information on the server, in an Action specified via the Chart's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side event, passing it the specified argument. * @param args A string value that represents any information that needs to be sent to the server-side event. */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the ComboBox and ComboBoxFor extensions. @@ -15110,11 +15318,11 @@ interface MVCxClientComboBox extends ASPxClientComboBox { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the ComboBox by processing the passed information on the server, in an Action specified by the ComboBox's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. @@ -15135,22 +15343,22 @@ interface MVCxClientDataView extends ASPxClientDataView { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the DataView by processing the passed information on the server, in an Action specified via the DataView's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the DateEdit extension. @@ -15167,22 +15375,22 @@ interface MVCxClientDockManager extends ASPxClientDockManager { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the DockManager by processing the passed information on the server, in an Action specified by the DockManager's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the DockPanel extension. @@ -15198,11 +15406,11 @@ interface MVCxClientDockPanel extends ASPxClientDockPanel { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the DockPanel by processing the passed information on the server, in an Action specified by the DockPanel's DockPanelSettings.CallbackRouteValues) property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. @@ -15223,22 +15431,22 @@ interface MVCxClientFileManager extends ASPxClientFileManager { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the FileManager by processing the passed information on the server, in an Action specified via the extension's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the file manager's CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the GridView extension. @@ -15254,11 +15462,11 @@ interface MVCxClientGridView extends ASPxClientGridView { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the GridView by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the GridView's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the GridView. * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. @@ -15317,22 +15525,22 @@ interface MVCxClientImageGallery extends ASPxClientImageGallery { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the ImageGallery by processing the passed information on the server, in an Action specified via the ImageGallery's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the ListBox and ListBoxFor extensions. @@ -15348,11 +15556,11 @@ interface MVCxClientListBox extends ASPxClientListBox { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the ListBox by processing the passed information on the server, in an Action specified by the ListBox's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server, and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. @@ -15382,11 +15590,11 @@ interface MVCxClientPivotGrid extends ASPxClientPivotGrid { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the PivotGrid by processing the passed information on the server, in an Action specified via the grid's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Passes PivotGrid callback parameters to the specified object. * @param obj An object that receives PivotGrid callback parameters. @@ -15398,11 +15606,11 @@ interface MVCxClientPivotGrid extends ASPxClientPivotGrid { */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the PopupControl extension. @@ -15418,11 +15626,11 @@ interface MVCxClientPopupControl extends ASPxClientPopupControl { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the PopupControl by processing the passed information on the server, in an Action specified via the PopupControl's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback with a parameters to update the popup window by processing the related popup window and the passed information on the server, in an Action specified by the PopupControl's CallbackRouteValues property. * @param window A ASPxClientPopupWindow object identifying the processed popup window. @@ -15436,12 +15644,12 @@ interface MVCxClientPopupControl extends ASPxClientPopupControl { */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; /** - * Sends a callback to the server and generates the server-side WindowCallback event, passing it the related popup window object and the specified argument. - * @param window An ASPxClientPopupWindow object identifying the processed popup window. - * @param parameter A string value specifying any information that needs to be sent to the server-side WindowCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param window + * @param parameter + * @param onSuccess */ - PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: Function): void; + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side WindowCallback event, passing the specified argument to it. * @param parameter A string value that is any information that needs to be sent to the server-side WindowCallback event. @@ -15513,22 +15721,22 @@ interface MVCxClientReportDesigner extends ASPxClientReportDesigner { */ PerformCallback(arg: Object): void; /** - * Sends a callback to the server with the specified argument. - * @param arg A Object value, specifying the callback argument. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param arg + * @param onSuccess */ - PerformCallback(arg: Object, onSuccess: Function): void; + PerformCallback(arg: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server with the specified argument. * @param arg A String value, specifying the callback argument. */ PerformCallback(arg: string): void; /** - * Sends a callback to the server with the specified argument. - * @param arg A String value, specifying the callback argument. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param arg + * @param onSuccess */ - PerformCallback(arg: string, onSuccess: Function): void; + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; } /** * A method that will handle the SaveCommandExecuted event. @@ -15565,22 +15773,22 @@ interface MVCxClientRichEdit extends ASPxClientRichEdit { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the RichEdit by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the RoundPanel extension. @@ -15596,22 +15804,22 @@ interface MVCxClientRoundPanel extends ASPxClientRoundPanel { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the Round Panel by processing the passed information on the server, in an Action specified by the Round Panel's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. - * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the Scheduler extension. @@ -15628,11 +15836,11 @@ interface MVCxClientScheduler extends ASPxClientScheduler { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the Scheduler by processing the passed information on the server, in an Action specified via the Scheduler's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. @@ -15682,22 +15890,22 @@ interface MVCxClientSpreadsheet extends ASPxClientSpreadsheet { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the Spreadsheet by processing the passed information on the server, in an Action specified via the CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the PageControl extension. @@ -15713,22 +15921,22 @@ interface MVCxClientPageControl extends ASPxClientPageControl { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the PageControl by processing the passed information on the server, in an Action specified by the PageControl's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A client-side counterpart of the TokenBox and TokenBoxFor extensions. @@ -15744,11 +15952,11 @@ interface MVCxClientTokenBox extends ASPxClientTokenBox { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the TokenBox by processing the passed information on the server, in an Action specified by the TokenBox's CallbackRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified by the CallbackRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. @@ -15769,11 +15977,11 @@ interface MVCxClientTreeList extends ASPxClientTreeList { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the TreeList by processing the passed information on the server, in an Action specified via the TreeList's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the TreeList's CustomDataCallback event. This method does not update the TreeList. * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. @@ -15785,11 +15993,11 @@ interface MVCxClientTreeList extends ASPxClientTreeList { */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Sends a callback to the server and generates the server-side CustomDataCallback event passing it the specified argument. * @param arg A string value that represents any information that needs to be sent to the server-side CustomDataCallback event. @@ -15887,11 +16095,11 @@ interface MVCxClientVerticalGrid extends ASPxClientVerticalGrid { */ PerformCallback(data: Object): void; /** - * Sends a callback with a parameter to update the VerticalGrid by processing the passed information on the server in an Action specified via the grid's CustomActionRouteValues property. - * @param data An object containing any information that needs to be passed to a handling Action specified via the grid's CustomActionRouteValues property. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param data + * @param onSuccess */ - PerformCallback(data: Object, onSuccess: Function): void; + PerformCallback(data: Object, onSuccess: (arg1: string) => void): void; /** * Sends a callback with a parameter to process the passed information on the server, in an Action specified via the VerticalGrid's CustomDataActionRouteValues property, and then process the returned result in the specified client function. This method does not update the VerticalGrid. * @param data An object containing any information that needs to be passed to a handling Action specified via the CustomDataActionRouteValues property. @@ -16013,11 +16221,11 @@ interface ASPxClientCallback extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A method that will handle the client events related to completion of callback server-side processing. @@ -16072,11 +16280,11 @@ interface ASPxClientCallbackPanel extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** * Returns the text displayed within the control's loading panel. */ @@ -16460,6 +16668,12 @@ interface ASPxClientControlsInitializedEventArgs extends ASPxClientEventArgs { */ isCallback: boolean; } +interface ASPxClientControlPredicate { + (control: Object): boolean; +} +interface ASPxClientControlAction { + (control: Object): void; +} /** * A collection object used on the client side to maintain particular client control objects */ @@ -16498,6 +16712,21 @@ interface ASPxClientControlCollection { * @param name A string value that is the hierarchically-qualified identifier of the required DevExpress control. */ GetByName(name: string): Object; + /** + * + * @param predicate + */ + GetControlsByPredicate(predicate: ASPxClientControlPredicate): Object[]; + /** + * + * @param type + */ + GetControlsByType(type: Object): Object[]; + /** + * + * @param action + */ + ForEachControl(action: ASPxClientControlAction): void; } /** * Represents a client-side equivalent of the ASPxDataView object. @@ -16559,11 +16788,11 @@ interface ASPxClientDataView extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * A JavaScript function which returns a value specifying whether an object meets the criteria defined within the method specified by this delegate. @@ -16629,11 +16858,11 @@ interface ASPxClientDockManager extends ASPxClientControl { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that contains any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** * Returns a zone specified by its unique identifier (zoneUID). * @param zoneUID A string value specifying the unique identifier of the zone. @@ -17375,11 +17604,11 @@ interface ASPxClientFileManager extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that specifies any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; } /** * A JavaScript function which receives callback data obtained via a call to the client SetCurrentFolderPath method. @@ -17448,6 +17677,7 @@ interface ASPxClientFileManagerFile extends ASPxClientFileManagerItem { * A client-side equivalent of the FileManagerFolder object. */ interface ASPxClientFileManagerFolder extends ASPxClientFileManagerItem { + isParentFolder: boolean; } /** * A JavaScript function which receives callback data obtained by a call to the client GetAllItems method. @@ -18659,6 +18889,7 @@ interface ASPxClientMenuBase extends ASPxClientControl { * Represents a client collection that maintains client menu objects. */ interface ASPxClientMenuCollection extends ASPxClientControlCollection { + RecalculateAll(): void; /** * Hides all menus maitained by the collection. */ @@ -19358,12 +19589,12 @@ interface ASPxClientPopupControl extends ASPxClientPopupControlBase { */ PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string): void; /** - * Sends a callback to the server and generates the server-side WindowCallback event, passing it the related popup window object and the specified argument. - * @param window An ASPxClientPopupWindow object identifying the processed popup window. - * @param parameter A string value specifying any information that needs to be sent to the server-side WindowCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param window + * @param parameter + * @param onSuccess */ - PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: Function): void; + PerformWindowCallback(window: ASPxClientPopupWindow, parameter: string, onSuccess: (arg1: string) => void): void; /** * Specifies the default popup window's size. * @param width An integer value that specifies the default popup window's width. @@ -20006,7 +20237,7 @@ interface ASPxClientRibbon extends ASPxClientControl { */ GetMinimized(): boolean; /** - * Specifies the visibility of a context tab ?ategory specified by its name. + * Specifies the visibility of a context tab category specified by its name. * @param categoryName A Name property value of the required category. * @param visible true to make a category visible; false to make it hidden. */ @@ -20248,11 +20479,11 @@ interface ASPxClientRoundPanel extends ASPxClientPanelBase { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side ContentCallback event, passing it the specified argument. - * @param parameter A string value that is any information that needs to be sent to the server-side ContentCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; /** * Returns the text displayed within the panel's header. */ @@ -20623,11 +20854,11 @@ interface ASPxClientPageControl extends ASPxClientTabControlBase { */ PerformCallback(parameter: string): void; /** - * Sends a callback to the server and generates the server-side Callback event, passing it the specified argument. - * @param parameter A string value that represents any information that needs to be sent to the server-side Callback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param parameter + * @param onSuccess */ - PerformCallback(parameter: string, onSuccess: Function): void; + PerformCallback(parameter: string, onSuccess: (arg1: string) => void): void; } /** * Represents a client-side equivalent of a tab control's TabPage object. @@ -21481,11 +21712,15 @@ interface ASPxClientChartDesigner extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * Sends a callback to the server and generates the server-side event, passing it the specified argument. - * @param arg A string value that represents any information that needs to be sent to the server-side event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param arg + * @param onSuccess + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientChartDesigner properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. */ - PerformCallback(arg: string, onSuccess: Function): void; UpdateLocalization(localization: { [key: string]: string; }): void; /** * Returns the model of the Client Chart Designer. @@ -21636,11 +21871,11 @@ interface ASPxClientWebChartControl extends ASPxClientControl { */ PerformCallback(args: string): void; /** - * Sends a callback to the server and generates the server-side CustomCallback event, passing it the specified argument. - * @param args A string value that represents any information that needs to be sent to the server-side CustomCallback event. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param args + * @param onSuccess */ - PerformCallback(args: string, onSuccess: Function): void; + PerformCallback(args: string, onSuccess: (arg1: string) => void): void; /** * Prints the current chart on the client side. */ @@ -23640,11 +23875,15 @@ interface ASPxClientQueryBuilder extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * Sends a callback to the server with the specified argument. - * @param arg A String value, specifying the callback argument. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param arg + * @param onSuccess + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientQueryBuilder properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. */ - PerformCallback(arg: string, onSuccess: Function): void; UpdateLocalization(localization: { [key: string]: string; }): void; /** * Returns the object model of a Query Builder. @@ -23797,11 +24036,15 @@ interface ASPxClientReportDesigner extends ASPxClientControl { */ PerformCallback(arg: string): void; /** - * Sends a callback to the server with the specified argument. - * @param arg A String value, specifying the callback argument. - * @param onSuccess A delegate method that will be called if the callback is successful. + * + * @param arg + * @param onSuccess + */ + PerformCallback(arg: string, onSuccess: (arg1: string) => void): void; + /** + * Updates the localization settings of the ASPxClientReportDesigner properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. */ - PerformCallback(arg: string, onSuccess: Function): void; UpdateLocalization(localization: { [key: string]: string; }): void; /** * Returns the object model of a Web Report Designer. @@ -24013,6 +24256,10 @@ interface ASPxClientReportViewer extends ASPxClientControl { * Occurs on the client side when another report page is loaded into this ASPxClientReportViewer instance. */ PageLoad: ASPxClientEvent>; + /** + * Submits the values of the specified parameters. + * @param parameters A dictionary containing the parameter names, along with their Object values. + */ SubmitParameters(parameters: { [key: string]: Object; }): void; /** * Prints a report shown in the ReportViewer. @@ -24260,6 +24507,10 @@ interface ASPxClientWebDocumentViewer extends ASPxClientControl { * @param format A String value, specifying the export format. The following formats are currently supported: 'csv', 'html', 'image', 'mht', 'pdf', 'rtf', 'txt', 'xls', and 'xlsx'. */ ExportTo(format: string): void; + /** + * Updates the localization settings of the ASPxClientWebDocumentViewer properties. + * @param localization A dictionary containing the property names, along with their localized equivalents. + */ UpdateLocalization(localization: { [key: string]: string; }): void; } /** @@ -25661,30 +25912,30 @@ interface ASPxClientRichEditStatic extends ASPxClientControlStatic { } interface ASPxSchedulerDateTimeHelperStatic { /** - * - * @param date + * Returns the date part of the specified DateTime value. + * @param date A DateTime object from which to extract the date. */ TruncToDate(date: Date): Date; /** - * - * @param date + * Returns the day time part of the specified DateTime value. + * @param date A DateTime object from which to extract the day time. */ ToDayTime(date: Date): any; /** - * - * @param date + * Adds the specified number of days to a DateTime object and returns the result. + * @param date A DateTime object to which to add days. */ AddDays(date: Date): Date; /** - * - * @param date - * @param timeSpan + * Adds the specified timespan to a DateTime object and returns the result. + * @param date A DateTime object to which to add a timespan. + * @param timeSpan A TimeSpan object specifying the timespan to add. */ AddTimeSpan(date: Date, timeSpan: any): Date; /** - * - * @param date - * @param spanInMs + * Rounds a DateTime value up to the nearest interval. + * @param date A DateTime object containing a value to round. + * @param spanInMs A TimeSpan object specifying an interval to which to round. */ CeilDateTime(date: Date, spanInMs: any): Date; } @@ -25706,9 +25957,9 @@ interface ASPxClientRecurrenceTypeEditStatic extends ASPxClientRadioButtonListSt } interface ASPxClientTimeIntervalStatic { /** - * - * @param start - * @param end + * Gets the duration of a time interval between two points in time. + * @param start A DateTime object specifying the starting point of the time interval. + * @param end A DateTime object specifying the ending point of the time interval. */ CalculateDuration(start: Date, end: Date): number; } From 1b240acf4a60d678527b4b1099c23ddb255a9752 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:45:11 +0200 Subject: [PATCH 054/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts-modules-no-data-to-display-tests.ts | 2 +- highcharts/highcharts-modules-no-data-to-display.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/highcharts/highcharts-modules-no-data-to-display-tests.ts b/highcharts/highcharts-modules-no-data-to-display-tests.ts index 9b1d69b8da..454b50f067 100644 --- a/highcharts/highcharts-modules-no-data-to-display-tests.ts +++ b/highcharts/highcharts-modules-no-data-to-display-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// function test_NoDataToDisplay() { diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/highcharts-modules-no-data-to-display.d.ts index d1910675cd..120acede4c 100644 --- a/highcharts/highcharts-modules-no-data-to-display.d.ts +++ b/highcharts/highcharts-modules-no-data-to-display.d.ts @@ -2,7 +2,7 @@ // Project: http://www.highcharts.com/ // Definitions by: Andrey Zolotin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// +// interface HighchartsChartObject { /** * Returns true if there are data points within the plot area now From 26a7266dbb029fe0abab4070fe973838d162f937 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:48:36 +0200 Subject: [PATCH 055/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts-modules-no-data-to-display-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/highcharts/highcharts-modules-no-data-to-display-tests.ts b/highcharts/highcharts-modules-no-data-to-display-tests.ts index 454b50f067..5a6ed0b59c 100644 --- a/highcharts/highcharts-modules-no-data-to-display-tests.ts +++ b/highcharts/highcharts-modules-no-data-to-display-tests.ts @@ -1,5 +1,6 @@ /// /// +// function test_NoDataToDisplay() { var chart = $("#container").highcharts(); From c19594e5e5437039b1530114d82a7b022773c01a Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:55:09 +0200 Subject: [PATCH 056/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts-modules-no-data-to-display-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highcharts/highcharts-modules-no-data-to-display-tests.ts b/highcharts/highcharts-modules-no-data-to-display-tests.ts index 5a6ed0b59c..806b7c3dd8 100644 --- a/highcharts/highcharts-modules-no-data-to-display-tests.ts +++ b/highcharts/highcharts-modules-no-data-to-display-tests.ts @@ -1,6 +1,6 @@ /// -/// // +/// function test_NoDataToDisplay() { var chart = $("#container").highcharts(); From c6b2d3b16c76a52fbff392520d46427f882dad53 Mon Sep 17 00:00:00 2001 From: "Zolotin, Andrey (GGA)" Date: Fri, 12 Aug 2016 16:55:48 +0200 Subject: [PATCH 057/203] #10342 Added hideNoData/showNoData to highcharts --- highcharts/highcharts-modules-no-data-to-display-tests.ts | 2 +- highcharts/highcharts-modules-no-data-to-display.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/highcharts/highcharts-modules-no-data-to-display-tests.ts b/highcharts/highcharts-modules-no-data-to-display-tests.ts index 806b7c3dd8..64b50f831f 100644 --- a/highcharts/highcharts-modules-no-data-to-display-tests.ts +++ b/highcharts/highcharts-modules-no-data-to-display-tests.ts @@ -1,5 +1,5 @@ /// -// +/// /// function test_NoDataToDisplay() { diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/highcharts-modules-no-data-to-display.d.ts index 120acede4c..ab5fdd1d0d 100644 --- a/highcharts/highcharts-modules-no-data-to-display.d.ts +++ b/highcharts/highcharts-modules-no-data-to-display.d.ts @@ -2,7 +2,7 @@ // Project: http://www.highcharts.com/ // Definitions by: Andrey Zolotin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// +/// interface HighchartsChartObject { /** * Returns true if there are data points within the plot area now From 876e78d5f5084d396e3b1c3eb11c73367655039e Mon Sep 17 00:00:00 2001 From: Jon Perl Date: Fri, 12 Aug 2016 11:14:35 -0400 Subject: [PATCH 058/203] Add missing jsonb column type to knex TableBuilder --- knex/knex.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knex/knex.d.ts b/knex/knex.d.ts index 64d530ed49..bd02069da1 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -370,6 +370,7 @@ declare module "knex" { enum(columnName: string, values: Value[]): ColumnBuilder; enu(columnName: string, values: Value[]): ColumnBuilder; json(columnName: string): ColumnBuilder; + jsonb(columnName: string): ColumnBuilder; uuid(columnName: string): ColumnBuilder; comment(val: string): TableBuilder; specificType(columnName: string, type: string): ColumnBuilder; From db5cd794084553b74b6beb32c446e0574004269d Mon Sep 17 00:00:00 2001 From: Finn Poppinga Date: Fri, 12 Aug 2016 17:19:54 +0200 Subject: [PATCH 059/203] add missing methods of QueryIterator interface --- documentdb/documentdb.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/documentdb/documentdb.d.ts b/documentdb/documentdb.d.ts index 1d901179a6..c4aefe470f 100644 --- a/documentdb/documentdb.d.ts +++ b/documentdb/documentdb.d.ts @@ -93,7 +93,12 @@ declare module 'documentdb' { /** Represents the result returned from a query. */ interface QueryIterator { - + current(): TResultRow; + executeNext(callback: (error: QueryError, result: TResultRow[]) => void): void; + forEach(iteratorFunction : (error: QueryError, element: TResultRow) => void): void; + hasMoreResults(): boolean; + nextItem(callback: (error : QueryError, item : TResultRow) => void): void; + reset() : void; toArray(callback: (error: QueryError, result: TResultRow[]) => void): void; } From c348d970d54ad7910ab9c21368134794279773f9 Mon Sep 17 00:00:00 2001 From: Moore Date: Fri, 12 Aug 2016 11:03:55 -0500 Subject: [PATCH 060/203] Fixed param middleware to accept url param as first middleware param --- koa-router/koa-router-tests.ts | 6 +++++- koa-router/koa-router.d.ts | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/koa-router/koa-router-tests.ts b/koa-router/koa-router-tests.ts index deaa7e083d..2adb278ed1 100644 --- a/koa-router/koa-router-tests.ts +++ b/koa-router/koa-router-tests.ts @@ -1,5 +1,6 @@ /// /// +/// import * as Koa from "koa"; import * as Router from "koa-router"; @@ -11,6 +12,9 @@ const router = new Router({ }); router + .param('id', function(id, ctx, next) { + next(); + }) .get('/', function (ctx, next) { ctx.body = 'Hello World!'; }) @@ -23,7 +27,7 @@ router .del('/users/:id', function (ctx, next) { // ... }); - + router.get('user', '/users/:id', function (ctx, next) { ctx.body = "sdsd"; }); diff --git a/koa-router/koa-router.d.ts b/koa-router/koa-router.d.ts index d289657c84..25ec962dad 100644 --- a/koa-router/koa-router.d.ts +++ b/koa-router/koa-router.d.ts @@ -30,7 +30,7 @@ declare module "koa-router" { export interface IRouterOptions { /** - * Router prefixes + * Router prefixes */ prefix?: string; /** @@ -52,6 +52,10 @@ declare module "koa-router" { (ctx: Router.IRouterContext, next?: () => any): any; } + export interface IParamMiddleware { + (param: string, ctx: Router.IRouterContext, next?: () => any): any; + } + export interface IRouterAllowedMethodsOptions { /** * throw error instead of setting status and header @@ -141,13 +145,13 @@ declare module "koa-router" { */ get(name: string, path: string, ...middleware: Array): Router; get(path: string, ...middleware: Array): Router; - + /** * HTTP post method */ post(name: string, path: string, ...middleware: Array): Router; post(path: string, ...middleware: Array): Router; - + /** * HTTP put method */ @@ -214,7 +218,7 @@ declare module "koa-router" { /** * Redirect `source` to `destination` URL with optional 30x status `code`. - * + * * Both `source` and `destination` can be route names. */ redirect(source: string, destination: string, code?: number): Router; @@ -245,7 +249,7 @@ declare module "koa-router" { /** * Run middleware for named route parameters. Useful for auto-loading or validation. */ - param(param: string, middleware: Router.IMiddleware): Router; + param(param: string, middleware: Router.IParamMiddleware): Router; /** * Generate URL from url pattern and given `params`. From 601a2d4ae2854bc62809d0e6312746b758fffc21 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 12 Aug 2016 17:50:16 +0100 Subject: [PATCH 061/203] Knex: add missing transaction.raw --- knex/knex.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knex/knex.d.ts b/knex/knex.d.ts index bd02069da1..4ef5ef5a8c 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -330,6 +330,7 @@ declare module "knex" { interface Transaction extends QueryBuilder { commit: any; rollback: any; + raw: Raw; } // @@ -370,7 +371,6 @@ declare module "knex" { enum(columnName: string, values: Value[]): ColumnBuilder; enu(columnName: string, values: Value[]): ColumnBuilder; json(columnName: string): ColumnBuilder; - jsonb(columnName: string): ColumnBuilder; uuid(columnName: string): ColumnBuilder; comment(val: string): TableBuilder; specificType(columnName: string, type: string): ColumnBuilder; From eb1ed6bb545c8c18fc620fec04f2ba3b3e79b581 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 12 Aug 2016 17:51:56 +0100 Subject: [PATCH 062/203] Add test --- knex/knex-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 3a00c32551..e894a6be47 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -380,6 +380,8 @@ knex.transaction(function(trx) { // Using trx as a transaction object: knex.transaction(function(trx) { + + trx.raw('') var info: any; var books: any[] = [ From 73748184ab2c45bbc67babed52d9d197241d384d Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 12 Aug 2016 17:52:39 +0100 Subject: [PATCH 063/203] Restore --- knex/knex.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knex/knex.d.ts b/knex/knex.d.ts index 4ef5ef5a8c..27996ccbca 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -370,6 +370,7 @@ declare module "knex" { binary(columnName: string): ColumnBuilder; enum(columnName: string, values: Value[]): ColumnBuilder; enu(columnName: string, values: Value[]): ColumnBuilder; + jsonb(columnName: string): ColumnBuilder; json(columnName: string): ColumnBuilder; uuid(columnName: string): ColumnBuilder; comment(val: string): TableBuilder; From 793ec09a5f53fbc83f3b2fd07b29b39ff44c9946 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 12 Aug 2016 17:53:07 +0100 Subject: [PATCH 064/203] Order --- knex/knex.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knex/knex.d.ts b/knex/knex.d.ts index 27996ccbca..68e8248c1e 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -370,8 +370,8 @@ declare module "knex" { binary(columnName: string): ColumnBuilder; enum(columnName: string, values: Value[]): ColumnBuilder; enu(columnName: string, values: Value[]): ColumnBuilder; - jsonb(columnName: string): ColumnBuilder; json(columnName: string): ColumnBuilder; + jsonb(columnName: string): ColumnBuilder; uuid(columnName: string): ColumnBuilder; comment(val: string): TableBuilder; specificType(columnName: string, type: string): ColumnBuilder; From b4f1909a44c251f20c4f17d49705a90ed69476ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chabbey=20Fran=C3=A7ois?= Date: Fri, 12 Aug 2016 10:06:28 -0700 Subject: [PATCH 065/203] Update lru-cache to v4.1.0 lru-cache accepts any type for the key. --- lru-cache/lru-cache.d.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lru-cache/lru-cache.d.ts b/lru-cache/lru-cache.d.ts index 25b9b8cf52..7bca656bd8 100644 --- a/lru-cache/lru-cache.d.ts +++ b/lru-cache/lru-cache.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lru-cache v2.5.0 +// Type definitions for lru-cache v4.0.1 // Project: https://github.com/isaacs/node-lru-cache // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,20 +12,22 @@ declare module 'lru-cache' { max?: number; maxAge?: number; length?: (value: T) => number; - dispose?: (key: string, value: T) => void; + dispose?: (key: any, value: T) => void; stale?: boolean; } interface Cache { - set(key: string, value: T): void; - get(key: string): T; - peek(key: string): T; - has(key: string): boolean - del(key: string): void; + set(key: any, value: T): void; + get(key: any): T; + peek(key: any): T; + has(key: any): boolean + del(key: any): void; reset(): void; - forEach(iter: (value: T, key: string, cache: Cache) => void, thisp?: any): void; - - keys(): string[]; + prune(): void; + forEach(iter: (value: T, key: any, cache: Cache) => void, thisp?: any): void; + itemCount: number; + length: number + keys(): any[]; values(): T[]; } } From 5458c8e4dc7239a5733a3d939e9983d846876b74 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Fri, 12 Aug 2016 18:09:15 +0100 Subject: [PATCH 066/203] Fix --- knex/knex.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knex/knex.d.ts b/knex/knex.d.ts index 68e8248c1e..75c9f67a43 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -330,7 +330,7 @@ declare module "knex" { interface Transaction extends QueryBuilder { commit: any; rollback: any; - raw: Raw; + raw: Knex.RawBuilder; } // From e630a5756bed554f8b93ce5483ba54bd88003ebe Mon Sep 17 00:00:00 2001 From: Moore Date: Fri, 12 Aug 2016 12:15:42 -0500 Subject: [PATCH 067/203] Removed uneeded reference --- koa-router/koa-router-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/koa-router/koa-router-tests.ts b/koa-router/koa-router-tests.ts index 2adb278ed1..36d3e6c1c8 100644 --- a/koa-router/koa-router-tests.ts +++ b/koa-router/koa-router-tests.ts @@ -1,6 +1,5 @@ /// /// -/// import * as Koa from "koa"; import * as Router from "koa-router"; From 42268d59f80998a02c848b9bb5ecb386a6e7e11d Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Fri, 12 Aug 2016 14:31:36 -0500 Subject: [PATCH 068/203] Revert "github-electron: Add AutoUpdater.getFeedURL()" This reverts commit 02925c82b29fd4415d788014227c1b96ad721eb2. --- github-electron/github-electron.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index babe66774d..b5cd642811 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -504,8 +504,6 @@ declare namespace Electron { * Set the url and initialize the auto updater. */ setFeedURL(url: string, requestHeaders?: Headers): void; - /** Returns the current update feed URL. */ - getFeedURL():string; /** * Ask the server whether there is an update, you have to call setFeedURL * before using this API From 293ecc11e4c743af076acf2d2330c4ae59a5b43c Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Fri, 12 Aug 2016 14:51:47 -0500 Subject: [PATCH 069/203] Added definitions for electron-notification v0.0.3 --- .../electron-notifications-tests.ts | 13 ++++++ .../electron-notifications.d.ts | 41 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 electron-notifications/electron-notifications-tests.ts create mode 100644 electron-notifications/electron-notifications.d.ts diff --git a/electron-notifications/electron-notifications-tests.ts b/electron-notifications/electron-notifications-tests.ts new file mode 100644 index 0000000000..7730747acc --- /dev/null +++ b/electron-notifications/electron-notifications-tests.ts @@ -0,0 +1,13 @@ +/// + +import * as notifier from 'electron-notifications'; + +const data: ElectronNotifications.NotifierOptions = { + message: 'message', + icon: 'icon', + buttons: ['ok', 'cancel'] +}; +const notification = notifier.notify('title', data); +notification.on('clicked', () => { console.log('clicked') }); +notification.on('swipedRight', () => { console.log('swipedRight') }); +notification.on('buttonClicked', (text) => { console.log(`buttonClicked: ${text}`) }); \ No newline at end of file diff --git a/electron-notifications/electron-notifications.d.ts b/electron-notifications/electron-notifications.d.ts new file mode 100644 index 0000000000..5cbb655246 --- /dev/null +++ b/electron-notifications/electron-notifications.d.ts @@ -0,0 +1,41 @@ +// Type definitions for electron-notifications v0.0.3 +// Project: https://github.com/blainesch/electron-notifications +// Definitions by: Daniel Pereira +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace ElectronNotifications { + + interface NotifierOptions { + + /** A message to display under the title. */ + message?: string, + + /** The absolute URL of a icon displayed to the left of the text. */ + icon?: string, + + /** One or two buttons to display on the right of the notification. */ + buttons?: string[] + } + + class NotificationWindow extends Electron.BrowserWindow { + + /** When the notification was clicked, but not dragged. This usually does the default action, or closes the notification. */ + on(event: 'clicked', listener: Function): this; + + /** When the notification has been swiped to the right. This usually indiciated the user wants to dismiss the notification. */ + on(event: 'swipedRight', listener: Function): this; + + /** When any one of the buttons are clicked, it will trigger a buttonClicked event, and pass the text that was clicked to the handler. */ + on(event: 'buttonClicked', listener: (text: string) => void): this; + + on(event: string, listener: Function): this; + } + +} + +/** A node module for sending notifications in electron applications */ +declare module 'electron-notifications' { + export function notify(title: string, data?: ElectronNotifications.NotifierOptions): ElectronNotifications.NotificationWindow; +} \ No newline at end of file From cd503bf98525afbe1f0dbe025b38b893cf19ad1c Mon Sep 17 00:00:00 2001 From: Kenneth Heutmaker Date: Fri, 12 Aug 2016 13:50:20 -0700 Subject: [PATCH 070/203] BigJS: Define BigJsInputType and use it whenever a parameter can be number, string or BigJS. This enables more flexibility in variables passed to these functions as demonstrated in the multipleTypesAccepted test. --- big.js/big.js-tests.ts | 18 +++++++- big.js/big.js.d.ts | 98 +++++++----------------------------------- 2 files changed, 33 insertions(+), 83 deletions(-) diff --git a/big.js/big.js-tests.ts b/big.js/big.js-tests.ts index 0067a0b4f5..5a12cab011 100644 --- a/big.js/big.js-tests.ts +++ b/big.js/big.js-tests.ts @@ -12,6 +12,7 @@ */ +import BigJS = BigJsLibrary.BigJS; function constructorTests() { var x = new Big(9) // '9' var y = new Big(x) // '9' @@ -247,4 +248,19 @@ function testMultipleConstructors() { x.div(3) // 1.667 y.div(3) // 1.6666666667 -} \ No newline at end of file +} + +function multipleTypesAccepted(n: number | BigJS | string) { + var y = Big(n) + .minus(n) + .mod(n) + .plus(n) + .times(n); + y.cmp(n); + y.eq(n); + y.gt(n); + y.gte(n); + y.lt(n); + y.lte(n); + y.div(n) +} diff --git a/big.js/big.js.d.ts b/big.js/big.js.d.ts index 52a653ba83..e08ee7bc57 100644 --- a/big.js/big.js.d.ts +++ b/big.js/big.js.d.ts @@ -25,23 +25,11 @@ declare namespace BigJsLibrary { RM: RoundingMode; } + type BigNumberInputType = number | string | BigJS; + interface BigJS_Constructors { - /** A decimal value. */ - new (value: number): BigJS; - /** A decimal value. - String values may be in exponential, as well as normal (non-exponential) notation. There is no limit to the number of digits of a string value (other than that of Javascript's maximum array size), but the largest recommended exponent magnitude is 1e+6. Infinity, NaN and hexadecimal literal strings, e.g. '0xff', are not valid. - String values in octal literal form will be interpreted as decimals, e.g. '011' is 11, not 9. */ - new (value: string): BigJS; - /** A decimal value. */ - new (value: BigJS): BigJS; - /** A decimal value. */ - (value: number): BigJS; - /** A decimal value. - String values may be in exponential, as well as normal (non-exponential) notation. There is no limit to the number of digits of a string value (other than that of Javascript's maximum array size), but the largest recommended exponent magnitude is 1e+6. Infinity, NaN and hexadecimal literal strings, e.g. '0xff', are not valid. - String values in octal literal form will be interpreted as decimals, e.g. '011' is 11, not 9. */ - (value: string): BigJS; - /** A decimal value. */ - (value: BigJS): BigJS; + new (value: BigNumberInputType): BigJS; + (value: BigNumberInputType): BigJS; /** A decimal value. */ (): BigJS; @@ -57,85 +45,35 @@ declare namespace BigJsLibrary { 1 = If the value of this Big number is greater than the value of n -1 = If the value of this Big number is less than the value of n 0 = If this Big number and n have the same value */ - cmp(n: number): number; - /** Compare - @returns {Number} - 1 = If the value of this Big number is greater than the value of n - -1 = If the value of this Big number is less than the value of n - 0 = If this Big number and n have the same value */ - cmp(n: string): number; - /** Compare - @returns {Number} - 1 = If the value of this Big number is greater than the value of n - -1 = If the value of this Big number is less than the value of n - 0 = If this Big number and n have the same value */ - cmp(n: BigJS): number; + cmp(n: BigNumberInputType): number; /** Returns a Big number whose value is the value of this Big number divided by n. */ - div(n: number): BigJS; - /** Returns a Big number whose value is the value of this Big number divided by n. */ - div(n: string): BigJS; - /** Returns a Big number whose value is the value of this Big number divided by n. */ - div(n: BigJS): BigJS; + div(n: BigNumberInputType): BigJS; /** Returns true if the value of this Big equals the value of n, otherwise returns false. */ - eq(n: number): boolean; - /** Returns true if the value of this Big equals the value of n, otherwise returns false. */ - eq(n: string): boolean; - /** Returns true if the value of this Big equals the value of n, otherwise returns false. */ - eq(n: BigJS): boolean; + eq(n: BigNumberInputType): boolean; /** Returns true if the value of this Big is greater than the value of n, otherwise returns false. */ - gt(n: number): boolean; - /** Returns true if the value of this Big is greater than the value of n, otherwise returns false. */ - gt(n: string): boolean; - /** Returns true if the value of this Big is greater than the value of n, otherwise returns false. */ - gt(n: BigJS): boolean; + gt(n: BigNumberInputType): boolean; /** Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false. */ - gte(n: number): boolean; - /** Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false. */ - gte(n: string): boolean; - /** Returns true if the value of this Big is greater than or equal to the value of n, otherwise returns false. */ - gte(n: BigJS): boolean; + gte(n: BigNumberInputType): boolean; /** Returns true if the value of this Big is less than the value of n, otherwise returns false. */ - lt(n: number): boolean; - /** Returns true if the value of this Big is less than the value of n, otherwise returns false. */ - lt(n: string): boolean; - /** Returns true if the value of this Big is less than the value of n, otherwise returns false. */ - lt(n: BigJS): boolean; + lt(n: BigNumberInputType): boolean; /** Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false. */ - lte(n: number): boolean; - /** Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false. */ - lte(n: string): boolean; - /** Returns true if the value of this Big is less than or equal to the value of n, otherwise returns false. */ - lte(n: BigJS): boolean; + lte(n: BigNumberInputType): boolean; /** Returns a Big number whose value is the value of this Big number minus n. */ - minus(n: number): BigJS; - /** Returns a Big number whose value is the value of this Big number minus n. */ - minus(n: string): BigJS; - /** Returns a Big number whose value is the value of this Big number minus n. */ - minus(n: BigJS): BigJS; + minus(n: BigNumberInputType): BigJS; /** Returns a Big number whose value is the value of this Big number modulo n, i.e. the integer remainder of dividing this Big number by n. - The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */ - mod(n: number): BigJS; - /** Returns a Big number whose value is the value of this Big number modulo n, i.e. the integer remainder of dividing this Big number by n. - The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */ - mod(n: string): BigJS; - /** Returns a Big number whose value is the value of this Big number modulo n, i.e. the integer remainder of dividing this Big number by n. - The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */ - mod(n: BigJS): BigJS; + The result will have the same sign as this Big number, and it will match that of Javascript's % operator (within the limits of its precision) and BigDecimal's remainder method. */ + mod(n: BigNumberInputType): BigJS; /** Returns a Big number whose value is the value of this Big number plus n. */ - plus(n: number): BigJS; - /** Returns a Big number whose value is the value of this Big number plus n. */ - plus(n: string): BigJS; - /** Returns a Big number whose value is the value of this Big number plus n. */ - plus(n: BigJS): BigJS; + plus(n: BigNumberInputType): BigJS; /** Returns a Big number whose value is the value of this Big number raised to the power exp. If exp is negative and the result has more fraction digits than is specified by Big.DP, it will be rounded to Big.DP decimal places using rounding mode Big.RM. @@ -156,11 +94,7 @@ declare namespace BigJsLibrary { sqrt(): BigJS; /** Returns a Big number whose value is the value of this Big number times n. */ - times(n: number): BigJS; - /** Returns a Big number whose value is the value of this Big number times n. */ - times(n: string): BigJS; - /** Returns a Big number whose value is the value of this Big number times n. */ - times(n: BigJS): BigJS; + times(n: BigNumberInputType): BigJS; /** Returns a string representing the value of this Big number in exponential notation to a fixed number of decimal places dp. */ toExponential(): string; From 7ccc70e89f23369cd0f4a01a4795ca78ad1867b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chabbey=20Fran=C3=A7ois?= Date: Fri, 12 Aug 2016 15:42:17 -0700 Subject: [PATCH 071/203] Update lru-cache.d.ts --- lru-cache/lru-cache.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lru-cache/lru-cache.d.ts b/lru-cache/lru-cache.d.ts index 7bca656bd8..0f92df2f68 100644 --- a/lru-cache/lru-cache.d.ts +++ b/lru-cache/lru-cache.d.ts @@ -17,7 +17,7 @@ declare module 'lru-cache' { } interface Cache { - set(key: any, value: T): void; + set(key: any, value: T, maxAge?: number): void; get(key: any): T; peek(key: any): T; has(key: any): boolean From 0bc5024c75c501f52853a435a48d44294a0c276b Mon Sep 17 00:00:00 2001 From: John Kokkinidis Date: Sat, 13 Aug 2016 01:59:29 +0300 Subject: [PATCH 072/203] - Updated react-scroll typing to match the new version of react-scroll. --- react-scroll/react-scroll.d.ts | 45 +++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/react-scroll/react-scroll.d.ts b/react-scroll/react-scroll.d.ts index 27d7dd2104..be88b48758 100644 --- a/react-scroll/react-scroll.d.ts +++ b/react-scroll/react-scroll.d.ts @@ -1,6 +1,6 @@ -// Type definitions for redux-immutable v3.0.5 +// Type definitions for react-scroll // Project: https://github.com/fisshy/react-scroll -// Definitions by: Pedro Pereira +// Definitions by: Ioannis Kokkinidis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -10,6 +10,8 @@ declare module "react-scroll" { interface Link extends React.ClassicComponentClass {} interface Element extends React.ClassicComponentClass {} + interface Button extends React.ClassicComponentClass {} + interface DirectLink extends React.ClassicComponentClass {} interface scrollEvnt { register(evtName: string, callback: Function) : void, @@ -24,15 +26,50 @@ declare module "react-scroll" { scrollTo(to: any, animate?: any, duration?: any, offset?: any) : void } + interface scrollSpy { + update() : void + } + + interface animateScroll { + scrollToTop(options: any) : void, + scrollToBottom(options: any) : void, + scrollTo(toY: number, options: any) : void, + scrollMore(toY: number, options: any) : void, + } + + interface directScroller { + get() : any + } + + interface Helpers { + } + + + const Link: Link; const Element: Element; const Events: Events; const scroller: scroller; + const DirectLink: DirectLink; + const Button: Button; + + const scrollSpy: scrollSpy; + const directScroller: directScroller; + const Helpers: Helpers; + const animateScroll: animateScroll; + + export { Link, Element, Events, - scroller + scroller, + scrollSpy, + directScroller, + DirectLink, + Button, + Helpers, + animateScroll } -} \ No newline at end of file +} From f29ae556487dd6dd1ea268d8d11beed8663b3df2 Mon Sep 17 00:00:00 2001 From: John Kokkinidis Date: Sat, 13 Aug 2016 02:11:45 +0300 Subject: [PATCH 073/203] - Made the options parameter optional. --- react-scroll/react-scroll.d.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/react-scroll/react-scroll.d.ts b/react-scroll/react-scroll.d.ts index be88b48758..f362e3d4ce 100644 --- a/react-scroll/react-scroll.d.ts +++ b/react-scroll/react-scroll.d.ts @@ -31,10 +31,10 @@ declare module "react-scroll" { } interface animateScroll { - scrollToTop(options: any) : void, - scrollToBottom(options: any) : void, - scrollTo(toY: number, options: any) : void, - scrollMore(toY: number, options: any) : void, + scrollToTop(options?: any) : void, + scrollToBottom(options?: any) : void, + scrollTo(toY: number, options?: any) : void, + scrollMore(toY: number, options?: any) : void, } interface directScroller { @@ -50,10 +50,8 @@ declare module "react-scroll" { const Element: Element; const Events: Events; const scroller: scroller; - const DirectLink: DirectLink; const Button: Button; - const scrollSpy: scrollSpy; const directScroller: directScroller; const Helpers: Helpers; From d44c56c717ef10b3d9aecb3b59df6dc6e03369a9 Mon Sep 17 00:00:00 2001 From: Michael Zlatkovsky Date: Fri, 12 Aug 2016 18:32:57 -0700 Subject: [PATCH 074/203] Update common runtime and add Excel 1.3 Also strip out filenames that start with _ in Word APIs --- office-js/office-js.d.ts | 1460 ++++++++++++++++++++++++-------------- 1 file changed, 941 insertions(+), 519 deletions(-) diff --git a/office-js/office-js.d.ts b/office-js/office-js.d.ts index f2bebfe3da..4f21022fe5 100644 --- a/office-js/office-js.d.ts +++ b/office-js/office-js.d.ts @@ -53,7 +53,7 @@ declare namespace Office { displayLanguage: string; license: string; touchEnabled: boolean; - ui: UI; + ui: UI; requirements: { /** * Check if the specified requirement set is supported by the host Office application. @@ -67,51 +67,54 @@ declare namespace Office { message: string; name: string; } - export interface UI { - /** - * Displays a dialog to show or collect information from the user or to facilitate Web navigation. - * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. - * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. - * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. - */ - displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; - /** - * When called from an active add-in dialog, asynchronously closes the dialog. - */ - close(): void; - /** - * Synchronously delivers a message from the dialog to its parent add-in. - * @param messageObject Accepts a message from the dialog to deliver to the add-in. - */ - messageParent(messageObject: any): void; + export interface UI { + /** + * Displays a dialog to show or collect information from the user or to facilitate Web navigation. + * @param startAddress Accepts the initial HTTPS Url that opens in the dialog. + * @param options Optional. Accepts a DialogOptions object to define dialog behaviors. + * @param callback Optional. Accepts a callback method to handle the dialog creation attempt. + */ + displayDialogAsync(startAddress: string, options?: DialogOptions, callback?: (result: AsyncResult) => void): void; + /** + * When called from an active add-in dialog, asynchronously closes the dialog. + */ + close(): void; + /** + * Synchronously delivers a message from the dialog to its parent add-in. + * @param messageObject Accepts a message from the dialog to deliver to the add-in. + */ + messageParent(messageObject: any): void; } export interface DialogOptions { /** * Optional. Defines the width of the dialog as a percentage of the current display. Defaults to 99%. 250px minimum. */ - height?: number, + height?: number, /** * Optional. Defines the height of the dialog as a percentage of the current display. Defaults to 99%. 150px minimum. */ - width?: number, + width?: number, /** * Optional. Specifies whether the dialog can only display pages that have HTTPS URLs. */ - requireHTTPS?: boolean, + requireHTTPS?: boolean, /** * Optional. Determines whether the dialog is safe to display within a Web frame. */ xFrameDenySafe?: boolean, } } -declare namespace OfficeExtension { + +declare module OfficeExtension { /** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling "context.sync()". */ class ClientObject { /** The request context associated with the object */ context: ClientRequestContext; + /** Returns a boolean value for whether the corresponding object is null. You must call "context.sync()" before reading the isNull property. [Api set: ExcelApi 1.3 (Preview), WordApi 1.3] */ + isNull: boolean; } } -declare namespace OfficeExtension { +declare module OfficeExtension { interface LoadOption { select?: string | string[]; expand?: string | string[]; @@ -127,18 +130,18 @@ declare namespace OfficeExtension { load(object: ClientObject, option?: string | string[] | LoadOption): void; /** Adds a trace message to the queue. If the promise returned by "context.sync()" is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */ trace(message: string): void; - /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code.�This method returns a promise, which is resolved when the synchronization is complete. */ + /** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code. This method returns a promise, which is resolved when the synchronization is complete. */ sync(passThroughValue?: T): IPromise; } } -declare namespace OfficeExtension { +declare module OfficeExtension { /** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */ class ClientResult { /** The value of the result that is retrieved from the document after "context.sync()" is invoked. */ value: T; } } -declare namespace OfficeExtension { +declare module OfficeExtension { /** The error object returned by "context.sync()", if a promise is rejected due to an error while processing the request. */ class Error { /** Error name: "OfficeExtension.Error".*/ @@ -158,68 +161,186 @@ declare namespace OfficeExtension { }; } } -declare namespace OfficeExtension { +declare module OfficeExtension { class ErrorCodes { static accessDenied: string; static generalException: string; static activityLimitReached: string; + static invalidObjectPath: string; + static propertyNotLoaded: string; + static valueNotLoaded: string; + static invalidRequestContext: string; + static invalidArgument: string; + static runMustReturnPromise: string; + static cannotRegisterEvent: string; } } -declare namespace OfficeExtension { - /** A Promise object that represents a deferred interaction with the host Office application. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. */ +declare module OfficeExtension { + /** An IPromise object that represents a deferred interaction with the host Office application. */ interface IPromise { /** * This method will be called once the previous promise has been resolved. * Both the onFulfilled on onRejected callbacks are optional. * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. */ then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise; + /** * This method will be called once the previous promise has been resolved. * Both the onFulfilled on onRejected callbacks are optional. * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. */ then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise; + /** * This method will be called once the previous promise has been resolved. * Both the onFulfilled on onRejected callbacks are optional. * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. */ then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise; + /** * This method will be called once the previous promise has been resolved. * Both the onFulfilled on onRejected callbacks are optional. * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. */ then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise; + /** * This method will be called once the previous promise has been resolved. * Both the onFulfilled on onRejected callbacks are optional. * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. */ then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise; + /** * This method will be called once the previous promise has been resolved. * Both the onFulfilled on onRejected callbacks are optional. * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. */ then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise; + + /** * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. * @param onRejected function to be called if or when the promise rejects. */ catch(onRejected?: (error: any) => IPromise): IPromise; + /** * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. * @param onRejected function to be called if or when the promise rejects. */ catch(onRejected?: (error: any) => U): IPromise; + + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => void): IPromise; + } + + /** An Promise object that represents a deferred interaction with the host Office application. The publically-consumable OfficeExtension.Promise is available starting in ExcelApi 1.2 and WordApi 1.2. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. When a "native" Promise implementation is available, OfficeExtension.Promise will switch to use the native Promise instead. */ + export class Promise implements IPromise + { + /** + * Creates a new promise based on a function that accepts resolve and reject handlers. + */ + constructor(func: (resolve, reject) => void); + + /** + * Creates a promise that resolves when all of the child promises resolve. + */ + static all(promises: OfficeExtension.IPromise[]): IPromise; + + /** + * Creates a promise that is resolved. + */ + static resolve(value: U): IPromise; + + /** + * Creates a promise that is rejected. + */ + static reject(error: any): IPromise; + + /* This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => IPromise): IPromise; + + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => U): IPromise; + + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => IPromise, onRejected?: (error: any) => void): IPromise; + + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise): IPromise; + + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise; + + /** + * This method will be called once the previous promise has been resolved. + * Both the onFulfilled on onRejected callbacks are optional. + * If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called. + + * @returns A new promise for the value or error that was returned from onFulfilled/onRejected. + */ + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise; + + + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => IPromise): IPromise; + + /** + * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. + * @param onRejected function to be called if or when the promise rejects. + */ + catch(onRejected?: (error: any) => U): IPromise; + /** * Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack. * @param onRejected function to be called if or when the promise rejects. @@ -227,7 +348,8 @@ declare namespace OfficeExtension { catch(onRejected?: (error: any) => void): IPromise; } } -declare namespace OfficeExtension { + +declare module OfficeExtension { /** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */ class TrackedObjects { /** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */ @@ -241,6 +363,26 @@ declare namespace OfficeExtension { } } +declare module OfficeExtension { + export class EventHandlers { + constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo); + add(handler: (args: T) => IPromise): EventHandlerResult; + remove(handler: (args: T) => IPromise): void; + removeAll(): void; + } + + export class EventHandlerResult { + constructor(context: ClientRequestContext, handlers: EventHandlers, handler: (args: T) => IPromise); + remove(): void; + } + + export interface EventInfo { + registerFunc: (callback: (args: any) => void) => IPromise; + unregisterFunc: (callback: (args: any) => void) => IPromise; + eventArgsTransformFunc: (args: any) => IPromise; + } +} + declare namespace Office { /** * Returns a promise of an object described in the expression. Callback is invoked only if method fails. @@ -467,7 +609,7 @@ declare namespace Office { * asyncContext: Object keeping state for the callback * @param callback The optional callback method */ - setDataAsync(data: TableData|any, options?: any, callback?: (result: AsyncResult) => void): void; + setDataAsync(data: TableData | any, options?: any, callback?: (result: AsyncResult) => void): void; } export interface Bindings { document: Document; @@ -743,7 +885,7 @@ declare namespace Office { * asyncContext: Object keeping state for the callback * @param callback The optional callback method */ - goToByIdAsync(id: string|number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void; + goToByIdAsync(id: string | number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void; /** * Removes an event handler for the specified event type. * @param eventType The event type. For document can be 'DocumentSelectionChanged' @@ -761,7 +903,7 @@ declare namespace Office { * asyncContext: Object keeping state for the callback * @param callback The optional callback method */ - setSelectedDataAsync(data: string|TableData|any[][], options?: any, callback?: (result: AsyncResult) => void): void; + setSelectedDataAsync(data: string | TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; } export interface File { size: number; @@ -853,7 +995,7 @@ declare namespace Office { * asyncContext: Object keeping state for the callback * @param callback The optional callback method */ - addColumnsAsync(tableData: TableData|any[][], options?: any, callback?: (result: AsyncResult) => void): void; + addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** * Adds the specified rows to the table * @param rows A 2D array with the rows to add @@ -861,7 +1003,7 @@ declare namespace Office { * asyncContext: Object keeping state for the callback * @param callback The optional callback method */ - addRowsAsync(rows: TableData|any[][], options?: any, callback?: (result: AsyncResult) => void): void; + addRowsAsync(rows: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void; /** * Clears the table * @param options Syntax example: {asyncContext:context} @@ -1503,9 +1645,238 @@ declare namespace Office { getWSSUrlAsync(options?: any, callback?: (result: AsyncResult) => void): void; } } - - -declare namespace Excel { +declare module Excel { + interface ThreeArrowsSet { + [index: number]: Icon; + redDownArrow: Icon; + yellowSideArrow: Icon; + greenUpArrow: Icon; + } + interface ThreeArrowsGraySet { + [index: number]: Icon; + grayDownArrow: Icon; + graySideArrow: Icon; + grayUpArrow: Icon; + } + interface ThreeFlagsSet { + [index: number]: Icon; + redFlag: Icon; + yellowFlag: Icon; + greenFlag: Icon; + } + interface ThreeTrafficLights1Set { + [index: number]: Icon; + redCircleWithBorder: Icon; + yellowCircle: Icon; + greenCircle: Icon; + } + interface ThreeTrafficLights2Set { + [index: number]: Icon; + redTrafficLight: Icon; + yellowTrafficLight: Icon; + greenTrafficLight: Icon; + } + interface ThreeSignsSet { + [index: number]: Icon; + redDiamond: Icon; + yellowTriangle: Icon; + greenCircle: Icon; + } + interface ThreeSymbolsSet { + [index: number]: Icon; + redCrossSymbol: Icon; + yellowExclamationSymbol: Icon; + greenCheckSymbol: Icon; + } + interface ThreeSymbols2Set { + [index: number]: Icon; + redCross: Icon; + yellowExclamation: Icon; + greenCheck: Icon; + } + interface FourArrowsSet { + [index: number]: Icon; + redDownArrow: Icon; + yellowDownInclineArrow: Icon; + yellowUpInclineArrow: Icon; + greenUpArrow: Icon; + } + interface FourArrowsGraySet { + [index: number]: Icon; + grayDownArrow: Icon; + grayDownInclineArrow: Icon; + grayUpInclineArrow: Icon; + grayUpArrow: Icon; + } + interface FourRedToBlackSet { + [index: number]: Icon; + blackCircle: Icon; + grayCircle: Icon; + pinkCircle: Icon; + redCircle: Icon; + } + interface FourRatingSet { + [index: number]: Icon; + oneBar: Icon; + twoBars: Icon; + threeBars: Icon; + fourBars: Icon; + } + interface FourTrafficLightsSet { + [index: number]: Icon; + blackCircleWithBorder: Icon; + redCircleWithBorder: Icon; + yellowCircle: Icon; + greenCircle: Icon; + } + interface FiveArrowsSet { + [index: number]: Icon; + redDownArrow: Icon; + yellowDownInclineArrow: Icon; + yellowSideArrow: Icon; + yellowUpInclineArrow: Icon; + greenUpArrow: Icon; + } + interface FiveArrowsGraySet { + [index: number]: Icon; + grayDownArrow: Icon; + grayDownInclineArrow: Icon; + graySideArrow: Icon; + grayUpInclineArrow: Icon; + grayUpArrow: Icon; + } + interface FiveRatingSet { + [index: number]: Icon; + noBars: Icon; + oneBar: Icon; + twoBars: Icon; + threeBars: Icon; + fourBars: Icon; + } + interface FiveQuartersSet { + [index: number]: Icon; + whiteCircleAllWhiteQuarters: Icon; + circleWithThreeWhiteQuarters: Icon; + circleWithTwoWhiteQuarters: Icon; + circleWithOneWhiteQuarter: Icon; + blackCircle: Icon; + } + interface ThreeStarsSet { + [index: number]: Icon; + silverStar: Icon; + halfGoldStar: Icon; + goldStar: Icon; + } + interface ThreeTrianglesSet { + [index: number]: Icon; + redDownTriangle: Icon; + yellowDash: Icon; + greenUpTriangle: Icon; + } + interface FiveBoxesSet { + [index: number]: Icon; + noFilledBoxes: Icon; + oneFilledBox: Icon; + twoFilledBoxes: Icon; + threeFilledBoxes: Icon; + fourFilledBoxes: Icon; + } + interface IconCollections { + threeArrows: ThreeArrowsSet; + threeArrowsGray: ThreeArrowsGraySet; + threeFlags: ThreeFlagsSet; + threeTrafficLights1: ThreeTrafficLights1Set; + threeTrafficLights2: ThreeTrafficLights2Set; + threeSigns: ThreeSignsSet; + threeSymbols: ThreeSymbolsSet; + threeSymbols2: ThreeSymbols2Set; + fourArrows: FourArrowsSet; + fourArrowsGray: FourArrowsGraySet; + fourRedToBlack: FourRedToBlackSet; + fourRating: FourRatingSet; + fourTrafficLights: FourTrafficLightsSet; + fiveArrows: FiveArrowsSet; + fiveArrowsGray: FiveArrowsGraySet; + fiveRating: FiveRatingSet; + fiveQuarters: FiveQuartersSet; + threeStars: ThreeStarsSet; + threeTriangles: ThreeTrianglesSet; + fiveBoxes: FiveBoxesSet; + } + var icons: IconCollections; + /** + * + * Provides information about the binding that raised the SelectionChanged event. + * + * [Api set: ExcelApi 1.2] + */ + interface BindingSelectionChangedEventArgs { + /** + * + * Gets the Binding object that represents the binding that raised the SelectionChanged event. + * + * [Api set: ExcelApi 1.2] + */ + binding: Excel.Binding; + /** + * + * Gets the number of columns selected. + * + * [Api set: ExcelApi 1.2] + */ + columnCount: number; + /** + * + * Gets the number of rows selected. + * + * [Api set: ExcelApi 1.2] + */ + rowCount: number; + /** + * + * Gets the index of the first column of the selection (zero-based). + * + * [Api set: ExcelApi 1.2] + */ + startColumn: number; + /** + * + * Gets the index of the first row of the selection (zero-based). + * + * [Api set: ExcelApi 1.2] + */ + startRow: number; + } + /** + * + * Provides information about the binding that raised the DataChanged event. + * + * [Api set: ExcelApi 1.2] + */ + interface BindingDataChangedEventArgs { + /** + * + * Gets the Binding object that represents the binding that raised the DataChanged event. + * + * [Api set: ExcelApi 1.2] + */ + binding: Excel.Binding; + } + /** + * + * Provides information about the document that raised the SelectionChanged event. + * + * [Api set: ExcelApi 1.2] + */ + interface SelectionChangedEventArgs { + /** + * + * Gets the workbook object that raised the SelectionChanged event. + * + * [Api set: ExcelApi 1.2] + */ + workbook: Excel.Workbook; + } /** * * Represents the Excel application that manages the workbook. @@ -1546,8 +1917,10 @@ declare namespace Excel { private m_bindings; private m_functions; private m_names; + private m_pivotTables; private m_tables; private m_worksheets; + private m_selectionChanged; /** * * Represents Excel application instance that contains this workbook. Read-only. @@ -1576,6 +1949,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ names: Excel.NamedItemCollection; + /** + * + * Represents a collection of PivotTables associated with the workbook. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + pivotTables: Excel.PivotTableCollection; /** * * Represents a collection of tables associated with the workbook. Read-only. @@ -1601,6 +1981,13 @@ declare namespace Excel { * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Excel.Workbook; + /** + * + * Occurs when the selection in the document is changed. + * + * [Api set: ExcelApi 1.2] + */ + onSelectionChanged: OfficeExtension.EventHandlers; } /** * @@ -1612,6 +1999,7 @@ declare namespace Excel { private m_charts; private m_id; private m_name; + private m_pivotTables; private m_position; private m_protection; private m_tables; @@ -1623,6 +2011,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ charts: Excel.ChartCollection; + /** + * + * Collection of PivotTables that are part of the worksheet. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + pivotTables: Excel.PivotTableCollection; /** * * Returns sheet protection object for a worksheet. @@ -1702,7 +2097,7 @@ declare namespace Excel { * * The used range is the smallest range that encompasses any cells that have a value or formatting assigned to them. If the worksheet is blank, this function will return the top left cell. * - * @param valuesOnly Considers only cells with values as used cells (ignores formatting). [Parameter available: ExcelApi 1.2] + * @param valuesOnly Considers only cells with values as used cells (ignores formatting). [Api set: ExcelApi 1.2] * * [Api set: ExcelApi 1.1] */ @@ -1747,6 +2142,15 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getItem(key: string): Excel.Worksheet; + /** + * + * Gets a worksheet object using its Name or ID. If the worksheet does not exist, the returned object's isNull property will be true. + * + * @param key The Name or ID of the worksheet. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(key: string): Excel.Worksheet; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -1777,7 +2181,7 @@ declare namespace Excel { protected: boolean; /** * - * Protect a worksheet. It throws if the worksheet has been protected. + * Protects a worksheet. Fails if the worksheet has been protected. * * @param options sheet protection options. * @@ -1786,7 +2190,7 @@ declare namespace Excel { protect(options?: Excel.WorksheetProtectionOptions): void; /** * - * Unprotect a worksheet + * Unprotects a worksheet. * * [Api set: ExcelApi 1.2] */ @@ -1868,7 +2272,7 @@ declare namespace Excel { allowInsertRows?: boolean; /** * - * Represents the worksheet protection option of allowing using pivot table feature. + * Represents the worksheet protection option of allowing using PivotTable feature. * * [Api set: ExcelApi 1.2] */ @@ -1909,6 +2313,8 @@ declare namespace Excel { private m_values; private m_worksheet; private m__ReferenceId; + private _ensureInteger(num, methodName); + private _getAdjacentRange(functionName, count, referenceRange, rowDirection, columnDirection); /** * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. Read-only. @@ -1916,6 +2322,12 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format: Excel.RangeFormat; + /** + * + * Represents the range sort of the current range. + * + * [Api set: ExcelApi 1.2] + */ sort: Excel.RangeSort; /** * @@ -2089,6 +2501,24 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getColumn(column: number): Excel.Range; + /** + * + * Gets a certain number of columns to the right of the current Range object. + * + * @param count The number of columns to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1. + * + * [Api set: ExcelApi 1.2] + */ + getColumnsAfter(count?: number): Excel.Range; + /** + * + * Gets a certain number of columns to the left of the current Range object. + * + * @param count The number of columns to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1. + * + * [Api set: ExcelApi 1.2] + */ + getColumnsBefore(count?: number): Excel.Range; /** * * Gets an object that represents the entire column of the range. @@ -2112,6 +2542,15 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getIntersection(anotherRange: Excel.Range | string): Excel.Range; + /** + * + * Gets the range object that represents the rectangular intersection of the given ranges. If no intersection is found, will return a null object. + * + * @param anotherRange The range object or range address that will be used to determine the intersection of ranges. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getIntersectionOrNull(anotherRange: Excel.Range | string): Excel.Range; /** * * Gets the last cell within the range. For example, the last cell of "B2:D5" is "D5". @@ -2143,6 +2582,16 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getOffsetRange(rowOffset: number, columnOffset: number): Excel.Range; + /** + * + * Gets a Range object similar to the current Range object, but with its bottom-right corner expanded (or contracted) by some number of rows and columns. + * + * @param deltaRows The number of rows by which to expand the bottom-right corner, relative to the current range. Use a positive number to expand the range, or a negative number to decrease it. + * @param deltaColumns The number of columnsby which to expand the bottom-right corner, relative to the current range. Use a positive number to expand the range, or a negative number to decrease it. + * + * [Api set: ExcelApi 1.2] + */ + getResizedRange(deltaRows: number, deltaColumns: number): Excel.Range; /** * * Gets a row contained in the range. @@ -2152,15 +2601,40 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getRow(row: number): Excel.Range; + /** + * + * Gets a certain number of rows above the current Range object. + * + * @param count The number of rows to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1. + * + * [Api set: ExcelApi 1.2] + */ + getRowsAbove(count?: number): Excel.Range; + /** + * + * Gets a certain number of rows below the current Range object. + * + * @param count The number of rows to include in the resulting range. In general, use a positive number to create a range outside the current range. You can also use a negative number to create a range within the current range. The default value is 1. + * + * [Api set: ExcelApi 1.2] + */ + getRowsBelow(count?: number): Excel.Range; /** * * Returns the used range of the given range object. * - * @param valuesOnly Considers only cells with values as used cells. [Parameter available: ExcelApi 1.2] + * @param valuesOnly Considers only cells with values as used cells. [Api set: ExcelApi 1.2] * * [Api set: ExcelApi 1.1] */ getUsedRange(valuesOnly?: boolean): Excel.Range; + /** + * + * Represents the visible rows of the current range. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getVisibleView(): Excel.RangeView; /** * * Inserts a cell or a range of cells into the worksheet in place of this range, and shifts the other cells to make space. Returns a new Range object at the now blank space. @@ -2207,6 +2681,129 @@ declare namespace Excel { interface RangeReference { address: string; } + /** + * + * RangeView represents a set of visible cells of the parent range. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + class RangeView extends OfficeExtension.ClientObject { + private m_columnCount; + private m_formulas; + private m_formulasLocal; + private m_formulasR1C1; + private m_numberFormat; + private m_rowCount; + private m_rows; + private m_text; + private m_valueTypes; + private m_values; + /** + * + * Represents a collection of range views associated with the range. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + rows: Excel.RangeViewCollection; + /** + * + * Returns the number of visible columns. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + columnCount: number; + /** + * + * Represents the formula in A1-style notation. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + formulas: Array>; + /** + * + * Represents the formula in A1-style notation, in the user's language and number-formatting locale. For example, the English "=SUM(A1, 1.5)" formula would become "=SUMME(A1; 1,5)" in German. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + formulasLocal: Array>; + /** + * + * Represents the formula in R1C1-style notation. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + formulasR1C1: Array>; + /** + * + * Represents Excel's number format code for the given cell. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + numberFormat: Array>; + /** + * + * Returns the number of visible rows. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + rowCount: number; + /** + * + * Text values of the specified range. The Text value will not depend on the cell width. The # sign substitution that happens in Excel UI will not affect the text value returned by the API. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + text: Array>; + /** + * + * Represents the type of data of each cell. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + valueTypes: Array>; + /** + * + * Represents the raw values of the specified range view. The data returned could be of type string, number, or a boolean. Cell that contain an error will return the error string. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + values: Array>; + /** + * + * Gets the parent range associated with the current RangeView. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getRange(): Excel.Range; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: string | string[] | OfficeExtension.LoadOption): Excel.RangeView; + } + /** + * + * Represents a collection of worksheet objects that are part of the workbook. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + class RangeViewCollection extends OfficeExtension.ClientObject { + private m__items; + /** Gets the loaded child items in this collection. */ + items: Array; + /** + * + * Gets a RangeView Row via it's index. Zero-Indexed. + * + * @param index Index of the visible row. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItem(index: number): Excel.RangeView; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: string | string[] | OfficeExtension.LoadOption): Excel.RangeViewCollection; + } /** * * A collection of all the nameditem objects that are part of the workbook. @@ -2226,6 +2823,15 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getItem(name: string): Excel.NamedItem; + /** + * + * Gets a nameditem object using its name. If the nameditem object does not exist, the returned object's isNull property will be true. + * + * @param name nameditem name. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(name: string): Excel.NamedItem; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -2292,6 +2898,8 @@ declare namespace Excel { class Binding extends OfficeExtension.ClientObject { private m_id; private m_type; + private m_dataChanged; + private m_selectionChanged; /** * * Represents binding identifier. Read-only. @@ -2331,6 +2939,20 @@ declare namespace Excel { * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Excel.Binding; + /** + * + * Occurs when data within the binding is changed. + * + * [Api set: ExcelApi 1.2] + */ + onDataChanged: OfficeExtension.EventHandlers; + /** + * + * Occurs when the selection is changed within the binding. + * + * [Api set: ExcelApi 1.2] + */ + onSelectionChanged: OfficeExtension.EventHandlers; } /** * @@ -2350,6 +2972,38 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ count: number; + /** + * + * Add a new binding to a particular Range. + * + * @param range Range to bind the binding to. May be an Excel Range object, or a string. If string, must contain the full address, including the sheet name + * @param bindingType Type of binding. See Excel.BindingType. + * @param id Name of binding. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + add(range: Excel.Range | string, bindingType: string, id: string): Excel.Binding; + /** + * + * Add a new binding based on a named item in the workbook. + * + * @param name Name from which to create binding. + * @param bindingType Type of binding. See Excel.BindingType. + * @param id Name of binding. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + addFromNamedItem(name: string, bindingType: string, id: string): Excel.Binding; + /** + * + * Add a new binding based on the current selection. + * + * @param bindingType Type of binding. See Excel.BindingType. + * @param id Name of binding. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + addFromSelection(bindingType: string, id: string): Excel.Binding; /** * * Gets a binding object by ID. @@ -2368,6 +3022,15 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getItemAt(index: number): Excel.Binding; + /** + * + * Gets a binding object by ID. If the binding object does not exist, the return object's isNull property will be true. + * + * @param id Id of the binding object to be retrieved. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(id: string): Excel.Binding; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -2419,6 +3082,15 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getItemAt(index: number): Excel.Table; + /** + * + * Gets a table by Name or ID. If the table does not exist, the return object's isNull property will be true. + * + * @param key Name or ID of the table to be retrieved. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(key: number | string): Excel.Table; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -2432,9 +3104,14 @@ declare namespace Excel { */ class Table extends OfficeExtension.ClientObject { private m_columns; + private m_highlightFirstColumn; + private m_highlightLastColumn; private m_id; private m_name; private m_rows; + private m_showBandedColumns; + private m_showBandedRows; + private m_showFilterButton; private m_showHeaders; private m_showTotals; private m_sort; @@ -2468,6 +3145,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet: Excel.Worksheet; + /** + * + * Indicates whether the first column contains special formatting. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + highlightFirstColumn: boolean; + /** + * + * Indicates whether the last column contains special formatting. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + highlightLastColumn: boolean; /** * * Returns a value that uniquely identifies the table in a given workbook. The value of the identifier remains the same even when the table is renamed. Read-only. @@ -2482,6 +3173,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name: string; + /** + * + * Indicates whether the columns show banded formatting in which odd columns are highlighted differently from even ones to make reading the table easier. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + showBandedColumns: boolean; + /** + * + * Indicates whether the rows show banded formatting in which odd rows are highlighted differently from even ones to make reading the table easier. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + showBandedRows: boolean; + /** + * + * Indicates whether the filter buttons are visible at the top of each column header. Setting this is only allowed if the table contains a header row. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + showFilterButton: boolean; /** * * Indicates whether the header row is visible or not. This value can be set to show or remove the header row. @@ -2610,6 +3322,15 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getItemAt(index: number): Excel.TableColumn; + /** + * + * Gets a column object by Name or ID. If the column does not exist, the returned object's isNull property will be true. + * + * @param key Column Name or ID. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(key: number | string): Excel.TableColumn; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -3131,6 +3852,16 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ getItemAt(index: number): Excel.Chart; + /** + * + * Gets a chart using its name. If there are multiple charts with the same name, the first one will be returned. + If the chart does not exist, the returned object's isNull property will be true. + * + * @param name Name of the chart to be retrieved. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(name: string): Excel.Chart; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -4380,7 +5111,7 @@ declare namespace Excel { * * The first criterion used to filter data. Used as an operator in the case of "custom" filtering. For example ">50" for number greater than 50 or "=*s" for values ending in "s". - + Used as a number in the case of top/bottom items/percents. E.g. "5" for the top 5 items if filterOn is set to "topItems" * * [Api set: ExcelApi 1.2] @@ -4473,10 +5204,85 @@ declare namespace Excel { */ set: string; } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + class PivotTableCollection extends OfficeExtension.ClientObject { + private m__items; + /** Gets the loaded child items in this collection. */ + items: Array; + /** + * + * Gets a PivotTable by name. + * + * @param name Name of the PivotTable to be retrieved. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItem(name: string): Excel.PivotTable; + /** + * + * Gets a PivotTable by name. If the PivotTable does not exist, the return object's isNull property will be true. + * + * @param name Name of the PivotTable to be retrieved. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + getItemOrNull(name: string): Excel.PivotTable; + /** + * + * Refreshes all the PivotTables in the collection. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + refreshAll(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: string | string[] | OfficeExtension.LoadOption): Excel.PivotTableCollection; + } + /** + * + * Represents an Excel PivotTable. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + class PivotTable extends OfficeExtension.ClientObject { + private m_name; + private m_worksheet; + /** + * + * The worksheet containing the current PivotTable. Read-only. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + worksheet: Excel.Worksheet; + /** + * + * Name of the PivotTable. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + name: string; + /** + * + * Refreshes the PivotTable. + * + * [Api set: ExcelApi 1.3 (Preview)] + */ + refresh(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + */ + load(option?: string | string[] | OfficeExtension.LoadOption): Excel.PivotTable; + } /** * [Api set: ExcelApi 1.1] */ - namespace BindingType { + module BindingType { var range: string; var table: string; var text: string; @@ -4484,7 +5290,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace BorderIndex { + module BorderIndex { var edgeTop: string; var edgeBottom: string; var edgeLeft: string; @@ -4497,7 +5303,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace BorderLineStyle { + module BorderLineStyle { var none: string; var continuous: string; var dash: string; @@ -4510,7 +5316,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace BorderWeight { + module BorderWeight { var hairline: string; var thin: string; var medium: string; @@ -4519,7 +5325,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace CalculationMode { + module CalculationMode { var automatic: string; var automaticExceptTables: string; var manual: string; @@ -4527,7 +5333,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace CalculationType { + module CalculationType { var recalculate: string; var full: string; var fullRebuild: string; @@ -4535,7 +5341,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace ClearApplyTo { + module ClearApplyTo { var all: string; var formats: string; var contents: string; @@ -4543,7 +5349,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace ChartDataLabelPosition { + module ChartDataLabelPosition { var invalid: string; var none: string; var center: string; @@ -4560,7 +5366,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace ChartLegendPosition { + module ChartLegendPosition { var invalid: string; var top: string; var bottom: string; @@ -4570,9 +5376,17 @@ declare namespace Excel { var custom: string; } /** + * + * Specifies whether the series are by rows or by columns. On Desktop, the "auto" option will inspect the source data shape to automatically guess whether the data is by rows or columns; on Excel Online, "auto" will simply default to "columns". + * * [Api set: ExcelApi 1.1] */ - namespace ChartSeriesBy { + module ChartSeriesBy { + /** + * + * On Desktop, the "auto" option will inspect the source data shape to automatically guess whether the data is by rows or columns; on Excel Online, "auto" will simply default to "columns". + * + */ var auto: string; var columns: string; var rows: string; @@ -4580,7 +5394,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace ChartType { + module ChartType { var invalid: string; var columnClustered: string; var columnStacked: string; @@ -4659,21 +5473,21 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace ChartUnderlineStyle { + module ChartUnderlineStyle { var none: string; var single: string; } /** * [Api set: ExcelApi 1.1] */ - namespace DeleteShiftDirection { + module DeleteShiftDirection { var up: string; var left: string; } /** * [Api set: ExcelApi 1.2] */ - namespace DynamicFilterCriteria { + module DynamicFilterCriteria { var unknown: string; var aboveAverage: string; var allDatesInPeriodApril: string; @@ -4713,7 +5527,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace FilterDatetimeSpecificity { + module FilterDatetimeSpecificity { var year: string; var month: string; var day: string; @@ -4724,7 +5538,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace FilterOn { + module FilterOn { var bottomItems: string; var bottomPercent: string; var cellColor: string; @@ -4739,14 +5553,14 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace FilterOperator { + module FilterOperator { var and: string; var or: string; } /** * [Api set: ExcelApi 1.1] */ - namespace HorizontalAlignment { + module HorizontalAlignment { var general: string; var left: string; var center: string; @@ -4759,7 +5573,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace IconSet { + module IconSet { var invalid: string; var threeArrows: string; var threeArrowsGray: string; @@ -4785,7 +5599,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace ImageFittingMode { + module ImageFittingMode { var fit: string; var fitAndCenter: string; var fill: string; @@ -4793,14 +5607,14 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace InsertShiftDirection { + module InsertShiftDirection { var down: string; var right: string; } /** * [Api set: ExcelApi 1.1] */ - namespace NamedItemType { + module NamedItemType { var string: string; var integer: string; var double: string; @@ -4810,7 +5624,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace RangeUnderlineStyle { + module RangeUnderlineStyle { var none: string; var single: string; var double: string; @@ -4820,7 +5634,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace SheetVisibility { + module SheetVisibility { var visible: string; var hidden: string; var veryHidden: string; @@ -4828,7 +5642,7 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.1] */ - namespace RangeValueType { + module RangeValueType { var unknown: string; var empty: string; var string: string; @@ -4840,14 +5654,14 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace SortOrientation { + module SortOrientation { var rows: string; var columns: string; } /** * [Api set: ExcelApi 1.2] */ - namespace SortOn { + module SortOn { var value: string; var cellColor: string; var fontColor: string; @@ -4856,21 +5670,21 @@ declare namespace Excel { /** * [Api set: ExcelApi 1.2] */ - namespace SortDataOption { + module SortDataOption { var normal: string; var textAsNumber: string; } /** * [Api set: ExcelApi 1.2] */ - namespace SortMethod { + module SortMethod { var pinYin: string; var strokeCount: string; } /** * [Api set: ExcelApi 1.1] */ - namespace VerticalAlignment { + module VerticalAlignment { var top: string; var center: string; var bottom: string; @@ -8229,6 +9043,57 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ tbillYield(settlement: number | string | boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult, maturity: number | string | boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult, pr: number | string | boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; + /** + * + * Returns the left-tailed Student's t-distribution. + * + * @param x Is the numeric value at which to evaluate the distribution. + * @param degFreedom Is an integer indicating the number of degrees of freedom that characterize the distribution. + * @param cumulative Is a logical value: for the cumulative distribution function, use TRUE; for the probability density function, use FALSE. + * + * [Api set: ExcelApi 1.2] + */ + t_Dist(x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, cumulative: boolean | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; + /** + * + * Returns the two-tailed Student's t-distribution. + * + * @param x Is the numeric value at which to evaluate the distribution. + * @param degFreedom Is an integer indicating the number of degrees of freedom that characterize the distribution. + * + * [Api set: ExcelApi 1.2] + */ + t_Dist_2T(x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; + /** + * + * Returns the right-tailed Student's t-distribution. + * + * @param x Is the numeric value at which to evaluate the distribution. + * @param degFreedom Is an integer indicating the number of degrees of freedom that characterize the distribution. + * + * [Api set: ExcelApi 1.2] + */ + t_Dist_RT(x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; + /** + * + * Returns the left-tailed inverse of the Student's t-distribution. + * + * @param probability Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive. + * @param degFreedom Is a positive integer indicating the number of degrees of freedom to characterize the distribution. + * + * [Api set: ExcelApi 1.2] + */ + t_Inv(probability: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; + /** + * + * Returns the two-tailed inverse of the Student's t-distribution. + * + * @param probability Is the probability associated with the two-tailed Student's t-distribution, a number between 0 and 1 inclusive. + * @param degFreedom Is a positive integer indicating the number of degrees of freedom to characterize the distribution. + * + * [Api set: ExcelApi 1.2] + */ + t_Inv_2T(probability: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, degFreedom: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; /** * * Returns the tangent of an angle. @@ -8598,7 +9463,7 @@ declare namespace Excel { */ z_Test(array: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, x: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult, sigma?: number | Excel.Range | Excel.RangeReference | Excel.FunctionResult): FunctionResult; } - namespace ErrorCodes { + module ErrorCodes { var accessDenied: string; var generalException: string; var insertDeleteConflict: string; @@ -8613,7 +9478,7 @@ declare namespace Excel { var unsupportedOperation: string; } } -declare namespace Excel { +declare module Excel { /** * The RequestContext object facilitates requests to the Excel application. Since the Office add-in and the Excel application run in two different processes, the request context is required to get access to the Excel object model from the add-in. */ @@ -8646,10 +9511,6 @@ declare namespace Word { * [Api set: WordApiDesktop 1.3 Beta] */ createDocument(base64File?: string): Word.Document; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Create a new instance of Word.Application object */ @@ -8751,13 +9612,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ type: string; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Clears the contents of the body object. The user can perform the undo operation on the cleared content. @@ -8905,16 +9759,10 @@ declare namespace Word { * [Api set: WordApi 1.1] */ select(selectionMode?: string): void; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Body; - _initReferenceId(value: string): void; } /** * @@ -9100,13 +9948,6 @@ declare namespace Word { * [Api set: WordApi 1.1] */ type: string; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Clears the contents of the content control. The user can perform the undo operation on the cleared content. @@ -9278,16 +10119,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ split(delimiters: Array, multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.ContentControl; - _initReferenceId(value: string): void; } /** * @@ -9308,13 +10143,6 @@ declare namespace Word { first: Word.ContentControl; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Gets a content control by its identifier. @@ -9360,16 +10188,10 @@ declare namespace Word { * [Api set: WordApi 1.1] */ getItem(index: number): Word.ContentControl; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.ContentControlCollection; - _initReferenceId(value: string): void; } /** * @@ -9411,13 +10233,6 @@ declare namespace Word { * [Api set: WordApi 1.1] */ saved: boolean; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Gets the current selection of the document. Multiple selections are not supported. @@ -9439,20 +10254,10 @@ declare namespace Word { * [Api set: WordApi 1.1] */ save(): void; - _GetObjectByReferenceId(referenceId: string): OfficeExtension.ClientResult; - _GetObjectTypeNameByReferenceId(referenceId: string): OfficeExtension.ClientResult; - _KeepReference(): void; - _RemoveAllReferences(): void; - _RemoveReference(referenceId: string): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Document; - _initReferenceId(value: string): void; } /** * @@ -9550,23 +10355,10 @@ declare namespace Word { * [Api set: WordApi 1.1] */ underline: string; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Font; - _initReferenceId(value: string): void; } /** * @@ -9673,20 +10465,6 @@ declare namespace Word { * [Api set: WordApi 1.1] */ width: number; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Deletes the inline picture from the document. @@ -9796,16 +10574,10 @@ declare namespace Word { * [Api set: WordApi 1.2] */ select(selectionMode?: string): void; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.InlinePicture; - _initReferenceId(value: string): void; } /** * @@ -9826,32 +10598,10 @@ declare namespace Word { first: Word.InlinePicture; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets an inline picture object by its index in the collection. - * - * @param index A number that identifies the index location of an inline picture object. - * - * [Api set: WordApi 1.1] - */ - _GetItem(index: number): Word.InlinePicture; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.InlinePictureCollection; - _initReferenceId(value: string): void; } /** * @@ -9877,7 +10627,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ id: number; - _ReferenceId: string; /** * * Gets the paragraphs in the list. @@ -9897,16 +10646,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ insertParagraph(paragraphText: string, insertLocation: string): Word.Paragraph; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.List; - _initReferenceId(value: string): void; } /** * @@ -9927,7 +10670,6 @@ declare namespace Word { first: Word.List; /** Gets the loaded child items in this collection. */ items: Array; - _ReferenceId: string; /** * * Gets a list by its identifier. @@ -9937,25 +10679,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ getById(id: number): Word.List; - /** - * - * Gets a list object by its index in the collection. - * - * @param index A number that identifies the index location of a list object. - * - * [Api set: WordApi 1.3 Beta] - */ - _GetItem(index: number): Word.List; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.ListCollection; - _initReferenceId(value: string): void; } /** * @@ -9973,17 +10700,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ levelTypes: Array; - _ReferenceId: string; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.ListFormat; - _initReferenceId(value: string): void; } /** * @@ -10009,7 +10729,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ siblingIndex: number; - _ReferenceId: string; /** * * Gets the list item parent, or the closest ancestor if the parent does not exist. @@ -10028,16 +10747,10 @@ declare namespace Word { * [Api set: WordApiDesktop 1.3 Beta] */ getDescendants(directChildrenOnly?: boolean): Word.ParagraphCollection; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.ListItem; - _initReferenceId(value: string): void; } /** * @@ -10248,20 +10961,6 @@ declare namespace Word { * [Api set: WordApi 1.1] */ text: string; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Clears the contents of the paragraph object. The user can perform the undo operation on the cleared content. @@ -10444,16 +11143,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ startNewList(): Word.List; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Paragraph; - _initReferenceId(value: string): void; } /** * @@ -10482,32 +11175,10 @@ declare namespace Word { last: Word.Paragraph; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a paragraph object by its index in the collection. - * - * @param index A number that identifies the index location of a paragraph object. - * - * [Api set: WordApi 1.1] - */ - _GetItem(index: number): Word.Paragraph; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.ParagraphCollection; - _initReferenceId(value: string): void; } /** * @@ -10630,20 +11301,6 @@ declare namespace Word { * [Api set: WordApi 1.1] */ text: string; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Clears the contents of the range object. The user can perform the undo operation on the cleared content. @@ -10864,16 +11521,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ split(delimiters: Array, multiParagraphs?: boolean, trimDelimiters?: boolean, trimSpacing?: boolean): Word.RangeCollection; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Range; - _initReferenceId(value: string): void; } /** * @@ -10894,32 +11545,10 @@ declare namespace Word { first: Word.Range; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a range object by its index in the collection. - * - * @param index A number that identifies the index location of a range object. - * - * [Api set: WordApi 1.3 Beta] - */ - _GetItem(index: number): Word.Range; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.RangeCollection; - _initReferenceId(value: string): void; } /** * @@ -10993,10 +11622,6 @@ declare namespace Word { * [Api set: WordApi 1.1] */ matchWildcards: boolean; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ @@ -11025,32 +11650,10 @@ declare namespace Word { first: Word.Range; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a range object by its index in the collection. - * - * @param index A number that identifies the index location of a range object. - * - * [Api set: WordApi 1.1] - */ - _GetItem(index: number): Word.Range; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.SearchResultCollection; - _initReferenceId(value: string): void; } /** * @@ -11077,20 +11680,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ next: Word.Section; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Gets one of the section's footers. @@ -11109,16 +11698,10 @@ declare namespace Word { * [Api set: WordApi 1.1] */ getHeader(type: string): Word.Body; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Section; - _initReferenceId(value: string): void; } /** * @@ -11139,32 +11722,10 @@ declare namespace Word { first: Word.Section; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a section object by its index in the collection. - * - * @param index A number that identifies the index location of a section object. - * - * [Api set: WordApi 1.1] - */ - _GetItem(index: number): Word.Section; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.SectionCollection; - _initReferenceId(value: string): void; } /** * @@ -11399,20 +11960,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ width: number; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Adds columns to the start or end of the table, using the first or last existing column as a template. This is applicable to uniform tables. The string values, if specified, are set in the newly inserted rows. @@ -11594,16 +12141,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ select(selectionMode?: string): void; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.Table; - _initReferenceId(value: string): void; } /** * @@ -11624,32 +12165,10 @@ declare namespace Word { first: Word.Table; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a table object by its index in the collection. - * - * @param index A number that identifies the index location of a table object. - * - * [Api set: WordApi 1.3 Beta] - */ - _GetItem(index: number): Word.Table; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableCollection; - _initReferenceId(value: string): void; } /** * @@ -11780,20 +12299,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ verticalAlignment: string; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Clears the contents of the row. @@ -11863,16 +12368,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ select(selectionMode?: string): void; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableRow; - _initReferenceId(value: string): void; } /** * @@ -11893,32 +12392,10 @@ declare namespace Word { first: Word.TableRow; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a table row object by its index in the collection. - * - * @param index A number that identifies the index location of a table row object. - * - * [Api set: WordApi 1.3 Beta] - */ - _GetItem(index: number): Word.TableRow; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableRowCollection; - _initReferenceId(value: string): void; } /** * @@ -12049,20 +12526,6 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ width: number; - /** - * - * ID - * - * [Api set: WordApi] - */ - _Id: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; /** * * Deletes the column containing this cell. This is applicable to uniform tables. @@ -12118,16 +12581,10 @@ declare namespace Word { * [Api set: WordApiDesktop 1.3 Beta] */ split(rowCount: number, columnCount: number): void; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableCell; - _initReferenceId(value: string): void; } /** * @@ -12148,32 +12605,10 @@ declare namespace Word { first: Word.TableCell; /** Gets the loaded child items in this collection. */ items: Array; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - /** - * - * Gets a table cell object by its index in the collection. - * - * @param index A number that identifies the index location of a table cell object. - * - * [Api set: WordApi 1.3 Beta] - */ - _GetItem(index: number): Word.TableCell; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableCellCollection; - _initReferenceId(value: string): void; } /** * @@ -12207,23 +12642,10 @@ declare namespace Word { * [Api set: WordApi 1.3 Beta] */ width: number; - /** - * - * ReferenceId - * - * [Api set: WordApi] - */ - _ReferenceId: string; - _KeepReference(): void; - /** Handle results returned from the document - * @private - */ - _handleResult(value: any): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */ load(option?: string | string[] | OfficeExtension.LoadOption): Word.TableBorderStyle; - _initReferenceId(value: string): void; } /** * From d493dd6da5ee4b44ee6557b210587826514d4228 Mon Sep 17 00:00:00 2001 From: rchaser53 Date: Sat, 13 Aug 2016 19:16:48 +0900 Subject: [PATCH 075/203] arguments type changes for using stateless functional component --- react-dnd/react-dnd.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-dnd/react-dnd.d.ts b/react-dnd/react-dnd.d.ts index 6da351d4ff..71b6adb51b 100644 --- a/react-dnd/react-dnd.d.ts +++ b/react-dnd/react-dnd.d.ts @@ -40,7 +40,7 @@ declare module __ReactDnd { spec: DragSourceSpec

    , collect: DragSourceCollector, options?: DndOptions

    - ): (componentClass: React.ComponentClass

    ) => DndComponentClass

    ; + ): (componentClass: React.ComponentClass

    | React.StatelessComponent

    ) => DndComponentClass

    ; export function DropTarget

    ( types: Identifier | Identifier[] | ((props: P) => Identifier | Identifier[]), From 108c7a9dd19309a5ed9a76507e9a4a1545e7eab0 Mon Sep 17 00:00:00 2001 From: Dawson Reid Date: Sat, 13 Aug 2016 09:36:37 -0300 Subject: [PATCH 076/203] #10185 ReadableStream pause and resume now returns a ReadableStream. ReadWriteStream pause and resume now return a ReadWriteStream. --- node/node.d.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 6770d84632..1bc8deb34d 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -257,8 +257,8 @@ declare namespace NodeJS { readable: boolean; read(size?: number): string | Buffer; setEncoding(encoding: string): void; - pause(): void; - resume(): void; + pause(): ReadableStream; + resume(): ReadableStream; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; unshift(chunk: string): void; @@ -276,7 +276,10 @@ declare namespace NodeJS { end(str: string, encoding?: string, cb?: Function): void; } - export interface ReadWriteStream extends ReadableStream, WritableStream { } + export interface ReadWriteStream extends ReadableStream, WritableStream { + pause(): ReadWriteStream; + resume(): ReadWriteStream; + } export interface Events extends EventEmitter { } From aa7bb9d75219b752c7e400e886b5ae739d0e4c49 Mon Sep 17 00:00:00 2001 From: Dawson Reid Date: Sat, 13 Aug 2016 09:38:02 -0300 Subject: [PATCH 077/203] #10185 Readable class pause and resume now return a Readable. --- node/node.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 1bc8deb34d..fa058f6e80 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2187,8 +2187,8 @@ declare module "stream" { _read(size: number): void; read(size?: number): any; setEncoding(encoding: string): void; - pause(): void; - resume(): void; + pause(): Readable; + resume(): Readable; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; unshift(chunk: any): void; From f8d5764dbd0daa5dd64513c388a51b84c3be6842 Mon Sep 17 00:00:00 2001 From: Dawson Reid Date: Sat, 13 Aug 2016 09:40:43 -0300 Subject: [PATCH 078/203] #10185 Duplex now overrides Readable pause and resume to return a Duplex stream specifically. --- node/node.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index fa058f6e80..bdb2cd22ca 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2223,6 +2223,10 @@ declare module "stream" { // Note: Duplex extends both Readable and Writable. export class Duplex extends Readable implements NodeJS.ReadWriteStream { + // Readable + pause(): Duplex; + resume(): Duplex; + // Writeable writable: boolean; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: Function): void; From 23ceec1daf9fdf46975b88c1ef959a779387a68f Mon Sep 17 00:00:00 2001 From: Dawson Reid Date: Sat, 13 Aug 2016 09:42:29 -0300 Subject: [PATCH 079/203] #10185 The Socket class now overrides the Duplex stream's pause and resume to return a Socket specifically. --- node/node.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index bdb2cd22ca..7cab07935a 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1284,8 +1284,8 @@ declare module "net" { setEncoding(encoding?: string): void; write(data: any, encoding?: string, callback?: Function): void; destroy(): void; - pause(): void; - resume(): void; + pause(): Socket; + resume(): Socket; setTimeout(timeout: number, callback?: Function): void; setNoDelay(noDelay?: boolean): void; setKeepAlive(enable?: boolean, initialDelay?: number): void; From db7a37d18c9ebfdea8076243adf6fd23939f8430 Mon Sep 17 00:00:00 2001 From: Dawson Reid Date: Sat, 13 Aug 2016 09:44:16 -0300 Subject: [PATCH 080/203] #10185 The Transform class now overrides pause and resume to return a Transform specifically. --- node/node.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 7cab07935a..e4e11b40f6 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2251,8 +2251,8 @@ declare module "stream" { _flush(callback: Function): void; read(size?: number): any; setEncoding(encoding: string): void; - pause(): void; - resume(): void; + pause(): Transform; + resume(): Transform; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(destination?: T): void; unshift(chunk: any): void; From fccee9cdb8c049beb89627c8ce21fd74ca3fad0a Mon Sep 17 00:00:00 2001 From: Andrew Connell Date: Sat, 13 Aug 2016 09:15:29 -0400 Subject: [PATCH 081/203] WallabyJS - added type def for config object declaration --- wallabyjs/wallabyjs-tests.ts | 40 +++++++++ wallabyjs/wallabyjs.d.ts | 167 +++++++++++++++++++++++++++++++++++ 2 files changed, 207 insertions(+) create mode 100644 wallabyjs/wallabyjs-tests.ts create mode 100644 wallabyjs/wallabyjs.d.ts diff --git a/wallabyjs/wallabyjs-tests.ts b/wallabyjs/wallabyjs-tests.ts new file mode 100644 index 0000000000..832a775cd0 --- /dev/null +++ b/wallabyjs/wallabyjs-tests.ts @@ -0,0 +1,40 @@ +/// + +import * as wallabyjs from 'wallabyjs'; + +export class WallabyConfig implements wallabyjs.IWallabyConfig { + + public files: string[] = [ + 'src/**/*.ts', + '!src/**/*.spec.ts' + ]; + + public tests: string[] = [ + 'src/**/*.spec.ts' + ]; + + public compilers: wallabyjs.IWallabyCompiler = { + 'src/**/*.js': this.wallaby.compilers.babel({}), + 'src/**/*.ts': this.wallaby.compilers.typeScript({}) + }; + + public preprocessors: wallabyjs.IWallabyProcessor = { + '**/*.js': file => file.content + '\n// this is JavaScript', + '**/*.ts': file => file.content + '\n// this is TypeScript' + }; + + public postprocessors: wallabyjs.IWallabyProcessor = { + '**/*.js': file => file.content + '\n// this is JavaScript', + '**/*.ts': file => file.content + '\n// this is TypeScript' + }; + + public env: wallabyjs.IWallabyEnvironment = { + type: 'node', + params: { + env: 'KEY1=value1;KEY2=value2', + runner: '--arg1;--arg2;' + } + }; + + constructor(private wallaby: any) { } +} diff --git a/wallabyjs/wallabyjs.d.ts b/wallabyjs/wallabyjs.d.ts new file mode 100644 index 0000000000..a10162ffa9 --- /dev/null +++ b/wallabyjs/wallabyjs.d.ts @@ -0,0 +1,167 @@ +// Type definitions for WallabyJS +// Project: http://wallabyjs.com +// Definitions by: Andrew Connell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'wallabyjs' { + namespace wallabyjs { + /** + * Wallaby configuration settings. + * + * @interface + * + * @property {IWallabyCompiler=} compilers - File patterns as keys and compiler functions as values. + * @property {boolean=} debug - Flag if debug messages written to Wallaby console (default=false). + * @prooperty {IWallabyEnvironment=} env - Specify a different test runner or change the runner settings. + * @property {string[] | IWallabyFilePattern[]} files - Specifies an array of source files or file name patterns to copy + * to the local cache. + * @property {Function=} postprocessor - Function that runs for every batch of file changes after all compilers and preprocessors. + * @property {Function=} preprocessor - Function that runs for every batch of file changes after all compilers. + * @property {string=} testFramework - Specifies the name and version of the testing framework you are using for your tests. + * @property {string[] | IWallabyFilePattern[]} tests - Specifies an array of test files or test file name patterns to copy + * to the local cache. + * @property {IWallabyWorkers=} workers - Degree of parallelism used to run your tests and controls the way wallaby re-uses workers. + * + * @see {@link https://wallabyjs.com/docs/config/overview.html} for details. + */ + interface IWallabyConfig { + comilers?: IWallabyCompiler; + debug?: boolean; + env?: IWallabyEnvironment; + files: string[] | IWallabyFilePattern[]; + postprocessor?: IWallabyProcessor; + preprocessor?: IWallabyProcessor; + testFramework?: string; + tests: string[] | IWallabyFilePattern[]; + workers?: IWallabyWorkers; + } + + /** + * Wallaby compiler configuration. + * + * @interface IWallabyCompiler + * + * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. + */ + interface IWallabyCompiler { + [pattern: string]: any + } + + + /** + * Wallaby processor used in pre & post processors. + * + * @interface IWallabyProcessor + * + * @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details. + */ + interface IWallabyProcessor { + [pattern: string]: (file: IWallabyFile) => void; + } + + /** + * Wallaby file object passed to pre & post processors. + * + * @interface IWallabyFile + * + * @property {string=} content - The current content of the file. + * @property {string=} path - The current path to the file. + * @function rename - Allows you to rename/move the file to newPath. + * @function changeExt - Shortcut for the rename function allowing you to change the file extension. + * + * @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details. + */ + interface IWallabyFile { + content?: string; + path?: string; + rename(newPath: string): void; + changeExt(newExt: string): void; + } + + /** + * Wallaby file pattern. + * + * @interface IWallabyFilePattern + * + * @property {string} pattern - File name or file pattern. + * @property {boolean=} ignore - Used to completely exclude the file from Wallaby (default=false). + * @property {boolean=} instrument - Determines if file is instrumented (default=true). + * @property {boolean=} load - Determines if the file is loaded to sandbox HTML via script tag .(default=true). + * + * @see {@link https://wallabyjs.com/docs/config/files.html} for details. + */ + interface IWallabyFilePattern { + pattern: string; + ignore?: boolean; + instrument?: boolean; + load?: boolean; + } + + /** + * Wallaby environment configuration. + * + * @interface IWallabyEnvironment + * + * @property {IWallabyEnvironmentParameters=} params - set parameters on environment. + * @property {string=} runner - Path of local Node / PhantomJs / Electron. + * @property {string=} type - Specify a different test runner or change the runner settings. + * + * @see {@link https://wallabyjs.com/docs/config/runner.html} for details. + */ + interface IWallabyEnvironment { + params?: IWallabyEnvironmentParameters; + runner?: string; + type?: string; + } + + /** + * Wallaby environment parameters. + * + * @interface IWallabyEnvironmentParameters + * + * @property {string=} env - Semicolon-separated spawed runner process env variables. + * @property {string=} runner - Space-separated spawed runner process flags. + * + * @see {@link https://wallabyjs.com/docs/config/runner.html} for details. + */ + interface IWallabyEnvironmentParameters { + env?: string; + runner?: string; + } + + /** + * Wallaby worker configuration. + * + * @interface IWallabyWorkers + * + * @property {boolean=} recycle - Specifies the degree of parallelism used to run your tests and + * controls the way wallaby re-uses workers. + * + * @see {@link https://wallabyjs.com/docs/config/workers.html} for details. + */ + interface IWallabyWorkers { + recycle?: boolean; + } + + /** + * Wallaby object passed into config. + * + * @interface IWallaby + * + * @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 {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. + */ + interface IWallaby { + localProjectDir?: string; + projectCacheDir?: string; + compilers?: IWallabyCompiler; + defaults?: any; + } + + } + export = wallabyjs; +} From b5b1fd28260ad040a545e3841f1e0b5f8ac959e3 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Sat, 13 Aug 2016 18:38:52 +0300 Subject: [PATCH 082/203] Adding missing methods from SyntheticEvent --- react/react.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react/react.d.ts b/react/react.d.ts index 691b9c7a0e..f3ce283545 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -278,6 +278,8 @@ declare namespace __React { preventDefault(): void; stopPropagation(): void; persist(): void; + isDefaultPrevented(): boolean; + isPropagationStopped(): boolean; target: EventTarget; timeStamp: Date; type: string; From 0438123cb941ed60f7f90cef22e2524dbcb086bc Mon Sep 17 00:00:00 2001 From: Giacomo Rebonato Date: Sat, 13 Aug 2016 23:04:24 +0100 Subject: [PATCH 083/203] added optional style object to CommonFlexProps --- react-flex/react-flex.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/react-flex/react-flex.d.ts b/react-flex/react-flex.d.ts index ddb7c3e5da..17a7a6e9e7 100644 --- a/react-flex/react-flex.d.ts +++ b/react-flex/react-flex.d.ts @@ -9,6 +9,11 @@ declare namespace __ReactFlex { export import React = __React; interface CommonFlexProps { + /** + * For custom style + */ + style?: Object; + /** * For `display: inline-flex`. */ From be9ecbf1d901e7d2de669064e938c3f6ed641090 Mon Sep 17 00:00:00 2001 From: Alex Wendland Date: Sat, 13 Aug 2016 16:21:53 -0700 Subject: [PATCH 084/203] Add withRouter to react-router --- react-router/react-router-tests.tsx | 21 ++++++++++++++++--- react-router/react-router.d.ts | 32 +++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 9862f4895a..745aff263d 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -8,7 +8,7 @@ import * as React from "react" import * as ReactDOM from "react-dom" -import { browserHistory, hashHistory, createMemoryHistory, Router, Route, IndexRoute, Link} from "react-router" +import { browserHistory, hashHistory, createMemoryHistory, withRouter, Router, Route, IndexRoute, Link} from "react-router" import { routerShape, locationShape } from "react-router/lib/PropTypes" interface MasterContext { @@ -42,8 +42,21 @@ class Master extends React.Component, {}> { } +interface DashboardProps { + router: ReactRouter.InjectedRouter +}; -class Dashboard extends React.Component<{}, {}> { +class Dashboard extends React.Component { + + navigate() { + var router = this.props.router; + router.push("/users"); + router.push({ + pathname: "/users/12", + query: { modal: true }, + state: { fromDashboard: true } + }); + } render() { return

    @@ -53,6 +66,8 @@ class Dashboard extends React.Component<{}, {}> { } +const DashboardWithRouter = withRouter(Dashboard) + class NotFound extends React.Component<{}, {}> { render() { @@ -78,7 +93,7 @@ class Users extends React.Component<{}, {}> { ReactDOM.render(( - + diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 2fbf965cb2..3fe2538048 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-router v2.0.0 // Project: https://github.com/rackt/react-router -// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown +// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -227,6 +227,27 @@ declare namespace ReactRouter { const RouteContext: React.Mixin + /* Higher Order Component */ + + // Wrap a component using withRouter(Component) to provide a router object + // to the Component's props, allowing the Component to programmatically call + // push and other functions. + // + // https://github.com/reactjs/react-router/blob/v2.4.0/upgrade-guides/v2.4.0.md + + interface InjectedRouter { + push: (pathOrLoc: H.LocationDescriptor) => void + replace: (pathOrLoc: H.LocationDescriptor) => void + go: (n: number) => void + goBack: () => void + goForward: () => void + setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void + createPath(path: H.Path, query?: H.Query): H.Path + createHref(path: H.Path, query?: H.Query): H.Href + isActive: (pathOrLoc: H.LocationDescriptor, indexOnly?: boolean) => boolean + } + + function withRouter>(component: C): C /* utils */ @@ -423,6 +444,10 @@ declare module "react-router/lib/createMemoryHistory" { export default ReactRouter.createMemoryHistory; } +declare module "react-router/lib/withRouter" { + export default ReactRouter.withRouter; +} + declare module "react-router" { import Router from "react-router/lib/Router" @@ -465,6 +490,8 @@ declare module "react-router" { import createMemoryHistory from "react-router/lib/createMemoryHistory"; + import withRouter from "react-router/lib/withRouter"; + // PlainRoute is defined in the API documented at: // https://github.com/rackt/react-router/blob/master/docs/API.md // but not included in any of the .../lib modules above. @@ -506,7 +533,8 @@ declare module "react-router" { PropTypes, match, useRouterHistory, - createMemoryHistory + createMemoryHistory, + withRouter } export default Router From 8184a8990e82728449c0511d7dbd87bfcb007c56 Mon Sep 17 00:00:00 2001 From: microshine Date: Sun, 14 Aug 2016 03:29:15 +0300 Subject: [PATCH 085/203] Update for 2.0.3 --- graphene-pk11/graphene-pk11-tests.ts | 45 +- graphene-pk11/graphene-pk11.d.ts | 2306 +++++++++++++------------- 2 files changed, 1206 insertions(+), 1145 deletions(-) diff --git a/graphene-pk11/graphene-pk11-tests.ts b/graphene-pk11/graphene-pk11-tests.ts index 624e0c2f1e..1f88f7772b 100644 --- a/graphene-pk11/graphene-pk11-tests.ts +++ b/graphene-pk11/graphene-pk11-tests.ts @@ -1,8 +1,6 @@ /// -import * as graphene from "graphene-pk11"; - -// Example of Hashing from README.MD +let graphene = require("graphene-pk11"); let Module = graphene.Module; let lib = "/usr/local/lib/softhsm/libsofthsm2.so"; @@ -13,13 +11,44 @@ mod.initialize(); let slot = mod.getSlots(0); if (slot.flags & graphene.SlotFlag.TOKEN_PRESENT) { let session = slot.open(); + session.login("12345"); - let digest = session.createDigest("sha1"); - digest.update("simple text 1"); - digest.update("simple text 2"); - let hash = digest.final(); + // generate EC key + let keys = session.generateKeyPair(graphene.KeyGenMechanism.ECDSA, { + keyType: graphene.KeyType.ECDSA, + token: false, + derive: true, + paramsECDSA: graphene.NamedCurve.getByName("secp192r1").value + }, { + keyType: graphene.KeyType.ECDSA, + token: false, + derive: true + }); - console.log("Hash SHA1:", hash.toString("hex")); // Hash SHA1: e1dc1e52e9779cd69679b3e0af87d2e288190d34 + // derive algorithm + let alg = { + name: "ECDH1_DERIVE", + params: new graphene.EcdhParams( + graphene.EcKdf.SHA1, + null, + keys.publicKey.getAttribute({ pointEC: null }).pointEC) + }; + + // Template for derived key + let template = { + "class": graphene.ObjectClass.SECRET_KEY, + "token": false, + "keyType": graphene.KeyType.AES, + "valueLen": 256 / 8, + "encrypt": true, + "decrypt": true + }; + + // Key derivation + let dKey = session.deriveKey(alg, keys.privateKey, template); + console.log("Derived key handle:", dKey.handle); + + session.logout(); session.close(); } else { diff --git a/graphene-pk11/graphene-pk11.d.ts b/graphene-pk11/graphene-pk11.d.ts index bc6e178ae6..e0143334ff 100644 --- a/graphene-pk11/graphene-pk11.d.ts +++ b/graphene-pk11/graphene-pk11.d.ts @@ -1,258 +1,423 @@ -// Type definitions for graphene-pk11 v2.0.2 +// Type definitions for graphene-pk11 v2.0.3 // Project: https://github.com/PeculiarVentures/graphene // Definitions by: Stepan Miroshin // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// /// /** * A simple layer for interacting with PKCS #11 / PKCS11 / CryptoKI for Node - * v2.0.2 + * v2.0.3 */ +declare module "graphene-pk11" { -declare module "types/graphene-pk11" { - import * as graphene from "graphene-pk11"; - import * as pkcs11 from "pkcs11js"; + import * as pkcs11 from "pkcs11js" - // ========== Core ========== - - /** - * Handle - */ type Handle = Buffer; - /** - * BaseObject - * - * @interface BaseObject - */ - interface BaseObject { + type CryptoData = string | Buffer; + + class Pkcs11Error extends Error { + code: number; + func: string; + constructor(code: number, func: string); } - /** - * HandleObject - * - * @interface HandleObject - * @extends {BaseObject} - */ - interface HandleObject extends BaseObject { + + class BaseObject { + protected lib: pkcs11.PKCS11; + constructor(lib?: pkcs11.PKCS11); + } + + class HandleObject extends BaseObject { /** * handle to pkcs11 object */ handle: Handle; + + constructor(handle: Handle, lib: pkcs11.PKCS11); + + protected getInfo(): void; } - /** - * Collection - * - * @interface Collection - * @extends {BaseObject} - * @template T - */ - interface Collection extends BaseObject { + class Collection extends BaseObject { + + protected items_: Array; + protected classType: any; /** * returns length of collection */ length: number; + constructor(items: Array, lib: pkcs11.PKCS11, classType: any); + /** * returns item from collection by index * @param {number} index of element in collection `[0..n]` */ items(index: number): T; - - } - type SessionObjectCollection = Collection - type MechanismCollection = Collection; - type SlotCollection = Collection; - - // ========== PKCS11 Objects ========== - - /** - * Certificate objects (object class CKO_CERTIFICATE) hold public-key or attribute certificates - */ - interface Certificate extends Storage { - /** - * Type of certificate - */ - type: graphene.CertificateType; - /** - * The certificate can be trusted for the application that it was created. - */ - trusted: boolean; - /** - * Categorization of the certificate - */ - category: graphene.CertificateCategory; - /** - * Checksum - */ - checkValue: Buffer; - /** - * Start date for the certificate (default empty) - */ - startDate: Date; - /** - * End date for the certificate (default empty) - */ - endDate: Date; } - /** - * X.509 certificate objects (certificate type `CKC_X_509`) hold X.509 public key certificates - */ - interface X509Certificate extends Certificate { + function isString(v: any): boolean; + function isNumber(v: any): boolean; + function isBoolean(v: any): boolean; + function isUndefined(v: any): boolean; + function isNull(v: any): boolean; + function isEmpty(v: any): boolean; + function isFunction(v: any): boolean; + function isObject(v: any): boolean; + function isArray(v: any): boolean; + function isFlag(v: any, fv: number): boolean; + function dateFromString(text: string): Date; + + // ========== Crypto ========== + + class Cipher extends BaseObject { + + session: Session; + + constructor(session: Session, alg: MechanismType, key: Key, lib: pkcs11.PKCS11); + + protected init(alg: MechanismType, key: Key): void; + + update(data: CryptoData): Buffer; + final(): Buffer; + once(data: CryptoData, enc: Buffer): Buffer; + once(data: CryptoData, enc: Buffer, cb: (error: Error, data: Buffer) => void): void; + } + + class Decipher extends BaseObject { + + protected session: Session; + protected blockSize: number; + + constructor(session: Session, alg: MechanismType, key: Key, blockSize: number, lib: pkcs11.PKCS11); + + protected init(alg: MechanismType, key: Key): void; + + update(data: Buffer): Buffer; + final(): Buffer; + once(data: Buffer, dec: Buffer): Buffer; + once(data: Buffer, dec: Buffer, cb: (error: Error, data: Buffer) => void): void; + } + + class Digest extends BaseObject { + + session: Session; + + constructor(session: Session, alg: MechanismType, lib: pkcs11.PKCS11); + + protected init(alg: MechanismType): void; + + update(data: CryptoData): void; + final(): Buffer; + once(data: CryptoData): Buffer; + once(data: CryptoData, cb: (error: Error, data: Buffer) => void): void; + } + + class Sign extends BaseObject { + + session: Session; + + constructor(session: Session, alg: MechanismType, key: Key, lib: pkcs11.PKCS11); + + protected init(alg: MechanismType, key: Key): void; + + update(data: CryptoData): void; + final(): Buffer; + once(data: CryptoData): Buffer; + once(data: CryptoData, cb: (error: Error, data: Buffer) => void): void; + } + + class Verify extends BaseObject { + + session: Session; + + constructor(session: Session, alg: MechanismType, key: Key, lib: pkcs11.PKCS11); + + protected init(alg: MechanismType, key: Key): void; + + update(data: CryptoData): void; + final(signature: Buffer): boolean; + once(data: CryptoData, signature: Buffer): boolean; + once(data: CryptoData, signature: Buffer, cb: (error: Error, valid: boolean) => void): void; + } + + // ========== Keys ========== + + interface IParams { + toCKI(): any; + } + + enum MechParams { + AesCBC, + AesCCM, + AesGCM, + RsaOAEP, + RsaPSS, + EcDH + } + + // AES + + class AesCbcParams implements IParams, pkcs11.AesCBC { /** - * DER-encoding of the certificate subject name - * - Must be specified when the object is created. - * - Must be non-empty if `CKA_URL` is empty. + * initialization vector + * - must have a fixed size of 16 bytes */ - subject: Buffer; + iv: Buffer; /** - * Key identifier for public/private key pair (default empty) + * the data */ - id: Buffer; + data: Buffer; + type: MechParams; + constructor(iv: Buffer, data?: Buffer); + toCKI(): Buffer; + } + + class AesCcmParams implements IParams { /** - * DER-encoding of the certificate issuer name (default empty) + * length of the data where 0 <= dataLength < 2^8L */ - issuer: Buffer; + dataLength: number; /** - * HEX-encoding of the certificate serial number (default empty) + * the nonce */ - serialNumber: string; + nonce: Buffer; /** - * BER-encoding of the certificate - * - Must be specified when the object is created. - * - Must be non-empty if `CKA_URL` is empty. + * the additional authentication data + * - This data is authenticated but not encrypted */ + aad: Buffer; + /** + * length of authentication tag (output following cipher text) in bits. + * - Can be any value between 0 and 128 + */ + macLength: number; + type: MechParams; + constructor(dataLength: number, nonce: Buffer, aad?: Buffer, macLength?: number); + toCKI(): pkcs11.AesCCM; + } + + class AesGcmParams implements IParams { + /** + * initialization vector + * - The length of the initialization vector can be any number between 1 and 256. + * 96-bit (12 byte) IV values can be processed more efficiently, + * so that length is recommended for situations in which efficiency is critical. + */ + iv: Buffer; + /** + * pointer to additional authentication data. + * This data is authenticated but not encrypted. + */ + aad: Buffer; + /** + * length of authentication tag (output following cipher text) in bits. + * Can be any value between 0 and 128. Default 128 + */ + tagBits: number; + type: MechParams; + constructor(iv: Buffer, aad?: Buffer, tagBits?: number); + toCKI(): pkcs11.AesGCM; + } + + // EC + + interface INamedCurve { + name: string; + oid: string; value: Buffer; - /** - * If not empty this attribute gives the URL where the complete certificate - * can be obtained (default empty) - * - Must be non-empty if `CKA_VALUE` is empty - */ - url: string; - /** - * SHA-1 hash of the subject public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - subjetcKeyIdentifier: Buffer; - /** - * SHA-1 hash of the issuer public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - authorityKeyIdentifier: Buffer; - /** - * Java MIDP security domain - */ - java: graphene.JavaMIDP; + size: number; } - /** - * WTLS certificate objects (certificate type `CKC_WTLS`) hold WTLS public key certificates - */ - interface WtlsCertificate extends Certificate { - /** - * WTLS-encoding (Identifier type) of the certificate subject - * - Must be specified when the object is created. - * - Can only be empty if `CKA_VALUE` is empty. - */ - subject: Buffer; - /** - * WTLS-encoding (Identifier type) of the certificate issuer (default empty) - */ - issuer: Buffer; - /** - * Key identifier for public/private key pair (default empty) - */ - id: Buffer; - /** - * WTLS-encoding of the certificate - * - Must be specified when the object is created. - * - Must be non-empty if `CKA_URL` is empty. - */ - value: Buffer; - /** - * If not empty this attribute gives the URL where the complete certificate - * can be obtained (default empty) - * - Must be non-empty if `CKA_VALUE` is empty - */ - url: string; - /** - * DER-encoding of the certificate serial number (default empty) - */ - serialNumber: Buffer; - /** - * SHA-1 hash of the subject public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - subjetcKeyIdentifier: Buffer; - /** - * SHA-1 hash of the issuer public key (default empty) - * - Can only be empty if `CKA_URL` is empty. - */ - authorityKeyIdentifier: Buffer; + class NamedCurve { + static getByName(name: string): INamedCurve; + static getByOid(oid: string): INamedCurve; } - /** - * X.509 attribute certificate objects (certificate type `CKC_X_509_ATTR_CERT`) hold X.509 attribute certificates - */ - interface AttributeCertificate extends Certificate { - /** - * DER-encoding of the attribute certificate's subject field. - * This is distinct from the `CKA_SUBJECT` attribute contained in `CKC_X_509` certificates - * because the `ASN.1` syntax and encoding are different. - * - Must be specified when the object is created - */ - owner: Buffer; - /** - * DER-encoding of the attribute certificate's issuer field. - * This is distinct from the `CKA_ISSUER` attribute contained in `CKC_X_509` certificates - * because the ASN.1 syntax and encoding are different. (default empty) - */ - issuer: Buffer; - /** - * DER-encoding of the certificate serial number (default empty) - */ - serialNumber: Buffer; - /** - * BER-encoding of a sequence of object identifier values corresponding - * to the attribute types contained in the certificate. - * When present, this field offers an opportunity for applications - * to search for a particular attribute certificate without fetching - * and parsing the certificate itself. (default empty) - */ - types: Buffer; - /** - * BER-encoding of the certificate - * - Must be specified when the object is created. - */ - value: Buffer; + enum EcKdf { + NULL, + SHA1, + SHA224, + SHA256, + SHA384, + SHA512 } - interface DomainParameters extends Storage { + class EcdhParams implements IParams, pkcs11.ECDH1 { /** - * Type of key the domain parameters can be used to generate. + * key derivation function used on the shared secret value */ - keyType: graphene.KeyType; + kdf: EcKdf; /** - * `CK_TRUE` only if domain parameters were either * generated locally (i.e., on the token) - * with a `C_GenerateKey` * created with a `C_CopyObject` call as a copy of domain parameters - * which had its `CKA_LOCAL` attribute set to `CK_TRUE` + * some data shared between the two parties */ - local: boolean; + sharedData: Buffer; + /** + * other party's EC public key value + */ + publicData: Buffer; + type: MechParams; + /** + * Creates an instance of EcdhParams. + * + * @param {EcKdf} kdf key derivation function used on the shared secret value + * @param {Buffer} [sharedData=null] some data shared between the two parties + * @param {Buffer} [publicData=null] other party's EC public key value + */ + constructor(kdf: EcKdf, sharedData?: Buffer, publicData?: Buffer); + toCKI(): pkcs11.ECDH1; + } + + // Rsa + + enum RsaMgf { + MGF1_SHA1, + MGF1_SHA224, + MGF1_SHA256, + MGF1_SHA384, + MGF1_SHA512 + } + + class RsaOaepParams implements IParams { + hashAlgorithm: MechanismEnum; + mgf: RsaMgf; + source: number; + sourceData: Buffer; + type: MechParams; + constructor(hashAlg?: MechanismEnum, mgf?: RsaMgf, sourceData?: Buffer); + toCKI(): pkcs11.RsaOAEP; + } + + class RsaPssParams implements IParams { + /** + * hash algorithm used in the PSS encoding; + * - if the signature mechanism does not include message hashing, + * then this value must be the mechanism used by the application to generate + * the message hash; + * - if the signature mechanism includes hashing, + * then this value must match the hash algorithm indicated + * by the signature mechanism + */ + hashAlgorithm: MechanismEnum; + /** + * mask generation function to use on the encoded block + */ + mgf: RsaMgf; + /** + * length, in bytes, of the salt value used in the PSS encoding; + * - typical values are the length of the message hash and zero + */ + saltLength: number; + type: MechParams; + constructor(hashAlg?: MechanismEnum, mgf?: RsaMgf, saltLen?: number); + toCKI(): pkcs11.RsaPSS; + } + + // ========== Objects ========== + + enum ObjectClass { + DATA, + CERTIFICATE, + PUBLIC_KEY, + PRIVATE_KEY, + SECRET_KEY, + HW_FEATURE, + DOMAIN_PARAMETERS, + MECHANISM, + OTP_KEY + } + + class SessionObject extends HandleObject { + /** + * Session + */ + session: Session; + /** + * gets the size of an object in bytes + * + * @readonly + * @type {number} + */ + size: number; + class: ObjectClass; + + /** + * Creates an instance of SessionObject. + * + * @param {SessionObject} object + */ + constructor(object: SessionObject); + /** + * Creates an instance of SessionObject. + * + * @param {Handle} handle + * @param {Session} session + * @param {pkcs11.PKCS11} lib + */ + constructor(handle: Handle, session: Session, lib: pkcs11.PKCS11); + constructor(handle: SessionObject); + + /** + * copies an object, creating a new object for the copy + * + * @param {ITemplate} template template for the new object + * @returns {SessionObject} + */ + copy(template: ITemplate): SessionObject; + /** + * destroys an object + */ + destroy(): void; + getAttribute(attr: string): ITemplate; + getAttribute(attrs: ITemplate): ITemplate; + setAttribute(attrs: string, value: any): void; + setAttribute(attrs: ITemplate): void; + get(name: string): any; + set(name: string, value: any): void; + toType(): T; + } + + class SessionObjectCollection extends Collection { + session: Session; + + constructor(items: Array, session: Session, lib: pkcs11.PKCS11, classType?: any); + + items(index: number): SessionObject; + } + + class Storage extends SessionObject { + /** + * `true` if object is a token object; + * `false` if object is a session object. Default is `false`. + */ + token: boolean; + /** + * `true` if object is a private object; + * `false` if object is a public object. + * Default value is token-specific, and may depend on the values of other attributes of the object. + */ + private: boolean; + /** + * `true` if object can be modified. Default is `false` + */ + modifiable: boolean; + /** + * Description of the object (default empty) + */ + label: string; } /** * Data objects (object class `CKO_DATA`) hold information defined by an application. * Other than providing access to it, Cryptoki does not attach any special meaning to a data object * - * @ + * @export * @class Data * @extends {Storage} */ - interface Data extends Storage { + class Data extends Storage { /** * Description of the application that manages the object (default empty) * @@ -273,18 +438,101 @@ declare module "types/graphene-pk11" { value: Buffer; } + class DomainParameters extends Storage { + /** + * Type of key the domain parameters can be used to generate. + */ + keyType: KeyType; + /** + * `CK_TRUE` only if domain parameters were either * generated locally (i.e., on the token) + * with a `C_GenerateKey` * created with a `C_CopyObject` call as a copy of domain parameters + * which had its `CKA_LOCAL` attribute set to `CK_TRUE` + */ + local: boolean; + } + + enum KeyType { + RSA, + DSA, + DH, + ECDSA, + EC, + X9_42_DH, + KEA, + GENERIC_SECRET, + RC2, + RC4, + DES, + DES2, + DES3, + CAST, + CAST3, + CAST5, + CAST128, + RC5, + IDEA, + SKIPJACK, + BATON, + JUNIPER, + CDMF, + AES, + GOSTR3410, + GOSTR3411, + GOST28147, + BLOWFISH, + TWOFISH, + SECURID, + HOTP, + ACTI, + CAMELLIA, + ARIA + } + enum KeyGenMechanism { + AES, + RSA, + RSA_X9_31, + DSA, + DH_PKCS, + DH_X9_42, + GOSTR3410, + GOST28147, + RC2, + RC4, + DES, + DES2, + SECURID, + ACTI, + CAST, + CAST3, + CAST5, + CAST128, + RC5, + IDEA, + GENERIC_SECRET, + SSL3_PRE_MASTER, + CAMELLIA, + ARIA, + SKIPJACK, + KEA, + BATON, + ECDSA, + EC, + JUNIPER, + TWOFISH, + } + /** * Definition for the base key object class * - defines the object class `CKO_PUBLIC_KEY`, `CKO_PRIVATE_KEY` and `CKO_SECRET_KEY` for type `CK_OBJECT_CLASS` * as used in the `CKA_CLASS` attribute of objects */ - interface Key extends Storage { + class Key extends Storage { /** * Type of key * - Must be specified when object is created with `C_CreateObject` * - Must be specified when object is unwrapped with `C_UnwrapKey` */ - type: graphene.KeyType; + type: KeyType; /** * Key identifier for key (default empty) * - May be modified after object is created with a `C_SetAttributeValue` call, @@ -334,14 +582,14 @@ declare module "types/graphene-pk11" { * - Must not be specified when object is generated with `C_GenerateKey` or `C_GenerateKeyPair`. * - Must not be specified when object is unwrapped with `C_UnwrapKey`. */ - mechanism: graphene.KeyGenMechanism; + mechanism: KeyGenMechanism; allowedMechanisms: void; } /** - * Private key objects (object class `CKO_PRIVATE_KEY`) hold private keys - */ - interface PrivateKey extends Key { + * Private key objects (object class `CKO_PRIVATE_KEY`) hold private keys + */ + class PrivateKey extends Key { /** * DER-encoding of the key subject name (default empty) * - May be modified after object is created with a `C_SetAttributeValue` call, @@ -438,7 +686,7 @@ declare module "types/graphene-pk11" { /** * Public key objects (object class CKO_PUBLIC_KEY) hold public keys */ - interface PublicKey extends Key { + class PublicKey extends Key { /** * DER-encoding of the key subject name (default empty) * - May be modified after object is created with a `C_SetAttributeValue` call, @@ -499,7 +747,7 @@ declare module "types/graphene-pk11" { /** * Secret key objects (object class `CKO_SECRET_KEY`) hold secret keys. */ - interface SecretKey extends Key { + class SecretKey extends Key { /** * `CK_TRUE` if key is sensitive * - May be modified after object is created with a `C_SetAttributeValue` call, @@ -616,136 +864,186 @@ declare module "types/graphene-pk11" { unwrapTemplate: void; } - interface Storage extends SessionObject { - /** - * `true` if object is a token object; - * `false` if object is a session object. Default is `false`. - */ - token: boolean; - /** - * `true` if object is a private object; - * `false` if object is a public object. - * Default value is token-specific, and may depend on the values of other attributes of the object. - */ - private: boolean; - /** - * `true` if object can be modified. Default is `false` - */ - modifiable: boolean; - /** - * Description of the object (default empty) - */ - label: string; + enum CertificateType { + X_509, + X_509_ATTR_CERT, + WTLS } - interface SessionObject extends HandleObject { - /** - * Session - */ - session: Session; - /** - * gets the size of an object in bytes - * - * @readonly - * @type {number} - */ - size: number; - /** - * copies an object, creating a new object for the copy - * - * @param {ITemplate} template template for the new object - * @returns {SessionObject} - */ - copy(template: ITemplate): SessionObject; - /** - * destroys an object - */ - destroy(): void; - getAttribute(attr: string): ITemplate; - getAttribute(attrs: ITemplate): ITemplate; - setAttribute(attrs: string, value: any): void; - setAttribute(attrs: ITemplate): void; - class: graphene.ObjectClass; - toType(): T; + enum CertificateCategory { + Unspecified, + TokenUser, + Authority, + OtherEntity } - // ========== Crypto ========== - /** - * Type CryptoData + * Certificate objects (object class CKO_CERTIFICATE) hold public-key or attribute certificates */ - type CryptoData = string | Buffer; + class Certificate extends Storage { + /** + * Type of certificate + */ + type: CertificateType; + /** + * The certificate can be trusted for the application that it was created. + */ + trusted: boolean; + /** + * Categorization of the certificate + */ + category: CertificateCategory; + /** + * Checksum + */ + checkValue: Buffer; + /** + * Start date for the certificate (default empty) + */ + startDate: Date; + /** + * End date for the certificate (default empty) + */ + endDate: Date; + } - interface INamedCurve { - name: string; - oid: string; + /** + * X.509 attribute certificate objects (certificate type `CKC_X_509_ATTR_CERT`) hold X.509 attribute certificates + */ + class AttributeCertificate extends Certificate { + /** + * DER-encoding of the attribute certificate's subject field. + * This is distinct from the `CKA_SUBJECT` attribute contained in `CKC_X_509` certificates + * because the `ASN.1` syntax and encoding are different. + * - Must be specified when the object is created + */ + owner: Buffer; + /** + * DER-encoding of the attribute certificate's issuer field. + * This is distinct from the `CKA_ISSUER` attribute contained in `CKC_X_509` certificates + * because the ASN.1 syntax and encoding are different. (default empty) + */ + issuer: Buffer; + /** + * DER-encoding of the certificate serial number (default empty) + */ + serialNumber: Buffer; + /** + * BER-encoding of a sequence of object identifier values corresponding + * to the attribute types contained in the certificate. + * When present, this field offers an opportunity for applications + * to search for a particular attribute certificate without fetching + * and parsing the certificate itself. (default empty) + */ + types: Buffer; + /** + * BER-encoding of the certificate + * - Must be specified when the object is created. + */ value: Buffer; - size: number; } /** - * Cipher - * - * @interface Cipher - * @extends {BaseObject} + * WTLS certificate objects (certificate type `CKC_WTLS`) hold WTLS public key certificates */ - interface Cipher extends BaseObject { - update(data: CryptoData): Buffer; - final(): Buffer; - once(data: CryptoData, enc: Buffer): Buffer; - once(data: CryptoData, enc: Buffer, cb: (error: Error, data: Buffer) => void): void; + class WtlsCertificate extends Certificate { + /** + * WTLS-encoding (Identifier type) of the certificate subject + * - Must be specified when the object is created. + * - Can only be empty if `CKA_VALUE` is empty. + */ + subject: Buffer; + /** + * WTLS-encoding (Identifier type) of the certificate issuer (default empty) + */ + issuer: Buffer; + /** + * Key identifier for public/private key pair (default empty) + */ + id: Buffer; + /** + * WTLS-encoding of the certificate + * - Must be specified when the object is created. + * - Must be non-empty if `CKA_URL` is empty. + */ + value: Buffer; + /** + * If not empty this attribute gives the URL where the complete certificate + * can be obtained (default empty) + * - Must be non-empty if `CKA_VALUE` is empty + */ + url: string; + /** + * DER-encoding of the certificate serial number (default empty) + */ + serialNumber: Buffer; + /** + * SHA-1 hash of the subject public key (default empty) + * - Can only be empty if `CKA_URL` is empty. + */ + subjetcKeyIdentifier: Buffer; + /** + * SHA-1 hash of the issuer public key (default empty) + * - Can only be empty if `CKA_URL` is empty. + */ + authorityKeyIdentifier: Buffer; + } + + enum JavaMIDP { + Unspecified, + Manufacturer, + Operator, + ThirdParty } /** - * Decipher - * - * @interface Decipher - * @extends {BaseObject} + * X.509 certificate objects (certificate type `CKC_X_509`) hold X.509 public key certificates */ - interface Decipher extends BaseObject { - update(data: Buffer): Buffer; - final(): Buffer; - once(data: Buffer, dec: Buffer): Buffer; - once(data: Buffer, dec: Buffer, cb: (error: Error, data: Buffer) => void): void; - } - - /** - * Digest - * - * @interface Digest - * @extends {BaseObject} - */ - interface Digest extends BaseObject { - update(data: CryptoData): void; - final(): Buffer; - once(data: CryptoData): Buffer; - once(data: CryptoData, cb: (error: Error, data: Buffer) => void): void; - } - - /** - * Sign - * - * @interface Sign - * @extends {BaseObject} - */ - interface Sign extends BaseObject { - update(data: CryptoData): void; - final(): Buffer; - once(data: CryptoData): Buffer; - once(data: CryptoData, cb: (error: Error, data: Buffer) => void): void; - } - - /** - * Verify - * - * @interface Verify - * @extends {BaseObject} - */ - interface Verify extends BaseObject { - update(data: CryptoData): void; - final(signature: Buffer): boolean; - once(data: CryptoData, signature: Buffer): boolean; - once(data: CryptoData, signature: Buffer, cb: (error: Error, valid: boolean) => void): void; + class X509Certificate extends Certificate { + /** + * DER-encoding of the certificate subject name + * - Must be specified when the object is created. + * - Must be non-empty if `CKA_URL` is empty. + */ + subject: Buffer; + /** + * Key identifier for public/private key pair (default empty) + */ + id: Buffer; + /** + * DER-encoding of the certificate issuer name (default empty) + */ + issuer: Buffer; + /** + * HEX-encoding of the certificate serial number (default empty) + */ + serialNumber: string; + /** + * BER-encoding of the certificate + * - Must be specified when the object is created. + * - Must be non-empty if `CKA_URL` is empty. + */ + value: Buffer; + /** + * If not empty this attribute gives the URL where the complete certificate + * can be obtained (default empty) + * - Must be non-empty if `CKA_VALUE` is empty + */ + url: string; + /** + * SHA-1 hash of the subject public key (default empty) + * - Can only be empty if `CKA_URL` is empty. + */ + subjetcKeyIdentifier: Buffer; + /** + * SHA-1 hash of the issuer public key (default empty) + * - Can only be empty if `CKA_URL` is empty. + */ + authorityKeyIdentifier: Buffer; + /** + * Java MIDP security domain + */ + java: JavaMIDP; } interface IAlgorithm { @@ -753,9 +1051,68 @@ declare module "types/graphene-pk11" { params: Buffer | IParams; } - type MechanismType = graphene.MechanismEnum | graphene.KeyGenMechanism | IAlgorithm | string; + type MechanismType = MechanismEnum | KeyGenMechanism | IAlgorithm | string; + + enum MechanismFlag { + /** + * `True` if the mechanism is performed by the device; `false` if the mechanism is performed in software + */ + HW, + /** + * `True` if the mechanism can be used with encrypt function + */ + ENCRYPT, + /** + * `True` if the mechanism can be used with decrypt function + */ + DECRYPT, + /** + * `True` if the mechanism can be used with digest function + */ + DIGEST, + /** + * `True` if the mechanism can be used with sign function + */ + SIGN, + /** + * `True` if the mechanism can be used with sign recover function + */ + SIGN_RECOVER, + /** + * `True` if the mechanism can be used with verify function + */ + VERIFY, + /** + * `True` if the mechanism can be used with verify recover function + */ + VERIFY_RECOVER, + /** + * `True` if the mechanism can be used with geberate function + */ + GENERATE, + /** + * `True` if the mechanism can be used with generate key pair function + */ + GENERATE_KEY_PAIR, + /** + * `True` if the mechanism can be used with wrap function + */ + WRAP, + /** + * `True` if the mechanism can be used with unwrap function + */ + UNWRAP, + /** + * `True` if the mechanism can be used with derive function + */ + DERIVE, + } + + class Mechanism extends BaseObject { + + protected handle: number; + protected slotHandle: Handle; - interface Mechanism extends BaseObject { /** * the minimum size of the key for the mechanism * _whether this is measured in bits or in bytes is mechanism-dependent_ @@ -774,10 +1131,336 @@ declare module "types/graphene-pk11" { * returns string name from MechanismEnum */ name: string; + + constructor(handle: number, slotHandle: Handle, lib: pkcs11.PKCS11); + + protected getInfo(): void; + + static create(alg: MechanismType): pkcs11.Mechanism; + static vendor(jsonFile: string): void; + static vendor(name: string, value: number): void; } - interface IParams { - toCKI(): any; + class MechanismCollection extends Collection { + + protected slotHandle: Handle; + + constructor(items: Array, slotHandle: Handle, lib: pkcs11.PKCS11, classType?: typeof Mechanism); + /** + * returns item from collection by index + * @param {number} index of element in collection `[0..n]` + */ + items(index: number): Mechanism; + } + + enum MechanismEnum { + RSA_PKCS_KEY_PAIR_GEN, + RSA_PKCS, + RSA_9796, + RSA_X_509, + MD2_RSA_PKCS, + MD5_RSA_PKCS, + SHA1_RSA_PKCS, + RIPEMD128_RSA_PKCS, + RIPEMD160_RSA_PKCS, + RSA_PKCS_OAEP, + RSA_X9_31_KEY_PAIR_GEN, + RSA_X9_31, + SHA1_RSA_X9_31, + RSA_PKCS_PSS, + SHA1_RSA_PKCS_PSS, + DSA_KEY_PAIR_GEN, + DSA, + DSA_SHA1, + DSA_SHA224, + DSA_SHA256, + DSA_SHA384, + DSA_SHA512, + DH_PKCS_KEY_PAIR_GEN, + DH_PKCS_DERIVE, + X9_42_DH_KEY_PAIR_GEN, + X9_42_DH_DERIVE, + X9_42_DH_HYBRID_DERIVE, + X9_42_MQV_DERIVE, + SHA256_RSA_PKCS, + SHA384_RSA_PKCS, + SHA512_RSA_PKCS, + SHA256_RSA_PKCS_PSS, + SHA384_RSA_PKCS_PSS, + SHA512_RSA_PKCS_PSS, + SHA224_RSA_PKCS, + SHA224_RSA_PKCS_PSS, + RC2_KEY_GEN, + RC2_ECB, + RC2_CBC, + RC2_MAC, + RC2_MAC_GENERAL, + RC2_CBC_PAD, + RC4_KEY_GEN, + RC4, + DES_KEY_GEN, + DES_ECB, + DES_CBC, + DES_MAC, + DES_MAC_GENERAL, + DES_CBC_PAD, + DES2_KEY_GEN, + DES3_KEY_GEN, + DES3_ECB, + DES3_CBC, + DES3_MAC, + DES3_MAC_GENERAL, + DES3_CBC_PAD, + CDMF_KEY_GEN, + CDMF_ECB, + CDMF_CBC, + CDMF_MAC, + CDMF_MAC_GENERAL, + CDMF_CBC_PAD, + DES_OFB64, + DES_OFB8, + DES_CFB64, + DES_CFB8, + MD2, + MD2_HMAC, + MD2_HMAC_GENERAL, + MD5, + MD5_HMAC, + MD5_HMAC_GENERAL, + SHA1, + SHA, + SHA_1, + SHA_1_HMAC, + SHA_1_HMAC_GENERAL, + RIPEMD128, + RIPEMD128_HMAC, + RIPEMD128_HMAC_GENERAL, + RIPEMD160, + RIPEMD160_HMAC, + RIPEMD160_HMAC_GENERAL, + SHA256, + SHA256_HMAC, + SHA256_HMAC_GENERAL, + SHA224, + SHA224_HMAC, + SHA224_HMAC_GENERAL, + SHA384, + SHA384_HMAC, + SHA384_HMAC_GENERAL, + SHA512, + SHA512_HMAC, + SHA512_HMAC_GENERAL, + SECURID_KEY_GEN, + SECURID, + HOTP_KEY_GEN, + HOTP, + ACTI, + ACTI_KEY_GEN, + CAST_KEY_GEN, + CAST_ECB, + CAST_CBC, + CAST_MAC, + CAST_MAC_GENERAL, + CAST_CBC_PAD, + CAST3_KEY_GEN, + CAST3_ECB, + CAST3_CBC, + CAST3_MAC, + CAST3_MAC_GENERAL, + CAST3_CBC_PAD, + CAST5_KEY_GEN, + CAST128_KEY_GEN, + CAST5_ECB, + CAST128_ECB, + CAST5_CBC, + CAST128_CBC, + CAST5_MAC, + CAST128_MAC, + CAST5_MAC_GENERAL, + CAST128_MAC_GENERAL, + CAST5_CBC_PAD, + CAST128_CBC_PAD, + RC5_KEY_GEN, + RC5_ECB, + RC5_CBC, + RC5_MAC, + RC5_MAC_GENERAL, + RC5_CBC_PAD, + IDEA_KEY_GEN, + IDEA_ECB, + IDEA_CBC, + IDEA_MAC, + IDEA_MAC_GENERAL, + IDEA_CBC_PAD, + GENERIC_SECRET_KEY_GEN, + CONCATENATE_BASE_AND_KEY, + CONCATENATE_BASE_AND_DATA, + CONCATENATE_DATA_AND_BASE, + XOR_BASE_AND_DATA, + EXTRACT_KEY_FROM_KEY, + SSL3_PRE_MASTER_KEY_GEN, + SSL3_MASTER_KEY_DERIVE, + SSL3_KEY_AND_MAC_DERIVE, + SSL3_MASTER_KEY_DERIVE_DH, + TLS_PRE_MASTER_KEY_GEN, + TLS_MASTER_KEY_DERIVE, + TLS_KEY_AND_MAC_DERIVE, + TLS_MASTER_KEY_DERIVE_DH, + TLS_PRF, + SSL3_MD5_MAC, + SSL3_SHA1_MAC, + MD5_KEY_DERIVATION, + MD2_KEY_DERIVATION, + SHA1_KEY_DERIVATION, + SHA256_KEY_DERIVATION, + SHA384_KEY_DERIVATION, + SHA512_KEY_DERIVATION, + SHA224_KEY_DERIVATION, + PBE_MD2_DES_CBC, + PBE_MD5_DES_CBC, + PBE_MD5_CAST_CBC, + PBE_MD5_CAST3_CBC, + PBE_MD5_CAST5_CBC, + PBE_MD5_CAST128_CBC, + PBE_SHA1_CAST5_CBC, + PBE_SHA1_CAST128_CBC, + PBE_SHA1_RC4_128, + PBE_SHA1_RC4_40, + PBE_SHA1_DES3_EDE_CBC, + PBE_SHA1_DES2_EDE_CBC, + PBE_SHA1_RC2_128_CBC, + PBE_SHA1_RC2_40_CBC, + PKCS5_PBKD2, + PBA_SHA1_WITH_SHA1_HMAC, + WTLS_PRE_MASTER_KEY_GEN, + WTLS_MASTER_KEY_DERIVE, + WTLS_MASTER_KEY_DERIVE_DH_ECC, + WTLS_PRF, + WTLS_SERVER_KEY_AND_MAC_DERIVE, + WTLS_CLIENT_KEY_AND_MAC_DERIVE, + KEY_WRAP_LYNKS, + KEY_WRAP_SET_OAEP, + CAMELLIA_KEY_GEN, + CAMELLIA_ECB, + CAMELLIA_CBC, + CAMELLIA_MAC, + CAMELLIA_MAC_GENERAL, + CAMELLIA_CBC_PAD, + CAMELLIA_ECB_ENCRYPT_DATA, + CAMELLIA_CBC_ENCRYPT_DATA, + CAMELLIA_CTR, + ARIA_KEY_GEN, + ARIA_ECB, + ARIA_CBC, + ARIA_MAC, + ARIA_MAC_GENERAL, + ARIA_CBC_PAD, + ARIA_ECB_ENCRYPT_DATA, + ARIA_CBC_ENCRYPT_DATA, + SKIPJACK_KEY_GEN, + SKIPJACK_ECB64, + SKIPJACK_CBC64, + SKIPJACK_OFB64, + SKIPJACK_CFB64, + SKIPJACK_CFB32, + SKIPJACK_CFB16, + SKIPJACK_CFB8, + SKIPJACK_WRAP, + SKIPJACK_PRIVATE_WRAP, + SKIPJACK_RELAYX, + KEA_KEY_PAIR_GEN, + KEA_KEY_DERIVE, + FORTEZZA_TIMESTAMP, + BATON_KEY_GEN, + BATON_ECB128, + BATON_ECB96, + BATON_CBC128, + BATON_COUNTER, + BATON_SHUFFLE, + BATON_WRAP, + ECDSA_KEY_PAIR_GEN, + EC_KEY_PAIR_GEN, + ECDSA, + ECDSA_SHA1, + ECDSA_SHA224, + ECDSA_SHA256, + ECDSA_SHA384, + ECDSA_SHA512, + ECDH1_DERIVE, + ECDH1_COFACTOR_DERIVE, + ECMQV_DERIVE, + JUNIPER_KEY_GEN, + JUNIPER_ECB128, + JUNIPER_CBC128, + JUNIPER_COUNTER, + JUNIPER_SHUFFLE, + JUNIPER_WRAP, + FASTHASH, + AES_KEY_GEN, + AES_ECB, + AES_CBC, + AES_MAC, + AES_MAC_GENERAL, + AES_CBC_PAD, + AES_CTR, + AES_CMAC, + AES_CMAC_GENERAL, + BLOWFISH_KEY_GEN, + BLOWFISH_CBC, + TWOFISH_KEY_GEN, + TWOFISH_CBC, + AES_GCM, + AES_CCM, + AES_KEY_WRAP, + AES_KEY_WRAP_PAD, + DES_ECB_ENCRYPT_DATA, + DES_CBC_ENCRYPT_DATA, + DES3_ECB_ENCRYPT_DATA, + DES3_CBC_ENCRYPT_DATA, + AES_ECB_ENCRYPT_DATA, + AES_CBC_ENCRYPT_DATA, + GOSTR3410_KEY_PAIR_GEN, + GOSTR3410, + GOSTR3410_WITH_GOSTR3411, + GOSTR3410_KEY_WRAP, + GOSTR3410_DERIVE, + GOSTR3411, + GOSTR3411_HMAC, + GOST28147_KEY_GEN, + GOST28147_ECB, + GOST28147, + GOST28147_MAC, + GOST28147_KEY_WRAP, + DSA_PARAMETER_GEN, + DH_PKCS_PARAMETER_GEN, + X9_42_DH_PARAMETER_GEN, + VENDOR_DEFINED + } + + enum SessionFlag { + /** + * `True` if the session is read/write; `false` if the session is read-only + */ + RW_SESSION, + /** + * This flag is provided for backward compatibility, and should always be set to `true` + */ + SERIAL_SESSION + } + + enum UserType { + /** + * Security Officer + */ + SO, + /** + * User + */ + USER, + /** + * Context specific + */ + CONTEXT_SPECIFIC } interface IKeyPair { @@ -788,11 +1471,13 @@ declare module "types/graphene-pk11" { /** * provides information about a session * - * @ + * @export * @class Session - * @extends {HandleObject} + * @extends {core.HandleObject} */ - interface Session extends HandleObject { + class Session extends HandleObject { + + constructor(handle: Handle, slot: Slot, lib: pkcs11.PKCS11); /** * Slot * @@ -817,6 +1502,9 @@ declare module "types/graphene-pk11" { * @type {number} */ deviceError: number; + + protected getInfo(): void; + /** * closes a session between an application and a token */ @@ -858,7 +1546,7 @@ declare module "types/graphene-pk11" { * but the token may impose subset restrictions * @param {} userType the user type. Default is `USER` */ - login(pin: string, userType?: graphene.UserType): void; + login(pin: string, userType?: UserType): void; /** * logs a user out from a token */ @@ -942,130 +1630,6 @@ declare module "types/graphene-pk11" { generateRandom(size: number): Buffer; } - interface Slot extends HandleObject { - slotDescription: string; - manufacturerID: string; - flags: number; - hardwareVersion: pkcs11.Version; - firmwareVersion: pkcs11.Version; - module: graphene.Module; - /** - * Returns information about token - * - * @returns {Token} - */ - getToken(): Token; - /** - * returns list of `MechanismInfo` - * - * @returns {MechanismCollection} - */ - getMechanisms(): MechanismCollection; - /** - * initializes a token - * - * @param {string} pin the SO's initial PIN - * @returns {string} - */ - initToken(pin: string): string; - /** - * opens a session between an application and a token in a particular slot - * - * @param {SessionFlag} [flags=session.SessionFlag.SERIAL_SESSION] indicates the type of session - * @returns {Session} - */ - open(flags?: graphene.SessionFlag): Session; - /** - * closes all sessions an application has with a token - */ - closeAll(): void; - } - - interface Token extends HandleObject { - /** - * application-defined label, assigned during token initialization. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - label: string; - /** - * ID of the device manufacturer. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - manufacturerID: string; - /** - * model of the device. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - model: string; - /** - * character-string serial number of the device. - * - Must be padded with the blank character (' '). - * - Should __not__ be null-terminated. - */ - serialNumber: string; - /** - * bit flags indicating capabilities and status of the device - */ - flags: number; - /** - * maximum number of sessions that can be opened with the token at one time by a single application - */ - maxSessionCount: number; - /** - * number of sessions that this application currently has open with the token - */ - sessionCount: number; - /** - * maximum number of read/write sessions that can be opened - * with the token at one time by a single application - */ - maxRwSessionCount: number; - /** - * number of read/write sessions that this application currently has open with the token - */ - rwSessionCount: number; - /** - * maximum length in bytes of the PIN - */ - maxPinLen: number; - /** - * minimum length in bytes of the PIN - */ - minPinLen: number; - /** - * the total amount of memory on the token in bytes in which public objects may be stored - */ - totalPublicMemory: number; - /** - * the amount of free (unused) memory on the token in bytes for public objects - */ - freePublicMemory: number; - /** - * the total amount of memory on the token in bytes in which private objects may be stored - */ - totalPrivateMemory: number; - /** - * the amount of free (unused) memory on the token in bytes for private objects - */ - freePrivateMemory: number; - /** - * version number of hardware - */ - hardwareVersion: pkcs11.Version; - /** - * version number of firmware - */ - firmwareVersion: pkcs11.Version; - /** - * current time as a character-string of length 16, - * represented in the format YYYYMMDDhhmmssxx - */ - utcTime: Date; - } - interface ITemplate { /** * CKA_CLASS @@ -1466,683 +2030,9 @@ declare module "types/graphene-pk11" { allowedMechanisms?: any; } -} - -declare module "graphene-pk11" { - import * as graphene from "types/graphene-pk11"; - import * as pkcs11 from "pkcs11js"; - - // ========== Parameters ========== - - // ========== AES ========== - - /** - * Parameter AES CBC - * - * @class AesCbcParams - * @implements {graphene.IParams} - * @implements {pkcs11.AesCBC} - */ - class AesCbcParams implements graphene.IParams, pkcs11.AesCBC { - /** - * initialization vector - * - must have a fixed size of 16 bytes - */ - iv: Buffer; - /** - * the data - */ - data: Buffer; - type: MechParams; - constructor(iv: Buffer, data?: Buffer); - toCKI(): Buffer; - } - - /** - * Parameter AES CCM - * - * @class AesCcmParams - * @implements {graphene.IParams} - */ - class AesCcmParams implements graphene.IParams { - /** - * length of the data where 0 <= dataLength < 2^8L - */ - dataLength: number; - /** - * the nonce - */ - nonce: Buffer; - /** - * the additional authentication data - * - This data is authenticated but not encrypted - */ - aad: Buffer; - /** - * length of authentication tag (output following cipher text) in bits. - * - Can be any value between 0 and 128 - */ - macLength: number; - type: MechParams; - constructor(dataLength: number, nonce: Buffer, aad?: Buffer, macLength?: number); - toCKI(): pkcs11.AesCCM; - } - - /** - * Parameter AES GCM - * - * @class AesGcmParams - * @implements {graphene.IParams} - */ - class AesGcmParams implements graphene.IParams { - /** - * initialization vector - * - The length of the initialization vector can be any number between 1 and 256. - * 96-bit (12 byte) IV values can be processed more efficiently, - * so that length is recommended for situations in which efficiency is critical. - */ - iv: Buffer; - /** - * pointer to additional authentication data. - * This data is authenticated but not encrypted. - */ - aad: Buffer; - /** - * length of authentication tag (output following cipher text) in bits. - * Can be any value between 0 and 128. Default 128 - */ - tagBits: number; - type: MechParams; - constructor(iv: Buffer, aad?: Buffer, tagBits?: number); - toCKI(): pkcs11.AesGCM; - } - - // ========== EC ========== - - /** - * Parameter EC DH - * - * @class EcdhParams - * @implements {graphene.IParams} - * @implements {pkcs11.ECDH1} - */ - class EcdhParams implements graphene.IParams, pkcs11.ECDH1 { - /** - * key derivation function used on the shared secret value - */ - kdf: EcKdf; - /** - * some data shared between the two parties - */ - sharedData: Buffer; - /** - * other party's EC public key value - */ - publicData: Buffer; - type: MechParams; - /** - * Creates an instance of EcdhParams. - * - * @param {EcKdf} kdf key derivation function used on the shared secret value - * @param {Buffer} [sharedData=null] some data shared between the two parties - * @param {Buffer} [publicData=null] other party's EC public key value - */ - constructor(kdf: EcKdf, sharedData?: Buffer, publicData?: Buffer); - toCKI(): pkcs11.ECDH1; - } - - class NamedCurve { - static getByName(name: string): graphene.INamedCurve; - static getByOid(oid: string): graphene.INamedCurve; - } - - /** - * EcKdf is used to indicate the Key Derivation Function (KDF) - * applied to derive keying data from a shared secret. - * The key derivation function will be used by the EC key agreement schemes. - */ - enum EcKdf { - NULL, - SHA1, - SHA224, - SHA256, - SHA384, - SHA512, - } - - // ========== RSA ========== - - /** - * Parameter RSA OAEP - * - * @class RsaOaepParams - * @implements {graphene.IParams} - */ - class RsaOaepParams implements graphene.IParams { - hashAlgorithm: MechanismEnum; - mgf: RsaMgf; - source: number; - sourceData: Buffer; - type: MechParams; - constructor(hashAlg?: MechanismEnum, mgf?: RsaMgf, sourceData?: Buffer); - toCKI(): pkcs11.RsaOAEP; - } - - /** - * Parameter RSA PSS - * - * @class RsaPssParams - * @implements {graphene.IParams} - */ - class RsaPssParams implements graphene.IParams { - /** - * hash algorithm used in the PSS encoding; - * - if the signature mechanism does not include message hashing, - * then this value must be the mechanism used by the application to generate - * the message hash; - * - if the signature mechanism includes hashing, - * then this value must match the hash algorithm indicated - * by the signature mechanism - */ - hashAlgorithm: MechanismEnum; - /** - * mask generation function to use on the encoded block - */ - mgf: RsaMgf; - /** - * length, in bytes, of the salt value used in the PSS encoding; - * - typical values are the length of the message hash and zero - */ - saltLength: number; - type: MechParams; - constructor(hashAlg?: MechanismEnum, mgf?: RsaMgf, saltLen?: number); - toCKI(): pkcs11.RsaPSS; - } - - enum RsaMgf { - MGF1_SHA1, - MGF1_SHA224, - MGF1_SHA256, - MGF1_SHA384, - MGF1_SHA512, - } - - - // ========== Enums ========== - - enum ObjectClass { - DATA, - CERTIFICATE, - PUBLIC_KEY, - PRIVATE_KEY, - SECRET_KEY, - HW_FEATURE, - DOMAIN_PARAMETERS, - MECHANISM, - OTP_KEY, - } - - class Mechanism { - static vendor(jsonFile: string): void; - static vendor(name: string, value: number): void; - } - - enum CertificateType { - X_509, - X_509_ATTR_CERT, - WTLS, - } - - enum CertificateCategory { - Unspecified = 0, - TokenUser = 1, - Authority = 2, - OtherEntity = 3, - } - - enum KeyType { - RSA, - DSA, - DH, - ECDSA, - EC, - X9_42_DH, - KEA, - GENERIC_SECRET, - RC2, - RC4, - DES, - DES2, - DES3, - CAST, - CAST3, - CAST5, - CAST128, - RC5, - IDEA, - SKIPJACK, - BATON, - JUNIPER, - CDMF, - AES, - GOSTR3410, - GOSTR3411, - GOST28147, - BLOWFISH, - TWOFISH, - SECURID, - HOTP, - ACTI, - CAMELLIA, - ARIA, - } - - enum KeyGenMechanism { - AES, - RSA, - RSA_X9_31, - DSA, - DH_PKCS, - DH_X9_42, - GOSTR3410, - GOST28147, - RC2, - RC4, - DES, - DES2, - SECURID, - ACTI, - CAST, - CAST3, - CAST5, - CAST128, - RC5, - IDEA, - GENERIC_SECRET, - SSL3_PRE_MASTER, - CAMELLIA, - ARIA, - SKIPJACK, - KEA, - BATON, - ECDSA, - EC, - JUNIPER, - TWOFISH, - } - - enum MechanismFlag { - /** - * `True` if the mechanism is performed by the device; `false` if the mechanism is performed in software - */ - HW, - /** - * `True` if the mechanism can be used with encrypt function - */ - ENCRYPT, - /** - * `True` if the mechanism can be used with decrypt function - */ - DECRYPT, - /** - * `True` if the mechanism can be used with digest function - */ - DIGEST, - /** - * `True` if the mechanism can be used with sign function - */ - SIGN, - /** - * `True` if the mechanism can be used with sign recover function - */ - SIGN_RECOVER, - /** - * `True` if the mechanism can be used with verify function - */ - VERIFY, - /** - * `True` if the mechanism can be used with verify recover function - */ - VERIFY_RECOVER, - /** - * `True` if the mechanism can be used with geberate function - */ - GENERATE, - /** - * `True` if the mechanism can be used with generate key pair function - */ - GENERATE_KEY_PAIR, - /** - * `True` if the mechanism can be used with wrap function - */ - WRAP, - /** - * `True` if the mechanism can be used with unwrap function - */ - UNWRAP, - /** - * `True` if the mechanism can be used with derive function - */ - DERIVE, - } - - enum MechanismEnum { - RSA_PKCS_KEY_PAIR_GEN, - RSA_PKCS, - RSA_9796, - RSA_X_509, - MD2_RSA_PKCS, - MD5_RSA_PKCS, - SHA1_RSA_PKCS, - RIPEMD128_RSA_PKCS, - RIPEMD160_RSA_PKCS, - RSA_PKCS_OAEP, - RSA_X9_31_KEY_PAIR_GEN, - RSA_X9_31, - SHA1_RSA_X9_31, - RSA_PKCS_PSS, - SHA1_RSA_PKCS_PSS, - DSA_KEY_PAIR_GEN, - DSA, - DSA_SHA1, - DSA_SHA224, - DSA_SHA256, - DSA_SHA384, - DSA_SHA512, - DH_PKCS_KEY_PAIR_GEN, - DH_PKCS_DERIVE, - X9_42_DH_KEY_PAIR_GEN, - X9_42_DH_DERIVE, - X9_42_DH_HYBRID_DERIVE, - X9_42_MQV_DERIVE, - SHA256_RSA_PKCS, - SHA384_RSA_PKCS, - SHA512_RSA_PKCS, - SHA256_RSA_PKCS_PSS, - SHA384_RSA_PKCS_PSS, - SHA512_RSA_PKCS_PSS, - SHA224_RSA_PKCS, - SHA224_RSA_PKCS_PSS, - RC2_KEY_GEN, - RC2_ECB, - RC2_CBC, - RC2_MAC, - RC2_MAC_GENERAL, - RC2_CBC_PAD, - RC4_KEY_GEN, - RC4, - DES_KEY_GEN, - DES_ECB, - DES_CBC, - DES_MAC, - DES_MAC_GENERAL, - DES_CBC_PAD, - DES2_KEY_GEN, - DES3_KEY_GEN, - DES3_ECB, - DES3_CBC, - DES3_MAC, - DES3_MAC_GENERAL, - DES3_CBC_PAD, - CDMF_KEY_GEN, - CDMF_ECB, - CDMF_CBC, - CDMF_MAC, - CDMF_MAC_GENERAL, - CDMF_CBC_PAD, - DES_OFB64, - DES_OFB8, - DES_CFB64, - DES_CFB8, - MD2, - MD2_HMAC, - MD2_HMAC_GENERAL, - MD5, - MD5_HMAC, - MD5_HMAC_GENERAL, - SHA1, - SHA, - SHA_1, - SHA_1_HMAC, - SHA_1_HMAC_GENERAL, - RIPEMD128, - RIPEMD128_HMAC, - RIPEMD128_HMAC_GENERAL, - RIPEMD160, - RIPEMD160_HMAC, - RIPEMD160_HMAC_GENERAL, - SHA256, - SHA256_HMAC, - SHA256_HMAC_GENERAL, - SHA224, - SHA224_HMAC, - SHA224_HMAC_GENERAL, - SHA384, - SHA384_HMAC, - SHA384_HMAC_GENERAL, - SHA512, - SHA512_HMAC, - SHA512_HMAC_GENERAL, - SECURID_KEY_GEN, - SECURID, - HOTP_KEY_GEN, - HOTP, - ACTI, - ACTI_KEY_GEN, - CAST_KEY_GEN, - CAST_ECB, - CAST_CBC, - CAST_MAC, - CAST_MAC_GENERAL, - CAST_CBC_PAD, - CAST3_KEY_GEN, - CAST3_ECB, - CAST3_CBC, - CAST3_MAC, - CAST3_MAC_GENERAL, - CAST3_CBC_PAD, - CAST5_KEY_GEN, - CAST128_KEY_GEN, - CAST5_ECB, - CAST128_ECB, - CAST5_CBC, - CAST128_CBC, - CAST5_MAC, - CAST128_MAC, - CAST5_MAC_GENERAL, - CAST128_MAC_GENERAL, - CAST5_CBC_PAD, - CAST128_CBC_PAD, - RC5_KEY_GEN, - RC5_ECB, - RC5_CBC, - RC5_MAC, - RC5_MAC_GENERAL, - RC5_CBC_PAD, - IDEA_KEY_GEN, - IDEA_ECB, - IDEA_CBC, - IDEA_MAC, - IDEA_MAC_GENERAL, - IDEA_CBC_PAD, - GENERIC_SECRET_KEY_GEN, - CONCATENATE_BASE_AND_KEY, - CONCATENATE_BASE_AND_DATA, - CONCATENATE_DATA_AND_BASE, - XOR_BASE_AND_DATA, - EXTRACT_KEY_FROM_KEY, - SSL3_PRE_MASTER_KEY_GEN, - SSL3_MASTER_KEY_DERIVE, - SSL3_KEY_AND_MAC_DERIVE, - SSL3_MASTER_KEY_DERIVE_DH, - TLS_PRE_MASTER_KEY_GEN, - TLS_MASTER_KEY_DERIVE, - TLS_KEY_AND_MAC_DERIVE, - TLS_MASTER_KEY_DERIVE_DH, - TLS_PRF, - SSL3_MD5_MAC, - SSL3_SHA1_MAC, - MD5_KEY_DERIVATION, - MD2_KEY_DERIVATION, - SHA1_KEY_DERIVATION, - SHA256_KEY_DERIVATION, - SHA384_KEY_DERIVATION, - SHA512_KEY_DERIVATION, - SHA224_KEY_DERIVATION, - PBE_MD2_DES_CBC, - PBE_MD5_DES_CBC, - PBE_MD5_CAST_CBC, - PBE_MD5_CAST3_CBC, - PBE_MD5_CAST5_CBC, - PBE_MD5_CAST128_CBC, - PBE_SHA1_CAST5_CBC, - PBE_SHA1_CAST128_CBC, - PBE_SHA1_RC4_128, - PBE_SHA1_RC4_40, - PBE_SHA1_DES3_EDE_CBC, - PBE_SHA1_DES2_EDE_CBC, - PBE_SHA1_RC2_128_CBC, - PBE_SHA1_RC2_40_CBC, - PKCS5_PBKD2, - PBA_SHA1_WITH_SHA1_HMAC, - WTLS_PRE_MASTER_KEY_GEN, - WTLS_MASTER_KEY_DERIVE, - WTLS_MASTER_KEY_DERIVE_DH_ECC, - WTLS_PRF, - WTLS_SERVER_KEY_AND_MAC_DERIVE, - WTLS_CLIENT_KEY_AND_MAC_DERIVE, - KEY_WRAP_LYNKS, - KEY_WRAP_SET_OAEP, - CAMELLIA_KEY_GEN, - CAMELLIA_ECB, - CAMELLIA_CBC, - CAMELLIA_MAC, - CAMELLIA_MAC_GENERAL, - CAMELLIA_CBC_PAD, - CAMELLIA_ECB_ENCRYPT_DATA, - CAMELLIA_CBC_ENCRYPT_DATA, - CAMELLIA_CTR, - ARIA_KEY_GEN, - ARIA_ECB, - ARIA_CBC, - ARIA_MAC, - ARIA_MAC_GENERAL, - ARIA_CBC_PAD, - ARIA_ECB_ENCRYPT_DATA, - ARIA_CBC_ENCRYPT_DATA, - SKIPJACK_KEY_GEN, - SKIPJACK_ECB64, - SKIPJACK_CBC64, - SKIPJACK_OFB64, - SKIPJACK_CFB64, - SKIPJACK_CFB32, - SKIPJACK_CFB16, - SKIPJACK_CFB8, - SKIPJACK_WRAP, - SKIPJACK_PRIVATE_WRAP, - SKIPJACK_RELAYX, - KEA_KEY_PAIR_GEN, - KEA_KEY_DERIVE, - FORTEZZA_TIMESTAMP, - BATON_KEY_GEN, - BATON_ECB128, - BATON_ECB96, - BATON_CBC128, - BATON_COUNTER, - BATON_SHUFFLE, - BATON_WRAP, - ECDSA_KEY_PAIR_GEN, - EC_KEY_PAIR_GEN, - ECDSA, - ECDSA_SHA1, - ECDSA_SHA224, - ECDSA_SHA256, - ECDSA_SHA384, - ECDSA_SHA512, - ECDH1_DERIVE, - ECDH1_COFACTOR_DERIVE, - ECMQV_DERIVE, - JUNIPER_KEY_GEN, - JUNIPER_ECB128, - JUNIPER_CBC128, - JUNIPER_COUNTER, - JUNIPER_SHUFFLE, - JUNIPER_WRAP, - FASTHASH, - AES_KEY_GEN, - AES_ECB, - AES_CBC, - AES_MAC, - AES_MAC_GENERAL, - AES_CBC_PAD, - AES_CTR, - AES_CMAC, - AES_CMAC_GENERAL, - BLOWFISH_KEY_GEN, - BLOWFISH_CBC, - TWOFISH_KEY_GEN, - TWOFISH_CBC, - AES_GCM, - AES_CCM, - AES_KEY_WRAP, - AES_KEY_WRAP_PAD, - DES_ECB_ENCRYPT_DATA, - DES_CBC_ENCRYPT_DATA, - DES3_ECB_ENCRYPT_DATA, - DES3_CBC_ENCRYPT_DATA, - AES_ECB_ENCRYPT_DATA, - AES_CBC_ENCRYPT_DATA, - GOSTR3410_KEY_PAIR_GEN, - GOSTR3410, - GOSTR3410_WITH_GOSTR3411, - GOSTR3410_KEY_WRAP, - GOSTR3410_DERIVE, - GOSTR3411, - GOSTR3411_HMAC, - GOST28147_KEY_GEN, - GOST28147_ECB, - GOST28147, - GOST28147_MAC, - GOST28147_KEY_WRAP, - DSA_PARAMETER_GEN, - DH_PKCS_PARAMETER_GEN, - X9_42_DH_PARAMETER_GEN, - VENDOR_DEFINED, - } - - enum MechParams { - AesCBC = 1, - AesCCM = 2, - AesGCM = 3, - RsaOAEP = 4, - RsaPSS = 5, - EcDH = 6, - } - - enum SessionFlag { - /** - * `True` if the session is read/write; `false` if the session is read-only - */ - RW_SESSION, - /** - * This flag is provided for backward compatibility, and should always be set to `true` - */ - SERIAL_SESSION - } - - enum UserType { - /** - * Security Officer - */ - SO, - /** - * User - */ - USER, - /** - * Context specific - */ - CONTEXT_SPECIFIC + class Template { + static toPkcs11(tmpl: ITemplate): pkcs11.Attribute[]; + static fromPkcs11(tmpl: pkcs11.Template): ITemplate; } enum SlotFlag { @@ -2157,7 +2047,69 @@ declare module "graphene-pk11" { /** * True if the slot is a hardware slot, as opposed to a software slot implementing a "soft token" */ - HW_SLOT + HW_SLOT, + } + class Slot extends HandleObject { + + slotDescription: string; + manufacturerID: string; + flags: number; + hardwareVersion: pkcs11.Version; + firmwareVersion: pkcs11.Version; + module: Module; + + constructor(handle: Handle, module: Module, lib: pkcs11.PKCS11); + + /** + * Recieve information about Slot + * + * @protected + */ + protected getInfo(): void; + + /** + * Returns information about token + * + * @returns {Token} + */ + getToken(): Token; + /** + * returns list of `MechanismInfo` + * + * @returns {MechanismCollection} + */ + getMechanisms(): MechanismCollection; + /** + * initializes a token + * + * @param {string} pin the SO's initial PIN + * @returns {string} + */ + initToken(pin: string): string; + /** + * opens a session between an application and a token in a particular slot + * + * @param {SessionFlag} [flags=session.SessionFlag.SERIAL_SESSION] indicates the type of session + * @returns {Session} + */ + open(flags?: SessionFlag): Session; + /** + * closes all sessions an application has with a token + */ + closeAll(): void; + } + + /** + * Collection of slots + * + * @export + * @class SlotCollection + * @extends {core.Collection} + */ + class SlotCollection extends Collection { + module: Module; + items(index: number): Slot; + constructor(items: Array, module: Module, lib: pkcs11.PKCS11, classType?: any); } enum TokenFlag { @@ -2181,16 +2133,96 @@ declare module "graphene-pk11" { SO_PIN_TO_BE_CHANGED } - enum JavaMIDP { - Unspecified, - Manufacturer, - Operator, - ThirdParty + class Token extends HandleObject { + /** + * application-defined label, assigned during token initialization. + * - Must be padded with the blank character (' '). + * - Should __not__ be null-terminated. + */ + label: string; + /** + * ID of the device manufacturer. + * - Must be padded with the blank character (' '). + * - Should __not__ be null-terminated. + */ + manufacturerID: string; + /** + * model of the device. + * - Must be padded with the blank character (' '). + * - Should __not__ be null-terminated. + */ + model: string; + /** + * character-string serial number of the device. + * - Must be padded with the blank character (' '). + * - Should __not__ be null-terminated. + */ + serialNumber: string; + /** + * bit flags indicating capabilities and status of the device + */ + flags: number; + /** + * maximum number of sessions that can be opened with the token at one time by a single application + */ + maxSessionCount: number; + /** + * number of sessions that this application currently has open with the token + */ + sessionCount: number; + /** + * maximum number of read/write sessions that can be opened + * with the token at one time by a single application + */ + maxRwSessionCount: number; + /** + * number of read/write sessions that this application currently has open with the token + */ + rwSessionCount: number; + /** + * maximum length in bytes of the PIN + */ + maxPinLen: number; + /** + * minimum length in bytes of the PIN + */ + minPinLen: number; + /** + * the total amount of memory on the token in bytes in which public objects may be stored + */ + totalPublicMemory: number; + /** + * the amount of free (unused) memory on the token in bytes for public objects + */ + freePublicMemory: number; + /** + * the total amount of memory on the token in bytes in which private objects may be stored + */ + totalPrivateMemory: number; + /** + * the amount of free (unused) memory on the token in bytes for private objects + */ + freePrivateMemory: number; + /** + * version number of hardware + */ + hardwareVersion: pkcs11.Version; + /** + * version number of firmware + */ + firmwareVersion: pkcs11.Version; + /** + * current time as a character-string of length 16, + * represented in the format YYYYMMDDhhmmssxx + */ + utcTime: Date; + + constructor(handle: Handle, lib: pkcs11.PKCS11); + + protected getInfo(): void; } - // ========== Module ========== - - class Module implements graphene.BaseObject { + class Module extends BaseObject { libFile: string; libName: string; /** @@ -2213,9 +2245,8 @@ declare module "graphene-pk11" { * version of library */ libraryVersion: pkcs11.Version; - constructor(lib: pkcs11.PKCS11); - + protected getInfo(): void; /** * initializes the Cryptoki library */ @@ -2229,11 +2260,11 @@ declare module "graphene-pk11" { * @param {number} index index of an element in collection * @param {number} tokenPresent only slots with tokens. Default `True` */ - getSlots(index: number, tokenPresent?: boolean): graphene.Slot; + getSlots(index: number, tokenPresent?: boolean): Slot; /** * @param {number} tokenPresent only slots with tokens. Default `True` */ - getSlots(tokenPresent?: boolean): graphene.SlotCollection; + getSlots(tokenPresent?: boolean): SlotCollection; /** * loads pkcs11 lib * @param libFile path to PKCS11 library @@ -2242,4 +2273,5 @@ declare module "graphene-pk11" { static load(libFile: string, libName?: string): Module; } -} \ No newline at end of file + +} \ No newline at end of file From 47f44b5a8bc2388c3fc9c9533e503b308ff6d3f4 Mon Sep 17 00:00:00 2001 From: microshine Date: Sun, 14 Aug 2016 12:10:50 +0300 Subject: [PATCH 086/203] Add base64url --- base64url/base64url.d.ts | 74 +++++++++++++++++++++++++++++++++++++ base64url/base64url.test.ts | 26 +++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 base64url/base64url.d.ts create mode 100644 base64url/base64url.test.ts diff --git a/base64url/base64url.d.ts b/base64url/base64url.d.ts new file mode 100644 index 0000000000..42dbe4cca5 --- /dev/null +++ b/base64url/base64url.d.ts @@ -0,0 +1,74 @@ +// Type definitions for base64url v2.0.0 +// Project: https://github.com/brianloveswords/base64url +// Definitions by: Stepan Miroshin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/** + * For encoding and decoding base64url! + * v2.0.0 + */ + +/** + * Encoding type + */ +declare type Encoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "utf16le" | "base64" | "binary" | "hex" + +interface IBase64Url { + /** + * Encode input to base64url + * @param {string} input Incoming input + * @param {Encoding} encoding Default 'utf8' + * @return {string} + */ + (input: string, encoding?: Encoding): string; + /** + * Encode input to base64url + * @param {Buffer} input Incoming value + */ + (inout: Buffer): string; + /** + * Encode input to base64url + * + * @param {string} input Incoming input + * @param {Encoding} encoding Default 'utf8' + * @returns {string} + */ + encode(input: string, encoding?: Encoding): string; + /** + * Encode input to base64url + * @param {Buffer} input Incoming value + */ + encode(input: Buffer): string; + /** + * Convert a base64url encoded string into a raw string. + * @param {string} base64url base64url encoded string + * @param {Encoding} encoding Encoding defaults to 'utf8' + * @returns {string} + */ + decode(base64url: string, encoding?: string): string; + /** + * Convert a base64url encoded string to a base64 encoded string + * @param {string | Buffer} base64url base64url encoded value + * @returns {string} + */ + toBase64(base64url: string | Buffer): string; + /** + * Convert a base64 encoded string to a base64url encoded string + * @param {string} base64 encoded string + * @returns {string} + */ + fromBase64(base64: string): string; + /** + * Convert a base64url encoded string to a Buffer + * @param {string} base64url encoded string + * @returns {Buffer} + */ + toBuffer(base64url: string): Buffer; +} + +declare module "base64url" { + const base64url: IBase64Url; + export = base64url; +} diff --git a/base64url/base64url.test.ts b/base64url/base64url.test.ts new file mode 100644 index 0000000000..01b3934bc9 --- /dev/null +++ b/base64url/base64url.test.ts @@ -0,0 +1,26 @@ +/// + +import * as base64url from "base64url"; + +// default +let str = base64url("some value"); +str = base64url("some value", "hex"); +str = base64url(new Buffer("some value")); + +// encode +str = base64url.encode("some value"); +str = base64url.encode("some value", "hex"); +str = base64url.encode(new Buffer("some value")); + +// decode +str = base64url.decode("ADA="); +str = base64url.decode("ADA=", "binary"); + +// toBase64 +str = base64url.toBase64("ADA="); +str = base64url.toBase64(new Buffer("ADA=", "base64")); + +// fromBase64 +str = base64url.fromBase64("ADA="); + +let buf = base64url.toBase64("ADA="); \ No newline at end of file From b52db8569b2109a43d5d26892fce363901180a60 Mon Sep 17 00:00:00 2001 From: Ramon Ornelas Date: Sun, 14 Aug 2016 15:28:52 -0300 Subject: [PATCH 087/203] - Fix support module (import) jspdf see: https://github.com/Microsoft/TypeScript/issues/5073 --- jspdf/jspdf-tests.ts | 2 + jspdf/jspdf.d.ts | 364 ++++++++++++++++++++++--------------------- 2 files changed, 187 insertions(+), 179 deletions(-) diff --git a/jspdf/jspdf-tests.ts b/jspdf/jspdf-tests.ts index 385eb7fc4a..7a104554b6 100644 --- a/jspdf/jspdf-tests.ts +++ b/jspdf/jspdf-tests.ts @@ -2,6 +2,8 @@ // From: https://mrrio.github.io/jsPDF/examples/basic.html +import * as jsPDF from 'jspdf'; + function test_simple_two_page_document() { var doc = new jsPDF(); doc.text(20, 20, 'Hello world!'); diff --git a/jspdf/jspdf.d.ts b/jspdf/jspdf.d.ts index 3b0b6cd99b..60246f04a1 100644 --- a/jspdf/jspdf.d.ts +++ b/jspdf/jspdf.d.ts @@ -3,201 +3,207 @@ // Definitions by: Amber Schühmacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class jsPDF { - constructor(orientation?:any, - unit?:string, - format?:string, - compressPdf?:number); +declare module 'jspdf' { + class jsPDF { + constructor(orientation?:any, + unit?:string, + format?:string, + compressPdf?:number); - CapJoinStyles:any; - version:string; + CapJoinStyles:any; + version:string; - internal: { - 'pdfEscape'(text:string, flags:any): any; - 'getStyle'(style:string) : any; - 'getFont'(): any; - 'getFontSize'():number; - 'getLineHeight'():number; - 'write'(string1:string):any; - 'getCoordinateString'(value:number):number; - 'getVerticalCoordinateString'(value:number):number; - 'collections':any; - 'newObject'():number; - 'newAdditionalObject'():any; - 'newObjectDeferred'():number; - 'newObjectDeferredBegin'(oid:number):void; - 'putStream'(str:string):void; - 'events':any; - 'scaleFactor':number; - 'pageSize': { - width:number; - height:number; + internal: { + 'pdfEscape'(text:string, flags:any): any; + 'getStyle'(style:string) : any; + 'getFont'(): any; + 'getFontSize'():number; + 'getLineHeight'():number; + 'write'(string1:string):any; + 'getCoordinateString'(value:number):number; + 'getVerticalCoordinateString'(value:number):number; + 'collections':any; + 'newObject'():number; + 'newAdditionalObject'():any; + 'newObjectDeferred'():number; + 'newObjectDeferredBegin'(oid:number):void; + 'putStream'(str:string):void; + 'events':any; + 'scaleFactor':number; + 'pageSize': { + width:number; + height:number; + }; + 'output'(type:any, options:any):any; + 'getNumberOfPages'():number; + 'pages':number[]; + 'out'(string:string):void; + 'f2'(number:number):number; + 'getPageInfo'(pageNumberOneBased:number):any; + 'getCurrentPageInfo'():any; }; - 'output'(type:any, options:any):any; - 'getNumberOfPages'():number; - 'pages':number[]; - 'out'(string:string):void; - 'f2'(number:number):number; - 'getPageInfo'(pageNumberOneBased:number):any; - 'getCurrentPageInfo'():any; - }; - addPage():jsPDF; - setPage(n:number):jsPDF; - insertPage(beforePage:number):jsPDF; - movePage(targetPage:number, beforePage:number):jsPDF; - deletePage(n:number):jsPDF; - setDisplayMode(zoom?:string, layout?:string, pmode?:string):jsPDF; - text(text:any, x:any, y:any, flags?:any, angle?:any, align?:any):jsPDF; - lstext(text:string, x:number, y:number, spacing:number):jsPDF; - line(x1:number, y1:number, x2:number, y2:number):any; - clip():void; - lines(lines:any, x:any, y:any, scale?:any, style?:string, closed?:boolean):jsPDF; - rect(x:number, y:number, w:number, h:number, style?:string):jsPDF; - triangle(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number, style:string):jsPDF; - roundedRect(x:number, y:number, w:number, h:number, rx:number, ry:number, style:string):jsPDF; - ellipse(x:number, y:number, rx:number, ry:number, style?:string):jsPDF; - circle(x:number, y:number, r:number, style:string):jsPDF; - setProperties(properties:any):jsPDF; - setFontSize(size:number):jsPDF; - setFont(fontName?:string, fontStyle?:string):jsPDF; - setFontStyle(style:string):jsPDF; - setFontType(style:string):jsPDF; - getFontList():any; - addFont(postScriptName:string, fontName:string, fontStyle:string):string; - setLineWidth(width:number):jsPDF; - setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF; - setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF; - setTextColor(r?:number, g?:number, b?:number):jsPDF; - setLineCap(style:string|number):jsPDF; - setLineJoin(style:string|number):jsPDF; - output(type?:string, options?:any):any; - save(filename:string):jsPDF; + addPage():jsPDF; + setPage(n:number):jsPDF; + insertPage(beforePage:number):jsPDF; + movePage(targetPage:number, beforePage:number):jsPDF; + deletePage(n:number):jsPDF; + setDisplayMode(zoom?:string, layout?:string, pmode?:string):jsPDF; + text(text:any, x:any, y:any, flags?:any, angle?:any, align?:any):jsPDF; + lstext(text:string, x:number, y:number, spacing:number):jsPDF; + line(x1:number, y1:number, x2:number, y2:number):any; + clip():void; + lines(lines:any, x:any, y:any, scale?:any, style?:string, closed?:boolean):jsPDF; + rect(x:number, y:number, w:number, h:number, style?:string):jsPDF; + triangle(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number, style:string):jsPDF; + roundedRect(x:number, y:number, w:number, h:number, rx:number, ry:number, style:string):jsPDF; + ellipse(x:number, y:number, rx:number, ry:number, style?:string):jsPDF; + circle(x:number, y:number, r:number, style:string):jsPDF; + setProperties(properties:any):jsPDF; + setFontSize(size:number):jsPDF; + setFont(fontName?:string, fontStyle?:string):jsPDF; + setFontStyle(style:string):jsPDF; + setFontType(style:string):jsPDF; + getFontList():any; + addFont(postScriptName:string, fontName:string, fontStyle:string):string; + setLineWidth(width:number):jsPDF; + setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF; + setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF; + setTextColor(r?:number, g?:number, b?:number):jsPDF; + setLineCap(style:string|number):jsPDF; + setLineJoin(style:string|number):jsPDF; + output(type?:string, options?:any):any; + save(filename:string):jsPDF; - /** - * jsPDF plugins below: - * - * - AddHTML - * - AddImage - * - Annotations - * - AutoPrint - * - Canvas - * - Cell - * - Context2D - * - FromHTML - * - JavaScript - * - PNG - * - split_text_to_size - * - SVG - * - total_pages - */ + /** + * jsPDF plugins below: + * + * - AddHTML + * - AddImage + * - Annotations + * - AutoPrint + * - Canvas + * - Cell + * - Context2D + * - FromHTML + * - JavaScript + * - PNG + * - split_text_to_size + * - SVG + * - total_pages + */ - // jsPDF plugin: addHTML - addHTML(element:any, x:number, y:number, options:any, callback:Function):jsPDF; - addHTML(element:any, callback:Function):jsPDF; + // jsPDF plugin: addHTML + addHTML(element:any, x:number, y:number, options:any, callback:Function):jsPDF; + addHTML(element:any, callback:Function):jsPDF; - // jsPDF plugin: addImage - color_spaces:any; - decode:any; - image_compression:any; + // jsPDF plugin: addImage + color_spaces:any; + decode:any; + image_compression:any; - sHashCode(str:string):any; - isString(object:any):boolean; - extractInfoFromBase64DataURI(dataURI:string):any[]; - supportsArrayBuffer():boolean; - isArrayBuffer(object:any):boolean; - isArrayBufferView(object:any):boolean; - binaryStringToUint8Array(binary_string:string):Uint8Array; - arrayBufferToBinaryString(buffer:any):string; - arrayBufferToBase64(arrayBuffer:ArrayBuffer):string; - createImageInfo(data:any, wd:any, ht:any, cs:any, bpc:any, imageIndex:number, alias:any, f?:any, dp?:any, trns?:any, pal?:any, smask?:any):any; - addImage(imageData?:any, format?:any, x?:number, y?:number, w?:number, h?:number, alias?:any, compression?:any, rotation?:any):jsPDF; - processJPEG(data:any, index:number, alias:any, compression?:any, dataAsBinaryString?:string):any; - processJPG():any; + sHashCode(str:string):any; + isString(object:any):boolean; + extractInfoFromBase64DataURI(dataURI:string):any[]; + supportsArrayBuffer():boolean; + isArrayBuffer(object:any):boolean; + isArrayBufferView(object:any):boolean; + binaryStringToUint8Array(binary_string:string):Uint8Array; + arrayBufferToBinaryString(buffer:any):string; + arrayBufferToBase64(arrayBuffer:ArrayBuffer):string; + createImageInfo(data:any, wd:any, ht:any, cs:any, bpc:any, imageIndex:number, alias:any, f?:any, dp?:any, trns?:any, pal?:any, smask?:any):any; + addImage(imageData?:any, format?:any, x?:number, y?:number, w?:number, h?:number, alias?:any, compression?:any, rotation?:any):jsPDF; + processJPEG(data:any, index:number, alias:any, compression?:any, dataAsBinaryString?:string):any; + processJPG():any; - // jsPDF plugin: Annotations - annotationPlugin:any; - createAnnotation(options:any):void; - link(x:number, y:number, w:number, h:number, options:any):void; - textWithLink(text:string, x:number, y:number, options:any):number; - getTextWidth(text:string):number; - getLineHeight():number; + // jsPDF plugin: Annotations + annotationPlugin:any; + createAnnotation(options:any):void; + link(x:number, y:number, w:number, h:number, options:any):void; + textWithLink(text:string, x:number, y:number, options:any):number; + getTextWidth(text:string):number; + getLineHeight():number; - // jsPDF plugin: AutoPrint - autoPrint():jsPDF; + // jsPDF plugin: AutoPrint + autoPrint():jsPDF; - // jsPDF plugin: Canvas - canvas: { - getContext():any; - style:any; - }; + // jsPDF plugin: Canvas + canvas: { + getContext():any; + style:any; + }; - // jsPDF plugin: Cell - setHeaderFunction(func:Function):void; - getTextDimensions(txt:string):any; - cellAddPage():void; - cellInitialize():void; - cell(x:number, y:number, w:number, h:number, txt:string, ln:number, align:string):jsPDF; - arrayMax(array:any[], comparisonFn?:Function):number; - table(x:number, y:number, data:any, headers:string[], config:any):jsPDF; - calculateLineHeight(headerNames:string[], columnWidths:number[], model:any[]):number; - setTableHeaderRow(config:any[]):void; - printHeaderRow(lineNumber:number, new_page?:boolean):void; + // jsPDF plugin: Cell + setHeaderFunction(func:Function):void; + getTextDimensions(txt:string):any; + cellAddPage():void; + cellInitialize():void; + cell(x:number, y:number, w:number, h:number, txt:string, ln:number, align:string):jsPDF; + arrayMax(array:any[], comparisonFn?:Function):number; + table(x:number, y:number, data:any, headers:string[], config:any):jsPDF; + calculateLineHeight(headerNames:string[], columnWidths:number[], model:any[]):number; + setTableHeaderRow(config:any[]):void; + printHeaderRow(lineNumber:number, new_page?:boolean):void; - // jsPDF plugin: Context2D - context2d: { - pageWrapXEnabled: boolean; - pageWrapYEnabled: boolean; - pageWrapX: number; - pageWrapY: number; - f2(number:number):number; - fillRect(x:number, y:number, w:number, h:number):void; - strokeRect(x:number, y:number, w:number, h:number):void; - clearRect(x:number, y:number, w:number, h:number):void; - save():void; - restore():void; - beginPath():void; - closePath():void; - setFillStyle(style:string):void; - setStrokeStyle(style:string):void; - fillText(text:string|string[], x:number, y:number, maxWidth:number):void; - strokeText(text:string|string[], x:number, y:number, maxWidth:number):void; - setFont(font:string):void; - setTextBaseline(baseline:string):void; - getTextBaseline():string; - setLineWidth(width:number):void; - setLineCap(style:string):void; - setLineJoin(style:string):void; - moveTo(x:number, y:number):void; - lastBreak: number; - pageBreaks: any[]; - lineTo(x:number, y:number):void; - bezierCurveTo(x1:number, y1:number, x2:number, y2:number, x:number, y:number):void; - quadraticCurveTo(x1:number, y1:number, x:number, y:number):void; - arc(x:number, y:number, radius:number, startAngle:number, endAngle:number, anticlockwise:any):void; - drawImage(img:string, x:number, y:number, w:number, h:number, x2?:number, y2?:number, w2?:number, h2?:number):void; - stroke():void; - fill():void; - translate(x:number, y:number):void; - measureText(text:string):number; - }; + // jsPDF plugin: Context2D + context2d: { + pageWrapXEnabled: boolean; + pageWrapYEnabled: boolean; + pageWrapX: number; + pageWrapY: number; + f2(number:number):number; + fillRect(x:number, y:number, w:number, h:number):void; + strokeRect(x:number, y:number, w:number, h:number):void; + clearRect(x:number, y:number, w:number, h:number):void; + save():void; + restore():void; + beginPath():void; + closePath():void; + setFillStyle(style:string):void; + setStrokeStyle(style:string):void; + fillText(text:string|string[], x:number, y:number, maxWidth:number):void; + strokeText(text:string|string[], x:number, y:number, maxWidth:number):void; + setFont(font:string):void; + setTextBaseline(baseline:string):void; + getTextBaseline():string; + setLineWidth(width:number):void; + setLineCap(style:string):void; + setLineJoin(style:string):void; + moveTo(x:number, y:number):void; + lastBreak: number; + pageBreaks: any[]; + lineTo(x:number, y:number):void; + bezierCurveTo(x1:number, y1:number, x2:number, y2:number, x:number, y:number):void; + quadraticCurveTo(x1:number, y1:number, x:number, y:number):void; + arc(x:number, y:number, radius:number, startAngle:number, endAngle:number, anticlockwise:any):void; + drawImage(img:string, x:number, y:number, w:number, h:number, x2?:number, y2?:number, w2?:number, h2?:number):void; + stroke():void; + fill():void; + translate(x:number, y:number):void; + measureText(text:string):number; + }; - // jsPDF plugin: fromHTML - fromHTML(HTML:string | HTMLElement, x:number, y:number, settings?:any, callback?:Function, margins?:any):jsPDF; + // jsPDF plugin: fromHTML + fromHTML(HTML:string | HTMLElement, x:number, y:number, settings?:any, callback?:Function, margins?:any):jsPDF; - // jsPDF plugin: JavaScript - addJS(txt:string):jsPDF; + // jsPDF plugin: JavaScript + addJS(txt:string):jsPDF; - // jsPDF plugin: PNG - processPNG(imageData:any, imageIndex:number, alias:string, compression:any, dataAsBinaryString:string):any; + // jsPDF plugin: PNG + processPNG(imageData:any, imageIndex:number, alias:string, compression:any, dataAsBinaryString:string):any; - // jsPDF plugin: split_text_to_size - getCharWidthsArray(text:string, options?:any):any[]; - getStringUnitWidth(text:string, options?:any):number; - splitTextToSize(text:string, maxlen:number, options?:any):any; + // jsPDF plugin: split_text_to_size + getCharWidthsArray(text:string, options?:any):any[]; + getStringUnitWidth(text:string, options?:any):number; + splitTextToSize(text:string, maxlen:number, options?:any):any; - // jsPDF plugin: SVG - addSVG(svgtext:string, x:number, y:number, w?:number, h?:number):jsPDF; + // jsPDF plugin: SVG + addSVG(svgtext:string, x:number, y:number, w?:number, h?:number):jsPDF; - // jsPDF plugin: total_pages - putTotalPages(pageExpression:string):jsPDF; + // jsPDF plugin: total_pages + putTotalPages(pageExpression:string):jsPDF; + } + + namespace jsPDF {} + + export = jsPDF; } From d50bebc384a1d8dff82a7100f62af61d5ae9ac79 Mon Sep 17 00:00:00 2001 From: DmitryEfimenko Date: Sun, 14 Aug 2016 18:38:26 -0700 Subject: [PATCH 088/203] make node-cache options optional --- node-cache/node-cache.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/node-cache/node-cache.d.ts b/node-cache/node-cache.d.ts index c599a7df16..3812cc9582 100644 --- a/node-cache/node-cache.d.ts +++ b/node-cache/node-cache.d.ts @@ -116,12 +116,12 @@ declare namespace NodeCacheTypes { } interface Options { - forceString: boolean; - objectValueSize: number; - arrayValueSize: number; - stdTTL: number; - checkperiod: number; - useClones: boolean; + forceString?: boolean; + objectValueSize?: number; + arrayValueSize?: number; + stdTTL?: number; + checkperiod?: number; + useClones?: boolean; } interface Stats { From cc84a3fe40424307bedb1d3abaeca4102f765800 Mon Sep 17 00:00:00 2001 From: Finn Poppinga Date: Mon, 15 Aug 2016 08:55:20 +0200 Subject: [PATCH 089/203] add optional responseHeaders parameter to documentdb QueryIterator callbacks --- documentdb/documentdb.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentdb/documentdb.d.ts b/documentdb/documentdb.d.ts index c4aefe470f..b37cec9313 100644 --- a/documentdb/documentdb.d.ts +++ b/documentdb/documentdb.d.ts @@ -94,12 +94,12 @@ declare module 'documentdb' { /** Represents the result returned from a query. */ interface QueryIterator { current(): TResultRow; - executeNext(callback: (error: QueryError, result: TResultRow[]) => void): void; - forEach(iteratorFunction : (error: QueryError, element: TResultRow) => void): void; + executeNext(callback: (error: QueryError, result: TResultRow[], responseHeaders? : any) => void): void; + forEach(iteratorFunction : (error: QueryError, element: TResultRow, responseHeaders? : any) => void): void; hasMoreResults(): boolean; - nextItem(callback: (error : QueryError, item : TResultRow) => void): void; + nextItem(callback: (error : QueryError, item : TResultRow, responseHeaders? : any) => void): void; reset() : void; - toArray(callback: (error: QueryError, result: TResultRow[]) => void): void; + toArray(callback: (error: QueryError, result: TResultRow[], responseHeaders? : any) => void): void; } /** Reprents an object with a unique identifier. */ From d2394f500891931b3d1b73a8dc97f36180d0ef7a Mon Sep 17 00:00:00 2001 From: Alexander Ryabtsev Date: Mon, 15 Aug 2016 16:11:43 +0300 Subject: [PATCH 090/203] Fix type defenition for canActivate function --- angularjs/angular-component-router.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-component-router.d.ts b/angularjs/angular-component-router.d.ts index 3b037b58b1..94d7dd7359 100644 --- a/angularjs/angular-component-router.d.ts +++ b/angularjs/angular-component-router.d.ts @@ -476,7 +476,7 @@ declare namespace angular { // Supplement IComponentOptions from angular.d.ts with router-specific // fields. interface IComponentOptions { - $canActivate?: () => boolean; + $canActivate?: (...args: any[]) => boolean | angular.IPromise; $routeConfig?: RouteDefinition[]; } } From e569feb83ef28046e07dc39d0bde584bffa973ec Mon Sep 17 00:00:00 2001 From: Erik Rothoff Andersson Date: Mon, 15 Aug 2016 16:24:03 +0200 Subject: [PATCH 091/203] Add path to fs.WriteStream --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index 6770d84632..17462097b3 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1418,6 +1418,7 @@ declare module "fs" { export interface WriteStream extends stream.Writable { close(): void; bytesWritten: number; + path: string; } /** From eb05cd3c8d1ac5c15df7ea4c961f92bf9e04cfa7 Mon Sep 17 00:00:00 2001 From: Nicholas Iannone Date: Mon, 15 Aug 2016 10:46:34 -0500 Subject: [PATCH 092/203] Added db-migrate and db-migrate/pg definitions. --- db-migrate-pg/db-migrate-pg-tests.ts | 411 +++++++++++++++++++++++++++ db-migrate-pg/db-migrate-pg.d.ts | 59 ++++ db-migrate/db-migrate-tests.ts | 322 +++++++++++++++++++++ db-migrate/db-migrate.d.ts | 150 ++++++++++ 4 files changed, 942 insertions(+) create mode 100644 db-migrate-pg/db-migrate-pg-tests.ts create mode 100644 db-migrate-pg/db-migrate-pg.d.ts create mode 100644 db-migrate/db-migrate-tests.ts create mode 100644 db-migrate/db-migrate.d.ts diff --git a/db-migrate-pg/db-migrate-pg-tests.ts b/db-migrate-pg/db-migrate-pg-tests.ts new file mode 100644 index 0000000000..ad2430440c --- /dev/null +++ b/db-migrate-pg/db-migrate-pg-tests.ts @@ -0,0 +1,411 @@ +// Test file for db-migrate-pg Definition file +/// + +import * as DbMigratePg from "DbMigratePg"; + +// Throw together a dummy driver +let db = {}; + +let callback = (err: any, response: any) => { + // Do nothing. +}; + +/// createTable(tableName, columnSpec, callback) +db.createTable('pets', { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' +}, callback); + +db.createTable('pets', { + columns: { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' + }, + ifNotExists: true +}, callback); + +db.createTable('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: 'id' + } + } +}, callback); + +db.createTable('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + product_id: 'id' + } + } + } +}, callback); + +/// dropTable(tableName, [options,] callback) +db.dropTable('pets', callback); + +db.dropTable('pets', { ifExists: true }, callback); + +/// renameTable(tableName, newTableName, callback) +db.renameTable('pets', 'pets_OLD', callback); + +/// addColumn(tableName, columnName, columnSpec, callback) +db.addColumn('pets', 'eyeColor', { + type: 'string', + length: 25, + notNull: true, +}, callback); + +db.addColumn('pets', 'id', { + type: 'int', + primaryKey: true, + autoIncrement: true, + notNull: true, + unique: true +}, callback); + +/// renameColumn(tableName, oldColumnName, newColumnName, callback) +db.renameColumn('pets', 'id', 'pet_id', callback); + +/// changeColumn(tableName, columnName, columnSpec, callback) +db.changeColumn('pets', 'eye_color', { + type: 'int', + unsigned: true, + notNull: true, + foreignKey: { + name: 'pets_eye_color_id_fk', + table: 'eye_color', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + eye_color: 'id' + } + } +}, callback); + +/// addIndex(tableName, indexName, columns, [unique,] callback) +db.addIndex('pets', 'pets_eye_color_idx', ['eye_color'], callback); +db.addIndex('pets', 'pets_registration_code_idx', ['registration_code'], true, callback); + +/// addForeignKey(tableName, referencedTableName, keyName, fieldMapping, rules, callback) +db.addForeignKey('module_user', 'modules', 'module_user_module_id_fk', +{ + 'module_id': 'id' +}, +{ + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' +}, callback); + +/// removeForeignKey(tableName, keyName, options, callback) +db.removeForeignKey('module_user', 'module_uer_module_id_foreign', callback); +db.removeForeignKey('module_user', 'module_user_module_id_foreign', { + dropIndex: true, +}, callback); + +/// insert(tableName, [columnNameArray,] valueArray, callback) +db.insert('module_user', ['first_name', 'last_name'], ['Test', 'Testerson'], callback); +db.insert('module_user', ['Test', 'Testerson'], callback); + +/// removeIndex([tableName,] indexName, callback) +db.removeIndex('pets', 'pets_eye_color_idx', callback); +db.removeIndex('pets_eye_color_idx', callback); + +/// runSql(sql, [params,] callback) +db.runSql('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [ + 'first_name', 'last_name', + 'Test', 'Testerson' +], callback); +db.runSql('DROP TABLE `pets`', callback); + +/// all(sql, [params,] callback) +db.all('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test'], callback); +db.all('SELECT * FROM `module_user`', callback); + +/// ========= +/// Async +/// ========= + +let onResolve = (result: any) => {}; + +/// createTableAsync(tableName, columnSpec) +db.createTableAsync('pets', { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' +}).then(onResolve); + +db.createTableAsync('pets', { + columns: { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' + }, + ifNotExists: true +}).then(onResolve); + +db.createTableAsync('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: 'id' + } + } +}).then(onResolve); + +db.createTableAsync('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + product_id: 'id' + } + } + } +}).then(onResolve); + +/// dropTableAsync(tableName, [options]) +db.dropTableAsync('pets').then(onResolve); +db.dropTableAsync('pets', { ifExists: true }).then(onResolve); + +/// renameTableAsync(tableName, newTableName) +db.renameTableAsync('pets', 'pets_OLD').then(onResolve); + +/// addColumnAsync(tableName, columnName, columnSpec) +db.addColumnAsync('pets', 'eyeColor', { + type: 'string', + length: 25, + notNull: true, +}).then(onResolve); + +db.addColumnAsync('pets', 'id', { + type: 'int', + primaryKey: true, + autoIncrement: true, + notNull: true, + unique: true +}).then(onResolve); + +/// renameColumnAsync(tableName, oldColumnName, newColumnName) +db.renameColumnAsync('pets', 'id', 'pet_id').then(onResolve); + +/// changeColumnAsync(tableName, columnName, columnSpec) +db.changeColumnAsync('pets', 'eye_color', { + type: 'int', + unsigned: true, + notNull: true, + foreignKey: { + name: 'pets_eye_color_id_fk', + table: 'eye_color', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + eye_color: 'id' + } + } +}).then(onResolve); + +/// addIndexAsync(tableName, indexName, columns, [unique]) +db.addIndexAsync('pets', 'pets_eye_color_idx', ['eye_color']).then(onResolve); +db.addIndexAsync('pets', 'pets_registration_code_idx', ['registration_code'], true).then(onResolve); + +/// addForeignKeyAsync(tableName, referencedTableName, keyName, fieldMapping, rules) +db.addForeignKeyAsync('module_user', 'modules', 'module_user_module_id_fk', +{ + 'module_id': 'id' +}, +{ + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' +}).then(onResolve); + +/// removeForeignKeyAsync(tableName, keyName, options) +db.removeForeignKeyAsync('module_user', 'module_uer_module_id_foreign').then(onResolve); +db.removeForeignKeyAsync('module_user', 'module_user_module_id_foreign', { + dropIndex: true, +}).then(onResolve); + +/// insertAsync(tableName, [columnNameArray,] valueArray) +db.insertAsync('module_user', ['first_name', 'last_name'], ['Test', 'Testerson']).then(onResolve); +db.insertAsync('module_user', ['Test', 'Testerson']).then(onResolve); + +/// removeIndexAsync([tableName,] indexName) +db.removeIndexAsync('pets', 'pets_eye_color_idx').then(onResolve); +db.removeIndexAsync('pets_eye_color_idx').then(onResolve); + +/// runSqlAsync(sql, [params]) +db.runSqlAsync('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [ + 'first_name', 'last_name', + 'Test', 'Testerson' +]).then(onResolve); +db.runSqlAsync('DROP TABLE `pets`').then(onResolve); + +/// allAsync(sql, [params]) +db.allAsync('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test']).then(onResolve); +db.allAsync('SELECT * FROM `module_user`').then(onResolve); + +/// ==================== +/// PG-specific tests +/// ==================== + +/// createColumnConstraint(spec, options, tableName, columnName) (INTERNAL USE ONLY) +let constraint: DbMigratePg.ColumnConstraint; + +constraint = db.createColumnConstraint({ + type: 'int', + length: 10, + unsigned: true, + primaryKey: false, + autoIncrement: false, + notNull: true, + unique: false, + defaultValue: 0, + foreignKey: { + name: 'pets_eye_color_id_fk', + table: 'eye_color', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + 'eye_color': 'id' + } + } +}, { + emitPrimaryKey: false +}, 'pets', 'eye_color'); + +// Print the SQL constraints +console.log(constraint.constraints); + +// Invoke the foreign key builder +constraint.foreignKey(callback); + +/// Public Callback Methods: + +/// createDatabase(dbName, [options,] callback) +db.createDatabase('petstore', callback); +db.createDatabase('petstore', {}, callback); + +/// dropDatabase(dbName, [options,] callback) +db.dropDatabase('petstore', callback); +db.dropDatabase('petstore', { ifExists: true }, callback); + +/// createSequence(sqName, [options,] callback) +db.createSequence('pets_id_sq', callback); +db.createSequence('pets_id_sq', { temp: true }, callback); + +/// switchDatabase(options, callback) +db.switchDatabase('petstore', callback); +db.switchDatabase({ database: 'petstore' }, callback); + +/// dropSequence(sqName, [options,] callback) +db.dropSequence('pets_id_sq', callback); +db.dropSequence('pets_id_sq', { + ifExists: true, + cascade: true, + restrict: true, +}, callback); + +/// Public Promisified Methods: + +/// createDatabaseAsync(dbName, [options]) +db.createDatabaseAsync('petstore').then(onResolve); +db.createDatabaseAsync('petstore', {}).then(onResolve); + +/// dropDatabaseAsync(dbName, [options]) +db.dropDatabaseAsync('petstore').then(onResolve); +db.dropDatabaseAsync('petstore', { ifExists: true }).then(onResolve); + +/// createSequenceAsync(sqName, [options]) +db.createSequenceAsync('pets_id_sq').then(onResolve); +db.createSequenceAsync('pets_id_sq', { temp: true }).then(onResolve); + +/// switchDatabaseAsync(options) +db.switchDatabaseAsync('petstore').then(onResolve); +db.switchDatabaseAsync({ database: 'petstore' }).then(onResolve); + +/// dropSequenceAsync(sqName, [options]) +db.dropSequenceAsync('pets_id_sq').then(onResolve); +db.dropSequenceAsync('pets_id_sq', { + ifExists: true, + cascade: true, + restrict: true, +}).then(onResolve); diff --git a/db-migrate-pg/db-migrate-pg.d.ts b/db-migrate-pg/db-migrate-pg.d.ts new file mode 100644 index 0000000000..056c0c71ce --- /dev/null +++ b/db-migrate-pg/db-migrate-pg.d.ts @@ -0,0 +1,59 @@ +// Type definitions for db-migrate-pg +// Project: https://github.com/db-migrate/pg +// Definitions by: nickiannone https://github.com/nickiannone +// Definitions: https://github.com/nickiannone/DefinitelyTyped + +/// +/// + +declare module "DbMigratePg" { + + import * as pg from "pg"; + import * as DbMigrate from "DbMigrate"; + + // 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: DbMigrate.CallbackFunction) => void; + constraints: string; + } + + export interface ColumnConstraintOptions { + emitPrimaryKey?: boolean; + } + + export class PgDriver extends DbMigrate.Base { + constructor(connection: pg.Client, schema: string, intern: DbMigrate.InternalOptions); + createDatabase(dbName: string, optionsOrCb: CreateDatabaseOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; + dropDatabase(dbName: string, optionsOrCb: DropDatabaseOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; + createSequence(sqName: string, optionsOrCb: CreateSequenceOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; + switchDatabase(options: string | SwitchDatabaseOptions, callback: DbMigrate.CallbackFunction): void; + dropSequence(dbName: string, optionsOrCb: DropSequenceOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; + createColumnConstraint(spec: DbMigrate.ColumnSpec, options: ColumnConstraintOptions, tableName: string, columnName: string): ColumnConstraint; + + createDatabaseAsync(dbName: string, options?: CreateDatabaseOptions): Promise; + dropDatabaseAsync(dbName: string, options?: DropDatabaseOptions): Promise; + createSequenceAsync(sqName: string, options?: CreateSequenceOptions): Promise; + switchDatabaseAsync(options: string | SwitchDatabaseOptions): Promise; + dropSequenceAsync(dbName: string, options?: DropSequenceOptions): Promise; + } +} \ No newline at end of file diff --git a/db-migrate/db-migrate-tests.ts b/db-migrate/db-migrate-tests.ts new file mode 100644 index 0000000000..9bdaafed5b --- /dev/null +++ b/db-migrate/db-migrate-tests.ts @@ -0,0 +1,322 @@ +// Test file for db.js Definition file +/// + +import * as DbMigrate from "DbMigrate"; + +// Throw together a dummy driver +let db = {}; + +let callback = (err: any, response: any) => { + // Do nothing. +}; + +/// createTable(tableName, columnSpec, callback) +db.createTable('pets', { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' +}, callback); + +db.createTable('pets', { + columns: { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' + }, + ifNotExists: true +}, callback); + +db.createTable('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: 'id' + } + } +}, callback); + +db.createTable('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + product_id: 'id' + } + } + } +}, callback); + +/// dropTable(tableName, [options,] callback) +db.dropTable('pets', callback); + +db.dropTable('pets', { ifExists: true }, callback); + +/// renameTable(tableName, newTableName, callback) +db.renameTable('pets', 'pets_OLD', callback); + +/// addColumn(tableName, columnName, columnSpec, callback) +db.addColumn('pets', 'eyeColor', { + type: 'string', + length: 25, + notNull: true, +}, callback); + +db.addColumn('pets', 'id', { + type: 'int', + primaryKey: true, + autoIncrement: true, + notNull: true, + unique: true +}, callback); + +/// renameColumn(tableName, oldColumnName, newColumnName, callback) +db.renameColumn('pets', 'id', 'pet_id', callback); + +/// changeColumn(tableName, columnName, columnSpec, callback) +db.changeColumn('pets', 'eye_color', { + type: 'int', + unsigned: true, + notNull: true, + foreignKey: { + name: 'pets_eye_color_id_fk', + table: 'eye_color', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + eye_color: 'id' + } + } +}, callback); + +/// addIndex(tableName, indexName, columns, [unique,] callback) +db.addIndex('pets', 'pets_eye_color_idx', ['eye_color'], callback); +db.addIndex('pets', 'pets_registration_code_idx', ['registration_code'], true, callback); + +/// addForeignKey(tableName, referencedTableName, keyName, fieldMapping, rules, callback) +db.addForeignKey('module_user', 'modules', 'module_user_module_id_fk', +{ + 'module_id': 'id' +}, +{ + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' +}, callback); + +/// removeForeignKey(tableName, keyName, options, callback) +db.removeForeignKey('module_user', 'module_uer_module_id_foreign', callback); +db.removeForeignKey('module_user', 'module_user_module_id_foreign', { + dropIndex: true, +}, callback); + +/// insert(tableName, [columnNameArray,] valueArray, callback) +db.insert('module_user', ['first_name', 'last_name'], ['Test', 'Testerson'], callback); +db.insert('module_user', ['Test', 'Testerson'], callback); + +/// removeIndex([tableName,] indexName, callback) +db.removeIndex('pets', 'pets_eye_color_idx', callback); +db.removeIndex('pets_eye_color_idx', callback); + +/// runSql(sql, [params,] callback) +db.runSql('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [ + 'first_name', 'last_name', + 'Test', 'Testerson' +], callback); +db.runSql('DROP TABLE `pets`', callback); + +/// all(sql, [params,] callback) +db.all('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test'], callback); +db.all('SELECT * FROM `module_user`', callback); + +/// ========= +/// Async +/// ========= + +let onResolve = (result: any) => {}; + +/// createTableAsync(tableName, columnSpec) +db.createTableAsync('pets', { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' +}).then(onResolve); + +db.createTableAsync('pets', { + columns: { + id: { type: 'int', primaryKey: true, autoIncrement: true }, + name: 'string' + }, + ifNotExists: true +}).then(onResolve); + +db.createTableAsync('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: 'id' + } + } +}).then(onResolve); + +db.createTableAsync('product_variant', +{ + id: { + type: 'int', + unsigned: true, + notNull: true, + primaryKey: true, + autoIncrement: true, + length: 10 + }, + product_id: { + type: 'int', + unsigned: true, + length: 10, + notNull: true, + foreignKey: { + name: 'product_variant_product_id_fk', + table: 'product', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + product_id: 'id' + } + } + } +}).then(onResolve); + +/// dropTableAsync(tableName, [options]) +db.dropTableAsync('pets').then(onResolve); +db.dropTableAsync('pets', { ifExists: true }).then(onResolve); + +/// renameTableAsync(tableName, newTableName) +db.renameTableAsync('pets', 'pets_OLD').then(onResolve); + +/// addColumnAsync(tableName, columnName, columnSpec) +db.addColumnAsync('pets', 'eyeColor', { + type: 'string', + length: 25, + notNull: true, +}).then(onResolve); + +db.addColumnAsync('pets', 'id', { + type: 'int', + primaryKey: true, + autoIncrement: true, + notNull: true, + unique: true +}).then(onResolve); + +/// renameColumnAsync(tableName, oldColumnName, newColumnName) +db.renameColumnAsync('pets', 'id', 'pet_id').then(onResolve); + +/// changeColumnAsync(tableName, columnName, columnSpec) +db.changeColumnAsync('pets', 'eye_color', { + type: 'int', + unsigned: true, + notNull: true, + foreignKey: { + name: 'pets_eye_color_id_fk', + table: 'eye_color', + rules: { + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' + }, + mapping: { + eye_color: 'id' + } + } +}).then(onResolve); + +/// addIndexAsync(tableName, indexName, columns, [unique]) +db.addIndexAsync('pets', 'pets_eye_color_idx', ['eye_color']).then(onResolve); +db.addIndexAsync('pets', 'pets_registration_code_idx', ['registration_code'], true).then(onResolve); + +/// addForeignKeyAsync(tableName, referencedTableName, keyName, fieldMapping, rules) +db.addForeignKeyAsync('module_user', 'modules', 'module_user_module_id_fk', +{ + 'module_id': 'id' +}, +{ + onDelete: 'CASCADE', + onUpdate: 'RESTRICT' +}).then(onResolve); + +/// removeForeignKeyAsync(tableName, keyName, options) +db.removeForeignKeyAsync('module_user', 'module_uer_module_id_foreign').then(onResolve); +db.removeForeignKeyAsync('module_user', 'module_user_module_id_foreign', { + dropIndex: true, +}).then(onResolve); + +/// insertAsync(tableName, [columnNameArray,] valueArray) +db.insertAsync('module_user', ['first_name', 'last_name'], ['Test', 'Testerson']).then(onResolve); +db.insertAsync('module_user', ['Test', 'Testerson']).then(onResolve); + +/// removeIndexAsync([tableName,] indexName) +db.removeIndexAsync('pets', 'pets_eye_color_idx').then(onResolve); +db.removeIndexAsync('pets_eye_color_idx').then(onResolve); + +/// runSqlAsync(sql, [params]) +db.runSqlAsync('INSERT INTO `module_user` (`?`,`?`) VALUES (\'?\',\'?\')', [ + 'first_name', 'last_name', + 'Test', 'Testerson' +]).then(onResolve); +db.runSqlAsync('DROP TABLE `pets`').then(onResolve); + +/// allAsync(sql, [params]) +db.allAsync('SELECT * FROM `module_user` WHERE `?` = \'?\'', ['first_name', 'Test']).then(onResolve); +db.allAsync('SELECT * FROM `module_user`').then(onResolve); \ No newline at end of file diff --git a/db-migrate/db-migrate.d.ts b/db-migrate/db-migrate.d.ts new file mode 100644 index 0000000000..465dfb1c68 --- /dev/null +++ b/db-migrate/db-migrate.d.ts @@ -0,0 +1,150 @@ +/// +/// + +// Type definitions for db-migrate/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 + +declare module "DbMigrate" { + + export interface CallbackFunction { (err: any, response: any): void; } + + export interface InternalModule { + log: any; + type: any; + } + + export interface InternalOptions { + mod: InternalModule; + } + + export interface ColumnSpec { + length?: number; + type: string; + unsigned?: boolean; + primaryKey?: boolean; + autoIncrement?: boolean; + notNull?: boolean; + unique?: boolean; + defaultValue?: any; + foreignKey?: ForeignKeySpec; + } + + export interface ForeignKeySpec { + name: string; + table: string; + rules?: ForeignKeyRules; + mapping: string | any; + } + + export interface ForeignKeyRules { + onDelete: string; + onUpdate: string; + } + + export interface RemoveForeignKeyOptions { + dropIndex?: boolean; + } + + export interface ColumnDef { + foreignKey?: any; // TODO Figure this out! + constraints: string; + } + + export interface CreateTableOptions { + columns?: Array; + ifNotExists?: boolean; + } + + export interface DropTableOptions { + ifExists?: boolean; + } + + export class Base { + constructor(intern: InternalOptions); + + close(callback?: CallbackFunction): void; + mapDataType(str: string): string; + truncate(tableName: string, callback: CallbackFunction): void; + checkDBMS(dbms: any, callback: CallbackFunction): void; + createDatabase(...options: any[]): void; + switchDatabase(...options: any[]): void; + dropDatabase(...options: any[]): void; + recurseCallbackArray(foreignKeys: Array, callback: CallbackFunction): void; + bindForeignKey(tableName: string, columnName: string, fkOptions: ForeignKeySpec): (callback: CallbackFunction) => void; + createColumnDef(name: string, spec: ColumnSpec, options?: any): ColumnDef; // TODO Figure out a type for `options`! + //createColumnConstraint(spec: ColumnSpec, options?: any, ...implementationDefinedOptions: any[]): string; + createMigrationsTable(callback: CallbackFunction): void; + createSeedsTable(callback: CallbackFunction): void; + createTable(tableName: string, options: any | CreateTableOptions, callback: CallbackFunction): void; + dropTable(tableName: string, optionsOrCb?: DropTableOptions | CallbackFunction, callback?: CallbackFunction): void; + renameTable(tableName: string, newTableName: string, callback: CallbackFunction): void; + addColumn(tableName: string, columnName: string, columnSpec: ColumnSpec, callback: CallbackFunction): void; + removeColumn(tableName: string, columnName: string, callback: CallbackFunction): void; + renameColumn(tableName: string, oldColumnName: string, newColumnName: string, callback: CallbackFunction): void; + changeColumn(tableName: string, columnName: string, columnSpec: ColumnSpec, callback: CallbackFunction): void; + quoteDDLArr(arr: Array): Array; + quoteArr(arr: Array): Array; + addIndex(tableName: string, indexName: string, columns: string | Array, uniqueOrCb?: boolean | CallbackFunction, callback?: CallbackFunction): void; + insert(tableName: string, columnNameOrValueArray: any, valueArrayOrCb?: any | CallbackFunction, callback?: CallbackFunction): void; + update(tableName: string, columnNameOrValueArray: any, valueArrayOrIds?: any, idsOrCb?: any | CallbackFunction, callback?: CallbackFunction): void; + lookup(tableName: string, column: string, id?: any, callback?: CallbackFunction): void; + removeIndex(tableNameOrIndexName: string, indexNameOrCb?: string | CallbackFunction, callback?: CallbackFunction): void; + addForeignKey(tableName: string, referencedTableName: string, keyName: string, fieldMapping: any, rules: ForeignKeyRules, callback: CallbackFunction): void; + removeForeignKey(tableName: string, keyName: string, optionsOrCb?: RemoveForeignKeyOptions | CallbackFunction, callback?: CallbackFunction): void; + normalizeColumnSpec(spec: string | ColumnSpec): ColumnSpec; + addMigrationRecord(name: string, callback: CallbackFunction): void; + addSeedRecord(name: string, callback: CallbackFunction): void; + startMigration(callback: CallbackFunction): void; + endMigration(callback: CallbackFunction): void; + runSql(sql?: string, paramsOrCb?: Array | CallbackFunction, callback?: CallbackFunction): void; + allLoadedMigrations(callback: CallbackFunction): void; + allLoadedSeeds(callback: CallbackFunction): void; + deleteMigration(migrationName: string, callback: CallbackFunction): void; + remove(table: string, ids: any, callback: CallbackFunction): void; // TODO Make ids match the type of ids in buildWhereClause(ids); + buildWhereClause(ids: any): string; + deleteSeed(seedName: string, callback: CallbackFunction): void; + all(sql: string, paramsOrCb?: Array | CallbackFunction, callback?: CallbackFunction): void; + escape(str: string): string; + escapeString(str: string): string; + escapeDDL(str: string): string; + + // Promisified methods + closeAsync(): Promise; + truncateAsync(tableName: string): Promise; + checkDBMSAsync(dbms: any): Promise; + createDatabaseAsync(...options: any[]): Promise; + switchDatabaseAsync(...options: any[]): Promise; + dropDatabaseAsync(...options: any[]): Promise; + recurseCallbackArrayAsync(foreignKeys: Array): Promise; + createMigrationsTableAsync(): Promise; + createSeedsTableAsync(): Promise; + createTableAsync(tableName: string, options: any | CreateTableOptions): Promise; + dropTableAsync(tableName: string, options?: DropTableOptions): Promise; + renameTableAsync(tableName: string, newTableName: string): Promise; + addColumnAsync(tableName: string, columnName: string, columnSpec: ColumnSpec): Promise; + removeColumnAsync(tableName: string, columnName: string): Promise; + renameColumnAsync(tableName: string, oldColumnName: string, newColumnName: string): Promise; + changeColumnAsync(tableName: string, columnName: string, columnSpec: ColumnSpec): Promise; + addIndexAsync(tableName: string, indexName: string, columns: string | Array, unique?: boolean): Promise; + insertAsync(tableName: string, columnNameOrValueArray: any, valueArrayOrCb?: any | CallbackFunction, callback?: CallbackFunction): Promise; + updateAsync(tableName: string, columnNameOrValueArray: any, valueArrayOrIds?: any, idsOrCb?: any | CallbackFunction, callback?: CallbackFunction): Promise; + lookupAsync(tableName: string, column: string, id?: any, callback?: CallbackFunction): Promise; + removeIndexAsync(tableNameOrIndexName: string, indexName?: string): Promise; + addForeignKeyAsync(tableName: string, referencedTableName: string, keyName: string, fieldMapping: any, rules: ForeignKeyRules): Promise; + removeForeignKeyAsync(tableName: string, keyName: string, options?: RemoveForeignKeyOptions): Promise; + addMigrationRecordAsync(name: string): Promise; + addSeedRecordAsync(name: string): Promise; + startMigrationAsync(): Promise; + endMigrationAsync(callback: CallbackFunction): Promise; + runSqlAsync(sql?: string, params?: Array): Promise; + allLoadedMigrationsAsync(): Promise; + allLoadedSeedsAsync(): Promise; + deleteMigrationAsync(migrationName: string): Promise; + removeAsync(table: string, ids: any): Promise; + deleteSeedAsync(seedName: string): Promise; + allAsync(sql: string, params?: Array): Promise; + } + +} \ No newline at end of file From 3b17086389f9ff0441376735df25f7ad0ee861ca Mon Sep 17 00:00:00 2001 From: Nicholas Iannone Date: Mon, 15 Aug 2016 11:39:47 -0500 Subject: [PATCH 093/203] Fix headers. --- db-migrate-pg/db-migrate-pg.d.ts | 2 +- db-migrate/db-migrate.d.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db-migrate-pg/db-migrate-pg.d.ts b/db-migrate-pg/db-migrate-pg.d.ts index 056c0c71ce..23e9025a21 100644 --- a/db-migrate-pg/db-migrate-pg.d.ts +++ b/db-migrate-pg/db-migrate-pg.d.ts @@ -1,6 +1,6 @@ // Type definitions for db-migrate-pg // Project: https://github.com/db-migrate/pg -// Definitions by: nickiannone https://github.com/nickiannone +// Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped /// diff --git a/db-migrate/db-migrate.d.ts b/db-migrate/db-migrate.d.ts index 465dfb1c68..88223ca4b0 100644 --- a/db-migrate/db-migrate.d.ts +++ b/db-migrate/db-migrate.d.ts @@ -1,11 +1,11 @@ -/// -/// - -// Type definitions for db-migrate/db-migrate-base +// Type definitions for db-migrate-base // Project: https://github.com/db-migrate/db-migrate-base -// Definitions by: nickiannone https://github.com/nickiannone +// Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped +/// +/// + declare module "DbMigrate" { export interface CallbackFunction { (err: any, response: any): void; } From 2c5dc32b68c0a022a3b7a1c46e8bd8878ca57da6 Mon Sep 17 00:00:00 2001 From: Nicholas Iannone Date: Mon, 15 Aug 2016 11:42:00 -0500 Subject: [PATCH 094/203] Tweaked name to match npm --- db-migrate/db-migrate.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db-migrate/db-migrate.d.ts b/db-migrate/db-migrate.d.ts index 88223ca4b0..66b4515f30 100644 --- a/db-migrate/db-migrate.d.ts +++ b/db-migrate/db-migrate.d.ts @@ -1,5 +1,5 @@ -// Type definitions for db-migrate-base -// Project: https://github.com/db-migrate/db-migrate-base +// Type definitions for db-migrate +// Project: https://github.com/db-migrate/db-migrate // Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped From 00dd9a1cf6c5b748d51e6d470ce6117bb383ea6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Pluci=C5=84ski?= Date: Mon, 15 Aug 2016 18:56:27 +0200 Subject: [PATCH 095/203] Changes for version 3.3.2 Changes for version 3.3.2 --- jstree/jstree.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/jstree/jstree.d.ts b/jstree/jstree.d.ts index dde9a24b67..2292da7f9c 100644 --- a/jstree/jstree.d.ts +++ b/jstree/jstree.d.ts @@ -1,8 +1,8 @@ -// Type definitions for jsTree v3.3.1 +// Type definitions for jsTree v3.3.2 // Project: http://www.jstree.com/ // Definitions by: Adam Pluciński // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// 1 commit 3b8f55d3797cd299eb36695b62d75c2313a3e3b3 2016-05-10 +// 1 commit bb0473ae8cfc205585b6404ef86f650df2f6996e 2016-08-15 /// @@ -465,6 +465,7 @@ interface JSTreeStaticDefaultsContextMenu { * * `separator_after` - a boolean indicating if there should be a separator after this item * * `_disabled` - a boolean indicating if this action should be disabled * * `label` - a string - the name of the action (could be a function returning a string) + * * `title` - a string - an optional tooltip for the item * * `action` - a function to be executed if this item is chosen, the function will receive * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) @@ -1339,6 +1340,8 @@ interface JSTree extends JQuery { * @param {Boolean} options.no_id do not return ID * @param {Boolean} options.no_children do not include children * @param {Boolean} options.no_data do not include node data + * @param {Boolean} options.no_li_attr do not include LI attributes + * @param {Boolean} options.no_a_attr do not include A attributes * @param {Boolean} options.flat return flat JSON instead of nested * @return {Object} */ @@ -1882,6 +1885,16 @@ interface JSTreeGetJsonOptions { */ no_data: boolean; + /** + * do not include LI attributes + */ + no_li_attr: boolean; + + /** + * do not include A attributes + */ + no_a_attr: boolean; + /** * return flat JSON instead of nested */ From 2675fa3a2e380e114181e5be481b32ed5269ec4c Mon Sep 17 00:00:00 2001 From: Nicholas Iannone Date: Mon, 15 Aug 2016 12:04:09 -0500 Subject: [PATCH 096/203] Fixed package name and project link --- .../db-migrate-base-tests.ts | 8 +++---- .../db-migrate-base.d.ts | 6 ++--- db-migrate-pg/db-migrate-pg.d.ts | 22 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) rename db-migrate/db-migrate-tests.ts => db-migrate-base/db-migrate-base-tests.ts (97%) rename db-migrate/db-migrate.d.ts => db-migrate-base/db-migrate-base.d.ts (98%) diff --git a/db-migrate/db-migrate-tests.ts b/db-migrate-base/db-migrate-base-tests.ts similarity index 97% rename from db-migrate/db-migrate-tests.ts rename to db-migrate-base/db-migrate-base-tests.ts index 9bdaafed5b..68c61e6f6c 100644 --- a/db-migrate/db-migrate-tests.ts +++ b/db-migrate-base/db-migrate-base-tests.ts @@ -1,10 +1,10 @@ -// Test file for db.js Definition file -/// +// Test file for db-migrate-base Definition file +/// -import * as DbMigrate from "DbMigrate"; +import * as DbMigrateBase from "DbMigrateBase"; // Throw together a dummy driver -let db = {}; +let db = {}; let callback = (err: any, response: any) => { // Do nothing. diff --git a/db-migrate/db-migrate.d.ts b/db-migrate-base/db-migrate-base.d.ts similarity index 98% rename from db-migrate/db-migrate.d.ts rename to db-migrate-base/db-migrate-base.d.ts index 66b4515f30..47dd8ce1c2 100644 --- a/db-migrate/db-migrate.d.ts +++ b/db-migrate-base/db-migrate-base.d.ts @@ -1,12 +1,12 @@ -// Type definitions for db-migrate -// Project: https://github.com/db-migrate/db-migrate +// Type definitions for db-migrate-base +// Project: https://github.com/db-migrate/db-migrate-base // Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped /// /// -declare module "DbMigrate" { +declare module "DbMigrateBase" { export interface CallbackFunction { (err: any, response: any): void; } diff --git a/db-migrate-pg/db-migrate-pg.d.ts b/db-migrate-pg/db-migrate-pg.d.ts index 23e9025a21..4d2823ec52 100644 --- a/db-migrate-pg/db-migrate-pg.d.ts +++ b/db-migrate-pg/db-migrate-pg.d.ts @@ -3,13 +3,13 @@ // Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped -/// +/// /// declare module "DbMigratePg" { import * as pg from "pg"; - import * as DbMigrate from "DbMigrate"; + import * as DbMigrateBase from "DbMigrateBase"; // Yes, this is a dummy interface for now; the current implementation of the pg driver doesn't need any options. export interface CreateDatabaseOptions {} @@ -33,7 +33,7 @@ declare module "DbMigratePg" { } export interface ColumnConstraint { - foreignKey: (callback: DbMigrate.CallbackFunction) => void; + foreignKey: (callback: DbMigrateBase.CallbackFunction) => void; constraints: string; } @@ -41,14 +41,14 @@ declare module "DbMigratePg" { emitPrimaryKey?: boolean; } - export class PgDriver extends DbMigrate.Base { - constructor(connection: pg.Client, schema: string, intern: DbMigrate.InternalOptions); - createDatabase(dbName: string, optionsOrCb: CreateDatabaseOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; - dropDatabase(dbName: string, optionsOrCb: DropDatabaseOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; - createSequence(sqName: string, optionsOrCb: CreateSequenceOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; - switchDatabase(options: string | SwitchDatabaseOptions, callback: DbMigrate.CallbackFunction): void; - dropSequence(dbName: string, optionsOrCb: DropSequenceOptions | DbMigrate.CallbackFunction, callback?: DbMigrate.CallbackFunction): void; - createColumnConstraint(spec: DbMigrate.ColumnSpec, options: ColumnConstraintOptions, tableName: string, columnName: string): ColumnConstraint; + export class PgDriver extends DbMigrateBase.Base { + constructor(connection: pg.Client, schema: string, intern: DbMigrateBase.InternalOptions); + createDatabase(dbName: string, optionsOrCb: CreateDatabaseOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void; + dropDatabase(dbName: string, optionsOrCb: DropDatabaseOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void; + createSequence(sqName: string, optionsOrCb: CreateSequenceOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void; + switchDatabase(options: string | SwitchDatabaseOptions, callback: DbMigrateBase.CallbackFunction): void; + dropSequence(dbName: string, optionsOrCb: DropSequenceOptions | DbMigrateBase.CallbackFunction, callback?: DbMigrateBase.CallbackFunction): void; + createColumnConstraint(spec: DbMigrateBase.ColumnSpec, options: ColumnConstraintOptions, tableName: string, columnName: string): ColumnConstraint; createDatabaseAsync(dbName: string, options?: CreateDatabaseOptions): Promise; dropDatabaseAsync(dbName: string, options?: DropDatabaseOptions): Promise; From 8c149d1b3785a3352e53b5030d7b30b71fe51531 Mon Sep 17 00:00:00 2001 From: Andrew Connell Date: Mon, 15 Aug 2016 14:17:41 -0400 Subject: [PATCH 097/203] updated per request https://github.com/DefinitelyTyped/DefinitelyTyped/pull/10608#discussion_r74803313 --- wallabyjs/wallabyjs.d.ts | 296 +++++++++++++++++++-------------------- 1 file changed, 146 insertions(+), 150 deletions(-) diff --git a/wallabyjs/wallabyjs.d.ts b/wallabyjs/wallabyjs.d.ts index a10162ffa9..4f90762c2b 100644 --- a/wallabyjs/wallabyjs.d.ts +++ b/wallabyjs/wallabyjs.d.ts @@ -4,164 +4,160 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'wallabyjs' { - namespace wallabyjs { - /** - * Wallaby configuration settings. - * - * @interface - * - * @property {IWallabyCompiler=} compilers - File patterns as keys and compiler functions as values. - * @property {boolean=} debug - Flag if debug messages written to Wallaby console (default=false). - * @prooperty {IWallabyEnvironment=} env - Specify a different test runner or change the runner settings. - * @property {string[] | IWallabyFilePattern[]} files - Specifies an array of source files or file name patterns to copy - * to the local cache. - * @property {Function=} postprocessor - Function that runs for every batch of file changes after all compilers and preprocessors. - * @property {Function=} preprocessor - Function that runs for every batch of file changes after all compilers. - * @property {string=} testFramework - Specifies the name and version of the testing framework you are using for your tests. - * @property {string[] | IWallabyFilePattern[]} tests - Specifies an array of test files or test file name patterns to copy - * to the local cache. - * @property {IWallabyWorkers=} workers - Degree of parallelism used to run your tests and controls the way wallaby re-uses workers. - * - * @see {@link https://wallabyjs.com/docs/config/overview.html} for details. - */ - interface IWallabyConfig { - comilers?: IWallabyCompiler; - debug?: boolean; - env?: IWallabyEnvironment; - files: string[] | IWallabyFilePattern[]; - postprocessor?: IWallabyProcessor; - preprocessor?: IWallabyProcessor; - testFramework?: string; - tests: string[] | IWallabyFilePattern[]; - workers?: IWallabyWorkers; - } + /** + * Wallaby configuration settings. + * + * @interface + * + * @property {IWallabyCompiler=} compilers - File patterns as keys and compiler functions as values. + * @property {boolean=} debug - Flag if debug messages written to Wallaby console (default=false). + * @prooperty {IWallabyEnvironment=} env - Specify a different test runner or change the runner settings. + * @property {string[] | IWallabyFilePattern[]} files - Specifies an array of source files or file name patterns to copy + * to the local cache. + * @property {Function=} postprocessor - Function that runs for every batch of file changes after all compilers and preprocessors. + * @property {Function=} preprocessor - Function that runs for every batch of file changes after all compilers. + * @property {string=} testFramework - Specifies the name and version of the testing framework you are using for your tests. + * @property {string[] | IWallabyFilePattern[]} tests - Specifies an array of test files or test file name patterns to copy + * to the local cache. + * @property {IWallabyWorkers=} workers - Degree of parallelism used to run your tests and controls the way wallaby re-uses workers. + * + * @see {@link https://wallabyjs.com/docs/config/overview.html} for details. + */ + export interface IWallabyConfig { + comilers?: IWallabyCompiler; + debug?: boolean; + env?: IWallabyEnvironment; + files: string[] | IWallabyFilePattern[]; + postprocessor?: IWallabyProcessor; + preprocessor?: IWallabyProcessor; + testFramework?: string; + tests: string[] | IWallabyFilePattern[]; + workers?: IWallabyWorkers; + } - /** - * Wallaby compiler configuration. - * - * @interface IWallabyCompiler - * - * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. - */ - interface IWallabyCompiler { - [pattern: string]: any - } + /** + * Wallaby compiler configuration. + * + * @interface IWallabyCompiler + * + * @see {@link https://wallabyjs.com/docs/config/compilers.html} for details. + */ + export interface IWallabyCompiler { + [pattern: string]: any + } - /** - * Wallaby processor used in pre & post processors. - * - * @interface IWallabyProcessor - * - * @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details. - */ - interface IWallabyProcessor { - [pattern: string]: (file: IWallabyFile) => void; - } + /** + * Wallaby processor used in pre & post processors. + * + * @interface IWallabyProcessor + * + * @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details. + */ + export interface IWallabyProcessor { + [pattern: string]: (file: IWallabyFile) => void; + } - /** - * Wallaby file object passed to pre & post processors. - * - * @interface IWallabyFile - * - * @property {string=} content - The current content of the file. - * @property {string=} path - The current path to the file. - * @function rename - Allows you to rename/move the file to newPath. - * @function changeExt - Shortcut for the rename function allowing you to change the file extension. - * - * @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details. - */ - interface IWallabyFile { - content?: string; - path?: string; - rename(newPath: string): void; - changeExt(newExt: string): void; - } + /** + * Wallaby file object passed to pre & post processors. + * + * @interface IWallabyFile + * + * @property {string=} content - The current content of the file. + * @property {string=} path - The current path to the file. + * @function rename - Allows you to rename/move the file to newPath. + * @function changeExt - Shortcut for the rename function allowing you to change the file extension. + * + * @see {@link https://wallabyjs.com/docs/config/preprocessors.html} for details. + */ + export interface IWallabyFile { + content?: string; + path?: string; + rename(newPath: string): void; + changeExt(newExt: string): void; + } - /** - * Wallaby file pattern. - * - * @interface IWallabyFilePattern - * - * @property {string} pattern - File name or file pattern. - * @property {boolean=} ignore - Used to completely exclude the file from Wallaby (default=false). - * @property {boolean=} instrument - Determines if file is instrumented (default=true). - * @property {boolean=} load - Determines if the file is loaded to sandbox HTML via script tag .(default=true). - * - * @see {@link https://wallabyjs.com/docs/config/files.html} for details. - */ - interface IWallabyFilePattern { - pattern: string; - ignore?: boolean; - instrument?: boolean; - load?: boolean; - } + /** + * Wallaby file pattern. + * + * @interface IWallabyFilePattern + * + * @property {string} pattern - File name or file pattern. + * @property {boolean=} ignore - Used to completely exclude the file from Wallaby (default=false). + * @property {boolean=} instrument - Determines if file is instrumented (default=true). + * @property {boolean=} load - Determines if the file is loaded to sandbox HTML via script tag .(default=true). + * + * @see {@link https://wallabyjs.com/docs/config/files.html} for details. + */ + export interface IWallabyFilePattern { + pattern: string; + ignore?: boolean; + instrument?: boolean; + load?: boolean; + } - /** - * Wallaby environment configuration. - * - * @interface IWallabyEnvironment - * - * @property {IWallabyEnvironmentParameters=} params - set parameters on environment. - * @property {string=} runner - Path of local Node / PhantomJs / Electron. - * @property {string=} type - Specify a different test runner or change the runner settings. - * - * @see {@link https://wallabyjs.com/docs/config/runner.html} for details. - */ - interface IWallabyEnvironment { - params?: IWallabyEnvironmentParameters; - runner?: string; - type?: string; - } + /** + * Wallaby environment configuration. + * + * @interface IWallabyEnvironment + * + * @property {IWallabyEnvironmentParameters=} params - set parameters on environment. + * @property {string=} runner - Path of local Node / PhantomJs / Electron. + * @property {string=} type - Specify a different test runner or change the runner settings. + * + * @see {@link https://wallabyjs.com/docs/config/runner.html} for details. + */ + export interface IWallabyEnvironment { + params?: IWallabyEnvironmentParameters; + runner?: string; + type?: string; + } - /** - * Wallaby environment parameters. - * - * @interface IWallabyEnvironmentParameters - * - * @property {string=} env - Semicolon-separated spawed runner process env variables. - * @property {string=} runner - Space-separated spawed runner process flags. - * - * @see {@link https://wallabyjs.com/docs/config/runner.html} for details. - */ - interface IWallabyEnvironmentParameters { - env?: string; - runner?: string; - } + /** + * Wallaby environment parameters. + * + * @interface IWallabyEnvironmentParameters + * + * @property {string=} env - Semicolon-separated spawed runner process env variables. + * @property {string=} runner - Space-separated spawed runner process flags. + * + * @see {@link https://wallabyjs.com/docs/config/runner.html} for details. + */ + export interface IWallabyEnvironmentParameters { + env?: string; + runner?: string; + } - /** - * Wallaby worker configuration. - * - * @interface IWallabyWorkers - * - * @property {boolean=} recycle - Specifies the degree of parallelism used to run your tests and - * controls the way wallaby re-uses workers. - * - * @see {@link https://wallabyjs.com/docs/config/workers.html} for details. - */ - interface IWallabyWorkers { - recycle?: boolean; - } + /** + * Wallaby worker configuration. + * + * @interface IWallabyWorkers + * + * @property {boolean=} recycle - Specifies the degree of parallelism used to run your tests and + * controls the way wallaby re-uses workers. + * + * @see {@link https://wallabyjs.com/docs/config/workers.html} for details. + */ + export interface IWallabyWorkers { + recycle?: boolean; + } - /** - * Wallaby object passed into config. - * - * @interface IWallaby - * - * @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 {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. - */ - interface IWallaby { - localProjectDir?: string; - projectCacheDir?: string; - compilers?: IWallabyCompiler; - defaults?: any; - } - + /** + * Wallaby object passed into config. + * + * @interface IWallaby + * + * @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 {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. + */ + export interface IWallaby { + localProjectDir?: string; + projectCacheDir?: string; + compilers?: IWallabyCompiler; + defaults?: any; } - export = wallabyjs; } From 3b613b085dfe0f388310bedbc15726eeaea23ebd Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 13:25:00 -0500 Subject: [PATCH 098/203] Added electron-notify --- electron-notify/electron-notify-tests.ts | 0 electron-notify/electron-notify.d.ts | 27 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 electron-notify/electron-notify-tests.ts create mode 100644 electron-notify/electron-notify.d.ts diff --git a/electron-notify/electron-notify-tests.ts b/electron-notify/electron-notify-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts new file mode 100644 index 0000000000..3678c00e3d --- /dev/null +++ b/electron-notify/electron-notify.d.ts @@ -0,0 +1,27 @@ +// Type definitions for electron-notify v0.1.0 +// Project: https://github.com/hankbao/electron-notify +// Definitions by: Daniel Pereira +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace ElectronNotify { +} + +/** Nice and simple notifications for electron apps */ +declare module 'electron-notifications' { + + /** Change some config options. Can be run multiple times, also between notify()-calls to change electron-notifys behaviour. */ + export function setConfig(configObj); + + /** Displays new notification. */ + export function notify(notificationObj); + + /** Clears the animation queue and closes all windows opened by electron-notify. Call this to clean up before quiting your app. */ + export function closeAll(); + + export function setTemplatePath(path); + + /** Returns the maximum amount of notifications that fit onto the users screen. */ + export function calcMaxVisibleNotification(): number; +} \ No newline at end of file From ee11f74293c468c3fae85eaf10a0024ac668be2a Mon Sep 17 00:00:00 2001 From: microshine Date: Mon, 15 Aug 2016 21:37:24 +0300 Subject: [PATCH 099/203] Fix errors with import and enums --- graphene-pk11/graphene-pk11-tests.ts | 2 +- graphene-pk11/graphene-pk11.d.ts | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/graphene-pk11/graphene-pk11-tests.ts b/graphene-pk11/graphene-pk11-tests.ts index 1f88f7772b..137e05385f 100644 --- a/graphene-pk11/graphene-pk11-tests.ts +++ b/graphene-pk11/graphene-pk11-tests.ts @@ -1,6 +1,6 @@ /// -let graphene = require("graphene-pk11"); +import * as graphene from "graphene-pk11"; let Module = graphene.Module; let lib = "/usr/local/lib/softhsm/libsofthsm2.so"; diff --git a/graphene-pk11/graphene-pk11.d.ts b/graphene-pk11/graphene-pk11.d.ts index e0143334ff..0405b4c6df 100644 --- a/graphene-pk11/graphene-pk11.d.ts +++ b/graphene-pk11/graphene-pk11.d.ts @@ -155,7 +155,7 @@ declare module "graphene-pk11" { AesGCM, RsaOAEP, RsaPSS, - EcDH + EcDH, } // AES @@ -242,7 +242,7 @@ declare module "graphene-pk11" { SHA224, SHA256, SHA384, - SHA512 + SHA512, } class EcdhParams implements IParams, pkcs11.ECDH1 { @@ -277,7 +277,7 @@ declare module "graphene-pk11" { MGF1_SHA224, MGF1_SHA256, MGF1_SHA384, - MGF1_SHA512 + MGF1_SHA512, } class RsaOaepParams implements IParams { @@ -326,7 +326,7 @@ declare module "graphene-pk11" { HW_FEATURE, DOMAIN_PARAMETERS, MECHANISM, - OTP_KEY + OTP_KEY, } class SessionObject extends HandleObject { @@ -485,7 +485,7 @@ declare module "graphene-pk11" { HOTP, ACTI, CAMELLIA, - ARIA + ARIA, } enum KeyGenMechanism { AES, @@ -867,14 +867,14 @@ declare module "graphene-pk11" { enum CertificateType { X_509, X_509_ATTR_CERT, - WTLS + WTLS, } enum CertificateCategory { Unspecified, TokenUser, Authority, - OtherEntity + OtherEntity, } /** @@ -993,7 +993,7 @@ declare module "graphene-pk11" { Unspecified, Manufacturer, Operator, - ThirdParty + ThirdParty, } /** @@ -1434,7 +1434,7 @@ declare module "graphene-pk11" { DSA_PARAMETER_GEN, DH_PKCS_PARAMETER_GEN, X9_42_DH_PARAMETER_GEN, - VENDOR_DEFINED + VENDOR_DEFINED, } enum SessionFlag { @@ -1445,7 +1445,7 @@ declare module "graphene-pk11" { /** * This flag is provided for backward compatibility, and should always be set to `true` */ - SERIAL_SESSION + SERIAL_SESSION, } enum UserType { @@ -1460,7 +1460,7 @@ declare module "graphene-pk11" { /** * Context specific */ - CONTEXT_SPECIFIC + CONTEXT_SPECIFIC, } interface IKeyPair { @@ -2130,7 +2130,7 @@ declare module "graphene-pk11" { SO_PIN_COUNT_LOW, SO_PIN_FINAL_TRY, SO_PIN_LOCKED, - SO_PIN_TO_BE_CHANGED + SO_PIN_TO_BE_CHANGED, } class Token extends HandleObject { From b5a1740fceca2ab9a9338734150f4dd9f6dc39fc Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Mon, 15 Aug 2016 15:04:16 -0400 Subject: [PATCH 100/203] auth0: add refreshToken method --- auth0/auth0.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts index 0608674ae7..5ca8487f85 100644 --- a/auth0/auth0.d.ts +++ b/auth0/auth0.d.ts @@ -21,6 +21,7 @@ interface Auth0Static { 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; From 8e26534f43e9c306b7d17358307d0f4356efb424 Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Mon, 15 Aug 2016 20:58:32 +0100 Subject: [PATCH 101/203] Updated typings and tests for Navigation 2.0.1 --- navigation/navigation-tests.ts | 3 +-- navigation/navigation.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/navigation/navigation-tests.ts b/navigation/navigation-tests.ts index 7d78cbe5ba..c1b6e45ff9 100644 --- a/navigation/navigation-tests.ts +++ b/navigation/navigation-tests.ts @@ -43,8 +43,7 @@ namespace NavigationTests { } // Navigation Event - var navigationListener = - (oldState: Navigation.State, state: Navigation.State, data: any) => { + var navigationListener = (oldState: Navigation.State, state: Navigation.State, data: any, asyncData: any) => { stateNavigator.offNavigate(navigationListener); }; stateNavigator.onNavigate(navigationListener); diff --git a/navigation/navigation.d.ts b/navigation/navigation.d.ts index 79dc718c90..ad3c1c8e23 100644 --- a/navigation/navigation.d.ts +++ b/navigation/navigation.d.ts @@ -113,7 +113,7 @@ declare namespace Navigation { * @param data The current NavigationData * @param asyncData The data passed asynchronously while navigating */ - navigated: (data: any, asyncData?: any) => void; + navigated: (data: any, asyncData: any) => void; /** * Called on the new State before navigating to it * @param data The new NavigationData @@ -454,12 +454,12 @@ declare namespace Navigation { * Registers a navigate event listener * @param handler The navigate event listener */ - onNavigate(handler: (oldState: State, state: State, data: any) => void): void; + onNavigate(handler: (oldState: State, state: State, data: any, asyncData: any) => void): void; /** * Unregisters a navigate event listener * @param handler The navigate event listener */ - offNavigate(handler: (oldState: State, state: State, data: any) => void): void; + offNavigate(handler: (oldState: State, state: State, data: any, asyncData: any) => void): void; /** * Navigates to a State * @param stateKey The key of a State From 4f1b5f462bee8dedcf530e89f605db080f05fca7 Mon Sep 17 00:00:00 2001 From: Giacomo Rebonato Date: Mon, 15 Aug 2016 21:12:56 +0100 Subject: [PATCH 102/203] changed object to any --- react-flex/react-flex.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-flex/react-flex.d.ts b/react-flex/react-flex.d.ts index 17a7a6e9e7..2bfb73c7cd 100644 --- a/react-flex/react-flex.d.ts +++ b/react-flex/react-flex.d.ts @@ -12,7 +12,7 @@ declare namespace __ReactFlex { /** * For custom style */ - style?: Object; + style?: any; /** * For `display: inline-flex`. From 07084d3ae632574dae4785a5caaaccde674527c9 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 15:14:45 -0500 Subject: [PATCH 103/203] Wrong module name --- electron-notify/electron-notify.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index 3678c00e3d..f6f4d47b07 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -9,7 +9,7 @@ declare namespace ElectronNotify { } /** Nice and simple notifications for electron apps */ -declare module 'electron-notifications' { +declare module 'electron-notify' { /** Change some config options. Can be run multiple times, also between notify()-calls to change electron-notifys behaviour. */ export function setConfig(configObj); From 9a2f1d6233262547efe578e86d3ede7c9315d72b Mon Sep 17 00:00:00 2001 From: Erik Rothoff Andersson Date: Mon, 15 Aug 2016 22:24:58 +0200 Subject: [PATCH 104/203] Path can be buffer --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 17462097b3..6542192c90 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1418,7 +1418,7 @@ declare module "fs" { export interface WriteStream extends stream.Writable { close(): void; bytesWritten: number; - path: string; + path: string | Buffer; } /** From 757592fbe0f8eae4cd96f0bade957d5cce611fcc Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 15 Aug 2016 16:33:24 -0400 Subject: [PATCH 105/203] Adding in crosshair for the axis options and removing duplicated entries --- highcharts/highcharts.d.ts | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 5d5d4ec4d3..8b0e34eacc 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -468,6 +468,10 @@ interface HighchartsAxisOptions { * @since 4.0 */ ceiling?: number; + /** + * Configure a crosshair that follows either the mouse pointer or the hovered point. + */ + crosshair?: HighchartsCrosshairObject; /** * 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. @@ -4830,17 +4834,6 @@ 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; - /** - * 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. - */ - cursor?: string; - /** - * The main color or the series. In line type series it applies to the line and the point markers unless otherwise - * 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; /** * You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user @@ -4901,11 +4894,6 @@ interface HighchartsIndividualSeriesOptions { * A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from * the pointPadding and groupPadding. */ - pointWidth?: number; - /** - * A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from - * the pointPadding and groupPadding. - */ pointWidth?: number; /** * This option allows grouping series in a stacked chart. The stack option can be a string or a number or anything From bd25423b260c565d60a65e16300bbaf40ac231c4 Mon Sep 17 00:00:00 2001 From: David Newell Date: Mon, 15 Aug 2016 16:36:17 -0400 Subject: [PATCH 106/203] Fixing spacing --- highcharts/highcharts.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 8b0e34eacc..de1e5343ca 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -4829,11 +4829,11 @@ interface HighchartsPlotOptions { */ interface HighchartsIndividualSeriesOptions { type?: string; - /** - * The main color or the series. In line type series it applies to the line and the point markers unless otherwise - * 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. - */ + /** + * The main color or the series. In line type series it applies to the line and the point markers unless otherwise + * 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; /** * You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user @@ -4890,10 +4890,10 @@ interface HighchartsIndividualSeriesOptions { * The name of the series as shown in the legend, tooltip etc. */ name?: string; - /** - * A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from - * the pointPadding and groupPadding. - */ + /** + * A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from + * the pointPadding and groupPadding. + */ pointWidth?: number; /** * This option allows grouping series in a stacked chart. The stack option can be a string or a number or anything From 3db7dcac3d1c8f4821b3a38331f8eecaae1c8041 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Mon, 15 Aug 2016 15:41:37 -0500 Subject: [PATCH 107/203] Add some basic node-forge definitions with tests. --- node-forge/node-forge-tests.ts | 7 ++++++ node-forge/node-forge.d.ts | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 node-forge/node-forge-tests.ts create mode 100644 node-forge/node-forge.d.ts diff --git a/node-forge/node-forge-tests.ts b/node-forge/node-forge-tests.ts new file mode 100644 index 0000000000..3882c8bd94 --- /dev/null +++ b/node-forge/node-forge-tests.ts @@ -0,0 +1,7 @@ +/// + +import * as forge from "node-forge"; + +let keypair = forge.pki.rsa.generateKeyPair({bits: 512}); +let privateKeyPem = forge.pki.privateKeyToPem(keypair.privateKey); +let publicKeyPem = forge.pki.publicKeyToPem(keypair.publicKey); diff --git a/node-forge/node-forge.d.ts b/node-forge/node-forge.d.ts new file mode 100644 index 0000000000..8313cdd031 --- /dev/null +++ b/node-forge/node-forge.d.ts @@ -0,0 +1,40 @@ +// Type definitions for node-forge 0.6.42 +// Project: https://github.com/digitalbazaar/forge +// Definitions by: Seth Westphal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "node-forge" { + + export namespace pki { + + export type PEM = string; + export type Key = any; + + export interface KeyPair { + publicKey: Key; + privateKey: Key; + } + + export function privateKeyToPem(key: Key, maxline?: number): PEM; + export function publicKeyToPem(key: Key, maxline?: number): PEM; + + export namespace rsa { + + export interface GenerateKeyPairOptions { + bits?: number; + e?: number; + workerScript?: string; + workers?: number; + workLoad?: number; + prng?: any; + algorithm?: string; + } + + export function generateKeyPair(bits?: number, e?: number, callback?: (err: Error, keypair: KeyPair) => void): KeyPair; + export function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair; + + } + + } + +} From dd7de3e50c342bdf77de61d725083d3d20ab8d9e Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 15:57:19 -0500 Subject: [PATCH 108/203] Added INotification and IConfiguration to electron notify --- electron-notify/electron-notify-tests.ts | 23 +++++++++++++ electron-notify/electron-notify.d.ts | 42 +++++++++++++++++++++--- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/electron-notify/electron-notify-tests.ts b/electron-notify/electron-notify-tests.ts index e69de29bb2..9194a11f1b 100644 --- a/electron-notify/electron-notify-tests.ts +++ b/electron-notify/electron-notify-tests.ts @@ -0,0 +1,23 @@ +/// + +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: function () { console.log('onClick') }, + onShowFunc: function () { console.log('onShow') }, + onCloseFunc: function () { console.log('onClose') } +}); \ No newline at end of file diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index f6f4d47b07..d5ac7f1966 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -6,22 +6,54 @@ /// declare namespace ElectronNotify { + + interface INotification { + title: string, + text?: string, + image?: string, + url?: string, + sound?: string, + onClickFunc?: (event: string, id: number, closeNotification) => void, + onShowFunc?: (event: string, id: number, closeNotification) => void, + onCloseFunc?: (event: string, id: number) => void + } + + interface IConfiguration { + 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 + } + } /** Nice and simple notifications for electron apps */ declare module 'electron-notify' { /** Change some config options. Can be run multiple times, also between notify()-calls to change electron-notifys behaviour. */ - export function setConfig(configObj); + export function setConfig(customConfig: ElectronNotify.IConfiguration); /** Displays new notification. */ - export function notify(notificationObj); + export function notify(notification: ElectronNotify.INotification); /** Clears the animation queue and closes all windows opened by electron-notify. Call this to clean up before quiting your app. */ export function closeAll(); - export function setTemplatePath(path); + export function getTemplatePath(): string; + + export function setTemplatePath(path: string); - /** Returns the maximum amount of notifications that fit onto the users screen. */ - export function calcMaxVisibleNotification(): number; } \ No newline at end of file From 8f082a028691948ef922e39ebc03b06e63f23518 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 15:59:05 -0500 Subject: [PATCH 109/203] Return voids --- electron-notify/electron-notify.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index d5ac7f1966..2984bd4876 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -44,16 +44,16 @@ declare namespace ElectronNotify { declare module 'electron-notify' { /** Change some config options. Can be run multiple times, also between notify()-calls to change electron-notifys behaviour. */ - export function setConfig(customConfig: ElectronNotify.IConfiguration); + export function setConfig(customConfig: ElectronNotify.IConfiguration): void; /** Displays new notification. */ - export function notify(notification: ElectronNotify.INotification); + export function notify(notification: ElectronNotify.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(); + export function closeAll(): void; export function getTemplatePath(): string; - export function setTemplatePath(path: string); + export function setTemplatePath(path: string): void; } \ No newline at end of file From 306ceee471b09371f44e7daeaffb94ae92ec8b07 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 15:59:55 -0500 Subject: [PATCH 110/203] Fix syntax issues --- electron-notify/electron-notify.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index 2984bd4876..198f8cafb6 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -13,8 +13,8 @@ declare namespace ElectronNotify { image?: string, url?: string, sound?: string, - onClickFunc?: (event: string, id: number, closeNotification) => void, - onShowFunc?: (event: string, id: number, closeNotification) => void, + onClickFunc?: (event: string, id: number, closeNotification: any) => void, + onShowFunc?: (event: string, id: number, closeNotification: any) => void, onCloseFunc?: (event: string, id: number) => void } From a0d70238a7d366bbefcdbabd2c59ccbd63c32713 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Mon, 15 Aug 2016 16:45:28 -0500 Subject: [PATCH 111/203] Update events --- electron-notify/electron-notify-tests.ts | 9 ++++++--- electron-notify/electron-notify.d.ts | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/electron-notify/electron-notify-tests.ts b/electron-notify/electron-notify-tests.ts index 9194a11f1b..95e2edf998 100644 --- a/electron-notify/electron-notify-tests.ts +++ b/electron-notify/electron-notify-tests.ts @@ -17,7 +17,10 @@ eNotify.notify({ image: 'path/to/image.png', url: 'http://google.de', sound: 'notification.wav', - onClickFunc: function () { console.log('onClick') }, - onShowFunc: function () { console.log('onShow') }, - onCloseFunc: function () { console.log('onClose') } + onClickFunc: (event) => { + console.log('onClick ' + event.id); + event.closeNotification('onClick'); + }, + onShowFunc: (event) => { console.log('onShow ' + event.id) }, + onCloseFunc: (event) => { console.log('onClose ' + event.id) } }); \ No newline at end of file diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index 198f8cafb6..3ad6906205 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -7,15 +7,24 @@ declare namespace ElectronNotify { + interface ICloseNotificationEvent { + event: 'close' | 'show' | 'click', + id: number + } + + interface INotificationEvent extends ICloseNotificationEvent { + closeNotification: (reason: any) => void, + } + interface INotification { title: string, text?: string, image?: string, url?: string, sound?: string, - onClickFunc?: (event: string, id: number, closeNotification: any) => void, - onShowFunc?: (event: string, id: number, closeNotification: any) => void, - onCloseFunc?: (event: string, id: number) => void + onClickFunc?: (event: INotificationEvent) => void, + onShowFunc?: (event: INotificationEvent) => void, + onCloseFunc?: (event: ICloseNotificationEvent) => void } interface IConfiguration { From 7343a3b43c2771d5cae4698bc0f5dc310e16954d Mon Sep 17 00:00:00 2001 From: Jason Killian Date: Mon, 15 Aug 2016 17:53:50 -0400 Subject: [PATCH 112/203] Add module typings for chroma-js Also added a few tests for this usage --- chroma-js/chroma-js-tests.ts | 24 +++++++++++++++++++++++- chroma-js/chroma-js.d.ts | 4 ++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/chroma-js/chroma-js-tests.ts b/chroma-js/chroma-js-tests.ts index ccc9d5a1a7..a994af975f 100644 --- a/chroma-js/chroma-js-tests.ts +++ b/chroma-js/chroma-js-tests.ts @@ -1,5 +1,7 @@ /// +import * as myChroma from "chroma-js"; + function test_chroma() { chroma('hotpink'); chroma('#ff3399'); @@ -41,6 +43,9 @@ function test_chroma() { chroma.limits(data, 'e', 5); chroma.limits(data, 'q', 5); chroma.limits(data, 'k', 5); + + myChroma(0xff3399); + myChroma.limits(data, 'k', 5); } function test_color() { @@ -99,6 +104,10 @@ function test_color() { chroma('#cbdbff').temperature(); chroma('#b3ccff').temperature(); chroma('33cc00').gl(); + + myChroma('teal').alpha(0.5).css(); + myChroma('teal').css('hsl'); + myChroma('orange').rgb(); } function test_scale() { @@ -163,4 +172,17 @@ function test_scale() { chroma.scale('OrRd').classes(5); chroma.scale('OrRd').classes(8); -} \ No newline at end of file + + myChroma.cubehelix() + .start(200) + .rotations(-0.35) + .gamma(0.7) + .lightness([0.3, 0.8]) + .scale() // convert to chroma.scale + + .correctLightness() + .colors(5); + + myChroma.scale('RdYlBu'); + myChroma.scale('RdYlBu').padding(0.15); +} diff --git a/chroma-js/chroma-js.d.ts b/chroma-js/chroma-js.d.ts index 654c4d8cef..e3f463d368 100644 --- a/chroma-js/chroma-js.d.ts +++ b/chroma-js/chroma-js.d.ts @@ -263,3 +263,7 @@ declare namespace Chroma { } declare var chroma: Chroma.ChromaStatic; + +declare module "chroma-js" { + export = chroma; +} From 4595e61ad1e8c5f48255a016471487f100a818f8 Mon Sep 17 00:00:00 2001 From: minodisk Date: Tue, 16 Aug 2016 18:44:27 +0900 Subject: [PATCH 113/203] Update react-helmet - Add `titleTemplate` to `HelmetProps` - Remove blank lines --- react-helmet/react-helmet.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/react-helmet/react-helmet.d.ts b/react-helmet/react-helmet.d.ts index 2ea19ae469..553a69ed56 100644 --- a/react-helmet/react-helmet.d.ts +++ b/react-helmet/react-helmet.d.ts @@ -7,9 +7,10 @@ declare namespace ReactHelmet { import React = __React; - + interface HelmetProps { base?: any; + defaultTitle?: string; htmlAttributes?: any; link?: Array; meta?: Array; @@ -27,7 +28,7 @@ declare namespace ReactHelmet { script: HelmetDatum; title: HelmetDatum; } - + interface HelmetDatum { toString(): string; toComponent(): React.Component; @@ -41,6 +42,6 @@ declare module "react-helmet" { (): ReactHelmet.HelmetComponent rewind(): ReactHelmet.HelmetData } - + export = Helmet; } From 9bb6206f477a736748689cd95c8ed98468a3456f Mon Sep 17 00:00:00 2001 From: Lukas Zech Date: Tue, 16 Aug 2016 14:17:25 +0200 Subject: [PATCH 114/203] Add Buffer.swap16, Buffer.swap32 and Buffer.swap64 functions --- node/node-tests.ts | 8 ++++++++ node/node.d.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index 32bdc94fdb..e5e0a7397b 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]); diff --git a/node/node.d.ts b/node/node.d.ts index 99963bf49e..46e347d562 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -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; From 4d8e6c5a4f2230652314f8e1cb6169b85ce33d02 Mon Sep 17 00:00:00 2001 From: Koloto Date: Tue, 16 Aug 2016 16:07:12 +0300 Subject: [PATCH 115/203] slickgrid: fixed getCellFromEvent signature, using DOMEvent in subscribe --- slickgrid/SlickGrid-tests.ts | 7 +++++-- slickgrid/SlickGrid.d.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/slickgrid/SlickGrid-tests.ts b/slickgrid/SlickGrid-tests.ts index e267a85948..592b966e6c 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) => { + let cell: Slick.Cell = args.grid.getCellFromEvent(e); + if (!cell) { return; } +}); \ No newline at end of file diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index 96f91eaaf1..bae31aab21 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.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. From f222c07219b1fad49639395dd32b0257d8480d1e Mon Sep 17 00:00:00 2001 From: Koloto Date: Tue, 16 Aug 2016 16:17:30 +0300 Subject: [PATCH 116/203] slickgrid: fixed getCellFromEvent signature, using DOMEvent in subscribe (fixed Travis CI failure) --- slickgrid/SlickGrid-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/slickgrid/SlickGrid-tests.ts b/slickgrid/SlickGrid-tests.ts index 592b966e6c..5221f7c19d 100644 --- a/slickgrid/SlickGrid-tests.ts +++ b/slickgrid/SlickGrid-tests.ts @@ -209,7 +209,7 @@ grid.onSort.subscribe((e, args) => { var sortCol:string = args.sortCols[0].sortCol.field; }); -grid.onMouseEnter.subscribe((e: DOMEvent, args) => { +grid.onMouseEnter.subscribe((e: DOMEvent, args: Slick.OnMouseEnterEventArgs) => { let cell: Slick.Cell = args.grid.getCellFromEvent(e); if (!cell) { return; } -}); \ No newline at end of file +}); From e847d83c47a87cc71909a77e228094977ed76d54 Mon Sep 17 00:00:00 2001 From: msucheck Date: Tue, 16 Aug 2016 15:35:02 +0200 Subject: [PATCH 117/203] Added useExternalSorting property to IGridOptions interface in ui-grid --- ui-grid/ui-grid.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 1ce953885f..084a6ac17a 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -832,6 +832,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 @@ -3558,7 +3563,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 */ @@ -3793,7 +3798,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; /** From 0d1bc9c0da57e6bdb510dd86d5dd8e519ad06de8 Mon Sep 17 00:00:00 2001 From: msucheck Date: Tue, 16 Aug 2016 16:00:15 +0200 Subject: [PATCH 118/203] Added definitions for highcharts-more --- highcharts/highcharts-more.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 highcharts/highcharts-more.d.ts diff --git a/highcharts/highcharts-more.d.ts b/highcharts/highcharts-more.d.ts new file mode 100644 index 0000000000..1d42764b3c --- /dev/null +++ b/highcharts/highcharts-more.d.ts @@ -0,0 +1,12 @@ +// Type definitions for Highcharts 4.2.6 +// Project: http://www.highcharts.com/ +// Definitions by: Maciej Suchecki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare var HighchartsMore: (H: HighchartsStatic) => HighchartsStatic; + +declare module "highcharts/highcharts-more" { + export = HighchartsMore; +} From a28758054fd5ee6d86e2f599e37e790a8c3a4e37 Mon Sep 17 00:00:00 2001 From: york yao Date: Tue, 16 Aug 2016 22:14:23 +0800 Subject: [PATCH 119/203] add 3 missing methods in crypto module: getCiphers, getCurves and getHashes --- node/node.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index 99963bf49e..723f6daed4 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2166,6 +2166,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" { From 0b7a922c8349ac89481ab8ef99b01cdd930287d6 Mon Sep 17 00:00:00 2001 From: msucheck Date: Tue, 16 Aug 2016 16:15:51 +0200 Subject: [PATCH 120/203] Added definitions for highcharts-modules-exporting --- highcharts/highcharts-modules-exporting.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 highcharts/highcharts-modules-exporting.d.ts diff --git a/highcharts/highcharts-modules-exporting.d.ts b/highcharts/highcharts-modules-exporting.d.ts new file mode 100644 index 0000000000..55368a7491 --- /dev/null +++ b/highcharts/highcharts-modules-exporting.d.ts @@ -0,0 +1,12 @@ +// Type definitions for Highcharts 4.2.6 (exporting module) +// Project: http://www.highcharts.com/ +// Definitions by: Maciej Suchecki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare var HighchartsExporting: (H: HighchartsStatic) => HighchartsStatic; + +declare module "highcharts/highcharts-modules-exporting" { + export = HighchartsExporting; +} From 2fc3a43ab80b98afaabcc676e9de92517b3c2d35 Mon Sep 17 00:00:00 2001 From: msucheck Date: Tue, 16 Aug 2016 16:43:23 +0200 Subject: [PATCH 121/203] Fixed module name for Highcharts Exporting Module - fixes #10540 --- highcharts/highcharts-modules-exporting.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/highcharts/highcharts-modules-exporting.d.ts b/highcharts/highcharts-modules-exporting.d.ts index 55368a7491..4d3bdaa648 100644 --- a/highcharts/highcharts-modules-exporting.d.ts +++ b/highcharts/highcharts-modules-exporting.d.ts @@ -7,6 +7,6 @@ declare var HighchartsExporting: (H: HighchartsStatic) => HighchartsStatic; -declare module "highcharts/highcharts-modules-exporting" { +declare module "highcharts/modules/exporting" { export = HighchartsExporting; } From 00a6998f4e16aa2009ca5545768151d0e7ab7998 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Tue, 16 Aug 2016 10:10:39 -0500 Subject: [PATCH 122/203] Move interfaces in the 'electron-notify' module, and export them --- electron-notify/electron-notify.d.ts | 50 +++++++++++++--------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/electron-notify/electron-notify.d.ts b/electron-notify/electron-notify.d.ts index 3ad6906205..b29efa0e50 100644 --- a/electron-notify/electron-notify.d.ts +++ b/electron-notify/electron-notify.d.ts @@ -5,29 +5,10 @@ /// -declare namespace ElectronNotify { +/** Nice and simple notifications for electron apps */ +declare module 'electron-notify' { - interface ICloseNotificationEvent { - event: 'close' | 'show' | 'click', - id: number - } - - interface INotificationEvent extends ICloseNotificationEvent { - closeNotification: (reason: any) => void, - } - - interface INotification { - title: string, - text?: string, - image?: string, - url?: string, - sound?: string, - onClickFunc?: (event: INotificationEvent) => void, - onShowFunc?: (event: INotificationEvent) => void, - onCloseFunc?: (event: ICloseNotificationEvent) => void - } - - interface IConfiguration { + export interface ICustomConfig { width?: number, height?: number, padding?: number, @@ -47,16 +28,31 @@ declare namespace ElectronNotify { defaultStyleText?: any } -} + export interface ICloseNotificationEvent { + event: 'close' | 'show' | 'click', + id: number + } -/** Nice and simple notifications for electron apps */ -declare module 'electron-notify' { + 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: ElectronNotify.IConfiguration): void; + export function setConfig(customConfig: ICustomConfig): void; /** Displays new notification. */ - export function notify(notification: ElectronNotify.INotification): void; + 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; From a1b6081ba37e8bb42d8ed51d07a281597b177b5f Mon Sep 17 00:00:00 2001 From: rchaser53 Date: Wed, 17 Aug 2016 00:30:11 +0900 Subject: [PATCH 123/203] add arguments type for using stateless functional component I added the type for DragSource arguments. But I forgot to add the other function arguments type. --- react-dnd/react-dnd.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/react-dnd/react-dnd.d.ts b/react-dnd/react-dnd.d.ts index 71b6adb51b..000cd04ee2 100644 --- a/react-dnd/react-dnd.d.ts +++ b/react-dnd/react-dnd.d.ts @@ -47,16 +47,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; From e75095f1fdf63af6b1576b7aa0ec49f8f5963b1a Mon Sep 17 00:00:00 2001 From: David Poetzsch-Heffter Date: Tue, 16 Aug 2016 19:02:50 +0200 Subject: [PATCH 124/203] made sessionToken option available for all db operations (needed for cloud code in self-hosted parse-server) --- parse/parse.d.ts | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 6cf51a98b4..3a7d6b25f8 100644 --- a/parse/parse.d.ts +++ b/parse/parse.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. From b8e87fd5302d9b7df7ef4498b64e1fd5961aea2e Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Wed, 17 Aug 2016 01:35:43 +0800 Subject: [PATCH 125/203] node.d.ts : dgram : Allow option parameters to be omitted. --- node/node-tests.ts | 3 +++ node/node.d.ts | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 32bdc94fdb..50242e9c31 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -507,9 +507,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/node/node.d.ts b/node/node.d.ts index 99963bf49e..61d98fb1ee 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1371,7 +1371,8 @@ declare module "dgram" { interface Socket extends events.EventEmitter { 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; + send(buf: Buffer, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; + bind(port?: number, address?: string, callback?: () => void): void; close(): void; address(): AddressInfo; setBroadcast(flag: boolean): void; From 190beb00269d2a34ae7c60eab75c15690caef4b1 Mon Sep 17 00:00:00 2001 From: Andrew Connell Date: Tue, 16 Aug 2016 15:57:28 -0400 Subject: [PATCH 126/203] update wallabyjs.d.ts - richer typing Added better support for custom compilers, built in compilers and typing for the wallaby object passed in. --- wallabyjs/wallabyjs-tests.ts | 4 +-- wallabyjs/wallabyjs.d.ts | 54 ++++++++++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/wallabyjs/wallabyjs-tests.ts b/wallabyjs/wallabyjs-tests.ts index 832a775cd0..132984d039 100644 --- a/wallabyjs/wallabyjs-tests.ts +++ b/wallabyjs/wallabyjs-tests.ts @@ -13,7 +13,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({}) }; @@ -36,5 +36,5 @@ export class WallabyConfig implements wallabyjs.IWallabyConfig { } }; - constructor(private wallaby: any) { } + constructor(private wallaby: wallabyjs.IWallaby) { } } diff --git a/wallabyjs/wallabyjs.d.ts b/wallabyjs/wallabyjs.d.ts index 4f90762c2b..211963c8b3 100644 --- a/wallabyjs/wallabyjs.d.ts +++ b/wallabyjs/wallabyjs.d.ts @@ -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; } } From b7802eae32129e2ca63bee58eec8df50fa691153 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Tue, 16 Aug 2016 14:38:37 -0500 Subject: [PATCH 127/203] Add redis-scripto typings with tests. --- redis-scripto/redis-scripto-tests.ts | 37 ++++++++++++++++++++++++++ redis-scripto/redis-scripto.d.ts | 39 ++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 redis-scripto/redis-scripto-tests.ts create mode 100644 redis-scripto/redis-scripto.d.ts diff --git a/redis-scripto/redis-scripto-tests.ts b/redis-scripto/redis-scripto-tests.ts new file mode 100644 index 0000000000..235ebeb819 --- /dev/null +++ b/redis-scripto/redis-scripto-tests.ts @@ -0,0 +1,37 @@ +/// +/// + +import * as redis from 'redis'; +import * as Scripto from 'redis-scripto'; + +var num: number; +var str: string; +var options: redis.ClientOpts; +var redisClient = redis.createClient(num, str, options); + +var scriptManager = new Scripto(redisClient); +scriptManager.loadFromDir('/path/to/lua/scripts'); + +var keys = ['keyOne', 'keyTwo']; +var values = [10, 20]; +scriptManager.run('your-script', keys, values, function(err, result) { + +}); + +scriptManager.eval('your-script', keys, values, function(err, result) { + +}); + +scriptManager.loadFromFile('script-one', '/path/to/the/file'); +scriptManager.run('script-one', [], [], function(err, result) { + +}); + +var scripts: Scripto.Scripts = { + 'script-two': 'return 1000' +}; + +scriptManager.load(scripts); +scriptManager.run('script-two', [], [], function(err, result) { + +}); diff --git a/redis-scripto/redis-scripto.d.ts b/redis-scripto/redis-scripto.d.ts new file mode 100644 index 0000000000..e62e239210 --- /dev/null +++ b/redis-scripto/redis-scripto.d.ts @@ -0,0 +1,39 @@ +// Type definitions for redis-scripto 0.1.3 +// Project: https://github.com/arunoda/node-redis-scripto +// Definitions by: Seth Westphal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "redis-scripto" { + + import * as redis from 'redis'; + + class Scripto { + + constructor(redisClient: redis.RedisClient); + + eval(scriptName: string, keys: string[], args: any[], callback: (err: Error, result: any) => void): void; + evalSha(scriptName: string, keys: string[], args: any[], callback: (err: Error, result: any) => void): void; + + load(scripts: Scripto.Scripts): void; + loadFromDir(scriptsDir: string): void; + loadFromFile(name: string, filepath: string): void; + + run(scriptName: string, keys: string[], args: any[], callback: (err: Error, result: any) => void): void; + + } + + namespace Scripto { + + export type Script = string; + + export interface Scripts { + [scriptName: string]: Script; + } + + } + + export = Scripto; + +} From be6fac9f8ce56d7975c5ece31a144e96848fa33a Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Tue, 16 Aug 2016 15:55:10 -0500 Subject: [PATCH 128/203] Add redis-rate-limiter and tests. --- .../redis-rate-limiter-tests.ts | 41 +++++++++++++++++ redis-rate-limiter/redis-rate-limiter.d.ts | 44 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 redis-rate-limiter/redis-rate-limiter-tests.ts create mode 100644 redis-rate-limiter/redis-rate-limiter.d.ts diff --git a/redis-rate-limiter/redis-rate-limiter-tests.ts b/redis-rate-limiter/redis-rate-limiter-tests.ts new file mode 100644 index 0000000000..8fb68941ac --- /dev/null +++ b/redis-rate-limiter/redis-rate-limiter-tests.ts @@ -0,0 +1,41 @@ +/// +/// +/// + +import * as express from 'express'; +import * as redis from 'redis'; +import * as rateLimiter from 'redis-rate-limiter'; + +var num: number; +var str: string; +var options: redis.ClientOpts; +var redisClient = redis.createClient(num, str, options); + +var limit = rateLimiter.create({ + redis: redisClient, + key: function(x) { return x.ip }, + rate: '100/minute' +}); + +var request = {} as express.Request; +limit(request, function(err, rate) { + if (err) { + console.warn('Rate limiting not available'); + } else { + console.log('Rate window: ' + rate.window); // 60 + console.log('Rate limit: ' + rate.limit); // 100 + console.log('Rate current: ' + rate.current); // 74 + if (rate.over) { + console.error('Over the limit!'); + } + } +}); + +var middleware = rateLimiter.middleware({ + redis: redisClient, + key: 'ip', + rate: '100/minute' +}); + +var app = express(); +app.use(middleware); diff --git a/redis-rate-limiter/redis-rate-limiter.d.ts b/redis-rate-limiter/redis-rate-limiter.d.ts new file mode 100644 index 0000000000..6fa9998a0a --- /dev/null +++ b/redis-rate-limiter/redis-rate-limiter.d.ts @@ -0,0 +1,44 @@ +// Type definitions for redis-rate-limiter 1.0.3 +// Project: https://github.com/TabDigital/redis-rate-limiter +// Definitions by: Seth Westphal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "redis-rate-limiter" { + + import * as express from 'express'; + import * as redis from 'redis'; + + class RedisRateLimiter { + + public static create(options: RedisRateLimiter.Options): + (req: express.Request, callback: (err: Error, res: RedisRateLimiter.Response) => void) => void; + public static middleware(options: RedisRateLimiter.Options): express.RequestHandler; + + } + + namespace RedisRateLimiter { + + export interface Options { + redis: redis.RedisClient; + key: 'ip' | ((req: express.Request) => string); + window?: number; + limit?: number; + rate?: string; + } + + export interface Response { + key: string; + current: number; + limit: number; + window: number; + over: boolean; + } + + } + + export = RedisRateLimiter; + +} From ad2267039b655754ecd546dd7414abe3787538df Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Tue, 16 Aug 2016 17:51:14 -0500 Subject: [PATCH 129/203] Rename auth0 -> auth0-js. --- auth0/auth0-tests.ts => auth0-js/auth0-js-tests.ts | 2 +- auth0/auth0.d.ts => auth0-js/auth0-js.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename auth0/auth0-tests.ts => auth0-js/auth0-js-tests.ts (91%) rename auth0/auth0.d.ts => auth0-js/auth0-js.d.ts (98%) diff --git a/auth0/auth0-tests.ts b/auth0-js/auth0-js-tests.ts similarity index 91% rename from auth0/auth0-tests.ts rename to auth0-js/auth0-js-tests.ts index 9cd903b306..c92251db91 100644 --- a/auth0/auth0-tests.ts +++ b/auth0-js/auth0-js-tests.ts @@ -1,4 +1,4 @@ -/// +/// var auth0 = new Auth0({ domain: 'mine.auth0.com', diff --git a/auth0/auth0.d.ts b/auth0-js/auth0-js.d.ts similarity index 98% rename from auth0/auth0.d.ts rename to auth0-js/auth0-js.d.ts index 5ca8487f85..1ee4ab9d7c 100644 --- a/auth0/auth0.d.ts +++ b/auth0-js/auth0-js.d.ts @@ -1,5 +1,5 @@ // Type definitions for Auth0.js -// Project: http://auth0.com +// Project: https://github.com/auth0/auth0.js // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From f471b0f7d78f0401773299e3f0634619e211b115 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Tue, 16 Aug 2016 19:24:53 -0500 Subject: [PATCH 130/203] Fix auth0 -> auth0-js imports. --- auth0.lock/auth0.lock-tests.ts | 2 +- auth0.lock/auth0.lock.d.ts | 2 +- auth0.widget/auth0.widget-tests.ts | 2 +- auth0.widget/auth0.widget.d.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/auth0.lock/auth0.lock-tests.ts b/auth0.lock/auth0.lock-tests.ts index 07a7cf8323..d466cf5937 100644 --- a/auth0.lock/auth0.lock-tests.ts +++ b/auth0.lock/auth0.lock-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID"; diff --git a/auth0.lock/auth0.lock.d.ts b/auth0.lock/auth0.lock.d.ts index 7a459afd97..43d842aecc 100644 --- a/auth0.lock/auth0.lock.d.ts +++ b/auth0.lock/auth0.lock.d.ts @@ -3,7 +3,7 @@ // Definitions by: Brian Caruso // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface Auth0LockAdditionalSignUpFieldOption { value: string; diff --git a/auth0.widget/auth0.widget-tests.ts b/auth0.widget/auth0.widget-tests.ts index 012e9b9769..f44601986e 100644 --- a/auth0.widget/auth0.widget-tests.ts +++ b/auth0.widget/auth0.widget-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// var widget: Auth0WidgetStatic = new Auth0Widget({ diff --git a/auth0.widget/auth0.widget.d.ts b/auth0.widget/auth0.widget.d.ts index 20694526c3..e36a7f868a 100644 --- a/auth0.widget/auth0.widget.d.ts +++ b/auth0.widget/auth0.widget.d.ts @@ -3,7 +3,7 @@ // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface Auth0WidgetStatic { From 0fdba28d3871b1e649567b1f41c2d053a358bdbd Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Tue, 16 Aug 2016 19:46:02 -0500 Subject: [PATCH 131/203] Add auth0 typings and tests. --- auth0/auth0-tests.ts | 51 ++++++++++++++++++++++++ auth0/auth0.d.ts | 95 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 auth0/auth0-tests.ts create mode 100644 auth0/auth0.d.ts diff --git a/auth0/auth0-tests.ts b/auth0/auth0-tests.ts new file mode 100644 index 0000000000..a1357246f3 --- /dev/null +++ b/auth0/auth0-tests.ts @@ -0,0 +1,51 @@ +/// + +import * as auth0 from 'auth0'; + +const management = new auth0.ManagementClient({ + token: '{YOUR_API_V2_TOKEN}', + domain: '{YOUR_ACCOUNT}.auth0.com' +}); + +const auth = new auth0.AuthenticationClient({ + domain: '{YOUR_ACCOUNT}.auth0.com', + clientId: '{OPTIONAL_CLIENT_ID}' +}); + +// Using a callback. +management.getUsers((err: Error, users: auth0.User[]) => { + if (err) { + // Handle error. + } + console.log(users); +}); + +// Using a Promise. +management + .getUsers() + .then((users) => { + console.log(users); + }) + .catch((err) => { + // Handle the error. + }); + +management + .createUser({ + connection: 'My-Connection', + email: 'hi@me.co', + }).then((user) => { + console.log(user); + }).catch((err) => { + // Handle the error. + }); + +auth + .requestChangePasswordEmail({ + connection: 'My-Connection', + email: 'hi@me.co', + }).then((response) => { + console.log(response); + }).catch((err) => { + // Handle the error. + }); diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts new file mode 100644 index 0000000000..e367d30411 --- /dev/null +++ b/auth0/auth0.d.ts @@ -0,0 +1,95 @@ +// Type definitions for auth0 v2.3.1 +// Project: https://github.com/auth0/node-auth0 +// Definitions by: Seth Westphal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "auth0" { + + import * as Promise from 'bluebird'; + + export interface ManagementClientOptions { + token: string; + domain?: string; + } + + export interface UserData { + connection: string; + email?: string; + username?: string; + password?: string; + phone_number?: string; + user_metadata?: {}; + email_verified?: boolean; + app_metadata?: {}; + } + + 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; + } + + 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; + } + + export interface Identity { + connection: string; + user_id: string; + provider: string; + isSocial: boolean; + } + + 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; + } + +} From d887ba6c3cb656316d96d06a5499910358963c20 Mon Sep 17 00:00:00 2001 From: rhysd Date: Wed, 17 Aug 2016 15:16:22 +0900 Subject: [PATCH 132/203] electron-prebuilt was renamed to electron http://electron.atom.io/blog/2016/08/16/npm-install-electron --- .../{electron-prebuilt-tests.ts => electron-tests.ts} | 4 ++-- github-electron/{electron-prebuilt.d.ts => electron.d.ts} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename github-electron/{electron-prebuilt-tests.ts => electron-tests.ts} (56%) rename github-electron/{electron-prebuilt.d.ts => electron.d.ts} (53%) diff --git a/github-electron/electron-prebuilt-tests.ts b/github-electron/electron-tests.ts similarity index 56% rename from github-electron/electron-prebuilt-tests.ts rename to github-electron/electron-tests.ts index 771fd06016..00b34d60b1 100644 --- a/github-electron/electron-prebuilt-tests.ts +++ b/github-electron/electron-tests.ts @@ -1,7 +1,7 @@ -/// +/// /// -import electron = require('electron-prebuilt'); +import electron = require('electron'); import child_process = require('child_process'); child_process.spawn(electron); diff --git a/github-electron/electron-prebuilt.d.ts b/github-electron/electron.d.ts similarity index 53% rename from github-electron/electron-prebuilt.d.ts rename to github-electron/electron.d.ts index d6b6dffc0e..5e331b3e47 100644 --- a/github-electron/electron-prebuilt.d.ts +++ b/github-electron/electron.d.ts @@ -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 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'electron-prebuilt' { +declare module 'electron' { var electron: string; export = electron; } From f1c88a8096d9892bec602a4bb1f560d33d0c82c7 Mon Sep 17 00:00:00 2001 From: Maxim Samoilov Date: Tue, 16 Aug 2016 14:40:01 +0700 Subject: [PATCH 133/203] test(react): add strictNullChecks test #10421 --- react/react-tsx-tests.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 react/react-tsx-tests.tsx diff --git a/react/react-tsx-tests.tsx b/react/react-tsx-tests.tsx new file mode 100644 index 0000000000..303a6b1f42 --- /dev/null +++ b/react/react-tsx-tests.tsx @@ -0,0 +1,16 @@ +/// +import React = require("react"); + +interface SCProps { + foo?: number; +} + +var StatelessComponent: React.SFC = ({ foo }: SCProps) => { + return

    { foo }
    ; +}; +StatelessComponent.displayName = "StatelessComponent3"; +StatelessComponent.defaultProps = { + foo: 42 +}; + +; From d72a787f0dfc80d3320842697d23f122644533ab Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Wed, 17 Aug 2016 10:06:23 +0300 Subject: [PATCH 134/203] Update react.d.ts --- react/react.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/react/react.d.ts b/react/react.d.ts index f3ce283545..7f3c87082a 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -276,10 +276,10 @@ declare namespace __React { isTrusted: boolean; nativeEvent: Event; preventDefault(): void; - stopPropagation(): void; - persist(): void; isDefaultPrevented(): boolean; + stopPropagation(): void; isPropagationStopped(): boolean; + persist(): void; target: EventTarget; timeStamp: Date; type: string; From 5073eb65dc9d6617d67d2c7b0a11e25d3b9ca6cb Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 17 Aug 2016 17:07:40 +0800 Subject: [PATCH 135/203] http.IncomingMessage: destroy not found Please refer to https://nodejs.org/api/http.html#http_message_destroy_error --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index 99963bf49e..8b944dda8d 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -670,6 +670,7 @@ declare module "http" { */ statusMessage?: string; socket: net.Socket; + destroy(error: Error): void; } /** * @deprecated Use IncomingMessage From 75bfef43c60910b770bbee513c019f055d16ab85 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 17 Aug 2016 17:36:04 +0800 Subject: [PATCH 136/203] destroy has a optional argument --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 8b944dda8d..3177d9d290 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -670,7 +670,7 @@ declare module "http" { */ statusMessage?: string; socket: net.Socket; - destroy(error: Error): void; + destroy(error?: Error): void; } /** * @deprecated Use IncomingMessage From ab22123c9c46173dda11d0d4d636fe336f492923 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 17 Aug 2016 17:36:56 +0800 Subject: [PATCH 137/203] destroy has a optional argument From 79dcf14a6ba1ae5fd1d2962916201fe45a48c98d Mon Sep 17 00:00:00 2001 From: Andrew Connell Date: Wed, 17 Aug 2016 06:16:16 -0400 Subject: [PATCH 138/203] update header with my GH link for DT-BOT --- wallabyjs/wallabyjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallabyjs/wallabyjs.d.ts b/wallabyjs/wallabyjs.d.ts index 211963c8b3..7b791e44ff 100644 --- a/wallabyjs/wallabyjs.d.ts +++ b/wallabyjs/wallabyjs.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' { From 739bd1a4746ed933a388321bcd02975c11c3430a Mon Sep 17 00:00:00 2001 From: york yao Date: Wed, 17 Aug 2016 18:54:40 +0800 Subject: [PATCH 139/203] the muster.array() 's parameter is optional --- multer/multer.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multer/multer.d.ts b/multer/multer.d.ts index 4b70555af8..2a4eea805f 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -90,7 +90,7 @@ declare module "multer" { /** 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; + 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. */ From 8039434c204a56b575f56fa2860654da808db208 Mon Sep 17 00:00:00 2001 From: Nicholas Iannone Date: Wed, 17 Aug 2016 09:53:59 -0500 Subject: [PATCH 140/203] Renamed modules. --- db-migrate-base/db-migrate-base-tests.ts | 2 +- db-migrate-base/db-migrate-base.d.ts | 2 +- db-migrate-pg/db-migrate-pg-tests.ts | 2 +- db-migrate-pg/db-migrate-pg.d.ts | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db-migrate-base/db-migrate-base-tests.ts b/db-migrate-base/db-migrate-base-tests.ts index 68c61e6f6c..55d471b98f 100644 --- a/db-migrate-base/db-migrate-base-tests.ts +++ b/db-migrate-base/db-migrate-base-tests.ts @@ -1,7 +1,7 @@ // Test file for db-migrate-base Definition file /// -import * as DbMigrateBase from "DbMigrateBase"; +import * as DbMigrateBase from "db-migrate-base"; // Throw together a dummy driver let db = {}; diff --git a/db-migrate-base/db-migrate-base.d.ts b/db-migrate-base/db-migrate-base.d.ts index 47dd8ce1c2..fe1f4ade47 100644 --- a/db-migrate-base/db-migrate-base.d.ts +++ b/db-migrate-base/db-migrate-base.d.ts @@ -6,7 +6,7 @@ /// /// -declare module "DbMigrateBase" { +declare module "db-migrate-base" { export interface CallbackFunction { (err: any, response: any): void; } diff --git a/db-migrate-pg/db-migrate-pg-tests.ts b/db-migrate-pg/db-migrate-pg-tests.ts index ad2430440c..3878c54607 100644 --- a/db-migrate-pg/db-migrate-pg-tests.ts +++ b/db-migrate-pg/db-migrate-pg-tests.ts @@ -1,7 +1,7 @@ // Test file for db-migrate-pg Definition file /// -import * as DbMigratePg from "DbMigratePg"; +import * as DbMigratePg from "db-migrate-pg"; // Throw together a dummy driver let db = {}; diff --git a/db-migrate-pg/db-migrate-pg.d.ts b/db-migrate-pg/db-migrate-pg.d.ts index 4d2823ec52..aa1a52d34e 100644 --- a/db-migrate-pg/db-migrate-pg.d.ts +++ b/db-migrate-pg/db-migrate-pg.d.ts @@ -6,10 +6,10 @@ /// /// -declare module "DbMigratePg" { +declare module "db-migrate-pg" { import * as pg from "pg"; - import * as DbMigrateBase from "DbMigrateBase"; + import * as DbMigrateBase from "db-migrate-base"; // Yes, this is a dummy interface for now; the current implementation of the pg driver doesn't need any options. export interface CreateDatabaseOptions {} From 45f675a1624a24ef5bf20ec74bf7e90c3e56629e Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Wed, 17 Aug 2016 11:06:04 -0400 Subject: [PATCH 141/203] Add GoogleEarth type definitions --- google-earth/google-earth-tests.ts | 131 + google-earth/google-earth.d.ts | 3920 ++++++++++++++++++++++++++++ 2 files changed, 4051 insertions(+) create mode 100644 google-earth/google-earth-tests.ts create mode 100644 google-earth/google-earth.d.ts diff --git a/google-earth/google-earth-tests.ts b/google-earth/google-earth-tests.ts new file mode 100644 index 0000000000..6c9d4df1bf --- /dev/null +++ b/google-earth/google-earth-tests.ts @@ -0,0 +1,131 @@ +/// + +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 HTML, 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); +} diff --git a/google-earth/google-earth.d.ts b/google-earth/google-earth.d.ts new file mode 100644 index 0000000000..ac10729f17 --- /dev/null +++ b/google-earth/google-earth.d.ts @@ -0,0 +1,3920 @@ +// Type definitions for Google Earth Plugin +// Project: https://developers.google.com/earth/ +// Definitions by: Ilia Choly +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace google { + + export function load( + moduleName: string, + moduleVersion: string, + optionalSettings?: any + ): void; +} + +declare namespace google.earth { + + /** + * Whether or not the Google Earth Browser Plug-in and API are supported on the current browser and operating system. + */ + export function isSupported(): boolean; + + /** + * Whether or not the Google Earth Browser Plug-in is currently installed on the user's machine. + * + * Note: if the plug-in is not installed, the user will be presented with a 'download' link upon calls to google.earth.createInstance(). + */ + export function isInstalled(): boolean; + + /** + * Attempts to create an instance of the plugin under the given web browser HTML DOM node. + * Upon success, calls the function passed in as the initCallback argument. + * Upon failure, calls the function passed in as the failureCallback argument and displays an error message to the user in place of the plug-in object. + * + * Note: + * + * The HTML DOM must be loaded before this function can be called. + * Common usage is to call this function upon the 's load event, or to use google.setOnLoadCallback. + */ + export function createInstance( + domNode: string|Element, + initCallback: (plugin: GEPlugin) => void, + failureCallback: (error: any) => void, + options?: any + ): void; + + /** + * Attaches a listener to a given object for a specific event; when the event occurs on the object, the given callback is invoked. + */ + export function addEventListener( + targetObject: any, + eventID: string, + listenerCallback: (event: KmlEvent) => void, + useCapture?: boolean + ): void; + + /** + * Removes an event listener previously added using google.earth.addEventListener() from the event chain. + * + * Note: + * + * You must pass in the exact same function object as was passed to addEventListener. + * If you are using an anonymous function callback, it will need to be refactored into its own variable. + */ + export function removeEventListener( + targetObject: any, + eventID: string, + listenerCallback: (event: KmlEvent) => void, + useCapture?: boolean + ): void; + + /** + * Retrieves and parses a KML or KMZ file at the given URL and returns an instance of a KmlFeature-derived class representing the parsed KML object model. + * + * Note: This function does not display the feature on the Earth. See below for more information. + */ + export function fetchKml( + pluginInstance: GEPlugin, + url: string, + completionCallback: (feature: KmlFeature) => void + ): void; + + /** + * Efficiently executes an arbitrary, user-defined function (the batch function), minimizing the amount of overhead incurred during cross-process communication between the web browser and Google Earth Plugin. + * This method is useful for batching together a large set of calls to the Earth API, for example, a large number of consecutive calls to KmlCoordArray.pushLatLngAlt. + */ + export function executeBatch(pluginInstance: GEPlugin, batchFunction: Function): void; + + /** + * Sets the language to be used for new instances of the plugin. + * Needs to be called before google.earth.createInstance(). + * Affects road and border labels, the error message displayed when the plugin fails to load, as well as the language of the Terms of Use page linked from the plugin. + */ + export function setLanguage(languageCode: string): void; + + /** + * This interface enables programmatic and user-driven interaction with photo overlays in the Google Earth Plugin. + * + * Note: This interface is still under development. + */ + export class GEPhotoOverlayViewer { + + /** + * Enters the given photo overlay object, exiting any other currently active photo overlay. + * If the argument is null, then any currently active photo overlay is exited and normal global navigation is enabled. + */ + setPhotoOverlay(photoOverlay: KmlPhotoOverlay): void; + } + + /** + * Used to manipulate the navigation controls in Google Earth. + */ + export class GENavigationControl { + + /** + * Whether the control is always visible, always hidden, or visible only when the user intends to use the control. + * + * See also: + * + * * GEPlugin.VISIBILITY_SHOW + * * GEPlugin.VISIBILITY_HIDE + * * GEPlugin.VISIBILITY_AUTO + */ + getVisibility(): GEVisibilityEnum; + + /** + * Whether the control is always visible, always hidden, or visible only when the user intends to use the control. + * + * See also: + * + * * GEPlugin.VISIBILITY_SHOW + * * GEPlugin.VISIBILITY_HIDE + * * GEPlugin.VISIBILITY_AUTO + */ + setVisibility(visibility: GEVisibilityEnum): void; + + /** + * Specifies the size of the navigation control. + * + * See also: + * + * * GEPlugin.NAVIGATION_CONTROL_LARGE + * * GEPlugin.NAVIGATION_CONTROL_SMALL + */ + getControlType(): GENavigationControlEnum; + + /** + * Specifies the size of the navigation control. + * + * See also: + * + * * GEPlugin.NAVIGATION_CONTROL_LARGE + * * GEPlugin.NAVIGATION_CONTROL_SMALL + */ + setControlType(controlType: GENavigationControlEnum): void; + + /** + * The position of the navigation controls in Google Earth + */ + getScreenXY(): KmlVec2; + + /** + * Enables or disables user-initiated entry to Street View imagery. + * When true, the Pegman icon is present in the navigation controls, allowing a user to drag the Pegman onto a street to initiate Street View. + * Users can also zoom down to ground level to enter Street View when this is set to true. + */ + setStreetViewEnabled(streetViewEnabled: boolean): void; + + /** + * Whether Street View is enabled in the navigation controls. + */ + getStreetViewEnabled(): boolean; + } + + /** + * Defines a tour, which is a playlist of scripted camera and update events. + * + * Note: This interface is still under development. + */ + export class KmlTour extends KmlFeature {} + + /** + * This interface enables programmatic and user-driven interaction with KML tours in the Google Earth Plugin. + * + * Note: This interface is still under development. + */ + export class GETourPlayer { + + /** + * Enters the given tour object, exiting any other currently active tour. + * This method does not automatically begin playing the tour. + * If the argument is null, then any currently active tour is exited and normal globe navigation is enabled. + */ + setTour(tour: KmlTour): void; + + /** + * Plays the currently active tour. + */ + play(): void; + + /** + * Pauses the currently active tour. + */ + pause(): void; + + /** + * Resets the currently active tour, stopping playback and rewinding to the start of the tour. + */ + reset(): void; + + /** + * The current elapsed playing time of the active tour, in seconds. + */ + getCurrentTime(): number; + + /** + * The current elapsed playing time of the active tour, in seconds. + */ + setCurrentTime(currentTime: number): void; + + /** + * The total duration of the active tour, in seconds. If no tour is loaded, the behavior of this method is undefined. + */ + getDuration(): number; + } + + /** + * This interface contains result information obtained by calling GEView's hitTest method. + * + * See also: + * + * * GEView.hitTest + */ + export class GEHitTestResult { + + /** + * Latitude of sampled point. + */ + getLatitude(): number; + + /** + * Latitude of sampled point. + */ + setLatitude(latitude: number): void; + + /** + * Longitude of sampled point. + */ + getLongitude(): number; + + /** + * Longitude of sampled point. + */ + setLongitude(longitude: number): void; + + /** + * Altitude of sampled point. + */ + getAltitude(): number; + + /** + * Altitude of sampled point. + */ + setAltitude(altitude: number): void; + } + + /** + * Maps between two different icon styles. + * Typically this interface is used to provide separate normal and highlighted styles for a placemark, so that the highlighted version appears when the user mouses over the icon. + */ + export class KmlStyleMap extends KmlStyleSelector { + + /** + * Sets both URLs for the placemark style. + */ + setUrl(normalStyleUrl: string, highlightStyleUrl: string): void; + + /** + * Sets both placemark styles. + */ + setStyle(normalStyle: KmlStyle, highlightStyle: KmlStyle): void; + + /** + * Defines a normal style for a placemark. + */ + getNormalStyleUrl(): string; + + /** + * Defines a normal style for a placemark. + */ + setNormalStyleUrl(normalStyleUrl: string): void; + + /** + * Defines highlighted styles for a placemark, so that the highlighted version appears when the user mouses over the icon in Google Earth. + */ + getHighlightStyleUrl(): string; + + /** + * Defines highlighted styles for a placemark, so that the highlighted version appears when the user mouses over the icon in Google Earth. + */ + setHighlightStyleUrl(highlightStyleUrl: string): void; + + /** + * Defines a normal style for a placemark. + */ + getNormalStyle(): KmlStyle; + + /** + * Defines a normal style for a placemark. + */ + setNormalStyle(normalStyle: KmlStyle): void; + + /** + * Defines highlighted styles for a placemark, so that the highlighted version appears when the user mouses over the icon in Google Earth. + */ + getHighlightStyle(): KmlStyle; + + /** + * Defines highlighted styles for a placemark, so that the highlighted version appears when the user mouses over the icon in Google Earth. + */ + setHighlightStyle(highlightStyle: KmlStyle): void; + } + + /** + * References a KML file or KMZ archive on a remote network. + * Use the Link property to specify the location of the KML file. + * Within that property, you can define the refresh options for updating the file, based on time and camera change. + * NetworkLinks can be used in combination with Regions to handle very large datasets efficiently. + */ + export class KmlNetworkLink extends KmlFeature { + + /** + * Sets the link, refreshVisibility, and flyToView for the network link. + */ + set(link: KmlLink, refreshVisibility: boolean, flyToView: boolean): void; + + /** + * Specifies the location of any of the following: + * + * * KML files fetched by network links + * * Image files used by icons in icon styles, ground overlays, and screen overlays + * * Model files used in the Model object + */ + getLink(): KmlLink; + + /** + * Specifies the location of any of the following: + * + * * KML files fetched by network links + * * Image files used by icons in icon styles, ground overlays, and screen overlays + * * Model files used in the Model object + */ + setLink(link: KmlLink): void; + + /** + * A value of 0 leaves the visibility of features within the control of the Google Earth user. + * Set the value to 1 to reset the visibility of features each time the NetworkLink is refreshed. + * For example, suppose a Placemark within the linked KML file has visibility set to 1 and the NetworkLink has refreshVisibility set to 1. + * When the file is first loaded into Google Earth, the user can clear the check box next to the item to turn off display in the 3D viewer. + * However, when the NetworkLink is refreshed, the Placemark will be made visible again, since its original visibility state was TRUE. + */ + getRefreshVisibility(): boolean; + + /** + * A value of 0 leaves the visibility of features within the control of the Google Earth user. + * Set the value to 1 to reset the visibility of features each time the NetworkLink is refreshed. + * For example, suppose a Placemark within the linked KML file has visibility set to 1 and the NetworkLink has refreshVisibility set to 1. + * When the file is first loaded into Google Earth, the user can clear the check box next to the item to turn off display in the 3D viewer. + * However, when the NetworkLink is refreshed, the Placemark will be made visible again, since its original visibility state was TRUE. + */ + setRefreshVisibility(refreshVisibility: boolean): void; + + /** + * A value of 1 causes Google Earth to fly to the view of the LookAt or Camera in the NetworkLinkControl (if it exists). + */ + getFlyToView(): boolean; + + /** + * A value of 1 causes Google Earth to fly to the view of the LookAt or Camera in the NetworkLinkControl (if it exists). + */ + setFlyToView(flyToView: boolean): void; + } + + /** + * Draws an image overlay fixed to the screen. + * Sample uses for ScreenOverlays are compasses, logos, and heads-up displays. + * ScreenOverlay sizing is determined by the size element. + * Positioning of the overlay is handled by mapping a point in the image specified by screenXY to a point on the screen specified by overlayXY. + * Then the image is rotated by rotation degrees about a point relative to the screen specified by rotationXY. + * + * Note: + * + * screenXY and overlayXY behave opposite to their corresponding behaviors in KML. + * This is due to a bug in the Earth API that will intentionally remain unfixed until a major version change. + */ + export class KmlScreenOverlay extends KmlOverlay { + + /** + * Specifies a point on (or outside of) the overlay image that is mapped to the screen coordinate. + * It requires x and y values, and the units for those values. + * + * Note: + * + * screenXY and overlayXY behave opposite to their corresponding behaviors in KML. + * This is due to a bug in the Earth API that will intentionally remain unfixed until a major version change. + */ + getScreenXY(): KmlVec2; + + /** + * Specifies a point relative to the screen origin that the overlay image is mapped to. + * The x and y values can be specified in three different ways: as pixels ("pixels"), as fractions of the screen ("fraction"), or as inset pixels ("insetPixels"), which is an offset in pixels from the upper right corner of the screen. + * The x and y positions can be specified in different ways - for example, x can be in pixels and y can be a fraction. + * The origin of the coordinate system is in the lower left corner of the screen. + * + * Note: + * + * screenXY and overlayXY behave opposite to their corresponding behaviors in KML. + * This is due to a bug in the Earth API that will intentionally remain unfixed until a major version change. + */ + getOverlayXY(): KmlVec2; + + /** + * Point relative to the screen about which the screen overlay is rotated. + */ + getRotationXY(): KmlVec2; + + /** + * Specifies the size of the image for the screen overlay, as follows: + * + * * A value of -1 indicates to use the native dimension + * * A value of 0 indicates to maintain the aspect ratio + * * A value of n sets the value of the dimension + */ + getSize(): KmlVec2; + + /** + * Adjusts how the image is placed inside the field of view. + * This element is useful if your image has been rotated and deviates slightly from a desired horizontal view. + */ + getRotation(): number; + + /** + * Adjusts how the image is placed inside the field of view. + * This element is useful if your image has been rotated and deviates slightly from a desired horizontal view. + */ + setRotation(rotation: number): void; + } + + /** + * Defines a photo overlay, which is a geographically located photograph of the Earth. + * Photo overlays can be drawn onto 2D rectangles in three dimensional space, or in the case of panoramic photos, onto partial or full cylinders, or even spheres. + * + * Note: This interface is still under development. + */ + export class KmlPhotoOverlay extends KmlOverlay {} + + /** + * Draws an image overlay draped onto the terrain. + * The href child of Icon specifies the image to be used as the overlay. + * If this object is omitted or contains no href, a rectangle is drawn using the color defined by the overlay. + */ + export class KmlGroundOverlay extends KmlOverlay { + + /** + * Specifies the distance above the earth's surface. + */ + getAltitude(): number; + + /** + * Specifies the distance above the earth's surface. + */ + setAltitude(altitude: number): void; + + /** + * Specifies how the altitude property is interpreted. + * + * See also: + * + * * GEPlugin.ALTITUDE_CLAMP_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_CLAMP_TO_SEA_FLOOR + */ + getAltitudeMode(): KmlAltitudeModeEnum; + + /** + * Specifies how the altitude property is interpreted. + * + * See also: + * + * * GEPlugin.ALTITUDE_CLAMP_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_CLAMP_TO_SEA_FLOOR + */ + setAltitudeMode(altitudeMode: KmlAltitudeModeEnum): void; + + /** + * The bounding box of the ground overlay. + */ + getLatLonBox(): KmlLatLonBox; + + /** + * The bounding box of the ground overlay. + */ + setLatLonBox(latLonBox: KmlLatLonBox): void; + } + + /** + * The KmlOverlay object is an abstract object and cannot be used directly in a KML file. + * Overlay is the base type for image overlays drawn on the planet surface or on the screen. + * Icon specifies the image to use and can be configured to reload images based on a timer or by camera changes. + * This object also includes specifications for stacking order of multiple overlays and for adding color and transparency values to the base image. + */ + export class KmlOverlay extends KmlFeature { + + /** + * Specifies the color values. + */ + getColor(): KmlColor; + + /** + * Defines the stacking order for the images in overlapping overlays. + * Overlays with higher drawOrder values are drawn on top of overlays with lower drawOrder values. + */ + getDrawOrder(): number; + + /** + * Defines the stacking order for the images in overlapping overlays. + * Overlays with higher drawOrder values are drawn on top of overlays with lower drawOrder values. + */ + setDrawOrder(drawOrder: number): void; + + /** + * Defines the image associated with the Overlay. + */ + getIcon(): KmlIcon; + + /** + * Defines the image associated with the Overlay. + */ + setIcon(icon: KmlIcon): void; + } + + /** + * This class controls the display of sunlight, historical imagery, and Street View panoramas in the plugin. + * The KmlViewerOptions object is passed to KmlAbstractView.setViewerOptions() + */ + export class KmlViewerOptions extends KmlObject { + + /** + * Returns the current state of the specified viewer option type. + * + * See also: + * + * * GEPlugin.OPTION_STREET_VIEW + * * GEPlugin.OPTION_SUNLIGHT + * * GEPlugin.OPTION_HISTORICAL_IMAGERY + * * GEPlugin.OPTION_STATE_DEFAULT + * * GEPlugin.OPTION_STATE_ENABLED + * * GEPlugin.OPTION_STATE_DISABLED + */ + setOption(type: GEViewerOptionsTypeEnum, state: GEViewerOptionsValueEnum): void; + + /** + * Set the state of viewer options, including sunlight, Street View, and historical imagery. + * + * See also: + * + * * GEPlugin.OPTION_STREET_VIEW + * * GEPlugin.OPTION_SUNLIGHT + * * GEPlugin.OPTION_HISTORICAL_IMAGERY + * * GEPlugin.OPTION_STATE_DEFAULT + * * GEPlugin.OPTION_STATE_ENABLED + * * GEPlugin.OPTION_STATE_DISABLED + */ + getOption(type: GEViewerOptionsValueEnum): GEViewerOptionsValueEnum; + } + + /** + * Describes rotation of a 3D model's coordinate system to position the object in Google Earth. + */ + export class KmlOrientation extends KmlObject { + + /** + * Sets the heading, tilt, and roll of a model. + */ + set(heading: number, tilt: number, roll: number): void; + + /** + * Rotation about the z axis (normal to the Earth's surface). + * A value of 0 (the default) equals North. + * A positive rotation is clockwise around the z axis and specified in degrees from 0 to 360. + */ + getHeading(): number; + + /** + * Rotation about the z axis (normal to the Earth's surface). + * A value of 0 (the default) equals North. + * A positive rotation is clockwise around the z axis and specified in degrees from 0 to 360. + */ + setHeading(heading: number): void; + + /** + * Rotation about the x axis. + * A positive rotation is clockwise around the x axis and specified in degrees from 0 to 360. + */ + getTilt(): number; + + /** + * Rotation about the x axis. + * A positive rotation is clockwise around the x axis and specified in degrees from 0 to 360. + */ + setTilt(tilt: number): void; + + /** + * Rotation about the y axis. + * A positive rotation is clockwise around the y axis and specified in degrees from 0 to 360. + */ + getRoll(): number; + + /** + * Rotation about the y axis. + * A positive rotation is clockwise around the y axis and specified in degrees from 0 to 360. + */ + setRoll(roll: number): void; + } + + /** + * Specifies the exact coordinates of the Model's origin in latitude, longitude, and altitude. + * Latitude and longitude measurements are standard lat-lon projection with WGS84 datum. + * Altitude is distance above the earth's surface, in meters, and is interpreted according to altitudeMode. + */ + export class KmlLocation extends KmlObject { + + /** + * Sets the latitude, longitude, and altitude of the Model. + */ + setLatLngAlt(lat: number, lng: number, alt: number): void; + + /** + * Longitude of the Model's location. + * Angular distance in degrees, relative to the Prime Meridian. + * Values west of the Meridian range from -180 to 0 degrees. + * Values east of the Meridian range from 0 to 180 degrees. + */ + getLongitude(): number; + + /** + * Longitude of the Model's location. + * Angular distance in degrees, relative to the Prime Meridian. + * Values west of the Meridian range from -180 to 0 degrees. + * Values east of the Meridian range from 0 to 180 degrees. + */ + setLongitude(longitude: number): void; + + /** + * Latitude of the camera location. + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + getLatitude(): number; + + /** + * Latitude of the camera location. + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + setLatitude(latitude: number): void; + + /** + * Specifies the distance above the earth's surface. + */ + getAltitude(): number; + + /** + * Specifies the distance above the earth's surface. + */ + setAltitude(altitude: number): void; + } + + /** + * Scales a model along the x, y, and z axes in the model's coordinate space. + */ + export class KmlScale extends KmlObject { + + /** + * Sets the x, y, and z coordinates for a model. + */ + set(x: number, y: number, z: number): void; + + /** + * Indicates the x coordinate. + */ + getX(): number; + + /** + * Indicates the x coordinate. + */ + setX(x: number): void; + + /** + * Indicates the y coordinate. + */ + getY(): number; + + /** + * Indicates the y coordinate. + */ + setY(y: number): void; + + /** + * Indicates the z coordinate. + */ + getZ(): number; + + /** + * Indicates the z coordinate. + */ + setZ(z: number): void; + } + + /** + * A single tuple consisting of floating point values for longitude, latitude, and altitude (in that order). + * Longitude and latitude values are in degrees. + * + * * longitude = -180 and <= 180 + * * latitude = -90 and = 90 + * * altitude values (optional) are in meters above sea level + */ + export class KmlCoord { + + /** + * Sets the latitude, longitude, altitude. + */ + setLatLngAlt(latitude: number, longitude: number, altitude: number): void; + + /** + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + getLatitude(): number; + + /** + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + setLatitude(latitude: number): void; + + /** + * Angular distance in degrees, relative to the Prime Meridian. Values west of the Meridian range from -180 to 0 degrees. + * Values east of the Meridian range from 0 to 180 degrees. + */ + getLongitude(): number; + + /** + * Angular distance in degrees, relative to the Prime Meridian. Values west of the Meridian range from -180 to 0 degrees. + * Values east of the Meridian range from 0 to 180 degrees. + */ + setLongitude(longitude: number): void; + + /** + * Distance from the earth's surface. + */ + getAltitude(): number; + + /** + * Distance from the earth's surface. + */ + setAltitude(altitude: number): void; + } + + /** + * The KmlCoordArray object defines an array of coordinates. + */ + export class KmlCoordArray { + + /** + * Returns the coordinates at the given index. + */ + get(index: number): KmlCoord; + + /** + * Sets the coordinates at the given index.. + */ + set(index: number, coord: KmlCoord): void; + + /** + * Sets the latitude, longitude, and altitude. + */ + setLatLngAlt( + index: number, + latitude: number, + longitude: number, + altitude: number + ): void; + + /** + * Appends one or more new elements to the end of an array and returns the new length of the array. + */ + pushLatLngAlt( + latitude: number, + longitude: number, + altitude: number + ): void; + + /** + * Appends one or more new elements to the end of an array and returns the new length of the array. + */ + push(coordOrList: KmlCoord): void; + + /** + * Deletes the last element of an array, decrements the array length, and returns the value that is removed. + */ + pop(): KmlCoord; + + /** + * Adds an element or elements to the beginning of an array. + */ + unshift(coordOrList: KmlCoord): number; + + /** + * Adds an element or elements to the beginning of an array. + */ + unshiftLatLngAlt( + latitude: number, + longitude: number, + altitude: number + ): void; + + /** + * Removes and returns the first element of the array. + */ + shift(): KmlCoord; + + /** + * Reverses the order of the elements in the array. + */ + reverse(): void; + + /** + * Clears all of the elements in the array + */ + clear(): void; + + /** + * Specifies the length of the index array. + */ + getLength(): number; + } + + /** + * The object corresponding to the retangular region in which Google Earth is displayed. + */ + export class GEWindow extends GEEventEmitter { + + /** + * Gives the Google Earth object focus. + */ + focus(): void; + + /** + * Removes focus from the Google Earth object. + */ + blur(): void; + + /** + * Toggles the overall visibility of Google Earth inside the browser. + */ + getVisibility(): boolean; + + /** + * Toggles the overall visibility of Google Earth inside the browser. + */ + setVisibility(visibility: boolean): void; + } + + /** + * The GEGlobe class encapsulates the Google Earth globe to determine access and event behavior. + */ + export class GEGlobe extends KmlObject { + + /** + * Returns the altitude for a given location on the globe. + * If the altitude data for the location has not yet been loaded, the return value is 0. + */ + getGroundAltitude(lat: number, lon: number): number; + + /** + * The top-level features currently in the Earth instance. + */ + getFeatures(): GEFeatureContainer; + } + + /** + * Controls the behavior of the camera that views the scene in Google Earth. + */ + export class GEView { + + /** + * Returns the screen x,y coordinates of a given point on the globe. + * + * Tip: project() is the inverse of hitTest(). + * + * See also: + * + * * GEPlugin.ALTITUDE_RELATIVE_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_RELATIVE_TO_SEA_FLOOR + */ + project( + lat: number, + lng: number, + alt: number, + altitudeMode: KmlAltitudeModeEnum + ): KmlVec2; + + /** + * Sets the camera that views the scene in Google Earth. + */ + setAbstractView(view: KmlAbstractView): void; + + /** + * Creates and returns a new KmlLookAt object, initialized to the current camera position and orientation. + * Use 'altitudeMode' to specify the altitude mode of the looked-at point. + * + * See also: + * + * * GEPlugin.ALTITUDE_RELATIVE_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_RELATIVE_TO_SEA_FLOOR + */ + copyAsLookAt(altitudeMode: KmlAltitudeModeEnum): KmlLookAt; + + /** + * Creates and returns a new KmlCamera object, initialized to the current camera position and orientation. + * Use 'altitudeMode' to specify the altitude mode of the new camera. + * + * See also: + * + * * GEPlugin.ALTITUDE_RELATIVE_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_RELATIVE_TO_SEA_FLOOR + */ + copyAsCamera(altitudeMode: KmlAltitudeModeEnum): KmlCamera; + + /** + * Returns a bounding box that completely contains the region of the globe that is currently visible. + * The returned box will be larger than what is strictly visible, if that is necessary to include everything that is visible. + */ + getViewportGlobeBounds(): KmlLatLonBox; + + /** + * Given a point on the screen in pixel coordinates, returns a GEHitTestResult with information about the geographic location corresponding to the point on the screen. + * Tip: hitTest() is the inverse of project(). + * + * See also: + * + * * GEPlugin.UNITS_PIXELS + * * GEPlugin.UNITS_INSET_PIXELS + * * GEPlugin.UNITS_FRACTION + * * GEPlugin.HIT_TEST_GLOBE + * * GEPlugin.HIT_TEST_TERRAIN + * * GEPlugin.HIT_TEST_BUILDINGS + */ + hitTest( + x: number, + xUnits: KmlUnitsEnum, + y: number, + yUnits: KmlUnitsEnum, + mode: GEHitTestModeEnum + ): GEHitTestResult; + } + + /** + * Defines an image associated with an Icon style or overlay. + */ + export class KmlIcon extends KmlLink { + + /** + * Gets the offset from the left (), in pixels, of the icon. + */ + getX(): number; + + /** + * Specifies the icon's offset (), in pixels from the left side of its icon palette, if a palette has been specified in the element. + */ + setX(x: number): number; + + /** + * Gets the offset from the bottom (), in pixels, of the icon. + */ + getY(): number; + + /** + * Specifies the offset (), in pixels from the bottom of its icon palette, if a palette has been specified in the element. + */ + setY(y: number): void; + + /** + * Gets the width (), in pixels, of the icon. + */ + getW(): number; + + /** + * Specifies the width (), in pixels, of the icon to use. + */ + setW(w: number): void; + + /** + * Gets the height (), in pixels, of the icon. + */ + getH(): number; + + /** + * Specifies the height (), in pixels, of the icon to use. + */ + setH(h: number): void; + } + + /** + * Specifies the location of any KML files fetched by network links, image files used by icons in icon styles, ground overlays, and screen overlays, or model files used in the Model object. + */ + export class KmlLink extends KmlObject { + + /** + * A URL (either an HTTP address or a local file specification). + * When the parent of Link is a NetworkLink, href is a KML file. + * When the parent of Link is a Model, href is a COLLADA file. + * When the parent of Link is an Overlay, href is an image. + */ + getHref(): string; + + /** + * A URL (either an HTTP address or a local file specification). + * When the parent of Link is a NetworkLink, href is a KML file. + * When the parent of Link is a Model, href is a COLLADA file. + * When the parent of Link is an Overlay, href is an image. + */ + setHref(href: string): void; + + /** + * Specifies to use a time-based refresh mode. + * + * See also: + * + * * GEPlugin.REFRESH_ON_CHANGE + * * GEPlugin.REFRESH_ON_INTERVAL + * * GEPlugin.REFRESH_ON_EXPIRE + */ + getRefreshMode(): KmlRefreshModeEnum; + + /** + * Specifies to use a time-based refresh mode. + * + * See also: + * + * * GEPlugin.REFRESH_ON_CHANGE + * * GEPlugin.REFRESH_ON_INTERVAL + * * GEPlugin.REFRESH_ON_EXPIRE + */ + setRefreshMode(refreshMode: KmlRefreshModeEnum): void; + + /** + * Indicates to refresh the file every n seconds. + */ + getRefreshInterval(): number; + + /** + * Indicates to refresh the file every n seconds. + */ + setRefreshInterval(refreshInterval: number): void; + + /** + * Specifies how the link is refreshed when the viewport changes. + * + * See also: + * + * * GEPlugin.VIEW_REFRESH_NEVER + * * GEPlugin.VIEW_REFRESH_ON_STOP + * * GEPlugin.VIEW_REFRESH_ON_REGION + */ + getViewRefreshMode(): KmlViewRefreshModeEnum; + + /** + * Specifies how the link is refreshed when the viewport changes. + * + * See also: + * + * * GEPlugin.VIEW_REFRESH_NEVER + * * GEPlugin.VIEW_REFRESH_ON_STOP + * * GEPlugin.VIEW_REFRESH_ON_REGION + */ + setViewRefreshMode(viewRefreshMode: KmlViewRefreshModeEnum): void; + + /** + * Specifies how the link is refreshed when the camera changes. + */ + getViewRefreshTime(): number; + + /** + * Specifies how the link is refreshed when the camera changes. + */ + setViewRefreshTime(viewRefreshTime: number): void; + + /** + * Scales the BBOX parameters before sending them to the server. + * A value less than 1 specifies to use less than the full view (screen). + * A value greater than 1 specifies to fetch an area that extends beyond the edges of the current view. + */ + getViewBoundScale(): number; + + /** + * Scales the BBOX parameters before sending them to the server. + * A value less than 1 specifies to use less than the full view (screen). + * A value greater than 1 specifies to fetch an area that extends beyond the edges of the current view. + */ + setViewBoundScale(viewBoundScale: number): void; + + /** + * Specifies the format of the query string that is appended to the Link's href before the file is fetched. + * (If the href specifies a local file, this element is ignored.) + */ + getViewFormat(): string; + + /** + * Specifies the format of the query string that is appended to the Link's href before the file is fetched. + * (If the href specifies a local file, this element is ignored.) + */ + setViewFormat(viewFormat: string): void; + } + + /** + * Controls time in the plugin. + */ + export class GETime { + + /** + * Set the plugin's clock rate. + * A value of 1 corresponds with real time; to pass one year in the plugin for every real second, set the rate to 31536000 (60 times 60 times 24 times 365). + */ + setRate(rate: number): void; + + /** + * Get the current plugin clock rate. + */ + getRate(): number; + + /** + * Returns the current computer clock time as a KmlTimeStamp object. + */ + getSystemTime(): KmlTimeStamp; + + /** + * Returns the GETimeControl object; this is the time slider. + */ + getControl(): GETimeControl; + + /** + * Whether or not historical imagery is enabled. + */ + getHistoricalImageryEnabled(): boolean; + + /** + * Turn historical imagery on or off. + * For more information, read the Time chapter of the Developer's Guide. + */ + setHistoricalImageryEnabled(historicalImageryEnabled: boolean): void; + + /** + * Get the current plugin time as a KmlTimeStamp or KmlTimeSpan. + */ + getTimePrimitive(): KmlTimePrimitive; + + /** + * Sets the current plugin time. + */ + setTimePrimitive(timePrimitive: KmlTimePrimitive): void; + } + + /** + * Used to manipulate the behavior of the Google Earth options such as, navigation, flyToSpeed, scroll wheel speed and so on. + */ + export class GEOptions { + + /** + * Sets the map type to Earth or sky mode. + */ + setMapType(type: GEMapTypeEnum): void; + + /** + * Speed of zoom when user rolls the mouse wheel. Default is 1. + * Set to a negative number to reverse the zoom direction. + */ + getScrollWheelZoomSpeed(): number; + + /** + * Speed of zoom when user rolls the mouse wheel. Default is 1. + * Set to a negative number to reverse the zoom direction. + */ + setScrollWheelZoomSpeed(scrollWheelZoomSpeed: number): void; + + /** + * Specifies the speed at which the camera moves (0 to 5.0). + * Set to SPEED_TELEPORT to immediately appear at selected destination. + * + * See also: + * + * * GEPlugin.SPEED_TELEPORT + */ + getFlyToSpeed(): number; + + /** + * Specifies the speed at which the camera moves (0 to 5.0). + * Set to SPEED_TELEPORT to immediately appear at selected destination. + * + * See also: + * + * * GEPlugin.SPEED_TELEPORT + */ + setFlyToSpeed(flyToSpeed: number): void; + + /** + * Show or hide the status bar. Disabled by default. + */ + getStatusBarVisibility(): boolean; + + /** + * Show or hide the status bar. Disabled by default. + */ + setStatusBarVisibility(statusBarVisibility: boolean): void; + + /** + * Show or hide the grid. Disabled by default. + */ + getGridVisibility(): boolean; + + /** + * Show or hide the grid. Disabled by default. + */ + setGridVisibility(gridVisibility: boolean): void; + + /** + * Show or hide the overview map. Disabled by default. + */ + getOverviewMapVisibility(): boolean; + + /** + * Show or hide the overview map. Disabled by default. + */ + setOverviewMapVisibility(overviewMapVisibility: boolean): void; + + /** + * Show or hide the scale legend. Disabled by default. + */ + getScaleLegendVisibility(): boolean; + + /** + * Show or hide the scale legend. Disabled by default. + */ + setScaleLegendVisibility(scaleLegendVisibility: boolean): void; + + /** + * Show or hide the blue atmosphere that appears around the perimeter of the Earth. + * On by default. + */ + getAtmosphereVisibility(): boolean; + + /** + * Show or hide the blue atmosphere that appears around the perimeter of the Earth. + * On by default. + */ + setAtmosphereVisibility(atmosphereVisibility: boolean): void; + + /** + * Enable or disable user panning and zooming of the map. Enabled by default. + * + * Note: This also enables and disables keyboard navigation (arrow keys, page-up/page-down, etc). + */ + getMouseNavigationEnabled(): boolean; + + /** + * Enable or disable user panning and zooming of the map. Enabled by default. + * + * Note: This also enables and disables keyboard navigation (arrow keys, page-up/page-down, etc). + */ + setMouseNavigationEnabled(mouseNavigationEnabled: boolean): void; + + /** + * Returns true if the animation of features as they are added or removed from the globe has been enabled. + */ + getFadeInOutEnabled(): boolean; + + /** + * Enable or disable the animation of a feature when it is added or removed from the Google Earth plugin. + * The animation consists of a slight change of scale. Default is true. + */ + setFadeInOutEnabled(fadeInOutEnabled: boolean): void; + + /** + * Returns true if display units are set to imperial units (feet and miles). + * False denotes metric units (meters and kilometers). + */ + getUnitsFeetMiles(): boolean; + + /** + * Set display units to imperial (feet and miles) or metric (meters and kilometers). + * This setting affects only the values displayed in the status bar and the scale bar. + * The values passed and returned with an object's getters and setters are always metric. + */ + setUnitsFeetMiles(unitsFeetMiles: boolean): void; + + /** + * Enables or disables building selection. + * If enabled, clicking a building will pop a feature balloon containing information from the Google 3D Warehouse database. + */ + setBuildingSelectionEnabled(buildingSelectionEnabled: boolean): void; + + /** + * Whether or not building selection is enabled. + */ + getBuildingSelectionEnabled(): boolean; + + /** + * Returns true if building highlighting is enabled. + */ + getBuildingHighlightingEnabled(): boolean; + + /** + * Enables or disables building highlighting. + * When enabled, buildings will be highlighted when they are moused over. + */ + setBuildingHighlightingEnabled(buildingHighlightingEnabled: boolean): void; + + /** + * Returns the terrain exaggeration value. Valid values are in the range of 1.0 through 3.0. + */ + getTerrainExaggeration(): number; + + /** + * Set the terrain exaggeration value. Valid values are in the range of 1.0 through 3.0. + * Attempting to set outside of this range will result in the value being clamped. + */ + setTerrainExaggeration(terrainExaggeration: number): void; + + /** + * When enabled, the view will change to 'ground level view' when the camera reaches ground level. + * This view provides pan and lookAt controls, but no zoom slider. + * The tilt will be set to 90, or parallel with level ground. + */ + setAutoGroundLevelViewEnabled(autoGroundLevelViewEnabled: boolean): void; + + /** + * Whether automatic ground level view is enabled. + */ + getAutoGroundLevelViewEnabled(): boolean; + } + + /** + * Adds a node to the end of the list of children of a specified feature. + * Returns the appended object. + */ + export class GESchemaObjectContainer { + + /** + * Adds a node to the end of the list of children of a specified feature. + * Returns the appended object. + */ + appendChild(object: T): void; + + /** + * Removes a node from the list of children of a specified object. + */ + removeChild(oldChild: T): void; + + /** + * Inserts a child before the referenced child in the list of objects. + */ + insertBefore(newChild: T, refChild: T): void; + + /** + * Replaces existing child in the list of features. + * Returns the old child. + */ + replaceChild(newChild: T, oldChild: T): void; + + /** + * Returns true if the container is not empty. + */ + hasChildNodes(): boolean; + + /** + * First child in the list of objects. + */ + getFirstChild(): T; + + /** + * Last child in the list of objects. + */ + getLastChild(): T; + + /** + * List of features (for KmlContainer), or list of features, styles, and schemas (for KmlDocument). + * Returns true if there are any child nodes. + */ + getChildNodes(): KmlObjectList; + } + + /** + * A container class that holds one or more features and allows the creation of nested hierarchies. + */ + export class GEFeatureContainer extends GESchemaObjectContainer {} + + /** + * A container object that contains an array of geometries, typically the children of a multi-geometry. + */ + export class GEGeometryContainer extends GESchemaObjectContainer {} + + /** + * A container object that contains an array of closed line strings, typically the outer boundary of a Polygon. + * Optionally, a LinearRing can also be used as the inner boundary of a Polygon to create holes in the Polygon. + * A Polygon can contain multiple LinearRing objects used as inner boundaries. + */ + export class GELinearRingContainer extends GESchemaObjectContainer {} + + /** + * A container that holds a collection of KmlStyle and KmlStyleMap objects. + * The KmlStyleMap object selects a style based on the current mode of the Placemark. + * An object derived from KmlStyleSelector is uniquely identified by its ID and its URL. + */ + export class GEStyleSelectorContainer extends GESchemaObjectContainer {} + + /** + * Defines the x and y coordinates of a 2D vector. + */ + export class KmlVec2 { + + /** + * Sets the coordinates of the vector. + */ + set( + x: number, + xUnits: KmlUnitsEnum, + y: number, + yUnits: KmlUnitsEnum + ): void; + + /** + * Indicates the x coordinate. + */ + getX(): number; + + /** + * Indicates the x coordinate. + */ + setX(x: number): void; + + /** + * Indicates the y coordinate. + */ + getY(): number; + + /** + * Indicates the y coordinate. + */ + setY(y: number): void; + + /** + * Units in which the x value is specified. + * + * See also: + * + * * GEPlugin.UNITS_FRACTION + * * GEPlugin.UNITS_PIXELS + * * GEPlugin.UNITS_INSET_PIXELS + */ + getXUnits(): KmlUnitsEnum; + + /** + * Units in which the x value is specified. + * + * See also: + * + * * GEPlugin.UNITS_FRACTION + * * GEPlugin.UNITS_PIXELS + * * GEPlugin.UNITS_INSET_PIXELS + */ + setXUnits(xUnits: KmlUnitsEnum): void; + + /** + * Units in which the y value is specified. + * + * See also: + * + * * GEPlugin.UNITS_FRACTION + * * GEPlugin.UNITS_PIyELS + * * GEPlugin.UNITS_INSET_PIyELS + */ + getYUnits(): KmlUnitsEnum; + + /** + * Units in which the y value is specified. + * + * See also: + * + * * GEPlugin.UNITS_FRACTION + * * GEPlugin.UNITS_PIyELS + * * GEPlugin.UNITS_INSET_PIyELS + */ + setYUnits(xUnits: KmlUnitsEnum): void; + } + + /** + * The GESun class controls the dawn to dusk views. + */ + export class GESun { + + /** + * Specifies whether the feature is drawn in the 3D viewer when it is initially loaded. + * In order for a feature to be visible, the visibility property and all of its ancestors must also be set to 1. + */ + getVisibility(): boolean; + + /** + * Specifies whether the feature is drawn in the 3D viewer when it is initially loaded. + * In order for a feature to be visible, the visibility property and all of its ancestors must also be set to 1. + */ + setVisibility(visibility: boolean): void; + } + + /** + * The KmlColor object values are expressed in hexadecimal notation. + * The range of values for any one color component is 0 to 255 (00 to ff). + * For alpha, 00 is fully transparent and ff is fully opaque. + * The order of expression is aabbggrr, where aa=alpha (00 to ff); bb=blue (00 to ff); gg=green (00 to ff); rr=red (00 to ff). + * For example, if you want to apply a blue color with 50 percent opacity to an overlay, + * you would specify the following when setting color value: 7fff0000, where alpha=0x7f, blue=0xff, green=0x00, and red=0x00. + */ + export class KmlColor { + + /** + * Set the color of an object. + */ + set(color: string): void; + + /** + * Returns the color of an object. + */ + get(): string; + + /** + * red numerical value + */ + getR(): number; + + /** + * red numerical value + */ + setR(r: number): void; + + /** + * green numerical value + */ + getG(): number; + + /** + * green numerical value + */ + setG(g: number): void; + + /** + * blue numerical value + */ + getB(): number; + + /** + * blue numerical value + */ + setB(b: number): void; + + /** + * opacity value + */ + getA(): number; + + /** + * opacity value + */ + setA(a: number): void; + } + + /** + * The event object used with all KMLObjects. + * For more information about events, see the Document Object Model Events specification at http: + */ + export class KmlEvent { + + /** + * Cancels the default action of the event. + * For example, calling this method in a placemark click handler prevents the placemark's default balloon from popping up. + */ + preventDefault(): void; + + /** + * Prevents event propagation. + * For example, if click event handlers are set up on both the GEGlobe and GEWindow objects, + * and stopPropagation is called in the GEGlobe click event handler, the GEWindow event handler will not be triggered when the globe is clicked. + */ + stopPropagation(): void; + + /** + * The object to which the KMLEvent was originally dispatched. + */ + getTarget(): GEEventEmitter; + + /** + * The target whose event listeners are currently being processed. + */ + getCurrentTarget: GEEventEmitter; + + /** + * The current stage of the flow of events. + */ + getEventPhase(): GEEventPhaseEnum; + + /** + * Indicates whether or not an event is a bubbling event. + */ + getBubbles(): boolean; + + /** + * Indicates whether the event can be cancelled. + * + * Note: Currently, cancelable has no effect. + */ + getCancelable(): boolean; + } + + /** + * Represents a mouse input event. + */ + export class KmlMouseEvent extends KmlEvent { + + /** + * The button on the mouse was pressed. + * Possible values include 0, 1, 2, where 0 is left, 1 is middle, and 2 is right mouse key. + */ + getButton(): number; + + /** + * The x coordinate at which the event occurred, measured in pixels from the left edge of the plug-in window. + */ + getClientX(): number; + + /** + * The y coordinate at which the event occurred, measured in pixels from the top edge of the plug-in window. + */ + getClientY(): number; + + /** + * The x coordinate at which the event occurred, measured in pixels from the left edge of the computer screen. + */ + getScreenX(): number; + + /** + * The y coordinate at which the event occurred, measured in pixels from the top edge of the computer screen. + */ + getScreenY(): number; + + /** + * The latitude at which the event occurred, in decimal degrees. + */ + getLatitude(): number; + + /** + * The longitude at which the event occurred, in decimal degrees. + */ + getLongitude(): number; + + /** + * The altitude at which the event occurred, in meters. + */ + getAltitude(): number; + + /** + * Indicates whether a mouse action occurred while on the Google Earth globe. + */ + getDidHitGlobe(): boolean; + + /** + * Indicates whether the ALT key was held down when an event occurred. + */ + getAltKey(): boolean; + + /** + * Indicates whether the CTRL key was held down when an event occurred. + */ + getCtrlKey(): boolean; + + /** + * Indicates whether the SHIFT key was held down when an event occurred. + */ + getShiftKey(): boolean; + + /** + * Used with the mouseover and mouseout events to specify a secondary target. + * For mouseover, it specifies the object that the mouse was over. + * For mouseout, it specifies the new object that the mouse is over. + */ + getRelatedTarget(): GEEventEmitter; + + /** + * Returns the timestamp of the event, in Unix time. + */ + getTimeStamp(): number; + } + + /** + * Defines when and how an event gets passed in and triggered from the Google Earth Plug-in. + */ + export class GEEventEmitter { + + /** + * Triggers an event when the user clicks a location in Google Earth with the mouse. + */ + click(event: KmlMouseEvent): void; + + /** + * Triggers an event when the user double clicks a location in Google Earth with the mouse. + */ + dblclick(event: KmlMouseEvent): void; + + /** + * Triggers an event when the user moves the mouse pointer over a location in Google Earth. + */ + mouseover(event: KmlMouseEvent): void; + + /** + * Triggers an event when the user presses the mouse button over a location in Google Earth. + */ + mousedown(event: KmlMouseEvent): void; + + /** + * Triggers an event when the user releases the mouse button over a location in Google Earth. + */ + mouseup(event: KmlMouseEvent): void; + + /** + * Triggers an event when the user moves the mouse off of the object in Google Earth. + */ + mouseout(event: KmlMouseEvent): void; + + /** + * Triggers an event when the user moves the mouse inside Google Earth. + */ + mousemove(event: KmlMouseEvent): void; + } + + /** + * The base class for all the other objects in the Google Earth Plug-in. + * The methods and behavior of KMLObject are inherited by all other objects. + * This is an abstract base class and cannot be used directly. + * It provides the id attribute, which allows unique identification of an object. + */ + export class KmlObject extends GEEventEmitter { + + /** + * The interface name (i.e. 'KmlPlacemark') of the object. + */ + getType(): string; + + /** + * Test whether this object is the same as another object. + * Useful for Chrome and Safari, where the comparison a==b sometimes fails for plugin objects. + */ + equals(compareTo: KmlObject): boolean; + + /** + * The unique ID of the KML object. + */ + getId(): string; + + /** + * The unique URL of the KML object. + * This is the base address joined with the ID using the # character. + * + * For example: http://www.google.com/bar.kml#atlantis + */ + getUrl(): string; + + /** + * The parent node of the KML object. + */ + getParentNode(): KmlObject; + + /** + * The document that owns the KML object. + */ + getOwnerDocument(): KmlDocument; + + /** + * Permanently deletes an object, allowing its ID to be reused. + * Attempting to access the object once it is released will result in an error. + */ + release(): void; + } + + /** + * A collection of KmlObjects. + */ + export class KmlObjectList { + + /** + * Gets an item from the object list. For example, list.item(0) returns the first object in the list. + */ + item(index: number): T; + + /** + * Number of objects in collection. + */ + getLength(): number; + } + + /** + * The base class for KmlStyle and KmlStyleMap. + */ + export class KmlStyleSelector extends KmlObject {} + + /** + * Defines the icon, label, line, list, polygon, and balloon styles. + */ + export class KmlStyle extends KmlStyleSelector { + + /** + * Specifies how icons for point placemarks are drawn in Google Earth. + */ + getIconStyle(): KmlIconStyle; + + /** + * Specifies how the name of a feature is drawn in the 3D viewer. + * A custom color, color mode, and scale for the label (name) can be specified. + */ + getLabelStyle(): KmlLabelStyle; + + /** + * Specifies the drawing style (color, color mode, and line width) for line geometry. + * Line geometry includes the outlines of outlined polygons and the extruded tether of Placemark icons (if extrusion is enabled). + */ + getLineStyle(): KmlLineStyle; + + /** + * Specifies the style for list geometry. + */ + getListStyle(): KmlListStyle; + + /** + * Specifies the drawing style for polygons, including polygon extrusions (which look like the walls of buildings) and line extrusions (which look like solid fences). + */ + getPolyStyle(): KmlPolyStyle; + + /** + * Specifies the drawing style for balloons. + */ + getBalloonStyle(): KmlBalloonStyle; + } + + /** + * The KmlColorStyle object is an abstract object. + * It specifies the color and color mode of extended style types. + */ + export class KmlColorStyle extends KmlObject { + + /** + * Color and opacity (alpha) values. + */ + getColor(): KmlColor; + + /** + * Specifies which color mode effect to apply to the base color. + * + * See also: + * + * * GEPlugin.COLOR_NORMAL + * * GEPlugin.COLOR_INHERIT + * * GEPlugin.COLOR_RANDOM + */ + getColorMode(): KmlColorModeEnum; + + /** + * Specifies which color mode effect to apply to the base color. + * + * See also: + * + * * GEPlugin.COLOR_NORMAL + * * GEPlugin.COLOR_INHERIT + * * GEPlugin.COLOR_RANDOM + */ + setColorMode(colorMode: KmlColorModeEnum): void; + } + + /** + * Specifies how icons for point placemarks are drawn in Google Earth. + * The icon property specifies the icon image. + * The scale property specifies the x, y scaling of the icon. + * The color specified in the color property of KmlIconStyle is blended with the color of the Icon. + */ + export class KmlIconStyle extends KmlColorStyle { + + /** + * Resizes the icon. + */ + getScale(): number; + + /** + * Resizes the icon. + */ + setScale(scale: number): void; + + /** + * The direction that icons are set to point, clockwise, and in degrees. + */ + getHeading(): number; + + /** + * The direction that icons are set to point, clockwise, and in degrees. + */ + setHeading(): number; + + /** + * A custom Icon. In KmlIconStyle, the only child element of KmlIcon is href and href is an HTTP address or a local file specification used to load an icon. + */ + getIcon(): KmlIcon; + + /** + * A custom Icon. In KmlIconStyle, the only child element of KmlIcon is href and href is an HTTP address or a local file specification used to load an icon. + */ + setIcon(icon: KmlIcon): void; + + /** + * Specifies the position within the Icon that is anchored to the point specified in the placemark. + * The x and y values can be specified in three different ways: as pixels, as fractions of the icon, or as inset pixels, which is an offset in pixels from the upper right corner of the icon. + * The x and y positions can be specified in different ways. + * For example, x can be in pixels and y can be a fraction. + * The origin of the coordinate system is in the lower left corner of the icon. + */ + getHotSpot(): KmlVec2; + } + + /** + * Specifies how the name of a feature is drawn in the 3D viewer. + * A custom color, color mode, and scale for the label (name) can be specified. + */ + export class KmlLabelStyle extends KmlColorStyle { + + /** + * Resizes the label. + */ + getScale(): number; + + /** + * Resizes the label. + */ + setScale(scale: number): void; + } + + /** + * The KmlLineStyle object specifies the drawing style (color, color mode, and line width) for all line geometry. + * Line geometry includes the outlines of outlined polygons and the extruded "tether" of Placemark icons (if extrusion is enabled). + */ + export class KmlLineStyle extends KmlColorStyle { + + /** + * Width of the line, in pixels. + */ + getWidth(): number; + + /** + * Width of the line, in pixels. + */ + setWidth(width: number): void; + } + + /** + * Specifies the drawing style for all polygons, including polygon extrusions (which look like the walls of buildings) and line extrusions (which look like solid fences). + */ + export class KmlPolyStyle extends KmlColorStyle { + + /** + * Specifies whether or not to fill the polygon. Possible values 1 (fill) and 0 (no fill). + */ + getFill(): boolean; + + /** + * Specifies whether or not to fill the polygon. Possible values 1 (fill) and 0 (no fill). + */ + setFill(fill: boolean): void; + + /** + * Specifies whether to outline the polygon. Polygon outlines use the current KmlLineStyle. + */ + getOutline(): boolean; + + /** + * Specifies whether to outline the polygon. Polygon outlines use the current KmlLineStyle. + */ + setOutline(outline: boolean): void; + } + + /** + * Specifies how a feature is displayed in the list view. + */ + export class KmlListStyle extends KmlObject { + + /** + * Background color for the Snippet. + */ + getBgColor(): KmlColor; + + /** + * Maximum number of lines of text for the Snippet. + */ + getMaxSnippetLines(): number; + + /** + * Maximum number of lines of text for the Snippet. + */ + setMaxSnippetLines(maxSnippetLines: number): void; + + /** + * Specifies how a feature should be displayed in a list view. + */ + getListItemType(): KmlListItemTypeEnum; + } + + /** + * Specifies how the description balloon for placemarks is drawn. + */ + export class KmlBalloonStyle extends KmlObject { + + /** + * Background color of the balloon (optional). + */ + getBgColor(): KmlColor; + + /** + * Foreground color for text. The default is black (ff000000). + */ + getTextColor(): KmlColor; + + /** + * The text contained in the balloon. + */ + getText(): string; + + /** + * The text contained in the balloon. + */ + setText(text: string): void; + } + + /** + * Specifies the top, bottom, right, and left sides of a bounding box on the Earth's surface. + */ + export class KmlLatLonBox extends KmlObject { + + /** + * Sets the north, south, east, and west edges of the bounding box, as well as the rotation of the overlay. + */ + setBox( + north: number, + south: number, + east: number, + west: number, + rotation: number + ): void; + + /** + * Specifies the latitude of the north edge of the bounding box, in decimal degrees from -90 to 90. + */ + getNorth(): number; + + /** + * Specifies the latitude of the north edge of the bounding box, in decimal degrees from -90 to 90. + */ + setNorth(north: number): void; + + /** + * Specifies the latitude of the south edge of the bounding box, in decimal degrees from -90 to 90. + */ + getSouth(): number; + + /** + * Specifies the latitude of the south edge of the bounding box, in decimal degrees from -90 to 90. + */ + setSouth(south: number): void; + + /** + * Specifies the longitude of the east edge of the bounding box, in decimal degrees from -180 to 180. + * (For overlays that overlap the meridian of 180 degrees longitude, values can extend beyond that range.) + */ + getEast(): number; + + /** + * Specifies the longitude of the east edge of the bounding box, in decimal degrees from -180 to 180. + * (For overlays that overlap the meridian of 180 degrees longitude, values can extend beyond that range.) + */ + setEast(east: number): void; + + /** + * Specifies the longitude of the west edge of the bounding box, in decimal degrees from -180 to 180. + * (For overlays that overlap the meridian of 180 degrees longitude, values can extend beyond that range.) + */ + getWest(): number; + + /** + * Specifies the longitude of the west edge of the bounding box, in decimal degrees from -180 to 180. + * (For overlays that overlap the meridian of 180 degrees longitude, values can extend beyond that range.) + */ + setWest(west: number): void; + + /** + * Specifies a rotation of the overlay about its center, in degrees. + * Values can be +/-180. The default is 0 (north). + * Rotations are specified in a counterclockwise direction. + */ + getRotation(): number; + + /** + * Specifies a rotation of the overlay about its center, in degrees. + * Values can be +/-180. The default is 0 (north). + * Rotations are specified in a counterclockwise direction. + */ + setRotation(rotation: number): void; + } + + /** + * Specifies a bounding box that describes an area of interest defined by geographic coordinates and altitudes. + */ + export class KmlLatLonAltBox extends KmlLatLonBox { + + /** + * Sets the north, south, east, west, rotation, minAltitude, maxAltitude, and altitudeMode of bounding box. + */ + setAltBox( + north: number, + south: number, + east: number, + west: number, + rotation: number, + minAltitude: number, + maxAltitude: number, + altitudeMode: KmlAltitudeModeEnum + ): void; + + /** + * Minimum altitude, specified in meters above sea level. + */ + getMinAltitude(): number; + + /** + * Minimum altitude, specified in meters above sea level. + */ + setMinAltitude(minAltitude: number): void; + + /** + * Maximim altitude, specified in meters above sea level. + */ + getMaxAltitude(): number; + + /** + * Maximim altitude, specified in meters above sea level. + */ + setMaxAltitude(maxAltitude: number): void; + + /** + * Specifies how the altitude property is interpreted. + * + * See also: + * + * * GEPlugin.ALTITUDE_CLAMP_TO_GROUND + * * GEPlugin.ALTITUDE_RELATIVE_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_CLAMP_TO_SEA_FLOOR + * * GEPlugin.ALTITUDE_RELATIVE_TO_SEA_FLOOR + */ + getAltitudeMode(): KmlAltitudeModeEnum; + + /** + * Specifies how the altitude property is interpreted. + * + * See also: + * + * * GEPlugin.ALTITUDE_CLAMP_TO_GROUND + * * GEPlugin.ALTITUDE_RELATIVE_TO_GROUND + * * GEPlugin.ALTITUDE_ABSOLUTE + * * GEPlugin.ALTITUDE_CLAMP_TO_SEA_FLOOR + * * GEPlugin.ALTITUDE_RELATIVE_TO_SEA_FLOOR + */ + setAltitudeMode(altitudeMode: KmlAltitudeModeEnum): number; + } + + /** + * The KmlLod or level of detail, describes the size of the projected region on the screen that is required in order for the region to be considered active. + * Also specifies the size of the pixel ramp used for fading in (from transparent to opaque) and fading out (from opaque to transparent). + */ + export class KmlLod extends KmlObject { + + /** + * Sets the minLodPixels, maxLodPixels, minFadeExtent, and maxFadeExtent for the projected region on the screen. + */ + set( + minLodPixels: number, + maxLodPixels: number, + minFadeExtent: number, + maxFadeExtent: number + ): void; + + /** + * Specifies measurement in screen pixels that represents the minimum limit of the visibility range for a given Region. + * Google Earth calculates the size of the region when projected onto screen space. + * Then it computes the square root of the region's area (if, for example, the Region is square and the viewpoint is directly above the Region, and the Region is not tilted, this measurement is equal to the width of the projected Region). + * If this measurement falls within the limits defined by minLodPixels and maxLodPixels (and if the LatLonAltBox is in view), the region is active. + * If this limit is not reached, the associated geometry is considered to be too far from the user's viewpoint to be drawn. + */ + getMinLodPixels(): number; + + /** + * Specifies measurement in screen pixels that represents the minimum limit of the visibility range for a given Region. + * Google Earth calculates the size of the region when projected onto screen space. + * Then it computes the square root of the region's area (if, for example, the Region is square and the viewpoint is directly above the Region, and the Region is not tilted, this measurement is equal to the width of the projected Region). + * If this measurement falls within the limits defined by minLodPixels and maxLodPixels (and if the LatLonAltBox is in view), the region is active. + * If this limit is not reached, the associated geometry is considered to be too far from the user's viewpoint to be drawn. + */ + setMinLodPixels(minLodPixels: number): void; + + /** + * Measurement in screen pixels that represents the maximum limit of the visibility range for a given Region. + * A value of -1, the default, indicates "active to infinite size." + */ + getMaxLodPixels(): number; + + /** + * Measurement in screen pixels that represents the maximum limit of the visibility range for a given Region. + * A value of -1, the default, indicates "active to infinite size." + */ + setMaxLodPixels(maxLogPixels: number): void; + + /** + * Distance over which the geometry fades, from fully opaque to fully transparent. + * This ramp value, expressed in screen pixels, is applied at the minimum end of the LOD (visibility) limits. + */ + getMinFadeExtent(): number; + + /** + * Distance over which the geometry fades, from fully opaque to fully transparent. + * This ramp value, expressed in screen pixels, is applied at the minimum end of the LOD (visibility) limits. + */ + setMinFadeExtent(minFadeExtent: number): void; + + /** + * Distance over which the geometry fades, from fully transparent to fully opaque. + * This ramp value, expressed in screen pixels, is applied at the maximum end of the LOD (visibility) limits. + */ + getMaxFadeExtent(): number; + + /** + * Distance over which the geometry fades, from fully transparent to fully opaque. + * This ramp value, expressed in screen pixels, is applied at the maximum end of the LOD (visibility) limits. + */ + setMaxFadeExtent(maxFadeExtent: number): void; + } + + /** + * The KmlRegion object is used to set region objects and their properties. + * A region contains a bounding box (LatLonAltBox) that describes an area of interest defined by geographic coordinates and altitudes. + * In addition, a Region contains an LOD (level of detail) extent that defines a validity range of the associated Region in terms of projected screen size. + * A Region is said to be "active" when the bounding box is within the user's view and the LOD requirements are met. + * Objects associated with a Region are drawn only when the Region is active. + * When the viewRefreshMode is onRegion, the Link or Icon is loaded only when the Region is active. + */ + export class KmlRegion extends KmlObject { + + /** + * Sets the latLonAltBox and lod for the region. + */ + set(latLonAltBox: KmlLatLonAltBox, lod: KmlLod): void; + + /** + * A bounding box that describes an area of interest defined by geographic coordinates and altitudes. + */ + getLatLonAltBox(): KmlLatLonAltBox; + + /** + * A bounding box that describes an area of interest defined by geographic coordinates and altitudes. + */ + setLatLonAltBox(latLonAltBox: KmlLatLonAltBox): void; + + /** + * LOD is an abbreviation for Level of Detail. + * Lod describes the size of the projected region on the screen that is required in order for the region to be considered "active. + * " Also specifies the size of the pixel ramp used for fading in (from transparent to opaque) and fading out (from opaque to transparent). + */ + getLod(): KmlLod; + + /** + * LOD is an abbreviation for Level of Detail. + * Lod describes the size of the projected region on the screen that is required in order for the region to be considered "active. + * " Also specifies the size of the pixel ramp used for fading in (from transparent to opaque) and fading out (from opaque to transparent). + */ + setLod(lod: KmlLod): void; + } + + /** + * Represents a specific point in time. + * The plugin accepts time in this format only; it does not accept JavaScript date or time objects. + */ + export class KmlDateTime { + + /** + * Set the date. Accepts only XML Schema time (see XML Schema Part 2: Datatypes Second Edition). + * The value can be expressed as yyyy-mm-ddThh:mm:sszzzzzz, where T is the separator between the date and the time, + * and the time zone is either Z(for UTC) or zzzzzz, which represents +/-hh:mm in relation to UTC. + * Additionally, the value can be expressed as a date only. + */ + set(date: string): void; + + /** + * Returns the date and time in XML Schema time format. + */ + get(): string; + } + + /** + * An abstract object and cannot be used directly in a JavaScript file. + * This element is extended by the TimeSpan and TimeStamp objects. + */ + export class KmlTimePrimitive extends KmlObject {} + + /** + * Represents a single moment in time. + * This is a simple element and contains no children. + * Its value is a dateTime, specified in XML time. + * The precision of the TimeStamp is dictated by the dateTime value in the when property. + */ + export class KmlTimeStamp extends KmlTimePrimitive { + + /** + * Represents a single moment in time. + * This is a simple element and contains no children. + * Its value is a dateTime, specified in XML time. + * The precision of the TimeStamp is dictated by the dateTime value in the when property. + * + * * dateTime gives second resolution + * * date gives day resolution + * * gYearMonth gives month resolution + * * gYear gives year resolution + */ + getWhen(): KmlDateTime; + } + + /** + * Represents an extent in time bounded by begin and end dateTimes. + */ + export class KmlTimeSpan extends KmlTimePrimitive { + + /** + * Describes the beginning instant of a time period. + * If absent, the beginning of the period is unbounded. + */ + getBegin(): KmlDateTime; + + /** + * Describes the ending instant of a time period. + * If absent, the end of the period is unbounded. + */ + getEnd(): KmlDateTime; + } + + /** + * This is an abstract class and cannot be created directly. + * This class is extended by KmlCamera and KmlLookAt. + */ + export class KmlAbstractView extends KmlObject { + + /** + * Creates a new KmlLookAt object that matches as closely as possible this KmlAbstractView. + * KmlLookAt is unable to represent roll, so roll values in the current view will not be passed to the new KmlLookAt object. + * + * If this view is already a KmlLookAt, this function returns a new KmlLookAt representing the same view. + */ + copyAsLookAt(): KmlLookAt; + + /** + * Creates a new KmlCamera object that matches this KmlAbstractView. + * + * If this view is already a KmlCamera, this function returns a new KmlCamera representing the same view. + */ + copyAsCamera(): KmlCamera; + + /** + * Returns the KmlTimeStamp or KmlTimeSpan object associated with this view. + */ + getTimePrimitive(): KmlTimePrimitive; + + /** + * Associate a KmlTimeStamp or KmlTimeSpan object with this view. + */ + setTimePrimitive(timePrimitive: KmlTimePrimitive): void; + + /** + * Returns the viewer options on the current view. + * + * See also: + * + * * GEPlugin.OPTION_STREET_VIEW + * * GEPlugin.OPTION_SUNLIGHT + * * GEPlugin.OPTION_HISTORICAL_IMAGERY + */ + getViewerOptions(): KmlViewerOptions; + + /** + * Sets the viewer options on the current view. + * + * See also: + * + * * GEPlugin.OPTION_STREET_VIEW + * * GEPlugin.OPTION_SUNLIGHT + * * GEPlugin.OPTION_HISTORICAL_IMAGERY + */ + setViewerOptions(viewerOptions: KmlViewerOptions): void; + } + + /** + * Defines a camera that is associated with anything derived from feature. + * The LookAt element positions the "camera" in relation to the object that is being viewed. + * This class either positions the relative to a feature, or you can manually change the view, using ge.getView().setAbstractView(). + */ + export class KmlLookAt extends KmlAbstractView { + + /** + * Sets the latitude, longitude, altitude, altitudeMode, heading, tilt, and range for the camera. + */ + set ( + latitude: number, + longitude: number, + altitude: number, + altitudeMode: KmlAltitudeModeEnum, + heading: number, + tilt: number, + range: number + ): void; + + /** + * Latitude of the point the camera is looking at. + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + getLatitude(): number; + + /** + * Latitude of the point the camera is looking at. + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + setLatitude(latitude: number): void; + + /** + * Latitude of the point the camera is looking at. + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + getLongitude(): number; + + /** + * Latitude of the point the camera is looking at. + * Degrees north or south of the Equator (0 degrees). + * Values range from -90 degrees (South Pole) to 90 degrees (North Pole). + */ + setLongitude(longitude: number): void; + + /** + * The distance in meters from the point specified by longitude, latitude, and altitude for the LookAt position. + */ + getRange(): number; + + /** + * The distance in meters from the point specified by longitude, latitude, and altitude for the LookAt position. + */ + setRange(range: number): void; + + /** + * Angle between the direction of the LookAt position and the normal to the surface of the earth. + * Values range from 0 to 90 degrees. Values for tilt cannot be negative. + * A tilt value of 0 degrees indicates viewing from directly above. + * A tilt value of 90 degrees indicates viewing along the horizon. + */ + getTilt(): number; + + /** + * Angle between the direction of the LookAt position and the normal to the surface of the earth. + * Values range from 0 to 90 degrees. Values for tilt cannot be negative. + * A tilt value of 0 degrees indicates viewing from directly above. + * A tilt value of 90 degrees indicates viewing along the horizon. + */ + setTilt(tilt: number): void; + + /** + * Direction (that is, North, South, East, West), in degrees. Default=0 (North). Values range from 0 to 360 degrees. + */ + getHeading(): number; + + /** + * Direction (that is, North, South, East, West), in degrees. Default=0 (North). Values range from 0 to 360 degrees. + */ + setHeading(heading: number): void; + + /** + * Distance from the earth's surface, in meters. + */ + getAltitude(): number; + + /** + * Distance from the earth's surface, in meters. + */ + setAltitude(altitude: number): void; + + /** + * Specifies how altitude components in the coordinates element are interpreted. + */ + getAltitudeMode(): KmlAltitudeModeEnum; + + /** + * Specifies how altitude components in the coordinates element are interpreted. + */ + setAltitudeMode(altitudeMode: KmlAltitudeModeEnum): void; + } + + /** + * Defines the camera that views the scene. + * This element defines the position of the camera relative to the Earth's surface as well as the viewing direction of the camera. + * The camera position is defined by longitude, latitude, altitude, and altitudeMode. + * The viewing direction of the camera is defined by heading, tilt, and roll. + * Camera can be a child element of any feature. + */ + export class KmlCamera extends KmlAbstractView { + + /** + * Sets the latitude, longitude, altitude, alitudeMode, heading, tilt, and roll values. + */ + set( + latitude: number, + longitude: number, + altitude: number, + altitudeMode: KmlAltitudeModeEnum, + heading: number, + tilt: number, + roll: number + ): void; + + /** + * Latitude of the camera location. Degrees north or south of the Equator (0 degrees). Values range from -90 degrees to 90 degrees. + */ + getLatitude(): number; + + /** + * Latitude of the camera location. Degrees north or south of the Equator (0 degrees). Values range from -90 degrees to 90 degrees. + */ + setLatitude(latitude: number): void; + + /** + * Longitude of the camera location. Angular distance in degrees, relative to the Prime Meridian. Values west of the Meridian range from -180 to 0 degrees. + * Values east of the Meridian range from 0 to 180 degrees. + */ + getLongitude(): number; + + /** + * Longitude of the camera location. Angular distance in degrees, relative to the Prime Meridian. Values west of the Meridian range from -180 to 0 degrees. + * Values east of the Meridian range from 0 to 180 degrees. + */ + setLongitude(longitude: number): void; + + /** + * Distance from the earth's surface. + */ + getAltitude(): number; + + /** + * Distance from the earth's surface. + */ + setAltitude(altitude: number): void; + + /** + * Direction (that is, North, South, East, West), in degrees. Default=0 (North). Values range from 0 to 360 degrees. + */ + getHeading(): number; + + /** + * Direction (that is, North, South, East, West), in degrees. Default=0 (North). Values range from 0 to 360 degrees. + */ + setHeading(heading: number): void; + + /** + * Angle between the direction of the camera position and the normal to the surface of the earth. Values range from 0 to 360 degrees. + * A tilt value of 0 degrees indicates viewing from directly above, 90 degrees indicates viewing along the horizon, and 180 degrees indicates viewing straight up at the sky. + */ + getTilt(): number; + + /** + * Angle between the direction of the camera position and the normal to the surface of the earth. Values range from 0 to 360 degrees. + * A tilt value of 0 degrees indicates viewing from directly above, 90 degrees indicates viewing along the horizon, and 180 degrees indicates viewing straight up at the sky. + */ + setTilt(tilt: number): void; + + /** + * Rotation, in degrees, of the camera around the Z axis. Values range from -180 to +180 degrees. + */ + getRoll(): number; + + /** + * Rotation, in degrees, of the camera around the Z axis. Values range from -180 to +180 degrees. + */ + setRoll(roll: number): void; + + /** + * Specifies how altitude components in the coordinates are interpreted. + */ + getAltitudeMode(): KmlAltitudeModeEnum; + + /** + * Specifies how altitude components in the coordinates are interpreted. + */ + setAltitudeMode(altitudeMode: KmlAltitudeModeEnum): void; + } + + /** + * The KmlGeometry object is an abstract object and cannot be used directly. + * It provides a placeholder object for all derived Geometry objects. + */ + export class KmlGeometry extends KmlObject {} + + /** + * Specifies an AltitudeMode for derived classes. + */ + export class KmlAltitudeGeometry extends KmlGeometry { + + /** + * Specifies how altitude components in the geometry coordinates are interpreted. + */ + getAltitudeMode(): KmlAltitudeModeEnum; + + /** + * Specifies how altitude components in the geometry coordinates are interpreted. + */ + setAltitudeMode(altitudeMode: KmlAltitudeModeEnum): void; + } + + /** + * A 3D object described in a referenced COLLADA file. + * COLLADA files have a .dae file extension. + * Models are created in their own coordinate space and then located, positioned, and scaled in Google Earth. + * Google Earth supports the COLLADA common profile, with the following exceptions: + * + * * Google Earth supports only triangles and lines as primitive types. The maximum number of triangles allowed is 21845. + * * Google Earth does not support animation or skinning. + * * Google Earth does not support external geometry references. + */ + export class KmlModel extends KmlAltitudeGeometry { + + /** + * Specifies the exact coordinates of the Model's origin in latitude, longitude, and altitude. + * Latitude and longitude measurements are standard lat-lon projection with WGS84 datum. + * Altitude is distance above the earth's surface, in meters, and is interpreted according to altitudeMode. + */ + getLocation(): KmlLocation; + + /** + * Specifies the exact coordinates of the Model's origin in latitude, longitude, and altitude. + * Latitude and longitude measurements are standard lat-lon projection with WGS84 datum. + * Altitude is distance above the earth's surface, in meters, and is interpreted according to altitudeMode. + */ + setLocation(location: KmlLocation): void; + + /** + * Describes rotation of a 3D model's coordinate system to position the object in Google Earth. + */ + getOrientation(): KmlOrientation; + + /** + * Describes rotation of a 3D model's coordinate system to position the object in Google Earth. + */ + setOrientation(orientation: KmlOrientation): void; + + /** + * Scales a model along the x, y, and z axes in the model's coordinate space + */ + getScale(): KmlScale; + + /** + * Scales a model along the x, y, and z axes in the model's coordinate space + */ + setScale(scale: KmlScale): void; + + /** + * Returns the link of the collada model. + */ + getLink(): KmlLink; + + /** + * Sets the link of the collada model. + */ + setLink(link: KmlLink): void; + } + + /** + * A container for zero or more geometry primitives associated with the same feature. + */ + export class KmlMultiGeometry extends KmlGeometry { + + /** + * The collection of geometries that are children of this multi-geometry. + */ + getGeometries(): GEGeometryContainer; + } + + /** + * Specifies the behavior of the object's geometry. + */ + export class KmlExtrudableGeometry extends KmlAltitudeGeometry { + + /** + * Specifies whether to connect the geometry to the ground. + */ + getExtrude(): boolean; + + /** + * Specifies whether to connect the geometry to the ground. + */ + setExtrude(extrude: boolean): void; + + /** + * Specifies whether to allow the geometry to follow the terrain elevation. + */ + getTessellate(): boolean; + + /** + * Specifies whether to allow the geometry to follow the terrain elevation. + */ + setTessellate(tessellate: boolean): void; + } + + /** + * A Polygon is defined by an outer boundary and 0 or more inner boundaries. + * The boundaries, in turn, are defined by LinearRings. + * When a Polygon is extruded, its boundaries are connected to the ground to form additional polygons, which gives the appearance of a building or a box. + * Extruded Polygons use PolyStyle for their color, color mode, and fill. + */ + export class KmlPolygon extends KmlExtrudableGeometry { + + /** + * Contains a LinearRing element. + */ + getOuterBoundary(): KmlLinearRing; + + /** + * Contains a LinearRing element. + */ + setOuterBoundary(outerBoundary: KmlLinearRing): void; + + /** + * Contains a LinearRing element. + * You can specify multiple innerBoundary properties, which create multiple cut-outs inside the Polygon. + */ + getInnerBoundaries(): GELinearRingContainer; + } + + /** + * A geographic location defined by longitude, latitude, and (optional) altitude. + * When a Point is contained by a Placemark, the point itself determines the position of the Placemark's name and icon. + * When a Point is extruded, it is connected to the ground with a line. This tether uses the current LineStyle. + */ + export class KmlPoint extends KmlExtrudableGeometry { + + /** + * Sets altitudeMode, extrude, tessellate, latitude, longitude, and altitude values. + */ + set( + latitude: number, + longitude: number, + altitude: number, + altitudeMode: KmlAltitudeModeEnum, + extrude: boolean, + tessellate: boolean + ): void; + + /** + * Sets the latitude and longitude. + */ + setLatLng(latitude: number, longitude: number): void; + + /** + * The point's latitude, in degrees. + */ + getLatitude(): number; + + /** + * The point's latitude, in degrees. + */ + setLatitude(latitude: number): void; + + /** + * The point's longitude, in degrees. + */ + getLongitude(): number; + + /** + * The point's longitude, in degrees. + */ + setLongitude(longitude: number): void; + + /** + * The point's altitude, in meters. + */ + getAltitude(): number; + + /** + * The point's altitude, in meters. + */ + setAltitude(altitude: number): void; + } + + /** + * Defines a connected set of line segments. + * Use KmlLineStyle to specify the color, color mode, and width of the line. + * When a LineString is extruded, the line is extended to the ground, forming a polygon that looks somewhat like a wall or fence. + * For extruded LineStrings, the line itself uses the current LineStyle, and the extrusion uses the current PolyStyle. + */ + export class KmlLineString extends KmlExtrudableGeometry { + + /** + * Two or more coordinate tuples, each consisting of floating point values for longitude, latitude, and altitude. + * The altitude component is optional. + */ + getCoordinates(): KmlCoordArray; + + /** + * Added to the altitude values for all points on the line string. + * Adjusts the altitude of the feature as a whole, without the need to update each coordinate set. + */ + setAltitudeOffset(altitudeOffset: number): void; + + /** + * Returns the altitudeOffset, or 0 if not set. + */ + getAltitudeOffset(): number; + } + + /** + * Defines a closed line string, typically the outer boundary of a Polygon. + * Optionally, a LinearRing can also be used as the inner boundary of a Polygon to create holes in the Polygon. + * A Polygon can contain multiple LinearRing elements used as inner boundaries. + * You do not need to connect the first and last points. + */ + export class KmlLinearRing extends KmlLineString {} + + + /** + * The KmlFeature object is an abstract object and is the base for all feature types (for example Placemarks, Overlays, and NetworkLinks). + */ + export class KmlFeature extends KmlObject { + + /** + * Retrieves the contents of the feature's element. + * The retrieved contents are scrubbed to remove JavaScript; CSS; and iframe, embed, and object tags. + * + * It should be safe to insert the resulting HTML into your page without concern for malicious content embedded in the feature data; + * however any feature depending on CSS or Javascript will not work. + */ + getBalloonHtml(): string; + + /** + * Retrieves the contents of the feature's element. The contents are not scrubbed. + * Use this method only if you trust the source of the feature data. + */ + getBalloonHtmlUnsafe(): string; + + /** + * User-defined text displayed in the plugin as the label for the object (for example, for a Placemark). + */ + getName(): string; + + /** + * User-defined text displayed in the plugin as the label for the object (for example, for a Placemark). + */ + setName(name: string): void; + + /** + * Specifies whether the feature is drawn in the plugin. + * In order for a feature to be visible, the visibility of all its ancestors must also be set to true. + * In the Google Earth List View, each feature has a checkbox that allows the user to control visibility of the feature. + */ + getVisibility(): boolean; + + /** + * Specifies whether the feature is drawn in the plugin. + * In order for a feature to be visible, the visibility of all its ancestors must also be set to true. + * In the Google Earth List View, each feature has a checkbox that allows the user to control visibility of the feature. + */ + setVisibility(visibility: boolean): void; + + /** + * Default state of left panel. + */ + getOpen(): boolean; + + /** + * Default state of left panel. + */ + setOpen(open: boolean): void; + + /** + * Specifies a value representing an unstructured address written as a standard street, city, state address, and/or as a postal code. + */ + getAddress(): string; + + /** + * Specifies a value representing an unstructured address written as a standard street, city, state address, and/or as a postal code. + */ + setAddress(address: string): void; + + /** + * Specifies a short description of the feature. + */ + getSnippet(): string; + + /** + * Specifies a short description of the feature. + */ + setSnippet(snippet: string): void; + + /** + * User-supplied text that appears in the description balloon. + */ + getDescription(): string; + + /** + * User-supplied text that appears in the description balloon. + */ + setDescription(description: string): void; + + /** + * Stores either the lookAt or camera view. + */ + getAbstractView(): KmlAbstractView; + + /** + * Stores either the lookAt or camera view. + */ + setAbstractView(abstractView: KmlAbstractView): void; + + /** + * URI of a Style or StyleMap defined in a Document. + * It refers to a Plug-in intitiated object. + */ + getStyleUrl(): string; + + /** + * URI of a Style or StyleMap defined in a Document. + * It refers to a Plug-in intitiated object. + */ + setStyleUrl(styleUrl: string): void; + + /** + * The style based on the current mode of the Placemark. + */ + getStyleSelector(): KmlStyleSelector; + + /** + * The style based on the current mode of the Placemark. + */ + setStyleSelector(styleSelector: KmlStyleSelector): void; + + /** + * Specifies region objects and their properties. + * A region contains a bounding box (LatLonAltBox) that describes an area of interest defined by geographic coordinates and altitudes. + */ + getRegion(): KmlRegion; + + /** + * Specifies region objects and their properties. + * A region contains a bounding box (LatLonAltBox) that describes an area of interest defined by geographic coordinates and altitudes. + */ + setRegion(region: KmlRegion): void; + + /** + * Returns the KML for a feature. + */ + getKml(): string; + + /** + * Returns previous sibling node within the container. + */ + getPreviousSibling(): KmlFeature; + + /** + * Returns the next sibling node within the container. + */ + getNextSibling(): KmlFeature; + + /** + * Returns the KmlTimeStamp or KmlTimeSpan object associated with this feature. + */ + getTimePrimitive(): KmlTimePrimitive; + + /** + * Attach a KmlTimeStamp or KmlTimeSpan object to this feature. + */ + setTimePrimitive(timePrimitive: KmlTimePrimitive): void; + + /** + * Returns the computed style of a feature, merging any inline styles with styles imported from setHref() or a StyleUrl. + * + * Note: Modifying the returned KmlStyle object is undefined and not recommended. + */ + getComputedStyle(): KmlStyle; + + /** + * Experimental Feature — this is an experimental feature and can change (or even be removed) at any time. + * The opacity of a feature, ranging from 0 (completely transparent) to 1 (complete opaque). + * The opacity of a folder or document will influence the opacity of child features. + * Thus, if a folder has an opacity of 0.5 and a child ground overlay in the folder also has an opacity of 0.5, the overlay will be drawn with an opacity of 0.25. + */ + getOpacity(): number; + + /** + * Experimental Feature — this is an experimental feature and can change (or even be removed) at any time. + * The opacity of a feature, ranging from 0 (completely transparent) to 1 (complete opaque). + * The opacity of a folder or document will influence the opacity of child features. + * Thus, if a folder has an opacity of 0.5 and a child ground overlay in the folder also has an opacity of 0.5, the overlay will be drawn with an opacity of 0.25. + */ + setOpacity(opacity: number): void; + } + + /** + * An abstract object and cannot be used directly. + * A KmlContainer object holds one or more features and allows the creation of nested hierarchies. + */ + export class KmlContainer extends KmlFeature { + + /** + * Get an element by ID. + * This is functionally equivalent to getElementByUrl with an unspecified base URL. + * + * For example: getElementByUrl('#foo'). + * + * Usage is when finding objects created with JavaScript, which have unspecified base URLs. + * The object must be a descendant of the container before it can be found. + */ + getElementById(id: string): KmlObject; + + /** + * Get an element by URL. A URL consists of the base address and ID, joined with the # character. + * + * For example: http://www.google.com/bar.kml#here_be_monsters + * + * This applies to objects that are fetched. + * In the case of plugin created objects, the URL is simply #foo. + * The object must be a descendant of the container before it can be found. + */ + getElementByUrl(url: string): KmlObject; + + /** + * Get an element by type. + */ + getElementsByType(type: string): KmlObjectList; + + /** + * A collection of features, such as name, description, and so on. + */ + getFeatures(): GEFeatureContainer; + } + + /** + * A Folder is used to arrange other features hierarchically (Folders, Placemarks, NetworkLinks, or Overlays). + * A feature is visible only if it and all of its ancestors are visible. + */ + export class KmlFolder extends KmlContainer {} + + /** + * A layer displayed in Google Earth. + */ + export class KmlLayer extends KmlFolder {} + + /** + * A container for the various layers displayed with the Google Earth Plug-in. + * It contains the same layers as Google Earth. + */ + export class KmlLayerRoot extends KmlFolder { + + /** + * Returns the layer based on the layer's ID. + */ + getLayerById(id: string): KmlLayer; + + /** + * Enables a layer based on its ID. + */ + enableLayerById(id: string, visibility: boolean): void; + + /** + * Returns the drawing order for this database. + */ + getDrawOrder(): number; + + /** + * Defines the drawing order for databases. + * Drawing order is lowest to highest. + * Google Earth Enterprise customers can add a side database and set the drawOrder to be either before or after that of the main database. + * Side databases default to a drawing order of 0. + */ + setDrawOrder(drawOrder: number): void; + } + + /** + * A KmlDocument has containers that holds features and styles. + * This container is required if you use shared styles. + * It is recommended that you use shared styles, which require the following. + * + * 1. Define all Styles in a Document. Assign a unique ID to each Style. + * 2. Within a given feature or StyleMap, reference the Style's ID using a styleUrl element. + * + * Note: Shared styles are not inherited by the features in the Document. + */ + export class KmlDocument extends KmlContainer { + + /** + * Returns a list of elements using a particular style URL. + */ + getElementsByStyleUrl(styleUrl: string): KmlObjectList; + + /** + * Returns an array containing the style selectors present in the KML document. + */ + getStyleSelectors(): GEStyleSelectorContainer; + } + + /** + * The KmlPlacemark is a feature with associated Geometry. + */ + export class KmlPlacemark extends KmlFeature { + + /** + * The geometry associated with the placemark. + */ + getGeometry(): KmlGeometry; + + /** + * The geometry associated with the placemark. + */ + setGeometry(geometry: KmlGeometry): void; + } + + /** + * The base class for the three types of balloon windows that can overlay the 3D window. + */ + export class GEAbstractBalloon { + + /** + * The ID of the balloon. + */ + getId(): string; + + /** + * The ID of the balloon. + */ + setId(id: string): void; + + /** + * Determines what the balloon is attached to. + */ + getFeature(): KmlFeature; + + /** + * Determines what the balloon is attached to. + */ + setFeature(feature: KmlFeature): void; + + /** + * Minimum width of the balloon. + */ + getMinWidth(): number; + + /** + * Minimum width of the balloon. + */ + setMinWidth(minWidth: number): void; + + /** + * Minimum height of the balloon. + */ + getMinHeight(): number; + + /** + * Minimum height of the balloon. + */ + setMinHeight(minHeight: number): void; + + /** + * Maximum width of the balloon. + */ + getMaxWidth(): number; + + /** + * Maximum width of the balloon. + */ + setMaxWidth(maxWidth: number): void; + + /** + * Maximum height of the balloon. + */ + getMaxHeight(): number; + + /** + * Maximum height of the balloon. + */ + setMaxHeight(maxHeight: number): void; + + /** + * When true, the balloon frame is displayed with a button that the user + * can click to close the balloon. When false, the balloon frame is just + * a plain frame. + * + * Default is true. + */ + getCloseButtonEnabled(): boolean; + + /** + * When true, the balloon frame is displayed with a button that the user + * can click to close the balloon. When false, the balloon frame is just + * a plain frame. + * + * Default is true. + */ + setCloseButtonEnabled(closeButtonEnabled: boolean): void; + } + + /** + * Base class for GEHtmlStringBalloon and GEHtmlDivBalloon. + */ + export class GEFeatureBalloon extends GEAbstractBalloon {} + + /** + * Creates a balloon that contains HTML. + */ + export class GEHtmlBalloon extends GEAbstractBalloon { + + /** + * The color of the text in the balloon. + * This must be set using the HTML hex format #RRGGBB. + * If not set, it is interpreted as #000000. + */ + getForegroundColor(): string; + + /** + * The color of the text in the balloon. + * This must be set using the HTML hex format #RRGGBB. + * If not set, it is interpreted as #000000. + */ + setForegroundColor(foregroundColor: string): void; + + /** + * The background color of the balloon. + * This must be set using the HTML hex format #RRGGBB. + * If not set, the default is interpreted as #FFFFFF. + */ + getBackgroundColor(): string; + + /** + * The background color of the balloon. + * This must be set using the HTML hex format #RRGGBB. + * If not set, the default is interpreted as #FFFFFF. + */ + setBackgroundColor(backgroundColor: string): void; + } + + /** + * The GEHtmlDivBalloon object creates a balloon based on the contentDiv property. + */ + export class GEHtmlDivBalloon extends GEHtmlBalloon { + + /** + * An HTMLDivElement to be used as the contents of the balloon. + * When the balloon is shown, the HTMLDivElement is attached to the balloon element in the web page. + * You can manipulate this balloon using ordinary HTML DOM techniques. + */ + getContentDiv(): HTMLDivElement; + + /** + * An HTMLDivElement to be used as the contents of the balloon. + * When the balloon is shown, the HTMLDivElement is attached to the balloon element in the web page. + * You can manipulate this balloon using ordinary HTML DOM techniques. + */ + setContentDiv(contentDiv: HTMLElement): void; + } + + /** + * The GEHtmlStringBalloon class represents a balloon based on the contentString. + */ + export class GEHtmlStringBalloon extends GEHtmlBalloon { + + /** + * You can include any HTML using the contentString property. + * When the balloon is visible, the content specified in contentString property, + * is inserted directly into the balloon element in the web page. + */ + getContentString(): string; + + /** + * You can include any HTML using the contentString property. + * When the balloon is visible, the content specified in contentString property, + * is inserted directly into the balloon element in the web page. + */ + setContentString(contentString: string): void; + } + + /** + * The base class for GETimeControl. + */ + export class GEControl {} + + /** + * Represents the time slider object. + */ + export class GETimeControl extends GEControl { + + /** + * Whether the time slider is visible or not. + */ + getVisibility(): GEVisibilityEnum; + + /** + * Specifies whether the control is visible or hidden. + */ + setVisibility(visibility: GEVisibilityEnum): void; + + /** + * Returns the clock rate that the plugin would use, if the play button on the time slider UI was pressed. + * This rate is calculated by the plugin based on the time range currently present in the slider. + */ + getCalculatedRate(): number; + + /** + * Returns a KmlTimeSpan object encompassing the earliest and latest times present in the time slider. + * For more information, refer to the Time chapter of the Developer's Guide. + */ + getExtents(): KmlTimeSpan; + + /** + * Returns an array containing the KmlTimeStamp objects associated with the historical imagery available in this view. + */ + getAvailableImageDates(): KmlObjectList; + + } + + /** + * The GEPlugin is the Google Earth Plugin's main object, and this is the object that is returned to the JavaScript application when you first create a plug-in instance. + * GEPlugin provides factory methods for ructing other objects (placemarks, and so on), and is also used to retrieve the root document objects. + */ + export class GEPlugin { + + /** + * A Specifies that altitudes are at ground level. For Ground overlays, this means that the image will be draped over the terrain. + */ + ALTITUDE_CLAMP_TO_GROUND: KmlAltitudeModeEnum; + + /** + * Specifies that altitudes are to be interpreted as meters above or below ground level (i.e. the elevation of the terrain at the location). + */ + ALTITUDE_RELATIVE_TO_GROUND: KmlAltitudeModeEnum; + + /** + * Specifies that altitudes are to be interpreted as meters above or below sea level, regardless of the actual elevation of the terrain beneath the object. + * For example, if you set the altitude of an object to 10 meters with an absolute altitude mode, the object will appear to be at ground level if the terrain beneath is also 10 meters above sea level. + * If the terrain is 3 meters above sea level, the object will appear elevated above the terrain by 7 meters. + * If, on the other hand, the terrain is 15 meters above sea level, the object may be completely invisible. + */ + ALTITUDE_ABSOLUTE: KmlAltitudeModeEnum; + + /** + * Specifies that altitudes are at sea floor level. + */ + ALTITUDE_CLAMP_TO_SEA_FLOOR: KmlAltitudeModeEnum; + + /** + * Specifies that altitudes are to be interpreted as meters above sea floor (i.e. the elevation of the sea floor at the location). + */ + ALTITUDE_RELATIVE_TO_SEA_FLOOR: KmlAltitudeModeEnum; + + /** + * Refresh when the file is loaded and whenever the Link parameters change. This refresh mode is the default. + */ + REFRESH_ON_CHANGE: KmlRefreshModeEnum; + + /** + * Refresh every n seconds (specified in refreshInterval). + */ + REFRESH_ON_INTERVAL: KmlRefreshModeEnum; + + /** + * Refresh when the expiration time is reached. + * If a fetched file has a NetworkLinkControl, the expires time takes precedence over expiration times specified in HTTP headers. + * If no expires time is specified, the HTTP max-age header is used (if present). + * If max-age is not present, the Expires HTTP header is used (if present). + */ + REFRESH_ON_EXPIRE: KmlRefreshModeEnum; + + /** + * Ignore changes in the view. Also ignore viewFormat parameters, if any. + * This view refresh mode is the default. + */ + VIEW_REFRESH_NEVER: KmlViewRefreshModeEnum; + + /** + * Refresh the file only when the user explicitly requests it. + */ + VIEW_REFRESH_ON_REQUEST: KmlViewRefreshModeEnum; + + /** + * Refresh n seconds after movement stops, where n is specified in viewRefreshTime. + */ + VIEW_REFRESH_ON_STOP: KmlViewRefreshModeEnum; + + /** + * Refresh only when the feature's Region becomes active. + */ + VIEW_REFRESH_ON_REGION: KmlViewRefreshModeEnum; + + /** + * Screen coordinates are to be interpreted as a fraction of an item, like an image or Google Earth window. + */ + UNITS_FRACTION: KmlUnitsEnum; + + /** + * Screen coordinates are to be interpreted as pixels from the left or bottom edge. + */ + UNITS_PIXELS: KmlUnitsEnum; + + /** + * Screen coordinates are to be interpreted as pixels from the top or right edge. + */ + UNITS_INSET_PIXELS: KmlUnitsEnum; + + /** + * Apply no color mode effect, i.e. use the base color as is. + */ + COLOR_NORMAL: KmlColorModeEnum; + + /** + * Apply a random linear scale to the base color. See the KML documentation for more details. + */ + COLOR_RANDOM: KmlColorModeEnum; + + /** + * Inherit the color mode from ancestor styles. + */ + COLOR_INHERIT: KmlColorModeEnum; + + /** + * The Earth map type, used with GEOptions' setMapType. + */ + MAP_TYPE_EARTH: GEMapTypeEnum; + + /** + * The Sky map type, used with GEOptions' setMapType. + */ + MAP_TYPE_SKY: GEMapTypeEnum; + + /** + * Hide the UI element. + */ + VISIBILITY_HIDE: GEVisibilityEnum; + + /** + * Show the UI element always. + */ + VISIBILITY_SHOW: GEVisibilityEnum; + + /** + * Automatically show or hide the UI element depending on user interaction. + */ + VISIBILITY_AUTO: GEVisibilityEnum; + + /** + * Specifies that fly-to should happen immediately, without a smooth transition. + */ + SPEED_TELEPORT: number; + + /** + * The Layer ID of the terrain layer. Use as an argument to getLayerById() or enableLayerById(). + */ + LAYER_TERRAIN: string; + + /** + * The Layer ID of the roads layer. Use as an argument to getLayerById() or enableLayerById(). + */ + LAYER_ROADS: string; + + /** + * The Layer ID of the photorealistic buildings layer. Use as an argument to getLayerById() or enableLayerById(). + */ + LAYER_BUILDINGS: string; + + /** + * The Layer ID of the low resolution (gray) buildings layer. + * Use as an argument to getLayerById() or enableLayerById(). + * Note that as photorealistic buildings continue to be created and added to the LAYER_BUILDINGS layer, the low-resolution version of those buildings will be removed from this layer. + * This layer will therefore change over time. + */ + LAYER_BUILDINGS_LOW_RESOLUTION: string; + + /** + * The Layer ID of the borders layer. Use as an argument to getLayerById() or enableLayerById(). + */ + LAYER_BORDERS: string; + + /** + * The Layer ID of the trees layer. Use as an argument to getLayerById() or enableLayerById(). + */ + LAYER_TREES: string; + + /** + * When using the GEView.hitTest method, this mode samples the globe (the earth's sphere at altitude 0, without terrain or buildings). + */ + HIT_TEST_GLOBE: GEHitTestModeEnum; + + /** + * When using the GEView.hitTest method, this mode samples the earth's terrain (the ground surface, including variations in altitude). + */ + HIT_TEST_TERRAIN: GEHitTestModeEnum; + + /** + * When using the GEView.hitTest method, this mode samples 3D buildings. + */ + HIT_TEST_BUILDINGS: GEHitTestModeEnum; + + /** + * Sets the render state to its default value. Currently, sunlight, Street View, and historical imagery all default to a disabled state. + */ + OPTION_STATE_DEFAULT: GEViewerOptionsValueEnum; + + /** + * Set the render state to on. Passed to the KmlViewerOptions.setOption method. + */ + OPTION_STATE_ENABLED: GEViewerOptionsValueEnum; + + /** + * Set the render state to off. Passed to the KmlViewerOptions.setOption method. + */ + OPTION_STATE_DISABLED: GEViewerOptionsValueEnum; + + /** + * Passed to the KmlViewerOptions.setOption method, along with a GEViewerOptionsValueEnum, to specify whether the Sun option should be visible. + * Sun can also be enabled/disabled with GEPlugin.getSun. + */ + OPTION_SUNLIGHT: GEViewerOptionsTypeEnum; + + /** + * Passed to the KmlViewerOptions.setOption method, along with a GEViewerOptionsValueEnum, to specify whether historical imagery should be enabled. + */ + OPTION_HISTORICAL_IMAGERY: GEViewerOptionsTypeEnum; + + /** + * Passed to the KmlViewerOptions.setOption method, along with a GEViewerOptionsValueEnum, to specify whether Street View should be enabled when the view reaches ground level. + * Note that this applies only to programmatic movement, such as fly-tos; to control whether the user can enter Street View using manual navigation controls, call ge.getPlugin().streetViewEnabled(true). + */ + OPTION_STREET_VIEW: GEViewerOptionsTypeEnum; + + /** + * The feature's visibility is tied to its list item's checkbox state. + */ + LIST_ITEM_CHECK: KmlListItemTypeEnum; + + /** + * When specified for a folder, document or network link, prevents all items from being made visible at once—that is, the user can turn all children off but cannot turn them all on at the same time. + * This setting is useful for containers or network links containing large amounts of data. + */ + LIST_ITEM_CHECK_OFF_ONLY: KmlListItemTypeEnum; + + /** + * Use a normal checkbox for visibility but do not display children in a list view. + * The item's checkbox should allows the user to toggle visibility of the child objects in the viewport. + */ + LIST_ITEM_CHECK_HIDE_CHILDREN: KmlListItemTypeEnum; + + /** + * When specified for a container (a folder or a document), only one of the container's items should be visible at a time. + */ + LIST_ITEM_RADIO_FOLDER: KmlListItemTypeEnum; + + /** + * The large navigation control type, used with GENavigationControl.setControlType(). + */ + NAVIGATION_CONTROL_LARGE: GENavigationControlEnum; + + /** + * The small navigation control type, used with GENavigationControl.setControlType(). + */ + NAVIGATION_CONTROL_SMALL: GENavigationControlEnum; + + /** + * Parse a string of KML and return a handle to the root of the KML object structure that was created. + */ + parseKml(kml: string): KmlObject; + + /** + * Get an element by ID. This is functionally equivalent to getElementByUrl with an unspecified base URL. + * + * For example: getElementByUrl('#foo'). + * + * Usage is when finding objects created with JavaScript, which have unspecified base URLs. + * The object must be a descendant of the DOM before it can be found. + */ + getElementById(id: string): KmlObject; + + /** + * Get an element by URL. A URL consists of the base address and the ID, joined with the # character. + * + * For example: http://www.google.com/bar.kml#here_be_monsters + * + * This applies to objects that are fetched. + * In the case of plugin created objects, the URL is simply #foo. + * The object must be a descendant of the DOM before it can be found. + */ + getElementByUrl(url: string): KmlObject; + + /** + * Get a list of elements by type. + */ + getElementsByType(): KmlObjectList; + + /** + * Creates a placemark on the globe. + * A Placemark is a feature with associated Geometry. + * A Placemark with a Point has an icon associated with it that marks a point on the Earth in the 3D viewer. + * (In the Google Earth 3D viewer, a Point Placemark is the only object you can click or roll over. + * Other Geometry objects do not have an icon in the 3D viewer. + * To allow the user to click in the 3D viewer, you would need to create a MultiGeometry object that contains both a Point and the other Geometry object.) + */ + createPlacemark(id: string): KmlPlacemark; + + /** + * Creates a point on the globe. Specifies the geographic location defined by longitude, latitude, and (optional) altitude. + */ + createPoint(id: string): KmlPoint; + + /** + * Creates a line string on Google Earth. + */ + createLineString(id: string): KmlLineString; + + /** + * Creates a folder. + * A KMLFolder is used to arrange other features hierarchically (Folders, Placemarks, NetworkLinks, or Overlays). + * A feature is visible only if it and all its ancestors are visible. + */ + createFolder(id: string): KmlFolder; + + /** + * Creates level of detail (LOD). + * LOD describes the size of the projected region on the screen that is required in order for the region to be considered active. + * Also specifies the size of the pixel ramp used for fading in (from transparent to opaque) and fading out (from opaque to transparent). + */ + createLod(id: string): KmlLod; + + /** + * Creates a LatLonBox, a bounding box that describes an area of interest defined by geographic coordinates and altitudes. + */ + createLatLonBox(id: string): KmlLatLonBox; + + /** + * Creates a LatLonAltBox, a bounding box that describes an area of interest defined by geographic coordinates and altitudes. + */ + createLatLonAltBox(id: string): KmlLatLonAltBox; + + /** + * Creates a Document. A Document is a container for features and styles. + */ + createDocument(id: string): KmlDocument; + + /** + * Creates a Region in Google Earth. + * A Region contains a bounding box that describes an area of interest defined by geographic coordinates and altitudes. + */ + createRegion(id: string): KmlRegion; + + /** + * Specifies the exact coordinates of the Model's origin in latitude, longitude, and altitude. + * Latitude and longitude measurements are standard lat-lon projection with WGS84 datum. + * Altitude is distance above the earth's surface, in meters, and is interpreted according to altitudeMode. + */ + createLocation(id: string): KmlLocation; + + /** + * Sets the rotation of a 3D model's coordinate system to position the object in Google Earth. + */ + createOrientation(id: string): KmlOrientation; + + /** + * Sets the scale of a model along the x, y, and z axes in the model's coordinate space. + */ + createScale(id: string): KmlScale; + + /** + * Creates a model. + * A model is a 3D object described in a COLLADA file. + * COLLADA files have a .dae file extension. + * Models are created in their own coordinate space and then located, positioned, and scaled in Google Earth. + */ + createModel(id: string): KmlModel; + + /** + * A Style defines an addressable style group that can be referenced by StyleMaps and features. + */ + createStyle(id: string): KmlStyle; + + /** + * Creates a LinearRing. + * A LinearRing defines a closed line string, typically the outer boundary of a Polygon. + * Optionally, a LinearRing can also be used as the inner boundary of a Polygon to create holes in the Polygon. + */ + createLinearRing(id: string): KmlLinearRing; + + /** + * Creates a Polygon. A Polygon is defined by an outer boundary and 0 or more inner boundaries. + */ + createPolygon(id: string): KmlPolygon; + + /** + * Creates an Icon. An icon defines an image associated with an Icon style or overlay. + */ + createIcon(id: string): KmlIcon; + + /** + * Creates a Link. + * A Link specifies the location of KML files fetched by network links, image files used in any overlay, or model files used with the Model object. + */ + createLink(id: string): KmlLink; + + /** + * Creates a GroundOverlay. + * A GroundOverlay draws an image overlay draped onto the terrain. + */ + createGroundOverlay(id: string): KmlGroundOverlay; + + /** + * Creates a NetworkLink. + * A NetworkLink references a KML file or KMZ archive on a local or remote network. + */ + createNetworkLink(id: string): KmlNetworkLink; + + /** + * Creates a ScreenOverlay. + * A ScreenOverlay draws an image overlay fixed to the screen. + */ + createScreenOverlay(id: string): KmlScreenOverlay; + + /** + * Creates a container for one or more geometry primitives associated with the same feature. + */ + createMultiGeometry(id: string): KmlMultiGeometry; + + /** + * Creates a StyleMap. + * A StyleMap maps between two different icon styles. + * Typically, a StyleMap is used to provide separate normal and highlighted styles for a Placemark, so that the highlighted version appears when the user mouses over the icon in Google Earth. + */ + createStyleMap(id: string): KmlStyleMap; + + /** + * Creates a new LookAt. + * A LookAt element positions the camera view in relation to an object that is being viewed. + */ + createLookAt(id: string): KmlLookAt; + + /** + * Creates a new Camera. + * This element positions the camera relative to the Earth's surface and defines the view direction. + */ + createCamera(id: string): KmlCamera; + + /** + * Creates a new viewer options object. + */ + createViewerOptions(id: string): KmlViewerOptions; + + /** + * Create a KmlTimeStamp object. + * For more information, refer to the Time chapter of the Google Earth API developer's guide. + */ + createTimeStamp(id: string): KmlTimeStamp; + + /** + * Create a KmlTimeSpan object. + * For more information, refer to the Time chapter of the Google Earth API developer's guide. + */ + createTimeSpan(id: string): KmlTimeSpan; + + /** + * Creates a Feature balloon. + */ + createFeatureBalloon(id: string): GEFeatureBalloon; + + /** + * Creates an HTML string balloon. + */ + createHtmlStringBalloon(id: string): GEHtmlStringBalloon; + + /** + * Creates an Html Div Balloon. + */ + createHtmlDivBalloon(id: string): GEHtmlDivBalloon; + + /** + * Returns the currently active balloon, or null. + */ + getBalloon(): GEAbstractBalloon; + + /** + * Sets the given balloon as the active balloon, replacing any existing active balloon. + * If the given feature is visible, then the balloon is displayed. Otherwise, the balloon is hidden. + * + * If the argument is null, then any existing active balloon will be hidden. + */ + setBalloon(newActiveBalloon: GEAbstractBalloon): void; + + /** + * Used for debugging purposes; if this value is not equal to the value returned by getPluginVersion then there is a misconfiguration on the end user's system. + * This check is automatically done during plugin instantiation. + */ + getEarthVersion(): string; + + /** + * The version of the Google Earth Plug-in installed on the end user's machine. + */ + getPluginVersion(): string; + + /** + * The options used to manipulate the behavior of the Google Earth plugin. + */ + getOptions(): GEOptions; + + /** + * The time class used to manipulate the behavior of the Google Earth plugin time. + */ + getTime(): GETime; + + /** + * Controls the window options. + */ + getWindow(): GEWindow; + + /** + * Controls the globe behavior. + */ + getGlobe(): GEGlobe; + + /** + * Displays the dawn to dusk views. + */ + getSun(): GESun; + + /** + * Controls built-in layer behavior. + */ + getLayerRoot(): KmlLayerRoot; + + /** + * Controls the plugin viewport. + */ + getView(): GEView; + + /** + * Controls the navigation controls on the globe. + */ + getNavigationControl(): GENavigationControl; + + /** + * The top-level features currently in the Earth object. + */ + getFeatures(): GEFeatureContainer; + + /** + * Exposes functionality for interacting with KML tours. + */ + getTourPlayer(): GETourPlayer; + + /** + * Exposes functionality for interacting with photo overlays. + */ + getPhotoOverlayViewer(): GEPhotoOverlayViewer; + + /** + * Returns a number between 0 and 100 (inclusive) that indicates the progress of the streaming of imagery for the current view. + * + * A value of 100 means that the imagery is completely streamed in. + */ + getStreamingPercent(): number; + } + + export enum GEEventPhaseEnum {} + export enum KmlListItemTypeEnum {} + export enum KmlColorModeEnum {} + export enum KmlAltitudeModeEnum {} + export enum KmlRefreshModeEnum {} + export enum KmlViewRefreshModeEnum {} + export enum KmlUnitsEnum {} + export enum GEMapTypeEnum {} + export enum GEVisibilityEnum {} + export enum GEHitTestModeEnum {} + export enum GEViewerOptionsValueEnum {} + export enum GENavigationControlEnum {} + export enum GEViewerOptionsTypeEnum {} + +} From 896f3172983d25c405be5ad21f3cc20f136ae0ee Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 17 Aug 2016 11:56:21 -0400 Subject: [PATCH 142/203] lodash: Added flush method to debounced & throttled functions --- lodash/lodash.d.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 52f274fd3c..e64c868354 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.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; } } From 383dc7a3a4fc24a3f1a1fdf17a6e051f1648f0e0 Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Wed, 17 Aug 2016 12:06:58 -0400 Subject: [PATCH 143/203] fix setter --- google-earth/google-earth.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-earth/google-earth.d.ts b/google-earth/google-earth.d.ts index ac10729f17..2e089bd23c 100644 --- a/google-earth/google-earth.d.ts +++ b/google-earth/google-earth.d.ts @@ -1921,7 +1921,7 @@ declare namespace google.earth { /** * The direction that icons are set to point, clockwise, and in degrees. */ - setHeading(): number; + setHeading(heading: number): void; /** * A custom Icon. In KmlIconStyle, the only child element of KmlIcon is href and href is an HTTP address or a local file specification used to load an icon. From f38e0a1a1e12c0d61787a8237daa356d109a3ff3 Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Wed, 17 Aug 2016 12:10:47 -0400 Subject: [PATCH 144/203] add missing method --- google-earth/google-earth.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/google-earth/google-earth.d.ts b/google-earth/google-earth.d.ts index 2e089bd23c..702524a076 100644 --- a/google-earth/google-earth.d.ts +++ b/google-earth/google-earth.d.ts @@ -2794,6 +2794,11 @@ declare namespace google.earth { */ setLatLng(latitude: number, longitude: number): void; + /** + * Sets the latitude, longitude, and altitide. + */ + setLatLngAlt(latitude: number, longitude: number, altitude: number): void; + /** * The point's latitude, in degrees. */ From dcaf000f890831e3e8431f0f682c7fffd06241ee Mon Sep 17 00:00:00 2001 From: Marcel Haldemann Date: Wed, 17 Aug 2016 19:12:21 +0200 Subject: [PATCH 145/203] make express.Application compatible with http.createServer --- express-serve-static-core/express-serve-static-core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-serve-static-core/express-serve-static-core.d.ts b/express-serve-static-core/express-serve-static-core.d.ts index de91c521cc..f83e509e63 100644 --- a/express-serve-static-core/express-serve-static-core.d.ts +++ b/express-serve-static-core/express-serve-static-core.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 { From 5953dd4f6c9cebee89f6f26da74280d525c21d08 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Wed, 17 Aug 2016 14:08:01 -0400 Subject: [PATCH 146/203] Verified that addPreSearch returns a ContextSensitiveHandler, and since the handler is added against a control, the getEventSource can return a Control as well.. --- xrm/xrm.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xrm/xrm.d.ts b/xrm/xrm.d.ts index cf2b4c77c3..824c91ba0c 100644 --- a/xrm/xrm.d.ts +++ b/xrm/xrm.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. From 40c950b9239ddfc16a3e4b45add90bc9b06f3647 Mon Sep 17 00:00:00 2001 From: Schmulik Raskin Date: Wed, 17 Aug 2016 23:43:33 +0300 Subject: [PATCH 147/203] Add namespace to gulp-rename to make export work --- gulp-rename/gulp-rename-tests.ts | 5 ++++- gulp-rename/gulp-rename.d.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gulp-rename/gulp-rename-tests.ts b/gulp-rename/gulp-rename-tests.ts index 6b204a36d9..b27f0f5ba9 100644 --- a/gulp-rename/gulp-rename-tests.ts +++ b/gulp-rename/gulp-rename-tests.ts @@ -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 \ No newline at end of file + .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md diff --git a/gulp-rename/gulp-rename.d.ts b/gulp-rename/gulp-rename.d.ts index 11368e9698..4c68aecde7 100644 --- a/gulp-rename/gulp-rename.d.ts +++ b/gulp-rename/gulp-rename.d.ts @@ -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; -} \ No newline at end of file +} From 4d42a7f7bda33685b99e633c6785bbaef6810e14 Mon Sep 17 00:00:00 2001 From: york yao Date: Thu, 18 Aug 2016 06:54:59 +0800 Subject: [PATCH 148/203] add override method of the multer methods (.single(), .array(), fields()) --- multer/multer.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/multer/multer.d.ts b/multer/multer.d.ts index 2a4eea805f..2ffaf61760 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -89,12 +89,18 @@ declare module "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; + /** 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 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; + array(fieldame: string, maxCount?: number): 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 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 */ + any(): express.RequestHandler; } } From 3c322e8e4dfae92f16a191d9e9a0b528860c96e9 Mon Sep 17 00:00:00 2001 From: Stefan Valentin Date: Wed, 17 Aug 2016 19:19:09 -0500 Subject: [PATCH 149/203] eventemitter2: Namespaces allow string[] for on/emit --- eventemitter2/eventemitter2.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eventemitter2/eventemitter2.d.ts b/eventemitter2/eventemitter2.d.ts index 39a349c6b6..de1be0d064 100644 --- a/eventemitter2/eventemitter2.d.ts +++ b/eventemitter2/eventemitter2.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. From b711ae75b8e05ffa4ce31981009bb1e59001ba92 Mon Sep 17 00:00:00 2001 From: bradley cushing Date: Wed, 17 Aug 2016 22:35:10 -0400 Subject: [PATCH 150/203] Update TabListProps interface with new optional props Changes were introduced in react-tabs PR #108. --- react-tabs/react-tabs.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-tabs/react-tabs.d.ts b/react-tabs/react-tabs.d.ts index 758db0d75c..565b055304 100644 --- a/react-tabs/react-tabs.d.ts +++ b/react-tabs/react-tabs.d.ts @@ -21,6 +21,8 @@ declare namespace ReactTabs { interface TabListProps { className?: string; + activeTabClassName?: string; + disabledTabClassName?: string; } interface TabList extends __React.ComponentClass {} From 5baa6e08ea662c63e73a820451f9e85ddc5d63bc Mon Sep 17 00:00:00 2001 From: TonyYang Date: Thu, 18 Aug 2016 11:34:00 +0800 Subject: [PATCH 151/203] express.Application is compatible with http.createServer Add test case: express.Application is compatible with http.createServer --- express/express-tests.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/express/express-tests.ts b/express/express-tests.ts index ed9265b66a..439ef95012 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -1,4 +1,5 @@ /// +/// 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); From 7d940e6e669eb3a267523b1995718f268044c2b0 Mon Sep 17 00:00:00 2001 From: Gayan Ranasinghe Date: Thu, 18 Aug 2016 10:44:23 +0530 Subject: [PATCH 152/203] fixes --- kendo-ui/kendo-ui.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kendo-ui/kendo-ui.d.ts b/kendo-ui/kendo-ui.d.ts index ab09a8882f..e8f02f1776 100644 --- a/kendo-ui/kendo-ui.d.ts +++ b/kendo-ui/kendo-ui.d.ts @@ -5,7 +5,6 @@ /// - declare namespace kendo { function culture(): { name: string; @@ -511,7 +510,7 @@ declare namespace kendo.data { render(value: Object): string; } - module binders { } + namespace binders { } interface Bindings { [key: string]: Binding; From 64ee4c96285cad9bf3e96d511c88849d654558a8 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 09:23:56 +0300 Subject: [PATCH 153/203] getInputNode should return HTMLInputElement --- material-ui/material-ui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 58a36f9cf9..6d48b46e58 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1712,7 +1712,7 @@ declare namespace __MaterialUI { focus(): void; select(): void; getValue(): string; - getInputNode(): Element; + getInputNode(): HTMLInputElement; } interface TimePickerProps extends React.Props { From 4a97011cb6fd9a584510d569387527a49c70612d Mon Sep 17 00:00:00 2001 From: Lutz Rosema Date: Thu, 18 Aug 2016 10:35:05 +0200 Subject: [PATCH 154/203] Add typedefs for viewport conversion methods --- pdf/pdf-tests.ts | 10 ++++++++++ pdf/pdf.d.ts | 21 ++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/pdf/pdf-tests.ts b/pdf/pdf-tests.ts index 07b49644cf..238bc291a3 100644 --- a/pdf/pdf-tests.ts +++ b/pdf/pdf-tests.ts @@ -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 diff --git a/pdf/pdf.d.ts b/pdf/pdf.d.ts index 9fca2d1af5..d13ba6f3cf 100644 --- a/pdf/pdf.d.ts +++ b/pdf/pdf.d.ts @@ -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) From 81742efd81d2d70b63636678f54e4e03af23d318 Mon Sep 17 00:00:00 2001 From: Finn Poppinga Date: Thu, 18 Aug 2016 13:00:30 +0200 Subject: [PATCH 155/203] add missing command HINCRBYFLOAT --- redis/redis.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index de52145261..5c8fd6b39f 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -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): 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; From cb827241b88929adce8708fad4395452e4b76941 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 15:42:15 +0300 Subject: [PATCH 156/203] Create simple-assign.d.ts --- simple-assign/simple-assign.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 simple-assign/simple-assign.d.ts diff --git a/simple-assign/simple-assign.d.ts b/simple-assign/simple-assign.d.ts new file mode 100644 index 0000000000..594e0f98ef --- /dev/null +++ b/simple-assign/simple-assign.d.ts @@ -0,0 +1,8 @@ +// Type definitions for simple-assign 0.1.0 +// Project: https://github.com/sindresorhus/object-assign +// Definitions by: Ivo Stratev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "simple-assign" { + export defualt function(target: any, ...sources: any[]): any; +} From 50e30a81c79d885db610d9733bf0d05721cbadda Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 15:45:04 +0300 Subject: [PATCH 157/203] Create simple-assign-tests.d.ts --- simple-assign/simple-assign-tests.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 simple-assign/simple-assign-tests.d.ts diff --git a/simple-assign/simple-assign-tests.d.ts b/simple-assign/simple-assign-tests.d.ts new file mode 100644 index 0000000000..3b901540e4 --- /dev/null +++ b/simple-assign/simple-assign-tests.d.ts @@ -0,0 +1,15 @@ + +/// +import * as assign from "simple-assign"; + +function assign1() { + return assign({hello: "world"}); +} + +function assign2() { + return assign({hello: "world"}, {hello: "worlds", second: "extra"}); +} + +function assign3() { + return assign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"}); +} From 224e661e5b10b072a72111b9871ad7da95aea6da Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 15:46:20 +0300 Subject: [PATCH 158/203] Update simple-assign.d.ts --- simple-assign/simple-assign.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-assign/simple-assign.d.ts b/simple-assign/simple-assign.d.ts index 594e0f98ef..ee122703fa 100644 --- a/simple-assign/simple-assign.d.ts +++ b/simple-assign/simple-assign.d.ts @@ -1,5 +1,5 @@ // Type definitions for simple-assign 0.1.0 -// Project: https://github.com/sindresorhus/object-assign +// Project: https://github.com/newoga/simple-assign // Definitions by: Ivo Stratev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 7e8ee0b8ce9e28426dcd0485a7abcb3955fedbb9 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 15:52:44 +0300 Subject: [PATCH 159/203] Update simple-assign.d.ts --- simple-assign/simple-assign.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-assign/simple-assign.d.ts b/simple-assign/simple-assign.d.ts index ee122703fa..f16d87fad5 100644 --- a/simple-assign/simple-assign.d.ts +++ b/simple-assign/simple-assign.d.ts @@ -4,5 +4,5 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "simple-assign" { - export defualt function(target: any, ...sources: any[]): any; + export default function(target: any, ...sources: any[]): any; } From aca9b1cd2895eeabf9152ffc58ddea2ec3ff6c47 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 15:52:54 +0300 Subject: [PATCH 160/203] Rename simple-assign-tests.d.ts to simple-assign-tests.ts --- .../{simple-assign-tests.d.ts => simple-assign-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename simple-assign/{simple-assign-tests.d.ts => simple-assign-tests.ts} (100%) diff --git a/simple-assign/simple-assign-tests.d.ts b/simple-assign/simple-assign-tests.ts similarity index 100% rename from simple-assign/simple-assign-tests.d.ts rename to simple-assign/simple-assign-tests.ts From 875b8b14b2ea73242eea76660c568e527abb9ba3 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 15:58:06 +0300 Subject: [PATCH 161/203] Update simple-assign-tests.ts --- simple-assign/simple-assign-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-assign/simple-assign-tests.ts b/simple-assign/simple-assign-tests.ts index 3b901540e4..9afada70dd 100644 --- a/simple-assign/simple-assign-tests.ts +++ b/simple-assign/simple-assign-tests.ts @@ -1,6 +1,6 @@ /// -import * as assign from "simple-assign"; +import assign from "simple-assign"; function assign1() { return assign({hello: "world"}); From 648906b7c7de03a0032ed66d850582856ebef97e Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 16:16:29 +0300 Subject: [PATCH 162/203] Update simple-assign.d.ts --- simple-assign/simple-assign.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simple-assign/simple-assign.d.ts b/simple-assign/simple-assign.d.ts index f16d87fad5..1c65a8e0f9 100644 --- a/simple-assign/simple-assign.d.ts +++ b/simple-assign/simple-assign.d.ts @@ -4,5 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "simple-assign" { - export default function(target: any, ...sources: any[]): any; + function simpleAssign(target: any, ...sources: any[]): any; + export = simpleAssign; } From 8fa7243389ed378b73fbac7f2b525d5cbd225412 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 16:16:56 +0300 Subject: [PATCH 163/203] Update simple-assign-tests.ts --- simple-assign/simple-assign-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-assign/simple-assign-tests.ts b/simple-assign/simple-assign-tests.ts index 9afada70dd..3970356f5b 100644 --- a/simple-assign/simple-assign-tests.ts +++ b/simple-assign/simple-assign-tests.ts @@ -1,6 +1,6 @@ /// -import assign from "simple-assign"; +import assign = require("simple-assign"); function assign1() { return assign({hello: "world"}); From 718c73a6bb01fdc5f8a44aad0b90d5de741525e1 Mon Sep 17 00:00:00 2001 From: Daniel Pereira Date: Thu, 18 Aug 2016 09:50:21 -0500 Subject: [PATCH 164/203] Added mock-require --- mock-require/mock-require-tests.ts | 47 ++++++++++++++++++++++++++++++ mock-require/mock-require.d.ts | 35 ++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 mock-require/mock-require-tests.ts create mode 100644 mock-require/mock-require.d.ts diff --git a/mock-require/mock-require-tests.ts b/mock-require/mock-require-tests.ts new file mode 100644 index 0000000000..528d466064 --- /dev/null +++ b/mock-require/mock-require-tests.ts @@ -0,0 +1,47 @@ +/// + +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 +} \ No newline at end of file diff --git a/mock-require/mock-require.d.ts b/mock-require/mock-require.d.ts new file mode 100644 index 0000000000..dded6f4224 --- /dev/null +++ b/mock-require/mock-require.d.ts @@ -0,0 +1,35 @@ +// Type definitions for mock-require v1.3.0 +// Project: https://github.com/boblauer/mock-require +// Definitions by: Daniel Pereira +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** 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; +} \ No newline at end of file From 612e4169c6bf8b0b29d27af170d166c84f36948b Mon Sep 17 00:00:00 2001 From: Leo Liang Date: Thu, 18 Aug 2016 22:56:13 +0800 Subject: [PATCH 165/203] Change overload function order to help with resolution. --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 61d98fb1ee..3f47be401d 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1370,8 +1370,8 @@ declare module "dgram" { export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; interface Socket extends events.EventEmitter { - send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void; 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; close(): void; address(): AddressInfo; From 903f09834da3cde4b2bd1bab80c1fd1f26597b1e Mon Sep 17 00:00:00 2001 From: Nicholas Iannone Date: Thu, 18 Aug 2016 10:31:28 -0500 Subject: [PATCH 166/203] Imported working promise library for downstream use. --- db-migrate-base/db-migrate-base.d.ts | 2 ++ db-migrate-pg/db-migrate-pg.d.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/db-migrate-base/db-migrate-base.d.ts b/db-migrate-base/db-migrate-base.d.ts index fe1f4ade47..d24388fdaf 100644 --- a/db-migrate-base/db-migrate-base.d.ts +++ b/db-migrate-base/db-migrate-base.d.ts @@ -8,6 +8,8 @@ declare module "db-migrate-base" { + import * as Promise from "bluebird"; + export interface CallbackFunction { (err: any, response: any): void; } export interface InternalModule { diff --git a/db-migrate-pg/db-migrate-pg.d.ts b/db-migrate-pg/db-migrate-pg.d.ts index aa1a52d34e..533b8ff91d 100644 --- a/db-migrate-pg/db-migrate-pg.d.ts +++ b/db-migrate-pg/db-migrate-pg.d.ts @@ -10,6 +10,7 @@ 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 {} From 2104b9c513c514bc4194d72b6c3d3ece89ba0ef3 Mon Sep 17 00:00:00 2001 From: Prashant Tiwari Date: Thu, 18 Aug 2016 21:50:59 +0530 Subject: [PATCH 167/203] Distinguish between Server and Request Ext Points These are two different methods with different signatures depending on the type of the extension event. --- hapi/hapi.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 68f6857110..fab645ca71 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -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(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): void; /** server.handler(name, method) Registers a new handler type to be used in routes where: From 7d23177b1abff1b80b9a2d6ffbc881f6562a2359 Mon Sep 17 00:00:00 2001 From: Prashant Tiwari Date: Thu, 18 Aug 2016 22:03:03 +0530 Subject: [PATCH 168/203] Missed options in ServerExtPoints --- hapi/hapi.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index fab645ca71..ff5e1d9fe8 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -2044,7 +2044,7 @@ declare module "hapi" { // All requests will get routed to '/test'*/ 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): 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: From c38064c1864c5c4b92c073ada511cf23b348582b Mon Sep 17 00:00:00 2001 From: Marcel Haldemann Date: Thu, 18 Aug 2016 19:54:31 +0200 Subject: [PATCH 169/203] added support for jasmine.getEnv().defaultTimeoutInterval Its the timeout for async calls as describt here: https://github.com/mhevery/jasmine-node/blob/master/README.md --- jasmine-node/jasmine-node.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jasmine-node/jasmine-node.d.ts b/jasmine-node/jasmine-node.d.ts index f547f844f6..f535d8c3e3 100644 --- a/jasmine-node/jasmine-node.d.ts +++ b/jasmine-node/jasmine-node.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; + } +} + declare module "jasmine-node" { interface ExecuteSpecsOptions { specFolders: string[], From 906c5660479d5b5c36fcbfd23bae2874e80a32a5 Mon Sep 17 00:00:00 2001 From: CodeAnimal Date: Thu, 18 Aug 2016 19:23:38 +0100 Subject: [PATCH 170/203] Remove commented out code Remove the code commented out. - Update the "usage" method documentation to apply to the `matches` method rather than the `regex` method. --- express-validator/express-validator.d.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 71797efce2..3599b9b79b 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -122,7 +122,6 @@ declare namespace ExpressValidator { /** * Check if length is 0 */ - //notNull(): Validator; // I don't see this in the documentation or code anywhere. isNull(): Validator; /** * Not just whitespace (input.trim().length !== 0) @@ -130,14 +129,13 @@ declare namespace ExpressValidator { notEmpty(): Validator; equals(equals:any): Validator; contains(str:string): Validator; - //notContains(str:string): Validator; // I don't see this in the documentation or code anywhere. + + /** + * Usage: matches(/[a-z]/i) or matches('[a-z]','i') + */ matches(pattern:string, modifiers?:string): Validator; matches(pattern: RegExp): Validator; - /** - * Usage: regex(/[a-z]/i) or regex('[a-z]','i') - */ - //regex(pattern:string, modifiers:string): Validator; // I don't see this in the documentation or code anywhere. - //notRegex(pattern:string, modifiers:string): Validator; // I don't see this in the documentation or code anywhere. + /** * max is optional */ @@ -200,7 +198,6 @@ declare namespace ExpressValidator { ltrim(...chars:string[]): Sanitizer; rtrim(...chars:string[]): Sanitizer; stripLow(keep_new_lines?: boolean): Sanitizer; - //ifNull(replace:any): Sanitizer; // I don't see this in the documentation or code anywhere. toFloat(): Sanitizer; toInt(radix?: number): Sanitizer; /** From 85da09fde6698a068e30da5ce464465c5c545fd5 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Thu, 18 Aug 2016 21:54:51 +0300 Subject: [PATCH 171/203] Update simple-assign.d.ts --- simple-assign/simple-assign.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/simple-assign/simple-assign.d.ts b/simple-assign/simple-assign.d.ts index 1c65a8e0f9..3b9229bd65 100644 --- a/simple-assign/simple-assign.d.ts +++ b/simple-assign/simple-assign.d.ts @@ -4,6 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "simple-assign" { + function simpleAssign(target: T, source: U): T & U; + function simpleAssign(target: T, source1: U, source2: V): T & U & V; + function simpleAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + function simpleAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; + function simpleAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: T): T & U & V & W & Q & R; function simpleAssign(target: any, ...sources: any[]): any; export = simpleAssign; } From 227ee0d1f5c6d73e1c5ec75049ba664dab0bd6d1 Mon Sep 17 00:00:00 2001 From: Meirion Hughes Date: Thu, 18 Aug 2016 14:59:41 +0100 Subject: [PATCH 172/203] Fix SAXParser startTag attrs type. update ASTAttribute to include optional prefix field update target version improve tests --- parse5/parse5-tests.ts | 35 +++++++++++++++++++++++++++++------ parse5/parse5.d.ts | 9 +++++---- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/parse5/parse5-tests.ts b/parse5/parse5-tests.ts index 420fda5992..090217a6e2 100644 --- a/parse5/parse5-tests.ts +++ b/parse5/parse5-tests.ts @@ -1,6 +1,6 @@ // Type definitions for parse5 2.1.5 // Project: https://github.com/inikulin/parse5 -// Definitions by: Nico Jansen +// Definitions by: Nico Jansen , Meirion Hughes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -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(''); + +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/parse5/parse5.d.ts b/parse5/parse5.d.ts index 69bfd1419e..bb77d6c0c3 100644 --- a/parse5/parse5.d.ts +++ b/parse5/parse5.d.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 /// @@ -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: From b110a22d2660d42dc4708c1a0f44828f6737d554 Mon Sep 17 00:00:00 2001 From: Meirion Hughes Date: Thu, 18 Aug 2016 21:03:32 +0100 Subject: [PATCH 173/203] Fix target version in test file --- parse5/parse5-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse5/parse5-tests.ts b/parse5/parse5-tests.ts index 090217a6e2..05e1ea683e 100644 --- a/parse5/parse5-tests.ts +++ b/parse5/parse5-tests.ts @@ -1,4 +1,4 @@ -// Type definitions for parse5 2.1.5 +// Type definitions for parse5 2.2.0 // Project: https://github.com/inikulin/parse5 // Definitions by: Nico Jansen , Meirion Hughes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 07b2e6b616344176a6bc8da71edd2f54c0b9e090 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Thu, 18 Aug 2016 13:07:30 -0700 Subject: [PATCH 174/203] Remove duplicate method and re-order some --- multer/multer.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/multer/multer.d.ts b/multer/multer.d.ts index 2ffaf61760..d9abb4a87c 100644 --- a/multer/multer.d.ts +++ b/multer/multer.d.ts @@ -87,18 +87,16 @@ 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 */ - single(): express.RequestHandler; + 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; - /** 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 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 */ any(): express.RequestHandler; } From d71b7c3821e24a0c167722e675445c6a6b6a9237 Mon Sep 17 00:00:00 2001 From: Chris Manning Date: Fri, 19 Aug 2016 15:13:47 +1200 Subject: [PATCH 175/203] Corrected missing return types to prevent noImplicitAny errors. --- dustjs-linkedin/dustjs-linkedin.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dustjs-linkedin/dustjs-linkedin.d.ts b/dustjs-linkedin/dustjs-linkedin.d.ts index 70bd288a39..9bb05b1424 100644 --- a/dustjs-linkedin/dustjs-linkedin.d.ts +++ b/dustjs-linkedin/dustjs-linkedin.d.ts @@ -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. From 4c7ec690272c58094009b707d4861b46e9982450 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Fri, 19 Aug 2016 16:08:38 +0800 Subject: [PATCH 176/203] http.IncomingMessage no destroy This is [Node v4.x document](https://nodejs.org/dist/latest-v4.x/docs/api/http.html#http_message_destroy_error), please refer this link. --- node/node-4.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node-4.d.ts b/node/node-4.d.ts index 02b37f8cb2..e60da8e309 100644 --- a/node/node-4.d.ts +++ b/node/node-4.d.ts @@ -632,6 +632,7 @@ declare module "http" { */ statusMessage?: string; socket: net.Socket; + destroy(error?: Error): void; } /** * @deprecated Use IncomingMessage From a94c941c50b85e01aeedea90a5a9dd6ac714aff8 Mon Sep 17 00:00:00 2001 From: Vasiliy Solovey Date: Fri, 19 Aug 2016 12:21:44 +0300 Subject: [PATCH 177/203] Improved aws-lambda type definitions --- aws-lambda/aws-lambda-tests.ts | 19 ++++++++++++++++++- aws-lambda/aws-lambda.d.ts | 14 +++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index fd289dcb7f..8b9f53a8ab 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -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(); \ No newline at end of file +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); +} \ No newline at end of file diff --git a/aws-lambda/aws-lambda.d.ts b/aws-lambda/aws-lambda.d.ts index cdd8e2f506..081c6e0e3e 100644 --- a/aws-lambda/aws-lambda.d.ts +++ b/aws-lambda/aws-lambda.d.ts @@ -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; } \ No newline at end of file From fdddacc2e801364decd875dee45bbaf90110631d Mon Sep 17 00:00:00 2001 From: recuedav Date: Fri, 19 Aug 2016 13:54:14 +0200 Subject: [PATCH 178/203] 6586 FIX lodash chain split --- lodash/lodash-3.10-tests.ts | 19 +++++++++++++++++++ lodash/lodash-3.10.d.ts | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/lodash/lodash-3.10-tests.ts b/lodash/lodash-3.10-tests.ts index 2616822f6e..3eeff29221 100644 --- a/lodash/lodash-3.10-tests.ts +++ b/lodash/lodash-3.10-tests.ts @@ -9658,6 +9658,25 @@ namespace TestSnakeCase { } } +// _.split +namespace TestSplit { + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('a-b-c').split(); + result = _('a-b-c').split('-'); + result = _('a-b-c').split('-', 2); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('a-b-c').chain().split(); + result = _('a-b-c').chain().split('-'); + result = _('a-b-c').chain().split('-', 2); + } +} + // _.startCase namespace TestStartCase { { diff --git a/lodash/lodash-3.10.d.ts b/lodash/lodash-3.10.d.ts index aea06a8362..a63d92d0f0 100644 --- a/lodash/lodash-3.10.d.ts +++ b/lodash/lodash-3.10.d.ts @@ -14720,6 +14720,27 @@ declare module _ { snakeCase(): LoDashExplicitWrapper; } + //_.split + interface LoDashImplicitWrapper { + /** + * 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; + } + + interface LoDashExplicitWrapper { + /** + * @see _.split + */ + split(separator?: RegExp|string, limit?: number): LoDashImplicitArrayWrapper; + } + //_.startCase interface LoDashStatic { /** From 0feed49c7d294522da1d9ac7589740303b458b86 Mon Sep 17 00:00:00 2001 From: Marcel Haldemann Date: Fri, 19 Aug 2016 15:19:00 +0200 Subject: [PATCH 179/203] support for cookieOptions.expires to be false (to be valid only until Browser closes) --- express-serve-static-core/express-serve-static-core.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-serve-static-core/express-serve-static-core.d.ts b/express-serve-static-core/express-serve-static-core.d.ts index f83e509e63..745b0e6ab2 100644 --- a/express-serve-static-core/express-serve-static-core.d.ts +++ b/express-serve-static-core/express-serve-static-core.d.ts @@ -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; From c34b986e7b1a52f38e28c649a166d5416e81c561 Mon Sep 17 00:00:00 2001 From: Marcel Haldemann Date: Fri, 19 Aug 2016 15:41:12 +0200 Subject: [PATCH 180/203] support for req.session.cookie.expires to be false added (false means: cookie to remain for only the duration of the user-agent) --- express-session/express-session.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-session/express-session.d.ts b/express-session/express-session.d.ts index 156e9404fc..90e1ed07cc 100644 --- a/express-session/express-session.d.ts +++ b/express-session/express-session.d.ts @@ -30,7 +30,7 @@ declare namespace Express { secure?: boolean; httpOnly: boolean; domain?: string; - expires: Date; + expires: Date | boolean; serialize: (name: string, value: string) => string; } } From 3aa72a05675e3be3781f41a15b0d95842994d094 Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Fri, 19 Aug 2016 11:19:57 -0400 Subject: [PATCH 181/203] document the enum types --- google-earth/google-earth.d.ts | 81 ++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 14 deletions(-) diff --git a/google-earth/google-earth.d.ts b/google-earth/google-earth.d.ts index 702524a076..3c85b96d7f 100644 --- a/google-earth/google-earth.d.ts +++ b/google-earth/google-earth.d.ts @@ -14,6 +14,73 @@ declare namespace google { declare namespace google.earth { + /** + * Specifies the current stage of the flow of events. + */ + export type GEEventPhaseEnum = any; + + /** + * Specifies how a feature should be displayed in a list view. + */ + export type KmlListItemTypeEnum = any; + + /** + * Specifies which color mode effect to apply to the base color. + */ + export type KmlColorModeEnum = any; + + /* + * Specifies how the altitude property is interpreted. + */ + export type KmlAltitudeModeEnum = any; + + /** + * Specifies how the link is refreshed. + */ + export type KmlRefreshModeEnum = any; + + /** + * Specifies how the link is refreshed when the viewport changes. + */ + export type KmlViewRefreshModeEnum = any; + + /** + * Specifies which units a value is specified in. + */ + type KmlUnitsEnum = any; + + /** + * Specifies if the map type is Earth or sky mode. + */ + type GEMapTypeEnum = any; + + /** + * Specifies if a control is always visible, always hidden, + * or visible only when the user intends to use the control. + */ + type GEVisibilityEnum = any; + + /** + * Specifies what to sample when performing a hit test. + */ + type GEHitTestModeEnum = number; + + /** + * Specifies the size of the navigation control. + */ + type GENavigationControlEnum = number; + + /** + * Specifies the state of viewer options, including sunlight, + * Street View, and historical imagery. + */ + type GEViewerOptionsValueEnum = number; + + /* + * Specifies the viewer option types. + */ + type GEViewerOptionsTypeEnum = number; + /** * Whether or not the Google Earth Browser Plug-in and API are supported on the current browser and operating system. */ @@ -3908,18 +3975,4 @@ declare namespace google.earth { getStreamingPercent(): number; } - export enum GEEventPhaseEnum {} - export enum KmlListItemTypeEnum {} - export enum KmlColorModeEnum {} - export enum KmlAltitudeModeEnum {} - export enum KmlRefreshModeEnum {} - export enum KmlViewRefreshModeEnum {} - export enum KmlUnitsEnum {} - export enum GEMapTypeEnum {} - export enum GEVisibilityEnum {} - export enum GEHitTestModeEnum {} - export enum GEViewerOptionsValueEnum {} - export enum GENavigationControlEnum {} - export enum GEViewerOptionsTypeEnum {} - } From ba133509fc0eb90c60f5f172389d68ab2454454c Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Fri, 19 Aug 2016 11:26:34 -0400 Subject: [PATCH 182/203] use any type --- google-earth/google-earth.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/google-earth/google-earth.d.ts b/google-earth/google-earth.d.ts index 3c85b96d7f..d0adc8c04e 100644 --- a/google-earth/google-earth.d.ts +++ b/google-earth/google-earth.d.ts @@ -63,23 +63,23 @@ declare namespace google.earth { /** * Specifies what to sample when performing a hit test. */ - type GEHitTestModeEnum = number; + type GEHitTestModeEnum = any; /** * Specifies the size of the navigation control. */ - type GENavigationControlEnum = number; + type GENavigationControlEnum = any; /** * Specifies the state of viewer options, including sunlight, * Street View, and historical imagery. */ - type GEViewerOptionsValueEnum = number; + type GEViewerOptionsValueEnum = any; /* * Specifies the viewer option types. */ - type GEViewerOptionsTypeEnum = number; + type GEViewerOptionsTypeEnum = any; /** * Whether or not the Google Earth Browser Plug-in and API are supported on the current browser and operating system. From 5863f2493ea8f12c4925c60d53e6184ffb43104e Mon Sep 17 00:00:00 2001 From: Daniel Niederberger Date: Fri, 19 Aug 2016 17:50:10 +0200 Subject: [PATCH 183/203] Add missing definition In angular you can either write `directive('myDirective', ['$http', function($http) {...}])`, which is minification safe, but it's also possible to write `directive('myDirective', function($http) {...})` which might not be minification safe, but valid angular nonetheless. --- angularjs/angular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 3c13fd6cf3..fcfde914e3 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -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. From 88c5e9aca6c4a8c065cca68204ba36b8c2ffdb73 Mon Sep 17 00:00:00 2001 From: Maciej Suchecki Date: Sat, 20 Aug 2016 11:54:27 +0200 Subject: [PATCH 184/203] Modified color properties to accept gradients in whole Highcharts lib (#10700) Updated setExtremes method to accept 'eventArguments' parameter Updated 'crosshair' field to accept boolean value in HighchartsAxisOptions --- highcharts/highcharts.d.ts | 76 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index de1e5343ca..bfe5a70235 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -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. From 502f0dfb79a3f1587a4b49b0c756bdcd12dbd1b1 Mon Sep 17 00:00:00 2001 From: Ezekiel Victor Date: Sat, 20 Aug 2016 02:55:51 -0700 Subject: [PATCH 185/203] definitions for karma-fixture (#10724) * definitions for karma-fixture * return type here can be any object with any keys (arbitrary JSON) * Update karma-fixture.d.ts --- karma-fixture/karma-fixture-tests.ts | 10 ++++++++++ karma-fixture/karma-fixture.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 karma-fixture/karma-fixture-tests.ts create mode 100644 karma-fixture/karma-fixture.d.ts diff --git a/karma-fixture/karma-fixture-tests.ts b/karma-fixture/karma-fixture-tests.ts new file mode 100644 index 0000000000..b3a1d8e51c --- /dev/null +++ b/karma-fixture/karma-fixture-tests.ts @@ -0,0 +1,10 @@ +/// + +fixture.setBase('fixtures/base/path'); +fixture.load('test1.html', 'test1.json', false); +fixture.load('test1.html', 'test2.html', 'test1.json'); +fixture.set('', true); +fixture.set('', ''); +fixture.cleanup(); +fixture.el.firstChild; +JSON.stringify(fixture.json[0]); diff --git a/karma-fixture/karma-fixture.d.ts b/karma-fixture/karma-fixture.d.ts new file mode 100644 index 0000000000..8e4d18fd47 --- /dev/null +++ b/karma-fixture/karma-fixture.d.ts @@ -0,0 +1,27 @@ +// Type definitions for karma-fixture 0.2.6 +// Project: https://github.com/billtrik/karma-fixture +// Definitions by: Ezekiel Victor +// 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; +} From cf44ce85f33d43a9e1717efbf47ea6a11560b302 Mon Sep 17 00:00:00 2001 From: Ivo Stratev Date: Sat, 20 Aug 2016 12:56:15 +0300 Subject: [PATCH 186/203] source5 type should be generic R (#10726) * source5 should be of generic type R * Update simple-assign-tests.ts --- simple-assign/simple-assign-tests.ts | 79 +++++++++++++++++++++++++--- simple-assign/simple-assign.d.ts | 2 +- 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/simple-assign/simple-assign-tests.ts b/simple-assign/simple-assign-tests.ts index 3970356f5b..d39583bc8c 100644 --- a/simple-assign/simple-assign-tests.ts +++ b/simple-assign/simple-assign-tests.ts @@ -1,15 +1,78 @@ - /// -import assign = require("simple-assign"); +import simpleAssign = require("simple-assign"); -function assign1() { - return assign({hello: "world"}); +interface Target { + hellow: string; } -function assign2() { - return assign({hello: "world"}, {hello: "worlds", second: "extra"}); +interface Source1 { + source1: string; } -function assign3() { - return assign({hello: "world"}, {hello: "worlds", second: "extra"}, {hello: "stop", the: "spinning"}); +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" + }); } diff --git a/simple-assign/simple-assign.d.ts b/simple-assign/simple-assign.d.ts index 3b9229bd65..7c44236f4c 100644 --- a/simple-assign/simple-assign.d.ts +++ b/simple-assign/simple-assign.d.ts @@ -8,7 +8,7 @@ declare module "simple-assign" { function simpleAssign(target: T, source1: U, source2: V): T & U & V; function simpleAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; function simpleAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; - function simpleAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: T): T & U & V & W & Q & R; + function simpleAssign(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; } From 8ff9b5f4ad74ecdecbf3aa6acf1dcc0efc43b70f Mon Sep 17 00:00:00 2001 From: Gary Blackwood Date: Sat, 20 Aug 2016 10:59:25 +0100 Subject: [PATCH 187/203] Update ravenjs configuration options. (#10732) The configuration options available to the ravenjs client have changed since the initial creation of the type definitions. See: https://docs.sentry.io/hosted/clients/javascript/config/ --- ravenjs/ravenjs.d.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ravenjs/ravenjs.d.ts b/ravenjs/ravenjs.d.ts index 53cf4ad9cb..ae891a7cda 100644 --- a/ravenjs/ravenjs.d.ts +++ b/ravenjs/ravenjs.d.ts @@ -1,6 +1,6 @@ // Type definitions for Raven.js // Project: https://github.com/getsentry/raven-js -// Definitions by: Santi Albo , Benjamin Pannell +// Definitions by: Santi Albo , Benjamin Pannell , Gary Blackwood // 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 { From 55c3e254e151847b8d37ca09b1a566ad4a48a66a Mon Sep 17 00:00:00 2001 From: York Yao Date: Sat, 20 Aug 2016 18:00:18 +0800 Subject: [PATCH 188/203] fix type of iconlib (#10716) * fix type of iconlib * better type of icon lib and theme --- json-editor/json-editor.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json-editor/json-editor.d.ts b/json-editor/json-editor.d.ts index cbb0c9c29c..280c17e70f 100644 --- a/json-editor/json-editor.d.ts +++ b/json-editor/json-editor.d.ts @@ -39,7 +39,7 @@ type JSONEditorOptions = { /** * 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 = { /** * 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. */ From 198bb0ca9a8cbe7060bb5c75f883bbdc0c35d014 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Mon, 22 Aug 2016 22:58:55 +0200 Subject: [PATCH 189/203] Add missing method --- github-electron/github-electron.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 7b246966ab..f2fe5c3ba4 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -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. */ From 69ecb66f736eb83b490c916f6be8ac65a5cf6163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez?= Date: Mon, 22 Aug 2016 10:07:25 -0600 Subject: [PATCH 190/203] Made node Buffer's lastIndexOf and indexOf conformant to node API --- node/node-tests.ts | 11 +++++++++++ node/node.d.ts | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index fd79f28f9d..bd19697f31 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -244,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'); diff --git a/node/node.d.ts b/node/node.d.ts index 750d273988..d86dac906c 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -503,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 From c532a2d96c13392d92f70b8961dfa8cca159248d Mon Sep 17 00:00:00 2001 From: Zlatkovsky Date: Tue, 23 Aug 2016 12:13:16 -0700 Subject: [PATCH 191/203] Fixed "no implicit any" issue with previous commit. --- office-js/office-js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/office-js/office-js.d.ts b/office-js/office-js.d.ts index 4f21022fe5..55b20f93cf 100644 --- a/office-js/office-js.d.ts +++ b/office-js/office-js.d.ts @@ -258,7 +258,7 @@ declare module OfficeExtension { /** * Creates a new promise based on a function that accepts resolve and reject handlers. */ - constructor(func: (resolve, reject) => void); + constructor(func: (resolve : (value?: R | IPromise) => void, reject: (error?: any) => void) => void); /** * Creates a promise that resolves when all of the child promises resolve. From 76fc7cd3089c09deefe1a3e43b937cfd8b969d1b Mon Sep 17 00:00:00 2001 From: Michael Durling Date: Tue, 23 Aug 2016 16:08:06 -0400 Subject: [PATCH 192/203] Add allowHTML NotificationSystem property --- react-notification-system/react-notification-system.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-notification-system/react-notification-system.d.ts b/react-notification-system/react-notification-system.d.ts index 4f51314680..31b151662a 100644 --- a/react-notification-system/react-notification-system.d.ts +++ b/react-notification-system/react-notification-system.d.ts @@ -74,6 +74,7 @@ declare namespace NotificationSystem { noAnimation?: boolean; ref?: string; style?: Style | boolean; + allowHTML?: boolean; } } From aefccb9b431554179eaddf90281ac0b73a701a33 Mon Sep 17 00:00:00 2001 From: Michael Durling Date: Tue, 23 Aug 2016 16:23:34 -0400 Subject: [PATCH 193/203] Fix name of Pusher interface property - sessionId is incorrect, should be sessionID --- pusher-js/pusher-js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pusher-js/pusher-js.d.ts b/pusher-js/pusher-js.d.ts index 0a6dc18d24..76bdb83c0e 100644 --- a/pusher-js/pusher-js.d.ts +++ b/pusher-js/pusher-js.d.ts @@ -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; } From a94bce4fff73a65b3a4471b6ce91780cc09ece5c Mon Sep 17 00:00:00 2001 From: ltrain777 Date: Wed, 24 Aug 2016 09:05:30 -0700 Subject: [PATCH 194/203] Fix json method signatures to match restler apis to pass json data. (#10736) --- restler/restler-tests.ts | 18 ++++++++++++++++-- restler/restler.d.ts | 12 ++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/restler/restler-tests.ts b/restler/restler-tests.ts index a709fc3375..8c53455d08 100644 --- a/restler/restler-tests.ts +++ b/restler/restler-tests.ts @@ -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 +}); diff --git a/restler/restler.d.ts b/restler/restler.d.ts index b504a4e75d..389203066d 100644 --- a/restler/restler.d.ts +++ b/restler/restler.d.ts @@ -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. From aba1694d0c591ff49e81115a46e2479d89a9ea84 Mon Sep 17 00:00:00 2001 From: Jack Moore Date: Wed, 24 Aug 2016 11:06:06 -0500 Subject: [PATCH 195/203] New definition for universal-router (#10744) * New definition for universal-router * Changed undefined return type to void --- universal-router/universal-router-tests.ts | 99 ++++++++++++++++++++++ universal-router/universal-router.d.ts | 70 +++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 universal-router/universal-router-tests.ts create mode 100644 universal-router/universal-router.d.ts diff --git a/universal-router/universal-router-tests.ts b/universal-router/universal-router-tests.ts new file mode 100644 index 0000000000..922ca137ad --- /dev/null +++ b/universal-router/universal-router-tests.ts @@ -0,0 +1,99 @@ +/// + +import {ActionContext, Params, resolve } from "universal-router"; + +// Test 1 +const routes1 = [ + { + path: "/one", + action: () => "Page One" + }, + { + path: "/two", + action: () => "Page Two" + } +]; + +resolve(routes1, { path: "/one" }) + .then(result => console.log(result)); + +// Test 2 +const routes2 = [ + { + path: "/hello/:username", + action: (context: ActionContext) => `Welcome, ${context.params["username"]}!` + } +]; + +resolve(routes2, { path: "/hello/john" }) + .then(result => console.log(result)); + + +// Test 3 +const routes3 = [ + { + path: "/hello/:username", + action: (ctx: ActionContext, { username }: Params) => `Welcome, ${username}!` + } +]; + +resolve(routes3, { path: "/hello/john" }) + .then(result => console.log(result)); + + +// Test 4 +const routes4 = [ + { + path: "/hello", + action: () => new Promise(resolve => { + setTimeout(() => resolve("Welcome!"), 1000); + }) + } +]; + +resolve(routes4, { path: "/hello" }) + .then(result => console.log(result)); + +// Test 5 +const routes5 = [ + { + path: "/hello/:username", + async action(ctx: ActionContext, { username }: Params) { + const waitable = async (name: string) => { + console.log(`Welcome ${name}`); + } + await waitable(username); + } + } +]; + +resolve(routes5, { path: "/hello/john" }) + .then(result => console.log(result)); + +// Test 6 +const routes6 = [ + { path: "/one", action: () => "

    Page One

    " }, + { path: "/two", action: () => "

    Page Two

    " } +]; + +resolve(routes6, { path: "/one" }).then(result => { + document.body.innerHTML = result || "

    Not Found

    "; +}); + +// Test 7 +interface Render { + render: typeof render; +} + +const routes7 = [ + { path: "/one", action: ({ render: func }: ActionContext & Render) => func("

    Page One

    ") }, + { path: "/two", action: ({ render: func }: ActionContext & Render) => func("

    Page Two

    ") } +]; + +function render(component: string) { + return new Promise(resolve => { + console.log(`Rendering... ${component}`); + }); +} + +resolve>(routes7, { path: "/one", render }); diff --git a/universal-router/universal-router.d.ts b/universal-router/universal-router.d.ts new file mode 100644 index 0000000000..6acba5c179 --- /dev/null +++ b/universal-router/universal-router.d.ts @@ -0,0 +1,70 @@ +// Type definitions for universal-router +// Project: https://github.com/kriasoft/universal-router +// Definitions by: Jack Moore +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "universal-router" { + /** + * Params is a key/value object that represents extracted URL paramters. Each + * URL parameter resolves to a string. + */ + export interface Params { + [key: string]: string; + } + + /** + * Context represents the context that is passed as the second argument + * passed to resolve. By default, it only is require to contain a path, but + * can be extended by the way of generics. + */ + export interface Context { + path: string; + } + + /** + * ActionContext is similar to Context, with the exception of an added params + * object. ActionContext is passed as the first argument to the action + * function. + */ + export interface ActionContext extends Context { + params: Params; + } + + /** + * A Route is a singular route in your application. It contains a path, an + * action function, and optional children which are an array of Route. + * + * @template C User context that is made union with ActionContext. + * @template R Result that every action function resolves to. If the action + * returns a Promise, R can be the type the Promise resolves to. + */ + export interface Route { + path: string; + action: (ctx: ActionContext & C, params: Params) => R | Promise | void; + children?: Routes; + } + + /** + * Routes in an array of type Route. + * @template C User context that is made union with ActionContext. + * @template R Result that every action function resolves to. If the action + * returns a Promise, R can be the type the Promise resolves to. + */ + export type Routes = Route[]; + + /** + * Resolve function that is given routes and a path or context object. + * Returns a Promise that resolves to result of the action function of the + * matched route. + * + * @template C User context that is made union with Context. + * @template R Result that every action function resolves to. If the action + * returns a Promise, R can be the type the Promise resolves to. + * + * @param {Routes | Route} routes - Single route or array of routes. + * @param {string | String | Context & C} pathOrContext - path to resolve or + * context object that contains the path along with other data. + * @return {Promise} - Result of matched action function wrapped in a Promsie. + */ + export function resolve(routes: Routes | Route, pathOrContext: string | String | Context & C): Promise +} \ No newline at end of file From 1fa21ec5019826429cf99b8b87175f9ec59407e0 Mon Sep 17 00:00:00 2001 From: "Keith D. Moore" Date: Wed, 24 Aug 2016 11:07:10 -0500 Subject: [PATCH 196/203] add typings for pouchdb-upsert. resolves #10596 (#10752) --- pouchdb-upsert/pouchdb-upsert-tests.ts | 49 +++++++++++++++++++ pouchdb-upsert/pouchdb-upsert.d.ts | 66 ++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 pouchdb-upsert/pouchdb-upsert-tests.ts create mode 100644 pouchdb-upsert/pouchdb-upsert.d.ts diff --git a/pouchdb-upsert/pouchdb-upsert-tests.ts b/pouchdb-upsert/pouchdb-upsert-tests.ts new file mode 100644 index 0000000000..fa4eb83af3 --- /dev/null +++ b/pouchdb-upsert/pouchdb-upsert-tests.ts @@ -0,0 +1,49 @@ +/// + +import * as pouchdbUpsert from 'pouchdb-upsert'; +PouchDB.plugin(pouchdbUpsert); + +namespace PouchDBUpsertTests { + type UpsertDocModel = { _id: 'test-doc1', name: 'test' }; + let docToUpsert: PouchDB.Core.Document; + const db = new PouchDB(); + + function testUpsert_WithPromise_AndReturnDoc() { + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + // Make some updates.... + return doc; + }).then((res: PouchDB.Core.Response) => { + }); + } + + function testUpsert_WithPromise_AndReturnBoolean() { + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + // Make some updates.... + return false; + }).then((res: PouchDB.Core.Response) => { + }); + } + + function testUpsert_WithCallback_AndReturnDoc() { + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + // Make some updates.... + return doc; + }, (res: PouchDB.Core.Response) => {}); + } + + function testUpsert_WithCallback_AndReturnBoolean() { + // callback return boolean + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + // 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) => {}); + } +} diff --git a/pouchdb-upsert/pouchdb-upsert.d.ts b/pouchdb-upsert/pouchdb-upsert.d.ts new file mode 100644 index 0000000000..b0a4e760a3 --- /dev/null +++ b/pouchdb-upsert/pouchdb-upsert.d.ts @@ -0,0 +1,66 @@ +// Type definitions for pouchdb-upsert v2.0.1 +// Project: https://github.com/pouchdb/upsert +// Definitions by: Keith D. Moore , Andrew Mitchell +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace PouchDB { + + interface Database { + /** + * 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): Promise; + + /** + * 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, + callback: Core.Callback): 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): Promise; + + // + /** + * 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, + callback: Core.Callback): void; + } + + interface UpsertDiffCallback { + (doc: Core.Document): Core.Document|boolean; + } +} + +declare module 'pouchdb-upsert' { + const plugin: PouchDB.Plugin; + export = plugin; +} From 77bc119042bdf92f5740d912a3a3bb336437ac08 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 24 Aug 2016 09:11:07 -0700 Subject: [PATCH 197/203] Add extra static members to the Node v4 Error class (#10747) Defines `stackTraceLimit` and `captureStackTrace` as static members for the Error class in Node v4 so their usage can be recognized. --- node/node-4-tests.ts | 14 ++++++++++++++ node/node-4.d.ts | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/node/node-4-tests.ts b/node/node-4-tests.ts index 8cddf66987..9db708b910 100644 --- a/node/node-4-tests.ts +++ b/node/node-4-tests.ts @@ -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); + } +} \ No newline at end of file diff --git a/node/node-4.d.ts b/node/node-4.d.ts index e60da8e309..848b0536d0 100644 --- a/node/node-4.d.ts +++ b/node/node-4.d.ts @@ -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, From d7c91b7a92d4e42ca50d375454b869e06bb80bb3 Mon Sep 17 00:00:00 2001 From: "Keith D. Moore" Date: Wed, 24 Aug 2016 11:28:27 -0500 Subject: [PATCH 198/203] add remove function typings to pouchdb-core (#10754) --- pouchdb-core/pouchdb-core-tests.ts | 27 +++++++++++++++++++++++++++ pouchdb-core/pouchdb-core.d.ts | 14 ++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/pouchdb-core/pouchdb-core-tests.ts b/pouchdb-core/pouchdb-core-tests.ts index ac7a6c3e69..71f5db7d63 100644 --- a/pouchdb-core/pouchdb-core-tests.ts +++ b/pouchdb-core/pouchdb-core-tests.ts @@ -75,4 +75,31 @@ namespace PouchDBCoreTests { db.info({ ajax: { cache: true }}, (error, result) => { }); } + + function testRemove() { + type MyModel = { rev: 'rev', property: 'someProperty '}; + let model: PouchDB.Core.Document; + const id = 'model'; + const rev = 'rev'; + + const db = new PouchDB(); + + // 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) => {}); + } } diff --git a/pouchdb-core/pouchdb-core.d.ts b/pouchdb-core/pouchdb-core.d.ts index a8b6418510..1a56e51785 100644 --- a/pouchdb-core/pouchdb-core.d.ts +++ b/pouchdb-core/pouchdb-core.d.ts @@ -319,6 +319,20 @@ declare namespace PouchDB { revision?: Core.RevisionId, options?: Core.PutOptions): Promise; + /** Remove a doc from the database */ + remove(doc: Core.Document, + options: Core.Options, + callback: Core.Callback): void; + remove(docId: Core.DocumentId, + revision: Core.RevisionId, + options: Core.Options, + callback: Core.Callback): void; + remove(doc: Core.Document, + options?: Core.Options): Promise; + remove(docId: Core.DocumentId, + revision: Core.RevisionId, + options?: Core.Options): Promise; + /** Get database information */ info(options: Core.InfoOptions | void, callback: Core.Callback): void; From 3f9b9ed351d9fc5c64576de74527ba923f5d6ed0 Mon Sep 17 00:00:00 2001 From: "Keith D. Moore" Date: Wed, 24 Aug 2016 11:28:54 -0500 Subject: [PATCH 199/203] add compact function typings to pouchdb-core (#10753) --- pouchdb-core/pouchdb-core-tests.ts | 10 ++++++++++ pouchdb-core/pouchdb-core.d.ts | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/pouchdb-core/pouchdb-core-tests.ts b/pouchdb-core/pouchdb-core-tests.ts index 71f5db7d63..b46bce834d 100644 --- a/pouchdb-core/pouchdb-core-tests.ts +++ b/pouchdb-core/pouchdb-core-tests.ts @@ -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<{}>(); diff --git a/pouchdb-core/pouchdb-core.d.ts b/pouchdb-core/pouchdb-core.d.ts index 1a56e51785..b0498e76af 100644 --- a/pouchdb-core/pouchdb-core.d.ts +++ b/pouchdb-core/pouchdb-core.d.ts @@ -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>; + /** Compact the database */ + compact(options?: Core.CompactOptions): Promise; + compact(options: Core.CompactOptions, + callback: Core.Callback): void; + /** Destroy the database */ destroy(options: Core.DestroyOptions | void, callback: Core.AnyCallback): void; From ccf79bc4f71390d180da5ef4499f61fed1f69077 Mon Sep 17 00:00:00 2001 From: nickp10 Date: Wed, 24 Aug 2016 10:31:03 -0600 Subject: [PATCH 200/203] Adding definitions for the set-cookie-parser library (#10756) * Adding definitions for the set-cookie-parser library * Adding newline to end of file --- set-cookie-parser/set-cookie-parser-tests.ts | 45 ++++++++++++++++++++ set-cookie-parser/set-cookie-parser.d.ts | 27 ++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 set-cookie-parser/set-cookie-parser-tests.ts create mode 100644 set-cookie-parser/set-cookie-parser.d.ts diff --git a/set-cookie-parser/set-cookie-parser-tests.ts b/set-cookie-parser/set-cookie-parser-tests.ts new file mode 100644 index 0000000000..731d38efaa --- /dev/null +++ b/set-cookie-parser/set-cookie-parser-tests.ts @@ -0,0 +1,45 @@ +/// +/// + +import assert = require("assert"); +import http = require("http"); +import setCookie = require("set-cookie-parser"); + +// Required properties only test +var requiredOnly = "foo=bar;"; +var 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 = {}; +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"); diff --git a/set-cookie-parser/set-cookie-parser.d.ts b/set-cookie-parser/set-cookie-parser.d.ts new file mode 100644 index 0000000000..91ca3ef2c1 --- /dev/null +++ b/set-cookie-parser/set-cookie-parser.d.ts @@ -0,0 +1,27 @@ +// Type definitions for set-cookie-parser +// Project: https://github.com/nfriedly/set-cookie-parser +// Definitions by: Nick Paddock +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "set-cookie-parser" { + import http = require("http"); + + function SetCookieParser(input: string | string[] | http.IncomingMessage): SetCookieParser.Cookie[]; + + namespace SetCookieParser { + interface Cookie { + name: string; + value: string; + path?: string; + expires?: Date; + maxAge?: number; + domain?: string; + secure?: boolean; + httpOnly?: boolean; + } + } + + export = SetCookieParser; +} From f0fede9ce3fb165fe254c367e44a2370fa033735 Mon Sep 17 00:00:00 2001 From: Giacomo Rebonato Date: Wed, 24 Aug 2016 17:33:31 +0100 Subject: [PATCH 201/203] added minSize and maxSide to React-Dropzone (#10755) * added minSize and maxSide * added comment to properties and fixed test --- react-dropzone/react-dropzone-tests.tsx | 2 ++ react-dropzone/react-dropzone.d.ts | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/react-dropzone/react-dropzone-tests.tsx b/react-dropzone/react-dropzone-tests.tsx index 6216b5f20e..ca3d462596 100644 --- a/react-dropzone/react-dropzone-tests.tsx +++ b/react-dropzone/react-dropzone-tests.tsx @@ -19,6 +19,8 @@ class Test extends React.Component { style={{ borderStyle: "dashed" }} activeStyle={{ borderStyle: "dotted" }} className="regular" + minSize={2000} + maxSize={Infinity} activeClassName="active" rejectClassName="reject" disableClick={true} diff --git a/react-dropzone/react-dropzone.d.ts b/react-dropzone/react-dropzone.d.ts index a8198524de..792fd436ba 100644 --- a/react-dropzone/react-dropzone.d.ts +++ b/react-dropzone/react-dropzone.d.ts @@ -22,6 +22,14 @@ declare namespace ReactDropzone { * Clicking the 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. */ From 882c5665a1031acb2a791af1928b3b26a129e094 Mon Sep 17 00:00:00 2001 From: York Yao Date: Thu, 25 Aug 2016 00:38:18 +0800 Subject: [PATCH 202/203] add type of socket.io-parser (#10761) * add type of socket.io-parser * fix CI --- socket.io-parser/socket.io-parser-tests.ts | 41 ++++++++++++++++++++++ socket.io-parser/socket.io-parser.d.ts | 39 ++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 socket.io-parser/socket.io-parser-tests.ts create mode 100644 socket.io-parser/socket.io-parser.d.ts diff --git a/socket.io-parser/socket.io-parser-tests.ts b/socket.io-parser/socket.io-parser-tests.ts new file mode 100644 index 0000000000..917f72500f --- /dev/null +++ b/socket.io-parser/socket.io-parser-tests.ts @@ -0,0 +1,41 @@ +/// +/// + +import * as parser from 'socket.io-parser'; +var encoder = new parser.Encoder(); +var packet = { + type: parser.EVENT, + data: 'test-packet', + id: 13 +}; +encoder.encode(packet, function (encodedPackets) { + var decoder = new parser.Decoder(); + decoder.on('decoded', function (decodedPacket) { + decodedPacket.type == parser.EVENT + decodedPacket.data == 'test-packet' + decodedPacket.id == 13 + }); + + for (var i = 0; i < encodedPackets.length; i++) { + decoder.add(encodedPackets[i]); + } +}); + +var packet2 = { + type: parser.BINARY_EVENT, + data: { i: new Buffer(1234), j: new Blob([new ArrayBuffer(2)]) }, + id: 15 +}; +encoder.encode(packet2, function (encodedPackets) { + var decoder = new parser.Decoder(); + decoder.on('decoded', function (decodedPacket) { + decodedPacket.type == parser.BINARY_EVENT + Buffer.isBuffer(decodedPacket.data.i) == true + Buffer.isBuffer(decodedPacket.data.j) == true + decodedPacket.id == 15 + }); + + for (var i = 0; i < encodedPackets.length; i++) { + decoder.add(encodedPackets[i]); + } +}); diff --git a/socket.io-parser/socket.io-parser.d.ts b/socket.io-parser/socket.io-parser.d.ts new file mode 100644 index 0000000000..0c4903fda4 --- /dev/null +++ b/socket.io-parser/socket.io-parser.d.ts @@ -0,0 +1,39 @@ +// Type definitions for json-editor +// Project: https://github.com/socketio/socket.io-parser +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "socket.io-parser" { + namespace Parser { + type Packet = { + type: number, + data: any, + id: number + } + type EncodedPacket = string | Buffer | ArrayBuffer | Blob; + + var types: string[]; + + var CONNECT: number; + var DISCONNECT: number; + var EVENT: number; + var ACK: number; + var ERROR: number; + var BINARY_EVENT: number; + var BINARY_ACK: number; + + class Encoder { + encode(packet: Packet, callback: (encodedPackets: EncodedPacket[]) => void): void; + } + + class Decoder { + on(event: string, callback: (decodedPacket: Packet) => void): void; + add(encodedPacket: EncodedPacket): void; + destroy(): void; + } + } + + export = Parser; +} From 23c9f2230960c4a9b83e4297471d082a27d02b74 Mon Sep 17 00:00:00 2001 From: David Herges Date: Wed, 24 Aug 2016 18:38:38 +0200 Subject: [PATCH 203/203] Adding type definitions for 'halfred' (#10764) --- halfred/halfred-tests.ts | 13 +++ halfred/halfred.d.ts | 247 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 260 insertions(+) create mode 100644 halfred/halfred-tests.ts create mode 100644 halfred/halfred.d.ts diff --git a/halfred/halfred-tests.ts b/halfred/halfred-tests.ts new file mode 100644 index 0000000000..3aecf39962 --- /dev/null +++ b/halfred/halfred-tests.ts @@ -0,0 +1,13 @@ +/// + +// 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); +} diff --git a/halfred/halfred.d.ts b/halfred/halfred.d.ts new file mode 100644 index 0000000000..9c1d571a9d --- /dev/null +++ b/halfred/halfred.d.ts @@ -0,0 +1,247 @@ +// Type definitions for Halfred v1.0.0 +// Project: https://github.com/basti1302/halfred +// Definitions by: David Herges +// 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; + + } + +}