From 7c50d2c7a7d11b0e6e76508b59b359b4ae4e558c Mon Sep 17 00:00:00 2001 From: "Dmitry A. Efimenko" Date: Thu, 15 Sep 2016 10:20:57 -0700 Subject: [PATCH 01/41] added prop options and func timeFormatter added property `options`, which can be found in [the code](https://github.com/joewalnes/smoothie/blob/15fc4b62f5b23c8d5dd1784c820ae73f341626e6/smoothie.js#L270). Even though it's not mentioned in the docs, it useful to be able to access these options after chart is initialized when you want to change appearance in real tme. added function `timeFormatter`, which is mentioned in [right here, in the definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/smoothie/smoothie.d.ts#L127) and can be found in [the code](https://github.com/joewalnes/smoothie/blob/15fc4b62f5b23c8d5dd1784c820ae73f341626e6/smoothie.js#L795) --- smoothie/smoothie.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smoothie/smoothie.d.ts b/smoothie/smoothie.d.ts index 98f205f598..c396261c52 100644 --- a/smoothie/smoothie.d.ts +++ b/smoothie/smoothie.d.ts @@ -141,6 +141,8 @@ declare module "smoothie" */ export class SmoothieChart { + options: IChartOptions; + constructor(chartOptions?: IChartOptions); /** @@ -188,5 +190,7 @@ declare module "smoothie" updateValueRange(): void; render(canvas?: HTMLCanvasElement, time?: number): void; + + static timeFormatter(date: Date): string; } } From d907b02638bf6c56ae3f632ca5c151cb869df5b4 Mon Sep 17 00:00:00 2001 From: Izaak Baker Date: Mon, 26 Sep 2016 14:01:45 -0700 Subject: [PATCH 02/41] Add module declaration to crossfilter so that it can be explicitly imported (#11521) --- crossfilter/crossfilter.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crossfilter/crossfilter.d.ts b/crossfilter/crossfilter.d.ts index 646d8abeb0..ed888f6959 100644 --- a/crossfilter/crossfilter.d.ts +++ b/crossfilter/crossfilter.d.ts @@ -1,6 +1,6 @@ // Type definitions for CrossFilter // Project: https://github.com/square/crossfilter -// Definitions by: Schmulik Raskin +// Definitions by: Schmulik Raskin , Izaak Baker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace CrossFilter { @@ -111,3 +111,8 @@ declare namespace CrossFilter { } declare var crossfilter: CrossFilter.CrossFilterStatic; +declare module "crossfilter" { + var crossfilter: CrossFilter.CrossFilterStatic; + export = crossfilter; +} + From 22a311bd60be06c92d4b9a6646e30b3180627158 Mon Sep 17 00:00:00 2001 From: David Lee Date: Mon, 26 Sep 2016 17:44:22 -0500 Subject: [PATCH 03/41] Add typings for murmurhash3js --- murmurhash3js/murmurhash3js-tests.ts | 12 ++++++++++++ murmurhash3js/murmurhash3js.d.ts | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 murmurhash3js/murmurhash3js-tests.ts create mode 100644 murmurhash3js/murmurhash3js.d.ts diff --git a/murmurhash3js/murmurhash3js-tests.ts b/murmurhash3js/murmurhash3js-tests.ts new file mode 100644 index 0000000000..297adcbc67 --- /dev/null +++ b/murmurhash3js/murmurhash3js-tests.ts @@ -0,0 +1,12 @@ +/// + +import murmurhash3js = require('murmurhash3js'); + +murmurhash3js.x86.hash32('string'); +murmurhash3js.x86.hash32('string with seed', 1337); + +murmurhash3js.x86.hash128('string'); +murmurhash3js.x86.hash128('string with seed', 1337); + +murmurhash3js.x64.hash128('string'); +murmurhash3js.x64.hash128('string with seed', 1337); diff --git a/murmurhash3js/murmurhash3js.d.ts b/murmurhash3js/murmurhash3js.d.ts new file mode 100644 index 0000000000..f43deeaa37 --- /dev/null +++ b/murmurhash3js/murmurhash3js.d.ts @@ -0,0 +1,15 @@ +// Type definitions for murmurhash3js v3.0.1 +// Project: https://github.com/pid/murmurHash3js +// Definitions by: Dave Lee +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'murmurhash3js' { + export module x86 { + function hash32(val: string, seed?: number): string; + function hash128(val: string, seed?: number): string; + } + + export module x64 { + function hash128(val: string, seed?: number): string; + } +} \ No newline at end of file From 5143d60f3790c68c23ebbaf8f78951316a32322e Mon Sep 17 00:00:00 2001 From: David Lee Date: Mon, 26 Sep 2016 17:46:34 -0500 Subject: [PATCH 04/41] fix module import to be ES6 compliant --- murmurhash3js/murmurhash3js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/murmurhash3js/murmurhash3js-tests.ts b/murmurhash3js/murmurhash3js-tests.ts index 297adcbc67..f9a40619d6 100644 --- a/murmurhash3js/murmurhash3js-tests.ts +++ b/murmurhash3js/murmurhash3js-tests.ts @@ -1,6 +1,6 @@ /// -import murmurhash3js = require('murmurhash3js'); +import * as murmurhash3js from 'murmurhash3js'; murmurhash3js.x86.hash32('string'); murmurhash3js.x86.hash32('string with seed', 1337); From 7e08a4492cabd1e022f488d3be9ebe9d238c06fe Mon Sep 17 00:00:00 2001 From: David Lee Date: Mon, 26 Sep 2016 17:47:40 -0500 Subject: [PATCH 05/41] newline at EOF --- murmurhash3js/murmurhash3js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/murmurhash3js/murmurhash3js.d.ts b/murmurhash3js/murmurhash3js.d.ts index f43deeaa37..2193085d5b 100644 --- a/murmurhash3js/murmurhash3js.d.ts +++ b/murmurhash3js/murmurhash3js.d.ts @@ -12,4 +12,4 @@ declare module 'murmurhash3js' { export module x64 { function hash128(val: string, seed?: number): string; } -} \ No newline at end of file +} From 5ac67c6749dd84d45b091ef1b991f5cbb1171536 Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Mon, 26 Sep 2016 19:40:01 -0700 Subject: [PATCH 06/41] [rethinkdb] Adds missing promise methods to Cursor and Connection --- rethinkdb/rethinkdb-tests.ts | 6 ++++-- rethinkdb/rethinkdb.d.ts | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/rethinkdb/rethinkdb-tests.ts b/rethinkdb/rethinkdb-tests.ts index a6911e3021..4dbd7ab638 100644 --- a/rethinkdb/rethinkdb-tests.ts +++ b/rethinkdb/rethinkdb-tests.ts @@ -15,8 +15,10 @@ r.connect({host:"localhost", port: 28015}, function(err, conn) { }) .between("james", "beth") .limit(4) - .run(conn, function() { - + .run(conn, function(err, cursor) { + cursor.toArray().then(rows => { + console.log(rows); + }); }) }) diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index 7161e42060..0b4d6b54b9 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -35,11 +35,13 @@ declare module "rethinkdb" { export class Cursor { hasNext():boolean; - each(cb:(err:Error, row:any)=>void, done?:()=>void); - each(cb:(err:Error, row:any)=>boolean, done?:()=>void); // returning false stops iteration - next(cb:(err:Error, row:any) => void); - toArray(cb:(err:Error, rows:any[]) => void); - close(); + each(cb:(err:Error, row:any)=>void, done?:()=>void): void; + each(cb:(err:Error, row:any)=>boolean, done?:()=>void): void; // returning false stops iteration + next(cb:(err:Error, row:any) => void): void; + toArray(cb:(err:Error, rows:any[]) => void): void; + toArray(): Promise; + close(cb: (err: Error) => void): void; + close(): Promise; } interface ConnectionOptions { @@ -50,11 +52,14 @@ declare module "rethinkdb" { } interface Connection { - close(); + close(cb: (err: Error) => void): void; + close(opts: { noreplyWait: boolean }, cb: (err: Error) => void): void; + close(): Promise; + close(opts: { noreplyWait: boolean }): Promise; reconnect(cb?:(err:Error, conn:Connection)=>void):Promise; - use(dbName:string); - addListener(event:string, cb:Function); - on(event:string, cb:Function); + use(dbName:string): void; + addListener(event:string, cb:Function): void; + on(event:string, cb:Function): void; } interface Db { From 87a03f83ce8a03188424ca2126f4d1c70e17f0b4 Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Mon, 26 Sep 2016 19:41:08 -0700 Subject: [PATCH 07/41] [rethinkdb] Applied TypeScript formatting to the file --- rethinkdb/rethinkdb.d.ts | 368 +++++++++++++++++++-------------------- 1 file changed, 184 insertions(+), 184 deletions(-) diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index 0b4d6b54b9..dc251b2a8e 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -8,234 +8,234 @@ declare module "rethinkdb" { - export function connect(host:ConnectionOptions, cb?:(err:Error, conn:Connection)=>void):Promise; + export function connect(host: ConnectionOptions, cb?: (err: Error, conn: Connection) => void): Promise; - export function dbCreate(name:string):Operation; - export function dbDrop(name:string):Operation; - export function dbList():Operation; + export function dbCreate(name: string): Operation; + export function dbDrop(name: string): Operation; + export function dbList(): Operation; - export function db(name:string):Db; - export function table(name:string, options?:{useOutdated:boolean}):Table; + export function db(name: string): Db; + export function table(name: string, options?: { useOutdated: boolean }): Table; - export function asc(property:string):Sort; - export function desc(property:string):Sort; + export function asc(property: string): Sort; + export function desc(property: string): Sort; - export var count:Aggregator; - export function sum(prop:string):Aggregator; - export function avg(prop:string):Aggregator; + export var count: Aggregator; + export function sum(prop: string): Aggregator; + export function avg(prop: string): Aggregator; - export function row(name:string):Expression; - export function expr(stuff:any):Expression; + export function row(name: string): Expression; + export function expr(stuff: any): Expression; - export function now():Time; + export function now(): Time; - // Control Structures - export function branch(test:Expression, trueBranch:Expression, falseBranch:Expression):Expression; + // Control Structures + export function branch(test: Expression, trueBranch: Expression, falseBranch: Expression): Expression; - export class Cursor { - hasNext():boolean; - each(cb:(err:Error, row:any)=>void, done?:()=>void): void; - each(cb:(err:Error, row:any)=>boolean, done?:()=>void): void; // returning false stops iteration - next(cb:(err:Error, row:any) => void): void; - toArray(cb:(err:Error, rows:any[]) => void): void; - toArray(): Promise; - close(cb: (err: Error) => void): void; - close(): Promise; - } + export class Cursor { + hasNext(): boolean; + each(cb: (err: Error, row: any) => void, done?: () => void): void; + each(cb: (err: Error, row: any) => boolean, done?: () => void): void; // returning false stops iteration + next(cb: (err: Error, row: any) => void): void; + toArray(cb: (err: Error, rows: any[]) => void): void; + toArray(): Promise; + close(cb: (err: Error) => void): void; + close(): Promise; + } - interface ConnectionOptions { - host:string; - port:number; - db?:string; - authKey?:string; - } + interface ConnectionOptions { + host: string; + port: number; + db?: string; + authKey?: string; + } - interface Connection { - close(cb: (err: Error) => void): void; - close(opts: { noreplyWait: boolean }, cb: (err: Error) => void): void; - close(): Promise; - close(opts: { noreplyWait: boolean }): Promise; - reconnect(cb?:(err:Error, conn:Connection)=>void):Promise; - use(dbName:string): void; - addListener(event:string, cb:Function): void; - on(event:string, cb:Function): void; - } + interface Connection { + close(cb: (err: Error) => void): void; + close(opts: { noreplyWait: boolean }, cb: (err: Error) => void): void; + close(): Promise; + close(opts: { noreplyWait: boolean }): Promise; + reconnect(cb?: (err: Error, conn: Connection) => void): Promise; + use(dbName: string): void; + addListener(event: string, cb: Function): void; + on(event: string, cb: Function): void; + } - interface Db { - tableCreate(name:string, options?:TableOptions):Operation; - tableDrop(name:string):Operation; - tableList():Operation; - table(name:string, options?:GetTableOptions):Table; - } + interface Db { + tableCreate(name: string, options?: TableOptions): Operation; + tableDrop(name: string): Operation; + tableList(): Operation; + table(name: string, options?: GetTableOptions): Table; + } - interface TableOptions { - primary_key?:string; // 'id' - durability?:string; // 'soft' - cache_size?:number; - datacenter?:string; - } + interface TableOptions { + primary_key?: string; // 'id' + durability?: string; // 'soft' + cache_size?: number; + datacenter?: string; + } - interface GetTableOptions { - useOutdated: boolean; - } + interface GetTableOptions { + useOutdated: boolean; + } - interface Writeable { - update(obj:Object, options?:UpdateOptions):Operation; - replace(obj:Object, options?:UpdateOptions):Operation; - replace(expr:ExpressionFunction):Operation; - delete(options?:UpdateOptions):Operation; - } + interface Writeable { + update(obj: Object, options?: UpdateOptions): Operation; + replace(obj: Object, options?: UpdateOptions): Operation; + replace(expr: ExpressionFunction): Operation; + delete(options?: UpdateOptions): Operation; + } - interface Table extends Sequence { - indexCreate(name:string, index?:ExpressionFunction):Operation; - indexDrop(name:string):Operation; - indexList():Operation; + interface Table extends Sequence { + indexCreate(name: string, index?: ExpressionFunction): Operation; + indexDrop(name: string): Operation; + indexList(): Operation; - insert(obj:any[], options?:InsertOptions):Operation; - insert(obj:any, options?:InsertOptions):Operation; + insert(obj: any[], options?: InsertOptions): Operation; + insert(obj: any, options?: InsertOptions): Operation; - get(key:string):Sequence; // primary key - getAll(key:string, index?:Index):Sequence; // without index defaults to primary key - getAll(...keys:string[]):Sequence; - } + get(key: string): Sequence; // primary key + getAll(key: string, index?: Index): Sequence; // without index defaults to primary key + getAll(...keys: string[]): Sequence; + } - interface Sequence extends Operation, Writeable { + interface Sequence extends Operation, Writeable { - between(lower:any, upper:any, index?:Index):Sequence; - filter(rql:ExpressionFunction):Sequence; - filter(rql:Expression):Sequence; - filter(obj:{[key:string]:any}):Sequence; + between(lower: any, upper: any, index?: Index): Sequence; + filter(rql: ExpressionFunction): Sequence; + filter(rql: Expression): Sequence; + filter(obj: { [key: string]: any }): Sequence; - // Join - // these return left, right - innerJoin(sequence:Sequence, join:JoinFunction):Sequence; - outerJoin(sequence:Sequence, join:JoinFunction):Sequence; - eqJoin(leftAttribute:string, rightSequence:Sequence, index?:Index):Sequence; - eqJoin(leftAttribute:ExpressionFunction, rightSequence:Sequence, index?:Index):Sequence; - zip():Sequence; + // Join + // these return left, right + innerJoin(sequence: Sequence, join: JoinFunction): Sequence; + outerJoin(sequence: Sequence, join: JoinFunction): Sequence; + eqJoin(leftAttribute: string, rightSequence: Sequence, index?: Index): Sequence; + eqJoin(leftAttribute: ExpressionFunction, rightSequence: Sequence, index?: Index): Sequence; + zip(): Sequence; - // Transform - map(transform:ExpressionFunction):Sequence; - withFields(...selectors:any[]):Sequence; - concatMap(transform:ExpressionFunction):Sequence; - orderBy(...keys:string[]):Sequence; - orderBy(...sorts:Sort[]):Sequence; - skip(n:number):Sequence; - limit(n:number):Sequence; - slice(start:number, end?:number):Sequence; - nth(n:number):Expression; - indexesOf(obj:any):Sequence; - isEmpty():Expression; - union(sequence:Sequence):Sequence; - sample(n:number):Sequence; + // Transform + map(transform: ExpressionFunction): Sequence; + withFields(...selectors: any[]): Sequence; + concatMap(transform: ExpressionFunction): Sequence; + orderBy(...keys: string[]): Sequence; + orderBy(...sorts: Sort[]): Sequence; + skip(n: number): Sequence; + limit(n: number): Sequence; + slice(start: number, end?: number): Sequence; + nth(n: number): Expression; + indexesOf(obj: any): Sequence; + isEmpty(): Expression; + union(sequence: Sequence): Sequence; + sample(n: number): Sequence; - // Aggregate - reduce(r:ReduceFunction, base?:any):Expression; - count():Expression; - distinct():Sequence; - groupedMapReduce(group:ExpressionFunction, map:ExpressionFunction, reduce:ReduceFunction, base?:any):Sequence; - groupBy(...aggregators:Aggregator[]):Expression; // TODO: reduction object - contains(prop:string):Expression; + // Aggregate + reduce(r: ReduceFunction, base?: any): Expression; + count(): Expression; + distinct(): Sequence; + groupedMapReduce(group: ExpressionFunction, map: ExpressionFunction, reduce: ReduceFunction, base?: any): Sequence; + groupBy(...aggregators: Aggregator[]): Expression; // TODO: reduction object + contains(prop: string): Expression; - // Manipulation - pluck(...props:string[]):Sequence; - without(...props:string[]):Sequence; - } + // Manipulation + pluck(...props: string[]): Sequence; + without(...props: string[]): Sequence; + } - interface ExpressionFunction { - (doc:Expression):Expression; - } + interface ExpressionFunction { + (doc: Expression): Expression; + } - interface JoinFunction { - (left:Expression, right:Expression):Expression; - } + interface JoinFunction { + (left: Expression, right: Expression): Expression; + } - interface ReduceFunction { - (acc:Expression, val:Expression):Expression; - } + interface ReduceFunction { + (acc: Expression, val: Expression): Expression; + } - interface InsertOptions { - upsert: boolean; // true - durability: string; // 'soft' - return_vals: boolean; // false - } + interface InsertOptions { + upsert: boolean; // true + durability: string; // 'soft' + return_vals: boolean; // false + } - interface UpdateOptions { - non_atomic: boolean; - durability: string; // 'soft' - return_vals: boolean; // false - } + interface UpdateOptions { + non_atomic: boolean; + durability: string; // 'soft' + return_vals: boolean; // false + } - interface WriteResult { - inserted: number; - replaced: number; - unchanged: number; - errors: number; - deleted: number; - skipped: number; - first_error: Error; - generated_keys: string[]; // only for insert - } + interface WriteResult { + inserted: number; + replaced: number; + unchanged: number; + errors: number; + deleted: number; + skipped: number; + first_error: Error; + generated_keys: string[]; // only for insert + } - interface JoinResult { - left:any; - right:any; - } + interface JoinResult { + left: any; + right: any; + } - interface CreateResult { - created: number; - } + interface CreateResult { + created: number; + } - interface DropResult { - dropped: number; - } + interface DropResult { + dropped: number; + } - interface Index { - index: string; - left_bound?: string; // 'closed' - right_bound?: string; // 'open' - } + interface Index { + index: string; + left_bound?: string; // 'closed' + right_bound?: string; // 'open' + } - interface Expression extends Writeable, Operation { - (prop:string):Expression; - merge(query:Expression):Expression; - append(prop:string):Expression; - contains(prop:string):Expression; + interface Expression extends Writeable, Operation { + (prop: string): Expression; + merge(query: Expression): Expression; + append(prop: string): Expression; + contains(prop: string): Expression; - and(b:boolean):Expression; - or(b:boolean):Expression; - eq(v:any):Expression; - ne(v:any):Expression; - not():Expression; + and(b: boolean): Expression; + or(b: boolean): Expression; + eq(v: any): Expression; + ne(v: any): Expression; + not(): Expression; - gt(value:T):Expression; - ge(value:T):Expression; - lt(value:T):Expression; - le(value:T):Expression; + gt(value: T): Expression; + ge(value: T): Expression; + lt(value: T): Expression; + le(value: T): Expression; - add(n:number):Expression; - sub(n:number):Expression; - mul(n:number):Expression; - div(n:number):Expression; - mod(n:number):Expression; + add(n: number): Expression; + sub(n: number): Expression; + mul(n: number): Expression; + div(n: number): Expression; + mod(n: number): Expression; - hasFields(...fields:string[]):Expression; + hasFields(...fields: string[]): Expression; - default(value:T):Expression; - } + default(value: T): Expression; + } - interface Operation { - run(conn:Connection, cb?:(err:Error, result:T)=>void):Promise; - } + interface Operation { + run(conn: Connection, cb?: (err: Error, result: T) => void): Promise; + } - interface Aggregator {} - interface Sort {} + interface Aggregator { } + interface Sort { } - interface Time {} + interface Time { } - // http://www.rethinkdb.com/api/#js - // TODO control structures + // http://www.rethinkdb.com/api/#js + // TODO control structures } From 317be6bc69da5f69b9517f1ff4c7908745dd5592 Mon Sep 17 00:00:00 2001 From: Alex Gorbatchev Date: Mon, 26 Sep 2016 19:59:32 -0700 Subject: [PATCH 08/41] [rethinkdb] Adds types to Cursor methods --- rethinkdb/rethinkdb.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index dc251b2a8e..7babd42fe2 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -36,10 +36,15 @@ declare module "rethinkdb" { export class Cursor { hasNext(): boolean; each(cb: (err: Error, row: any) => void, done?: () => void): void; + each(cb: (err: Error, row: T) => void, done?: () => void): void; each(cb: (err: Error, row: any) => boolean, done?: () => void): void; // returning false stops iteration + each(cb: (err: Error, row: T) => boolean, done?: () => void): void; // returning false stops iteration next(cb: (err: Error, row: any) => void): void; + next(cb: (err: Error, row: T) => void): void; toArray(cb: (err: Error, rows: any[]) => void): void; + toArray(cb: (err: Error, rows: T[]) => void): void; toArray(): Promise; + toArray(): Promise; close(cb: (err: Error) => void): void; close(): Promise; } From b5979947c9bec28a35a1c4189ec21cea12d5dc3d Mon Sep 17 00:00:00 2001 From: "Dmitry A. Efimenko" Date: Mon, 26 Sep 2016 20:45:56 -0700 Subject: [PATCH 09/41] webpack - HotModuleReplacementPlugin has opts arg --- webpack/webpack.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index 96a7c710df..42dbc81e05 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -404,7 +404,7 @@ declare module "webpack" { } interface HotModuleReplacementPluginStatic { - new(): Plugin; + new(options?: any): Plugin; } interface ExtendedAPIPluginStatic { From 3a517142892532ae628f98d23990742bf212e34f Mon Sep 17 00:00:00 2001 From: stonio Date: Tue, 27 Sep 2016 09:55:51 +0200 Subject: [PATCH 10/41] [openlayers] forEachFeatureAtPixel can return a value See doc http://openlayers.org/en/latest/apidoc/ol.Map.html#forEachFeatureAtPixel --- openlayers/openlayers.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 0b9e1b41f4..36026fa70d 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -2131,7 +2131,7 @@ declare namespace ol { * @param ref2 Value to use as this when executing layerFilter. * @returns Callback result, i.e. the return value of last callback execution, or the first truthy callback return value. */ - forEachFeatureAtPixel(pixel: ol.Pixel, callback: (feature: ol.Feature, layer: ol.layer.Layer) => any, ref?: any, layerFilter?: (layerCandidate: ol.layer.Layer) => boolean, ref2?: any): void; + forEachFeatureAtPixel(pixel: ol.Pixel, callback: (feature: ol.Feature, layer: ol.layer.Layer) => any, ref?: any, layerFilter?: (layerCandidate: ol.layer.Layer) => boolean, ref2?: any): any; /** * Detect layers that have a color value at a pixel on the viewport, and execute a callback with each matching layer. Layers included in the detection can be configured through opt_layerFilter. Feature overlays will always be included in the detection. From 6aff001e47fada0f16768ee435ddcc9eb7c521c1 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Tue, 27 Sep 2016 09:23:13 +0100 Subject: [PATCH 11/41] Update react.d.ts Added myself as an author so I get notifications of PRs / updates from GitHub. --- 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 2f762e0974..c13cdac082 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1,6 +1,6 @@ // Type definitions for React v0.14 // Project: http://facebook.github.io/react/ -// Definitions by: Asana , AssureSign , Microsoft +// Definitions by: Asana , AssureSign , Microsoft , John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace __React { From 29a2eb800b4cb7ecc5218fd222001c641bdb8258 Mon Sep 17 00:00:00 2001 From: Passakorn Suppakityothin Date: Tue, 27 Sep 2016 17:56:23 +0700 Subject: [PATCH 12/41] Fix error that came using typescript 2 This error come when try compile with typescript 2 kue.d.ts(13,3): error TS2440: Import declaration conflicts with local declaration of 'redis' --- kue/kue.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kue/kue.d.ts b/kue/kue.d.ts index baca094200..ee3571db0d 100644 --- a/kue/kue.d.ts +++ b/kue/kue.d.ts @@ -10,7 +10,7 @@ declare module "kue" { import events = require('events'); import express = require('express'); - import redis = require('redis'); + import redisClientFactory = require('redis'); export class Queue extends events.EventEmitter { name: string; @@ -18,7 +18,7 @@ declare module "kue" { promoter: any; workers: Worker[]; shuttingDown: boolean; - client: redis.RedisClient; + client: redisClientFactory.RedisClient; testMode: TestMode; static singleton: Queue; @@ -63,7 +63,7 @@ declare module "kue" { public id: number; public type: string; public data: any; - public client: redis.RedisClient; + public client: redisClientFactory.RedisClient; private _max_attempts; static priorities: Priorities; @@ -109,7 +109,7 @@ declare module "kue" { class Worker extends events.EventEmitter { queue: Queue; type: string; - client: redis.RedisClient; + client: redisClientFactory.RedisClient; job: Job; constructor(queue: Queue, type: string); @@ -127,10 +127,10 @@ declare module "kue" { interface Redis { configureFactory(options: Object, queue: Queue): void; - createClient(): redis.RedisClient; - createClientFactory(options: Object): redis.RedisClient; - client(): redis.RedisClient; - pubsubClient(): redis.RedisClient; + createClient(): redisClientFactory.RedisClient; + createClientFactory(options: Object): redisClientFactory.RedisClient; + client(): redisClientFactory.RedisClient; + pubsubClient(): redisClientFactory.RedisClient; reset(): void; } From 262f69018bce7a7a11bfbd0bc663c29cd501bb6d Mon Sep 17 00:00:00 2001 From: Erik Mogensen Date: Tue, 27 Sep 2016 13:48:39 +0200 Subject: [PATCH 13/41] path can be string or a hash of options As per http://restify.com/#client-api it states: > Note that all further documentation refers to the "short-hand" > form of methods like get/put/del which take a string path. You > can also pass in an object to any of those methods with extra > params (notably headers): So the path can be either a string or a hash of options. --- restify/restify.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 65b3f44d47..a1b933f419 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -470,12 +470,12 @@ declare module "restify" { } interface Client { - get: (path: string, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - head: (path: string, callback?: (err: any, req: Request, res: Response) => any) => any; - post: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - put: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - patch: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - del: (path: string, callback?: (err: any, req: Request, res: Response) => any) => any; + get: (opts: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + head: (opts: any, callback?: (err: any, req: Request, res: Response) => any) => any; + post: (opts: any, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + put: (opts: any, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + patch: (opts: any, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + del: (opts: any, callback?: (err: any, req: Request, res: Response) => any) => any; basicAuth: (username: string, password: string) => any; } From 1e7454173b2d2cf76545b361456df7fb42683ce0 Mon Sep 17 00:00:00 2001 From: ryutamaki Date: Tue, 27 Sep 2016 23:17:03 +0900 Subject: [PATCH 14/41] Add CognitoIdentity into aws-sdk --- aws-sdk/aws-sdk.d.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 2a92a4bcc4..d30b3af305 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -22,6 +22,27 @@ declare module "aws-sdk" { constructor(profile: string); } + export module CognitoIdentity { + export interface CognitoIdentityCredentialsParams { + IdentityPoolId?: string; + AccountId?: string; + Logins?: {[k: string]: any}; + + RoleArn?: string; + RoleSessionName?: string; + WebIdentityToken?: string; + ProviderId?: string; + Policy?: string; + DurationSeconds?: number; + + IdentityId?: string; + } + } + + export class CognitoIdentityCredentials extends Credentials { + constructor(params: CognitoIdentity.CognitoIdentityCredentialsParams); + } + export interface Logger { write?: (chunk: any, encoding?: string, callback?: () => void) => void; log?: (...messages: any[]) => void; From 1545f5cd9193d38e465637ad35d38ba620a007af Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Tue, 27 Sep 2016 22:46:12 +0300 Subject: [PATCH 15/41] Font advanced config options added (for v2.0.6+) --- canvas-gauges/canvas-gauges-tests.ts | 6 ++++-- canvas-gauges/canvas-gauges.d.ts | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/canvas-gauges/canvas-gauges-tests.ts b/canvas-gauges/canvas-gauges-tests.ts index d0f04e1082..015bdfd7e2 100644 --- a/canvas-gauges/canvas-gauges-tests.ts +++ b/canvas-gauges/canvas-gauges-tests.ts @@ -8,10 +8,12 @@ import { } from 'canvas-gauges'; let linearOptions: LinearGaugeOptions = { - renderTo: document.createElement('canvas') + renderTo: document.createElement('canvas'), + fontNumbersStyle: 'italic' }; let radialOptions: RadialGaugeOptions = { - renderTo: 'gauge-id' + renderTo: 'gauge-id', + fontNumbersWeight: 'bold' }; new LinearGauge(linearOptions); diff --git a/canvas-gauges/canvas-gauges.d.ts b/canvas-gauges/canvas-gauges.d.ts index 2b67c7f76f..b330726f55 100644 --- a/canvas-gauges/canvas-gauges.d.ts +++ b/canvas-gauges/canvas-gauges.d.ts @@ -4,6 +4,10 @@ // Definitions: https://github.com/Mikhus/DefinitelyTyped declare namespace CanvasGauges { + export type FontStyle = 'normal' | 'italic' | 'oblique'; + export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | + '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'; + export type RenderTarget = string|HTMLElement; export interface AnimationRule { @@ -86,7 +90,15 @@ declare namespace CanvasGauges { fontTitleSize?: number, fontValueSize?: number, fontUnitsSize?: number, - fontNumbersSize?: number + fontNumbersSize?: number, + fontTitleStyle?: FontStyle, + fontValueStyle?: FontStyle, + fontUnitsStyle?: FontStyle, + fontNumbersStyle?: FontStyle, + fontTitleWeight?: FontWeight, + fontValueWeight?: FontWeight, + fontUnitsWeight?: FontWeight, + fontNumbersWeight?: FontWeight } export interface RadialGaugeOptions extends GenericOptions { From fd8fdb5cf992e09f0a12da758c1099bcba75cf86 Mon Sep 17 00:00:00 2001 From: Frank Gambino Date: Tue, 27 Sep 2016 18:04:58 -0400 Subject: [PATCH 16/41] Add missing slider parameters --- flexSlider/flexSlider.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flexSlider/flexSlider.d.ts b/flexSlider/flexSlider.d.ts index c8fa3f949c..276bb35e84 100644 --- a/flexSlider/flexSlider.d.ts +++ b/flexSlider/flexSlider.d.ts @@ -78,10 +78,10 @@ interface FlexSliderOptions { // Callback API start?: (slider: SliderObject) => any; //Callback: function(slider) - Fires when the slider loads the first slide before?: (slider: SliderObject) => any; //Callback: function(slider) - Fires asynchronously with each slider animation - after?: () => any; //Callback: function(slider) - Fires after each slider animation completes - end?: () => any; //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) - added?: () => any; //{NEW} Callback: function(slider) - Fires after a slide is added - removed?: () => any; + after?: (slider: SliderObject) => any; //Callback: function(slider) - Fires after each slider animation completes + end?: (slider: SliderObject) => any; //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous) + added?: (slider: SliderObject) => any; //{NEW} Callback: function(slider) - Fires after a slide is added + removed?: (slider: SliderObject) => any; } From dc0093e464a1a31a0659b776daee83e68a7320df Mon Sep 17 00:00:00 2001 From: Vipul Shekhawat Date: Tue, 27 Sep 2016 16:03:49 -0700 Subject: [PATCH 17/41] Add backspaceToRemoveMessage prop --- react-select/react-select.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index 701d5efc4a..8011122fed 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -87,6 +87,12 @@ declare namespace ReactSelect { * @default true */ backspaceRemoves?: boolean; + /** + * Message to use for screenreaders to press backspace to remove the current item + * {label} is replaced with the item label + * @default "Press backspace to remove..." + */ + backspaceToRemoveMessage?: string; /** * CSS className for the outer element */ From 4c73343ec113a863b7c66f0f1e8e2a1e435c3eaf Mon Sep 17 00:00:00 2001 From: Erik Mogensen Date: Wed, 28 Sep 2016 12:36:05 +0200 Subject: [PATCH 18/41] fixup! path can be string or a hash of options --- restify/restify.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index a1b933f419..eb4f5b5702 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -470,24 +470,24 @@ declare module "restify" { } interface Client { - get: (opts: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - head: (opts: any, callback?: (err: any, req: Request, res: Response) => any) => any; - post: (opts: any, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - put: (opts: any, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - patch: (opts: any, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; - del: (opts: any, callback?: (err: any, req: Request, res: Response) => any) => any; + get: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + head: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any; + post: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + put: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + patch: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any; + del: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any; basicAuth: (username: string, password: string) => any; } interface HttpClient extends Client { - get: (path?: any, callback?: Function) => any; - head: (path?:any, callback?: Function) => any; - post: (opts?: any, callback?: Function) => any; - put: (opts?: any, callback?: Function) => any; - patch: (opts?: any, callback?: Function) => any; - del: (opts?: any, callback?: Function) => any; + get: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any; + head: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any; + post: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any; + put: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any; + patch: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any; + del: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any; } - + interface ThrottleOptions { burst?: number; rate?: number; From 27986da0aa5f78c596bd8068b3e617b9c55b7137 Mon Sep 17 00:00:00 2001 From: Chen Zhutian Date: Wed, 28 Sep 2016 20:24:41 +0800 Subject: [PATCH 19/41] add request.body (#11395) * add request.body * Update koa-bodyparser.d.ts According to the documentation of `koa-bodyparser`: ```javascript // the parsed body will store in this.request.body // if nothing was parsed, body will be an empty object {} ctx.body = ctx.request.body; ``` Therefore the `body` property will exit in the `request` object. Changing the `body` property from optional to required can also fix the conflict problem in Koa's declaration file: ```ts class Koa extend Request, Response {} ``` --- koa-bodyparser/koa-bodyparser.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/koa-bodyparser/koa-bodyparser.d.ts b/koa-bodyparser/koa-bodyparser.d.ts index f8e1b25aae..0daf7cdb2a 100644 --- a/koa-bodyparser/koa-bodyparser.d.ts +++ b/koa-bodyparser/koa-bodyparser.d.ts @@ -18,6 +18,11 @@ declare module "koa-bodyparser" { import * as Koa from "koa"; + module "koa" { + interface Request { + body: any; + } + } function bodyParser(opts?: { /** From 02aed91b3d7e1b0d4226609ac2453f8555491206 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 28 Sep 2016 08:27:39 -0400 Subject: [PATCH 20/41] Implement tilebelt definition (#11495) --- tilebelt/tilebelt-tests.ts | 29 ++++++ tilebelt/tilebelt.d.ts | 189 +++++++++++++++++++++++++++++++++++++ 2 files changed, 218 insertions(+) create mode 100644 tilebelt/tilebelt-tests.ts create mode 100644 tilebelt/tilebelt.d.ts diff --git a/tilebelt/tilebelt-tests.ts b/tilebelt/tilebelt-tests.ts new file mode 100644 index 0000000000..90c0923f36 --- /dev/null +++ b/tilebelt/tilebelt-tests.ts @@ -0,0 +1,29 @@ +/// +import * as tilebelt from 'tilebelt' + +const lon = 30.5 +const lat = 50.5 +const z = 15 +const tile = [5, 10, 10] +const tiles = [ + [0, 0, 5], + [0, 1, 5], + [1, 1, 5], + [1, 0, 5] +] +const quadkey = '00001033' +const bbox = [ -178.24, 84.70, -177.89, 84.73 ] + +tilebelt.tileToQuadkey(tile) +tilebelt.tileToBBOX(tile) +tilebelt.tileToGeoJSON(tile) +tilebelt.getParent(tile) +tilebelt.getSiblings(tile) +tilebelt.tileToQuadkey(tile) +tilebelt.pointToTile(lon, lat, z) +tilebelt.quadkeyToTile(quadkey) +tilebelt.bboxToTile(bbox) +tilebelt.pointToTileFraction(lon, lat, z) +tilebelt.hasSiblings(tile, tiles) +tilebelt.hasTile(tiles, tile) +tilebelt.tilesEqual(tiles[0], tiles[1]) \ No newline at end of file diff --git a/tilebelt/tilebelt.d.ts b/tilebelt/tilebelt.d.ts new file mode 100644 index 0000000000..c35a803228 --- /dev/null +++ b/tilebelt/tilebelt.d.ts @@ -0,0 +1,189 @@ +// Type definitions for tilebelt 1.0.1 +// Project: https://github.com/mapbox/tilebelt +// Definitions by: Denis Carriere +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare const tilebelt: tilebelt.TilebeltStatic; +declare namespace tilebelt { + interface TilebeltStatic { + /** + * Get a geojson representation of a tile + * + * @name tileToGeoJSON + * @param {Array} tile + * @returns {Feature} + * @example + * var poly = tileToGeoJSON([5, 10, 10]) + * //=poly + */ + tileToGeoJSON(tile: Array): GeoJSON.Feature + + /** + * Get the bbox of a tile + * + * @name tileToBBOX + * @param {Array} tile + * @returns {Array} bbox + * @example + * var bbox = tileToBBOX([5, 10, 10]) + * //=bbox + */ + tileToBBOX(tile: Array): Array + + /** + * Get the tile for a point at a specified zoom level + * + * @name pointToTile + * @param {number} lon + * @param {number} lat + * @param {number} z + * @returns {Array} tile + * @example + * var tile = pointToTile(1, 1, 20) + * //=tile + */ + pointToTile(lon: number, lat: number, z: number): Array + + /** + * Get the 4 tiles one zoom level higher + * + * @name getChildren + * @param {Array} tile + * @returns {Array>} tiles + * @example + * var tiles = getChildren([5, 10, 10]) + * //=tiles + */ + getChildren(tile: Array): Array> + + /** + * Get the tile one zoom level lower + * + * @name getParent + * @param {Array} tile + * @returns {Array} tile + * @example + * var tile = getParent([5, 10, 10]) + * //=tile + */ + getParent(tile: Array): Array + + /** + * Get the 3 sibling tiles for a tile + * + * @name getSiblings + * @param {Array} tile + * @returns {Array>} tiles + * @example + * var tiles = getSiblings([5, 10, 10]) + * //=tiles + */ + getSiblings(tile: Array): Array> + + /** + * Check to see if an array of tiles contains a tiles siblings + * + * @name hasSiblings + * @param {Array} tile + * @param {Array>} tiles + * @returns {boolean} + * @example + * var tiles = [ + * [0, 0, 5], + * [0, 1, 5], + * [1, 1, 5], + * [1, 0, 5] + * ] + * hasSiblings([0, 0, 5], tiles) + * //=boolean + */ + hasSiblings(tile: Array, tiles: Array>): boolean + + /** + * Check to see if an array of tiles contains a particular tile + * + * @name hasTile + * @param {Array>} tiles + * @param {Array} tile + * @returns {boolean} + * @example + * var tiles = [ + * [0, 0, 5], + * [0, 1, 5], + * [1, 1, 5], + * [1, 0, 5] + * ] + * hasTile(tiles, [0, 0, 5]) + * //=boolean + */ + hasTile(tiles: Array>, tile: Array): boolean + + /** + * Check to see if two tiles are the same + * + * @name tilesEqual + * @param {Array} tile1 + * @param {Array} tile2 + * @returns {boolean} + * @example + * tilesEqual([0, 1, 5], [0, 0, 5]) + * //=boolean + */ + tilesEqual(tile1: Array, tile2: Array): boolean + + /** + * Get the quadkey for a tile + * + * @name tileToQuadkey + * @param {Array} tile + * @returns {string} quadkey + * @example + * var quadkey = tileToQuadkey([0, 1, 5]) + * //=quadkey + */ + tileToQuadkey(tile: Array): string + + /** + * Get the tile for a quadkey + * + * @name quadkeyToTile + * @param {string} quadkey + * @returns {Array} tile + * @example + * var tile = quadkeyToTile('00001033') + * //=tile + */ + quadkeyToTile(quadkey: string): Array + + /** + * Get the smallest tile to cover a bbox + * + * @name bboxToTile + * @param {Array} bbox + * @returns {Array} tile + * @example + * var tile = bboxToTile([ -178, 84, -177, 85 ]) + * //=tile + */ + bboxToTile(bbox: Array): Array + + /** + * Get the precise fractional tile location for a point at a zoom level + * + * @name pointToTileFraction + * @param {number} lon + * @param {number} lat + * @param {number} z + * @returns {Array} tile fraction + * var tile = pointToTileFraction(30.5, 50.5, 15) + * //=tile + */ + pointToTileFraction(lon: number, lat: number, z: number): Array + } +} + +declare module "tilebelt" { + export = tilebelt +} \ No newline at end of file From 7b9c3257214af878d92693308cd7686cbe1f1384 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 28 Sep 2016 20:29:10 +0800 Subject: [PATCH 21/41] Add import test (#11476) --- validator/validator-tests.ts | 252 +++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index cc857121bb..fa2f72439f 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -2,6 +2,258 @@ import * as validator from 'validator'; + +/************************************************ +* * +* IMPORT TESTS * +* * +************************************************/ +import { + blacklist as blacklistFunc, + contains as containsFunc, + equals as equalsFunc, + escape as escapeFunc, + isAfter as isAfterFunc, + isAlpha as isAlphaFunc, + isAlphanumeric as isAlphanumericFunc, + isAscii as isAsciiFunc, + isBase64 as isBase64Func, + isBefore as isBeforeFunc, + isBoolean as isBooleanFunc, + isByteLength as isByteLengthFunc, + isCreditCard as isCreditCardFunc, + isCurrency as isCurrencyFunc, + isDataURI as isDataURIFunc, + isDate as isDateFunc, + isDecimal as isDecimalFunc, + isDivisibleBy as isDivisibleByFunc, + isEmail as isEmailFunc, + isFQDN as isFQDNFunc, + isFloat as isFloatFunc, + isFullWidth as isFullWidthFunc, + isHalfWidth as isHalfWidthFunc, + isHexColor as isHexColorFunc, + isHexadecimal as isHexadecimalFunc, + isIP as isIPFunc, + isISBN as isISBNFunc, + isISIN as isISINFunc, + isISO8601 as isISO8601Func, + isIn as isInFunc, + isInt as isIntFunc, + isJSON as isJSONFunc, + isLength as isLengthFunc, + isLowercase as isLowercaseFunc, + isMACAddress as isMACAddressFunc, + isMD5 as isMD5Func, + isMobilePhone as isMobilePhoneFunc, + isMongoId as isMongoIdFunc, + isMultibyte as isMultibyteFunc, + isNull as isNullFunc, + isNumeric as isNumericFunc, + isSurrogatePair as isSurrogatePairFunc, + isURL as isURLFunc, + isUUID as isUUIDFunc, + isUppercase as isUppercaseFunc, + isVariableWidth as isVariableWidthFunc, + isWhitelisted as isWhitelistedFunc, + ltrim as ltrimFunc, + matches as matchesFunc, + normalizeEmail as normalizeEmailFunc, + rtrim as rtrimFunc, + stripLow as stripLowFunc, + toBoolean as toBooleanFunc, + toDate as toDateFunc, + toFloat as toFloatFunc, + toInt as toIntFunc, + trim as trimFunc, + unescape as unescapeFunc, + whitelist as whitelistFunc, +} from 'validator' + +namespace import_tests { + let _blacklist = validator.blacklist; + _blacklist = blacklistFunc; + + let _contains = validator.contains; + _contains = containsFunc; + + let _equals = validator.equals; + _equals = equalsFunc; + + let _escape = validator.escape; + _escape = escapeFunc; + + let _isAfter = validator.isAfter; + _isAfter = isAfterFunc; + + let _isAlpha = validator.isAlpha; + _isAlpha = isAlphaFunc; + + let _isAlphanumeric = validator.isAlphanumeric; + _isAlphanumeric = isAlphanumericFunc; + + let _isAscii = validator.isAscii; + _isAscii = isAsciiFunc; + + let _isBase64 = validator.isBase64; + _isBase64 = isBase64Func; + + let _isBefore = validator.isBefore; + _isBefore = isBeforeFunc; + + let _isBoolean = validator.isBoolean; + _isBoolean = isBooleanFunc; + + let _isByteLength = validator.isByteLength; + _isByteLength = isByteLengthFunc; + + let _isCreditCard = validator.isCreditCard; + _isCreditCard = isCreditCardFunc; + + let _isCurrency = validator.isCurrency; + _isCurrency = isCurrencyFunc; + + let _isDataURI = validator.isDataURI; + _isDataURI = isDataURIFunc; + + let _isDate = validator.isDate; + _isDate = isDateFunc; + + let _isDecimal = validator.isDecimal; + _isDecimal = isDecimalFunc; + + let _isDivisibleBy = validator.isDivisibleBy; + _isDivisibleBy = isDivisibleByFunc; + + let _isEmail = validator.isEmail; + _isEmail = isEmailFunc; + + let _isFQDN = validator.isFQDN; + _isFQDN = isFQDNFunc; + + let _isFloat = validator.isFloat; + _isFloat = isFloatFunc; + + let _isFullWidth = validator.isFullWidth; + _isFullWidth = isFullWidthFunc; + + let _isHalfWidth = validator.isHalfWidth; + _isHalfWidth = isHalfWidthFunc; + + let _isHexColor = validator.isHexColor; + _isHexColor = isHexColorFunc; + + let _isHexadecimal = validator.isHexadecimal; + _isHexadecimal = isHexadecimalFunc; + + let _isIP = validator.isIP; + _isIP = isIPFunc; + + let _isISBN = validator.isISBN; + _isISBN = isISBNFunc; + + let _isISIN = validator.isISIN; + _isISIN = isISINFunc; + + let _isISO8601 = validator.isISO8601; + _isISO8601 = isISO8601Func; + + let _isIn = validator.isIn; + _isIn = isInFunc; + + let _isInt = validator.isInt; + _isInt = isIntFunc; + + let _isJSON = validator.isJSON; + _isJSON = isJSONFunc; + + let _isLength = validator.isLength; + _isLength = isLengthFunc; + + let _isLowercase = validator.isLowercase; + _isLowercase = isLowercaseFunc; + + let _isMACAddress = validator.isMACAddress; + _isMACAddress = isMACAddressFunc; + + let _isMD5 = validator.isMD5; + _isMD5 = isMD5Func; + + let _isMobilePhone = validator.isMobilePhone; + _isMobilePhone = isMobilePhoneFunc; + + let _isMongoId = validator.isMongoId; + _isMongoId = isMongoIdFunc; + + let _isMultibyte = validator.isMultibyte; + _isMultibyte = isMultibyteFunc; + + let _isNull = validator.isNull; + _isNull = isNullFunc; + + let _isNumeric = validator.isNumeric; + _isNumeric = isNumericFunc; + + let _isSurrogatePair = validator.isSurrogatePair; + _isSurrogatePair = isSurrogatePairFunc; + + let _isURL = validator.isURL; + _isURL = isURLFunc; + + let _isUUID = validator.isUUID; + _isUUID = isUUIDFunc; + + let _isUppercase = validator.isUppercase; + _isUppercase = isUppercaseFunc; + + let _isVariableWidth = validator.isVariableWidth; + _isVariableWidth = isVariableWidthFunc; + + let _isWhitelisted = validator.isWhitelisted; + _isWhitelisted = isWhitelistedFunc; + + let _ltrim = validator.ltrim; + _ltrim = ltrimFunc; + + let _matches = validator.matches; + _matches = matchesFunc; + + let _normalizeEmail = validator.normalizeEmail; + _normalizeEmail = normalizeEmailFunc; + + let _rtrim = validator.rtrim; + _rtrim = rtrimFunc; + + let _stripLow = validator.stripLow; + _stripLow = stripLowFunc; + + let _toBoolean = validator.toBoolean; + _toBoolean = toBooleanFunc; + + let _toDate = validator.toDate; + _toDate = toDateFunc; + + let _toFloat = validator.toFloat; + _toFloat = toFloatFunc; + + let _toInt = validator.toInt; + _toInt = toIntFunc; + + let _trim = validator.trim; + _trim = trimFunc; + + let _unescape = validator.unescape; + _unescape = unescapeFunc; + + let _whitelist = validator.whitelist; + _whitelist = whitelistFunc; +} + +/************************************************ +* * +* API TESTS * +* * +************************************************/ let any: any; // ************** From f597aadbe9227b84dcd231c0396d6a93d271621f Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 28 Sep 2016 20:29:27 +0800 Subject: [PATCH 22/41] [validator] Add new stuff which document not mentioned (#11498) * Add new stuff which document not mentioned * Add related test --- validator/validator-tests.ts | 10 ++++++++++ validator/validator.d.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index fa2f72439f..a0ee4a4cbf 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -551,6 +551,16 @@ let any: any; result = validator.whitelist('sample', 'abc'); } +{ + let str: string; + str = validator.toString([123, 456, '123', '456', true, false]); +} + +{ + let ver: string; + ver = validator.version; +} + // ************** // * Extensions * // ************** diff --git a/validator/validator.d.ts b/validator/validator.d.ts index eb09d12b95..02e8eba732 100644 --- a/validator/validator.d.ts +++ b/validator/validator.d.ts @@ -213,6 +213,10 @@ declare namespace ValidatorJS { // remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will // need to escape some chars, e.g. whitelist(input, '\\[\\]'). whitelist(input: string, chars: string): string; + + toString(input: any | any[]): string; + + version: string; // ************** // * Extensions * From bbf7d433237a5e8eb455e74bbd561f614eea9f15 Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Wed, 28 Sep 2016 22:42:23 +1000 Subject: [PATCH 23/41] http.ServerRequest => http.IncomingMessage (#11500) --- acl/acl.d.ts | 2 +- applicationinsights/applicationinsights.d.ts | 8 ++++---- browser-sync/browser-sync.d.ts | 4 ++-- bufferstream/bufferstream.d.ts | 2 +- busboy/busboy-tests.ts | 2 +- express-serve-static-core/express-serve-static-core.d.ts | 2 +- formidable/formidable-tests.ts | 2 +- multiparty/multiparty-tests.ts | 2 +- multiparty/multiparty.d.ts | 2 +- on-headers/on-headers-tests.ts | 2 +- restify/restify.d.ts | 2 +- urlrouter/urlrouter.d.ts | 2 +- ws/ws-tests.ts | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/acl/acl.d.ts b/acl/acl.d.ts index d222f9ebb6..eaa728cb2c 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -20,7 +20,7 @@ declare module "acl" { type Callback = (err: Error) => any; type AnyCallback = (err: Error, obj: any) => any; type AllowedCallback = (err: Error, allowed: boolean) => any; - type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value; + type GetUserId = (req: http.IncomingMessage, res: http.ServerResponse) => Value; interface AclStatic { new (backend: Backend, logger: Logger, options: Option): Acl; diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts index 96d5773fa5..45c89556a6 100644 --- a/applicationinsights/applicationinsights.d.ts +++ b/applicationinsights/applicationinsights.d.ts @@ -346,24 +346,24 @@ interface Client { * Log an incoming http request to your server. The request data will be tracked during the response "finish" event if it is successful or the request "error" * event if it fails. The request duration is automatically calculated as the timespan between when the trackRequest method was called, and when the response "finish" * or request "error" events were fired. - * @param request The http.ServerRequest object to track + * @param request The http.IncomingMessage object to track * @param response The http.ServerResponse object for this request * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty. */ - trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: { + trackRequest(request: any /* http.IncomingMessage */, response: any /* http.ServerResponse */, properties?: { [key: string]: string; }): void; /** * Log an incoming http request to your server. The request data is tracked synchronously rather than waiting for the response "finish"" or request "error"" events. * Use this if you need your request telemetry to respect custom app insights operation and user context (for example if you set any appInsights.client.context.tags). - * @param request The http.ServerRequest object to track + * @param request The http.IncomingMessage object to track * @param response The http.ServerResponse object for this request * @param ellapsedMilliseconds The duration for this request. Defaults to 0. * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty. * @param error An error that was returned for this request if it was unsuccessful. Defaults to null. */ - trackRequestSync(request: any /*http.ServerRequest */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: { + trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: { [key: string]: string;}, error?: any) : void; /** diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 00d234f958..54b42aff4a 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -288,11 +288,11 @@ declare module "browser-sync" { middleware?: MiddlewareHandler; ws: boolean; reqHeaders: (config: any) => Hash; - proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any; + proxyRes: (res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any; } interface MiddlewareHandler { - (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; + (req: http.IncomingMessage, res: http.ServerResponse, next: Function): any; } interface PerRouteMiddleware { diff --git a/bufferstream/bufferstream.d.ts b/bufferstream/bufferstream.d.ts index ee115d0ab5..c43a716d4b 100644 --- a/bufferstream/bufferstream.d.ts +++ b/bufferstream/bufferstream.d.ts @@ -104,7 +104,7 @@ declare module 'bufferstream/postbuffer' { http client buffer */ - constructor(req: http.ServerRequest); + constructor(req: http.IncomingMessage); /* set a callback to get all post data from a http server request */ diff --git a/busboy/busboy-tests.ts b/busboy/busboy-tests.ts index 058b5c92d3..11e8b6c9ad 100644 --- a/busboy/busboy-tests.ts +++ b/busboy/busboy-tests.ts @@ -5,7 +5,7 @@ import * as Busboy from 'busboy'; import * as http from 'http'; import * as util from 'util'; -function serverFn(req: http.ServerRequest, res: http.ServerResponse) { +function serverFn(req: http.IncomingMessage, res: http.ServerResponse) { if (req.method === 'POST') { var busboy = new Busboy({ headers: req.headers }); busboy.on('file', function(fieldname, file, filename, encoding, mimetype) { 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 0371c2bb6a..648f1447a5 100644 --- a/express-serve-static-core/express-serve-static-core.d.ts +++ b/express-serve-static-core/express-serve-static-core.d.ts @@ -130,7 +130,7 @@ declare module "express-serve-static-core" { interface Errback { (err: Error): void; } - interface Request extends http.ServerRequest, Express.Request { + interface Request extends http.IncomingMessage, Express.Request { /** * Return request header. diff --git a/formidable/formidable-tests.ts b/formidable/formidable-tests.ts index a0f70a713c..4fdc5ba4cf 100644 --- a/formidable/formidable-tests.ts +++ b/formidable/formidable-tests.ts @@ -48,7 +48,7 @@ if (form.bytesReceived > 100) { if (form.bytesExpected > 100) { } -var req: http.ServerRequest; +var req: http.IncomingMessage; form.parse(req); form.parse(req, (err: any, fields: formidable.Fields, files: formidable.Files) => { diff --git a/multiparty/multiparty-tests.ts b/multiparty/multiparty-tests.ts index 47e6a62f71..e84320ca46 100644 --- a/multiparty/multiparty-tests.ts +++ b/multiparty/multiparty-tests.ts @@ -4,7 +4,7 @@ import multiparty = require('multiparty'); import http = require('http'); import util = require('util'); -http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) { +http.createServer(function (req: http.IncomingMessage, res: http.ServerResponse) { if (req.url === '/upload' && req.method === 'POST') { var count = 0; var form = new multiparty.Form(); diff --git a/multiparty/multiparty.d.ts b/multiparty/multiparty.d.ts index a280c366f8..b0977ff034 100644 --- a/multiparty/multiparty.d.ts +++ b/multiparty/multiparty.d.ts @@ -18,7 +18,7 @@ declare module "multiparty" { * @param request * @param callback */ - parse(request: http.ServerRequest, callback?: (error: Error, fields: any, files: any) => any): void; + parse(request: http.IncomingMessage, callback?: (error: Error, fields: any, files: any) => any): void; } export interface File { diff --git a/on-headers/on-headers-tests.ts b/on-headers/on-headers-tests.ts index 11f33c4ef0..35b62764ed 100644 --- a/on-headers/on-headers-tests.ts +++ b/on-headers/on-headers-tests.ts @@ -6,7 +6,7 @@ import onHeaders = require('on-headers') http.createServer(onRequest) .listen(3000); -function onRequest(req: http.ServerRequest, res: http.ServerResponse) { +function onRequest(req: http.IncomingMessage, res: http.ServerResponse) { onHeaders(res, addPoweredBy); res.setHeader('Content-Type', 'text/plain') res.end('hello!'); diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 65b3f44d47..5f6ca472b1 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -35,7 +35,7 @@ declare module "restify" { } } - interface Request extends http.ServerRequest { + interface Request extends http.IncomingMessage { /** * builds an absolute URI for the request. * @private diff --git a/urlrouter/urlrouter.d.ts b/urlrouter/urlrouter.d.ts index c7a741ac90..0a1fff0d4c 100644 --- a/urlrouter/urlrouter.d.ts +++ b/urlrouter/urlrouter.d.ts @@ -13,7 +13,7 @@ declare module "urlrouter" { namespace UrlRouterInternal { - interface ServerRequest extends http.ServerRequest { + interface ServerRequest extends http.IncomingMessage { params: any; } diff --git a/ws/ws-tests.ts b/ws/ws-tests.ts index 3c85d678cb..4afa12bfe8 100644 --- a/ws/ws-tests.ts +++ b/ws/ws-tests.ts @@ -66,7 +66,7 @@ var WebSocketServer = WebSocket.Server; info: { origin: string secure: boolean - req: http.ServerRequest + req: http.IncomingMessage } , callback: (res: boolean) => void ): void { From 7315e9e81faa9d6e940561f5b25a72762b9719e5 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 28 Sep 2016 20:44:55 +0800 Subject: [PATCH 24/41] [node] Add events for dgram (#11501) * Add events for dgram * Add tests for dgram * Correct dgram.RemoteInfo interface * Correct emit * Correct emit --- node/node-tests.ts | 88 +++++++++++++++++++++++++++++++++++++++++----- node/node.d.ts | 45 +++++++++++++++++++++++- 2 files changed, 124 insertions(+), 9 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 30ea4bcaa3..623d31c1f9 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -659,14 +659,86 @@ namespace tty_tests { //////////////////////////////////////////////////// namespace dgram_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"); + { + 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"); + } + + { + let _socket: dgram.Socket; + let _boolean: boolean; + let _err: Error; + let _str: string; + let _rinfo: dgram.AddressInfo; + /** + * events.EventEmitter + * 1. close + * 2. error + * 3. listening + * 4. message + **/ + + _socket = _socket.addListener("close", () => {}); + _socket = _socket.addListener("error", (err) => { + let _err: Error = err; + }) + _socket = _socket.addListener("listening", () => {}); + _socket = _socket.addListener("message", (msg, rinfo) => { + let _msg: string = msg; + let _rinfo: dgram.AddressInfo = rinfo; + }) + + _boolean = _socket.emit("close") + _boolean = _socket.emit("error", _err); + _boolean = _socket.emit("listening"); + _boolean = _socket.emit("message", _str, _rinfo); + + _socket = _socket.on("close", () => {}); + _socket = _socket.on("error", (err) => { + let _err: Error = err; + }) + _socket = _socket.on("listening", () => {}); + _socket = _socket.on("message", (msg, rinfo) => { + let _msg: string = msg; + let _rinfo: dgram.AddressInfo = rinfo; + }) + + _socket = _socket.once("close", () => {}); + _socket = _socket.once("error", (err) => { + let _err: Error = err; + }) + _socket = _socket.once("listening", () => {}); + _socket = _socket.once("message", (msg, rinfo) => { + let _msg: string = msg; + let _rinfo: dgram.AddressInfo = rinfo; + }) + + _socket = _socket.prependListener("close", () => {}); + _socket = _socket.prependListener("error", (err) => { + let _err: Error = err; + }) + _socket = _socket.prependListener("listening", () => {}); + _socket = _socket.prependListener("message", (msg, rinfo) => { + let _msg: string = msg; + let _rinfo: dgram.AddressInfo = rinfo; + }) + + _socket = _socket.prependOnceListener("close", () => {}); + _socket = _socket.prependOnceListener("error", (err) => { + let _err: Error = err; + }) + _socket = _socket.prependOnceListener("listening", () => {}); + _socket = _socket.prependOnceListener("message", (msg, rinfo) => { + let _msg: string = msg; + let _rinfo: dgram.AddressInfo = rinfo; + }) + } } //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 5b807cb5b2..3473ab3281 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1855,8 +1855,8 @@ declare module "dgram" { interface RemoteInfo { address: string; + family: string; port: number; - size: number; } interface AddressInfo { @@ -1894,6 +1894,49 @@ declare module "dgram" { dropMembership(multicastAddress: string, multicastInterface?: string): void; ref(): void; unref(): void; + + /** + * events.EventEmitter + * 1. close + * 2. error + * 3. listening + * 4. message + **/ + addListener(event: string, listener: Function): this; + addListener(event: "close", listener: () => void): this; + addListener(event: "error", listener: (err: Error) => void): this; + addListener(event: "listening", listener: () => void): this; + addListener(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this; + + emit(event: string, ...args: any[]): boolean; + emit(event: "close"): boolean; + emit(event: "error", err: Error): boolean; + emit(event: "listening"): boolean; + emit(event: "message", msg: string, rinfo: AddressInfo): boolean; + + on(event: string, listener: Function): this; + on(event: "close", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "listening", listener: () => void): this; + on(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this; + + once(event: string, listener: Function): this; + once(event: "close", listener: () => void): this; + once(event: "error", listener: (err: Error) => void): this; + once(event: "listening", listener: () => void): this; + once(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this; + + prependListener(event: string, listener: Function): this; + prependListener(event: "close", listener: () => void): this; + prependListener(event: "error", listener: (err: Error) => void): this; + prependListener(event: "listening", listener: () => void): this; + prependListener(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this; + + prependOnceListener(event: string, listener: Function): this; + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "error", listener: (err: Error) => void): this; + prependOnceListener(event: "listening", listener: () => void): this; + prependOnceListener(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this; } } From c48f9b3fd516a74fd38c51818b0eae6e98c63d38 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 28 Sep 2016 20:46:43 +0800 Subject: [PATCH 25/41] [node] Add events for tls.Server and tls.TLSSocket (#11502) * Add events for tls.Server * Add tests for tls.Server * Add tests for TLSSocket * Add events for TLSSocket --- node/node-tests.ts | 199 ++++++++++++++++++++++++++++++++++++++++++--- node/node.d.ts | 79 ++++++++++++++++++ 2 files changed, 268 insertions(+), 10 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 623d31c1f9..433435ee13 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -558,17 +558,196 @@ namespace crypto_tests { ////////////////////////////////////////////////// namespace tls_tests { - var ctx: tls.SecureContext = tls.createSecureContext({ - key: "NOT REALLY A KEY", - cert: "SOME CERTIFICATE", - }); - var blah = ctx.context; + { + var ctx: tls.SecureContext = tls.createSecureContext({ + key: "NOT REALLY A KEY", + cert: "SOME CERTIFICATE", + }); + var blah = ctx.context; - var connOpts: tls.ConnectionOptions = { - host: "127.0.0.1", - port: 55 - }; - var tlsSocket = tls.connect(connOpts); + var connOpts: tls.ConnectionOptions = { + host: "127.0.0.1", + port: 55 + }; + var tlsSocket = tls.connect(connOpts); + } + + { + let _server: tls.Server; + let _boolean: boolean; + let _func1 = function(err: Error, resp: Buffer){}; + let _func2 = function(err: Error, sessionData: any){}; + /** + * events.EventEmitter + * 1. tlsClientError + * 2. newSession + * 3. OCSPRequest + * 4. resumeSession + * 5. secureConnection + **/ + + _server = _server.addListener("tlsClientError", (err, tlsSocket) => { + let _err: Error = err; + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + _server = _server.addListener("newSession", (sessionId, sessionData, callback) => { + let _sessionId: any = sessionId; + let _sessionData: any = sessionData; + let _func1 = callback; + }) + _server = _server.addListener("OCSPRequest", (certificate, issuer, callback) => { + let _certificate: Buffer = certificate; + let _issuer: Buffer = issuer; + let _callback: Function = callback; + }) + _server = _server.addListener("resumeSession", (sessionId, callback) => { + let _sessionId: any = sessionId; + let _func2 = callback; + }) + _server = _server.addListener("secureConnection", (tlsSocket) => { + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + + let _err: Error; + let _tlsSocket: tls.TLSSocket; + let _any: any; + let _func: Function; + let _buffer: Buffer; + _boolean = _server.emit("tlsClientError", _err, _tlsSocket); + _boolean = _server.emit("newSession", _any, _any, _func1); + _boolean = _server.emit("OCSPRequest", _buffer, _buffer, _func); + _boolean = _server.emit("resumeSession", _any, _func2); + _boolean = _server.emit("secureConnection", _tlsSocket); + + _server = _server.on("tlsClientError", (err, tlsSocket) => { + let _err: Error = err; + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + _server = _server.on("newSession", (sessionId, sessionData, callback) => { + let _sessionId: any = sessionId; + let _sessionData: any = sessionData; + let _func1 = callback; + }) + _server = _server.on("OCSPRequest", (certificate, issuer, callback) => { + let _certificate: Buffer = certificate; + let _issuer: Buffer = issuer; + let _callback: Function = callback; + }) + _server = _server.on("resumeSession", (sessionId, callback) => { + let _sessionId: any = sessionId; + let _func2 = callback; + }) + _server = _server.on("secureConnection", (tlsSocket) => { + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + + _server = _server.once("tlsClientError", (err, tlsSocket) => { + let _err: Error = err; + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + _server = _server.once("newSession", (sessionId, sessionData, callback) => { + let _sessionId: any = sessionId; + let _sessionData: any = sessionData; + let _func1 = callback; + }) + _server = _server.once("OCSPRequest", (certificate, issuer, callback) => { + let _certificate: Buffer = certificate; + let _issuer: Buffer = issuer; + let _callback: Function = callback; + }) + _server = _server.once("resumeSession", (sessionId, callback) => { + let _sessionId: any = sessionId; + let _func2 = callback; + }) + _server = _server.once("secureConnection", (tlsSocket) => { + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + + _server = _server.prependListener("tlsClientError", (err, tlsSocket) => { + let _err: Error = err; + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + _server = _server.prependListener("newSession", (sessionId, sessionData, callback) => { + let _sessionId: any = sessionId; + let _sessionData: any = sessionData; + let _func1 = callback; + }) + _server = _server.prependListener("OCSPRequest", (certificate, issuer, callback) => { + let _certificate: Buffer = certificate; + let _issuer: Buffer = issuer; + let _callback: Function = callback; + }) + _server = _server.prependListener("resumeSession", (sessionId, callback) => { + let _sessionId: any = sessionId; + let _func2 = callback; + }) + _server = _server.prependListener("secureConnection", (tlsSocket) => { + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + + _server = _server.prependOnceListener("tlsClientError", (err, tlsSocket) => { + let _err: Error = err; + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + _server = _server.prependOnceListener("newSession", (sessionId, sessionData, callback) => { + let _sessionId: any = sessionId; + let _sessionData: any = sessionData; + let _func1 = callback; + }) + _server = _server.prependOnceListener("OCSPRequest", (certificate, issuer, callback) => { + let _certificate: Buffer = certificate; + let _issuer: Buffer = issuer; + let _callback: Function = callback; + }) + _server = _server.prependOnceListener("resumeSession", (sessionId, callback) => { + let _sessionId: any = sessionId; + let _func2 = callback; + }) + _server = _server.prependOnceListener("secureConnection", (tlsSocket) => { + let _tlsSocket: tls.TLSSocket = tlsSocket; + }) + } + + { + let _TLSSocket: tls.TLSSocket; + let _boolean: boolean; + /** + * events.EventEmitter + * 1. close + * 2. error + * 3. listening + * 4. message + **/ + + _TLSSocket = _TLSSocket.addListener("OCSPResponse", (response) => { + let _response: Buffer = response; + }) + _TLSSocket = _TLSSocket.addListener("secureConnect", () => { }); + + let _buffer: Buffer; + _boolean = _TLSSocket.emit("OCSPResponse", _buffer); + _boolean = _TLSSocket.emit("secureConnect"); + + _TLSSocket = _TLSSocket.on("OCSPResponse", (response) => { + let _response: Buffer = response; + }) + _TLSSocket = _TLSSocket.on("secureConnect", () => { }); + + _TLSSocket = _TLSSocket.once("OCSPResponse", (response) => { + let _response: Buffer = response; + }) + _TLSSocket = _TLSSocket.once("secureConnect", () => { }); + + _TLSSocket = _TLSSocket.prependListener("OCSPResponse", (response) => { + let _response: Buffer = response; + }) + _TLSSocket = _TLSSocket.prependListener("secureConnect", () => { }); + + _TLSSocket = _TLSSocket.prependOnceListener("OCSPResponse", (response) => { + let _response: Buffer = response; + }) + _TLSSocket = _TLSSocket.prependOnceListener("secureConnect", () => { }); + } } //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 3473ab3281..5c016af3fd 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2628,6 +2628,35 @@ declare module "tls" { * @returns {boolean} - Returns true on success, false otherwise. */ setMaxSendFragment(size: number): boolean; + + /** + * events.EventEmitter + * 1. OCSPResponse + * 2. secureConnect + **/ + addListener(event: string, listener: Function): this; + addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + addListener(event: "secureConnect", listener: () => void): this; + + emit(event: string, ...args: any[]): boolean; + emit(event: "OCSPResponse", response: Buffer): boolean; + emit(event: "secureConnect"): boolean; + + on(event: string, listener: Function): this; + on(event: "OCSPResponse", listener: (response: Buffer) => void): this; + on(event: "secureConnect", listener: () => void): this; + + once(event: string, listener: Function): this; + once(event: "OCSPResponse", listener: (response: Buffer) => void): this; + once(event: "secureConnect", listener: () => void): this; + + prependListener(event: string, listener: Function): this; + prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + prependListener(event: "secureConnect", listener: () => void): this; + + prependOnceListener(event: string, listener: Function): this; + prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; + prependOnceListener(event: "secureConnect", listener: () => void): this; } export interface TlsOptions { @@ -2686,6 +2715,56 @@ declare module "tls" { }): void; maxConnections: number; connections: number; + + /** + * events.EventEmitter + * 1. tlsClientError + * 2. newSession + * 3. OCSPRequest + * 4. resumeSession + * 5. secureConnection + **/ + addListener(event: string, listener: Function): this; + addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + addListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this; + addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this; + addListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; + addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + + emit(event: string, ...args: any[]): boolean; + emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; + emit(event: "newSession", sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void): boolean; + emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: Function): boolean; + emit(event: "resumeSession", sessionId: any, callback: (err: Error, sessionData: any) => void): boolean; + emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; + + on(event: string, listener: Function): this; + on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + on(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this; + on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this; + on(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; + on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + + once(event: string, listener: Function): this; + once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + once(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this; + once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this; + once(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; + once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + + prependListener(event: string, listener: Function): this; + prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this; + prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this; + prependListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; + prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; + + prependOnceListener(event: string, listener: Function): this; + prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; + prependOnceListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this; + prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this; + prependOnceListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this; + prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; } export interface ClearTextStream extends stream.Duplex { From ce70e15ee4639ce8648acfd4b0a81b021e4c7998 Mon Sep 17 00:00:00 2001 From: Stefan Dobrev Date: Wed, 28 Sep 2016 16:02:02 +0300 Subject: [PATCH 26/41] [react-router] Update getComponents signatures (#11319) Update `getComponent(s)` all over the place. See #9530 for more info. --- react-router/react-router.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 1a68cc89a5..321adf9bb7 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -169,8 +169,8 @@ declare namespace ReactRouter { path?: RoutePattern component?: RouteComponent components?: RouteComponents - getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void + getComponent?: (nextState: RouterState, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (nextState: RouterState, cb: (error: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook indexRoute?: PlainRoute @@ -195,8 +195,8 @@ declare namespace ReactRouter { interface IndexRouteProps extends React.Props { component?: RouteComponent components?: RouteComponents - getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void - getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void + getComponent?: (nextState: RouterState, cb: (error: any, component?: RouteComponent) => void) => void + getComponents?: (nextState: RouterState, cb: (error: any, components?: RouteComponents) => void) => void onEnter?: EnterHook onLeave?: LeaveHook } From 3518ba75e124a9afae1f18df34043e4a982047eb Mon Sep 17 00:00:00 2001 From: Craig Boland Date: Wed, 28 Sep 2016 08:05:50 -0500 Subject: [PATCH 27/41] Updated jquery.dataTables for 1.10.7. (#11408) * Updated jquery.dataTables for 1.10.7. Version release notes: https://cdn.datatables.net/1.10.7/ * Added any() * Added i18n() Note: selector-modifier support currently exists with interface ObjectSelectorModifier. * Added strong variable typing in jquery.dataTables-tests.ts * For parameter 'def', replaced 'Object' data type with 'any' per TypeScript declaration file guidance. --- jquery.dataTables/jquery.dataTables-tests.ts | 5 +++++ jquery.dataTables/jquery.dataTables.d.ts | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index 6329861604..09014f39f4 100644 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -311,6 +311,9 @@ $(document).ready(function () { var initSettings = dt.init(); + var i18n: string = dt.i18n('buttons.copy', 'Copy to clipboard'); + i18n = dt.i18n('select.rows', { _: '%d rows selected', 1: '1 row selected' }, 0); + var off = dt.off("event"); off = dt.off("event", function () { }); off.$(""); @@ -901,5 +904,7 @@ $(document).ready(function () { //#region "Methods-Util" + var util_1: boolean = dt.any(); + //#endregion "Methods-Util" }); diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index 459676f87d..70c72b8570 100644 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1,4 +1,4 @@ -// Type definitions for JQuery DataTables 1.10.6 +// Type definitions for JQuery DataTables 1.10.7 // Project: http://www.datatables.net // Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -188,6 +188,17 @@ declare namespace DataTables { */ draw(reset?: boolean): DataTable; + /* + * Look up a language token that was defined in the DataTables' language initialisation object. + * + * @param token The language token to lookup from the language object. + * @param def The default value to use if the DataTables initialisation has not specified a value. + * @param numeric If handling numeric output, the number to be presented should be given in this parameter. If not numeric operator is required (for example button label text) this parameter is not required. + * + * @returns Resulting internationalised string. + */ + i18n(token: string, def: any | string, numeric?: number): string; + /* * Get the initialisation options used for the table. Since: DataTables 1.10.6 */ @@ -412,6 +423,11 @@ declare namespace DataTables { //#region "util-methods" interface UtilityMethods { + /* + * Get a boolean value to indicate if there are any entries in the API instance's result set (i.e. any data, selected rows, etc). + */ + any(): boolean; + /** * Concatenate two or more API instances together * From 3929fe1b6762a5380c717a52f296af3d55740ede Mon Sep 17 00:00:00 2001 From: AKFish Date: Wed, 28 Sep 2016 21:41:30 +0800 Subject: [PATCH 28/41] [HAPI] Add `IStrictSessionHandler` (#11523) * Fix #11519 --- hapi/hapi-8.2.0.d.ts | 8 ++++++-- hapi/hapi-tests-8.2.0.ts | 10 ++++++++++ hapi/hapi-tests.ts | 10 ++++++++++ hapi/hapi.d.ts | 8 ++++++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/hapi/hapi-8.2.0.d.ts b/hapi/hapi-8.2.0.d.ts index ef81b4fba3..a789915965 100644 --- a/hapi/hapi-8.2.0.d.ts +++ b/hapi/hapi-8.2.0.d.ts @@ -300,8 +300,12 @@ declare module "hapi" { } export interface ISessionHandler { (request: Request, reply: IReply): void; + } + + export interface IStrictSessionHandler{ (request: Request, reply: IStrictReply): void; } + export interface IRequestHandler { (request: Request): T; } @@ -464,7 +468,7 @@ declare module "hapi" { }; /** an alternative location for the route handler option. */ - handler?: ISessionHandler | string | IRouteHandlerConfig; + handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; /** an optional unique identifier used to look up the route using server.lookup(). */ id?: number; /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ @@ -834,7 +838,7 @@ declare module "hapi" { /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ vhost?: string; /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ - handler: ISessionHandler | string | IRouteHandlerConfig; + handler: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; /** - additional route options.*/ config?: IRouteAdditionalConfigurationOptions; } diff --git a/hapi/hapi-tests-8.2.0.ts b/hapi/hapi-tests-8.2.0.ts index e26ce193bc..012e913432 100644 --- a/hapi/hapi-tests-8.2.0.ts +++ b/hapi/hapi-tests-8.2.0.ts @@ -124,5 +124,15 @@ server.route([{ } }]); +// Implict handler +server.route({ + method: 'GET', + path: '/hello6', + handler: function (request, reply) { + request.log('info', { route: '/hello' }, Date.now()); + reply('hello world'); + } +}); + // Start the server server.start(); diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index 3288618816..c33e934611 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -112,6 +112,16 @@ server.route([{ } }]); +// Implict handler +server.route({ + method: 'GET', + path: '/hello6', + handler: function (request, reply) { + request.log('info', { route: '/hello' }, Date.now()); + reply('hello world'); + } +}); + // config.validate parameters should be optional server.route([{ method: 'GET', diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index ff5e1d9fe8..9c01eb741d 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -330,8 +330,12 @@ declare module "hapi" { export interface ISessionHandler { (request: Request, reply: IReply): void; + } + + export interface IStrictSessionHandler { (request: Request, reply: IStrictReply): void; } + export interface IRequestHandler { (request: Request): T; } @@ -495,7 +499,7 @@ declare module "hapi" { }; /** an alternative location for the route handler option. */ - handler?: ISessionHandler | string | IRouteHandlerConfig; + handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; /** an optional unique identifier used to look up the route using server.lookup(). */ id?: number; /** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */ @@ -894,7 +898,7 @@ declare module "hapi" { /** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/ vhost?: string; /** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/ - handler?: ISessionHandler | string | IRouteHandlerConfig; + handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig; /** - additional route options.*/ config?: IRouteAdditionalConfigurationOptions; } From 351b4c7598c689337b8ce2c82543f902f8b30045 Mon Sep 17 00:00:00 2001 From: nkovacic Date: Wed, 28 Sep 2016 15:47:15 +0200 Subject: [PATCH 29/41] Added FileResizeOptions for the changed resize function call --- ng-file-upload/ng-file-upload-tests.ts | 12 +++++++++++- ng-file-upload/ng-file-upload.d.ts | 21 +++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ng-file-upload/ng-file-upload-tests.ts b/ng-file-upload/ng-file-upload-tests.ts index f7fdcf1015..ff3044977a 100644 --- a/ng-file-upload/ng-file-upload-tests.ts +++ b/ng-file-upload/ng-file-upload-tests.ts @@ -78,7 +78,17 @@ class UploadController { fileWithNewName = this.Upload.rename(files[0], "newName.jpg"); this.Upload - .resize(files[0], 1024, 1024, 0.7, 'image/jpeg', 0.9, true) + .resize(files[0], { + height: 1024, + width: 1024, + quality: 0.7, + ratio: 0.9, + centerCrop: true, + restoreExif: true, + resizeIf: (width, height) => { + return true; + } + }) .then((resizedFile) => { console.log(resizedFile); }); diff --git a/ng-file-upload/ng-file-upload.d.ts b/ng-file-upload/ng-file-upload.d.ts index 41b0331dbe..2700a5d206 100644 --- a/ng-file-upload/ng-file-upload.d.ts +++ b/ng-file-upload/ng-file-upload.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular File Upload 11.1.1 +// Type definitions for Angular File Upload 12.2.12 // Project: https://github.com/danialfarid/ng-file-upload // Definitions by: John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -92,6 +92,20 @@ declare namespace angular.angularFileUpload { ngfValidateForce?: boolean; } + interface ResizeIfFunction { + (width: number, height: number): boolean; + } + + interface FileResizeOptions { + centerCrop?: boolean; + height?: number; + ratio?: number; + resizeIf?: ResizeIfFunction; + restoreExif?: boolean; + quality?: number; + width?: number; + } + interface IUploadService { /** * Convert a single file or array of files to a single or array of @@ -166,7 +180,7 @@ declare namespace angular.angularFileUpload { * @param {string} newName * @return {File} */ - rename(file: File, newName: string): File; + rename(file: File, newName: string): Blob; /** * Resizes an image. Returns a promise * @@ -179,8 +193,7 @@ declare namespace angular.angularFileUpload { * @param {boolean} [centerCrop] * @return {angular.IPromise} */ - resize(file: File, width?: number, height?: number, quality?: number, type?: string, - ratio?: number | string, centerCrop?: boolean): angular.IPromise; + resize(file: File, options: FileResizeOptions): angular.IPromise; /** * Set the default values for ngf-select and ngf-drop directives * From 462850812b7b471d6d8d01223accb3ca282b8731 Mon Sep 17 00:00:00 2001 From: Maux Date: Wed, 28 Sep 2016 23:49:22 +1000 Subject: [PATCH 30/41] getEvent should not be set to void it should return a value (#11135) * getEvent should not be set to void it should return a value * Add type to getActionData for testing * pnotify Add type fpr notice styling and state * fix pnotify test * Remove Generics and replaces by return any * convert space tp tabs --- dhtmlxscheduler/dhtmlxscheduler.d.ts | 60 +++++++++++++------------- jquery.pnotify/jquery.pnotify-tests.ts | 4 +- jquery.pnotify/jquery.pnotify.d.ts | 14 +++--- 3 files changed, 37 insertions(+), 41 deletions(-) diff --git a/dhtmlxscheduler/dhtmlxscheduler.d.ts b/dhtmlxscheduler/dhtmlxscheduler.d.ts index 40123827ca..3f075861ab 100644 --- a/dhtmlxscheduler/dhtmlxscheduler.d.ts +++ b/dhtmlxscheduler/dhtmlxscheduler.d.ts @@ -3,12 +3,12 @@ // Definitions by: Maksim Kozhukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface SchedulerCallback { (...args: any[]) : any } +interface SchedulerCallback { (...args: any[]): any } interface SchedulerFilterCallback { (id: string | number, event: any): boolean } -type SchedulerEventName ='onAfterEventDisplay'|'onAfterFolderToggle'|'onAfterLightbox'|'onAfterSchedulerResize'|'onBeforeCollapse'|'onBeforeDrag'|'onBeforeEventChanged'|'onBeforeEventCreated'|'onBeforeEventDelete'|'onBeforeEventDisplay'|'onBeforeEventDragIn'|'onBeforeEventDragOut'|'onBeforeExpand'|'onBeforeExternalDragIn'|'onBeforeFolderToggle'|'onBeforeLightbox'|'onBeforeSectionRender'|'onBeforeTodayDisplayed'|'onBeforeTooltip'|'onBeforeViewChange'|'onCellClick'|'onCellDblClick'|'onClearAll'|'onClick'|'onCollapse'|'onConfirmedBeforeEventDelete'|'onContextMenu'|'onDblClick'|'onDragEnd'|'onEmptyClick'|'onEventAdded'|'onEventCancel'|'onEventChanged'|'onEventCollision'|'onEventCopied'|'onEventCreated'|'onEventCut'|'onEventDeleted'|'onEventDrag'|'onEventDragIn'|'onEventDragOut'|'onEventDropOut'|'onEventIdChange'|'onEventLoading'|'onEventPasted'|'onEventSave'|'onExpand'|'onExternalDragIn'|'onLightbox'|'onLightboxButton'|'onLimitViolation'|'onLoadError'|'onLocationError'|'onMouseDown'|'onMouseMove'|'onOptionsLoad'|'onOptionsLoadFinal'|'onOptionsLoadStart'|'onSaveError'|'onScaleAdd'|'onScaleDblClick'|'onSchedulerReady'|'onSchedulerResize'|'onTemplatesReady'|'onTimelineCreated'|'onViewChange'|'onViewMoreClick'|'onXLE'|'onXLS'|'onXScaleClick'|'onXScaleDblClick'|'onYScaleClick'|'onYScaleDblClick'; +type SchedulerEventName = 'onAfterEventDisplay' | 'onAfterFolderToggle' | 'onAfterLightbox' | 'onAfterSchedulerResize' | 'onBeforeCollapse' | 'onBeforeDrag' | 'onBeforeEventChanged' | 'onBeforeEventCreated' | 'onBeforeEventDelete' | 'onBeforeEventDisplay' | 'onBeforeEventDragIn' | 'onBeforeEventDragOut' | 'onBeforeExpand' | 'onBeforeExternalDragIn' | 'onBeforeFolderToggle' | 'onBeforeLightbox' | 'onBeforeSectionRender' | 'onBeforeTodayDisplayed' | 'onBeforeTooltip' | 'onBeforeViewChange' | 'onCellClick' | 'onCellDblClick' | 'onClearAll' | 'onClick' | 'onCollapse' | 'onConfirmedBeforeEventDelete' | 'onContextMenu' | 'onDblClick' | 'onDragEnd' | 'onEmptyClick' | 'onEventAdded' | 'onEventCancel' | 'onEventChanged' | 'onEventCollision' | 'onEventCopied' | 'onEventCreated' | 'onEventCut' | 'onEventDeleted' | 'onEventDrag' | 'onEventDragIn' | 'onEventDragOut' | 'onEventDropOut' | 'onEventIdChange' | 'onEventLoading' | 'onEventPasted' | 'onEventSave' | 'onExpand' | 'onExternalDragIn' | 'onLightbox' | 'onLightboxButton' | 'onLimitViolation' | 'onLoadError' | 'onLocationError' | 'onMouseDown' | 'onMouseMove' | 'onOptionsLoad' | 'onOptionsLoadFinal' | 'onOptionsLoadStart' | 'onSaveError' | 'onScaleAdd' | 'onScaleDblClick' | 'onSchedulerReady' | 'onSchedulerResize' | 'onTemplatesReady' | 'onTimelineCreated' | 'onViewChange' | 'onViewMoreClick' | 'onXLE' | 'onXLS' | 'onXScaleClick' | 'onXScaleDblClick' | 'onYScaleClick' | 'onYScaleDblClick'; -interface SchedulerTemplates{ +interface SchedulerTemplates { /** * specifies the date in the header of the view * @param start the start date of the view @@ -458,7 +458,7 @@ interface SchedulerTemplates{ } -interface SchedulerConfigOptions{ +interface SchedulerConfigOptions { /** * 'says' to present the numbers of days in the Month view as clickable links that open the related day in the specified view */ @@ -477,12 +477,12 @@ interface SchedulerConfigOptions{ /** * specifies how to display the default error notification in case the XML data loading failed */ - ajax_error: string|boolean; + ajax_error: string | boolean; /** * 'says' to show multi-day events in the regular way (as one-day events are displayed) */ - all_timed: boolean|string; + all_timed: boolean | string; /** * sets the date format that will be used by the addEvent() method to parse the start_date, end_date properties in case they are specified as strings @@ -812,7 +812,7 @@ interface SchedulerConfigOptions{ /** * sets the height of the area that displays multi-day events */ - multi_day_height_limit: number|boolean; + multi_day_height_limit: number | boolean; /** * enables the possibility to render the same events in several sections of the Timeline or Units view @@ -942,12 +942,12 @@ interface SchedulerConfigOptions{ /** * enables/disables the touch support in the scheduler */ - touch: boolean|string; + touch: boolean | string; /** * defines the time period in milliseconds that is used to differ the long touch gesture from the scroll gesture */ - touch_drag: number|boolean; + touch_drag: number | boolean; /** * enables/disables prompting messages in the right top corner of the screen @@ -996,7 +996,7 @@ interface SchedulerConfigOptions{ } -interface SchedulerDateHelpers{ +interface SchedulerDateHelpers { add(origin: Date, count: number, unit: string): Date; copy(origin: Date): Date; @@ -1017,19 +1017,19 @@ interface SchedulerDateHelpers{ to_fixed(value: number): string; } -interface SchedulerHotkeys{ +interface SchedulerHotkeys { edit_save: number; edit_cancel: number; } -interface SchedulerLocaleDate{ +interface SchedulerLocaleDate { month_full: string[]; month_short: string[]; day_full: string[]; day_short: string[]; } -interface SchedulerLocaleLabels{ +interface SchedulerLocaleLabels { dhx_cal_today_button: string; day_tab: string; week_tab: string; @@ -1046,13 +1046,13 @@ interface SchedulerLocaleLabels{ section_time: string; } -interface SchedulerLocale{ +interface SchedulerLocale { date: SchedulerLocaleDate; labels: SchedulerLocaleLabels; } -interface SchedulerSizes{ +interface SchedulerSizes { /** * the height of day cells in the month view */ @@ -1124,14 +1124,14 @@ interface SchedulerSizes{ scroll_width: number; } -interface SchedulerEnterprise{ +interface SchedulerEnterprise { /** * Creates a new instance of Scheduler */ getSchedulerInstance(): SchedulerStatic; } -interface SchedulerStatic{ +interface SchedulerStatic { templates: SchedulerTemplates; config: SchedulerConfigOptions; date: SchedulerDateHelpers; @@ -1238,7 +1238,7 @@ interface SchedulerStatic{ * @param time_points an array [start_minute,end_minute,..,start_minute_N,end_minute_N],
where each pair sets a certain limit range. The array can have any number of
such pairs * @param items defines specific items of view(s) to block */ - blockTime(date: Date|number, time_points: any[], items?: any): void; + blockTime(date: Date | number, time_points: any[], items?: any): void; /** * calls an inner event @@ -1327,7 +1327,7 @@ interface SchedulerStatic{ * deletes the specified event * @param id the event's id */ - deleteEvent(id: string|number): void; + deleteEvent(id: string | number): void; /** * removes marking/blocking set by the addMarkedTimespan() and blockTime() methods @@ -1393,39 +1393,39 @@ interface SchedulerStatic{ * returns the event object by its id * @param event_id the event's id */ - getEvent(event_id: string|number): void; + getEvent(event_id: string | number): any; /** * gets the event's end date * @param id the event's id */ - getEventEndDate(id: string): Date; + getEventEndDate(id: string | number): Date; /** * gets the event's start date * @param id the event's id */ - getEventStartDate(id: string): Date; + getEventStartDate(id: string | number): Date; /** * gets the event's text * @param id the event's id */ - getEventText(id: string): string; + getEventText(id: string | number): string; /** * returns a collection of events which occur during the specified period * @param from the start date of the period * @param to the end date of the period */ - getEvents(from?: Date, to?: Date): void; + getEvents(from?: Date, to?: Date): any; /** * gets the label of a select control in the lightbox * @param property the name of a data property that the control is mapped to * @param key the option's id. This parameter is compared with the event's data property
to assign the select's option to an event */ - getLabel(property: string, key: string|number): void; + getLabel(property: string, key: string | number): any; /** * gets the lightbox's HTML object element @@ -1486,7 +1486,7 @@ interface SchedulerStatic{ * @param date the initial date of the scheduler (by default, the current date) * @param view the name of the initial view (by default, "week") */ - init(container: string|HTMLElement, date?: Date, view?: string): void; + init(container: string | HTMLElement, date?: Date, view?: string): void; /** * inverts the specified time zones @@ -1497,7 +1497,7 @@ interface SchedulerStatic{ /** * checks whether the calendar is currently opened in the scheduler */ - isCalendarVisible(): boolean|HTMLElement; + isCalendarVisible(): boolean | HTMLElement; /** * checks whether the specified event one-day or multi-day @@ -1607,7 +1607,7 @@ interface SchedulerStatic{ * @param id the event's id * @param event the event object */ - setEvent(id: string|number, event: any): void; + setEvent(id: string | number, event: any): void; /** * sets the event's end date @@ -1739,7 +1739,7 @@ interface SchedulerStatic{ * removes marking/blocking set by the markTimespan() method * @param divs a timespan to remove marking/blocking from (or an array of timespans) */ - unmarkTimespan(divs: HTMLElement|any[]): void; + unmarkTimespan(divs: HTMLElement | any[]): void; /** * unselects the specified event @@ -1776,7 +1776,5 @@ interface SchedulerStatic{ } - - declare var scheduler: SchedulerStatic; declare var Scheduler: SchedulerEnterprise; \ No newline at end of file diff --git a/jquery.pnotify/jquery.pnotify-tests.ts b/jquery.pnotify/jquery.pnotify-tests.ts index 8704da19f3..d0f2c4475e 100644 --- a/jquery.pnotify/jquery.pnotify-tests.ts +++ b/jquery.pnotify/jquery.pnotify-tests.ts @@ -223,7 +223,7 @@ function test_pnotify() { }); var type = "error"; - var stack_bottomright = {"dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25}; + var stack_bottomright = { "dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25 }; var opts = { title: "Over Here", @@ -233,8 +233,8 @@ function test_pnotify() { width: "100%", stack: stack_bottomright, type: "error" + } as PNotifyOptions; - }; new PNotify(opts); new PNotify({ diff --git a/jquery.pnotify/jquery.pnotify.d.ts b/jquery.pnotify/jquery.pnotify.d.ts index 8daee5da1e..03a1e91c1c 100644 --- a/jquery.pnotify/jquery.pnotify.d.ts +++ b/jquery.pnotify/jquery.pnotify.d.ts @@ -4,11 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - -// could not pass the Travis Test if enabled -//type NoticeTypeOptions = "notice" | "info" | "success" | "error"; -//type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome"; -//type StateOptions = "initializing" | "opening" | "open" | "closing" | "closed"; +type NoticeTypeOptions = "notice" | "info" | "success" | "error"; +type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome"; +type StateOptions = "initializing" | "opening" | "open" | "closing" | "closed"; interface PNotifyStack { dir1?: string; @@ -137,7 +135,7 @@ interface PNotifyOptions { /** * What styling classes to use. (Can be either "brighttheme", "jqueryui", "bootstrap2", "bootstrap3", or "fontawesome".) */ - styling?: string; + styling?: StylingOptions; /** * Additional classes to be added to the notice. (For custom styling.) */ @@ -182,7 +180,7 @@ interface PNotifyOptions { /** * Type of the notice. "notice", "info", "success", or "error". */ - type?: string; + type?: NoticeTypeOptions; /** * Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class. */ @@ -263,7 +261,7 @@ interface PNotify { /** * The state can be "initializing", "opening", "open", "closing", and "closed" */ - state?: string; + state?: StateOptions; /** * This function is for updating the notice. From f65b3822d91e01e95d80e9f1e02bf21468709256 Mon Sep 17 00:00:00 2001 From: Yvo Date: Wed, 28 Sep 2016 09:52:20 -0400 Subject: [PATCH 31/41] Add barTintColor to NavigatorIOS (#11522) --- react-native/react-native.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 4973fa08f9..e3e0cf0209 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -1591,7 +1591,11 @@ declare namespace __React { export interface NavigatorIOSProperties extends React.Props { - + /** + * The background color of the navigation bar + */ + barTintColor?: string + /** * NavigatorIOS uses "route" objects to identify child views, their props, and navigation bar configuration. * "push" and all the other navigation operations expect routes to be like this From 750936896bacf9027eccc80228822f4f131a77a5 Mon Sep 17 00:00:00 2001 From: lucap86 Date: Wed, 28 Sep 2016 15:52:35 +0200 Subject: [PATCH 32/41] GreenSock TweenMax TweenLite config Object typed refs #11265 (#11310) * refs #9944 * refs #11265 * refs #11265 --- greensock/greensock.d.ts | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index a3b3801775..004ec79dab 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -13,7 +13,38 @@ interface IDispatcher { declare type Tween = TweenLite | TweenMax; declare type Timeline = SimpleTimeline | TimelineLite | TimelineMax; - +declare type TweenConfig = { + [tweenProp: string]: any; + delay?: number; + ease?: Ease; + repeat?: number; + repeatDelay?: number; + yoyo?: boolean; + paused?: boolean; + overwrite?: string|number; + onComplete?: Function; + immediateRender?: boolean; + onCompleteParams?: any[]; + onCompleteScope?: Object; + onRepeat?: Function; + onRepeatScope?: Object; + onReverseComplete?: Function; + onReverseCompleteParams?: any[]; + onReverseCompleteScope?: Object; + onStart?: Function; + onStartParams?: any[]; + onStartScope?: Object; + onUpdate?: Function; + onUpdateParams?: any[]; + onUpdateScope?: Object; + startAt?: Object; + useFrames?: boolean; + lazy?: boolean; + onOverwrite?: Function; + autoCSS?: boolean; + callbackScope?: Object; +} + //com.greensock.core declare class Animation { static ticker: IDispatcher; @@ -86,7 +117,7 @@ declare class TweenLite extends Animation { static killTweensOf(target: Object, onlyActive?: boolean, vars?: Object): void; static lagSmoothing(threshold: number, adjustedLag: number): void; static set(target: Object, vars: Object): TweenLite; - static to(target: Object, duration: number, vars: Object): TweenLite; + static to(target: Object, duration: number, vars: TweenConfig): TweenLite; } declare class TweenMax extends TweenLite { @@ -112,7 +143,7 @@ declare class TweenMax extends TweenLite { static staggerFrom(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; static staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; static staggerTo(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; - static to(target:Object, duration:number, vars:Object):TweenMax; + static to(target:Object, duration:number, vars:TweenConfig):TweenMax; updateTo(vars: Object, resetDuration?: boolean): TweenMax; yoyo(): boolean; yoyo(value?: boolean): TweenMax; From 881408c91909383843f7cf10de4f39fcd71baa06 Mon Sep 17 00:00:00 2001 From: Prashant Tiwari Date: Wed, 28 Sep 2016 19:24:45 +0530 Subject: [PATCH 33/41] Call strategy with only mode or options (#11466) * Call strategy with only mode or options * Refactor `server.auth.strategy` --- hapi/hapi.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 9c01eb741d..a25ecff38d 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -1876,7 +1876,9 @@ declare module "hapi" { } } });*/ - strategy(name: string, scheme: any, mode?: boolean | string, options?: any): void; + strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void; + strategy(name: string, scheme: string, mode?: boolean | string): void; + strategy(name: string, scheme: string, options?:any): void; /** server.auth.test(strategy, request, next) Tests a request against an authentication strategy where: From 15345f88562b77cbf03013382581838bf97813d3 Mon Sep 17 00:00:00 2001 From: panoti Date: Wed, 28 Sep 2016 21:01:54 +0700 Subject: [PATCH 34/41] - add client.exists([params, [callback]]) (#11515) --- elasticsearch/elasticsearch.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/elasticsearch/elasticsearch.d.ts b/elasticsearch/elasticsearch.d.ts index 2816a0dee0..26a9a1e880 100644 --- a/elasticsearch/elasticsearch.d.ts +++ b/elasticsearch/elasticsearch.d.ts @@ -15,6 +15,8 @@ declare module Elasticsearch { create(params: CreateDocumentParams, callback: (err: any, response: any, status: any) => void): void; delete(params: DeleteDocumentParams): PromiseLike; delete(params: DeleteDocumentParams, callback: (error: any, response: any) => void): void; + exists(params: ExistsParams): PromiseLike; + exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; get(params: GetParams): PromiseLike>; index(params: IndexDocumentParams): PromiseLike; @@ -95,6 +97,7 @@ declare module Elasticsearch { method?: string; body?: any; ignore?: number | number[]; + filterPath?: string | string[]; } export interface BulkIndexDocumentsParams extends GenericParams { @@ -205,6 +208,17 @@ declare module Elasticsearch { _source: T; } + export interface ExistsParams extends GenericParams { + id: string; + index: string; + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + type: string; + } + export interface IndexDocumentParams extends GenericParams { index: string; type: string; From 32b5d0a12c4a8e5be4e51c82d8636de022b6b4ec Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 28 Sep 2016 07:23:24 -0700 Subject: [PATCH 35/41] Update to Electron 1.4.1 (#11481) --- github-electron/github-electron.d.ts | 62 ++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 64b7cf6a02..9541d64ac6 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron v1.3.6 +// Type definitions for Electron v1.4.1 // Project: http://electron.atom.io/ // Definitions by: jedmao , rhysd , Milan Burda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -176,7 +176,7 @@ declare namespace Electron { /** * Emitted when the gpu process crashes. */ - on(event: 'gpu-process-crashed', listener: Function): this; + on(event: 'gpu-process-crashed', listener: (event: Event, killed: boolean) => void): this; /** * Emitted when Chrome's accessibility support changes. * @@ -841,6 +841,11 @@ declare namespace Electron { * Note: This is only implemented on macOS. */ on(event: 'scroll-touch-end', listener: Function): this; + /** + * Emitted when scroll wheel event phase filed upon reaching the edge of element. + * Note: This is only implemented on macOS. + */ + on(event: 'scroll-touch-edge', listener: Function): this; /** * Emitted on 3-finger swipe. * Note: This is only implemented on macOS. @@ -2589,6 +2594,7 @@ declare namespace Electron { static createEmpty(): NativeImage; /** * Creates a new NativeImage instance from file located at path. + * This method returns an empty image if the path does not exist, cannot be read, or is not a valid image. */ static createFromPath(path: string): NativeImage; /** @@ -2769,8 +2775,18 @@ declare namespace Electron { referrer: string; method: string; uploadData?: { + /** + * Content being sent. + */ bytes: Buffer, - file: string + /** + * Path of file being uploaded. + */ + file: string, + /** + * UUID of blob data. Use session.getBlobData method to retrieve the data. + */ + blobUUID: string; }[]; } @@ -3016,6 +3032,10 @@ declare namespace Electron { * @returns The user agent for this session. */ getUserAgent(): string; + /** + * Returns the blob data associated with the identifier. + */ + getBlobData(identifier: string, callback: (result: Buffer) => void): void; /** * The webRequest API set allows to intercept and modify contents of a request at various stages of its lifetime. */ @@ -3317,6 +3337,10 @@ declare namespace Electron { * Path of file being uploaded. */ file: string; + /** + * UUID of blob data. Use session.getBlobData method to retrieve the data. + */ + blobUUID: string; } interface BeforeRequestDetails extends Details { @@ -3495,6 +3519,11 @@ declare namespace Electron { * Get system preferences. */ interface SystemPreferences { + /** + * Note: This is only implemented on Windows. + */ + on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this; + on(event: string, listener: Function): this; /** * @returns If the system is in Dark Mode. * @@ -3549,13 +3578,17 @@ declare namespace Electron { */ getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any; /** - * This method returns true if DWM composition (Aero Glass) is enabled, - * and false otherwise. You can use it to determine if you should create - * a transparent window or not (transparent windows won’t work correctly when DWM composition is disabled). + * @returns Whether DWM composition (Aero Glass) is enabled. * * Note: This is only implemented on Windows. */ isAeroGlassEnabled(): boolean; + /** + * @returns The users current system wide color preference in the form of an RGBA hexadecimal string. + * + * Note: This is only implemented on Windows. + */ + getAccentColor(): string; } // https://github.com/electron/electron/blob/master/docs/api/tray.md @@ -3822,7 +3855,7 @@ declare namespace Electron { /** * Emitted when the renderer process has crashed. */ - on(event: 'crashed', listener: Function): this; + on(event: 'crashed', listener: (event: Event, killed: boolean) => void): this; /** * Emitted when a plugin process has crashed. */ @@ -4237,6 +4270,10 @@ declare namespace Electron { * If offscreen rendering is enabled returns the current frame rate. */ getFrameRate(): number; + /** + * If offscreen rendering is enabled invalidates the frame and generates a new one through the 'paint' event. + */ + invalidate(): void; /** * Sets the item as dragging item for current drag-drop operation. */ @@ -4438,7 +4475,7 @@ declare namespace Electron { [key: string]: string; } - type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other'; + type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'; /** * Specifies the action to take place when ending webContents.findInPage request. @@ -4881,6 +4918,15 @@ declare namespace Electron { * A list of strings which specifies the blink features to be disabled separated by ,. */ disableblinkfeatures: string; + /** + * A value that links the webview to a specific webContents. + * When a webview first loads a new webContents is created and this attribute is set + * to its instance identifier. Setting this attribute on a new or existing webview connects + * it to the existing webContents that currently renders in a different webview. + * + * The existing webview will see the destroy event and will then create a new webContents when a new url is loaded. + */ + guestinstance: string; /** * Loads the url in the webview, the url must contain the protocol prefix, e.g. the http:// or file://. */ From 7be68adbdff4bea14f33f54f27d3bdb5822e3b10 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Wed, 28 Sep 2016 22:34:18 +0800 Subject: [PATCH 36/41] Correct fs.createWriteStream (#11560) --- node/node.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/node/node.d.ts b/node/node.d.ts index 5c016af3fd..0f2374ae10 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2321,6 +2321,8 @@ declare module "fs" { encoding?: string; fd?: number; mode?: number; + autoClose?: boolean; + start?: number; }): WriteStream; export function fdatasync(fd: number, callback: Function): void; export function fdatasyncSync(fd: number): void; From b8cdd448dd9bc6236fef31a11aa6bd1daf074739 Mon Sep 17 00:00:00 2001 From: vargeek Date: Wed, 28 Sep 2016 23:11:03 +0800 Subject: [PATCH 37/41] add declaration file for weapp (#11554) * add declaration file of weapp * rename "weapp" to "weapp-api" rename "weapp" to "weapp-api" to avoid naming conflicts --- weapp-api/weapp-api-tests.ts | 678 ++++++++++++++++++++ weapp-api/weapp-api.d.ts | 1135 ++++++++++++++++++++++++++++++++++ 2 files changed, 1813 insertions(+) create mode 100644 weapp-api/weapp-api-tests.ts create mode 100644 weapp-api/weapp-api.d.ts diff --git a/weapp-api/weapp-api-tests.ts b/weapp-api/weapp-api-tests.ts new file mode 100644 index 0000000000..0b249701c6 --- /dev/null +++ b/weapp-api/weapp-api-tests.ts @@ -0,0 +1,678 @@ +/// + + +App({ + onLaunch: function () { + //调用API从本地缓存中获取数据 + var logs = wx.getStorageSync('logs') as Array || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + }, + getUserInfo: function (cb: Function) { + var that = this; + if (this.globalData.userInfo) { + typeof cb == "function" && cb(this.globalData.userInfo) + } else { + //调用登录接口 + wx.login({ + success: function () { + wx.getUserInfo({ + success: function (res) { + that.globalData.userInfo = res.userInfo; + typeof cb == "function" && cb(that.globalData.userInfo) + } + }) + } + }); + } + }, + globalData: { + userInfo: null + } +}) + + +let app = getApp(); +let page = app.getCurrentPage(); +page.setData({ 'foo': 'bar' }); +Page({ + data: { + foo: 'bar' + }, + onLoad: function (options) { + console.log(options.title); + } +}) + + +wx.request({ + url: 'test.php', + data: { + x: '', + y: '' + }, + header: { + 'Content-Type': 'application/json' + }, + success: function (res) { + console.log(res.data) + } +}) + +wx.chooseImage({ + success: function (res) { + var tempFilePaths = res.tempFilePaths + wx.uploadFile({ + url: 'http://example.com/upload', + filePath: tempFilePaths[0], + name: 'file', + formData: { + 'user': 'test' + } + }) + } +}) + +wx.downloadFile({ + url: 'http://example.com/audio/123', + type: 'audio', + success: function (res) { + wx.playVoice({ + filePath: res.tempFilePath + }) + } +}) + +wx.connectSocket({ + url: 'test.php', + data: { + x: '', + y: '' + }, + header: { + 'content-type': 'application/json' + }, + method: "GET", +}) + +wx.connectSocket({ + url: 'test.php' +}) +wx.onSocketOpen(function (res) { + console.log('WebSocket连接已打开!') +}) + +wx.connectSocket({ + url: 'test.php' +}) +wx.onSocketOpen(function (res) { + console.log('WebSocket连接已打开!') +}) +wx.onSocketError(function (res) { + console.log('WebSocket连接打开失败,请检查!') +}) + +var socketOpen = false +var socketMsgQueue: Array = [] +wx.connectSocket({ + url: 'test.php' +}) + +wx.onSocketOpen(function (res) { + socketOpen = true + for (var i = 0; i < socketMsgQueue.length; i++) { + sendSocketMessage(socketMsgQueue[i]) + } + socketMsgQueue = [] +}) + +function sendSocketMessage(msg: string) { + if (socketOpen) { + wx.sendSocketMessage({ + data: msg + }) + } else { + socketMsgQueue.push(msg) + } +} + +wx.connectSocket({ + url: 'test.php' +}) + +wx.onSocketMessage(function (res) { + console.log('收到服务器内容:' + res.data) +}) + +wx.connectSocket({ + url: 'test.php' +}) + +//注意这里有时序问题, +//如果 wx.connectSocket 还没回调 wx.onSocketOpen,而先调用 wx.closeSocket,那么就做不到关闭 WebSocket 的目的。 +//必须在 WebSocket 打开期间调用 wx.closeSocket 才能关闭。 +wx.onSocketOpen(function () { + wx.closeSocket() +}) + +wx.onSocketClose(function (res) { + console.log('WebSocket 已关闭!') +}) + +wx.chooseImage({ + count: 1, // 默认9 + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 + var tempFilePaths = res.tempFilePaths + } +}) + +wx.previewImage({ + current: '', // 当前显示图片的http链接 + urls: [] // 需要预览的图片http链接列表 +}) + +wx.startRecord({ + success: function (res) { + var tempFilePath = res.tempFilePath + }, + fail: function (res) { + //录音失败 + } +}) +setTimeout(function () { + //结束录音 + wx.stopRecord() +}, 10000) + +wx.startRecord({ + success: function (res) { + var tempFilePath = res.tempFilePath + wx.playVoice({ + filePath: tempFilePath, + complete: function () { + } + }) + } +}) + +wx.startRecord({ + success: function (res) { + var tempFilePath = res.tempFilePath + wx.playVoice({ + filePath: tempFilePath + }) + + setTimeout(function () { + //暂停播放 + wx.pauseVoice() + }, 5000) + } +}) + +wx.startRecord({ + success: function (res) { + var tempFilePath = res.tempFilePath + wx.playVoice({ + filePath: tempFilePath + }) + + setTimeout(function () { + wx.stopVoice() + }, 5000) + } +}) + +wx.getBackgroundAudioPlayerState({ + success: function (res) { + var status = res.status + var dataUrl = res.dataUrl + var currentPosition = res.currentPosition + var duration = res.duration + var downloadPercent = res.downloadPercent + } +}) + +wx.playBackgroundAudio({ + dataUrl: '', + title: '', + coverImgUrl: '' +}) + +wx.pauseBackgroundAudio() + +wx.seekBackgroundAudio({ + position: 30 +}) +wx.stopBackgroundAudio() + +wx.startRecord({ + success: function (res) { + var tempFilePath = res.tempFilePath + wx.saveFile({ + tempFilePath: tempFilePath, + success: function (res) { + var savedFilePath = res.savedFilePath + } + }) + } +}) + + +Page({ + bindButtonTap: function () { + var that = this + wx.chooseVideo({ + sourceType: ['album', 'camera'], + maxDuration: 60, + camera: ['front', 'back'], + success: function (res) { + that.setData({ + src: res.tempFilePath + }) + } + }) + } +}) + +wx.setStorage({ + key: "key", + data: "value" +}) + +try { + wx.setStorageSync('key', 'value') +} catch (e) { +} + +wx.getStorage({ + key: 'key', + success: function (res) { + console.log(res.data) + } +}) + + +var value = wx.getStorageSync('key') +if (value) { + // Do something with return value +} + + +wx.clearStorage() + + +try { + wx.clearStorageSync() +} catch (e) { +} + + +wx.getLocation({ + type: 'wgs84', + success: function (res) { + var latitude = res.latitude + var longitude = res.longitude + var speed = res.speed + var accuracy = res.accuracy + } +}) + +wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function(res) { + var latitude = res.latitude + var longitude = res.longitude + wx.openLocation({ + latitude: latitude, + longitude: longitude, + scale: 28 + }) + } +}) + +wx.getNetworkType({ + success: function(res) { + var networkType = res.networkType // 返回网络类型2g,3g,4g,wifi + } +}) + +wx.getSystemInfo({ + success: function(res) { + console.log(res.model) + console.log(res.pixelRatio) + console.log(res.windowWidth) + console.log(res.windowHeight) + console.log(res.language) + console.log(res.version) + } +}) + +wx.onAccelerometerChange(function(res) { + console.log(res.x) + console.log(res.y) + console.log(res.z) +}) + +wx.onCompassChange(function (res) { + console.log(res.direction) +}) + +wx.setNavigationBarTitle({ + title: '当前页面' +}) + +wx.navigateTo({ + url: 'test?id=1' +}) + +wx.redirectTo({ + url: 'test?id=1' +}) + + +var animation = wx.createAnimation({ + transformOrigin: "50% 50%", + duration: 1000, + timingFunction: "ease", + delay: 0 +}) + + +Page({ + data: { + animationData: {} + }, + onShow: function(){ + var animation = wx.createAnimation({ + duration: 1000, + timingFunction: 'ease', + }) + + this.animation = animation + + animation.scale(2,2).rotate(45).step() + + this.setData({ + animationData:animation.export() + }) + + setTimeout(function() { + animation.translate(30).step() + this.setData({ + animationData:animation.export() + }) + }.bind(this), 1000) + }, + rotateAndScale: function () { + // 旋转同时放大 + this.animation.rotate(45).scale(2, 2).step() + this.setData({ + animationData:animation.export() + }) + }, + rotateThenScale: function () { + // 先旋转后放大 + this.animation.rotate(45).step() + this.animation.scale(2, 2).step() + this.setData({ + animationData:animation.export() + }) + }, + rotateAndScaleThenTranslate: function () { + // 先旋转同时放大,然后平移 + this.animation.rotate(45).scale(2, 2).step() + this.animation.translate(100, 100).step({ duration: 1000 }) + this.setData({ + animationData:animation.export() + }) + } +}) + +// 假设页面上有3个画布 +var canvas1Id = 3001 +var canvas2Id = 3002 +var canvas3Id = 3003 + +var context = wx.createContext(); + +[canvas1Id, canvas2Id, canvas3Id].forEach(function (id) { + context.clearActions() + // 在context上调用方法 + wx.drawCanvas({ + canvasId: id, + actions: context.getActions() + }) +}) + + +Page({ + onReady: function() { + var context = wx.createContext() + context.rect(5, 5, 25, 15) + context.stroke() + context.scale(2, 2) //再放大2倍 + context.rect(5, 5, 25, 15) + context.stroke() + context.scale(2, 2) //再放大2倍 + context.rect(5, 5, 25, 15) + context.stroke() + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }) + } +}) + + +Page({ + onReady: function() { + var context = wx.createContext() + context.rect(50, 50, 200, 200) + context.stroke() + context.rotate(5 * Math.PI / 180) + context.rect(50, 50, 200, 200) + context.stroke() + context.rotate(5 * Math.PI / 180) + context.rect(50, 50, 200, 200) + context.stroke() + + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }) + } +}) + +Page({ + onReady: function() { + var context = wx.createContext() + + context.rect(50, 50, 200, 200) + context.stroke() + context.translate(50, 50) + context.rect(50, 50, 200, 200) + context.stroke() + + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }) + } +}) + +Page({ + onReady: function() { + var context = wx.createContext() + + context.rect(50, 50, 200, 200) + context.fill() + context.clearRect(100, 100, 50, 50) + + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }) + } +}) + +Page({ + onReady: function() { + var context = wx.createContext() + wx.chooseImage({ + success: function(res) { + context.drawImage(res.tempFilePaths[0], 0, 0) + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }) + } + }) + } +}) + +Page({ + onReady:function(){ + var context = wx.createContext() + + context.setFontSize(14) + context.fillText("MINA", 50, 50) + context.moveTo(0, 50) + context.lineTo(100, 50) + context.stroke() + + context.setFontSize(20) + context.fillText("MINA", 100, 100) + context.moveTo(0, 100) + context.lineTo(200, 100) + context.stroke() + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }); + } +}) + +Page({ + onReady: function() { + var context = wx.createContext() + + context.setFillStyle("#ff00ff") + context.setStrokeStyle("#00ffff") + + context.rect(50, 50, 100, 100) + context.fill() + context.stroke() + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }); + } +}) + +Page({ + onReady: function() { + var context = wx.createContext() + + context.setLineWidth(10) + context.setLineCap("round") + context.setLineJoin("miter") + context.setMiterLimit(10) + context.moveTo(20, 20) + context.lineTo(150, 27) + context.lineTo(20, 54) + context.stroke() + + context.beginPath() + + context.setMiterLimit(3) + context.moveTo(20, 70) + context.lineTo(150, 77) + context.lineTo(20, 104) + context.stroke() + + wx.drawCanvas({ + canvasId: 1, + actions: context.getActions() + }); + } +}) +Page({ + canvasIdErrorCallback: function (e:any) { + console.error(e.detail.errMsg) + }, + onReady: function() { + //使用wx.createContext获取绘图上下文context + var context = wx.createContext() + + context.setStrokeStyle("#00ff00") + context.setLineWidth(5) + context.rect(0, 0, 200, 200) + context.stroke() + context.setStrokeStyle("#ff0000") + context.setLineWidth(2) + context.moveTo(160, 100) + context.arc(100, 100, 60, 0,2 * Math.PI, true) + context.moveTo(140, 100) + context.arc(100, 100, 40, 0, Math.PI, false) + context.moveTo(85, 80) + context.arc(80, 80, 5, 0,2 * Math.PI, true) + context.moveTo(125, 80) + context.arc(120, 80, 5, 0, 2 * Math.PI, true) + context.stroke() + + // 调用 wx.drawCanvas,通过 canvasId 指定在哪张画布上绘制,通过 actions 指定绘制行为 + wx.drawCanvas({ + canvasId: 'firstCanvas', + actions: context.getActions() // 获取绘图动作数组 + }) + } +}) + + +App({ + onLaunch: function() { + wx.login({ + success: function(res) { + if (res.code) { + //发起网络请求 + wx.request({ + url: 'https://test.com/onLogin', + data: { + code: res.code + } + }) + } else { + console.log('获取用户登录态失败!' + res.errMsg) + } + } + }); + } +}) + + +wx.getUserInfo({ + success: function(res) { + var userInfo = res.userInfo + var nickName = userInfo.nickName + var avatarUrl = userInfo.avatarUrl + var gender = userInfo.gender //性别 0:未知、1:男、2:女 + var province = userInfo.province + var city = userInfo.city + var country = userInfo.country + } +}) + +wx.requestPayment({ + 'timeStamp': '', + 'nonceStr': '', + 'package': '', + 'signType': 'MD5', + 'paySign': '', + 'success':function(res){ + }, + 'fail':function(res){ + } +}) diff --git a/weapp-api/weapp-api.d.ts b/weapp-api/weapp-api.d.ts new file mode 100644 index 0000000000..cb9d00383d --- /dev/null +++ b/weapp-api/weapp-api.d.ts @@ -0,0 +1,1135 @@ +// Type definitions for weapp +// Project: https://mp.weixin.qq.com/debug/wxadoc/dev/index.html +// Definitions by: vargeek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace wx { + type NoneParamCallback = () => void; + type OneParamCallback = (data: any) => void; + type ResponseCallback = (res: any) => void; + type DataResponseCallback = (res: DataResponse) => void; + type TempFileResponseCallback = (res: TempFileResponse) => void; + type ErrorCallback = (error: any) => void; + type EventCallback = (event: any) => void; + + interface DataResponse { + /** 回调函数返回的内容 */ + data: any; + } + interface TempFileResponse { + /** 文件的临时路径 */ + tempFilePath: string; + } + + interface PageOptions { + /** 页面的初始数据 */ + data?: any; + /** 生命周期函数--监听页面加载 */ + onLoad?: (options: any) => void; + /** 生命周期函数--监听页面渲染完成 */ + onReady?: NoneParamCallback; + /** 生命周期函数--监听页面显示 */ + onShow?: NoneParamCallback; + /** 生命周期函数--监听页面隐藏 */ + onHide?: NoneParamCallback; + /** 生命周期函数--监听页面卸载 */ + onUnload?: NoneParamCallback; + [key: string]: any; + } + + interface AppOptions { + /** + * 生命周期函数--监听小程序初始化 + * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) + */ + onLaunch?: NoneParamCallback; + /** + * 生命周期函数--监听小程序显示 + * 当小程序启动,或从后台进入前台显示,会触发 onShow + */ + onShow?: NoneParamCallback; + /** + * 生命周期函数--监听小程序隐藏 + * 当小程序从前台进入后台,会触发 onHide + */ + onHide?: NoneParamCallback; + [key: string]: any + } + + interface RequestHeader { + [key: string]: string; + } + interface RequestOptions { + /** 开发者服务器接口地址 */ + url: string; + /** 请求的参数 */ + data?: string | any; + /** 设置请求的 header , header 中不能设置 Referer */ + header?: RequestHeader; + /** 默认为 GET,有效值:OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT */ + method?: string; + /** 收到开发者服务成功返回的回调函数,res = {data: '开发者服务器返回的内容'} */ + success?: DataResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * wx.request发起的是https请求。一个微信小程序,同时只能有5个网络请求连接。 + */ + function request(options: RequestOptions): void; + + + interface UploadFileOptions { + /** 开发者服务器 url */ + url: string; + /** 要上传文件资源的路径 */ + filePath: string; + /** 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 */ + name: string; + /** HTTP 请求 Header , header 中不能设置 Referer */ + header?: RequestHeader; + /** HTTP 请求中其他额外的 form data */ + formData?: any; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 将本地资源上传到开发者服务器。 + * 如页面通过 wx.chooseImage 等接口获取到一个本地资源的临时文件路径后, + * 可通过此接口将本地资源上传到指定服务器。 + * 客户端发起一个 HTTPS POST 请求, + * 其中 Content-Type 为 multipart/form-data 。 + */ + function uploadFile(options: UploadFileOptions): void; + + + interface DownloadFileOptions { + /** 下载资源的 url */ + url: string; + /** 下载资源的类型,用于客户端识别处理,有效值:image/audio/video */ + type?: string; + /** HTTP 请求 Header */ + header?: RequestHeader; + /** 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} */ + success?: TempFileResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 下载文件资源到本地。客户端直接发起一个 HTTP GET 请求, + * 把下载到的资源根据 type 进行处理,并返回文件的本地临时路径。 + */ + function downloadFile(options: DownloadFileOptions): void; + + + interface ConnectSocketOptions { + /** 开发者服务器接口地址,必须是 HTTPS 协议,且域名必须是后台配置的合法域名 */ + url: string; + /** 请求的数据 */ + data?: any; + /** HTTP Header , header 中不能设置 Referer */ + header?: RequestHeader; + /** 默认是GET,有效值为: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT */ + method?: string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 创建一个 WebSocket 连接; + * 一个微信小程序同时只能有一个 WebSocket 连接, + * 如果当前已存在一个 WebSocket 连接, + * 会自动关闭该连接,并重新创建一个 WebSocket 连接。 + */ + function connectSocket(options: ConnectSocketOptions): void; + + + /** 监听WebSocket连接打开事件。 */ + function onSocketOpen(callback: OneParamCallback): void; + + /** 监听WebSocket错误。 */ + function onSocketError(callback: ErrorCallback): void; + + interface SendSocketMessageOptions { + /** 需要发送的内容 */ + data: string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 通过 WebSocket 连接发送数据,需要先 wx.connectSocket, + * 并在 wx.onSocketOpen 回调之后才能发送。 + */ + function sendSocketMessage(options: SendSocketMessageOptions): void; + + + /** + * 监听WebSocket接受到服务器的消息事件。 + */ + function onSocketMessage(callback: DataResponseCallback): void; + + /** + * 关闭WebSocket连接。 + */ + function closeSocket(): void; + + /** 监听WebSocket关闭。 */ + function onSocketClose(callback: ResponseCallback): void; + + type ImageSizeType = 'original' | 'compressed'; + type ImageSourceType = 'album' | 'camera'; + type VideoSourceType = 'album' | 'camera'; + type CameraDevice = 'front' | 'back'; + + interface TempFilesData { + /** 文件的临时路径 */ + tempFilePaths: string; + } + interface ChooseImageOptions { + /** 最多可以选择的图片张数,默认9 */ + count?: number; + /** original 原图,compressed 压缩图,默认二者都有 */ + sizeType?: Array; + /** album 从相册选图,camera 使用相机,默认二者都有 */ + sourceType?: Array; + /** 成功则返回图片的本地文件路径列表 tempFilePaths */ + success: (res: TempFilesData) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 从本地相册选择图片或使用相机拍照。 + */ + function chooseImage(options: ChooseImageOptions): void; + + interface PreviewImageOptions { + /** 当前显示图片的链接,不填则默认为 urls 的第一张 */ + current?: string; + /** 需要预览的图片链接列表 */ + urls: Array; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 预览图片。 + */ + function previewImage(options: PreviewImageOptions): void; + + interface StartRecordOptions { + /** 录音成功后调用,返回录音文件的临时文件路径,res = {tempFilePath: '录音文件的临时路径'} */ + success?: TempFileResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 开始录音。当主动调用wx.stopRecord, + * 或者录音超过1分钟时自动结束录音,返回录音文件的临时文件路径。 + * 注:文件的临时路径,在小程序本次启动期间可以正常使用, + * 如需持久保存,需在主动调用wx.saveFile,在小程序下次启动时才能访问得到。 + */ + function startRecord(options: StartRecordOptions): void; + + /** + * ​ 主动调用停止录音。 + */ + function stopRecord(): void; + + interface PlayVoiceOptions { + /** 需要播放的语音文件的文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 开始播放语音,同时只允许一个语音文件正在播放, + * 如果前一个语音文件还没播放完,将中断前一个语音播放。 + */ + function playVoice(options: PlayVoiceOptions): void; + + /** + * 暂停正在播放的语音。 + * 再次调用wx.playVoice播放同一个文件时,会从暂停处开始播放。 + * 如果想从头开始播放,需要先调用 wx.stopVoice。 + */ + function pauseVoice(): void; + + /** + * 结束播放语音。 + */ + function stopVoice(): void; + + interface BackgroundAudioPlayerState { + /** 选定音频的长度(单位:s),只有在当前有音乐播放时返回 */ + duration?: number; + /** 选定音频的播放位置(单位:s),只有在当前有音乐播放时返回 */ + currentPosition?: number; + /** 播放状态(2:没有音乐在播放,1:播放中,0:暂停中) */ + status: number; + /** 音频的下载进度(整数,80 代表 80%),只有在当前有音乐播放时返回 */ + downloadPercent?: number; + /** 歌曲数据链接,只有在当前有音乐播放时返回 */ + dataUrl?: string; + } + type GetBackgroundAudioPlayerStateSuccessCallback = (state: BackgroundAudioPlayerState) => void; + interface GetBackgroundAudioPlayerStateOptions { + /** 接口调用成功的回调函数 */ + success?: GetBackgroundAudioPlayerStateSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: NoneParamCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NoneParamCallback; + } + /** 获取音乐播放状态。 */ + function getBackgroundAudioPlayerState(options: GetBackgroundAudioPlayerStateOptions): void; + + interface PlayBackgroundAudioOptions { + /** 音乐链接 */ + dataUrl: string; + /** 音乐标题 */ + title?: string; + /** 封面URL */ + coverImgUrl?: string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + + } + /** 播放音乐,同时只能有一首音乐正在播放。 */ + function playBackgroundAudio(options: PlayBackgroundAudioOptions): void; + + /** 暂停播放音乐。 */ + function pauseBackgroundAudio(): void; + + interface SeekBackgroundAudioOptions { + /** 音乐位置,单位:秒 */ + position: number; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 控制音乐播放进度。 + */ + function seekBackgroundAudio(options: SeekBackgroundAudioOptions): void; + + /** + * 停止播放音乐。 + */ + function stopBackgroundAudio(): void; + + /** 监听音乐播放。 */ + function onBackgroundAudioPlay(callback: NoneParamCallback): void; + + /** 监听音乐暂停。 */ + function onBackgroundAudioPause(callback: NoneParamCallback): void; + + /** 监听音乐停止。 */ + function onBackgroundAudioStop(callback: NoneParamCallback): void; + + interface SavedFileData { + /** 文件的保存路径 */ + savedFilePath: string; + } + interface SaveFileOptions { + /** 需要保存的文件的临时路径 */ + tempFilePath: string; + /** 返回文件的保存路径,res = {savedFilePath: '文件的保存路径'} */ + success?: (res: SavedFileData) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 保存文件到本地。 + */ + function saveFile(options: SaveFileOptions): void; + + interface VideoData { + /** 选定视频的临时文件路径 */ + tempFilePath: string; + /** 选定视频的时间长度 */ + duration: number; + /** 选定视频的数据量大小 */ + size: number; + /** 返回选定视频的长 */ + height: number; + /** 返回选定视频的宽 */ + width: number; + } + interface ChooseVideoOptions { + /** album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera'] */ + sourceType?: Array; + /** 拍摄视频最长拍摄时间,单位秒。最长支持60秒 */ + maxDuration?: number; + /** 前置或者后置摄像头,默认为前后都有,即:['front', 'back'] */ + camera?: Array; + /** 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明 */ + success?: (res: VideoData) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。 + */ + function chooseVideo(options: ChooseVideoOptions): void; + + interface SetStorageOptions { + /** 本地缓存中的指定的 key */ + key: string; + /** 需要存储的内容 */ + data: any | string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 将数据存储在本地缓存中指定的 key 中, + * 会覆盖掉原来该 key 对应的内容,这是一个异步接口。 + */ + function setStorage(options: SetStorageOptions): void; + /** + * 将 data 存储在本地缓存中指定的 key 中, + * 会覆盖掉原来该 key 对应的内容,这是一个同步接口。 + * + * @param {string} key 本地缓存中的指定的 key + * @param {(Object | string)} data 需要存储的内容 + */ + function setStorageSync(key: string, data: any | string): void; + + interface GetStorageOptions { + /** 本地缓存中的指定的 key */ + key: string; + /** 接口调用的回调函数,res = {data: key对应的内容} */ + success: DataResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 从本地缓存中异步获取指定 key 对应的内容。 + */ + function getStorage(options: GetStorageOptions): void; + + /** + * 从本地缓存中同步获取指定 key 对应的内容。 + * + * @param {string} key + * @returns {(Object | string)} + */ + function getStorageSync(key: string): any | string; + + /** + * 清理本地数据缓存。 + */ + function clearStorage(): void; + /** + * 同步清理本地数据缓存 + */ + function clearStorageSync(): void; + + interface LocationData { + /** 纬度,浮点数,范围为-90~90,负数表示南纬 */ + latitude: number; + /** 经度,浮点数,范围为-180~180,负数表示西经 */ + longitude: number; + /** 速度,浮点数,单位m/s */ + speed: number; + /** 位置的精确度 */ + accuracy: number; + } + + interface GetLocationOptions { + /** 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于wx.openLocation的坐标 */ + type?: 'wgs84' | 'gcj02'; + /** 接口调用成功的回调函数,返回内容详见返回参数说明。 */ + success: (res: LocationData) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 获取当前的地理位置、速度。 + */ + function getLocation(options: GetLocationOptions): void; + + interface OpenLocationOptions { + /** 纬度,范围为-90~90,负数表示南纬 */ + latitude: number; + /** 经度,范围为-180~180,负数表示西经 */ + longitude: number; + /** 缩放比例,范围1~28,默认为28 */ + scale?: number; + /** 位置名 */ + name?: string; + /** 地址的详细说明 */ + address?: string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 使用微信内置地图查看位置 + */ + function openLocation(options: OpenLocationOptions): void; + + interface NetworkTypeData { + /** 返回网络类型2g,3g,4g,wifi */ + networkType: '2g' | '3g' | '4g' | 'wifi'; + } + interface GetNetworkTypeOptions { + /** 接口调用成功,返回网络类型 networkType */ + success: (res: NetworkTypeData) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 获取网络类型。 + */ + function getNetworkType(options: GetNetworkTypeOptions): void; + + + interface SystemInfo { + /** 手机型号 */ + model: string; + /** 设备像素比 */ + pixelRatio: number; + /** 窗口宽度 */ + windowWidth: number; + /** 窗口高度 */ + windowHeight: number; + /** 微信设置的语言 */ + language: string; + /** 微信版本号 */ + version: string; + } + interface GetSystemInfoOptions { + /** 成功获取系统信息的回调 */ + success: (res: SystemInfo) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 获取系统信息。 + */ + function getSystemInfo(options: GetSystemInfoOptions): void; + + interface AccelerometerData { + /** X 轴 */ + x: number; + /** Y 轴 */ + y: number; + /** Z 轴 */ + z: number; + } + type AccelerometerChangeCallback = (res: AccelerometerData) => void; + /** + * 监听重力感应数据,频率:5次/秒 + */ + function onAccelerometerChange(callback: AccelerometerChangeCallback): void; + + interface CompassData { + /** 面对的方向度数 */ + direction: number; + } + type CompassChangeCallback = (res: CompassData) => void; + function onCompassChange(callback: CompassChangeCallback): void; + + interface SetNavigationBarTitleOptions { + /** 页面标题 */ + title?: string; + /** 成功获取系统信息的回调 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 动态设置当前页面的标题。 + */ + function setNavigationBarTitle(options: SetNavigationBarTitleOptions): void; + + /** + * 在当前页面显示导航条加载动画。 + */ + function showNavigationBarLoading(): void; + /** + * 隐藏导航条加载动画。 + */ + function hideNavigationBarLoading(): void; + + interface NavigateToOptions { + /** 需要跳转的应用内页面的路径 */ + url: string; + /** 成功获取系统信息的回调 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。 + * + * 注意:为了不让用户在使用小程序时造成困扰, + * 我们规定页面路径只能是五层,请尽量避免多层级的交互方式。 + */ + function navigateTo(options: NavigateToOptions): void; + + interface RedirectToOptions { + /** 需要跳转的应用内页面的路径 */ + url: string; + /** 成功获取系统信息的回调 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 关闭当前页面,跳转到应用内的某个页面。 + */ + function redirectTo(options: RedirectToOptions): void; + + /** + * 关闭当前页面,回退前一页面。 + */ + function navigateBack(): void; + + type TimingFunction = 'linear' | 'ease' | 'ease-in' | 'ease-in-out' | 'ease-out' | 'step-start' | 'step-end'; + + interface CreateAnimationOptions { + /** 动画持续时间,单位ms,默认值 400 */ + duration?: number; + /** 定义动画的效果,默认值"linear",有效值:"linear","ease","ease-in","ease-in-out","ease-out","step-start","step-end" */ + timingFunction?: TimingFunction; + /** 动画持续时间,单位 ms,默认值 0 */ + delay?: number; + /** 设置transform-origin,默认为"50% 50% 0" */ + transformOrigin?: string; + } + + interface Animator { + actions: Array; + } + interface AnimationAction { + animates: Array; + option: AnimationActionOption; + } + interface AnimationActionOption { + transformOrigin: string; + transition: AnimationTransition; + } + interface AnimationTransition { + delay: number; + duration: number; + timingFunction: TimingFunction; + } + interface Animate { + type: string; + args: Array; + } + + /** + * 创建一个动画实例animation。调用实例的方法来描述动画。 + * 最后通过动画实例的export方法导出动画数据传递给组件的animation属性。 + * + * 注意: export 方法每次调用后会清掉之前的动画操作 + */ + function createAnimation(options?: CreateAnimationOptions): Animation; + /** 动画实例可以调用以下方法来描述动画,调用结束后会返回自身,支持链式调用的写法。 */ + interface Animation { + /** + * 调用动画操作方法后要调用 step() 来表示一组动画完成, + * 可以在一组动画中调用任意多个动画方法, + * 一组动画中的所有动画会同时开始, + * 一组动画完成后才会进行下一组动画。 + * @param {CreateAnimationOptions} options 指定当前组动画的配置 + */ + step(options?: CreateAnimationOptions): void; + /** + * 导出动画操作 + * + * 注意: export 方法每次调用后会清掉之前的动画操作 + */ + export(): Animator; + + /** 透明度,参数范围 0~1 */ + opacity(value: number): Animation; + /** 颜色值 */ + backgroundColor(color: string): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + width(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + height(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + top(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + left(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + bottom(length: number): Animation; + /** 长度值,如果传入 Number 则默认使用 px,可传入其他自定义单位的长度值 */ + right(length: number): Animation; + + /** deg的范围-180~180,从原点顺时针旋转一个deg角度 */ + rotate(deg: number): Animation; + /** deg的范围-180~180,在X轴旋转一个deg角度 */ + rotateX(deg: number): Animation; + /** deg的范围-180~180,在Y轴旋转一个deg角度 */ + rotateY(deg: number): Animation; + /** deg的范围-180~180,在Z轴旋转一个deg角度 */ + rotateZ(deg: number): Animation; + /** 同transform-function rotate3d */ + rotate3d(x: number, y: number, z: number, deg: number): Animation; + + /** + * 一个参数时,表示在X轴、Y轴同时缩放sx倍数; + * 两个参数时表示在X轴缩放sx倍数,在Y轴缩放sy倍数 + */ + scale(sx: number, sy?: number): Animation; + /** 在X轴缩放sx倍数 */ + scaleX(sx: number): Animation; + /** 在Y轴缩放sy倍数 */ + scaleY(sy: number): Animation; + /** 在Z轴缩放sy倍数 */ + scaleZ(sz: number): Animation; + /** 在X轴缩放sx倍数,在Y轴缩放sy倍数,在Z轴缩放sz倍数 */ + scale3d(sx: number, sy: number, sz: number): Animation; + + /** + * 一个参数时,表示在X轴偏移tx,单位px; + * 两个参数时,表示在X轴偏移tx,在Y轴偏移ty,单位px。 + */ + translate(tx: number, ty?: number): Animation; + /** + * 在X轴偏移tx,单位px + */ + translateX(tx: number): Animation; + /** + * 在Y轴偏移tx,单位px + */ + translateY(ty: number): Animation; + /** + * 在Z轴偏移tx,单位px + */ + translateZ(tz: number): Animation; + /** + * 在X轴偏移tx,在Y轴偏移ty,在Z轴偏移tz,单位px + */ + translate3d(tx: number, ty: number, tz: number): Animation; + + /** + * 参数范围-180~180; + * 一个参数时,Y轴坐标不变,X轴坐标延顺时针倾斜ax度; + * 两个参数时,分别在X轴倾斜ax度,在Y轴倾斜ay度 + */ + skew(ax: number, ay?: number): Animation; + /** 参数范围-180~180;Y轴坐标不变,X轴坐标延顺时针倾斜ax度 */ + skewX(ax: number): Animation; + /** 参数范围-180~180;X轴坐标不变,Y轴坐标延顺时针倾斜ay度 */ + skewY(ay: number): Animation; + + /** + * 同transform-function matrix + */ + matrix(a: number, b: number, c: number, d: number, tx: number, ty: number): Animation; + /** 同transform-function matrix3d */ + matrix3d(a1: number, b1: number, c1: number, d1: number, a2: number, b2: number, c2: number, d2: number, a3: number, b3: number, c3: number, d3: number, a4: number, b4: number, c4: number, d4: number): Animation; + } + + interface CanvasAction { + method: string; + data: Array | Array + } + type LineCapType = 'butt' | 'round' | 'square'; + type LineJoinType = 'bevel' | 'round' | 'miter'; + /** + * context只是一个记录方法调用的容器,用于生成记录绘制行为的actions数组。context跟不存在对应关系,一个context生成画布的绘制动作数组可以应用于多个。 + */ + interface CanvasContext { + /** 获取当前context上存储的绘图动作 */ + getActions(): Array + /** 清空当前的存储绘图动作 */ + clearActions(): void; + /** + * 对横纵坐标进行缩放 + * 在调用scale方法后,之后创建的路径其横纵坐标会被缩放。 + * 多次调用scale,倍数会相乘。 + * + * @param {number} scaleWidth 横坐标缩放的倍数 + * @param {number} scaleHeight 纵坐标轴缩放的倍数 + */ + scale(scaleWidth: number, scaleHeight?: number): void; + /** + * 对坐标轴进行顺时针旋转 + * 以原点为中心,原点可以用 translate方法修改。 + * 顺时针旋转当前坐标轴。多次调用rotate,旋转的角度会叠加。 + * + * @param {number} rotate 旋转角度,以弧度计。 + */ + rotate(rotate: number): void; + /** + * 对坐标原点进行缩放 + * 对当前坐标系的原点(0, 0)进行变换,默认的坐标系原点为页面左上角。 + * + * @param {number} x 水平坐标平移量 + * @param {number} y 竖直坐标平移量 + */ + translate(x: number, y: number): void; + /** + * 保存当前坐标轴的缩放、旋转、平移信息 + */ + save(): void; + /** + * 恢复之前保存过的坐标轴的缩放、旋转、平移信息 + */ + restore(): void; + /** + * 在给定的矩形区域内,清除画布上的像素 + * 清除画布上在该矩形区域内的内容。 + * + * @param {number} x 矩形区域左上角的x坐标 + * @param {number} y 矩形区域左上角的y坐标 + * @param {number} width 矩形区域的宽度 + * @param {number} height 矩形区域的高度 + */ + clearRect(x: number, y: number, width: number, height: number): void; + /** + * 在画布上绘制被填充的文本 + * + * @param {string} text 在画布上输出的文本 + * @param {number} x 绘制文本的左上角x坐标位置 + * @param {number} y 绘制文本的左上角y坐标位置 + */ + fillText(text: string, x: number, y: number): void; + /** + * 在画布上绘制图像 + * 绘制图像,图像保持原始尺寸。 + * + * @param {string} imageResource 所要绘制的图片资源。 通过chooseImage得到一个文件路径或者一个项目目录内的图片 + * @param {number} x 图像左上角的x坐标 + * @param {number} y 图像左上角的y坐标 + */ + drawImage(imageResource: string, x: number, y: number): void; + /** + * 对当前路径进行填充 + */ + fill(): void; + /** + * 对当前路径进行描边 + */ + stroke(): void; + /** + * 开始一个路径 + * 开始创建一个路径,需要调用fill或者stroke才会使用路径进行填充或描边。 + * 同一个路径内的多次setFillStyle、setStrokeStyle、setLineWidth等设置, + * 以最后一次设置为准。 + */ + beginPath(): void; + /** + * 关闭一个路径 + */ + closePath(): void; + /** + * 把路径移动到画布中的指定点,但不创建线条。 + * + * @param {number} x 目标位置的x坐标 + * @param {number} y 目标位置的y坐标 + */ + moveTo(x: number, y: number): void; + /** + * 在当前位置添加一个新点,然后在画布中创建从该点到最后指定点的路径。 + * + * @param {number} x 目标位置的x坐标 + * @param {number} y 目标位置的y坐标 + */ + lineTo(x: number, y: number): void; + /** + * 添加一个矩形路径到当前路径。 + * + * @param {number} x 矩形路径左上角的x坐标 + * @param {number} y 矩形路径左上角的y坐标 + * @param {number} width 矩形路径的宽度 + * @param {number} height 矩形路径的高度 + */ + rect(x: number, y: number, width: number, height: number): void; + /** + * 添加一个弧形路径到当前路径,顺时针绘制。 + * + * @param {number} x 矩形路径左上角的x坐标 + * @param {number} y 矩形路径左上角的y坐标 + * @param {number} radius 矩形路径左上角的y坐标 + * @param {number} startAngle 起始弧度 + * @param {number} endAngle 结束弧度 + * @param {boolean} sweepAngle 从起始弧度开始,扫过的弧度 + */ + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, sweepAngle: boolean): void; + /** + * 创建二次方贝塞尔曲线 + * + * @param {number} cpx 贝塞尔控制点的x坐标 + * @param {number} cpy 贝塞尔控制点的y坐标 + * @param {number} x 结束点的x坐标 + * @param {number} y 结束点的y坐标 + */ + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + /** + * 创建三次方贝塞尔曲线 + * + * @param {number} cp1x 第一个贝塞尔控制点的 x 坐标 + * @param {number} cp1y 第一个贝塞尔控制点的 y 坐标 + * @param {number} cp2x 第二个贝塞尔控制点的 x 坐标 + * @param {number} cp2y 第二个贝塞尔控制点的 y 坐标 + * @param {number} x 结束点的x坐标 + * @param {number} y 结束点的y坐标 + */ + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + /** + * 设置填充样式 + * + * @param {string} color 设置为填充样式的颜色。'rgb(255, 0, 0)'或'rgba(255, 0, 0, 0.6)'或'#ff0000'格式的颜色字符串 + */ + setFillStyle(color: string): void; + /** + * 设置线条样式 + * + * @param {string} color 设置为填充样式的颜色。'rgb(255, 0, 0)'或'rgba(255, 0, 0, 0.6)'或'#ff0000'格式的颜色字符串 + */ + setStrokeStyle(color: string): void; + /** + * 设置阴影 + * + * @param {number} offsetX 阴影相对于形状在水平方向的偏移 + * @param {number} offsetY 阴影相对于形状在竖直方向的偏移 + * @param {number} blur 阴影的模糊级别,数值越大越模糊 0~100 + * @param {string} color 阴影的颜色。 'rgb(255, 0, 0)'或'rgba(255, 0, 0, 0.6)'或'#ff0000'格式的颜色字符串 + */ + setShadow(offsetX: number, offsetY: number, blur: number, color: string): void; + /** + * 设置字体大小 + * + * @param {number} fontSize 字体的字号 + */ + setFontSize(fontSize: number): void; + /** + * 设置线条端点的样式 + * + * @param {LineCapType} lineCap 线条的结束端点样式。 'butt'、'round'、'square' + */ + setLineCap(lineCap: LineCapType): void; + /** + * 设置两线相交处的样式 + * @param {LineJoinType} lineJoin 两条线相交时,所创建的拐角类型 + */ + setLineJoin(lineJoin: LineJoinType): void; + /** + * 设置线条宽度 + * + * @param {number} lineWidth 线条的宽度 + */ + setLineWidth(lineWidth: number): void; + /** 设置最大斜接长度,斜接长度指的是在两条线交汇处内角和外角之间的距离。 + * 当 setLineJoin为 miter 时才有效。 + * 超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示 + * + * @param {number} miterLimit 最大斜接长度 + */ + setMiterLimit(miterLimit: number): void; + } + /** + * 创建并返回绘图上下文context对象。 + * context只是一个记录方法调用的容器, + * 用于生成记录绘制行为的actions数组。c + * ontext跟不存在对应关系, + * 一个context生成画布的绘制动作数组可以应用于多个。 + */ + function createContext(): CanvasContext; + + interface DrawCanvasOptions { + /** 画布标识,传入 的 cavas-id */ + canvasId: number | string; + /** + * 绘图动作数组,由 wx.createContext 创建的 context, + * 调用 getActions 方法导出绘图动作数组。 + */ + actions: Array; + } + /** + * 绘制画布 + */ + function drawCanvas(options: DrawCanvasOptions): void; + + /** + * 收起键盘。 + */ + function hideKeyboard(): void; + + interface LoginResponse { + /** 调用结果 */ + errMsg: string; + /** 用户允许登录后,回调内容会带上 code(有效期五分钟), + * 开发者需要将 code 发送到开发者服务器后台, + * 使用code 换取 session_key api, + * 将 code 换成 openid 和 session_key */ + code: string; + } + interface LoginOptions { + /** 接口调用成功的回调函数 */ + success?: (res: LoginResponse) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + + /** + * 调用接口获取登录凭证(code)进而换取用户登录态信息, + * 包括用户的唯一标识(openid) 及本次登录的 会话密钥(session_key)。 + * 用户数据的加解密通讯需要依赖会话密钥完成。 + */ + function login(option: LoginOptions): void; + + interface UserInfo { + nickName: string; + avatarUrl: string; + gender: number; + province: string; + city: string; + country: string; + } + interface UserInfoResponse { + /** 用户信息对象,不包含 openid 等敏感信息 */ + userInfo: UserInfo; + /** 不包括敏感信息的原始数据字符串,用于计算签名。 */ + rawData: string; + /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息。 */ + signature: string; + /** 包括敏感数据在内的完整用户信息的加密数据,详细见加密数据解密算法 */ + encryptData: string; + } + interface GetUserInfoOptions { + /** 接口调用成功的回调函数 */ + success?: (res: UserInfoResponse) => void; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 获取用户信息,需要先调用 wx.login 接口。 + */ + function getUserInfo(options: GetUserInfoOptions): void; + + type PaymentSignType = 'MD5'; + interface RequestPaymentOptions { + /** 时间戳从1970年1月1日00:00:00至今的秒数,即当前的时间 */ + timeStamp: string|number; + /** 随机字符串,长度为32个字符以下。 */ + nonceStr: string; + /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=* */ + package: string; + /** 签名算法,暂支持 MD5 */ + signType: PaymentSignType; + /** 签名,具体签名方案参见微信公众号支付帮助文档; */ + paySign: string; + /** 接口调用成功的回调函数 */ + success?: ResponseCallback; + /** 接口调用失败的回调函数 */ + fail?: ResponseCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ResponseCallback; + } + /** + * 发起微信支付。 + */ + function requestPayment(options: RequestPaymentOptions): void; +} + + +interface Page { + /** + * setData 函数用于将数据从逻辑层发送到视图层, + * 同时改变对应的 this.data 的值。 + * 注意: + * 1. 直接修改 this.data 无效,无法改变页面的状态,还会造成数据不一致。 + * 2. 单次设置的数据不能超过1024kB,请尽量避免一次设置过多的数据。 + */ + setData(data: any): void; +} +interface PageConstructor { + /** + * Page() 函数用来注册一个页面。 + * 接受一个 object 参数,其指定页面的初始数据、生命周期函数、事件处理函数等。 + */ + (options: wx.PageOptions): void; +} +declare var Page: PageConstructor; + + +interface App { + /** + * getCurrentPage() 函数用户获取当前页面的实例。 + */ + getCurrentPage(): Page; +} +interface AppConstructor { + /** + * App() 函数用来注册一个小程序。 + * 接受一个 object 参数,其指定小程序的生命周期函数等。 + */ + (options: wx.AppOptions): void; +} +declare var App: AppConstructor; + +/** + * 我们提供了全局的 getApp() 函数,可以获取到小程序实例。 + */ +declare function getApp(): App; From 727c305d5e32c5dec79b8f407013aad6d8cf4abd Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 28 Sep 2016 11:11:29 -0400 Subject: [PATCH 38/41] Added more methods to Turf (#11558) * Added more methods to Turf - circle - geojsonType - propReduce - coordAll - tesselate * Replace Object with GeoJSON --- turf/turf-tests.ts | 20 +++++- turf/turf.d.ts | 166 ++++++++++++++++++++++++++++++++------------- 2 files changed, 139 insertions(+), 47 deletions(-) diff --git a/turf/turf-tests.ts b/turf/turf-tests.ts index 31462adc51..0e887e2e3e 100644 --- a/turf/turf-tests.ts +++ b/turf/turf-tests.ts @@ -499,8 +499,26 @@ turf.collect(polygons, points, 'population', 'values') /////////////////////////////////////////// // Tests Assertions /////////////////////////////////////////// +// -- Test bbox -- turf.bbox(polygon1) turf.bbox(point1) turf.bbox(lineString1) turf.bbox(multiLineString1) -turf.bbox(multiPolygon1) \ No newline at end of file +turf.bbox(multiPolygon1) + +// -- Test circle -- +turf.circle(point1, 10) +turf.circle(point1, 10, 32) +turf.circle(point1, 10, 64, 'miles') + +// -- Test geojsonType -- +turf.geojsonType(point1, 'point', 'Test') + +// -- Test propReduce -- +turf.propReduce(point1, (memo, coord) => {}, 'point') + +// -- Test coordAll -- +turf.coordAll(polygon1) + +// -- Test tesselate -- +turf.tesselate(polygon1) \ No newline at end of file diff --git a/turf/turf.d.ts b/turf/turf.d.ts index e90cf69276..773802a103 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -80,16 +80,22 @@ ASSERTIONS - [ ] featureOf - [ ] collectionOf - [x] bbox -- [ ] circle -- [ ] geojsonType -- [ ] propReduce -- [ ] coordAll -- [ ] tesselate +- [x] circle +- [x] geojsonType +- [x] propReduce +- [x] coordAll +- [x] tesselate */ declare const turf: turf.TurfStatic; declare const TemplateUnits: 'miles' | 'nauticalmiles' | 'degrees' | 'radians' | 'inches' | 'yards' | 'meters' | 'metres' | 'kilometers' | 'kilometres' declare const TemplateType: 'point'| 'points' | 'polygon' | 'polygons' +declare interface OptionsRandom { + bbox?: Array + num_vertices?: number + max_radial_length?: number +} +declare type PropReduceCallback = (memo: any, coord: GeoJSON.Feature | GeoJSON.FeatureCollection) => any declare module turf { interface TurfStatic { ////////////////////////////////////////////////////// @@ -169,11 +175,79 @@ declare module turf { * var bboxPolygon = turf.bboxPolygon(bbox); * * //=bbox - * + * * //=bboxPolygon */ bbox(bbox: GeoJSON.Feature | GeoJSON.FeatureCollection): Array; + /** + * Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision. + * + * @name circle + * @param {Feature} center center point + * @param {number} radius radius of the circle + * @param {number} [steps=64] number of steps + * @param {string} [units=kilometers] miles, kilometers, degrees, or radians + * @returns {Feature} circle polygon + * @example + * var center = point([-75.343, 39.984]); + * var radius = 5; + * var steps = 10; + * var units = 'kilometers'; + * + * var circle = turf.circle(center, radius, steps, units); + * + * //=circle + */ + circle(center: GeoJSON.Feature, radius: number, steps?: number, units?: typeof TemplateUnits): GeoJSON.Feature; + + + /** + * Enforce expectations about types of GeoJSON objects for Turf. + * + * @name geojsonType + * @param {GeoJSON} value any GeoJSON object + * @param {string} type expected GeoJSON type + * @param {string} name name of calling function + * @throws {Error} if value is not the expected type. + */ + geojsonType(value: GeoJSON.Feature | GeoJSON.FeatureCollection, type: string, name: string): void + + /** + * Reduce properties in any GeoJSON object into a single value, similar to how Array.reduce works. However, in this case we lazily run the reduction, so an array of all properties is unnecessary. + * + * @name propReduce + * @param {GeoJSON} layer any GeoJSON object + * @param {Function} callback a method that takes (memo, coord) and returns a new memo + * @param {*} memo the starting value of memo: can be any type. + * @return {*} combined value + */ + propReduce(layer: GeoJSON.Feature | GeoJSON.FeatureCollection, callback: PropReduceCallback, memo: any): any + + /** + * Get all coordinates from any GeoJSON object, returning an array of coordinate arrays. + * + * @name coordAll + * @param {GeoJSON} layer any GeoJSON object + * @returns {Array>} coordinate position array + */ + coordAll(layer: GeoJSON.Feature | GeoJSON.FeatureCollection): Array> + + /** + * Tesselates a {@link Feature} into a {@link FeatureCollection} of triangles using [earcut](https://github.com/mapbox/earcut). + * + * @name tesselate + * @param {Feature} polygon the polygon to tesselate + * @returns {FeatureCollection} a geometrycollection feature + * @example + * var polygon = turf.random('polygon').features[0]; + * + * var triangles = turf.tesselate(polygon); + * + * //=triangles + */ + tesselate(poly: GeoJSON.Feature): GeoJSON.FeatureCollection + /** * Takes a bbox and returns an equivalent polygon. * @param bbox An Array of bounding box coordinates in the form: [xLow, yLow, xHigh, yHigh] @@ -298,7 +372,7 @@ declare module turf { */ buffer(feature: GeoJSON.Feature, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature; buffer(feature: GeoJSON.Feature, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature; - buffer(feature: GeoJSON.Feature, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature; + buffer(feature: GeoJSON.Feature, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature; buffer(feature: GeoJSON.Feature, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature; buffer(feature: GeoJSON.FeatureCollection, distance: number, units?: typeof TemplateUnits): GeoJSON.FeatureCollection; buffer(feature: GeoJSON.FeatureCollection, distance: number, units?: typeof TemplateUnits): GeoJSON.FeatureCollection; @@ -343,7 +417,7 @@ declare module turf { * If they share a border, returns the border if they don't intersect, returns undefined. * * @name [intersect](http://turfjs.org/docs/#intersect) - * @param {Feature} poly1 + * @param {Feature} poly1 * @param {Feature} poly2 * @returns {Feature|undefined} A feature representing the point(s) they share (in case of a {Point} or {MultiPoint}), the borders they share (in case of a {LineString} or a {MultiLineString}), the area they share (in case of {Polygon} or {MultiPolygon}). If they do not share any point, returns `undefined`. * @example @@ -456,7 +530,7 @@ declare module turf { /** * Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}. - * + * * @name [featureCollection](http://turfjs.org/docs/#featurecollection) * @param {Feature[]} features input features * @returns {FeatureCollection} a FeatureCollection of input features @@ -497,7 +571,7 @@ declare module turf { /** * Creates a {@link LineString} based on a coordinate array. Properties can be added optionally. - * + * * @name [lineString](http://turfjs.org/docs/#linestring) * @param {Array>} coordinates an array of Positions * @param {Object=} properties an Object of key-value pairs to add as properties @@ -525,7 +599,7 @@ declare module turf { /** * Creates a {@link Feature} based on a coordinate array. Properties can be added optionally. - * + * * @name [multiLineString](http://turfjs.org/docs/#multilinestring) * @param {Array>>} coordinates an array of LineStrings * @param {Object=} properties an Object of key-value pairs to add as properties @@ -541,7 +615,7 @@ declare module turf { /** * Takes coordinates and properties (optional) and returns a new {@link Point} feature. - * + * * @name [point](http://turfjs.org/docs/#point) * @param {Array} coordinates longitude, latitude position (each in decimal degrees) * @param {Object=} properties an Object that is used as the {@link Feature}'s @@ -556,7 +630,7 @@ declare module turf { /** * Creates a {@link Feature} based on a coordinate array. Properties can be added optionally. - * + * * @name [multiPoint](http://turfjs.org/docs/#multipoint) * @param {Array>} coordinates an array of Positions * @param {Object=} properties an Object of key-value pairs to add as properties @@ -572,7 +646,7 @@ declare module turf { /** * Takes an array of LinearRings and optionally an {@link Object} with properties and returns a {@link Polygon} feature. - * + * * @name [polygon](http://turfjs.org/docs/#polygon) * @param {Array>>} coordinates an array of LinearRings * @param {Object=} properties a properties object @@ -595,7 +669,7 @@ declare module turf { /** * Creates a {@link Feature} based on a coordinate array. Properties can be added optionally. - * + * * @name [multiPolygon](http://turfjs.org/docs/#multipolygon) * @param {Array>>>} coordinates an array of Polygons * @param {Object=} properties an Object of key-value pairs to add as properties @@ -664,15 +738,15 @@ declare module turf { * * //=polygons */ - random(type?: typeof TemplateType, count?: number, options?: { - bbox?: Array - num_vertices?: number - max_radial_length?: number - }): GeoJSON.FeatureCollection; + random(type?: 'point', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection; + random(type?: 'points', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection; + random(type?: 'polygon', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection; + random(type?: 'polygons', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection; + random(type?: typeof TemplateType, count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection; /** * Takes a {@link FeatureCollection} and returns a FeatureCollection with given number of {@link Feature|features} at random. - * + * * @name [sample](http://turfjs.org/docs/#sample) * @param {FeatureCollection} featurecollection set of input features * @param {number} num number of features to select @@ -694,7 +768,7 @@ declare module turf { /** * Takes a bounding box and a cell size in degrees and returns a {@link FeatureCollection} of flat-topped hexagons ({@link Polygon} features) aligned in an "odd-q" vertical grid as described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/). - * + * * @name [hexGrid](http://turfjs.org/docs/#hexgrid) * @param {Array} bbox bounding box in [minX, minY, maxX, maxY] order * @param {number} cellSize dimension of cell in specified units @@ -737,7 +811,7 @@ declare module turf { pointGrid( bbox: Array, cellSize: number, - units?: typeof TemplateUnits + units?: typeof TemplateUnits ): GeoJSON.FeatureCollection; /** @@ -835,7 +909,7 @@ declare module turf { * var poly = polygon([[[-81, 41], [-81, 47], [-72, 47], [-72, 41], [-81, 41]]]) * * var isInside = turf.inside(pt, poly) - * + * * //=isInside */ inside( @@ -857,10 +931,10 @@ declare module turf { * var pt2 = point([-77, 38]) * var poly1 = polygon([[[-81, 41], [-81, 47], [-72, 47], [-72, 41], [-81, 41]]], {pop: 1000}) * var poly2 = polygon([[[-81, 35], [-81, 41], [-72, 41], [-72, 35], [-81, 35]]], {pop: 3000}) - * + * * var points = featureCollection([pt1, pt2]) * var polygons = featureCollection([poly1, poly2]) - * + * * var tagged = turf.tag(points, polygons, 'pop', 'population') * //=tagged */ @@ -1181,27 +1255,27 @@ declare module "@turf/bbox" { export = bbox; } -// declare module "@turf/circle" { -// const circle: typeof turf.circle; -// export = circle; -// } +declare module "@turf/circle" { + const circle: typeof turf.circle; + export = circle; +} -// declare module "@turf/geojsonType" { -// const geojsonType: typeof turf.geojsonType; -// export = geojsonType; -// } +declare module "@turf/geojsonType" { + const geojsonType: typeof turf.geojsonType; + export = geojsonType; +} -// declare module "@turf/propReduce" { -// const propReduce: typeof turf.propReduce; -// export = propReduce; -// } +declare module "@turf/propReduce" { + const propReduce: typeof turf.propReduce; + export = propReduce; +} -// declare module "@turf/coordAll" { -// const coordAll: typeof turf.coordAll; -// export = coordAll; -// } +declare module "@turf/coordAll" { + const coordAll: typeof turf.coordAll; + export = coordAll; +} -// declare module "@turf/tesselate" { -// const tesselate: typeof turf.tesselate; -// export = tesselate; -// } +declare module "@turf/tesselate" { + const tesselate: typeof turf.tesselate; + export = tesselate; +} From a4a33e265cf12ce775a9a0e54897fdabf2f6b3ce Mon Sep 17 00:00:00 2001 From: Artur Eshenbrener Date: Wed, 28 Sep 2016 19:20:57 +0300 Subject: [PATCH 39/41] [bluebird] document .suppressUnhandledRejections http://bluebirdjs.com/docs/api/suppressunhandledrejections.html --- bluebird/bluebird.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 35b506542a..3dc66b78f0 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -317,6 +317,13 @@ class Bluebird implements Bluebird.Thenable, Bluebird.Inspection { */ cancel(): void; + /** + * Basically sugar for doing: somePromise.catch(function(){}); + * + * Which is needed in case error handlers are attached asynchronously to the promise later, which would otherwise result in premature unhandled rejection reporting. + */ + suppressUnhandledRejections(): void; + /** * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. * From b8abf4a0e491270df1369d953fdb0af63379947f Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Wed, 28 Sep 2016 12:20:33 -0700 Subject: [PATCH 40/41] Add typings for shallowequal. --- shallowequal/shallowequal-tests.ts | 12 ++++++++++++ shallowequal/shallowequal.d.ts | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 shallowequal/shallowequal-tests.ts create mode 100644 shallowequal/shallowequal.d.ts diff --git a/shallowequal/shallowequal-tests.ts b/shallowequal/shallowequal-tests.ts new file mode 100644 index 0000000000..73c644c770 --- /dev/null +++ b/shallowequal/shallowequal-tests.ts @@ -0,0 +1,12 @@ +/// + +import shallowEqual = require('shallowequal'); + +const a = {}, b = {}; +function compare(a: any, b: any, indexOrKey?: number | string) { + return false; +} + +shallowEqual(a, b); +shallowEqual(a, b, compare); +shallowEqual(a, b, compare, {}); diff --git a/shallowequal/shallowequal.d.ts b/shallowequal/shallowequal.d.ts new file mode 100644 index 0000000000..d3971e15c9 --- /dev/null +++ b/shallowequal/shallowequal.d.ts @@ -0,0 +1,9 @@ +// Type definitions for shallowequal v0.2.2 +// Project: https://github.com/dashed/shallowequal +// Definitions by: Sean Kelley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'shallowequal' { + function shallowEqual(objA: any, objB: any, compare?: (objA: any, objB: any, indexOrKey?: number | string) => boolean, compareContext?: any): boolean; + export = shallowEqual; +} From cfdd3db404999e24047ccd0d74a71c411f02ca3b Mon Sep 17 00:00:00 2001 From: Matt Rohr Date: Wed, 28 Sep 2016 17:33:47 -0400 Subject: [PATCH 41/41] URIjs fix .joinPaths() the .joinPaths function is on URIStatic, not an instance of URI https://medialize.github.io/URI.js/docs.html#static-joinPaths --- urijs/URIjs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/urijs/URIjs.d.ts b/urijs/URIjs.d.ts index 8d784ad1ac..79a65dbb55 100644 --- a/urijs/URIjs.d.ts +++ b/urijs/URIjs.d.ts @@ -52,8 +52,6 @@ declare namespace uri { is(qry: string): boolean; iso8859(): URI; - joinPaths(...paths: (string | URI)[]): URI; - normalize(): URI; normalizeFragment(): URI; normalizeHash(): URI; @@ -190,6 +188,8 @@ declare namespace uri { expand(template: string, vals: Object): URI; iso8859(): void; + + joinPaths(...paths: (string | URI)[]): URI; parse(url: string): { protocol: string;